summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml8
-rw-r--r--SConstruct484
-rw-r--r--core/SCsub111
-rw-r--r--core/array.cpp4
-rw-r--r--core/bind/SCsub2
-rw-r--r--core/bind/core_bind.cpp38
-rw-r--r--core/bind/core_bind.h2
-rw-r--r--core/callable.cpp2
-rw-r--r--core/class_db.cpp81
-rw-r--r--core/class_db.h20
-rw-r--r--core/command_queue_mt.cpp2
-rw-r--r--core/command_queue_mt.h8
-rw-r--r--core/core_builders.py139
-rw-r--r--core/core_string_names.cpp2
-rw-r--r--core/core_string_names.h2
-rw-r--r--core/cowdata.h12
-rw-r--r--core/crypto/SCsub8
-rw-r--r--core/crypto/crypto.cpp18
-rw-r--r--core/crypto/crypto.h2
-rw-r--r--core/crypto/hashing_context.cpp16
-rw-r--r--core/debugger/SCsub2
-rw-r--r--core/debugger/debugger_marshalls.cpp2
-rw-r--r--core/debugger/engine_debugger.cpp10
-rw-r--r--core/debugger/engine_debugger.h14
-rw-r--r--core/debugger/local_debugger.cpp2
-rw-r--r--core/debugger/local_debugger.h2
-rw-r--r--core/debugger/remote_debugger.cpp4
-rw-r--r--core/debugger/remote_debugger.h8
-rw-r--r--core/debugger/remote_debugger_peer.cpp4
-rw-r--r--core/debugger/remote_debugger_peer.h2
-rw-r--r--core/debugger/script_debugger.h2
-rw-r--r--core/dictionary.cpp14
-rw-r--r--core/dictionary.h2
-rw-r--r--core/engine.cpp6
-rw-r--r--core/engine.h2
-rw-r--r--core/error_macros.cpp4
-rw-r--r--core/hash_map.h52
-rw-r--r--core/image.cpp54
-rw-r--r--core/image.h2
-rw-r--r--core/input/SCsub16
-rw-r--r--core/input/input_builders.py20
-rw-r--r--core/input/input_event.cpp28
-rw-r--r--core/input/input_filter.cpp6
-rw-r--r--core/input/input_map.cpp20
-rw-r--r--core/input/input_map.h4
-rw-r--r--core/io/SCsub2
-rw-r--r--core/io/config_file.cpp2
-rw-r--r--core/io/dtls_server.cpp2
-rw-r--r--core/io/file_access_compressed.cpp16
-rw-r--r--core/io/file_access_encrypted.cpp10
-rw-r--r--core/io/file_access_memory.cpp10
-rw-r--r--core/io/file_access_network.cpp8
-rw-r--r--core/io/file_access_pack.cpp6
-rw-r--r--core/io/file_access_pack.h4
-rw-r--r--core/io/file_access_zip.cpp26
-rw-r--r--core/io/image_loader.cpp2
-rw-r--r--core/io/image_loader.h4
-rw-r--r--core/io/ip.cpp10
-rw-r--r--core/io/logger.cpp4
-rw-r--r--core/io/marshalls.cpp6
-rw-r--r--core/io/marshalls.h2
-rw-r--r--core/io/multiplayer_api.cpp28
-rw-r--r--core/io/net_socket.cpp4
-rw-r--r--core/io/packet_peer.cpp4
-rw-r--r--core/io/packet_peer_dtls.cpp2
-rw-r--r--core/io/pck_packer.cpp8
-rw-r--r--core/io/resource_format_binary.cpp6
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_importer.cpp6
-rw-r--r--core/io/resource_importer.h6
-rw-r--r--core/io/resource_loader.cpp16
-rw-r--r--core/io/resource_loader.h8
-rw-r--r--core/io/resource_saver.cpp4
-rw-r--r--core/io/stream_peer.cpp4
-rw-r--r--core/io/stream_peer_ssl.cpp4
-rw-r--r--core/io/translation_loader_po.h4
-rw-r--r--core/io/xml_parser.cpp8
-rw-r--r--core/io/zip_io.cpp4
-rw-r--r--core/list.h32
-rw-r--r--core/make_binders.py48
-rw-r--r--core/map.h44
-rw-r--r--core/math/SCsub2
-rw-r--r--core/math/a_star.cpp8
-rw-r--r--core/math/aabb.h4
-rw-r--r--core/math/expression.cpp80
-rw-r--r--core/math/expression.h4
-rw-r--r--core/math/geometry.h4
-rw-r--r--core/math/octree.h52
-rw-r--r--core/math/quick_hull.cpp6
-rw-r--r--core/math/quick_hull.h8
-rw-r--r--core/math/rect2.h2
-rw-r--r--core/message_queue.cpp12
-rw-r--r--core/method_bind.cpp2
-rw-r--r--core/method_bind.h2
-rw-r--r--core/node_path.cpp12
-rw-r--r--core/oa_hash_map.h10
-rw-r--r--core/object.cpp38
-rw-r--r--core/object.h26
-rw-r--r--core/ordered_hash_map.h24
-rw-r--r--core/os/SCsub2
-rw-r--r--core/os/dir_access.cpp10
-rw-r--r--core/os/dir_access.h4
-rw-r--r--core/os/file_access.cpp12
-rw-r--r--core/os/file_access.h8
-rw-r--r--core/os/keyboard.cpp2
-rw-r--r--core/os/memory.cpp12
-rw-r--r--core/os/midi_driver.cpp2
-rw-r--r--core/os/os.cpp16
-rw-r--r--core/os/os.h2
-rw-r--r--core/os/rw_lock.cpp4
-rw-r--r--core/os/thread.cpp10
-rw-r--r--core/packed_data_container.cpp4
-rw-r--r--core/packed_data_container.h4
-rw-r--r--core/pool_allocator.cpp30
-rw-r--r--core/print_string.cpp6
-rw-r--r--core/project_settings.cpp12
-rw-r--r--core/reference.h18
-rw-r--r--core/register_core_types.cpp18
-rw-r--r--core/resource.cpp20
-rw-r--r--core/resource.h2
-rw-r--r--core/rid_owner.h16
-rw-r--r--core/script_language.cpp8
-rw-r--r--core/script_language.h20
-rw-r--r--core/self_list.h22
-rw-r--r--core/set.h40
-rw-r--r--core/string_name.cpp24
-rw-r--r--core/string_name.h4
-rw-r--r--core/translation.cpp10
-rw-r--r--core/undo_redo.cpp24
-rw-r--r--core/ustring.cpp14
-rw-r--r--core/ustring.h6
-rw-r--r--core/variant.cpp24
-rw-r--r--core/variant.h16
-rw-r--r--core/variant_call.cpp10
-rw-r--r--core/variant_op.cpp10
-rw-r--r--core/variant_parser.h18
-rw-r--r--doc/classes/@GlobalScope.xml28
-rw-r--r--doc/classes/ARVRAnchor.xml2
-rw-r--r--doc/classes/ARVRCamera.xml2
-rw-r--r--doc/classes/ARVRController.xml2
-rw-r--r--doc/classes/ARVROrigin.xml2
-rw-r--r--doc/classes/ARVRServer.xml2
-rw-r--r--doc/classes/AcceptDialog.xml11
-rw-r--r--doc/classes/AnimatedSprite2D.xml (renamed from doc/classes/AnimatedSprite.xml)4
-rw-r--r--doc/classes/AnimatedTexture.xml4
-rw-r--r--doc/classes/Area3D.xml (renamed from doc/classes/Area.xml)36
-rw-r--r--doc/classes/ArrayMesh.xml4
-rw-r--r--doc/classes/AudioStreamPlayer3D.xml2
-rw-r--r--doc/classes/BaseMaterial3D.xml4
-rw-r--r--doc/classes/BoneAttachment3D.xml (renamed from doc/classes/BoneAttachment.xml)4
-rw-r--r--doc/classes/BoxShape3D.xml (renamed from doc/classes/BoxShape.xml)4
-rw-r--r--doc/classes/CPUParticles2D.xml4
-rw-r--r--doc/classes/CPUParticles3D.xml (renamed from doc/classes/CPUParticles.xml)26
-rw-r--r--doc/classes/Camera3D.xml (renamed from doc/classes/Camera.xml)14
-rw-r--r--doc/classes/CanvasItem.xml2
-rw-r--r--doc/classes/CanvasItemMaterial.xml6
-rw-r--r--doc/classes/CapsuleShape3D.xml (renamed from doc/classes/CapsuleShape.xml)2
-rw-r--r--doc/classes/ClippedCamera3D.xml (renamed from doc/classes/ClippedCamera.xml)12
-rw-r--r--doc/classes/CollisionObject3D.xml (renamed from doc/classes/CollisionObject.xml)20
-rw-r--r--doc/classes/CollisionPolygon3D.xml (renamed from doc/classes/CollisionPolygon.xml)4
-rw-r--r--doc/classes/CollisionShape3D.xml (renamed from doc/classes/CollisionShape.xml)8
-rw-r--r--doc/classes/ConcavePolygonShape3D.xml (renamed from doc/classes/ConcavePolygonShape.xml)6
-rw-r--r--doc/classes/ConeTwistJoint3D.xml (renamed from doc/classes/ConeTwistJoint.xml)16
-rw-r--r--doc/classes/ConfigFile.xml2
-rw-r--r--doc/classes/ConfirmationDialog.xml5
-rw-r--r--doc/classes/Control.xml198
-rw-r--r--doc/classes/ConvexPolygonShape3D.xml (renamed from doc/classes/ConvexPolygonShape.xml)4
-rw-r--r--doc/classes/Curve3D.xml6
-rw-r--r--doc/classes/CylinderShape3D.xml (renamed from doc/classes/CylinderShape.xml)2
-rw-r--r--doc/classes/DirectionalLight3D.xml (renamed from doc/classes/DirectionalLight.xml)8
-rw-r--r--doc/classes/DisplayServer.xml1059
-rw-r--r--doc/classes/EditorFeatureProfile.xml2
-rw-r--r--doc/classes/EditorFileDialog.xml17
-rw-r--r--doc/classes/EditorNode3DGizmo.xml (renamed from doc/classes/EditorSpatialGizmo.xml)20
-rw-r--r--doc/classes/EditorNode3DGizmoPlugin.xml (renamed from doc/classes/EditorSpatialGizmoPlugin.xml)42
-rw-r--r--doc/classes/EditorPlugin.xml8
-rw-r--r--doc/classes/Environment.xml8
-rw-r--r--doc/classes/FileDialog.xml20
-rw-r--r--doc/classes/GIProbe.xml4
-rw-r--r--doc/classes/GPUParticles2D.xml (renamed from doc/classes/Particles2D.xml)6
-rw-r--r--doc/classes/GPUParticles3D.xml (renamed from doc/classes/Particles.xml)6
-rw-r--r--doc/classes/Generic6DOFJoint3D.xml (renamed from doc/classes/Generic6DOFJoint.xml)26
-rw-r--r--doc/classes/GeometryInstance3D.xml (renamed from doc/classes/GeometryInstance.xml)32
-rw-r--r--doc/classes/HeightMapShape3D.xml (renamed from doc/classes/HeightMapShape.xml)4
-rw-r--r--doc/classes/HingeJoint3D.xml (renamed from doc/classes/HingeJoint.xml)12
-rw-r--r--doc/classes/ImmediateGeometry3D.xml (renamed from doc/classes/ImmediateGeometry.xml)2
-rw-r--r--doc/classes/InputDefault.xml15
-rw-r--r--doc/classes/InputEventFromWindow.xml17
-rw-r--r--doc/classes/InputEventKey.xml2
-rw-r--r--doc/classes/InputEventScreenDrag.xml2
-rw-r--r--doc/classes/InputEventScreenTouch.xml2
-rw-r--r--doc/classes/InputEventWithModifiers.xml2
-rw-r--r--doc/classes/InputFilter.xml (renamed from doc/classes/Input.xml)16
-rw-r--r--doc/classes/InterpolatedCamera.xml36
-rw-r--r--doc/classes/Joint3D.xml (renamed from doc/classes/Joint.xml)2
-rw-r--r--doc/classes/KinematicBody3D.xml (renamed from doc/classes/KinematicBody.xml)20
-rw-r--r--doc/classes/KinematicCollision3D.xml (renamed from doc/classes/KinematicCollision.xml)8
-rw-r--r--doc/classes/Light3D.xml (renamed from doc/classes/Light.xml)36
-rw-r--r--doc/classes/Listener3D.xml (renamed from doc/classes/Listener.xml)6
-rw-r--r--doc/classes/MainLoop.xml101
-rw-r--r--doc/classes/Material.xml2
-rw-r--r--doc/classes/MenuButton.xml4
-rw-r--r--doc/classes/Mesh.xml8
-rw-r--r--doc/classes/MeshInstance.xml74
-rw-r--r--doc/classes/MeshInstance2D.xml2
-rw-r--r--doc/classes/MeshInstance3D.xml83
-rw-r--r--doc/classes/MeshLibrary.xml4
-rw-r--r--doc/classes/MultiMesh.xml2
-rw-r--r--doc/classes/MultiMeshInstance2D.xml2
-rw-r--r--doc/classes/MultiMeshInstance3D.xml (renamed from doc/classes/MultiMeshInstance.xml)6
-rw-r--r--doc/classes/Navigation3D.xml (renamed from doc/classes/Navigation.xml)4
-rw-r--r--doc/classes/NavigationAgent3D.xml (renamed from doc/classes/NavigationAgent.xml)8
-rw-r--r--doc/classes/NavigationObstacle2D.xml2
-rw-r--r--doc/classes/NavigationObstacle3D.xml (renamed from doc/classes/NavigationObstacle.xml)8
-rw-r--r--doc/classes/NavigationRegion3D.xml (renamed from doc/classes/NavigationRegion.xml)6
-rw-r--r--doc/classes/NavigationServer2D.xml (renamed from doc/classes/Navigation2DServer.xml)4
-rw-r--r--doc/classes/NavigationServer3D.xml (renamed from doc/classes/NavigationServer.xml)4
-rw-r--r--doc/classes/Node.xml28
-rw-r--r--doc/classes/Node3D.xml (renamed from doc/classes/Spatial.xml)38
-rw-r--r--doc/classes/Node3DGizmo.xml (renamed from doc/classes/SpatialGizmo.xml)2
-rw-r--r--doc/classes/NodePath.xml34
-rw-r--r--doc/classes/OS.xml462
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/OmniLight3D.xml (renamed from doc/classes/OmniLight.xml)6
-rw-r--r--doc/classes/Panel.xml10
-rw-r--r--doc/classes/ParticlesMaterial.xml6
-rw-r--r--doc/classes/Path3D.xml (renamed from doc/classes/Path.xml)8
-rw-r--r--doc/classes/PathFollow3D.xml (renamed from doc/classes/PathFollow.xml)20
-rw-r--r--doc/classes/Performance.xml2
-rw-r--r--doc/classes/PhysicalBone3D.xml (renamed from doc/classes/PhysicalBone.xml)4
-rw-r--r--doc/classes/PhysicalSkyMaterial.xml2
-rw-r--r--doc/classes/Physics2DDirectBodyStateSW.xml15
-rw-r--r--doc/classes/PhysicsBody3D.xml (renamed from doc/classes/PhysicsBody.xml)4
-rw-r--r--doc/classes/PhysicsDirectBodyState2D.xml (renamed from doc/classes/Physics2DDirectBodyState.xml)10
-rw-r--r--doc/classes/PhysicsDirectBodyState2DSW.xml15
-rw-r--r--doc/classes/PhysicsDirectBodyState3D.xml (renamed from doc/classes/PhysicsDirectBodyState.xml)10
-rw-r--r--doc/classes/PhysicsDirectSpaceState2D.xml (renamed from doc/classes/Physics2DDirectSpaceState.xml)34
-rw-r--r--doc/classes/PhysicsDirectSpaceState3D.xml (renamed from doc/classes/PhysicsDirectSpaceState.xml)24
-rw-r--r--doc/classes/PhysicsMaterial.xml2
-rw-r--r--doc/classes/PhysicsServer2D.xml (renamed from doc/classes/Physics2DServer.xml)60
-rw-r--r--doc/classes/PhysicsServer2DSW.xml (renamed from doc/classes/Physics2DServerSW.xml)6
-rw-r--r--doc/classes/PhysicsServer3D.xml (renamed from doc/classes/PhysicsServer.xml)132
-rw-r--r--doc/classes/PhysicsShapeQueryParameters2D.xml (renamed from doc/classes/Physics2DShapeQueryParameters.xml)4
-rw-r--r--doc/classes/PhysicsShapeQueryParameters3D.xml (renamed from doc/classes/PhysicsShapeQueryParameters.xml)10
-rw-r--r--doc/classes/PhysicsShapeQueryResult2D.xml (renamed from doc/classes/Physics2DShapeQueryResult.xml)8
-rw-r--r--doc/classes/PhysicsShapeQueryResult3D.xml (renamed from doc/classes/PhysicsShapeQueryResult.xml)8
-rw-r--r--doc/classes/PhysicsTestMotionResult2D.xml (renamed from doc/classes/Physics2DTestMotionResult.xml)2
-rw-r--r--doc/classes/PinJoint2D.xml4
-rw-r--r--doc/classes/PinJoint3D.xml (renamed from doc/classes/PinJoint.xml)10
-rw-r--r--doc/classes/Popup.xml76
-rw-r--r--doc/classes/PopupDialog.xml20
-rw-r--r--doc/classes/PopupMenu.xml17
-rw-r--r--doc/classes/PopupPanel.xml2
-rw-r--r--doc/classes/Position3D.xml4
-rw-r--r--doc/classes/ProceduralSkyMaterial.xml4
-rw-r--r--doc/classes/ProjectSettings.xml36
-rw-r--r--doc/classes/ProximityGroup3D.xml (renamed from doc/classes/ProximityGroup.xml)4
-rw-r--r--doc/classes/RID.xml2
-rw-r--r--doc/classes/RayCast3D.xml (renamed from doc/classes/RayCast.xml)14
-rw-r--r--doc/classes/RayShape3D.xml (renamed from doc/classes/RayShape.xml)4
-rw-r--r--doc/classes/ReflectionProbe.xml4
-rw-r--r--doc/classes/RemoteTransform3D.xml (renamed from doc/classes/RemoteTransform.xml)10
-rw-r--r--doc/classes/RenderingServer.xml (renamed from doc/classes/VisualServer.xml)293
-rw-r--r--doc/classes/RigidBody2D.xml6
-rw-r--r--doc/classes/RigidBody3D.xml (renamed from doc/classes/RigidBody.xml)30
-rw-r--r--doc/classes/RootMotionView.xml2
-rw-r--r--doc/classes/SceneTree.xml76
-rw-r--r--doc/classes/ScriptCreateDialog.xml7
-rw-r--r--doc/classes/Shape3D.xml (renamed from doc/classes/Shape.xml)4
-rw-r--r--doc/classes/Skeleton3D.xml (renamed from doc/classes/Skeleton.xml)10
-rw-r--r--doc/classes/SkeletonIK3D.xml (renamed from doc/classes/SkeletonIK.xml)4
-rw-r--r--doc/classes/SliderJoint3D.xml (renamed from doc/classes/SliderJoint.xml)6
-rw-r--r--doc/classes/SoftBody3D.xml (renamed from doc/classes/SoftBody.xml)12
-rw-r--r--doc/classes/SphereShape3D.xml (renamed from doc/classes/SphereShape.xml)4
-rw-r--r--doc/classes/SpotLight3D.xml (renamed from doc/classes/SpotLight.xml)4
-rw-r--r--doc/classes/SpringArm3D.xml (renamed from doc/classes/SpringArm.xml)30
-rw-r--r--doc/classes/Sprite2D.xml (renamed from doc/classes/Sprite.xml)8
-rw-r--r--doc/classes/Sprite3D.xml2
-rw-r--r--doc/classes/SpriteBase3D.xml4
-rw-r--r--doc/classes/SpriteFrames.xml4
-rw-r--r--doc/classes/StaticBody3D.xml (renamed from doc/classes/StaticBody.xml)4
-rw-r--r--doc/classes/SubViewport.xml51
-rw-r--r--doc/classes/Texture2D.xml20
-rw-r--r--doc/classes/Thread.xml2
-rw-r--r--doc/classes/VehicleBody3D.xml (renamed from doc/classes/VehicleBody.xml)12
-rw-r--r--doc/classes/VehicleWheel3D.xml (renamed from doc/classes/VehicleWheel.xml)14
-rw-r--r--doc/classes/VelocityTracker3D.xml (renamed from doc/classes/SpatialVelocityTracker.xml)2
-rw-r--r--doc/classes/Viewport.xml115
-rw-r--r--doc/classes/VisibilityEnabler2D.xml8
-rw-r--r--doc/classes/VisibilityEnabler3D.xml (renamed from doc/classes/VisibilityEnabler.xml)14
-rw-r--r--doc/classes/VisibilityNotifier3D.xml (renamed from doc/classes/VisibilityNotifier.xml)18
-rw-r--r--doc/classes/VisualInstance3D.xml (renamed from doc/classes/VisualInstance.xml)20
-rw-r--r--doc/classes/Window.xml419
-rw-r--r--doc/classes/WindowDialog.xml59
-rw-r--r--doc/classes/World2D.xml6
-rw-r--r--doc/classes/World3D.xml (renamed from doc/classes/World.xml)16
-rw-r--r--doc/classes/WorldEnvironment.xml2
-rw-r--r--doc/classes/WorldMarginShape3D.xml (renamed from doc/classes/WorldMarginShape.xml)6
-rwxr-xr-xdoc/tools/doc_merge.py114
-rwxr-xr-xdoc/tools/doc_status.py351
-rwxr-xr-xdoc/tools/makerst.py317
-rw-r--r--doc/translations/extract.py106
-rw-r--r--drivers/SCsub35
-rw-r--r--drivers/alsa/SCsub2
-rw-r--r--drivers/alsa/audio_driver_alsa.cpp24
-rw-r--r--drivers/alsamidi/SCsub2
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.cpp12
-rw-r--r--drivers/coreaudio/SCsub2
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp40
-rw-r--r--drivers/coremidi/SCsub2
-rw-r--r--drivers/coremidi/midi_driver_coremidi.cpp6
-rw-r--r--drivers/dummy/SCsub2
-rw-r--r--drivers/dummy/rasterizer_dummy.h4
-rw-r--r--drivers/dummy/texture_loader_dummy.h2
-rw-r--r--drivers/gl_context/SCsub8
-rw-r--r--drivers/gles2/SCsub2
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp84
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.h2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp20
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp78
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.h4
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp58
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h24
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp10
-rw-r--r--drivers/gles2/shader_gles2.cpp32
-rw-r--r--drivers/gles2/shader_gles2.h2
-rw-r--r--drivers/gles2/shaders/SCsub40
-rw-r--r--drivers/png/SCsub9
-rw-r--r--drivers/png/png_driver_common.cpp6
-rw-r--r--drivers/pulseaudio/SCsub2
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp66
-rw-r--r--drivers/spirv-reflect/SCsub6
-rw-r--r--drivers/unix/SCsub4
-rw-r--r--drivers/unix/dir_access_unix.cpp14
-rw-r--r--drivers/unix/file_access_unix.cpp12
-rw-r--r--drivers/unix/ip_unix.cpp18
-rw-r--r--drivers/unix/net_socket_posix.cpp16
-rw-r--r--drivers/unix/os_unix.cpp20
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/unix/rw_lock_posix.cpp2
-rw-r--r--drivers/unix/thread_posix.cpp4
-rw-r--r--drivers/vulkan/SCsub88
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp380
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h8
-rw-r--r--drivers/vulkan/vulkan_context.cpp178
-rw-r--r--drivers/wasapi/SCsub2
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp60
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h6
-rw-r--r--drivers/windows/SCsub2
-rw-r--r--drivers/windows/dir_access_windows.cpp18
-rw-r--r--drivers/windows/file_access_windows.cpp12
-rw-r--r--drivers/windows/thread_windows.cpp4
-rw-r--r--drivers/winmidi/SCsub2
-rw-r--r--drivers/xaudio2/SCsub6
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp6
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.h2
-rw-r--r--editor/SCsub48
-rw-r--r--editor/animation_bezier_editor.cpp12
-rw-r--r--editor/animation_track_editor.cpp64
-rw-r--r--editor/animation_track_editor.h2
-rw-r--r--editor/animation_track_editor_plugins.cpp2
-rw-r--r--editor/array_property_edit.cpp6
-rw-r--r--editor/audio_stream_preview.cpp4
-rw-r--r--editor/code_editor.cpp4
-rw-r--r--editor/connections_dialog.cpp10
-rw-r--r--editor/connections_dialog.h2
-rw-r--r--editor/create_dialog.cpp6
-rw-r--r--editor/debugger/SCsub2
-rw-r--r--editor/debugger/editor_debugger_inspector.cpp6
-rw-r--r--editor/debugger/editor_debugger_node.cpp8
-rw-r--r--editor/debugger/editor_debugger_node.h8
-rw-r--r--editor/debugger/editor_debugger_tree.cpp6
-rw-r--r--editor/debugger/editor_debugger_tree.h4
-rw-r--r--editor/debugger/script_editor_debugger.cpp6
-rw-r--r--editor/debugger/script_editor_debugger.h4
-rw-r--r--editor/dependency_editor.cpp6
-rw-r--r--editor/dictionary_property_edit.cpp2
-rw-r--r--editor/doc_data.cpp6
-rw-r--r--editor/editor_about.cpp2
-rw-r--r--editor/editor_asset_installer.cpp12
-rw-r--r--editor/editor_audio_buses.cpp8
-rw-r--r--editor/editor_audio_buses.h2
-rw-r--r--editor/editor_autoload_settings.cpp32
-rw-r--r--editor/editor_autoload_settings.h4
-rw-r--r--editor/editor_builders.py9
-rw-r--r--editor/editor_data.cpp24
-rw-r--r--editor/editor_data.h2
-rw-r--r--editor/editor_export.cpp25
-rw-r--r--editor/editor_export.h9
-rw-r--r--editor/editor_feature_profile.cpp2
-rw-r--r--editor/editor_file_dialog.cpp8
-rw-r--r--editor/editor_file_system.cpp60
-rw-r--r--editor/editor_file_system.h6
-rw-r--r--editor/editor_help.cpp6
-rw-r--r--editor/editor_help_search.cpp2
-rw-r--r--editor/editor_inspector.cpp38
-rw-r--r--editor/editor_log.cpp2
-rw-r--r--editor/editor_node.cpp101
-rw-r--r--editor/editor_node.h3
-rw-r--r--editor/editor_plugin.cpp12
-rw-r--r--editor/editor_plugin.h2
-rw-r--r--editor/editor_properties.cpp30
-rw-r--r--editor/editor_properties_array_dict.cpp48
-rw-r--r--editor/editor_resource_preview.cpp6
-rw-r--r--editor/editor_run_script.cpp6
-rw-r--r--editor/editor_sectioned_inspector.cpp10
-rw-r--r--editor/editor_settings.cpp8
-rw-r--r--editor/editor_spin_slider.cpp2
-rw-r--r--editor/editor_sub_scene.cpp10
-rw-r--r--editor/editor_themes.cpp6
-rw-r--r--editor/editor_themes.h4
-rw-r--r--editor/editor_vcs_interface.cpp2
-rw-r--r--editor/export_template_manager.cpp12
-rw-r--r--editor/fileserver/SCsub2
-rw-r--r--editor/filesystem_dock.cpp6
-rw-r--r--editor/find_in_files.cpp6
-rw-r--r--editor/groups_editor.cpp8
-rw-r--r--editor/icons/GizmoCPUParticles3D.svg (renamed from editor/icons/GizmoCPUParticles.svg)0
-rw-r--r--editor/icons/GizmoGPUParticles3D.svg (renamed from editor/icons/GizmoParticles.svg)0
-rw-r--r--editor/icons/SCsub14
-rw-r--r--editor/icons/SubViewport.svg1
-rw-r--r--editor/icons/editor_icons_builders.py14
-rw-r--r--editor/import/SCsub2
-rw-r--r--editor/import/collada.cpp12
-rw-r--r--editor/import/collada.h6
-rw-r--r--editor/import/editor_import_collada.cpp30
-rw-r--r--editor/import/editor_import_collada.h2
-rw-r--r--editor/import/editor_import_plugin.h2
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp44
-rw-r--r--editor/import/editor_scene_importer_gltf.h2
-rw-r--r--editor/import/resource_importer_bitmask.h2
-rw-r--r--editor/import/resource_importer_csv.h2
-rw-r--r--editor/import/resource_importer_csv_translation.h2
-rw-r--r--editor/import/resource_importer_image.h2
-rw-r--r--editor/import/resource_importer_layered_texture.cpp6
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_obj.cpp4
-rw-r--r--editor/import/resource_importer_obj.h4
-rw-r--r--editor/import/resource_importer_scene.cpp26
-rw-r--r--editor/import/resource_importer_scene.h6
-rw-r--r--editor/import/resource_importer_texture.cpp8
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/import/resource_importer_texture_atlas.h2
-rw-r--r--editor/import/resource_importer_wav.h2
-rw-r--r--editor/inspector_dock.cpp10
-rw-r--r--editor/node_3d_editor_gizmos.cpp126
-rw-r--r--editor/node_3d_editor_gizmos.h12
-rw-r--r--editor/node_dock.cpp2
-rw-r--r--editor/plugins/SCsub2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp8
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp4
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp10
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp18
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp4
-rw-r--r--editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp8
-rw-r--r--editor/plugins/baked_lightmap_editor_plugin.cpp12
-rw-r--r--editor/plugins/camera_3d_editor_plugin.cpp14
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp30
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/collision_polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/collision_polygon_3d_editor_plugin.cpp8
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp29
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h2
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/cpu_particles_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/cpu_particles_3d_editor_plugin.h2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp2
-rw-r--r--editor/plugins/gi_probe_editor_plugin.cpp12
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/gpu_particles_2d_editor_plugin.h2
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/gpu_particles_3d_editor_plugin.h2
-rw-r--r--editor/plugins/gradient_editor_plugin.cpp2
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp16
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/line_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp2
-rw-r--r--editor/plugins/mesh_instance_3d_editor_plugin.cpp21
-rw-r--r--editor/plugins/multimesh_editor_plugin.cpp8
-rw-r--r--editor/plugins/navigation_polygon_editor_plugin.cpp2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp62
-rw-r--r--editor/plugins/node_3d_editor_plugin.h10
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp10
-rw-r--r--editor/plugins/path_3d_editor_plugin.cpp10
-rw-r--r--editor/plugins/path_3d_editor_plugin.h6
-rw-r--r--editor/plugins/physical_bone_3d_editor_plugin.cpp8
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp7
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp2
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.cpp62
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp20
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp6
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.h2
-rw-r--r--editor/plugins/skeleton_ik_3d_editor_plugin.cpp2
-rw-r--r--editor/plugins/skeleton_ik_3d_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.cpp4
-rw-r--r--editor/plugins/sprite_2d_editor_plugin.h2
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp12
-rw-r--r--editor/plugins/texture_editor_plugin.cpp2
-rw-r--r--editor/plugins/texture_region_editor_plugin.cpp40
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp26
-rw-r--r--editor/plugins/tile_map_editor_plugin.h1
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp4
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp8
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp36
-rw-r--r--editor/progress_dialog.cpp2
-rw-r--r--editor/project_export.cpp4
-rw-r--r--editor/project_manager.cpp18
-rw-r--r--editor/project_settings_editor.cpp14
-rw-r--r--editor/property_editor.cpp14
-rw-r--r--editor/property_selector.cpp32
-rw-r--r--editor/pvrtc_compress.cpp4
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/rename_dialog.cpp6
-rw-r--r--editor/rename_dialog.h2
-rw-r--r--editor/scene_tree_dock.cpp56
-rw-r--r--editor/scene_tree_dock.h4
-rw-r--r--editor/scene_tree_editor.cpp24
-rw-r--r--editor/settings_config_dialog.cpp8
-rwxr-xr-xeditor/translations/extract.py40
-rw-r--r--gles_builders.py254
-rw-r--r--main/SCsub8
-rw-r--r--main/main.cpp54
-rw-r--r--main/main_builders.py6
-rw-r--r--main/performance.cpp2
-rw-r--r--main/tests/SCsub2
-rw-r--r--main/tests/test_astar.cpp4
-rw-r--r--main/tests/test_gdscript.cpp20
-rw-r--r--main/tests/test_main.cpp8
-rw-r--r--main/tests/test_math.cpp10
-rw-r--r--main/tests/test_oa_hash_map.cpp2
-rw-r--r--main/tests/test_ordered_hash_map.cpp4
-rw-r--r--main/tests/test_shader_lang.cpp8
-rw-r--r--main/tests/test_string.cpp6
-rw-r--r--methods.py321
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj12
-rw-r--r--misc/hooks/README.md37
-rwxr-xr-xmisc/hooks/pre-commit2
-rwxr-xr-xmisc/hooks/pre-commit-black132
-rwxr-xr-xmisc/hooks/pre-commit-clang-format14
-rwxr-xr-xmisc/hooks/pre-commit-makerst9
-rwxr-xr-xmisc/scripts/fix_headers.py24
-rwxr-xr-xmisc/scripts/fix_style.sh20
-rwxr-xr-xmisc/travis/black-format.sh48
-rwxr-xr-xmisc/travis/clang-format.sh8
-rw-r--r--modules/SCsub4
-rw-r--r--modules/arkit/SCsub6
-rw-r--r--modules/arkit/config.py3
-rw-r--r--modules/assimp/SCsub150
-rw-r--r--modules/assimp/config.py3
-rw-r--r--modules/assimp/editor_scene_importer_assimp.cpp68
-rw-r--r--modules/assimp/editor_scene_importer_assimp.h2
-rw-r--r--modules/assimp/import_state.h10
-rw-r--r--modules/assimp/import_utils.h10
-rw-r--r--modules/basis_universal/SCsub42
-rw-r--r--modules/basis_universal/config.py1
-rw-r--r--modules/basis_universal/register_types.cpp12
-rw-r--r--modules/basis_universal/texture_basisu.cpp2
-rw-r--r--modules/bmp/SCsub4
-rw-r--r--modules/bmp/config.py1
-rw-r--r--modules/bmp/image_loader_bmp.cpp4
-rw-r--r--modules/bmp/register_types.cpp2
-rw-r--r--modules/bullet/SCsub357
-rw-r--r--modules/bullet/area_bullet.h2
-rw-r--r--modules/bullet/btRayShape.cpp1
-rw-r--r--modules/bullet/bullet_physics_server.cpp42
-rw-r--r--modules/bullet/bullet_physics_server.h2
-rw-r--r--modules/bullet/bullet_utilities.h2
-rw-r--r--modules/bullet/collision_object_bullet.cpp12
-rw-r--r--modules/bullet/collision_object_bullet.h8
-rw-r--r--modules/bullet/config.py7
-rw-r--r--modules/bullet/constraint_bullet.cpp4
-rw-r--r--modules/bullet/constraint_bullet.h2
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsDirectBodyState3D.xml (renamed from modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml)2
-rw-r--r--modules/bullet/doc_classes/BulletPhysicsServer3D.xml (renamed from modules/bullet/doc_classes/BulletPhysicsServer.xml)2
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp6
-rw-r--r--modules/bullet/godot_collision_configuration.cpp4
-rw-r--r--modules/bullet/godot_result_callbacks.cpp4
-rw-r--r--modules/bullet/hinge_joint_bullet.cpp4
-rw-r--r--modules/bullet/rigid_body_bullet.cpp88
-rw-r--r--modules/bullet/rigid_body_bullet.h20
-rw-r--r--modules/bullet/shape_bullet.cpp8
-rw-r--r--modules/bullet/soft_body_bullet.cpp6
-rw-r--r--modules/bullet/space_bullet.cpp60
-rw-r--r--modules/bullet/space_bullet.h10
-rw-r--r--modules/camera/SCsub7
-rw-r--r--modules/camera/config.py3
-rw-r--r--modules/csg/SCsub4
-rw-r--r--modules/csg/config.py21
-rw-r--r--modules/csg/csg_shape.cpp64
-rw-r--r--modules/csg/doc_classes/CSGBox3D.xml (renamed from modules/csg/doc_classes/CSGBox.xml)2
-rw-r--r--modules/csg/doc_classes/CSGCombiner.xml15
-rw-r--r--modules/csg/doc_classes/CSGCombiner3D.xml15
-rw-r--r--modules/csg/doc_classes/CSGCylinder3D.xml (renamed from modules/csg/doc_classes/CSGCylinder.xml)2
-rw-r--r--modules/csg/doc_classes/CSGMesh3D.xml (renamed from modules/csg/doc_classes/CSGMesh.xml)2
-rw-r--r--modules/csg/doc_classes/CSGPolygon3D.xml (renamed from modules/csg/doc_classes/CSGPolygon.xml)16
-rw-r--r--modules/csg/doc_classes/CSGPrimitive3D.xml (renamed from modules/csg/doc_classes/CSGPrimitive.xml)2
-rw-r--r--modules/csg/doc_classes/CSGShape3D.xml (renamed from modules/csg/doc_classes/CSGShape.xml)4
-rw-r--r--modules/csg/doc_classes/CSGSphere3D.xml (renamed from modules/csg/doc_classes/CSGSphere.xml)2
-rw-r--r--modules/csg/doc_classes/CSGTorus3D.xml (renamed from modules/csg/doc_classes/CSGTorus.xml)2
-rw-r--r--modules/csg/register_types.cpp9
-rw-r--r--modules/cvtt/SCsub6
-rw-r--r--modules/cvtt/config.py3
-rw-r--r--modules/dds/SCsub4
-rw-r--r--modules/dds/config.py1
-rw-r--r--modules/dds/texture_loader_dds.h2
-rw-r--r--modules/enet/SCsub6
-rw-r--r--modules/enet/config.py3
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp28
-rw-r--r--modules/etc/SCsub34
-rw-r--r--modules/etc/config.py3
-rw-r--r--modules/etc/image_etc.cpp2
-rw-r--r--modules/etc/texture_loader_pkm.h2
-rw-r--r--modules/freetype/SCsub28
-rw-r--r--modules/freetype/config.py1
-rw-r--r--modules/gdnative/SCsub15
-rw-r--r--modules/gdnative/android/android_gdn.cpp6
-rw-r--r--modules/gdnative/arvr/SCsub6
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp60
-rw-r--r--modules/gdnative/arvr/config.py5
-rw-r--r--modules/gdnative/config.py3
-rw-r--r--modules/gdnative/gdnative.cpp14
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp8
-rw-r--r--modules/gdnative/gdnative_builders.py270
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp2
-rw-r--r--modules/gdnative/include/pluginscript/godot_pluginscript.h12
-rw-r--r--modules/gdnative/nativescript/SCsub6
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp14
-rw-r--r--modules/gdnative/nativescript/godot_nativescript.cpp14
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp32
-rw-r--r--modules/gdnative/nativescript/nativescript.h8
-rw-r--r--modules/gdnative/net/SCsub9
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.cpp30
-rw-r--r--modules/gdnative/net/packet_peer_gdnative.cpp10
-rw-r--r--modules/gdnative/net/stream_peer_gdnative.cpp12
-rw-r--r--modules/gdnative/pluginscript/SCsub6
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_instance.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp32
-rw-r--r--modules/gdnative/videodecoder/SCsub8
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.cpp48
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.h10
-rw-r--r--modules/gdnavigation/SCsub34
-rw-r--r--modules/gdnavigation/config.py1
-rw-r--r--modules/gdnavigation/gd_navigation_server.cpp84
-rw-r--r--modules/gdnavigation/nav_map.cpp26
-rw-r--r--modules/gdnavigation/nav_region.cpp4
-rw-r--r--modules/gdnavigation/nav_utils.h6
-rw-r--r--modules/gdnavigation/navigation_mesh_editor_plugin.cpp8
-rw-r--r--modules/gdnavigation/navigation_mesh_generator.cpp34
-rw-r--r--modules/gdnavigation/register_types.cpp2
-rw-r--r--modules/gdnavigation/rvo_agent.cpp4
-rw-r--r--modules/gdscript/SCsub10
-rw-r--r--modules/gdscript/config.py3
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml8
-rw-r--r--modules/gdscript/gdscript.cpp60
-rw-r--r--modules/gdscript/gdscript.h8
-rw-r--r--modules/gdscript/gdscript_compiler.cpp28
-rw-r--r--modules/gdscript/gdscript_editor.cpp92
-rw-r--r--modules/gdscript/gdscript_function.cpp58
-rw-r--r--modules/gdscript/gdscript_function.h4
-rw-r--r--modules/gdscript/gdscript_functions.cpp6
-rw-r--r--modules/gdscript/gdscript_parser.cpp284
-rw-r--r--modules/gdscript/gdscript_parser.h24
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp10
-rw-r--r--modules/gdscript/language_server/gdscript_extend_parser.cpp16
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp16
-rw-r--r--modules/gdscript/language_server/gdscript_language_server.cpp8
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp6
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp20
-rw-r--r--modules/gdscript/register_types.cpp2
-rw-r--r--modules/glslang/SCsub12
-rw-r--r--modules/glslang/config.py1
-rw-r--r--modules/gridmap/SCsub4
-rw-r--r--modules/gridmap/config.py3
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml2
-rw-r--r--modules/gridmap/grid_map.cpp4
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp6
-rw-r--r--modules/hdr/SCsub4
-rw-r--r--modules/hdr/config.py1
-rw-r--r--modules/hdr/register_types.cpp2
-rw-r--r--modules/jpg/SCsub4
-rw-r--r--modules/jpg/config.py1
-rw-r--r--modules/jpg/register_types.cpp2
-rw-r--r--modules/jsonrpc/SCsub4
-rw-r--r--modules/jsonrpc/config.py5
-rw-r--r--modules/jsonrpc/jsonrpc.cpp2
-rwxr-xr-xmodules/mbedtls/SCsub8
-rwxr-xr-xmodules/mbedtls/config.py1
-rw-r--r--modules/mbedtls/crypto_mbedtls.cpp26
-rw-r--r--modules/mbedtls/crypto_mbedtls.h4
-rw-r--r--modules/mbedtls/dtls_server_mbedtls.cpp2
-rwxr-xr-xmodules/mbedtls/packet_peer_mbed_dtls.cpp16
-rw-r--r--modules/mbedtls/ssl_context_mbedtls.cpp14
-rwxr-xr-xmodules/mbedtls/stream_peer_mbedtls.cpp14
-rw-r--r--modules/mobile_vr/SCsub6
-rw-r--r--modules/mobile_vr/config.py3
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp2
-rw-r--r--modules/modules_builders.py6
-rw-r--r--modules/mono/SCsub42
-rw-r--r--modules/mono/build_scripts/api_solution_build.py35
-rw-r--r--modules/mono/build_scripts/gen_cs_glue_version.py20
-rw-r--r--modules/mono/build_scripts/godot_tools_build.py23
-rw-r--r--modules/mono/build_scripts/make_android_mono_config.py17
-rw-r--r--modules/mono/build_scripts/mono_configure.py509
-rw-r--r--modules/mono/build_scripts/mono_reg_utils.py52
-rw-r--r--modules/mono/build_scripts/solution_builder.py132
-rw-r--r--modules/mono/class_db_api_json.cpp10
-rw-r--r--modules/mono/config.py59
-rw-r--r--modules/mono/csharp_script.cpp177
-rw-r--r--modules/mono/csharp_script.h8
-rwxr-xr-xmodules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs618
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs400
-rwxr-xr-xmodules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs93
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs15
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj2
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs42
-rw-r--r--modules/mono/editor/bindings_generator.cpp40
-rw-r--r--modules/mono/editor/bindings_generator.h18
-rw-r--r--modules/mono/editor/csharp_project.cpp4
-rw-r--r--modules/mono/editor/editor_internal_calls.cpp18
-rw-r--r--modules/mono/editor/godotsharp_export.cpp13
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs2
-rw-r--r--modules/mono/glue/base_object_glue.cpp14
-rw-r--r--modules/mono/glue/collections_glue.cpp26
-rw-r--r--modules/mono/glue/gd_glue.cpp18
-rw-r--r--modules/mono/glue/glue_header.h2
-rw-r--r--modules/mono/godotsharp_dirs.cpp6
-rw-r--r--modules/mono/managed_callable.cpp4
-rw-r--r--modules/mono/mono_gc_handle.cpp2
-rw-r--r--modules/mono/mono_gc_handle.h2
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp198
-rw-r--r--modules/mono/mono_gd/gd_mono.h10
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.cpp286
-rw-r--r--modules/mono/mono_gd/gd_mono_assembly.h35
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.cpp164
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp78
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp10
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp10
-rw-r--r--modules/mono/mono_gd/gd_mono_log.h9
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp42
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h4
-rw-r--r--modules/mono/mono_gd/gd_mono_method.cpp30
-rw-r--r--modules/mono/mono_gd/gd_mono_method.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_method_thunk.h52
-rw-r--r--modules/mono/mono_gd/gd_mono_property.cpp32
-rw-r--r--modules/mono/mono_gd/gd_mono_property.h6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp109
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h8
-rw-r--r--modules/mono/mono_gd/managed_type.h2
-rwxr-xr-x[-rw-r--r--]modules/mono/mono_gd/support/android_support.cpp (renamed from modules/mono/mono_gd/gd_mono_android.cpp)98
-rwxr-xr-x[-rw-r--r--]modules/mono/mono_gd/support/android_support.h (renamed from modules/mono/mono_gd/gd_mono_android.h)19
-rwxr-xr-xmodules/mono/mono_gd/support/ios_support.h51
-rwxr-xr-xmodules/mono/mono_gd/support/ios_support.mm151
-rw-r--r--modules/mono/register_types.cpp4
-rw-r--r--modules/mono/signal_awaiter_utils.cpp4
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp6
-rw-r--r--modules/mono/utils/osx_utils.cpp6
-rw-r--r--modules/mono/utils/path_utils.cpp10
-rw-r--r--modules/mono/utils/string_utils.cpp2
-rw-r--r--modules/ogg/SCsub6
-rw-r--r--modules/ogg/config.py1
-rw-r--r--modules/opensimplex/SCsub4
-rw-r--r--modules/opensimplex/config.py9
-rw-r--r--modules/opensimplex/noise_texture.cpp4
-rw-r--r--modules/opus/SCsub31
-rw-r--r--modules/opus/config.py1
-rw-r--r--modules/pvr/SCsub4
-rw-r--r--modules/pvr/config.py1
-rw-r--r--modules/pvr/texture_loader_pvr.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.h2
-rw-r--r--modules/regex/SCsub16
-rw-r--r--modules/regex/config.py3
-rw-r--r--modules/regex/regex.cpp26
-rw-r--r--modules/squish/SCsub6
-rw-r--r--modules/squish/config.py1
-rw-r--r--modules/stb_vorbis/SCsub4
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp12
-rw-r--r--modules/stb_vorbis/config.py3
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.h2
-rw-r--r--modules/svg/SCsub6
-rw-r--r--modules/svg/config.py1
-rw-r--r--modules/svg/image_loader_svg.cpp4
-rw-r--r--modules/svg/image_loader_svg.h2
-rw-r--r--modules/svg/register_types.cpp2
-rw-r--r--modules/tga/SCsub4
-rw-r--r--modules/tga/config.py1
-rw-r--r--modules/tga/image_loader_tga.cpp2
-rw-r--r--modules/tga/register_types.cpp2
-rw-r--r--modules/theora/SCsub60
-rw-r--r--modules/theora/config.py3
-rw-r--r--modules/theora/video_stream_theora.cpp14
-rw-r--r--modules/theora/video_stream_theora.h2
-rw-r--r--modules/tinyexr/SCsub4
-rw-r--r--modules/tinyexr/config.py3
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp6
-rw-r--r--modules/tinyexr/register_types.cpp4
-rw-r--r--modules/upnp/SCsub6
-rw-r--r--modules/upnp/config.py5
-rw-r--r--modules/upnp/upnp.cpp24
-rw-r--r--modules/upnp/upnp_device.cpp8
-rw-r--r--modules/vhacd/SCsub6
-rw-r--r--modules/vhacd/config.py2
-rw-r--r--modules/vhacd/register_types.cpp2
-rw-r--r--modules/visual_script/SCsub4
-rw-r--r--modules/visual_script/config.py3
-rw-r--r--modules/visual_script/register_types.cpp4
-rw-r--r--modules/visual_script/visual_script.cpp38
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp4
-rw-r--r--modules/visual_script/visual_script_editor.cpp22
-rw-r--r--modules/visual_script/visual_script_expression.cpp66
-rw-r--r--modules/visual_script/visual_script_expression.h2
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp56
-rw-r--r--modules/visual_script/visual_script_nodes.cpp8
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp24
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp18
-rw-r--r--modules/vorbis/SCsub18
-rw-r--r--modules/vorbis/config.py1
-rw-r--r--modules/webm/SCsub12
-rw-r--r--modules/webm/config.py5
-rw-r--r--modules/webm/libvpx/SCsub175
-rw-r--r--modules/webm/video_stream_webm.cpp34
-rw-r--r--modules/webm/video_stream_webm.h2
-rw-r--r--modules/webp/SCsub6
-rw-r--r--modules/webp/config.py1
-rw-r--r--modules/webp/image_loader_webp.cpp10
-rw-r--r--modules/webp/register_types.cpp2
-rw-r--r--modules/webrtc/SCsub8
-rw-r--r--modules/webrtc/config.py5
-rw-r--r--modules/webrtc/webrtc_data_channel_gdnative.cpp36
-rw-r--r--modules/webrtc/webrtc_data_channel_js.cpp4
-rw-r--r--modules/webrtc/webrtc_multiplayer.cpp3
-rw-r--r--modules/webrtc/webrtc_peer_connection.cpp4
-rw-r--r--modules/webrtc/webrtc_peer_connection_gdnative.cpp24
-rw-r--r--modules/webrtc/webrtc_peer_connection_js.cpp2
-rw-r--r--modules/websocket/SCsub6
-rw-r--r--modules/websocket/config.py5
-rw-r--r--modules/websocket/emws_server.cpp2
-rw-r--r--modules/websocket/packet_buffer.h4
-rw-r--r--modules/websocket/websocket_macros.h4
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp10
-rw-r--r--modules/websocket/wsl_client.cpp4
-rw-r--r--modules/websocket/wsl_peer.cpp20
-rw-r--r--modules/websocket/wsl_peer.h6
-rw-r--r--modules/websocket/wsl_server.cpp2
-rw-r--r--modules/xatlas_unwrap/SCsub6
-rw-r--r--modules/xatlas_unwrap/config.py3
-rw-r--r--modules/xatlas_unwrap/register_types.cpp4
-rw-r--r--platform/SCsub24
-rw-r--r--platform/android/SCsub76
-rw-r--r--platform/android/api/api.cpp4
-rw-r--r--platform/android/api/java_class_wrapper.h2
-rw-r--r--platform/android/audio_driver_jandroid.cpp14
-rw-r--r--platform/android/audio_driver_opensl.cpp10
-rw-r--r--platform/android/detect.py241
-rw-r--r--platform/android/dir_access_jandroid.cpp12
-rw-r--r--platform/android/export/export.cpp68
-rw-r--r--platform/android/file_access_android.cpp8
-rw-r--r--platform/android/file_access_jandroid.cpp2
-rw-r--r--platform/android/java_class_wrapper.cpp18
-rw-r--r--platform/android/java_godot_lib_jni.cpp18
-rw-r--r--platform/android/java_godot_wrapper.cpp16
-rw-r--r--platform/android/java_godot_wrapper.h10
-rw-r--r--platform/android/jni_utils.cpp8
-rw-r--r--platform/android/jni_utils.h10
-rw-r--r--platform/android/os_android.cpp10
-rw-r--r--platform/android/string_android.h4
-rw-r--r--platform/android/thread_jandroid.cpp16
-rw-r--r--platform/haiku/SCsub27
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp8
-rw-r--r--platform/haiku/detect.py140
-rw-r--r--platform/haiku/haiku_direct_window.cpp10
-rw-r--r--platform/haiku/os_haiku.cpp8
-rw-r--r--platform/iphone/SCsub38
-rw-r--r--platform/iphone/detect.py257
-rw-r--r--platform/iphone/export/export.cpp33
-rw-r--r--platform/iphone/godot_iphone.cpp4
-rw-r--r--platform/iphone/os_iphone.cpp12
-rw-r--r--platform/javascript/SCsub68
-rw-r--r--platform/javascript/api/api.cpp4
-rw-r--r--platform/javascript/audio_driver_javascript.cpp6
-rw-r--r--platform/javascript/detect.py152
-rw-r--r--platform/javascript/emscripten_helpers.py25
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/javascript/http_client_javascript.cpp4
-rw-r--r--platform/javascript/http_request.h2
-rw-r--r--platform/javascript/os_javascript.cpp26
-rw-r--r--platform/javascript/os_javascript.h2
-rw-r--r--platform/linuxbsd/SCsub5
-rw-r--r--platform/linuxbsd/context_gl_x11.cpp12
-rw-r--r--platform/linuxbsd/crash_handler_linuxbsd.cpp12
-rw-r--r--platform/linuxbsd/detect.py379
-rw-r--r--platform/linuxbsd/detect_prime_x11.cpp8
-rw-r--r--platform/linuxbsd/display_server_x11.cpp99
-rw-r--r--platform/linuxbsd/display_server_x11.h1
-rw-r--r--platform/linuxbsd/joypad_linux.cpp10
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp10
-rw-r--r--platform/linuxbsd/platform_linuxbsd_builders.py8
-rw-r--r--platform/linuxbsd/vulkan_context_x11.cpp4
-rw-r--r--platform/osx/SCsub21
-rw-r--r--platform/osx/detect.py208
-rw-r--r--platform/osx/display_server_osx.h6
-rw-r--r--platform/osx/export/export.cpp40
-rw-r--r--platform/osx/joypad_osx.cpp30
-rw-r--r--platform/osx/platform_osx_builders.py10
-rw-r--r--platform/server/SCsub12
-rw-r--r--platform/server/detect.py263
-rw-r--r--platform/server/os_server.cpp8
-rw-r--r--platform/uwp/SCsub20
-rw-r--r--platform/uwp/app.cpp12
-rw-r--r--platform/uwp/context_egl_uwp.cpp2
-rw-r--r--platform/uwp/detect.py172
-rw-r--r--platform/uwp/export/export.cpp36
-rw-r--r--platform/uwp/os_uwp.cpp16
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/windows/SCsub10
-rw-r--r--platform/windows/context_gl_windows.cpp8
-rw-r--r--platform/windows/crash_handler_windows.cpp6
-rw-r--r--platform/windows/detect.py425
-rw-r--r--platform/windows/display_server_windows.cpp129
-rw-r--r--platform/windows/display_server_windows.h3
-rw-r--r--platform/windows/export/export.cpp2
-rw-r--r--platform/windows/godot_windows.cpp12
-rw-r--r--platform/windows/joypad_windows.cpp18
-rw-r--r--platform/windows/joypad_windows.h4
-rw-r--r--platform/windows/os_windows.cpp40
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/windows/platform_windows_builders.py10
-rw-r--r--platform/windows/vulkan_context_win.cpp4
-rw-r--r--platform/windows/windows_terminal_logger.cpp2
-rw-r--r--platform_methods.py37
-rw-r--r--scene/2d/SCsub2
-rw-r--r--scene/2d/animated_sprite_2d.cpp2
-rw-r--r--scene/2d/area_2d.cpp4
-rw-r--r--scene/2d/camera_2d.cpp6
-rw-r--r--scene/2d/collision_object_2d.cpp2
-rw-r--r--scene/2d/collision_object_2d.h2
-rw-r--r--scene/2d/collision_polygon_2d.cpp4
-rw-r--r--scene/2d/collision_shape_2d.cpp4
-rw-r--r--scene/2d/cpu_particles_2d.cpp4
-rw-r--r--scene/2d/gpu_particles_2d.cpp2
-rw-r--r--scene/2d/joints_2d.cpp4
-rw-r--r--scene/2d/line_builder.cpp8
-rw-r--r--scene/2d/navigation_agent_2d.cpp28
-rw-r--r--scene/2d/navigation_obstacle_2d.cpp16
-rw-r--r--scene/2d/navigation_region_2d.cpp6
-rw-r--r--scene/2d/path_2d.cpp4
-rw-r--r--scene/2d/physics_body_2d.cpp30
-rw-r--r--scene/2d/polygon_2d.cpp2
-rw-r--r--scene/2d/ray_cast_2d.cpp2
-rw-r--r--scene/2d/skeleton_2d.cpp14
-rw-r--r--scene/2d/tile_map.cpp16
-rw-r--r--scene/3d/SCsub4
-rw-r--r--scene/3d/area_3d.cpp4
-rw-r--r--scene/3d/arvr_nodes.cpp34
-rw-r--r--scene/3d/audio_stream_player_3d.cpp5
-rw-r--r--scene/3d/audio_stream_player_3d.h2
-rw-r--r--scene/3d/baked_lightmap.cpp6
-rw-r--r--scene/3d/camera_3d.cpp6
-rw-r--r--scene/3d/collision_object_3d.cpp4
-rw-r--r--scene/3d/collision_object_3d.h2
-rw-r--r--scene/3d/collision_polygon_3d.cpp8
-rw-r--r--scene/3d/collision_shape_3d.cpp22
-rw-r--r--scene/3d/cpu_particles_3d.cpp10
-rw-r--r--scene/3d/gi_probe.cpp9
-rw-r--r--scene/3d/gi_probe.h2
-rw-r--r--scene/3d/gpu_particles_3d.cpp6
-rw-r--r--scene/3d/light_3d.cpp4
-rw-r--r--scene/3d/listener_3d.cpp2
-rw-r--r--scene/3d/mesh_instance_3d.cpp26
-rw-r--r--scene/3d/mesh_instance_3d.h1
-rw-r--r--scene/3d/navigation_agent_3d.cpp30
-rw-r--r--scene/3d/navigation_obstacle_3d.cpp18
-rw-r--r--scene/3d/navigation_region_3d.cpp19
-rw-r--r--scene/3d/node_3d.cpp20
-rw-r--r--scene/3d/path_3d.cpp8
-rw-r--r--scene/3d/physics_body_3d.cpp42
-rw-r--r--scene/3d/physics_body_3d.h2
-rw-r--r--scene/3d/physics_joint_3d.cpp4
-rw-r--r--scene/3d/ray_cast_3d.cpp6
-rw-r--r--scene/3d/skeleton_3d.cpp10
-rw-r--r--scene/3d/skeleton_3d.h4
-rw-r--r--scene/3d/skeleton_ik_3d.cpp26
-rw-r--r--scene/3d/skeleton_ik_3d.h10
-rw-r--r--scene/3d/soft_body_3d.cpp15
-rw-r--r--scene/3d/sprite_3d.cpp12
-rw-r--r--scene/3d/vehicle_body_3d.cpp14
-rw-r--r--scene/SCsub26
-rw-r--r--scene/animation/SCsub2
-rw-r--r--scene/animation/animation_blend_tree.cpp2
-rw-r--r--scene/animation/animation_cache.cpp4
-rw-r--r--scene/animation/animation_cache.h8
-rw-r--r--scene/animation/animation_node_state_machine.cpp9
-rw-r--r--scene/animation/animation_player.cpp12
-rw-r--r--scene/animation/animation_player.h18
-rw-r--r--scene/animation/animation_tree.cpp36
-rw-r--r--scene/animation/animation_tree.h8
-rw-r--r--scene/animation/tween.cpp56
-rw-r--r--scene/audio/SCsub2
-rw-r--r--scene/audio/audio_stream_player.cpp2
-rw-r--r--scene/debugger/SCsub2
-rw-r--r--scene/debugger/scene_debugger.cpp28
-rw-r--r--scene/gui/SCsub2
-rw-r--r--scene/gui/base_button.cpp2
-rw-r--r--scene/gui/color_picker.cpp10
-rw-r--r--scene/gui/control.cpp94
-rw-r--r--scene/gui/file_dialog.cpp12
-rw-r--r--scene/gui/graph_edit.cpp8
-rw-r--r--scene/gui/graph_node.cpp2
-rw-r--r--scene/gui/label.cpp8
-rw-r--r--scene/gui/line_edit.cpp24
-rw-r--r--scene/gui/panel.cpp5
-rw-r--r--scene/gui/panel.h5
-rw-r--r--scene/gui/popup_menu.cpp3
-rw-r--r--scene/gui/range.cpp2
-rw-r--r--scene/gui/rich_text_label.cpp64
-rw-r--r--scene/gui/rich_text_label.h16
-rw-r--r--scene/gui/scroll_bar.cpp8
-rw-r--r--scene/gui/spin_box.cpp2
-rw-r--r--scene/gui/split_container.cpp2
-rw-r--r--scene/gui/tab_container.cpp6
-rw-r--r--scene/gui/text_edit.cpp28
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/tree.cpp134
-rw-r--r--scene/gui/tree.h4
-rw-r--r--scene/main/SCsub2
-rw-r--r--scene/main/canvas_item.cpp24
-rw-r--r--scene/main/canvas_layer.cpp4
-rw-r--r--scene/main/http_request.cpp8
-rw-r--r--scene/main/instance_placeholder.cpp8
-rw-r--r--scene/main/node.cpp126
-rw-r--r--scene/main/node.h4
-rw-r--r--scene/main/scene_tree.cpp26
-rw-r--r--scene/main/viewport.cpp134
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/main/window.cpp6
-rw-r--r--scene/main/window.h11
-rw-r--r--scene/register_scene_types.cpp17
-rw-r--r--scene/resources/SCsub2
-rw-r--r--scene/resources/animation.h5
-rw-r--r--scene/resources/audio_stream_sample.cpp6
-rw-r--r--scene/resources/default_theme/SCsub2
-rw-r--r--scene/resources/default_theme/default_theme.cpp10
-rwxr-xr-xscene/resources/default_theme/make_header.py18
-rw-r--r--scene/resources/dynamic_font.cpp19
-rw-r--r--scene/resources/dynamic_font.h2
-rw-r--r--scene/resources/environment.cpp40
-rw-r--r--scene/resources/environment.h4
-rw-r--r--scene/resources/font.cpp6
-rw-r--r--scene/resources/font.h2
-rw-r--r--scene/resources/material.cpp10
-rw-r--r--scene/resources/mesh.cpp6
-rw-r--r--scene/resources/mesh_data_tool.cpp28
-rw-r--r--scene/resources/packed_scene.cpp62
-rw-r--r--scene/resources/particles_material.cpp6
-rw-r--r--scene/resources/polygon_path_finder.cpp10
-rw-r--r--scene/resources/primitive_meshes.cpp2
-rw-r--r--scene/resources/resource_format_text.cpp10
-rw-r--r--scene/resources/resource_format_text.h2
-rw-r--r--scene/resources/shader.h4
-rw-r--r--scene/resources/shape_2d.cpp4
-rw-r--r--scene/resources/surface_tool.cpp6
-rw-r--r--scene/resources/texture.cpp14
-rw-r--r--scene/resources/texture.h4
-rw-r--r--scene/resources/theme.cpp70
-rw-r--r--scene/resources/tile_set.cpp6
-rw-r--r--scene/resources/tile_set.h4
-rw-r--r--scene/resources/visual_shader.cpp16
-rw-r--r--scene/resources/world_3d.cpp4
-rw-r--r--scene/scene_string_names.cpp2
-rw-r--r--scene/scene_string_names.h2
-rw-r--r--servers/SCsub14
-rw-r--r--servers/arvr/SCsub2
-rw-r--r--servers/arvr_server.cpp18
-rw-r--r--servers/audio/SCsub2
-rw-r--r--servers/audio/audio_driver_dummy.cpp6
-rw-r--r--servers/audio/audio_filter_sw.cpp2
-rw-r--r--servers/audio/audio_rb_resampler.cpp8
-rw-r--r--servers/audio/audio_rb_resampler.h2
-rw-r--r--servers/audio/effects/SCsub2
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp3
-rw-r--r--servers/audio/effects/audio_effect_record.cpp8
-rw-r--r--servers/audio/effects/audio_stream_generator.cpp2
-rw-r--r--servers/audio/effects/reverb.cpp6
-rw-r--r--servers/audio_server.cpp16
-rw-r--r--servers/camera/SCsub4
-rw-r--r--servers/camera_server.cpp10
-rw-r--r--servers/display_server.cpp8
-rw-r--r--servers/display_server.h4
-rw-r--r--servers/navigation_server_2d.cpp4
-rw-r--r--servers/navigation_server_2d.h2
-rw-r--r--servers/navigation_server_3d.cpp10
-rw-r--r--servers/physics_2d/SCsub2
-rw-r--r--servers/physics_2d/area_pair_2d_sw.cpp4
-rw-r--r--servers/physics_2d/body_2d_sw.cpp14
-rw-r--r--servers/physics_2d/body_2d_sw.h2
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.cpp12
-rw-r--r--servers/physics_2d/broad_phase_2d_basic.h4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.cpp4
-rw-r--r--servers/physics_2d/broad_phase_2d_hash_grid.h6
-rw-r--r--servers/physics_2d/broad_phase_2d_sw.cpp2
-rw-r--r--servers/physics_2d/broad_phase_2d_sw.h4
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp2
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp162
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.h2
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.h6
-rw-r--r--servers/physics_2d/constraint_2d_sw.h2
-rw-r--r--servers/physics_2d/joints_2d_sw.h4
-rw-r--r--servers/physics_2d/physics_server_2d_sw.cpp30
-rw-r--r--servers/physics_2d/physics_server_2d_sw.h2
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.cpp4
-rw-r--r--servers/physics_2d/physics_server_2d_wrap_mt.h6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp4
-rw-r--r--servers/physics_2d/space_2d_sw.cpp34
-rw-r--r--servers/physics_2d/step_2d_sw.cpp14
-rw-r--r--servers/physics_3d/SCsub2
-rw-r--r--servers/physics_3d/area_pair_3d_sw.cpp4
-rw-r--r--servers/physics_3d/body_3d_sw.cpp12
-rw-r--r--servers/physics_3d/body_3d_sw.h2
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.cpp14
-rw-r--r--servers/physics_3d/broad_phase_3d_basic.h6
-rw-r--r--servers/physics_3d/broad_phase_3d_sw.cpp2
-rw-r--r--servers/physics_3d/broad_phase_3d_sw.h6
-rw-r--r--servers/physics_3d/broad_phase_octree.cpp10
-rw-r--r--servers/physics_3d/broad_phase_octree.h6
-rw-r--r--servers/physics_3d/collision_object_3d_sw.cpp2
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.cpp70
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.h2
-rw-r--r--servers/physics_3d/collision_solver_3d_sw.cpp6
-rw-r--r--servers/physics_3d/collision_solver_3d_sw.h4
-rw-r--r--servers/physics_3d/constraint_3d_sw.h2
-rw-r--r--servers/physics_3d/gjk_epa.cpp10
-rw-r--r--servers/physics_3d/joints/SCsub2
-rw-r--r--servers/physics_3d/joints_3d_sw.h2
-rw-r--r--servers/physics_3d/physics_server_3d_sw.cpp24
-rw-r--r--servers/physics_3d/physics_server_3d_sw.h2
-rw-r--r--servers/physics_3d/shape_3d_sw.cpp4
-rw-r--r--servers/physics_3d/space_3d_sw.cpp28
-rw-r--r--servers/physics_3d/space_3d_sw.h2
-rw-r--r--servers/physics_3d/step_3d_sw.cpp12
-rw-r--r--servers/physics_server_2d.cpp10
-rw-r--r--servers/physics_server_2d.h4
-rw-r--r--servers/physics_server_3d.cpp10
-rw-r--r--servers/physics_server_3d.h6
-rw-r--r--servers/register_server_types.cpp6
-rw-r--r--servers/rendering/SCsub2
-rw-r--r--servers/rendering/rasterizer.cpp6
-rw-r--r--servers/rendering/rasterizer.h49
-rw-r--r--servers/rendering/rasterizer_rd/SCsub2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp12
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp22
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h4
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp26
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.h11
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp29
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h22
-rw-r--r--servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp4
-rw-r--r--servers/rendering/rasterizer_rd/shader_compiler_rd.cpp16
-rw-r--r--servers/rendering/rasterizer_rd/shader_rd.cpp6
-rw-r--r--servers/rendering/rasterizer_rd/shaders/SCsub42
-rw-r--r--servers/rendering/rendering_device.cpp6
-rw-r--r--servers/rendering/rendering_device.h2
-rw-r--r--servers/rendering/rendering_server_canvas.cpp36
-rw-r--r--servers/rendering/rendering_server_canvas.h2
-rw-r--r--servers/rendering/rendering_server_globals.cpp14
-rw-r--r--servers/rendering/rendering_server_raster.h3
-rw-r--r--servers/rendering/rendering_server_scene.cpp24
-rw-r--r--servers/rendering/rendering_server_scene.h10
-rw-r--r--servers/rendering/rendering_server_viewport.cpp18
-rw-r--r--servers/rendering/rendering_server_wrap_mt.cpp6
-rw-r--r--servers/rendering/rendering_server_wrap_mt.h3
-rw-r--r--servers/rendering/shader_language.cpp207
-rw-r--r--servers/rendering/shader_language.h27
-rw-r--r--servers/rendering/shader_types.cpp2
-rw-r--r--servers/rendering_server.cpp18
-rw-r--r--servers/rendering_server.h4
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp24
-rw-r--r--thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp24
-rw-r--r--thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch224
-rw-r--r--thirdparty/vulkan/vk_enum_string_helper.h2
1194 files changed, 15023 insertions, 12263 deletions
diff --git a/.gitignore b/.gitignore
index cc5c822e69..9096ff228a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ local.properties
.idea
.gradletasknamecache
project.properties
+platform/android/java/lib/.cxx/
platform/android/java/libs/*
platform/android/java/app/libs/*
diff --git a/.travis.yml b/.travis.yml
index 8b58e12563..14ee95e77e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -129,9 +129,6 @@ matrix:
before_install:
- eval "${MATRIX_EVAL}"
- - if [ "$STATIC_CHECKS" = "yes" ]; then
- unset SCONS_CACHE;
- fi
install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
@@ -150,6 +147,10 @@ install:
./emsdk/emsdk install latest;
./emsdk/emsdk activate latest;
fi
+ - if [ "$STATIC_CHECKS" = "yes" ]; then
+ unset SCONS_CACHE;
+ pip3 install --user black pygments;
+ fi
before_script:
- if [ "$PLATFORM" = "android" ]; then
@@ -160,6 +161,7 @@ before_script:
script:
- if [ "$STATIC_CHECKS" = "yes" ]; then
sh ./misc/travis/clang-format.sh &&
+ sh ./misc/travis/black-format.sh &&
doc/tools/makerst.py --dry-run doc/classes modules;
else
scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS &&
diff --git a/SConstruct b/SConstruct
index ed4b3c6242..8fc333a8fa 100644
--- a/SConstruct
+++ b/SConstruct
@@ -26,48 +26,48 @@ platform_exporters = []
platform_apis = []
for x in sorted(glob.glob("platform/*")):
- if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")):
+ if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
continue
tmppath = "./" + x
sys.path.insert(0, tmppath)
import detect
- if (os.path.exists(x + "/export/export.cpp")):
+ if os.path.exists(x + "/export/export.cpp"):
platform_exporters.append(x[9:])
- if (os.path.exists(x + "/api/api.cpp")):
+ if os.path.exists(x + "/api/api.cpp"):
platform_apis.append(x[9:])
- if (detect.is_active()):
+ if detect.is_active():
active_platforms.append(detect.get_name())
active_platform_ids.append(x)
- if (detect.can_build()):
+ if detect.can_build():
x = x.replace("platform/", "") # rest of world
x = x.replace("platform\\", "") # win32
platform_list += [x]
platform_opts[x] = detect.get_opts()
platform_flags[x] = detect.get_flags()
sys.path.remove(tmppath)
- sys.modules.pop('detect')
+ sys.modules.pop("detect")
module_list = methods.detect_modules()
methods.save_active_platforms(active_platforms, active_platform_ids)
-custom_tools = ['default']
+custom_tools = ["default"]
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
if os.name == "nt" and (platform_arg == "android" or ARGUMENTS.get("use_mingw", False)):
- custom_tools = ['mingw']
-elif platform_arg == 'javascript':
+ custom_tools = ["mingw"]
+elif platform_arg == "javascript":
# Use generic POSIX build toolchain for Emscripten.
- custom_tools = ['cc', 'c++', 'ar', 'link', 'textfile', 'zip']
+ custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"]
env_base = Environment(tools=custom_tools)
-if 'TERM' in os.environ:
- env_base['ENV']['TERM'] = os.environ['TERM']
-env_base.AppendENVPath('PATH', os.getenv('PATH'))
-env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
+if "TERM" in os.environ:
+ env_base["ENV"]["TERM"] = os.environ["TERM"]
+env_base.AppendENVPath("PATH", os.getenv("PATH"))
+env_base.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
env_base.disabled_modules = []
env_base.use_ptrcall = False
env_base.module_version_string = ""
@@ -94,7 +94,7 @@ env_base.SConsignFile(".sconsign{0}.dblite".format(pickle.HIGHEST_PROTOCOL))
# Build options
-customs = ['custom.py']
+customs = ["custom.py"]
profile = ARGUMENTS.get("profile", False)
if profile:
@@ -106,62 +106,62 @@ if profile:
opts = Variables(customs, ARGUMENTS)
# Target build options
-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(EnumVariable('optimize', "Optimization type", 'speed', ('speed', 'size')))
+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(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size")))
-opts.Add(BoolVariable('tools', "Build the tools (a.k.a. the Godot editor)", True))
-opts.Add(BoolVariable('use_lto', 'Use link-time optimization', False))
-opts.Add(BoolVariable('use_precise_math_checks', 'Math checks use very precise epsilon (useful to debug the engine)', 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))
+opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise epsilon (debug option)", False))
# Components
-opts.Add(BoolVariable('deprecated', "Enable deprecated features", 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("deprecated", "Enable deprecated features", True))
+opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
+opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
# Advanced options
-opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False))
-opts.Add(BoolVariable('progress', "Show a progress indicator during compilation", True))
-opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'all', ('extra', 'all', 'moderate', 'no')))
-opts.Add(BoolVariable('werror', "Treat compiler warnings as errors. Depends on the level of warnings set with 'warnings'", False))
-opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=extra werror=yes", False))
-opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
-opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))
-opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel')))
-opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False))
-opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced GUI nodes and behaviors", False))
-opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
-opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '')
+opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
+opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True))
+opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no")))
+opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", True))
+opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False))
+opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files", "")
+opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False))
+opts.Add(EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")))
+opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
+opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
+opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", False))
+opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "")
# Thirdparty libraries
-#opts.Add(BoolVariable('builtin_assimp', "Use the built-in Assimp library", True))
-opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True))
-opts.Add(BoolVariable('builtin_certs', "Bundle default SSL certificates to be used if you don't specify an override in the project settings", True))
-opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True))
-opts.Add(BoolVariable('builtin_freetype', "Use the built-in FreeType library", True))
-opts.Add(BoolVariable('builtin_glslang', "Use the built-in glslang 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_wslay', "Use the built-in wslay 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_pcre2_with_jit', "Use JIT compiler for the built-in PCRE2 library", True))
-opts.Add(BoolVariable('builtin_recast', "Use the built-in Recast library", True))
-opts.Add(BoolVariable('builtin_rvo2', "Use the built-in RVO2 library", True))
-opts.Add(BoolVariable('builtin_squish', "Use the built-in squish library", True))
-opts.Add(BoolVariable('builtin_vulkan', "Use the built-in Vulkan loader library and headers", True))
-opts.Add(BoolVariable('builtin_xatlas', "Use the built-in xatlas 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))
+# opts.Add(BoolVariable('builtin_assimp', "Use the built-in Assimp library", True))
+opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
+opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", 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_glslang", "Use the built-in glslang 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_wslay", "Use the built-in wslay 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_pcre2_with_jit", "Use JIT compiler for the built-in PCRE2 library", True))
+opts.Add(BoolVariable("builtin_recast", "Use the built-in Recast library", True))
+opts.Add(BoolVariable("builtin_rvo2", "Use the built-in RVO2 library", True))
+opts.Add(BoolVariable("builtin_squish", "Use the built-in squish library", True))
+opts.Add(BoolVariable("builtin_vulkan", "Use the built-in Vulkan loader library and headers", True))
+opts.Add(BoolVariable("builtin_xatlas", "Use the built-in xatlas 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")
@@ -184,63 +184,64 @@ for x in module_list:
tmppath = "./modules/" + x
sys.path.insert(0, tmppath)
import config
+
enabled_attr = getattr(config, "is_enabled", None)
- if (callable(enabled_attr) and not config.is_enabled()):
+ if callable(enabled_attr) and not config.is_enabled():
module_enabled = False
sys.path.remove(tmppath)
- sys.modules.pop('config')
- opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), module_enabled))
+ sys.modules.pop("config")
+ opts.Add(BoolVariable("module_" + x + "_enabled", "Enable module '%s'" % (x,), module_enabled))
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
-env_base.Prepend(CPPPATH=['#'])
+env_base.Prepend(CPPPATH=["#"])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
env_base.platform_apis = platform_apis
-if (env_base["use_precise_math_checks"]):
- env_base.Append(CPPDEFINES=['PRECISE_MATH_CHECKS'])
+if env_base["use_precise_math_checks"]:
+ env_base.Append(CPPDEFINES=["PRECISE_MATH_CHECKS"])
-if (env_base['target'] == 'debug'):
- env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC','DISABLE_FORCED_INLINE'])
+if env_base["target"] == "debug":
+ env_base.Append(CPPDEFINES=["DEBUG_MEMORY_ALLOC", "DISABLE_FORCED_INLINE"])
# The two options below speed up incremental builds, but reduce the certainty that all files
# will properly be rebuilt. As such, we only enable them for debug (dev) builds, not release.
# 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
- env_base.Decider('MD5-timestamp')
+ env_base.Decider("MD5-timestamp")
# Use cached implicit dependencies by default. Can be overridden by specifying `--implicit-deps-changed` in the command line.
# http://scons.org/doc/production/HTML/scons-user/ch06s04.html
- env_base.SetOption('implicit_cache', 1)
+ env_base.SetOption("implicit_cache", 1)
-if (env_base['no_editor_splash']):
- env_base.Append(CPPDEFINES=['NO_EDITOR_SPLASH'])
+if env_base["no_editor_splash"]:
+ env_base.Append(CPPDEFINES=["NO_EDITOR_SPLASH"])
-if not env_base['deprecated']:
- env_base.Append(CPPDEFINES=['DISABLE_DEPRECATED'])
+if not env_base["deprecated"]:
+ env_base.Append(CPPDEFINES=["DISABLE_DEPRECATED"])
env_base.platforms = {}
selected_platform = ""
-if env_base['platform'] != "":
- selected_platform = env_base['platform']
-elif env_base['p'] != "":
- selected_platform = env_base['p']
+if env_base["platform"] != "":
+ selected_platform = env_base["platform"]
+elif env_base["p"] != "":
+ selected_platform = env_base["p"]
env_base["platform"] = selected_platform
else:
# Missing `platform` argument, try to detect platform automatically
- if sys.platform.startswith('linux'):
- selected_platform = 'linuxbsd'
- elif sys.platform == 'darwin':
- selected_platform = 'osx'
- elif sys.platform == 'win32':
- selected_platform = 'windows'
+ if sys.platform.startswith("linux"):
+ selected_platform = "linuxbsd"
+ elif sys.platform == "darwin":
+ selected_platform = "osx"
+ elif sys.platform == "win32":
+ selected_platform = "windows"
else:
print("Could not detect platform automatically. Supported platforms:")
for x in platform_list:
@@ -251,21 +252,30 @@ else:
print("Automatically detected platform: " + selected_platform)
env_base["platform"] = selected_platform
+if selected_platform in ["linux", "bsd", "x11"]:
+ if selected_platform == "x11":
+ # Deprecated alias kept for compatibility.
+ print('Platform "x11" has been renamed to "linuxbsd" in Godot 4.0. Building for platform "linuxbsd".')
+ # Alias for convenience.
+ selected_platform = "linuxbsd"
+ env_base["platform"] = selected_platform
+
if selected_platform in platform_list:
tmppath = "./platform/" + selected_platform
sys.path.insert(0, tmppath)
import detect
+
if "create" in dir(detect):
env = detect.create(env_base)
else:
env = env_base.Clone()
- if env['dev']:
- env['verbose'] = True
- env['warnings'] = "extra"
- env['werror'] = True
+ if env["dev"]:
+ env["verbose"] = True
+ env["warnings"] = "extra"
+ env["werror"] = True
- if env['vsproj']:
+ if env["vsproj"]:
env.vs_incs = []
env.vs_srcs = []
@@ -278,7 +288,7 @@ if selected_platform in platform_list:
pieces = fname.split(".")
if len(pieces) > 0:
basename = pieces[0]
- basename = basename.replace('\\\\', '/')
+ basename = basename.replace("\\\\", "/")
if os.path.isfile(basename + ".h"):
env.vs_incs = env.vs_incs + [basename + ".h"]
elif os.path.isfile(basename + ".hpp"):
@@ -287,28 +297,29 @@ if selected_platform in platform_list:
env.vs_srcs = env.vs_srcs + [basename + ".c"]
elif os.path.isfile(basename + ".cpp"):
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
+
env.AddToVSProject = AddToVSProject
env.extra_suffix = ""
- if env["extra_suffix"] != '':
- env.extra_suffix += '.' + env["extra_suffix"]
+ if env["extra_suffix"] != "":
+ env.extra_suffix += "." + env["extra_suffix"]
# Environment flags
- CCFLAGS = env.get('CCFLAGS', '')
- env['CCFLAGS'] = ''
+ CCFLAGS = env.get("CCFLAGS", "")
+ env["CCFLAGS"] = ""
env.Append(CCFLAGS=str(CCFLAGS).split())
- CFLAGS = env.get('CFLAGS', '')
- env['CFLAGS'] = ''
+ CFLAGS = env.get("CFLAGS", "")
+ env["CFLAGS"] = ""
env.Append(CFLAGS=str(CFLAGS).split())
- CXXFLAGS = env.get('CXXFLAGS', '')
- env['CXXFLAGS'] = ''
+ CXXFLAGS = env.get("CXXFLAGS", "")
+ env["CXXFLAGS"] = ""
env.Append(CXXFLAGS=str(CXXFLAGS).split())
- LINKFLAGS = env.get('LINKFLAGS', '')
- env['LINKFLAGS'] = ''
+ LINKFLAGS = env.get("LINKFLAGS", "")
+ env["LINKFLAGS"] = ""
env.Append(LINKFLAGS=str(LINKFLAGS).split())
# Platform specific flags
@@ -327,12 +338,12 @@ if selected_platform in platform_list:
if not env.msvc:
# Specifying GNU extensions support explicitly, which are supported by
# both GCC and Clang. Both currently default to gnu11 and gnu++14.
- env.Prepend(CFLAGS=['-std=gnu11'])
- env.Prepend(CXXFLAGS=['-std=gnu++17'])
+ env.Prepend(CFLAGS=["-std=gnu11"])
+ env.Prepend(CXXFLAGS=["-std=gnu++17"])
else:
# MSVC doesn't have clear C standard support, /std only covers C++.
# We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
- env.Prepend(CCFLAGS=['/std:c++17'])
+ env.Prepend(CCFLAGS=["/std:c++17"])
# Enforce our minimal compiler version requirements
cc_version = methods.get_compiler_version(env) or [-1, -1]
@@ -343,16 +354,20 @@ if selected_platform in platform_list:
# GCC 8 before 8.4 has a regression in the support of guaranteed copy elision
# which causes a build failure: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521
if cc_version_major == 8 and cc_version_minor < 4:
- print("Detected GCC 8 version < 8.4, which is not supported due to a "
- "regression in its C++17 guaranteed copy elision support. Use a "
- "newer GCC version, or Clang 6 or later by passing \"use_llvm=yes\" "
- "to the SCons command line.")
+ print(
+ "Detected GCC 8 version < 8.4, which is not supported due to a "
+ "regression in its C++17 guaranteed copy elision support. Use a "
+ 'newer GCC version, or Clang 6 or later by passing "use_llvm=yes" '
+ "to the SCons command line."
+ )
sys.exit(255)
elif cc_version_major < 7:
- print("Detected GCC version older than 7, which does not fully support "
- "C++17. Supported versions are GCC 7, 9 and later. Use a newer GCC "
- "version, or Clang 6 or later by passing \"use_llvm=yes\" to the "
- "SCons command line.")
+ print(
+ "Detected GCC version older than 7, which does not fully support "
+ "C++17. Supported versions are GCC 7, 9 and later. Use a newer GCC "
+ 'version, or Clang 6 or later by passing "use_llvm=yes" to the '
+ "SCons command line."
+ )
sys.exit(255)
elif methods.using_clang(env):
# Apple LLVM versions differ from upstream LLVM version \o/, compare
@@ -360,87 +375,100 @@ if selected_platform in platform_list:
if env["platform"] == "osx" or env["platform"] == "iphone":
vanilla = methods.is_vanilla_clang(env)
if vanilla and cc_version_major < 6:
- print("Detected Clang version older than 6, which does not fully support "
- "C++17. Supported versions are Clang 6 and later.")
+ print(
+ "Detected Clang version older than 6, which does not fully support "
+ "C++17. Supported versions are Clang 6 and later."
+ )
sys.exit(255)
elif not vanilla and cc_version_major < 10:
- print("Detected Apple Clang version older than 10, which does not fully "
- "support C++17. Supported versions are Apple Clang 10 and later.")
+ print(
+ "Detected Apple Clang version older than 10, which does not fully "
+ "support C++17. Supported versions are Apple Clang 10 and later."
+ )
sys.exit(255)
elif cc_version_major < 6:
- print("Detected Clang version older than 6, which does not fully support "
- "C++17. Supported versions are Clang 6 and later.")
+ print(
+ "Detected Clang version older than 6, which does not fully support "
+ "C++17. Supported versions are Clang 6 and later."
+ )
sys.exit(255)
# Configure compiler warnings
if env.msvc:
# Truncations, narrowing conversions, signed/unsigned comparisons...
- disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4018', '/wd4800']
- if (env["warnings"] == 'extra'):
- env.Append(CCFLAGS=['/Wall']) # Implies /W4
- elif (env["warnings"] == 'all'):
- env.Append(CCFLAGS=['/W3'] + disable_nonessential_warnings)
- elif (env["warnings"] == 'moderate'):
- env.Append(CCFLAGS=['/W2'] + disable_nonessential_warnings)
- else: # 'no'
- env.Append(CCFLAGS=['/w'])
+ disable_nonessential_warnings = ["/wd4267", "/wd4244", "/wd4305", "/wd4018", "/wd4800"]
+ if env["warnings"] == "extra":
+ env.Append(CCFLAGS=["/Wall"]) # Implies /W4
+ elif env["warnings"] == "all":
+ env.Append(CCFLAGS=["/W3"] + disable_nonessential_warnings)
+ elif env["warnings"] == "moderate":
+ env.Append(CCFLAGS=["/W2"] + disable_nonessential_warnings)
+ else: # 'no'
+ env.Append(CCFLAGS=["/w"])
# Set exception handling model to avoid warnings caused by Windows system headers.
- env.Append(CCFLAGS=['/EHsc'])
- if (env["werror"]):
- env.Append(CCFLAGS=['/WX'])
+ env.Append(CCFLAGS=["/EHsc"])
+ if env["werror"]:
+ env.Append(CCFLAGS=["/WX"])
# Force to use Unicode encoding
- env.Append(MSVC_FLAGS=['/utf8'])
- else: # Rest of the world
+ env.Append(MSVC_FLAGS=["/utf8"])
+ else: # Rest of the world
shadow_local_warning = []
- all_plus_warnings = ['-Wwrite-strings']
+ all_plus_warnings = ["-Wwrite-strings"]
if methods.using_gcc(env):
if cc_version_major >= 7:
- shadow_local_warning = ['-Wshadow-local']
+ shadow_local_warning = ["-Wshadow-local"]
- if (env["warnings"] == 'extra'):
- env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter']
- + all_plus_warnings + shadow_local_warning)
- env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor'])
+ if env["warnings"] == "extra":
+ env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wno-unused-parameter"] + all_plus_warnings + shadow_local_warning)
+ env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
if methods.using_gcc(env):
- env.Append(CCFLAGS=['-Walloc-zero',
- '-Wduplicated-branches', '-Wduplicated-cond',
- '-Wstringop-overflow=4', '-Wlogical-op'])
+ env.Append(
+ CCFLAGS=[
+ "-Walloc-zero",
+ "-Wduplicated-branches",
+ "-Wduplicated-cond",
+ "-Wstringop-overflow=4",
+ "-Wlogical-op",
+ ]
+ )
# -Wnoexcept was removed temporarily due to GH-36325.
- env.Append(CXXFLAGS=['-Wplacement-new=1'])
+ env.Append(CXXFLAGS=["-Wplacement-new=1"])
if cc_version_major >= 9:
- env.Append(CCFLAGS=['-Wattribute-alias=2'])
+ env.Append(CCFLAGS=["-Wattribute-alias=2"])
if methods.using_clang(env):
- env.Append(CCFLAGS=['-Wimplicit-fallthrough'])
- elif (env["warnings"] == 'all'):
- env.Append(CCFLAGS=['-Wall'] + shadow_local_warning)
- elif (env["warnings"] == 'moderate'):
- env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning)
- else: # 'no'
- env.Append(CCFLAGS=['-w'])
- if (env["werror"]):
- env.Append(CCFLAGS=['-Werror'])
+ env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
+ elif env["warnings"] == "all":
+ env.Append(CCFLAGS=["-Wall"] + shadow_local_warning)
+ elif env["warnings"] == "moderate":
+ env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + shadow_local_warning)
+ else: # 'no'
+ env.Append(CCFLAGS=["-w"])
+ if env["werror"]:
+ env.Append(CCFLAGS=["-Werror"])
# FIXME: Temporary workaround after the Vulkan merge, remove once warnings are fixed.
if methods.using_gcc(env):
- env.Append(CXXFLAGS=['-Wno-error=cpp'])
+ env.Append(CXXFLAGS=["-Wno-error=cpp"])
+ if cc_version_major == 7: # Bogus warning fixed in 8+.
+ env.Append(CCFLAGS=["-Wno-error=strict-overflow"])
else:
- env.Append(CXXFLAGS=['-Wno-error=#warnings'])
- else: # always enable those errors
- env.Append(CCFLAGS=['-Werror=return-type'])
+ env.Append(CXXFLAGS=["-Wno-error=#warnings"])
+ else: # always enable those errors
+ env.Append(CCFLAGS=["-Werror=return-type"])
- if (hasattr(detect, 'get_program_suffix')):
+ if hasattr(detect, "get_program_suffix"):
suffix = "." + detect.get_program_suffix()
else:
suffix = "." + selected_platform
- if (env["target"] == "release"):
+ if env["target"] == "release":
if env["tools"]:
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
- env.Append(CPPDEFINES=['NDEBUG'])
+ env.Append(CPPDEFINES=["NDEBUG"])
- elif (env["target"] == "release_debug"):
+ elif env["target"] == "release_debug":
if env["tools"]:
suffix += ".opt.tools"
else:
@@ -453,27 +481,28 @@ if selected_platform in platform_list:
if env["arch"] != "":
suffix += "." + env["arch"]
- elif (env["bits"] == "32"):
+ elif env["bits"] == "32":
suffix += ".32"
- elif (env["bits"] == "64"):
+ elif env["bits"] == "64":
suffix += ".64"
suffix += env.extra_suffix
sys.path.remove(tmppath)
- sys.modules.pop('detect')
+ sys.modules.pop("detect")
env.module_list = []
env.module_icons_paths = []
env.doc_class_path = {}
for x in sorted(module_list):
- if not env['module_' + x + '_enabled']:
+ if not env["module_" + x + "_enabled"]:
continue
tmppath = "./modules/" + x
sys.path.insert(0, tmppath)
env.current_module = x
import config
+
if config.can_build(env, selected_platform):
config.configure(env)
env.module_list.append(x)
@@ -495,7 +524,7 @@ if selected_platform in platform_list:
env.module_icons_paths.append("modules/" + x + "/" + "icons")
sys.path.remove(tmppath)
- sys.modules.pop('config')
+ sys.modules.pop("config")
methods.update_version(env.module_version_string)
@@ -514,45 +543,66 @@ if selected_platform in platform_list:
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
- if (env.use_ptrcall):
- env.Append(CPPDEFINES=['PTRCALL_ENABLED'])
- if env['tools']:
- env.Append(CPPDEFINES=['TOOLS_ENABLED'])
- if env['disable_3d']:
- if env['tools']:
- print("Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).")
+ if env.use_ptrcall:
+ env.Append(CPPDEFINES=["PTRCALL_ENABLED"])
+ if env["tools"]:
+ env.Append(CPPDEFINES=["TOOLS_ENABLED"])
+ if env["disable_3d"]:
+ if env["tools"]:
+ print(
+ "Build option 'disable_3d=yes' cannot be used with 'tools=yes' (editor), "
+ "only with 'tools=no' (export template)."
+ )
sys.exit(255)
else:
- env.Append(CPPDEFINES=['_3D_DISABLED'])
- if env['disable_advanced_gui']:
- if env['tools']:
- print("Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).")
+ env.Append(CPPDEFINES=["_3D_DISABLED"])
+ if env["disable_advanced_gui"]:
+ if env["tools"]:
+ print(
+ "Build option 'disable_advanced_gui=yes' cannot be used with 'tools=yes' (editor), "
+ "only with 'tools=no' (export template)."
+ )
sys.exit(255)
else:
- env.Append(CPPDEFINES=['ADVANCED_GUI_DISABLED'])
- if env['minizip']:
- env.Append(CPPDEFINES=['MINIZIP_ENABLED'])
+ env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])
+ if env["minizip"]:
+ env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
- editor_module_list = ['regex']
+ editor_module_list = ["regex"]
for x in editor_module_list:
- if not env['module_' + x + '_enabled']:
- if env['tools']:
- print("Build option 'module_" + x + "_enabled=no' cannot be used with 'tools=yes' (editor), only with 'tools=no' (export template).")
+ if not env["module_" + x + "_enabled"]:
+ if env["tools"]:
+ print(
+ "Build option 'module_" + x + "_enabled=no' cannot be used with 'tools=yes' (editor), "
+ "only with 'tools=no' (export template)."
+ )
sys.exit(255)
- if not env['verbose']:
+ if not env["verbose"]:
methods.no_verbose(sys, env)
- if (not env["platform"] == "server"):
- env.Append(BUILDERS = { 'GLES2_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_gles2_headers), suffix='glsl.gen.h', src_suffix='.glsl')})
- env.Append(BUILDERS = { 'RD_GLSL' : env.Builder(action=run_in_subprocess(gles_builders.build_rd_headers), suffix='glsl.gen.h', src_suffix='.glsl')})
+ if not env["platform"] == "server":
+ env.Append(
+ BUILDERS={
+ "GLES2_GLSL": env.Builder(
+ action=run_in_subprocess(gles_builders.build_gles2_headers), suffix="glsl.gen.h", src_suffix=".glsl"
+ )
+ }
+ )
+ env.Append(
+ BUILDERS={
+ "RD_GLSL": env.Builder(
+ action=run_in_subprocess(gles_builders.build_rd_headers), suffix="glsl.gen.h", src_suffix=".glsl"
+ )
+ }
+ )
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
- Export('env')
+ Export("env")
# build subdirs, the build order is dependent on link order.
@@ -569,16 +619,16 @@ if selected_platform in platform_list:
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation
- if env['vsproj']:
- env['CPPPATH'] = [Dir(path) for path in env['CPPPATH']]
+ if env["vsproj"]:
+ env["CPPPATH"] = [Dir(path) for path in env["CPPPATH"]]
methods.generate_vs_project(env, GetOption("num_jobs"))
methods.generate_cpp_hint_file("cpp.hint")
# Check for the existence of headers
conf = Configure(env)
- if ("check_c_headers" in env):
+ if "check_c_headers" in env:
for header in env["check_c_headers"]:
- if (conf.CheckCHeader(header[0])):
+ if conf.CheckCHeader(header[0]):
env.AppendUnique(CPPDEFINES=[header[1]])
elif selected_platform != "":
@@ -600,26 +650,30 @@ elif selected_platform != "":
sys.exit(255)
# The following only makes sense when the env is defined, and assumes it is
-if 'env' in locals():
+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())
+ 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'
+ node_count_fname = str(env.Dir("#")) + "/.scons_node_count"
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):
+ 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')
+ if env["verbose"] and path != None:
+ screen.write(
+ "Current cache limit is {} (used: {})\n".format(
+ self.convert_size(limit), self.convert_size(self.get_size(path))
+ )
+ )
self.delete(self.file_list())
def __call__(self, node, *args, **kw):
@@ -627,22 +681,22 @@ if 'env' in locals():
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))
+ 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%] ')
+ elif node_count_max > 0 and node_count > node_count_max:
+ screen.write("\r[100%] ")
screen.flush()
else:
- screen.write('\r[Initial build] ')
+ screen.write("\r[Initial build] ")
screen.flush()
def delete(self, files):
if len(files) == 0:
return
- if env['verbose']:
+ if env["verbose"]:
# Utter something
- screen.write('\rPurging %d %s from cache...\n' % (len(files), len(files) > 1 and 'files' or 'file'))
+ 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):
@@ -651,7 +705,7 @@ if 'env' in locals():
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, '*', '*'))]
+ 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 []
@@ -666,7 +720,7 @@ if 'env' in locals():
# Search for the first entry where the storage limit is
# reached
sum, mark = 0, None
- for i,x in enumerate(file_stat):
+ for i, x in enumerate(file_stat):
sum += x[1]
if sum > self.limit:
mark = i
@@ -685,7 +739,7 @@ if 'env' in locals():
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 = '.'):
+ def get_size(self, start_path="."):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
@@ -695,8 +749,8 @@ if 'env' in locals():
def progress_finish(target, source, env):
global node_count, progressor
- with open(node_count_fname, 'w') as f:
- f.write('%d\n' % node_count)
+ with open(node_count_fname, "w") as f:
+ f.write("%d\n" % node_count)
progressor.delete(progressor.file_list())
try:
@@ -710,7 +764,7 @@ if 'env' in locals():
# 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(progressor, interval=node_count_interval)
- progress_finish_command = Command('progress_finish', [], progress_finish)
+ progress_finish_command = Command("progress_finish", [], progress_finish)
AlwaysBuild(progress_finish_command)
diff --git a/core/SCsub b/core/SCsub
index ca003ce931..0ab4f11d87 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
import core_builders
import make_binders
@@ -11,31 +11,32 @@ env.core_sources = []
# Generate AES256 script encryption key
import os
+
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"
-if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
+if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ:
e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
ec_valid = True
- if (len(e) != 64):
+ if len(e) != 64:
ec_valid = False
else:
for i in range(len(e) >> 1):
- if (i > 0):
+ if i > 0:
txt += ","
- txts = "0x" + e[i * 2:i * 2 + 2]
+ txts = "0x" + e[i * 2 : i * 2 + 2]
try:
int(txts, 16)
except:
ec_valid = False
txt += txts
- if (not ec_valid):
+ if not ec_valid:
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)
# NOTE: It is safe to generate this file here, since this is still executed serially
with open("script_encryption_key.gen.cpp", "w") as f:
- f.write("#include \"core/project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
+ f.write('#include "core/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n")
# Add required thirdparty code.
@@ -49,7 +50,6 @@ thirdparty_misc_sources = [
# C sources
"fastlz.c",
"smaz.c",
-
# C++ sources
"hq2x.cpp",
"pcg.cpp",
@@ -60,30 +60,30 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis
env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources)
# Zlib library, can be unbundled
-if env['builtin_zlib']:
- thirdparty_zlib_dir = "#thirdparty/zlib/"
- thirdparty_zlib_sources = [
- "adler32.c",
- "compress.c",
- "crc32.c",
- "deflate.c",
- "infback.c",
- "inffast.c",
- "inflate.c",
- "inftrees.c",
- "trees.c",
- "uncompr.c",
- "zutil.c",
- ]
- thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
-
- env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
- # Needs to be available in main env too
- env.Prepend(CPPPATH=[thirdparty_zlib_dir])
- if (env['target'] == 'debug'):
- env_thirdparty.Append(CPPDEFINES=['ZLIB_DEBUG'])
-
- env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
+if env["builtin_zlib"]:
+ thirdparty_zlib_dir = "#thirdparty/zlib/"
+ thirdparty_zlib_sources = [
+ "adler32.c",
+ "compress.c",
+ "crc32.c",
+ "deflate.c",
+ "infback.c",
+ "inffast.c",
+ "inflate.c",
+ "inftrees.c",
+ "trees.c",
+ "uncompr.c",
+ "zutil.c",
+ ]
+ thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
+
+ env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
+ # Needs to be available in main env too
+ env.Prepend(CPPPATH=[thirdparty_zlib_dir])
+ if env["target"] == "debug":
+ env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
+
+ env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
# Minizip library, could be unbundled in theory
# However, our version has some custom modifications, so it won't compile with the system one
@@ -99,7 +99,7 @@ env_thirdparty.add_source_files(env.core_sources, thirdparty_minizip_sources)
# Zstd library, can be unbundled in theory
# though we currently use some private symbols
# https://github.com/godotengine/godot/issues/17374
-if env['builtin_zstd']:
+if env["builtin_zstd"]:
thirdparty_zstd_dir = "#thirdparty/zstd/"
thirdparty_zstd_sources = [
"common/debug.c",
@@ -142,32 +142,45 @@ if env['builtin_zstd']:
env.add_source_files(env.core_sources, "*.cpp")
# Certificates
-env.Depends("#core/io/certs_compressed.gen.h", ["#thirdparty/certs/ca-certificates.crt", env.Value(env['builtin_certs']), env.Value(env['system_certs_path'])])
-env.CommandNoCache("#core/io/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", run_in_subprocess(core_builders.make_certs_header))
+env.Depends(
+ "#core/io/certs_compressed.gen.h",
+ ["#thirdparty/certs/ca-certificates.crt", env.Value(env["builtin_certs"]), env.Value(env["system_certs_path"])],
+)
+env.CommandNoCache(
+ "#core/io/certs_compressed.gen.h",
+ "#thirdparty/certs/ca-certificates.crt",
+ run_in_subprocess(core_builders.make_certs_header),
+)
# Make binders
-env.CommandNoCache(['method_bind.gen.inc', 'method_bind_ext.gen.inc', 'method_bind_free_func.gen.inc'], 'make_binders.py', run_in_subprocess(make_binders.run))
+env.CommandNoCache(
+ ["method_bind.gen.inc", "method_bind_ext.gen.inc", "method_bind_free_func.gen.inc"],
+ "make_binders.py",
+ run_in_subprocess(make_binders.run),
+)
# Authors
-env.Depends('#core/authors.gen.h', "../AUTHORS.md")
-env.CommandNoCache('#core/authors.gen.h', "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header))
+env.Depends("#core/authors.gen.h", "../AUTHORS.md")
+env.CommandNoCache("#core/authors.gen.h", "../AUTHORS.md", run_in_subprocess(core_builders.make_authors_header))
# Donors
-env.Depends('#core/donors.gen.h', "../DONORS.md")
-env.CommandNoCache('#core/donors.gen.h', "../DONORS.md", run_in_subprocess(core_builders.make_donors_header))
+env.Depends("#core/donors.gen.h", "../DONORS.md")
+env.CommandNoCache("#core/donors.gen.h", "../DONORS.md", run_in_subprocess(core_builders.make_donors_header))
# License
-env.Depends('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"])
-env.CommandNoCache('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header))
+env.Depends("#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"])
+env.CommandNoCache(
+ "#core/license.gen.h", ["../COPYRIGHT.txt", "../LICENSE.txt"], run_in_subprocess(core_builders.make_license_header)
+)
# Chain load SCsubs
-SConscript('os/SCsub')
-SConscript('math/SCsub')
-SConscript('crypto/SCsub')
-SConscript('io/SCsub')
-SConscript('debugger/SCsub')
-SConscript('input/SCsub')
-SConscript('bind/SCsub')
+SConscript("os/SCsub")
+SConscript("math/SCsub")
+SConscript("crypto/SCsub")
+SConscript("io/SCsub")
+SConscript("debugger/SCsub")
+SConscript("input/SCsub")
+SConscript("bind/SCsub")
# Build it all as a library
diff --git a/core/array.cpp b/core/array.cpp
index 7eb15ea934..d65bddae61 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -67,7 +67,7 @@ void Array::_unref() const {
if (_p->refcount.unref()) {
memdelete(_p);
}
- _p = NULL;
+ _p = nullptr;
}
Variant &Array::operator[](int p_idx) {
@@ -467,7 +467,7 @@ const void *Array::id() const {
Array::Array(const Array &p_from) {
- _p = NULL;
+ _p = nullptr;
_ref(p_from);
}
diff --git a/core/bind/SCsub b/core/bind/SCsub
index 1c5f954470..19a6549225 100644
--- a/core/bind/SCsub
+++ b/core/bind/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 0236523200..e8955c05df 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -62,7 +62,7 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
-_ResourceLoader *_ResourceLoader::singleton = NULL;
+_ResourceLoader *_ResourceLoader::singleton = nullptr;
Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) {
@@ -173,7 +173,7 @@ Vector<String> _ResourceSaver::get_recognized_extensions(const RES &p_resource)
return ret;
}
-_ResourceSaver *_ResourceSaver::singleton = NULL;
+_ResourceSaver *_ResourceSaver::singleton = nullptr;
void _ResourceSaver::_bind_methods() {
@@ -778,7 +778,7 @@ Vector<String> _OS::get_granted_permissions() const {
String _OS::get_unique_id() const {
return OS::get_singleton()->get_unique_id();
}
-_OS *_OS::singleton = NULL;
+_OS *_OS::singleton = nullptr;
void _OS::_bind_methods() {
@@ -916,7 +916,7 @@ _OS::_OS() {
///////////////////// GEOMETRY
-_Geometry *_Geometry::singleton = NULL;
+_Geometry *_Geometry::singleton = nullptr;
_Geometry *_Geometry::get_singleton() {
@@ -1363,11 +1363,11 @@ void _File::close() {
if (f)
memdelete(f);
- f = NULL;
+ f = nullptr;
}
bool _File::is_open() const {
- return f != NULL;
+ return f != nullptr;
}
String _File::get_path() const {
@@ -1630,7 +1630,7 @@ void _File::store_var(const Variant &p_var, bool p_full_objects) {
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
int len;
- Error err = encode_variant(p_var, NULL, len, p_full_objects);
+ Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_MSG(err != OK, "Error when trying to encode Variant.");
Vector<uint8_t> buff;
@@ -1654,7 +1654,7 @@ Variant _File::get_var(bool p_allow_objects) const {
const uint8_t *r = buff.ptr();
Variant v;
- Error err = decode_variant(v, &r[0], len, NULL, p_allow_objects);
+ Error err = decode_variant(v, &r[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to encode Variant.");
return v;
@@ -1733,7 +1733,7 @@ void _File::_bind_methods() {
_File::_File() {
- f = NULL;
+ f = nullptr;
eswap = false;
}
@@ -1934,7 +1934,7 @@ _Directory::~_Directory() {
memdelete(d);
}
-_Marshalls *_Marshalls::singleton = NULL;
+_Marshalls *_Marshalls::singleton = nullptr;
_Marshalls *_Marshalls::get_singleton() {
return singleton;
@@ -1943,7 +1943,7 @@ _Marshalls *_Marshalls::get_singleton() {
String _Marshalls::variant_to_base64(const Variant &p_var, bool p_full_objects) {
int len;
- Error err = encode_variant(p_var, NULL, len, p_full_objects);
+ Error err = encode_variant(p_var, nullptr, len, p_full_objects);
ERR_FAIL_COND_V_MSG(err != OK, "", "Error when trying to encode Variant.");
Vector<uint8_t> buff;
@@ -1972,7 +1972,7 @@ Variant _Marshalls::base64_to_variant(const String &p_str, bool p_allow_objects)
ERR_FAIL_COND_V(CryptoCore::b64_decode(&w[0], buf.size(), &len, (unsigned char *)cstr.get_data(), strlen) != OK, Variant());
Variant v;
- Error err = decode_variant(v, &w[0], len, NULL, p_allow_objects);
+ Error err = decode_variant(v, &w[0], len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
return v;
@@ -2151,7 +2151,7 @@ Error _Thread::start(Object *p_instance, const StringName &p_method, const Varia
if (!thread) {
active = false;
target_method = StringName();
- target_instance = NULL;
+ target_instance = nullptr;
userdata = Variant();
return ERR_CANT_CREATE;
}
@@ -2179,11 +2179,11 @@ Variant _Thread::wait_to_finish() {
Variant r = ret;
active = false;
target_method = StringName();
- target_instance = NULL;
+ target_instance = nullptr;
userdata = Variant();
if (thread)
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
return r;
}
@@ -2202,8 +2202,8 @@ void _Thread::_bind_methods() {
_Thread::_Thread() {
active = false;
- thread = NULL;
- target_instance = NULL;
+ thread = nullptr;
+ target_instance = nullptr;
}
_Thread::~_Thread() {
@@ -2581,7 +2581,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}
-_Engine *_Engine::singleton = NULL;
+_Engine *_Engine::singleton = nullptr;
_Engine::_Engine() {
singleton = this;
@@ -2657,7 +2657,7 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
return result;
}
-_JSON *_JSON::singleton = NULL;
+_JSON *_JSON::singleton = nullptr;
_JSON::_JSON() {
singleton = this;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 510d87844d..d5f44cdc44 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -502,7 +502,7 @@ public:
String base64_to_utf8(const String &p_str);
_Marshalls() { singleton = this; }
- ~_Marshalls() { singleton = NULL; }
+ ~_Marshalls() { singleton = nullptr; }
};
class _Mutex : public Reference {
diff --git a/core/callable.cpp b/core/callable.cpp
index 2bb9ab167b..6a5dc151e5 100644
--- a/core/callable.cpp
+++ b/core/callable.cpp
@@ -79,7 +79,7 @@ StringName Callable::get_method() const {
}
CallableCustom *Callable::get_custom() const {
- ERR_FAIL_COND_V_MSG(!is_custom(), NULL,
+ ERR_FAIL_COND_V_MSG(!is_custom(), nullptr,
vformat("Can't get custom on non-CallableCustom \"%s\".", operator String()));
return custom;
}
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 50c924bdd2..691b5a20fd 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -261,8 +261,9 @@ HashMap<StringName, StringName> ClassDB::compat_classes;
ClassDB::ClassInfo::ClassInfo() {
api = API_NONE;
- creation_func = NULL;
- inherits_ptr = NULL;
+ class_ptr = nullptr;
+ creation_func = nullptr;
+ inherits_ptr = nullptr;
disabled = false;
exposed = false;
}
@@ -289,7 +290,7 @@ void ClassDB::get_class_list(List<StringName> *p_classes) {
OBJTYPE_RLOCK;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = classes.next(k))) {
@@ -303,7 +304,7 @@ void ClassDB::get_inheriters_from_class(const StringName &p_class, List<StringNa
OBJTYPE_RLOCK;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = classes.next(k))) {
@@ -316,7 +317,7 @@ void ClassDB::get_direct_inheriters_from_class(const StringName &p_class, List<S
OBJTYPE_RLOCK;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = classes.next(k))) {
@@ -376,7 +377,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
List<StringName> names;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = classes.next(k))) {
@@ -398,7 +399,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->method_map.next(k))) {
@@ -445,7 +446,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->constant_map.next(k))) {
@@ -465,7 +466,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->signal_map.next(k))) {
@@ -488,7 +489,7 @@ uint64_t ClassDB::get_api_hash(APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->property_setget.next(k))) {
@@ -548,14 +549,14 @@ Object *ClassDB::instance(const StringName &p_class) {
ti = classes.getptr(compat_classes[p_class]);
}
}
- ERR_FAIL_COND_V_MSG(!ti, NULL, "Cannot get class '" + String(p_class) + "'.");
- ERR_FAIL_COND_V_MSG(ti->disabled, NULL, "Class '" + String(p_class) + "' is disabled.");
- ERR_FAIL_COND_V(!ti->creation_func, NULL);
+ ERR_FAIL_COND_V_MSG(!ti, nullptr, "Cannot get class '" + String(p_class) + "'.");
+ ERR_FAIL_COND_V_MSG(ti->disabled, nullptr, "Class '" + String(p_class) + "' is disabled.");
+ ERR_FAIL_COND_V(!ti->creation_func, nullptr);
}
#ifdef TOOLS_ENABLED
if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {
ERR_PRINT("Class '" + String(p_class) + "' can only be instantiated by editor.");
- return NULL;
+ return nullptr;
}
#endif
return ti->creation_func();
@@ -571,7 +572,7 @@ bool ClassDB::can_instance(const StringName &p_class) {
return false;
}
#endif
- return (!ti->disabled && ti->creation_func != NULL);
+ return (!ti->disabled && ti->creation_func != nullptr);
}
void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {
@@ -594,7 +595,7 @@ void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherit
ti.inherits_ptr = &classes[ti.inherits];
} else {
- ti.inherits_ptr = NULL;
+ ti.inherits_ptr = nullptr;
}
}
@@ -652,7 +653,7 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b
#else
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = type->method_map.next(K))) {
@@ -684,7 +685,7 @@ MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) {
return *method;
type = type->inherits_ptr;
}
- return NULL;
+ return nullptr;
}
void ClassDB::bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant) {
@@ -736,7 +737,7 @@ void ClassDB::get_integer_constant_list(const StringName &p_class, List<String>
for (List<StringName>::Element *E = type->constant_order.front(); E; E = E->next())
p_constants->push_back(E->get());
#else
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = type->constant_map.next(K))) {
p_constants->push_back(*K);
@@ -783,7 +784,7 @@ StringName ClassDB::get_integer_constant_enum(const StringName &p_class, const S
while (type) {
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = type->enum_map.next(k))) {
List<StringName> &constants_list = type->enum_map.get(*k);
@@ -809,7 +810,7 @@ void ClassDB::get_enum_list(const StringName &p_class, List<StringName> *p_enums
while (type) {
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = type->enum_map.next(k))) {
p_enums->push_back(*k);
}
@@ -875,7 +876,7 @@ void ClassDB::get_signal_list(StringName p_class, List<MethodInfo> *p_signals, b
while (check) {
- const StringName *S = NULL;
+ const StringName *S = nullptr;
while ((S = check->signal_map.next(S))) {
p_signals->push_back(check->signal_map[*S]);
@@ -937,7 +938,7 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons
ERR_FAIL_COND(!type);
- MethodBind *mb_set = NULL;
+ MethodBind *mb_set = nullptr;
if (p_setter) {
mb_set = get_method(p_class, p_setter);
#ifdef DEBUG_METHODS_ENABLED
@@ -949,7 +950,7 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons
#endif
}
- MethodBind *mb_get = NULL;
+ MethodBind *mb_get = nullptr;
if (p_getter) {
mb_get = get_method(p_class, p_getter);
@@ -1086,9 +1087,9 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
Callable::CallError ce;
if (psg->_getptr) {
- r_value = psg->_getptr->call(p_object, NULL, 0, ce);
+ r_value = psg->_getptr->call(p_object, nullptr, 0, ce);
} else {
- r_value = p_object->call(psg->getter, NULL, 0, ce);
+ r_value = p_object->call(psg->getter, nullptr, 0, ce);
}
}
return true;
@@ -1245,33 +1246,33 @@ MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const c
#endif
OBJTYPE_WLOCK;
- ERR_FAIL_COND_V(!p_bind, NULL);
+ ERR_FAIL_COND_V(!p_bind, nullptr);
p_bind->set_name(mdname);
String instance_type = p_bind->get_instance_class();
#ifdef DEBUG_ENABLED
- ERR_FAIL_COND_V_MSG(has_method(instance_type, mdname), NULL, "Class " + String(instance_type) + " already has a method " + String(mdname) + ".");
+ ERR_FAIL_COND_V_MSG(has_method(instance_type, mdname), nullptr, "Class " + String(instance_type) + " already has a method " + String(mdname) + ".");
#endif
ClassInfo *type = classes.getptr(instance_type);
if (!type) {
memdelete(p_bind);
- ERR_FAIL_V_MSG(NULL, "Couldn't bind method '" + mdname + "' for instance '" + instance_type + "'.");
+ ERR_FAIL_V_MSG(nullptr, "Couldn't bind method '" + mdname + "' for instance '" + instance_type + "'.");
}
if (type->method_map.has(mdname)) {
memdelete(p_bind);
// overloading not supported
- ERR_FAIL_V_MSG(NULL, "Method already bound '" + instance_type + "::" + mdname + "'.");
+ ERR_FAIL_V_MSG(nullptr, "Method already bound '" + instance_type + "::" + mdname + "'.");
}
#ifdef DEBUG_METHODS_ENABLED
if (method_name.args.size() > p_bind->get_argument_count()) {
memdelete(p_bind);
- ERR_FAIL_V_MSG(NULL, "Method definition provides more arguments than the method actually has '" + instance_type + "::" + mdname + "'.");
+ ERR_FAIL_V_MSG(nullptr, "Method definition provides more arguments than the method actually has '" + instance_type + "::" + mdname + "'.");
}
p_bind->set_argument_names(method_name.args);
@@ -1382,7 +1383,7 @@ void ClassDB::add_resource_base_extension(const StringName &p_extension, const S
void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = resource_base_extensions.next(K))) {
@@ -1392,7 +1393,7 @@ void ClassDB::get_resource_base_extensions(List<String> *p_extensions) {
void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p_extensions) {
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = resource_base_extensions.next(K))) {
StringName cmp = resource_base_extensions[*K];
@@ -1412,7 +1413,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
default_values[p_class] = HashMap<StringName, Variant>();
}
- Object *c = NULL;
+ Object *c = nullptr;
bool cleanup_c = false;
if (Engine::get_singleton()->has_singleton(p_class)) {
@@ -1446,20 +1447,20 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
}
if (!default_values.has(p_class)) {
- if (r_valid != NULL) *r_valid = false;
+ if (r_valid != nullptr) *r_valid = false;
return Variant();
}
if (!default_values[p_class].has(p_property)) {
- if (r_valid != NULL) *r_valid = false;
+ if (r_valid != nullptr) *r_valid = false;
return Variant();
}
- if (r_valid != NULL) *r_valid = true;
+ if (r_valid != nullptr) *r_valid = true;
return default_values[p_class][p_property];
}
-RWLock *ClassDB::lock = NULL;
+RWLock *ClassDB::lock = nullptr;
void ClassDB::init() {
@@ -1476,13 +1477,13 @@ void ClassDB::cleanup() {
//OBJTYPE_LOCK; hah not here
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = classes.next(k))) {
ClassInfo &ti = classes[*k];
- const StringName *m = NULL;
+ const StringName *m = nullptr;
while ((m = ti.method_map.next(m))) {
memdelete(ti.method_map[*m]);
diff --git a/core/class_db.h b/core/class_db.h
index 35bbe6b6f5..1cbff34ea1 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -234,7 +234,7 @@ public:
MethodBind *bind = create_method_bind(p_method);
- return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, NULL, 0); //use static function, much smaller binary usage
+ return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, nullptr, 0); //use static function, much smaller binary usage
}
template <class N, class M>
@@ -315,7 +315,7 @@ public:
GLOBAL_LOCK_FUNCTION;
MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
- ERR_FAIL_COND_V(!bind, NULL);
+ ERR_FAIL_COND_V(!bind, nullptr);
bind->set_name(p_name);
bind->set_default_arguments(p_default_args);
@@ -325,13 +325,13 @@ public:
ClassInfo *type = classes.getptr(instance_type);
if (!type) {
memdelete(bind);
- ERR_FAIL_COND_V(!type, NULL);
+ ERR_FAIL_COND_V(!type, nullptr);
}
if (type->method_map.has(p_name)) {
memdelete(bind);
// overloading not supported
- ERR_FAIL_V_MSG(NULL, "Method already bound: " + instance_type + "::" + p_name + ".");
+ ERR_FAIL_V_MSG(nullptr, "Method already bound: " + instance_type + "::" + p_name + ".");
}
type->method_map[p_name] = bind;
#ifdef DEBUG_METHODS_ENABLED
@@ -351,12 +351,12 @@ public:
static void add_property_group(StringName p_class, const String &p_name, const String &p_prefix = "");
static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default);
- static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = NULL);
- static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = NULL);
+ static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
+ static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
- static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
- static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = NULL);
+ static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
+ static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
static StringName get_property_setter(StringName p_class, const StringName &p_property);
static StringName get_property_getter(StringName p_class, const StringName &p_property);
@@ -371,13 +371,13 @@ public:
static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant);
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);
+ static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = nullptr);
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);
- static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = NULL);
+ static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr);
static StringName get_category(const StringName &p_node);
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 85e8a847a0..3ce769c72c 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -113,7 +113,7 @@ CommandQueueMT::CommandQueueMT(bool p_sync) {
if (p_sync)
sync = memnew(Semaphore);
else
- sync = NULL;
+ sync = nullptr;
}
CommandQueueMT::~CommandQueueMT() {
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h
index cc08ae7004..558453bdf5 100644
--- a/core/command_queue_mt.h
+++ b/core/command_queue_mt.h
@@ -360,7 +360,7 @@ class CommandQueueMT {
if (dealloc_one()) {
goto tryagain;
}
- return NULL;
+ return nullptr;
}
} else {
// ahead of dealloc_ptr, check that there is room
@@ -374,11 +374,11 @@ class CommandQueueMT {
if (dealloc_one()) {
goto tryagain;
}
- return NULL;
+ return nullptr;
}
// if this happens, it's a bug
- ERR_FAIL_COND_V((COMMAND_MEM_SIZE - write_ptr) < 8, NULL);
+ ERR_FAIL_COND_V((COMMAND_MEM_SIZE - write_ptr) < 8, nullptr);
// zero means, wrap to beginning
uint32_t *p = (uint32_t *)&command_mem[write_ptr];
@@ -406,7 +406,7 @@ class CommandQueueMT {
lock();
T *ret;
- while ((ret = allocate<T>()) == NULL) {
+ while ((ret = allocate<T>()) == nullptr) {
unlock();
// sleep a little until fetch happened and some room is made
diff --git a/core/core_builders.py b/core/core_builders.py
index a06b61cb9b..d03874608e 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -11,15 +11,15 @@ def escape_string(s):
rev_result = []
while c >= 256:
c, low = (c // 256, c % 256)
- rev_result.append('\\%03o' % low)
- rev_result.append('\\%03o' % c)
- return ''.join(reversed(rev_result))
+ rev_result.append("\\%03o" % low)
+ rev_result.append("\\%03o" % c)
+ return "".join(reversed(rev_result))
- result = ''
+ result = ""
if isinstance(s, str):
- s = s.encode('utf-8')
+ s = s.encode("utf-8")
for c in s:
- if not(32 <= c < 127) or c in (ord('\\'), ord('"')):
+ if not (32 <= c < 127) or c in (ord("\\"), ord('"')):
result += charcode_to_c_escapes(c)
else:
result += chr(c)
@@ -34,6 +34,7 @@ def make_certs_header(target, source, env):
buf = f.read()
decomp_size = len(buf)
import zlib
+
buf = zlib.compress(buf)
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
@@ -41,9 +42,9 @@ def make_certs_header(target, source, env):
g.write("#define CERTS_COMPRESSED_GEN_H\n")
# System certs path. Editor will use them if defined. (for package maintainers)
- path = env['system_certs_path']
- g.write("#define _SYSTEM_CERTS_PATH \"%s\"\n" % str(path))
- if env['builtin_certs']:
+ path = env["system_certs_path"]
+ g.write('#define _SYSTEM_CERTS_PATH "%s"\n' % str(path))
+ if env["builtin_certs"]:
# Defined here and not in env so changing it does not trigger a full rebuild.
g.write("#define BUILTIN_CERTS_ENABLED\n")
g.write("static const int _certs_compressed_size = " + str(len(buf)) + ";\n")
@@ -59,8 +60,18 @@ def make_certs_header(target, source, env):
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"]
+ sections = [
+ "Project Founders",
+ "Lead Developer",
+ "Project Manager",
+ "Developers",
+ ]
+ sections_id = [
+ "AUTHORS_FOUNDERS",
+ "AUTHORS_LEAD_DEVELOPERS",
+ "AUTHORS_PROJECT_MANAGERS",
+ "AUTHORS_DEVELOPERS",
+ ]
src = source[0]
dst = target[0]
@@ -80,7 +91,7 @@ def make_authors_header(target, source, env):
for line in f:
if reading:
if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
+ g.write('\t"' + escape_string(line.strip()) + '",\n')
continue
if line.startswith("## "):
if reading:
@@ -103,10 +114,22 @@ def make_authors_header(target, source, env):
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"]
+ 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]
dst = target[0]
@@ -126,7 +149,7 @@ def make_donors_header(target, source, env):
for line in f:
if reading >= 0:
if line.startswith(" "):
- g.write("\t\"" + escape_string(line.strip()) + "\",\n")
+ g.write('\t"' + escape_string(line.strip()) + '",\n')
continue
if line.startswith("## "):
if reading:
@@ -169,8 +192,8 @@ def make_license_header(target, source, env):
return line
def next_tag(self):
- if not ':' in self.current:
- return ('', [])
+ if not ":" in self.current:
+ return ("", [])
tag, line = self.current.split(":", 1)
lines = [line.strip()]
while self.next_line() and self.current.startswith(" "):
@@ -178,6 +201,7 @@ def make_license_header(target, source, env):
return (tag, lines)
from collections import OrderedDict
+
projects = OrderedDict()
license_list = []
@@ -218,26 +242,30 @@ def make_license_header(target, source, env):
with open(src_license, "r", encoding="utf-8") 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\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(
+ "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('\t"' + escape_string(line) + '",\n')
f.write("};\n\n")
f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n")
@@ -246,11 +274,21 @@ def make_license_header(target, source, env):
for project_name, project in iter(projects.items()):
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")
+ 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")
@@ -258,30 +296,37 @@ def make_license_header(target, source, env):
f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n")
for project_name, project in iter(projects.items()):
- f.write("\t{ \"" + escape_string(project_name) + "\", "
- + "&COPYRIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], "
- + str(len(project)) + " },\n")
+ 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('\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")
+ f.write('\t"\\n"\n')
else:
- f.write("\t\"" + escape_string(line) + "\\n\"\n")
- f.write("\t\"\",\n\n")
+ f.write('\t"' + escape_string(line) + '\\n"\n')
+ f.write('\t"",\n\n')
f.write("};\n\n")
f.write("#endif // LICENSE_GEN_H\n")
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp
index 253d5f1acb..1d3b333efc 100644
--- a/core/core_string_names.cpp
+++ b/core/core_string_names.cpp
@@ -30,7 +30,7 @@
#include "core_string_names.h"
-CoreStringNames *CoreStringNames::singleton = NULL;
+CoreStringNames *CoreStringNames::singleton = nullptr;
CoreStringNames::CoreStringNames() :
_free(StaticCString::create("free")),
diff --git a/core/core_string_names.h b/core/core_string_names.h
index dce0244631..2ade44f4e0 100644
--- a/core/core_string_names.h
+++ b/core/core_string_names.h
@@ -41,7 +41,7 @@ class CoreStringNames {
static void create() { singleton = memnew(CoreStringNames); }
static void free() {
memdelete(singleton);
- singleton = NULL;
+ singleton = nullptr;
}
CoreStringNames();
diff --git a/core/cowdata.h b/core/cowdata.h
index 8b01b63aaa..975a572906 100644
--- a/core/cowdata.h
+++ b/core/cowdata.h
@@ -61,7 +61,7 @@ private:
_FORCE_INLINE_ uint32_t *_get_refcount() const {
if (!_ptr)
- return NULL;
+ return nullptr;
return reinterpret_cast<uint32_t *>(_ptr) - 2;
}
@@ -69,7 +69,7 @@ private:
_FORCE_INLINE_ uint32_t *_get_size() const {
if (!_ptr)
- return NULL;
+ return nullptr;
return reinterpret_cast<uint32_t *>(_ptr) - 1;
}
@@ -77,7 +77,7 @@ private:
_FORCE_INLINE_ T *_get_data() const {
if (!_ptr)
- return NULL;
+ return nullptr;
return reinterpret_cast<T *>(_ptr);
}
@@ -261,7 +261,7 @@ Error CowData<T>::resize(int p_size) {
if (p_size == 0) {
// wants to clean up
_unref(_ptr);
- _ptr = NULL;
+ _ptr = nullptr;
return OK;
}
@@ -356,7 +356,7 @@ void CowData<T>::_ref(const CowData &p_from) {
return; // self assign, do nothing.
_unref(_ptr);
- _ptr = NULL;
+ _ptr = nullptr;
if (!p_from._ptr)
return; //nothing to do
@@ -369,7 +369,7 @@ void CowData<T>::_ref(const CowData &p_from) {
template <class T>
CowData<T>::CowData() {
- _ptr = NULL;
+ _ptr = nullptr;
}
template <class T>
diff --git a/core/crypto/SCsub b/core/crypto/SCsub
index 0a3f05d87a..da4a9c9381 100644
--- a/core/crypto/SCsub
+++ b/core/crypto/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_crypto = env.Clone()
@@ -22,7 +22,9 @@ if not has_module:
env_thirdparty = env_crypto.Clone()
env_thirdparty.disable_warnings()
# Custom config file
- env_thirdparty.Append(CPPDEFINES=[('MBEDTLS_CONFIG_FILE', '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')])
+ env_thirdparty.Append(
+ CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')]
+ )
thirdparty_mbedtls_dir = "#thirdparty/mbedtls/library/"
thirdparty_mbedtls_sources = [
"aes.c",
@@ -30,7 +32,7 @@ if not has_module:
"md5.c",
"sha1.c",
"sha256.c",
- "godot_core_mbedtls_platform.c"
+ "godot_core_mbedtls_platform.c",
]
thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources)
diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp
index 793bf719b7..ab8548e3ba 100644
--- a/core/crypto/crypto.cpp
+++ b/core/crypto/crypto.cpp
@@ -36,11 +36,11 @@
/// Resources
-CryptoKey *(*CryptoKey::_create)() = NULL;
+CryptoKey *(*CryptoKey::_create)() = nullptr;
CryptoKey *CryptoKey::create() {
if (_create)
return _create();
- return NULL;
+ return nullptr;
}
void CryptoKey::_bind_methods() {
@@ -48,11 +48,11 @@ void CryptoKey::_bind_methods() {
ClassDB::bind_method(D_METHOD("load", "path"), &CryptoKey::load);
}
-X509Certificate *(*X509Certificate::_create)() = NULL;
+X509Certificate *(*X509Certificate::_create)() = nullptr;
X509Certificate *X509Certificate::create() {
if (_create)
return _create();
- return NULL;
+ return nullptr;
}
void X509Certificate::_bind_methods() {
@@ -62,8 +62,8 @@ void X509Certificate::_bind_methods() {
/// Crypto
-void (*Crypto::_load_default_certificates)(String p_path) = NULL;
-Crypto *(*Crypto::_create)() = NULL;
+void (*Crypto::_load_default_certificates)(String p_path) = nullptr;
+Crypto *(*Crypto::_create)() = nullptr;
Crypto *Crypto::create() {
if (_create)
return _create();
@@ -87,11 +87,11 @@ PackedByteArray Crypto::generate_random_bytes(int p_bytes) {
}
Ref<CryptoKey> Crypto::generate_rsa(int p_bytes) {
- ERR_FAIL_V_MSG(NULL, "generate_rsa is not available when mbedtls module is disabled.");
+ ERR_FAIL_V_MSG(nullptr, "generate_rsa is not available when mbedtls module is disabled.");
}
Ref<X509Certificate> Crypto::generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) {
- ERR_FAIL_V_MSG(NULL, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
+ ERR_FAIL_V_MSG(nullptr, "generate_self_signed_certificate is not available when mbedtls module is disabled.");
}
Crypto::Crypto() {
@@ -113,7 +113,7 @@ RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_origi
key->load(p_path);
return key;
}
- return NULL;
+ return nullptr;
}
void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {
diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h
index 3279c0620f..e515367de5 100644
--- a/core/crypto/crypto.h
+++ b/core/crypto/crypto.h
@@ -87,7 +87,7 @@ class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
GDCLASS(ResourceFormatLoaderCrypto, ResourceFormatLoader);
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/core/crypto/hashing_context.cpp b/core/crypto/hashing_context.cpp
index a4d8a93c8a..af43bc9bad 100644
--- a/core/crypto/hashing_context.cpp
+++ b/core/crypto/hashing_context.cpp
@@ -33,9 +33,9 @@
#include "core/crypto/crypto_core.h"
Error HashingContext::start(HashType p_type) {
- ERR_FAIL_COND_V(ctx != NULL, ERR_ALREADY_IN_USE);
+ ERR_FAIL_COND_V(ctx != nullptr, ERR_ALREADY_IN_USE);
_create_ctx(p_type);
- ERR_FAIL_COND_V(ctx == NULL, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(ctx == nullptr, ERR_UNAVAILABLE);
switch (type) {
case HASH_MD5:
return ((CryptoCore::MD5Context *)ctx)->start();
@@ -48,7 +48,7 @@ Error HashingContext::start(HashType p_type) {
}
Error HashingContext::update(PackedByteArray p_chunk) {
- ERR_FAIL_COND_V(ctx == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(ctx == nullptr, ERR_UNCONFIGURED);
size_t len = p_chunk.size();
ERR_FAIL_COND_V(len == 0, FAILED);
const uint8_t *r = p_chunk.ptr();
@@ -64,7 +64,7 @@ Error HashingContext::update(PackedByteArray p_chunk) {
}
PackedByteArray HashingContext::finish() {
- ERR_FAIL_COND_V(ctx == NULL, PackedByteArray());
+ ERR_FAIL_COND_V(ctx == nullptr, PackedByteArray());
PackedByteArray out;
Error err = FAILED;
switch (type) {
@@ -99,7 +99,7 @@ void HashingContext::_create_ctx(HashType p_type) {
ctx = memnew(CryptoCore::SHA256Context);
break;
default:
- ctx = NULL;
+ ctx = nullptr;
}
}
@@ -116,7 +116,7 @@ void HashingContext::_delete_ctx() {
memdelete((CryptoCore::SHA256Context *)ctx);
break;
}
- ctx = NULL;
+ ctx = nullptr;
}
void HashingContext::_bind_methods() {
@@ -129,10 +129,10 @@ void HashingContext::_bind_methods() {
}
HashingContext::HashingContext() {
- ctx = NULL;
+ ctx = nullptr;
}
HashingContext::~HashingContext() {
- if (ctx != NULL)
+ if (ctx != nullptr)
_delete_ctx();
}
diff --git a/core/debugger/SCsub b/core/debugger/SCsub
index 1c5f954470..19a6549225 100644
--- a/core/debugger/SCsub
+++ b/core/debugger/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/debugger/debugger_marshalls.cpp b/core/debugger/debugger_marshalls.cpp
index 427c005b60..410c55129d 100644
--- a/core/debugger/debugger_marshalls.cpp
+++ b/core/debugger/debugger_marshalls.cpp
@@ -227,7 +227,7 @@ Array DebuggerMarshalls::ScriptStackVariable::serialize(int max_size) {
}
int len = 0;
- Error err = encode_variant(var, NULL, len, true);
+ Error err = encode_variant(var, nullptr, len, true);
if (err != OK)
ERR_PRINT("Failed to encode variant.");
diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp
index c64d886800..bfe38d0f4a 100644
--- a/core/debugger/engine_debugger.cpp
+++ b/core/debugger/engine_debugger.cpp
@@ -35,8 +35,8 @@
#include "core/debugger/script_debugger.h"
#include "core/os/os.h"
-EngineDebugger *EngineDebugger::singleton = NULL;
-ScriptDebugger *EngineDebugger::script_debugger = NULL;
+EngineDebugger *EngineDebugger::singleton = nullptr;
+ScriptDebugger *EngineDebugger::script_debugger = nullptr;
Map<StringName, EngineDebugger::Profiler> EngineDebugger::profilers;
Map<StringName, EngineDebugger::Capture> EngineDebugger::captures;
@@ -173,7 +173,7 @@ void EngineDebugger::deinitialize() {
singleton->poll_events(false);
memdelete(singleton);
- singleton = NULL;
+ singleton = nullptr;
profilers.clear();
captures.clear();
}
@@ -181,6 +181,6 @@ void EngineDebugger::deinitialize() {
EngineDebugger::~EngineDebugger() {
if (script_debugger)
memdelete(script_debugger);
- script_debugger = NULL;
- singleton = NULL;
+ script_debugger = nullptr;
+ singleton = nullptr;
}
diff --git a/core/debugger/engine_debugger.h b/core/debugger/engine_debugger.h
index 9e01aeba18..7b6b77ca9b 100644
--- a/core/debugger/engine_debugger.h
+++ b/core/debugger/engine_debugger.h
@@ -50,10 +50,10 @@ public:
class Profiler {
friend class EngineDebugger;
- ProfilingToggle toggle = NULL;
- ProfilingAdd add = NULL;
- ProfilingTick tick = NULL;
- void *data = NULL;
+ ProfilingToggle toggle = nullptr;
+ ProfilingAdd add = nullptr;
+ ProfilingTick tick = nullptr;
+ void *data = nullptr;
bool active = false;
public:
@@ -69,8 +69,8 @@ public:
class Capture {
friend class EngineDebugger;
- CaptureFunc capture = NULL;
- void *data = NULL;
+ CaptureFunc capture = nullptr;
+ void *data = nullptr;
public:
Capture() {}
@@ -97,7 +97,7 @@ protected:
public:
_FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; }
- _FORCE_INLINE_ static bool is_active() { return singleton != NULL && script_debugger != NULL; }
+ _FORCE_INLINE_ static bool is_active() { return singleton != nullptr && script_debugger != nullptr; }
_FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; };
diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp
index 01e30fb621..6d88ceb2c1 100644
--- a/core/debugger/local_debugger.cpp
+++ b/core/debugger/local_debugger.cpp
@@ -402,7 +402,7 @@ LocalDebugger::LocalDebugger() {
[](void *p_user, bool p_enable, const Array &p_opts) {
((ScriptsProfiler *)p_user)->toggle(p_enable, p_opts);
},
- NULL,
+ nullptr,
[](void *p_user, float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) {
((ScriptsProfiler *)p_user)->tick(p_frame_time, p_idle_time, p_physics_time, p_physics_frame_time);
});
diff --git a/core/debugger/local_debugger.h b/core/debugger/local_debugger.h
index e299df0546..2c4302f4da 100644
--- a/core/debugger/local_debugger.h
+++ b/core/debugger/local_debugger.h
@@ -40,7 +40,7 @@ class LocalDebugger : public EngineDebugger {
private:
struct ScriptsProfiler;
- ScriptsProfiler *scripts_profiler = NULL;
+ ScriptsProfiler *scripts_profiler = nullptr;
String target_function;
Map<String, String> options;
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index 66b890be23..c2996e552f 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -373,7 +373,7 @@ struct RemoteDebugger::VisualProfiler {
struct RemoteDebugger::PerformanceProfiler {
- Object *performance = NULL;
+ Object *performance = nullptr;
int last_perf_time = 0;
void toggle(bool p_enable, const Array &p_opts) {}
@@ -867,7 +867,7 @@ RemoteDebugger *RemoteDebugger::create_for_uri(const String &p_uri) {
Ref<RemoteDebuggerPeer> peer = RemoteDebuggerPeer::create_from_uri(p_uri);
if (peer.is_valid())
return memnew(RemoteDebugger(peer));
- return NULL;
+ return nullptr;
}
RemoteDebugger::RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer) {
diff --git a/core/debugger/remote_debugger.h b/core/debugger/remote_debugger.h
index 83789c67f9..f805eec631 100644
--- a/core/debugger/remote_debugger.h
+++ b/core/debugger/remote_debugger.h
@@ -50,10 +50,10 @@ private:
struct VisualProfiler;
struct PerformanceProfiler;
- NetworkProfiler *network_profiler = NULL;
- ServersProfiler *servers_profiler = NULL;
- VisualProfiler *visual_profiler = NULL;
- PerformanceProfiler *performance_profiler = NULL;
+ NetworkProfiler *network_profiler = nullptr;
+ ServersProfiler *servers_profiler = nullptr;
+ VisualProfiler *visual_profiler = nullptr;
+ PerformanceProfiler *performance_profiler = nullptr;
Ref<RemoteDebuggerPeer> peer;
diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp
index 42c2c8e309..ed04431177 100644
--- a/core/debugger/remote_debugger_peer.cpp
+++ b/core/debugger/remote_debugger_peer.cpp
@@ -68,7 +68,7 @@ void RemoteDebuggerPeerTCP::close() {
running = false;
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
tcp_client->disconnect_from_host();
out_buf.resize(0);
@@ -106,7 +106,7 @@ void RemoteDebuggerPeerTCP::_write_out() {
out_queue.pop_front();
mutex.unlock();
int size = 0;
- Error err = encode_variant(var, NULL, size);
+ Error err = encode_variant(var, nullptr, size);
ERR_CONTINUE(err != OK || size > out_buf.size() - 4); // 4 bytes separator.
encode_uint32(size, buf);
encode_variant(var, buf + 4, size);
diff --git a/core/debugger/remote_debugger_peer.h b/core/debugger/remote_debugger_peer.h
index 6fc3214a51..e4b838f145 100644
--- a/core/debugger/remote_debugger_peer.h
+++ b/core/debugger/remote_debugger_peer.h
@@ -58,7 +58,7 @@ class RemoteDebuggerPeerTCP : public RemoteDebuggerPeer {
private:
Ref<StreamPeerTCP> tcp_client;
Mutex mutex;
- Thread *thread = NULL;
+ Thread *thread = nullptr;
List<Array> in_queue;
List<Array> out_queue;
int out_left = 0;
diff --git a/core/debugger/script_debugger.h b/core/debugger/script_debugger.h
index a60b57c637..e5066273d2 100644
--- a/core/debugger/script_debugger.h
+++ b/core/debugger/script_debugger.h
@@ -47,7 +47,7 @@ class ScriptDebugger {
Map<int, Set<StringName>> breakpoints;
- ScriptLanguage *break_lang = NULL;
+ ScriptLanguage *break_lang = nullptr;
Vector<StackInfo> error_stack_info;
public:
diff --git a/core/dictionary.cpp b/core/dictionary.cpp
index cdb518228b..bc3b792bd5 100644
--- a/core/dictionary.cpp
+++ b/core/dictionary.cpp
@@ -90,7 +90,7 @@ const Variant *Dictionary::getptr(const Variant &p_key) const {
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key);
if (!E)
- return NULL;
+ return nullptr;
return &E.get();
}
@@ -99,7 +99,7 @@ Variant *Dictionary::getptr(const Variant &p_key) {
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(p_key);
if (!E)
- return NULL;
+ return nullptr;
return &E.get();
}
@@ -186,7 +186,7 @@ void Dictionary::_unref() const {
if (_p->refcount.unref()) {
memdelete(_p);
}
- _p = NULL;
+ _p = nullptr;
}
uint32_t Dictionary::hash() const {
@@ -236,17 +236,17 @@ Array Dictionary::values() const {
const Variant *Dictionary::next(const Variant *p_key) const {
- if (p_key == NULL) {
+ if (p_key == nullptr) {
// caller wants to get the first element
if (_p->variant_map.front())
return &_p->variant_map.front().key();
- return NULL;
+ return nullptr;
}
OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::Element E = _p->variant_map.find(*p_key);
if (E && E.next())
return &E.next().key();
- return NULL;
+ return nullptr;
}
Dictionary Dictionary::duplicate(bool p_deep) const {
@@ -270,7 +270,7 @@ const void *Dictionary::id() const {
}
Dictionary::Dictionary(const Dictionary &p_from) {
- _p = NULL;
+ _p = nullptr;
_ref(p_from);
}
diff --git a/core/dictionary.h b/core/dictionary.h
index 0ce817f3d4..c6cbacc144 100644
--- a/core/dictionary.h
+++ b/core/dictionary.h
@@ -75,7 +75,7 @@ public:
uint32_t hash() const;
void operator=(const Dictionary &p_dictionary);
- const Variant *next(const Variant *p_key = NULL) const;
+ const Variant *next(const Variant *p_key = nullptr) const;
Array keys() const;
Array values() const;
diff --git a/core/engine.cpp b/core/engine.cpp
index 85ad175f38..36987eab31 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -114,7 +114,7 @@ Dictionary Engine::get_version_info() const {
static Array array_from_info(const char *const *info_list) {
Array arr;
- for (int i = 0; info_list[i] != NULL; i++) {
+ for (int i = 0; info_list[i] != nullptr; i++) {
arr.push_back(info_list[i]);
}
return arr;
@@ -193,7 +193,7 @@ void Engine::add_singleton(const Singleton &p_singleton) {
Object *Engine::get_singleton_object(const String &p_name) const {
const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
- ERR_FAIL_COND_V_MSG(!E, NULL, "Failed to retrieve non-existent singleton '" + p_name + "'.");
+ ERR_FAIL_COND_V_MSG(!E, nullptr, "Failed to retrieve non-existent singleton '" + p_name + "'.");
return E->get();
};
@@ -208,7 +208,7 @@ void Engine::get_singletons(List<Singleton> *p_singletons) {
p_singletons->push_back(E->get());
}
-Engine *Engine::singleton = NULL;
+Engine *Engine::singleton = nullptr;
Engine *Engine::get_singleton() {
return singleton;
diff --git a/core/engine.h b/core/engine.h
index cfe3a918fc..4cfdeffa82 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -42,7 +42,7 @@ public:
struct Singleton {
StringName name;
Object *ptr;
- Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) :
+ Singleton(const StringName &p_name = StringName(), Object *p_ptr = nullptr) :
name(p_name),
ptr(p_ptr) {
}
diff --git a/core/error_macros.cpp b/core/error_macros.cpp
index f6da990562..5de070844a 100644
--- a/core/error_macros.cpp
+++ b/core/error_macros.cpp
@@ -34,7 +34,7 @@
#include "core/ustring.h"
#include "os/os.h"
-static ErrorHandlerList *error_handler_list = NULL;
+static ErrorHandlerList *error_handler_list = nullptr;
void add_error_handler(ErrorHandlerList *p_handler) {
@@ -48,7 +48,7 @@ void remove_error_handler(ErrorHandlerList *p_handler) {
_global_lock();
- ErrorHandlerList *prev = NULL;
+ ErrorHandlerList *prev = nullptr;
ErrorHandlerList *l = error_handler_list;
while (l) {
diff --git a/core/hash_map.h b/core/hash_map.h
index e40b00a67a..f27a86cc02 100644
--- a/core/hash_map.h
+++ b/core/hash_map.h
@@ -197,14 +197,14 @@ private:
e = e->next;
}
- return NULL;
+ return nullptr;
}
Element *create_element(const TKey &p_key) {
/* if element doesn't exist, create it */
Element *e = memnew(Element);
- ERR_FAIL_COND_V_MSG(!e, NULL, "Out of memory.");
+ ERR_FAIL_COND_V_MSG(!e, nullptr, "Out of memory.");
uint32_t hash = Hasher::hash(p_key);
uint32_t index = hash & ((1 << hash_table_power) - 1);
e->next = hash_table[index];
@@ -234,7 +234,7 @@ private:
for (int i = 0; i < (1 << p_t.hash_table_power); i++) {
- hash_table[i] = NULL;
+ hash_table[i] = nullptr;
const Element *e = p_t.hash_table[i];
@@ -260,7 +260,7 @@ public:
Element *set(const Pair &p_pair) {
- Element *e = NULL;
+ Element *e = nullptr;
if (!hash_table)
make_hash_table(); // if no table, make one
else
@@ -272,7 +272,7 @@ public:
e = create_element(p_pair.key);
if (!e)
- return NULL;
+ return nullptr;
check_hash_table(); // perform mantenience routine
}
@@ -282,12 +282,12 @@ public:
bool has(const TKey &p_key) const {
- return getptr(p_key) != NULL;
+ return getptr(p_key) != nullptr;
}
/**
* Get a key from data, return a const reference.
- * WARNING: this doesn't check errors, use either getptr and check NULL, or check
+ * WARNING: this doesn't check errors, use either getptr and check nullptr, or check
* first with has(key)
*/
@@ -306,38 +306,38 @@ public:
}
/**
- * Same as get, except it can return NULL when item was not found.
+ * Same as get, except it can return nullptr when item was not found.
* This is mainly used for speed purposes.
*/
_FORCE_INLINE_ TData *getptr(const TKey &p_key) {
if (unlikely(!hash_table))
- return NULL;
+ return nullptr;
Element *e = const_cast<Element *>(get_element(p_key));
if (e)
return &e->pair.data;
- return NULL;
+ return nullptr;
}
_FORCE_INLINE_ const TData *getptr(const TKey &p_key) const {
if (unlikely(!hash_table))
- return NULL;
+ return nullptr;
const Element *e = const_cast<Element *>(get_element(p_key));
if (e)
return &e->pair.data;
- return NULL;
+ return nullptr;
}
/**
- * Same as get, except it can return NULL when item was not found.
+ * Same as get, except it can return nullptr when item was not found.
* This version is custom, will take a hash and a custom key (that should support operator==()
*/
@@ -345,7 +345,7 @@ public:
_FORCE_INLINE_ TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) {
if (unlikely(!hash_table))
- return NULL;
+ return nullptr;
uint32_t hash = p_custom_hash;
uint32_t index = hash & ((1 << hash_table_power) - 1);
@@ -364,14 +364,14 @@ public:
e = e->next;
}
- return NULL;
+ return nullptr;
}
template <class C>
_FORCE_INLINE_ const TData *custom_getptr(C p_custom_key, uint32_t p_custom_hash) const {
if (unlikely(!hash_table))
- return NULL;
+ return nullptr;
uint32_t hash = p_custom_hash;
uint32_t index = hash & ((1 << hash_table_power) - 1);
@@ -390,7 +390,7 @@ public:
e = e->next;
}
- return NULL;
+ return nullptr;
}
/**
@@ -406,7 +406,7 @@ public:
uint32_t index = hash & ((1 << hash_table_power) - 1);
Element *e = hash_table[index];
- Element *p = NULL;
+ Element *p = nullptr;
while (e) {
/* checking hash first avoids comparing key, which may take longer */
@@ -443,7 +443,7 @@ public:
}
inline TData &operator[](const TKey &p_key) { //assignment
- Element *e = NULL;
+ Element *e = nullptr;
if (!hash_table)
make_hash_table(); // if no table, make one
else
@@ -462,12 +462,12 @@ public:
/**
* Get the next key to p_key, and the first key if p_key is null.
- * Returns a pointer to the next key if found, NULL otherwise.
+ * Returns a pointer to the next key if found, nullptr otherwise.
* Adding/Removing elements while iterating will, of course, have unexpected results, don't do it.
*
* Example:
*
- * const TKey *k=NULL;
+ * const TKey *k=nullptr;
*
* while( (k=table.next(k)) ) {
*
@@ -478,7 +478,7 @@ public:
const TKey *next(const TKey *p_key) const {
if (unlikely(!hash_table))
- return NULL;
+ return nullptr;
if (!p_key) { /* get the first key */
@@ -492,7 +492,7 @@ public:
} else { /* get the next key */
const Element *e = get_element(*p_key);
- ERR_FAIL_COND_V_MSG(!e, NULL, "Invalid key supplied.");
+ ERR_FAIL_COND_V_MSG(!e, nullptr, "Invalid key supplied.");
if (e->next) {
/* if there is a "next" in the list, return that */
return &e->next->pair.key;
@@ -511,7 +511,7 @@ public:
/* nothing found, was at end */
}
- return NULL; /* nothing found */
+ return nullptr; /* nothing found */
}
inline unsigned int size() const {
@@ -552,7 +552,7 @@ public:
}
HashMap() {
- hash_table = NULL;
+ hash_table = nullptr;
elements = 0;
hash_table_power = 0;
}
@@ -586,7 +586,7 @@ public:
HashMap(const HashMap &p_table) {
- hash_table = NULL;
+ hash_table = nullptr;
elements = 0;
hash_table_power = 0;
diff --git a/core/image.cpp b/core/image.cpp
index d691c4f442..2097f27b01 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -84,10 +84,10 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
};
-SavePNGFunc Image::save_png_func = NULL;
-SaveEXRFunc Image::save_exr_func = NULL;
+SavePNGFunc Image::save_png_func = nullptr;
+SaveEXRFunc Image::save_exr_func = nullptr;
-SavePNGBufferFunc Image::save_png_buffer_func = NULL;
+SavePNGBufferFunc Image::save_png_buffer_func = nullptr;
void Image::_put_pixelb(int p_x, int p_y, uint32_t p_pixelsize, uint8_t *p_data, const uint8_t *p_pixel) {
@@ -2099,14 +2099,14 @@ Error Image::load(const String &p_path) {
Error Image::save_png(const String &p_path) const {
- if (save_png_func == NULL)
+ if (save_png_func == nullptr)
return ERR_UNAVAILABLE;
return save_png_func(p_path, Ref<Image>((Image *)this));
}
Vector<uint8_t> Image::save_png_to_buffer() const {
- if (save_png_buffer_func == NULL) {
+ if (save_png_buffer_func == nullptr) {
return Vector<uint8_t>();
}
@@ -2115,7 +2115,7 @@ Vector<uint8_t> Image::save_png_to_buffer() const {
Error Image::save_exr(const String &p_path, bool p_grayscale) const {
- if (save_exr_func == NULL)
+ if (save_exr_func == nullptr)
return ERR_UNAVAILABLE;
return save_exr_func(p_path, Ref<Image>((Image *)this), p_grayscale);
@@ -2533,28 +2533,28 @@ void Image::fill(const Color &c) {
}
}
-ImageMemLoadFunc Image::_png_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_jpg_mem_loader_func = NULL;
-ImageMemLoadFunc Image::_webp_mem_loader_func = NULL;
+ImageMemLoadFunc Image::_png_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_jpg_mem_loader_func = nullptr;
+ImageMemLoadFunc Image::_webp_mem_loader_func = nullptr;
-void (*Image::_image_compress_bc_func)(Image *, float, Image::UsedChannels) = NULL;
-void (*Image::_image_compress_bptc_func)(Image *, float, Image::UsedChannels) = NULL;
-void (*Image::_image_compress_pvrtc2_func)(Image *) = NULL;
-void (*Image::_image_compress_pvrtc4_func)(Image *) = NULL;
-void (*Image::_image_compress_etc1_func)(Image *, float) = NULL;
-void (*Image::_image_compress_etc2_func)(Image *, float, Image::UsedChannels) = NULL;
-void (*Image::_image_decompress_pvrtc)(Image *) = NULL;
-void (*Image::_image_decompress_bc)(Image *) = NULL;
-void (*Image::_image_decompress_bptc)(Image *) = NULL;
-void (*Image::_image_decompress_etc1)(Image *) = NULL;
-void (*Image::_image_decompress_etc2)(Image *) = NULL;
+void (*Image::_image_compress_bc_func)(Image *, float, Image::UsedChannels) = nullptr;
+void (*Image::_image_compress_bptc_func)(Image *, float, Image::UsedChannels) = nullptr;
+void (*Image::_image_compress_pvrtc2_func)(Image *) = nullptr;
+void (*Image::_image_compress_pvrtc4_func)(Image *) = nullptr;
+void (*Image::_image_compress_etc1_func)(Image *, float) = nullptr;
+void (*Image::_image_compress_etc2_func)(Image *, float, Image::UsedChannels) = nullptr;
+void (*Image::_image_decompress_pvrtc)(Image *) = nullptr;
+void (*Image::_image_decompress_bc)(Image *) = nullptr;
+void (*Image::_image_decompress_bptc)(Image *) = nullptr;
+void (*Image::_image_decompress_etc1)(Image *) = nullptr;
+void (*Image::_image_decompress_etc2)(Image *) = nullptr;
-Vector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = NULL;
-Ref<Image> (*Image::lossy_unpacker)(const Vector<uint8_t> &) = NULL;
-Vector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = NULL;
-Ref<Image> (*Image::lossless_unpacker)(const Vector<uint8_t> &) = NULL;
-Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = NULL;
-Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = NULL;
+Vector<uint8_t> (*Image::lossy_packer)(const Ref<Image> &, float) = nullptr;
+Ref<Image> (*Image::lossy_unpacker)(const Vector<uint8_t> &) = nullptr;
+Vector<uint8_t> (*Image::lossless_packer)(const Ref<Image> &) = nullptr;
+Ref<Image> (*Image::lossless_unpacker)(const Vector<uint8_t> &) = nullptr;
+Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = nullptr;
+Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = nullptr;
void Image::_set_data(const Dictionary &p_data) {
@@ -2945,7 +2945,7 @@ void Image::_bind_methods() {
ClassDB::bind_method(D_METHOD("detect_used_channels", "source"), &Image::detect_used_channels, DEFVAL(COMPRESS_SOURCE_GENERIC));
ClassDB::bind_method(D_METHOD("compress", "mode", "source", "lossy_quality"), &Image::compress, DEFVAL(COMPRESS_SOURCE_GENERIC), DEFVAL(0.7));
- ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "lossy_quality"), &Image::compress, DEFVAL(0.7));
+ ClassDB::bind_method(D_METHOD("compress_from_channels", "mode", "channels", "lossy_quality"), &Image::compress_from_channels, DEFVAL(0.7));
ClassDB::bind_method(D_METHOD("decompress"), &Image::decompress);
ClassDB::bind_method(D_METHOD("is_compressed"), &Image::is_compressed);
diff --git a/core/image.h b/core/image.h
index 9453f41334..5bd73fa677 100644
--- a/core/image.h
+++ b/core/image.h
@@ -187,7 +187,7 @@ private:
_FORCE_INLINE_ void _get_mipmap_offset_and_size(int p_mipmap, int &r_offset, int &r_width, int &r_height) const; //get where the mipmap begins in data
- static int _get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps = -1, int *r_mm_width = NULL, int *r_mm_height = NULL);
+ static int _get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps = -1, int *r_mm_width = nullptr, int *r_mm_height = nullptr);
bool _can_modify(Format p_format) const;
_FORCE_INLINE_ void _put_pixelb(int p_x, int p_y, uint32_t p_pixelsize, uint8_t *p_data, const uint8_t *p_pixel);
diff --git a/core/input/SCsub b/core/input/SCsub
index f1660932e5..d46e52a347 100644
--- a/core/input/SCsub
+++ b/core/input/SCsub
@@ -1,20 +1,28 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
from platform_methods import run_in_subprocess
import input_builders
# Order matters here. Higher index controller database files write on top of lower index database files.
-controller_databases = ["#core/input/gamecontrollerdb_204.txt", "#core/input/gamecontrollerdb_205.txt", "#core/input/gamecontrollerdb.txt", "#core/input/godotcontrollerdb.txt"]
+controller_databases = [
+ "#core/input/gamecontrollerdb_204.txt",
+ "#core/input/gamecontrollerdb_205.txt",
+ "#core/input/gamecontrollerdb.txt",
+ "#core/input/godotcontrollerdb.txt",
+]
env.Depends("#core/input/default_controller_mappings.gen.cpp", controller_databases)
-env.CommandNoCache("#core/input/default_controller_mappings.gen.cpp", controller_databases, run_in_subprocess(input_builders.make_default_controller_mappings))
+env.CommandNoCache(
+ "#core/input/default_controller_mappings.gen.cpp",
+ controller_databases,
+ run_in_subprocess(input_builders.make_default_controller_mappings),
+)
env.add_source_files(env.core_sources, "*.cpp")
# Don't warn about duplicate entry here, we need it registered manually for first build,
# even if later builds will pick it up twice due to above *.cpp globbing.
env.add_source_files(env.core_sources, "#core/input/default_controller_mappings.gen.cpp", warn_duplicates=False)
-
diff --git a/core/input/input_builders.py b/core/input/input_builders.py
index ca142c0c80..6184c5debb 100644
--- a/core/input/input_builders.py
+++ b/core/input/input_builders.py
@@ -12,8 +12,8 @@ def make_default_controller_mappings(target, source, env):
g = open(dst, "w")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
- g.write("#include \"core/typedefs.h\"\n")
- g.write("#include \"core/input/default_controller_mappings.h\"\n")
+ g.write('#include "core/typedefs.h"\n')
+ g.write('#include "core/input/default_controller_mappings.h"\n')
# ensure mappings have a consistent order
platform_mappings = OrderedDict()
@@ -37,11 +37,19 @@ def make_default_controller_mappings(target, source, env):
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]))
+ 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))
+ g.write(
+ "// WARNING - DISCARDED UNSUPPORTED MAPPING TYPE FROM DATABASE {}: {} {}\n".format(
+ src_path, current_platform, line
+ )
+ )
valid_mapping = False
break
if valid_mapping:
@@ -62,12 +70,12 @@ def make_default_controller_mappings(target, source, env):
variable = platform_variables[platform]
g.write("{}\n".format(variable))
for mapping in mappings.values():
- g.write("\t\"{}\",\n".format(mapping))
+ g.write('\t"{}",\n'.format(mapping))
g.write("#endif\n")
g.write("\tNULL\n};\n")
g.close()
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 088d185b8d..80219331c0 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -366,10 +366,10 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed
match = get_keycode() == key->get_keycode() && (!key->is_pressed() || (code & event_code) == code);
}
if (match) {
- if (p_pressed != NULL)
+ if (p_pressed != nullptr)
*p_pressed = key->is_pressed();
- if (p_strength != NULL)
- *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+ if (p_strength != nullptr)
+ *p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}
@@ -541,10 +541,10 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool *p
bool match = mb->button_index == button_index;
if (match) {
- if (p_pressed != NULL)
+ if (p_pressed != nullptr)
*p_pressed = mb->is_pressed();
- if (p_strength != NULL)
- *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+ if (p_strength != nullptr)
+ *p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@@ -815,9 +815,9 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event, bool *
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)
+ if (p_pressed != nullptr)
*p_pressed = pressed;
- if (p_strength != NULL) {
+ if (p_strength != nullptr) {
if (pressed) {
if (p_deadzone == 1.0f) {
*p_strength = 1.0f;
@@ -892,10 +892,10 @@ bool InputEventJoypadButton::action_match(const Ref<InputEvent> &p_event, bool *
bool match = button_index == jb->button_index;
if (match) {
- if (p_pressed != NULL)
+ if (p_pressed != nullptr)
*p_pressed = jb->is_pressed();
- if (p_strength != NULL)
- *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+ if (p_strength != nullptr)
+ *p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
}
return match;
@@ -1140,10 +1140,10 @@ bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pres
bool match = action == act->action;
if (match) {
- if (p_pressed != NULL)
+ if (p_pressed != nullptr)
*p_pressed = act->pressed;
- if (p_strength != NULL)
- *p_strength = (p_pressed != NULL && *p_pressed) ? 1.0f : 0.0f;
+ if (p_strength != nullptr)
+ *p_strength = (p_pressed != nullptr && *p_pressed) ? 1.0f : 0.0f;
}
return match;
}
diff --git a/core/input/input_filter.cpp b/core/input/input_filter.cpp
index 088f7effd6..2e8442a905 100644
--- a/core/input/input_filter.cpp
+++ b/core/input/input_filter.cpp
@@ -39,7 +39,7 @@
#include "editor/editor_settings.h"
#endif
-InputFilter *InputFilter::singleton = NULL;
+InputFilter *InputFilter::singleton = nullptr;
void (*InputFilter::set_mouse_mode_func)(InputFilter::MouseMode) = nullptr;
InputFilter::MouseMode (*InputFilter::get_mouse_mode_func)() = nullptr;
@@ -1028,9 +1028,9 @@ void InputFilter::_axis_event(int p_device, int p_axis, float p_value) {
InputFilter::JoyEvent InputFilter::_find_to_event(String p_to) {
// string names of the SDL buttons in the same order as input_event.h godot buttons
- static const char *buttons[] = { "a", "b", "x", "y", "leftshoulder", "rightshoulder", "lefttrigger", "righttrigger", "leftstick", "rightstick", "back", "start", "dpup", "dpdown", "dpleft", "dpright", "guide", NULL };
+ static const char *buttons[] = { "a", "b", "x", "y", "leftshoulder", "rightshoulder", "lefttrigger", "righttrigger", "leftstick", "rightstick", "back", "start", "dpup", "dpdown", "dpleft", "dpright", "guide", nullptr };
- static const char *axis[] = { "leftx", "lefty", "rightx", "righty", NULL };
+ static const char *axis[] = { "leftx", "lefty", "rightx", "righty", nullptr };
JoyEvent ret;
ret.type = -1;
diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp
index 8f18c082d6..6b6acf062d 100644
--- a/core/input/input_map.cpp
+++ b/core/input/input_map.cpp
@@ -33,7 +33,7 @@
#include "core/os/keyboard.h"
#include "core/project_settings.h"
-InputMap *InputMap::singleton = NULL;
+InputMap *InputMap::singleton = nullptr;
int InputMap::ALL_DEVICES = -1;
@@ -116,7 +116,7 @@ List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Re
}
}
- return NULL;
+ return nullptr;
}
bool InputMap::has_action(const StringName &p_action) const {
@@ -144,7 +144,7 @@ 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_MSG(!input_map.has(p_action), false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
- return (_find_event(input_map[p_action], p_event) != NULL);
+ return (_find_event(input_map[p_action], p_event) != nullptr);
}
void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event) {
@@ -181,7 +181,7 @@ const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_actio
const Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E)
- return NULL;
+ return nullptr;
return &E->get().inputs;
}
@@ -196,20 +196,20 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
Ref<InputEventAction> input_event_action = p_event;
if (input_event_action.is_valid()) {
- if (p_pressed != NULL)
+ if (p_pressed != nullptr)
*p_pressed = input_event_action->is_pressed();
- if (p_strength != NULL)
- *p_strength = (p_pressed != NULL && *p_pressed) ? input_event_action->get_strength() : 0.0f;
+ if (p_strength != nullptr)
+ *p_strength = (p_pressed != nullptr && *p_pressed) ? input_event_action->get_strength() : 0.0f;
return input_event_action->get_action() == p_action;
}
bool pressed;
float strength;
List<Ref<InputEvent>>::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
- if (event != NULL) {
- if (p_pressed != NULL)
+ if (event != nullptr) {
+ if (p_pressed != nullptr)
*p_pressed = pressed;
- if (p_strength != NULL)
+ if (p_strength != nullptr)
*p_strength = strength;
return true;
} else {
diff --git a/core/input/input_map.h b/core/input/input_map.h
index de6f57b0bf..e03bc5fd4f 100644
--- a/core/input/input_map.h
+++ b/core/input/input_map.h
@@ -55,7 +55,7 @@ private:
mutable Map<StringName, Action> input_map;
- List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;
+ List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = nullptr, float *p_strength = nullptr) const;
Array _get_action_list(const StringName &p_action);
Array _get_actions();
@@ -79,7 +79,7 @@ public:
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;
+ bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = nullptr, float *p_strength = nullptr) const;
const Map<StringName, Action> &get_action_map() const;
void load_from_globals();
diff --git a/core/io/SCsub b/core/io/SCsub
index 1c5f954470..19a6549225 100644
--- a/core/io/SCsub
+++ b/core/io/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index 351e2941e8..73230e3a3c 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -290,7 +290,7 @@ Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream)
next_tag.fields.clear();
next_tag.name = String();
- Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, NULL, true);
+ Error err = VariantParser::parse_tag_assign_eof(p_stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
return OK;
} else if (err != OK) {
diff --git a/core/io/dtls_server.cpp b/core/io/dtls_server.cpp
index 07e6abb1c9..5bda06e5b9 100644
--- a/core/io/dtls_server.cpp
+++ b/core/io/dtls_server.cpp
@@ -32,7 +32,7 @@
#include "core/os/file_access.h"
#include "core/project_settings.h"
-DTLSServer *(*DTLSServer::_create)() = NULL;
+DTLSServer *(*DTLSServer::_create)() = nullptr;
bool DTLSServer::available = false;
DTLSServer *DTLSServer::create() {
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 17cc6ce58f..c76142d22d 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -64,7 +64,7 @@ Error FileAccessCompressed::open_after_magic(FileAccess *p_base) {
cmode = (Compression::Mode)f->get_32();
block_size = f->get_32();
if (block_size == 0) {
- f = NULL; // Let the caller to handle the FileAccess object if failed to open as compressed file.
+ f = nullptr; // Let the caller to handle the FileAccess object if failed to open as compressed file.
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Can't open compressed file '" + p_base->get_path() + "' with block size 0, it is corrupted.");
}
read_total = f->get_32();
@@ -109,7 +109,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
if (err != OK) {
//not openable
- f = NULL;
+ f = nullptr;
return err;
}
@@ -131,7 +131,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) {
rmagic[4] = 0;
if (magic != rmagic || open_after_magic(f) != OK) {
memdelete(f);
- f = NULL;
+ f = nullptr;
return ERR_FILE_UNRECOGNIZED;
}
}
@@ -187,12 +187,12 @@ void FileAccessCompressed::close() {
}
memdelete(f);
- f = NULL;
+ f = nullptr;
}
bool FileAccessCompressed::is_open() const {
- return f != NULL;
+ return f != nullptr;
}
void FileAccessCompressed::seek(size_t p_position) {
@@ -392,20 +392,20 @@ Error FileAccessCompressed::_set_unix_permissions(const String &p_file, uint32_t
FileAccessCompressed::FileAccessCompressed() :
cmode(Compression::MODE_ZSTD),
writing(false),
- write_ptr(0),
+ write_ptr(nullptr),
write_buffer_size(0),
write_max(0),
block_size(0),
read_eof(false),
at_end(false),
- read_ptr(NULL),
+ read_ptr(nullptr),
read_block(0),
read_block_count(0),
read_block_size(0),
read_pos(0),
read_total(0),
magic("GCMP"),
- f(NULL) {
+ f(nullptr) {
}
FileAccessCompressed::~FileAccessCompressed() {
diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp
index 20b6fc81dc..a5b3807789 100644
--- a/core/io/file_access_encrypted.cpp
+++ b/core/io/file_access_encrypted.cpp
@@ -41,7 +41,7 @@
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) {
- ERR_FAIL_COND_V_MSG(file != NULL, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
+ ERR_FAIL_COND_V_MSG(file != nullptr, ERR_ALREADY_IN_USE, "Can't open file while another file from path '" + file->get_path_absolute() + "' is open.");
ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER);
pos = 0;
@@ -159,7 +159,7 @@ void FileAccessEncrypted::close() {
file->store_buffer(compressed.ptr(), compressed.size());
file->close();
memdelete(file);
- file = NULL;
+ file = nullptr;
data.clear();
} else {
@@ -167,13 +167,13 @@ void FileAccessEncrypted::close() {
file->close();
memdelete(file);
data.clear();
- file = NULL;
+ file = nullptr;
}
}
bool FileAccessEncrypted::is_open() const {
- return file != NULL;
+ return file != nullptr;
}
String FileAccessEncrypted::get_path() const {
@@ -319,7 +319,7 @@ Error FileAccessEncrypted::_set_unix_permissions(const String &p_file, uint32_t
FileAccessEncrypted::FileAccessEncrypted() {
- file = NULL;
+ file = nullptr;
pos = 0;
eofed = false;
mode = MODE_MAX;
diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp
index 9e707678c0..a2379ce88f 100644
--- a/core/io/file_access_memory.cpp
+++ b/core/io/file_access_memory.cpp
@@ -35,7 +35,7 @@
#include "core/os/dir_access.h"
#include "core/project_settings.h"
-static Map<String, Vector<uint8_t>> *files = NULL;
+static Map<String, Vector<uint8_t>> *files = nullptr;
void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
@@ -71,7 +71,7 @@ bool FileAccessMemory::file_exists(const String &p_name) {
String name = fix_path(p_name);
//name = DirAccess::normalize_path(name);
- return files && (files->find(name) != NULL);
+ return files && (files->find(name) != nullptr);
}
Error FileAccessMemory::open_custom(const uint8_t *p_data, int p_len) {
@@ -101,12 +101,12 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
void FileAccessMemory::close() {
- data = NULL;
+ data = nullptr;
}
bool FileAccessMemory::is_open() const {
- return data != NULL;
+ return data != nullptr;
}
void FileAccessMemory::seek(size_t p_position) {
@@ -196,5 +196,5 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, int p_length) {
FileAccessMemory::FileAccessMemory() {
- data = NULL;
+ data = nullptr;
}
diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp
index 370dd8f982..a3f307393f 100644
--- a/core/io/file_access_network.cpp
+++ b/core/io/file_access_network.cpp
@@ -114,7 +114,7 @@ void FileAccessNetworkClient::_thread_func() {
int response = get_32();
DEBUG_PRINT("GET RESPONSE: " + itos(response));
- FileAccessNetwork *fa = NULL;
+ FileAccessNetwork *fa = nullptr;
if (response != FileAccessNetwork::RESPONSE_DATA) {
if (!accesses.has(id)) {
@@ -219,11 +219,11 @@ Error FileAccessNetworkClient::connect(const String &p_host, int p_port, const S
return OK;
}
-FileAccessNetworkClient *FileAccessNetworkClient::singleton = NULL;
+FileAccessNetworkClient *FileAccessNetworkClient::singleton = nullptr;
FileAccessNetworkClient::FileAccessNetworkClient() {
- thread = NULL;
+ thread = nullptr;
quit = false;
singleton = this;
last_id = 0;
@@ -295,7 +295,7 @@ Error FileAccessNetwork::_open(const String &p_path, int p_mode_flags) {
pos = 0;
eof_flag = false;
last_page = -1;
- last_page_buff = NULL;
+ last_page_buff = nullptr;
//buffers.clear();
nc->unlock_mutex();
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 055ce816ad..0a7dee9444 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -98,18 +98,18 @@ void PackedData::add_path(const String &pkg_path, const String &path, uint64_t o
void PackedData::add_pack_source(PackSource *p_source) {
- if (p_source != NULL) {
+ if (p_source != nullptr) {
sources.push_back(p_source);
}
};
-PackedData *PackedData::singleton = NULL;
+PackedData *PackedData::singleton = nullptr;
PackedData::PackedData() {
singleton = this;
root = memnew(PackedDir);
- root->parent = NULL;
+ root->parent = nullptr;
disabled = false;
add_pack_source(memnew(PackedSourcePCK));
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index e1f35aabdd..8df6826ac9 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -185,9 +185,9 @@ FileAccess *PackedData::try_open_path(const String &p_path) {
PathMD5 pmd5(p_path.md5_buffer());
Map<PathMD5, PackedFile>::Element *E = files.find(pmd5);
if (!E)
- return NULL; //not found
+ return nullptr; //not found
if (E->get().offset == 0)
- return NULL; //was erased
+ return nullptr; //was erased
return E->get().src->get_file(p_path, &E->get());
}
diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp
index 680450ba43..57de66afaf 100644
--- a/core/io/file_access_zip.cpp
+++ b/core/io/file_access_zip.cpp
@@ -35,20 +35,20 @@
#include "core/os/copymem.h"
#include "core/os/file_access.h"
-ZipArchive *ZipArchive::instance = NULL;
+ZipArchive *ZipArchive::instance = nullptr;
extern "C" {
static void *godot_open(void *data, const char *p_fname, int mode) {
if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
- return NULL;
+ return nullptr;
}
FileAccess *f = (FileAccess *)data;
f->open(p_fname, FileAccess::READ);
- return f->is_open() ? data : NULL;
+ return f->is_open() ? data : nullptr;
}
static uLong godot_read(void *data, void *fdata, void *buf, uLong size) {
@@ -126,11 +126,11 @@ void ZipArchive::close_handle(unzFile p_file) const {
unzFile ZipArchive::get_file_handle(String p_file) const {
- ERR_FAIL_COND_V_MSG(!file_exists(p_file), NULL, "File '" + p_file + " doesn't exist.");
+ ERR_FAIL_COND_V_MSG(!file_exists(p_file), nullptr, "File '" + p_file + " doesn't exist.");
File file = files[p_file];
FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!f, NULL, "Cannot open file '" + packages[file.package].filename + "'.");
+ ERR_FAIL_COND_V_MSG(!f, nullptr, "Cannot open file '" + packages[file.package].filename + "'.");
zlib_filefunc_def io;
zeromem(&io, sizeof(io));
@@ -149,12 +149,12 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
io.free_mem = godot_free;
unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io);
- ERR_FAIL_COND_V(!pkg, NULL);
+ ERR_FAIL_COND_V(!pkg, nullptr);
int unz_err = unzGoToFilePos(pkg, &file.file_pos);
if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) {
unzClose(pkg);
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
return pkg;
@@ -199,7 +199,7 @@ bool ZipArchive::try_open_pack(const String &p_path, bool p_replace_files) {
char filename_inzip[256];
unz_file_info64 file_info;
- err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), NULL, 0, NULL, 0);
+ err = unzGetCurrentFileInfo64(zfile, &file_info, filename_inzip, sizeof(filename_inzip), nullptr, 0, nullptr, 0);
ERR_CONTINUE(err != UNZ_OK);
File f;
@@ -233,7 +233,7 @@ FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p
ZipArchive *ZipArchive::get_singleton() {
- if (instance == NULL) {
+ if (instance == nullptr) {
instance = memnew(ZipArchive);
}
@@ -268,7 +268,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) {
zfile = arch->get_file_handle(p_path);
ERR_FAIL_COND_V(!zfile, FAILED);
- int err = unzGetCurrentFileInfo64(zfile, &file_info, NULL, 0, NULL, 0, NULL, 0);
+ int err = unzGetCurrentFileInfo64(zfile, &file_info, nullptr, 0, nullptr, 0, nullptr, 0);
ERR_FAIL_COND_V(err != UNZ_OK, FAILED);
return OK;
@@ -282,12 +282,12 @@ void FileAccessZip::close() {
ZipArchive *arch = ZipArchive::get_singleton();
ERR_FAIL_COND(!arch);
arch->close_handle(zfile);
- zfile = NULL;
+ zfile = nullptr;
}
bool FileAccessZip::is_open() const {
- return zfile != NULL;
+ return zfile != nullptr;
}
void FileAccessZip::seek(size_t p_position) {
@@ -370,7 +370,7 @@ bool FileAccessZip::file_exists(const String &p_name) {
}
FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) :
- zfile(NULL) {
+ zfile(nullptr) {
_open(p_path, FileAccess::READ);
}
diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp
index 99ac5bcdd9..2770adbd36 100644
--- a/core/io/image_loader.cpp
+++ b/core/io/image_loader.cpp
@@ -100,7 +100,7 @@ ImageFormatLoader *ImageLoader::recognize(const String &p_extension) {
return loader[i];
}
- return NULL;
+ return nullptr;
}
Vector<ImageFormatLoader *> ImageLoader::loader;
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 29352e9cd4..18b4df98f7 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -59,7 +59,7 @@ class ImageLoader {
protected:
public:
- static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = NULL, bool p_force_linear = false, float p_scale = 1.0);
+ static Error load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom = nullptr, bool p_force_linear = false, float p_scale = 1.0);
static void get_recognized_extensions(List<String> *p_extensions);
static ImageFormatLoader *recognize(const String &p_extension);
@@ -73,7 +73,7 @@ public:
class ResourceFormatLoaderImage : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 2143b84d15..5de7fb7186 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -280,19 +280,19 @@ void IP::_bind_methods() {
BIND_ENUM_CONSTANT(TYPE_ANY);
}
-IP *IP::singleton = NULL;
+IP *IP::singleton = nullptr;
IP *IP::get_singleton() {
return singleton;
}
-IP *(*IP::_create)() = NULL;
+IP *(*IP::_create)() = nullptr;
IP *IP::create() {
- ERR_FAIL_COND_V_MSG(singleton, NULL, "IP singleton already exist.");
- ERR_FAIL_COND_V(!_create, NULL);
+ ERR_FAIL_COND_V_MSG(singleton, nullptr, "IP singleton already exist.");
+ ERR_FAIL_COND_V(!_create, nullptr);
return _create();
}
@@ -307,7 +307,7 @@ IP::IP() {
resolver->thread = Thread::create(_IP_ResolverPrivate::_thread_function, resolver);
#else
- resolver->thread = NULL;
+ resolver->thread = nullptr;
#endif
}
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index 4d732332d5..48aebeda3d 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -108,7 +108,7 @@ Logger::~Logger() {}
void RotatedFileLogger::close_file() {
if (file) {
memdelete(file);
- file = NULL;
+ file = nullptr;
}
}
@@ -182,7 +182,7 @@ void RotatedFileLogger::rotate_file() {
RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) :
base_path(p_base_path.simplify_path()),
max_files(p_max_files > 0 ? p_max_files : 1),
- file(NULL) {
+ file(nullptr) {
rotate_file();
}
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index fbcaa582b7..81bc45b2f7 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -439,7 +439,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
(*r_len) += 8;
if (val.is_null()) {
- r_variant = (Object *)NULL;
+ r_variant = (Object *)nullptr;
} else {
Ref<EncodedObjectAsID> obj_as_id;
obj_as_id.instance();
@@ -457,7 +457,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
return err;
if (str == String()) {
- r_variant = (Object *)NULL;
+ r_variant = (Object *)nullptr;
} else {
Object *obj = ClassDB::instance(str);
@@ -917,7 +917,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
// Test for potential wrong values sent by the debugger when it breaks.
Object *obj = p_variant.get_validated_object();
if (!obj) {
- // Object is invalid, send a NULL instead.
+ // Object is invalid, send a nullptr instead.
if (buf) {
encode_uint32(Variant::NIL, buf);
}
diff --git a/core/io/marshalls.h b/core/io/marshalls.h
index 7d95bc4f86..d029ed238c 100644
--- a/core/io/marshalls.h
+++ b/core/io/marshalls.h
@@ -199,7 +199,7 @@ public:
EncodedObjectAsID();
};
-Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = NULL, bool p_allow_objects = false);
+Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len = nullptr, bool p_allow_objects = false);
Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bool p_full_objects = false);
#endif // MARSHALLS_H
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index c29df07624..3bec52416e 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -207,7 +207,7 @@ int get_packet_len(uint32_t p_node_target, int p_packet_len) {
void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_packet_len) {
- ERR_FAIL_COND_MSG(root_node == NULL, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
+ ERR_FAIL_COND_MSG(root_node == nullptr, "Multiplayer root node was not initialized. If you are using custom multiplayer, remember to set the root node via MultiplayerAPI.set_root_node before using it.");
ERR_FAIL_COND_MSG(p_packet_len < 1, "Invalid packet received. Size too small.");
#ifdef DEBUG_ENABLED
@@ -285,7 +285,7 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
}
Node *node = _process_get_node(p_from, p_packet, node_target, p_packet_len);
- ERR_FAIL_COND_MSG(node == NULL, "Invalid packet received. Requested node was not found.");
+ ERR_FAIL_COND_MSG(node == nullptr, "Invalid packet received. Requested node was not found.");
uint16_t name_id = 0;
switch (name_id_compression) {
@@ -321,14 +321,14 @@ void MultiplayerAPI::_process_packet(int p_from, const uint8_t *p_packet, int p_
Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, uint32_t p_node_target, int p_packet_len) {
- Node *node = NULL;
+ Node *node = nullptr;
if (p_node_target & 0x80000000) {
// Use full path (not cached yet).
int ofs = p_node_target & 0x7FFFFFFF;
- ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, NULL, "Invalid packet received. Size smaller than declared.");
+ ERR_FAIL_COND_V_MSG(ofs >= p_packet_len, nullptr, "Invalid packet received. Size smaller than declared.");
String paths;
paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs);
@@ -344,10 +344,10 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, uin
int id = p_node_target;
Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from);
- ERR_FAIL_COND_V_MSG(!E, NULL, "Invalid packet received. Requests invalid peer cache.");
+ ERR_FAIL_COND_V_MSG(!E, nullptr, "Invalid packet received. Requests invalid peer cache.");
Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id);
- ERR_FAIL_COND_V_MSG(!F, NULL, "Invalid packet received. Unabled to find requested cached node.");
+ ERR_FAIL_COND_V_MSG(!F, nullptr, "Invalid packet received. Unabled to find requested cached node.");
PathGetCache::NodeInfo *ni = &F->get();
// Do proper caching later.
@@ -456,7 +456,7 @@ void MultiplayerAPI::_process_rset(Node *p_node, const uint16_t p_rpc_property_i
#endif
Variant value;
- Error err = _decode_and_decompress_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL);
+ Error err = _decode_and_decompress_variant(value, &p_packet[p_offset], p_packet_len - p_offset, nullptr);
ERR_FAIL_COND_MSG(err != OK, "Invalid packet received. Unable to decode RSET value.");
@@ -491,7 +491,7 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
}
Node *node = root_node->get_node(path);
- ERR_FAIL_COND(node == NULL);
+ ERR_FAIL_COND(node == nullptr);
const bool valid_rpc_checksum = node->get_rpc_md5() == methods_md5;
if (valid_rpc_checksum == false) {
ERR_PRINT("The rpc node checksum failed. Make sure to have the same methods on both nodes. Node path: " + path);
@@ -504,7 +504,7 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
// Encode path to send ack.
CharString pname = String(path).utf8();
- int len = encode_cstring(pname.get_data(), NULL);
+ int len = encode_cstring(pname.get_data(), nullptr);
Vector<uint8_t> packet;
@@ -572,7 +572,7 @@ bool MultiplayerAPI::_send_confirm_path(Node *p_node, NodePath p_path, PathSentC
// Encode function name.
const CharString path = String(p_path).utf8();
- const int path_len = encode_cstring(path.get_data(), NULL);
+ const int path_len = encode_cstring(path.get_data(), nullptr);
// Extract MD5 from rpc methods list.
const String methods_md5 = p_node->get_rpc_md5();
@@ -862,7 +862,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
// Set argument.
int len(0);
- Error err = _encode_and_compress_variant(*p_arg[0], NULL, len);
+ Error err = _encode_and_compress_variant(*p_arg[0], nullptr, len);
ERR_FAIL_COND_MSG(err != OK, "Unable to encode RSET value. THIS IS LIKELY A BUG IN THE ENGINE!");
MAKE_ROOM(ofs + len);
_encode_and_compress_variant(*p_arg[0], &(packet_cache.write[ofs]), len);
@@ -907,7 +907,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
ofs += 1;
for (int i = 0; i < p_argcount; i++) {
int len(0);
- Error err = _encode_and_compress_variant(*p_arg[i], NULL, len);
+ Error err = _encode_and_compress_variant(*p_arg[i], nullptr, len);
ERR_FAIL_COND_MSG(err != OK, "Unable to encode RPC argument. THIS IS LIKELY A BUG IN THE ENGINE!");
MAKE_ROOM(ofs + len);
_encode_and_compress_variant(*p_arg[i], &(packet_cache.write[ofs]), len);
@@ -943,7 +943,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, bool p_unreliable, bool p
// Append 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);
+ int path_len = encode_cstring(pname.get_data(), nullptr);
MAKE_ROOM(ofs + path_len);
encode_cstring(pname.get_data(), &(packet_cache.write[ofs]));
@@ -1262,7 +1262,7 @@ void MultiplayerAPI::_bind_methods() {
MultiplayerAPI::MultiplayerAPI() :
allow_object_decoding(false) {
rpc_sender_id = 0;
- root_node = NULL;
+ root_node = nullptr;
clear();
}
diff --git a/core/io/net_socket.cpp b/core/io/net_socket.cpp
index 23edbc7d64..838c674cec 100644
--- a/core/io/net_socket.cpp
+++ b/core/io/net_socket.cpp
@@ -30,7 +30,7 @@
#include "net_socket.h"
-NetSocket *(*NetSocket::_create)() = NULL;
+NetSocket *(*NetSocket::_create)() = nullptr;
NetSocket *NetSocket::create() {
@@ -38,5 +38,5 @@ NetSocket *NetSocket::create() {
return _create();
ERR_PRINT("Unable to create network socket, platform not supported");
- return NULL;
+ return nullptr;
}
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 2f5c493c2c..38abb5c0d6 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -90,13 +90,13 @@ Error PacketPeer::get_var(Variant &r_variant, bool p_allow_objects) {
if (err)
return err;
- return decode_variant(r_variant, buffer, buffer_size, NULL, p_allow_objects);
+ return decode_variant(r_variant, buffer, buffer_size, nullptr, p_allow_objects);
}
Error PacketPeer::put_var(const Variant &p_packet, bool p_full_objects) {
int len;
- Error err = encode_variant(p_packet, NULL, len, p_full_objects); // compute len first
+ Error err = encode_variant(p_packet, nullptr, len, p_full_objects); // compute len first
if (err)
return err;
diff --git a/core/io/packet_peer_dtls.cpp b/core/io/packet_peer_dtls.cpp
index 01218a6881..6da115eed2 100644
--- a/core/io/packet_peer_dtls.cpp
+++ b/core/io/packet_peer_dtls.cpp
@@ -32,7 +32,7 @@
#include "core/os/file_access.h"
#include "core/project_settings.h"
-PacketPeerDTLS *(*PacketPeerDTLS::_create)() = NULL;
+PacketPeerDTLS *(*PacketPeerDTLS::_create)() = nullptr;
bool PacketPeerDTLS::available = false;
PacketPeerDTLS *PacketPeerDTLS::create() {
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 11e537c10b..5c4b3379ee 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -63,7 +63,7 @@ void PCKPacker::_bind_methods() {
Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
- if (file != NULL) {
+ if (file != nullptr) {
memdelete(file);
}
@@ -182,12 +182,12 @@ Error PCKPacker::flush(bool p_verbose) {
PCKPacker::PCKPacker() {
- file = NULL;
+ file = nullptr;
};
PCKPacker::~PCKPacker() {
- if (file != NULL) {
+ if (file != nullptr) {
memdelete(file);
};
- file = NULL;
+ file = nullptr;
};
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index efd452191a..a640565ecf 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1009,7 +1009,7 @@ String ResourceLoaderBinary::recognize(FileAccess *p_f) {
ResourceLoaderBinary::ResourceLoaderBinary() :
translation_remapped(false),
ver_format(0),
- f(NULL),
+ f(nullptr),
importmd_ofs(0),
error(OK) {
@@ -1107,7 +1107,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
- FileAccess *fw = NULL; //=FileAccess::open(p_path+".depren");
+ FileAccess *fw = nullptr; //=FileAccess::open(p_path+".depren");
String local_path = p_path.get_base_dir();
@@ -2095,7 +2095,7 @@ void ResourceFormatSaverBinary::get_recognized_extensions(const RES &p_resource,
p_extensions->push_back("res");
}
-ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = NULL;
+ResourceFormatSaverBinary *ResourceFormatSaverBinary::singleton = nullptr;
ResourceFormatSaverBinary::ResourceFormatSaverBinary() {
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 0ffa2c3626..da67e1e648 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -101,7 +101,7 @@ public:
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index 452514a588..ceb73cab77 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -69,7 +69,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
memdelete(f);
return OK;
@@ -274,7 +274,7 @@ void ResourceFormatImporter::get_internal_resource_path_list(const String &p_pat
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
memdelete(f);
return;
@@ -434,7 +434,7 @@ String ResourceFormatImporter::get_import_settings_hash() const {
return hash.md5_text();
}
-ResourceFormatImporter *ResourceFormatImporter::singleton = NULL;
+ResourceFormatImporter *ResourceFormatImporter::singleton = nullptr;
ResourceFormatImporter::ResourceFormatImporter() {
singleton = this;
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index 369efbe83c..dbac80599a 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -45,7 +45,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
Variant metadata;
};
- Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = NULL) const;
+ Error _get_path_and_type(const String &p_path, PathAndType &r_path_and_type, bool *r_valid = nullptr) const;
static ResourceFormatImporter *singleton;
@@ -58,7 +58,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
public:
static ResourceFormatImporter *get_singleton() { return singleton; }
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
@@ -123,7 +123,7 @@ public:
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
virtual String get_option_group_file() const { return String(); }
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr) = 0;
virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index b150df5f40..05a41013c2 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -936,7 +936,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
@@ -1048,7 +1048,7 @@ void ResourceLoader::set_load_callback(ResourceLoadedCallback p_callback) {
_loaded_callback = p_callback;
}
-ResourceLoadedCallback ResourceLoader::_loaded_callback = NULL;
+ResourceLoadedCallback ResourceLoader::_loaded_callback = nullptr;
Ref<ResourceFormatLoader> ResourceLoader::_find_custom_resource_format_loader(String path) {
for (int i = 0; i < loader_count; ++i) {
@@ -1075,7 +1075,7 @@ bool ResourceLoader::add_custom_resource_format_loader(String script_path) {
Object *obj = ClassDB::instance(ibt);
- ERR_FAIL_COND_V_MSG(obj == NULL, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
+ ERR_FAIL_COND_V_MSG(obj == nullptr, false, "Cannot instance script as custom resource loader, expected 'ResourceFormatLoader' inheritance, got: " + String(ibt) + ".");
ResourceFormatLoader *crl = Object::cast_to<ResourceFormatLoader>(obj);
crl->set_script(s);
@@ -1140,11 +1140,11 @@ void ResourceLoader::finalize() {
memdelete(thread_load_semaphore);
}
-ResourceLoadErrorNotify ResourceLoader::err_notify = NULL;
-void *ResourceLoader::err_notify_ud = NULL;
+ResourceLoadErrorNotify ResourceLoader::err_notify = nullptr;
+void *ResourceLoader::err_notify_ud = nullptr;
-DependencyErrorNotify ResourceLoader::dep_err_notify = NULL;
-void *ResourceLoader::dep_err_notify_ud = NULL;
+DependencyErrorNotify ResourceLoader::dep_err_notify = nullptr;
+void *ResourceLoader::dep_err_notify_ud = nullptr;
bool ResourceLoader::abort_on_missing_resource = true;
bool ResourceLoader::timestamp_on_load = false;
@@ -1162,4 +1162,4 @@ SelfList<Resource>::List ResourceLoader::remapped_list;
HashMap<String, Vector<String>> ResourceLoader::translation_remaps;
HashMap<String, String> ResourceLoader::path_remaps;
-ResourceLoaderImport ResourceLoader::import = NULL;
+ResourceLoaderImport ResourceLoader::import = nullptr;
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index a97b72e7df..be4adf9091 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -43,7 +43,7 @@ protected:
static void _bind_methods();
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual bool exists(const String &p_path) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
@@ -93,7 +93,7 @@ private:
static HashMap<String, Vector<String>> translation_remaps;
static HashMap<String, String> path_remaps;
- static String _path_remap(const String &p_path, bool *r_translation_remapped = NULL);
+ static String _path_remap(const String &p_path, bool *r_translation_remapped = nullptr);
friend class Resource;
static SelfList<Resource>::List remapped_list;
@@ -140,9 +140,9 @@ private:
public:
static Error load_threaded_request(const String &p_path, const String &p_type_hint = "", bool p_use_sub_threads = false, const String &p_source_resource = String());
static ThreadLoadStatus load_threaded_get_status(const String &p_path, float *r_progress = nullptr);
- static RES load_threaded_get(const String &p_path, Error *r_error = NULL);
+ static RES load_threaded_get(const String &p_path, Error *r_error = nullptr);
- static RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = NULL);
+ static RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false, Error *r_error = nullptr);
static bool exists(const String &p_path, const String &p_type_hint = "");
static void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions);
diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp
index 80d2c5e471..09128adb50 100644
--- a/core/io/resource_saver.cpp
+++ b/core/io/resource_saver.cpp
@@ -38,7 +38,7 @@ Ref<ResourceFormatSaver> ResourceSaver::saver[MAX_SAVERS];
int ResourceSaver::saver_count = 0;
bool ResourceSaver::timestamp_on_save = false;
-ResourceSavedCallback ResourceSaver::save_callback = 0;
+ResourceSavedCallback ResourceSaver::save_callback = nullptr;
Error ResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
@@ -218,7 +218,7 @@ bool ResourceSaver::add_custom_resource_format_saver(String script_path) {
Object *obj = ClassDB::instance(ibt);
- ERR_FAIL_COND_V_MSG(obj == NULL, false, "Cannot instance script as custom resource saver, expected 'ResourceFormatSaver' inheritance, got: " + String(ibt) + ".");
+ ERR_FAIL_COND_V_MSG(obj == nullptr, false, "Cannot instance script as custom resource saver, expected 'ResourceFormatSaver' inheritance, got: " + String(ibt) + ".");
ResourceFormatSaver *crl = Object::cast_to<ResourceFormatSaver>(obj);
crl->set_script(s);
diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp
index 3c695c18fc..b28b17aa95 100644
--- a/core/io/stream_peer.cpp
+++ b/core/io/stream_peer.cpp
@@ -224,7 +224,7 @@ void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) {
int len = 0;
Vector<uint8_t> buf;
- encode_variant(p_variant, NULL, len, p_full_objects);
+ encode_variant(p_variant, nullptr, len, p_full_objects);
buf.resize(len);
put_32(len);
encode_variant(p_variant, buf.ptrw(), len, p_full_objects);
@@ -368,7 +368,7 @@ Variant StreamPeer::get_var(bool p_allow_objects) {
ERR_FAIL_COND_V(err != OK, Variant());
Variant ret;
- err = decode_variant(ret, var.ptr(), len, NULL, p_allow_objects);
+ err = decode_variant(ret, var.ptr(), len, nullptr, p_allow_objects);
ERR_FAIL_COND_V_MSG(err != OK, Variant(), "Error when trying to decode Variant.");
return ret;
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 03ca726619..d98935f77c 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -32,13 +32,13 @@
#include "core/engine.h"
-StreamPeerSSL *(*StreamPeerSSL::_create)() = NULL;
+StreamPeerSSL *(*StreamPeerSSL::_create)() = nullptr;
StreamPeerSSL *StreamPeerSSL::create() {
if (_create)
return _create();
- return NULL;
+ return nullptr;
}
bool StreamPeerSSL::available = false;
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index d280729e94..9d3117b630 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -37,8 +37,8 @@
class TranslationLoaderPO : public ResourceFormatLoader {
public:
- static RES load_translation(FileAccess *f, Error *r_error = NULL);
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ static RES load_translation(FileAccess *f, Error *r_error = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index bd450dd84f..9613ad3f10 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -165,7 +165,7 @@ bool XMLParser::_parse_cdata() {
return true;
char *cDataBegin = P;
- char *cDataEnd = 0;
+ char *cDataEnd = nullptr;
// find end of CDATA
while (*P && !cDataEnd) {
@@ -529,9 +529,9 @@ void XMLParser::close() {
if (data)
memdelete_arr(data);
- data = NULL;
+ data = nullptr;
length = 0;
- P = NULL;
+ P = nullptr;
node_empty = false;
node_type = NODE_NONE;
node_offset = 0;
@@ -544,7 +544,7 @@ int XMLParser::get_current_line() const {
XMLParser::XMLParser() {
- data = NULL;
+ data = nullptr;
close();
special_characters.push_back("&amp;");
special_characters.push_back("<lt;");
diff --git a/core/io/zip_io.cpp b/core/io/zip_io.cpp
index 40e902d874..3a2a207d22 100644
--- a/core/io/zip_io.cpp
+++ b/core/io/zip_io.cpp
@@ -47,7 +47,7 @@ void *zipio_open(void *data, const char *p_fname, int mode) {
}
if (!f)
- return NULL;
+ return nullptr;
return data;
}
@@ -98,7 +98,7 @@ int zipio_close(voidpf opaque, voidpf stream) {
if (f) {
f->close();
memdelete(f);
- f = NULL;
+ f = nullptr;
}
return 0;
}
diff --git a/core/list.h b/core/list.h
index d441c0230d..be2dccd876 100644
--- a/core/list.h
+++ b/core/list.h
@@ -142,7 +142,7 @@ public:
_FORCE_INLINE_ Element() {
next_ptr = 0;
prev_ptr = 0;
- data = NULL;
+ data = nullptr;
};
};
@@ -220,8 +220,8 @@ public:
if (!_data) {
_data = memnew_allocator(_Data, A);
- _data->first = NULL;
- _data->last = NULL;
+ _data->first = nullptr;
+ _data->last = nullptr;
_data->size_cache = 0;
}
@@ -261,8 +261,8 @@ public:
if (!_data) {
_data = memnew_allocator(_Data, A);
- _data->first = NULL;
- _data->last = NULL;
+ _data->first = nullptr;
+ _data->last = nullptr;
_data->size_cache = 0;
}
@@ -357,7 +357,7 @@ public:
it = it->next();
};
- return NULL;
+ return nullptr;
};
/**
@@ -370,7 +370,7 @@ public:
if (_data->size_cache == 0) {
memdelete_allocator<_Data, A>(_data);
- _data = NULL;
+ _data = nullptr;
}
return ret;
@@ -498,7 +498,7 @@ public:
_data->last->next_ptr = p_I;
p_I->prev_ptr = _data->last;
- p_I->next_ptr = NULL;
+ p_I->next_ptr = nullptr;
_data->last = p_I;
}
@@ -535,7 +535,7 @@ public:
_data->first->prev_ptr = p_I;
p_I->next_ptr = _data->first;
- p_I->prev_ptr = NULL;
+ p_I->prev_ptr = nullptr;
_data->first = p_I;
}
@@ -595,7 +595,7 @@ public:
if (from != current) {
- current->prev_ptr = NULL;
+ current->prev_ptr = nullptr;
current->next_ptr = from;
Element *find = from;
@@ -618,8 +618,8 @@ public:
to = current;
} else {
- current->prev_ptr = NULL;
- current->next_ptr = NULL;
+ current->prev_ptr = nullptr;
+ current->next_ptr = nullptr;
}
current = next;
@@ -661,12 +661,12 @@ public:
sort.sort(aux_buffer, s);
_data->first = aux_buffer[0];
- aux_buffer[0]->prev_ptr = NULL;
+ aux_buffer[0]->prev_ptr = nullptr;
aux_buffer[0]->next_ptr = aux_buffer[1];
_data->last = aux_buffer[s - 1];
aux_buffer[s - 1]->prev_ptr = aux_buffer[s - 2];
- aux_buffer[s - 1]->next_ptr = NULL;
+ aux_buffer[s - 1]->next_ptr = nullptr;
for (int i = 1; i < s - 1; i++) {
@@ -686,7 +686,7 @@ public:
*/
List(const List &p_list) {
- _data = NULL;
+ _data = nullptr;
const Element *it = p_list.front();
while (it) {
@@ -696,7 +696,7 @@ public:
}
List() {
- _data = NULL;
+ _data = nullptr;
};
~List() {
clear();
diff --git a/core/make_binders.py b/core/make_binders.py
index c42b91fbe5..94bee95bfb 100644
--- a/core/make_binders.py
+++ b/core/make_binders.py
@@ -280,58 +280,57 @@ MethodBind* create_method_bind($ifret R$ $ifnoret void$ (*p_method)($ifconst con
"""
-
def make_version(template, nargs, argmax, const, ret):
intext = template
from_pos = 0
outtext = ""
- while(True):
+ while True:
to_pos = intext.find("$", from_pos)
- if (to_pos == -1):
+ if to_pos == -1:
outtext += intext[from_pos:]
break
else:
outtext += intext[from_pos:to_pos]
end = intext.find("$", to_pos + 1)
- if (end == -1):
+ if end == -1:
break # ignore
- macro = intext[to_pos + 1:end]
+ macro = intext[to_pos + 1 : end]
cmd = ""
data = ""
- if (macro.find(" ") != -1):
- cmd = macro[0:macro.find(" ")]
- data = macro[macro.find(" ") + 1:]
+ if macro.find(" ") != -1:
+ cmd = macro[0 : macro.find(" ")]
+ data = macro[macro.find(" ") + 1 :]
else:
cmd = macro
- if (cmd == "argc"):
+ if cmd == "argc":
outtext += str(nargs)
- if (cmd == "ifret" and ret):
+ if cmd == "ifret" and ret:
outtext += data
- if (cmd == "ifargs" and nargs):
+ if cmd == "ifargs" and nargs:
outtext += data
- if (cmd == "ifretargs" and nargs and ret):
+ if cmd == "ifretargs" and nargs and ret:
outtext += data
- if (cmd == "ifconst" and const):
+ if cmd == "ifconst" and const:
outtext += data
- elif (cmd == "ifnoconst" and not const):
+ elif cmd == "ifnoconst" and not const:
outtext += data
- elif (cmd == "ifnoret" and not ret):
+ elif cmd == "ifnoret" and not ret:
outtext += data
- elif (cmd == "iftempl" and (nargs > 0 or ret)):
+ elif cmd == "iftempl" and (nargs > 0 or ret):
outtext += data
- elif (cmd == "arg,"):
+ elif cmd == "arg,":
for i in range(1, nargs + 1):
- if (i > 1):
+ if i > 1:
outtext += ", "
outtext += data.replace("@", str(i))
- elif (cmd == "arg"):
+ elif cmd == "arg":
for i in range(1, nargs + 1):
outtext += data.replace("@", str(i))
- elif (cmd == "noarg"):
+ elif cmd == "noarg":
for i in range(nargs + 1, argmax + 1):
outtext += data.replace("@", str(i))
@@ -348,7 +347,9 @@ def run(target, source, env):
text_ext = ""
text_free_func = "#ifndef METHOD_BIND_FREE_FUNC_H\n#define METHOD_BIND_FREE_FUNC_H\n"
text_free_func += "\n//including this header file allows method binding to use free functions\n"
- text_free_func += "//note that the free function must have a pointer to an instance of the class as its first parameter\n"
+ text_free_func += (
+ "//note that the free function must have a pointer to an instance of the class as its first parameter\n"
+ )
for i in range(0, versions + 1):
@@ -361,7 +362,7 @@ def run(target, source, env):
t += make_version(template_typed, i, versions, True, False)
t += make_version(template, i, versions, True, True)
t += make_version(template_typed, i, versions, True, True)
- if (i >= versions_ext):
+ if i >= versions_ext:
text_ext += t
else:
text += t
@@ -383,6 +384,7 @@ def run(target, source, env):
f.write(text_free_func)
-if __name__ == '__main__':
+if __name__ == "__main__":
from platform_methods import subprocess_main
+
subprocess_main(globals())
diff --git a/core/map.h b/core/map.h
index 010c47b0fb..6b9dff51de 100644
--- a/core/map.h
+++ b/core/map.h
@@ -95,11 +95,11 @@ public:
};
Element() {
color = RED;
- right = NULL;
- left = NULL;
- parent = NULL;
- _next = NULL;
- _prev = NULL;
+ right = nullptr;
+ left = nullptr;
+ parent = nullptr;
+ _next = nullptr;
+ _prev = nullptr;
};
};
@@ -118,7 +118,7 @@ private:
#else
_nil = (Element *)&_GlobalNilClass::_nil;
#endif
- _root = NULL;
+ _root = nullptr;
size_cache = 0;
}
@@ -133,7 +133,7 @@ private:
if (_root) {
memdelete_allocator<Element, A>(_root);
- _root = NULL;
+ _root = nullptr;
}
}
@@ -205,7 +205,7 @@ private:
}
if (node->parent == _data._root)
- return NULL; // No successor, as p_node = last node
+ return nullptr; // No successor, as p_node = last node
return node->parent;
}
}
@@ -227,7 +227,7 @@ private:
}
if (node == _data._root)
- return NULL; // No predecessor, as p_node = first node
+ return nullptr; // No predecessor, as p_node = first node
return node->parent;
}
}
@@ -246,13 +246,13 @@ private:
return node; // found
}
- return NULL;
+ return nullptr;
}
Element *_find_closest(const K &p_key) const {
Element *node = _data._root->left;
- Element *prev = NULL;
+ Element *prev = nullptr;
C less;
while (node != _data._nil) {
@@ -266,8 +266,8 @@ private:
return node; // found
}
- if (prev == NULL)
- return NULL; // tree empty
+ if (prev == nullptr)
+ return nullptr; // tree empty
if (less(p_key, prev->_key))
prev = prev->_prev;
@@ -519,7 +519,7 @@ public:
const Element *find(const K &p_key) const {
if (!_data._root)
- return NULL;
+ return nullptr;
const Element *res = _find(p_key);
return res;
@@ -528,7 +528,7 @@ public:
Element *find(const K &p_key) {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *res = _find(p_key);
return res;
@@ -537,7 +537,7 @@ public:
const Element *find_closest(const K &p_key) const {
if (!_data._root)
- return NULL;
+ return nullptr;
const Element *res = _find_closest(p_key);
return res;
@@ -546,7 +546,7 @@ public:
Element *find_closest(const K &p_key) {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *res = _find_closest(p_key);
return res;
@@ -554,7 +554,7 @@ public:
bool has(const K &p_key) const {
- return find(p_key) != NULL;
+ return find(p_key) != nullptr;
}
Element *insert(const K &p_key, const V &p_value) {
@@ -612,11 +612,11 @@ public:
Element *front() const {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *e = _data._root->left;
if (e == _data._nil)
- return NULL;
+ return nullptr;
while (e->left != _data._nil)
e = e->left;
@@ -627,11 +627,11 @@ public:
Element *back() const {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *e = _data._root->left;
if (e == _data._nil)
- return NULL;
+ return nullptr;
while (e->right != _data._nil)
e = e->right;
diff --git a/core/math/SCsub b/core/math/SCsub
index be438fcfbe..c8fdac207e 100644
--- a/core/math/SCsub
+++ b/core/math/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_math = env.Clone()
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index bfff12ac45..3e3e6c50a7 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -66,7 +66,7 @@ void AStar::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) {
pt->id = p_id;
pt->pos = p_pos;
pt->weight_scale = p_weight_scale;
- pt->prev_point = NULL;
+ pt->prev_point = nullptr;
pt->open_pass = 0;
pt->closed_pass = 0;
pt->enabled = true;
@@ -167,7 +167,7 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
if (bidirectional) s.direction = Segment::BIDIRECTIONAL;
Set<Segment>::Element *element = segments.find(s);
- if (element != NULL) {
+ if (element != nullptr) {
s.direction |= element->get().direction;
if (s.direction == Segment::BIDIRECTIONAL) {
// Both are neighbours of each other now
@@ -194,7 +194,7 @@ void AStar::disconnect_points(int p_id, int p_with_id, bool bidirectional) {
int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
Set<Segment>::Element *element = segments.find(s);
- if (element != NULL) {
+ if (element != nullptr) {
// s is the new segment
// Erase the directions to be removed
s.direction = (element->get().direction & ~remove_direction);
@@ -255,7 +255,7 @@ bool AStar::are_points_connected(int p_id, int p_with_id, bool bidirectional) co
Segment s(p_id, p_with_id);
const Set<Segment>::Element *element = segments.find(s);
- return element != NULL &&
+ return element != nullptr &&
(bidirectional || (element->get().direction & s.direction) == s.direction);
}
diff --git a/core/math/aabb.h b/core/math/aabb.h
index d9d50c7139..eca74e6755 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -72,8 +72,8 @@ public:
AABB merge(const AABB &p_with) const;
void merge_with(const AABB &p_aabb); ///merge with another AABB
AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
- bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
- bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
+ bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
+ bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
_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;
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 04fda9d09a..859b9be8c5 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -760,7 +760,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
PackedByteArray barr;
bool full_objects = *p_inputs[1];
int len;
- Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
+ Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
if (err) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
@@ -791,7 +791,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
Variant ret;
{
const uint8_t *r = varr.ptr();
- Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
+ Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
if (err != OK) {
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -1298,12 +1298,12 @@ Expression::ENode *Expression::_parse_expression() {
while (true) {
//keep appending stuff to expression
- ENode *expr = NULL;
+ ENode *expr = nullptr;
Token tk;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
switch (tk.type) {
case TK_CURLY_BRACKET_OPEN: {
@@ -1321,18 +1321,18 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
dn->dict.push_back(subexpr);
_get_token(tk);
if (tk.type != TK_COLON) {
_set_error("Expected ':'");
- return NULL;
+ return nullptr;
}
subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
dn->dict.push_back(subexpr);
@@ -1365,7 +1365,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
an->array.push_back(subexpr);
cofs = str_ofs;
@@ -1385,11 +1385,11 @@ Expression::ENode *Expression::_parse_expression() {
//a suexpression
ENode *e = _parse_expression();
if (error_set)
- return NULL;
+ return nullptr;
_get_token(tk);
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')'");
- return NULL;
+ return nullptr;
}
expr = e;
@@ -1419,7 +1419,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
func_call->arguments.push_back(subexpr);
@@ -1484,7 +1484,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
ConstructorNode *constructor = alloc_node<ConstructorNode>();
@@ -1501,7 +1501,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
constructor->arguments.push_back(subexpr);
@@ -1525,7 +1525,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
@@ -1542,7 +1542,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
bifunc->arguments.push_back(subexpr);
@@ -1584,7 +1584,7 @@ Expression::ENode *Expression::_parse_expression() {
default: {
_set_error("Expected expression.");
- return NULL;
+ return nullptr;
} break;
}
@@ -1594,7 +1594,7 @@ Expression::ENode *Expression::_parse_expression() {
int cofs2 = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
bool done = false;
@@ -1607,14 +1607,14 @@ Expression::ENode *Expression::_parse_expression() {
ENode *what = _parse_expression();
if (!what)
- return NULL;
+ return nullptr;
index->index = what;
_get_token(tk);
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']' at end of index.");
- return NULL;
+ return nullptr;
}
expr = index;
@@ -1624,7 +1624,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_IDENTIFIER) {
_set_error("Expected identifier after '.'");
- return NULL;
+ return nullptr;
}
StringName identifier = tk.value;
@@ -1648,7 +1648,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
func_call->arguments.push_back(subexpr);
@@ -1698,7 +1698,7 @@ Expression::ENode *Expression::_parse_expression() {
int cofs = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
Variant::Operator op = Variant::OP_MAX;
@@ -1805,7 +1805,7 @@ Expression::ENode *Expression::_parse_expression() {
default: {
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
- return NULL;
+ return nullptr;
}
}
@@ -1822,7 +1822,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// OK! create operator..
@@ -1835,7 +1835,7 @@ Expression::ENode *Expression::_parse_expression() {
if (expr_pos == expression.size()) {
//can happen..
_set_error("Unexpected end of expression...");
- return NULL;
+ return nullptr;
}
}
@@ -1845,7 +1845,7 @@ Expression::ENode *Expression::_parse_expression() {
OperatorNode *op = alloc_node<OperatorNode>();
op->op = expression[i].op;
op->nodes[0] = expression[i + 1].node;
- op->nodes[1] = NULL;
+ op->nodes[1] = nullptr;
expression.write[i].is_op = false;
expression.write[i].node = op;
expression.remove(i + 1);
@@ -1855,7 +1855,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1864,7 +1864,7 @@ Expression::ENode *Expression::_parse_expression() {
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (expression[next_op + 1].is_op) {
@@ -1874,7 +1874,7 @@ Expression::ENode *Expression::_parse_expression() {
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators.");
- return NULL;
+ return nullptr;
}
op->nodes[0] = expression[next_op - 1].node; //expression goes as left
@@ -1897,8 +1897,8 @@ bool Expression::_compile_expression() {
if (nodes) {
memdelete(nodes);
- nodes = NULL;
- root = NULL;
+ nodes = nullptr;
+ root = nullptr;
}
error_str = String();
@@ -1908,11 +1908,11 @@ bool Expression::_compile_expression() {
root = _parse_expression();
if (error_set) {
- root = NULL;
+ root = nullptr;
if (nodes) {
memdelete(nodes);
}
- nodes = NULL;
+ nodes = nullptr;
return true;
}
@@ -2151,8 +2151,8 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
if (nodes) {
memdelete(nodes);
- nodes = NULL;
- root = NULL;
+ nodes = nullptr;
+ root = nullptr;
}
error_str = String();
@@ -2164,11 +2164,11 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
root = _parse_expression();
if (error_set) {
- root = NULL;
+ root = nullptr;
if (nodes) {
memdelete(nodes);
}
- nodes = NULL;
+ nodes = nullptr;
return ERR_INVALID_PARAMETER;
}
@@ -2212,9 +2212,11 @@ Expression::Expression() :
output_type(Variant::NIL),
sequenced(false),
error_set(true),
- root(NULL),
- nodes(NULL),
+ root(nullptr),
+ nodes(nullptr),
execution_error(false) {
+ str_ofs = 0;
+ expression_dirty = false;
}
Expression::~Expression() {
diff --git a/core/math/expression.h b/core/math/expression.h
index bbf946bb0a..78de225ebf 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -219,7 +219,7 @@ private:
Type type;
- ENode() { next = NULL; }
+ ENode() { next = nullptr; }
virtual ~ENode() {
if (next) {
memdelete(next);
@@ -352,7 +352,7 @@ protected:
public:
Error parse(const String &p_expression, const Vector<String> &p_input_names = Vector<String>());
- Variant execute(Array p_inputs, Object *p_base = NULL, bool p_show_error = true);
+ Variant execute(Array p_inputs, Object *p_base = nullptr, bool p_show_error = true);
bool has_execute_failed() const;
String get_error_text() const;
diff --git a/core/math/geometry.h b/core/math/geometry.h
index becbcdbf0f..e47d18b056 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -891,7 +891,7 @@ public:
for (int i = 0; i < c; i++) {
const Vector2 &v1 = p[i];
const Vector2 &v2 = p[(i + 1) % c];
- if (segment_intersects_segment_2d(v1, v2, p_point, further_away, NULL)) {
+ if (segment_intersects_segment_2d(v1, v2, p_point, further_away, nullptr)) {
intersections++;
}
}
@@ -902,7 +902,7 @@ public:
static Vector<Vector<Face3>> separate_objects(Vector<Face3> p_array);
// Create a "wrap" that encloses the given geometry.
- static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = NULL);
+ static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = nullptr);
struct MeshData {
diff --git a/core/math/octree.h b/core/math/octree.h
index b47c052b68..5225fbecb4 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -119,9 +119,9 @@ private:
children_count = 0;
parent_index = -1;
last_pass = 0;
- parent = NULL;
+ parent = nullptr;
for (int i = 0; i < 8; i++)
- children[i] = NULL;
+ children[i] = nullptr;
}
~Octant() {
@@ -171,7 +171,7 @@ private:
octree = 0;
pairable_mask = 0;
pairable_type = 0;
- common_parent = NULL;
+ common_parent = nullptr;
}
};
@@ -308,19 +308,19 @@ private:
while (root && root->children_count < 2 && !root->elements.size() && !(use_pairs && root->pairable_elements.size())) {
- Octant *new_root = NULL;
+ Octant *new_root = nullptr;
if (root->children_count == 1) {
for (int i = 0; i < 8; i++) {
if (root->children[i]) {
new_root = root->children[i];
- root->children[i] = NULL;
+ root->children[i] = nullptr;
break;
}
}
ERR_FAIL_COND(!new_root);
- new_root->parent = NULL;
+ new_root->parent = nullptr;
new_root->parent_index = -1;
}
@@ -332,7 +332,7 @@ private:
void _insert_element(Element *p_element, Octant *p_octant);
void _ensure_valid_root(const AABB &p_aabb);
- bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = NULL);
+ bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = nullptr);
void _remove_element(Element *p_element);
void _pair_element(Element *p_element, Octant *p_octant);
void _unpair_element(Element *p_element, Octant *p_octant);
@@ -377,10 +377,10 @@ public:
int get_subindex(OctreeElementID p_id) const;
int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF);
- int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
- int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+ int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
+ int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
- int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF);
+ int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF);
void set_pair_callback(PairCallback p_callback, void *p_userdata);
void set_unpair_callback(UnpairCallback p_callback, void *p_userdata);
@@ -396,7 +396,7 @@ public:
template <class T, bool use_pairs, class AL>
T *Octree<T, use_pairs, AL>::get(OctreeElementID p_id) const {
const typename ElementMap::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().userdata;
}
@@ -442,7 +442,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
p_element->octant_owners.push_back(owner);
- if (p_element->common_parent == NULL) {
+ if (p_element->common_parent == nullptr) {
p_element->common_parent = p_octant;
p_element->container_aabb = p_octant->aabb;
} else {
@@ -463,7 +463,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
} else {
/* not big enough, send it to subitems */
int splits = 0;
- bool candidate = p_element->common_parent == NULL;
+ bool candidate = p_element->common_parent == nullptr;
for (int i = 0; i < 8; i++) {
@@ -552,7 +552,7 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const AABB &p_aabb) {
root = memnew_allocator(Octant, AL);
- root->parent = NULL;
+ root->parent = nullptr;
root->parent_index = -1;
root->aabb = base;
@@ -634,11 +634,11 @@ bool Octree<T, use_pairs, AL>::_remove_element_from_octant(Element *p_element, O
if (p_octant == root) { // won't have a parent, just erase
- root = NULL;
+ root = nullptr;
} else {
ERR_FAIL_INDEX_V(p_octant->parent_index, 8, octant_removed);
- parent->children[p_octant->parent_index] = NULL;
+ parent->children[p_octant->parent_index] = nullptr;
parent->children_count--;
}
@@ -852,12 +852,12 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
if (old_has_surf) {
_remove_element(&e); // removing
- e.common_parent = NULL;
+ e.common_parent = nullptr;
e.aabb = AABB();
_optimize();
} else {
_ensure_valid_root(p_aabb); // inserting
- e.common_parent = NULL;
+ e.common_parent = nullptr;
e.aabb = p_aabb;
_insert_element(&e, root);
if (use_pairs)
@@ -884,7 +884,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
combined.merge_with(p_aabb);
_ensure_valid_root(combined);
- ERR_FAIL_COND(e.octant_owners.front() == NULL);
+ ERR_FAIL_COND(e.octant_owners.front() == nullptr);
/* FIND COMMON PARENT */
@@ -902,7 +902,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) {
//prepare for reinsert
e.octant_owners.clear();
- e.common_parent = NULL;
+ e.common_parent = nullptr;
e.aabb = p_aabb;
_insert_element(&e, common_parent); // reinsert from this point
@@ -971,7 +971,7 @@ void Octree<T, use_pairs, AL>::set_pairable(OctreeElementID p_id, bool p_pairabl
e.pairable = p_pairable;
e.pairable_type = p_pairable_type;
e.pairable_mask = p_pairable_mask;
- e.common_parent = NULL;
+ e.common_parent = nullptr;
if (!e.aabb.has_no_surface()) {
_ensure_valid_root(e.aabb);
@@ -1364,15 +1364,15 @@ Octree<T, use_pairs, AL>::Octree(real_t p_unit_size) {
last_element_id = 1;
pass = 1;
unit_size = p_unit_size;
- root = NULL;
+ root = nullptr;
octant_count = 0;
pair_count = 0;
- pair_callback = NULL;
- unpair_callback = NULL;
- pair_callback_userdata = NULL;
- unpair_callback_userdata = NULL;
+ pair_callback = nullptr;
+ unpair_callback = nullptr;
+ pair_callback_userdata = nullptr;
+ unpair_callback_userdata = nullptr;
}
#endif // OCTREE_H
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 63dd18091f..7fbb26c377 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -399,7 +399,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
ERR_CONTINUE(!F);
List<Geometry::MeshData::Face>::Element *O = F->get().left == E ? F->get().right : F->get().left;
ERR_CONTINUE(O == E);
- ERR_CONTINUE(O == NULL);
+ ERR_CONTINUE(O == nullptr);
if (O->get().plane.is_equal_approx(f.plane)) {
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
@@ -440,10 +440,10 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
// remove all edge connections to this face
for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
if (G->get().left == O)
- G->get().left = NULL;
+ G->get().left = nullptr;
if (G->get().right == O)
- G->get().right = NULL;
+ G->get().right = nullptr;
}
ret_edges.erase(F); //remove the edge
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index aea9ffad8b..173f919a73 100644
--- a/core/math/quick_hull.h
+++ b/core/math/quick_hull.h
@@ -77,15 +77,15 @@ private:
struct FaceConnect {
List<Face>::Element *left, *right;
FaceConnect() {
- left = NULL;
- right = NULL;
+ left = nullptr;
+ right = nullptr;
}
};
struct RetFaceConnect {
List<Geometry::MeshData::Face>::Element *left, *right;
RetFaceConnect() {
- left = NULL;
- right = NULL;
+ left = nullptr;
+ right = nullptr;
}
};
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 3b9660e2f0..30dbfdbbe5 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -105,7 +105,7 @@ struct Rect2 {
bool intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const;
- bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = NULL, Point2 *r_normal = NULL) const;
+ bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = nullptr, Point2 *r_normal = nullptr) const;
inline bool encloses(const Rect2 &p_rect) const {
diff --git a/core/message_queue.cpp b/core/message_queue.cpp
index 26f5b23416..652c424492 100644
--- a/core/message_queue.cpp
+++ b/core/message_queue.cpp
@@ -34,7 +34,7 @@
#include "core/project_settings.h"
#include "core/script_language.h"
-MessageQueue *MessageQueue::singleton = NULL;
+MessageQueue *MessageQueue::singleton = nullptr;
MessageQueue *MessageQueue::get_singleton() {
@@ -174,7 +174,7 @@ void MessageQueue::statistics() {
Object *target = message->callable.get_object();
- if (target != NULL) {
+ if (target != nullptr) {
switch (message->type & FLAG_MASK) {
@@ -240,7 +240,7 @@ int MessageQueue::get_max_buffer_usage() const {
void MessageQueue::_call_function(const Callable &p_callable, const Variant *p_args, int p_argcount, bool p_show_error) {
- const Variant **argptrs = NULL;
+ const Variant **argptrs = nullptr;
if (p_argcount) {
argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount);
for (int i = 0; i < p_argcount; i++) {
@@ -291,7 +291,7 @@ void MessageQueue::flush() {
Object *target = message->callable.get_object();
- if (target != NULL) {
+ if (target != nullptr) {
switch (message->type & FLAG_MASK) {
case TYPE_CALL: {
@@ -343,7 +343,7 @@ bool MessageQueue::is_flushing() const {
MessageQueue::MessageQueue() {
- ERR_FAIL_COND_MSG(singleton != NULL, "A MessageQueue singleton already exists.");
+ ERR_FAIL_COND_MSG(singleton != nullptr, "A MessageQueue singleton already exists.");
singleton = this;
flushing = false;
@@ -375,6 +375,6 @@ MessageQueue::~MessageQueue() {
read_pos += sizeof(Variant) * message->args;
}
- singleton = NULL;
+ singleton = nullptr;
memdelete_arr(buffer);
}
diff --git a/core/method_bind.cpp b/core/method_bind.cpp
index 2c9d0cee2f..c513de9ca0 100644
--- a/core/method_bind.cpp
+++ b/core/method_bind.cpp
@@ -108,7 +108,7 @@ MethodBind::MethodBind() {
argument_count = 0;
default_argument_count = 0;
#ifdef DEBUG_METHODS_ENABLED
- argument_types = NULL;
+ argument_types = nullptr;
#endif
_const = false;
_returns = false;
diff --git a/core/method_bind.h b/core/method_bind.h
index a1ab4e58fc..588b472b62 100644
--- a/core/method_bind.h
+++ b/core/method_bind.h
@@ -382,7 +382,7 @@ public:
virtual bool is_vararg() const { return true; }
MethodBindVarArg() {
- call_method = NULL;
+ call_method = nullptr;
_set_returns(true);
}
};
diff --git a/core/node_path.cpp b/core/node_path.cpp
index e844cd7c27..83233622a0 100644
--- a/core/node_path.cpp
+++ b/core/node_path.cpp
@@ -99,7 +99,7 @@ void NodePath::unref() {
memdelete(data);
}
- data = NULL;
+ data = nullptr;
}
bool NodePath::operator==(const NodePath &p_path) const {
@@ -189,7 +189,7 @@ NodePath::operator String() const {
NodePath::NodePath(const NodePath &p_path) {
- data = NULL;
+ data = nullptr;
if (p_path.data && p_path.data->refcount.ref()) {
@@ -287,7 +287,7 @@ NodePath NodePath::get_as_property_path() const {
NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
- data = NULL;
+ data = nullptr;
if (p_path.size() == 0)
return;
@@ -302,7 +302,7 @@ NodePath::NodePath(const Vector<StringName> &p_path, bool p_absolute) {
NodePath::NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute) {
- data = NULL;
+ data = nullptr;
if (p_path.size() == 0 && p_subpath.size() == 0)
return;
@@ -349,7 +349,7 @@ NodePath NodePath::simplified() const {
NodePath::NodePath(const String &p_path) {
- data = NULL;
+ data = nullptr;
if (p_path.length() == 0)
return;
@@ -442,7 +442,7 @@ bool NodePath::is_empty() const {
}
NodePath::NodePath() {
- data = NULL;
+ data = nullptr;
}
NodePath::~NodePath() {
diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h
index 447b0db0eb..71e3ba9068 100644
--- a/core/oa_hash_map.h
+++ b/core/oa_hash_map.h
@@ -224,7 +224,7 @@ public:
/**
* returns true if the value was found, false otherwise.
*
- * if r_data is not NULL then the value will be written to the object
+ * if r_data is not nullptr then the value will be written to the object
* it points to.
*/
bool lookup(const TKey &p_key, TValue &r_data) const {
@@ -243,7 +243,7 @@ public:
/**
* returns true if the value was found, false otherwise.
*
- * if r_data is not NULL then the value will be written to the object
+ * if r_data is not nullptr then the value will be written to the object
* it points to.
*/
TValue *lookup_ptr(const TKey &p_key) const {
@@ -253,7 +253,7 @@ public:
if (exists) {
return &values[pos];
}
- return NULL;
+ return nullptr;
}
_FORCE_INLINE_ bool has(const TKey &p_key) const {
@@ -325,8 +325,8 @@ public:
Iterator it;
it.valid = false;
it.pos = p_iter.pos;
- it.key = NULL;
- it.value = NULL;
+ it.key = nullptr;
+ it.value = nullptr;
for (uint32_t i = it.pos; i < capacity; i++) {
it.pos = i + 1;
diff --git a/core/object.cpp b/core/object.cpp
index 188c0ee5c2..b0e6f2bdae 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -368,7 +368,7 @@ bool Object::_predelete() {
_predelete_ok = 1;
notification(NOTIFICATION_PREDELETE, true);
if (_predelete_ok) {
- _class_ptr = NULL; //must restore so destructors can access class ptr correctly
+ _class_ptr = nullptr; //must restore so destructors can access class ptr correctly
}
return _predelete_ok;
}
@@ -781,7 +781,7 @@ bool Object::has_method(const StringName &p_method) const {
MethodBind *method = ClassDB::get_method(get_class_name(), p_method);
- return method != NULL;
+ return method != nullptr;
}
Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
@@ -797,7 +797,7 @@ void Object::setvar(const Variant &p_key, const Variant &p_value, bool *r_valid)
}
Variant Object::callv(const StringName &p_method, const Array &p_args) {
- const Variant **argptrs = NULL;
+ const Variant **argptrs = nullptr;
if (p_args.size() > 0) {
argptrs = (const Variant **)alloca(sizeof(Variant *) * p_args.size());
@@ -955,7 +955,7 @@ void Object::set_script_and_instance(const Variant &p_script, ScriptInstance *p_
//this function is not meant to be used in any of these ways
ERR_FAIL_COND(p_script.is_null());
ERR_FAIL_COND(!p_instance);
- ERR_FAIL_COND(script_instance != NULL || !script.is_null());
+ ERR_FAIL_COND(script_instance != nullptr || !script.is_null());
script = p_script;
script_instance = p_instance;
@@ -968,7 +968,7 @@ void Object::set_script(const Variant &p_script) {
if (script_instance) {
memdelete(script_instance);
- script_instance = NULL;
+ script_instance = nullptr;
}
script = p_script;
@@ -1119,7 +1119,7 @@ Variant Object::_emit_signal(const Variant **p_args, int p_argcount, Callable::C
StringName signal = *p_args[0];
- const Variant **args = NULL;
+ const Variant **args = nullptr;
int argc = p_argcount - 1;
if (argc) {
@@ -1354,7 +1354,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals) const {
ClassDB::get_signal_list(get_class_name(), p_signals);
//find maybe usersignals?
- const StringName *S = NULL;
+ const StringName *S = nullptr;
while ((S = signal_map.next(S))) {
@@ -1367,7 +1367,7 @@ void Object::get_signal_list(List<MethodInfo> *p_signals) const {
void Object::get_all_signal_connections(List<Connection> *p_connections) const {
- const StringName *S = NULL;
+ const StringName *S = nullptr;
while ((S = signal_map.next(S))) {
@@ -1393,7 +1393,7 @@ void Object::get_signal_connection_list(const StringName &p_signal, List<Connect
int Object::get_persistent_signal_connection_count() const {
int count = 0;
- const StringName *S = NULL;
+ const StringName *S = nullptr;
while ((S = signal_map.next(S))) {
@@ -1505,7 +1505,7 @@ bool Object::is_connected(const StringName &p_signal, const Callable &p_callable
return s->slot_map.has(target);
//const Map<Signal::Target,Signal::Slot>::Element *E = s->slot_map.find(target);
- //return (E!=NULL);
+ //return (E!=nullptr );
}
void Object::disconnect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method) {
@@ -1840,7 +1840,7 @@ Variant::Type Object::get_static_property_type_indexed(const Vector<StringName>
}
Callable::CallError ce;
- Variant check = Variant::construct(t, NULL, 0, ce);
+ Variant check = Variant::construct(t, nullptr, 0, ce);
for (int i = 1; i < p_path.size(); i++) {
if (check.get_type() == Variant::OBJECT || check.get_type() == Variant::DICTIONARY || check.get_type() == Variant::ARRAY) {
@@ -1889,7 +1889,7 @@ uint32_t Object::get_edited_version() const {
void *Object::get_script_instance_binding(int p_script_language_index) {
#ifdef DEBUG_ENABLED
- ERR_FAIL_INDEX_V(p_script_language_index, MAX_SCRIPT_INSTANCE_BINDINGS, NULL);
+ ERR_FAIL_INDEX_V(p_script_language_index, MAX_SCRIPT_INSTANCE_BINDINGS, nullptr);
#endif
//it's up to the script language to make this thread safe, if the function is called twice due to threads being out of syncro
@@ -1910,19 +1910,19 @@ void *Object::get_script_instance_binding(int p_script_language_index) {
bool Object::has_script_instance_binding(int p_script_language_index) {
- return _script_instance_bindings[p_script_language_index] != NULL;
+ return _script_instance_bindings[p_script_language_index] != nullptr;
}
void Object::set_script_instance_binding(int p_script_language_index, void *p_data) {
#ifdef DEBUG_ENABLED
- CRASH_COND(_script_instance_bindings[p_script_language_index] != NULL);
+ CRASH_COND(_script_instance_bindings[p_script_language_index] != nullptr);
#endif
_script_instance_bindings[p_script_language_index] = p_data;
}
void Object::_construct_object(bool p_reference) {
type_is_reference = p_reference;
- _class_ptr = NULL;
+ _class_ptr = nullptr;
_block_signals = false;
_predelete_ok = 0;
_instance_id = ObjectDB::add_instance(this);
@@ -1931,7 +1931,7 @@ void Object::_construct_object(bool p_reference) {
_emitting = false;
instance_binding_count = 0;
memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS);
- script_instance = NULL;
+ script_instance = nullptr;
#ifdef TOOLS_ENABLED
_edited = false;
@@ -1955,16 +1955,16 @@ Object::~Object() {
if (script_instance)
memdelete(script_instance);
- script_instance = NULL;
+ script_instance = nullptr;
- const StringName *S = NULL;
+ const StringName *S = nullptr;
if (_emitting) {
//@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
ERR_PRINT("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
}
- while ((S = signal_map.next(NULL))) {
+ while ((S = signal_map.next(nullptr))) {
SignalData *s = &signal_map[*S];
diff --git a/core/object.h b/core/object.h
index 0826686fb3..40032de271 100644
--- a/core/object.h
+++ b/core/object.h
@@ -242,7 +242,7 @@ struct MethodInfo {
//if ( is_type(T::get_class_static()) )
//return static_cast<T*>(this);
////else
-//return NULL;
+//return nullptr;
/*
the following is an incomprehensible blob of hacks and workarounds to compensate for many of the fallencies in C++. As a plus, this macro pretty much alone defines the object model.
@@ -591,11 +591,11 @@ public:
return dynamic_cast<T *>(p_object);
#else
if (!p_object)
- return NULL;
+ return nullptr;
if (p_object->is_class_ptr(T::get_class_ptr_static()))
return static_cast<T *>(p_object);
else
- return NULL;
+ return nullptr;
#endif
}
@@ -605,11 +605,11 @@ public:
return dynamic_cast<const T *>(p_object);
#else
if (!p_object)
- return NULL;
+ return nullptr;
if (p_object->is_class_ptr(T::get_class_ptr_static()))
return static_cast<const T *>(p_object);
else
- return NULL;
+ return nullptr;
#endif
}
@@ -644,10 +644,10 @@ public:
//void set(const String& p_name, const Variant& p_value);
//Variant get(const String& p_name) const;
- void set(const StringName &p_name, const Variant &p_value, bool *r_valid = NULL);
- Variant get(const StringName &p_name, bool *r_valid = NULL) const;
- void set_indexed(const Vector<StringName> &p_names, const Variant &p_value, bool *r_valid = NULL);
- Variant get_indexed(const Vector<StringName> &p_names, bool *r_valid = NULL) const;
+ void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
+ Variant get(const StringName &p_name, bool *r_valid = nullptr) const;
+ void set_indexed(const Vector<StringName> &p_names, const Variant &p_value, bool *r_valid = nullptr);
+ Variant get_indexed(const Vector<StringName> &p_names, bool *r_valid = nullptr) const;
void get_property_list(List<PropertyInfo> *p_list, bool p_reversed = false) const;
@@ -664,8 +664,8 @@ public:
String to_string();
//used mainly by script, get and set all INCLUDING string
- virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
- virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = NULL);
+ virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
+ virtual void setvar(const Variant &p_key, const Variant &p_value, bool *r_valid = nullptr);
/* SCRIPT */
@@ -715,8 +715,8 @@ public:
void set_block_signals(bool p_block);
bool is_blocking_signals() const;
- Variant::Type get_static_property_type(const StringName &p_property, bool *r_valid = NULL) const;
- Variant::Type get_static_property_type_indexed(const Vector<StringName> &p_path, bool *r_valid = NULL) const;
+ Variant::Type get_static_property_type(const StringName &p_property, bool *r_valid = nullptr) const;
+ Variant::Type get_static_property_type_indexed(const Vector<StringName> &p_path, bool *r_valid = nullptr) const;
virtual void get_translatable_strings(List<String> *p_strings) const;
diff --git a/core/ordered_hash_map.h b/core/ordered_hash_map.h
index 055e3e607e..05debd529f 100644
--- a/core/ordered_hash_map.h
+++ b/core/ordered_hash_map.h
@@ -70,9 +70,9 @@ public:
public:
_FORCE_INLINE_ Element() :
- list_element(NULL),
- prev_element(NULL),
- next_element(NULL) {
+ list_element(nullptr),
+ prev_element(nullptr),
+ next_element(nullptr) {
}
Element next() const {
@@ -104,7 +104,7 @@ public:
}
operator bool() const {
- return (list_element != NULL);
+ return (list_element != nullptr);
}
const K &key() const {
@@ -144,7 +144,7 @@ public:
public:
_FORCE_INLINE_ ConstElement() :
- list_element(NULL) {
+ list_element(nullptr) {
}
ConstElement(const ConstElement &other) :
@@ -157,11 +157,11 @@ public:
}
ConstElement next() const {
- return ConstElement(list_element ? list_element->next() : NULL);
+ return ConstElement(list_element ? list_element->next() : nullptr);
}
ConstElement prev() const {
- return ConstElement(list_element ? list_element->prev() : NULL);
+ return ConstElement(list_element ? list_element->prev() : nullptr);
}
_FORCE_INLINE_ bool operator==(const ConstElement &p_other) const {
@@ -172,7 +172,7 @@ public:
}
operator bool() const {
- return (list_element != NULL);
+ return (list_element != nullptr);
}
const K &key() const {
@@ -196,7 +196,7 @@ public:
if (list_element) {
return ConstElement(*list_element);
}
- return ConstElement(NULL);
+ return ConstElement(nullptr);
}
Element find(const K &p_key) {
@@ -204,7 +204,7 @@ public:
if (list_element) {
return Element(*list_element);
}
- return Element(NULL);
+ return Element(nullptr);
}
Element insert(const K &p_key, const V &p_value) {
@@ -213,7 +213,7 @@ public:
(*list_element)->get().second = p_value;
return Element(*list_element);
}
- typename InternalList::Element *new_element = list.push_back(Pair<const K *, V>(NULL, p_value));
+ typename InternalList::Element *new_element = list.push_back(Pair<const K *, V>(nullptr, p_value));
typename InternalMap::Element *e = map.set(p_key, new_element);
new_element->get().first = &e->key();
@@ -223,7 +223,7 @@ public:
void erase(Element &p_element) {
map.erase(p_element.key());
list.erase(p_element.list_element);
- p_element.list_element = NULL;
+ p_element.list_element = nullptr;
}
bool erase(const K &p_key) {
diff --git a/core/os/SCsub b/core/os/SCsub
index 1c5f954470..19a6549225 100644
--- a/core/os/SCsub
+++ b/core/os/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.core_sources, "*.cpp")
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 642c86be2f..94c8cd5d73 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -226,11 +226,11 @@ String DirAccess::fix_path(String p_path) const {
return p_path;
}
-DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { 0, 0, 0 };
+DirAccess::CreateFunc DirAccess::create_func[ACCESS_MAX] = { nullptr, nullptr, nullptr };
DirAccess *DirAccess::create_for_path(const String &p_path) {
- DirAccess *da = NULL;
+ DirAccess *da = nullptr;
if (p_path.begins_with("res://")) {
da = create(ACCESS_RESOURCES);
@@ -249,13 +249,13 @@ DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
DirAccess *da = create_for_path(p_path);
- ERR_FAIL_COND_V_MSG(!da, NULL, "Cannot create DirAccess for path '" + p_path + "'.");
+ ERR_FAIL_COND_V_MSG(!da, nullptr, "Cannot create DirAccess for path '" + p_path + "'.");
Error err = da->change_dir(p_path);
if (r_error)
*r_error = err;
if (err != OK) {
memdelete(da);
- return NULL;
+ return nullptr;
}
return da;
@@ -263,7 +263,7 @@ DirAccess *DirAccess::open(const String &p_path, Error *r_error) {
DirAccess *DirAccess::create(AccessType p_access) {
- DirAccess *da = create_func[p_access] ? create_func[p_access]() : NULL;
+ DirAccess *da = create_func[p_access] ? create_func[p_access]() : nullptr;
if (da) {
da->_access_type = p_access;
}
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 059f7aad2f..60eb553968 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -128,7 +128,7 @@ public:
create_func[p_access] = _create_builtin<T>;
}
- static DirAccess *open(const String &p_path, Error *r_error = NULL);
+ static DirAccess *open(const String &p_path, Error *r_error = nullptr);
DirAccess();
virtual ~DirAccess();
@@ -141,7 +141,7 @@ struct DirAccessRef {
return f;
}
- operator bool() const { return f != NULL; }
+ operator bool() const { return f != nullptr; }
DirAccess *f;
DirAccessRef(DirAccess *fa) { f = fa; }
~DirAccessRef() {
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 30cfaa7617..3922f031b7 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -36,15 +36,15 @@
#include "core/os/os.h"
#include "core/project_settings.h"
-FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { 0, 0 };
+FileAccess::CreateFunc FileAccess::create_func[ACCESS_MAX] = { nullptr, nullptr };
-FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = NULL;
+FileAccess::FileCloseFailNotify FileAccess::close_fail_notify = nullptr;
bool FileAccess::backup_save = false;
FileAccess *FileAccess::create(AccessType p_access) {
- ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, 0);
+ ERR_FAIL_INDEX_V(p_access, ACCESS_MAX, nullptr);
FileAccess *ret = create_func[p_access]();
ret->_set_access_type(p_access);
@@ -70,7 +70,7 @@ void FileAccess::_set_access_type(AccessType p_access) {
FileAccess *FileAccess::create_for_path(const String &p_path) {
- FileAccess *ret = NULL;
+ FileAccess *ret = nullptr;
if (p_path.begins_with("res://")) {
ret = create(ACCESS_RESOURCES);
@@ -95,7 +95,7 @@ FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_er
//try packed data first
- FileAccess *ret = NULL;
+ FileAccess *ret = nullptr;
if (!(p_mode_flags & WRITE) && PackedData::get_singleton() && !PackedData::get_singleton()->is_disabled()) {
ret = PackedData::get_singleton()->try_open_path(p_path);
if (ret) {
@@ -113,7 +113,7 @@ FileAccess *FileAccess::open(const String &p_path, int p_mode_flags, Error *r_er
if (err != OK) {
memdelete(ret);
- ret = NULL;
+ ret = nullptr;
}
return ret;
diff --git a/core/os/file_access.h b/core/os/file_access.h
index 4a82637ecc..010cc74a87 100644
--- a/core/os/file_access.h
+++ b/core/os/file_access.h
@@ -153,7 +153,7 @@ public:
static FileAccess *create(AccessType p_access); /// Create a file access (for the current platform) this is the only portable way of accessing files.
static FileAccess *create_for_path(const String &p_path);
- static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = NULL); /// Create a file access (for the current platform) this is the only portable way of accessing files.
+ static FileAccess *open(const String &p_path, int p_mode_flags, Error *r_error = nullptr); /// Create a file access (for the current platform) this is the only portable way of accessing files.
static CreateFunc get_create_func(AccessType p_access);
static bool exists(const String &p_name); ///< return true if a file exists
static uint64_t get_modified_time(const String &p_file);
@@ -167,8 +167,8 @@ public:
static String get_sha256(const String &p_file);
static String get_multiple_md5(const Vector<String> &p_file);
- static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = NULL);
- static String get_file_as_string(const String &p_path, Error *r_error = NULL);
+ static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = nullptr);
+ static String get_file_as_string(const String &p_path, Error *r_error = nullptr);
template <class T>
static void make_default(AccessType p_access) {
@@ -187,7 +187,7 @@ struct FileAccessRef {
return f;
}
- operator bool() const { return f != NULL; }
+ operator bool() const { return f != nullptr; }
FileAccess *f;
operator FileAccess *() { return f; }
FileAccessRef(FileAccess *fa) { f = fa; }
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 7141423c77..c65d3fefc2 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -288,7 +288,7 @@ static const _KeyCodeText _keycodes[] = {
{KEY_DIVISION ,"Division"},
{KEY_YDIAERESIS ,"Ydiaeresis"},
- {0 ,0}
+ {0 ,nullptr}
/* clang-format on */
};
diff --git a/core/os/memory.cpp b/core/os/memory.cpp
index 39d3fce910..d921c10ad4 100644
--- a/core/os/memory.cpp
+++ b/core/os/memory.cpp
@@ -81,7 +81,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *mem = malloc(p_bytes + (prepad ? PAD_ALIGN : 0));
- ERR_FAIL_COND_V(!mem, NULL);
+ ERR_FAIL_COND_V(!mem, nullptr);
atomic_increment(&alloc_count);
@@ -103,7 +103,7 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
- if (p_memory == NULL) {
+ if (p_memory == nullptr) {
return alloc_static(p_bytes, p_pad_align);
}
@@ -130,12 +130,12 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
if (p_bytes == 0) {
free(mem);
- return NULL;
+ return nullptr;
} else {
*s = p_bytes;
mem = (uint8_t *)realloc(mem, p_bytes + PAD_ALIGN);
- ERR_FAIL_COND_V(!mem, NULL);
+ ERR_FAIL_COND_V(!mem, nullptr);
s = (uint64_t *)mem;
@@ -147,7 +147,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
mem = (uint8_t *)realloc(mem, p_bytes);
- ERR_FAIL_COND_V(mem == NULL && p_bytes > 0, NULL);
+ ERR_FAIL_COND_V(mem == nullptr && p_bytes > 0, nullptr);
return mem;
}
@@ -155,7 +155,7 @@ void *Memory::realloc_static(void *p_memory, size_t p_bytes, bool p_pad_align) {
void Memory::free_static(void *p_ptr, bool p_pad_align) {
- ERR_FAIL_COND(p_ptr == NULL);
+ ERR_FAIL_COND(p_ptr == nullptr);
uint8_t *mem = (uint8_t *)p_ptr;
diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp
index c23ade3088..985f6f38e5 100644
--- a/core/os/midi_driver.cpp
+++ b/core/os/midi_driver.cpp
@@ -34,7 +34,7 @@
#include "core/os/os.h"
uint8_t MIDIDriver::last_received_message = 0x00;
-MIDIDriver *MIDIDriver::singleton = NULL;
+MIDIDriver *MIDIDriver::singleton = nullptr;
MIDIDriver *MIDIDriver::get_singleton() {
return singleton;
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 66ab3bbd8c..0636810e4b 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -40,7 +40,7 @@
#include <stdarg.h>
-OS *OS::singleton = NULL;
+OS *OS::singleton = nullptr;
OS *OS::get_singleton() {
@@ -184,7 +184,7 @@ void OS::dump_memory_to_file(const char *p_file) {
//Memory::dump_static_mem_to_file(p_file);
}
-static FileAccess *_OSPRF = NULL;
+static FileAccess *_OSPRF = nullptr;
static void _OS_printres(Object *p_obj) {
@@ -207,7 +207,7 @@ void OS::print_all_resources(String p_to_file) {
Error err;
_OSPRF = FileAccess::open(p_to_file, FileAccess::WRITE, &err);
if (err != OK) {
- _OSPRF = NULL;
+ _OSPRF = nullptr;
ERR_FAIL_MSG("Can't print all resources to file: " + String(p_to_file) + ".");
}
}
@@ -218,13 +218,13 @@ void OS::print_all_resources(String p_to_file) {
if (_OSPRF)
memdelete(_OSPRF);
- _OSPRF = NULL;
+ _OSPRF = nullptr;
}
}
void OS::print_resources_in_use(bool p_short) {
- ResourceCache::dump(NULL, p_short);
+ ResourceCache::dump(nullptr, p_short);
}
void OS::dump_resources_to_file(const char *p_file) {
@@ -523,9 +523,9 @@ OS::OS() {
_allow_layered = false;
_stack_bottom = (void *)(&stack_bottom);
- _logger = NULL;
+ _logger = nullptr;
- has_server_feature_callback = NULL;
+ has_server_feature_callback = nullptr;
Vector<Logger *> loggers;
loggers.push_back(memnew(StdLogger));
@@ -534,5 +534,5 @@ OS::OS() {
OS::~OS() {
memdelete(_logger);
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/core/os/os.h b/core/os/os.h
index a31b1c1f4b..714a10bf76 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -130,7 +130,7 @@ public:
virtual int get_low_processor_usage_mode_sleep_usec() const;
virtual String get_executable_path() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL) = 0;
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr) = 0;
virtual Error kill(const ProcessID &p_pid) = 0;
virtual int get_process_id() const;
virtual void vibrate_handheld(int p_duration_ms = 500);
diff --git a/core/os/rw_lock.cpp b/core/os/rw_lock.cpp
index 75683962af..1dd2c3bccb 100644
--- a/core/os/rw_lock.cpp
+++ b/core/os/rw_lock.cpp
@@ -34,11 +34,11 @@
#include <stddef.h>
-RWLock *(*RWLock::create_func)() = 0;
+RWLock *(*RWLock::create_func)() = nullptr;
RWLock *RWLock::create() {
- ERR_FAIL_COND_V(!create_func, 0);
+ ERR_FAIL_COND_V(!create_func, nullptr);
return create_func();
}
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index 7f6148057d..294b52f00c 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -30,10 +30,10 @@
#include "thread.h"
-Thread *(*Thread::create_func)(ThreadCreateCallback, void *, const Settings &) = NULL;
-Thread::ID (*Thread::get_thread_id_func)() = NULL;
-void (*Thread::wait_to_finish_func)(Thread *) = NULL;
-Error (*Thread::set_name_func)(const String &) = NULL;
+Thread *(*Thread::create_func)(ThreadCreateCallback, void *, const Settings &) = nullptr;
+Thread::ID (*Thread::get_thread_id_func)() = nullptr;
+void (*Thread::wait_to_finish_func)(Thread *) = nullptr;
+Error (*Thread::set_name_func)(const String &) = nullptr;
Thread::ID Thread::_main_thread_id = 0;
@@ -50,7 +50,7 @@ Thread *Thread::create(ThreadCreateCallback p_callback, void *p_user, const Sett
return create_func(p_callback, p_user, p_settings);
}
- return NULL;
+ return nullptr;
}
void Thread::wait_to_finish(Thread *p_thread) {
diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp
index b82a366ef2..04deba2c14 100644
--- a/core/packed_data_container.cpp
+++ b/core/packed_data_container.cpp
@@ -114,7 +114,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b
} else {
Variant v;
- Error rerr = decode_variant(v, p_buf + p_ofs, datalen - p_ofs, NULL, false);
+ Error rerr = decode_variant(v, p_buf + p_ofs, datalen - p_ofs, nullptr, false);
if (rerr != OK) {
@@ -254,7 +254,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
uint32_t pos = tmpdata.size();
int len;
- encode_variant(p_data, NULL, len, false);
+ encode_variant(p_data, nullptr, len, false);
tmpdata.resize(tmpdata.size() + len);
encode_variant(p_data, &tmpdata.write[pos], len, false);
return pos;
diff --git a/core/packed_data_container.h b/core/packed_data_container.h
index 852fdcd0d3..0f08a1cb7b 100644
--- a/core/packed_data_container.h
+++ b/core/packed_data_container.h
@@ -73,7 +73,7 @@ protected:
static void _bind_methods();
public:
- virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
+ virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
Error pack(const Variant &p_data);
int size() const;
@@ -98,7 +98,7 @@ public:
bool _is_dictionary() const;
int size() const;
- virtual Variant getvar(const Variant &p_key, bool *r_valid = NULL) const;
+ virtual Variant getvar(const Variant &p_key, bool *r_valid = nullptr) const;
PackedDataContainerRef();
};
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index 5a83c3eeb4..b74540395c 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -250,9 +250,9 @@ PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) {
unsigned int check = p_mem & CHECK_MASK;
int entry = p_mem >> CHECK_BITS;
- ERR_FAIL_INDEX_V(entry, entry_max, NULL);
- ERR_FAIL_COND_V(entry_array[entry].check != check, NULL);
- ERR_FAIL_COND_V(entry_array[entry].len == 0, NULL);
+ ERR_FAIL_INDEX_V(entry, entry_max, nullptr);
+ ERR_FAIL_COND_V(entry_array[entry].check != check, nullptr);
+ ERR_FAIL_COND_V(entry_array[entry].len == 0, nullptr);
return &entry_array[entry];
}
@@ -261,9 +261,9 @@ const PoolAllocator::Entry *PoolAllocator::get_entry(ID p_mem) const {
unsigned int check = p_mem & CHECK_MASK;
int entry = p_mem >> CHECK_BITS;
- ERR_FAIL_INDEX_V(entry, entry_max, NULL);
- ERR_FAIL_COND_V(entry_array[entry].check != check, NULL);
- ERR_FAIL_COND_V(entry_array[entry].len == 0, NULL);
+ ERR_FAIL_INDEX_V(entry, entry_max, nullptr);
+ ERR_FAIL_COND_V(entry_array[entry].check != check, nullptr);
+ ERR_FAIL_COND_V(entry_array[entry].len == 0, nullptr);
return &entry_array[entry];
}
@@ -461,7 +461,7 @@ const void *PoolAllocator::get(ID p_mem) const {
if (!needs_locking) {
const Entry *e = get_entry(p_mem);
- ERR_FAIL_COND_V(!e, NULL);
+ ERR_FAIL_COND_V(!e, nullptr);
return &pool[e->pos];
}
@@ -471,20 +471,20 @@ const void *PoolAllocator::get(ID p_mem) const {
if (!e) {
mt_unlock();
- ERR_FAIL_COND_V(!e, NULL);
+ ERR_FAIL_COND_V(!e, nullptr);
}
if (e->lock == 0) {
mt_unlock();
ERR_PRINT("e->lock == 0");
- return NULL;
+ return nullptr;
}
if ((int)e->pos >= pool_size) {
mt_unlock();
ERR_PRINT("e->pos<0 || e->pos>=pool_size");
- return NULL;
+ return nullptr;
}
const void *ptr = &pool[e->pos];
@@ -498,7 +498,7 @@ void *PoolAllocator::get(ID p_mem) {
if (!needs_locking) {
Entry *e = get_entry(p_mem);
- ERR_FAIL_COND_V(!e, NULL);
+ ERR_FAIL_COND_V(!e, nullptr);
return &pool[e->pos];
}
@@ -508,21 +508,21 @@ void *PoolAllocator::get(ID p_mem) {
if (!e) {
mt_unlock();
- ERR_FAIL_COND_V(!e, NULL);
+ ERR_FAIL_COND_V(!e, nullptr);
}
if (e->lock == 0) {
//assert(0);
mt_unlock();
ERR_PRINT("e->lock == 0");
- return NULL;
+ return nullptr;
}
if ((int)e->pos >= pool_size) {
mt_unlock();
ERR_PRINT("e->pos<0 || e->pos>=pool_size");
- return NULL;
+ return nullptr;
}
void *ptr = &pool[e->pos];
@@ -606,7 +606,7 @@ PoolAllocator::PoolAllocator(void *p_mem, int p_size, int p_align, bool p_needs_
create_pool(p_mem, p_size, p_max_entries);
needs_locking = p_needs_locking;
align = p_align;
- mem_ptr = NULL;
+ mem_ptr = nullptr;
}
PoolAllocator::PoolAllocator(int p_align, int p_size, bool p_needs_locking, int p_max_entries) {
diff --git a/core/print_string.cpp b/core/print_string.cpp
index 551b149334..8eb1d9e86a 100644
--- a/core/print_string.cpp
+++ b/core/print_string.cpp
@@ -34,7 +34,7 @@
#include <stdio.h>
-static PrintHandlerList *print_handler_list = NULL;
+static PrintHandlerList *print_handler_list = nullptr;
bool _print_line_enabled = true;
bool _print_error_enabled = true;
@@ -50,7 +50,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
_global_lock();
- PrintHandlerList *prev = NULL;
+ PrintHandlerList *prev = nullptr;
PrintHandlerList *l = print_handler_list;
while (l) {
@@ -69,7 +69,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
//OS::get_singleton()->print("print handler list is %p\n",print_handler_list);
_global_unlock();
- ERR_FAIL_COND(l == NULL);
+ ERR_FAIL_COND(l == nullptr);
}
void print_line(String p_string) {
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 36fb016448..63b52661b4 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -43,7 +43,7 @@
#include <zlib.h>
-ProjectSettings *ProjectSettings::singleton = NULL;
+ProjectSettings *ProjectSettings::singleton = nullptr;
ProjectSettings *ProjectSettings::get_singleton() {
@@ -532,7 +532,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) {
d.resize(vlen);
f->get_buffer(d.ptrw(), vlen);
Variant value;
- err = decode_variant(value, d.ptr(), d.size(), NULL, true);
+ err = decode_variant(value, d.ptr(), d.size(), nullptr, true);
ERR_CONTINUE_MSG(err != OK, "Error decoding property: " + key + ".");
set(key, value);
}
@@ -571,7 +571,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
memdelete(f);
// If we're loading a project.godot from source code, we can operate some
@@ -679,7 +679,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
file->store_string(key);
int len;
- err = encode_variant(p_custom_features, NULL, len, false);
+ err = encode_variant(p_custom_features, nullptr, len, false);
if (err != OK) {
memdelete(file);
ERR_FAIL_V(err);
@@ -717,7 +717,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str
file->store_string(key);
int len;
- err = encode_variant(value, NULL, len, true);
+ err = encode_variant(value, nullptr, len, true);
if (err != OK)
memdelete(file);
ERR_FAIL_COND_V_MSG(err != OK, ERR_INVALID_DATA, "Error when trying to encode Variant.");
@@ -1220,5 +1220,5 @@ ProjectSettings::ProjectSettings() {
ProjectSettings::~ProjectSettings() {
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/core/reference.h b/core/reference.h
index 6898bfec3b..30a93d82a6 100644
--- a/core/reference.h
+++ b/core/reference.h
@@ -152,7 +152,7 @@ public:
Ref r;
r.reference = Object::cast_to<T>(refb);
ref(r);
- r.reference = NULL;
+ r.reference = nullptr;
}
void operator=(const Variant &p_variant) {
@@ -190,14 +190,14 @@ public:
Ref(const Ref &p_from) {
- reference = NULL;
+ reference = nullptr;
ref(p_from);
}
template <class T_Other>
Ref(const Ref<T_Other> &p_from) {
- reference = NULL;
+ reference = nullptr;
Reference *refb = const_cast<Reference *>(static_cast<const Reference *>(p_from.ptr()));
if (!refb) {
unref();
@@ -206,12 +206,12 @@ public:
Ref r;
r.reference = Object::cast_to<T>(refb);
ref(r);
- r.reference = NULL;
+ r.reference = nullptr;
}
Ref(T *p_reference) {
- reference = NULL;
+ reference = nullptr;
if (p_reference)
ref_pointer(p_reference);
}
@@ -233,8 +233,8 @@ public:
}
}
- inline bool is_valid() const { return reference != NULL; }
- inline bool is_null() const { return reference == NULL; }
+ inline bool is_valid() const { return reference != nullptr; }
+ inline bool is_null() const { return reference == nullptr; }
void unref() {
//TODO this should be moved to mutexes, since this engine does not really
@@ -245,7 +245,7 @@ public:
memdelete(reference);
}
- reference = NULL;
+ reference = nullptr;
}
void instance() {
@@ -254,7 +254,7 @@ public:
Ref() {
- reference = NULL;
+ reference = nullptr;
}
~Ref() {
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 7145d64629..c09cade1a8 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -78,17 +78,17 @@ static Ref<TranslationLoaderPO> resource_format_po;
static Ref<ResourceFormatSaverCrypto> resource_format_saver_crypto;
static Ref<ResourceFormatLoaderCrypto> resource_format_loader_crypto;
-static _ResourceLoader *_resource_loader = NULL;
-static _ResourceSaver *_resource_saver = NULL;
-static _OS *_os = NULL;
-static _Engine *_engine = NULL;
-static _ClassDB *_classdb = NULL;
-static _Marshalls *_marshalls = NULL;
-static _JSON *_json = NULL;
+static _ResourceLoader *_resource_loader = nullptr;
+static _ResourceSaver *_resource_saver = nullptr;
+static _OS *_os = nullptr;
+static _Engine *_engine = nullptr;
+static _ClassDB *_classdb = nullptr;
+static _Marshalls *_marshalls = nullptr;
+static _JSON *_json = nullptr;
-static IP *ip = NULL;
+static IP *ip = nullptr;
-static _Geometry *_geometry = NULL;
+static _Geometry *_geometry = nullptr;
extern Mutex _global_mutex;
diff --git a/core/resource.cpp b/core/resource.cpp
index e329a1574f..d1883d8043 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -328,7 +328,7 @@ Node *Resource::get_local_scene() const {
return _get_local_scene_func();
}
- return NULL;
+ return nullptr;
}
void Resource::setup_local_to_scene() {
@@ -337,7 +337,7 @@ void Resource::setup_local_to_scene() {
get_script_instance()->call("_setup_local_to_scene");
}
-Node *(*Resource::_get_local_scene_func)() = NULL;
+Node *(*Resource::_get_local_scene_func)() = nullptr;
void Resource::set_as_translation_remapped(bool p_remapped) {
@@ -438,7 +438,7 @@ Resource::Resource() :
subindex = 0;
local_to_scene = false;
- local_scene = NULL;
+ local_scene = nullptr;
}
Resource::~Resource() {
@@ -458,9 +458,9 @@ HashMap<String, Resource *> ResourceCache::resources;
HashMap<String, HashMap<String, int>> ResourceCache::resource_path_cache;
#endif
-RWLock *ResourceCache::lock = NULL;
+RWLock *ResourceCache::lock = nullptr;
#ifdef TOOLS_ENABLED
-RWLock *ResourceCache::path_cache_lock = NULL;
+RWLock *ResourceCache::path_cache_lock = nullptr;
#endif
void ResourceCache::setup() {
@@ -482,7 +482,7 @@ void ResourceCache::clear() {
void ResourceCache::reload_externals() {
/*
- const String *K=NULL;
+ const String *K=nullptr;
while ((K=resources.next(K))) {
resources[*K]->reload_external_data();
}
@@ -506,7 +506,7 @@ Resource *ResourceCache::get(const String &p_path) {
lock->read_unlock();
if (!res) {
- return NULL;
+ return nullptr;
}
return *res;
@@ -515,7 +515,7 @@ Resource *ResourceCache::get(const String &p_path) {
void ResourceCache::get_cached_resources(List<Ref<Resource>> *p_resources) {
lock->read_lock();
- const String *K = NULL;
+ const String *K = nullptr;
while ((K = resources.next(K))) {
Resource *r = resources[*K];
@@ -539,13 +539,13 @@ void ResourceCache::dump(const char *p_file, bool p_short) {
Map<String, int> type_count;
- FileAccess *f = NULL;
+ FileAccess *f = nullptr;
if (p_file) {
f = FileAccess::open(p_file, FileAccess::WRITE);
ERR_FAIL_COND_MSG(!f, "Cannot create file at path '" + String(p_file) + "'.");
}
- const String *K = NULL;
+ const String *K = nullptr;
while ((K = resources.next(K))) {
Resource *r = resources[*K];
diff --git a/core/resource.h b/core/resource.h
index 9f83848c04..3b7812c870 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -162,7 +162,7 @@ public:
static void reload_externals();
static bool has(const String &p_path);
static Resource *get(const String &p_path);
- static void dump(const char *p_file = NULL, bool p_short = false);
+ static void dump(const char *p_file = nullptr, bool p_short = false);
static void get_cached_resources(List<Ref<Resource>> *p_resources);
static int get_cached_resource_count();
};
diff --git a/core/rid_owner.h b/core/rid_owner.h
index 5c8c48a4cb..946b2e396c 100644
--- a/core/rid_owner.h
+++ b/core/rid_owner.h
@@ -142,7 +142,7 @@ public:
if (THREAD_SAFE) {
spin_lock.unlock();
}
- return NULL;
+ return nullptr;
}
uint32_t idx_chunk = idx / elements_in_chunk;
@@ -153,7 +153,7 @@ public:
if (THREAD_SAFE) {
spin_lock.unlock();
}
- return NULL;
+ return nullptr;
}
T *ptr = &chunks[idx_chunk][idx_element];
@@ -236,7 +236,7 @@ public:
}
_FORCE_INLINE_ T *get_ptr_by_index(uint32_t p_index) {
- ERR_FAIL_INDEX_V(p_index, alloc_count, NULL);
+ ERR_FAIL_INDEX_V(p_index, alloc_count, nullptr);
if (THREAD_SAFE) {
spin_lock.lock();
}
@@ -283,14 +283,14 @@ public:
}
RID_Alloc(uint32_t p_target_chunk_byte_size = 4096) {
- chunks = NULL;
- free_list_chunks = NULL;
- validator_chunks = NULL;
+ chunks = nullptr;
+ free_list_chunks = nullptr;
+ validator_chunks = nullptr;
elements_in_chunk = sizeof(T) > p_target_chunk_byte_size ? 1 : (p_target_chunk_byte_size / sizeof(T));
max_alloc = 0;
alloc_count = 0;
- description = NULL;
+ description = nullptr;
}
~RID_Alloc() {
@@ -340,7 +340,7 @@ public:
_FORCE_INLINE_ T *getornull(const RID &p_rid) {
T **ptr = alloc.getornull(p_rid);
if (unlikely(!ptr)) {
- return NULL;
+ return nullptr;
}
return *ptr;
}
diff --git a/core/script_language.cpp b/core/script_language.cpp
index c664563909..82cac6bc9a 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -42,7 +42,7 @@ int ScriptServer::_language_count = 0;
bool ScriptServer::scripting_enabled = true;
bool ScriptServer::reload_scripts_on_save = false;
bool ScriptServer::languages_finished = false;
-ScriptEditRequestFunction ScriptServer::edit_request_func = NULL;
+ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
void Script::_notification(int p_what) {
@@ -136,7 +136,7 @@ bool ScriptServer::is_scripting_enabled() {
ScriptLanguage *ScriptServer::get_language(int p_idx) {
- ERR_FAIL_INDEX_V(p_idx, _language_count, NULL);
+ ERR_FAIL_INDEX_V(p_idx, _language_count, nullptr);
return _languages[p_idx];
}
@@ -256,7 +256,7 @@ StringName ScriptServer::get_global_class_native_base(const String &p_class) {
return base;
}
void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) {
- const StringName *K = NULL;
+ const StringName *K = nullptr;
List<StringName> classes;
while ((K = global_classes.next(K))) {
classes.push_back(*K);
@@ -350,7 +350,7 @@ void ScriptInstance::call_multilevel(const StringName &p_method, VARIANT_ARG_DEC
ScriptInstance::~ScriptInstance() {
}
-ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = NULL;
+ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = nullptr;
ScriptCodeCompletionCache::ScriptCodeCompletionCache() {
singleton = this;
}
diff --git a/core/script_language.h b/core/script_language.h
index 6219a423d0..2d86c5166d 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -137,7 +137,7 @@ public:
virtual StringName get_instance_base_type() const = 0; // this may not work in all scripts, will return empty if so
virtual ScriptInstance *instance_create(Object *p_this) = 0;
- virtual PlaceHolderScriptInstance *placeholder_instance_create(Object *p_this) { return NULL; }
+ virtual PlaceHolderScriptInstance *placeholder_instance_create(Object *p_this) { return nullptr; }
virtual bool instance_has(const Object *p_this) const = 0;
virtual bool has_source_code() const = 0;
@@ -189,9 +189,9 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value) = 0;
virtual bool get(const StringName &p_name, Variant &r_ret) const = 0;
virtual void get_property_list(List<PropertyInfo> *p_properties) const = 0;
- virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const = 0;
+ virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const = 0;
- virtual Object *get_owner() { return NULL; }
+ virtual Object *get_owner() { return nullptr; }
virtual void get_property_state(List<Pair<StringName, Variant>> &state);
virtual void get_method_list(List<MethodInfo> *p_list) const = 0;
@@ -306,7 +306,7 @@ public:
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const = 0;
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, List<Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const = 0;
+ 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 = nullptr, List<Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) 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;
@@ -363,7 +363,7 @@ public:
virtual String debug_get_stack_level_source(int p_level) const = 0;
virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) = 0;
virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) = 0;
- virtual ScriptInstance *debug_get_stack_level_instance(int p_level) { return NULL; }
+ virtual ScriptInstance *debug_get_stack_level_instance(int p_level) { return nullptr; }
virtual void debug_get_globals(List<String> *p_globals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1) = 0;
virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1) = 0;
@@ -390,7 +390,7 @@ public:
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) = 0;
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) = 0;
- virtual void *alloc_instance_binding_data(Object *p_object) { return NULL; } //optional, not used by all languages
+ virtual void *alloc_instance_binding_data(Object *p_object) { return nullptr; } //optional, not used by all languages
virtual void free_instance_binding_data(void *p_data) {} //optional, not used by all languages
virtual void refcount_incremented_instance_binding(Object *p_object) {} //optional, not used by all languages
virtual bool refcount_decremented_instance_binding(Object *p_object) { return true; } //return true if it can die //optional, not used by all languages
@@ -398,7 +398,7 @@ public:
virtual void frame();
virtual bool handles_global_class_type(const String &p_type) const { return false; }
- virtual String get_global_class_name(const String &p_path, String *r_base_type = NULL, String *r_icon_path = NULL) const { return String(); }
+ virtual String get_global_class_name(const String &p_path, String *r_base_type = nullptr, String *r_icon_path = nullptr) const { return String(); }
virtual ~ScriptLanguage() {}
};
@@ -418,7 +418,7 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
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 Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
virtual void get_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName &p_method) const;
@@ -441,8 +441,8 @@ public:
virtual bool is_placeholder() const { return true; }
- virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid = NULL);
- virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid = NULL);
+ virtual void property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
+ virtual Variant property_get_fallback(const StringName &p_name, bool *r_valid = nullptr);
virtual Vector<ScriptNetData> get_rpc_methods() const { return Vector<ScriptNetData>(); }
virtual uint16_t get_rpc_method_id(const StringName &p_method) const;
diff --git a/core/self_list.h b/core/self_list.h
index 1cd7bb44d8..19d2783208 100644
--- a/core/self_list.h
+++ b/core/self_list.h
@@ -49,7 +49,7 @@ public:
p_elem->_root = this;
p_elem->_next = _first;
- p_elem->_prev = NULL;
+ p_elem->_prev = nullptr;
if (_first) {
_first->_prev = p_elem;
@@ -66,7 +66,7 @@ public:
ERR_FAIL_COND(p_elem->_root);
p_elem->_root = this;
- p_elem->_next = NULL;
+ p_elem->_next = nullptr;
p_elem->_prev = _last;
if (_last) {
@@ -98,18 +98,18 @@ public:
_last = p_elem->_prev;
}
- p_elem->_next = NULL;
- p_elem->_prev = NULL;
- p_elem->_root = NULL;
+ p_elem->_next = nullptr;
+ p_elem->_prev = nullptr;
+ p_elem->_root = nullptr;
}
_FORCE_INLINE_ SelfList<T> *first() { return _first; }
_FORCE_INLINE_ const SelfList<T> *first() const { return _first; }
_FORCE_INLINE_ List() {
- _first = NULL;
- _last = NULL;
+ _first = nullptr;
+ _last = nullptr;
}
- _FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != NULL); }
+ _FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != nullptr); }
};
private:
@@ -129,9 +129,9 @@ public:
_FORCE_INLINE_ SelfList(T *p_self) {
_self = p_self;
- _next = NULL;
- _prev = NULL;
- _root = NULL;
+ _next = nullptr;
+ _prev = nullptr;
+ _root = nullptr;
}
_FORCE_INLINE_ ~SelfList() {
diff --git a/core/set.h b/core/set.h
index 5ddfb87b74..c17ee15350 100644
--- a/core/set.h
+++ b/core/set.h
@@ -82,11 +82,11 @@ public:
};
Element() {
color = RED;
- right = NULL;
- left = NULL;
- parent = NULL;
- _next = NULL;
- _prev = NULL;
+ right = nullptr;
+ left = nullptr;
+ parent = nullptr;
+ _next = nullptr;
+ _prev = nullptr;
};
};
@@ -105,7 +105,7 @@ private:
#else
_nil = (Element *)&_GlobalNilClass::_nil;
#endif
- _root = NULL;
+ _root = nullptr;
size_cache = 0;
}
@@ -120,7 +120,7 @@ private:
if (_root) {
memdelete_allocator<Element, A>(_root);
- _root = NULL;
+ _root = nullptr;
}
}
@@ -192,7 +192,7 @@ private:
}
if (node->parent == _data._root)
- return NULL; // No successor, as p_node = last node
+ return nullptr; // No successor, as p_node = last node
return node->parent;
}
}
@@ -214,7 +214,7 @@ private:
}
if (node == _data._root)
- return NULL; // No predecessor, as p_node = first node.
+ return nullptr; // No predecessor, as p_node = first node.
return node->parent;
}
}
@@ -233,13 +233,13 @@ private:
return node; // found
}
- return NULL;
+ return nullptr;
}
Element *_lower_bound(const T &p_value) const {
Element *node = _data._root->left;
- Element *prev = NULL;
+ Element *prev = nullptr;
C less;
while (node != _data._nil) {
@@ -253,8 +253,8 @@ private:
return node; // found
}
- if (prev == NULL)
- return NULL; // tree empty
+ if (prev == nullptr)
+ return nullptr; // tree empty
if (less(prev->value, p_value))
prev = prev->_next;
@@ -504,7 +504,7 @@ public:
const Element *find(const T &p_value) const {
if (!_data._root)
- return NULL;
+ return nullptr;
const Element *res = _find(p_value);
return res;
@@ -513,7 +513,7 @@ public:
Element *find(const T &p_value) {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *res = _find(p_value);
return res;
@@ -526,7 +526,7 @@ public:
bool has(const T &p_value) const {
- return find(p_value) != NULL;
+ return find(p_value) != nullptr;
}
Element *insert(const T &p_value) {
@@ -564,11 +564,11 @@ public:
Element *front() const {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *e = _data._root->left;
if (e == _data._nil)
- return NULL;
+ return nullptr;
while (e->left != _data._nil)
e = e->left;
@@ -579,11 +579,11 @@ public:
Element *back() const {
if (!_data._root)
- return NULL;
+ return nullptr;
Element *e = _data._root->left;
if (e == _data._nil)
- return NULL;
+ return nullptr;
while (e->right != _data._nil)
e = e->right;
diff --git a/core/string_name.cpp b/core/string_name.cpp
index 4ec9af008e..9cbac97a7c 100644
--- a/core/string_name.cpp
+++ b/core/string_name.cpp
@@ -54,7 +54,7 @@ void StringName::setup() {
ERR_FAIL_COND(configured);
for (int i = 0; i < STRING_TABLE_LEN; i++) {
- _table[i] = NULL;
+ _table[i] = nullptr;
}
configured = true;
}
@@ -110,7 +110,7 @@ void StringName::unref() {
memdelete(_data);
}
- _data = NULL;
+ _data = nullptr;
}
bool StringName::operator==(const String &p_name) const {
@@ -160,7 +160,7 @@ void StringName::operator=(const StringName &p_name) {
StringName::StringName(const StringName &p_name) {
- _data = NULL;
+ _data = nullptr;
ERR_FAIL_COND(!configured);
@@ -171,7 +171,7 @@ StringName::StringName(const StringName &p_name) {
StringName::StringName(const char *p_name) {
- _data = NULL;
+ _data = nullptr;
ERR_FAIL_COND(!configured);
@@ -206,9 +206,9 @@ StringName::StringName(const char *p_name) {
_data->refcount.init();
_data->hash = hash;
_data->idx = idx;
- _data->cname = NULL;
+ _data->cname = nullptr;
_data->next = _table[idx];
- _data->prev = NULL;
+ _data->prev = nullptr;
if (_table[idx])
_table[idx]->prev = _data;
_table[idx] = _data;
@@ -216,7 +216,7 @@ StringName::StringName(const char *p_name) {
StringName::StringName(const StaticCString &p_static_string) {
- _data = NULL;
+ _data = nullptr;
ERR_FAIL_COND(!configured);
@@ -252,7 +252,7 @@ StringName::StringName(const StaticCString &p_static_string) {
_data->idx = idx;
_data->cname = p_static_string.ptr;
_data->next = _table[idx];
- _data->prev = NULL;
+ _data->prev = nullptr;
if (_table[idx])
_table[idx]->prev = _data;
_table[idx] = _data;
@@ -260,7 +260,7 @@ StringName::StringName(const StaticCString &p_static_string) {
StringName::StringName(const String &p_name) {
- _data = NULL;
+ _data = nullptr;
ERR_FAIL_COND(!configured);
@@ -293,9 +293,9 @@ StringName::StringName(const String &p_name) {
_data->refcount.init();
_data->hash = hash;
_data->idx = idx;
- _data->cname = NULL;
+ _data->cname = nullptr;
_data->next = _table[idx];
- _data->prev = NULL;
+ _data->prev = nullptr;
if (_table[idx])
_table[idx]->prev = _data;
_table[idx] = _data;
@@ -390,7 +390,7 @@ StringName StringName::search(const String &p_name) {
StringName::StringName() {
- _data = NULL;
+ _data = nullptr;
}
StringName::~StringName() {
diff --git a/core/string_name.h b/core/string_name.h
index e68ab8bfa3..aec87b8e66 100644
--- a/core/string_name.h
+++ b/core/string_name.h
@@ -61,8 +61,8 @@ class StringName {
_Data *prev;
_Data *next;
_Data() {
- cname = NULL;
- next = prev = NULL;
+ cname = nullptr;
+ next = prev = nullptr;
idx = 0;
hash = 0;
}
diff --git a/core/translation.cpp b/core/translation.cpp
index df3661e5d0..3f45bb17c9 100644
--- a/core/translation.cpp
+++ b/core/translation.cpp
@@ -407,7 +407,7 @@ static const char *locale_list[] = {
"zh_SG", // Chinese (Singapore)
"zh_TW", // Chinese (Taiwan)
"zu_ZA", // Zulu (South Africa)
- 0
+ nullptr
};
static const char *locale_names[] = {
@@ -775,7 +775,7 @@ static const char *locale_names[] = {
"Chinese (Singapore)",
"Chinese (Taiwan)",
"Zulu (South Africa)",
- 0
+ nullptr
};
// Windows has some weird locale identifiers which do not honor the ISO 639-1
@@ -789,7 +789,7 @@ static const char *locale_renames[][2] = {
{ "in", "id" }, // Indonesian
{ "iw", "he" }, // Hebrew
{ "no", "nb" }, // Norwegian Bokmål
- { NULL, NULL }
+ { nullptr, nullptr }
};
///////////////////////////////////////////////
@@ -929,7 +929,7 @@ String TranslationServer::standardize_locale(const String &p_locale) {
// Handles known non-ISO locale names used e.g. on Windows
int idx = 0;
- while (locale_renames[idx][0] != NULL) {
+ while (locale_renames[idx][0] != nullptr) {
if (locale_renames[idx][0] == univ_locale) {
univ_locale = locale_renames[idx][1];
break;
@@ -1141,7 +1141,7 @@ StringName TranslationServer::translate(const StringName &p_message) const {
return res;
}
-TranslationServer *TranslationServer::singleton = NULL;
+TranslationServer *TranslationServer::singleton = nullptr;
bool TranslationServer::_load_translations(const String &p_from) {
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 02f460c93d..8bd5a4915d 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -108,7 +108,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
void UndoRedo::add_do_method(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -128,7 +128,7 @@ void UndoRedo::add_do_method(Object *p_object, const StringName &p_method, VARIA
void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
@@ -151,7 +151,7 @@ void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VAR
}
void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, const Variant &p_value) {
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -166,7 +166,7 @@ void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, c
}
void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property, const Variant &p_value) {
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
@@ -186,7 +186,7 @@ void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property,
}
void UndoRedo::add_do_reference(Object *p_object) {
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -199,7 +199,7 @@ void UndoRedo::add_do_reference(Object *p_object) {
}
void UndoRedo::add_undo_reference(Object *p_object) {
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
@@ -417,13 +417,13 @@ UndoRedo::UndoRedo() {
current_action = -1;
merge_mode = MERGE_DISABLE;
merging = false;
- callback = NULL;
- callback_ud = NULL;
+ callback = nullptr;
+ callback_ud = nullptr;
- method_callbck_ud = NULL;
- prop_callback_ud = NULL;
- method_callback = NULL;
- property_callback = NULL;
+ method_callbck_ud = nullptr;
+ prop_callback_ud = nullptr;
+ method_callback = nullptr;
+ property_callback = nullptr;
}
UndoRedo::~UndoRedo() {
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 8027ae29b5..e56f177103 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -205,7 +205,7 @@ void String::copy_from(const CharType *p_cstr, const int p_clip_to) {
}
// assumes the following have already been validated:
-// p_char != NULL
+// p_char != nullptr
// p_length > 0
// p_length <= p_char strlen
void String::copy_from_unchecked(const CharType *p_char, const int p_length) {
@@ -1640,7 +1640,7 @@ CharString String::utf8() const {
/*
String::String(CharType p_char) {
- shared=NULL;
+ shared=nullptr;
copy_from(p_char);
}
*/
@@ -1913,7 +1913,7 @@ static double built_in_strtod(const C *string, /* A decimal ASCII floating-point
* necessary unless F is present. The "E" may
* actually be an "e". E and X may both be
* omitted (but not just one). */
- C **endPtr = NULL) /* If non-NULL, store terminating Cacter's
+ C **endPtr = nullptr) /* If non-nullptr, store terminating Cacter's
* address here. */
{
@@ -2101,7 +2101,7 @@ static double built_in_strtod(const C *string, /* A decimal ASCII floating-point
}
done:
- if (endPtr != NULL) {
+ if (endPtr != nullptr) {
*endPtr = (C *)p;
}
@@ -2202,7 +2202,7 @@ double String::to_double() const {
return 0;
#ifndef NO_USE_STDLIB
return built_in_strtod<CharType>(c_str());
-//return wcstod(c_str(),NULL); DOES NOT WORK ON ANDROID :(
+//return wcstod(c_str(),nullptr ); DOES NOT WORK ON ANDROID :(
#else
return built_in_strtod<CharType>(c_str());
#endif
@@ -3449,7 +3449,7 @@ String String::http_unescape() const {
CharType ord2 = ord_at(i + 2);
if ((ord2 >= '0' && ord2 <= '9') || (ord2 >= 'A' && ord2 <= 'Z')) {
char bytes[3] = { (char)ord1, (char)ord2, 0 };
- res += (char)strtol(bytes, NULL, 16);
+ res += (char)strtol(bytes, nullptr, 16);
i += 2;
}
} else {
@@ -3633,7 +3633,7 @@ String String::xml_unescape() const {
String str;
int l = length();
- int len = _xml_unescape(c_str(), l, NULL);
+ int len = _xml_unescape(c_str(), l, nullptr);
if (len == 0)
return String();
str.resize(len + 1);
diff --git a/core/ustring.h b/core/ustring.h
index 33320a0a49..ee7e3b1e16 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -117,7 +117,7 @@ struct StrRange {
const CharType *c_str;
int len;
- StrRange(const CharType *p_c_str = NULL, int p_len = 0) {
+ StrRange(const CharType *p_c_str = nullptr, int p_len = 0) {
c_str = p_c_str;
len = p_len;
}
@@ -206,7 +206,7 @@ public:
int findn(const String &p_str, int p_from = 0) const; ///< return <0 if failed, case insensitive
int rfind(const String &p_str, int p_from = -1) const; ///< return <0 if failed
int rfindn(const String &p_str, int p_from = -1) const; ///< return <0 if failed, case insensitive
- int findmk(const Vector<String> &p_keys, int p_from = 0, int *r_key = NULL) const; ///< return <0 if failed
+ int findmk(const Vector<String> &p_keys, int p_from = 0, int *r_key = nullptr) const; ///< return <0 if failed
bool match(const String &p_wildcard) const;
bool matchn(const String &p_wildcard) const;
bool begins_with(const String &p_string) const;
@@ -253,7 +253,7 @@ public:
int64_t to_int64() const;
static int to_int(const char *p_str, int p_len = -1);
static double to_double(const char *p_str);
- static double to_double(const CharType *p_str, const CharType **r_end = NULL);
+ static double to_double(const CharType *p_str, const CharType **r_end = nullptr);
static int64_t to_int(const CharType *p_str, int p_len = -1);
String capitalize() const;
String camelcase_to_underscore(bool lowercase = true) const;
diff --git a/core/variant.cpp b/core/variant.cpp
index d12a15ec9d..b3611536b8 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -233,8 +233,8 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
return (p_type_to == OBJECT);
};
- const Type *valid_types = NULL;
- const Type *invalid_types = NULL;
+ const Type *valid_types = nullptr;
+ const Type *invalid_types = nullptr;
switch (p_type_to) {
case BOOL: {
@@ -570,7 +570,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
return (p_type_to == OBJECT);
};
- const Type *valid_types = NULL;
+ const Type *valid_types = nullptr;
switch (p_type_to) {
case BOOL: {
@@ -1020,7 +1020,7 @@ bool Variant::is_zero() const {
} break;
case OBJECT: {
- return _get_obj().obj == NULL;
+ return _get_obj().obj == nullptr;
} break;
case CALLABLE: {
@@ -1479,7 +1479,7 @@ void Variant::clear() {
memdelete(reference);
}
}
- _get_obj().obj = NULL;
+ _get_obj().obj = nullptr;
_get_obj().id = ObjectID();
} break;
case _RID: {
@@ -1864,7 +1864,7 @@ String Variant::stringify(List<const void *> &stack) const {
stack.push_back(d.id());
- //const String *K=NULL;
+ //const String *K=nullptr;
String str("{");
List<Variant> keys;
d.get_key_list(&keys);
@@ -2227,7 +2227,7 @@ Variant::operator RID() const {
};
#endif
Callable::CallError ce;
- Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, NULL, 0, ce);
+ Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, nullptr, 0, ce);
if (ce.error == Callable::CallError::CALL_OK && ret.get_type() == Variant::_RID) {
return ret;
}
@@ -2242,7 +2242,7 @@ Variant::operator Object *() const {
if (type == OBJECT)
return _get_obj().obj;
else
- return NULL;
+ return nullptr;
}
Object *Variant::get_validated_object_with_check(bool &r_previously_freed) const {
@@ -2252,7 +2252,7 @@ Object *Variant::get_validated_object_with_check(bool &r_previously_freed) const
return instance;
} else {
r_previously_freed = false;
- return NULL;
+ return nullptr;
}
}
@@ -2260,7 +2260,7 @@ Object *Variant::get_validated_object() const {
if (type == OBJECT)
return ObjectDB::get_instance(_get_obj().id);
else
- return NULL;
+ return nullptr;
}
Variant::operator Node *() const {
@@ -2268,14 +2268,14 @@ Variant::operator Node *() const {
if (type == OBJECT)
return Object::cast_to<Node>(_get_obj().obj);
else
- return NULL;
+ return nullptr;
}
Variant::operator Control *() const {
if (type == OBJECT)
return Object::cast_to<Control>(_get_obj().obj);
else
- return NULL;
+ return nullptr;
}
Variant::operator Dictionary() const {
diff --git a/core/variant.h b/core/variant.h
index d38130e3a3..a832f7ccf8 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -435,16 +435,16 @@ public:
bool has_method(const StringName &p_method) const;
static Vector<Variant::Type> get_method_argument_types(Variant::Type p_type, const StringName &p_method);
static Vector<Variant> get_method_default_arguments(Variant::Type p_type, const StringName &p_method);
- static Variant::Type get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return = NULL);
+ static Variant::Type get_method_return_type(Variant::Type p_type, const StringName &p_method, bool *r_has_return = nullptr);
static Vector<StringName> get_method_argument_names(Variant::Type p_type, const StringName &p_method);
static bool is_method_const(Variant::Type p_type, const StringName &p_method);
- void set_named(const StringName &p_index, const Variant &p_value, bool *r_valid = NULL);
- Variant get_named(const StringName &p_index, bool *r_valid = NULL) const;
+ void set_named(const StringName &p_index, const Variant &p_value, bool *r_valid = nullptr);
+ Variant get_named(const StringName &p_index, bool *r_valid = nullptr) const;
- void set(const Variant &p_index, const Variant &p_value, bool *r_valid = NULL);
- Variant get(const Variant &p_index, bool *r_valid = NULL) const;
- bool in(const Variant &p_index, bool *r_valid = NULL) const;
+ void set(const Variant &p_index, const Variant &p_value, bool *r_valid = nullptr);
+ Variant get(const Variant &p_index, bool *r_valid = nullptr) const;
+ bool in(const Variant &p_index, bool *r_valid = nullptr) const;
bool iter_init(Variant &r_iter, bool &r_valid) const;
bool iter_next(Variant &r_iter, bool &r_valid) const;
@@ -467,13 +467,13 @@ public:
static void get_constructor_list(Variant::Type p_type, List<MethodInfo> *p_list);
static void get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants);
static bool has_constant(Variant::Type p_type, const StringName &p_value);
- static Variant get_constant_value(Variant::Type p_type, const StringName &p_value, bool *r_valid = NULL);
+ static Variant get_constant_value(Variant::Type p_type, const StringName &p_value, bool *r_valid = nullptr);
typedef String (*ObjectDeConstruct)(const Variant &p_object, void *ud);
typedef void (*ObjectConstruct)(const String &p_text, void *ud, Variant &r_value);
String get_construct_string() const;
- static void construct_from_string(const String &p_string, Variant &r_value, ObjectConstruct p_obj_construct = NULL, void *p_construct_ud = NULL);
+ static void construct_from_string(const String &p_string, Variant &r_value, ObjectConstruct p_obj_construct = nullptr, void *p_construct_ud = nullptr);
void operator=(const Variant &p_variant); // only this is enough for all the other types
Variant(const Variant &p_variant);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index db7244a221..391c293810 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1191,9 +1191,9 @@ struct _VariantCall {
}
};
-_VariantCall::TypeFunc *_VariantCall::type_funcs = NULL;
-_VariantCall::ConstructFunc *_VariantCall::construct_funcs = NULL;
-_VariantCall::ConstantData *_VariantCall::constant_data = NULL;
+_VariantCall::TypeFunc *_VariantCall::type_funcs = nullptr;
+_VariantCall::ConstructFunc *_VariantCall::construct_funcs = nullptr;
+_VariantCall::ConstantData *_VariantCall::constant_data = nullptr;
Variant Variant::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
@@ -1310,7 +1310,7 @@ Variant Variant::construct(const Variant::Type p_type, const Variant **p_args, i
case NODE_PATH:
return NodePath();
case _RID: return RID();
- case OBJECT: return (Object *)NULL;
+ case OBJECT: return (Object *)nullptr;
case CALLABLE: return Callable();
case SIGNAL: return Signal();
case DICTIONARY: return Dictionary();
@@ -1957,7 +1957,7 @@ void register_variant_methods() {
ADDFUNC0NC(DICTIONARY, NIL, Dictionary, clear, varray());
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has, NIL, "key", varray());
ADDFUNC1R(DICTIONARY, BOOL, Dictionary, has_all, ARRAY, "keys", varray());
- ADDFUNC1R(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray());
+ ADDFUNC1RNC(DICTIONARY, BOOL, Dictionary, erase, NIL, "key", varray());
ADDFUNC0R(DICTIONARY, INT, Dictionary, hash, varray());
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, keys, varray());
ADDFUNC0R(DICTIONARY, ARRAY, Dictionary, values, varray());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 88f6ce19a2..f173c88054 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -438,7 +438,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
CASE_TYPE(math, OP_EQUAL, NIL) {
if (p_b.type == NIL) _RETURN(true);
if (p_b.type == OBJECT)
- _RETURN(p_b._get_obj().obj == NULL);
+ _RETURN(p_b._get_obj().obj == nullptr);
_RETURN(false);
}
@@ -457,7 +457,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
if (p_b.type == OBJECT)
_RETURN((p_a._get_obj().obj == p_b._get_obj().obj));
if (p_b.type == NIL)
- _RETURN(p_a._get_obj().obj == NULL);
+ _RETURN(p_a._get_obj().obj == nullptr);
_RETURN_FAIL;
}
@@ -534,7 +534,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
CASE_TYPE(math, OP_NOT_EQUAL, NIL) {
if (p_b.type == NIL) _RETURN(false);
if (p_b.type == OBJECT)
- _RETURN(p_b._get_obj().obj != NULL);
+ _RETURN(p_b._get_obj().obj != nullptr);
_RETURN(true);
}
@@ -554,7 +554,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
if (p_b.type == OBJECT)
_RETURN((p_a._get_obj().obj != p_b._get_obj().obj));
if (p_b.type == NIL)
- _RETURN(p_a._get_obj().obj != NULL);
+ _RETURN(p_a._get_obj().obj != nullptr);
_RETURN_FAIL;
}
@@ -3527,7 +3527,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
if (dic->empty())
return false;
- const Variant *next = dic->next(NULL);
+ const Variant *next = dic->next(nullptr);
r_iter = *next;
return true;
diff --git a/core/variant_parser.h b/core/variant_parser.h
index d50842145c..63ed51bcc9 100644
--- a/core/variant_parser.h
+++ b/core/variant_parser.h
@@ -58,7 +58,7 @@ public:
virtual bool is_utf8() const;
virtual bool is_eof() const;
- StreamFile() { f = NULL; }
+ StreamFile() { f = nullptr; }
};
struct StreamString : public Stream {
@@ -130,17 +130,17 @@ private:
template <class T>
static Error _parse_construct(Stream *p_stream, Vector<T> &r_construct, int &line, String &r_err_str);
static Error _parse_enginecfg(Stream *p_stream, Vector<String> &strings, int &line, String &r_err_str);
- static Error _parse_dictionary(Dictionary &object, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = NULL);
- static Error _parse_array(Array &array, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = NULL);
- static Error _parse_tag(Token &token, Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = NULL, bool p_simple_tag = false);
+ static Error _parse_dictionary(Dictionary &object, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
+ static Error _parse_array(Array &array, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
+ static Error _parse_tag(Token &token, Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
public:
- static Error parse_tag(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = NULL, bool p_simple_tag = false);
- static Error parse_tag_assign_eof(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser = NULL, bool p_simple_tag = false);
+ static Error parse_tag(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
+ static Error parse_tag_assign_eof(Stream *p_stream, int &line, String &r_err_str, Tag &r_tag, String &r_assign, Variant &r_value, ResourceParser *p_res_parser = nullptr, bool p_simple_tag = false);
- static Error parse_value(Token &token, Variant &value, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = NULL);
+ static Error parse_value(Token &token, Variant &value, Stream *p_stream, int &line, String &r_err_str, ResourceParser *p_res_parser = nullptr);
static Error get_token(Stream *p_stream, Token &r_token, int &line, String &r_err_str);
- static Error parse(Stream *p_stream, Variant &r_ret, String &r_err_str, int &r_err_line, ResourceParser *p_res_parser = NULL);
+ static Error parse(Stream *p_stream, Variant &r_ret, String &r_err_str, int &r_err_line, ResourceParser *p_res_parser = nullptr);
};
class VariantWriter {
@@ -149,7 +149,7 @@ public:
typedef String (*EncodeResourceFunc)(void *ud, const RES &p_resource);
static Error write(const Variant &p_variant, StoreStringFunc p_store_string_func, void *p_store_string_ud, EncodeResourceFunc p_encode_res_func, void *p_encode_res_ud);
- static Error write_to_string(const Variant &p_variant, String &r_string, EncodeResourceFunc p_encode_res_func = NULL, void *p_encode_res_ud = NULL);
+ static Error write_to_string(const Variant &p_variant, String &r_string, EncodeResourceFunc p_encode_res_func = nullptr, void *p_encode_res_ud = nullptr);
};
#endif // VARIANT_PARSER_H
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 74c364bad5..8c6821eaac 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -36,8 +36,8 @@
<member name="IP" type="IP" setter="" getter="">
The [IP] singleton.
</member>
- <member name="Input" type="Input" setter="" getter="">
- The [Input] singleton.
+ <member name="Input" type="InputFilter" setter="" getter="">
+ The [InputFilter] singleton.
</member>
<member name="InputMap" type="InputMap" setter="" getter="">
The [InputMap] singleton.
@@ -56,14 +56,14 @@
<member name="Marshalls" type="Marshalls" setter="" getter="">
The [Marshalls] singleton.
</member>
- <member name="Navigation2DServer" type="Navigation2DServer" setter="" getter="">
- The [Navigation2DServer] singleton.
- </member>
<member name="NavigationMeshGenerator" type="NavigationMeshGenerator" setter="" getter="">
The [NavigationMeshGenerator] singleton.
</member>
- <member name="NavigationServer" type="NavigationServer" setter="" getter="">
- The [NavigationServer] singleton.
+ <member name="NavigationServer2D" type="NavigationServer2D" setter="" getter="">
+ The [NavigationServer2D] singleton.
+ </member>
+ <member name="NavigationServer3D" type="NavigationServer3D" setter="" getter="">
+ The [NavigationServer2D] singleton.
</member>
<member name="OS" type="OS" setter="" getter="">
The [OS] singleton.
@@ -71,15 +71,18 @@
<member name="Performance" type="Performance" setter="" getter="">
The [Performance] singleton.
</member>
- <member name="Physics2DServer" type="Physics2DServer" setter="" getter="">
- The [Physics2DServer] singleton.
+ <member name="PhysicsServer2D" type="PhysicsServer2D" setter="" getter="">
+ The [PhysicsServer2D] singleton.
</member>
- <member name="PhysicsServer" type="PhysicsServer" setter="" getter="">
- The [PhysicsServer] singleton.
+ <member name="PhysicsServer3D" type="PhysicsServer3D" setter="" getter="">
+ The [PhysicsServer3D] singleton.
</member>
<member name="ProjectSettings" type="ProjectSettings" setter="" getter="">
The [ProjectSettings] singleton.
</member>
+ <member name="RenderingServer" type="RenderingServer" setter="" getter="">
+ The [RenderingServer] singleton.
+ </member>
<member name="ResourceLoader" type="ResourceLoader" setter="" getter="">
The [ResourceLoader] singleton.
</member>
@@ -92,9 +95,6 @@
<member name="VisualScriptEditor" type="VisualScriptEditor" setter="" getter="">
The [VisualScriptEditor] singleton.
</member>
- <member name="VisualServer" type="VisualServer" setter="" getter="">
- The [VisualServer] singleton.
- </member>
</members>
<constants>
<constant name="MARGIN_LEFT" value="0" enum="Margin">
diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml
index 87181f572d..82575ce7cb 100644
--- a/doc/classes/ARVRAnchor.xml
+++ b/doc/classes/ARVRAnchor.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ARVRAnchor" inherits="Spatial" version="4.0">
+<class name="ARVRAnchor" inherits="Node3D" version="4.0">
<brief_description>
An anchor point in AR space.
</brief_description>
diff --git a/doc/classes/ARVRCamera.xml b/doc/classes/ARVRCamera.xml
index a571d26c83..c97d5cf1d8 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" version="4.0">
+<class name="ARVRCamera" inherits="Camera3D" version="4.0">
<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 ebae25feb7..572b47ce6d 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" version="4.0">
+<class name="ARVRController" inherits="Node3D" version="4.0">
<brief_description>
A spatial node representing a spatially-tracked controller.
</brief_description>
diff --git a/doc/classes/ARVROrigin.xml b/doc/classes/ARVROrigin.xml
index 9a386fd154..a88a89c927 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" version="4.0">
+<class name="ARVROrigin" inherits="Node3D" version="4.0">
<brief_description>
The origin point in AR/VR.
</brief_description>
diff --git a/doc/classes/ARVRServer.xml b/doc/classes/ARVRServer.xml
index 6db7121858..d8d069c048 100644
--- a/doc/classes/ARVRServer.xml
+++ b/doc/classes/ARVRServer.xml
@@ -69,7 +69,7 @@
<return type="int">
</return>
<description>
- Returns the absolute timestamp (in μs) of the last [ARVRServer] commit of the AR/VR eyes to [VisualServer]. The value comes from an internal call to [method OS.get_ticks_usec].
+ Returns the absolute timestamp (in μs) of the last [ARVRServer] commit of the AR/VR eyes to [RenderingServer]. The value comes from an internal call to [method OS.get_ticks_usec].
</description>
</method>
<method name="get_last_frame_usec">
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 01540383dc..99b566e74f 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" version="4.0">
+<class name="AcceptDialog" inherits="Window" version="4.0">
<brief_description>
Base dialog for user notification.
</brief_description>
@@ -67,9 +67,16 @@
<member name="dialog_text" type="String" setter="set_text" getter="get_text" default="&quot;&quot;">
The text displayed by the dialog.
</member>
- <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Alert!&quot;" />
+ <member name="title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Alert!&quot;" />
+ <member name="transient" type="bool" setter="set_transient" getter="is_transient" override="true" default="true" />
+ <member name="visible" type="bool" setter="set_visible" getter="is_visible" override="true" default="false" />
+ <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" override="true" default="true" />
</members>
<signals>
+ <signal name="cancelled">
+ <description>
+ </description>
+ </signal>
<signal name="confirmed">
<description>
Emitted when the dialog is accepted, i.e. the OK button is pressed.
diff --git a/doc/classes/AnimatedSprite.xml b/doc/classes/AnimatedSprite2D.xml
index b5c1d38ff9..8d0534ccd2 100644
--- a/doc/classes/AnimatedSprite.xml
+++ b/doc/classes/AnimatedSprite2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AnimatedSprite" inherits="Node2D" version="4.0">
+<class name="AnimatedSprite2D" inherits="Node2D" version="4.0">
<brief_description>
Sprite node that can use multiple textures for animation.
</brief_description>
@@ -61,7 +61,7 @@
If [code]true[/code], the [member animation] is currently playing.
</member>
<member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0">
- Strength of the specular light effect of this [AnimatedSprite].
+ Strength of the specular light effect of this [AnimatedSprite2D].
</member>
<member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )">
The color of the specular light effect.
diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml
index b851c76e59..80b910aaa7 100644
--- a/doc/classes/AnimatedTexture.xml
+++ b/doc/classes/AnimatedTexture.xml
@@ -4,7 +4,7 @@
Proxy texture for simple frame-based animations.
</brief_description>
<description>
- [AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or [AnimatedSprite], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] resource can be used, e.g. in a [TileSet].
+ [AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or [AnimatedSprite2D], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] resource can be used, e.g. in a [TileSet].
The playback of the animation is controlled by the [member fps] property as well as each frame's optional delay (see [method set_frame_delay]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
[AnimatedTexture] currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. Also, it doesn't support [AtlasTexture]. Each frame needs to be separate image.
</description>
@@ -71,7 +71,7 @@
</members>
<constants>
<constant name="MAX_FRAMES" value="256">
- The maximum number of frames supported by [AnimatedTexture]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite].
+ The maximum number of frames supported by [AnimatedTexture]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite2D].
</constant>
</constants>
</class>
diff --git a/doc/classes/Area.xml b/doc/classes/Area3D.xml
index b273a7a9d9..1adfc878e2 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Area" inherits="CollisionObject" version="4.0">
+<class name="Area3D" inherits="CollisionObject3D" version="4.0">
<brief_description>
General-purpose area node for detection and 3D physics influence.
</brief_description>
<description>
- 3D area that detects [CollisionObject] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
+ 3D area that detects [CollisionObject3D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
</description>
<tutorials>
</tutorials>
@@ -31,14 +31,14 @@
<return type="Array">
</return>
<description>
- Returns a list of intersecting [Area]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+ Returns a list of intersecting [Area3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
</description>
</method>
<method name="get_overlapping_bodies" qualifiers="const">
<return type="Array">
</return>
<description>
- Returns a list of intersecting [PhysicsBody]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+ Returns a list of intersecting [PhysicsBody3D]s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
</description>
</method>
<method name="overlaps_area" qualifiers="const">
@@ -47,7 +47,7 @@
<argument index="0" name="area" type="Node">
</argument>
<description>
- If [code]true[/code], the given area overlaps the Area.
+ If [code]true[/code], the given area overlaps the Area3D.
[b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
</description>
</method>
@@ -57,9 +57,9 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- If [code]true[/code], the given physics body overlaps the Area.
+ If [code]true[/code], the given physics body overlaps the Area3D.
[b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
- The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+ The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</method>
<method name="set_collision_layer_bit">
@@ -70,7 +70,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Set/clear individual bits on the layer mask. This simplifies editing this [Area]'s layers.
+ Set/clear individual bits on the layer mask. This simplifies editing this [Area3D]'s layers.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -81,7 +81,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Set/clear individual bits on the collision mask. This simplifies editing which [Area] layers this [Area] scans.
+ Set/clear individual bits on the collision mask. This simplifies editing which [Area3D] layers this [Area3D] scans.
</description>
</method>
</methods>
@@ -137,20 +137,20 @@
<member name="reverb_bus_uniformity" type="float" setter="set_reverb_uniformity" getter="get_reverb_uniformity" default="0.0">
The degree to which this area's reverb is a uniform effect. Ranges from [code]0[/code] to [code]1[/code] with [code]0.1[/code] precision.
</member>
- <member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area.SpaceOverride" default="0">
+ <member name="space_override" type="int" setter="set_space_override_mode" getter="get_space_override_mode" enum="Area3D.SpaceOverride" default="0">
Override mode for gravity and damping calculations within this area. See [enum SpaceOverride] for possible values.
</member>
</members>
<signals>
<signal name="area_entered">
- <argument index="0" name="area" type="Area">
+ <argument index="0" name="area" type="Area3D">
</argument>
<description>
Emitted when another area enters.
</description>
</signal>
<signal name="area_exited">
- <argument index="0" name="area" type="Area">
+ <argument index="0" name="area" type="Area3D">
</argument>
<description>
Emitted when another area exits.
@@ -159,7 +159,7 @@
<signal name="area_shape_entered">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Area">
+ <argument index="1" name="area" type="Area3D">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -172,7 +172,7 @@
<signal name="area_shape_exited">
<argument index="0" name="area_id" type="int">
</argument>
- <argument index="1" name="area" type="Area">
+ <argument index="1" name="area" type="Area3D">
</argument>
<argument index="2" name="area_shape" type="int">
</argument>
@@ -187,7 +187,7 @@
</argument>
<description>
Emitted when a physics body enters.
- The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+ The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_exited">
@@ -195,7 +195,7 @@
</argument>
<description>
Emitted when a physics body exits.
- The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+ The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_entered">
@@ -209,7 +209,7 @@
</argument>
<description>
Emitted when a physics body enters, reporting which shapes overlapped.
- The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+ The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_exited">
@@ -223,7 +223,7 @@
</argument>
<description>
Emitted when a physics body exits, reporting which shapes were overlapping.
- The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+ The [code]body[/code] argument can either be a [PhysicsBody3D] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
</signals>
diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml
index 47abd2e996..9e742ea581 100644
--- a/doc/classes/ArrayMesh.xml
+++ b/doc/classes/ArrayMesh.xml
@@ -18,10 +18,10 @@
arrays[ArrayMesh.ARRAY_VERTEX] = vertices
# Create the Mesh.
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
- var m = MeshInstance.new()
+ var m = MeshInstance3D.new()
m.mesh = arr_mesh
[/codeblock]
- The [MeshInstance] is ready to be added to the [SceneTree] to be shown.
+ The [MeshInstance3D] is ready to be added to the [SceneTree] to be shown.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/content/procedural_geometry/arraymesh.html</link>
diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml
index 4ec8dba2c6..3eeb524e9c 100644
--- a/doc/classes/AudioStreamPlayer3D.xml
+++ b/doc/classes/AudioStreamPlayer3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="AudioStreamPlayer3D" inherits="Spatial" version="4.0">
+<class name="AudioStreamPlayer3D" inherits="Node3D" version="4.0">
<brief_description>
Plays 3D sound in 3D space.
</brief_description>
diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml
index 380e739f46..bffaf91e1d 100644
--- a/doc/classes/BaseMaterial3D.xml
+++ b/doc/classes/BaseMaterial3D.xml
@@ -634,8 +634,8 @@
The object's X axis will always face the camera.
</constant>
<constant name="BILLBOARD_PARTICLES" value="3" enum="BillboardMode">
- Used for particle systems when assigned to [Particles] and [CPUParticles] nodes. Enables [code]particles_anim_*[/code] properties.
- The [member ParticlesMaterial.anim_speed] or [member CPUParticles.anim_speed] should also be set to a positive value for the animation to play.
+ Used for particle systems when assigned to [GPUParticles3D] and [CPUParticles3D] nodes. Enables [code]particles_anim_*[/code] properties.
+ The [member ParticlesMaterial.anim_speed] or [member CPUParticles3D.anim_speed] should also be set to a positive value for the animation to play.
</constant>
<constant name="TEXTURE_CHANNEL_RED" value="0" enum="TextureChannel">
Used to read from the red channel of a texture.
diff --git a/doc/classes/BoneAttachment.xml b/doc/classes/BoneAttachment3D.xml
index d15322254b..ab1e5b17d9 100644
--- a/doc/classes/BoneAttachment.xml
+++ b/doc/classes/BoneAttachment3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BoneAttachment" inherits="Spatial" version="4.0">
+<class name="BoneAttachment3D" inherits="Node3D" version="4.0">
<brief_description>
A node that will attach to a bone.
</brief_description>
<description>
- This node must be the child of a [Skeleton] node. You can then select a bone for this node to attach to. The BoneAttachment node will copy the transform of the selected bone.
+ This node must be the child of a [Skeleton3D] node. You can then select a bone for this node to attach to. The BoneAttachment3D node will copy the transform of the selected bone.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/BoxShape.xml b/doc/classes/BoxShape3D.xml
index 3a5f05ef79..fd08da148d 100644
--- a/doc/classes/BoxShape.xml
+++ b/doc/classes/BoxShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BoxShape" inherits="Shape" version="4.0">
+<class name="BoxShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Box shape resource.
</brief_description>
<description>
- 3D box shape that can be a child of a [PhysicsBody] or [Area].
+ 3D box shape that can be a child of a [PhysicsBody3D] or [Area3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml
index 799ba32075..c2b821699d 100644
--- a/doc/classes/CPUParticles2D.xml
+++ b/doc/classes/CPUParticles2D.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
CPU-based 2D particle node used to create a variety of particle systems and effects.
- See also [Particles2D], which provides the same functionality with hardware acceleration, but may not run on older devices.
+ See also [GPUParticles2D], which provides the same functionality with hardware acceleration, but may not run on older devices.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/2d/particle_systems_2d.html</link>
@@ -17,7 +17,7 @@
<argument index="0" name="particles" type="Node">
</argument>
<description>
- Sets this node's properties to match a given [Particles2D] node with an assigned [ParticlesMaterial].
+ Sets this node's properties to match a given [GPUParticles2D] node with an assigned [ParticlesMaterial].
</description>
</method>
<method name="get_param" qualifiers="const">
diff --git a/doc/classes/CPUParticles.xml b/doc/classes/CPUParticles3D.xml
index 6a6525e99a..07da066bd9 100644
--- a/doc/classes/CPUParticles.xml
+++ b/doc/classes/CPUParticles3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CPUParticles" inherits="GeometryInstance" version="4.0">
+<class name="CPUParticles3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
CPU-based 3D particle emitter.
</brief_description>
<description>
CPU-based 3D particle node used to create a variety of particle systems and effects.
- See also [Particles], which provides the same functionality with hardware acceleration, but may not run on older devices.
+ See also [GPUParticles3D], which provides the same functionality with hardware acceleration, but may not run on older devices.
</description>
<tutorials>
</tutorials>
@@ -16,13 +16,13 @@
<argument index="0" name="particles" type="Node">
</argument>
<description>
- Sets this node's properties to match a given [Particles] node with an assigned [ParticlesMaterial].
+ Sets this node's properties to match a given [GPUParticles3D] node with an assigned [ParticlesMaterial].
</description>
</method>
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<description>
Returns the base value of the parameter specified by [enum Parameter].
@@ -31,7 +31,7 @@
<method name="get_param_curve" qualifiers="const">
<return type="Curve">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<description>
Returns the [Curve] of the parameter specified by [enum Parameter].
@@ -40,7 +40,7 @@
<method name="get_param_randomness" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<description>
Returns the randomness factor of the parameter specified by [enum Parameter].
@@ -49,7 +49,7 @@
<method name="get_particle_flag" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="CPUParticles.Flags">
+ <argument index="0" name="flag" type="int" enum="CPUParticles3D.Flags">
</argument>
<description>
Returns the enabled state of the given flag (see [enum Flags] for options).
@@ -65,7 +65,7 @@
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<argument index="1" name="value" type="float">
</argument>
@@ -76,7 +76,7 @@
<method name="set_param_curve">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<argument index="1" name="curve" type="Curve">
</argument>
@@ -87,7 +87,7 @@
<method name="set_param_randomness">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="CPUParticles.Parameter">
+ <argument index="0" name="param" type="int" enum="CPUParticles3D.Parameter">
</argument>
<argument index="1" name="randomness" type="float">
</argument>
@@ -98,7 +98,7 @@
<method name="set_particle_flag">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="CPUParticles.Flags">
+ <argument index="0" name="flag" type="int" enum="CPUParticles3D.Flags">
</argument>
<argument index="1" name="enable" type="bool">
</argument>
@@ -165,7 +165,7 @@
<member name="direction" type="Vector3" setter="set_direction" getter="get_direction" default="Vector3( 1, 0, 0 )">
Unit vector specifying the particles' emission direction.
</member>
- <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="CPUParticles.DrawOrder" default="0">
+ <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="CPUParticles3D.DrawOrder" default="0">
Particle draw order. Uses [enum DrawOrder] values.
</member>
<member name="emission_box_extents" type="Vector3" setter="set_emission_box_extents" getter="get_emission_box_extents">
@@ -180,7 +180,7 @@
<member name="emission_points" type="PackedVector3Array" setter="set_emission_points" getter="get_emission_points" default="PackedVector3Array( )">
Sets the initial positions to spawn particles when using [constant EMISSION_SHAPE_POINTS] or [constant EMISSION_SHAPE_DIRECTED_POINTS].
</member>
- <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="CPUParticles.EmissionShape" default="0">
+ <member name="emission_shape" type="int" setter="set_emission_shape" getter="get_emission_shape" enum="CPUParticles3D.EmissionShape" default="0">
Particles will be emitted inside this region. See [enum EmissionShape] for possible values.
</member>
<member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius">
diff --git a/doc/classes/Camera.xml b/doc/classes/Camera3D.xml
index 6097721cbd..bfba23c7ee 100644
--- a/doc/classes/Camera.xml
+++ b/doc/classes/Camera3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Camera" inherits="Spatial" version="4.0">
+<class name="Camera3D" inherits="Node3D" version="4.0">
<brief_description>
Camera node, displays from a point of view.
</brief_description>
<description>
- Camera is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed.
+ [Camera3D] is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed.
</description>
<tutorials>
</tutorials>
@@ -22,14 +22,14 @@
<return type="RID">
</return>
<description>
- Returns the camera's RID from the [VisualServer].
+ Returns the camera's RID from the [RenderingServer].
</description>
</method>
<method name="get_camera_transform" qualifiers="const">
<return type="Transform">
</return>
<description>
- Gets the camera transform. Subclassed cameras such as [InterpolatedCamera] may provide different transforms than the [Node] transform.
+ Gets the camera transform. Subclassed cameras such as [ClippedCamera3D] may provide different transforms than the [Node] transform.
</description>
</method>
<method name="get_cull_mask_bit" qualifiers="const">
@@ -172,7 +172,7 @@
<member name="current" type="bool" setter="set_current" getter="is_current" default="false">
If [code]true[/code], the ancestor [Viewport] is currently using this camera.
</member>
- <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera.DopplerTracking" default="0">
+ <member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera3D.DopplerTracking" default="0">
If not [constant DOPPLER_TRACKING_DISABLED], this camera will simulate the [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] for objects changed in particular [code]_process[/code] methods. See [enum DopplerTracking] for possible values.
</member>
<member name="effects" type="CameraEffects" setter="set_effects" getter="get_effects">
@@ -192,13 +192,13 @@
<member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset" default="0.0">
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" default="1">
+ <member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera3D.KeepAspect" default="1">
The axis to lock during [member fov]/[member size] adjustments. Can be either [constant KEEP_WIDTH] or [constant KEEP_HEIGHT].
</member>
<member name="near" type="float" setter="set_znear" getter="get_znear" default="0.05">
The distance to the near culling boundary for this camera relative to its local Z axis.
</member>
- <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera.Projection" default="0">
+ <member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera3D.Projection" default="0">
The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size.
</member>
<member name="size" type="float" setter="set_size" getter="get_size" default="1.0">
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 73ba8b392f..f2ce2a6fb9 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -426,7 +426,7 @@
<return type="RID">
</return>
<description>
- Returns the canvas item RID used by [VisualServer] for this item.
+ Returns the canvas item RID used by [RenderingServer] for this item.
</description>
</method>
<method name="get_canvas_transform" qualifiers="const">
diff --git a/doc/classes/CanvasItemMaterial.xml b/doc/classes/CanvasItemMaterial.xml
index ffe2272260..c2d44c1d17 100644
--- a/doc/classes/CanvasItemMaterial.xml
+++ b/doc/classes/CanvasItemMaterial.xml
@@ -18,7 +18,7 @@
The manner in which material reacts to lighting.
</member>
<member name="particles_anim_h_frames" type="int" setter="set_particles_anim_h_frames" getter="get_particles_anim_h_frames">
- The number of columns in the spritesheet assigned as [Texture2D] for a [Particles2D] or [CPUParticles2D].
+ The number of columns in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or [CPUParticles2D].
[b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code].
</member>
<member name="particles_anim_loop" type="bool" setter="set_particles_anim_loop" getter="get_particles_anim_loop">
@@ -26,11 +26,11 @@
[b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code].
</member>
<member name="particles_anim_v_frames" type="int" setter="set_particles_anim_v_frames" getter="get_particles_anim_v_frames">
- The number of rows in the spritesheet assigned as [Texture2D] for a [Particles2D] or [CPUParticles2D].
+ The number of rows in the spritesheet assigned as [Texture2D] for a [GPUParticles2D] or [CPUParticles2D].
[b]Note:[/b] This property is only used and visible in the editor if [member particles_animation] is [code]true[/code].
</member>
<member name="particles_animation" type="bool" setter="set_particles_animation" getter="get_particles_animation" default="false">
- If [code]true[/code], enable spritesheet-based animation features when assigned to [Particles2D] and [CPUParticles2D] nodes. The [member ParticlesMaterial.anim_speed] or [member CPUParticles2D.anim_speed] should also be set to a positive value for the animation to play.
+ If [code]true[/code], enable spritesheet-based animation features when assigned to [GPUParticles2D] and [CPUParticles2D] nodes. The [member ParticlesMaterial.anim_speed] or [member CPUParticles2D.anim_speed] should also be set to a positive value for the animation to play.
This property (and other [code]particles_anim_*[/code] properties that depend on it) has no effect on other types of nodes.
</member>
</members>
diff --git a/doc/classes/CapsuleShape.xml b/doc/classes/CapsuleShape3D.xml
index c83e832281..f56d94dc63 100644
--- a/doc/classes/CapsuleShape.xml
+++ b/doc/classes/CapsuleShape3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CapsuleShape" inherits="Shape" version="4.0">
+<class name="CapsuleShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Capsule shape for collisions.
</brief_description>
diff --git a/doc/classes/ClippedCamera.xml b/doc/classes/ClippedCamera3D.xml
index 4cdc098c2f..58ecec828d 100644
--- a/doc/classes/ClippedCamera.xml
+++ b/doc/classes/ClippedCamera3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ClippedCamera" inherits="Camera" version="4.0">
+<class name="ClippedCamera3D" inherits="Camera3D" version="4.0">
<brief_description>
- A [Camera] that includes collision.
+ A [Camera3D] that includes collision.
</brief_description>
<description>
- This node extends [Camera] to add collisions with [Area] and/or [PhysicsBody] nodes. The camera cannot move through colliding objects.
+ This node extends [Camera3D] to add collisions with [Area3D] and/or [PhysicsBody3D] nodes. The camera cannot move through colliding objects.
</description>
<tutorials>
</tutorials>
@@ -84,10 +84,10 @@
</methods>
<members>
<member name="clip_to_areas" type="bool" setter="set_clip_to_areas" getter="is_clip_to_areas_enabled" default="false">
- If [code]true[/code], the camera stops on contact with [Area]s.
+ If [code]true[/code], the camera stops on contact with [Area3D]s.
</member>
<member name="clip_to_bodies" type="bool" setter="set_clip_to_bodies" getter="is_clip_to_bodies_enabled" default="true">
- If [code]true[/code], the camera stops on contact with [PhysicsBody]s.
+ If [code]true[/code], the camera stops on contact with [PhysicsBody3D]s.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
The camera's collision mask. Only objects in at least one collision layer matching the mask will be detected.
@@ -95,7 +95,7 @@
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.0">
The camera's collision margin. The camera can't get closer than this distance to a colliding object.
</member>
- <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="ClippedCamera.ProcessMode" default="0">
+ <member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="ClippedCamera3D.ProcessMode" default="0">
The camera's process callback. See [enum ProcessMode].
</member>
</members>
diff --git a/doc/classes/CollisionObject.xml b/doc/classes/CollisionObject3D.xml
index 34758d71b2..f8e897653d 100644
--- a/doc/classes/CollisionObject.xml
+++ b/doc/classes/CollisionObject3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionObject" inherits="Spatial" version="4.0">
+<class name="CollisionObject3D" inherits="Node3D" version="4.0">
<brief_description>
Base node for collision objects.
</brief_description>
<description>
- CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
+ CollisionObject3D is the base class for physics objects. It can hold any number of collision [Shape3D]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject3D can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
</description>
<tutorials>
</tutorials>
@@ -23,7 +23,7 @@
<argument index="4" name="shape_idx" type="int">
</argument>
<description>
- Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events.
+ Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape3D] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events.
</description>
</method>
<method name="create_shape_owner">
@@ -81,10 +81,10 @@
</return>
<argument index="0" name="owner_id" type="int">
</argument>
- <argument index="1" name="shape" type="Shape">
+ <argument index="1" name="shape" type="Shape3D">
</argument>
<description>
- Adds a [Shape] to the shape owner.
+ Adds a [Shape3D] to the shape owner.
</description>
</method>
<method name="shape_owner_clear_shapes">
@@ -106,14 +106,14 @@
</description>
</method>
<method name="shape_owner_get_shape" qualifiers="const">
- <return type="Shape">
+ <return type="Shape3D">
</return>
<argument index="0" name="owner_id" type="int">
</argument>
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Returns the [Shape] with the given id from the given shape owner.
+ Returns the [Shape3D] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_shape_count" qualifiers="const">
@@ -133,7 +133,7 @@
<argument index="1" name="shape_id" type="int">
</argument>
<description>
- Returns the child index of the [Shape] with the given id from the given shape owner.
+ Returns the child index of the [Shape3D] with the given id from the given shape owner.
</description>
</method>
<method name="shape_owner_get_transform" qualifiers="const">
@@ -181,10 +181,10 @@
</methods>
<members>
<member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
- If [code]true[/code], the [CollisionObject] will continue to receive input events as the mouse is dragged across its shapes.
+ If [code]true[/code], the [CollisionObject3D] will continue to receive input events as the mouse is dragged across its shapes.
</member>
<member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
- If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s.
+ If [code]true[/code], the [CollisionObject3D]'s shapes will respond to [RayCast3D]s.
</member>
</members>
<signals>
diff --git a/doc/classes/CollisionPolygon.xml b/doc/classes/CollisionPolygon3D.xml
index 8aceec17a8..dd3c57d1d0 100644
--- a/doc/classes/CollisionPolygon.xml
+++ b/doc/classes/CollisionPolygon3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionPolygon" inherits="Spatial" version="4.0">
+<class name="CollisionPolygon3D" inherits="Node3D" version="4.0">
<brief_description>
Editor-only class for defining a collision polygon in 3D space.
</brief_description>
<description>
- Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates a [Shape] for gameplay. Properties modified during gameplay will have no effect.
+ Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at run-time. Creates a [Shape3D] for gameplay. Properties modified during gameplay will have no effect.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/CollisionShape.xml b/doc/classes/CollisionShape3D.xml
index 7787bf957d..76515a65a7 100644
--- a/doc/classes/CollisionShape.xml
+++ b/doc/classes/CollisionShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CollisionShape" inherits="Spatial" version="4.0">
+<class name="CollisionShape3D" inherits="Node3D" version="4.0">
<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 create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method CollisionObject.shape_owner_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 [Area3D] to give it a detection shape, or add it to a [PhysicsBody3D] to create a solid object. [b]IMPORTANT[/b]: this is an Editor-only helper to create shapes, use [method CollisionObject3D.shape_owner_get_shape] to get the actual shape.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
@@ -14,7 +14,7 @@
<return type="void">
</return>
<description>
- Sets the collision shape's shape to the addition of all its convexed [MeshInstance] siblings geometry.
+ Sets the collision shape's shape to the addition of all its convexed [MeshInstance3D] siblings geometry.
</description>
</method>
<method name="resource_changed">
@@ -31,7 +31,7 @@
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
A disabled collision shape has no effect in the world.
</member>
- <member name="shape" type="Shape" setter="set_shape" getter="get_shape">
+ <member name="shape" type="Shape3D" setter="set_shape" getter="get_shape">
The actual shape owned by this collision shape.
</member>
</members>
diff --git a/doc/classes/ConcavePolygonShape.xml b/doc/classes/ConcavePolygonShape3D.xml
index 47f2276c63..20402d350a 100644
--- a/doc/classes/ConcavePolygonShape.xml
+++ b/doc/classes/ConcavePolygonShape3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConcavePolygonShape" inherits="Shape" version="4.0">
+<class name="ConcavePolygonShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Concave polygon shape.
</brief_description>
<description>
- Concave polygon shape resource, which can be set into a [PhysicsBody] or area. This shape is created by feeding a list of triangles.
- Note: when used for collision, [ConcavePolygonShape] is intended to work with static [PhysicsBody] nodes like [StaticBody] and will not work with [KinematicBody] or [RigidBody] with a mode other than Static.
+ Concave polygon shape resource, which can be set into a [PhysicsBody3D] or area. This shape is created by feeding a list of triangles.
+ Note: when used for collision, [ConcavePolygonShape3D] is intended to work with static [PhysicsBody3D] nodes like [StaticBody3D] and will not work with [KinematicBody3D] or [RigidBody3D] with a mode other than Static.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint3D.xml
index 8682391a73..e86e95bec3 100644
--- a/doc/classes/ConeTwistJoint.xml
+++ b/doc/classes/ConeTwistJoint3D.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConeTwistJoint" inherits="Joint" version="4.0">
+<class name="ConeTwistJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
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].
- The twist axis is initiated as the X axis of the [Joint].
- Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint in the local space of the two Bodies.
+ The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint3D].
+ The twist axis is initiated as the X axis of the [Joint3D].
+ Once the Bodies swing, the twist axis is calculated as the middle of the x-axes of the Joint3D in the local space of the two Bodies.
</description>
<tutorials>
</tutorials>
@@ -14,7 +14,7 @@
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="ConeTwistJoint.Param">
+ <argument index="0" name="param" type="int" enum="ConeTwistJoint3D.Param">
</argument>
<description>
</description>
@@ -22,7 +22,7 @@
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="ConeTwistJoint.Param">
+ <argument index="0" name="param" type="int" enum="ConeTwistJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
@@ -44,7 +44,7 @@
<member name="swing_span" type="float" setter="_set_swing_span" getter="_get_swing_span" default="45.0">
Swing is rotation from side to side, around the axis perpendicular to the twist axis.
The swing span defines, how much rotation will not get corrected along the swing axis.
- Could be defined as looseness in the [ConeTwistJoint].
+ Could be defined as looseness in the [ConeTwistJoint3D].
If below 0.05, this behavior is locked.
</member>
<member name="twist_span" type="float" setter="_set_twist_span" getter="_get_twist_span" default="180.0">
@@ -56,7 +56,7 @@
<constant name="PARAM_SWING_SPAN" value="0" enum="Param">
Swing is rotation from side to side, around the axis perpendicular to the twist axis.
The swing span defines, how much rotation will not get corrected along the swing axis.
- Could be defined as looseness in the [ConeTwistJoint].
+ Could be defined as looseness in the [ConeTwistJoint3D].
If below 0.05, this behavior is locked.
</constant>
<constant name="PARAM_TWIST_SPAN" value="1" enum="Param">
diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml
index a16326d55a..522d484131 100644
--- a/doc/classes/ConfigFile.xml
+++ b/doc/classes/ConfigFile.xml
@@ -8,7 +8,7 @@
[codeblock]
[section]
some_key=42
- string_example="Hello World!"
+ string_example="Hello World3D!"
a_vector=Vector3( 1, 0, 2 )
[/codeblock]
The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used directly without accessing the filesystem.
diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml
index 801d9508dd..6d5871508b 100644
--- a/doc/classes/ConfirmationDialog.xml
+++ b/doc/classes/ConfirmationDialog.xml
@@ -22,8 +22,9 @@
</method>
</methods>
<members>
- <member name="rect_min_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size" override="true" default="Vector2( 200, 70 )" />
- <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Please Confirm...&quot;" />
+ <member name="min_size" type="Vector2i" setter="set_min_size" getter="get_min_size" override="true" default="Vector2i( 200, 70 )" />
+ <member name="size" type="Vector2i" setter="set_size" getter="get_size" override="true" default="Vector2i( 200, 100 )" />
+ <member name="title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Please Confirm...&quot;" />
</members>
<constants>
</constants>
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 89db5baf8a..85a75fda37 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -7,10 +7,12 @@
Base class for all UI-related nodes. [Control] features a bounding rectangle that defines its extents, an anchor position relative to its parent control or the current viewport, and margins that represent an offset to the anchor. The margins update automatically when the node, any of its parents, or the screen size change.
For more information on Godot's UI system, anchors, margins, and containers, see the related tutorials in the manual. To build flexible UIs, you'll need a mix of UI elements that inherit from [Control] and [Container] nodes.
[b]User Interface nodes and input[/b]
- Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [method MainLoop._input_event]. Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it.
+ Godot sends input events to the scene's root node first, by calling [method Node._input]. [method Node._input] forwards the event down the node tree to the nodes under the mouse cursor, or on keyboard focus. To do so, it calls [code]MainLoop._input_event[/code].
+ [b]FIXME:[/b] No longer valid after DisplayServer split and Input refactoring.
+ Call [method accept_event] so no other node receives the event. Once you accepted an input, it becomes handled so [method Node._unhandled_input] will not process it.
Only one [Control] node can be in keyboard focus. Only the node in focus will receive keyboard events. To get the focus, call [method grab_focus]. [Control] nodes lose focus when another node grabs it, or if you hide the node in focus.
Sets [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] to tell a [Control] node to ignore mouse or touch events. You'll need it if you place an icon on top of a button.
- [Theme] resources change the Control's appearance. If you change the [Theme] on a [Control] 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.
+ [Theme] resources change the Control's appearance. If you change the [Theme] on a [Control] node, it affects all of its children. To override some of the theme's parameters, call one of the [code]add_theme_*_override[/code] methods, like [method add_theme_font_override]. You can override the theme with the inspector.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/gui/index.html</link>
@@ -87,7 +89,7 @@
Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to [method Node._unhandled_input] or [method Node._unhandled_key_input].
</description>
</method>
- <method name="add_color_override">
+ <method name="add_theme_color_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -98,7 +100,7 @@
Overrides the [Color] with given [code]name[/code] in the [member theme] resource the control uses. If the [code]color[/code] is empty or invalid, the override is cleared and the color from assigned [Theme] is used.
</description>
</method>
- <method name="add_constant_override">
+ <method name="add_theme_constant_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -109,7 +111,7 @@
Overrides an integer constant with given [code]name[/code] in the [member theme] resource the control uses. If the [code]constant[/code] is empty or invalid, the override is cleared and the constant from assigned [Theme] is used.
</description>
</method>
- <method name="add_font_override">
+ <method name="add_theme_font_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -120,7 +122,7 @@
Overrides the font with given [code]name[/code] in the [member theme] resource the control uses. If [code]font[/code] is empty or invalid, the override is cleared and the font from assigned [Theme] is used.
</description>
</method>
- <method name="add_icon_override">
+ <method name="add_theme_icon_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -131,7 +133,7 @@
Overrides the icon with given [code]name[/code] in the [member theme] resource the control uses. If [code]icon[/code] is empty or invalid, the override is cleared and the icon from assigned [Theme] is used.
</description>
</method>
- <method name="add_shader_override">
+ <method name="add_theme_shader_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -142,7 +144,7 @@
Overrides the [Shader] with given [code]name[/code] in the [member theme] resource the control uses. If [code]shader[/code] is empty or invalid, the override is cleared and the shader from assigned [Theme] is used.
</description>
</method>
- <method name="add_stylebox_override">
+ <method name="add_theme_stylebox_override">
<return type="void">
</return>
<argument index="0" name="name" type="StringName">
@@ -217,21 +219,6 @@
Returns [member margin_left] and [member margin_top]. See also [member rect_position].
</description>
</method>
- <method name="get_color" qualifiers="const">
- <return type="Color">
- </return>
- <argument index="0" name="name" type="StringName">
- </argument>
- <argument index="1" name="type" type="StringName" default="&quot;&quot;">
- </argument>
- <description>
- Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
- [codeblock]
- func _ready():
- modulate = get_color("font_color", "Button") #get the color defined for button fonts
- [/codeblock]
- </description>
- </method>
<method name="get_combined_minimum_size" qualifiers="const">
<return type="Vector2">
</return>
@@ -239,17 +226,6 @@
Returns combined minimum size from [member rect_min_size] and [method get_minimum_size].
</description>
</method>
- <method name="get_constant" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="name" type="StringName">
- </argument>
- <argument index="1" name="type" type="StringName" default="&quot;&quot;">
- </argument>
- <description>
- Returns a constant from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
- </description>
- </method>
<method name="get_cursor_shape" qualifiers="const">
<return type="int" enum="Control.CursorShape">
</return>
@@ -298,17 +274,6 @@
Returns the control that has the keyboard focus or [code]null[/code] if none.
</description>
</method>
- <method name="get_font" qualifiers="const">
- <return type="Font">
- </return>
- <argument index="0" name="name" type="StringName">
- </argument>
- <argument index="1" name="type" type="StringName" default="&quot;&quot;">
- </argument>
- <description>
- Returns a font from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
- </description>
- </method>
<method name="get_global_rect" qualifiers="const">
<return type="Rect2">
</return>
@@ -316,17 +281,6 @@
Returns the position and size of the control relative to the top-left corner of the screen. See [member rect_position] and [member rect_size].
</description>
</method>
- <method name="get_icon" qualifiers="const">
- <return type="Texture2D">
- </return>
- <argument index="0" name="name" type="StringName">
- </argument>
- <argument index="1" name="type" type="StringName" default="&quot;&quot;">
- </argument>
- <description>
- Returns an icon from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
- </description>
- </method>
<method name="get_margin" qualifiers="const">
<return type="float">
</return>
@@ -371,7 +325,55 @@
Returns the rotation (in radians).
</description>
</method>
- <method name="get_stylebox" qualifiers="const">
+ <method name="get_theme_color" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
+ [codeblock]
+ func _ready():
+ modulate = get_theme_color("font_color", "Button") #get the color defined for button fonts
+ [/codeblock]
+ </description>
+ </method>
+ <method name="get_theme_constant" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ Returns a constant from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
+ </description>
+ </method>
+ <method name="get_theme_font" qualifiers="const">
+ <return type="Font">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ Returns a font from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
+ </description>
+ </method>
+ <method name="get_theme_icon" qualifiers="const">
+ <return type="Texture2D">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ Returns an icon from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code].
+ </description>
+ </method>
+ <method name="get_theme_stylebox" qualifiers="const">
<return type="StyleBox">
</return>
<argument index="0" name="name" type="StringName">
@@ -409,7 +411,25 @@
Steal the focus from another control and become the focused control (see [member focus_mode]).
</description>
</method>
- <method name="has_color" qualifiers="const">
+ <method name="has_focus" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ Returns [code]true[/code] if this is the current focused control. See [member focus_mode].
+ </description>
+ </method>
+ <method name="has_point" qualifiers="virtual">
+ <return type="bool">
+ </return>
+ <argument index="0" name="point" type="Vector2">
+ </argument>
+ <description>
+ Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control.
+ If not overridden, default behavior is checking if the point is within control's Rect.
+ [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code].
+ </description>
+ </method>
+ <method name="has_theme_color" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -420,7 +440,7 @@
Returns [code]true[/code] if [Color] with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme].
</description>
</method>
- <method name="has_color_override" qualifiers="const">
+ <method name="has_theme_color_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -429,7 +449,7 @@
Returns [code]true[/code] if [Color] with given [code]name[/code] has a valid override in this [Control] node.
</description>
</method>
- <method name="has_constant" qualifiers="const">
+ <method name="has_theme_constant" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -440,7 +460,7 @@
Returns [code]true[/code] if constant with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme].
</description>
</method>
- <method name="has_constant_override" qualifiers="const">
+ <method name="has_theme_constant_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -449,14 +469,7 @@
Returns [code]true[/code] if constant with given [code]name[/code] has a valid override in this [Control] node.
</description>
</method>
- <method name="has_focus" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if this is the current focused control. See [member focus_mode].
- </description>
- </method>
- <method name="has_font" qualifiers="const">
+ <method name="has_theme_font" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -467,7 +480,7 @@
Returns [code]true[/code] if font with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme].
</description>
</method>
- <method name="has_font_override" qualifiers="const">
+ <method name="has_theme_font_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -476,7 +489,7 @@
Returns [code]true[/code] if font with given [code]name[/code] has a valid override in this [Control] node.
</description>
</method>
- <method name="has_icon" qualifiers="const">
+ <method name="has_theme_icon" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -487,7 +500,7 @@
Returns [code]true[/code] if icon with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme].
</description>
</method>
- <method name="has_icon_override" qualifiers="const">
+ <method name="has_theme_icon_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -496,18 +509,7 @@
Returns [code]true[/code] if icon with given [code]name[/code] has a valid override in this [Control] node.
</description>
</method>
- <method name="has_point" qualifiers="virtual">
- <return type="bool">
- </return>
- <argument index="0" name="point" type="Vector2">
- </argument>
- <description>
- Virtual method to be implemented by the user. Returns whether the given [code]point[/code] is inside this control.
- If not overridden, default behavior is checking if the point is within control's Rect.
- [b]Note:[/b] If you want to check if a point is inside the control, you can use [code]get_rect().has_point(point)[/code].
- </description>
- </method>
- <method name="has_shader_override" qualifiers="const">
+ <method name="has_theme_shader_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -516,7 +518,7 @@
Returns [code]true[/code] if [Shader] with given [code]name[/code] has a valid override in this [Control] node.
</description>
</method>
- <method name="has_stylebox" qualifiers="const">
+ <method name="has_theme_stylebox" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -527,7 +529,7 @@
Returns [code]true[/code] if [StyleBox] with given [code]name[/code] and associated with [Control] of given [code]type[/code] exists in assigned [Theme].
</description>
</method>
- <method name="has_stylebox_override" qualifiers="const">
+ <method name="has_theme_stylebox_override" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="name" type="StringName">
@@ -757,16 +759,6 @@
If [code]keep_margins[/code] is [code]true[/code], control's anchors will be updated instead of margins.
</description>
</method>
- <method name="show_modal">
- <return type="void">
- </return>
- <argument index="0" name="exclusive" type="bool" default="false">
- </argument>
- <description>
- Displays a control as modal. Control must be a subwindow. Modal controls capture the input signals until closed or the area outside them is accessed. When a modal control loses focus, or the ESC key is pressed, they automatically hide. Modal controls are used extensively for popup dialogs and menus.
- If [code]exclusive[/code] is [code]true[/code], other controls will not receive input and clicking outside this control will not close it.
- </description>
- </method>
<method name="warp_mouse">
<return type="void">
</return>
@@ -905,11 +897,6 @@
Emitted when the node's minimum size changes.
</description>
</signal>
- <signal name="modal_closed">
- <description>
- Emitted when a modal [Control] is closed. See [method show_modal].
- </description>
- </signal>
<signal name="mouse_entered">
<description>
Emitted when the mouse enters the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
@@ -930,6 +917,10 @@
Emitted when one of the size flags changes. See [member size_flags_horizontal] and [member size_flags_vertical].
</description>
</signal>
+ <signal name="theme_changed">
+ <description>
+ </description>
+ </signal>
</signals>
<constants>
<constant name="FOCUS_NONE" value="0" enum="FocusMode">
@@ -957,10 +948,7 @@
Sent when the node loses focus.
</constant>
<constant name="NOTIFICATION_THEME_CHANGED" value="45">
- Sent when the node's [member theme] changes, right before Godot redraws the control. Happens when you call one of the [code]add_*_override[/code] methods.
- </constant>
- <constant name="NOTIFICATION_MODAL_CLOSE" value="46">
- Sent when an open modal dialog closes. See [method show_modal].
+ Sent when the node's [member theme] changes, right before Godot redraws the control. Happens when you call one of the [code]add_theme_*_override[/code] methods.
</constant>
<constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
Sent when this node is inside a [ScrollContainer] which has begun being scrolled.
diff --git a/doc/classes/ConvexPolygonShape.xml b/doc/classes/ConvexPolygonShape3D.xml
index 077bb57a03..c036f80e2d 100644
--- a/doc/classes/ConvexPolygonShape.xml
+++ b/doc/classes/ConvexPolygonShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ConvexPolygonShape" inherits="Shape" version="4.0">
+<class name="ConvexPolygonShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Convex polygon shape for 3D physics.
</brief_description>
<description>
- Convex polygon shape resource, which can be added to a [PhysicsBody] or area.
+ Convex polygon shape resource, which can be added to a [PhysicsBody3D] or area.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 5024cdefbd..fe454d90cc 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -4,7 +4,7 @@
Describes a Bézier curve in 3D space.
</brief_description>
<description>
- This class describes a Bézier curve in 3D space. It is mainly used to give a shape to a [Path], but can be manually sampled for other purposes.
+ This class describes a Bézier curve in 3D space. It is mainly used to give a shape to a [Path3D], but can be manually sampled for other purposes.
It keeps a cache of precalculated points along the curve, to speed up further calculations.
</description>
<tutorials>
@@ -223,7 +223,7 @@
</argument>
<description>
Sets the tilt angle in radians for the point [code]idx[/code]. 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 [PathFollow3D], this tilt is an offset over the natural tilt the [PathFollow3D] calculates.
</description>
</method>
<method name="tessellate" qualifiers="const">
@@ -246,7 +246,7 @@
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" default="true">
- If [code]true[/code], the curve will bake up vectors used for orientation. This is used when [member PathFollow.rotation_mode] is set to [constant PathFollow.ROTATION_ORIENTED]. Changing it forces the cache to be recomputed.
+ If [code]true[/code], the curve will bake up vectors used for orientation. This is used when [member PathFollow3D.rotation_mode] is set to [constant PathFollow3D.ROTATION_ORIENTED]. Changing it forces the cache to be recomputed.
</member>
</members>
<constants>
diff --git a/doc/classes/CylinderShape.xml b/doc/classes/CylinderShape3D.xml
index 54adbd3b04..eb12568e71 100644
--- a/doc/classes/CylinderShape.xml
+++ b/doc/classes/CylinderShape3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CylinderShape" inherits="Shape" version="4.0">
+<class name="CylinderShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Cylinder shape for collisions.
</brief_description>
diff --git a/doc/classes/DirectionalLight.xml b/doc/classes/DirectionalLight3D.xml
index a3ef830d5d..a5d476f5c8 100644
--- a/doc/classes/DirectionalLight.xml
+++ b/doc/classes/DirectionalLight3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="DirectionalLight" inherits="Light" version="4.0">
+<class name="DirectionalLight3D" inherits="Light3D" version="4.0">
<brief_description>
Directional light from a distance, as from the Sun.
</brief_description>
<description>
- A directional light is a type of [Light] node that models an infinite number of parallel rays covering the entire scene. It is used for 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 to determine light direction.
+ A directional light is a type of [Light3D] node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight3D transform (origin) is ignored. Only the basis is used to determine light direction.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link>
@@ -18,7 +18,7 @@
<member name="directional_shadow_blend_splits" type="bool" setter="set_blend_splits" getter="is_blend_splits_enabled" default="false">
If [code]true[/code], shadow detail is sacrificed in exchange for smoother transitions between splits.
</member>
- <member name="directional_shadow_depth_range" type="int" setter="set_shadow_depth_range" getter="get_shadow_depth_range" enum="DirectionalLight.ShadowDepthRange" default="0">
+ <member name="directional_shadow_depth_range" type="int" setter="set_shadow_depth_range" getter="get_shadow_depth_range" enum="DirectionalLight3D.ShadowDepthRange" default="0">
Optimizes shadow rendering for detail versus movement. See [enum ShadowDepthRange].
</member>
<member name="directional_shadow_fade_start" type="float" setter="set_param" getter="get_param" default="0.8">
@@ -26,7 +26,7 @@
<member name="directional_shadow_max_distance" type="float" setter="set_param" getter="get_param" default="100.0">
The maximum distance for shadow splits.
</member>
- <member name="directional_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="DirectionalLight.ShadowMode" default="2">
+ <member name="directional_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="DirectionalLight3D.ShadowMode" default="2">
The light's shadow rendering algorithm. See [enum ShadowMode].
</member>
<member name="directional_shadow_normal_bias" type="float" setter="set_param" getter="get_param" default="0.8">
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
new file mode 100644
index 0000000000..7fa64c21cb
--- /dev/null
+++ b/doc/classes/DisplayServer.xml
@@ -0,0 +1,1059 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="DisplayServer" inherits="Object" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="alert">
+ <return type="void">
+ </return>
+ <argument index="0" name="text" type="String">
+ </argument>
+ <argument index="1" name="title" type="String" default="&quot;Alert!&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="clipboard_get" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="clipboard_set">
+ <return type="void">
+ </return>
+ <argument index="0" name="clipboard" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="console_set_visible">
+ <return type="void">
+ </return>
+ <argument index="0" name="console_visible" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="create_sub_window">
+ <return type="int">
+ </return>
+ <argument index="0" name="mode" type="int" enum="DisplayServer.WindowMode">
+ </argument>
+ <argument index="1" name="rect" type="int">
+ </argument>
+ <argument index="2" name="arg2" type="Rect2i" default="Rect2i( 0, 0, 0, 0 )">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="cursor_get_shape" qualifiers="const">
+ <return type="int" enum="DisplayServer.CursorShape">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="cursor_set_custom_image">
+ <return type="void">
+ </return>
+ <argument index="0" name="cursor" type="Resource">
+ </argument>
+ <argument index="1" name="shape" type="int" enum="DisplayServer.CursorShape" default="0">
+ </argument>
+ <argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="cursor_set_shape">
+ <return type="void">
+ </return>
+ <argument index="0" name="shape" type="int" enum="DisplayServer.CursorShape">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="delete_sub_window">
+ <return type="void">
+ </return>
+ <argument index="0" name="window_id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="dialog_input_text">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="title" type="String">
+ </argument>
+ <argument index="1" name="description" type="String">
+ </argument>
+ <argument index="2" name="existing_text" type="PackedStringArray">
+ </argument>
+ <argument index="3" name="callback" type="Callable">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="dialog_show">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="title" type="String">
+ </argument>
+ <argument index="1" name="description" type="String">
+ </argument>
+ <argument index="2" name="buttons" type="PackedStringArray">
+ </argument>
+ <argument index="3" name="callback" type="Callable">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="enable_for_stealing_focus">
+ <return type="void">
+ </return>
+ <argument index="0" name="process_id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="force_process_and_drop_events">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_latin_keyboard_variant" qualifiers="const">
+ <return type="int" enum="DisplayServer.LatinKeyboardVariant">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_name" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_screen_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_swap_ok_cancel">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_window_at_screen_position" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="position" type="Vector2i">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_window_list" qualifiers="const">
+ <return type="PackedInt32Array">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_add_check_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="label" type="String">
+ </argument>
+ <argument index="2" name="callback" type="Callable">
+ </argument>
+ <argument index="3" name="tag" type="Variant" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_add_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="label" type="String">
+ </argument>
+ <argument index="2" name="callback" type="Callable">
+ </argument>
+ <argument index="3" name="tag" type="Variant" default="null">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_add_separator">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_add_submenu_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="label" type="String">
+ </argument>
+ <argument index="2" name="submenu" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_clear">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_get_item_callback">
+ <return type="Callable">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_get_item_submenu">
+ <return type="String">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_get_item_tag">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_get_item_text">
+ <return type="String">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_is_item_checkable" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_is_item_checked" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_remove_item">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="callback" type="Callable">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_checkable">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="checkable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_checked">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="checked" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_submenu">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="submenu" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_tag">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="tag" type="Variant">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="global_menu_set_item_text">
+ <return type="void">
+ </return>
+ <argument index="0" name="menu_root" type="String">
+ </argument>
+ <argument index="1" name="idx" type="int">
+ </argument>
+ <argument index="2" name="text" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="has_feature" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="feature" type="int" enum="DisplayServer.Feature">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="ime_get_selection" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="ime_get_text" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_console_visible" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_get_absolute_position" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_get_button_state" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_get_mode" qualifiers="const">
+ <return type="int" enum="DisplayServer.MouseMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_get_position" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_set_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mouse_mode" type="int" enum="DisplayServer.MouseMode">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="mouse_warp_to_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2i">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="native_video_is_playing" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="native_video_pause">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="native_video_play">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="volume" type="float">
+ </argument>
+ <argument index="2" name="audio_track" type="String">
+ </argument>
+ <argument index="3" name="subtitle_track" type="String">
+ </argument>
+ <argument index="4" name="arg4" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="native_video_stop">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="native_video_unpause">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="process_events">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_dpi" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_orientation" qualifiers="const">
+ <return type="int" enum="DisplayServer.ScreenOrientation">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_position" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_scale" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_get_usable_rect" qualifiers="const">
+ <return type="Rect2i">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_is_kept_on" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="screen_is_touchscreen" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_set_keep_on">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="screen_set_orientation">
+ <return type="void">
+ </return>
+ <argument index="0" name="orientation" type="int" enum="DisplayServer.ScreenOrientation">
+ </argument>
+ <argument index="1" name="screen" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_icon">
+ <return type="void">
+ </return>
+ <argument index="0" name="image" type="Image">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_native_icon">
+ <return type="void">
+ </return>
+ <argument index="0" name="filename" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="virtual_keyboard_get_height" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="virtual_keyboard_hide">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="virtual_keyboard_show">
+ <return type="void">
+ </return>
+ <argument index="0" name="existing_text" type="String">
+ </argument>
+ <argument index="1" name="position" type="Rect2" default="Rect2i( 0, 0, 0, 0 )">
+ </argument>
+ <argument index="2" name="max_length" type="int" default="-1">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="vsync_is_enabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="vsync_is_using_via_compositor" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="vsync_set_enabled">
+ <return type="void">
+ </return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="vsync_set_use_via_compositor">
+ <return type="void">
+ </return>
+ <argument index="0" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_attach_instance_id">
+ <return type="void">
+ </return>
+ <argument index="0" name="instance_id" type="int">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_can_draw" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_attached_instance_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_current_screen" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_flag" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="flag" type="int" enum="DisplayServer.WindowFlags">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_max_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_min_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_mode" qualifiers="const">
+ <return type="int" enum="DisplayServer.WindowMode">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_position" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_real_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_get_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_move_to_foreground">
+ <return type="void">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_request_attention">
+ <return type="void">
+ </return>
+ <argument index="0" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_current_screen">
+ <return type="void">
+ </return>
+ <argument index="0" name="screen" type="int">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_drop_files_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callback" type="Callable">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_flag">
+ <return type="void">
+ </return>
+ <argument index="0" name="flag" type="int" enum="DisplayServer.WindowFlags">
+ </argument>
+ <argument index="1" name="enabled" type="bool">
+ </argument>
+ <argument index="2" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_ime_active">
+ <return type="void">
+ </return>
+ <argument index="0" name="active" type="bool">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_ime_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2i">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_input_event_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callback" type="Callable">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_input_text_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callback" type="Callable">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_max_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="max_size" type="Vector2i">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_min_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="min_size" type="Vector2i">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="DisplayServer.WindowMode">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="position" type="Vector2i">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_rect_changed_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callback" type="Callable">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="size" type="Vector2i">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_title">
+ <return type="void">
+ </return>
+ <argument index="0" name="title" type="String">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_transient">
+ <return type="void">
+ </return>
+ <argument index="0" name="window_id" type="int">
+ </argument>
+ <argument index="1" name="parent_window_id" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="window_set_window_event_callback">
+ <return type="void">
+ </return>
+ <argument index="0" name="callback" type="Callable">
+ </argument>
+ <argument index="1" name="window_id" type="int" default="0">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <constants>
+ <constant name="FEATURE_GLOBAL_MENU" value="0" enum="Feature">
+ </constant>
+ <constant name="FEATURE_SUBWINDOWS" value="1" enum="Feature">
+ </constant>
+ <constant name="FEATURE_TOUCHSCREEN" value="2" enum="Feature">
+ </constant>
+ <constant name="FEATURE_MOUSE" value="3" enum="Feature">
+ </constant>
+ <constant name="FEATURE_MOUSE_WARP" value="4" enum="Feature">
+ </constant>
+ <constant name="FEATURE_CLIPBOARD" value="5" enum="Feature">
+ </constant>
+ <constant name="FEATURE_VIRTUAL_KEYBOARD" value="6" enum="Feature">
+ </constant>
+ <constant name="FEATURE_CURSOR_SHAPE" value="7" enum="Feature">
+ </constant>
+ <constant name="FEATURE_CUSTOM_CURSOR_SHAPE" value="8" enum="Feature">
+ </constant>
+ <constant name="FEATURE_NATIVE_VIDEO" value="9" enum="Feature">
+ </constant>
+ <constant name="FEATURE_NATIVE_DIALOG" value="10" enum="Feature">
+ </constant>
+ <constant name="FEATURE_CONSOLE_WINDOW" value="11" enum="Feature">
+ </constant>
+ <constant name="FEATURE_IME" value="12" enum="Feature">
+ </constant>
+ <constant name="FEATURE_WINDOW_TRANSPARENCY" value="13" enum="Feature">
+ </constant>
+ <constant name="FEATURE_HIDPI" value="14" enum="Feature">
+ </constant>
+ <constant name="FEATURE_ICON" value="15" enum="Feature">
+ </constant>
+ <constant name="FEATURE_NATIVE_ICON" value="16" enum="Feature">
+ </constant>
+ <constant name="FEATURE_ORIENTATION" value="17" enum="Feature">
+ </constant>
+ <constant name="FEATURE_SWAP_BUFFERS" value="18" enum="Feature">
+ </constant>
+ <constant name="MOUSE_MODE_VISIBLE" value="0" enum="MouseMode">
+ </constant>
+ <constant name="MOUSE_MODE_HIDDEN" value="1" enum="MouseMode">
+ </constant>
+ <constant name="MOUSE_MODE_CAPTURED" value="2" enum="MouseMode">
+ </constant>
+ <constant name="MOUSE_MODE_CONFINED" value="3" enum="MouseMode">
+ </constant>
+ <constant name="SCREEN_OF_MAIN_WINDOW" value="-1">
+ </constant>
+ <constant name="MAIN_WINDOW_ID" value="0">
+ </constant>
+ <constant name="INVALID_WINDOW_ID" value="-1">
+ </constant>
+ <constant name="SCREEN_LANDSCAPE" value="0" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_PORTRAIT" value="1" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_REVERSE_LANDSCAPE" value="2" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_REVERSE_PORTRAIT" value="3" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_SENSOR_LANDSCAPE" value="4" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_SENSOR_PORTRAIT" value="5" enum="ScreenOrientation">
+ </constant>
+ <constant name="SCREEN_SENSOR" value="6" enum="ScreenOrientation">
+ </constant>
+ <constant name="CURSOR_ARROW" value="0" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_IBEAM" value="1" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_CROSS" value="3" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_WAIT" value="4" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_BUSY" value="5" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_DRAG" value="6" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_CAN_DROP" value="7" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_FORBIDDEN" value="8" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_VSIZE" value="9" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_HSIZE" value="10" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_BDIAGSIZE" value="11" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_FDIAGSIZE" value="12" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_MOVE" value="13" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_VSPLIT" value="14" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_HSPLIT" value="15" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_HELP" value="16" enum="CursorShape">
+ </constant>
+ <constant name="CURSOR_MAX" value="17" enum="CursorShape">
+ </constant>
+ <constant name="WINDOW_MODE_WINDOWED" value="0" enum="WindowMode">
+ </constant>
+ <constant name="WINDOW_MODE_MINIMIZED" value="1" enum="WindowMode">
+ </constant>
+ <constant name="WINDOW_MODE_MAXIMIZED" value="2" enum="WindowMode">
+ </constant>
+ <constant name="WINDOW_MODE_FULLSCREEN" value="3" enum="WindowMode">
+ </constant>
+ <constant name="WINDOW_FLAG_RESIZE_DISABLED" value="0" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_BORDERLESS" value="1" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_ALWAYS_ON_TOP" value="2" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_MAX" value="5" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_RESIZE_DISABLED_BIT" value="1" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_BORDERLESS_BIT" value="2" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_ALWAYS_ON_TOP_BIT" value="4" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_TRANSPARENT_BIT" value="8" enum="WindowFlags">
+ </constant>
+ <constant name="WINDOW_FLAG_NO_FOCUS_BIT" value="16" enum="WindowFlags">
+ </constant>
+ <constant name="LATIN_KEYBOARD_QWERTY" value="0" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_QWERTZ" value="1" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_AZERTY" value="2" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_QZERTY" value="3" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_DVORAK" value="4" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_NEO" value="5" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="LATIN_KEYBOARD_COLEMAK" value="6" enum="LatinKeyboardVariant">
+ </constant>
+ <constant name="WINDOW_EVENT_MOUSE_ENTER" value="0" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_MOUSE_EXIT" value="1" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_FOCUS_IN" value="2" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_FOCUS_OUT" value="3" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_CLOSE_REQUEST" value="4" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_GO_BACK_REQUEST" value="5" enum="WindowEvent">
+ </constant>
+ <constant name="WINDOW_EVENT_DPI_CHANGE" value="6" enum="WindowEvent">
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml
index 75b906d6d2..53db8dd293 100644
--- a/doc/classes/EditorFeatureProfile.xml
+++ b/doc/classes/EditorFeatureProfile.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
An editor feature profile can be used to disable specific features of the Godot editor. When disabled, the features won't appear in the editor, which makes the editor less cluttered. This is useful in education settings to reduce confusion or when working in a team. For example, artists and level designers could use a feature profile that disables the script editor to avoid accidentally making changes to files they aren't supposed to edit.
- To manage editor feature profiles visually, use [b]Editor > Manage Feature Profiles...[/b] at the top of the editor window.
+ To manage editor feature profiles visually, use [b]Editor &gt; Manage Feature Profiles...[/b] at the top of the editor window.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/EditorFileDialog.xml b/doc/classes/EditorFileDialog.xml
index 3e6bbd682d..084459e518 100644
--- a/doc/classes/EditorFileDialog.xml
+++ b/doc/classes/EditorFileDialog.xml
@@ -60,14 +60,13 @@
<member name="display_mode" type="int" setter="set_display_mode" getter="get_display_mode" enum="EditorFileDialog.DisplayMode" default="0">
The view format in which the [EditorFileDialog] displays resources to the user.
</member>
- <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="EditorFileDialog.Mode" default="4">
- The purpose of the [EditorFileDialog], which defines the allowed behaviors.
+ <member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="EditorFileDialog.FileMode" default="4">
+ The dialog's open or save mode, which affects the selection behavior. See [enum FileMode]
</member>
- <member name="resizable" type="bool" setter="set_resizable" getter="get_resizable" override="true" default="true" />
<member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
If [code]true[/code], hidden files and directories will be visible in the [EditorFileDialog].
</member>
- <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
+ <member name="title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
</members>
<signals>
<signal name="dir_selected">
@@ -93,19 +92,19 @@
</signal>
</signals>
<constants>
- <constant name="MODE_OPEN_FILE" value="0" enum="Mode">
+ <constant name="FILE_MODE_OPEN_FILE" value="0" enum="FileMode">
The [EditorFileDialog] can select only one file. Accepting the window will open the file.
</constant>
- <constant name="MODE_OPEN_FILES" value="1" enum="Mode">
+ <constant name="FILE_MODE_OPEN_FILES" value="1" enum="FileMode">
The [EditorFileDialog] can select multiple files. Accepting the window will open all files.
</constant>
- <constant name="MODE_OPEN_DIR" value="2" enum="Mode">
+ <constant name="FILE_MODE_OPEN_DIR" value="2" enum="FileMode">
The [EditorFileDialog] can select only one directory. Accepting the window will open the directory.
</constant>
- <constant name="MODE_OPEN_ANY" value="3" enum="Mode">
+ <constant name="FILE_MODE_OPEN_ANY" value="3" enum="FileMode">
The [EditorFileDialog] can select a file or directory. Accepting the window will open it.
</constant>
- <constant name="MODE_SAVE_FILE" value="4" enum="Mode">
+ <constant name="FILE_MODE_SAVE_FILE" value="4" enum="FileMode">
The [EditorFileDialog] can select only one file. Accepting the window will save the file.
</constant>
<constant name="ACCESS_RESOURCES" value="0" enum="Access">
diff --git a/doc/classes/EditorSpatialGizmo.xml b/doc/classes/EditorNode3DGizmo.xml
index b8c4daab07..6d695ddeea 100644
--- a/doc/classes/EditorSpatialGizmo.xml
+++ b/doc/classes/EditorNode3DGizmo.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSpatialGizmo" inherits="SpatialGizmo" version="4.0">
+<class name="EditorNode3DGizmo" inherits="Node3DGizmo" version="4.0">
<brief_description>
- Custom gizmo for editing Spatial objects.
+ Custom gizmo for editing Node3D objects.
</brief_description>
<description>
- Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See [EditorSpatialGizmoPlugin] for more information.
+ Custom gizmo that is used for providing custom visualization and editing (handles) for Node3D objects. See [EditorNode3DGizmoPlugin] for more information.
</description>
<tutorials>
</tutorials>
@@ -124,17 +124,17 @@
</description>
</method>
<method name="get_plugin" qualifiers="const">
- <return type="EditorSpatialGizmoPlugin">
+ <return type="EditorNode3DGizmoPlugin">
</return>
<description>
- Returns the [EditorSpatialGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorSpatialGizmoPlugin.get_material].
+ Returns the [EditorNode3DGizmoPlugin] that owns this gizmo. It's useful to retrieve materials using [method EditorNode3DGizmoPlugin.get_material].
</description>
</method>
<method name="get_spatial_node" qualifiers="const">
- <return type="Spatial">
+ <return type="Node3D">
</return>
<description>
- Returns the Spatial node associated with this gizmo.
+ Returns the Node3D node associated with this gizmo.
</description>
</method>
<method name="is_handle_highlighted" qualifiers="virtual">
@@ -150,7 +150,7 @@
<return type="void">
</return>
<description>
- This function is called when the Spatial this gizmo refers to changes (the [method Spatial.update_gizmo] is called).
+ This function is called when the Node3D this gizmo refers to changes (the [method Node3D.update_gizmo] is called).
</description>
</method>
<method name="set_handle" qualifiers="virtual">
@@ -158,13 +158,13 @@
</return>
<argument index="0" name="index" type="int">
</argument>
- <argument index="1" name="camera" type="Camera">
+ <argument index="1" name="camera" type="Camera3D">
</argument>
<argument index="2" name="point" type="Vector2">
</argument>
<description>
This function is used when the user drags a gizmo handle (previously added with [method add_handles]) in screen coordinates.
- The [Camera] is also provided so screen coordinates can be converted to raycasts.
+ The [Camera3D] is also provided so screen coordinates can be converted to raycasts.
</description>
</method>
<method name="set_hidden">
diff --git a/doc/classes/EditorSpatialGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml
index b1a4a25a5f..ca75b47fbf 100644
--- a/doc/classes/EditorSpatialGizmoPlugin.xml
+++ b/doc/classes/EditorNode3DGizmoPlugin.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="EditorSpatialGizmoPlugin" inherits="Resource" version="4.0">
+<class name="EditorNode3DGizmoPlugin" inherits="Resource" version="4.0">
<brief_description>
- Used by the editor to define Spatial gizmo types.
+ Used by the editor to define Node3D gizmo types.
</brief_description>
<description>
- EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorSpatialGizmoPlugin] for the simpler gizmos, or creating a new [EditorSpatialGizmo] type. See the tutorial in the documentation for more info.
+ EditorNode3DGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending [EditorNode3DGizmoPlugin] for the simpler gizmos, or creating a new [EditorNode3DGizmo] type. See the tutorial in the documentation for more info.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/plugins/editor/spatial_gizmos.html</link>
@@ -31,7 +31,7 @@
<method name="commit_handle" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<argument index="1" name="index" type="int">
</argument>
@@ -44,12 +44,12 @@
</description>
</method>
<method name="create_gizmo" qualifiers="virtual">
- <return type="EditorSpatialGizmo">
+ <return type="EditorNode3DGizmo">
</return>
- <argument index="0" name="spatial" type="Spatial">
+ <argument index="0" name="spatial" type="Node3D">
</argument>
<description>
- Override this method to return a custom [EditorSpatialGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo].
+ Override this method to return a custom [EditorNode3DGizmo] for the spatial nodes of your choice, return [code]null[/code] for the rest of nodes. See also [method has_gizmo].
</description>
</method>
<method name="create_handle_material">
@@ -60,7 +60,7 @@
<argument index="1" name="billboard" type="bool" default="false">
</argument>
<description>
- Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_handles]. Should not be overridden.
+ Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_handles]. Should not be overridden.
</description>
</method>
<method name="create_icon_material">
@@ -75,7 +75,7 @@
<argument index="3" name="color" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
<description>
- Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_unscaled_billboard]. Should not be overridden.
+ Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_unscaled_billboard]. Should not be overridden.
</description>
</method>
<method name="create_material">
@@ -92,13 +92,13 @@
<argument index="4" name="use_vertex_color" type="bool" default="false">
</argument>
<description>
- Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorSpatialGizmo.add_mesh] and [method EditorSpatialGizmo.add_lines]. Should not be overridden.
+ Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with [method get_material] and used in [method EditorNode3DGizmo.add_mesh] and [method EditorNode3DGizmo.add_lines]. Should not be overridden.
</description>
</method>
<method name="get_handle_name" qualifiers="virtual">
<return type="String">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<argument index="1" name="index" type="int">
</argument>
@@ -109,7 +109,7 @@
<method name="get_handle_value" qualifiers="virtual">
<return type="Variant">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<argument index="1" name="index" type="int">
</argument>
@@ -122,10 +122,10 @@
</return>
<argument index="0" name="name" type="String">
</argument>
- <argument index="1" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="1" name="gizmo" type="EditorNode3DGizmo">
</argument>
<description>
- Gets material from the internal list of materials. If an [EditorSpatialGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
+ Gets material from the internal list of materials. If an [EditorNode3DGizmo] is provided, it will try to get the corresponding variant (selected and/or editable).
</description>
</method>
<method name="get_name" qualifiers="virtual">
@@ -144,16 +144,16 @@
<method name="has_gizmo" qualifiers="virtual">
<return type="bool">
</return>
- <argument index="0" name="spatial" type="Spatial">
+ <argument index="0" name="spatial" type="Node3D">
</argument>
<description>
- Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a [Spatial] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorSpatialGizmo] assigned and is added to this plugin's list of active gizmos.
+ Override this method to define which Node3D nodes have a gizmo from this plugin. Whenever a [Node3D] node is added to a scene this method is called, if it returns [code]true[/code] the node gets a generic [EditorNode3DGizmo] assigned and is added to this plugin's list of active gizmos.
</description>
</method>
<method name="is_handle_highlighted" qualifiers="virtual">
<return type="bool">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<argument index="1" name="index" type="int">
</argument>
@@ -165,13 +165,13 @@
<return type="bool">
</return>
<description>
- Override this method to define whether Spatial with this gizmo should be selecteble even when the gizmo is hidden.
+ Override this method to define whether Node3D with this gizmo should be selecteble even when the gizmo is hidden.
</description>
</method>
<method name="redraw" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<description>
Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
@@ -180,11 +180,11 @@
<method name="set_handle" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="gizmo" type="EditorSpatialGizmo">
+ <argument index="0" name="gizmo" type="EditorNode3DGizmo">
</argument>
<argument index="1" name="index" type="int">
</argument>
- <argument index="2" name="camera" type="Camera">
+ <argument index="2" name="camera" type="Camera3D">
</argument>
<argument index="3" name="point" type="Vector2">
</argument>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 587fd51f1e..19583fca28 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -71,7 +71,7 @@
</argument>
<description>
Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
- When given node or resource is selected, the base type will be instanced (e.g. "Spatial", "Control", "Resource"), then the script will be loaded and set to this object.
+ When given node or resource is selected, the base type will be instanced (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object.
You can use the virtual method [method handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword.
During run-time, this will be a simple object with a script so this function does not need to be called then.
</description>
@@ -111,7 +111,7 @@
<method name="add_spatial_gizmo_plugin">
<return type="void">
</return>
- <argument index="0" name="plugin" type="EditorSpatialGizmoPlugin">
+ <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin">
</argument>
<description>
</description>
@@ -229,7 +229,7 @@
<method name="forward_spatial_gui_input" qualifiers="virtual">
<return type="bool">
</return>
- <argument index="0" name="camera" type="Camera">
+ <argument index="0" name="camera" type="Camera3D">
</argument>
<argument index="1" name="event" type="InputEvent">
</argument>
@@ -450,7 +450,7 @@
<method name="remove_spatial_gizmo_plugin">
<return type="void">
</return>
- <argument index="0" name="plugin" type="EditorSpatialGizmoPlugin">
+ <argument index="0" name="plugin" type="EditorNode3DGizmoPlugin">
</argument>
<description>
</description>
diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml
index f5c04b3947..18d1fc8eca 100644
--- a/doc/classes/Environment.xml
+++ b/doc/classes/Environment.xml
@@ -108,7 +108,7 @@
If [code]true[/code], the depth fog effect is enabled. When enabled, fog will appear in the distance (relative to the camera).
</member>
<member name="fog_depth_end" type="float" setter="set_fog_depth_end" getter="get_fog_depth_end" default="100.0">
- The fog's depth end distance from the camera. If this value is set to 0, it will be equal to the current camera's [member Camera.far] value.
+ The fog's depth end distance from the camera. If this value is set to 0, it will be equal to the current camera's [member Camera3D.far] value.
</member>
<member name="fog_enabled" type="bool" setter="set_fog_enabled" getter="is_fog_enabled" default="false">
If [code]true[/code], fog effects are enabled. [member fog_height_enabled] and/or [member fog_depth_enabled] must be set to [code]true[/code] to actually display fog.
@@ -126,7 +126,7 @@
The Y coordinate where the height fog will be the least intense. If this value is greater than [member fog_height_max], fog will be displayed from top to bottom. Otherwise, it will be displayed from bottom to top.
</member>
<member name="fog_sun_amount" type="float" setter="set_fog_sun_amount" getter="get_fog_sun_amount" default="0.0">
- The intensity of the depth fog color transition when looking towards the sun. The sun's direction is determined automatically using the DirectionalLight node in the scene.
+ The intensity of the depth fog color transition when looking towards the sun. The sun's direction is determined automatically using the DirectionalLight3D node in the scene.
</member>
<member name="fog_sun_color" type="Color" setter="set_fog_sun_color" getter="get_fog_sun_color" default="Color( 1, 0.9, 0.7, 1 )">
The depth fog's [Color] when looking towards the sun.
@@ -137,10 +137,6 @@
<member name="fog_transmit_enabled" type="bool" setter="set_fog_transmit_enabled" getter="is_fog_transmit_enabled" default="false">
Enables fog's light transmission effect. If [code]true[/code], light will be more visible in the fog to simulate light scattering as in real life.
</member>
- <member name="glow_bicubic_upscale" type="bool" setter="set_glow_bicubic_upscale" getter="is_glow_bicubic_upscale_enabled" default="false">
- Smooths out the blockiness created by sampling higher levels, at the cost of performance.
- [b]Note:[/b] When using the GLES2 renderer, this is only available if the GPU supports the [code]GL_EXT_gpu_shader4[/code] extension.
- </member>
<member name="glow_blend_mode" type="int" setter="set_glow_blend_mode" getter="get_glow_blend_mode" enum="Environment.GlowBlendMode" default="2">
The glow blending mode.
</member>
diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml
index 78fcec33ea..99563ee367 100644
--- a/doc/classes/FileDialog.xml
+++ b/doc/classes/FileDialog.xml
@@ -68,19 +68,19 @@
The currently selected file path of the file dialog.
</member>
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" />
+ <member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="FileDialog.FileMode" default="4">
+ The dialog's open or save mode, which affects the selection behavior. See [enum FileMode].
+ </member>
<member name="filters" type="PackedStringArray" setter="set_filters" getter="get_filters" default="PackedStringArray( )">
The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code].
</member>
- <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode" default="4">
- The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants.
- </member>
<member name="mode_overrides_title" type="bool" setter="set_mode_overrides_title" getter="is_mode_overriding_title" default="true">
- If [code]true[/code], changing the [code]Mode[/code] property will set the window title accordingly (e.g. setting mode to [constant MODE_OPEN_FILE] will change the window title to "Open a File").
+ If [code]true[/code], changing the [code]Mode[/code] property will set the window title accordingly (e.g. setting mode to [constant FILE_MODE_OPEN_FILE] will change the window title to "Open a File").
</member>
<member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
If [code]true[/code], the dialog will show hidden files.
</member>
- <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
+ <member name="title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
</members>
<signals>
<signal name="dir_selected">
@@ -106,19 +106,19 @@
</signal>
</signals>
<constants>
- <constant name="MODE_OPEN_FILE" value="0" enum="Mode">
+ <constant name="FILE_MODE_OPEN_FILE" value="0" enum="FileMode">
The dialog allows selecting one, and only one file.
</constant>
- <constant name="MODE_OPEN_FILES" value="1" enum="Mode">
+ <constant name="FILE_MODE_OPEN_FILES" value="1" enum="FileMode">
The dialog allows selecting multiple files.
</constant>
- <constant name="MODE_OPEN_DIR" value="2" enum="Mode">
+ <constant name="FILE_MODE_OPEN_DIR" value="2" enum="FileMode">
The dialog only allows selecting a directory, disallowing the selection of any file.
</constant>
- <constant name="MODE_OPEN_ANY" value="3" enum="Mode">
+ <constant name="FILE_MODE_OPEN_ANY" value="3" enum="FileMode">
The dialog allows selecting one file or directory.
</constant>
- <constant name="MODE_SAVE_FILE" value="4" enum="Mode">
+ <constant name="FILE_MODE_SAVE_FILE" value="4" enum="FileMode">
The dialog will warn when a file exists.
</constant>
<constant name="ACCESS_RESOURCES" value="0" enum="Access">
diff --git a/doc/classes/GIProbe.xml b/doc/classes/GIProbe.xml
index 322143ea9e..df50244c77 100644
--- a/doc/classes/GIProbe.xml
+++ b/doc/classes/GIProbe.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GIProbe" inherits="VisualInstance" version="4.0">
+<class name="GIProbe" inherits="VisualInstance3D" version="4.0">
<brief_description>
Real-time global illumination (GI) probe.
</brief_description>
@@ -19,7 +19,7 @@
<argument index="1" name="create_visual_debug" type="bool" default="false">
</argument>
<description>
- Bakes the effect from all [GeometryInstance]s marked with [member GeometryInstance.use_in_baked_light] and [Light]s marked with either [constant Light.BAKE_INDIRECT] or [constant Light.BAKE_ALL]. If [code]create_visual_debug[/code] is [code]true[/code], after baking the light, this will generate a [MultiMesh] that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the [GIProbe]'s data and debug any issues that may be occurring.
+ Bakes the effect from all [GeometryInstance3D]s marked with [member GeometryInstance3D.use_in_baked_light] and [Light3D]s marked with either [constant Light3D.BAKE_INDIRECT] or [constant Light3D.BAKE_ALL]. If [code]create_visual_debug[/code] is [code]true[/code], after baking the light, this will generate a [MultiMesh] that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the [GIProbe]'s data and debug any issues that may be occurring.
</description>
</method>
<method name="debug_bake">
diff --git a/doc/classes/Particles2D.xml b/doc/classes/GPUParticles2D.xml
index 50fc3680bc..64a2522f2f 100644
--- a/doc/classes/Particles2D.xml
+++ b/doc/classes/GPUParticles2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Particles2D" inherits="Node2D" version="4.0">
+<class name="GPUParticles2D" inherits="Node2D" version="4.0">
<brief_description>
2D particle emitter.
</brief_description>
<description>
- 2D particle node used to create a variety of particle systems and effects. [Particles2D] features an emitter that generates some number of particles at a given rate.
+ 2D particle node used to create a variety of particle systems and effects. [GPUParticles2D] features an emitter that generates some number of particles at a given rate.
Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
</description>
<tutorials>
@@ -30,7 +30,7 @@
<member name="amount" type="int" setter="set_amount" getter="get_amount" default="8">
Number of particles emitted in one emission cycle.
</member>
- <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles2D.DrawOrder" default="0">
+ <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles2D.DrawOrder" default="0">
Particle draw order. Uses [enum DrawOrder] values.
</member>
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting" default="false">
diff --git a/doc/classes/Particles.xml b/doc/classes/GPUParticles3D.xml
index 74651ddd2f..add8f28bf8 100644
--- a/doc/classes/Particles.xml
+++ b/doc/classes/GPUParticles3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Particles" inherits="GeometryInstance" version="4.0">
+<class name="GPUParticles3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
3D particle emitter.
</brief_description>
<description>
- 3D particle node used to create a variety of particle systems and effects. [Particles] features an emitter that generates some number of particles at a given rate.
+ 3D particle node used to create a variety of particle systems and effects. [GPUParticles3D] features an emitter that generates some number of particles at a given rate.
Use the [code]process_material[/code] property to add a [ParticlesMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles.
</description>
<tutorials>
@@ -50,7 +50,7 @@
<member name="amount" type="int" setter="set_amount" getter="get_amount" default="8">
Number of particles to emit.
</member>
- <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="Particles.DrawOrder" default="0">
+ <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles3D.DrawOrder" default="0">
Particle draw order. Uses [enum DrawOrder] values.
</member>
<member name="draw_pass_1" type="Mesh" setter="set_draw_pass_mesh" getter="get_draw_pass_mesh">
diff --git a/doc/classes/Generic6DOFJoint.xml b/doc/classes/Generic6DOFJoint3D.xml
index 29ebf9f5d6..fae567dc58 100644
--- a/doc/classes/Generic6DOFJoint.xml
+++ b/doc/classes/Generic6DOFJoint3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Generic6DOFJoint" inherits="Joint" version="4.0">
+<class name="Generic6DOFJoint3D" inherits="Joint3D" version="4.0">
<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>
@@ -12,7 +12,7 @@
<method name="get_flag_x" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<description>
</description>
@@ -20,7 +20,7 @@
<method name="get_flag_y" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<description>
</description>
@@ -28,7 +28,7 @@
<method name="get_flag_z" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<description>
</description>
@@ -36,7 +36,7 @@
<method name="get_param_x" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<description>
</description>
@@ -44,7 +44,7 @@
<method name="get_param_y" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<description>
</description>
@@ -52,7 +52,7 @@
<method name="get_param_z" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<description>
</description>
@@ -60,7 +60,7 @@
<method name="set_flag_x">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<argument index="1" name="value" type="bool">
</argument>
@@ -70,7 +70,7 @@
<method name="set_flag_y">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<argument index="1" name="value" type="bool">
</argument>
@@ -80,7 +80,7 @@
<method name="set_flag_z">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="Generic6DOFJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="Generic6DOFJoint3D.Flag">
</argument>
<argument index="1" name="value" type="bool">
</argument>
@@ -90,7 +90,7 @@
<method name="set_param_x">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
@@ -100,7 +100,7 @@
<method name="set_param_y">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
@@ -110,7 +110,7 @@
<method name="set_param_z">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="Generic6DOFJoint.Param">
+ <argument index="0" name="param" type="int" enum="Generic6DOFJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance3D.xml
index 8259462531..7df5f0ea50 100644
--- a/doc/classes/GeometryInstance.xml
+++ b/doc/classes/GeometryInstance3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GeometryInstance" inherits="VisualInstance" version="4.0">
+<class name="GeometryInstance3D" inherits="VisualInstance3D" version="4.0">
<brief_description>
Base node for geometry-based visual instances.
</brief_description>
@@ -12,10 +12,10 @@
<method name="get_flag" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="GeometryInstance.Flags">
+ <argument index="0" name="flag" type="int" enum="GeometryInstance3D.Flags">
</argument>
<description>
- Returns the [enum GeometryInstance.Flags] that have been set for this object.
+ Returns the [enum GeometryInstance3D.Flags] that have been set for this object.
</description>
</method>
<method name="set_custom_aabb">
@@ -30,36 +30,36 @@
<method name="set_flag">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="GeometryInstance.Flags">
+ <argument index="0" name="flag" type="int" enum="GeometryInstance3D.Flags">
</argument>
<argument index="1" name="value" type="bool">
</argument>
<description>
- Sets the [enum GeometryInstance.Flags] specified. See [enum GeometryInstance.Flags] for options.
+ Sets the [enum GeometryInstance3D.Flags] specified. See [enum GeometryInstance3D.Flags] for options.
</description>
</method>
</methods>
<members>
- <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting" default="1">
+ <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance3D.ShadowCastingSetting" default="1">
The selected shadow casting flag. See [enum ShadowCastingSetting] for possible values.
</member>
<member name="extra_cull_margin" type="float" setter="set_extra_cull_margin" getter="get_extra_cull_margin" default="0.0">
- The extra distance added to the GeometryInstance's bounding box ([AABB]) to increase its cull box.
+ The extra distance added to the GeometryInstance3D's bounding box ([AABB]) to increase its cull box.
</member>
<member name="lod_max_distance" type="float" setter="set_lod_max_distance" getter="get_lod_max_distance" default="0.0">
- The GeometryInstance's max LOD distance.
+ The GeometryInstance3D's max LOD distance.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_max_hysteresis" type="float" setter="set_lod_max_hysteresis" getter="get_lod_max_hysteresis" default="0.0">
- The GeometryInstance's max LOD margin.
+ The GeometryInstance3D's max LOD margin.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_min_distance" type="float" setter="set_lod_min_distance" getter="get_lod_min_distance" default="0.0">
- The GeometryInstance's min LOD distance.
+ The GeometryInstance3D's min LOD distance.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="lod_min_hysteresis" type="float" setter="set_lod_min_hysteresis" getter="get_lod_min_hysteresis" default="0.0">
- The GeometryInstance's min LOD margin.
+ The GeometryInstance3D's min LOD margin.
[b]Note:[/b] This property currently has no effect.
</member>
<member name="material_override" type="Material" setter="set_material_override" getter="get_material_override">
@@ -69,7 +69,7 @@
<member name="use_dynamic_gi" type="bool" setter="set_flag" getter="get_flag" default="false">
</member>
<member name="use_in_baked_light" type="bool" setter="set_flag" getter="get_flag" default="false">
- If [code]true[/code], this GeometryInstance will be used when baking lights using a [GIProbe].
+ If [code]true[/code], this GeometryInstance3D will be used when baking lights using a [GIProbe].
</member>
</members>
<constants>
@@ -77,11 +77,11 @@
Will not cast any shadows.
</constant>
<constant name="SHADOW_CASTING_SETTING_ON" value="1" enum="ShadowCastingSetting">
- Will cast shadows from all visible faces in the GeometryInstance.
+ Will cast shadows from all visible faces in the GeometryInstance3D.
Will take culling into account, so faces not being rendered will not be taken into account when shadow casting.
</constant>
<constant name="SHADOW_CASTING_SETTING_DOUBLE_SIDED" value="2" enum="ShadowCastingSetting">
- Will cast shadows from all visible faces in the GeometryInstance.
+ Will cast shadows from all visible faces in the GeometryInstance3D.
Will not take culling into account, so all faces will be taken into account when shadow casting.
</constant>
<constant name="SHADOW_CASTING_SETTING_SHADOWS_ONLY" value="3" enum="ShadowCastingSetting">
@@ -89,12 +89,12 @@
In other words, the actual mesh will not be visible, only the shadows casted from the mesh will be.
</constant>
<constant name="FLAG_USE_BAKED_LIGHT" value="0" enum="Flags">
- Will allow the GeometryInstance to be used when baking lights using a [GIProbe].
+ Will allow the GeometryInstance3D to be used when baking lights using a [GIProbe].
</constant>
<constant name="FLAG_USE_DYNAMIC_GI" value="1" enum="Flags">
</constant>
<constant name="FLAG_DRAW_NEXT_FRAME_IF_VISIBLE" value="2" enum="Flags">
- Unused in this class, exposed for consistency with [enum VisualServer.InstanceFlags].
+ Unused in this class, exposed for consistency with [enum RenderingServer.InstanceFlags].
</constant>
<constant name="FLAG_MAX" value="3" enum="Flags">
Represents the size of the [enum Flags] enum.
diff --git a/doc/classes/HeightMapShape.xml b/doc/classes/HeightMapShape3D.xml
index 029f3642d2..6d230bdab8 100644
--- a/doc/classes/HeightMapShape.xml
+++ b/doc/classes/HeightMapShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HeightMapShape" inherits="Shape" version="4.0">
+<class name="HeightMapShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Height map shape for 3D physics (Bullet only).
</brief_description>
<description>
- Height map shape resource, which can be added to a [PhysicsBody] or [Area].
+ Height map shape resource, which can be added to a [PhysicsBody3D] or [Area3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/HingeJoint.xml b/doc/classes/HingeJoint3D.xml
index 0d1b6ff0e0..2d4480cb20 100644
--- a/doc/classes/HingeJoint.xml
+++ b/doc/classes/HingeJoint3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="HingeJoint" inherits="Joint" version="4.0">
+<class name="HingeJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
A hinge between two 3D bodies.
</brief_description>
<description>
- A HingeJoint normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though.
+ A HingeJoint3D normally uses the Z axis of body A as the hinge axis, another axis can be specified when adding it manually though.
</description>
<tutorials>
</tutorials>
@@ -12,7 +12,7 @@
<method name="get_flag" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="flag" type="int" enum="HingeJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="HingeJoint3D.Flag">
</argument>
<description>
Returns the value of the specified flag.
@@ -21,7 +21,7 @@
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="HingeJoint.Param">
+ <argument index="0" name="param" type="int" enum="HingeJoint3D.Param">
</argument>
<description>
Returns the value of the specified parameter.
@@ -30,7 +30,7 @@
<method name="set_flag">
<return type="void">
</return>
- <argument index="0" name="flag" type="int" enum="HingeJoint.Flag">
+ <argument index="0" name="flag" type="int" enum="HingeJoint3D.Flag">
</argument>
<argument index="1" name="enabled" type="bool">
</argument>
@@ -41,7 +41,7 @@
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="HingeJoint.Param">
+ <argument index="0" name="param" type="int" enum="HingeJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
diff --git a/doc/classes/ImmediateGeometry.xml b/doc/classes/ImmediateGeometry3D.xml
index 710e929d1a..1c0831c922 100644
--- a/doc/classes/ImmediateGeometry.xml
+++ b/doc/classes/ImmediateGeometry3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ImmediateGeometry" inherits="GeometryInstance" version="4.0">
+<class name="ImmediateGeometry3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
Draws simple geometry from code.
</brief_description>
diff --git a/doc/classes/InputDefault.xml b/doc/classes/InputDefault.xml
deleted file mode 100644
index ea4d08c628..0000000000
--- a/doc/classes/InputDefault.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InputDefault" inherits="Input" version="4.0">
- <brief_description>
- Default implementation of the [Input] class.
- </brief_description>
- <description>
- Default implementation of the [Input] class, used internally by the editor and games for default input management.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/InputEventFromWindow.xml b/doc/classes/InputEventFromWindow.xml
new file mode 100644
index 0000000000..7cd5b7d179
--- /dev/null
+++ b/doc/classes/InputEventFromWindow.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="InputEventFromWindow" inherits="InputEvent" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <members>
+ <member name="window_id" type="int" setter="set_window_id" getter="get_window_id" default="0">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/InputEventKey.xml b/doc/classes/InputEventKey.xml
index c8d0769b90..34afa90553 100644
--- a/doc/classes/InputEventKey.xml
+++ b/doc/classes/InputEventKey.xml
@@ -43,7 +43,7 @@
If [code]true[/code], the key's state is pressed. If [code]false[/code], the key's state is released.
</member>
<member name="unicode" type="int" setter="set_unicode" getter="get_unicode" default="0">
- The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method OS.set_ime_active] for more information.
+ The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See [method Window.set_ime_active] for more information.
</member>
</members>
<constants>
diff --git a/doc/classes/InputEventScreenDrag.xml b/doc/classes/InputEventScreenDrag.xml
index d7e0c2454c..a315e4ddfb 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" version="4.0">
+<class name="InputEventScreenDrag" inherits="InputEventFromWindow" version="4.0">
<brief_description>
Input event type for screen drag events. Only available on mobile devices.
</brief_description>
diff --git a/doc/classes/InputEventScreenTouch.xml b/doc/classes/InputEventScreenTouch.xml
index 4a5cd36423..16a3cf8353 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" version="4.0">
+<class name="InputEventScreenTouch" inherits="InputEventFromWindow" version="4.0">
<brief_description>
Input event type for screen touch events.
(only available on mobile devices)
diff --git a/doc/classes/InputEventWithModifiers.xml b/doc/classes/InputEventWithModifiers.xml
index 63465ad28c..34faf18e24 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" version="4.0">
+<class name="InputEventWithModifiers" inherits="InputEventFromWindow" version="4.0">
<brief_description>
Base class for keys events with modifiers.
</brief_description>
diff --git a/doc/classes/Input.xml b/doc/classes/InputFilter.xml
index 0f212e7498..54184ae8a3 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/InputFilter.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Input" inherits="Object" version="4.0">
+<class name="InputFilter" inherits="Object" version="4.0">
<brief_description>
A singleton that deals with inputs.
</brief_description>
@@ -68,7 +68,7 @@
</description>
</method>
<method name="get_current_cursor_shape" qualifiers="const">
- <return type="int" enum="Input.CursorShape">
+ <return type="int" enum="InputFilter.CursorShape">
</return>
<description>
Returns the currently assigned cursor shape (see [enum CursorShape]).
@@ -193,7 +193,7 @@
</description>
</method>
<method name="get_mouse_mode" qualifiers="const">
- <return type="int" enum="Input.MouseMode">
+ <return type="int" enum="InputFilter.MouseMode">
</return>
<description>
Returns the mouse mode. See the constants for more information.
@@ -277,7 +277,7 @@
<argument index="3" name="guid" type="String">
</argument>
<description>
- Notifies the [Input] singleton that a connection has changed, to update the state for the [code]device[/code] index.
+ Notifies the [InputFilter] singleton that a connection has changed, to update the state for the [code]device[/code] index.
This is used internally and should not have to be called from user scripts. See [signal joy_connection_changed] for the signal emitted when this is triggered internally.
</description>
</method>
@@ -293,7 +293,7 @@
var a = InputEventAction.new()
a.action = "ui_cancel"
a.pressed = true
- Input.parse_input_event(a)
+ InputFilter.parse_input_event(a)
[/codeblock]
</description>
</method>
@@ -311,7 +311,7 @@
</return>
<argument index="0" name="image" type="Resource">
</argument>
- <argument index="1" name="shape" type="int" enum="Input.CursorShape" default="0">
+ <argument index="1" name="shape" type="int" enum="InputFilter.CursorShape" default="0">
</argument>
<argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )">
</argument>
@@ -326,7 +326,7 @@
<method name="set_default_cursor_shape">
<return type="void">
</return>
- <argument index="0" name="shape" type="int" enum="Input.CursorShape" default="0">
+ <argument index="0" name="shape" type="int" enum="InputFilter.CursorShape" default="0">
</argument>
<description>
Sets the default cursor shape to be used in the viewport instead of [constant CURSOR_ARROW].
@@ -337,7 +337,7 @@
<method name="set_mouse_mode">
<return type="void">
</return>
- <argument index="0" name="mode" type="int" enum="Input.MouseMode">
+ <argument index="0" name="mode" type="int" enum="InputFilter.MouseMode">
</argument>
<description>
Sets the mouse mode. See the constants for more information.
diff --git a/doc/classes/InterpolatedCamera.xml b/doc/classes/InterpolatedCamera.xml
deleted file mode 100644
index 66df7e9531..0000000000
--- a/doc/classes/InterpolatedCamera.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="InterpolatedCamera" inherits="Camera" version="4.0">
- <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>
- <methods>
- <method name="set_target">
- <return type="void">
- </return>
- <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" default="false">
- 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" default="1.0">
- 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" default="NodePath(&quot;&quot;)">
- The target's [NodePath].
- </member>
- </members>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/Joint.xml b/doc/classes/Joint3D.xml
index 34da997292..15bef960f6 100644
--- a/doc/classes/Joint.xml
+++ b/doc/classes/Joint3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Joint" inherits="Spatial" version="4.0">
+<class name="Joint3D" inherits="Node3D" version="4.0">
<brief_description>
Base class for all 3D joints.
</brief_description>
diff --git a/doc/classes/KinematicBody.xml b/doc/classes/KinematicBody3D.xml
index 4ccbc679bf..5f9b36f97d 100644
--- a/doc/classes/KinematicBody.xml
+++ b/doc/classes/KinematicBody3D.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicBody" inherits="PhysicsBody" version="4.0">
+<class name="KinematicBody3D" inherits="PhysicsBody3D" version="4.0">
<brief_description>
Kinematic body 3D node.
</brief_description>
<description>
Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all; to other types of bodies, such as a character or a rigid body, these are the same as a static body. However, they have two main uses:
[b]Simulated motion:[/b] When these bodies are moved manually, either from code or from an [AnimationPlayer] (with [member AnimationPlayer.playback_process_mode] set to "physics"), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
- [b]Kinematic characters:[/b] 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.
+ [b]Kinematic characters:[/b] KinematicBody3D also has an API for moving objects (the [method move_and_collide] and [method move_and_slide] methods) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/kinematic_character_2d.html</link>
@@ -15,7 +15,7 @@
<method name="get_axis_lock" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<description>
Returns [code]true[/code] if the specified [code]axis[/code] is locked. See also [member move_lock_x], [member move_lock_y] and [member move_lock_z].
@@ -36,12 +36,12 @@
</description>
</method>
<method name="get_slide_collision">
- <return type="KinematicCollision">
+ <return type="KinematicCollision3D">
</return>
<argument index="0" name="slide_idx" type="int">
</argument>
<description>
- Returns a [KinematicCollision], which contains information about a collision that occurred during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1).
+ Returns a [KinematicCollision3D], which contains information about a collision that occurred during the last [method move_and_slide] call. Since the body can collide several times in a single call to [method move_and_slide], you must specify the index of the collision in the range 0 to ([method get_slide_count] - 1).
</description>
</method>
<method name="get_slide_count" qualifiers="const">
@@ -73,7 +73,7 @@
</description>
</method>
<method name="move_and_collide">
- <return type="KinematicCollision">
+ <return type="KinematicCollision3D">
</return>
<argument index="0" name="rel_vec" type="Vector3">
</argument>
@@ -84,7 +84,7 @@
<argument index="3" name="test_only" type="bool" default="false">
</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.
+ Moves the body along the vector [code]rel_vec[/code]. The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision.
If [code]test_only[/code] is [code]true[/code], the body does not move but the would-be collision information is given.
</description>
</method>
@@ -104,14 +104,14 @@
<argument index="5" name="infinite_inertia" type="bool" default="true">
</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 [KinematicBody] 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.
+ 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 [KinematicBody3D] or [RigidBody3D], 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.
This method should be used in [method Node._physics_process] (or in a method called by [method Node._physics_process]), as it uses the physics step's [code]delta[/code] value automatically in calculations. Otherwise, the simulation will run at an incorrect speed.
[code]linear_velocity[/code] is the velocity vector (typically meters per second). Unlike in [method move_and_collide], you should [i]not[/i] multiply it by [code]delta[/code] — the physics engine handles applying the velocity.
[code]up_direction[/code] is the up direction, used to determine what is a wall and what is a floor or a ceiling. If set to the default value of [code]Vector3(0, 0, 0)[/code], everything is considered a wall.
If [code]stop_on_slope[/code] is [code]true[/code], body will not slide on slopes if you include gravity in [code]linear_velocity[/code].
If the body collides, it will change direction a maximum of [code]max_slides[/code] times before it stops.
[code]floor_max_angle[/code] is the maximum angle (in radians) where a slope is still considered a floor (or a ceiling), rather than a wall. The default value equals 45 degrees.
- If [code]infinite_inertia[/code] is [code]true[/code], body will be able to push [RigidBody] nodes, but it won't also detect any collisions with them. If [code]false[/code], it will interact with [RigidBody] nodes like with [StaticBody].
+ If [code]infinite_inertia[/code] is [code]true[/code], body will be able to push [RigidBody3D] nodes, but it won't also detect any collisions with them. If [code]false[/code], it will interact with [RigidBody3D] nodes like with [StaticBody3D].
Returns the [code]linear_velocity[/code] vector, rotated and/or scaled if a slide collision occurred. To get detailed information about collisions that occurred, use [method get_slide_collision].
</description>
</method>
@@ -140,7 +140,7 @@
<method name="set_axis_lock">
<return type="void">
</return>
- <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<argument index="1" name="lock" type="bool">
</argument>
diff --git a/doc/classes/KinematicCollision.xml b/doc/classes/KinematicCollision3D.xml
index 858a1e69c0..f3248a9ca1 100644
--- a/doc/classes/KinematicCollision.xml
+++ b/doc/classes/KinematicCollision3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="KinematicCollision" inherits="Reference" version="4.0">
+<class name="KinematicCollision3D" inherits="Reference" version="4.0">
<brief_description>
- Collision data for [KinematicBody] collisions.
+ Collision data for [KinematicBody3D] collisions.
</brief_description>
<description>
- Contains collision data for [KinematicBody] collisions. When a [KinematicBody] is moved using [method KinematicBody.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision object is returned.
+ Contains collision data for [KinematicBody3D] collisions. When a [KinematicBody3D] is moved using [method KinematicBody3D.move_and_collide], it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision3D object is returned.
This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
</description>
<tutorials>
@@ -25,7 +25,7 @@
The colliding body's shape.
</member>
<member name="collider_shape_index" type="int" setter="" getter="get_collider_shape_index" default="0">
- The colliding shape's index. See [CollisionObject].
+ The colliding shape's index. See [CollisionObject3D].
</member>
<member name="collider_velocity" type="Vector3" setter="" getter="get_collider_velocity" default="Vector3( 0, 0, 0 )">
The colliding object's velocity.
diff --git a/doc/classes/Light.xml b/doc/classes/Light3D.xml
index a2867a50d2..4e48a24951 100644
--- a/doc/classes/Light.xml
+++ b/doc/classes/Light3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Light" inherits="VisualInstance" version="4.0">
+<class name="Light3D" inherits="VisualInstance3D" version="4.0">
<brief_description>
Provides a base class for different kinds of light nodes.
</brief_description>
<description>
- 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.
+ Light3D 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. Light3D contains the common variables and parameters used for lighting.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link>
@@ -13,21 +13,21 @@
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="Light.Param">
+ <argument index="0" name="param" type="int" enum="Light3D.Param">
</argument>
<description>
- Returns the value of the specified [enum Light.Param] parameter.
+ Returns the value of the specified [enum Light3D.Param] parameter.
</description>
</method>
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="Light.Param">
+ <argument index="0" name="param" type="int" enum="Light3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
<description>
- Sets the value of the specified [enum Light.Param] parameter.
+ Sets the value of the specified [enum Light3D.Param] parameter.
</description>
</method>
</methods>
@@ -35,7 +35,7 @@
<member name="editor_only" type="bool" setter="set_editor_only" getter="is_editor_only" default="false">
If [code]true[/code], the light only appears in the editor and will not be visible at runtime.
</member>
- <member name="light_bake_mode" type="int" setter="set_bake_mode" getter="get_bake_mode" enum="Light.BakeMode" default="1">
+ <member name="light_bake_mode" type="int" setter="set_bake_mode" getter="get_bake_mode" enum="Light3D.BakeMode" default="1">
The light's bake mode. See [enum BakeMode].
</member>
<member name="light_color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
@@ -69,7 +69,7 @@
If [code]true[/code], the light will cast shadows.
</member>
<member name="shadow_reverse_cull_face" type="bool" setter="set_shadow_reverse_cull_face" getter="get_shadow_reverse_cull_face" default="false">
- If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with [constant GeometryInstance.SHADOW_CASTING_SETTING_DOUBLE_SIDED].
+ If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with [constant GeometryInstance3D.SHADOW_CASTING_SETTING_DOUBLE_SIDED].
</member>
</members>
<constants>
@@ -83,42 +83,42 @@
Constant for accessing [member light_specular].
</constant>
<constant name="PARAM_RANGE" value="3" enum="Param">
- Constant for accessing [member OmniLight.omni_range] or [member SpotLight.spot_range].
+ Constant for accessing [member OmniLight3D.omni_range] or [member SpotLight3D.spot_range].
</constant>
<constant name="PARAM_ATTENUATION" value="4" enum="Param">
- Constant for accessing [member OmniLight.omni_attenuation] or [member SpotLight.spot_attenuation].
+ Constant for accessing [member OmniLight3D.omni_attenuation] or [member SpotLight3D.spot_attenuation].
</constant>
<constant name="PARAM_SPOT_ANGLE" value="5" enum="Param">
- Constant for accessing [member SpotLight.spot_angle].
+ Constant for accessing [member SpotLight3D.spot_angle].
</constant>
<constant name="PARAM_SPOT_ATTENUATION" value="6" enum="Param">
- Constant for accessing [member SpotLight.spot_angle_attenuation].
+ Constant for accessing [member SpotLight3D.spot_angle_attenuation].
</constant>
<constant name="PARAM_CONTACT_SHADOW_SIZE" value="7" enum="Param">
Constant for accessing [member shadow_contact].
</constant>
<constant name="PARAM_SHADOW_MAX_DISTANCE" value="8" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_max_distance].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_max_distance].
</constant>
<constant name="PARAM_SHADOW_SPLIT_1_OFFSET" value="9" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_split_1].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_split_1].
</constant>
<constant name="PARAM_SHADOW_SPLIT_2_OFFSET" value="10" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_split_2].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_split_2].
</constant>
<constant name="PARAM_SHADOW_SPLIT_3_OFFSET" value="11" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_split_3].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_split_3].
</constant>
<constant name="PARAM_SHADOW_FADE_START" value="12" enum="Param">
</constant>
<constant name="PARAM_SHADOW_NORMAL_BIAS" value="13" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_normal_bias].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_normal_bias].
</constant>
<constant name="PARAM_SHADOW_BIAS" value="14" enum="Param">
Constant for accessing [member shadow_bias].
</constant>
<constant name="PARAM_SHADOW_BIAS_SPLIT_SCALE" value="15" enum="Param">
- Constant for accessing [member DirectionalLight.directional_shadow_bias_split_scale].
+ Constant for accessing [member DirectionalLight3D.directional_shadow_bias_split_scale].
</constant>
<constant name="PARAM_MAX" value="16" enum="Param">
Represents the size of the [enum Param] enum.
diff --git a/doc/classes/Listener.xml b/doc/classes/Listener3D.xml
index 72bbfa29d4..998ea757ff 100644
--- a/doc/classes/Listener.xml
+++ b/doc/classes/Listener3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Listener" inherits="Spatial" version="4.0">
+<class name="Listener3D" inherits="Node3D" version="4.0">
<brief_description>
Overrides the location sounds are heard from.
</brief_description>
<description>
- Once added to the scene tree and enabled using [method make_current], this node will override the location sounds are heard from. This can be used to listen from a location different from the [Camera].
+ Once added to the scene tree and enabled using [method make_current], this node will override the location sounds are heard from. This can be used to listen from a location different from the [Camera3D].
[b]Note:[/b] There is no 2D equivalent for this node yet.
</description>
<tutorials>
@@ -29,7 +29,7 @@
</return>
<description>
Returns [code]true[/code] if the listener was made current using [method make_current], [code]false[/code] otherwise.
- [b]Note:[/b] There may be more than one Listener marked as "current" in the scene tree, but only the one that was made current last will be used.
+ [b]Note:[/b] There may be more than one Listener3D marked as "current" in the scene tree, but only the one that was made current last will be used.
</description>
</method>
<method name="make_current">
diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml
index af71c30936..7bb478fce2 100644
--- a/doc/classes/MainLoop.xml
+++ b/doc/classes/MainLoop.xml
@@ -7,6 +7,7 @@
[MainLoop] is the abstract base class for a Godot project's game loop. It is inherited by [SceneTree], which is the default game loop implementation used in Godot projects, though it is also possible to write and use one's own [MainLoop] subclass instead of the scene tree.
Upon the application start, a [MainLoop] implementation must be provided to the OS; otherwise, the application will exit. This happens automatically (and a [SceneTree] is created) unless a main [Script] is provided from the command line (with e.g. [code]godot -s my_loop.gd[/code], which should then be a [MainLoop] implementation.
Here is an example script implementing a simple [MainLoop]:
+ [b]FIXME:[/b] No longer valid after DisplayServer split and Input refactoring.
[codeblock]
extends MainLoop
@@ -43,17 +44,6 @@
<tutorials>
</tutorials>
<methods>
- <method name="_drop_files" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="files" type="PackedStringArray">
- </argument>
- <argument index="1" name="from_screen" type="int">
- </argument>
- <description>
- Called when files are dragged from the OS file manager and dropped in the game window. The arguments are a list of file paths and the identifier of the screen where the drag originated.
- </description>
- </method>
<method name="_finalize" qualifiers="virtual">
<return type="void">
</return>
@@ -61,17 +51,6 @@
Called before the program exits.
</description>
</method>
- <method name="_global_menu_action" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="id" type="Variant">
- </argument>
- <argument index="1" name="meta" type="Variant">
- </argument>
- <description>
- Called when the user performs an action in the system global menu (e.g. the Mac OS menu bar).
- </description>
- </method>
<method name="_idle" qualifiers="virtual">
<return type="bool">
</return>
@@ -89,24 +68,6 @@
Called once during initialization.
</description>
</method>
- <method name="_input_event" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="event" type="InputEvent">
- </argument>
- <description>
- Called whenever an [InputEvent] is received by the main loop.
- </description>
- </method>
- <method name="_input_text" qualifiers="virtual">
- <return type="void">
- </return>
- <argument index="0" name="text" type="String">
- </argument>
- <description>
- Deprecated callback, does not do anything. Use [method _input_event] to parse text input. Will be removed in Godot 4.0.
- </description>
- </method>
<method name="_iteration" qualifiers="virtual">
<return type="bool">
</return>
@@ -140,24 +101,6 @@
Should not be called manually, override [method _initialize] instead. Will be removed in Godot 4.0.
</description>
</method>
- <method name="input_event">
- <return type="void">
- </return>
- <argument index="0" name="event" type="InputEvent">
- </argument>
- <description>
- Should not be called manually, override [method _input_event] instead. Will be removed in Godot 4.0.
- </description>
- </method>
- <method name="input_text">
- <return type="void">
- </return>
- <argument index="0" name="text" type="String">
- </argument>
- <description>
- Should not be called manually, override [method _input_text] instead. Will be removed in Godot 4.0.
- </description>
- </method>
<method name="iteration">
<return type="bool">
</return>
@@ -180,58 +123,30 @@
</signal>
</signals>
<constants>
- <constant name="NOTIFICATION_WM_MOUSE_ENTER" value="1002">
- Notification received from the OS when the mouse enters the game window.
- Implemented on desktop and web platforms.
- </constant>
- <constant name="NOTIFICATION_WM_MOUSE_EXIT" value="1003">
- Notification received from the OS when the mouse leaves the game window.
- Implemented on desktop and web platforms.
- </constant>
- <constant name="NOTIFICATION_WM_FOCUS_IN" value="1004">
- Notification received from the OS when the game window is focused.
- Implemented on all platforms.
- </constant>
- <constant name="NOTIFICATION_WM_FOCUS_OUT" value="1005">
- Notification received from the OS when the game window is unfocused.
- Implemented on all platforms.
- </constant>
- <constant name="NOTIFICATION_WM_QUIT_REQUEST" value="1006">
- Notification received from the OS when a quit request is sent (e.g. closing the window with a "Close" button or Alt+F4).
- Implemented on desktop platforms.
- </constant>
- <constant name="NOTIFICATION_WM_GO_BACK_REQUEST" value="1007">
- Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
- Specific to the Android platform.
- </constant>
- <constant name="NOTIFICATION_WM_UNFOCUS_REQUEST" value="1008">
- Notification received from the OS when an unfocus request is sent (e.g. another OS window wants to take the focus).
- No supported platforms currently send this notification.
- </constant>
- <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="1009">
+ <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="2009">
Notification received from the OS when the application is exceeding its allocated memory.
Specific to the iOS platform.
</constant>
- <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="1010">
+ <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010">
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_WM_ABOUT" value="1011">
+ <constant name="NOTIFICATION_WM_ABOUT" value="2011">
Notification received from the OS when a request for "About" information is sent.
Specific to the macOS platform.
</constant>
- <constant name="NOTIFICATION_CRASH" value="1012">
+ <constant name="NOTIFICATION_CRASH" value="2012">
Notification received from Godot's crash handler when the engine is about to crash.
Implemented on desktop platforms if the crash handler is enabled.
</constant>
- <constant name="NOTIFICATION_OS_IME_UPDATE" value="1013">
+ <constant name="NOTIFICATION_OS_IME_UPDATE" value="2013">
Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string).
Specific to the macOS platform.
</constant>
- <constant name="NOTIFICATION_APP_RESUMED" value="1014">
+ <constant name="NOTIFICATION_APP_RESUMED" value="2014">
Notification received from the OS when the app is resumed.
Specific to the Android platform.
</constant>
- <constant name="NOTIFICATION_APP_PAUSED" value="1015">
+ <constant name="NOTIFICATION_APP_PAUSED" value="2015">
Notification received from the OS when the app is paused.
Specific to the Android platform.
</constant>
diff --git a/doc/classes/Material.xml b/doc/classes/Material.xml
index a0c1979646..a37c8127f0 100644
--- a/doc/classes/Material.xml
+++ b/doc/classes/Material.xml
@@ -4,7 +4,7 @@
Abstract base [Resource] for coloring and shading geometry.
</brief_description>
<description>
- Material is a base [Resource] used for coloring and shading geometry. All materials inherit from it and almost all [VisualInstance] derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here.
+ Material is a base [Resource] used for coloring and shading geometry. All materials inherit from it and almost all [VisualInstance3D] derived nodes carry a Material. A few flags and parameters are shared between all material types and are configured here.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml
index 6ec9d60df4..316315f777 100644
--- a/doc/classes/MenuButton.xml
+++ b/doc/classes/MenuButton.xml
@@ -38,9 +38,9 @@
<member name="toggle_mode" type="bool" setter="set_toggle_mode" getter="is_toggle_mode" override="true" default="true" />
</members>
<signals>
- <signal name="about_to_show">
+ <signal name="about_to_popup">
<description>
- Emitted when [PopupMenu] of this MenuButton is about to show.
+ Emitted when the [PopupMenu] of this MenuButton is about to show.
</description>
</signal>
</signals>
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index dc7ffc8934..6958c815a6 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -10,10 +10,10 @@
</tutorials>
<methods>
<method name="create_convex_shape" qualifiers="const">
- <return type="Shape">
+ <return type="Shape3D">
</return>
<description>
- Calculate a [ConvexPolygonShape] from the mesh.
+ Calculate a [ConvexPolygonShape3D] from the mesh.
</description>
</method>
<method name="create_outline" qualifiers="const">
@@ -27,10 +27,10 @@
</description>
</method>
<method name="create_trimesh_shape" qualifiers="const">
- <return type="Shape">
+ <return type="Shape3D">
</return>
<description>
- Calculate a [ConcavePolygonShape] from the mesh.
+ Calculate a [ConcavePolygonShape3D] from the mesh.
</description>
</method>
<method name="generate_triangle_mesh" qualifiers="const">
diff --git a/doc/classes/MeshInstance.xml b/doc/classes/MeshInstance.xml
deleted file mode 100644
index 6123dfa37a..0000000000
--- a/doc/classes/MeshInstance.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MeshInstance" inherits="GeometryInstance" version="4.0">
- <brief_description>
- Node that instances meshes into a scenario.
- </brief_description>
- <description>
- MeshInstance is a node that takes a [Mesh] resource and adds it to the current scenario by creating an instance of it. This is the class most often used to get 3D geometry rendered and can be used to instance a single [Mesh] in many places. This allows to reuse geometry and save on resources. When a [Mesh] has to be instanced more than thousands of times at close proximity, consider using a [MultiMesh] in a [MultiMeshInstance] instead.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="create_convex_collision">
- <return type="void">
- </return>
- <description>
- This helper creates a [StaticBody] child node with a [ConvexPolygonShape] collision shape calculated from the mesh geometry. It's mainly used for testing.
- </description>
- </method>
- <method name="create_debug_tangents">
- <return type="void">
- </return>
- <description>
- This helper creates a [MeshInstance] child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing.
- </description>
- </method>
- <method name="create_trimesh_collision">
- <return type="void">
- </return>
- <description>
- This helper creates a [StaticBody] child node with a [ConcavePolygonShape] collision shape calculated from the mesh geometry. It's mainly used for testing.
- </description>
- </method>
- <method name="get_surface_material" qualifiers="const">
- <return type="Material">
- </return>
- <argument index="0" name="surface" type="int">
- </argument>
- <description>
- Returns the [Material] for a surface of the [Mesh] resource.
- </description>
- </method>
- <method name="get_surface_material_count" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the number of surface materials.
- </description>
- </method>
- <method name="set_surface_material">
- <return type="void">
- </return>
- <argument index="0" name="surface" type="int">
- </argument>
- <argument index="1" name="material" type="Material">
- </argument>
- <description>
- Sets the [Material] for a surface of the [Mesh] resource.
- </description>
- </method>
- </methods>
- <members>
- <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
- The [Mesh] resource for the instance.
- </member>
- <member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath(&quot;..&quot;)">
- [NodePath] to the [Skeleton] associated with the instance.
- </member>
- <member name="skin" type="Skin" setter="set_skin" getter="get_skin">
- Sets the skin to be used by this instance.
- </member>
- </members>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/MeshInstance2D.xml b/doc/classes/MeshInstance2D.xml
index 2781dd4626..0cfc8deb0a 100644
--- a/doc/classes/MeshInstance2D.xml
+++ b/doc/classes/MeshInstance2D.xml
@@ -4,7 +4,7 @@
Node used for displaying a [Mesh] in 2D.
</brief_description>
<description>
- Node used for displaying a [Mesh] in 2D. Can be constructed from an existing [Sprite] via a tool in the editor toolbar. Select "Sprite" then "Convert to Mesh2D", select settings in popup and press "Create Mesh2D".
+ Node used for displaying a [Mesh] in 2D. Can be constructed from an existing [Sprite2D] via a tool in the editor toolbar. Select "Sprite2D" then "Convert to Mesh2D", select settings in popup and press "Create Mesh2D".
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/2d/2d_meshes.html</link>
diff --git a/doc/classes/MeshInstance3D.xml b/doc/classes/MeshInstance3D.xml
new file mode 100644
index 0000000000..c569da2df1
--- /dev/null
+++ b/doc/classes/MeshInstance3D.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MeshInstance3D" inherits="GeometryInstance3D" version="4.0">
+ <brief_description>
+ Node that instances meshes into a scenario.
+ </brief_description>
+ <description>
+ MeshInstance3D is a node that takes a [Mesh] resource and adds it to the current scenario by creating an instance of it. This is the class most often used render 3D geometry and can be used to instance a single [Mesh] in many places. This allows reuse of geometry which can save on resources. When a [Mesh] has to be instanced more than thousands of times at close proximity, consider using a [MultiMesh] in a [MultiMeshInstance3D] instead.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="create_convex_collision">
+ <return type="void">
+ </return>
+ <description>
+ This helper creates a [StaticBody3D] child node with a [ConvexPolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing.
+ </description>
+ </method>
+ <method name="create_debug_tangents">
+ <return type="void">
+ </return>
+ <description>
+ This helper creates a [MeshInstance3D] child node with gizmos at every vertex calculated from the mesh geometry. It's mainly used for testing.
+ </description>
+ </method>
+ <method name="create_trimesh_collision">
+ <return type="void">
+ </return>
+ <description>
+ This helper creates a [StaticBody3D] child node with a [ConcavePolygonShape3D] collision shape calculated from the mesh geometry. It's mainly used for testing.
+ </description>
+ </method>
+ <method name="get_active_material" qualifiers="const">
+ <return type="Material">
+ </return>
+ <argument index="0" name="surface" type="int">
+ </argument>
+ <description>
+ Returns the [Material] that will be used by the [Mesh] when drawing. This can return the [member GeometryInstance3D.material_override], the surface override [Material] defined in this [MeshInstance3D], or the surface [Material] defined in the [Mesh]. For example, if [member GeometryInstance3D.material_override] is used, all surfaces will return the override material.
+ </description>
+ </method>
+ <method name="get_surface_material" qualifiers="const">
+ <return type="Material">
+ </return>
+ <argument index="0" name="surface" type="int">
+ </argument>
+ <description>
+ Returns the override [Material] for the specified surface of the [Mesh] resource.
+ </description>
+ </method>
+ <method name="get_surface_material_count" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the number of surface materials.
+ </description>
+ </method>
+ <method name="set_surface_material">
+ <return type="void">
+ </return>
+ <argument index="0" name="surface" type="int">
+ </argument>
+ <argument index="1" name="material" type="Material">
+ </argument>
+ <description>
+ Sets the override [Material] for the specified surface of the [Mesh] resource. This material is associated with this [MeshInstance3D] rather than with the [Mesh] resource.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="mesh" type="Mesh" setter="set_mesh" getter="get_mesh">
+ The [Mesh] resource for the instance.
+ </member>
+ <member name="skeleton" type="NodePath" setter="set_skeleton_path" getter="get_skeleton_path" default="NodePath(&quot;..&quot;)">
+ [NodePath] to the [Skeleton3D] associated with the instance.
+ </member>
+ <member name="skin" type="Skin" setter="set_skin" getter="get_skin">
+ Sets the skin to be used by this instance.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml
index a96f6d7231..ccf6172017 100644
--- a/doc/classes/MeshLibrary.xml
+++ b/doc/classes/MeshLibrary.xml
@@ -94,7 +94,7 @@
</argument>
<description>
Returns an item's collision shapes.
- The array consists of each [Shape] followed by its [Transform].
+ The array consists of each [Shape3D] followed by its [Transform].
</description>
</method>
<method name="get_last_unused_item_id" qualifiers="const">
@@ -178,7 +178,7 @@
</argument>
<description>
Sets an item's collision shapes.
- The array should consist of [Shape] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY].
+ The array should consist of [Shape3D] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY].
</description>
</method>
</methods>
diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml
index 2a1d270990..0f56ab4b95 100644
--- a/doc/classes/MultiMesh.xml
+++ b/doc/classes/MultiMesh.xml
@@ -4,7 +4,7 @@
Provides high-performance mesh instancing.
</brief_description>
<description>
- MultiMesh provides low-level mesh instancing. Drawing thousands of [MeshInstance] nodes can be slow, since each object is submitted to the GPU then drawn individually.
+ MultiMesh provides low-level mesh instancing. Drawing thousands of [MeshInstance3D] nodes can be slow, since each object is submitted to the GPU then drawn individually.
MultiMesh is much faster as it can draw thousands of instances with a single draw call, resulting in less API overhead.
As a drawback, if the instances are too far away of each other, performance may be reduced as every single instance will always rendered (they are spatially indexed as one, for the whole object).
Since instances may have any behavior, the AABB used for visibility must be provided by the user.
diff --git a/doc/classes/MultiMeshInstance2D.xml b/doc/classes/MultiMeshInstance2D.xml
index 2fe5447a27..07f21514ef 100644
--- a/doc/classes/MultiMeshInstance2D.xml
+++ b/doc/classes/MultiMeshInstance2D.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
[MultiMeshInstance2D] is a specialized node to instance a [MultiMesh] resource in 2D.
- Usage is the same as [MultiMeshInstance].
+ Usage is the same as [MultiMeshInstance3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/MultiMeshInstance.xml b/doc/classes/MultiMeshInstance3D.xml
index 6cbc0a8e04..cab17c952e 100644
--- a/doc/classes/MultiMeshInstance.xml
+++ b/doc/classes/MultiMeshInstance3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiMeshInstance" inherits="GeometryInstance" version="4.0">
+<class name="MultiMeshInstance3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
Node that instances a [MultiMesh].
</brief_description>
<description>
- [MultiMeshInstance] is a specialized node to instance [GeometryInstance]s based on a [MultiMesh] resource.
+ [MultiMeshInstance3D] is a specialized node to instance [GeometryInstance3D]s based on a [MultiMesh] resource.
This is useful to optimize the rendering of a high amount of instances of a given mesh (for example trees in a forest or grass strands).
</description>
<tutorials>
@@ -16,7 +16,7 @@
</methods>
<members>
<member name="multimesh" type="MultiMesh" setter="set_multimesh" getter="get_multimesh">
- The [MultiMesh] resource that will be used and shared among all instances of the [MultiMeshInstance].
+ The [MultiMesh] resource that will be used and shared among all instances of the [MultiMeshInstance3D].
</member>
</members>
<constants>
diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation3D.xml
index 93170bca4a..807f0ad309 100644
--- a/doc/classes/Navigation.xml
+++ b/doc/classes/Navigation3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Navigation" inherits="Spatial" version="4.0">
+<class name="Navigation3D" inherits="Node3D" version="4.0">
<brief_description>
Mesh-based navigation and pathfinding node.
</brief_description>
<description>
- Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
+ Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion3D] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/NavigationAgent.xml b/doc/classes/NavigationAgent3D.xml
index c6c9abec13..f9df1d390b 100644
--- a/doc/classes/NavigationAgent.xml
+++ b/doc/classes/NavigationAgent3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationAgent" inherits="Node" version="4.0">
+<class name="NavigationAgent3D" inherits="Node" version="4.0">
<brief_description>
3D Agent used in navigation for collision avoidance.
</brief_description>
<description>
- 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation] node, or using [method set_navigation]. [NavigationAgent] is physics safe.
+ 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. This can be done by having the agent as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationAgent3D] is physics safe.
</description>
<tutorials>
</tutorials>
@@ -41,7 +41,7 @@
<return type="Node">
</return>
<description>
- Returns the [Navigation] node that the agent is using for its navigation system.
+ Returns the [Navigation3D] node that the agent is using for its navigation system.
</description>
</method>
<method name="get_next_location">
@@ -85,7 +85,7 @@
<argument index="0" name="navigation" type="Node">
</argument>
<description>
- Sets the [Navigation] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation] node.
+ Sets the [Navigation3D] node used by the agent. Useful when you don't want to make the agent a child of a [Navigation3D] node.
</description>
</method>
<method name="set_target_location">
diff --git a/doc/classes/NavigationObstacle2D.xml b/doc/classes/NavigationObstacle2D.xml
index 4d12b985e0..ddd96975f1 100644
--- a/doc/classes/NavigationObstacle2D.xml
+++ b/doc/classes/NavigationObstacle2D.xml
@@ -4,7 +4,7 @@
2D Obstacle used in navigation for collision avoidance.
</brief_description>
<description>
- 2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle] is physics safe.
+ 2D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation2D] node, or using [method set_navigation]. [NavigationObstacle2D] is physics safe.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/NavigationObstacle.xml b/doc/classes/NavigationObstacle3D.xml
index 31cf01793a..e01a40ed73 100644
--- a/doc/classes/NavigationObstacle.xml
+++ b/doc/classes/NavigationObstacle3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationObstacle" inherits="Node" version="4.0">
+<class name="NavigationObstacle3D" inherits="Node" version="4.0">
<brief_description>
3D Obstacle used in navigation for collision avoidance.
</brief_description>
<description>
- 3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation] node, or using [method set_navigation]. [NavigationObstacle] is physics safe.
+ 3D Obstacle used in navigation for collision avoidance. The obstacle needs navigation data to work correctly. This can be done by having the obstacle as a child of a [Navigation3D] node, or using [method set_navigation]. [NavigationObstacle3D] is physics safe.
</description>
<tutorials>
</tutorials>
@@ -13,7 +13,7 @@
<return type="Node">
</return>
<description>
- Returns the [Navigation] node that the obstacle is using for its navigation system.
+ Returns the [Navigation3D] node that the obstacle is using for its navigation system.
</description>
</method>
<method name="set_navigation">
@@ -22,7 +22,7 @@
<argument index="0" name="navigation" type="Node">
</argument>
<description>
- Sets the [Navigation] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation] node.
+ Sets the [Navigation3D] node used by the obstacle. Useful when you don't want to make the obstacle a child of a [Navigation3D] node.
</description>
</method>
</methods>
diff --git a/doc/classes/NavigationRegion.xml b/doc/classes/NavigationRegion3D.xml
index a32ded2878..b70bfb6596 100644
--- a/doc/classes/NavigationRegion.xml
+++ b/doc/classes/NavigationRegion3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationRegion" inherits="Spatial" version="4.0">
+<class name="NavigationRegion3D" inherits="Node3D" version="4.0">
<brief_description>
A region of the navigation map.
</brief_description>
<description>
- A region of the navigation map. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node (even not a direct child).
+ A region of the navigation map. It tells the [Navigation3D] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation3D] node (even not a direct child).
</description>
<tutorials>
</tutorials>
@@ -19,7 +19,7 @@
</methods>
<members>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
- Determines if the [NavigationRegion] is enabled or disabled.
+ Determines if the [NavigationRegion3D] is enabled or disabled.
</member>
<member name="navmesh" type="NavigationMesh" setter="set_navigation_mesh" getter="get_navigation_mesh">
The [NavigationMesh] resource to use.
diff --git a/doc/classes/Navigation2DServer.xml b/doc/classes/NavigationServer2D.xml
index 110844c492..1b9099336c 100644
--- a/doc/classes/Navigation2DServer.xml
+++ b/doc/classes/NavigationServer2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Navigation2DServer" inherits="Object" version="4.0">
+<class name="NavigationServer2D" inherits="Object" version="4.0">
<brief_description>
Server interface for low-level 2D navigation access
</brief_description>
<description>
- Navigation2DServer is the server responsible for all 2D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
+ NavigationServer2D is the server responsible for all 2D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/NavigationServer.xml b/doc/classes/NavigationServer3D.xml
index 1b534b8458..1f621c3c81 100644
--- a/doc/classes/NavigationServer.xml
+++ b/doc/classes/NavigationServer3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="NavigationServer" inherits="Object" version="4.0">
+<class name="NavigationServer3D" inherits="Object" version="4.0">
<brief_description>
Server interface for low-level 3D navigation access
</brief_description>
<description>
- NavigationServer is the server responsible for all 3D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
+ NavigationServer3D is the server responsible for all 3D navigation. It creates the agents, maps, and regions for navigation to work as expected. This keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 717130728d..d7bff83575 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -53,7 +53,7 @@
<description>
Called when there is an input event. The input event propagates up 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.
+ To consume the input event and stop it propagating further to other nodes, [method Viewport.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>
@@ -97,7 +97,7 @@
<description>
Called when an [InputEvent] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it.
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.
+ To consume the input event and stop it propagating further to other nodes, [method Viewport.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>
@@ -109,7 +109,7 @@
<description>
Called when an [InputEventKey] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it.
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.
+ To consume the input event and stop it propagating further to other nodes, [method Viewport.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>
@@ -938,42 +938,40 @@
Notification received from the OS when the game window is unfocused.
Implemented on all platforms.
</constant>
- <constant name="NOTIFICATION_WM_QUIT_REQUEST" value="1006">
- Notification received from the OS when a quit request is sent (e.g. closing the window with a "Close" button or Alt+F4).
+ <constant name="NOTIFICATION_WM_CLOSE_REQUEST" value="1006">
+ Notification received from the OS when a close request is sent (e.g. closing the window with a "Close" button or Alt+F4).
Implemented on desktop platforms.
</constant>
<constant name="NOTIFICATION_WM_GO_BACK_REQUEST" value="1007">
Notification received from the OS when a go back request is sent (e.g. pressing the "Back" button on Android).
Specific to the Android platform.
</constant>
- <constant name="NOTIFICATION_WM_UNFOCUS_REQUEST" value="1008">
- Notification received from the OS when an unfocus request is sent (e.g. another OS window wants to take the focus).
- No supported platforms currently send this notification.
+ <constant name="NOTIFICATION_WM_SIZE_CHANGED" value="1008">
</constant>
- <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="1009">
+ <constant name="NOTIFICATION_OS_MEMORY_WARNING" value="2009">
Notification received from the OS when the application is exceeding its allocated memory.
Specific to the iOS platform.
</constant>
- <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="1010">
+ <constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010">
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_WM_ABOUT" value="1011">
+ <constant name="NOTIFICATION_WM_ABOUT" value="2011">
Notification received from the OS when a request for "About" information is sent.
Specific to the macOS platform.
</constant>
- <constant name="NOTIFICATION_CRASH" value="1012">
+ <constant name="NOTIFICATION_CRASH" value="2012">
Notification received from Godot's crash handler when the engine is about to crash.
Implemented on desktop platforms if the crash handler is enabled.
</constant>
- <constant name="NOTIFICATION_OS_IME_UPDATE" value="1013">
+ <constant name="NOTIFICATION_OS_IME_UPDATE" value="2013">
Notification received from the OS when an update of the Input Method Engine occurs (e.g. change of IME cursor position or composition string).
Specific to the macOS platform.
</constant>
- <constant name="NOTIFICATION_APP_RESUMED" value="1014">
+ <constant name="NOTIFICATION_APP_RESUMED" value="2014">
Notification received from the OS when the app is resumed.
Specific to the Android platform.
</constant>
- <constant name="NOTIFICATION_APP_PAUSED" value="1015">
+ <constant name="NOTIFICATION_APP_PAUSED" value="2015">
Notification received from the OS when the app is paused.
Specific to the Android platform.
</constant>
diff --git a/doc/classes/Spatial.xml b/doc/classes/Node3D.xml
index d057db8519..ef24f638fb 100644
--- a/doc/classes/Spatial.xml
+++ b/doc/classes/Node3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Spatial" inherits="Node" version="4.0">
+<class name="Node3D" inherits="Node" version="4.0">
<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.
+ Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Node3D. Use [Node3D] 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 [Node3D] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Node3D]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Node3D] object itself is referred to as object-local coordinate system.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/3d/introduction_to_3d.html</link>
@@ -19,17 +19,17 @@
</description>
</method>
<method name="get_parent_spatial" qualifiers="const">
- <return type="Spatial">
+ <return type="Node3D">
</return>
<description>
- Returns the parent [Spatial], or an empty [Object] if no parent exists or parent is not of type [Spatial].
+ Returns the parent [Node3D], or an empty [Object] if no parent exists or parent is not of type [Node3D].
</description>
</method>
<method name="get_world" qualifiers="const">
- <return type="World">
+ <return type="World3D">
</return>
<description>
- Returns the current [World] resource this [Spatial] node is registered to.
+ Returns the current [World3D] resource this [Node3D] node is registered to.
</description>
</method>
<method name="global_rotate">
@@ -72,7 +72,7 @@
<return type="bool">
</return>
<description>
- Returns whether node notifies about its local transformation changes. [Spatial] will not propagate this by default.
+ Returns whether node notifies about its local transformation changes. [Node3D] will not propagate this by default.
</description>
</method>
<method name="is_scale_disabled" qualifiers="const">
@@ -93,7 +93,7 @@
<return type="bool">
</return>
<description>
- Returns whether the node notifies about its global and local transformation changes. [Spatial] will not propagate this by default.
+ Returns whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default.
</description>
</method>
<method name="is_visible_in_tree" qualifiers="const">
@@ -234,7 +234,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Sets whether the node notifies about its local transformation changes. [Spatial] will not propagate this by default.
+ Sets whether the node notifies about its local transformation changes. [Node3D] will not propagate this by default.
</description>
</method>
<method name="set_notify_transform">
@@ -243,7 +243,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Sets whether the node notifies about its global and local transformation changes. [Spatial] will not propagate this by default.
+ Sets whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default.
</description>
</method>
<method name="show">
@@ -294,16 +294,16 @@
<return type="void">
</return>
<description>
- Updates the [SpatialGizmo] of this node.
+ Updates the [Node3DGizmo] of this node.
</description>
</method>
</methods>
<members>
- <member name="gizmo" type="SpatialGizmo" setter="set_gizmo" getter="get_gizmo">
- The [SpatialGizmo] for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor.
+ <member name="gizmo" type="Node3DGizmo" setter="set_gizmo" getter="get_gizmo">
+ The [Node3DGizmo] for this node. Used for example in [EditorNode3DGizmo] as custom visualization and editing handles in Editor.
</member>
<member name="global_transform" type="Transform" setter="set_global_transform" getter="get_global_transform">
- World space (global) [Transform] of this node.
+ World3D space (global) [Transform] of this node.
</member>
<member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation">
Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).
@@ -334,17 +334,17 @@
</signals>
<constants>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000">
- Spatial nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform.
+ Node3D nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform.
In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform].
</constant>
<constant name="NOTIFICATION_ENTER_WORLD" value="41">
- Spatial nodes receives this notification when they are registered to new [World] resource.
+ Node3D nodes receives this notification when they are registered to new [World3D] resource.
</constant>
<constant name="NOTIFICATION_EXIT_WORLD" value="42">
- Spatial nodes receives this notification when they are unregistered from current [World] resource.
+ Node3D nodes receives this notification when they are unregistered from current [World3D] resource.
</constant>
<constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43">
- Spatial nodes receives this notification when their visibility changes.
+ Node3D nodes receives this notification when their visibility changes.
</constant>
</constants>
</class>
diff --git a/doc/classes/SpatialGizmo.xml b/doc/classes/Node3DGizmo.xml
index 5260eaa8a3..55080614fc 100644
--- a/doc/classes/SpatialGizmo.xml
+++ b/doc/classes/Node3DGizmo.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpatialGizmo" inherits="Reference" version="4.0">
+<class name="Node3DGizmo" inherits="Reference" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml
index e8ab3e536e..dc7fd1be3f 100644
--- a/doc/classes/NodePath.xml
+++ b/doc/classes/NodePath.xml
@@ -4,7 +4,7 @@
Pre-parsed scene tree path.
</brief_description>
<description>
- A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite:texture:size"[/code] would refer to the [code]size[/code] property of the [code]texture[/code] resource on the node named [code]"Sprite"[/code] which is a child of the other named nodes in the path.
+ A pre-parsed relative or absolute path in a scene tree, for use with [method Node.get_node] and similar functions. It can reference a node, a resource within a node, or a property of a node or resource. For instance, [code]"Path2D/PathFollow2D/Sprite2D:texture:size"[/code] would refer to the [code]size[/code] property of the [code]texture[/code] resource on the node named [code]"Sprite2D"[/code] which is a child of the other named nodes in the path.
You will usually just pass a string to [method Node.get_node] and it will be automatically converted, but you may occasionally want to parse a path ahead of time with [NodePath] or the literal syntax [code]@"path"[/code]. Exporting a [NodePath] variable will give you a node selection widget in the properties panel of the editor, which can often be useful.
A [NodePath] is composed of a list of slash-separated node names (like a filesystem path) and an optional colon-separated list of "subnames" which can be resources or properties.
Some examples of NodePaths include the following:
@@ -30,20 +30,20 @@
<argument index="0" name="from" type="String">
</argument>
<description>
- Creates a NodePath from a string, e.g. [code]"Path2D/PathFollow2D/Sprite:texture:size"[/code]. A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, [code]"."[/code] and [code]".."[/code] indicate the current node and its parent.
+ Creates a NodePath from a string, e.g. [code]"Path2D/PathFollow2D/Sprite2D:texture:size"[/code]. A path is absolute if it starts with a slash. Absolute paths are only valid in the global scene tree, not within individual scenes. In a relative path, [code]"."[/code] and [code]".."[/code] indicate the current node and its parent.
The "subnames" optionally included after the path to the target node can point to resources or properties, and can also be nested.
Examples of valid NodePaths (assuming that those nodes exist and have the referenced resources or properties):
[codeblock]
- # Points to the Sprite node
- "Path2D/PathFollow2D/Sprite"
- # Points to the Sprite node and its "texture" resource.
- # get_node() would retrieve "Sprite", while get_node_and_resource()
- # would retrieve both the Sprite node and the "texture" resource.
- "Path2D/PathFollow2D/Sprite:texture"
- # Points to the Sprite node and its "position" property.
- "Path2D/PathFollow2D/Sprite:position"
- # Points to the Sprite node and the "x" component of its "position" property.
- "Path2D/PathFollow2D/Sprite:position:x"
+ # Points to the Sprite2D node
+ "Path2D/PathFollow2D/Sprite2D"
+ # Points to the Sprite2D node and its "texture" resource.
+ # get_node() would retrieve "Sprite2D", while get_node_and_resource()
+ # would retrieve both the Sprite2D node and the "texture" resource.
+ "Path2D/PathFollow2D/Sprite2D:texture"
+ # Points to the Sprite2D node and its "position" property.
+ "Path2D/PathFollow2D/Sprite2D:position"
+ # Points to the Sprite2D node and the "x" component of its "position" property.
+ "Path2D/PathFollow2D/Sprite2D:position:x"
# Absolute path (from "root")
"/root/Level/Path2D"
[/codeblock]
@@ -69,7 +69,7 @@
<description>
Returns all subnames concatenated with a colon character ([code]:[/code]) as separator, i.e. the right side of the first colon in a node path.
[codeblock]
- var nodepath = NodePath("Path2D/PathFollow2D/Sprite:texture:load_path")
+ var nodepath = NodePath("Path2D/PathFollow2D/Sprite2D:texture:load_path")
print(nodepath.get_concatenated_subnames()) # texture:load_path
[/codeblock]
</description>
@@ -82,7 +82,7 @@
<description>
Gets the node name indicated by [code]idx[/code] (0 to [method get_name_count]).
[codeblock]
- var node_path = NodePath("Path2D/PathFollow2D/Sprite")
+ var node_path = NodePath("Path2D/PathFollow2D/Sprite2D")
print(node_path.get_name(0)) # Path2D
print(node_path.get_name(1)) # PathFollow2D
print(node_path.get_name(2)) # Sprite
@@ -94,7 +94,7 @@
</return>
<description>
Gets the number of node names which make up the path. Subnames (see [method get_subname_count]) are not included.
- For example, [code]"Path2D/PathFollow2D/Sprite"[/code] has 3 names.
+ For example, [code]"Path2D/PathFollow2D/Sprite2D"[/code] has 3 names.
</description>
</method>
<method name="get_subname">
@@ -105,7 +105,7 @@
<description>
Gets the resource or property name indicated by [code]idx[/code] (0 to [method get_subname_count]).
[codeblock]
- var node_path = NodePath("Path2D/PathFollow2D/Sprite:texture:load_path")
+ var node_path = NodePath("Path2D/PathFollow2D/Sprite2D:texture:load_path")
print(node_path.get_subname(0)) # texture
print(node_path.get_subname(1)) # load_path
[/codeblock]
@@ -116,7 +116,7 @@
</return>
<description>
Gets the number of resource or property names ("subnames") in the path. Each subname is listed after a colon character ([code]:[/code]) in the node path.
- For example, [code]"Path2D/PathFollow2D/Sprite:texture:load_path"[/code] has 2 subnames.
+ For example, [code]"Path2D/PathFollow2D/Sprite2D:texture:load_path"[/code] has 2 subnames.
</description>
</method>
<method name="is_absolute">
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index d43c395433..db79ee7765 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -9,24 +9,6 @@
<tutorials>
</tutorials>
<methods>
- <method name="alert">
- <return type="void">
- </return>
- <argument index="0" name="text" type="String">
- </argument>
- <argument index="1" name="title" type="String" default="&quot;Alert!&quot;">
- </argument>
- <description>
- Displays a modal dialog box using the host OS' facilities. Execution is blocked until the dialog is closed.
- </description>
- </method>
- <method name="can_draw" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the host OS allows drawing.
- </description>
- </method>
<method name="can_use_threads" qualifiers="const">
<return type="bool">
</return>
@@ -34,13 +16,6 @@
Returns [code]true[/code] if the current host platform is using multiple threads.
</description>
</method>
- <method name="center_window">
- <return type="void">
- </return>
- <description>
- Centers the window on the screen if in windowed mode.
- </description>
- </method>
<method name="close_midi_inputs">
<return type="void">
</return>
@@ -133,22 +108,6 @@
Returns the keycode 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="PackedStringArray">
</return>
@@ -165,13 +124,6 @@
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
- <method name="get_current_video_driver" qualifiers="const">
- <return type="int" enum="OS.VideoDriver">
- </return>
- <description>
- Returns the currently used video driver, using one of the values from [enum VideoDriver].
- </description>
- </method>
<method name="get_date" qualifiers="const">
<return type="Dictionary">
</return>
@@ -224,24 +176,6 @@
[b]Note:[/b] This method is implemented on Android.
</description>
</method>
- <method name="get_ime_selection" qualifiers="const">
- <return type="Vector2">
- </return>
- <description>
- Returns the IME cursor position (the currently-edited portion of the string) relative to the characters in the composition string.
- [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME cursor position.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
- <method name="get_ime_text" qualifiers="const">
- <return type="String">
- </return>
- <description>
- Returns the IME intermediate composition string.
- [constant MainLoop.NOTIFICATION_OS_IME_UPDATE] is sent to the application to notify it of changes to the IME composition string.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
<method name="get_keycode_string" qualifiers="const">
<return type="String">
</return>
@@ -252,15 +186,6 @@
See also [member InputEventKey.keycode] and [method InputEventKey.get_keycode_with_modifiers].
</description>
</method>
- <method name="get_latin_keyboard_variant" qualifiers="const">
- <return type="String">
- </return>
- <description>
- Returns the current latin keyboard variant as a String.
- Possible return values are: [code]"QWERTY"[/code], [code]"AZERTY"[/code], [code]"QZERTY"[/code], [code]"DVORAK"[/code], [code]"NEO"[/code], [code]"COLEMAK"[/code] or [code]"ERROR"[/code].
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows. Returns [code]"QWERTY"[/code] on unsupported platforms.
- </description>
- </method>
<method name="get_locale" qualifiers="const">
<return type="String">
</return>
@@ -298,57 +223,6 @@
Returns the number of threads available on the host machine.
</description>
</method>
- <method name="get_real_window_size" qualifiers="const">
- <return type="Vector2">
- </return>
- <description>
- Returns the window size including decorations like window borders.
- </description>
- </method>
- <method name="get_screen_count" qualifiers="const">
- <return type="int">
- </return>
- <description>
- Returns the number of displays attached to the host machine.
- </description>
- </method>
- <method name="get_screen_dpi" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="screen" type="int" default="-1">
- </argument>
- <description>
- Returns the dots per inch density of the specified screen. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used.
- On Android devices, the actual screen densities are grouped into six generalized densities:
- [codeblock]
- ldpi - 120 dpi
- mdpi - 160 dpi
- hdpi - 240 dpi
- xhdpi - 320 dpi
- xxhdpi - 480 dpi
- xxxhdpi - 640 dpi
- [/codeblock]
- [b]Note:[/b] This method is implemented on Android, Linux, macOS and Windows. Returns [code]72[/code] on unsupported platforms.
- </description>
- </method>
- <method name="get_screen_position" qualifiers="const">
- <return type="Vector2">
- </return>
- <argument index="0" name="screen" type="int" default="-1">
- </argument>
- <description>
- Returns the position of the specified screen by index. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used.
- </description>
- </method>
- <method name="get_screen_size" qualifiers="const">
- <return type="Vector2">
- </return>
- <argument index="0" name="screen" type="int" default="-1">
- </argument>
- <description>
- Returns the dimensions in pixels of the specified screen. If [code]screen[/code] is [/code]-1[/code] (the default value), the current screen will be used.
- </description>
- </method>
<method name="get_splash_tick_msec" qualifiers="const">
<return type="int">
</return>
@@ -461,84 +335,6 @@
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>
- Returns the number of video drivers supported on the current platform.
- </description>
- </method>
- <method name="get_video_driver_name" qualifiers="const">
- <return type="String">
- </return>
- <argument index="0" name="driver" type="int" enum="OS.VideoDriver">
- </argument>
- <description>
- Returns the name of the video driver matching the given [code]driver[/code] index. This index is a value from [enum VideoDriver], and you can use [method get_current_video_driver] to get the current backend's index.
- </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 if it is currently hidden.
- </description>
- </method>
- <method name="get_window_safe_area" qualifiers="const">
- <return type="Rect2">
- </return>
- <description>
- Returns unobscured area of the window where interactive controls should be rendered.
- </description>
- </method>
- <method name="global_menu_add_item">
- <return type="void">
- </return>
- <argument index="0" name="menu" type="String">
- </argument>
- <argument index="1" name="label" type="String">
- </argument>
- <argument index="2" name="id" type="Variant">
- </argument>
- <argument index="3" name="meta" type="Variant">
- </argument>
- <description>
- Add a new item with text "label" to global menu. Use "_dock" menu to add item to the macOS dock icon menu.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
- <method name="global_menu_add_separator">
- <return type="void">
- </return>
- <argument index="0" name="menu" type="String">
- </argument>
- <description>
- Add a separator between items. Separators also occupy an index.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
- <method name="global_menu_clear">
- <return type="void">
- </return>
- <argument index="0" name="menu" type="String">
- </argument>
- <description>
- Clear the global menu, in effect removing all items.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
- <method name="global_menu_remove_item">
- <return type="void">
- </return>
- <argument index="0" name="menu" type="String">
- </argument>
- <argument index="1" name="idx" type="int">
- </argument>
- <description>
- Removes the item at index "idx" from the global menu. Note that the indexes of items after the removed item are going to be shifted by one.
- [b]Note:[/b] This method is implemented on macOS.
- </description>
- </method>
<method name="has_environment" qualifiers="const">
<return type="bool">
</return>
@@ -558,27 +354,6 @@
[b]Note:[/b] Tag names are case-sensitive.
</description>
</method>
- <method name="has_touchscreen_ui_hint" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the device has a touchscreen or emulates one.
- </description>
- </method>
- <method name="has_virtual_keyboard" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise.
- </description>
- </method>
- <method name="hide_virtual_keyboard">
- <return type="void">
- </return>
- <description>
- Hides the virtual keyboard if it is shown, does nothing otherwise.
- </description>
- </method>
<method name="is_debug_build" qualifiers="const">
<return type="bool">
</return>
@@ -597,13 +372,6 @@
Returns [code]true[/code] if the input keycode corresponds to a Unicode character.
</description>
</method>
- <method name="is_ok_left_and_cancel_right" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the [b]OK[/b] button should appear on the left and [b]Cancel[/b] on the right.
- </description>
- </method>
<method name="is_stdout_verbose" qualifiers="const">
<return type="bool">
</return>
@@ -618,21 +386,6 @@
If [code]true[/code], the [code]user://[/code] file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable.
</description>
</method>
- <method name="is_window_always_on_top" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the window should always be on top of other windows.
- </description>
- </method>
- <method name="is_window_focused" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the window is currently focused.
- [b]Note:[/b] Only implemented on desktop platforms. On other platforms, it will always return [code]true[/code].
- </description>
- </method>
<method name="kill">
<return type="int" enum="Error">
</return>
@@ -644,62 +397,6 @@
[b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows.
</description>
</method>
- <method name="move_window_to_foreground">
- <return type="void">
- </return>
- <description>
- Moves the window to the front.
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows.
- </description>
- </method>
- <method name="native_video_is_playing">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if native video is playing.
- [b]Note:[/b] This method is implemented on Android and iOS.
- </description>
- </method>
- <method name="native_video_pause">
- <return type="void">
- </return>
- <description>
- Pauses native video playback.
- [b]Note:[/b] This method is implemented on Android and iOS.
- </description>
- </method>
- <method name="native_video_play">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="path" type="String">
- </argument>
- <argument index="1" name="volume" type="float">
- </argument>
- <argument index="2" name="audio_track" type="String">
- </argument>
- <argument index="3" name="subtitle_track" type="String">
- </argument>
- <description>
- Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
- [b]Note:[/b] This method is implemented on Android and iOS, and the current Android implementation does not support the [code]volume[/code], [code]audio_track[/code] and [code]subtitle_track[/code] options.
- </description>
- </method>
- <method name="native_video_stop">
- <return type="void">
- </return>
- <description>
- Stops native video playback.
- [b]Note:[/b] This method is implemented on Android and iOS.
- </description>
- </method>
- <method name="native_video_unpause">
- <return type="void">
- </return>
- <description>
- Resumes native video playback.
- [b]Note:[/b] This method is implemented on Android and iOS.
- </description>
- </method>
<method name="open_midi_inputs">
<return type="void">
</return>
@@ -742,14 +439,6 @@
Shows all resources currently used by the game.
</description>
</method>
- <method name="request_attention">
- <return type="void">
- </return>
- <description>
- Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX.
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows.
- </description>
- </method>
<method name="request_permission">
<return type="bool">
</return>
@@ -767,51 +456,6 @@
[b]Note:[/b] This method is implemented on Android.
</description>
</method>
- <method name="set_icon">
- <return type="void">
- </return>
- <argument index="0" name="icon" type="Image">
- </argument>
- <description>
- Sets the game's icon using an [Image] resource.
- The same image is used for window caption, taskbar/dock and window selection dialog. Image is scaled as needed.
- [b]Note:[/b] This method is implemented on HTML5, Linux, macOS and Windows.
- </description>
- </method>
- <method name="set_ime_active">
- <return type="void">
- </return>
- <argument index="0" name="active" type="bool">
- </argument>
- <description>
- Sets whether IME input mode should be enabled.
- If active IME handles key events before the application and creates an composition string and suggestion list.
- Application can retrieve the composition status by using [method get_ime_selection] and [method get_ime_text] functions.
- Completed composition string is committed when input is finished.
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows.
- </description>
- </method>
- <method name="set_ime_position">
- <return type="void">
- </return>
- <argument index="0" name="position" type="Vector2">
- </argument>
- <description>
- Sets position of IME suggestion list popup (in window coordinates).
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows.
- </description>
- </method>
- <method name="set_native_icon">
- <return type="void">
- </return>
- <argument index="0" name="filename" type="String">
- </argument>
- <description>
- Sets the game's icon using a multi-size platform-specific icon file ([code]*.ico[/code] on Windows and [code]*.icns[/code] on macOS).
- Appropriate size sub-icons are used for window caption, taskbar/dock and window selection dialog.
- [b]Note:[/b] This method is implemented on macOS and Windows.
- </description>
- </method>
<method name="set_thread_name">
<return type="int" enum="Error">
</return>
@@ -830,27 +474,6 @@
Enables backup saves if [code]enabled[/code] is [code]true[/code].
</description>
</method>
- <method name="set_window_always_on_top">
- <return type="void">
- </return>
- <argument index="0" name="enabled" type="bool">
- </argument>
- <description>
- Sets whether the window should always be on top.
- [b]Note:[/b] This method is implemented on Linux, macOS and Windows.
- </description>
- </method>
- <method name="set_window_title">
- <return type="void">
- </return>
- <argument index="0" name="title" type="String">
- </argument>
- <description>
- Sets the window title to the specified string.
- [b]Note:[/b] This should be used sporadically. Don't set this every frame, as that will negatively affect performance on some window managers.
- [b]Note:[/b] This method is implemented on HTML5, Linux, macOS and Windows.
- </description>
- </method>
<method name="shell_open">
<return type="int" enum="Error">
</return>
@@ -864,82 +487,18 @@
[b]Note:[/b] This method is implemented on Android, iOS, HTML5, Linux, macOS and Windows.
</description>
</method>
- <method name="show_virtual_keyboard">
- <return type="void">
- </return>
- <argument index="0" name="existing_text" type="String" default="&quot;&quot;">
- </argument>
- <description>
- Shows the virtual keyboard if the platform has one. The [code]existing_text[/code] parameter is useful for implementing your own LineEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).
- [b]Note:[/b] This method is implemented on Android, iOS and UWP.
- </description>
- </method>
</methods>
<members>
- <member name="clipboard" type="String" setter="set_clipboard" getter="get_clipboard" default="&quot;&quot;">
- The clipboard from the host OS. Might be unavailable on some platforms.
- </member>
- <member name="current_screen" type="int" setter="set_current_screen" getter="get_current_screen" default="0">
- The current screen index (starting from 0).
- </member>
<member name="exit_code" type="int" setter="set_exit_code" getter="get_exit_code" default="0">
The exit code passed to the OS when the main loop exits. By convention, an exit code of [code]0[/code] indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive).
[b]Note:[/b] This value will be ignored if using [method SceneTree.quit] with an [code]exit_code[/code] argument passed.
</member>
- <member name="keep_screen_on" type="bool" setter="set_keep_screen_on" getter="is_keep_screen_on" default="true">
- 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" default="false">
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="low_processor_usage_mode_sleep_usec" type="int" setter="set_low_processor_usage_mode_sleep_usec" getter="get_low_processor_usage_mode_sleep_usec" default="6900">
The amount of sleeping between frames when the low-processor usage mode is enabled (in microseconds). Higher values will result in lower CPU usage.
</member>
- <member name="max_window_size" type="Vector2" setter="set_max_window_size" getter="get_max_window_size" default="Vector2( 0, 0 )">
- The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value.
- </member>
- <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size" default="Vector2( 0, 0 )">
- The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value.
- </member>
- <member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation" default="0">
- The current screen orientation.
- </member>
- <member name="vsync_enabled" type="bool" setter="set_use_vsync" getter="is_vsync_enabled" default="true">
- If [code]true[/code], vertical synchronization (Vsync) is enabled.
- </member>
- <member name="vsync_via_compositor" type="bool" setter="set_vsync_via_compositor" getter="is_vsync_via_compositor_enabled" default="false">
- If [code]true[/code] and [code]vsync_enabled[/code] is true, the operating system's window compositor will be used for vsync when the compositor is enabled and the game is in windowed mode.
- [b]Note:[/b] This option is experimental and meant to alleviate stutter experienced by some users. However, some users have experienced a Vsync framerate halving (e.g. from 60 FPS to 30 FPS) when using it.
- [b]Note:[/b] This property is only implemented on Windows.
- </member>
- <member name="window_borderless" type="bool" setter="set_borderless_window" getter="get_borderless_window" default="false">
- If [code]true[/code], removes the window frame.
- [b]Note:[/b] Setting [code]window_borderless[/code] to [code]false[/code] disables per-pixel transparency.
- </member>
- <member name="window_fullscreen" type="bool" setter="set_window_fullscreen" getter="is_window_fullscreen" default="false">
- If [code]true[/code], the window is fullscreen.
- </member>
- <member name="window_maximized" type="bool" setter="set_window_maximized" getter="is_window_maximized" default="false">
- If [code]true[/code], the window is maximized.
- </member>
- <member name="window_minimized" type="bool" setter="set_window_minimized" getter="is_window_minimized" default="false">
- 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" default="false">
- If [code]true[/code], the window background is transparent and window frame is removed.
- Use [code]get_tree().get_root().set_transparent_background(true)[/code] to disable main viewport background rendering.
- [b]Note:[/b] This property has no effect if [b]Project &gt; Project Settings &gt; Display &gt; Window &gt; Per-pixel transparency &gt; Allowed[/b] setting is disabled.
- [b]Note:[/b] This property is implemented on HTML5, Linux, macOS and Windows.
- </member>
- <member name="window_position" type="Vector2" setter="set_window_position" getter="get_window_position" default="Vector2( 0, 0 )">
- 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.
- </member>
- <member name="window_resizable" type="bool" setter="set_window_resizable" getter="is_window_resizable" default="true">
- If [code]true[/code], the window is resizable by the user.
- </member>
- <member name="window_size" type="Vector2" setter="set_window_size" getter="get_window_size" default="Vector2( 0, 0 )">
- The size of the window (without counting window manager decorations).
- </member>
</members>
<constants>
<constant name="VIDEO_DRIVER_GLES2" value="0" enum="VideoDriver">
@@ -1005,27 +564,6 @@
<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>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 33f5fc0f35..35e87d1a2a 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -314,7 +314,7 @@
<method name="has_signal" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="signal" type="String">
+ <argument index="0" name="signal" type="StringName">
</argument>
<description>
Returns [code]true[/code] if the given [code]signal[/code] exists.
diff --git a/doc/classes/OmniLight.xml b/doc/classes/OmniLight3D.xml
index dc57efd3f9..0bbc987156 100644
--- a/doc/classes/OmniLight.xml
+++ b/doc/classes/OmniLight3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="OmniLight" inherits="Light" version="4.0">
+<class name="OmniLight3D" inherits="Light3D" version="4.0">
<brief_description>
Omnidirectional light, such as a light bulb or a candle.
</brief_description>
<description>
- An Omnidirectional light is a type of [Light] that emits light in all directions. The light is attenuated by distance and this attenuation can be configured by changing its energy, radius, and attenuation parameters.
+ An Omnidirectional light is a type of [Light3D] that emits light in all directions. The light is attenuated by distance and this attenuation can be configured by changing its energy, radius, and attenuation parameters.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link>
@@ -18,7 +18,7 @@
<member name="omni_range" type="float" setter="set_param" getter="get_param" default="5.0">
The light's radius.
</member>
- <member name="omni_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="OmniLight.ShadowMode" default="1">
+ <member name="omni_shadow_mode" type="int" setter="set_shadow_mode" getter="get_shadow_mode" enum="OmniLight3D.ShadowMode" default="1">
See [enum ShadowMode].
</member>
</members>
diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml
index a3f6a0be8f..7285bc9e2e 100644
--- a/doc/classes/Panel.xml
+++ b/doc/classes/Panel.xml
@@ -10,11 +10,21 @@
</tutorials>
<methods>
</methods>
+ <members>
+ <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Panel.Mode" default="0">
+ </member>
+ </members>
<constants>
+ <constant name="MODE_BACKGROUND" value="0" enum="Mode">
+ </constant>
+ <constant name="MODE_FOREGROUND" value="1" enum="Mode">
+ </constant>
</constants>
<theme_items>
<theme_item name="panel" type="StyleBox">
The style of this [Panel].
</theme_item>
+ <theme_item name="panel_fg" type="StyleBox">
+ </theme_item>
</theme_items>
</class>
diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml
index 1e90214e47..d04ac5bdce 100644
--- a/doc/classes/ParticlesMaterial.xml
+++ b/doc/classes/ParticlesMaterial.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ParticlesMaterial" inherits="Material" version="4.0">
<brief_description>
- Particle properties for [Particles] and [Particles2D] nodes.
+ Particle properties for [GPUParticles3D] and [GPUParticles2D] nodes.
</brief_description>
<description>
- ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [Particles] and [Particles2D] emitter nodes.
+ ParticlesMaterial defines particle properties and behavior. It is used in the [code]process_material[/code] of [GPUParticles3D] and [GPUParticles2D] emitter nodes.
Some of this material's properties are applied to each particle when emitted, while others can have a [CurveTexture] applied to vary values over the lifetime of the particle.
When a randomness ratio is applied to a property it is used to scale that property by a random amount. The random ratio is used to interpolate between [code]1.0[/code] and a random number less than one, the result is multiplied by the property to obtain the randomized property. For example a random ratio of [code]0.4[/code] would scale the original property between [code]0.4-1.0[/code] of its original value.
</description>
@@ -132,7 +132,7 @@
Animation speed randomness ratio.
</member>
<member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
- Each particle's initial color. If the [Particles2D]'s [code]texture[/code] is defined, it will be multiplied by this color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code].
+ Each particle's initial color. If the [GPUParticles2D]'s [code]texture[/code] is defined, it will be multiplied by this color. To have particle display color in a [BaseMaterial3D] make sure to set [member BaseMaterial3D.vertex_color_use_as_albedo] to [code]true[/code].
</member>
<member name="color_ramp" type="Texture2D" setter="set_color_ramp" getter="get_color_ramp">
Each particle's color will vary along this [GradientTexture].
diff --git a/doc/classes/Path.xml b/doc/classes/Path3D.xml
index 801e86ff9e..b97e7efd5d 100644
--- a/doc/classes/Path.xml
+++ b/doc/classes/Path3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Path" inherits="Spatial" version="4.0">
+<class name="Path3D" inherits="Node3D" version="4.0">
<brief_description>
- Contains a [Curve3D] path for [PathFollow] nodes to follow.
+ Contains a [Curve3D] path for [PathFollow3D] nodes to follow.
</brief_description>
<description>
- Can have [PathFollow] child nodes moving along the [Curve3D]. See [PathFollow] for more information on the usage.
- Note that the path is considered as relative to the moved nodes (children of [PathFollow]). As such, the curve should usually start with a zero vector [code](0, 0, 0)[/code].
+ Can have [PathFollow3D] child nodes moving along the [Curve3D]. See [PathFollow3D] for more information on the usage.
+ Note that the path is considered as relative to the moved nodes (children of [PathFollow3D]). As such, the curve should usually start with a zero vector [code](0, 0, 0)[/code].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PathFollow.xml b/doc/classes/PathFollow3D.xml
index 85ca5b787f..f405bdedfc 100644
--- a/doc/classes/PathFollow.xml
+++ b/doc/classes/PathFollow3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PathFollow" inherits="Spatial" version="4.0">
+<class name="PathFollow3D" inherits="Node3D" version="4.0">
<brief_description>
- Point sampler for a [Path].
+ Point sampler for a [Path3D].
</brief_description>
<description>
- This node takes its parent [Path], and returns the coordinates of a point within it, given a distance from the first vertex.
+ This node takes its parent [Path3D], and returns the coordinates of a point within it, given a distance from the first vertex.
It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be children of this node. The descendant nodes will then move accordingly when setting an offset in this node.
</description>
<tutorials>
@@ -14,7 +14,7 @@
<members>
<member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation" default="true">
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.
+ The points along the [Curve3D] of the [Path3D] 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" default="0.0">
@@ -26,7 +26,7 @@
<member name="offset" type="float" setter="set_offset" getter="get_offset" default="0.0">
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="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow.RotationMode" default="3">
+ <member name="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow3D.RotationMode" default="3">
Allows or forbids rotation on one or more axes, depending on the [enum RotationMode] constants being used.
</member>
<member name="unit_offset" type="float" setter="set_unit_offset" getter="get_unit_offset" default="0.0">
@@ -38,19 +38,19 @@
</members>
<constants>
<constant name="ROTATION_NONE" value="0" enum="RotationMode">
- Forbids the PathFollow to rotate.
+ Forbids the PathFollow3D to rotate.
</constant>
<constant name="ROTATION_Y" value="1" enum="RotationMode">
- Allows the PathFollow to rotate in the Y axis only.
+ Allows the PathFollow3D to rotate in the Y axis only.
</constant>
<constant name="ROTATION_XY" value="2" enum="RotationMode">
- Allows the PathFollow to rotate in both the X, and Y axes.
+ Allows the PathFollow3D to rotate in both the X, and Y axes.
</constant>
<constant name="ROTATION_XYZ" value="3" enum="RotationMode">
- Allows the PathFollow to rotate in any axis.
+ Allows the PathFollow3D to rotate in any axis.
</constant>
<constant name="ROTATION_ORIENTED" value="4" enum="RotationMode">
- Uses the up vector information in a [Curve3D] to enforce orientation. This rotation mode requires the [Path]'s [member Curve3D.up_vector_enabled] property to be set to [code]true[/code].
+ Uses the up vector information in a [Curve3D] to enforce orientation. This rotation mode requires the [Path3D]'s [member Curve3D.up_vector_enabled] property to be set to [code]true[/code].
</constant>
</constants>
</class>
diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml
index 378b165644..2a0c153267 100644
--- a/doc/classes/Performance.xml
+++ b/doc/classes/Performance.xml
@@ -95,7 +95,7 @@
Number of islands in the 2D physics engine.
</constant>
<constant name="PHYSICS_3D_ACTIVE_OBJECTS" value="23" enum="Monitor">
- Number of active [RigidBody] and [VehicleBody] nodes in the game.
+ Number of active [RigidBody3D] and [VehicleBody3D] nodes in the game.
</constant>
<constant name="PHYSICS_3D_COLLISION_PAIRS" value="24" enum="Monitor">
Number of collision pairs in the 3D physics engine.
diff --git a/doc/classes/PhysicalBone.xml b/doc/classes/PhysicalBone3D.xml
index bb31f03c18..d45c72ee87 100644
--- a/doc/classes/PhysicalBone.xml
+++ b/doc/classes/PhysicalBone3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicalBone" inherits="PhysicsBody" version="4.0">
+<class name="PhysicalBone3D" inherits="PhysicsBody3D" version="4.0">
<brief_description>
</brief_description>
<description>
@@ -55,7 +55,7 @@
</member>
<member name="joint_offset" type="Transform" setter="set_joint_offset" getter="get_joint_offset" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
</member>
- <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone.JointType" default="0">
+ <member name="joint_type" type="int" setter="set_joint_type" getter="get_joint_type" enum="PhysicalBone3D.JointType" default="0">
</member>
<member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0">
</member>
diff --git a/doc/classes/PhysicalSkyMaterial.xml b/doc/classes/PhysicalSkyMaterial.xml
index 705c063257..89b43158dc 100644
--- a/doc/classes/PhysicalSkyMaterial.xml
+++ b/doc/classes/PhysicalSkyMaterial.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
The [PhysicalSkyMaterial] uses the Preetham analytic daylight model to draw a sky based on physical properties. This results in a substantially more realistic sky than the [ProceduralSkyMaterial], but it is slightly slower and less flexible.
- The [PhysicalSkyMaterial] only supports one sun. The color, energy, and direction of the sun are taken from the first [DirectionalLight] in the scene tree.
+ The [PhysicalSkyMaterial] only supports one sun. The color, energy, and direction of the sun are taken from the first [DirectionalLight3D] in the scene tree.
As it is based on a daylight model, the sky fades to black as the sunset ends. If you want a full day/night cycle, you will have to add a night sky by converting this to a [ShaderMaterial] and adding a night sky directly into the resulting shader.
</description>
<tutorials>
diff --git a/doc/classes/Physics2DDirectBodyStateSW.xml b/doc/classes/Physics2DDirectBodyStateSW.xml
deleted file mode 100644
index 11f1140ca8..0000000000
--- a/doc/classes/Physics2DDirectBodyStateSW.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectBodyStateSW" inherits="Physics2DDirectBodyState" version="4.0">
- <brief_description>
- Software implementation of [Physics2DDirectBodyState].
- </brief_description>
- <description>
- Software implementation of [Physics2DDirectBodyState]. This object exposes no new methods or properties and should not be used, as [Physics2DDirectBodyState] selects the best implementation available.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody3D.xml
index c0927a5b53..f0ba2a7f5f 100644
--- a/doc/classes/PhysicsBody.xml
+++ b/doc/classes/PhysicsBody3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsBody" inherits="CollisionObject" version="4.0">
+<class name="PhysicsBody3D" inherits="CollisionObject3D" version="4.0">
<brief_description>
Base class for all objects affected by physics in 3D space.
</brief_description>
<description>
- PhysicsBody is an abstract base class for implementing a physics body. All *Body types inherit from it.
+ PhysicsBody3D is an abstract base class for implementing a physics body. All *Body types inherit from it.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
diff --git a/doc/classes/Physics2DDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState2D.xml
index d9d402ac9a..46205fecd1 100644
--- a/doc/classes/Physics2DDirectBodyState.xml
+++ b/doc/classes/PhysicsDirectBodyState2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectBodyState" inherits="Object" version="4.0">
+<class name="PhysicsDirectBodyState2D" inherits="Object" version="4.0">
<brief_description>
- Direct access object to a physics body in the [Physics2DServer].
+ Direct access object to a physics body in the [PhysicsServer2D].
</brief_description>
<description>
- Provides direct access to a physics body in the [Physics2DServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody2D._integrate_forces].
+ Provides direct access to a physics body in the [PhysicsServer2D], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody2D._integrate_forces].
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
@@ -119,7 +119,7 @@
<argument index="0" name="contact_idx" type="int">
</argument>
<description>
- Returns the collided shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
+ Returns the collided shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
</description>
</method>
<method name="get_contact_collider_velocity_at_position" qualifiers="const">
@@ -167,7 +167,7 @@
</description>
</method>
<method name="get_space_state">
- <return type="Physics2DDirectSpaceState">
+ <return type="PhysicsDirectSpaceState2D">
</return>
<description>
Returns the current state of the space, useful for queries.
diff --git a/doc/classes/PhysicsDirectBodyState2DSW.xml b/doc/classes/PhysicsDirectBodyState2DSW.xml
new file mode 100644
index 0000000000..94fc4213b7
--- /dev/null
+++ b/doc/classes/PhysicsDirectBodyState2DSW.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="PhysicsDirectBodyState2DSW" inherits="PhysicsDirectBodyState2D" version="4.0">
+ <brief_description>
+ Software implementation of [PhysicsDirectBodyState2D].
+ </brief_description>
+ <description>
+ Software implementation of [PhysicsDirectBodyState2D]. This object exposes no new methods or properties and should not be used, as [PhysicsDirectBodyState2D] selects the best implementation available.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/PhysicsDirectBodyState.xml b/doc/classes/PhysicsDirectBodyState3D.xml
index 24cf4961be..1ee520fe5f 100644
--- a/doc/classes/PhysicsDirectBodyState.xml
+++ b/doc/classes/PhysicsDirectBodyState3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsDirectBodyState" inherits="Object" version="4.0">
+<class name="PhysicsDirectBodyState3D" inherits="Object" version="4.0">
<brief_description>
- Direct access object to a physics body in the [PhysicsServer].
+ Direct access object to a physics body in the [PhysicsServer3D].
</brief_description>
<description>
- Provides direct access to a physics body in the [PhysicsServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody._integrate_forces].
+ Provides direct access to a physics body in the [PhysicsServer3D], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody3D._integrate_forces].
</description>
<tutorials>
</tutorials>
@@ -128,7 +128,7 @@
</return>
<description>
Returns the number of contacts this body has with other bodies.
- [b]Note:[/b] By default, this returns 0 unless bodies are configured to monitor contacts. See [member RigidBody.contact_monitor].
+ [b]Note:[/b] By default, this returns 0 unless bodies are configured to monitor contacts. See [member RigidBody3D.contact_monitor].
</description>
</method>
<method name="get_contact_impulse" qualifiers="const">
@@ -168,7 +168,7 @@
</description>
</method>
<method name="get_space_state">
- <return type="PhysicsDirectSpaceState">
+ <return type="PhysicsDirectSpaceState3D">
</return>
<description>
Returns the current state of the space, useful for queries.
diff --git a/doc/classes/Physics2DDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState2D.xml
index 662a823d84..d85d7794dd 100644
--- a/doc/classes/Physics2DDirectSpaceState.xml
+++ b/doc/classes/PhysicsDirectSpaceState2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DDirectSpaceState" inherits="Object" version="4.0">
+<class name="PhysicsDirectSpaceState2D" inherits="Object" version="4.0">
<brief_description>
- Direct access object to a space in the [Physics2DServer].
+ Direct access object to a space in the [PhysicsServer2D].
</brief_description>
<description>
- 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.
+ Direct access object to a space in the [PhysicsServer2D]. It's used mainly to do queries against objects and areas residing in a given space.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
@@ -13,35 +13,35 @@
<method name="cast_motion">
<return type="Array">
</return>
- <argument index="0" name="shape" type="Physics2DShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D">
</argument>
<description>
Checks how far the shape can travel toward a point. If the shape can not move, the array will be empty.
- [b]Note:[/b] Both the shape and the motion are supplied through a [Physics2DShapeQueryParameters] object. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code].
+ [b]Note:[/b] Both the shape and the motion are supplied through a [PhysicsShapeQueryParameters2D] object. The method will return an array with two floats between 0 and 1, both representing a fraction of [code]motion[/code]. The first is how far the shape can move without triggering a collision, and the second is the point at which a collision will occur. If no collision is detected, the returned array will be [code][1, 1][/code].
</description>
</method>
<method name="collide_shape">
<return type="Array">
</return>
- <argument index="0" name="shape" type="Physics2DShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D">
</argument>
<argument index="1" name="max_results" type="int" default="32">
</argument>
<description>
- Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time.
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time.
</description>
</method>
<method name="get_rest_info">
<return type="Dictionary">
</return>
- <argument index="0" name="shape" type="Physics2DShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D">
</argument>
<description>
- Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead.
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space. If it collides with more than one shape, the nearest one is selected. If the shape did not intersect anything, then an empty dictionary is returned instead.
[b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object. The returned object is a dictionary containing the following fields:
[code]collider_id[/code]: The colliding object's ID.
[code]linear_velocity[/code]: The colliding object's velocity [Vector2]. If the object is an [Area2D], the result is [code](0, 0)[/code].
- [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
+ [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
[code]normal[/code]: The object's surface normal at the intersection point.
[code]point[/code]: The intersection point.
[code]rid[/code]: The intersecting object's [RID].
@@ -67,10 +67,10 @@
Checks whether a point is inside any shape. The shapes the point is inside of are returned in an array containing dictionaries with the following fields:
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
- [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
+ [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
- Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively.
+ Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
</description>
</method>
<method name="intersect_point_on_canvas">
@@ -112,28 +112,28 @@
Intersects a ray in a given space. The returned object is a dictionary with the following fields:
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
- [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
+ [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
[code]normal[/code]: The object's surface normal at the intersection point.
[code]position[/code]: The intersection point.
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
If the ray did not intersect anything, then an empty dictionary is returned instead.
- Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively.
+ Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody2D]s or [Area2D]s, respectively.
</description>
</method>
<method name="intersect_shape">
<return type="Array">
</return>
- <argument index="0" name="shape" type="Physics2DShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters2D">
</argument>
<argument index="1" name="max_results" type="int" default="32">
</argument>
<description>
- Checks the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space.
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters2D] object, against the space.
[b]Note:[/b] This method does not take into account the [code]motion[/code] property of the object. The intersected shapes are returned in an array containing dictionaries with the following fields:
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
- [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data].
+ [code]metadata[/code]: The intersecting shape's metadata. This metadata is different from [method Object.get_meta], and is set with [method PhysicsServer2D.shape_set_data].
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
The number of intersections can be limited with the [code]max_results[/code] parameter, to reduce the processing time.
diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState3D.xml
index a6172805e9..09ee93732d 100644
--- a/doc/classes/PhysicsDirectSpaceState.xml
+++ b/doc/classes/PhysicsDirectSpaceState3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsDirectSpaceState" inherits="Object" version="4.0">
+<class name="PhysicsDirectSpaceState3D" inherits="Object" version="4.0">
<brief_description>
- Direct access object to a space in the [PhysicsServer].
+ Direct access object to a space in the [PhysicsServer3D].
</brief_description>
<description>
- 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.
+ Direct access object to a space in the [PhysicsServer3D]. It's used mainly to do queries against objects and areas residing in a given space.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
@@ -13,7 +13,7 @@
<method name="cast_motion">
<return type="Array">
</return>
- <argument index="0" name="shape" type="PhysicsShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D">
</argument>
<argument index="1" name="motion" type="Vector3">
</argument>
@@ -25,23 +25,23 @@
<method name="collide_shape">
<return type="Array">
</return>
- <argument index="0" name="shape" type="PhysicsShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D">
</argument>
<argument index="1" name="max_results" type="int" default="32">
</argument>
<description>
- Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time.
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time.
</description>
</method>
<method name="get_rest_info">
<return type="Dictionary">
</return>
- <argument index="0" name="shape" type="PhysicsShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D">
</argument>
<description>
- Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields:
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. If it collides with more than one shape, the nearest one is selected. The returned object is a dictionary containing the following fields:
[code]collider_id[/code]: The colliding object's ID.
- [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area], the result is [code](0, 0, 0)[/code].
+ [code]linear_velocity[/code]: The colliding object's velocity [Vector3]. If the object is an [Area3D], the result is [code](0, 0, 0)[/code].
[code]normal[/code]: The object's surface normal at the intersection point.
[code]point[/code]: The intersection point.
[code]rid[/code]: The intersecting object's [RID].
@@ -73,18 +73,18 @@
[code]rid[/code]: The intersecting object's [RID].
[code]shape[/code]: The shape index of the colliding shape.
If the ray did not intersect anything, then an empty dictionary is returned instead.
- Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody]s or [Area]s, respectively.
+ Additionally, the method can take an [code]exclude[/code] array of objects or [RID]s that are to be excluded from collisions, a [code]collision_mask[/code] bitmask representing the physics layers to check in, or booleans to determine if the ray should collide with [PhysicsBody3D]s or [Area3D]s, respectively.
</description>
</method>
<method name="intersect_shape">
<return type="Array">
</return>
- <argument index="0" name="shape" type="PhysicsShapeQueryParameters">
+ <argument index="0" name="shape" type="PhysicsShapeQueryParameters3D">
</argument>
<argument index="1" name="max_results" type="int" default="32">
</argument>
<description>
- Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
+ Checks the intersections of a shape, given through a [PhysicsShapeQueryParameters3D] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields:
[code]collider[/code]: The colliding object.
[code]collider_id[/code]: The colliding object's ID.
[code]rid[/code]: The intersecting object's [RID].
diff --git a/doc/classes/PhysicsMaterial.xml b/doc/classes/PhysicsMaterial.xml
index 84e7f2b275..6410626496 100644
--- a/doc/classes/PhysicsMaterial.xml
+++ b/doc/classes/PhysicsMaterial.xml
@@ -4,7 +4,7 @@
A material for physics properties.
</brief_description>
<description>
- Provides a means of modifying the collision properties of a [PhysicsBody].
+ Provides a means of modifying the collision properties of a [PhysicsBody3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Physics2DServer.xml b/doc/classes/PhysicsServer2D.xml
index 45215253be..9da739e57a 100644
--- a/doc/classes/Physics2DServer.xml
+++ b/doc/classes/PhysicsServer2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DServer" inherits="Object" version="4.0">
+<class name="PhysicsServer2D" inherits="Object" version="4.0">
<brief_description>
Server interface for low-level 2D physics access.
</brief_description>
<description>
- Physics2DServer is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
+ PhysicsServer2D is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
</description>
<tutorials>
</tutorials>
@@ -83,7 +83,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.AreaParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter">
</argument>
<description>
Returns an area parameter value. See [enum AreaParameter] for a list of available parameters.
@@ -130,7 +130,7 @@
</description>
</method>
<method name="area_get_space_override_mode" qualifiers="const">
- <return type="int" enum="Physics2DServer.AreaSpaceOverrideMode">
+ <return type="int" enum="PhysicsServer2D.AreaSpaceOverrideMode">
</return>
<argument index="0" name="area" type="RID">
</argument>
@@ -225,7 +225,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.AreaParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter">
</argument>
<argument index="2" name="value" type="Variant">
</argument>
@@ -288,7 +288,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="Physics2DServer.AreaSpaceOverrideMode">
+ <argument index="1" name="mode" type="int" enum="PhysicsServer2D.AreaSpaceOverrideMode">
</argument>
<description>
Sets the space override mode for the area. See [enum AreaSpaceOverrideMode] for a list of available modes.
@@ -461,7 +461,7 @@
</description>
</method>
<method name="body_get_continuous_collision_detection_mode" qualifiers="const">
- <return type="int" enum="Physics2DServer.CCDMode">
+ <return type="int" enum="PhysicsServer2D.CCDMode">
</return>
<argument index="0" name="body" type="RID">
</argument>
@@ -470,12 +470,12 @@
</description>
</method>
<method name="body_get_direct_state">
- <return type="Physics2DDirectBodyState">
+ <return type="PhysicsDirectBodyState2D">
</return>
<argument index="0" name="body" type="RID">
</argument>
<description>
- Returns the [Physics2DDirectBodyState] of the body.
+ Returns the [PhysicsDirectBodyState2D] of the body.
</description>
</method>
<method name="body_get_max_contacts_reported" qualifiers="const">
@@ -488,7 +488,7 @@
</description>
</method>
<method name="body_get_mode" qualifiers="const">
- <return type="int" enum="Physics2DServer.BodyMode">
+ <return type="int" enum="PhysicsServer2D.BodyMode">
</return>
<argument index="0" name="body" type="RID">
</argument>
@@ -510,7 +510,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.BodyParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter">
</argument>
<description>
Returns the value of a body parameter. See [enum BodyParameter] for a list of available parameters.
@@ -572,7 +572,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="state" type="int" enum="Physics2DServer.BodyState">
+ <argument index="1" name="state" type="int" enum="PhysicsServer2D.BodyState">
</argument>
<description>
Returns a body state.
@@ -647,7 +647,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="Physics2DServer.CCDMode">
+ <argument index="1" name="mode" type="int" enum="PhysicsServer2D.CCDMode">
</argument>
<description>
Sets the continuous collision detection mode using one of the [enum CCDMode] constants.
@@ -685,7 +685,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="Physics2DServer.BodyMode">
+ <argument index="1" name="mode" type="int" enum="PhysicsServer2D.BodyMode">
</argument>
<description>
Sets the body mode using one of the [enum BodyMode] constants.
@@ -707,7 +707,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.BodyParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -798,7 +798,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="state" type="int" enum="Physics2DServer.BodyState">
+ <argument index="1" name="state" type="int" enum="PhysicsServer2D.BodyState">
</argument>
<argument index="2" name="value" type="Variant">
</argument>
@@ -819,10 +819,10 @@
</argument>
<argument index="4" name="margin" type="float" default="0.08">
</argument>
- <argument index="5" name="result" type="Physics2DTestMotionResult" default="null">
+ <argument index="5" name="result" type="PhysicsTestMotionResult2D" default="null">
</argument>
<description>
- Returns [code]true[/code] if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. [Physics2DTestMotionResult] can be passed to return additional information in.
+ Returns [code]true[/code] if a collision would result from moving in the given direction from a given point in space. Margin increases the size of the shapes involved in the collision detection. [PhysicsTestMotionResult2D] can be passed to return additional information in.
</description>
</method>
<method name="capsule_shape_create">
@@ -869,7 +869,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.DampedStringParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam">
</argument>
<description>
Returns the value of a damped spring joint parameter.
@@ -880,7 +880,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.DampedStringParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.DampedStringParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -894,13 +894,13 @@
<argument index="0" name="rid" type="RID">
</argument>
<description>
- Destroys any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console.
+ Destroys any of the objects created by PhysicsServer2D. If the [RID] passed is not one of the objects that can be created by PhysicsServer2D, an error will be sent to the console.
</description>
</method>
<method name="get_process_info">
<return type="int">
</return>
- <argument index="0" name="process_info" type="int" enum="Physics2DServer.ProcessInfo">
+ <argument index="0" name="process_info" type="int" enum="PhysicsServer2D.ProcessInfo">
</argument>
<description>
Returns information about the current state of the 2D physics engine. See [enum ProcessInfo] for a list of available states.
@@ -928,14 +928,14 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.JointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.JointParam">
</argument>
<description>
Returns the value of a joint parameter.
</description>
</method>
<method name="joint_get_type" qualifiers="const">
- <return type="int" enum="Physics2DServer.JointType">
+ <return type="int" enum="PhysicsServer2D.JointType">
</return>
<argument index="0" name="joint" type="RID">
</argument>
@@ -948,7 +948,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.JointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.JointParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -1012,7 +1012,7 @@
</description>
</method>
<method name="shape_get_type" qualifiers="const">
- <return type="int" enum="Physics2DServer.ShapeType">
+ <return type="int" enum="PhysicsServer2D.ShapeType">
</return>
<argument index="0" name="shape" type="RID">
</argument>
@@ -1039,12 +1039,12 @@
</description>
</method>
<method name="space_get_direct_state">
- <return type="Physics2DDirectSpaceState">
+ <return type="PhysicsDirectSpaceState2D">
</return>
<argument index="0" name="space" type="RID">
</argument>
<description>
- Returns the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries.
+ Returns the state of a space, a [PhysicsDirectSpaceState2D]. This object can be used to make collision/intersection queries.
</description>
</method>
<method name="space_get_param" qualifiers="const">
@@ -1052,7 +1052,7 @@
</return>
<argument index="0" name="space" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.SpaceParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter">
</argument>
<description>
Returns the value of a space parameter.
@@ -1083,7 +1083,7 @@
</return>
<argument index="0" name="space" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="Physics2DServer.SpaceParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter">
</argument>
<argument index="2" name="value" type="float">
</argument>
diff --git a/doc/classes/Physics2DServerSW.xml b/doc/classes/PhysicsServer2DSW.xml
index 1e4531ed66..dac5e360f0 100644
--- a/doc/classes/Physics2DServerSW.xml
+++ b/doc/classes/PhysicsServer2DSW.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DServerSW" inherits="Physics2DServer" version="4.0">
+<class name="PhysicsServer2DSW" inherits="PhysicsServer2D" version="4.0">
<brief_description>
- Software implementation of [Physics2DServer].
+ Software implementation of [PhysicsServer2D].
</brief_description>
<description>
- This class exposes no new methods or properties and should not be used, as [Physics2DServer] automatically selects the best implementation available.
+ This class exposes no new methods or properties and should not be used, as [PhysicsServer2D] automatically selects the best implementation available.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer3D.xml
index 1b9ce80a1b..e9e1552c92 100644
--- a/doc/classes/PhysicsServer.xml
+++ b/doc/classes/PhysicsServer3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsServer" inherits="Object" version="4.0">
+<class name="PhysicsServer3D" inherits="Object" version="4.0">
<brief_description>
Server interface for low-level physics access.
</brief_description>
<description>
- PhysicsServer is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
+ PhysicsServer3D is the server responsible for all 3D physics. It can create many kinds of physics objects, but does not insert them on the node tree.
</description>
<tutorials>
</tutorials>
@@ -48,7 +48,7 @@
<return type="RID">
</return>
<description>
- Creates an [Area].
+ Creates an [Area3D].
</description>
</method>
<method name="area_get_object_instance_id" qualifiers="const">
@@ -65,7 +65,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.AreaParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.AreaParameter">
</argument>
<description>
Returns an area parameter value. A list of available parameters is on the [enum AreaParameter] constants.
@@ -112,7 +112,7 @@
</description>
</method>
<method name="area_get_space_override_mode" qualifiers="const">
- <return type="int" enum="PhysicsServer.AreaSpaceOverrideMode">
+ <return type="int" enum="PhysicsServer3D.AreaSpaceOverrideMode">
</return>
<argument index="0" name="area" type="RID">
</argument>
@@ -216,7 +216,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.AreaParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.AreaParameter">
</argument>
<argument index="2" name="value" type="Variant">
</argument>
@@ -289,7 +289,7 @@
</return>
<argument index="0" name="area" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="PhysicsServer.AreaSpaceOverrideMode">
+ <argument index="1" name="mode" type="int" enum="PhysicsServer3D.AreaSpaceOverrideMode">
</argument>
<description>
Sets the space override mode for the area. The modes are described in the [enum AreaSpaceOverrideMode] constants.
@@ -421,7 +421,7 @@
<method name="body_create">
<return type="RID">
</return>
- <argument index="0" name="mode" type="int" enum="PhysicsServer.BodyMode" default="2">
+ <argument index="0" name="mode" type="int" enum="PhysicsServer3D.BodyMode" default="2">
</argument>
<argument index="1" name="init_sleeping" type="bool" default="false">
</argument>
@@ -449,12 +449,12 @@
</description>
</method>
<method name="body_get_direct_state">
- <return type="PhysicsDirectBodyState">
+ <return type="PhysicsDirectBodyState3D">
</return>
<argument index="0" name="body" type="RID">
</argument>
<description>
- Returns the [PhysicsDirectBodyState] of the body.
+ Returns the [PhysicsDirectBodyState3D] of the body.
</description>
</method>
<method name="body_get_kinematic_safe_margin" qualifiers="const">
@@ -475,7 +475,7 @@
</description>
</method>
<method name="body_get_mode" qualifiers="const">
- <return type="int" enum="PhysicsServer.BodyMode">
+ <return type="int" enum="PhysicsServer3D.BodyMode">
</return>
<argument index="0" name="body" type="RID">
</argument>
@@ -497,7 +497,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.BodyParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.BodyParameter">
</argument>
<description>
Returns the value of a body parameter. A list of available parameters is on the [enum BodyParameter] constants.
@@ -548,7 +548,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="state" type="int" enum="PhysicsServer.BodyState">
+ <argument index="1" name="state" type="int" enum="PhysicsServer3D.BodyState">
</argument>
<description>
Returns a body state.
@@ -559,7 +559,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="1" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<description>
</description>
@@ -619,7 +619,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="1" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<argument index="2" name="lock" type="bool">
</argument>
@@ -712,7 +712,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="PhysicsServer.BodyMode">
+ <argument index="1" name="mode" type="int" enum="PhysicsServer3D.BodyMode">
</argument>
<description>
Sets the body mode, from one of the [enum BodyMode] constants.
@@ -734,7 +734,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.BodyParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.BodyParameter">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -807,7 +807,7 @@
</return>
<argument index="0" name="body" type="RID">
</argument>
- <argument index="1" name="state" type="int" enum="PhysicsServer.BodyState">
+ <argument index="1" name="state" type="int" enum="PhysicsServer3D.BodyState">
</argument>
<argument index="2" name="value" type="Variant">
</argument>
@@ -820,7 +820,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.ConeTwistJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.ConeTwistJointParam">
</argument>
<description>
Gets a cone_twist_joint parameter (see [enum ConeTwistJointParam] constants).
@@ -831,7 +831,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.ConeTwistJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.ConeTwistJointParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -845,7 +845,7 @@
<argument index="0" name="rid" type="RID">
</argument>
<description>
- Destroys any of the objects created by PhysicsServer. If the [RID] passed is not one of the objects that can be created by PhysicsServer, an error will be sent to the console.
+ Destroys any of the objects created by PhysicsServer3D. If the [RID] passed is not one of the objects that can be created by PhysicsServer3D, an error will be sent to the console.
</description>
</method>
<method name="generic_6dof_joint_get_flag">
@@ -855,7 +855,7 @@
</argument>
<argument index="1" name="axis" type="int" enum="Vector3.Axis">
</argument>
- <argument index="2" name="flag" type="int" enum="PhysicsServer.G6DOFJointAxisFlag">
+ <argument index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag">
</argument>
<description>
Gets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants).
@@ -868,7 +868,7 @@
</argument>
<argument index="1" name="axis" type="int" enum="Vector3.Axis">
</argument>
- <argument index="2" name="param" type="int" enum="PhysicsServer.G6DOFJointAxisParam">
+ <argument index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam">
</argument>
<description>
Gets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants).
@@ -881,7 +881,7 @@
</argument>
<argument index="1" name="axis" type="int" enum="Vector3.Axis">
</argument>
- <argument index="2" name="flag" type="int" enum="PhysicsServer.G6DOFJointAxisFlag">
+ <argument index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag">
</argument>
<argument index="3" name="enable" type="bool">
</argument>
@@ -896,7 +896,7 @@
</argument>
<argument index="1" name="axis" type="int" enum="Vector3.Axis">
</argument>
- <argument index="2" name="param" type="int" enum="PhysicsServer.G6DOFJointAxisParam">
+ <argument index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam">
</argument>
<argument index="3" name="value" type="float">
</argument>
@@ -907,7 +907,7 @@
<method name="get_process_info">
<return type="int">
</return>
- <argument index="0" name="process_info" type="int" enum="PhysicsServer.ProcessInfo">
+ <argument index="0" name="process_info" type="int" enum="PhysicsServer3D.ProcessInfo">
</argument>
<description>
Returns an Info defined by the [enum ProcessInfo] input given.
@@ -918,7 +918,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="flag" type="int" enum="PhysicsServer.HingeJointFlag">
+ <argument index="1" name="flag" type="int" enum="PhysicsServer3D.HingeJointFlag">
</argument>
<description>
Gets a hinge_joint flag (see [enum HingeJointFlag] constants).
@@ -929,7 +929,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.HingeJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.HingeJointParam">
</argument>
<description>
Gets a hinge_joint parameter (see [enum HingeJointParam]).
@@ -940,7 +940,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="flag" type="int" enum="PhysicsServer.HingeJointFlag">
+ <argument index="1" name="flag" type="int" enum="PhysicsServer3D.HingeJointFlag">
</argument>
<argument index="2" name="enabled" type="bool">
</argument>
@@ -953,7 +953,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.HingeJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.HingeJointParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -973,7 +973,7 @@
<argument index="3" name="local_ref_B" type="Transform">
</argument>
<description>
- Creates a [ConeTwistJoint].
+ Creates a [ConeTwistJoint3D].
</description>
</method>
<method name="joint_create_generic_6dof">
@@ -988,7 +988,7 @@
<argument index="3" name="local_ref_B" type="Transform">
</argument>
<description>
- Creates a [Generic6DOFJoint].
+ Creates a [Generic6DOFJoint3D].
</description>
</method>
<method name="joint_create_hinge">
@@ -1003,7 +1003,7 @@
<argument index="3" name="hinge_B" type="Transform">
</argument>
<description>
- Creates a [HingeJoint].
+ Creates a [HingeJoint3D].
</description>
</method>
<method name="joint_create_pin">
@@ -1018,7 +1018,7 @@
<argument index="3" name="local_B" type="Vector3">
</argument>
<description>
- Creates a [PinJoint].
+ Creates a [PinJoint3D].
</description>
</method>
<method name="joint_create_slider">
@@ -1033,7 +1033,7 @@
<argument index="3" name="local_ref_B" type="Transform">
</argument>
<description>
- Creates a [SliderJoint].
+ Creates a [SliderJoint3D].
</description>
</method>
<method name="joint_get_solver_priority" qualifiers="const">
@@ -1042,16 +1042,16 @@
<argument index="0" name="joint" type="RID">
</argument>
<description>
- Gets the priority value of the Joint.
+ Gets the priority value of the Joint3D.
</description>
</method>
<method name="joint_get_type" qualifiers="const">
- <return type="int" enum="PhysicsServer.JointType">
+ <return type="int" enum="PhysicsServer3D.JointType">
</return>
<argument index="0" name="joint" type="RID">
</argument>
<description>
- Returns the type of the Joint.
+ Returns the type of the Joint3D.
</description>
</method>
<method name="joint_set_solver_priority">
@@ -1062,7 +1062,7 @@
<argument index="1" name="priority" type="int">
</argument>
<description>
- Sets the priority value of the Joint.
+ Sets the priority value of the Joint3D.
</description>
</method>
<method name="pin_joint_get_local_a" qualifiers="const">
@@ -1088,7 +1088,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.PinJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.PinJointParam">
</argument>
<description>
Gets a pin_joint parameter (see [enum PinJointParam] constants).
@@ -1121,7 +1121,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.PinJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.PinJointParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -1141,7 +1141,7 @@
<method name="shape_create">
<return type="RID">
</return>
- <argument index="0" name="type" type="int" enum="PhysicsServer.ShapeType">
+ <argument index="0" name="type" type="int" enum="PhysicsServer3D.ShapeType">
</argument>
<description>
Creates a shape of a type from [enum ShapeType]. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape].
@@ -1157,7 +1157,7 @@
</description>
</method>
<method name="shape_get_type" qualifiers="const">
- <return type="int" enum="PhysicsServer.ShapeType">
+ <return type="int" enum="PhysicsServer3D.ShapeType">
</return>
<argument index="0" name="shape" type="RID">
</argument>
@@ -1181,7 +1181,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.SliderJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.SliderJointParam">
</argument>
<description>
Gets a slider_joint parameter (see [enum SliderJointParam] constants).
@@ -1192,7 +1192,7 @@
</return>
<argument index="0" name="joint" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.SliderJointParam">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.SliderJointParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -1208,12 +1208,12 @@
</description>
</method>
<method name="space_get_direct_state">
- <return type="PhysicsDirectSpaceState">
+ <return type="PhysicsDirectSpaceState3D">
</return>
<argument index="0" name="space" type="RID">
</argument>
<description>
- Returns the state of a space, a [PhysicsDirectSpaceState]. This object can be used to make collision/intersection queries.
+ Returns the state of a space, a [PhysicsDirectSpaceState3D]. This object can be used to make collision/intersection queries.
</description>
</method>
<method name="space_get_param" qualifiers="const">
@@ -1221,7 +1221,7 @@
</return>
<argument index="0" name="space" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.SpaceParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.SpaceParameter">
</argument>
<description>
Returns the value of a space parameter.
@@ -1252,7 +1252,7 @@
</return>
<argument index="0" name="space" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="PhysicsServer.SpaceParameter">
+ <argument index="1" name="param" type="int" enum="PhysicsServer3D.SpaceParameter">
</argument>
<argument index="2" name="value" type="float">
</argument>
@@ -1263,19 +1263,19 @@
</methods>
<constants>
<constant name="JOINT_PIN" value="0" enum="JointType">
- The [Joint] is a [PinJoint].
+ The [Joint3D] is a [PinJoint3D].
</constant>
<constant name="JOINT_HINGE" value="1" enum="JointType">
- The [Joint] is a [HingeJoint].
+ The [Joint3D] is a [HingeJoint3D].
</constant>
<constant name="JOINT_SLIDER" value="2" enum="JointType">
- The [Joint] is a [SliderJoint].
+ The [Joint3D] is a [SliderJoint3D].
</constant>
<constant name="JOINT_CONE_TWIST" value="3" enum="JointType">
- The [Joint] is a [ConeTwistJoint].
+ The [Joint3D] is a [ConeTwistJoint3D].
</constant>
<constant name="JOINT_6DOF" value="4" enum="JointType">
- The [Joint] is a [Generic6DOFJoint].
+ The [Joint3D] is a [Generic6DOFJoint3D].
</constant>
<constant name="PIN_JOINT_BIAS" value="0" enum="PinJointParam">
The strength with which the pinned objects try to stay in positional relation to each other.
@@ -1286,7 +1286,7 @@
The higher, the stronger.
</constant>
<constant name="PIN_JOINT_IMPULSE_CLAMP" value="2" enum="PinJointParam">
- If above 0, this value is the maximum value for an impulse that this Joint puts on its ends.
+ If above 0, this value is the maximum value for an impulse that this Joint3D puts on its ends.
</constant>
<constant name="HINGE_JOINT_BIAS" value="0" enum="HingeJointParam">
The speed with which the two bodies get pulled together when they move in different directions.
@@ -1389,7 +1389,7 @@
<constant name="CONE_TWIST_JOINT_SWING_SPAN" value="0" enum="ConeTwistJointParam">
Swing is rotation from side to side, around the axis perpendicular to the twist axis.
The swing span defines, how much rotation will not get corrected along the swing axis.
- Could be defined as looseness in the [ConeTwistJoint].
+ Could be defined as looseness in the [ConeTwistJoint3D].
If below 0.05, this behavior is locked.
</constant>
<constant name="CONE_TWIST_JOINT_TWIST_SPAN" value="1" enum="ConeTwistJointParam">
@@ -1401,7 +1401,7 @@
The higher, the faster.
</constant>
<constant name="CONE_TWIST_JOINT_SOFTNESS" value="3" enum="ConeTwistJointParam">
- The ease with which the Joint twists, if it's too low, it takes more force to twist the joint.
+ The ease with which the Joint3D twists, if it's too low, it takes more force to twist the joint.
</constant>
<constant name="CONE_TWIST_JOINT_RELAXATION" value="4" enum="ConeTwistJointParam">
Defines, how fast the swing- and twist-speed-difference on both sides gets synced.
@@ -1467,31 +1467,31 @@
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 [WorldMarginShape].
+ The [Shape3D] is a [WorldMarginShape3D].
</constant>
<constant name="SHAPE_RAY" value="1" enum="ShapeType">
- The [Shape] is a [RayShape].
+ The [Shape3D] is a [RayShape3D].
</constant>
<constant name="SHAPE_SPHERE" value="2" enum="ShapeType">
- The [Shape] is a [SphereShape].
+ The [Shape3D] is a [SphereShape3D].
</constant>
<constant name="SHAPE_BOX" value="3" enum="ShapeType">
- The [Shape] is a [BoxShape].
+ The [Shape3D] is a [BoxShape3D].
</constant>
<constant name="SHAPE_CAPSULE" value="4" enum="ShapeType">
- The [Shape] is a [CapsuleShape].
+ The [Shape3D] is a [CapsuleShape3D].
</constant>
<constant name="SHAPE_CYLINDER" value="5" enum="ShapeType">
- The [Shape] is a [CylinderShape].
+ The [Shape3D] is a [CylinderShape3D].
</constant>
<constant name="SHAPE_CONVEX_POLYGON" value="6" enum="ShapeType">
- The [Shape] is a [ConvexPolygonShape].
+ The [Shape3D] is a [ConvexPolygonShape3D].
</constant>
<constant name="SHAPE_CONCAVE_POLYGON" value="7" enum="ShapeType">
- The [Shape] is a [ConcavePolygonShape].
+ The [Shape3D] is a [ConcavePolygonShape3D].
</constant>
<constant name="SHAPE_HEIGHTMAP" value="8" enum="ShapeType">
- The [Shape] is a [HeightMapShape].
+ The [Shape3D] is a [HeightMapShape3D].
</constant>
<constant name="SHAPE_CUSTOM" value="9" enum="ShapeType">
This constant is used internally by the engine. Any attempt to create this kind of shape results in an error.
diff --git a/doc/classes/Physics2DShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters2D.xml
index 392ccbd10a..9a162dabbb 100644
--- a/doc/classes/Physics2DShapeQueryParameters.xml
+++ b/doc/classes/PhysicsShapeQueryParameters2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DShapeQueryParameters" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryParameters2D" inherits="Reference" version="4.0">
<brief_description>
Parameters to be sent to a 2D shape physics query.
</brief_description>
<description>
- This class contains the shape and other parameters for 2D intersection/collision queries. See also [Physics2DShapeQueryResult].
+ This class contains the shape and other parameters for 2D intersection/collision queries. See also [PhysicsShapeQueryResult2D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PhysicsShapeQueryParameters.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml
index 829a1d1bf0..6606cfbc59 100644
--- a/doc/classes/PhysicsShapeQueryParameters.xml
+++ b/doc/classes/PhysicsShapeQueryParameters3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryParameters" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryParameters3D" inherits="Reference" version="4.0">
<brief_description>
Parameters to be sent to a 3D shape physics query.
</brief_description>
<description>
- This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult].
+ This class contains the shape and other parameters for 3D intersection/collision queries. See also [PhysicsShapeQueryResult3D].
</description>
<tutorials>
</tutorials>
@@ -15,16 +15,16 @@
<argument index="0" name="shape" type="Resource">
</argument>
<description>
- Sets the [Shape] that will be used for collision/intersection queries.
+ Sets the [Shape3D] that will be used for collision/intersection queries.
</description>
</method>
</methods>
<members>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
- If [code]true[/code], the query will take [Area]s into account.
+ If [code]true[/code], the query will take [Area3D]s into account.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
- If [code]true[/code], the query will take [PhysicsBody]s into account.
+ If [code]true[/code], the query will take [PhysicsBody3D]s into account.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="2147483647">
The physics layer(s) the query will take into account (as a bitmask).
diff --git a/doc/classes/Physics2DShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult2D.xml
index 359a716bee..227683cc33 100644
--- a/doc/classes/Physics2DShapeQueryResult.xml
+++ b/doc/classes/PhysicsShapeQueryResult2D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DShapeQueryResult" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryResult2D" inherits="Reference" version="4.0">
<brief_description>
- Result of a 2D shape query in [Physics2DServer].
+ Result of a 2D shape query in [PhysicsServer2D].
</brief_description>
<description>
- The result of a 2D shape query in [Physics2DServer]. See also [Physics2DShapeQueryParameters].
+ The result of a 2D shape query in [PhysicsServer2D]. See also [PhysicsShapeQueryParameters2D].
</description>
<tutorials>
</tutorials>
@@ -40,7 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
+ Returns the child index of the object's [Shape2D] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
diff --git a/doc/classes/PhysicsShapeQueryResult.xml b/doc/classes/PhysicsShapeQueryResult3D.xml
index ea6dc2c39e..4555c4e242 100644
--- a/doc/classes/PhysicsShapeQueryResult.xml
+++ b/doc/classes/PhysicsShapeQueryResult3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PhysicsShapeQueryResult" inherits="Reference" version="4.0">
+<class name="PhysicsShapeQueryResult3D" inherits="Reference" version="4.0">
<brief_description>
- Result of a 3D shape query in [PhysicsServer].
+ Result of a 3D shape query in [PhysicsServer3D].
</brief_description>
<description>
- The result of a 3D shape query in [PhysicsServer]. See also [PhysicsShapeQueryParameters].
+ The result of a 3D shape query in [PhysicsServer3D]. See also [PhysicsShapeQueryParameters3D].
</description>
<tutorials>
</tutorials>
@@ -40,7 +40,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns the child index of the object's [Shape] that intersected with the shape at index [code]idx[/code].
+ Returns the child index of the object's [Shape3D] that intersected with the shape at index [code]idx[/code].
</description>
</method>
<method name="get_result_rid" qualifiers="const">
diff --git a/doc/classes/Physics2DTestMotionResult.xml b/doc/classes/PhysicsTestMotionResult2D.xml
index 9e8c03580f..301cff2885 100644
--- a/doc/classes/Physics2DTestMotionResult.xml
+++ b/doc/classes/PhysicsTestMotionResult2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Physics2DTestMotionResult" inherits="Reference" version="4.0">
+<class name="PhysicsTestMotionResult2D" inherits="Reference" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/PinJoint2D.xml b/doc/classes/PinJoint2D.xml
index 020babdf40..42155a7f25 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" version="4.0">
<brief_description>
- Pin Joint for 2D shapes.
+ Pin joint for 2D shapes.
</brief_description>
<description>
- Pin Joint for 2D rigid bodies. It pins two bodies (rigid or static) together.
+ Pin joint for 2D rigid bodies. It pins two bodies (rigid or static) together.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/PinJoint.xml b/doc/classes/PinJoint3D.xml
index 78cab4805e..0af1e60839 100644
--- a/doc/classes/PinJoint.xml
+++ b/doc/classes/PinJoint3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PinJoint" inherits="Joint" version="4.0">
+<class name="PinJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
Pin joint for 3D shapes.
</brief_description>
@@ -12,7 +12,7 @@
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="PinJoint.Param">
+ <argument index="0" name="param" type="int" enum="PinJoint3D.Param">
</argument>
<description>
Returns the value of the specified parameter.
@@ -21,7 +21,7 @@
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="PinJoint.Param">
+ <argument index="0" name="param" type="int" enum="PinJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
@@ -38,7 +38,7 @@
The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger.
</member>
<member name="params/impulse_clamp" type="float" setter="set_param" getter="get_param" default="0.0">
- If above 0, this value is the maximum value for an impulse that this Joint produces.
+ If above 0, this value is the maximum value for an impulse that this Joint3D produces.
</member>
</members>
<constants>
@@ -49,7 +49,7 @@
The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger.
</constant>
<constant name="PARAM_IMPULSE_CLAMP" value="2" enum="Param">
- If above 0, this value is the maximum value for an impulse that this Joint produces.
+ If above 0, this value is the maximum value for an impulse that this Joint3D produces.
</constant>
</constants>
</class>
diff --git a/doc/classes/Popup.xml b/doc/classes/Popup.xml
index 483e262f60..6f77f3371d 100644
--- a/doc/classes/Popup.xml
+++ b/doc/classes/Popup.xml
@@ -1,81 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Popup" inherits="Control" version="4.0">
+<class name="Popup" inherits="Window" version="4.0">
<brief_description>
Base container control for popups and dialogs.
</brief_description>
<description>
- Popup is a base [Control] used to show dialogs and popups. It's a subwindow and modal by default (see [Control]) and has helpers for custom popup behavior. All popup methods ensure correct placement within the viewport.
+ Popup is a base [Control] used to show dialogs and popups. It's a subwindow and modal by default (see [Control]) and has helpers for custom popup behavior.
</description>
<tutorials>
</tutorials>
<methods>
- <method name="popup">
- <return type="void">
- </return>
- <argument index="0" name="bounds" type="Rect2" default="Rect2( 0, 0, 0, 0 )">
- </argument>
- <description>
- Popup (show the control in modal form).
- </description>
- </method>
- <method name="popup_centered">
- <return type="void">
- </return>
- <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <description>
- Popup (show the control in modal form) in the center of the screen relative to its current canvas transform, at the current size, or at a size determined by [code]size[/code].
- </description>
- </method>
- <method name="popup_centered_clamped">
- <return type="void">
- </return>
- <argument index="0" name="size" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <argument index="1" name="fallback_ratio" type="float" default="0.75">
- </argument>
- <description>
- Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, clamping the size to [code]size[/code], then ensuring the popup is no larger than the viewport size multiplied by [code]fallback_ratio[/code].
- </description>
- </method>
- <method name="popup_centered_minsize">
- <return type="void">
- </return>
- <argument index="0" name="minsize" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <description>
- Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, ensuring the size is never smaller than [code]minsize[/code].
- </description>
- </method>
- <method name="popup_centered_ratio">
- <return type="void">
- </return>
- <argument index="0" name="ratio" type="float" default="0.75">
- </argument>
- <description>
- Popup (show the control in modal form) in the center of the screen relative to the current canvas transform, scaled at a ratio of size of the screen.
- </description>
- </method>
- <method name="set_as_minsize">
- <return type="void">
- </return>
- <description>
- Shrink popup to keep to the minimum size of content.
- </description>
- </method>
</methods>
<members>
- <member name="popup_exclusive" type="bool" setter="set_exclusive" getter="is_exclusive" default="false">
- 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>
+ <member name="borderless" type="bool" setter="set_flag" getter="get_flag" override="true" default="true" />
+ <member name="transient" type="bool" setter="set_transient" getter="is_transient" override="true" default="true" />
+ <member name="unresizable" type="bool" setter="set_flag" getter="get_flag" override="true" default="true" />
<member name="visible" type="bool" setter="set_visible" getter="is_visible" override="true" default="false" />
+ <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" override="true" default="true" />
</members>
<signals>
- <signal name="about_to_show">
- <description>
- Emitted when a popup is about to be shown. This is often used in [PopupMenu] to clear the list of options then create a new one according to the current context.
- </description>
- </signal>
<signal name="popup_hide">
<description>
Emitted when a popup is hidden.
@@ -83,11 +25,5 @@
</signal>
</signals>
<constants>
- <constant name="NOTIFICATION_POST_POPUP" value="80">
- Notification sent right after the popup is shown.
- </constant>
- <constant name="NOTIFICATION_POPUP_HIDE" value="81">
- Notification sent right after the popup is hidden.
- </constant>
</constants>
</class>
diff --git a/doc/classes/PopupDialog.xml b/doc/classes/PopupDialog.xml
deleted file mode 100644
index a8fd9c1b7d..0000000000
--- a/doc/classes/PopupDialog.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="PopupDialog" inherits="Popup" version="4.0">
- <brief_description>
- Base class for popup dialogs.
- </brief_description>
- <description>
- PopupDialog is a base class for popup dialogs, along with [WindowDialog].
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
- <theme_items>
- <theme_item name="panel" type="StyleBox">
- Sets a custom [StyleBox] for the panel of the [PopupDialog].
- </theme_item>
- </theme_items>
-</class>
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml
index 8dda33f624..569da5c58b 100644
--- a/doc/classes/PopupMenu.xml
+++ b/doc/classes/PopupMenu.xml
@@ -330,13 +330,6 @@
Returns the tooltip associated with the specified index index [code]idx[/code].
</description>
</method>
- <method name="is_hide_on_window_lose_focus" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if the popup will be hidden when the window loses focus or not.
- </description>
- </method>
<method name="is_item_checkable" qualifiers="const">
<return type="bool">
</return>
@@ -404,15 +397,6 @@
[b]Note:[/b] The indices of items after the removed item will be shifted by one.
</description>
</method>
- <method name="set_hide_on_window_lose_focus">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
- <description>
- Hides the [PopupMenu] when the window loses focus.
- </description>
- </method>
<method name="set_item_accelerator">
<return type="void">
</return>
@@ -604,7 +588,6 @@
<member name="allow_search" type="bool" setter="set_allow_search" getter="get_allow_search" default="false">
If [code]true[/code], allows to navigate [PopupMenu] with letter keys.
</member>
- <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" />
<member name="hide_on_checkable_item_selection" type="bool" setter="set_hide_on_checkable_item_selection" getter="is_hide_on_checkable_item_selection" default="true">
If [code]true[/code], hides the [PopupMenu] when a checkbox or radio button is selected.
</member>
diff --git a/doc/classes/PopupPanel.xml b/doc/classes/PopupPanel.xml
index 2e62d09f8f..72045c5559 100644
--- a/doc/classes/PopupPanel.xml
+++ b/doc/classes/PopupPanel.xml
@@ -4,7 +4,7 @@
Class for displaying popups with a panel background.
</brief_description>
<description>
- Class for displaying popups with a panel background. In some cases it might be simpler to use than [Popup], since it provides a configurable background. If you are making windows, better check [WindowDialog].
+ Class for displaying popups with a panel background. In some cases it might be simpler to use than [Popup], since it provides a configurable background. If you are making windows, better check [Window].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml
index 6dce8a91c6..ca61a57483 100644
--- a/doc/classes/Position3D.xml
+++ b/doc/classes/Position3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Position3D" inherits="Spatial" version="4.0">
+<class name="Position3D" inherits="Node3D" version="4.0">
<brief_description>
Generic 3D position hint for editing.
</brief_description>
<description>
- Generic 3D position hint for editing. It's just like a plain [Spatial], but it displays as a cross in the 3D editor at all times.
+ Generic 3D position hint for editing. It's just like a plain [Node3D], but it displays as a cross in the 3D editor at all times.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ProceduralSkyMaterial.xml b/doc/classes/ProceduralSkyMaterial.xml
index dec0cbc120..70e82d248c 100644
--- a/doc/classes/ProceduralSkyMaterial.xml
+++ b/doc/classes/ProceduralSkyMaterial.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ProceduralSkyMaterial" inherits="Material" version="4.0">
<brief_description>
- A [Material] used with [Sky] to generate a background based on user input parameters.
+ A [Material] used with [Sky] to generate a background based on user input parameters.
</brief_description>
<description>
ProceduralSkyMaterial 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 [ProceduralSkyMaterial] uses a lightweight shader to draw the sky and is thus suited for real time updates. When you do not need a quick sky that is not realistic, this is a good option.
- The [ProceduralSkyMaterial] supports up to 4 suns. Each sun takes its color, energy, and direction from the corresponding [DirectionalLight] in the scene.
+ The [ProceduralSkyMaterial] supports up to 4 suns. Each sun takes its color, energy, and direction from the corresponding [DirectionalLight3D] in the scene.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 79d5ffa2e7..46f6fd2284 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -202,7 +202,7 @@
Icon used for the project, set when project loads. Exporters will also use this icon when possible.
</member>
<member name="application/config/macos_native_icon" type="String" setter="" getter="" default="&quot;&quot;">
- Icon set in [code].icns[/code] format used on macOS to set the game's icon. This is done automatically on start by calling [method OS.set_native_icon].
+ Icon set in [code].icns[/code] format used on macOS to set the game's icon. This is done automatically on start by calling [method DisplayServer.set_native_icon].
</member>
<member name="application/config/name" type="String" setter="" getter="" default="&quot;&quot;">
The project's name. It is used both by the Project Manager and by exporters. The project name can be translated by translating its value in localization files.
@@ -215,7 +215,7 @@
If [code]true[/code], the project will save user data to its own user directory (see [member application/config/custom_user_dir_name]). This setting is only effective on desktop platforms. A name must be set in the [member application/config/custom_user_dir_name] setting for this to take effect. If [code]false[/code], the project will save user data to [code](OS user data directory)/Godot/app_userdata/(project name)[/code].
</member>
<member name="application/config/windows_native_icon" type="String" setter="" getter="" default="&quot;&quot;">
- Icon set in [code].ico[/code] format used on Windows to set the game's icon. This is done automatically on start by calling [method OS.set_native_icon].
+ Icon set in [code].ico[/code] format used on Windows to set the game's icon. This is done automatically on start by calling [method DisplayServer.set_native_icon].
</member>
<member name="application/run/disable_stderr" type="bool" setter="" getter="" default="false">
If [code]true[/code], disables printing to standard error in an exported build.
@@ -426,12 +426,6 @@
<member name="display/window/ios/hide_home_indicator" type="bool" setter="" getter="" default="true">
If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button.
</member>
- <member name="display/window/per_pixel_transparency/allowed" type="bool" setter="" getter="" default="false">
- If [code]true[/code], allows per-pixel transparency in a desktop window. This affects performance, so leave it on [code]false[/code] unless you need it.
- </member>
- <member name="display/window/per_pixel_transparency/enabled" type="bool" setter="" getter="" default="false">
- Sets the window background to transparent when it starts.
- </member>
<member name="display/window/size/always_on_top" type="bool" setter="" getter="" default="false">
Force the window to be always on top.
</member>
@@ -898,7 +892,7 @@
[b]Note:[/b] This property is only read when the project starts. To change the default gravity at runtime, use the following code sample:
[codeblock]
# Set the default gravity strength to 98.
- Physics2DServer.area_set_param(get_viewport().find_world_2d().get_space(), Physics2DServer.AREA_PARAM_GRAVITY, 98)
+ PhysicsServer2D.area_set_param(get_viewport().find_world_2d().get_space(), PhysicsServer2D.AREA_PARAM_GRAVITY, 98)
[/codeblock]
</member>
<member name="physics/2d/default_gravity_vector" type="Vector2" setter="" getter="" default="Vector2( 0, 1 )">
@@ -906,7 +900,7 @@
[b]Note:[/b] This property is only read when the project starts. To change the default gravity vector at runtime, use the following code sample:
[codeblock]
# Set the default gravity direction to `Vector2(0, 1)`.
- Physics2DServer.area_set_param(get_viewport().find_world_2d().get_space(), Physics2DServer.AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1))
+ PhysicsServer2D.area_set_param(get_viewport().find_world_2d().get_space(), PhysicsServer2D.AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1))
[/codeblock]
</member>
<member name="physics/2d/default_linear_damp" type="float" setter="" getter="" default="0.1">
@@ -920,20 +914,20 @@
"DEFAULT" and "GodotPhysics" are the same, as there is currently no alternative 2D physics server implemented.
</member>
<member name="physics/2d/sleep_threshold_angular" type="float" setter="" getter="" default="0.139626">
- Threshold angular velocity under which a 2D physics body will be considered inactive. See [constant Physics2DServer.SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD].
+ Threshold angular velocity under which a 2D physics body will be considered inactive. See [constant PhysicsServer2D.SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD].
</member>
<member name="physics/2d/sleep_threshold_linear" type="float" setter="" getter="" default="2.0">
- Threshold linear velocity under which a 2D physics body will be considered inactive. See [constant Physics2DServer.SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD].
+ Threshold linear velocity under which a 2D physics body will be considered inactive. See [constant PhysicsServer2D.SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD].
</member>
<member name="physics/2d/thread_model" type="int" setter="" getter="" default="1">
Sets 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.
[b]Warning:[/b] As of Godot 3.2, there are mixed reports about the use of a Multi-Threaded thread model for physics. Be sure to assess whether it does give you extra performance and no regressions when using it.
</member>
<member name="physics/2d/time_before_sleep" type="float" setter="" getter="" default="0.5">
- Time (in seconds) of inactivity before which a 2D physics body will put to sleep. See [constant Physics2DServer.SPACE_PARAM_BODY_TIME_TO_SLEEP].
+ Time (in seconds) of inactivity before which a 2D physics body will put to sleep. See [constant PhysicsServer2D.SPACE_PARAM_BODY_TIME_TO_SLEEP].
</member>
<member name="physics/3d/active_soft_world" type="bool" setter="" getter="" default="true">
- Sets whether the 3D physics world will be created with support for [SoftBody] physics. Only applies to the Bullet physics engine.
+ Sets whether the 3D physics world will be created with support for [SoftBody3D] physics. Only applies to the Bullet physics engine.
</member>
<member name="physics/3d/default_angular_damp" type="float" setter="" getter="" default="0.1">
The default angular damp in 3D.
@@ -943,7 +937,7 @@
[b]Note:[/b] This property is only read when the project starts. To change the default gravity at runtime, use the following code sample:
[codeblock]
# Set the default gravity strength to 9.8.
- PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 9.8)
+ PhysicsServer3D.area_set_param(get_viewport().find_world().get_space(), PhysicsServer3D.AREA_PARAM_GRAVITY, 9.8)
[/codeblock]
</member>
<member name="physics/3d/default_gravity_vector" type="Vector3" setter="" getter="" default="Vector3( 0, -1, 0 )">
@@ -951,7 +945,7 @@
[b]Note:[/b] This property is only read when the project starts. To change the default gravity vector at runtime, use the following code sample:
[codeblock]
# Set the default gravity direction to `Vector3(0, -1, 0)`.
- PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0))
+ PhysicsServer3D.area_set_param(get_viewport().find_world().get_space(), PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR, Vector3(0, -1, 0))
[/codeblock]
</member>
<member name="physics/3d/default_linear_damp" type="float" setter="" getter="" default="0.1">
@@ -973,7 +967,7 @@
[b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.physics_jitter_fix] instead.
</member>
<member name="rendering/environment/default_clear_color" type="Color" setter="" getter="" default="Color( 0.3, 0.3, 0.3, 1 )">
- Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method VisualServer.set_default_clear_color].
+ Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method RenderingServer.set_default_clear_color].
</member>
<member name="rendering/environment/default_environment" type="String" setter="" getter="" default="&quot;&quot;">
[Environment] that will be used as a fallback environment in case a scene does not specify its own environment. The default environment is loaded in at scene load time regardless of whether you have set an environment or not. If you do not rely on the fallback environment, it is best to delete [code]default_env.tres[/code], or to specify a different default environment here.
@@ -1002,7 +996,9 @@
</member>
<member name="rendering/quality/driver/driver_name" type="String" setter="" getter="" default="&quot;Vulkan&quot;">
The video driver to use ("GLES2" or "Vulkan").
- [b]Note:[/b] The backend in use can be overridden at runtime via the [code]--video-driver[/code] command line argument. In such cases, this property is not updated, so use [method OS.get_current_video_driver] to query it at run-time.
+ [b]Note:[/b] The backend in use can be overridden at runtime via the [code]--rendering-driver[/code] command line argument.
+ [b]FIXME:[/b] No longer valid after DisplayServer split:
+ In such cases, this property is not updated, so use [code]OS.get_current_video_driver[/code] to query it at run-time.
</member>
<member name="rendering/quality/filters/depth_of_field_bokeh_quality" type="int" setter="" getter="" default="2">
</member>
@@ -1027,6 +1023,10 @@
</member>
<member name="rendering/quality/gi_probes/quality" type="int" setter="" getter="" default="1">
</member>
+ <member name="rendering/quality/glow/upscale_mode" type="int" setter="" getter="" default="1">
+ </member>
+ <member name="rendering/quality/glow/upscale_mode.mobile" type="int" setter="" getter="" default="0">
+ </member>
<member name="rendering/quality/intended_usage/framebuffer_allocation" type="int" setter="" getter="" default="2">
Strategy used for framebuffer allocation. The simpler it is, the less resources it uses (but the less features it supports). If set to "2D Without Sampling" or "3D Without Effects", sample buffers will not be allocated. This means [code]SCREEN_TEXTURE[/code] and [code]DEPTH_TEXTURE[/code] will not be available in shaders and post-processing effects will not be available in the [Environment].
</member>
diff --git a/doc/classes/ProximityGroup.xml b/doc/classes/ProximityGroup3D.xml
index dee1a3daf0..1714c1ec8d 100644
--- a/doc/classes/ProximityGroup.xml
+++ b/doc/classes/ProximityGroup3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ProximityGroup" inherits="Spatial" version="4.0">
+<class name="ProximityGroup3D" inherits="Node3D" version="4.0">
<brief_description>
General-purpose proximity detection node.
</brief_description>
@@ -21,7 +21,7 @@
</method>
</methods>
<members>
- <member name="dispatch_mode" type="int" setter="set_dispatch_mode" getter="get_dispatch_mode" enum="ProximityGroup.DispatchMode" default="0">
+ <member name="dispatch_mode" type="int" setter="set_dispatch_mode" getter="get_dispatch_mode" enum="ProximityGroup3D.DispatchMode" default="0">
</member>
<member name="grid_radius" type="Vector3" setter="set_grid_radius" getter="get_grid_radius" default="Vector3( 1, 1, 1 )">
</member>
diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml
index 77c608fccb..644c427120 100644
--- a/doc/classes/RID.xml
+++ b/doc/classes/RID.xml
@@ -4,7 +4,7 @@
Handle for a [Resource]'s unique ID.
</brief_description>
<description>
- The RID type is used to access the unique integer ID of a resource. They are opaque, which means they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [VisualServer].
+ The RID type is used to access the unique integer ID of a resource. They are opaque, which means they do not grant access to the associated resource by themselves. They are used by and with the low-level Server classes such as [RenderingServer].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/RayCast.xml b/doc/classes/RayCast3D.xml
index 65f632ba74..08c6d6f40c 100644
--- a/doc/classes/RayCast.xml
+++ b/doc/classes/RayCast3D.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayCast" inherits="Spatial" version="4.0">
+<class name="RayCast3D" inherits="Node3D" version="4.0">
<brief_description>
Query the closest object intersecting a ray.
</brief_description>
<description>
A RayCast represents a line from its origin to its destination position, [code]cast_to[/code]. It is used to query the 3D space in order to find the closest object along the path of the ray.
- RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code] or by setting proper filtering with collision layers and masks.
- RayCast can be configured to report collisions with [Area]s ([member collide_with_areas]) and/or [PhysicsBody]s ([member collide_with_bodies]).
+ RayCast3D can ignore some objects by adding them to the exception list via [code]add_exception[/code] or by setting proper filtering with collision layers and masks.
+ RayCast3D can be configured to report collisions with [Area3D]s ([member collide_with_areas]) and/or [PhysicsBody3D]s ([member collide_with_bodies]).
Only enabled raycasts will be able to query the space and report collisions.
- RayCast calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame), use [method force_raycast_update] after adjusting the raycast.
+ RayCast3D calculates intersection every physics frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between physics frames (or during the same frame), use [method force_raycast_update] after adjusting the raycast.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
@@ -130,10 +130,10 @@
The ray's destination point, relative to the RayCast's [code]position[/code].
</member>
<member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false">
- If [code]true[/code], collision with [Area]s will be reported.
+ If [code]true[/code], collision with [Area3D]s will be reported.
</member>
<member name="collide_with_bodies" type="bool" setter="set_collide_with_bodies" getter="is_collide_with_bodies_enabled" default="true">
- If [code]true[/code], collision with [PhysicsBody]s will be reported.
+ If [code]true[/code], collision with [PhysicsBody3D]s will be reported.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
The ray's collision mask. Only objects in at least one collision layer enabled in the mask will be detected.
@@ -142,7 +142,7 @@
If [code]true[/code], collisions will be reported.
</member>
<member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true">
- If [code]true[/code], collisions will be ignored for this RayCast's immediate parent.
+ If [code]true[/code], collisions will be ignored for this RayCast3D's immediate parent.
</member>
</members>
<constants>
diff --git a/doc/classes/RayShape.xml b/doc/classes/RayShape3D.xml
index 87a642f779..9839044c30 100644
--- a/doc/classes/RayShape.xml
+++ b/doc/classes/RayShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RayShape" inherits="Shape" version="4.0">
+<class name="RayShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Ray shape for 3D collisions.
</brief_description>
<description>
- Ray shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
+ Ray shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. A ray is not really a collision body; instead, it tries to separate itself from whatever is touching its far endpoint. It's often useful for characters.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml
index e138af6841..84f87c3e71 100644
--- a/doc/classes/ReflectionProbe.xml
+++ b/doc/classes/ReflectionProbe.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ReflectionProbe" inherits="VisualInstance" version="4.0">
+<class name="ReflectionProbe" inherits="VisualInstance3D" version="4.0">
<brief_description>
Captures its surroundings to create reflections.
</brief_description>
@@ -17,7 +17,7 @@
If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location.
</member>
<member name="cull_mask" type="int" setter="set_cull_mask" getter="get_cull_mask" default="1048575">
- Sets the cull mask which determines what objects are drawn by this probe. Every [VisualInstance] with a layer included in this cull mask will be rendered by the probe. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost.
+ Sets the cull mask which determines what objects are drawn by this probe. Every [VisualInstance3D] with a layer included in this cull mask will be rendered by the probe. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost.
</member>
<member name="enable_shadows" type="bool" setter="set_enable_shadows" getter="are_shadows_enabled" default="false">
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the [constant UPDATE_ALWAYS] [member update_mode].
diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform3D.xml
index feb6ac1841..bd3da2aea9 100644
--- a/doc/classes/RemoteTransform.xml
+++ b/doc/classes/RemoteTransform3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RemoteTransform" inherits="Spatial" version="4.0">
+<class name="RemoteTransform3D" inherits="Node3D" version="4.0">
<brief_description>
- RemoteTransform pushes its own [Transform] to another [Spatial] derived Node in the scene.
+ RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node in the scene.
</brief_description>
<description>
- RemoteTransform pushes its own [Transform] to another [Spatial] derived Node (called the remote node) in the scene.
+ RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node (called the remote node) in the scene.
It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates.
</description>
<tutorials>
@@ -14,13 +14,13 @@
<return type="void">
</return>
<description>
- [RemoteTransform] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again.
+ [RemoteTransform3D] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again.
</description>
</method>
</methods>
<members>
<member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node" default="NodePath(&quot;&quot;)">
- The [NodePath] to the remote node, relative to the RemoteTransform's position in the scene.
+ The [NodePath] to the remote node, relative to the RemoteTransform3D's position in the scene.
</member>
<member name="update_position" type="bool" setter="set_update_position" getter="get_update_position" default="true">
If [code]true[/code], the remote node's position is updated.
diff --git a/doc/classes/VisualServer.xml b/doc/classes/RenderingServer.xml
index 00e0b7cdc9..965d6bf175 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualServer" inherits="Object" version="4.0">
+<class name="RenderingServer" inherits="Object" version="4.0">
<brief_description>
Server for anything visible.
</brief_description>
@@ -9,7 +9,7 @@
The visual server can be used to bypass the scene system entirely.
Resources are created using the [code]*_create[/code] functions.
All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas].
- In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any [Spatial] node with [method Spatial.get_world]. Otherwise, a scenario can be created with [method scenario_create].
+ In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world]. Otherwise, a scenario can be created with [method scenario_create].
Similarly in 2D, a canvas is needed to draw all canvas items.
In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using [method instance_set_base]. The instance must also be attached to the scenario using [method instance_set_scenario] in order to be visible.
In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas.
@@ -52,8 +52,8 @@
<return type="RID">
</return>
<description>
- Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="camera_set_cull_mask">
@@ -64,7 +64,7 @@
<argument index="1" name="layers" type="int">
</argument>
<description>
- Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera.cull_mask].
+ Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera3D.cull_mask].
</description>
</method>
<method name="camera_set_environment">
@@ -75,7 +75,7 @@
<argument index="1" name="env" type="RID">
</argument>
<description>
- Sets the environment used by this camera. Equivalent to [member Camera.environment].
+ Sets the environment used by this camera. Equivalent to [member Camera3D.environment].
</description>
</method>
<method name="camera_set_frustum">
@@ -144,15 +144,15 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera.KEEP_HEIGHT].
+ If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera3D.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera3D.KEEP_HEIGHT].
</description>
</method>
<method name="canvas_create">
<return type="RID">
</return>
<description>
- Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="canvas_item_clear">
@@ -247,8 +247,8 @@
<return type="RID">
</return>
<description>
- Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="canvas_light_occluder_attach_to_canvas">
@@ -266,8 +266,8 @@
<return type="RID">
</return>
<description>
- Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="canvas_light_occluder_set_enabled">
@@ -398,7 +398,7 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.CanvasLightMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.CanvasLightMode">
</argument>
<description>
The mode of the light, see [enum CanvasLightMode] constants.
@@ -453,7 +453,7 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="filter" type="int" enum="VisualServer.CanvasLightShadowFilter">
+ <argument index="1" name="filter" type="int" enum="RenderingServer.CanvasLightShadowFilter">
</argument>
<description>
Sets the canvas light's shadow's filter, see [enum CanvasLightShadowFilter] constants.
@@ -520,8 +520,8 @@
<return type="RID">
</return>
<description>
- Creates a new light occluder polygon and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="canvas_occluder_polygon_set_cull_mode">
@@ -529,7 +529,7 @@
</return>
<argument index="0" name="occluder_polygon" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.CanvasOccluderPolygonCullMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.CanvasOccluderPolygonCullMode">
</argument>
<description>
Sets an occluder polygons cull mode. See [enum CanvasOccluderPolygonCullMode] constants.
@@ -587,8 +587,8 @@
<return type="RID">
</return>
<description>
- Creates a directional light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this directional light to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -596,8 +596,8 @@
<return type="RID">
</return>
<description>
- Creates an environment and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="environment_set_adjustment">
@@ -626,13 +626,13 @@
</argument>
<argument index="1" name="color" type="Color">
</argument>
- <argument index="2" name="ambient" type="int" enum="VisualServer.EnvironmentAmbientSource" default="0">
+ <argument index="2" name="ambient" type="int" enum="RenderingServer.EnvironmentAmbientSource" default="0">
</argument>
<argument index="3" name="energy" type="float" default="1.0">
</argument>
<argument index="4" name="sky_contibution" type="float" default="0.0">
</argument>
- <argument index="5" name="reflection_source" type="int" enum="VisualServer.EnvironmentReflectionSource" default="0">
+ <argument index="5" name="reflection_source" type="int" enum="RenderingServer.EnvironmentReflectionSource" default="0">
</argument>
<argument index="6" name="ao_color" type="Color" default="Color( 0, 0, 0, 1 )">
</argument>
@@ -644,7 +644,7 @@
</return>
<argument index="0" name="env" type="RID">
</argument>
- <argument index="1" name="bg" type="int" enum="VisualServer.EnvironmentBG">
+ <argument index="1" name="bg" type="int" enum="RenderingServer.EnvironmentBG">
</argument>
<description>
Sets the [i]BGMode[/i] of the environment. Equivalent to [member Environment.background_mode].
@@ -755,7 +755,7 @@
</argument>
<argument index="6" name="bloom_threshold" type="float">
</argument>
- <argument index="7" name="blend_mode" type="int" enum="VisualServer.EnvironmentGlowBlendMode">
+ <argument index="7" name="blend_mode" type="int" enum="RenderingServer.EnvironmentGlowBlendMode">
</argument>
<argument index="8" name="hdr_bleed_threshold" type="float">
</argument>
@@ -763,8 +763,6 @@
</argument>
<argument index="10" name="hdr_luminance_cap" type="float">
</argument>
- <argument index="11" name="bicubic_upscale" type="bool">
- </argument>
<description>
</description>
</method>
@@ -818,7 +816,7 @@
</argument>
<argument index="6" name="ao_channel_affect" type="float">
</argument>
- <argument index="7" name="blur" type="int" enum="VisualServer.EnvironmentSSAOBlur">
+ <argument index="7" name="blur" type="int" enum="RenderingServer.EnvironmentSSAOBlur">
</argument>
<argument index="8" name="bilateral_sharpness" type="float">
</argument>
@@ -851,7 +849,7 @@
</return>
<argument index="0" name="env" type="RID">
</argument>
- <argument index="1" name="tone_mapper" type="int" enum="VisualServer.EnvironmentToneMapper">
+ <argument index="1" name="tone_mapper" type="int" enum="RenderingServer.EnvironmentToneMapper">
</argument>
<argument index="2" name="exposure" type="float">
</argument>
@@ -902,13 +900,13 @@
<argument index="0" name="rid" type="RID">
</argument>
<description>
- Tries to free an object in the VisualServer.
+ Tries to free an object in the RenderingServer.
</description>
</method>
<method name="get_render_info">
<return type="int">
</return>
- <argument index="0" name="info" type="int" enum="VisualServer.RenderInfo">
+ <argument index="0" name="info" type="int" enum="RenderingServer.RenderInfo">
</argument>
<description>
Returns a certain information, see [enum RenderInfo] for options.
@@ -955,13 +953,13 @@
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if changes have been made to the VisualServer's data. [method force_draw] is usually called if this happens.
+ Returns [code]true[/code] if changes have been made to the RenderingServer's data. [method force_draw] is usually called if this happens.
</description>
</method>
<method name="has_feature" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="feature" type="int" enum="VisualServer.Features">
+ <argument index="0" name="feature" type="int" enum="RenderingServer.Features">
</argument>
<description>
Not yet implemented. Always returns [code]false[/code].
@@ -981,12 +979,12 @@
</return>
<argument index="0" name="immediate" type="RID">
</argument>
- <argument index="1" name="primitive" type="int" enum="VisualServer.PrimitiveType">
+ <argument index="1" name="primitive" type="int" enum="RenderingServer.PrimitiveType">
</argument>
<argument index="2" name="texture" type="RID">
</argument>
<description>
- Sets up [ImmediateGeometry] internals to prepare for drawing. Equivalent to [method ImmediateGeometry.begin].
+ Sets up [ImmediateGeometry3D] internals to prepare for drawing. Equivalent to [method ImmediateGeometry3D.begin].
</description>
</method>
<method name="immediate_clear">
@@ -995,7 +993,7 @@
<argument index="0" name="immediate" type="RID">
</argument>
<description>
- Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry.clear].
+ Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry3D.clear].
</description>
</method>
<method name="immediate_color">
@@ -1006,15 +1004,15 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry.set_color].
+ Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_color].
</description>
</method>
<method name="immediate_create">
<return type="RID">
</return>
<description>
- Creates an immediate geometry and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]immediate_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates an immediate geometry and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]immediate_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this immediate geometry to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -1024,7 +1022,7 @@
<argument index="0" name="immediate" type="RID">
</argument>
<description>
- Ends drawing the [ImmediateGeometry] and displays it. Equivalent to [method ImmediateGeometry.end].
+ Ends drawing the [ImmediateGeometry3D] and displays it. Equivalent to [method ImmediateGeometry3D.end].
</description>
</method>
<method name="immediate_get_material" qualifiers="const">
@@ -1033,7 +1031,7 @@
<argument index="0" name="immediate" type="RID">
</argument>
<description>
- Returns the material assigned to the [ImmediateGeometry].
+ Returns the material assigned to the [ImmediateGeometry3D].
</description>
</method>
<method name="immediate_normal">
@@ -1044,7 +1042,7 @@
<argument index="1" name="normal" type="Vector3">
</argument>
<description>
- Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry.set_normal].
+ Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_normal].
</description>
</method>
<method name="immediate_set_material">
@@ -1055,7 +1053,7 @@
<argument index="1" name="material" type="RID">
</argument>
<description>
- Sets the material to be used to draw the [ImmediateGeometry].
+ Sets the material to be used to draw the [ImmediateGeometry3D].
</description>
</method>
<method name="immediate_tangent">
@@ -1066,7 +1064,7 @@
<argument index="1" name="tangent" type="Plane">
</argument>
<description>
- Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry.set_tangent].
+ Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_tangent].
</description>
</method>
<method name="immediate_uv">
@@ -1077,7 +1075,7 @@
<argument index="1" name="tex_uv" type="Vector2">
</argument>
<description>
- Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv].
+ Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_uv].
</description>
</method>
<method name="immediate_uv2">
@@ -1088,7 +1086,7 @@
<argument index="1" name="tex_uv" type="Vector2">
</argument>
<description>
- Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv2].
+ Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry3D.set_uv2].
</description>
</method>
<method name="immediate_vertex">
@@ -1099,7 +1097,7 @@
<argument index="1" name="vertex" type="Vector3">
</argument>
<description>
- Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry.add_vertex].
+ Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry3D.add_vertex].
</description>
</method>
<method name="immediate_vertex_2d">
@@ -1110,7 +1108,7 @@
<argument index="1" name="vertex" type="Vector2">
</argument>
<description>
- Adds the next vertex using the information provided in advance. This is a helper class that calls [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry.add_vertex].
+ Adds the next vertex using the information provided in advance. This is a helper class that calls [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry3D.add_vertex].
</description>
</method>
<method name="init">
@@ -1146,8 +1144,8 @@
<return type="RID">
</return>
<description>
- Creates a visual instance and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using [method instance_set_base].
</description>
</method>
@@ -1159,8 +1157,8 @@
<argument index="1" name="scenario" type="RID">
</argument>
<description>
- Creates a visual instance, adds it to the VisualServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="instance_geometry_set_as_instance_lod">
@@ -1179,10 +1177,10 @@
</return>
<argument index="0" name="instance" type="RID">
</argument>
- <argument index="1" name="shadow_casting_setting" type="int" enum="VisualServer.ShadowCastingSetting">
+ <argument index="1" name="shadow_casting_setting" type="int" enum="RenderingServer.ShadowCastingSetting">
</argument>
<description>
- Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance.cast_shadow].
+ Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance3D.cast_shadow].
</description>
</method>
<method name="instance_geometry_set_draw_range">
@@ -1207,7 +1205,7 @@
</return>
<argument index="0" name="instance" type="RID">
</argument>
- <argument index="1" name="flag" type="int" enum="VisualServer.InstanceFlags">
+ <argument index="1" name="flag" type="int" enum="RenderingServer.InstanceFlags">
</argument>
<argument index="2" name="enabled" type="bool">
</argument>
@@ -1223,7 +1221,7 @@
<argument index="1" name="material" type="RID">
</argument>
<description>
- Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance.material_override].
+ Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override].
</description>
</method>
<method name="instance_set_base">
@@ -1234,7 +1232,7 @@
<argument index="1" name="base" type="RID">
</argument>
<description>
- Sets the base of the instance. A base can be any of the 3D objects that are created in the VisualServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario.
+ Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario.
</description>
</method>
<method name="instance_set_blend_shape_weight">
@@ -1258,7 +1256,7 @@
<argument index="1" name="aabb" type="AABB">
</argument>
<description>
- Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance.set_custom_aabb].
+ Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance3D.set_custom_aabb].
</description>
</method>
<method name="instance_set_exterior">
@@ -1280,7 +1278,7 @@
<argument index="1" name="margin" type="float">
</argument>
<description>
- Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance.extra_cull_margin].
+ Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance3D.extra_cull_margin].
</description>
</method>
<method name="instance_set_layer_mask">
@@ -1291,7 +1289,7 @@
<argument index="1" name="mask" type="int">
</argument>
<description>
- Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance.layers].
+ Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance3D.layers].
</description>
</method>
<method name="instance_set_scenario">
@@ -1315,7 +1313,7 @@
<argument index="2" name="material" type="RID">
</argument>
<description>
- Sets the material of a specific surface. Equivalent to [method MeshInstance.set_surface_material].
+ Sets the material of a specific surface. Equivalent to [method MeshInstance3D.set_surface_material].
</description>
</method>
<method name="instance_set_transform">
@@ -1326,7 +1324,7 @@
<argument index="1" name="transform" type="Transform">
</argument>
<description>
- Sets the world space transform of the instance. Equivalent to [member Spatial.transform].
+ Sets the world space transform of the instance. Equivalent to [member Node3D.transform].
</description>
</method>
<method name="instance_set_use_lightmap">
@@ -1350,7 +1348,7 @@
<argument index="1" name="visible" type="bool">
</argument>
<description>
- Sets whether an instance is drawn or not. Equivalent to [member Spatial.visible].
+ Sets whether an instance is drawn or not. Equivalent to [member Node3D.visible].
</description>
</method>
<method name="instances_cull_aabb" qualifiers="const">
@@ -1361,7 +1359,7 @@
<argument index="1" name="scenario" type="RID">
</argument>
<description>
- Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
+ Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
@@ -1373,7 +1371,7 @@
<argument index="1" name="scenario" type="RID">
</argument>
<description>
- Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
+ Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
@@ -1387,7 +1385,7 @@
<argument index="2" name="scenario" type="RID">
</argument>
<description>
- Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
+ Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
@@ -1399,7 +1397,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight.directional_shadow_blend_splits].
+ If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight3D.directional_shadow_blend_splits].
</description>
</method>
<method name="light_directional_set_shadow_depth_range_mode">
@@ -1407,10 +1405,10 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="range_mode" type="int" enum="VisualServer.LightDirectionalShadowDepthRangeMode">
+ <argument index="1" name="range_mode" type="int" enum="RenderingServer.LightDirectionalShadowDepthRangeMode">
</argument>
<description>
- Sets the shadow depth range mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options.
+ Sets the shadow depth range mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options.
</description>
</method>
<method name="light_directional_set_shadow_mode">
@@ -1418,10 +1416,10 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.LightDirectionalShadowMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.LightDirectionalShadowMode">
</argument>
<description>
- Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options.
+ Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options.
</description>
</method>
<method name="light_omni_set_shadow_mode">
@@ -1429,10 +1427,10 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.LightOmniShadowMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.LightOmniShadowMode">
</argument>
<description>
- Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [member OmniLight.omni_shadow_mode].
+ Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [member OmniLight3D.omni_shadow_mode].
</description>
</method>
<method name="light_set_color">
@@ -1443,7 +1441,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Sets the color of the light. Equivalent to [member Light.light_color].
+ Sets the color of the light. Equivalent to [member Light3D.light_color].
</description>
</method>
<method name="light_set_cull_mask">
@@ -1454,7 +1452,7 @@
<argument index="1" name="mask" type="int">
</argument>
<description>
- Sets the cull mask for this Light. Lights only affect objects in the selected layers. Equivalent to [member Light.light_cull_mask].
+ Sets the cull mask for this Light3D. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask].
</description>
</method>
<method name="light_set_negative">
@@ -1465,7 +1463,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light.light_negative].
+ If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light3D.light_negative].
</description>
</method>
<method name="light_set_param">
@@ -1473,12 +1471,12 @@
</return>
<argument index="0" name="light" type="RID">
</argument>
- <argument index="1" name="param" type="int" enum="VisualServer.LightParam">
+ <argument index="1" name="param" type="int" enum="RenderingServer.LightParam">
</argument>
<argument index="2" name="value" type="float">
</argument>
<description>
- Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light.set_param].
+ Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light3D.set_param].
</description>
</method>
<method name="light_set_projector">
@@ -1500,7 +1498,7 @@
<argument index="1" name="enabled" type="bool">
</argument>
<description>
- If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light.shadow_reverse_cull_face].
+ If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light3D.shadow_reverse_cull_face].
</description>
</method>
<method name="light_set_shadow">
@@ -1511,7 +1509,7 @@
<argument index="1" name="enabled" type="bool">
</argument>
<description>
- If [code]true[/code], light will cast shadows. Equivalent to [member Light.shadow_enabled].
+ If [code]true[/code], light will cast shadows. Equivalent to [member Light3D.shadow_enabled].
</description>
</method>
<method name="light_set_shadow_color">
@@ -1522,7 +1520,7 @@
<argument index="1" name="color" type="Color">
</argument>
<description>
- Sets the color of the shadow cast by the light. Equivalent to [member Light.shadow_color].
+ Sets the color of the shadow cast by the light. Equivalent to [member Light3D.shadow_color].
</description>
</method>
<method name="light_set_use_gi">
@@ -1540,8 +1538,8 @@
<return type="RID">
</return>
<description>
- Creates a lightmap capture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_capture_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a lightmap capture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]lightmap_capture_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this lightmap capture to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -1662,8 +1660,8 @@
<return type="RID">
</return>
<description>
- Creates an empty material and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="material_get_param" qualifiers="const">
@@ -1728,7 +1726,7 @@
</return>
<argument index="0" name="mesh" type="RID">
</argument>
- <argument index="1" name="primitive" type="int" enum="VisualServer.PrimitiveType">
+ <argument index="1" name="primitive" type="int" enum="RenderingServer.PrimitiveType">
</argument>
<argument index="2" name="arrays" type="Array">
</argument>
@@ -1756,8 +1754,8 @@
<return type="RID">
</return>
<description>
- Creates a new mesh and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -1771,7 +1769,7 @@
</description>
</method>
<method name="mesh_get_blend_shape_mode" qualifiers="const">
- <return type="int" enum="VisualServer.BlendShapeMode">
+ <return type="int" enum="RenderingServer.BlendShapeMode">
</return>
<argument index="0" name="mesh" type="RID">
</argument>
@@ -1802,7 +1800,7 @@
</return>
<argument index="0" name="mesh" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.BlendShapeMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.BlendShapeMode">
</argument>
<description>
Sets a mesh's blend shape mode.
@@ -1915,7 +1913,7 @@
</argument>
<argument index="1" name="instances" type="int">
</argument>
- <argument index="2" name="transform_format" type="int" enum="VisualServer.MultimeshTransformFormat">
+ <argument index="2" name="transform_format" type="int" enum="RenderingServer.MultimeshTransformFormat">
</argument>
<argument index="3" name="color_format" type="bool" default="false">
</argument>
@@ -1928,8 +1926,8 @@
<return type="RID">
</return>
<description>
- Creates a new multimesh on the VisualServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a new multimesh on the RenderingServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -2109,8 +2107,8 @@
<return type="RID">
</return>
<description>
- Creates a new omni light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this omni light to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -2118,8 +2116,8 @@
<return type="RID">
</return>
<description>
- Creates a particle system and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach these particles to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -2129,7 +2127,7 @@
<argument index="0" name="particles" type="RID">
</argument>
<description>
- Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method Particles.capture_aabb].
+ Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method GPUParticles3D.capture_aabb].
</description>
</method>
<method name="particles_get_emitting">
@@ -2165,7 +2163,7 @@
<argument index="0" name="particles" type="RID">
</argument>
<description>
- Reset the particles on the next update. Equivalent to [method Particles.restart].
+ Reset the particles on the next update. Equivalent to [method GPUParticles3D.restart].
</description>
</method>
<method name="particles_set_amount">
@@ -2176,7 +2174,7 @@
<argument index="1" name="amount" type="int">
</argument>
<description>
- Sets the number of particles to be drawn and allocates the memory for them. Equivalent to [member Particles.amount].
+ Sets the number of particles to be drawn and allocates the memory for them. Equivalent to [member GPUParticles3D.amount].
</description>
</method>
<method name="particles_set_custom_aabb">
@@ -2187,7 +2185,7 @@
<argument index="1" name="aabb" type="AABB">
</argument>
<description>
- Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member Particles.visibility_aabb].
+ Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member GPUParticles3D.visibility_aabb].
</description>
</method>
<method name="particles_set_draw_order">
@@ -2195,10 +2193,10 @@
</return>
<argument index="0" name="particles" type="RID">
</argument>
- <argument index="1" name="order" type="int" enum="VisualServer.ParticlesDrawOrder">
+ <argument index="1" name="order" type="int" enum="RenderingServer.ParticlesDrawOrder">
</argument>
<description>
- Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member Particles.draw_order].
+ Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member GPUParticles3D.draw_order].
</description>
</method>
<method name="particles_set_draw_pass_mesh">
@@ -2211,7 +2209,7 @@
<argument index="2" name="mesh" type="RID">
</argument>
<description>
- Sets the mesh to be used for the specified draw pass. Equivalent to [member Particles.draw_pass_1], [member Particles.draw_pass_2], [member Particles.draw_pass_3], and [member Particles.draw_pass_4].
+ Sets the mesh to be used for the specified draw pass. Equivalent to [member GPUParticles3D.draw_pass_1], [member GPUParticles3D.draw_pass_2], [member GPUParticles3D.draw_pass_3], and [member GPUParticles3D.draw_pass_4].
</description>
</method>
<method name="particles_set_draw_passes">
@@ -2222,7 +2220,7 @@
<argument index="1" name="count" type="int">
</argument>
<description>
- Sets the number of draw passes to use. Equivalent to [member Particles.draw_passes].
+ Sets the number of draw passes to use. Equivalent to [member GPUParticles3D.draw_passes].
</description>
</method>
<method name="particles_set_emission_transform">
@@ -2244,7 +2242,7 @@
<argument index="1" name="emitting" type="bool">
</argument>
<description>
- If [code]true[/code], particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [member Particles.emitting].
+ If [code]true[/code], particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [member GPUParticles3D.emitting].
</description>
</method>
<method name="particles_set_explosiveness_ratio">
@@ -2255,7 +2253,7 @@
<argument index="1" name="ratio" type="float">
</argument>
<description>
- Sets the explosiveness ratio. Equivalent to [member Particles.explosiveness].
+ Sets the explosiveness ratio. Equivalent to [member GPUParticles3D.explosiveness].
</description>
</method>
<method name="particles_set_fixed_fps">
@@ -2266,7 +2264,7 @@
<argument index="1" name="fps" type="int">
</argument>
<description>
- Sets the frame rate that the particle system rendering will be fixed to. Equivalent to [member Particles.fixed_fps].
+ Sets the frame rate that the particle system rendering will be fixed to. Equivalent to [member GPUParticles3D.fixed_fps].
</description>
</method>
<method name="particles_set_fractional_delta">
@@ -2277,7 +2275,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- If [code]true[/code], uses fractional delta which smooths the movement of the particles. Equivalent to [member Particles.fract_delta].
+ If [code]true[/code], uses fractional delta which smooths the movement of the particles. Equivalent to [member GPUParticles3D.fract_delta].
</description>
</method>
<method name="particles_set_lifetime">
@@ -2288,7 +2286,7 @@
<argument index="1" name="lifetime" type="float">
</argument>
<description>
- Sets the lifetime of each particle in the system. Equivalent to [member Particles.lifetime].
+ Sets the lifetime of each particle in the system. Equivalent to [member GPUParticles3D.lifetime].
</description>
</method>
<method name="particles_set_one_shot">
@@ -2299,7 +2297,7 @@
<argument index="1" name="one_shot" type="bool">
</argument>
<description>
- If [code]true[/code], particles will emit once and then stop. Equivalent to [member Particles.one_shot].
+ If [code]true[/code], particles will emit once and then stop. Equivalent to [member GPUParticles3D.one_shot].
</description>
</method>
<method name="particles_set_pre_process_time">
@@ -2310,7 +2308,7 @@
<argument index="1" name="time" type="float">
</argument>
<description>
- Sets the preprocess time for the particles animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [member Particles.preprocess].
+ Sets the preprocess time for the particles animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [member GPUParticles3D.preprocess].
</description>
</method>
<method name="particles_set_process_material">
@@ -2321,7 +2319,7 @@
<argument index="1" name="material" type="RID">
</argument>
<description>
- Sets the material for processing the particles. Note: this is not the material used to draw the materials. Equivalent to [member Particles.process_material].
+ Sets the material for processing the particles. Note: this is not the material used to draw the materials. Equivalent to [member GPUParticles3D.process_material].
</description>
</method>
<method name="particles_set_randomness_ratio">
@@ -2332,7 +2330,7 @@
<argument index="1" name="ratio" type="float">
</argument>
<description>
- Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [member Particles.randomness].
+ Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [member GPUParticles3D.randomness].
</description>
</method>
<method name="particles_set_speed_scale">
@@ -2343,7 +2341,7 @@
<argument index="1" name="scale" type="float">
</argument>
<description>
- Sets the speed scale of the particle system. Equivalent to [member Particles.speed_scale].
+ Sets the speed scale of the particle system. Equivalent to [member GPUParticles3D.speed_scale].
</description>
</method>
<method name="particles_set_use_local_coordinates">
@@ -2354,15 +2352,15 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- If [code]true[/code], particles use local coordinates. If [code]false[/code] they use global coordinates. Equivalent to [member Particles.local_coords].
+ If [code]true[/code], particles use local coordinates. If [code]false[/code] they use global coordinates. Equivalent to [member GPUParticles3D.local_coords].
</description>
</method>
<method name="reflection_probe_create">
<return type="RID">
</return>
<description>
- Creates a reflection probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -2492,7 +2490,7 @@
</return>
<argument index="0" name="probe" type="RID">
</argument>
- <argument index="1" name="mode" type="int" enum="VisualServer.ReflectionProbeUpdateMode">
+ <argument index="1" name="mode" type="int" enum="RenderingServer.ReflectionProbeUpdateMode">
</argument>
<description>
Sets how often the reflection probe updates. Can either be once or every frame. See [enum ReflectionProbeUpdateMode] for options.
@@ -2516,8 +2514,8 @@
<return type="RID">
</return>
<description>
- Creates a scenario and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
The scenario is the 3D world that all the visual instances exist in.
</description>
</method>
@@ -2526,7 +2524,7 @@
</return>
<argument index="0" name="scenario" type="RID">
</argument>
- <argument index="1" name="debug_mode" type="int" enum="VisualServer.ScenarioDebugMode">
+ <argument index="1" name="debug_mode" type="int" enum="RenderingServer.ScenarioDebugMode">
</argument>
<description>
Sets the [enum ScenarioDebugMode] for this scenario. See [enum ScenarioDebugMode] for options.
@@ -2591,8 +2589,8 @@
<return type="RID">
</return>
<description>
- Creates an empty shader and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="shader_get_code" qualifiers="const">
@@ -2723,8 +2721,8 @@
<return type="RID">
</return>
<description>
- Creates a skeleton and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="skeleton_get_bone_count" qualifiers="const">
@@ -2740,8 +2738,8 @@
<return type="RID">
</return>
<description>
- Creates an empty sky and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="sky_set_material">
@@ -2759,8 +2757,8 @@
<return type="RID">
</return>
<description>
- Creates a spot light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
+ Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
@@ -2812,7 +2810,7 @@
<argument index="2" name="screen" type="int" default="0">
</argument>
<description>
- Copies viewport to a region of the screen specified by [code]rect[/code]. If [member Viewport.render_direct_to_screen] is [code]true[/code], then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
+ Copies the viewport to a region of the screen specified by [code]rect[/code]. If [method viewport_set_render_direct_to_screen] is [code]true[/code], then the viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
For example, you can set the root viewport to not render at all with the following code:
[codeblock]
func _ready():
@@ -2826,17 +2824,8 @@
<return type="RID">
</return>
<description>
- Creates an empty viewport and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] VisualServer functions.
- Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
- </description>
- </method>
- <method name="viewport_detach">
- <return type="void">
- </return>
- <argument index="0" name="viewport" type="RID">
- </argument>
- <description>
- Detaches the viewport from the screen.
+ Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] RenderingServer functions.
+ Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
</description>
</method>
<method name="viewport_get_render_info">
@@ -2844,7 +2833,7 @@
</return>
<argument index="0" name="viewport" type="RID">
</argument>
- <argument index="1" name="info" type="int" enum="VisualServer.ViewportRenderInfo">
+ <argument index="1" name="info" type="int" enum="RenderingServer.ViewportRenderInfo">
</argument>
<description>
Returns a viewport's render information. For options, see the [enum ViewportRenderInfo] constants.
@@ -2915,7 +2904,7 @@
</return>
<argument index="0" name="viewport" type="RID">
</argument>
- <argument index="1" name="clear_mode" type="int" enum="VisualServer.ViewportClearMode">
+ <argument index="1" name="clear_mode" type="int" enum="RenderingServer.ViewportClearMode">
</argument>
<description>
Sets the clear mode of a viewport. See [enum ViewportClearMode] for options.
@@ -2926,7 +2915,7 @@
</return>
<argument index="0" name="viewport" type="RID">
</argument>
- <argument index="1" name="draw" type="int" enum="VisualServer.ViewportDebugDraw">
+ <argument index="1" name="draw" type="int" enum="RenderingServer.ViewportDebugDraw">
</argument>
<description>
Sets the debug draw mode of a viewport. See [enum ViewportDebugDraw] for options.
@@ -2981,7 +2970,7 @@
</return>
<argument index="0" name="viewport" type="RID">
</argument>
- <argument index="1" name="msaa" type="int" enum="VisualServer.ViewportMSAA">
+ <argument index="1" name="msaa" type="int" enum="RenderingServer.ViewportMSAA">
</argument>
<description>
Sets the anti-aliasing mode. See [enum ViewportMSAA] for options.
@@ -3074,7 +3063,7 @@
</return>
<argument index="0" name="viewport" type="RID">
</argument>
- <argument index="1" name="update_mode" type="int" enum="VisualServer.ViewportUpdateMode">
+ <argument index="1" name="update_mode" type="int" enum="RenderingServer.ViewportUpdateMode">
</argument>
<description>
Sets when the viewport should be updated. See [enum ViewportUpdateMode] constants for options.
@@ -3095,12 +3084,12 @@
<signals>
<signal name="frame_post_draw">
<description>
- Emitted at the end of the frame, after the VisualServer has finished updating all the Viewports.
+ Emitted at the end of the frame, after the RenderingServer has finished updating all the Viewports.
</description>
</signal>
<signal name="frame_pre_draw">
<description>
- Emitted at the beginning of the frame, before the VisualServer updates all the Viewports.
+ Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports.
</description>
</signal>
</signals>
@@ -3378,7 +3367,9 @@
<constant name="VIEWPORT_UPDATE_WHEN_VISIBLE" value="2" enum="ViewportUpdateMode">
Update the viewport whenever it is visible.
</constant>
- <constant name="VIEWPORT_UPDATE_ALWAYS" value="3" enum="ViewportUpdateMode">
+ <constant name="VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE" value="3" enum="ViewportUpdateMode">
+ </constant>
+ <constant name="VIEWPORT_UPDATE_ALWAYS" value="4" enum="ViewportUpdateMode">
Always update the viewport.
</constant>
<constant name="VIEWPORT_CLEAR_ALWAYS" value="0" enum="ViewportClearMode">
diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml
index 79c4205f59..e746d7fc96 100644
--- a/doc/classes/RigidBody2D.xml
+++ b/doc/classes/RigidBody2D.xml
@@ -16,7 +16,7 @@
<method name="_integrate_forces" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="state" type="Physics2DDirectBodyState">
+ <argument index="0" name="state" type="PhysicsDirectBodyState2D">
</argument>
<description>
Allows you to read and safely modify the simulation state for the object. Use this instead of [method Node._physics_process] if you need to directly change the body's [code]position[/code] or other physics properties. By default, it works in addition to the usual physics behavior, but [member custom_integrator] allows you to disable the default behavior and write custom force integration for a body.
@@ -106,10 +106,10 @@
</argument>
<argument index="2" name="margin" type="float" default="0.08">
</argument>
- <argument index="3" name="result" type="Physics2DTestMotionResult" default="null">
+ <argument index="3" name="result" type="PhysicsTestMotionResult2D" 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).
+ 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 [PhysicsTestMotionResult2D], which contains additional information about the collision (should there be one).
</description>
</method>
</methods>
diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody3D.xml
index e2b7813361..829589f650 100644
--- a/doc/classes/RigidBody.xml
+++ b/doc/classes/RigidBody3D.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RigidBody" inherits="PhysicsBody" version="4.0">
+<class name="RigidBody3D" inherits="PhysicsBody3D" version="4.0">
<brief_description>
Physics Body whose position is determined through physics simulation in 3D space.
</brief_description>
<description>
- This is the node that implements full 3D physics. This means that you do not control a RigidBody directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc.
- A RigidBody has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic.
- [b]Note:[/b] Don't change a RigidBody's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state.
+ This is the node that implements full 3D physics. This means that you do not control a RigidBody3D directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc.
+ A RigidBody3D has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic.
+ [b]Note:[/b] Don't change a RigidBody3D's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state.
If you need to override the default physics behavior, you can write a custom force integration function. See [member custom_integrator].
</description>
<tutorials>
@@ -16,7 +16,7 @@
<method name="_integrate_forces" qualifiers="virtual">
<return type="void">
</return>
- <argument index="0" name="state" type="PhysicsDirectBodyState">
+ <argument index="0" name="state" type="PhysicsDirectBodyState3D">
</argument>
<description>
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the [member custom_integrator] property allows you to disable the default behavior and do fully custom force integration for a body.
@@ -85,7 +85,7 @@
<method name="get_axis_lock" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<description>
Returns [code]true[/code] if the specified linear or rotational axis is locked.
@@ -102,7 +102,7 @@
<method name="set_axis_lock">
<return type="void">
</return>
- <argument index="0" name="axis" type="int" enum="PhysicsServer.BodyAxis">
+ <argument index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis">
</argument>
<argument index="1" name="lock" type="bool">
</argument>
@@ -122,10 +122,10 @@
</methods>
<members>
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp" default="-1.0">
- Damps RigidBody's rotational forces.
+ Damps RigidBody3D's rotational forces.
</member>
<member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity" default="Vector3( 0, 0, 0 )">
- RigidBody's rotational velocity.
+ RigidBody3D's rotational velocity.
</member>
<member name="axis_lock_angular_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
Lock the body's rotation in the X axis.
@@ -146,10 +146,10 @@
Lock the body's movement in the Z axis.
</member>
<member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep" default="true">
- If [code]true[/code], the RigidBody will not calculate forces and will act as a static body while there is no movement. It will wake up when forces are applied through other collisions or when the [code]apply_impulse[/code] method is used.
+ If [code]true[/code], the RigidBody3D will not calculate forces and will act as a static body while there is no movement. It will wake up when forces are applied through other collisions or when the [code]apply_impulse[/code] method is used.
</member>
<member name="contact_monitor" type="bool" setter="set_contact_monitor" getter="is_contact_monitor_enabled" default="false">
- If [code]true[/code], the RigidBody will emit signals when it collides with another RigidBody.
+ If [code]true[/code], the RigidBody3D will emit signals when it collides with another RigidBody3D.
</member>
<member name="contacts_reported" type="int" setter="set_max_contacts_reported" getter="get_max_contacts_reported" default="0">
The maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0.
@@ -162,7 +162,7 @@
If [code]true[/code], internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
</member>
<member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0">
- This is multiplied by the global 3D gravity setting found in [b]Project &gt; Project Settings &gt; Physics &gt; 3d[/b] to produce RigidBody's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
+ This is multiplied by the global 3D gravity setting found in [b]Project &gt; Project Settings &gt; Physics &gt; 3d[/b] to produce RigidBody3D's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
</member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="-1.0">
The body's linear damp. Cannot be less than -1.0. If this value is different from -1.0, any linear damp derived from the world or areas will be overridden.
@@ -173,7 +173,7 @@
<member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0">
The body's mass.
</member>
- <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody.Mode" default="0">
+ <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidBody3D.Mode" default="0">
The body mode. See [enum Mode] for possible values.
</member>
<member name="physics_material_override" type="PhysicsMaterial" setter="set_physics_material_override" getter="get_physics_material_override">
@@ -241,13 +241,13 @@
Rigid body mode. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code.
</constant>
<constant name="MODE_STATIC" value="1" enum="Mode">
- Static mode. The body behaves like a [StaticBody], and can only move by user code.
+ Static mode. The body behaves like a [StaticBody3D], and can only move by user code.
</constant>
<constant name="MODE_CHARACTER" value="2" enum="Mode">
Character body mode. This behaves like a rigid body, but can not rotate.
</constant>
<constant name="MODE_KINEMATIC" value="3" enum="Mode">
- Kinematic body mode. The body behaves like a [KinematicBody], and can only move by user code.
+ Kinematic body mode. The body behaves like a [KinematicBody3D], and can only move by user code.
</constant>
</constants>
</class>
diff --git a/doc/classes/RootMotionView.xml b/doc/classes/RootMotionView.xml
index 654e42a3c6..be8d8d0078 100644
--- a/doc/classes/RootMotionView.xml
+++ b/doc/classes/RootMotionView.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="RootMotionView" inherits="VisualInstance" version="4.0">
+<class name="RootMotionView" inherits="VisualInstance3D" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index e6778013cf..00ca5c6e9f 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -135,13 +135,6 @@
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>
@@ -237,13 +230,6 @@
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 [InputEvent] as handled.
- </description>
- </method>
<method name="set_quit_on_go_back">
<return type="void">
</return>
@@ -251,22 +237,7 @@
</argument>
<description>
If [code]true[/code], the application quits automatically on going back (e.g. on Android). Enabled by default.
- To handle 'Go Back' button when this option is disabled, use [constant MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST].
- </description>
- </method>
- <method name="set_screen_stretch">
- <return type="void">
- </return>
- <argument index="0" name="mode" type="int" enum="SceneTree.StretchMode">
- </argument>
- <argument index="1" name="aspect" type="int" enum="SceneTree.StretchAspect">
- </argument>
- <argument index="2" name="minsize" type="Vector2">
- </argument>
- <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] ratio.
+ To handle 'Go Back' button when this option is disabled, use [constant DisplayServer.WINDOW_EVENT_GO_BACK_REQUEST].
</description>
</method>
</methods>
@@ -301,11 +272,8 @@
<member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections" default="false">
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 root [Viewport].
- </member>
- <member name="use_font_oversampling" type="bool" setter="set_use_font_oversampling" getter="is_using_font_oversampling" default="false">
- If [code]true[/code], font oversampling is used.
+ <member name="root" type="Window" setter="" getter="get_root">
+ The [SceneTree]'s root [Window].
</member>
</members>
<signals>
@@ -328,15 +296,6 @@
Emitted when files are dragged from the OS file manager and dropped in the game window. The arguments are a list of file paths and the identifier of the screen where the drag originated.
</description>
</signal>
- <signal name="global_menu_action">
- <argument index="0" name="id" type="Variant">
- </argument>
- <argument index="1" name="meta" type="Variant">
- </argument>
- <description>
- Emitted whenever global menu item is clicked.
- </description>
- </signal>
<signal name="idle_frame">
<description>
Emitted immediately before [method Node._process] is called on every node in the [SceneTree].
@@ -389,11 +348,6 @@
Emitted immediately before [method Node._physics_process] is called on every node in the [SceneTree].
</description>
</signal>
- <signal name="screen_resized">
- <description>
- Emitted when 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.
@@ -418,29 +372,5 @@
<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">
- No stretching.
- </constant>
- <constant name="STRETCH_MODE_2D" value="1" enum="StretchMode">
- Render stretching in higher resolution (interpolated).
- </constant>
- <constant name="STRETCH_MODE_VIEWPORT" value="2" enum="StretchMode">
- Keep the specified display resolution. No interpolation. Content may appear pixelated.
- </constant>
- <constant name="STRETCH_ASPECT_IGNORE" value="0" enum="StretchAspect">
- Fill the window with the content stretched to cover excessive space. Content may appear stretched.
- </constant>
- <constant name="STRETCH_ASPECT_KEEP" value="1" enum="StretchAspect">
- Retain the same aspect ratio by padding with black bars on either axis. This prevents distortion.
- </constant>
- <constant name="STRETCH_ASPECT_KEEP_WIDTH" value="2" enum="StretchAspect">
- Expand vertically. Left/right black bars may appear if the window is too wide.
- </constant>
- <constant name="STRETCH_ASPECT_KEEP_HEIGHT" value="3" enum="StretchAspect">
- Expand horizontally. Top/bottom black bars may appear if the window is too tall.
- </constant>
- <constant name="STRETCH_ASPECT_EXPAND" value="4" enum="StretchAspect">
- Expand in both directions, retaining the same aspect ratio. This prevents distortion while avoiding black bars.
- </constant>
</constants>
</class>
diff --git a/doc/classes/ScriptCreateDialog.xml b/doc/classes/ScriptCreateDialog.xml
index 9f16a6ed46..aa60ecb12b 100644
--- a/doc/classes/ScriptCreateDialog.xml
+++ b/doc/classes/ScriptCreateDialog.xml
@@ -4,7 +4,7 @@
The Editor's popup dialog for creating new [Script] files.
</brief_description>
<description>
- The [ScriptCreateDialog] creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the [method Popup.popup] methods.
+ The [ScriptCreateDialog] creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the [method Window.popup] methods.
[codeblock]
func _ready():
dialog.config("Node", "res://new_node.gd") # For in-engine types
@@ -33,10 +33,7 @@
</methods>
<members>
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" />
- <member name="margin_bottom" type="float" setter="set_margin" getter="get_margin" override="true" default="232.0" />
- <member name="margin_right" type="float" setter="set_margin" getter="get_margin" override="true" default="361.0" />
- <member name="rect_size" type="Vector2" setter="_set_size" getter="get_size" override="true" default="Vector2( 361, 232 )" />
- <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Attach Node Script&quot;" />
+ <member name="title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Attach Node Script&quot;" />
</members>
<signals>
<signal name="script_created">
diff --git a/doc/classes/Shape.xml b/doc/classes/Shape3D.xml
index d70d2c09b3..1af6550dc5 100644
--- a/doc/classes/Shape.xml
+++ b/doc/classes/Shape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Shape" inherits="Resource" version="4.0">
+<class name="Shape3D" inherits="Resource" version="4.0">
<brief_description>
Base class for all 3D shape resources.
</brief_description>
<description>
- Base class for all 3D shape resources. Nodes that inherit from this can be used as shapes for a [PhysicsBody] or [Area] objects.
+ Base class for all 3D shape resources. Nodes that inherit from this can be used as shapes for a [PhysicsBody3D] or [Area3D] objects.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
diff --git a/doc/classes/Skeleton.xml b/doc/classes/Skeleton3D.xml
index eaab4063b8..08404fb467 100644
--- a/doc/classes/Skeleton.xml
+++ b/doc/classes/Skeleton3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Skeleton" inherits="Spatial" version="4.0">
+<class name="Skeleton3D" inherits="Node3D" version="4.0">
<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]). It can also use ragdoll physics.
+ Skeleton3D provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics.
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>
@@ -38,6 +38,12 @@
Clear all the bones in this skeleton.
</description>
</method>
+ <method name="clear_bones_global_pose_override">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="find_bone" qualifiers="const">
<return type="int">
</return>
diff --git a/doc/classes/SkeletonIK.xml b/doc/classes/SkeletonIK3D.xml
index 1db78314d2..de83847403 100644
--- a/doc/classes/SkeletonIK.xml
+++ b/doc/classes/SkeletonIK3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SkeletonIK" inherits="Node" version="4.0">
+<class name="SkeletonIK3D" inherits="Node" version="4.0">
<brief_description>
</brief_description>
<description>
@@ -8,7 +8,7 @@
</tutorials>
<methods>
<method name="get_parent_skeleton" qualifiers="const">
- <return type="Skeleton">
+ <return type="Skeleton3D">
</return>
<description>
</description>
diff --git a/doc/classes/SliderJoint.xml b/doc/classes/SliderJoint3D.xml
index dc0cf96eb4..efd6353e3c 100644
--- a/doc/classes/SliderJoint.xml
+++ b/doc/classes/SliderJoint3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SliderJoint" inherits="Joint" version="4.0">
+<class name="SliderJoint3D" inherits="Joint3D" version="4.0">
<brief_description>
Piston kind of slider between two bodies in 3D.
</brief_description>
@@ -12,7 +12,7 @@
<method name="get_param" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="param" type="int" enum="SliderJoint.Param">
+ <argument index="0" name="param" type="int" enum="SliderJoint3D.Param">
</argument>
<description>
</description>
@@ -20,7 +20,7 @@
<method name="set_param">
<return type="void">
</return>
- <argument index="0" name="param" type="int" enum="SliderJoint.Param">
+ <argument index="0" name="param" type="int" enum="SliderJoint3D.Param">
</argument>
<argument index="1" name="value" type="float">
</argument>
diff --git a/doc/classes/SoftBody.xml b/doc/classes/SoftBody3D.xml
index 46a00fbd67..24d6609900 100644
--- a/doc/classes/SoftBody.xml
+++ b/doc/classes/SoftBody3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SoftBody" inherits="MeshInstance" version="4.0">
+<class name="SoftBody3D" inherits="MeshInstance3D" version="4.0">
<brief_description>
A soft mesh physics body.
</brief_description>
@@ -80,12 +80,12 @@
<member name="areaAngular_stiffness" type="float" setter="set_areaAngular_stiffness" getter="get_areaAngular_stiffness" default="0.5">
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1">
- The physics layers this SoftBody is in.
+ The physics layers this SoftBody3D is in.
Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
- The physics layers this SoftBody scans for collisions.
+ The physics layers this SoftBody3D scans for collisions.
</member>
<member name="damping_coefficient" type="float" setter="set_damping_coefficient" getter="get_damping_coefficient" default="0.01">
</member>
@@ -94,20 +94,20 @@
<member name="linear_stiffness" type="float" setter="set_linear_stiffness" getter="get_linear_stiffness" default="0.5">
</member>
<member name="parent_collision_ignore" type="NodePath" setter="set_parent_collision_ignore" getter="get_parent_collision_ignore" default="NodePath(&quot;&quot;)">
- [NodePath] to a [CollisionObject] this SoftBody should avoid clipping.
+ [NodePath] to a [CollisionObject3D] this SoftBody3D should avoid clipping.
</member>
<member name="pose_matching_coefficient" type="float" setter="set_pose_matching_coefficient" getter="get_pose_matching_coefficient" default="0.0">
</member>
<member name="pressure_coefficient" type="float" setter="set_pressure_coefficient" getter="get_pressure_coefficient" default="0.0">
</member>
<member name="ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
- If [code]true[/code], the [SoftBody] will respond to [RayCast]s.
+ If [code]true[/code], the [SoftBody3D] will respond to [RayCast3D]s.
</member>
<member name="simulation_precision" type="int" setter="set_simulation_precision" getter="get_simulation_precision" default="5">
Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
</member>
<member name="total_mass" type="float" setter="set_total_mass" getter="get_total_mass" default="1.0">
- The SoftBody's mass.
+ The SoftBody3D's mass.
</member>
<member name="volume_stiffness" type="float" setter="set_volume_stiffness" getter="get_volume_stiffness" default="0.5">
</member>
diff --git a/doc/classes/SphereShape.xml b/doc/classes/SphereShape3D.xml
index 75dab58c38..1eaf890639 100644
--- a/doc/classes/SphereShape.xml
+++ b/doc/classes/SphereShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SphereShape" inherits="Shape" version="4.0">
+<class name="SphereShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Sphere shape for 3D collisions.
</brief_description>
<description>
- Sphere shape for 3D collisions, which can be set into a [PhysicsBody] or [Area]. This shape is useful for modeling sphere-like 3D objects.
+ Sphere shape for 3D collisions, which can be set into a [PhysicsBody3D] or [Area3D]. This shape is useful for modeling sphere-like 3D objects.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/SpotLight.xml b/doc/classes/SpotLight3D.xml
index 351d4f8aff..f094818c21 100644
--- a/doc/classes/SpotLight.xml
+++ b/doc/classes/SpotLight3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpotLight" inherits="Light" version="4.0">
+<class name="SpotLight3D" inherits="Light3D" version="4.0">
<brief_description>
A spotlight, such as a reflector spotlight or a lantern.
</brief_description>
<description>
- A Spotlight 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. This attenuation can be configured by changing the energy, radius and attenuation parameters of [Light].
+ A Spotlight is a type of [Light3D] node that emits lights in a specific direction, in the shape of a cone. The light is attenuated through the distance. This attenuation can be configured by changing the energy, radius and attenuation parameters of [Light3D].
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/3d/lights_and_shadows.html</link>
diff --git a/doc/classes/SpringArm.xml b/doc/classes/SpringArm3D.xml
index 780ed5077d..8305494c2b 100644
--- a/doc/classes/SpringArm.xml
+++ b/doc/classes/SpringArm3D.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpringArm" inherits="Spatial" version="4.0">
+<class name="SpringArm3D" inherits="Node3D" version="4.0">
<brief_description>
A helper node, mostly used in 3rd person cameras.
</brief_description>
<description>
- The SpringArm node is a node that casts a ray (or collision shape) along its z axis and moves all its direct children to the collision point, minus a margin.
+ The SpringArm3D node is a node that casts a ray (or collision shape) along its z axis and moves all its direct children to the collision point, minus a margin.
The most common use case for this is to make a 3rd person camera that reacts to collisions in the environment.
- The SpringArm will either cast a ray, or if a shape is given, it will cast the shape in the direction of its z axis.
- If you use the SpringArm as a camera controller for your player, you might need to exclude the player's collider from the SpringArm's collision check.
+ The SpringArm3D will either cast a ray, or if a shape is given, it will cast the shape in the direction of its z axis.
+ If you use the SpringArm3D as a camera controller for your player, you might need to exclude the player's collider from the SpringArm3D's collision check.
</description>
<tutorials>
</tutorials>
@@ -18,14 +18,14 @@
<argument index="0" name="RID" type="RID">
</argument>
<description>
- Adds the [PhysicsBody] object with the given [RID] to the list of [PhysicsBody] objects excluded from the collision check.
+ Adds the [PhysicsBody3D] object with the given [RID] to the list of [PhysicsBody3D] objects excluded from the collision check.
</description>
</method>
<method name="clear_excluded_objects">
<return type="void">
</return>
<description>
- Clears the list of [PhysicsBody] objects excluded from the collision check.
+ Clears the list of [PhysicsBody3D] objects excluded from the collision check.
</description>
</method>
<method name="get_hit_length">
@@ -41,7 +41,7 @@
<argument index="0" name="RID" type="RID">
</argument>
<description>
- Removes the given [RID] from the list of [PhysicsBody] objects excluded from the collision check.
+ Removes the given [RID] from the list of [PhysicsBody3D] objects excluded from the collision check.
</description>
</method>
</methods>
@@ -50,17 +50,17 @@
The layers against which the collision check shall be done.
</member>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.01">
- When the collision check is made, a candidate length for the SpringArm is given.
- The margin is then subtracted to this length and the translation is applied to the child objects of the SpringArm.
- This margin is useful for when the SpringArm has a [Camera] as a child node: without the margin, the [Camera] would be placed on the exact point of collision, while with the margin the [Camera] would be placed close to the point of collision.
+ When the collision check is made, a candidate length for the SpringArm3D is given.
+ The margin is then subtracted to this length and the translation is applied to the child objects of the SpringArm3D.
+ This margin is useful for when the SpringArm3D has a [Camera3D] as a child node: without the margin, the [Camera3D] would be placed on the exact point of collision, while with the margin the [Camera3D] would be placed close to the point of collision.
</member>
- <member name="shape" type="Shape" setter="set_shape" getter="get_shape">
- The [Shape] to use for the SpringArm.
- When the shape is set, the SpringArm will cast the [Shape] on its z axis instead of performing a ray cast.
+ <member name="shape" type="Shape3D" setter="set_shape" getter="get_shape">
+ The [Shape3D] to use for the SpringArm3D.
+ When the shape is set, the SpringArm3D will cast the [Shape3D] on its z axis instead of performing a ray cast.
</member>
<member name="spring_length" type="float" setter="set_length" getter="get_length" default="1.0">
- The maximum extent of the SpringArm. This is used as a length for both the ray and the shape cast used internally to calculate the desired position of the SpringArm's child nodes.
- To know more about how to perform a shape cast or a ray cast, please consult the [PhysicsDirectSpaceState] documentation.
+ The maximum extent of the SpringArm3D. This is used as a length for both the ray and the shape cast used internally to calculate the desired position of the SpringArm3D's child nodes.
+ To know more about how to perform a shape cast or a ray cast, please consult the [PhysicsDirectSpaceState3D] documentation.
</member>
</members>
<constants>
diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite2D.xml
index 6c21881535..950fda4e20 100644
--- a/doc/classes/Sprite.xml
+++ b/doc/classes/Sprite2D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Sprite" inherits="Node2D" version="4.0">
+<class name="Sprite2D" inherits="Node2D" version="4.0">
<brief_description>
General-purpose sprite node.
</brief_description>
@@ -13,7 +13,7 @@
<return type="Rect2">
</return>
<description>
- Returns a [Rect2] representing the Sprite's boundary in local coordinates. Can be used to detect if the Sprite was clicked. Example:
+ Returns a [Rect2] representing the Sprite2D's boundary in local coordinates. Can be used to detect if the Sprite2D was clicked. Example:
[codeblock]
func _input(event):
if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:
@@ -53,7 +53,7 @@
The number of columns in the sprite sheet.
</member>
<member name="normal_map" type="Texture2D" setter="set_normal_map" getter="get_normal_map">
- The normal map gives depth to the Sprite.
+ The normal map gives depth to the Sprite2D.
</member>
<member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2( 0, 0 )">
The texture's drawing offset.
@@ -68,7 +68,7 @@
The region of the atlas texture to display. [member region_enabled] must be [code]true[/code].
</member>
<member name="shininess" type="float" setter="set_shininess" getter="get_shininess" default="1.0">
- Strength of the specular light effect of this [Sprite].
+ Strength of the specular light effect of this [Sprite2D].
</member>
<member name="specular_color" type="Color" setter="set_specular_color" getter="get_specular_color" default="Color( 1, 1, 1, 1 )">
The color of the specular light effect.
diff --git a/doc/classes/Sprite3D.xml b/doc/classes/Sprite3D.xml
index 63958eeb7b..f59d5130c9 100644
--- a/doc/classes/Sprite3D.xml
+++ b/doc/classes/Sprite3D.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
A node that displays a 2D texture in a 3D environment. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.
- [b]Note:[/b] There are [url=https://github.com/godotengine/godot/issues/20855]known performance issues[/url] when using [Sprite3D]. Consider using a [MeshInstance] with a [QuadMesh] as the mesh instead. You can still have billboarding by enabling billboard properties in the QuadMesh's [StandardMaterial3D].
+ [b]Note:[/b] There are [url=https://github.com/godotengine/godot/issues/20855]known performance issues[/url] when using [Sprite3D]. Consider using a [MeshInstance3D] with a [QuadMesh] as the mesh instead. You can still have billboarding by enabling billboard properties in the QuadMesh's [StandardMaterial3D].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 563a17e8f6..479dc5f94c 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" version="4.0">
+<class name="SpriteBase3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
2D sprite node in 3D environment.
</brief_description>
@@ -76,7 +76,7 @@
The size of one pixel's width on the sprite to scale it in 3D.
</member>
<member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="false">
- If [code]true[/code], the [Light] in the [Environment] has effects on the sprite.
+ If [code]true[/code], the [Light3D] in the [Environment] has effects on the sprite.
</member>
<member name="transparent" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="true">
If [code]true[/code], the texture's transparency and the opacity are used to make those parts of the sprite invisible.
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index 9facdde681..6e1e1688f4 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SpriteFrames" inherits="Resource" version="4.0">
<brief_description>
- Sprite frame library for AnimatedSprite.
+ Sprite frame library for AnimatedSprite2D.
</brief_description>
<description>
- Sprite frame library for [AnimatedSprite]. Contains frames and animation data for playback.
+ Sprite frame library for [AnimatedSprite2D]. Contains frames and animation data for playback.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/StaticBody.xml b/doc/classes/StaticBody3D.xml
index 280b95d182..c896efc314 100644
--- a/doc/classes/StaticBody.xml
+++ b/doc/classes/StaticBody3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="StaticBody" inherits="PhysicsBody" version="4.0">
+<class name="StaticBody3D" inherits="PhysicsBody3D" version="4.0">
<brief_description>
Static body for 3D physics.
</brief_description>
<description>
- Static body for 3D physics. A static body is a simple body that is not intended to move. In contrast to [RigidBody], they don't consume any CPU resources as long as they don't move.
+ Static body for 3D physics. A static body is a simple body that is not intended to move. In contrast to [RigidBody3D], they don't consume any CPU resources as long as they don't move.
Additionally, a constant linear or angular velocity can be set for the static body, so even if it doesn't move, it affects other bodies as if it was moving (this is useful for simulating conveyor belts or conveyor wheels).
</description>
<tutorials>
diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml
new file mode 100644
index 0000000000..561e5d1a15
--- /dev/null
+++ b/doc/classes/SubViewport.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="SubViewport" inherits="Viewport" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="get_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_size">
+ <return type="void">
+ </return>
+ <argument index="0" name="size" type="Vector2i">
+ </argument>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="arvr" type="bool" setter="set_use_arvr" getter="is_using_arvr" default="false">
+ </member>
+ <member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="SubViewport.ClearMode" default="0">
+ </member>
+ <member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="SubViewport.UpdateMode" default="2">
+ </member>
+ </members>
+ <constants>
+ <constant name="UPDATE_DISABLED" value="0" enum="UpdateMode">
+ </constant>
+ <constant name="UPDATE_ONCE" value="1" enum="UpdateMode">
+ </constant>
+ <constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode">
+ </constant>
+ <constant name="UPDATE_WHEN_PARENT_VISIBLE" value="3" enum="UpdateMode">
+ </constant>
+ <constant name="UPDATE_ALWAYS" value="4" enum="UpdateMode">
+ </constant>
+ <constant name="CLEAR_MODE_ALWAYS" value="0" enum="ClearMode">
+ </constant>
+ <constant name="CLEAR_MODE_NEVER" value="1" enum="ClearMode">
+ </constant>
+ <constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2" enum="ClearMode">
+ </constant>
+ </constants>
+</class>
diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml
index 63cdb0d90a..ffe806cef7 100644
--- a/doc/classes/Texture2D.xml
+++ b/doc/classes/Texture2D.xml
@@ -4,7 +4,7 @@
Texture for 2D and 3D.
</brief_description>
<description>
- A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite] or GUI [Control].
+ A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite2D] or GUI [Control].
Textures are often created by loading them from a file. See [method @GDScript.load].
[Texture2D] is a base for other resources. It cannot be used directly.
</description>
@@ -28,12 +28,12 @@
</argument>
<argument index="6" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
- <argument index="7" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0">
+ <argument index="7" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
</argument>
- <argument index="8" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0">
+ <argument index="8" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
</argument>
<description>
- Draws the texture using a [CanvasItem] with the [VisualServer] API at the specified [code]position[/code].
+ Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code].
</description>
</method>
<method name="draw_rect" qualifiers="const">
@@ -55,12 +55,12 @@
</argument>
<argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
- <argument index="8" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0">
+ <argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
</argument>
- <argument index="9" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0">
+ <argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
</argument>
<description>
- Draws the texture using a [CanvasItem] with the [VisualServer] API.
+ Draws the texture using a [CanvasItem] with the [RenderingServer] API.
</description>
</method>
<method name="draw_rect_region" qualifiers="const">
@@ -82,14 +82,14 @@
</argument>
<argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
</argument>
- <argument index="8" name="texture_filter" type="int" enum="VisualServer.CanvasItemTextureFilter" default="0">
+ <argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
</argument>
- <argument index="9" name="texture_repeat" type="int" enum="VisualServer.CanvasItemTextureRepeat" default="0">
+ <argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
</argument>
<argument index="10" name="clip_uv" type="bool" default="true">
</argument>
<description>
- Draws a part of the texture using a [CanvasItem] with the [VisualServer] API.
+ Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
</description>
</method>
<method name="get_data" qualifiers="const">
diff --git a/doc/classes/Thread.xml b/doc/classes/Thread.xml
index 3bb5797df5..4d6e89fa6f 100644
--- a/doc/classes/Thread.xml
+++ b/doc/classes/Thread.xml
@@ -36,7 +36,7 @@
<argument index="3" name="priority" type="int" enum="Thread.Priority" default="1">
</argument>
<description>
- Starts a new [Thread] that runs [code]method[/code] on object [code]instance[/code] with [code]userdata[/code] passed as an argument. The [code]priority[/code] of the [Thread] can be changed by passing a value from the [enum Priority] enum.
+ Starts a new [Thread] that runs [code]method[/code] on object [code]instance[/code] with [code]userdata[/code] passed as an argument. Even if no userdata is passed, [code]method[/code] must accept one argument and it will be null. The [code]priority[/code] of the [Thread] can be changed by passing a value from the [enum Priority] enum.
Returns [constant OK] on success, or [constant ERR_CANT_CREATE] on failure.
</description>
</method>
diff --git a/doc/classes/VehicleBody.xml b/doc/classes/VehicleBody3D.xml
index 74879419a1..b8b85ff605 100644
--- a/doc/classes/VehicleBody.xml
+++ b/doc/classes/VehicleBody3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VehicleBody" inherits="RigidBody" version="4.0">
+<class name="VehicleBody3D" inherits="RigidBody3D" version="4.0">
<brief_description>
Physics body that simulates the behavior of a car.
</brief_description>
<description>
- This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape] for the main body of your vehicle and add [VehicleWheel] nodes for the wheels. You should also add a [MeshInstance] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly.
- [b]Note:[/b] The origin point of your VehicleBody will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape] and [MeshInstance] upwards.
+ This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a [CollisionShape3D] for the main body of your vehicle and add [VehicleWheel3D] nodes for the wheels. You should also add a [MeshInstance3D] to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the [member brake], [member engine_force], and [member steering] properties and not change the position or orientation of this node directly.
+ [b]Note:[/b] The origin point of your VehicleBody3D will determine the center of gravity of your vehicle so it is better to keep this low and move the [CollisionShape3D] and [MeshInstance3D] upwards.
</description>
<tutorials>
</tutorials>
@@ -13,16 +13,16 @@
</methods>
<members>
<member name="brake" type="float" setter="set_brake" getter="get_brake" default="0.0">
- Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.
+ Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody3D.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.
</member>
<member name="engine_force" type="float" setter="set_engine_force" getter="get_engine_force" default="0.0">
- Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have [member VehicleWheel.use_as_traction] set to [code]true[/code] and are in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.
+ Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have [member VehicleWheel3D.use_as_traction] set to [code]true[/code] and are in contact with a surface. The [member RigidBody3D.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.
[b]Note:[/b] The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears.
A negative value will result in the vehicle reversing.
</member>
<member name="mass" type="float" setter="set_mass" getter="get_mass" override="true" default="40.0" />
<member name="steering" type="float" setter="set_steering" getter="get_steering" default="0.0">
- The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel.use_as_steering] set to [code]true[/code] will automatically be rotated.
+ The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel3D.use_as_steering] set to [code]true[/code] will automatically be rotated.
</member>
<member name="weight" type="float" setter="set_weight" getter="get_weight" override="true" default="392.0" />
</members>
diff --git a/doc/classes/VehicleWheel.xml b/doc/classes/VehicleWheel3D.xml
index 1a6a226fd1..c71d797eff 100644
--- a/doc/classes/VehicleWheel.xml
+++ b/doc/classes/VehicleWheel3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VehicleWheel" inherits="Spatial" version="4.0">
+<class name="VehicleWheel3D" inherits="Node3D" version="4.0">
<brief_description>
Physics object that simulates the behavior of a wheel.
</brief_description>
<description>
- This node needs to be used as a child node of [VehicleBody] and simulates the behavior 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 [VehicleBody3D] and simulates the behavior of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface.
</description>
<tutorials>
</tutorials>
@@ -33,7 +33,7 @@
</methods>
<members>
<member name="brake" type="float" setter="set_brake" getter="get_brake" default="0.0">
- Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.
+ Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the [member RigidBody3D.mass] of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.
</member>
<member name="damping_compression" type="float" setter="set_damping_compression" getter="get_damping_compression" default="0.83">
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.
@@ -42,7 +42,7 @@
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="engine_force" type="float" setter="set_engine_force" getter="get_engine_force" default="0.0">
- Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.
+ Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The [member RigidBody3D.mass] of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.
[b]Note:[/b] The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears.
A negative value will result in the wheel reversing.
</member>
@@ -50,7 +50,7 @@
The steering angle for the wheel. Setting this to a non-zero value will result in the vehicle turning when it's moving.
</member>
<member name="suspension_max_force" type="float" setter="set_suspension_max_force" getter="get_suspension_max_force" default="6000.0">
- 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 3× to 4× this number.
+ The maximum force the spring can resist. This value should be higher than a quarter of the [member RigidBody3D.mass] of the [VehicleBody3D] or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number.
</member>
<member name="suspension_stiffness" type="float" setter="set_suspension_stiffness" getter="get_suspension_stiffness" default="5.88">
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.
@@ -59,10 +59,10 @@
This is the distance the suspension can travel. As Godot units are equivalent to 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" default="false">
- If [code]true[/code], this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody.steering] and ignored if you are using the per-wheel [member steering] value instead.
+ If [code]true[/code], this wheel will be turned when the car steers. This value is used in conjunction with [member VehicleBody3D.steering] and ignored if you are using the per-wheel [member steering] value instead.
</member>
<member name="use_as_traction" type="bool" setter="set_use_as_traction" getter="is_used_as_traction" default="false">
- If [code]true[/code], this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead.
+ If [code]true[/code], this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with [member VehicleBody3D.engine_force] and ignored if you are using the per-wheel [member engine_force] value instead.
</member>
<member name="wheel_friction_slip" type="float" setter="set_friction_slip" getter="get_friction_slip" default="10.5">
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.
diff --git a/doc/classes/SpatialVelocityTracker.xml b/doc/classes/VelocityTracker3D.xml
index 7a4e0c054a..98f7533c76 100644
--- a/doc/classes/SpatialVelocityTracker.xml
+++ b/doc/classes/VelocityTracker3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SpatialVelocityTracker" inherits="Reference" version="4.0">
+<class name="VelocityTracker3D" inherits="Reference" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 0632be28e1..517eb3b24c 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -4,7 +4,7 @@
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.
+ 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 Camera3D 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 [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.
@@ -17,7 +17,7 @@
</tutorials>
<methods>
<method name="find_world" qualifiers="const">
- <return type="World">
+ <return type="World3D">
</return>
<description>
Returns the 3D world of the viewport, or if none the world of the parent viewport.
@@ -31,7 +31,7 @@
</description>
</method>
<method name="get_camera" qualifiers="const">
- <return type="Camera">
+ <return type="Camera3D">
</return>
<description>
Returns the active 3D camera.
@@ -44,13 +44,6 @@
Returns the total transform of the viewport.
</description>
</method>
- <method name="get_modal_stack_top" qualifiers="const">
- <return type="Control">
- </return>
- <description>
- Returns the topmost modal in the stack.
- </description>
- </method>
<method name="get_mouse_position" qualifiers="const">
<return type="Vector2">
</return>
@@ -76,13 +69,6 @@
Returns the [enum ShadowAtlasQuadrantSubdiv] of the specified quadrant.
</description>
</method>
- <method name="get_size_override" qualifiers="const">
- <return type="Vector2">
- </return>
- <description>
- Returns the size override set with [method set_size_override].
- </description>
- </method>
<method name="get_texture" qualifiers="const">
<return type="ViewportTexture">
</return>
@@ -99,7 +85,7 @@
<return type="RID">
</return>
<description>
- Returns the viewport's RID from the [VisualServer].
+ Returns the viewport's RID from the [RenderingServer].
</description>
</method>
<method name="get_visible_rect" qualifiers="const">
@@ -116,13 +102,6 @@
Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
</description>
</method>
- <method name="gui_has_modal_stack" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if there are visible modals on-screen.
- </description>
- </method>
<method name="gui_is_dragging" qualifiers="const">
<return type="bool">
</return>
@@ -133,31 +112,31 @@
<method name="input">
<return type="void">
</return>
- <argument index="0" name="local_event" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
+ </argument>
+ <argument index="1" name="in_local_coords" type="bool" default="false">
</argument>
<description>
</description>
</method>
- <method name="is_input_handled" qualifiers="const">
- <return type="bool">
+ <method name="input_text">
+ <return type="void">
</return>
+ <argument index="0" name="text" type="String">
+ </argument>
<description>
</description>
</method>
- <method name="is_size_override_enabled" qualifiers="const">
+ <method name="is_embedding_subwindows" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if the size override is enabled. See [method set_size_override].
</description>
</method>
- <method name="set_attach_to_screen_rect">
- <return type="void">
+ <method name="is_input_handled" qualifiers="const">
+ <return type="bool">
</return>
- <argument index="0" name="rect" type="Rect2">
- </argument>
<description>
- Attaches this [Viewport] to the root [Viewport] with the specified rectangle. This bypasses the need for another node to display this [Viewport] but makes you responsible for updating the position of this [Viewport] manually.
</description>
</method>
<method name="set_input_as_handled">
@@ -178,23 +157,12 @@
Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible.
</description>
</method>
- <method name="set_size_override">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
- <argument index="1" name="size" type="Vector2" default="Vector2( -1, -1 )">
- </argument>
- <argument index="2" name="margin" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <description>
- Sets the size override of the viewport. If the [code]enable[/code] parameter is [code]true[/code] the override is used, otherwise it uses the default size. If the size parameter is [code](-1, -1)[/code], it won't update the size.
- </description>
- </method>
<method name="unhandled_input">
<return type="void">
</return>
- <argument index="0" name="local_event" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
+ </argument>
+ <argument index="1" name="in_local_coords" type="bool" default="false">
</argument>
<description>
</description>
@@ -217,9 +185,6 @@
</method>
</methods>
<members>
- <member name="arvr" type="bool" setter="set_use_arvr" getter="use_arvr" default="false">
- If [code]true[/code], the viewport will be used in AR/VR process.
- </member>
<member name="audio_listener_enable_2d" type="bool" setter="set_as_audio_listener_2d" getter="is_audio_listener_2d" default="false">
If [code]true[/code], the viewport will process 2D audio streams.
</member>
@@ -242,6 +207,8 @@
<member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled" default="false">
If [code]true[/code], the viewport will not receive input event.
</member>
+ <member name="gui_embed_subwindows" type="bool" setter="set_embed_subwindows_hint" getter="get_embed_subwindows_hint" default="false">
+ </member>
<member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled" default="true">
If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly.
</member>
@@ -251,20 +218,11 @@
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems.
</member>
<member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world" default="false">
- If [code]true[/code], the viewport will use [World] defined in [code]world[/code] property.
+ If [code]true[/code], the viewport will use [World3D] defined in [code]world[/code] property.
</member>
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
</member>
- <member name="render_direct_to_screen" type="bool" setter="set_use_render_direct_to_screen" getter="is_using_render_direct_to_screen" default="false">
- If [code]true[/code], renders the Viewport directly to the screen instead of to the root viewport. Only available in GLES2. This is a low-level optimization and should not be used in most cases. If used, reading from the Viewport or from [code]SCREEN_TEXTURE[/code] becomes unavailable. For more information see [method VisualServer.viewport_set_render_direct_to_screen].
- </member>
- <member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="Viewport.ClearMode" default="0">
- The clear mode when viewport used as a render target.
- </member>
- <member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="Viewport.UpdateMode" default="2">
- The update mode when viewport used as a render target.
- </member>
<member name="shadow_atlas_quad_0" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv" default="2">
The subdivision amount of the first quadrant on the shadow atlas.
</member>
@@ -281,17 +239,11 @@
The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
[b]Note:[/b] If this is set to 0, shadows won't be visible. Since user-created viewports default to a value of 0, this value must be set above 0 manually.
</member>
- <member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2( 0, 0 )">
- The width and height of viewport.
- </member>
- <member name="size_override_stretch" type="bool" setter="set_size_override_stretch" getter="is_size_override_stretch_enabled" default="false">
- If [code]true[/code], the size override affects stretch as well.
- </member>
<member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background" default="false">
If [code]true[/code], the viewport should render its background as transparent.
</member>
- <member name="world" type="World" setter="set_world" getter="get_world">
- The custom [World] which can be used as 3D environment source.
+ <member name="world" type="World3D" setter="set_world" getter="get_world">
+ The custom [World3D] which can be used as 3D environment source.
</member>
<member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d">
The custom [World2D] which can be used as 2D environment source.
@@ -307,23 +259,11 @@
</signal>
<signal name="size_changed">
<description>
- Emitted when the size of the viewport is changed, whether by [method set_size_override], resize of window, or some other means.
+ Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
</description>
</signal>
</signals>
<constants>
- <constant name="UPDATE_DISABLED" value="0" enum="UpdateMode">
- Do not update the render target.
- </constant>
- <constant name="UPDATE_ONCE" value="1" enum="UpdateMode">
- Update the render target once, then switch to [constant UPDATE_DISABLED].
- </constant>
- <constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode">
- Update the render target only when it is visible. This is the default value.
- </constant>
- <constant name="UPDATE_ALWAYS" value="3" enum="UpdateMode">
- Always update the render target.
- </constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED" value="0" enum="ShadowAtlasQuadrantSubdiv">
This quadrant will not be used.
</constant>
@@ -410,15 +350,6 @@
<constant name="MSAA_16X" value="4" enum="MSAA">
Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
</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 [constant CLEAR_MODE_NEVER].
- </constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST" value="0" enum="DefaultCanvasItemTextureFilter">
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR" value="1" enum="DefaultCanvasItemTextureFilter">
diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml
index 3f9bf6887a..0bdecafbfa 100644
--- a/doc/classes/VisibilityEnabler2D.xml
+++ b/doc/classes/VisibilityEnabler2D.xml
@@ -36,13 +36,13 @@
If [code]true[/code], [RigidBody2D] nodes will be paused.
</member>
<member name="pause_animated_sprites" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [AnimatedSprite] nodes will be paused.
+ If [code]true[/code], [AnimatedSprite2D] nodes will be paused.
</member>
<member name="pause_animations" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
If [code]true[/code], [AnimationPlayer] nodes will be paused.
</member>
<member name="pause_particles" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [Particles2D] nodes will be paused.
+ If [code]true[/code], [GPUParticles2D] nodes will be paused.
</member>
<member name="physics_process_parent" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="false">
If [code]true[/code], the parent's [method Node._physics_process] will be stopped.
@@ -59,7 +59,7 @@
This enabler will freeze [RigidBody2D] nodes.
</constant>
<constant name="ENABLER_PAUSE_PARTICLES" value="2" enum="Enabler">
- This enabler will stop [Particles2D] nodes.
+ This enabler will stop [GPUParticles2D] nodes.
</constant>
<constant name="ENABLER_PARENT_PROCESS" value="3" enum="Enabler">
This enabler will stop the parent's _process function.
@@ -68,7 +68,7 @@
This enabler will stop the parent's _physics_process function.
</constant>
<constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5" enum="Enabler">
- This enabler will stop [AnimatedSprite] nodes animations.
+ This enabler will stop [AnimatedSprite2D] nodes animations.
</constant>
<constant name="ENABLER_MAX" value="6" enum="Enabler">
Represents the size of the [enum Enabler] enum.
diff --git a/doc/classes/VisibilityEnabler.xml b/doc/classes/VisibilityEnabler3D.xml
index 7ab6c52e6c..9c25c6c7c8 100644
--- a/doc/classes/VisibilityEnabler.xml
+++ b/doc/classes/VisibilityEnabler3D.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityEnabler" inherits="VisibilityNotifier" version="4.0">
+<class name="VisibilityEnabler3D" inherits="VisibilityNotifier3D" version="4.0">
<brief_description>
Enables certain nodes only when visible.
</brief_description>
<description>
- The VisibilityEnabler will disable [RigidBody] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler itself.
- Note that VisibilityEnabler will not affect nodes added after scene initialization.
+ The VisibilityEnabler3D will disable [RigidBody3D] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler3D itself.
+ Note that VisibilityEnabler3D will not affect nodes added after scene initialization.
</description>
<tutorials>
</tutorials>
@@ -13,7 +13,7 @@
<method name="is_enabler_enabled" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="enabler" type="int" enum="VisibilityEnabler.Enabler">
+ <argument index="0" name="enabler" type="int" enum="VisibilityEnabler3D.Enabler">
</argument>
<description>
Returns whether the enabler identified by given [enum Enabler] constant is active.
@@ -22,7 +22,7 @@
<method name="set_enabler">
<return type="void">
</return>
- <argument index="0" name="enabler" type="int" enum="VisibilityEnabler.Enabler">
+ <argument index="0" name="enabler" type="int" enum="VisibilityEnabler3D.Enabler">
</argument>
<argument index="1" name="enabled" type="bool">
</argument>
@@ -33,7 +33,7 @@
</methods>
<members>
<member name="freeze_bodies" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
- If [code]true[/code], [RigidBody] nodes will be paused.
+ If [code]true[/code], [RigidBody3D] nodes will be paused.
</member>
<member name="pause_animations" type="bool" setter="set_enabler" getter="is_enabler_enabled" default="true">
If [code]true[/code], [AnimationPlayer] nodes will be paused.
@@ -44,7 +44,7 @@
This enabler will pause [AnimationPlayer] nodes.
</constant>
<constant name="ENABLER_FREEZE_BODIES" value="1" enum="Enabler">
- This enabler will freeze [RigidBody] nodes.
+ This enabler will freeze [RigidBody3D] nodes.
</constant>
<constant name="ENABLER_MAX" value="2" enum="Enabler">
Represents the size of the [enum Enabler] enum.
diff --git a/doc/classes/VisibilityNotifier.xml b/doc/classes/VisibilityNotifier3D.xml
index 6161017884..d8a605c69c 100644
--- a/doc/classes/VisibilityNotifier.xml
+++ b/doc/classes/VisibilityNotifier3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisibilityNotifier" inherits="Spatial" version="4.0">
+<class name="VisibilityNotifier3D" inherits="Node3D" version="4.0">
<brief_description>
Detects when the node is visible on screen.
</brief_description>
<description>
- The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera]'s view.
+ The VisibilityNotifier3D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera3D]'s view.
</description>
<tutorials>
</tutorials>
@@ -20,32 +20,32 @@
</methods>
<members>
<member name="aabb" type="AABB" setter="set_aabb" getter="get_aabb" default="AABB( -1, -1, -1, 2, 2, 2 )">
- The VisibilityNotifier's bounding box.
+ The VisibilityNotifier3D's bounding box.
</member>
</members>
<signals>
<signal name="camera_entered">
- <argument index="0" name="camera" type="Camera">
+ <argument index="0" name="camera" type="Camera3D">
</argument>
<description>
- Emitted when the VisibilityNotifier enters a [Camera]'s view.
+ Emitted when the VisibilityNotifier3D enters a [Camera3D]'s view.
</description>
</signal>
<signal name="camera_exited">
- <argument index="0" name="camera" type="Camera">
+ <argument index="0" name="camera" type="Camera3D">
</argument>
<description>
- Emitted when the VisibilityNotifier exits a [Camera]'s view.
+ Emitted when the VisibilityNotifier3D exits a [Camera3D]'s view.
</description>
</signal>
<signal name="screen_entered">
<description>
- Emitted when the VisibilityNotifier enters the screen.
+ Emitted when the VisibilityNotifier3D enters the screen.
</description>
</signal>
<signal name="screen_exited">
<description>
- Emitted when the VisibilityNotifier exits the screen.
+ Emitted when the VisibilityNotifier3D exits the screen.
</description>
</signal>
</signals>
diff --git a/doc/classes/VisualInstance.xml b/doc/classes/VisualInstance3D.xml
index 1bbd5cb64d..6451b3f330 100644
--- a/doc/classes/VisualInstance.xml
+++ b/doc/classes/VisualInstance3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="VisualInstance" inherits="Spatial" version="4.0">
+<class name="VisualInstance3D" inherits="Node3D" version="4.0">
<brief_description>
Parent of all visual 3D nodes.
</brief_description>
<description>
- The [VisualInstance] is used to connect a resource to a visual representation. All visual 3D nodes inherit from the [VisualInstance]. In general, you should not access the [VisualInstance] properties directly as they are accessed and managed by the nodes that inherit from [VisualInstance]. [VisualInstance] is the node representation of the [VisualServer] instance.
+ The [VisualInstance3D] is used to connect a resource to a visual representation. All visual 3D nodes inherit from the [VisualInstance3D]. In general, you should not access the [VisualInstance3D] properties directly as they are accessed and managed by the nodes that inherit from [VisualInstance3D]. [VisualInstance3D] is the node representation of the [RenderingServer] instance.
</description>
<tutorials>
</tutorials>
@@ -13,21 +13,21 @@
<return type="AABB">
</return>
<description>
- Returns the [AABB] (also known as the bounding box) for this [VisualInstance].
+ Returns the [AABB] (also known as the bounding box) for this [VisualInstance3D].
</description>
</method>
<method name="get_base" qualifiers="const">
<return type="RID">
</return>
<description>
- Returns the RID of the resource associated with this [VisualInstance]. For example, if the Node is a [MeshInstance], this will return the RID of the associated [Mesh].
+ Returns the RID of the resource associated with this [VisualInstance3D]. For example, if the Node is a [MeshInstance3D], this will return the RID of the associated [Mesh].
</description>
</method>
<method name="get_instance" qualifiers="const">
<return type="RID">
</return>
<description>
- Returns the RID of this instance. This RID is the same as the RID returned by [method VisualServer.instance_create]. This RID is needed if you want to call [VisualServer] functions directly on this [VisualInstance].
+ Returns the RID of this instance. This RID is the same as the RID returned by [method RenderingServer.instance_create]. This RID is needed if you want to call [RenderingServer] functions directly on this [VisualInstance3D].
</description>
</method>
<method name="get_layer_mask_bit" qualifiers="const">
@@ -43,8 +43,8 @@
<return type="AABB">
</return>
<description>
- Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance].
- Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Spatial]'s [Transform].
+ Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance3D].
+ Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform].
</description>
</method>
<method name="set_base">
@@ -53,7 +53,7 @@
<argument index="0" name="base" type="RID">
</argument>
<description>
- Sets the resource that is instantiated by this [VisualInstance], which changes how the engine handles the [VisualInstance] under the hood. Equivalent to [method VisualServer.instance_set_base].
+ Sets the resource that is instantiated by this [VisualInstance3D], which changes how the engine handles the [VisualInstance3D] under the hood. Equivalent to [method RenderingServer.instance_set_base].
</description>
</method>
<method name="set_layer_mask_bit">
@@ -70,8 +70,8 @@
</methods>
<members>
<member name="layers" type="int" setter="set_layer_mask" getter="get_layer_mask" default="1">
- The render layer(s) this [VisualInstance] is drawn on.
- This object will only be visible for [Camera]s whose cull mask includes the render object this [VisualInstance] is set to.
+ The render layer(s) this [VisualInstance3D] is drawn on.
+ This object will only be visible for [Camera3D]s whose cull mask includes the render object this [VisualInstance3D] is set to.
</member>
</members>
<constants>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
new file mode 100644
index 0000000000..e1a0f1f22a
--- /dev/null
+++ b/doc/classes/Window.xml
@@ -0,0 +1,419 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="Window" inherits="Viewport" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="can_draw" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="child_controls_changed">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_flag" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="flag" type="int" enum="Window.Flags">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_real_size" qualifiers="const">
+ <return type="Vector2i">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_theme_color" qualifiers="const">
+ <return type="Color">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_theme_constant" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_theme_font" qualifiers="const">
+ <return type="Font">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_theme_icon" qualifiers="const">
+ <return type="Texture2D">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_theme_stylebox" qualifiers="const">
+ <return type="StyleBox">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="grab_focus">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="has_focus" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="has_theme_color" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="has_theme_constant" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="has_theme_font" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="has_theme_icon" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="has_theme_stylebox" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="StringName">
+ </argument>
+ <argument index="1" name="type" type="StringName" default="&quot;&quot;">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="hide">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_embedded" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_maximize_allowed" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="is_using_font_oversampling" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="move_to_foreground">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="popup">
+ <return type="void">
+ </return>
+ <argument index="0" name="rect" type="Rect2i" default="Rect2i( 0, 0, 0, 0 )">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="popup_centered">
+ <return type="void">
+ </return>
+ <argument index="0" name="minsize" type="Vector2i" default="Vector2i( 0, 0 )">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="popup_centered_clamped">
+ <return type="void">
+ </return>
+ <argument index="0" name="minsize" type="Vector2i" default="Vector2i( 0, 0 )">
+ </argument>
+ <argument index="1" name="fallback_ratio" type="float" default="0.75">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="popup_centered_ratio">
+ <return type="void">
+ </return>
+ <argument index="0" name="ratio" type="float" default="0.8">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="popup_on_parent">
+ <return type="void">
+ </return>
+ <argument index="0" name="parent_rect" type="Rect2i">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="request_attention">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_flag">
+ <return type="void">
+ </return>
+ <argument index="0" name="flag" type="int" enum="Window.Flags">
+ </argument>
+ <argument index="1" name="enabled" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_ime_active">
+ <return type="void">
+ </return>
+ <argument index="0" name="arg0" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_ime_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="arg0" type="Vector2i">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_use_font_oversampling">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="show">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="always_on_top" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
+ <member name="borderless" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
+ <member name="content_scale_aspect" type="int" setter="set_content_scale_aspect" getter="get_content_scale_aspect" enum="Window.ContentScaleAspect" default="0">
+ </member>
+ <member name="content_scale_mode" type="int" setter="set_content_scale_mode" getter="get_content_scale_mode" enum="Window.ContentScaleMode" default="0">
+ </member>
+ <member name="content_scale_size" type="Vector2i" setter="set_content_scale_size" getter="get_content_scale_size" default="Vector2i( 0, 0 )">
+ </member>
+ <member name="current_screen" type="int" setter="set_current_screen" getter="get_current_screen" default="0">
+ </member>
+ <member name="exclusive" type="bool" setter="set_exclusive" getter="is_exclusive" default="false">
+ </member>
+ <member name="max_size" type="Vector2i" setter="set_max_size" getter="get_max_size" default="Vector2i( 0, 0 )">
+ </member>
+ <member name="min_size" type="Vector2i" setter="set_min_size" getter="get_min_size" default="Vector2i( 0, 0 )">
+ </member>
+ <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Window.Mode" default="0">
+ </member>
+ <member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i( 0, 0 )">
+ </member>
+ <member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i( 100, 100 )">
+ </member>
+ <member name="theme" type="Theme" setter="set_theme" getter="get_theme">
+ </member>
+ <member name="title" type="String" setter="set_title" getter="get_title" default="&quot;&quot;">
+ </member>
+ <member name="transient" type="bool" setter="set_transient" getter="is_transient" default="false">
+ </member>
+ <member name="transparent" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
+ <member name="unfocusable" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
+ <member name="unresizable" type="bool" setter="set_flag" getter="get_flag" default="false">
+ </member>
+ <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true">
+ </member>
+ <member name="wrap_controls" type="bool" setter="set_wrap_controls" getter="is_wrapping_controls" default="false">
+ </member>
+ </members>
+ <signals>
+ <signal name="about_to_popup">
+ <description>
+ </description>
+ </signal>
+ <signal name="close_requested">
+ <description>
+ </description>
+ </signal>
+ <signal name="files_dropped">
+ <argument index="0" name="files" type="PackedStringArray">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ <signal name="focus_entered">
+ <description>
+ </description>
+ </signal>
+ <signal name="focus_exited">
+ <description>
+ </description>
+ </signal>
+ <signal name="go_back_requested">
+ <description>
+ </description>
+ </signal>
+ <signal name="mouse_entered">
+ <description>
+ </description>
+ </signal>
+ <signal name="mouse_exited">
+ <description>
+ </description>
+ </signal>
+ <signal name="visibility_changed">
+ <description>
+ </description>
+ </signal>
+ <signal name="window_input">
+ <argument index="0" name="event" type="InputEvent">
+ </argument>
+ <description>
+ </description>
+ </signal>
+ </signals>
+ <constants>
+ <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="30">
+ </constant>
+ <constant name="MODE_WINDOWED" value="0" enum="Mode">
+ </constant>
+ <constant name="MODE_MINIMIZED" value="1" enum="Mode">
+ </constant>
+ <constant name="MODE_MAXIMIZED" value="2" enum="Mode">
+ </constant>
+ <constant name="MODE_FULLSCREEN" value="3" enum="Mode">
+ </constant>
+ <constant name="FLAG_RESIZE_DISABLED" value="0" enum="Flags">
+ </constant>
+ <constant name="FLAG_BORDERLESS" value="1" enum="Flags">
+ </constant>
+ <constant name="FLAG_ALWAYS_ON_TOP" value="2" enum="Flags">
+ </constant>
+ <constant name="FLAG_TRANSPARENT" value="3" enum="Flags">
+ </constant>
+ <constant name="FLAG_NO_FOCUS" value="4" enum="Flags">
+ </constant>
+ <constant name="FLAG_MAX" value="5" enum="Flags">
+ </constant>
+ <constant name="CONTENT_SCALE_MODE_DISABLED" value="0" enum="ContentScaleMode">
+ </constant>
+ <constant name="CONTENT_SCALE_MODE_OBJECTS" value="1" enum="ContentScaleMode">
+ </constant>
+ <constant name="CONTENT_SCALE_MODE_PIXELS" value="2" enum="ContentScaleMode">
+ </constant>
+ <constant name="CONTENT_SCALE_ASPECT_IGNORE" value="0" enum="ContentScaleAspect">
+ </constant>
+ <constant name="CONTENT_SCALE_ASPECT_KEEP" value="1" enum="ContentScaleAspect">
+ </constant>
+ <constant name="CONTENT_SCALE_ASPECT_KEEP_WIDTH" value="2" enum="ContentScaleAspect">
+ </constant>
+ <constant name="CONTENT_SCALE_ASPECT_KEEP_HEIGHT" value="3" enum="ContentScaleAspect">
+ </constant>
+ <constant name="CONTENT_SCALE_ASPECT_EXPAND" value="4" enum="ContentScaleAspect">
+ </constant>
+ </constants>
+ <theme_items>
+ <theme_item name="close" type="Texture2D">
+ </theme_item>
+ <theme_item name="close_h_ofs" type="int" default="18">
+ </theme_item>
+ <theme_item name="close_highlight" type="Texture2D">
+ </theme_item>
+ <theme_item name="close_v_ofs" type="int" default="18">
+ </theme_item>
+ <theme_item name="panel" type="StyleBox">
+ </theme_item>
+ <theme_item name="resize_margin" type="int" default="4">
+ </theme_item>
+ <theme_item name="scaleborder_size" type="int" default="4">
+ </theme_item>
+ <theme_item name="title_color" type="Color" default="Color( 0, 0, 0, 1 )">
+ </theme_item>
+ <theme_item name="title_font" type="Font">
+ </theme_item>
+ <theme_item name="title_height" type="int" default="20">
+ </theme_item>
+ <theme_item name="window_panel" type="StyleBox">
+ </theme_item>
+ </theme_items>
+</class>
diff --git a/doc/classes/WindowDialog.xml b/doc/classes/WindowDialog.xml
deleted file mode 100644
index 8b6bf00508..0000000000
--- a/doc/classes/WindowDialog.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WindowDialog" inherits="Popup" version="4.0">
- <brief_description>
- Base class for window dialogs.
- </brief_description>
- <description>
- Windowdialog is the base class for all window-based dialogs. It's a by-default toplevel [Control] that draws a window decoration and allows motion and resizing.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="get_close_button">
- <return type="TextureButton">
- </return>
- <description>
- Returns the close [TextureButton].
- </description>
- </method>
- </methods>
- <members>
- <member name="resizable" type="bool" setter="set_resizable" getter="get_resizable" default="false">
- If [code]true[/code], the user can resize the window.
- </member>
- <member name="window_title" type="String" setter="set_title" getter="get_title" default="&quot;&quot;">
- The text displayed in the window's title bar.
- </member>
- </members>
- <constants>
- </constants>
- <theme_items>
- <theme_item name="close" type="Texture2D">
- The icon for the close button.
- </theme_item>
- <theme_item name="close_h_ofs" type="int" default="18">
- The horizontal offset of the close button.
- </theme_item>
- <theme_item name="close_highlight" type="Texture2D">
- The icon used for the close button when it's hovered with the mouse cursor.
- </theme_item>
- <theme_item name="close_v_ofs" type="int" default="18">
- The vertical offset of the close button.
- </theme_item>
- <theme_item name="panel" type="StyleBox">
- The style for both the content background of the [WindowDialog] and the title bar.
- </theme_item>
- <theme_item name="scaleborder_size" type="int" default="4">
- The thickness of the border that can be dragged when scaling the window (if [member resizable] is enabled).
- </theme_item>
- <theme_item name="title_color" type="Color" default="Color( 0, 0, 0, 1 )">
- The color of the title text.
- </theme_item>
- <theme_item name="title_font" type="Font">
- The font used to draw the title.
- </theme_item>
- <theme_item name="title_height" type="int" default="20">
- The vertical offset of the title text.
- </theme_item>
- </theme_items>
-</class>
diff --git a/doc/classes/World2D.xml b/doc/classes/World2D.xml
index 9e2d4cfde3..2d8382b7e3 100644
--- a/doc/classes/World2D.xml
+++ b/doc/classes/World2D.xml
@@ -13,13 +13,13 @@
</methods>
<members>
<member name="canvas" type="RID" setter="" getter="get_canvas">
- The [RID] of this world's canvas resource. Used by the [VisualServer] for 2D drawing.
+ The [RID] of this world's canvas resource. Used by the [RenderingServer] for 2D drawing.
</member>
- <member name="direct_space_state" type="Physics2DDirectSpaceState" setter="" getter="get_direct_space_state">
+ <member name="direct_space_state" type="PhysicsDirectSpaceState2D" setter="" getter="get_direct_space_state">
The state of this world's physics space. This allows arbitrary querying for collision.
</member>
<member name="space" type="RID" setter="" getter="get_space">
- The [RID] of this world's physics space resource. Used by the [Physics2DServer] for 2D physics, treating it as both a space and an area.
+ The [RID] of this world's physics space resource. Used by the [PhysicsServer2D] for 2D physics, treating it as both a space and an area.
</member>
</members>
<constants>
diff --git a/doc/classes/World.xml b/doc/classes/World3D.xml
index 48596c87d0..4224a2a2c3 100644
--- a/doc/classes/World.xml
+++ b/doc/classes/World3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="World" inherits="Resource" version="4.0">
+<class name="World3D" inherits="Resource" version="4.0">
<brief_description>
Class that has everything pertaining to a world.
</brief_description>
<description>
- 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.
+ Class that has everything pertaining to a world. A physics space, a visual scenario and a sound space. Node3D nodes register their resources into the current world.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/physics/ray-casting.html</link>
@@ -14,20 +14,20 @@
<members>
<member name="camera_effects" type="CameraEffects" setter="set_camera_effects" getter="get_camera_effects">
</member>
- <member name="direct_space_state" type="PhysicsDirectSpaceState" setter="" getter="get_direct_space_state">
- The World's physics direct space state, used for making various queries. Might be used only during [code]_physics_process[/code].
+ <member name="direct_space_state" type="PhysicsDirectSpaceState3D" setter="" getter="get_direct_space_state">
+ The World3D's physics direct space state, used for making various queries. Might be used only during [code]_physics_process[/code].
</member>
<member name="environment" type="Environment" setter="set_environment" getter="get_environment">
- The World's [Environment].
+ The World3D's [Environment].
</member>
<member name="fallback_environment" type="Environment" setter="set_fallback_environment" getter="get_fallback_environment">
- The World's fallback_environment will be used if the World's [Environment] fails or is missing.
+ The World3D's fallback_environment will be used if the World3D's [Environment] fails or is missing.
</member>
<member name="scenario" type="RID" setter="" getter="get_scenario">
- The World's visual scenario.
+ The World3D's visual scenario.
</member>
<member name="space" type="RID" setter="" getter="get_space">
- The World's physics space.
+ The World3D's physics space.
</member>
</members>
<constants>
diff --git a/doc/classes/WorldEnvironment.xml b/doc/classes/WorldEnvironment.xml
index 73500868a8..92b75621c2 100644
--- a/doc/classes/WorldEnvironment.xml
+++ b/doc/classes/WorldEnvironment.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
The [WorldEnvironment] node is used to configure the default [Environment] for the scene.
- The parameters defined in the [WorldEnvironment] can be overridden by an [Environment] node set on the current [Camera]. Additionally, only one [WorldEnvironment] may be instanced in a given scene at a time.
+ The parameters defined in the [WorldEnvironment] can be overridden by an [Environment] node set on the current [Camera3D]. Additionally, only one [WorldEnvironment] may be instanced in a given scene at a time.
The [WorldEnvironment] 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>
diff --git a/doc/classes/WorldMarginShape.xml b/doc/classes/WorldMarginShape3D.xml
index 54f76a066b..a91447056b 100644
--- a/doc/classes/WorldMarginShape.xml
+++ b/doc/classes/WorldMarginShape3D.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="WorldMarginShape" inherits="Shape" version="4.0">
+<class name="WorldMarginShape3D" inherits="Shape3D" version="4.0">
<brief_description>
Infinite plane shape for 3D collisions.
</brief_description>
<description>
- An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane.
+ An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape3D] is used in a [PhysicsBody3D], it will cause colliding objects placed "below" it to teleport "above" the plane.
</description>
<tutorials>
</tutorials>
@@ -12,7 +12,7 @@
</methods>
<members>
<member name="plane" type="Plane" setter="set_plane" getter="get_plane" default="Plane( 0, 1, 0, 0 )">
- The [Plane] used by the [WorldMarginShape] for collision.
+ The [Plane] used by the [WorldMarginShape3D] for collision.
</member>
</members>
<constants>
diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py
index 496d5dcb74..f6f52f5d66 100755
--- a/doc/tools/doc_merge.py
+++ b/doc/tools/doc_merge.py
@@ -21,7 +21,7 @@ def write_string(_f, text, newline=True):
for t in range(tab):
_f.write("\t")
_f.write(text)
- if (newline):
+ if newline:
_f.write("\n")
@@ -30,7 +30,7 @@ def escape(ret):
ret = ret.replace("<", "&gt;")
ret = ret.replace(">", "&lt;")
ret = ret.replace("'", "&apos;")
- ret = ret.replace("\"", "&quot;")
+ ret = ret.replace('"', "&quot;")
return ret
@@ -43,25 +43,26 @@ def dec_tab():
global tab
tab -= 1
+
write_string(f, '<?xml version="1.0" encoding="UTF-8" ?>')
write_string(f, '<doc version="' + new_doc.attrib["version"] + '">')
def get_tag(node, name):
tag = ""
- if (name in node.attrib):
- tag = ' ' + name + '="' + escape(node.attrib[name]) + '" '
+ if name in node.attrib:
+ tag = " " + name + '="' + escape(node.attrib[name]) + '" '
return tag
def find_method_descr(old_class, name):
methods = old_class.find("methods")
- if(methods != None and len(list(methods)) > 0):
+ if methods != None and len(list(methods)) > 0:
for m in list(methods):
- if (m.attrib["name"] == name):
+ if m.attrib["name"] == name:
description = m.find("description")
- if (description != None and description.text.strip() != ""):
+ if description != None and description.text.strip() != "":
return description.text
return None
@@ -70,11 +71,11 @@ def find_method_descr(old_class, name):
def find_signal_descr(old_class, name):
signals = old_class.find("signals")
- if(signals != None and len(list(signals)) > 0):
+ if signals != None and len(list(signals)) > 0:
for m in list(signals):
- if (m.attrib["name"] == name):
+ if m.attrib["name"] == name:
description = m.find("description")
- if (description != None and description.text.strip() != ""):
+ if description != None and description.text.strip() != "":
return description.text
return None
@@ -82,13 +83,13 @@ def find_signal_descr(old_class, name):
def find_constant_descr(old_class, name):
- if (old_class is None):
+ if old_class is None:
return None
constants = old_class.find("constants")
- if(constants != None and len(list(constants)) > 0):
+ if constants != None and len(list(constants)) > 0:
for m in list(constants):
- if (m.attrib["name"] == name):
- if (m.text.strip() != ""):
+ if m.attrib["name"] == name:
+ if m.text.strip() != "":
return m.text
return None
@@ -96,35 +97,35 @@ def find_constant_descr(old_class, name):
def write_class(c):
class_name = c.attrib["name"]
print("Parsing Class: " + class_name)
- if (class_name in old_classes):
+ if class_name in old_classes:
old_class = old_classes[class_name]
else:
old_class = None
category = get_tag(c, "category")
inherits = get_tag(c, "inherits")
- write_string(f, '<class name="' + class_name + '" ' + category + inherits + '>')
+ write_string(f, '<class name="' + class_name + '" ' + category + inherits + ">")
inc_tab()
write_string(f, "<brief_description>")
- if (old_class != None):
+ if old_class != None:
old_brief_descr = old_class.find("brief_description")
- if (old_brief_descr != None):
+ if old_brief_descr != None:
write_string(f, escape(old_brief_descr.text.strip()))
write_string(f, "</brief_description>")
write_string(f, "<description>")
- if (old_class != None):
+ if old_class != None:
old_descr = old_class.find("description")
- if (old_descr != None):
+ if old_descr != None:
write_string(f, escape(old_descr.text.strip()))
write_string(f, "</description>")
methods = c.find("methods")
- if(methods != None and len(list(methods)) > 0):
+ if methods != None and len(list(methods)) > 0:
write_string(f, "<methods>")
inc_tab()
@@ -132,35 +133,46 @@ def write_class(c):
for m in list(methods):
qualifiers = get_tag(m, "qualifiers")
- write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + '>')
+ write_string(f, '<method name="' + escape(m.attrib["name"]) + '" ' + qualifiers + ">")
inc_tab()
for a in list(m):
- if (a.tag == "return"):
+ if a.tag == "return":
typ = get_tag(a, "type")
- write_string(f, '<return' + typ + '>')
- write_string(f, '</return>')
- elif (a.tag == "argument"):
+ write_string(f, "<return" + typ + ">")
+ write_string(f, "</return>")
+ elif a.tag == "argument":
default = get_tag(a, "default")
- write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '"' + default + '>')
- write_string(f, '</argument>')
-
- write_string(f, '<description>')
- if (old_class != None):
+ write_string(
+ f,
+ '<argument index="'
+ + a.attrib["index"]
+ + '" name="'
+ + escape(a.attrib["name"])
+ + '" type="'
+ + a.attrib["type"]
+ + '"'
+ + default
+ + ">",
+ )
+ write_string(f, "</argument>")
+
+ write_string(f, "<description>")
+ if old_class != None:
old_method_descr = find_method_descr(old_class, m.attrib["name"])
- if (old_method_descr):
+ if old_method_descr:
write_string(f, escape(escape(old_method_descr.strip())))
- write_string(f, '</description>')
+ write_string(f, "</description>")
dec_tab()
write_string(f, "</method>")
dec_tab()
write_string(f, "</methods>")
signals = c.find("signals")
- if(signals != None and len(list(signals)) > 0):
+ if signals != None and len(list(signals)) > 0:
write_string(f, "<signals>")
inc_tab()
@@ -171,24 +183,33 @@ def write_class(c):
inc_tab()
for a in list(m):
- if (a.tag == "argument"):
-
- write_string(f, '<argument index="' + a.attrib["index"] + '" name="' + escape(a.attrib["name"]) + '" type="' + a.attrib["type"] + '">')
- write_string(f, '</argument>')
-
- write_string(f, '<description>')
- if (old_class != None):
+ if a.tag == "argument":
+
+ write_string(
+ f,
+ '<argument index="'
+ + a.attrib["index"]
+ + '" name="'
+ + escape(a.attrib["name"])
+ + '" type="'
+ + a.attrib["type"]
+ + '">',
+ )
+ write_string(f, "</argument>")
+
+ write_string(f, "<description>")
+ if old_class != None:
old_signal_descr = find_signal_descr(old_class, m.attrib["name"])
- if (old_signal_descr):
+ if old_signal_descr:
write_string(f, escape(old_signal_descr.strip()))
- write_string(f, '</description>')
+ write_string(f, "</description>")
dec_tab()
write_string(f, "</signal>")
dec_tab()
write_string(f, "</signals>")
constants = c.find("constants")
- if(constants != None and len(list(constants)) > 0):
+ if constants != None and len(list(constants)) > 0:
write_string(f, "<constants>")
inc_tab()
@@ -197,7 +218,7 @@ def write_class(c):
write_string(f, '<constant name="' + escape(m.attrib["name"]) + '" value="' + m.attrib["value"] + '">')
old_constant_descr = find_constant_descr(old_class, m.attrib["name"])
- if (old_constant_descr):
+ if old_constant_descr:
write_string(f, escape(old_constant_descr.strip()))
write_string(f, "</constant>")
@@ -207,9 +228,10 @@ def write_class(c):
dec_tab()
write_string(f, "</class>")
+
for c in list(old_doc):
old_classes[c.attrib["name"]] = c
for c in list(new_doc):
write_class(c)
-write_string(f, '</doc>\n')
+write_string(f, "</doc>\n")
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index e6e6d5f606..629b5a032b 100755
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -13,75 +13,74 @@ import xml.etree.ElementTree as ET
################################################################################
flags = {
- 'c': platform.platform() != 'Windows', # Disable by default on windows, since we use ANSI escape codes
- 'b': False,
- 'g': False,
- 's': False,
- 'u': False,
- 'h': False,
- 'p': False,
- 'o': True,
- 'i': False,
- 'a': True,
- 'e': False,
+ "c": platform.platform() != "Windows", # Disable by default on windows, since we use ANSI escape codes
+ "b": False,
+ "g": False,
+ "s": False,
+ "u": False,
+ "h": False,
+ "p": False,
+ "o": True,
+ "i": False,
+ "a": True,
+ "e": False,
}
flag_descriptions = {
- 'c': 'Toggle colors when outputting.',
- 'b': 'Toggle showing only not fully described classes.',
- 'g': 'Toggle showing only completed classes.',
- 's': 'Toggle showing comments about the status.',
- 'u': 'Toggle URLs to docs.',
- 'h': 'Show help and exit.',
- 'p': 'Toggle showing percentage as well as counts.',
- 'o': 'Toggle overall column.',
- 'i': 'Toggle collapse of class items columns.',
- 'a': 'Toggle showing all items.',
- 'e': 'Toggle hiding empty items.',
+ "c": "Toggle colors when outputting.",
+ "b": "Toggle showing only not fully described classes.",
+ "g": "Toggle showing only completed classes.",
+ "s": "Toggle showing comments about the status.",
+ "u": "Toggle URLs to docs.",
+ "h": "Show help and exit.",
+ "p": "Toggle showing percentage as well as counts.",
+ "o": "Toggle overall column.",
+ "i": "Toggle collapse of class items columns.",
+ "a": "Toggle showing all items.",
+ "e": "Toggle hiding empty items.",
}
long_flags = {
- 'colors': 'c',
- 'use-colors': 'c',
-
- 'bad': 'b',
- 'only-bad': 'b',
-
- 'good': 'g',
- 'only-good': 'g',
-
- 'comments': 's',
- 'status': 's',
-
- 'urls': 'u',
- 'gen-url': 'u',
-
- 'help': 'h',
-
- 'percent': 'p',
- 'use-percentages': 'p',
-
- 'overall': 'o',
- 'use-overall': 'o',
-
- 'items': 'i',
- 'collapse': 'i',
-
- 'all': 'a',
-
- 'empty': 'e',
+ "colors": "c",
+ "use-colors": "c",
+ "bad": "b",
+ "only-bad": "b",
+ "good": "g",
+ "only-good": "g",
+ "comments": "s",
+ "status": "s",
+ "urls": "u",
+ "gen-url": "u",
+ "help": "h",
+ "percent": "p",
+ "use-percentages": "p",
+ "overall": "o",
+ "use-overall": "o",
+ "items": "i",
+ "collapse": "i",
+ "all": "a",
+ "empty": "e",
}
-table_columns = ['name', 'brief_description', 'description', 'methods', 'constants', 'members', 'signals', 'theme_items']
-table_column_names = ['Name', 'Brief Desc.', 'Desc.', 'Methods', 'Constants', 'Members', 'Signals', 'Theme Items']
+table_columns = [
+ "name",
+ "brief_description",
+ "description",
+ "methods",
+ "constants",
+ "members",
+ "signals",
+ "theme_items",
+]
+table_column_names = ["Name", "Brief Desc.", "Desc.", "Methods", "Constants", "Members", "Signals", "Theme Items"]
colors = {
- 'name': [36], # cyan
- 'part_big_problem': [4, 31], # underline, red
- 'part_problem': [31], # red
- 'part_mostly_good': [33], # yellow
- 'part_good': [32], # green
- 'url': [4, 34], # underline, blue
- 'section': [1, 4], # bold, underline
- 'state_off': [36], # cyan
- 'state_on': [1, 35], # bold, magenta/plum
- 'bold': [1], # bold
+ "name": [36], # cyan
+ "part_big_problem": [4, 31], # underline, red
+ "part_problem": [31], # red
+ "part_mostly_good": [33], # yellow
+ "part_good": [32], # green
+ "url": [4, 34], # underline, blue
+ "section": [1, 4], # bold, underline
+ "state_off": [36], # cyan
+ "state_on": [1, 35], # bold, magenta/plum
+ "bold": [1], # bold
}
overall_progress_description_weigth = 10
@@ -90,6 +89,7 @@ overall_progress_description_weigth = 10
# Utils #
################################################################################
+
def validate_tag(elem, tag):
if elem.tag != tag:
print('Tag mismatch, expected "' + tag + '", got ' + elem.tag)
@@ -97,36 +97,38 @@ def validate_tag(elem, tag):
def color(color, string):
- if flags['c'] and terminal_supports_color():
- color_format = ''
+ if flags["c"] and terminal_supports_color():
+ color_format = ""
for code in colors[color]:
- color_format += '\033[' + str(code) + 'm'
- return color_format + string + '\033[0m'
+ color_format += "\033[" + str(code) + "m"
+ return color_format + string + "\033[0m"
else:
return string
-ansi_escape = re.compile(r'\x1b[^m]*m')
+
+ansi_escape = re.compile(r"\x1b[^m]*m")
def nonescape_len(s):
- return len(ansi_escape.sub('', s))
+ return len(ansi_escape.sub("", s))
+
def terminal_supports_color():
p = sys.platform
- supported_platform = p != 'Pocket PC' and (p != 'win32' or
- 'ANSICON' in os.environ)
+ supported_platform = p != "Pocket PC" and (p != "win32" or "ANSICON" in os.environ)
- is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
+ is_a_tty = hasattr(sys.stdout, "isatty") and sys.stdout.isatty()
if not supported_platform or not is_a_tty:
return False
return True
+
################################################################################
# Classes #
################################################################################
-class ClassStatusProgress:
+class ClassStatusProgress:
def __init__(self, described=0, total=0):
self.described = described
self.total = total
@@ -143,42 +145,41 @@ class ClassStatusProgress:
return self.described >= self.total
def to_configured_colored_string(self):
- if flags['p']:
- return self.to_colored_string('{percent}% ({has}/{total})', '{pad_percent}{pad_described}{s}{pad_total}')
+ if flags["p"]:
+ return self.to_colored_string("{percent}% ({has}/{total})", "{pad_percent}{pad_described}{s}{pad_total}")
else:
return self.to_colored_string()
- def to_colored_string(self, format='{has}/{total}', pad_format='{pad_described}{s}{pad_total}'):
+ def to_colored_string(self, format="{has}/{total}", pad_format="{pad_described}{s}{pad_total}"):
ratio = float(self.described) / float(self.total) if self.total != 0 else 1
percent = int(round(100 * ratio))
s = format.format(has=str(self.described), total=str(self.total), percent=str(percent))
if self.described >= self.total:
- s = color('part_good', s)
+ s = color("part_good", s)
elif self.described >= self.total / 4 * 3:
- s = color('part_mostly_good', s)
+ s = color("part_mostly_good", s)
elif self.described > 0:
- s = color('part_problem', s)
+ s = color("part_problem", s)
else:
- s = color('part_big_problem', s)
+ s = color("part_big_problem", s)
pad_size = max(len(str(self.described)), len(str(self.total)))
- pad_described = ''.ljust(pad_size - len(str(self.described)))
- pad_percent = ''.ljust(3 - len(str(percent)))
- pad_total = ''.ljust(pad_size - len(str(self.total)))
+ pad_described = "".ljust(pad_size - len(str(self.described)))
+ pad_percent = "".ljust(3 - len(str(percent)))
+ pad_total = "".ljust(pad_size - len(str(self.total)))
return pad_format.format(pad_described=pad_described, pad_total=pad_total, pad_percent=pad_percent, s=s)
class ClassStatus:
-
- def __init__(self, name=''):
+ def __init__(self, name=""):
self.name = name
self.has_brief_description = True
self.has_description = True
self.progresses = {
- 'methods': ClassStatusProgress(),
- 'constants': ClassStatusProgress(),
- 'members': ClassStatusProgress(),
- 'theme_items': ClassStatusProgress(),
- 'signals': ClassStatusProgress()
+ "methods": ClassStatusProgress(),
+ "constants": ClassStatusProgress(),
+ "members": ClassStatusProgress(),
+ "theme_items": ClassStatusProgress(),
+ "signals": ClassStatusProgress(),
}
def __add__(self, other):
@@ -208,66 +209,70 @@ class ClassStatus:
def make_output(self):
output = {}
- output['name'] = color('name', self.name)
+ output["name"] = color("name", self.name)
- ok_string = color('part_good', 'OK')
- missing_string = color('part_big_problem', 'MISSING')
+ ok_string = color("part_good", "OK")
+ missing_string = color("part_big_problem", "MISSING")
- output['brief_description'] = ok_string if self.has_brief_description else missing_string
- output['description'] = ok_string if self.has_description else missing_string
+ output["brief_description"] = ok_string if self.has_brief_description else missing_string
+ output["description"] = ok_string if self.has_description else missing_string
description_progress = ClassStatusProgress(
(self.has_brief_description + self.has_description) * overall_progress_description_weigth,
- 2 * overall_progress_description_weigth
+ 2 * overall_progress_description_weigth,
)
items_progress = ClassStatusProgress()
- for k in ['methods', 'constants', 'members', 'signals', 'theme_items']:
+ for k in ["methods", "constants", "members", "signals", "theme_items"]:
items_progress += self.progresses[k]
output[k] = self.progresses[k].to_configured_colored_string()
- output['items'] = items_progress.to_configured_colored_string()
+ output["items"] = items_progress.to_configured_colored_string()
- output['overall'] = (description_progress + items_progress).to_colored_string(color('bold', '{percent}%'), '{pad_percent}{s}')
+ output["overall"] = (description_progress + items_progress).to_colored_string(
+ color("bold", "{percent}%"), "{pad_percent}{s}"
+ )
- if self.name.startswith('Total'):
- output['url'] = color('url', 'https://docs.godotengine.org/en/latest/classes/')
- if flags['s']:
- output['comment'] = color('part_good', 'ALL OK')
+ if self.name.startswith("Total"):
+ output["url"] = color("url", "https://docs.godotengine.org/en/latest/classes/")
+ if flags["s"]:
+ output["comment"] = color("part_good", "ALL OK")
else:
- output['url'] = color('url', 'https://docs.godotengine.org/en/latest/classes/class_{name}.html'.format(name=self.name.lower()))
+ output["url"] = color(
+ "url", "https://docs.godotengine.org/en/latest/classes/class_{name}.html".format(name=self.name.lower())
+ )
- if flags['s'] and not flags['g'] and self.is_ok():
- output['comment'] = color('part_good', 'ALL OK')
+ if flags["s"] and not flags["g"] and self.is_ok():
+ output["comment"] = color("part_good", "ALL OK")
return output
@staticmethod
def generate_for_class(c):
status = ClassStatus()
- status.name = c.attrib['name']
+ status.name = c.attrib["name"]
for tag in list(c):
- if tag.tag == 'brief_description':
+ if tag.tag == "brief_description":
status.has_brief_description = len(tag.text.strip()) > 0
- elif tag.tag == 'description':
+ elif tag.tag == "description":
status.has_description = len(tag.text.strip()) > 0
- elif tag.tag in ['methods', 'signals']:
+ elif tag.tag in ["methods", "signals"]:
for sub_tag in list(tag):
- descr = sub_tag.find('description')
+ descr = sub_tag.find("description")
status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
- elif tag.tag in ['constants', 'members', 'theme_items']:
+ elif tag.tag in ["constants", "members", "theme_items"]:
for sub_tag in list(tag):
if not sub_tag.text is None:
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
- elif tag.tag in ['tutorials']:
+ elif tag.tag in ["tutorials"]:
pass # Ignore those tags for now
- elif tag.tag in ['theme_items']:
+ elif tag.tag in ["theme_items"]:
pass # Ignore those tags, since they seem to lack description at all
else:
@@ -286,63 +291,69 @@ merged_file = ""
for arg in sys.argv[1:]:
try:
- if arg.startswith('--'):
+ if arg.startswith("--"):
flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]]
- elif arg.startswith('-'):
+ elif arg.startswith("-"):
for f in arg[1:]:
flags[f] = not flags[f]
elif os.path.isdir(arg):
for f in os.listdir(arg):
- if f.endswith('.xml'):
- input_file_list.append(os.path.join(arg, f));
+ if f.endswith(".xml"):
+ input_file_list.append(os.path.join(arg, f))
else:
input_class_list.append(arg)
except KeyError:
print("Unknown command line flag: " + arg)
sys.exit(1)
-if flags['i']:
- for r in ['methods', 'constants', 'members', 'signals', 'theme_items']:
+if flags["i"]:
+ for r in ["methods", "constants", "members", "signals", "theme_items"]:
index = table_columns.index(r)
del table_column_names[index]
del table_columns[index]
- table_column_names.append('Items')
- table_columns.append('items')
+ table_column_names.append("Items")
+ table_columns.append("items")
-if flags['o'] == (not flags['i']):
- table_column_names.append(color('bold', 'Overall'))
- table_columns.append('overall')
+if flags["o"] == (not flags["i"]):
+ table_column_names.append(color("bold", "Overall"))
+ table_columns.append("overall")
-if flags['u']:
- table_column_names.append('Docs URL')
- table_columns.append('url')
+if flags["u"]:
+ table_column_names.append("Docs URL")
+ table_columns.append("url")
################################################################################
# Help #
################################################################################
-if len(input_file_list) < 1 or flags['h']:
- if not flags['h']:
- print(color('section', 'Invalid usage') + ': Please specify a classes directory')
- print(color('section', 'Usage') + ': doc_status.py [flags] <classes_dir> [class names]')
- print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
- print(color('section', 'Available flags') + ':')
+if len(input_file_list) < 1 or flags["h"]:
+ if not flags["h"]:
+ print(color("section", "Invalid usage") + ": Please specify a classes directory")
+ print(color("section", "Usage") + ": doc_status.py [flags] <classes_dir> [class names]")
+ print("\t< and > signify required parameters, while [ and ] signify optional parameters.")
+ print(color("section", "Available flags") + ":")
possible_synonym_list = list(long_flags)
possible_synonym_list.sort()
flag_list = list(flags)
flag_list.sort()
for flag in flag_list:
- synonyms = [color('name', '-' + flag)]
+ synonyms = [color("name", "-" + flag)]
for synonym in possible_synonym_list:
if long_flags[synonym] == flag:
- synonyms.append(color('name', '--' + synonym))
-
- print(('{synonyms} (Currently ' + color('state_' + ('on' if flags[flag] else 'off'), '{value}') + ')\n\t{description}').format(
- synonyms=', '.join(synonyms),
- value=('on' if flags[flag] else 'off'),
- description=flag_descriptions[flag]
- ))
+ synonyms.append(color("name", "--" + synonym))
+
+ print(
+ (
+ "{synonyms} (Currently "
+ + color("state_" + ("on" if flags[flag] else "off"), "{value}")
+ + ")\n\t{description}"
+ ).format(
+ synonyms=", ".join(synonyms),
+ value=("on" if flags[flag] else "off"),
+ description=flag_descriptions[flag],
+ )
+ )
sys.exit(0)
@@ -357,21 +368,21 @@ for file in input_file_list:
tree = ET.parse(file)
doc = tree.getroot()
- if 'version' not in doc.attrib:
+ if "version" not in doc.attrib:
print('Version missing from "doc"')
sys.exit(255)
- version = doc.attrib['version']
+ version = doc.attrib["version"]
- if doc.attrib['name'] in class_names:
+ if doc.attrib["name"] in class_names:
continue
- class_names.append(doc.attrib['name'])
- classes[doc.attrib['name']] = doc
+ class_names.append(doc.attrib["name"])
+ classes[doc.attrib["name"]] = doc
class_names.sort()
if len(input_class_list) < 1:
- input_class_list = ['*']
+ input_class_list = ["*"]
filtered_classes = set()
for pattern in input_class_list:
@@ -384,23 +395,23 @@ filtered_classes.sort()
################################################################################
table = [table_column_names]
-table_row_chars = '| - '
-table_column_chars = '|'
+table_row_chars = "| - "
+table_column_chars = "|"
-total_status = ClassStatus('Total')
+total_status = ClassStatus("Total")
for cn in filtered_classes:
c = classes[cn]
- validate_tag(c, 'class')
+ validate_tag(c, "class")
status = ClassStatus.generate_for_class(c)
total_status = total_status + status
- if (flags['b'] and status.is_ok()) or (flags['g'] and not status.is_ok()) or (not flags['a']):
+ if (flags["b"] and status.is_ok()) or (flags["g"] and not status.is_ok()) or (not flags["a"]):
continue
- if flags['e'] and status.is_empty():
+ if flags["e"] and status.is_empty():
continue
out = status.make_output()
@@ -409,10 +420,10 @@ for cn in filtered_classes:
if column in out:
row.append(out[column])
else:
- row.append('')
+ row.append("")
- if 'comment' in out and out['comment'] != '':
- row.append(out['comment'])
+ if "comment" in out and out["comment"] != "":
+ row.append(out["comment"])
table.append(row)
@@ -421,22 +432,22 @@ for cn in filtered_classes:
# Print output table #
################################################################################
-if len(table) == 1 and flags['a']:
- print(color('part_big_problem', 'No classes suitable for printing!'))
+if len(table) == 1 and flags["a"]:
+ print(color("part_big_problem", "No classes suitable for printing!"))
sys.exit(0)
-if len(table) > 2 or not flags['a']:
- total_status.name = 'Total = {0}'.format(len(table) - 1)
+if len(table) > 2 or not flags["a"]:
+ total_status.name = "Total = {0}".format(len(table) - 1)
out = total_status.make_output()
row = []
for column in table_columns:
if column in out:
row.append(out[column])
else:
- row.append('')
+ row.append("")
table.append(row)
-if flags['a']:
+if flags["a"]:
# Duplicate the headers at the bottom of the table so they can be viewed
# without having to scroll back to the top.
table.append(table_column_names)
@@ -451,7 +462,9 @@ for row in table:
divider_string = table_row_chars[0]
for cell_i in range(len(table[0])):
- divider_string += table_row_chars[1] + table_row_chars[2] * (table_column_sizes[cell_i]) + table_row_chars[1] + table_row_chars[0]
+ divider_string += (
+ table_row_chars[1] + table_row_chars[2] * (table_column_sizes[cell_i]) + table_row_chars[1] + table_row_chars[0]
+ )
print(divider_string)
for row_i, row in enumerate(table):
@@ -461,7 +474,11 @@ for row_i, row in enumerate(table):
if cell_i == 0:
row_string += table_row_chars[3] + cell + table_row_chars[3] * (padding_needed - 1)
else:
- row_string += table_row_chars[3] * int(math.floor(float(padding_needed) / 2)) + cell + table_row_chars[3] * int(math.ceil(float(padding_needed) / 2))
+ row_string += (
+ table_row_chars[3] * int(math.floor(float(padding_needed) / 2))
+ + cell
+ + table_row_chars[3] * int(math.ceil(float(padding_needed) / 2))
+ )
row_string += table_column_chars
print(row_string)
@@ -474,5 +491,5 @@ for row_i, row in enumerate(table):
print(divider_string)
-if total_status.is_ok() and not flags['g']:
- print('All listed classes are ' + color('part_good', 'OK') + '!')
+if total_status.is_ok() and not flags["g"]:
+ print("All listed classes are " + color("part_good", "OK") + "!")
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 9012de03b3..9de5eac31d 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -7,10 +7,12 @@ import xml.etree.ElementTree as ET
from collections import OrderedDict
# Uncomment to do type checks. I have it commented out so it works below Python 3.5
-#from typing import List, Dict, TextIO, Tuple, Iterable, Optional, DefaultDict, Any, Union
+# from typing import List, Dict, TextIO, Tuple, Iterable, Optional, DefaultDict, Any, Union
# http(s)://docs.godotengine.org/<langcode>/<tag>/path/to/page.html(#fragment-tag)
-GODOT_DOCS_PATTERN = re.compile(r'^http(?:s)?://docs\.godotengine\.org/(?:[a-zA-Z0-9.\-_]*)/(?:[a-zA-Z0-9.\-_]*)/(.*)\.html(#.*)?$')
+GODOT_DOCS_PATTERN = re.compile(
+ r"^http(?:s)?://docs\.godotengine\.org/(?:[a-zA-Z0-9.\-_]*)/(?:[a-zA-Z0-9.\-_]*)/(.*)\.html(#.*)?$"
+)
def print_error(error, state): # type: (str, State) -> None
@@ -37,7 +39,9 @@ class TypeName:
class PropertyDef:
- def __init__(self, name, type_name, setter, getter, text, default_value, overridden): # type: (str, TypeName, Optional[str], Optional[str], Optional[str], Optional[str], Optional[bool]) -> None
+ def __init__(
+ self, name, type_name, setter, getter, text, default_value, overridden
+ ): # type: (str, TypeName, Optional[str], Optional[str], Optional[str], Optional[str], Optional[bool]) -> None
self.name = name
self.type_name = type_name
self.setter = setter
@@ -46,6 +50,7 @@ class PropertyDef:
self.default_value = default_value
self.overridden = overridden
+
class ParameterDef:
def __init__(self, name, type_name, default_value): # type: (str, TypeName, Optional[str]) -> None
self.name = name
@@ -61,7 +66,9 @@ class SignalDef:
class MethodDef:
- def __init__(self, name, return_type, parameters, description, qualifiers): # type: (str, TypeName, List[ParameterDef], Optional[str], Optional[str]) -> None
+ def __init__(
+ self, name, return_type, parameters, description, qualifiers
+ ): # type: (str, TypeName, List[ParameterDef], Optional[str], Optional[str]) -> None
self.name = name
self.return_type = return_type
self.parameters = parameters
@@ -144,10 +151,12 @@ class State:
getter = property.get("getter") or None
default_value = property.get("default") or None
if default_value is not None:
- default_value = '``{}``'.format(default_value)
+ default_value = "``{}``".format(default_value)
overridden = property.get("override") or False
- property_def = PropertyDef(property_name, type_name, setter, getter, property.text, default_value, overridden)
+ property_def = PropertyDef(
+ property_name, type_name, setter, getter, property.text, default_value, overridden
+ )
class_def.properties[property_name] = property_def
methods = class_root.find("methods")
@@ -246,8 +255,6 @@ class State:
if link.text is not None:
class_def.tutorials.append(link.text)
-
-
def sort_classes(self): # type: () -> None
self.classes = OrderedDict(sorted(self.classes.items(), key=lambda t: t[0]))
@@ -273,7 +280,11 @@ def main(): # type: () -> None
parser.add_argument("path", nargs="+", help="A path to an XML file or a directory containing XML files to parse.")
group = parser.add_mutually_exclusive_group()
group.add_argument("--output", "-o", default=".", help="The directory to save output .rst files in.")
- group.add_argument("--dry-run", action="store_true", help="If passed, no output will be generated and XML files are only checked for errors.")
+ group.add_argument(
+ "--dry-run",
+ action="store_true",
+ help="If passed, no output will be generated and XML files are only checked for errors.",
+ )
args = parser.parse_args()
file_list = [] # type: List[str]
@@ -283,15 +294,15 @@ def main(): # type: () -> None
if path.endswith(os.sep):
path = path[:-1]
- if os.path.basename(path) == 'modules':
+ if os.path.basename(path) == "modules":
for subdir, dirs, _ in os.walk(path):
- if 'doc_classes' in dirs:
- doc_dir = os.path.join(subdir, 'doc_classes')
- class_file_names = (f for f in os.listdir(doc_dir) if f.endswith('.xml'))
+ if "doc_classes" in dirs:
+ doc_dir = os.path.join(subdir, "doc_classes")
+ class_file_names = (f for f in os.listdir(doc_dir) if f.endswith(".xml"))
file_list += (os.path.join(doc_dir, f) for f in class_file_names)
elif os.path.isdir(path):
- file_list += (os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xml'))
+ file_list += (os.path.join(path, f) for f in os.listdir(path) if f.endswith(".xml"))
elif os.path.isfile(path):
if not path.endswith(".xml"):
@@ -311,7 +322,7 @@ def main(): # type: () -> None
continue
doc = tree.getroot()
- if 'version' not in doc.attrib:
+ if "version" not in doc.attrib:
print_error("Version missing from 'doc', file: {}".format(cur_file), state)
continue
@@ -337,13 +348,14 @@ def main(): # type: () -> None
if state.errored:
exit(1)
+
def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, State, bool, str) -> None
class_name = class_def.name
if dry_run:
- f = open(os.devnull, "w")
+ f = open(os.devnull, "w", encoding="utf-8")
else:
- f = open(os.path.join(output_dir, "class_" + class_name.lower() + '.rst'), 'w', encoding='utf-8')
+ f = open(os.path.join(output_dir, "class_" + class_name.lower() + ".rst"), "w", encoding="utf-8")
# Warn contributors not to edit this file directly
f.write(":github_url: hide\n\n")
@@ -352,13 +364,13 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
f.write(".. The source is found in doc/classes or modules/<name>/doc_classes.\n\n")
f.write(".. _class_" + class_name + ":\n\n")
- f.write(make_heading(class_name, '='))
+ f.write(make_heading(class_name, "="))
# Inheritance tree
# Ascendants
if class_def.inherits:
inh = class_def.inherits.strip()
- f.write('**Inherits:** ')
+ f.write("**Inherits:** ")
first = True
while inh in state.classes:
if not first:
@@ -381,7 +393,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
inherited.append(c.name)
if len(inherited):
- f.write('**Inherited By:** ')
+ f.write("**Inherited By:** ")
for i, child in enumerate(inherited):
if i > 0:
f.write(", ")
@@ -393,20 +405,20 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
f.write(rstize_text(class_def.brief_description.strip(), state) + "\n\n")
# Class description
- if class_def.description is not None and class_def.description.strip() != '':
- f.write(make_heading('Description', '-'))
+ if class_def.description is not None and class_def.description.strip() != "":
+ f.write(make_heading("Description", "-"))
f.write(rstize_text(class_def.description.strip(), state) + "\n\n")
# Online tutorials
if len(class_def.tutorials) > 0:
- f.write(make_heading('Tutorials', '-'))
+ f.write(make_heading("Tutorials", "-"))
for t in class_def.tutorials:
link = t.strip()
f.write("- " + make_url(link) + "\n\n")
# Properties overview
if len(class_def.properties) > 0:
- f.write(make_heading('Properties', '-'))
+ f.write(make_heading("Properties", "-"))
ml = [] # type: List[Tuple[str, str, str]]
for property_def in class_def.properties.values():
type_rst = property_def.type_name.to_rst(state)
@@ -420,7 +432,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
# Methods overview
if len(class_def.methods) > 0:
- f.write(make_heading('Methods', '-'))
+ f.write(make_heading("Methods", "-"))
ml = []
for method_list in class_def.methods.values():
for m in method_list:
@@ -429,7 +441,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
# Theme properties
if class_def.theme_items is not None and len(class_def.theme_items) > 0:
- f.write(make_heading('Theme Properties', '-'))
+ f.write(make_heading("Theme Properties", "-"))
pl = []
for theme_item_list in class_def.theme_items.values():
for theme_item in theme_item_list:
@@ -438,30 +450,30 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
# Signals
if len(class_def.signals) > 0:
- f.write(make_heading('Signals', '-'))
+ f.write(make_heading("Signals", "-"))
index = 0
for signal in class_def.signals.values():
if index != 0:
- f.write('----\n\n')
+ f.write("----\n\n")
f.write(".. _class_{}_signal_{}:\n\n".format(class_name, signal.name))
_, signature = make_method_signature(class_def, signal, False, state)
f.write("- {}\n\n".format(signature))
- if signal.description is not None and signal.description.strip() != '':
- f.write(rstize_text(signal.description.strip(), state) + '\n\n')
+ if signal.description is not None and signal.description.strip() != "":
+ f.write(rstize_text(signal.description.strip(), state) + "\n\n")
index += 1
# Enums
if len(class_def.enums) > 0:
- f.write(make_heading('Enumerations', '-'))
+ f.write(make_heading("Enumerations", "-"))
index = 0
for e in class_def.enums.values():
if index != 0:
- f.write('----\n\n')
+ f.write("----\n\n")
f.write(".. _enum_{}_{}:\n\n".format(class_name, e.name))
# Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it.
@@ -474,16 +486,16 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
f.write("enum **{}**:\n\n".format(e.name))
for value in e.values.values():
f.write("- **{}** = **{}**".format(value.name, value.value))
- if value.text is not None and value.text.strip() != '':
- f.write(' --- ' + rstize_text(value.text.strip(), state))
+ if value.text is not None and value.text.strip() != "":
+ f.write(" --- " + rstize_text(value.text.strip(), state))
- f.write('\n\n')
+ f.write("\n\n")
index += 1
# Constants
if len(class_def.constants) > 0:
- f.write(make_heading('Constants', '-'))
+ f.write(make_heading("Constants", "-"))
# Sphinx seems to divide the bullet list into individual <ul> tags if we weave the labels into it.
# As such I'll put them all above the list. Won't be perfect but better than making the list visually broken.
for constant in class_def.constants.values():
@@ -491,14 +503,14 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
for constant in class_def.constants.values():
f.write("- **{}** = **{}**".format(constant.name, constant.value))
- if constant.text is not None and constant.text.strip() != '':
- f.write(' --- ' + rstize_text(constant.text.strip(), state))
+ if constant.text is not None and constant.text.strip() != "":
+ f.write(" --- " + rstize_text(constant.text.strip(), state))
- f.write('\n\n')
+ f.write("\n\n")
# Property descriptions
if any(not p.overridden for p in class_def.properties.values()) > 0:
- f.write(make_heading('Property Descriptions', '-'))
+ f.write(make_heading("Property Descriptions", "-"))
index = 0
for property_def in class_def.properties.values():
@@ -506,36 +518,36 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
continue
if index != 0:
- f.write('----\n\n')
+ f.write("----\n\n")
f.write(".. _class_{}_property_{}:\n\n".format(class_name, property_def.name))
- f.write('- {} **{}**\n\n'.format(property_def.type_name.to_rst(state), property_def.name))
+ f.write("- {} **{}**\n\n".format(property_def.type_name.to_rst(state), property_def.name))
info = []
if property_def.default_value is not None:
info.append(("*Default*", property_def.default_value))
if property_def.setter is not None and not property_def.setter.startswith("_"):
- info.append(("*Setter*", property_def.setter + '(value)'))
+ info.append(("*Setter*", property_def.setter + "(value)"))
if property_def.getter is not None and not property_def.getter.startswith("_"):
- info.append(('*Getter*', property_def.getter + '()'))
+ info.append(("*Getter*", property_def.getter + "()"))
if len(info) > 0:
format_table(f, info)
- if property_def.text is not None and property_def.text.strip() != '':
- f.write(rstize_text(property_def.text.strip(), state) + '\n\n')
+ if property_def.text is not None and property_def.text.strip() != "":
+ f.write(rstize_text(property_def.text.strip(), state) + "\n\n")
index += 1
# Method descriptions
if len(class_def.methods) > 0:
- f.write(make_heading('Method Descriptions', '-'))
+ f.write(make_heading("Method Descriptions", "-"))
index = 0
for method_list in class_def.methods.values():
for i, m in enumerate(method_list):
if index != 0:
- f.write('----\n\n')
+ f.write("----\n\n")
if i == 0:
f.write(".. _class_{}_method_{}:\n\n".format(class_name, m.name))
@@ -543,24 +555,24 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
ret_type, signature = make_method_signature(class_def, m, False, state)
f.write("- {} {}\n\n".format(ret_type, signature))
- if m.description is not None and m.description.strip() != '':
- f.write(rstize_text(m.description.strip(), state) + '\n\n')
+ if m.description is not None and m.description.strip() != "":
+ f.write(rstize_text(m.description.strip(), state) + "\n\n")
index += 1
def make_class_list(class_list, columns): # type: (List[str], int) -> None
# This function is no longer used.
- f = open('class_list.rst', 'w', encoding='utf-8')
+ f = open("class_list.rst", "w", encoding="utf-8")
col_max = len(class_list) // columns + 1
- print(('col max is ', col_max))
+ print(("col max is ", col_max))
fit_columns = [] # type: List[List[str]]
for _ in range(0, columns):
fit_columns.append([])
indexers = [] # type List[str]
- last_initial = ''
+ last_initial = ""
for idx, name in enumerate(class_list):
col = idx // col_max
@@ -590,7 +602,7 @@ def make_class_list(class_list, columns): # type: (List[str], int) -> None
f.write("\n")
for r in range(0, row_max):
- s = '+ '
+ s = "+ "
for c in range(0, columns):
if r >= len(fit_columns[c]):
continue
@@ -598,13 +610,13 @@ def make_class_list(class_list, columns): # type: (List[str], int) -> None
classname = fit_columns[c][r]
initial = classname[0]
if classname in indexers:
- s += '**' + initial + '** | '
+ s += "**" + initial + "** | "
else:
- s += ' | '
+ s += " | "
- s += '[' + classname + '](class_' + classname.lower() + ') | '
+ s += "[" + classname + "](class_" + classname.lower() + ") | "
- s += '\n'
+ s += "\n"
f.write(s)
for n in range(0, columns):
@@ -618,29 +630,29 @@ def escape_rst(text, until_pos=-1): # type: (str) -> str
# Escape \ character, otherwise it ends up as an escape character in rst
pos = 0
while True:
- pos = text.find('\\', pos, until_pos)
+ pos = text.find("\\", pos, until_pos)
if pos == -1:
break
- text = text[:pos] + "\\\\" + text[pos + 1:]
+ text = text[:pos] + "\\\\" + text[pos + 1 :]
pos += 2
# Escape * character to avoid interpreting it as emphasis
pos = 0
while True:
- pos = text.find('*', pos, until_pos)
+ pos = text.find("*", pos, until_pos)
if pos == -1:
break
- text = text[:pos] + "\*" + text[pos + 1:]
+ text = text[:pos] + "\*" + text[pos + 1 :]
pos += 2
# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
pos = 0
while True:
- pos = text.find('_', pos, until_pos)
+ pos = text.find("_", pos, until_pos)
if pos == -1:
break
if not text[pos + 1].isalnum(): # don't escape within a snake_case word
- text = text[:pos] + "\_" + text[pos + 1:]
+ text = text[:pos] + "\_" + text[pos + 1 :]
pos += 2
else:
pos += 1
@@ -652,16 +664,16 @@ def rstize_text(text, state): # type: (str, State) -> str
# Linebreak + tabs in the XML should become two line breaks unless in a "codeblock"
pos = 0
while True:
- pos = text.find('\n', pos)
+ pos = text.find("\n", pos)
if pos == -1:
break
pre_text = text[:pos]
indent_level = 0
- while text[pos + 1] == '\t':
+ while text[pos + 1] == "\t":
pos += 1
indent_level += 1
- post_text = text[pos + 1:]
+ post_text = text[pos + 1 :]
# Handle codeblocks
if post_text.startswith("[codeblock]"):
@@ -670,28 +682,33 @@ def rstize_text(text, state): # type: (str, State) -> str
print_error("[codeblock] without a closing tag, file: {}".format(state.current_class), state)
return ""
- code_text = post_text[len("[codeblock]"):end_pos]
+ code_text = post_text[len("[codeblock]") : end_pos]
post_text = post_text[end_pos:]
# Remove extraneous tabs
code_pos = 0
while True:
- code_pos = code_text.find('\n', code_pos)
+ code_pos = code_text.find("\n", code_pos)
if code_pos == -1:
break
to_skip = 0
- while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == '\t':
+ while code_pos + to_skip + 1 < len(code_text) and code_text[code_pos + to_skip + 1] == "\t":
to_skip += 1
if to_skip > indent_level:
- print_error("Four spaces should be used for indentation within [codeblock], file: {}".format(state.current_class), state)
-
- if len(code_text[code_pos + to_skip + 1:]) == 0:
+ print_error(
+ "Four spaces should be used for indentation within [codeblock], file: {}".format(
+ state.current_class
+ ),
+ state,
+ )
+
+ if len(code_text[code_pos + to_skip + 1 :]) == 0:
code_text = code_text[:code_pos] + "\n"
code_pos += 1
else:
- code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1:]
+ code_text = code_text[:code_pos] + "\n " + code_text[code_pos + to_skip + 1 :]
code_pos += 5 - to_skip
text = pre_text + "\n[codeblock]" + code_text + post_text
@@ -702,7 +719,7 @@ def rstize_text(text, state): # type: (str, State) -> str
text = pre_text + "\n\n" + post_text
pos += 2
- next_brac_pos = text.find('[')
+ next_brac_pos = text.find("[")
text = escape_rst(text, next_brac_pos)
# Handle [tags]
@@ -714,54 +731,59 @@ def rstize_text(text, state): # type: (str, State) -> str
tag_depth = 0
previous_pos = 0
while True:
- pos = text.find('[', pos)
+ pos = text.find("[", pos)
if inside_url and (pos > previous_pos):
url_has_name = True
if pos == -1:
break
- endq_pos = text.find(']', pos + 1)
+ endq_pos = text.find("]", pos + 1)
if endq_pos == -1:
break
pre_text = text[:pos]
- post_text = text[endq_pos + 1:]
- tag_text = text[pos + 1:endq_pos]
+ post_text = text[endq_pos + 1 :]
+ tag_text = text[pos + 1 : endq_pos]
escape_post = False
if tag_text in state.classes:
if tag_text == state.current_class:
# We don't want references to the same class
- tag_text = '``{}``'.format(tag_text)
+ tag_text = "``{}``".format(tag_text)
else:
tag_text = make_type(tag_text, state)
escape_post = True
else: # command
cmd = tag_text
- space_pos = tag_text.find(' ')
- if cmd == '/codeblock':
- tag_text = ''
+ space_pos = tag_text.find(" ")
+ if cmd == "/codeblock":
+ tag_text = ""
tag_depth -= 1
inside_code = False
# Strip newline if the tag was alone on one
- if pre_text[-1] == '\n':
+ if pre_text[-1] == "\n":
pre_text = pre_text[:-1]
- elif cmd == '/code':
- tag_text = '``'
+ elif cmd == "/code":
+ tag_text = "``"
tag_depth -= 1
inside_code = False
escape_post = True
elif inside_code:
- tag_text = '[' + tag_text + ']'
- elif cmd.find('html') == 0:
- param = tag_text[space_pos + 1:]
+ tag_text = "[" + tag_text + "]"
+ elif cmd.find("html") == 0:
+ param = tag_text[space_pos + 1 :]
tag_text = param
- elif cmd.startswith('method') or cmd.startswith('member') or cmd.startswith('signal') or cmd.startswith('constant'):
- param = tag_text[space_pos + 1:]
-
- if param.find('.') != -1:
- ss = param.split('.')
+ elif (
+ cmd.startswith("method")
+ or cmd.startswith("member")
+ or cmd.startswith("signal")
+ or cmd.startswith("constant")
+ ):
+ param = tag_text[space_pos + 1 :]
+
+ if param.find(".") != -1:
+ ss = param.split(".")
if len(ss) > 2:
print_error("Bad reference: '{}', file: {}".format(param, state.current_class), state)
class_param, method_param = ss
@@ -794,7 +816,7 @@ def rstize_text(text, state): # type: (str, State) -> str
# Search in the current class
search_class_defs = [class_def]
- if param.find('.') == -1:
+ if param.find(".") == -1:
# Also search in @GlobalScope as a last resort if no class was specified
search_class_defs.append(state.classes["@GlobalScope"])
@@ -815,66 +837,71 @@ def rstize_text(text, state): # type: (str, State) -> str
ref_type = "_constant"
else:
- print_error("Unresolved type reference '{}' in method reference '{}', file: {}".format(class_param, param, state.current_class), state)
+ print_error(
+ "Unresolved type reference '{}' in method reference '{}', file: {}".format(
+ class_param, param, state.current_class
+ ),
+ state,
+ )
repl_text = method_param
if class_param != state.current_class:
repl_text = "{}.{}".format(class_param, method_param)
- tag_text = ':ref:`{}<class_{}{}_{}>`'.format(repl_text, class_param, ref_type, method_param)
+ tag_text = ":ref:`{}<class_{}{}_{}>`".format(repl_text, class_param, ref_type, method_param)
escape_post = True
- elif cmd.find('image=') == 0:
+ elif cmd.find("image=") == 0:
tag_text = "" # '![](' + cmd[6:] + ')'
- elif cmd.find('url=') == 0:
+ elif cmd.find("url=") == 0:
url_link = cmd[4:]
- tag_text = '`'
+ tag_text = "`"
tag_depth += 1
inside_url = True
url_has_name = False
- elif cmd == '/url':
- tag_text = ('' if url_has_name else url_link) + " <" + url_link + ">`_"
+ elif cmd == "/url":
+ tag_text = ("" if url_has_name else url_link) + " <" + url_link + ">`_"
tag_depth -= 1
escape_post = True
inside_url = False
url_has_name = False
- elif cmd == 'center':
+ elif cmd == "center":
tag_depth += 1
- tag_text = ''
- elif cmd == '/center':
+ tag_text = ""
+ elif cmd == "/center":
tag_depth -= 1
- tag_text = ''
- elif cmd == 'codeblock':
+ tag_text = ""
+ elif cmd == "codeblock":
tag_depth += 1
- tag_text = '\n::\n'
+ tag_text = "\n::\n"
inside_code = True
- elif cmd == 'br':
+ elif cmd == "br":
# Make a new paragraph instead of a linebreak, rst is not so linebreak friendly
- tag_text = '\n\n'
+ tag_text = "\n\n"
# Strip potential leading spaces
- while post_text[0] == ' ':
+ while post_text[0] == " ":
post_text = post_text[1:]
- elif cmd == 'i' or cmd == '/i':
+ elif cmd == "i" or cmd == "/i":
if cmd == "/i":
tag_depth -= 1
else:
tag_depth += 1
- tag_text = '*'
- elif cmd == 'b' or cmd == '/b':
+ tag_text = "*"
+ elif cmd == "b" or cmd == "/b":
if cmd == "/b":
tag_depth -= 1
else:
tag_depth += 1
- tag_text = '**'
- elif cmd == 'u' or cmd == '/u':
+ tag_text = "**"
+ elif cmd == "u" or cmd == "/u":
if cmd == "/u":
tag_depth -= 1
else:
tag_depth += 1
- tag_text = ''
- elif cmd == 'code':
- tag_text = '``'
+ tag_text = ""
+ elif cmd == "code":
+ tag_text = "``"
tag_depth += 1
inside_code = True
- elif cmd.startswith('enum '):
+ elif cmd.startswith("enum "):
tag_text = make_enum(cmd[5:], state)
escape_post = True
else:
@@ -883,24 +910,24 @@ def rstize_text(text, state): # type: (str, State) -> str
# Properly escape things like `[Node]s`
if escape_post and post_text and (post_text[0].isalnum() or post_text[0] == "("): # not punctuation, escape
- post_text = '\ ' + post_text
+ 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)
+ iter_pos = post_text.find("*", iter_pos, next_brac_pos)
if iter_pos == -1:
break
- post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1:]
+ post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1 :]
iter_pos += 2
iter_pos = 0
while not inside_code:
- iter_pos = post_text.find('_', iter_pos, next_brac_pos)
+ iter_pos = post_text.find("_", iter_pos, next_brac_pos)
if iter_pos == -1:
break
if not post_text[iter_pos + 1].isalnum(): # don't escape within a snake_case word
- post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1:]
+ post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1 :]
iter_pos += 2
else:
iter_pos += 1
@@ -922,7 +949,7 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl
column_sizes = [0] * len(data[0])
for row in data:
for i, text in enumerate(row):
- text_length = len(text or '')
+ text_length = len(text or "")
if text_length > column_sizes[i]:
column_sizes[i] = text_length
@@ -939,16 +966,16 @@ def format_table(f, data, remove_empty_columns=False): # type: (TextIO, Iterabl
for i, text in enumerate(row):
if column_sizes[i] == 0 and remove_empty_columns:
continue
- row_text += " " + (text or '').ljust(column_sizes[i]) + " |"
+ row_text += " " + (text or "").ljust(column_sizes[i]) + " |"
row_text += "\n"
f.write(row_text)
f.write(sep)
- f.write('\n')
+ f.write("\n")
def make_type(t, state): # type: (str, State) -> str
if t in state.classes:
- return ':ref:`{0}<class_{0}>`'.format(t)
+ return ":ref:`{0}<class_{0}>`".format(t)
print_error("Unresolved type '{}', file: {}".format(t, state.current_class), state)
return t
@@ -957,7 +984,7 @@ def make_enum(t, state): # type: (str, State) -> str
p = t.find(".")
if p >= 0:
c = t[0:p]
- e = t[p + 1:]
+ e = t[p + 1 :]
# Variant enums live in GlobalScope but still use periods.
if c == "Variant":
c = "@GlobalScope"
@@ -969,7 +996,7 @@ def make_enum(t, state): # type: (str, State) -> str
c = "@GlobalScope"
if not c in state.classes and c.startswith("_"):
- c = c[1:] # Remove the underscore prefix
+ c = c[1:] # Remove the underscore prefix
if c in state.classes and e in state.classes[c].enums:
return ":ref:`{0}<enum_{1}_{0}>`".format(e, c)
@@ -981,7 +1008,9 @@ def make_enum(t, state): # type: (str, State) -> str
return t
-def make_method_signature(class_def, method_def, make_ref, state): # type: (ClassDef, Union[MethodDef, SignalDef], bool, State) -> Tuple[str, str]
+def make_method_signature(
+ class_def, method_def, make_ref, state
+): # type: (ClassDef, Union[MethodDef, SignalDef], bool, State) -> Tuple[str, str]
ret_type = " "
ref_type = "signal"
@@ -996,34 +1025,34 @@ def make_method_signature(class_def, method_def, make_ref, state): # type: (Cla
else:
out += "**{}** ".format(method_def.name)
- out += '**(**'
+ out += "**(**"
for i, arg in enumerate(method_def.parameters):
if i > 0:
- out += ', '
+ out += ", "
else:
- out += ' '
+ out += " "
out += "{} {}".format(arg.type_name.to_rst(state), arg.name)
if arg.default_value is not None:
- out += '=' + arg.default_value
+ out += "=" + arg.default_value
- if isinstance(method_def, MethodDef) and method_def.qualifiers is not None and 'vararg' in method_def.qualifiers:
+ if isinstance(method_def, MethodDef) and method_def.qualifiers is not None and "vararg" in method_def.qualifiers:
if len(method_def.parameters) > 0:
- out += ', ...'
+ out += ", ..."
else:
- out += ' ...'
+ out += " ..."
- out += ' **)**'
+ out += " **)**"
if isinstance(method_def, MethodDef) and method_def.qualifiers is not None:
- out += ' ' + method_def.qualifiers
+ out += " " + method_def.qualifiers
return ret_type, out
def make_heading(title, underline): # type: (str, str) -> str
- return title + '\n' + (underline * len(title)) + "\n\n"
+ return title + "\n" + (underline * len(title)) + "\n\n"
def make_url(link): # type: (str) -> str
@@ -1047,5 +1076,5 @@ def make_url(link): # type: (str) -> str
return "`" + link + " <" + link + ">`_"
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/doc/translations/extract.py b/doc/translations/extract.py
index cd06e13dda..a65f942b92 100644
--- a/doc/translations/extract.py
+++ b/doc/translations/extract.py
@@ -7,7 +7,7 @@ import shutil
from collections import OrderedDict
EXTRACT_TAGS = ["description", "brief_description", "member", "constant", "theme_item", "link"]
-HEADER = '''\
+HEADER = """\
# LANGUAGE translation of the Godot Engine class reference.
# Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.
# Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).
@@ -24,7 +24,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8-bit\\n"
-'''
+"""
# Some strings used by makerst.py are normally part of the editor translations,
# so we need to include them manually here for the online docs.
BASE_STRINGS = [
@@ -42,7 +42,8 @@ BASE_STRINGS = [
## <xml-line-number-hack from="https://stackoverflow.com/a/36430270/10846399">
import sys
-sys.modules['_elementtree'] = None
+
+sys.modules["_elementtree"] = None
import xml.etree.ElementTree as ET
## override the parser to get the line number
@@ -62,8 +63,11 @@ class LineNumberingParser(ET.XMLParser):
element._end_column_number = self.parser.CurrentColumnNumber
element._end_byte_index = self.parser.CurrentByteIndex
return element
+
+
## </xml-line-number-hack>
+
class Desc:
def __init__(self, line_no, msg, desc_list=None):
## line_no : the line number where the desc is
@@ -73,6 +77,7 @@ class Desc:
self.msg = msg
self.desc_list = desc_list
+
class DescList:
def __init__(self, doc, path):
## doc : root xml element of the document
@@ -82,29 +87,32 @@ class DescList:
self.path = path
self.list = []
+
def print_error(error):
print("ERROR: {}".format(error))
+
## build classes with xml elements recursively
def _collect_classes_dir(path, classes):
if not os.path.isdir(path):
print_error("Invalid directory path: {}".format(path))
exit(1)
- for _dir in map(lambda dir : os.path.join(path, dir), os.listdir(path)):
+ for _dir in map(lambda dir: os.path.join(path, dir), os.listdir(path)):
if os.path.isdir(_dir):
_collect_classes_dir(_dir, classes)
elif os.path.isfile(_dir):
if not _dir.endswith(".xml"):
- #print("Got non-.xml file '{}', skipping.".format(path))
+ # print("Got non-.xml file '{}', skipping.".format(path))
continue
_collect_classes_file(_dir, classes)
+
## opens a file and parse xml add to classes
def _collect_classes_file(path, classes):
if not os.path.isfile(path) or not path.endswith(".xml"):
print_error("Invalid xml file path: {}".format(path))
exit(1)
- print('Collecting file: {}'.format(os.path.basename(path)))
+ print("Collecting file: {}".format(os.path.basename(path)))
try:
tree = ET.parse(path, parser=LineNumberingParser())
@@ -114,8 +122,8 @@ def _collect_classes_file(path, classes):
doc = tree.getroot()
- if 'name' in doc.attrib:
- if 'version' not in doc.attrib:
+ if "name" in doc.attrib:
+ if "version" not in doc.attrib:
print_error("Version missing from 'doc', file: {}".format(path))
name = doc.attrib["name"]
@@ -124,7 +132,7 @@ def _collect_classes_file(path, classes):
exit(1)
classes[name] = DescList(doc, path)
else:
- print_error('Unknown XML file {}, skipping'.format(path))
+ print_error("Unknown XML file {}, skipping".format(path))
## regions are list of tuples with size 3 (start_index, end_index, indent)
@@ -132,56 +140,64 @@ def _collect_classes_file(path, classes):
## if i inside the region returns the indent, else returns -1
def _get_xml_indent(i, regions):
for region in regions:
- if region[0] < i < region[1] :
+ if region[0] < i < region[1]:
return region[2]
return -1
+
## find and build all regions of codeblock which we need later
-def _make_codeblock_regions(desc, path=''):
+def _make_codeblock_regions(desc, path=""):
code_block_end = False
code_block_index = 0
code_block_regions = []
while not code_block_end:
code_block_index = desc.find("[codeblock]", code_block_index)
- if code_block_index < 0: break
- xml_indent=0
- while True :
+ if code_block_index < 0:
+ break
+ xml_indent = 0
+ while True:
## [codeblock] always have a trailing new line and some tabs
## those tabs are belongs to xml indentations not code indent
- if desc[code_block_index+len("[codeblock]\n")+xml_indent] == '\t':
- xml_indent+=1
- else: break
+ if desc[code_block_index + len("[codeblock]\n") + xml_indent] == "\t":
+ xml_indent += 1
+ else:
+ break
end_index = desc.find("[/codeblock]", code_block_index)
- if end_index < 0 :
- print_error('Non terminating codeblock: {}'.format(path))
+ if end_index < 0:
+ print_error("Non terminating codeblock: {}".format(path))
exit(1)
- code_block_regions.append( (code_block_index, end_index, xml_indent) )
+ code_block_regions.append((code_block_index, end_index, xml_indent))
code_block_index += 1
return code_block_regions
+
def _strip_and_split_desc(desc, code_block_regions):
- desc_strip = '' ## a stripped desc msg
+ desc_strip = "" ## a stripped desc msg
total_indent = 0 ## code indent = total indent - xml indent
for i in range(len(desc)):
c = desc[i]
- if c == '\n' : c = '\\n'
- if c == '"': c = '\\"'
- if c == '\\': c = '\\\\' ## <element \> is invalid for msgmerge
- if c == '\t':
+ if c == "\n":
+ c = "\\n"
+ if c == '"':
+ c = '\\"'
+ if c == "\\":
+ c = "\\\\" ## <element \> is invalid for msgmerge
+ if c == "\t":
xml_indent = _get_xml_indent(i, code_block_regions)
if xml_indent >= 0:
total_indent += 1
if xml_indent < total_indent:
- c = '\\t'
+ c = "\\t"
else:
continue
else:
continue
desc_strip += c
- if c == '\\n':
+ if c == "\\n":
total_indent = 0
return desc_strip
+
## make catalog strings from xml elements
def _make_translation_catalog(classes):
unique_msgs = OrderedDict()
@@ -189,8 +205,9 @@ def _make_translation_catalog(classes):
desc_list = classes[class_name]
for elem in desc_list.doc.iter():
if elem.tag in EXTRACT_TAGS:
- if not elem.text or len(elem.text) == 0 : continue
- line_no = elem._start_line_number if elem.text[0]!='\n' else elem._start_line_number+1
+ if not elem.text or len(elem.text) == 0:
+ continue
+ line_no = elem._start_line_number if elem.text[0] != "\n" else elem._start_line_number + 1
desc_str = elem.text.strip()
code_block_regions = _make_codeblock_regions(desc_str, desc_list.path)
desc_msg = _strip_and_split_desc(desc_str, code_block_regions)
@@ -203,44 +220,48 @@ def _make_translation_catalog(classes):
unique_msgs[desc_msg].append(desc_obj)
return unique_msgs
+
## generate the catalog file
def _generate_translation_catalog_file(unique_msgs, output):
- with open(output, 'w', encoding='utf8') as f:
+ with open(output, "w", encoding="utf8") as f:
f.write(HEADER)
for msg in BASE_STRINGS:
- f.write('#: doc/tools/makerst.py\n')
+ f.write("#: doc/tools/makerst.py\n")
f.write('msgid "{}"\n'.format(msg))
f.write('msgstr ""\n\n')
for msg in unique_msgs:
if len(msg) == 0 or msg in BASE_STRINGS:
continue
- f.write('#:')
+ f.write("#:")
desc_list = unique_msgs[msg]
for desc in desc_list:
- path = desc.desc_list.path.replace('\\', '/')
- if path.startswith('./'):
+ path = desc.desc_list.path.replace("\\", "/")
+ if path.startswith("./"):
path = path[2:]
- f.write(' {}:{}'.format(path, desc.line_no))
- f.write('\n')
+ f.write(" {}:{}".format(path, desc.line_no))
+ f.write("\n")
f.write('msgid "{}"\n'.format(msg))
f.write('msgstr ""\n\n')
## TODO: what if 'nt'?
- if (os.name == "posix"):
+ if os.name == "posix":
print("Wrapping template at 79 characters for compatibility with Weblate.")
os.system("msgmerge -w79 {0} {0} > {0}.wrap".format(output))
shutil.move("{}.wrap".format(output), output)
+
def main():
parser = argparse.ArgumentParser()
- parser.add_argument("--path", "-p", nargs="+", default=".", help="The directory or directories containing XML files to collect.")
+ parser.add_argument(
+ "--path", "-p", nargs="+", default=".", help="The directory or directories containing XML files to collect."
+ )
parser.add_argument("--output", "-o", default="translation_catalog.pot", help="The path to the output file.")
args = parser.parse_args()
output = os.path.abspath(args.output)
- if not os.path.isdir(os.path.dirname(output)) or not output.endswith('.pot'):
+ if not os.path.isdir(os.path.dirname(output)) or not output.endswith(".pot"):
print_error("Invalid output path: {}".format(output))
exit(1)
@@ -252,13 +273,14 @@ def main():
print("\nCurrent working dir: {}".format(path))
- path_classes = OrderedDict() ## dictionary of key=class_name, value=DescList objects
+ path_classes = OrderedDict() ## dictionary of key=class_name, value=DescList objects
_collect_classes_dir(path, path_classes)
classes.update(path_classes)
- classes = OrderedDict(sorted(classes.items(), key = lambda kv: kv[0].lower()))
+ classes = OrderedDict(sorted(classes.items(), key=lambda kv: kv[0].lower()))
unique_msgs = _make_translation_catalog(classes)
_generate_translation_catalog_file(unique_msgs, output)
-if __name__ == '__main__':
+
+if __name__ == "__main__":
main()
diff --git a/drivers/SCsub b/drivers/SCsub
index 41c20d81ad..cc7bcbc640 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -1,41 +1,42 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.drivers_sources = []
# OS drivers
-SConscript('unix/SCsub')
-SConscript('windows/SCsub')
+SConscript("unix/SCsub")
+SConscript("windows/SCsub")
# Sounds drivers
-SConscript('alsa/SCsub')
-SConscript('coreaudio/SCsub')
-SConscript('pulseaudio/SCsub')
-if (env["platform"] == "windows"):
+SConscript("alsa/SCsub")
+SConscript("coreaudio/SCsub")
+SConscript("pulseaudio/SCsub")
+if env["platform"] == "windows":
SConscript("wasapi/SCsub")
-if env['xaudio2']:
+if env["xaudio2"]:
SConscript("xaudio2/SCsub")
# Midi drivers
-SConscript('alsamidi/SCsub')
-SConscript('coremidi/SCsub')
-SConscript('winmidi/SCsub')
+SConscript("alsamidi/SCsub")
+SConscript("coremidi/SCsub")
+SConscript("winmidi/SCsub")
# Graphics drivers
-if (env["platform"] != "server" and env["platform"] != "javascript"):
-# SConscript('gles2/SCsub')
- SConscript('vulkan/SCsub')
- SConscript('gl_context/SCsub')
+if env["platform"] != "server" and env["platform"] != "javascript":
+ # SConscript('gles2/SCsub')
+ SConscript("vulkan/SCsub")
+ SConscript("gl_context/SCsub")
else:
- SConscript('dummy/SCsub')
+ SConscript("dummy/SCsub")
# Core dependencies
SConscript("png/SCsub")
SConscript("spirv-reflect/SCsub")
-if env['vsproj']:
+if env["vsproj"]:
import os
+
path = os.getcwd()
# Change directory so the path resolves correctly in the function call.
os.chdir("..")
diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/alsa/SCsub
+++ b/drivers/alsa/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp
index 400ce31bf7..48e694dd3a 100644
--- a/drivers/alsa/audio_driver_alsa.cpp
+++ b/drivers/alsa/audio_driver_alsa.cpp
@@ -60,7 +60,7 @@ Error AudioDriverALSA::init_device() {
fprintf(stderr, "ALSA ERR: %s\n", snd_strerror(status)); \
if (pcm_handle) { \
snd_pcm_close(pcm_handle); \
- pcm_handle = NULL; \
+ pcm_handle = nullptr; \
} \
ERR_FAIL_COND_V(m_cond, ERR_CANT_OPEN); \
}
@@ -98,7 +98,7 @@ Error AudioDriverALSA::init_device() {
status = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 2);
CHECK_FAIL(status < 0);
- status = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &mix_rate, NULL);
+ status = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &mix_rate, nullptr);
CHECK_FAIL(status < 0);
// In ALSA the period size seems to be the one that will determine the actual latency
@@ -113,12 +113,12 @@ Error AudioDriverALSA::init_device() {
status = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size);
CHECK_FAIL(status < 0);
- status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, NULL);
+ status = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, &period_size, nullptr);
CHECK_FAIL(status < 0);
print_verbose("Audio buffer frames: " + itos(period_size) + " calculated latency: " + itos(period_size * 1000 / mix_rate) + "ms");
- status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, NULL);
+ status = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &periods, nullptr);
CHECK_FAIL(status < 0);
status = snd_pcm_hw_params(pcm_handle, hwparams);
@@ -262,11 +262,11 @@ Array AudioDriverALSA::get_device_list() {
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
return list;
- for (void **n = hints; *n != NULL; n++) {
+ for (void **n = hints; *n != nullptr; 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 (name != nullptr && !strncmp(name, "plughw", 6)) {
if (desc) {
list.push_back(String(name) + ";" + String(desc));
} else {
@@ -274,9 +274,9 @@ Array AudioDriverALSA::get_device_list() {
}
}
- if (desc != NULL)
+ if (desc != nullptr)
free(desc);
- if (name != NULL)
+ if (name != nullptr)
free(name);
}
snd_device_name_free_hint(hints);
@@ -314,7 +314,7 @@ void AudioDriverALSA::finish_device() {
if (pcm_handle) {
snd_pcm_close(pcm_handle);
- pcm_handle = NULL;
+ pcm_handle = nullptr;
}
}
@@ -325,15 +325,15 @@ void AudioDriverALSA::finish() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
finish_device();
}
AudioDriverALSA::AudioDriverALSA() :
- thread(NULL),
- pcm_handle(NULL),
+ thread(nullptr),
+ pcm_handle(nullptr),
device_name("Default"),
new_device("Default") {
}
diff --git a/drivers/alsamidi/SCsub b/drivers/alsamidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/alsamidi/SCsub
+++ b/drivers/alsamidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp
index 0cecf1de3e..e3e54ea267 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.cpp
+++ b/drivers/alsamidi/midi_driver_alsamidi.cpp
@@ -132,18 +132,18 @@ Error MIDIDriverALSAMidi::open() {
return ERR_CANT_OPEN;
int i = 0;
- for (void **n = hints; *n != NULL; n++) {
+ for (void **n = hints; *n != nullptr; n++) {
char *name = snd_device_name_get_hint(*n, "NAME");
- if (name != NULL) {
+ if (name != nullptr) {
snd_rawmidi_t *midi_in;
- int ret = snd_rawmidi_open(&midi_in, NULL, name, SND_RAWMIDI_NONBLOCK);
+ int ret = snd_rawmidi_open(&midi_in, nullptr, name, SND_RAWMIDI_NONBLOCK);
if (ret >= 0) {
connected_inputs.insert(i++, midi_in);
}
}
- if (name != NULL)
+ if (name != nullptr)
free(name);
}
snd_device_name_free_hint(hints);
@@ -161,7 +161,7 @@ void MIDIDriverALSAMidi::close() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
for (int i = 0; i < connected_inputs.size(); i++) {
@@ -202,7 +202,7 @@ PackedStringArray MIDIDriverALSAMidi::get_connected_inputs() {
MIDIDriverALSAMidi::MIDIDriverALSAMidi() {
- thread = NULL;
+ thread = nullptr;
exit_thread = false;
}
diff --git a/drivers/coreaudio/SCsub b/drivers/coreaudio/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/coreaudio/SCsub
+++ b/drivers/coreaudio/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index 1e95bcf5d9..21c3649445 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -79,8 +79,8 @@ Error AudioDriverCoreAudio::init() {
#endif
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
- AudioComponent comp = AudioComponentFindNext(NULL, &desc);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
+ AudioComponent comp = AudioComponentFindNext(nullptr, &desc);
+ ERR_FAIL_COND_V(comp == nullptr, FAILED);
OSStatus result = AudioComponentInstanceNew(comp, &audio_unit);
ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -335,7 +335,7 @@ void AudioDriverCoreAudio::finish() {
ERR_PRINT("AudioComponentInstanceDispose failed");
}
- audio_unit = NULL;
+ audio_unit = nullptr;
unlock();
}
}
@@ -351,8 +351,8 @@ Error AudioDriverCoreAudio::capture_init() {
#endif
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
- AudioComponent comp = AudioComponentFindNext(NULL, &desc);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
+ AudioComponent comp = AudioComponentFindNext(nullptr, &desc);
+ ERR_FAIL_COND_V(comp == nullptr, FAILED);
OSStatus result = AudioComponentInstanceNew(comp, &input_unit);
ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -380,7 +380,7 @@ Error AudioDriverCoreAudio::capture_init() {
size = sizeof(AudioDeviceID);
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
- result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, &size, &deviceId);
+ result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
ERR_FAIL_COND_V(result != noErr, FAILED);
result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &deviceId, sizeof(AudioDeviceID));
@@ -469,7 +469,7 @@ void AudioDriverCoreAudio::capture_finish() {
ERR_PRINT("AudioComponentInstanceDispose failed");
}
- input_unit = NULL;
+ input_unit = nullptr;
unlock();
}
}
@@ -513,18 +513,18 @@ Array AudioDriverCoreAudio::_get_device_list(bool capture) {
prop.mElement = kAudioObjectPropertyElementMaster;
UInt32 size = 0;
- AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &size);
+ AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
AudioDeviceID *audioDevices = (AudioDeviceID *)malloc(size);
- AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &size, audioDevices);
+ AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, nullptr, &size, audioDevices);
UInt32 deviceCount = size / sizeof(AudioDeviceID);
for (UInt32 i = 0; i < deviceCount; i++) {
prop.mScope = capture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
prop.mSelector = kAudioDevicePropertyStreamConfiguration;
- AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, NULL, &size);
+ AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, nullptr, &size);
AudioBufferList *bufferList = (AudioBufferList *)malloc(size);
- AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, bufferList);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, nullptr, &size, bufferList);
UInt32 channelCount = 0;
for (UInt32 j = 0; j < bufferList->mNumberBuffers; j++)
@@ -538,7 +538,7 @@ Array AudioDriverCoreAudio::_get_device_list(bool capture) {
size = sizeof(CFStringRef);
prop.mSelector = kAudioObjectPropertyName;
- AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, &cfname);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, nullptr, &size, &cfname);
CFIndex length = CFStringGetLength(cfname);
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
@@ -569,18 +569,18 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
prop.mElement = kAudioObjectPropertyElementMaster;
UInt32 size = 0;
- AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &size);
+ AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, nullptr, &size);
AudioDeviceID *audioDevices = (AudioDeviceID *)malloc(size);
- AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &size, audioDevices);
+ AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, nullptr, &size, audioDevices);
UInt32 deviceCount = size / sizeof(AudioDeviceID);
for (UInt32 i = 0; i < deviceCount && !found; i++) {
prop.mScope = capture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
prop.mSelector = kAudioDevicePropertyStreamConfiguration;
- AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, NULL, &size);
+ AudioObjectGetPropertyDataSize(audioDevices[i], &prop, 0, nullptr, &size);
AudioBufferList *bufferList = (AudioBufferList *)malloc(size);
- AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, bufferList);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, nullptr, &size, bufferList);
UInt32 channelCount = 0;
for (UInt32 j = 0; j < bufferList->mNumberBuffers; j++)
@@ -594,7 +594,7 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
size = sizeof(CFStringRef);
prop.mSelector = kAudioObjectPropertyName;
- AudioObjectGetPropertyData(audioDevices[i], &prop, 0, NULL, &size, &cfname);
+ AudioObjectGetPropertyData(audioDevices[i], &prop, 0, nullptr, &size, &cfname);
CFIndex length = CFStringGetLength(cfname);
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8) + 1;
@@ -620,7 +620,7 @@ void AudioDriverCoreAudio::_set_device(const String &device, bool capture) {
UInt32 elem = capture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice;
AudioObjectPropertyAddress property = { elem, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
- OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, NULL, &size, &deviceId);
+ OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &property, 0, nullptr, &size, &deviceId);
ERR_FAIL_COND(result != noErr);
found = true;
@@ -677,8 +677,8 @@ String AudioDriverCoreAudio::capture_get_device() {
#endif
AudioDriverCoreAudio::AudioDriverCoreAudio() :
- audio_unit(NULL),
- input_unit(NULL),
+ audio_unit(nullptr),
+ input_unit(nullptr),
active(false),
device_name("Default"),
capture_device_name("Default"),
diff --git a/drivers/coremidi/SCsub b/drivers/coremidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/coremidi/SCsub
+++ b/drivers/coremidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/coremidi/midi_driver_coremidi.cpp b/drivers/coremidi/midi_driver_coremidi.cpp
index d807896e61..2cd322813b 100644
--- a/drivers/coremidi/midi_driver_coremidi.cpp
+++ b/drivers/coremidi/midi_driver_coremidi.cpp
@@ -47,8 +47,8 @@ void MIDIDriverCoreMidi::read(const MIDIPacketList *packet_list, void *read_proc
Error MIDIDriverCoreMidi::open() {
- CFStringRef name = CFStringCreateWithCString(NULL, "Godot", kCFStringEncodingASCII);
- OSStatus result = MIDIClientCreate(name, NULL, NULL, &client);
+ CFStringRef name = CFStringCreateWithCString(nullptr, "Godot", kCFStringEncodingASCII);
+ OSStatus result = MIDIClientCreate(name, nullptr, nullptr, &client);
CFRelease(name);
if (result != noErr) {
ERR_PRINT("MIDIClientCreate failed, code: " + itos(result));
@@ -99,7 +99,7 @@ PackedStringArray MIDIDriverCoreMidi::get_connected_inputs() {
for (int i = 0; i < connected_sources.size(); i++) {
MIDIEndpointRef source = connected_sources[i];
- CFStringRef ref = NULL;
+ CFStringRef ref = nullptr;
char name[256];
MIDIObjectGetStringProperty(source, kMIDIPropertyDisplayName, &ref);
diff --git a/drivers/dummy/SCsub b/drivers/dummy/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/dummy/SCsub
+++ b/drivers/dummy/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index a503492595..0bcfed2dcf 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -77,7 +77,7 @@ public:
void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) {}
#endif
- void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {}
+ void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) {}
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
@@ -719,7 +719,7 @@ public:
float lightmap_capture_get_energy(RID p_capture) const { return 0.0; }
const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const {
const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture);
- ERR_FAIL_COND_V(!capture, NULL);
+ ERR_FAIL_COND_V(!capture, nullptr);
return &capture->octree;
}
diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h
index e5ae945706..2a7d01dd78 100644
--- a/drivers/dummy/texture_loader_dummy.h
+++ b/drivers/dummy/texture_loader_dummy.h
@@ -36,7 +36,7 @@
class ResourceFormatDummyTexture : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index d6945ee2eb..ddeec6f4c6 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]):
+if env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]:
# Thirdparty source files
thirdparty_dir = "#thirdparty/glad/"
thirdparty_sources = [
@@ -12,8 +12,8 @@ if (env["platform"] in ["haiku", "osx", "windows", "linuxbsd"]):
env.Prepend(CPPPATH=[thirdparty_dir])
- env.Append(CPPDEFINES=['GLAD_ENABLED'])
- env.Append(CPPDEFINES=['GLES_OVER_GL'])
+ env.Append(CPPDEFINES=["GLAD_ENABLED"])
+ env.Append(CPPDEFINES=["GLES_OVER_GL"])
env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub
index 9923e52c73..987ddcd16e 100644
--- a/drivers/gles2/SCsub
+++ b/drivers/gles2/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index 734b4463ff..069eeaba6c 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -208,7 +208,7 @@ void RasterizerCanvasGLES2::canvas_end() {
RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) {
- RasterizerStorageGLES2::Texture *tex_return = NULL;
+ RasterizerStorageGLES2::Texture *tex_return = nullptr;
if (p_texture.is_valid()) {
@@ -216,7 +216,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
if (!texture) {
state.current_tex = RID();
- state.current_tex_ptr = NULL;
+ state.current_tex_ptr = nullptr;
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1);
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
@@ -243,7 +243,7 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con
}
} else {
state.current_tex = RID();
- state.current_tex_ptr = NULL;
+ state.current_tex_ptr = nullptr;
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1);
glBindTexture(GL_TEXTURE_2D, storage->resources.white_tex);
@@ -293,14 +293,14 @@ void RasterizerCanvasGLES2::_draw_polygon(const int *p_indices, int p_index_coun
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), nullptr);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
@@ -345,7 +345,7 @@ void RasterizerCanvasGLES2::_draw_polygon(const int *p_indices, int p_index_coun
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
if (storage->config.support_32_bits_indices) { //should check for
@@ -369,14 +369,14 @@ void RasterizerCanvasGLES2::_draw_generic(GLuint p_primitive, int p_vertex_count
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), nullptr);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
@@ -411,14 +411,14 @@ void RasterizerCanvasGLES2::_draw_generic_indices(GLuint p_primitive, const int
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
uint32_t buffer_ofs = 0;
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(Vector2), nullptr);
buffer_ofs += sizeof(Vector2) * p_vertex_count;
if (p_singlecolor) {
@@ -447,7 +447,7 @@ void RasterizerCanvasGLES2::_draw_generic_indices(GLuint p_primitive, const int
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.polygon_index_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
if (storage->config.support_32_bits_indices) { //should check for
@@ -510,11 +510,11 @@ void RasterizerCanvasGLES2::_draw_gui_primitive(int p_points, const Vector2 *p_v
glBindBuffer(GL_ARRAY_BUFFER, data.polygon_buffer);
#ifndef GLES_OVER_GL
// Orphan the buffer to avoid CPU/GPU sync points caused by glBufferSubData
- glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, data.polygon_buffer_size, nullptr, GL_DYNAMIC_DRAW);
#endif
glBufferSubData(GL_ARRAY_BUFFER, 0, p_points * stride * 4 * sizeof(float), buffer_data);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, stride * sizeof(float), nullptr);
if (p_colors) {
glVertexAttribPointer(RS::ARRAY_COLOR, 4, GL_FLOAT, GL_FALSE, stride * sizeof(float), CAST_INT_TO_UCHAR_PTR(color_offset * sizeof(float)));
@@ -579,7 +579,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
if (line->antialiased)
glEnable(GL_LINE_SMOOTH);
#endif
- _draw_gui_primitive(2, verts, NULL, NULL);
+ _draw_gui_primitive(2, verts, nullptr, nullptr);
#ifdef GLES_OVER_GL
if (line->antialiased)
@@ -595,7 +595,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
line->to - t
};
- _draw_gui_primitive(4, verts, NULL, NULL);
+ _draw_gui_primitive(4, verts, nullptr, nullptr);
#ifdef GLES_OVER_GL
if (line->antialiased) {
glEnable(GL_LINE_SMOOTH);
@@ -604,7 +604,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
verts[j],
verts[(j + 1) % 4],
};
- _draw_gui_primitive(2, vertsl, NULL, NULL);
+ _draw_gui_primitive(2, vertsl, nullptr, nullptr);
}
glDisable(GL_LINE_SMOOTH);
}
@@ -702,7 +702,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
untile = true;
}
- _draw_gui_primitive(4, points, NULL, uvs);
+ _draw_gui_primitive(4, points, nullptr, uvs);
if (untile) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -717,7 +717,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
};
state.canvas_shader.set_uniform(CanvasShaderGLES2::COLOR_TEXPIXEL_SIZE, Vector2());
- _draw_gui_primitive(4, points, NULL, uvs);
+ _draw_gui_primitive(4, points, nullptr, uvs);
}
} else {
@@ -971,10 +971,10 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
glEnableVertexAttribArray(RS::ARRAY_TEX_UV);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), nullptr);
glVertexAttribPointer(RS::ARRAY_TEX_UV, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), CAST_INT_TO_UCHAR_PTR((sizeof(float) * 2)));
- glDrawElements(GL_TRIANGLES, 18 * 3 - (np->draw_center ? 0 : 6), GL_UNSIGNED_BYTE, NULL);
+ glDrawElements(GL_TRIANGLES, 18 * 3 - (np->draw_center ? 0 : 6), GL_UNSIGNED_BYTE, nullptr);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
@@ -1008,7 +1008,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
_bind_canvas_texture(RID(), RID());
- _draw_polygon(indices, num_points * 3, num_points + 1, points, NULL, &circle->color, true);
+ _draw_polygon(indices, num_points * 3, num_points + 1, points, nullptr, &circle->color, true);
} break;
case Item::Command::TYPE_POLYGON: {
@@ -1241,13 +1241,13 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
_bind_canvas_texture(RID(), RID());
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);
+ _draw_generic(GL_TRIANGLE_STRIP, pline->triangles.size(), pline->triangles.ptr(), nullptr, pline->triangle_colors.ptr(), pline->triangle_colors.size() == 1);
#ifdef GLES_OVER_GL
glEnable(GL_LINE_SMOOTH);
if (pline->multiline) {
//needs to be different
} else {
- _draw_generic(GL_LINE_LOOP, pline->lines.size(), pline->lines.ptr(), NULL, pline->line_colors.ptr(), pline->line_colors.size() == 1);
+ _draw_generic(GL_LINE_LOOP, pline->lines.size(), pline->lines.ptr(), nullptr, pline->line_colors.ptr(), pline->line_colors.size() == 1);
}
glDisable(GL_LINE_SMOOTH);
#endif
@@ -1265,12 +1265,12 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
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);
+ _draw_generic(GL_LINES, to_draw * 2, &pline->lines.ptr()[offset], nullptr, 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);
+ _draw_generic(GL_LINES, pline->lines.size(), pline->lines.ptr(), nullptr, pline->line_colors.ptr(), pline->line_colors.size() == 1);
}
#ifdef GLES_OVER_GL
@@ -1402,7 +1402,7 @@ void RasterizerCanvasGLES2::_copy_screen(const Rect2 &p_rect) {
2, 3, 0
};
- _draw_polygon(indexpos, 6, 4, vertpos, uvpos, NULL, false);
+ _draw_polygon(indexpos, 6, 4, vertpos, uvpos, nullptr, false);
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_COPY_SECTION, false);
storage->shaders.copy.set_conditional(CopyShaderGLES2::USE_NO_ALPHA, false);
@@ -1426,16 +1426,16 @@ void RasterizerCanvasGLES2::_copy_texscreen(const Rect2 &p_rect) {
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;
+ Item *current_clip = nullptr;
- RasterizerStorageGLES2::Shader *shader_cache = NULL;
+ RasterizerStorageGLES2::Shader *shader_cache = nullptr;
bool rebind_shader = true;
bool prev_use_skeleton = false;
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_SKELETON, false);
state.current_tex = RID();
- state.current_tex_ptr = NULL;
+ state.current_tex_ptr = nullptr;
state.current_normal = RID();
state.canvas_texscreen_used = false;
@@ -1475,14 +1475,14 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
}
}
- RasterizerStorageGLES2::Skeleton *skeleton = NULL;
+ RasterizerStorageGLES2::Skeleton *skeleton = nullptr;
{
//skeleton handling
if (ci->skeleton.is_valid() && storage->skeleton_owner.owns(ci->skeleton)) {
skeleton = storage->skeleton_owner.getornull(ci->skeleton);
if (!skeleton->use_2d) {
- skeleton = NULL;
+ skeleton = nullptr;
} else {
state.skeleton_transform = p_base_transform * skeleton->base_transform_2d;
state.skeleton_transform_inverse = state.skeleton_transform.affine_inverse();
@@ -1490,7 +1490,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
}
}
- bool use_skeleton = skeleton != NULL;
+ bool use_skeleton = skeleton != nullptr;
if (prev_use_skeleton != use_skeleton) {
rebind_shader = true;
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_SKELETON, use_skeleton);
@@ -1513,13 +1513,13 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
if (material != canvas_last_material || rebind_shader) {
- RasterizerStorageGLES2::Shader *shader_ptr = NULL;
+ RasterizerStorageGLES2::Shader *shader_ptr = nullptr;
if (material_ptr) {
shader_ptr = material_ptr->shader;
if (shader_ptr && shader_ptr->mode != RS::SHADER_CANVAS_ITEM) {
- shader_ptr = NULL; // not a canvas item shader, don't use.
+ shader_ptr = nullptr; // not a canvas item shader, don't use.
}
}
@@ -1674,7 +1674,7 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
_set_uniforms();
if (unshaded || (state.uniforms.final_modulate.a > 0.001 && (!shader_cache || shader_cache->canvas_item.light_mode != RasterizerStorageGLES2::Shader::CanvasItem::LIGHT_MODE_LIGHT_ONLY) && !ci->light_masked))
- _canvas_item_render_commands(p_item_list, NULL, reclip, material_ptr);
+ _canvas_item_render_commands(p_item_list, nullptr, reclip, material_ptr);
rebind_shader = true; // hacked in for now.
@@ -1753,9 +1753,9 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons
}
glActiveTexture(GL_TEXTURE0);
- _canvas_item_render_commands(p_item_list, NULL, reclip, material_ptr); //redraw using light
+ _canvas_item_render_commands(p_item_list, nullptr, reclip, material_ptr); //redraw using light
- state.using_light = NULL;
+ state.using_light = nullptr;
}
light = light->next_ptr;
@@ -1980,7 +1980,7 @@ void RasterizerCanvasGLES2::reset_canvas() {
void RasterizerCanvasGLES2::_bind_quad_buffer() {
glBindBuffer(GL_ARRAY_BUFFER, data.canvas_quad_vertices);
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
- glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, NULL);
+ glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
}
void RasterizerCanvasGLES2::draw_generic_textured_rect(const Rect2 &p_rect, const Rect2 &p_src) {
@@ -2117,7 +2117,7 @@ void RasterizerCanvasGLES2::initialize() {
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);
+ glBufferData(GL_ARRAY_BUFFER, poly_size, nullptr, GL_DYNAMIC_DRAW);
data.polygon_buffer_size = poly_size;
@@ -2128,7 +2128,7 @@ void RasterizerCanvasGLES2::initialize() {
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);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, index_size, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
data.polygon_index_buffer_size = index_size;
@@ -2140,7 +2140,7 @@ void RasterizerCanvasGLES2::initialize() {
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);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(float) * (16 + 16) * 2, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
@@ -2210,7 +2210,7 @@ void RasterizerCanvasGLES2::initialize() {
state.canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false));
- state.using_light = NULL;
+ state.using_light = nullptr;
state.using_transparent_rt = false;
state.using_skeleton = false;
}
diff --git a/drivers/gles2/rasterizer_canvas_gles2.h b/drivers/gles2/rasterizer_canvas_gles2.h
index 4e4db98c25..2d6355e948 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.h
+++ b/drivers/gles2/rasterizer_canvas_gles2.h
@@ -116,7 +116,7 @@ public:
virtual void canvas_end();
_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, const float *p_weights = NULL, const int *p_bones = NULL);
+ _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 float *p_weights = nullptr, const int *p_bones = nullptr);
_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 _draw_generic_indices(GLuint p_primitive, 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);
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index cc17af171e..37b729d568 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -221,7 +221,7 @@ void RasterizerGLES2::initialize() {
if (OS::get_singleton()->is_stdout_verbose()) {
if (GLAD_GL_ARB_debug_output) {
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
- glDebugMessageCallbackARB(_gl_debug_print, NULL);
+ glDebugMessageCallbackARB(_gl_debug_print, nullptr);
glEnable(_EXT_DEBUG_OUTPUT);
} else {
print_line("OpenGL debugging not supported!");
@@ -233,12 +233,12 @@ void RasterizerGLES2::initialize() {
#ifdef CAN_DEBUG
#ifdef GLES_OVER_GL
if (OS::get_singleton()->is_stdout_verbose() && 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);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_ERROR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_PORTABILITY_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_PERFORMANCE_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
+ glDebugMessageControlARB(_EXT_DEBUG_SOURCE_API_ARB, _EXT_DEBUG_TYPE_OTHER_ARB, _EXT_DEBUG_SEVERITY_HIGH_ARB, 0, nullptr, GL_TRUE);
/* glDebugMessageInsertARB(
GL_DEBUG_SOURCE_API_ARB,
GL_DEBUG_TYPE_OTHER_ARB, 1,
@@ -256,7 +256,7 @@ void RasterizerGLES2::initialize() {
print_line("godot: ENABLING GL DEBUG");
glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
- callback(_gl_debug_print, NULL);
+ callback(_gl_debug_print, nullptr);
glEnable(_EXT_DEBUG_OUTPUT);
}
}
@@ -316,7 +316,7 @@ void RasterizerGLES2::set_current_render_target(RID p_render_target) {
glViewport(0, 0, rt->width, rt->height);
} else {
- storage->frame.current_rt = NULL;
+ storage->frame.current_rt = nullptr;
storage->frame.clear_request = false;
glViewport(0, 0, DisplayServer::get_singleton()->window_get_size().width, DisplayServer::get_singleton()->window_get_size().height);
glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES2::system_fbo);
@@ -324,7 +324,7 @@ void RasterizerGLES2::set_current_render_target(RID p_render_target) {
}
void RasterizerGLES2::restore_render_target(bool p_3d_was_drawn) {
- ERR_FAIL_COND(storage->frame.current_rt == NULL);
+ ERR_FAIL_COND(storage->frame.current_rt == nullptr);
RasterizerStorageGLES2::RenderTarget *rt = storage->frame.current_rt;
glBindFramebuffer(GL_FRAMEBUFFER, rt->fbo);
glViewport(0, 0, rt->width, rt->height);
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 4bb8d5a16d..8d4c6e87fa 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -142,7 +142,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) {
glGenTextures(1, &shadow_atlas->color);
glBindTexture(GL_TEXTURE_2D, shadow_atlas->color);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shadow_atlas->size, shadow_atlas->size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shadow_atlas->size, shadow_atlas->size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
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);
@@ -152,7 +152,7 @@ void RasterizerSceneGLES2::shadow_atlas_set_size(RID p_atlas, int p_size) {
//just depth texture
glGenTextures(1, &shadow_atlas->depth);
glBindTexture(GL_TEXTURE_2D, shadow_atlas->depth);
- glTexImage2D(GL_TEXTURE_2D, 0, storage->config.depth_internalformat, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, storage->config.depth_internalformat, shadow_atlas->size, shadow_atlas->size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -566,7 +566,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
// Mobile hardware (PowerVR specially) prefers this approach,
// the previous approach with manual lod levels kills the game.
for (int i = 0; i < 6; i++) {
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, nullptr);
}
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
@@ -575,7 +575,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
for (int i = 0; i < 6; i++) {
glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
glBindTexture(GL_TEXTURE_2D, rpi->color[i]);
- glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size, size, 0, format, type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, internal_format, size, size, 0, format, type, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, rpi->color[i], 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rpi->depth);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@@ -646,7 +646,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_postprocess_step(RID p_inst
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, storage->resources.mipmap_blur_color);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size, size, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size, size, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, storage->resources.mipmap_blur_color, 0);
glViewport(0, 0, size, size);
glActiveTexture(GL_TEXTURE0);
@@ -956,7 +956,7 @@ void RasterizerSceneGLES2::gi_probe_instance_set_bounds(RID p_probe, const Vecto
void RasterizerSceneGLES2::_add_geometry(RasterizerStorageGLES2::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES2::GeometryOwner *p_owner, int p_material, bool p_depth_pass, bool p_shadow_pass) {
- RasterizerStorageGLES2::Material *material = NULL;
+ RasterizerStorageGLES2::Material *material = nullptr;
RID material_src;
if (p_instance->material_override.is_valid()) {
@@ -971,7 +971,7 @@ void RasterizerSceneGLES2::_add_geometry(RasterizerStorageGLES2::Geometry *p_geo
material = storage->material_owner.getornull(material_src);
if (!material->shader || !material->shader->valid) {
- material = NULL;
+ material = nullptr;
}
}
@@ -1236,7 +1236,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
RasterizerStorageGLES2::Surface *surface = mesh->surfaces[j];
- _add_geometry(surface, instance, NULL, material_index, p_depth_pass, p_shadow_pass);
+ _add_geometry(surface, instance, nullptr, material_index, p_depth_pass, p_shadow_pass);
}
} break;
@@ -1264,7 +1264,7 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
RasterizerStorageGLES2::Immediate *im = storage->immediate_owner.getornull(instance->base);
ERR_CONTINUE(!im);
- _add_geometry(im, instance, NULL, -1, p_depth_pass, p_shadow_pass);
+ _add_geometry(im, instance, nullptr, -1, p_depth_pass, p_shadow_pass);
} break;
@@ -2259,19 +2259,19 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
bool prev_instancing = false;
bool prev_depth_prepass = false;
state.scene_shader.set_conditional(SceneShaderGLES2::SHADELESS, false);
- RasterizerStorageGLES2::Material *prev_material = NULL;
- RasterizerStorageGLES2::Geometry *prev_geometry = NULL;
- RasterizerStorageGLES2::Skeleton *prev_skeleton = NULL;
- RasterizerStorageGLES2::GeometryOwner *prev_owner = NULL;
+ RasterizerStorageGLES2::Material *prev_material = nullptr;
+ RasterizerStorageGLES2::Geometry *prev_geometry = nullptr;
+ RasterizerStorageGLES2::Skeleton *prev_skeleton = nullptr;
+ RasterizerStorageGLES2::GeometryOwner *prev_owner = nullptr;
Transform view_transform_inverse = p_view_transform.inverse();
CameraMatrix projection_inverse = p_projection.inverse();
bool prev_base_pass = false;
- LightInstance *prev_light = NULL;
+ LightInstance *prev_light = nullptr;
bool prev_vertex_lit = false;
- ReflectionProbeInstance *prev_refprobe_1 = NULL;
- ReflectionProbeInstance *prev_refprobe_2 = NULL;
+ ReflectionProbeInstance *prev_refprobe_1 = nullptr;
+ ReflectionProbeInstance *prev_refprobe_2 = nullptr;
int prev_blend_mode = -2; //will always catch the first go
@@ -2299,7 +2299,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
using_fog = true;
}
- RasterizerStorageGLES2::Texture *prev_lightmap = NULL;
+ RasterizerStorageGLES2::Texture *prev_lightmap = nullptr;
float lightmap_energy = 1.0;
bool prev_use_lightmap_capture = false;
@@ -2313,10 +2313,10 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
bool rebind = false;
bool accum_pass = *e->use_accum_ptr;
*e->use_accum_ptr = true; //set to accum for next time this is found
- LightInstance *light = NULL;
- ReflectionProbeInstance *refprobe_1 = NULL;
- ReflectionProbeInstance *refprobe_2 = NULL;
- RasterizerStorageGLES2::Texture *lightmap = NULL;
+ LightInstance *light = nullptr;
+ ReflectionProbeInstance *refprobe_1 = nullptr;
+ ReflectionProbeInstance *refprobe_2 = nullptr;
+ RasterizerStorageGLES2::Texture *lightmap = nullptr;
bool use_lightmap_capture = false;
bool rebind_light = false;
bool rebind_reflection = false;
@@ -2432,13 +2432,13 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
}
if (refprobe_1 != prev_refprobe_1 || refprobe_2 != prev_refprobe_2) {
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_REFLECTION_PROBE1, refprobe_1 != NULL);
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_REFLECTION_PROBE2, refprobe_2 != NULL);
- if (refprobe_1 != NULL && refprobe_1 != prev_refprobe_1) {
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_REFLECTION_PROBE1, refprobe_1 != nullptr);
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_REFLECTION_PROBE2, refprobe_2 != nullptr);
+ if (refprobe_1 != nullptr && refprobe_1 != prev_refprobe_1) {
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 5);
glBindTexture(GL_TEXTURE_CUBE_MAP, refprobe_1->cubemap);
}
- if (refprobe_2 != NULL && refprobe_2 != prev_refprobe_2) {
+ if (refprobe_2 != nullptr && refprobe_2 != prev_refprobe_2) {
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 6);
glBindTexture(GL_TEXTURE_CUBE_MAP, refprobe_2->cubemap);
}
@@ -2467,8 +2467,8 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
}
if (lightmap != prev_lightmap) {
- state.scene_shader.set_conditional(SceneShaderGLES2::USE_LIGHTMAP, lightmap != NULL);
- if (lightmap != NULL) {
+ state.scene_shader.set_conditional(SceneShaderGLES2::USE_LIGHTMAP, lightmap != nullptr);
+ if (lightmap != nullptr) {
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 4);
glBindTexture(GL_TEXTURE_2D, lightmap->tex_id);
}
@@ -2641,7 +2641,7 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
prev_use_lightmap_capture = use_lightmap_capture;
}
- _setup_light_type(NULL, NULL); //clear light stuff
+ _setup_light_type(nullptr, nullptr); //clear light stuff
state.scene_shader.set_conditional(SceneShaderGLES2::USE_SKELETON, false);
state.scene_shader.set_conditional(SceneShaderGLES2::SHADELESS, false);
state.scene_shader.set_conditional(SceneShaderGLES2::BASE_PASS, false);
@@ -2901,7 +2901,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
if (!storage->frame.current_rt->used_dof_blur_near) {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->color);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
}
int vp_h = storage->frame.current_rt->height;
@@ -3216,7 +3216,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
storage->info.render.object_count += p_cull_count;
GLuint current_fb = 0;
- Environment *env = NULL;
+ Environment *env = nullptr;
int viewport_width, viewport_height;
int viewport_x = 0;
@@ -3300,7 +3300,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
}
} else {
- render_light_instances = NULL;
+ render_light_instances = nullptr;
render_directional_lights = 0;
render_light_instance_count = 0;
}
@@ -3318,7 +3318,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
}
} else {
- reflection_probe_instances = NULL;
+ reflection_probe_instances = nullptr;
reflection_probe_count = 0;
}
@@ -3391,7 +3391,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// render sky
- RasterizerStorageGLES2::Sky *sky = NULL;
+ RasterizerStorageGLES2::Sky *sky = nullptr;
GLuint env_radiance_tex = 0;
if (env) {
switch (env->bg_mode) {
@@ -3806,7 +3806,7 @@ void RasterizerSceneGLES2::render_shadow(RID p_light, RID p_shadow_atlas, int p_
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH, true);
- _render_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, RID(), NULL, 0, bias, normal_bias, flip_facing, false, true);
+ _render_render_list(render_list.elements, render_list.element_count, light_transform, light_projection, RID(), nullptr, 0, bias, normal_bias, flip_facing, false, true);
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH, false);
state.scene_shader.set_conditional(SceneShaderGLES2::RENDER_DEPTH_DUAL_PARABOLOID, false);
@@ -3977,7 +3977,7 @@ void RasterizerSceneGLES2::initialize() {
{
glGenBuffers(1, &state.sky_verts);
glBindBuffer(GL_ARRAY_BUFFER, state.sky_verts);
- glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * 8, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * 8, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
@@ -3987,7 +3987,7 @@ void RasterizerSceneGLES2::initialize() {
glGenBuffers(1, &state.immediate_buffer);
glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer);
- glBufferData(GL_ARRAY_BUFFER, immediate_buffer_size * 1024, NULL, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, immediate_buffer_size * 1024, nullptr, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
@@ -4010,7 +4010,7 @@ void RasterizerSceneGLES2::initialize() {
for (int i = 0; i < 6; i++) {
- glTexImage2D(_cube_side_enum[i], 0, storage->config.depth_internalformat, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, NULL);
+ glTexImage2D(_cube_side_enum[i], 0, storage->config.depth_internalformat, cube_size, cube_size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, nullptr);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -4050,7 +4050,7 @@ void RasterizerSceneGLES2::initialize() {
glGenTextures(1, &directional_shadow.color);
glBindTexture(GL_TEXTURE_2D, directional_shadow.color);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, directional_shadow.size, directional_shadow.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, directional_shadow.size, directional_shadow.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
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);
@@ -4061,7 +4061,7 @@ void RasterizerSceneGLES2::initialize() {
glGenTextures(1, &directional_shadow.depth);
glBindTexture(GL_TEXTURE_2D, directional_shadow.depth);
- glTexImage2D(GL_TEXTURE_2D, 0, storage->config.depth_internalformat, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, storage->config.depth_internalformat, directional_shadow.size, directional_shadow.size, 0, GL_DEPTH_COMPONENT, storage->config.depth_type, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h
index 6d0a5a45ca..56c0e632c2 100644
--- a/drivers/gles2/rasterizer_scene_gles2.h
+++ b/drivers/gles2/rasterizer_scene_gles2.h
@@ -575,7 +575,7 @@ public:
_FORCE_INLINE_ Element *add_element() {
if (element_count + alpha_element_count >= max_elements)
- return NULL;
+ return nullptr;
elements[element_count] = &base_elements[element_count];
return elements[element_count++];
@@ -583,7 +583,7 @@ public:
_FORCE_INLINE_ Element *add_alpha_element() {
if (element_count + alpha_element_count >= max_elements) {
- return NULL;
+ return nullptr;
}
int idx = max_elements - alpha_element_count - 1;
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 4337d2a833..409722ff82 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -653,7 +653,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
height = MAX(1, height);
depth = MAX(1, depth);
- glTexImage3D(texture->target, mipmaps, internal_format, width, height, depth, 0, format, type, NULL);
+ glTexImage3D(texture->target, mipmaps, internal_format, width, height, depth, 0, format, type, nullptr);
width /= 2;
height /= 2;
@@ -676,7 +676,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_
#endif
if (p_flags & RS::TEXTURE_FLAG_USED_FOR_STREAMING) {
//prealloc if video
- glTexImage2D(texture->target, 0, internal_format, texture->alloc_width, texture->alloc_height, 0, format, type, NULL);
+ glTexImage2D(texture->target, 0, internal_format, texture->alloc_width, texture->alloc_height, 0, format, type, nullptr);
}
texture->active = true;
@@ -946,7 +946,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer)
glBindFramebuffer(GL_FRAMEBUFFER, temp_framebuffer);
glBindTexture(GL_TEXTURE_2D, temp_color_texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->alloc_width, texture->alloc_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -1180,7 +1180,7 @@ void RasterizerStorageGLES2::texture_set_proxy(RID p_texture, RID p_proxy) {
if (texture->proxy) {
texture->proxy->proxy_owners.erase(texture);
- texture->proxy = NULL;
+ texture->proxy = nullptr;
}
if (p_proxy.is_valid()) {
@@ -1301,7 +1301,7 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
// Mobile hardware (PowerVR specially) prefers this approach,
// the previous approach with manual lod levels kills the game.
for (int i = 0; i < 6; i++) {
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, size, size, 0, format, type, nullptr);
}
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
@@ -1330,7 +1330,7 @@ void RasterizerStorageGLES2::sky_set_texture(RID p_sky, RID p_panorama, int p_ra
//make framebuffer size the texture size, need to use a separate texture for compatibility
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, resources.mipmap_blur_color);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size, size, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size, size, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, resources.mipmap_blur_color, 0);
if (lod == 1) {
@@ -1477,7 +1477,7 @@ void RasterizerStorageGLES2::_update_shader(Shader *p_shader) const {
}
ShaderCompilerGLES2::GeneratedCode gen_code;
- ShaderCompilerGLES2::IdentifierActions *actions = NULL;
+ ShaderCompilerGLES2::IdentifierActions *actions = nullptr;
switch (p_shader->mode) {
@@ -2815,7 +2815,7 @@ AABB RasterizerStorageGLES2::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
if (mesh->custom_aabb != AABB())
return mesh->custom_aabb;
- Skeleton *sk = NULL;
+ Skeleton *sk = nullptr;
if (p_skeleton.is_valid()) {
sk = skeleton_owner.getornull(p_skeleton);
}
@@ -3626,9 +3626,9 @@ void RasterizerStorageGLES2::skeleton_allocate(RID p_skeleton, int p_bones, bool
glBindTexture(GL_TEXTURE_2D, skeleton->tex_id);
#ifdef GLES_OVER_GL
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, p_bones * (skeleton->use_2d ? 2 : 3), 1, 0, GL_RGBA, GL_FLOAT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, p_bones * (skeleton->use_2d ? 2 : 3), 1, 0, GL_RGBA, GL_FLOAT, nullptr);
#else
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, p_bones * (skeleton->use_2d ? 2 : 3), 1, 0, GL_RGBA, GL_FLOAT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, p_bones * (skeleton->use_2d ? 2 : 3), 1, 0, GL_RGBA, GL_FLOAT, nullptr);
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@@ -4465,7 +4465,7 @@ float RasterizerStorageGLES2::lightmap_capture_get_energy(RID p_capture) const {
const Vector<RasterizerStorage::LightmapCaptureOctree> *RasterizerStorageGLES2::lightmap_capture_get_octree_ptr(RID p_capture) const {
const LightmapCapture *capture = lightmap_capture_data_owner.getornull(p_capture);
- ERR_FAIL_COND_V(!capture, NULL);
+ ERR_FAIL_COND_V(!capture, nullptr);
return &capture->octree;
}
@@ -4579,7 +4579,7 @@ void RasterizerStorageGLES2::instance_remove_skeleton(RID p_skeleton, Rasterizer
void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
- Instantiable *inst = NULL;
+ Instantiable *inst = nullptr;
switch (p_instance->base_type) {
case RS::INSTANCE_MESH: {
inst = mesh_owner.getornull(p_base);
@@ -4623,7 +4623,7 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {
- Instantiable *inst = NULL;
+ Instantiable *inst = nullptr;
switch (p_instance->base_type) {
case RS::INSTANCE_MESH: {
@@ -4721,7 +4721,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenTextures(1, &rt->color);
glBindTexture(GL_TEXTURE_2D, rt->color);
- glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, nullptr);
if (texture->flags & RS::TEXTURE_FLAG_FILTER) {
@@ -4744,7 +4744,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenTextures(1, &rt->depth);
glBindTexture(GL_TEXTURE_2D, rt->depth);
- glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, rt->width, rt->height, 0, GL_DEPTH_COMPONENT, config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, rt->width, rt->height, 0, GL_DEPTH_COMPONENT, config.depth_type, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -4841,7 +4841,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenTextures(1, &rt->multisample_color);
glBindTexture(GL_TEXTURE_2D, rt->multisample_color);
- glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, rt->width, rt->height, 0, color_format, color_type, nullptr);
// multisample buffer is same size as front buffer, so just use nearest
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -4894,9 +4894,9 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glBindTexture(GL_TEXTURE_2D, rt->copy_screen_effect.color);
if (rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rt->width, rt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
} else {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, rt->width, rt->height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, rt->width, rt->height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -4961,7 +4961,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glBindTexture(GL_TEXTURE_2D, rt->mip_maps[i].color);
for (int l = 0; l < level + 1; l++) {
- glTexImage2D(GL_TEXTURE_2D, l, color_internal_format, width, height, 0, color_format, color_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, l, color_internal_format, width, height, 0, color_format, color_type, nullptr);
width = MAX(1, (width / 2));
height = MAX(1, (height / 2));
}
@@ -4975,7 +4975,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
for (int l = 0; l < level + 1; l++) {
glGenTextures(1, &rt->mip_maps[i].sizes.write[l].color);
glBindTexture(GL_TEXTURE_2D, rt->mip_maps[i].sizes[l].color);
- glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, width, height, 0, color_format, color_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, color_internal_format, width, height, 0, color_format, color_type, nullptr);
width = MAX(1, (width / 2));
height = MAX(1, (height / 2));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -5412,12 +5412,12 @@ RID RasterizerStorageGLES2::canvas_light_shadow_buffer_create(int p_width) {
glGenTextures(1, &cls->distance);
glBindTexture(GL_TEXTURE_2D, cls->distance);
if (config.use_rgba_2d_shadows) {
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
} else {
#ifdef GLES_OVER_GL
- glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, nullptr);
#else
- glTexImage2D(GL_TEXTURE_2D, 0, GL_FLOAT, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_FLOAT, cls->size, cls->height, 0, _RED_OES, GL_FLOAT, nullptr);
#endif
}
@@ -5611,7 +5611,7 @@ bool RasterizerStorageGLES2::free(RID p_rid) {
while (shader->materials.first()) {
Material *m = shader->materials.first()->self();
- m->shader = NULL;
+ m->shader = nullptr;
_material_make_dirty(m);
shader->materials.remove(shader->materials.first());
@@ -5942,7 +5942,7 @@ void RasterizerStorageGLES2::initialize() {
#ifdef IPHONE_ENABLED
// appears that IPhone doesn't need to dlopen TODO: test this rigorously before removing
- //void *gles2_lib = dlopen(NULL, RTLD_LAZY);
+ //void *gles2_lib = dlopen(nullptr, RTLD_LAZY);
//glRenderbufferStorageMultisampleAPPLE = dlsym(gles2_lib, "glRenderbufferStorageMultisampleAPPLE");
//glResolveMultisampleFramebufferAPPLE = dlsym(gles2_lib, "glResolveMultisampleFramebufferAPPLE");
#elif ANDROID_ENABLED
@@ -6014,7 +6014,7 @@ void RasterizerStorageGLES2::initialize() {
GLuint depth;
glGenTextures(1, &depth);
glBindTexture(GL_TEXTURE_2D, depth);
- glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, config.depth_type, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -6046,7 +6046,7 @@ void RasterizerStorageGLES2::initialize() {
glGenTextures(1, &depth);
glBindTexture(GL_TEXTURE_2D, depth);
- glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -6074,7 +6074,7 @@ void RasterizerStorageGLES2::initialize() {
frame.count = 0;
frame.delta = 0;
- frame.current_rt = NULL;
+ frame.current_rt = nullptr;
frame.clear_request = false;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &config.max_vertex_texture_image_units);
@@ -6190,7 +6190,7 @@ void RasterizerStorageGLES2::initialize() {
glGenTextures(1, &resources.white_tex_array);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D_ARRAY, resources.white_tex_array);
- glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 8, 8, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, 8, 8, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 8, 8, 1, GL_RGB, GL_UNSIGNED_BYTE, whitetexdata);
glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
glBindTexture(GL_TEXTURE_2D, 0);
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index f8b8b824bd..29651936fb 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -289,7 +289,7 @@ public:
void *detect_normal_ud;
Texture() :
- proxy(NULL),
+ proxy(nullptr),
flags(0),
width(0),
height(0),
@@ -307,14 +307,14 @@ public:
active(false),
tex_id(0),
stored_cube_sides(0),
- render_target(NULL),
+ render_target(nullptr),
redraw_if_visible(false),
- detect_3d(NULL),
- detect_3d_ud(NULL),
- detect_srgb(NULL),
- detect_srgb_ud(NULL),
- detect_normal(NULL),
- detect_normal_ud(NULL) {
+ detect_3d(nullptr),
+ detect_3d_ud(nullptr),
+ detect_srgb(nullptr),
+ detect_srgb_ud(nullptr),
+ detect_normal(nullptr),
+ detect_normal_ud(nullptr) {
}
_ALWAYS_INLINE_ Texture *get_ptr() {
@@ -331,7 +331,7 @@ public:
}
for (Set<Texture *>::Element *E = proxy_owners.front(); E; E = E->next()) {
- E->get()->proxy = NULL;
+ E->get()->proxy = nullptr;
}
if (proxy) {
@@ -508,7 +508,7 @@ public:
Shader() :
dirty_list(this) {
- shader = NULL;
+ shader = nullptr;
valid = false;
custom_code_id = 0;
version = 1;
@@ -561,7 +561,7 @@ public:
dirty_list(this) {
can_cast_shadow_cache = false;
is_animated_cache = false;
- shader = NULL;
+ shader = nullptr;
line_width = 1.0;
last_pass = 0;
render_priority = 0;
@@ -655,7 +655,7 @@ public:
int total_data_size;
Surface() :
- mesh(NULL),
+ mesh(nullptr),
array_len(0),
index_array_len(0),
array_byte_size(0),
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index d626263431..699d6e1484 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -226,7 +226,7 @@ void ShaderCompilerGLES2::_dump_function_deps(SL::ShaderNode *p_node, const Stri
_dump_function_deps(p_node, E->get(), p_func_code, r_to_add, r_added);
- SL::FunctionNode *fnode = NULL;
+ SL::FunctionNode *fnode = nullptr;
for (int i = 0; i < p_node->functions.size(); i++) {
if (p_node->functions[i].name == E->get()) {
@@ -639,12 +639,12 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
code += _mkid(arr_node->name);
}
- if (arr_node->call_expression != NULL) {
+ if (arr_node->call_expression != nullptr) {
code += ".";
code += _dump_node_code(arr_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
}
- if (arr_node->index_expression != NULL) {
+ if (arr_node->index_expression != nullptr) {
code += "[";
code += _dump_node_code(arr_node->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
@@ -923,7 +923,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener
code += _dump_node_code(member_node->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += ".";
code += member_node->name;
- if (member_node->index_expression != NULL) {
+ if (member_node->index_expression != nullptr) {
code += "[";
code += _dump_node_code(member_node->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
@@ -945,7 +945,7 @@ Error ShaderCompilerGLES2::compile(RS::ShaderMode p_mode, const String &p_code,
print_line(itos(i + 1) + " " + 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);
+ _err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
return err;
}
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index f03f1ffa4f..2c335c6c5a 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -55,7 +55,7 @@
#endif
-ShaderGLES2 *ShaderGLES2::active = NULL;
+ShaderGLES2 *ShaderGLES2::active = nullptr;
//#define DEBUG_SHADER
@@ -103,10 +103,10 @@ bool ShaderGLES2::bind() {
}
void ShaderGLES2::unbind() {
- version = NULL;
+ version = nullptr;
glUseProgram(0);
uniforms_dirty = true;
- active = NULL;
+ active = nullptr;
}
static void _display_error_with_code(const String &p_error, const Vector<const char *> &p_code) {
@@ -196,19 +196,19 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
CharString code_string2;
CharString code_globals;
- CustomCode *cc = NULL;
+ CustomCode *cc = nullptr;
if (conditional_version.code_version > 0) {
cc = custom_code_map.getptr(conditional_version.code_version);
- ERR_FAIL_COND_V(!cc, NULL);
+ ERR_FAIL_COND_V(!cc, nullptr);
v.code_version = cc->version;
}
// program
v.id = glCreateProgram();
- ERR_FAIL_COND_V(v.id == 0, NULL);
+ ERR_FAIL_COND_V(v.id == 0, nullptr);
if (cc) {
for (int i = 0; i < cc->custom_defines.size(); i++) {
@@ -244,7 +244,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
#endif
v.vert_id = glCreateShader(GL_VERTEX_SHADER);
- glShaderSource(v.vert_id, strings.size(), &strings[0], NULL);
+ glShaderSource(v.vert_id, strings.size(), &strings[0], nullptr);
glCompileShader(v.vert_id);
GLint status;
@@ -281,7 +281,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
v.id = 0;
}
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
strings.resize(string_base_size);
@@ -320,7 +320,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
#endif
v.frag_id = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(v.frag_id, strings.size(), &strings[0], NULL);
+ glShaderSource(v.frag_id, strings.size(), &strings[0], nullptr);
glCompileShader(v.frag_id);
glGetShaderiv(v.frag_id, GL_COMPILE_STATUS, &status);
@@ -357,7 +357,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
v.id = 0;
}
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
glAttachShader(v.id, v.frag_id);
@@ -384,7 +384,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
v.id = 0;
ERR_PRINT("No OpenGL program link log. What the frick?");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (iloglen == 0) {
@@ -407,7 +407,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
glDeleteProgram(v.id);
v.id = 0;
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// get uniform locations
@@ -553,7 +553,7 @@ void ShaderGLES2::setup(
}
void ShaderGLES2::finish() {
- const VersionKey *V = NULL;
+ const VersionKey *V = nullptr;
while ((V = version_map.next(V))) {
Version &v = version_map[*V];
@@ -565,7 +565,7 @@ void ShaderGLES2::finish() {
}
void ShaderGLES2::clear_caches() {
- const VersionKey *V = NULL;
+ const VersionKey *V = nullptr;
while ((V = version_map.next(V))) {
Version &v = version_map[*V];
@@ -578,7 +578,7 @@ void ShaderGLES2::clear_caches() {
version_map.clear();
custom_code_map.clear();
- version = NULL;
+ version = nullptr;
last_custom_code = 1;
uniforms_dirty = true;
}
@@ -1093,7 +1093,7 @@ void ShaderGLES2::use_material(void *p_material) {
}
ShaderGLES2::ShaderGLES2() {
- version = NULL;
+ version = nullptr;
last_custom_code = 1;
uniforms_dirty = true;
}
diff --git a/drivers/gles2/shader_gles2.h b/drivers/gles2/shader_gles2.h
index 54858becb6..d20d5bc585 100644
--- a/drivers/gles2/shader_gles2.h
+++ b/drivers/gles2/shader_gles2.h
@@ -121,7 +121,7 @@ private:
id = 0;
vert_id = 0;
frag_id = 0;
- uniform_location = NULL;
+ uniform_location = nullptr;
code_version = 0;
ok = false;
}
diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub
index d7ae0243e6..bcd6ea79fb 100644
--- a/drivers/gles2/shaders/SCsub
+++ b/drivers/gles2/shaders/SCsub
@@ -1,23 +1,23 @@
#!/usr/bin/env python
-Import('env')
+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');
- env.GLES2_GLSL('lens_distorted.glsl');
+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');
+ env.GLES2_GLSL("lens_distorted.glsl")
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index 87b54cecaf..db08be0c47 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -1,11 +1,11 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_png = env.Clone()
# Thirdparty source files
-if env['builtin_libpng']:
+if env["builtin_libpng"]:
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
"png.c",
@@ -32,6 +32,7 @@ if env['builtin_libpng']:
# Currently .ASM filter_neon.S does not compile on NT.
import os
+
use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt"
if use_neon:
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
@@ -45,7 +46,7 @@ if env['builtin_libpng']:
if use_neon:
env_neon = env_thirdparty.Clone()
if "S_compiler" in env:
- env_neon['CC'] = env['S_compiler']
+ env_neon["CC"] = env["S_compiler"]
neon_sources = []
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
@@ -56,4 +57,4 @@ if env['builtin_libpng']:
# Godot source files
env_png.add_source_files(env.drivers_sources, "*.cpp")
-Export('env')
+Export("env")
diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp
index efd488fd5c..f17abcb54c 100644
--- a/drivers/png/png_driver_common.cpp
+++ b/drivers/png/png_driver_common.cpp
@@ -110,7 +110,7 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) {
uint8_t *writer = buffer.ptrw();
// read image data to buffer and release libpng resources
- success = png_image_finish_read(&png_img, NULL, writer, stride, NULL);
+ success = png_image_finish_read(&png_img, nullptr, writer, stride, nullptr);
ERR_FAIL_COND_V_MSG(check_error(png_img), ERR_FILE_CORRUPT, png_img.message);
ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT);
@@ -175,7 +175,7 @@ Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer) {
uint8_t *writer = p_buffer.ptrw();
success = png_image_write_to_memory(&png_img, &writer[buffer_offset],
- &compressed_size, 0, reader, 0, NULL);
+ &compressed_size, 0, reader, 0, nullptr);
ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message);
}
if (!success) {
@@ -189,7 +189,7 @@ Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer) {
uint8_t *writer = p_buffer.ptrw();
success = png_image_write_to_memory(&png_img, &writer[buffer_offset],
- &compressed_size, 0, reader, 0, NULL);
+ &compressed_size, 0, reader, 0, nullptr);
ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message);
ERR_FAIL_COND_V(!success, FAILED);
}
diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/pulseaudio/SCsub
+++ b/drivers/pulseaudio/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index ee9278fb8f..8a47f6cf96 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -98,7 +98,7 @@ void AudioDriverPulseAudio::detect_channels(bool capture) {
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);
+ int ret = pa_mainloop_iterate(pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -128,7 +128,7 @@ void AudioDriverPulseAudio::detect_channels(bool capture) {
if (pa_op) {
while (pa_status == 0) {
- int ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ int ret = pa_mainloop_iterate(pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -203,7 +203,7 @@ Error AudioDriverPulseAudio::init_device() {
pa_map.map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT;
pa_str = pa_stream_new(pa_ctx, "Sound", &spec, &pa_map);
- if (pa_str == NULL) {
+ if (pa_str == nullptr) {
ERR_PRINT("PulseAudio: pa_stream_new error: " + String(pa_strerror(pa_context_errno(pa_ctx))));
ERR_FAIL_V(ERR_CANT_OPEN);
}
@@ -220,9 +220,9 @@ Error AudioDriverPulseAudio::init_device() {
attr.maxlength = (uint32_t)-1;
attr.minreq = (uint32_t)-1;
- const char *dev = device_name == "Default" ? NULL : device_name.utf8().get_data();
+ const char *dev = device_name == "Default" ? nullptr : 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);
+ int error_code = pa_stream_connect_playback(pa_str, dev, &attr, flags, nullptr, nullptr);
ERR_FAIL_COND_V(error_code < 0, ERR_CANT_OPEN);
samples_in.resize(buffer_frames * channels);
@@ -244,31 +244,31 @@ Error AudioDriverPulseAudio::init() {
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
pa_ml = pa_mainloop_new();
- ERR_FAIL_COND_V(pa_ml == NULL, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V(pa_ml == nullptr, 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);
+ ERR_FAIL_COND_V(pa_ctx == nullptr, 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);
+ int ret = pa_context_connect(pa_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
if (ret < 0) {
if (pa_ctx) {
pa_context_unref(pa_ctx);
- pa_ctx = NULL;
+ pa_ctx = nullptr;
}
if (pa_ml) {
pa_mainloop_free(pa_ml);
- pa_ml = NULL;
+ pa_ml = nullptr;
}
return ERR_CANT_OPEN;
}
while (pa_ready == 0) {
- ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ ret = pa_mainloop_iterate(pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -278,12 +278,12 @@ Error AudioDriverPulseAudio::init() {
if (pa_ctx) {
pa_context_disconnect(pa_ctx);
pa_context_unref(pa_ctx);
- pa_ctx = NULL;
+ pa_ctx = nullptr;
}
if (pa_ml) {
pa_mainloop_free(pa_ml);
- pa_ml = NULL;
+ pa_ml = nullptr;
}
return ERR_CANT_OPEN;
@@ -377,7 +377,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
int ret;
do {
- ret = pa_mainloop_iterate(ad->pa_ml, 0, NULL);
+ ret = pa_mainloop_iterate(ad->pa_ml, 0, nullptr);
} while (ret > 0);
if (avail_bytes > 0 && pa_stream_get_state(ad->pa_str) == PA_STREAM_READY) {
@@ -385,7 +385,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
if (bytes > 0) {
size_t bytes_to_write = MIN(bytes, avail_bytes);
const void *ptr = ad->samples_out.ptr();
- ret = pa_stream_write(ad->pa_str, (char *)ptr + write_ofs, bytes_to_write, NULL, 0LL, PA_SEEK_RELATIVE);
+ ret = pa_stream_write(ad->pa_str, (char *)ptr + write_ofs, bytes_to_write, nullptr, 0LL, PA_SEEK_RELATIVE);
if (ret != 0) {
ERR_PRINT("PulseAudio: pa_stream_write error: " + String(pa_strerror(ret)));
} else {
@@ -432,7 +432,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
pa_operation *pa_op = pa_context_get_server_info(ad->pa_ctx, &AudioDriverPulseAudio::pa_server_info_cb, (void *)ad);
if (pa_op) {
while (ad->pa_status == 0) {
- ret = pa_mainloop_iterate(ad->pa_ml, 1, NULL);
+ ret = pa_mainloop_iterate(ad->pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -463,7 +463,7 @@ void AudioDriverPulseAudio::thread_func(void *p_udata) {
if (ad->pa_rec_str && pa_stream_get_state(ad->pa_rec_str) == PA_STREAM_READY) {
size_t bytes = pa_stream_readable_size(ad->pa_rec_str);
if (bytes > 0) {
- const void *ptr = NULL;
+ const void *ptr = nullptr;
size_t maxbytes = ad->input_buffer.size() * sizeof(int16_t);
bytes = MIN(bytes, maxbytes);
@@ -555,7 +555,7 @@ Array AudioDriverPulseAudio::get_device_list() {
pa_devices.clear();
pa_devices.push_back("Default");
- if (pa_ctx == NULL) {
+ if (pa_ctx == nullptr) {
return pa_devices;
}
@@ -566,7 +566,7 @@ Array AudioDriverPulseAudio::get_device_list() {
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);
+ int ret = pa_mainloop_iterate(pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -613,7 +613,7 @@ void AudioDriverPulseAudio::finish_device() {
if (pa_str) {
pa_stream_disconnect(pa_str);
pa_stream_unref(pa_str);
- pa_str = NULL;
+ pa_str = nullptr;
}
}
@@ -630,17 +630,17 @@ void AudioDriverPulseAudio::finish() {
if (pa_ctx) {
pa_context_disconnect(pa_ctx);
pa_context_unref(pa_ctx);
- pa_ctx = NULL;
+ pa_ctx = nullptr;
}
if (pa_ml) {
pa_mainloop_free(pa_ml);
- pa_ml = NULL;
+ pa_ml = nullptr;
}
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
Error AudioDriverPulseAudio::capture_init_device() {
@@ -680,12 +680,12 @@ Error AudioDriverPulseAudio::capture_init_device() {
attr.fragsize = input_buffer_size * sizeof(int16_t);
pa_rec_str = pa_stream_new(pa_ctx, "Record", &spec, &pa_rec_map);
- if (pa_rec_str == NULL) {
+ if (pa_rec_str == nullptr) {
ERR_PRINT("PulseAudio: pa_stream_new error: " + String(pa_strerror(pa_context_errno(pa_ctx))));
ERR_FAIL_V(ERR_CANT_OPEN);
}
- const char *dev = capture_device_name == "Default" ? NULL : capture_device_name.utf8().get_data();
+ const char *dev = capture_device_name == "Default" ? nullptr : capture_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_record(pa_rec_str, dev, &attr, flags);
if (error_code < 0) {
@@ -709,7 +709,7 @@ void AudioDriverPulseAudio::capture_finish_device() {
ERR_PRINT("PulseAudio: pa_stream_disconnect error: " + String(pa_strerror(ret)));
}
pa_stream_unref(pa_rec_str);
- pa_rec_str = NULL;
+ pa_rec_str = nullptr;
}
}
@@ -757,7 +757,7 @@ Array AudioDriverPulseAudio::capture_get_device_list() {
pa_rec_devices.clear();
pa_rec_devices.push_back("Default");
- if (pa_ctx == NULL) {
+ if (pa_ctx == nullptr) {
return pa_rec_devices;
}
@@ -768,7 +768,7 @@ Array AudioDriverPulseAudio::capture_get_device_list() {
pa_operation *pa_op = pa_context_get_source_info_list(pa_ctx, pa_sourcelist_cb, (void *)this);
if (pa_op) {
while (pa_status == 0) {
- int ret = pa_mainloop_iterate(pa_ml, 1, NULL);
+ int ret = pa_mainloop_iterate(pa_ml, 1, nullptr);
if (ret < 0) {
ERR_PRINT("pa_mainloop_iterate error");
}
@@ -794,11 +794,11 @@ String AudioDriverPulseAudio::capture_get_device() {
}
AudioDriverPulseAudio::AudioDriverPulseAudio() :
- thread(NULL),
- pa_ml(NULL),
- pa_ctx(NULL),
- pa_str(NULL),
- pa_rec_str(NULL),
+ thread(nullptr),
+ pa_ml(nullptr),
+ pa_ctx(nullptr),
+ pa_str(nullptr),
+ pa_rec_str(nullptr),
device_name("Default"),
new_device("Default"),
default_device(""),
diff --git a/drivers/spirv-reflect/SCsub b/drivers/spirv-reflect/SCsub
index 8ff27da114..d0ffaf068d 100644
--- a/drivers/spirv-reflect/SCsub
+++ b/drivers/spirv-reflect/SCsub
@@ -1,17 +1,17 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_spirv_reflect = env.Clone()
env_spirv_reflect.disable_warnings()
thirdparty_dir = "#thirdparty/spirv-reflect/"
thirdparty_sources = [
- "spirv_reflect.c"
+ "spirv_reflect.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_spirv_reflect.add_source_files(env.drivers_sources, thirdparty_sources)
-Export('env')
+Export("env")
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub
index 4888f56099..91ef613546 100644
--- a/drivers/unix/SCsub
+++ b/drivers/unix/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ]
+env["check_c_headers"] = [["mntent.h", "HAVE_MNTENT"]]
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 715bc56003..00103684c7 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -129,7 +129,7 @@ String DirAccessUnix::get_next() {
dirent *entry = readdir(dir_stream);
- if (entry == NULL) {
+ if (entry == nullptr) {
list_dir_end();
return "";
}
@@ -173,7 +173,7 @@ void DirAccessUnix::list_dir_end() {
if (dir_stream)
closedir(dir_stream);
- dir_stream = 0;
+ dir_stream = nullptr;
_cisdir = false;
}
@@ -207,7 +207,7 @@ static void _get_drives(List<String> *list) {
char strings[4096];
while (getmntent_r(mtab, &mnt, strings, sizeof(strings))) {
- if (mnt.mnt_dir != NULL && _filter_drive(&mnt)) {
+ if (mnt.mnt_dir != nullptr && _filter_drive(&mnt)) {
// Avoid duplicates
if (!list->find(mnt.mnt_dir)) {
list->push_back(mnt.mnt_dir);
@@ -306,7 +306,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
// prev_dir is the directory we are changing out of
String prev_dir;
char real_current_dir_name[2048];
- ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == NULL, ERR_BUG);
+ ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG);
if (prev_dir.parse_utf8(real_current_dir_name))
prev_dir = real_current_dir_name; //no utf8, maybe latin?
@@ -327,7 +327,7 @@ Error DirAccessUnix::change_dir(String p_dir) {
String base = _get_root_path();
if (base != String() && !try_dir.begins_with(base)) {
- ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == NULL, ERR_BUG);
+ ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == nullptr, ERR_BUG);
String new_dir;
new_dir.parse_utf8(real_current_dir_name);
@@ -410,14 +410,14 @@ String DirAccessUnix::get_filesystem_type() const {
DirAccessUnix::DirAccessUnix() {
- dir_stream = 0;
+ dir_stream = nullptr;
_cisdir = false;
/* determine drive count */
// set current directory to an absolute path of the current directory
char real_current_dir_name[2048];
- ERR_FAIL_COND(getcwd(real_current_dir_name, 2048) == NULL);
+ ERR_FAIL_COND(getcwd(real_current_dir_name, 2048) == nullptr);
if (current_dir.parse_utf8(real_current_dir_name))
current_dir = real_current_dir_name;
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 91164dc3f9..4aa408a1f0 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -76,7 +76,7 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
if (f)
fclose(f);
- f = NULL;
+ f = nullptr;
path_src = p_path;
path = fix_path(p_path);
@@ -119,7 +119,7 @@ Error FileAccessUnix::_open(const String &p_path, int p_mode_flags) {
f = fopen(path.utf8().get_data(), mode_string);
- if (f == NULL) {
+ if (f == nullptr) {
switch (errno) {
case ENOENT: {
last_error = ERR_FILE_NOT_FOUND;
@@ -155,7 +155,7 @@ void FileAccessUnix::close() {
return;
fclose(f);
- f = NULL;
+ f = nullptr;
if (close_notification_func) {
close_notification_func(path, flags);
@@ -175,7 +175,7 @@ void FileAccessUnix::close() {
bool FileAccessUnix::is_open() const {
- return (f != NULL);
+ return (f != nullptr);
}
String FileAccessUnix::get_path() const {
@@ -352,10 +352,10 @@ FileAccess *FileAccessUnix::create_libc() {
return memnew(FileAccessUnix);
}
-CloseNotificationFunc FileAccessUnix::close_notification_func = NULL;
+CloseNotificationFunc FileAccessUnix::close_notification_func = nullptr;
FileAccessUnix::FileAccessUnix() :
- f(NULL),
+ f(nullptr),
flags(0),
last_error(OK) {
}
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 08c099f771..5e3dedfc2f 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -107,13 +107,13 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
};
hints.ai_flags &= ~AI_NUMERICHOST;
- int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);
+ int s = getaddrinfo(p_hostname.utf8().get_data(), nullptr, &hints, &result);
if (s != 0) {
ERR_PRINT("getaddrinfo failed! Cannot resolve hostname.");
return IP_Address();
};
- if (result == NULL || result->ai_addr == NULL) {
+ if (result == nullptr || result->ai_addr == nullptr) {
ERR_PRINT("Invalid response from getaddrinfo");
if (result)
freeaddrinfo(result);
@@ -175,7 +175,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
addrs = (IP_ADAPTER_ADDRESSES *)memalloc(buf_size);
int err = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME,
- NULL, addrs, &buf_size);
+ nullptr, addrs, &buf_size);
if (err == NO_ERROR) {
break;
};
@@ -189,7 +189,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
IP_ADAPTER_ADDRESSES *adapter = addrs;
- while (adapter != NULL) {
+ while (adapter != nullptr) {
Interface_Info info;
info.name = adapter->AdapterName;
@@ -197,7 +197,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
info.index = String::num_uint64(adapter->IfIndex);
IP_ADAPTER_UNICAST_ADDRESS *address = adapter->FirstUnicastAddress;
- while (address != NULL) {
+ while (address != nullptr) {
int family = address->Address.lpSockaddr->sa_family;
if (family != AF_INET && family != AF_INET6)
continue;
@@ -219,13 +219,13 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
- struct ifaddrs *ifAddrStruct = NULL;
- struct ifaddrs *ifa = NULL;
+ struct ifaddrs *ifAddrStruct = nullptr;
+ struct ifaddrs *ifa = nullptr;
int family;
getifaddrs(&ifAddrStruct);
- for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
+ for (ifa = ifAddrStruct; ifa != nullptr; ifa = ifa->ifa_next) {
if (!ifa->ifa_addr)
continue;
@@ -248,7 +248,7 @@ void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) co
info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
}
- if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct);
+ if (ifAddrStruct != nullptr) freeifaddrs(ifAddrStruct);
}
#endif
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 4adeeb1d9b..7c6543c3a2 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -86,7 +86,7 @@
#define SOCK_CLOSE closesocket
// connect is broken on windows under certain conditions, reasons unknown:
// See https://github.com/godotengine/webrtc-native/issues/6
-#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) ::WSAConnect(p_sock, p_addr, p_addr_len, NULL, NULL, NULL, NULL)
+#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) ::WSAConnect(p_sock, p_addr, p_addr_len, nullptr, nullptr, nullptr, nullptr)
// Workaround missing flag in MinGW
#if defined(__MINGW32__) && !defined(SIO_UDP_NETRESET)
@@ -155,7 +155,7 @@ NetSocket *NetSocketPosix::_create_func() {
void NetSocketPosix::make_default() {
#if defined(WINDOWS_ENABLED)
- if (_create == NULL) {
+ if (_create == nullptr) {
WSADATA data;
WSAStartup(MAKEWORD(2, 2), &data);
}
@@ -165,10 +165,10 @@ void NetSocketPosix::make_default() {
void NetSocketPosix::cleanup() {
#if defined(WINDOWS_ENABLED)
- if (_create != NULL) {
+ if (_create != nullptr) {
WSACleanup();
}
- _create = NULL;
+ _create = nullptr;
#endif
}
@@ -446,15 +446,15 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const {
#if defined(WINDOWS_ENABLED)
bool ready = false;
fd_set rd, wr, ex;
- fd_set *rdp = NULL;
- fd_set *wrp = NULL;
+ fd_set *rdp = nullptr;
+ fd_set *wrp = nullptr;
FD_ZERO(&rd);
FD_ZERO(&wr);
FD_ZERO(&ex);
FD_SET(_sock, &ex);
struct timeval timeout = { p_timeout, 0 };
- // For blocking operation, pass NULL timeout pointer to select.
- struct timeval *tp = NULL;
+ // For blocking operation, pass nullptr timeout pointer to select.
+ struct timeval *tp = nullptr;
if (p_timeout >= 0) {
// If timeout is non-negative, we want to specify the timeout instead.
tp = &timeout;
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 76a89b2bb4..53c60951b7 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -109,7 +109,7 @@ void OS_Unix::initialize_debugging() {
struct sigaction action;
memset(&action, 0, sizeof(action));
action.sa_handler = handle_interrupt;
- sigaction(SIGINT, &action, NULL);
+ sigaction(SIGINT, &action, nullptr);
}
}
@@ -172,24 +172,24 @@ String OS_Unix::get_name() const {
uint64_t OS_Unix::get_unix_time() const {
- return time(NULL);
+ return time(nullptr);
};
uint64_t OS_Unix::get_system_time_secs() const {
struct timeval tv_now;
- gettimeofday(&tv_now, NULL);
+ gettimeofday(&tv_now, nullptr);
return uint64_t(tv_now.tv_sec);
}
uint64_t OS_Unix::get_system_time_msecs() const {
struct timeval tv_now;
- gettimeofday(&tv_now, NULL);
+ gettimeofday(&tv_now, nullptr);
return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
}
OS::Date OS_Unix::get_date(bool utc) const {
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt;
if (utc)
lt = gmtime(&t);
@@ -209,7 +209,7 @@ OS::Date OS_Unix::get_date(bool utc) const {
}
OS::Time OS_Unix::get_time(bool utc) const {
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt;
if (utc)
lt = gmtime(&t);
@@ -224,7 +224,7 @@ OS::Time OS_Unix::get_time(bool utc) const {
}
OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm *lt = localtime(&t);
char name[16];
strftime(name, 16, "%Z", lt);
@@ -379,7 +379,7 @@ int OS_Unix::get_process_id() const {
bool OS_Unix::has_environment(const String &p_var) const {
- return getenv(p_var.utf8().get_data()) != NULL;
+ return getenv(p_var.utf8().get_data()) != nullptr;
}
String OS_Unix::get_locale() const {
@@ -433,7 +433,7 @@ Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const S
p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());
error = dlerror();
- if (error != NULL) {
+ if (error != nullptr) {
ERR_FAIL_COND_V_MSG(!p_optional, ERR_CANT_RESOLVE, "Can't resolve symbol " + p_name + ". Error: " + error + ".");
return ERR_CANT_RESOLVE;
@@ -511,7 +511,7 @@ String OS_Unix::get_executable_path() const {
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
char buf[MAXPATHLEN];
size_t len = sizeof(buf);
- if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
+ if (sysctl(mib, 4, buf, &len, nullptr, 0) != 0) {
WARN_PRINT("Couldn't get executable path from sysctl");
return OS::get_executable_path();
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index c381890834..90679ddf1d 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -85,7 +85,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
diff --git a/drivers/unix/rw_lock_posix.cpp b/drivers/unix/rw_lock_posix.cpp
index bb3eebd267..f219a0905c 100644
--- a/drivers/unix/rw_lock_posix.cpp
+++ b/drivers/unix/rw_lock_posix.cpp
@@ -91,7 +91,7 @@ void RWLockPosix::make_default() {
RWLockPosix::RWLockPosix() {
//rwlock=PTHREAD_RWLOCK_INITIALIZER; fails on OSX
- pthread_rwlock_init(&rwlock, NULL);
+ pthread_rwlock_init(&rwlock, nullptr);
}
RWLockPosix::~RWLockPosix() {
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp
index 21f49a7e38..c227aec6d6 100644
--- a/drivers/unix/thread_posix.cpp
+++ b/drivers/unix/thread_posix.cpp
@@ -75,7 +75,7 @@ void *ThreadPosix::thread_callback(void *userdata) {
ScriptServer::thread_exit();
- return NULL;
+ return nullptr;
}
Thread *ThreadPosix::create_func_posix(ThreadCreateCallback p_callback, void *p_user, const Settings &) {
@@ -108,7 +108,7 @@ void ThreadPosix::wait_to_finish_func_posix(Thread *p_thread) {
ERR_FAIL_COND(!tp);
ERR_FAIL_COND(tp->pthread == 0);
- pthread_join(tp->pthread, NULL);
+ pthread_join(tp->pthread, nullptr);
tp->pthread = 0;
}
diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub
index de776b19b2..7ffdac27d5 100644
--- a/drivers/vulkan/SCsub
+++ b/drivers/vulkan/SCsub
@@ -1,10 +1,10 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-if env['builtin_vulkan']:
+if env["builtin_vulkan"]:
# Use bundled Vulkan headers
thirdparty_dir = "#thirdparty/vulkan"
env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include", thirdparty_dir + "/loader"])
@@ -27,48 +27,56 @@ if env['builtin_vulkan']:
]
vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"]
- if env['platform'] == "windows":
+ if env["platform"] == "windows":
loader_sources.append("dirent_on_windows.c")
loader_sources.append("dxgi_loader.c")
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_WIN32_KHR',
- 'VULKAN_NON_CMAKE_BUILD',
- 'WIN32_LEAN_AND_MEAN',
- 'API_NAME=\\"%s\\"' % 'Vulkan'
- ])
- if not env.msvc: # Windows 7+, missing in mingw headers
- env_thirdparty.AppendUnique(CPPDEFINES=[
- "CM_GETIDLIST_FILTER_CLASS=0x00000200",
- "CM_GETIDLIST_FILTER_PRESENT=0x00000100"
- ])
- elif env['platform'] == "osx":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_MACOS_MVK',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
- elif env['platform'] == "iphone":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_IOS_MVK',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
- elif env['platform'] == "linuxbsd":
- env_thirdparty.AppendUnique(CPPDEFINES=[
- 'VK_USE_PLATFORM_XLIB_KHR',
- 'VULKAN_NON_CMAKE_BUILD',
- 'SYSCONFDIR=\\"%s\\"' % '/etc',
- 'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
- 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
- ])
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_WIN32_KHR",
+ "VULKAN_NON_CMAKE_BUILD",
+ "WIN32_LEAN_AND_MEAN",
+ 'API_NAME=\\"%s\\"' % "Vulkan",
+ ]
+ )
+ if not env.msvc: # Windows 7+, missing in mingw headers
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=["CM_GETIDLIST_FILTER_CLASS=0x00000200", "CM_GETIDLIST_FILTER_PRESENT=0x00000100"]
+ )
+ elif env["platform"] == "osx":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_MACOS_MVK",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
+ elif env["platform"] == "iphone":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_IOS_MVK",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
+ elif env["platform"] == "linuxbsd":
+ env_thirdparty.AppendUnique(
+ CPPDEFINES=[
+ "VK_USE_PLATFORM_XLIB_KHR",
+ "VULKAN_NON_CMAKE_BUILD",
+ 'SYSCONFDIR=\\"%s\\"' % "/etc",
+ 'FALLBACK_DATA_DIRS=\\"%s\\"' % "/usr/local/share:/usr/share",
+ 'FALLBACK_CONFIG_DIRS=\\"%s\\"' % "/etc/xdg",
+ ]
+ )
import platform
- if (platform.system() == "Linux"):
+
+ if platform.system() == "Linux":
# In glibc since 2.17 and musl libc since 1.1.24. Used by loader.c.
- env_thirdparty.AppendUnique(CPPDEFINES=['HAVE_SECURE_GETENV'])
+ env_thirdparty.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
loader_sources = [thirdparty_dir + "/loader/" + file for file in loader_sources]
env_thirdparty.add_source_files(env.drivers_sources, loader_sources)
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 8ebf5b0f04..69957d9939 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -1234,13 +1234,13 @@ const VkImageType RenderingDeviceVulkan::vulkan_image_type[RenderingDevice::TEXT
Error RenderingDeviceVulkan::_buffer_allocate(Buffer *p_buffer, uint32_t p_size, uint32_t p_usage, VmaMemoryUsage p_mapping) {
VkBufferCreateInfo bufferInfo;
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- bufferInfo.pNext = NULL;
+ bufferInfo.pNext = nullptr;
bufferInfo.flags = 0;
bufferInfo.size = p_size;
bufferInfo.usage = p_usage;
bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
bufferInfo.queueFamilyIndexCount = 0;
- bufferInfo.pQueueFamilyIndices = 0;
+ bufferInfo.pQueueFamilyIndices = nullptr;
VmaAllocationCreateInfo allocInfo;
allocInfo.flags = 0;
@@ -1248,10 +1248,10 @@ Error RenderingDeviceVulkan::_buffer_allocate(Buffer *p_buffer, uint32_t p_size,
allocInfo.requiredFlags = 0;
allocInfo.preferredFlags = 0;
allocInfo.memoryTypeBits = 0;
- allocInfo.pool = NULL;
- allocInfo.pUserData = NULL;
+ allocInfo.pool = nullptr;
+ allocInfo.pUserData = nullptr;
- VkResult err = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &p_buffer->buffer, &p_buffer->allocation, NULL);
+ VkResult err = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &p_buffer->buffer, &p_buffer->allocation, nullptr);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "Can't create buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
p_buffer->size = p_size;
p_buffer->buffer_info.buffer = p_buffer->buffer;
@@ -1265,8 +1265,8 @@ Error RenderingDeviceVulkan::_buffer_free(Buffer *p_buffer) {
ERR_FAIL_COND_V(p_buffer->size == 0, ERR_INVALID_PARAMETER);
vmaDestroyBuffer(allocator, p_buffer->buffer, p_buffer->allocation);
- p_buffer->buffer = NULL;
- p_buffer->allocation = NULL;
+ p_buffer->buffer = nullptr;
+ p_buffer->allocation = nullptr;
p_buffer->size = 0;
return OK;
@@ -1276,13 +1276,13 @@ Error RenderingDeviceVulkan::_insert_staging_block() {
VkBufferCreateInfo bufferInfo;
bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
- bufferInfo.pNext = NULL;
+ bufferInfo.pNext = nullptr;
bufferInfo.flags = 0;
bufferInfo.size = staging_buffer_block_size;
bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
bufferInfo.queueFamilyIndexCount = 0;
- bufferInfo.pQueueFamilyIndices = 0;
+ bufferInfo.pQueueFamilyIndices = nullptr;
VmaAllocationCreateInfo allocInfo;
allocInfo.flags = 0;
@@ -1290,12 +1290,12 @@ Error RenderingDeviceVulkan::_insert_staging_block() {
allocInfo.requiredFlags = 0;
allocInfo.preferredFlags = 0;
allocInfo.memoryTypeBits = 0;
- allocInfo.pool = NULL;
- allocInfo.pUserData = NULL;
+ allocInfo.pool = nullptr;
+ allocInfo.pUserData = nullptr;
StagingBufferBlock block;
- VkResult err = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &block.buffer, &block.allocation, NULL);
+ VkResult err = vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &block.buffer, &block.allocation, nullptr);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "vmaCreateBuffer failed with error " + itos(err) + ".");
block.frame_used = 0;
@@ -1459,7 +1459,7 @@ Error RenderingDeviceVulkan::_buffer_update(Buffer *p_buffer, size_t p_offset, c
//map staging buffer (It's CPU and coherent)
- void *data_ptr = NULL;
+ void *data_ptr = nullptr;
{
VkResult vkerr = vmaMapMemory(allocator, staging_buffer_blocks[staging_buffer_current].allocation, &data_ptr);
ERR_FAIL_COND_V_MSG(vkerr, ERR_CANT_CREATE, "vmaMapMemory failed with error " + itos(vkerr) + ".");
@@ -1492,11 +1492,11 @@ void RenderingDeviceVulkan::_memory_barrier(VkPipelineStageFlags p_src_stage_mas
VkMemoryBarrier mem_barrier;
mem_barrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
- mem_barrier.pNext = NULL;
+ mem_barrier.pNext = nullptr;
mem_barrier.srcAccessMask = p_src_access;
mem_barrier.dstAccessMask = p_dst_sccess;
- vkCmdPipelineBarrier(p_sync_with_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, p_src_stage_mask, p_dst_stage_mask, 0, 1, &mem_barrier, 0, NULL, 0, NULL);
+ vkCmdPipelineBarrier(p_sync_with_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, p_src_stage_mask, p_dst_stage_mask, 0, 1, &mem_barrier, 0, nullptr, 0, nullptr);
}
void RenderingDeviceVulkan::_full_barrier(bool p_sync_with_draw) {
@@ -1539,7 +1539,7 @@ void RenderingDeviceVulkan::_buffer_memory_barrier(VkBuffer buffer, uint64_t p_f
VkBufferMemoryBarrier buffer_mem_barrier;
buffer_mem_barrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
- buffer_mem_barrier.pNext = NULL;
+ buffer_mem_barrier.pNext = nullptr;
buffer_mem_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
buffer_mem_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
buffer_mem_barrier.srcAccessMask = p_src_access;
@@ -1548,7 +1548,7 @@ void RenderingDeviceVulkan::_buffer_memory_barrier(VkBuffer buffer, uint64_t p_f
buffer_mem_barrier.offset = p_from;
buffer_mem_barrier.size = p_size;
- vkCmdPipelineBarrier(p_sync_with_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, p_src_stage_mask, p_dst_stage_mask, 0, 0, NULL, 1, &buffer_mem_barrier, 0, NULL);
+ vkCmdPipelineBarrier(p_sync_with_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, p_src_stage_mask, p_dst_stage_mask, 0, 0, nullptr, 1, &buffer_mem_barrier, 0, nullptr);
}
/*****************/
@@ -1561,7 +1561,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
VkImageCreateInfo image_create_info;
image_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
- image_create_info.pNext = NULL;
+ image_create_info.pNext = nullptr;
image_create_info.flags = 0;
VkImageFormatListCreateInfoKHR format_list_create_info;
@@ -1574,7 +1574,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
}
format_list_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
- format_list_create_info.pNext = NULL;
+ format_list_create_info.pNext = nullptr;
format_list_create_info.viewFormatCount = allowed_formats.size();
format_list_create_info.pViewFormats = allowed_formats.ptr();
image_create_info.pNext = &format_list_create_info;
@@ -1665,7 +1665,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
image_create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
image_create_info.queueFamilyIndexCount = 0;
- image_create_info.pQueueFamilyIndices = NULL;
+ image_create_info.pQueueFamilyIndices = nullptr;
image_create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
uint32_t required_mipmaps = get_image_required_mipmaps(image_create_info.extent.width, image_create_info.extent.height, image_create_info.extent.depth);
@@ -1744,8 +1744,8 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
allocInfo.requiredFlags = 0;
allocInfo.preferredFlags = 0;
allocInfo.memoryTypeBits = 0;
- allocInfo.pool = NULL;
- allocInfo.pUserData = NULL;
+ allocInfo.pool = nullptr;
+ allocInfo.pUserData = nullptr;
Texture texture;
@@ -1806,7 +1806,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
VkImageViewCreateInfo image_view_create_info;
image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- image_view_create_info.pNext = NULL;
+ image_view_create_info.pNext = nullptr;
image_view_create_info.flags = 0;
image_view_create_info.image = texture.image;
@@ -1852,7 +1852,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
image_view_create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
}
- err = vkCreateImageView(device, &image_view_create_info, NULL, &texture.view);
+ err = vkCreateImageView(device, &image_view_create_info, nullptr, &texture.view);
if (err) {
vmaDestroyImage(allocator, texture.image, texture.allocation);
@@ -1863,7 +1863,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
{
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
@@ -1877,7 +1877,7 @@ RID RenderingDeviceVulkan::texture_create(const TextureFormat &p_format, const T
image_memory_barrier.subresourceRange.baseArrayLayer = 0;
image_memory_barrier.subresourceRange.layerCount = image_create_info.arrayLayers;
- vkCmdPipelineBarrier(frames[frame].setup_command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(frames[frame].setup_command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
RID id = texture_owner.make_rid(texture);
@@ -1910,7 +1910,7 @@ RID RenderingDeviceVulkan::texture_create_shared(const TextureView &p_view, RID
VkImageViewCreateInfo image_view_create_info;
image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- image_view_create_info.pNext = NULL;
+ image_view_create_info.pNext = nullptr;
image_view_create_info.flags = 0;
image_view_create_info.image = texture.image;
@@ -1961,7 +1961,7 @@ RID RenderingDeviceVulkan::texture_create_shared(const TextureView &p_view, RID
image_view_create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
}
- VkResult err = vkCreateImageView(device, &image_view_create_info, NULL, &texture.view);
+ VkResult err = vkCreateImageView(device, &image_view_create_info, nullptr, &texture.view);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateImageView failed with error " + itos(err) + ".");
texture.owner = p_with_texture;
@@ -2002,7 +2002,7 @@ RID RenderingDeviceVulkan::texture_create_shared_from_slice(const TextureView &p
VkImageViewCreateInfo image_view_create_info;
image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- image_view_create_info.pNext = NULL;
+ image_view_create_info.pNext = nullptr;
image_view_create_info.flags = 0;
image_view_create_info.image = texture.image;
@@ -2059,7 +2059,7 @@ RID RenderingDeviceVulkan::texture_create_shared_from_slice(const TextureView &p
image_view_create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
}
- VkResult err = vkCreateImageView(device, &image_view_create_info, NULL, &texture.view);
+ VkResult err = vkCreateImageView(device, &image_view_create_info, nullptr, &texture.view);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateImageView failed with error " + itos(err) + ".");
texture.owner = p_with_texture;
@@ -2121,7 +2121,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
{
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.oldLayout = texture->layout;
@@ -2136,7 +2136,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
image_memory_barrier.subresourceRange.baseArrayLayer = p_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
uint32_t mipmap_offset = 0;
@@ -2169,7 +2169,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
uint8_t *write_ptr;
{ //map
- void *data_ptr = NULL;
+ void *data_ptr = nullptr;
VkResult vkerr = vmaMapMemory(allocator, staging_buffer_blocks[staging_buffer_current].allocation, &data_ptr);
ERR_FAIL_COND_V_MSG(vkerr, ERR_CANT_CREATE, "vmaMapMemory failed with error " + itos(vkerr) + ".");
write_ptr = (uint8_t *)data_ptr;
@@ -2258,7 +2258,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
{
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
@@ -2272,7 +2272,7 @@ Error RenderingDeviceVulkan::texture_update(RID p_texture, uint32_t p_layer, con
image_memory_barrier.subresourceRange.baseArrayLayer = p_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
return OK;
@@ -2380,7 +2380,7 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t
{ //Source image barrier
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
image_memory_barrier.oldLayout = tex->layout;
@@ -2395,7 +2395,7 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t
image_memory_barrier.subresourceRange.baseArrayLayer = p_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
uint32_t computed_w = tex->width;
@@ -2437,7 +2437,7 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t
{ //restore src
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
@@ -2451,7 +2451,7 @@ Vector<uint8_t> RenderingDeviceVulkan::texture_get_data(RID p_texture, uint32_t
image_memory_barrier.subresourceRange.baseArrayLayer = p_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
_flush(true);
@@ -2546,7 +2546,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
{ //Source
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
image_memory_barrier.oldLayout = src_tex->layout;
@@ -2561,12 +2561,12 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
image_memory_barrier.subresourceRange.baseArrayLayer = p_src_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
{ //Dest
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.oldLayout = dst_tex->layout;
@@ -2581,7 +2581,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
image_memory_barrier.subresourceRange.baseArrayLayer = p_dst_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
//COPY
@@ -2617,7 +2617,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
{ //restore src
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
@@ -2631,14 +2631,14 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
image_memory_barrier.subresourceRange.baseArrayLayer = p_src_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
{ //make dst readable
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
@@ -2653,7 +2653,7 @@ Error RenderingDeviceVulkan::texture_copy(RID p_from_texture, RID p_to_texture,
image_memory_barrier.subresourceRange.baseArrayLayer = p_src_layer;
image_memory_barrier.subresourceRange.layerCount = 1;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
}
@@ -2691,7 +2691,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color,
if (src_tex->layout != VK_IMAGE_LAYOUT_GENERAL) { //storage may be in general state
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = 0;
image_memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.oldLayout = src_tex->layout;
@@ -2707,7 +2707,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color,
image_memory_barrier.subresourceRange.layerCount = p_layers;
layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
VkClearColorValue clear_color;
@@ -2729,7 +2729,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color,
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
image_memory_barrier.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
@@ -2744,7 +2744,7 @@ Error RenderingDeviceVulkan::texture_clear(RID p_texture, const Color &p_color,
image_memory_barrier.subresourceRange.baseArrayLayer = p_base_layer;
image_memory_barrier.subresourceRange.layerCount = p_layers;
- vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
return OK;
@@ -2944,27 +2944,27 @@ VkRenderPass RenderingDeviceVulkan::_render_pass_create(const Vector<AttachmentF
subpass.flags = 0;
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass.inputAttachmentCount = 0; //unsupported for now
- subpass.pInputAttachments = NULL;
+ subpass.pInputAttachments = nullptr;
subpass.colorAttachmentCount = color_references.size();
subpass.pColorAttachments = color_references.ptr();
subpass.pDepthStencilAttachment = depth_stencil_references.ptr();
subpass.pResolveAttachments = resolve_references.ptr();
subpass.preserveAttachmentCount = 0;
- subpass.pPreserveAttachments = NULL;
+ subpass.pPreserveAttachments = nullptr;
VkRenderPassCreateInfo render_pass_create_info;
render_pass_create_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
- render_pass_create_info.pNext = NULL;
+ render_pass_create_info.pNext = nullptr;
render_pass_create_info.flags = 0;
render_pass_create_info.attachmentCount = attachments.size();
render_pass_create_info.pAttachments = attachments.ptr();
render_pass_create_info.subpassCount = 1;
render_pass_create_info.pSubpasses = &subpass;
render_pass_create_info.dependencyCount = 0;
- render_pass_create_info.pDependencies = NULL;
+ render_pass_create_info.pDependencies = nullptr;
VkRenderPass render_pass;
- VkResult res = vkCreateRenderPass(device, &render_pass_create_info, NULL, &render_pass);
+ VkResult res = vkCreateRenderPass(device, &render_pass_create_info, nullptr, &render_pass);
ERR_FAIL_COND_V_MSG(res, VK_NULL_HANDLE, "vkCreateRenderPass failed with error " + itos(res) + ".");
if (r_color_attachment_count) {
@@ -3083,7 +3083,7 @@ RID RenderingDeviceVulkan::sampler_create(const SamplerState &p_state) {
VkSamplerCreateInfo sampler_create_info;
sampler_create_info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
- sampler_create_info.pNext = NULL;
+ sampler_create_info.pNext = nullptr;
sampler_create_info.flags = 0;
sampler_create_info.magFilter = p_state.mag_filter == SAMPLER_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
sampler_create_info.minFilter = p_state.min_filter == SAMPLER_FILTER_LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
@@ -3113,7 +3113,7 @@ RID RenderingDeviceVulkan::sampler_create(const SamplerState &p_state) {
sampler_create_info.unnormalizedCoordinates = p_state.unnormalized_uvw;
VkSampler sampler;
- VkResult res = vkCreateSampler(device, &sampler_create_info, NULL, &sampler);
+ VkResult res = vkCreateSampler(device, &sampler_create_info, nullptr, &sampler);
ERR_FAIL_COND_V_MSG(res, RID(), "vkCreateSampler failed with error " + itos(res) + ".");
return sampler_owner.make_rid(sampler);
@@ -3178,7 +3178,7 @@ RenderingDevice::VertexFormatID RenderingDeviceVulkan::vertex_format_create(cons
}
vdcache.create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
- vdcache.create_info.pNext = NULL;
+ vdcache.create_info.pNext = nullptr;
vdcache.create_info.flags = 0;
vdcache.create_info.vertexAttributeDescriptionCount = p_vertex_formats.size();
@@ -3546,7 +3546,7 @@ bool RenderingDeviceVulkan::_uniform_add_binding(Vector<Vector<VkDescriptorSetLa
}
layout_binding.binding = binding;
layout_binding.stageFlags = shader_stage_masks[p_stage];
- layout_binding.pImmutableSamplers = NULL; //no support for this yet
+ layout_binding.pImmutableSamplers = nullptr; //no support for this yet
info.stages = 1 << p_stage;
info.binding = binding;
@@ -3600,7 +3600,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed parsing shader.");
uint32_t binding_count = 0;
- result = spvReflectEnumerateDescriptorBindings(&module, &binding_count, NULL);
+ result = spvReflectEnumerateDescriptorBindings(&module, &binding_count, nullptr);
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating descriptor bindings.");
@@ -3742,7 +3742,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
layout_binding.binding = info.binding;
layout_binding.stageFlags = shader_stage_masks[stage];
- layout_binding.pImmutableSamplers = NULL; //no support for this yet
+ layout_binding.pImmutableSamplers = nullptr; //no support for this yet
info.stages = 1 << stage;
info.binding = info.binding;
@@ -3760,7 +3760,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
if (stage == SHADER_STAGE_VERTEX) {
uint32_t iv_count = 0;
- result = spvReflectEnumerateInputVariables(&module, &iv_count, NULL);
+ result = spvReflectEnumerateInputVariables(&module, &iv_count, nullptr);
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating input variables.");
@@ -3783,7 +3783,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
if (stage == SHADER_STAGE_FRAGMENT) {
uint32_t ov_count = 0;
- result = spvReflectEnumerateOutputVariables(&module, &ov_count, NULL);
+ result = spvReflectEnumerateOutputVariables(&module, &ov_count, nullptr);
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating output variables.");
@@ -3803,7 +3803,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
}
}
uint32_t pc_count = 0;
- result = spvReflectEnumeratePushConstantBlocks(&module, &pc_count, NULL);
+ result = spvReflectEnumeratePushConstantBlocks(&module, &pc_count, nullptr);
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed enumerating push constants.");
@@ -3817,7 +3817,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
ERR_FAIL_COND_V_MSG(result != SPV_REFLECT_RESULT_SUCCESS, RID(),
"Reflection of SPIR-V shader stage '" + String(shader_stage_names[p_stages[i].shader_stage]) + "' failed obtaining push constants.");
#if 0
- if (pconstants[0] == NULL) {
+ if (pconstants[0] == nullptr) {
FileAccess *f = FileAccess::open("res://popo.spv", FileAccess::WRITE);
f->store_buffer((const uint8_t *)&SpirV[0], SpirV.size() * sizeof(uint32_t));
memdelete(f);
@@ -3857,7 +3857,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
for (int i = 0; i < p_stages.size(); i++) {
VkShaderModuleCreateInfo shader_module_create_info;
shader_module_create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
- shader_module_create_info.pNext = NULL;
+ shader_module_create_info.pNext = nullptr;
shader_module_create_info.flags = 0;
shader_module_create_info.codeSize = p_stages[i].spir_v.size();
const uint8_t *r = p_stages[i].spir_v.ptr();
@@ -3865,7 +3865,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
shader_module_create_info.pCode = (const uint32_t *)r;
VkShaderModule module;
- VkResult res = vkCreateShaderModule(device, &shader_module_create_info, NULL, &module);
+ VkResult res = vkCreateShaderModule(device, &shader_module_create_info, nullptr, &module);
if (res) {
success = false;
error_text = "Error (" + itos(res) + ") creating shader module for stage: " + String(shader_stage_names[p_stages[i].shader_stage]);
@@ -3882,12 +3882,12 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
VkPipelineShaderStageCreateInfo shader_stage;
shader_stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
- shader_stage.pNext = NULL;
+ shader_stage.pNext = nullptr;
shader_stage.flags = 0;
shader_stage.stage = shader_stage_bits[p_stages[i].shader_stage];
shader_stage.module = module;
shader_stage.pName = "main";
- shader_stage.pSpecializationInfo = NULL;
+ shader_stage.pSpecializationInfo = nullptr;
shader.pipeline_stages.push_back(shader_stage);
}
@@ -3900,13 +3900,13 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
//empty ones are fine if they were not used according to spec (binding count will be 0)
VkDescriptorSetLayoutCreateInfo layout_create_info;
layout_create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
- layout_create_info.pNext = NULL;
+ layout_create_info.pNext = nullptr;
layout_create_info.flags = 0;
layout_create_info.bindingCount = set_bindings[i].size();
layout_create_info.pBindings = set_bindings[i].ptr();
VkDescriptorSetLayout layout;
- VkResult res = vkCreateDescriptorSetLayout(device, &layout_create_info, NULL, &layout);
+ VkResult res = vkCreateDescriptorSetLayout(device, &layout_create_info, nullptr, &layout);
if (res) {
error_text = "Error (" + itos(res) + ") creating descriptor set layout for set " + itos(i);
success = false;
@@ -3943,7 +3943,7 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
//create pipeline layout
VkPipelineLayoutCreateInfo pipeline_layout_create_info;
pipeline_layout_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pipeline_layout_create_info.pNext = NULL;
+ pipeline_layout_create_info.pNext = nullptr;
pipeline_layout_create_info.flags = 0;
pipeline_layout_create_info.setLayoutCount = shader.sets.size();
@@ -3965,10 +3965,10 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
pipeline_layout_create_info.pPushConstantRanges = &push_constant_range;
} else {
pipeline_layout_create_info.pushConstantRangeCount = 0;
- pipeline_layout_create_info.pPushConstantRanges = NULL;
+ pipeline_layout_create_info.pPushConstantRanges = nullptr;
}
- VkResult err = vkCreatePipelineLayout(device, &pipeline_layout_create_info, NULL, &shader.pipeline_layout);
+ VkResult err = vkCreatePipelineLayout(device, &pipeline_layout_create_info, nullptr, &shader.pipeline_layout);
if (err) {
error_text = "Error (" + itos(err) + ") creating pipeline layout.";
@@ -3979,11 +3979,11 @@ RID RenderingDeviceVulkan::shader_create(const Vector<ShaderStageData> &p_stages
if (!success) {
//clean up if failed
for (int i = 0; i < shader.pipeline_stages.size(); i++) {
- vkDestroyShaderModule(device, shader.pipeline_stages[i].module, NULL);
+ vkDestroyShaderModule(device, shader.pipeline_stages[i].module, nullptr);
}
for (int i = 0; i < shader.sets.size(); i++) {
- vkDestroyDescriptorSetLayout(device, shader.sets[i].descriptor_set_layout, NULL);
+ vkDestroyDescriptorSetLayout(device, shader.sets[i].descriptor_set_layout, nullptr);
}
ERR_FAIL_V_MSG(RID(), error_text);
@@ -4064,7 +4064,7 @@ RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataF
VkBufferViewCreateInfo view_create_info;
view_create_info.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO;
- view_create_info.pNext = NULL;
+ view_create_info.pNext = nullptr;
view_create_info.flags = 0;
view_create_info.buffer = texture_buffer.buffer.buffer;
view_create_info.format = vulkan_formats[p_format];
@@ -4073,7 +4073,7 @@ RID RenderingDeviceVulkan::texture_buffer_create(uint32_t p_size_elements, DataF
texture_buffer.view = VK_NULL_HANDLE;
- VkResult res = vkCreateBufferView(device, &view_create_info, NULL, &texture_buffer.view);
+ VkResult res = vkCreateBufferView(device, &view_create_info, nullptr, &texture_buffer.view);
if (res) {
_buffer_free(&texture_buffer.buffer);
ERR_FAIL_V_MSG(RID(), "Unable to create buffer view, error " + itos(res) + ".");
@@ -4088,7 +4088,7 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a
descriptor_pools[p_key] = Set<DescriptorPool *>();
}
- DescriptorPool *pool = NULL;
+ DescriptorPool *pool = nullptr;
for (Set<DescriptorPool *>::Element *E = descriptor_pools[p_key].front(); E; E = E->next()) {
if (E->get()->usage < max_descriptors_per_pool) {
@@ -4104,7 +4104,7 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a
VkDescriptorPoolCreateInfo descriptor_pool_create_info;
descriptor_pool_create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- descriptor_pool_create_info.pNext = NULL;
+ descriptor_pool_create_info.pNext = nullptr;
descriptor_pool_create_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT; // can't think how somebody may NOT need this flag..
descriptor_pool_create_info.maxSets = max_descriptors_per_pool;
Vector<VkDescriptorPoolSize> sizes;
@@ -4169,10 +4169,10 @@ RenderingDeviceVulkan::DescriptorPool *RenderingDeviceVulkan::_descriptor_pool_a
descriptor_pool_create_info.poolSizeCount = sizes.size();
descriptor_pool_create_info.pPoolSizes = sizes.ptr();
- VkResult res = vkCreateDescriptorPool(device, &descriptor_pool_create_info, NULL, &pool->pool);
+ VkResult res = vkCreateDescriptorPool(device, &descriptor_pool_create_info, nullptr, &pool->pool);
if (res) {
memdelete(pool);
- ERR_FAIL_COND_V_MSG(res, NULL, "vkCreateDescriptorPool failed with error " + itos(res) + ".");
+ ERR_FAIL_COND_V_MSG(res, nullptr, "vkCreateDescriptorPool failed with error " + itos(res) + ".");
}
descriptor_pools[p_key].insert(pool);
}
@@ -4189,7 +4189,7 @@ void RenderingDeviceVulkan::_descriptor_pool_free(const DescriptorPoolKey &p_key
ERR_FAIL_COND(p_pool->usage == 0);
p_pool->usage--;
if (p_pool->usage == 0) {
- vkDestroyDescriptorPool(device, p_pool->pool, NULL);
+ vkDestroyDescriptorPool(device, p_pool->pool, nullptr);
descriptor_pools[p_key].erase(p_pool);
memdelete(p_pool);
if (descriptor_pools[p_key].empty()) {
@@ -4249,8 +4249,8 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
VkWriteDescriptorSet write; //common header
write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
- write.pNext = NULL;
- write.dstSet = NULL; //will assign afterwards when everything is valid
+ write.pNext = nullptr;
+ write.dstSet = nullptr; //will assign afterwards when everything is valid
write.dstBinding = set_uniform.binding;
uint32_t type_size = 1;
@@ -4282,8 +4282,8 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.descriptorCount = uniform.ids.size();
write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
write.pImageInfo = image_infos.push_back(image_info)->get().ptr();
- write.pBufferInfo = NULL;
- write.pTexelBufferView = NULL;
+ write.pBufferInfo = nullptr;
+ write.pTexelBufferView = nullptr;
type_size = uniform.ids.size();
@@ -4337,8 +4337,8 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.descriptorCount = uniform.ids.size() / 2;
write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
write.pImageInfo = image_infos.push_back(image_info)->get().ptr();
- write.pBufferInfo = NULL;
- write.pTexelBufferView = NULL;
+ write.pBufferInfo = nullptr;
+ write.pTexelBufferView = nullptr;
type_size = uniform.ids.size() / 2;
@@ -4363,7 +4363,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
"Texture (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_SAMPLING_BIT usage flag set in order to be used as uniform.");
VkDescriptorImageInfo img_info;
- img_info.sampler = NULL;
+ img_info.sampler = nullptr;
img_info.imageView = texture->view;
if (texture->usage_flags & (TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | TEXTURE_USAGE_RESOLVE_ATTACHMENT_BIT)) {
@@ -4389,8 +4389,8 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.descriptorCount = uniform.ids.size();
write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
write.pImageInfo = image_infos.push_back(image_info)->get().ptr();
- write.pBufferInfo = NULL;
- write.pTexelBufferView = NULL;
+ write.pBufferInfo = nullptr;
+ write.pTexelBufferView = nullptr;
type_size = uniform.ids.size();
} break;
@@ -4416,7 +4416,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
"Image (binding: " + itos(uniform.binding) + ", index " + itos(j) + ") needs the TEXTURE_USAGE_STORAGE_BIT usage flag set in order to be used as uniform.");
VkDescriptorImageInfo img_info;
- img_info.sampler = NULL;
+ img_info.sampler = nullptr;
img_info.imageView = texture->view;
if (texture->owner.is_valid()) {
@@ -4438,8 +4438,8 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.descriptorCount = uniform.ids.size();
write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
write.pImageInfo = image_infos.push_back(image_info)->get().ptr();
- write.pBufferInfo = NULL;
- write.pTexelBufferView = NULL;
+ write.pBufferInfo = nullptr;
+ write.pTexelBufferView = nullptr;
type_size = uniform.ids.size();
@@ -4467,7 +4467,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.dstArrayElement = 0;
write.descriptorCount = uniform.ids.size();
write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
- write.pImageInfo = NULL;
+ write.pImageInfo = nullptr;
write.pBufferInfo = buffer_infos.push_back(buffer_info)->get().ptr();
write.pTexelBufferView = buffer_views.push_back(buffer_view)->get().ptr();
@@ -4533,9 +4533,9 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.dstArrayElement = 0;
write.descriptorCount = 1;
write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- write.pImageInfo = NULL;
+ write.pImageInfo = nullptr;
write.pBufferInfo = &buffer->buffer_info;
- write.pTexelBufferView = NULL;
+ write.pTexelBufferView = nullptr;
} break;
case UNIFORM_TYPE_STORAGE_BUFFER: {
@@ -4552,9 +4552,9 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
write.dstArrayElement = 0;
write.descriptorCount = 1;
write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
- write.pImageInfo = NULL;
+ write.pImageInfo = nullptr;
write.pBufferInfo = &buffer->buffer_info;
- write.pTexelBufferView = NULL;
+ write.pTexelBufferView = nullptr;
} break;
case UNIFORM_TYPE_INPUT_ATTACHMENT: {
@@ -4578,7 +4578,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
VkDescriptorSetAllocateInfo descriptor_set_allocate_info;
descriptor_set_allocate_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
- descriptor_set_allocate_info.pNext = NULL;
+ descriptor_set_allocate_info.pNext = nullptr;
descriptor_set_allocate_info.descriptorPool = pool->pool;
descriptor_set_allocate_info.descriptorSetCount = 1;
descriptor_set_allocate_info.pSetLayouts = &shader->sets[p_shader_set].descriptor_set_layout;
@@ -4619,7 +4619,7 @@ RID RenderingDeviceVulkan::uniform_set_create(const Vector<Uniform> &p_uniforms,
for (int i = 0; i < writes.size(); i++) {
writes.write[i].dstSet = descriptor_set;
}
- vkUpdateDescriptorSets(device, writes.size(), writes.ptr(), 0, NULL);
+ vkUpdateDescriptorSets(device, writes.size(), writes.ptr(), 0, nullptr);
}
return id;
@@ -4638,7 +4638,7 @@ Error RenderingDeviceVulkan::buffer_update(RID p_buffer, uint32_t p_offset, uint
VkPipelineStageFlags dst_stage_mask;
VkAccessFlags dst_access;
- Buffer *buffer = NULL;
+ Buffer *buffer = nullptr;
if (vertex_buffer_owner.owns(p_buffer)) {
dst_stage_mask = VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
dst_access = VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
@@ -4684,7 +4684,7 @@ Vector<uint8_t> RenderingDeviceVulkan::buffer_get_data(RID p_buffer) {
_THREAD_SAFE_METHOD_
- Buffer *buffer = NULL;
+ Buffer *buffer = nullptr;
if (vertex_buffer_owner.owns(p_buffer)) {
buffer = vertex_buffer_owner.getornull(p_buffer);
} else if (index_buffer_owner.owns(p_buffer)) {
@@ -4783,12 +4783,12 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
} else {
//does not use vertices
pipeline_vertex_input_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
- pipeline_vertex_input_state_create_info.pNext = NULL;
+ pipeline_vertex_input_state_create_info.pNext = nullptr;
pipeline_vertex_input_state_create_info.flags = 0;
pipeline_vertex_input_state_create_info.vertexBindingDescriptionCount = 0;
- pipeline_vertex_input_state_create_info.pVertexBindingDescriptions = NULL;
+ pipeline_vertex_input_state_create_info.pVertexBindingDescriptions = nullptr;
pipeline_vertex_input_state_create_info.vertexAttributeDescriptionCount = 0;
- pipeline_vertex_input_state_create_info.pVertexAttributeDescriptions = NULL;
+ pipeline_vertex_input_state_create_info.pVertexAttributeDescriptions = nullptr;
ERR_FAIL_COND_V_MSG(shader->vertex_input_mask != 0, RID(),
"Shader contains vertex inputs, but no vertex input description was provided for pipeline creation.");
@@ -4799,7 +4799,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
VkPipelineInputAssemblyStateCreateInfo input_assembly_create_info;
input_assembly_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
- input_assembly_create_info.pNext = NULL;
+ input_assembly_create_info.pNext = nullptr;
input_assembly_create_info.flags = 0;
static const VkPrimitiveTopology topology_list[RENDER_PRIMITIVE_MAX] = {
@@ -4822,24 +4822,24 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
//tesselation
VkPipelineTessellationStateCreateInfo tesselation_create_info;
tesselation_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
- tesselation_create_info.pNext = NULL;
+ tesselation_create_info.pNext = nullptr;
tesselation_create_info.flags = 0;
ERR_FAIL_COND_V(p_rasterization_state.patch_control_points < 1 || p_rasterization_state.patch_control_points > limits.maxTessellationPatchSize, RID());
tesselation_create_info.patchControlPoints = p_rasterization_state.patch_control_points;
VkPipelineViewportStateCreateInfo viewport_state_create_info;
viewport_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
- viewport_state_create_info.pNext = NULL;
+ viewport_state_create_info.pNext = nullptr;
viewport_state_create_info.flags = 0;
viewport_state_create_info.viewportCount = 1; //if VR extensions are supported at some point, this will have to be customizable in the framebuffer format
- viewport_state_create_info.pViewports = NULL;
+ viewport_state_create_info.pViewports = nullptr;
viewport_state_create_info.scissorCount = 1;
- viewport_state_create_info.pScissors = NULL;
+ viewport_state_create_info.pScissors = nullptr;
//rasterization
VkPipelineRasterizationStateCreateInfo rasterization_state_create_info;
rasterization_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
- rasterization_state_create_info.pNext = NULL;
+ rasterization_state_create_info.pNext = nullptr;
rasterization_state_create_info.flags = 0;
rasterization_state_create_info.depthClampEnable = p_rasterization_state.enable_depth_clamp;
rasterization_state_create_info.rasterizerDiscardEnable = p_rasterization_state.discard_primitives;
@@ -4862,7 +4862,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
//multisample
VkPipelineMultisampleStateCreateInfo multisample_state_create_info;
multisample_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- multisample_state_create_info.pNext = NULL;
+ multisample_state_create_info.pNext = nullptr;
multisample_state_create_info.flags = 0;
multisample_state_create_info.rasterizationSamples = rasterization_sample_count[p_multisample_state.sample_count];
@@ -4882,7 +4882,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
}
multisample_state_create_info.pSampleMask = sample_mask.ptr();
} else {
- multisample_state_create_info.pSampleMask = NULL;
+ multisample_state_create_info.pSampleMask = nullptr;
}
multisample_state_create_info.alphaToCoverageEnable = p_multisample_state.enable_alpha_to_coverage;
@@ -4892,7 +4892,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
VkPipelineDepthStencilStateCreateInfo depth_stencil_state_create_info;
depth_stencil_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
- depth_stencil_state_create_info.pNext = NULL;
+ depth_stencil_state_create_info.pNext = nullptr;
depth_stencil_state_create_info.flags = 0;
depth_stencil_state_create_info.depthTestEnable = p_depth_stencil_state.enable_depth_test;
depth_stencil_state_create_info.depthWriteEnable = p_depth_stencil_state.enable_depth_write;
@@ -4931,7 +4931,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
//blend state
VkPipelineColorBlendStateCreateInfo color_blend_state_create_info;
color_blend_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
- color_blend_state_create_info.pNext = NULL;
+ color_blend_state_create_info.pNext = nullptr;
color_blend_state_create_info.flags = 0;
color_blend_state_create_info.logicOpEnable = p_blend_state.enable_logic_op;
ERR_FAIL_INDEX_V(p_blend_state.logic_op, LOGIC_OP_MAX, RID());
@@ -4988,7 +4988,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
VkPipelineDynamicStateCreateInfo dynamic_state_create_info;
dynamic_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
- dynamic_state_create_info.pNext = NULL;
+ dynamic_state_create_info.pNext = nullptr;
dynamic_state_create_info.flags = 0;
Vector<VkDynamicState> dynamic_states; //vulkan is weird..
@@ -5030,7 +5030,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
VkGraphicsPipelineCreateInfo graphics_pipeline_create_info;
graphics_pipeline_create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
- graphics_pipeline_create_info.pNext = NULL;
+ graphics_pipeline_create_info.pNext = nullptr;
graphics_pipeline_create_info.flags = 0;
graphics_pipeline_create_info.stageCount = shader->pipeline_stages.size();
@@ -5048,11 +5048,11 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
graphics_pipeline_create_info.renderPass = fb_format.render_pass;
graphics_pipeline_create_info.subpass = 0;
- graphics_pipeline_create_info.basePipelineHandle = NULL;
+ graphics_pipeline_create_info.basePipelineHandle = nullptr;
graphics_pipeline_create_info.basePipelineIndex = 0;
RenderPipeline pipeline;
- VkResult err = vkCreateGraphicsPipelines(device, NULL, 1, &graphics_pipeline_create_info, NULL, &pipeline.pipeline);
+ VkResult err = vkCreateGraphicsPipelines(device, nullptr, 1, &graphics_pipeline_create_info, nullptr, &pipeline.pipeline);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateGraphicsPipelines failed with error " + itos(err) + ".");
pipeline.set_formats = shader->set_formats;
@@ -5116,16 +5116,16 @@ RID RenderingDeviceVulkan::compute_pipeline_create(RID p_shader) {
VkComputePipelineCreateInfo compute_pipeline_create_info;
compute_pipeline_create_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
- compute_pipeline_create_info.pNext = NULL;
+ compute_pipeline_create_info.pNext = nullptr;
compute_pipeline_create_info.flags = 0;
compute_pipeline_create_info.stage = shader->pipeline_stages[0];
compute_pipeline_create_info.layout = shader->pipeline_layout;
- compute_pipeline_create_info.basePipelineHandle = NULL;
+ compute_pipeline_create_info.basePipelineHandle = nullptr;
compute_pipeline_create_info.basePipelineIndex = 0;
ComputePipeline pipeline;
- VkResult err = vkCreateComputePipelines(device, NULL, 1, &compute_pipeline_create_info, NULL, &pipeline.pipeline);
+ VkResult err = vkCreateComputePipelines(device, nullptr, 1, &compute_pipeline_create_info, nullptr, &pipeline.pipeline);
ERR_FAIL_COND_V_MSG(err, RID(), "vkCreateComputePipelines failed with error " + itos(err) + ".");
pipeline.set_formats = shader->set_formats;
@@ -5193,8 +5193,8 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin_for_screen(Di
_THREAD_SAFE_METHOD_
- ERR_FAIL_COND_V_MSG(draw_list != NULL, INVALID_ID, "Only one draw list can be active at the same time.");
- ERR_FAIL_COND_V_MSG(compute_list != NULL, INVALID_ID, "Only one draw/compute list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(draw_list != nullptr, INVALID_ID, "Only one draw list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(compute_list != nullptr, INVALID_ID, "Only one draw/compute list can be active at the same time.");
VkCommandBuffer command_buffer = frames[frame].draw_command_buffer;
draw_list = memnew(DrawList);
@@ -5207,7 +5207,7 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin_for_screen(Di
VkRenderPassBeginInfo render_pass_begin;
render_pass_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- render_pass_begin.pNext = NULL;
+ render_pass_begin.pNext = nullptr;
render_pass_begin.renderPass = context->window_get_render_pass(p_screen);
render_pass_begin.framebuffer = context->window_get_framebuffer(p_screen);
@@ -5268,7 +5268,7 @@ Error RenderingDeviceVulkan::_draw_list_setup_framebuffer(Framebuffer *p_framebu
VkFramebufferCreateInfo framebuffer_create_info;
framebuffer_create_info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
- framebuffer_create_info.pNext = NULL;
+ framebuffer_create_info.pNext = nullptr;
framebuffer_create_info.flags = 0;
framebuffer_create_info.renderPass = version.render_pass;
Vector<VkImageView> attachments;
@@ -5285,7 +5285,7 @@ Error RenderingDeviceVulkan::_draw_list_setup_framebuffer(Framebuffer *p_framebu
framebuffer_create_info.height = p_framebuffer->size.height;
framebuffer_create_info.layers = 1;
- VkResult err = vkCreateFramebuffer(device, &framebuffer_create_info, NULL, &version.framebuffer);
+ VkResult err = vkCreateFramebuffer(device, &framebuffer_create_info, nullptr, &version.framebuffer);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "vkCreateFramebuffer failed with error " + itos(err) + ".");
p_framebuffer->framebuffers.insert(vk, version);
@@ -5301,7 +5301,7 @@ Error RenderingDeviceVulkan::_draw_list_render_pass_begin(Framebuffer *framebuff
VkRenderPassBeginInfo render_pass_begin;
render_pass_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- render_pass_begin.pNext = NULL;
+ render_pass_begin.pNext = nullptr;
render_pass_begin.renderPass = render_pass;
render_pass_begin.framebuffer = vkframebuffer;
@@ -5404,8 +5404,8 @@ RenderingDevice::DrawListID RenderingDeviceVulkan::draw_list_begin(RID p_framebu
_THREAD_SAFE_METHOD_
- ERR_FAIL_COND_V_MSG(draw_list != NULL, INVALID_ID, "Only one draw list can be active at the same time.");
- ERR_FAIL_COND_V_MSG(compute_list != NULL, INVALID_ID, "Only one draw/compute list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(draw_list != nullptr, INVALID_ID, "Only one draw list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(compute_list != nullptr, INVALID_ID, "Only one draw/compute list can be active at the same time.");
Framebuffer *framebuffer = framebuffer_owner.getornull(p_framebuffer);
ERR_FAIL_COND_V(!framebuffer, INVALID_ID);
@@ -5542,11 +5542,11 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
VkCommandPoolCreateInfo cmd_pool_info;
cmd_pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
- cmd_pool_info.pNext = NULL;
+ cmd_pool_info.pNext = nullptr;
cmd_pool_info.queueFamilyIndex = context->get_graphics_queue();
cmd_pool_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
- VkResult res = vkCreateCommandPool(device, &cmd_pool_info, NULL, &split_draw_list_allocators.write[i].command_pool);
+ VkResult res = vkCreateCommandPool(device, &cmd_pool_info, nullptr, &split_draw_list_allocators.write[i].command_pool);
ERR_FAIL_COND_V_MSG(res, ERR_CANT_CREATE, "vkCreateCommandPool failed with error " + itos(res) + ".");
for (int j = 0; j < frame_count; j++) {
@@ -5556,7 +5556,7 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
VkCommandBufferAllocateInfo cmdbuf;
//no command buffer exists, create it.
cmdbuf.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
- cmdbuf.pNext = NULL;
+ cmdbuf.pNext = nullptr;
cmdbuf.commandPool = split_draw_list_allocators[i].command_pool;
cmdbuf.level = VK_COMMAND_BUFFER_LEVEL_SECONDARY;
cmdbuf.commandBufferCount = 1;
@@ -5593,7 +5593,7 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
VkCommandBufferInheritanceInfo inheritance_info;
inheritance_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
- inheritance_info.pNext = NULL;
+ inheritance_info.pNext = nullptr;
inheritance_info.renderPass = render_pass;
inheritance_info.subpass = 0;
inheritance_info.framebuffer = vkframebuffer;
@@ -5603,21 +5603,21 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
VkCommandBufferBeginInfo cmdbuf_begin;
cmdbuf_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmdbuf_begin.pNext = NULL;
+ cmdbuf_begin.pNext = nullptr;
cmdbuf_begin.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT | VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
cmdbuf_begin.pInheritanceInfo = &inheritance_info;
VkResult res = vkResetCommandBuffer(command_buffer, 0);
if (res) {
memdelete_arr(draw_list);
- draw_list = NULL;
+ draw_list = nullptr;
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "vkResetCommandBuffer failed with error " + itos(res) + ".");
}
res = vkBeginCommandBuffer(command_buffer, &cmdbuf_begin);
if (res) {
memdelete_arr(draw_list);
- draw_list = NULL;
+ draw_list = nullptr;
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "vkBeginCommandBuffer failed with error " + itos(res) + ".");
}
@@ -5658,30 +5658,30 @@ Error RenderingDeviceVulkan::draw_list_begin_split(RID p_framebuffer, uint32_t p
RenderingDeviceVulkan::DrawList *RenderingDeviceVulkan::_get_draw_list_ptr(DrawListID p_id) {
if (p_id < 0) {
- return NULL;
+ return nullptr;
}
if (!draw_list) {
- return NULL;
+ return nullptr;
} else if (p_id == ID_TYPE_DRAW_LIST) {
if (draw_list_split) {
- return NULL;
+ return nullptr;
}
return draw_list;
} else if (p_id >> DrawListID(ID_BASE_SHIFT) == ID_TYPE_SPLIT_DRAW_LIST) {
if (!draw_list_split) {
- return NULL;
+ return nullptr;
}
uint64_t index = p_id & ((DrawListID(1) << DrawListID(ID_BASE_SHIFT)) - 1); //mask
if (index >= draw_list_count) {
- return NULL;
+ return nullptr;
}
return &draw_list[index];
} else {
- return NULL;
+ return nullptr;
}
}
@@ -5927,7 +5927,7 @@ void RenderingDeviceVulkan::draw_list_draw(DrawListID p_list, bool p_use_indices
#endif
if (!dl->state.sets[i].bound) {
//All good, see if this requires re-binding
- vkCmdBindDescriptorSets(dl->command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, dl->state.pipeline_layout, i, 1, &dl->state.sets[i].descriptor_set, 0, NULL);
+ vkCmdBindDescriptorSets(dl->command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, dl->state.pipeline_layout, i, 1, &dl->state.sets[i].descriptor_set, 0, nullptr);
dl->state.sets[i].bound = true;
}
}
@@ -6046,13 +6046,13 @@ void RenderingDeviceVulkan::draw_list_end() {
vkCmdExecuteCommands(frames[frame].draw_command_buffer, draw_list_count, command_buffers);
vkCmdEndRenderPass(frames[frame].draw_command_buffer);
memdelete_arr(draw_list);
- draw_list = NULL;
+ draw_list = nullptr;
} else {
//just end the list
vkCmdEndRenderPass(draw_list->command_buffer);
memdelete(draw_list);
- draw_list = NULL;
+ draw_list = nullptr;
}
for (int i = 0; i < draw_list_bound_textures.size(); i++) {
@@ -6085,8 +6085,8 @@ void RenderingDeviceVulkan::draw_list_end() {
RenderingDevice::ComputeListID RenderingDeviceVulkan::compute_list_begin() {
- ERR_FAIL_COND_V_MSG(draw_list != NULL, INVALID_ID, "Only one draw list can be active at the same time.");
- ERR_FAIL_COND_V_MSG(compute_list != NULL, INVALID_ID, "Only one draw/compute list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(draw_list != nullptr, INVALID_ID, "Only one draw list can be active at the same time.");
+ ERR_FAIL_COND_V_MSG(compute_list != nullptr, INVALID_ID, "Only one draw/compute list can be active at the same time.");
compute_list = memnew(ComputeList);
compute_list->command_buffer = frames[frame].draw_command_buffer;
@@ -6189,7 +6189,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.oldLayout = textures_to_sampled[i]->layout;
@@ -6204,7 +6204,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
image_memory_barrier.subresourceRange.baseArrayLayer = 0;
image_memory_barrier.subresourceRange.layerCount = textures_to_sampled[i]->layers;
- vkCmdPipelineBarrier(cl->command_buffer, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(cl->command_buffer, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
textures_to_sampled[i]->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
@@ -6220,7 +6220,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.oldLayout = textures_to_storage[i]->layout;
@@ -6235,7 +6235,7 @@ void RenderingDeviceVulkan::compute_list_bind_uniform_set(ComputeListID p_list,
image_memory_barrier.subresourceRange.baseArrayLayer = 0;
image_memory_barrier.subresourceRange.layerCount = textures_to_storage[i]->layers;
- vkCmdPipelineBarrier(cl->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(cl->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
textures_to_storage[i]->layout = VK_IMAGE_LAYOUT_GENERAL;
@@ -6329,7 +6329,7 @@ void RenderingDeviceVulkan::compute_list_dispatch(ComputeListID p_list, uint32_t
#endif
if (!cl->state.sets[i].bound) {
//All good, see if this requires re-binding
- vkCmdBindDescriptorSets(cl->command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, cl->state.pipeline_layout, i, 1, &cl->state.sets[i].descriptor_set, 0, NULL);
+ vkCmdBindDescriptorSets(cl->command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, cl->state.pipeline_layout, i, 1, &cl->state.sets[i].descriptor_set, 0, nullptr);
cl->state.sets[i].bound = true;
}
}
@@ -6352,7 +6352,7 @@ void RenderingDeviceVulkan::compute_list_end() {
VkImageMemoryBarrier image_memory_barrier;
image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
- image_memory_barrier.pNext = NULL;
+ image_memory_barrier.pNext = nullptr;
image_memory_barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
image_memory_barrier.oldLayout = E->get()->layout;
@@ -6367,13 +6367,13 @@ void RenderingDeviceVulkan::compute_list_end() {
image_memory_barrier.subresourceRange.baseArrayLayer = 0;
image_memory_barrier.subresourceRange.layerCount = E->get()->layers;
- vkCmdPipelineBarrier(compute_list->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &image_memory_barrier);
+ vkCmdPipelineBarrier(compute_list->command_buffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
E->get()->layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
}
memdelete(compute_list);
- compute_list = NULL;
+ compute_list = nullptr;
#ifdef FORCE_FULL_BARRIER
_full_barrier(true);
#else
@@ -6389,7 +6389,7 @@ void RenderingDeviceVulkan::draw_list_render_secondary_to_framebuffer(ID p_frame
VkRenderPassBeginInfo render_pass_begin;
render_pass_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
- render_pass_begin.pNext = NULL;
+ render_pass_begin.pNext = nullptr;
render_pass_begin.renderPass = context->get_render_pass();
render_pass_begin.framebuffer = context->get_frame_framebuffer(frame);
@@ -6547,9 +6547,9 @@ void RenderingDeviceVulkan::swap_buffers() {
{
VkCommandBufferBeginInfo cmdbuf_begin;
cmdbuf_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmdbuf_begin.pNext = NULL;
+ cmdbuf_begin.pNext = nullptr;
cmdbuf_begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmdbuf_begin.pInheritanceInfo = NULL;
+ cmdbuf_begin.pInheritanceInfo = nullptr;
VkResult err = vkResetCommandBuffer(frames[frame].setup_command_buffer, 0);
ERR_FAIL_COND_MSG(err, "vkResetCommandBuffer failed with error " + itos(err) + ".");
@@ -6588,7 +6588,7 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
while (frames[p_frame].render_pipelines_to_dispose_of.front()) {
RenderPipeline *pipeline = &frames[p_frame].render_pipelines_to_dispose_of.front()->get();
- vkDestroyPipeline(device, pipeline->pipeline, NULL);
+ vkDestroyPipeline(device, pipeline->pipeline, nullptr);
frames[p_frame].render_pipelines_to_dispose_of.pop_front();
}
@@ -6596,7 +6596,7 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
while (frames[p_frame].compute_pipelines_to_dispose_of.front()) {
ComputePipeline *pipeline = &frames[p_frame].compute_pipelines_to_dispose_of.front()->get();
- vkDestroyPipeline(device, pipeline->pipeline, NULL);
+ vkDestroyPipeline(device, pipeline->pipeline, nullptr);
frames[p_frame].compute_pipelines_to_dispose_of.pop_front();
}
@@ -6615,7 +6615,7 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
while (frames[p_frame].buffer_views_to_dispose_of.front()) {
VkBufferView buffer_view = frames[p_frame].buffer_views_to_dispose_of.front()->get();
- vkDestroyBufferView(device, buffer_view, NULL);
+ vkDestroyBufferView(device, buffer_view, nullptr);
frames[p_frame].buffer_views_to_dispose_of.pop_front();
}
@@ -6626,15 +6626,15 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
//descriptor set layout for each set
for (int i = 0; i < shader->sets.size(); i++) {
- vkDestroyDescriptorSetLayout(device, shader->sets[i].descriptor_set_layout, NULL);
+ vkDestroyDescriptorSetLayout(device, shader->sets[i].descriptor_set_layout, nullptr);
}
//pipeline layout
- vkDestroyPipelineLayout(device, shader->pipeline_layout, NULL);
+ vkDestroyPipelineLayout(device, shader->pipeline_layout, nullptr);
//shaders themselves
for (int i = 0; i < shader->pipeline_stages.size(); i++) {
- vkDestroyShaderModule(device, shader->pipeline_stages[i].module, NULL);
+ vkDestroyShaderModule(device, shader->pipeline_stages[i].module, nullptr);
}
frames[p_frame].shaders_to_dispose_of.pop_front();
@@ -6644,7 +6644,7 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
while (frames[p_frame].samplers_to_dispose_of.front()) {
VkSampler sampler = frames[p_frame].samplers_to_dispose_of.front()->get();
- vkDestroySampler(device, sampler, NULL);
+ vkDestroySampler(device, sampler, nullptr);
frames[p_frame].samplers_to_dispose_of.pop_front();
}
@@ -6655,8 +6655,8 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
for (Map<Framebuffer::VersionKey, Framebuffer::Version>::Element *E = framebuffer->framebuffers.front(); E; E = E->next()) {
//first framebuffer, then render pass because it depends on it
- vkDestroyFramebuffer(device, E->get().framebuffer, NULL);
- vkDestroyRenderPass(device, E->get().render_pass, NULL);
+ vkDestroyFramebuffer(device, E->get().framebuffer, nullptr);
+ vkDestroyRenderPass(device, E->get().render_pass, nullptr);
}
frames[p_frame].framebuffers_to_dispose_of.pop_front();
@@ -6669,7 +6669,7 @@ void RenderingDeviceVulkan::_free_pending_resources(int p_frame) {
if (texture->bound) {
WARN_PRINT("Deleted a texture while it was bound..");
}
- vkDestroyImageView(device, texture->view, NULL);
+ vkDestroyImageView(device, texture->view, nullptr);
if (texture->owner.is_null()) {
//actually owns the image and the allocation too
vmaDestroyImage(allocator, texture->image, texture->allocation);
@@ -6708,9 +6708,9 @@ void RenderingDeviceVulkan::_flush(bool p_current_frame) {
if (p_current_frame) {
VkCommandBufferBeginInfo cmdbuf_begin;
cmdbuf_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmdbuf_begin.pNext = NULL;
+ cmdbuf_begin.pNext = nullptr;
cmdbuf_begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmdbuf_begin.pInheritanceInfo = NULL;
+ cmdbuf_begin.pInheritanceInfo = nullptr;
VkResult err = vkBeginCommandBuffer(frames[frame].setup_command_buffer, &cmdbuf_begin);
ERR_FAIL_COND_MSG(err, "vkBeginCommandBuffer failed with error " + itos(err) + ".");
@@ -6720,9 +6720,9 @@ void RenderingDeviceVulkan::_flush(bool p_current_frame) {
if (p_current_frame) {
VkCommandBufferBeginInfo cmdbuf_begin;
cmdbuf_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmdbuf_begin.pNext = NULL;
+ cmdbuf_begin.pNext = nullptr;
cmdbuf_begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmdbuf_begin.pInheritanceInfo = NULL;
+ cmdbuf_begin.pInheritanceInfo = nullptr;
VkResult err = vkBeginCommandBuffer(frames[frame].draw_command_buffer, &cmdbuf_begin);
ERR_FAIL_COND_MSG(err, "vkBeginCommandBuffer failed with error " + itos(err) + ".");
@@ -6757,11 +6757,11 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) {
{ //create command pool, one per frame is recommended
VkCommandPoolCreateInfo cmd_pool_info;
cmd_pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
- cmd_pool_info.pNext = NULL;
+ cmd_pool_info.pNext = nullptr;
cmd_pool_info.queueFamilyIndex = p_context->get_graphics_queue();
cmd_pool_info.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
- VkResult res = vkCreateCommandPool(device, &cmd_pool_info, NULL, &frames[i].command_pool);
+ VkResult res = vkCreateCommandPool(device, &cmd_pool_info, nullptr, &frames[i].command_pool);
ERR_FAIL_COND_MSG(res, "vkCreateCommandPool failed with error " + itos(res) + ".");
}
@@ -6770,7 +6770,7 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) {
VkCommandBufferAllocateInfo cmdbuf;
//no command buffer exists, create it.
cmdbuf.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
- cmdbuf.pNext = NULL;
+ cmdbuf.pNext = nullptr;
cmdbuf.commandPool = frames[i].command_pool;
cmdbuf.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
cmdbuf.commandBufferCount = 1;
@@ -6787,12 +6787,12 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) {
VkQueryPoolCreateInfo query_pool_create_info;
query_pool_create_info.sType = VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO;
query_pool_create_info.flags = 0;
- query_pool_create_info.pNext = NULL;
+ query_pool_create_info.pNext = nullptr;
query_pool_create_info.queryType = VK_QUERY_TYPE_TIMESTAMP;
query_pool_create_info.queryCount = max_timestamp_query_elements;
query_pool_create_info.pipelineStatistics = 0;
- vkCreateQueryPool(device, &query_pool_create_info, NULL, &frames[i].timestamp_pool);
+ vkCreateQueryPool(device, &query_pool_create_info, nullptr, &frames[i].timestamp_pool);
frames[i].timestamp_names = memnew_arr(String, max_timestamp_query_elements);
frames[i].timestamp_cpu_values = memnew_arr(uint64_t, max_timestamp_query_elements);
@@ -6809,9 +6809,9 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) {
//setting up things can be done in the meantime until swap_buffers(), which is called before advance.
VkCommandBufferBeginInfo cmdbuf_begin;
cmdbuf_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmdbuf_begin.pNext = NULL;
+ cmdbuf_begin.pNext = nullptr;
cmdbuf_begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
- cmdbuf_begin.pInheritanceInfo = NULL;
+ cmdbuf_begin.pInheritanceInfo = nullptr;
VkResult err = vkBeginCommandBuffer(frames[0].setup_command_buffer, &cmdbuf_begin);
ERR_FAIL_COND_MSG(err, "vkBeginCommandBuffer failed with error " + itos(err) + ".");
@@ -6853,11 +6853,11 @@ void RenderingDeviceVulkan::initialize(VulkanContext *p_context) {
//check to make sure DescriptorPoolKey is good
static_assert(sizeof(uint64_t) * 3 >= UNIFORM_TYPE_MAX * sizeof(uint16_t));
- draw_list = NULL;
+ draw_list = nullptr;
draw_list_count = 0;
draw_list_split = false;
- compute_list = NULL;
+ compute_list = nullptr;
}
template <class T>
@@ -6880,7 +6880,7 @@ void RenderingDeviceVulkan::capture_timestamp(const String &p_name, bool p_sync_
VkMemoryBarrier memoryBarrier;
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
- memoryBarrier.pNext = NULL;
+ memoryBarrier.pNext = nullptr;
memoryBarrier.srcAccessMask = VK_ACCESS_INDIRECT_COMMAND_READ_BIT |
VK_ACCESS_INDEX_READ_BIT |
VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT |
@@ -6912,7 +6912,7 @@ void RenderingDeviceVulkan::capture_timestamp(const String &p_name, bool p_sync_
VK_ACCESS_HOST_READ_BIT |
VK_ACCESS_HOST_WRITE_BIT;
- vkCmdPipelineBarrier(p_sync_to_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1, &memoryBarrier, 0, NULL, 0, NULL);
+ vkCmdPipelineBarrier(p_sync_to_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1, &memoryBarrier, 0, nullptr, 0, nullptr);
}
vkCmdWriteTimestamp(p_sync_to_draw ? frames[frame].draw_command_buffer : frames[frame].setup_command_buffer, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, frames[frame].timestamp_pool, frames[frame].timestamp_count);
frames[frame].timestamp_names[frames[frame].timestamp_count] = p_name;
@@ -7030,8 +7030,8 @@ void RenderingDeviceVulkan::finalize() {
for (int i = 0; i < frame_count; i++) {
int f = (frame + i) % frame_count;
_free_pending_resources(f);
- vkDestroyCommandPool(device, frames[i].command_pool, NULL);
- vkDestroyQueryPool(device, frames[i].timestamp_pool, NULL);
+ vkDestroyCommandPool(device, frames[i].command_pool, nullptr);
+ vkDestroyQueryPool(device, frames[i].timestamp_pool, nullptr);
memdelete_arr(frames[i].timestamp_names);
memdelete_arr(frames[i].timestamp_cpu_values);
memdelete_arr(frames[i].timestamp_result_names);
@@ -7040,7 +7040,7 @@ void RenderingDeviceVulkan::finalize() {
}
for (int i = 0; i < split_draw_list_allocators.size(); i++) {
- vkDestroyCommandPool(device, split_draw_list_allocators[i].command_pool, NULL);
+ vkDestroyCommandPool(device, split_draw_list_allocators[i].command_pool, nullptr);
}
memdelete_arr(frames);
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index f7ae9c28ea..208109bba3 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -78,7 +78,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
static void get_compressed_image_format_block_dimensions(DataFormat p_format, uint32_t &r_w, uint32_t &r_h);
uint32_t get_compressed_image_format_block_byte_size(DataFormat p_format);
static uint32_t get_compressed_image_format_pixel_rshift(DataFormat p_format);
- static uint32_t get_image_format_required_size(DataFormat p_format, uint32_t p_width, uint32_t p_height, uint32_t p_depth, uint32_t p_mipmaps, uint32_t *r_blockw = NULL, uint32_t *r_blockh = NULL, uint32_t *r_depth = NULL);
+ static uint32_t get_image_format_required_size(DataFormat p_format, uint32_t p_width, uint32_t p_height, uint32_t p_depth, uint32_t p_mipmaps, uint32_t *r_blockw = nullptr, uint32_t *r_blockh = nullptr, uint32_t *r_depth = nullptr);
static uint32_t get_image_required_mipmaps(uint32_t p_width, uint32_t p_height, uint32_t p_depth);
static bool format_has_stencil(DataFormat p_format);
@@ -207,8 +207,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
VkDescriptorBufferInfo buffer_info; //used for binding
Buffer() {
size = 0;
- buffer = NULL;
- allocation = NULL;
+ buffer = nullptr;
+ allocation = nullptr;
}
};
@@ -260,7 +260,7 @@ class RenderingDeviceVulkan : public RenderingDevice {
}
};
- VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depthcolor_action, int *r_color_attachment_count = NULL);
+ VkRenderPass _render_pass_create(const Vector<AttachmentFormat> &p_format, InitialAction p_initial_action, FinalAction p_final_action, InitialAction p_initial_depth_action, FinalAction p_final_depthcolor_action, int *r_color_attachment_count = nullptr);
// This is a cache and it's never freed, it ensures
// IDs for a given format are always unique.
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 494c64ff55..d3666bca52 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -51,20 +51,20 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(
void *pUserData) {
// This error needs to be ignored because the AMD allocator will mix up memory types on IGP processors.
- if (strstr(pCallbackData->pMessage, "Mapping an image with layout") != NULL &&
- strstr(pCallbackData->pMessage, "can result in undefined behavior if this memory is used by the device") != NULL) {
+ if (strstr(pCallbackData->pMessage, "Mapping an image with layout") != nullptr &&
+ strstr(pCallbackData->pMessage, "can result in undefined behavior if this memory is used by the device") != nullptr) {
return VK_FALSE;
}
// This needs to be ignored because Validator is wrong here.
- if (strstr(pCallbackData->pMessage, "SPIR-V module not valid: Pointer operand") != NULL &&
- strstr(pCallbackData->pMessage, "must be a memory object") != NULL) {
+ if (strstr(pCallbackData->pMessage, "SPIR-V module not valid: Pointer operand") != nullptr &&
+ strstr(pCallbackData->pMessage, "must be a memory object") != nullptr) {
return VK_FALSE;
}
// Workaround for Vulkan-Loader usability bug: https://github.com/KhronosGroup/Vulkan-Loader/issues/262.
- if (strstr(pCallbackData->pMessage, "wrong ELF class: ELFCLASS32") != NULL) {
+ if (strstr(pCallbackData->pMessage, "wrong ELF class: ELFCLASS32") != nullptr) {
return VK_FALSE;
}
- if (pCallbackData->pMessageIdName && strstr(pCallbackData->pMessageIdName, "UNASSIGNED-CoreValidation-DrawState-ClearCmdBeforeDraw") != NULL) {
+ if (pCallbackData->pMessageIdName && strstr(pCallbackData->pMessageIdName, "UNASSIGNED-CoreValidation-DrawState-ClearCmdBeforeDraw") != nullptr) {
return VK_FALSE;
}
@@ -92,7 +92,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanContext::_debug_messenger_callback(
"\n\t\tObject[" + String::num_int64(object) + "]" +
" - " + string_VkObjectType(pCallbackData->pObjects[object].objectType) +
", Handle " + String::num_int64(pCallbackData->pObjects[object].objectHandle);
- if (NULL != pCallbackData->pObjects[object].pObjectName && strlen(pCallbackData->pObjects[object].pObjectName) > 0) {
+ if (nullptr != pCallbackData->pObjects[object].pObjectName && strlen(pCallbackData->pObjects[object].pObjectName) > 0) {
objects_string += ", Name \"" + String(pCallbackData->pObjects[object].pObjectName) + "\"";
}
}
@@ -172,7 +172,7 @@ Error VulkanContext::_create_validation_layers() {
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_core_validation",
"VK_LAYER_GOOGLE_unique_objects" };
VkBool32 validation_found = 0;
- err = vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL);
+ err = vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
const char **instance_validation_layers = instance_validation_layers_alt1;
if (instance_layer_count > 0) {
@@ -222,12 +222,12 @@ Error VulkanContext::_initialize_extensions() {
VkBool32 platformSurfaceExtFound = 0;
memset(extension_names, 0, sizeof(extension_names));
- err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
+ err = vkEnumerateInstanceExtensionProperties(nullptr, &instance_extension_count, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
if (instance_extension_count > 0) {
VkExtensionProperties *instance_extensions = (VkExtensionProperties *)malloc(sizeof(VkExtensionProperties) * instance_extension_count);
- err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, instance_extensions);
+ err = vkEnumerateInstanceExtensionProperties(nullptr, &instance_extension_count, instance_extensions);
if (err) {
free(instance_extensions);
ERR_FAIL_V(ERR_CANT_CREATE);
@@ -286,7 +286,7 @@ Error VulkanContext::_create_physical_device() {
CharString namecs = name.utf8();
const VkApplicationInfo app = {
/*sType*/ VK_STRUCTURE_TYPE_APPLICATION_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*pApplicationName*/ cs.get_data(),
/*applicationVersion*/ 0,
/*pEngineName*/ namecs.get_data(),
@@ -295,7 +295,7 @@ Error VulkanContext::_create_physical_device() {
};
VkInstanceCreateInfo inst_info = {
/*sType*/ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*pApplicationInfo*/ &app,
/*enabledLayerCount*/ enabled_layer_count,
@@ -313,7 +313,7 @@ Error VulkanContext::_create_physical_device() {
if (use_validation_layers) {
// VK_EXT_debug_utils style
dbg_messenger_create_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
- dbg_messenger_create_info.pNext = NULL;
+ dbg_messenger_create_info.pNext = nullptr;
dbg_messenger_create_info.flags = 0;
dbg_messenger_create_info.messageSeverity =
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
@@ -327,7 +327,7 @@ Error VulkanContext::_create_physical_device() {
uint32_t gpu_count;
- VkResult err = vkCreateInstance(&inst_info, NULL, &inst);
+ VkResult err = vkCreateInstance(&inst_info, nullptr, &inst);
ERR_FAIL_COND_V_MSG(err == VK_ERROR_INCOMPATIBLE_DRIVER, ERR_CANT_CREATE,
"Cannot find a compatible Vulkan installable client driver (ICD).\n\n"
"vkCreateInstance Failure");
@@ -342,7 +342,7 @@ Error VulkanContext::_create_physical_device() {
"vkCreateInstance Failure");
/* Make initial call to query gpu_count, then second call for gpu info*/
- err = vkEnumeratePhysicalDevices(inst, &gpu_count, NULL);
+ err = vkEnumeratePhysicalDevices(inst, &gpu_count, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
ERR_FAIL_COND_V_MSG(gpu_count == 0, ERR_CANT_CREATE,
@@ -366,12 +366,12 @@ Error VulkanContext::_create_physical_device() {
enabled_extension_count = 0;
memset(extension_names, 0, sizeof(extension_names));
- err = vkEnumerateDeviceExtensionProperties(gpu, NULL, &device_extension_count, NULL);
+ err = vkEnumerateDeviceExtensionProperties(gpu, nullptr, &device_extension_count, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
if (device_extension_count > 0) {
VkExtensionProperties *device_extensions = (VkExtensionProperties *)malloc(sizeof(VkExtensionProperties) * device_extension_count);
- err = vkEnumerateDeviceExtensionProperties(gpu, NULL, &device_extension_count, device_extensions);
+ err = vkEnumerateDeviceExtensionProperties(gpu, nullptr, &device_extension_count, device_extensions);
if (err) {
free(device_extensions);
ERR_FAIL_V(ERR_CANT_CREATE);
@@ -449,16 +449,16 @@ Error VulkanContext::_create_physical_device() {
(PFN_vkCmdInsertDebugUtilsLabelEXT)vkGetInstanceProcAddr(inst, "vkCmdInsertDebugUtilsLabelEXT");
SetDebugUtilsObjectNameEXT =
(PFN_vkSetDebugUtilsObjectNameEXT)vkGetInstanceProcAddr(inst, "vkSetDebugUtilsObjectNameEXT");
- if (NULL == CreateDebugUtilsMessengerEXT || NULL == DestroyDebugUtilsMessengerEXT ||
- NULL == SubmitDebugUtilsMessageEXT || NULL == CmdBeginDebugUtilsLabelEXT ||
- NULL == CmdEndDebugUtilsLabelEXT || NULL == CmdInsertDebugUtilsLabelEXT ||
- NULL == SetDebugUtilsObjectNameEXT) {
+ if (nullptr == CreateDebugUtilsMessengerEXT || nullptr == DestroyDebugUtilsMessengerEXT ||
+ nullptr == SubmitDebugUtilsMessageEXT || nullptr == CmdBeginDebugUtilsLabelEXT ||
+ nullptr == CmdEndDebugUtilsLabelEXT || nullptr == CmdInsertDebugUtilsLabelEXT ||
+ nullptr == SetDebugUtilsObjectNameEXT) {
ERR_FAIL_V_MSG(ERR_CANT_CREATE,
"GetProcAddr: Failed to init VK_EXT_debug_utils\n"
"GetProcAddr: Failure");
}
- err = CreateDebugUtilsMessengerEXT(inst, &dbg_messenger_create_info, NULL, &dbg_messenger);
+ err = CreateDebugUtilsMessengerEXT(inst, &dbg_messenger_create_info, nullptr, &dbg_messenger);
switch (err) {
case VK_SUCCESS:
break;
@@ -478,7 +478,7 @@ Error VulkanContext::_create_physical_device() {
vkGetPhysicalDeviceProperties(gpu, &gpu_props);
/* Call with NULL data to get count */
- vkGetPhysicalDeviceQueueFamilyProperties(gpu, &queue_family_count, NULL);
+ vkGetPhysicalDeviceQueueFamilyProperties(gpu, &queue_family_count, nullptr);
ERR_FAIL_COND_V(queue_family_count == 0, ERR_CANT_CREATE);
queue_props = (VkQueueFamilyProperties *)malloc(queue_family_count * sizeof(VkQueueFamilyProperties));
@@ -492,7 +492,7 @@ Error VulkanContext::_create_physical_device() {
#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \
{ \
fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \
- ERR_FAIL_COND_V_MSG(fp##entrypoint == NULL, ERR_CANT_CREATE, \
+ ERR_FAIL_COND_V_MSG(fp##entrypoint == nullptr, ERR_CANT_CREATE, \
"vkGetInstanceProcAddr failed to find vk" #entrypoint); \
}
@@ -511,7 +511,7 @@ Error VulkanContext::_create_device() {
float queue_priorities[1] = { 0.0 };
VkDeviceQueueCreateInfo queues[2];
queues[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queues[0].pNext = NULL;
+ queues[0].pNext = nullptr;
queues[0].queueFamilyIndex = graphics_queue_family_index;
queues[0].queueCount = 1;
queues[0].pQueuePriorities = queue_priorities;
@@ -519,12 +519,12 @@ Error VulkanContext::_create_device() {
VkDeviceCreateInfo sdevice = {
/*sType*/ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*queueCreateInfoCount*/ 1,
/*pQueueCreateInfos*/ queues,
/*enabledLayerCount*/ 0,
- /*ppEnabledLayerNames*/ NULL,
+ /*ppEnabledLayerNames*/ nullptr,
/*enabledExtensionCount*/ enabled_extension_count,
/*ppEnabledExtensionNames*/ (const char *const *)extension_names,
/*pEnabledFeatures*/ &physical_device_features, // If specific features are required, pass them in here
@@ -532,14 +532,14 @@ Error VulkanContext::_create_device() {
};
if (separate_present_queue) {
queues[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
- queues[1].pNext = NULL;
+ queues[1].pNext = nullptr;
queues[1].queueFamilyIndex = present_queue_family_index;
queues[1].queueCount = 1;
queues[1].pQueuePriorities = queue_priorities;
queues[1].flags = 0;
sdevice.queueCreateInfoCount = 2;
}
- err = vkCreateDevice(gpu, &sdevice, NULL, &device);
+ err = vkCreateDevice(gpu, &sdevice, nullptr, &device);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
return OK;
}
@@ -593,12 +593,12 @@ Error VulkanContext::_initialize_queues(VkSurfaceKHR surface) {
_create_device();
- static PFN_vkGetDeviceProcAddr g_gdpa = NULL;
+ static PFN_vkGetDeviceProcAddr g_gdpa = nullptr;
#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \
{ \
if (!g_gdpa) g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(inst, "vkGetDeviceProcAddr"); \
fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \
- ERR_FAIL_COND_V_MSG(fp##entrypoint == NULL, ERR_CANT_CREATE, \
+ ERR_FAIL_COND_V_MSG(fp##entrypoint == nullptr, ERR_CANT_CREATE, \
"vkGetDeviceProcAddr failed to find vk" #entrypoint); \
}
@@ -622,7 +622,7 @@ Error VulkanContext::_initialize_queues(VkSurfaceKHR surface) {
// Get the list of VkFormat's that are supported:
uint32_t formatCount;
- VkResult err = fpGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &formatCount, NULL);
+ VkResult err = fpGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &formatCount, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
VkSurfaceFormatKHR *surfFormats = (VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
err = fpGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &formatCount, surfFormats);
@@ -662,7 +662,7 @@ Error VulkanContext::_create_semaphores() {
// rendering and waiting for drawing to be complete before presenting
VkSemaphoreCreateInfo semaphoreCreateInfo = {
/*sType*/ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
};
@@ -670,21 +670,21 @@ Error VulkanContext::_create_semaphores() {
// ahead of the image presents
VkFenceCreateInfo fence_ci = {
/*sType*/ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ VK_FENCE_CREATE_SIGNALED_BIT
};
for (uint32_t i = 0; i < FRAME_LAG; i++) {
- err = vkCreateFence(device, &fence_ci, NULL, &fences[i]);
+ err = vkCreateFence(device, &fence_ci, nullptr, &fences[i]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
- err = vkCreateSemaphore(device, &semaphoreCreateInfo, NULL, &image_acquired_semaphores[i]);
+ err = vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &image_acquired_semaphores[i]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
- err = vkCreateSemaphore(device, &semaphoreCreateInfo, NULL, &draw_complete_semaphores[i]);
+ err = vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &draw_complete_semaphores[i]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
if (separate_present_queue) {
- err = vkCreateSemaphore(device, &semaphoreCreateInfo, NULL, &image_ownership_semaphores[i]);
+ err = vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &image_ownership_semaphores[i]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
}
}
@@ -753,7 +753,7 @@ VkFramebuffer VulkanContext::window_get_framebuffer(DisplayServer::WindowID p_wi
void VulkanContext::window_destroy(DisplayServer::WindowID p_window_id) {
ERR_FAIL_COND(!windows.has(p_window_id));
_clean_up_swap_chain(&windows[p_window_id]);
- vkDestroySurfaceKHR(inst, windows[p_window_id].surface, NULL);
+ vkDestroySurfaceKHR(inst, windows[p_window_id].surface, nullptr);
windows.erase(p_window_id);
}
@@ -765,20 +765,20 @@ Error VulkanContext::_clean_up_swap_chain(Window *window) {
vkDeviceWaitIdle(device);
//this destroys images associated it seems
- fpDestroySwapchainKHR(device, window->swapchain, NULL);
+ fpDestroySwapchainKHR(device, window->swapchain, nullptr);
window->swapchain = VK_NULL_HANDLE;
- vkDestroyRenderPass(device, window->render_pass, NULL);
+ vkDestroyRenderPass(device, window->render_pass, nullptr);
if (window->swapchain_image_resources) {
for (uint32_t i = 0; i < swapchainImageCount; i++) {
- vkDestroyImageView(device, window->swapchain_image_resources[i].view, NULL);
- vkDestroyFramebuffer(device, window->swapchain_image_resources[i].framebuffer, NULL);
+ vkDestroyImageView(device, window->swapchain_image_resources[i].view, nullptr);
+ vkDestroyFramebuffer(device, window->swapchain_image_resources[i].framebuffer, nullptr);
}
free(window->swapchain_image_resources);
- window->swapchain_image_resources = NULL;
+ window->swapchain_image_resources = nullptr;
}
if (separate_present_queue) {
- vkDestroyCommandPool(device, window->present_cmd_pool, NULL);
+ vkDestroyCommandPool(device, window->present_cmd_pool, nullptr);
}
return OK;
}
@@ -796,7 +796,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
uint32_t presentModeCount;
- err = fpGetPhysicalDeviceSurfacePresentModesKHR(gpu, window->surface, &presentModeCount, NULL);
+ err = fpGetPhysicalDeviceSurfacePresentModesKHR(gpu, window->surface, &presentModeCount, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
VkPresentModeKHR *presentModes = (VkPresentModeKHR *)malloc(presentModeCount * sizeof(VkPresentModeKHR));
ERR_FAIL_COND_V(!presentModes, ERR_CANT_CREATE);
@@ -918,7 +918,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
VkSwapchainCreateInfoKHR swapchain_ci = {
/*sType*/ VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*surface*/ window->surface,
/*minImageCount*/ desiredNumOfSwapchainImages,
@@ -932,19 +932,19 @@ Error VulkanContext::_update_swap_chain(Window *window) {
/*imageUsage*/ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
/*imageSharingMode*/ VK_SHARING_MODE_EXCLUSIVE,
/*queueFamilyIndexCount*/ 0,
- /*pQueueFamilyIndices*/ NULL,
+ /*pQueueFamilyIndices*/ nullptr,
/*preTransform*/ (VkSurfaceTransformFlagBitsKHR)preTransform,
/*compositeAlpha*/ compositeAlpha,
/*presentMode*/ swapchainPresentMode,
/*clipped*/ true,
- /*oldSwapchain*/ NULL,
+ /*oldSwapchain*/ nullptr,
};
- err = fpCreateSwapchainKHR(device, &swapchain_ci, NULL, &window->swapchain);
+ err = fpCreateSwapchainKHR(device, &swapchain_ci, nullptr, &window->swapchain);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
uint32_t sp_image_count;
- err = fpGetSwapchainImagesKHR(device, window->swapchain, &sp_image_count, NULL);
+ err = fpGetSwapchainImagesKHR(device, window->swapchain, &sp_image_count, nullptr);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
if (swapchainImageCount == 0) {
@@ -972,7 +972,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
for (uint32_t i = 0; i < swapchainImageCount; i++) {
VkImageViewCreateInfo color_image_view = {
/*sType*/ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*image*/ swapchainImages[i],
/*viewType*/ VK_IMAGE_VIEW_TYPE_2D,
@@ -994,7 +994,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
color_image_view.image = window->swapchain_image_resources[i].image;
- err = vkCreateImageView(device, &color_image_view, NULL, &window->swapchain_image_resources[i].view);
+ err = vkCreateImageView(device, &color_image_view, nullptr, &window->swapchain_image_resources[i].view);
if (err) {
free(swapchainImages);
ERR_FAIL_V(ERR_CANT_CREATE);
@@ -1028,33 +1028,33 @@ Error VulkanContext::_update_swap_chain(Window *window) {
/*flags*/ 0,
/*pipelineBindPoint*/ VK_PIPELINE_BIND_POINT_GRAPHICS,
/*inputAttachmentCount*/ 0,
- /*pInputAttachments*/ NULL,
+ /*pInputAttachments*/ nullptr,
/*colorAttachmentCount*/ 1,
/*pColorAttachments*/ &color_reference,
- /*pResolveAttachments*/ NULL,
- /*pDepthStencilAttachment*/ NULL,
+ /*pResolveAttachments*/ nullptr,
+ /*pDepthStencilAttachment*/ nullptr,
/*preserveAttachmentCount*/ 0,
- /*pPreserveAttachments*/ NULL,
+ /*pPreserveAttachments*/ nullptr,
};
const VkRenderPassCreateInfo rp_info = {
/*sTyp*/ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*attachmentCount*/ 1,
/*pAttachments*/ &attachment,
/*subpassCount*/ 1,
/*pSubpasses*/ &subpass,
/*dependencyCount*/ 0,
- /*pDependencies*/ NULL,
+ /*pDependencies*/ nullptr,
};
- err = vkCreateRenderPass(device, &rp_info, NULL, &window->render_pass);
+ err = vkCreateRenderPass(device, &rp_info, nullptr, &window->render_pass);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
for (uint32_t i = 0; i < swapchainImageCount; i++) {
const VkFramebufferCreateInfo fb_info = {
/*sType*/ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*renderPass*/ window->render_pass,
/*attachmentCount*/ 1,
@@ -1064,7 +1064,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
/*layers*/ 1,
};
- err = vkCreateFramebuffer(device, &fb_info, NULL, &window->swapchain_image_resources[i].framebuffer);
+ err = vkCreateFramebuffer(device, &fb_info, nullptr, &window->swapchain_image_resources[i].framebuffer);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
}
}
@@ -1074,15 +1074,15 @@ Error VulkanContext::_update_swap_chain(Window *window) {
if (separate_present_queue) {
const VkCommandPoolCreateInfo present_cmd_pool_info = {
/*sType*/ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ 0,
/*queueFamilyIndex*/ present_queue_family_index,
};
- err = vkCreateCommandPool(device, &present_cmd_pool_info, NULL, &window->present_cmd_pool);
+ err = vkCreateCommandPool(device, &present_cmd_pool_info, nullptr, &window->present_cmd_pool);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
const VkCommandBufferAllocateInfo present_cmd_info = {
/*sType*/ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*commandPool*/ window->present_cmd_pool,
/*level*/ VK_COMMAND_BUFFER_LEVEL_PRIMARY,
/*commandBufferCount*/ 1,
@@ -1094,16 +1094,16 @@ Error VulkanContext::_update_swap_chain(Window *window) {
const VkCommandBufferBeginInfo cmd_buf_info = {
/*sType*/ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*flags*/ VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT,
- /*pInheritanceInfo*/ NULL,
+ /*pInheritanceInfo*/ nullptr,
};
err = vkBeginCommandBuffer(window->swapchain_image_resources[i].graphics_to_present_cmd, &cmd_buf_info);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
VkImageMemoryBarrier image_ownership_barrier = {
/*sType*/ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*srcAccessMask*/ 0,
/*dstAccessMask*/ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
/*oldLayout*/ VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
@@ -1115,7 +1115,7 @@ Error VulkanContext::_update_swap_chain(Window *window) {
};
vkCmdPipelineBarrier(window->swapchain_image_resources[i].graphics_to_present_cmd, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, NULL, 0, NULL, 1, &image_ownership_barrier);
+ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_ownership_barrier);
err = vkEndCommandBuffer(window->swapchain_image_resources[i].graphics_to_present_cmd);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
}
@@ -1163,16 +1163,16 @@ void VulkanContext::flush(bool p_flush_setup, bool p_flush_pending) {
//use a fence to wait for everything done
VkSubmitInfo submit_info;
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
- submit_info.pWaitDstStageMask = NULL;
+ submit_info.pNext = nullptr;
+ submit_info.pWaitDstStageMask = nullptr;
submit_info.waitSemaphoreCount = 0;
- submit_info.pWaitSemaphores = NULL;
+ submit_info.pWaitSemaphores = nullptr;
submit_info.commandBufferCount = 1;
submit_info.pCommandBuffers = command_buffer_queue.ptr();
submit_info.signalSemaphoreCount = 0;
- submit_info.pSignalSemaphores = NULL;
+ submit_info.pSignalSemaphores = nullptr;
VkResult err = vkQueueSubmit(graphics_queue, 1, &submit_info, VK_NULL_HANDLE);
- command_buffer_queue.write[0] = NULL;
+ command_buffer_queue.write[0] = nullptr;
ERR_FAIL_COND(err);
vkDeviceWaitIdle(device);
}
@@ -1183,14 +1183,14 @@ void VulkanContext::flush(bool p_flush_setup, bool p_flush_pending) {
VkSubmitInfo submit_info;
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
- submit_info.pWaitDstStageMask = NULL;
+ submit_info.pNext = nullptr;
+ submit_info.pWaitDstStageMask = nullptr;
submit_info.waitSemaphoreCount = 0;
- submit_info.pWaitSemaphores = NULL;
+ submit_info.pWaitSemaphores = nullptr;
submit_info.commandBufferCount = command_buffer_count - 1;
submit_info.pCommandBuffers = command_buffer_queue.ptr() + 1;
submit_info.signalSemaphoreCount = 0;
- submit_info.pSignalSemaphores = NULL;
+ submit_info.pSignalSemaphores = nullptr;
VkResult err = vkQueueSubmit(graphics_queue, 1, &submit_info, VK_NULL_HANDLE);
ERR_FAIL_COND(err);
vkDeviceWaitIdle(device);
@@ -1274,10 +1274,10 @@ Error VulkanContext::swap_buffers() {
// engine has fully released ownership to the application, and it is
// okay to render to the image.
- const VkCommandBuffer *commands_ptr = NULL;
+ const VkCommandBuffer *commands_ptr = nullptr;
uint32_t commands_to_submit = 0;
- if (command_buffer_queue[0] == NULL) {
+ if (command_buffer_queue[0] == nullptr) {
//no setup command, but commands to submit, submit from the first and skip command
if (command_buffer_count > 1) {
commands_ptr = command_buffer_queue.ptr() + 1;
@@ -1291,7 +1291,7 @@ Error VulkanContext::swap_buffers() {
VkPipelineStageFlags pipe_stage_flags;
VkSubmitInfo submit_info;
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submit_info.pNext = NULL;
+ submit_info.pNext = nullptr;
submit_info.pWaitDstStageMask = &pipe_stage_flags;
pipe_stage_flags = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
submit_info.waitSemaphoreCount = 1;
@@ -1303,7 +1303,7 @@ Error VulkanContext::swap_buffers() {
err = vkQueueSubmit(graphics_queue, 1, &submit_info, fences[frame_index]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
- command_buffer_queue.write[0] = NULL;
+ command_buffer_queue.write[0] = nullptr;
command_buffer_count = 1;
if (separate_present_queue) {
@@ -1339,13 +1339,13 @@ Error VulkanContext::swap_buffers() {
// otherwise wait for draw complete
VkPresentInfoKHR present = {
/*sType*/ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
- /*pNext*/ NULL,
+ /*pNext*/ nullptr,
/*waitSemaphoreCount*/ 1,
/*pWaitSemaphores*/ (separate_present_queue) ? &image_ownership_semaphores[frame_index] : &draw_complete_semaphores[frame_index],
/*swapchainCount*/ 0,
- /*pSwapchain*/ NULL,
- /*pImageIndices*/ NULL,
- /*pResults*/ NULL,
+ /*pSwapchain*/ nullptr,
+ /*pImageIndices*/ nullptr,
+ /*pResults*/ nullptr,
};
VkSwapchainKHR *pSwapchains = (VkSwapchainKHR *)alloca(sizeof(VkSwapchainKHR *) * windows.size());
@@ -1483,15 +1483,15 @@ VkPhysicalDeviceLimits VulkanContext::get_device_limits() const {
}
VulkanContext::VulkanContext() {
- queue_props = NULL;
+ queue_props = nullptr;
command_buffer_count = 0;
- instance_validation_layers = NULL;
+ instance_validation_layers = nullptr;
use_validation_layers = true;
VK_KHR_incremental_present_enabled = true;
VK_GOOGLE_display_timing_enabled = true;
command_buffer_queue.resize(1); //first one is the setup command always
- command_buffer_queue.write[0] = NULL;
+ command_buffer_queue.write[0] = nullptr;
command_buffer_count = 1;
queues_initialized = false;
diff --git a/drivers/wasapi/SCsub b/drivers/wasapi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/wasapi/SCsub
+++ b/drivers/wasapi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index fa78771993..ab2976f02c 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -54,10 +54,10 @@ const IID IID_IAudioClient = __uuidof(IAudioClient);
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient);
-#define SAFE_RELEASE(memory) \
- if ((memory) != NULL) { \
- (memory)->Release(); \
- (memory) = NULL; \
+#define SAFE_RELEASE(memory) \
+ if ((memory) != nullptr) { \
+ (memory)->Release(); \
+ (memory) = nullptr; \
}
#define REFTIMES_PER_SEC 10000000
@@ -75,11 +75,11 @@ class CMMNotificationClient : public IMMNotificationClient {
public:
CMMNotificationClient() :
_cRef(1),
- _pEnumerator(NULL) {}
+ _pEnumerator(nullptr) {}
virtual ~CMMNotificationClient() {
- if ((_pEnumerator) != NULL) {
+ if ((_pEnumerator) != nullptr) {
(_pEnumerator)->Release();
- (_pEnumerator) = NULL;
+ (_pEnumerator) = nullptr;
}
}
@@ -103,7 +103,7 @@ public:
AddRef();
*ppvInterface = (IMMNotificationClient *)this;
} else {
- *ppvInterface = NULL;
+ *ppvInterface = nullptr;
return E_NOINTERFACE;
}
return S_OK;
@@ -143,23 +143,23 @@ static CMMNotificationClient notif_client;
Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_capture, bool reinit) {
WAVEFORMATEX *pwfex;
- IMMDeviceEnumerator *enumerator = NULL;
- IMMDevice *device = NULL;
+ IMMDeviceEnumerator *enumerator = nullptr;
+ IMMDevice *device = nullptr;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
+ HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
if (p_device->device_name == "Default") {
hr = enumerator->GetDefaultAudioEndpoint(p_capture ? eCapture : eRender, eConsole, &device);
} else {
- IMMDeviceCollection *devices = NULL;
+ IMMDeviceCollection *devices = nullptr;
hr = enumerator->EnumAudioEndpoints(p_capture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &devices);
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
- LPWSTR strId = NULL;
+ LPWSTR strId = nullptr;
bool found = false;
UINT count = 0;
@@ -167,12 +167,12 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN);
for (ULONG i = 0; i < count && !found; i++) {
- IMMDevice *tmp_device = NULL;
+ IMMDevice *tmp_device = nullptr;
hr = devices->Item(i, &tmp_device);
ERR_BREAK(hr != S_OK);
- IPropertyStore *props = NULL;
+ IPropertyStore *props = nullptr;
hr = tmp_device->OpenPropertyStore(STGM_READ, &props);
ERR_BREAK(hr != S_OK);
@@ -202,7 +202,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
CoTaskMemFree(strId);
}
- if (device == NULL) {
+ if (device == nullptr) {
hr = enumerator->GetDefaultAudioEndpoint(p_capture ? eCapture : eRender, eConsole, &device);
}
}
@@ -224,7 +224,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
ERR_PRINT("WASAPI: RegisterEndpointNotificationCallback error");
}
- hr = device->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&p_device->audio_client);
+ hr = device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, (void **)&p_device->audio_client);
SAFE_RELEASE(device)
if (reinit) {
@@ -246,7 +246,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
print_verbose("WASAPI: wBitsPerSample = " + itos(pwfex->wBitsPerSample));
print_verbose("WASAPI: cbSize = " + itos(pwfex->cbSize));
- WAVEFORMATEX *closest = NULL;
+ WAVEFORMATEX *closest = nullptr;
hr = p_device->audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, pwfex, &closest);
if (hr == S_FALSE) {
WARN_PRINT("WASAPI: Mix format is not supported by the Device");
@@ -295,7 +295,7 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c
pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nChannels * (pwfex->wBitsPerSample / 8);
}
- hr = p_device->audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, streamflags, p_capture ? REFTIMES_PER_SEC : 0, 0, pwfex, NULL);
+ hr = p_device->audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, streamflags, p_capture ? REFTIMES_PER_SEC : 0, 0, pwfex, nullptr);
ERR_FAIL_COND_V_MSG(hr != S_OK, ERR_CANT_OPEN, "WASAPI: Initialize failed with error 0x" + String::num_uint64(hr, 16) + ".");
if (p_capture) {
@@ -424,14 +424,14 @@ AudioDriver::SpeakerMode AudioDriverWASAPI::get_speaker_mode() const {
Array AudioDriverWASAPI::audio_device_get_list(bool p_capture) {
Array list;
- IMMDeviceCollection *devices = NULL;
- IMMDeviceEnumerator *enumerator = NULL;
+ IMMDeviceCollection *devices = nullptr;
+ IMMDeviceEnumerator *enumerator = nullptr;
list.push_back(String("Default"));
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
+ HRESULT hr = CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void **)&enumerator);
ERR_FAIL_COND_V(hr != S_OK, Array());
hr = enumerator->EnumAudioEndpoints(p_capture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &devices);
@@ -442,12 +442,12 @@ Array AudioDriverWASAPI::audio_device_get_list(bool p_capture) {
ERR_FAIL_COND_V(hr != S_OK, Array());
for (ULONG i = 0; i < count; i++) {
- IMMDevice *device = NULL;
+ IMMDevice *device = nullptr;
hr = devices->Item(i, &device);
ERR_BREAK(hr != S_OK);
- IPropertyStore *props = NULL;
+ IPropertyStore *props = nullptr;
hr = device->OpenPropertyStore(STGM_READ, &props);
ERR_BREAK(hr != S_OK);
@@ -594,7 +594,7 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
// Check how much frames are available on the WASAPI buffer
UINT32 write_frames = MIN(ad->buffer_frames - cur_frames, avail_frames);
if (write_frames > 0) {
- BYTE *buffer = NULL;
+ BYTE *buffer = nullptr;
hr = ad->audio_output.render_client->GetBuffer(write_frames, &buffer);
if (hr == S_OK) {
@@ -693,7 +693,7 @@ void AudioDriverWASAPI::thread_func(void *p_udata) {
HRESULT hr = ad->audio_input.capture_client->GetNextPacketSize(&packet_length);
if (hr == S_OK) {
while (packet_length != 0) {
- hr = ad->audio_input.capture_client->GetBuffer(&data, &num_frames_available, &flags, NULL, NULL);
+ hr = ad->audio_input.capture_client->GetBuffer(&data, &num_frames_available, &flags, nullptr, nullptr);
ERR_BREAK(hr != S_OK);
// fixme: Only works for floating point atm
@@ -796,7 +796,7 @@ void AudioDriverWASAPI::finish() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
finish_capture_device();
@@ -855,7 +855,7 @@ String AudioDriverWASAPI::capture_get_device() {
AudioDriverWASAPI::AudioDriverWASAPI() {
- thread = NULL;
+ thread = nullptr;
samples_in.clear();
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index 3ea61c6010..01a4666812 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -59,9 +59,9 @@ class AudioDriverWASAPI : public AudioDriver {
String new_device;
AudioDeviceWASAPI() :
- audio_client(NULL),
- render_client(NULL),
- capture_client(NULL),
+ audio_client(nullptr),
+ render_client(nullptr),
+ capture_client(nullptr),
active(false),
format_tag(0),
bits_per_sample(0),
diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub
index 28b315ae66..91e1140b75 100644
--- a/drivers/windows/SCsub
+++ b/drivers/windows/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index cf09f79832..a8618b05d7 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -67,7 +67,7 @@ Error DirAccessWindows::list_dir_begin() {
_cishidden = false;
list_dir_end();
- p->h = FindFirstFileExW((current_dir + "\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0);
+ p->h = FindFirstFileExW((current_dir + "\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, nullptr, 0);
return (p->h == INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK;
}
@@ -175,7 +175,7 @@ Error DirAccessWindows::make_dir(String p_dir) {
p_dir = "\\\\?\\" + p_dir; //done according to
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx
- success = CreateDirectoryW(p_dir.c_str(), NULL);
+ success = CreateDirectoryW(p_dir.c_str(), nullptr);
err = GetLastError();
if (success) {
@@ -206,7 +206,13 @@ String DirAccessWindows::get_current_dir(bool p_include_drive) {
if (p_include_drive) {
return current_dir;
} else {
- return current_dir.right(current_dir.find(":") + 1);
+ if (_get_root_string() == "") {
+ int p = current_dir.find(":");
+ if (p != -1) {
+ return current_dir.right(p + 1);
+ }
+ }
+ return current_dir;
}
}
@@ -269,11 +275,11 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
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)) {
+ if (!GetTempFileNameW(fix_path(get_current_dir()).c_str(), nullptr, 0, tmpfile)) {
return FAILED;
}
- if (!::ReplaceFileW(tmpfile, p_path.c_str(), NULL, 0, NULL, NULL)) {
+ if (!::ReplaceFileW(tmpfile, p_path.c_str(), nullptr, 0, nullptr, nullptr)) {
DeleteFileW(tmpfile);
return FAILED;
}
@@ -343,7 +349,7 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const {
size_t DirAccessWindows::get_space_left() {
uint64_t bytes = 0;
- if (!GetDiskFreeSpaceEx(NULL, (PULARGE_INTEGER)&bytes, NULL, NULL))
+ if (!GetDiskFreeSpaceEx(nullptr, (PULARGE_INTEGER)&bytes, nullptr, nullptr))
return 0;
//this is either 0 or a value in bytes.
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 01d2b8716f..69078b3326 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -117,7 +117,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
errno_t errcode = _wfopen_s(&f, path.c_str(), mode_string);
- if (f == NULL) {
+ if (f == nullptr) {
switch (errcode) {
case ENOENT: {
last_error = ERR_FILE_NOT_FOUND;
@@ -140,7 +140,7 @@ void FileAccessWindows::close() {
return;
fclose(f);
- f = NULL;
+ f = nullptr;
if (save_path != "") {
@@ -164,7 +164,7 @@ void FileAccessWindows::close() {
rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0;
} else {
//atomic replace for existing file
- rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
+ rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), nullptr, 2 | 4, nullptr, nullptr);
}
if (rename_error) {
attempts--;
@@ -196,7 +196,7 @@ String FileAccessWindows::get_path_absolute() const {
bool FileAccessWindows::is_open() const {
- return (f != NULL);
+ return (f != nullptr);
}
void FileAccessWindows::seek(size_t p_position) {
@@ -318,7 +318,7 @@ bool FileAccessWindows::file_exists(const String &p_name) {
//printf("opening file %s\n", p_fname.c_str());
String filename = fix_path(p_name);
_wfopen_s(&g, filename.c_str(), L"rb");
- if (g == NULL) {
+ if (g == nullptr) {
return false;
} else {
@@ -354,7 +354,7 @@ Error FileAccessWindows::_set_unix_permissions(const String &p_file, uint32_t p_
}
FileAccessWindows::FileAccessWindows() :
- f(NULL),
+ f(nullptr),
flags(0),
prev_op(0),
last_error(OK) {
diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp
index a7f34b64ca..aea2db2603 100644
--- a/drivers/windows/thread_windows.cpp
+++ b/drivers/windows/thread_windows.cpp
@@ -64,7 +64,7 @@ Thread *ThreadWindows::create_func_windows(ThreadCreateCallback p_callback, void
ThreadWindows *tr = memnew(ThreadWindows);
tr->callback = p_callback;
tr->user = p_user;
- tr->handle = CreateEvent(NULL, TRUE, FALSE, NULL);
+ tr->handle = CreateEvent(nullptr, TRUE, FALSE, nullptr);
QueueUserWorkItem(thread_callback, tr, WT_EXECUTELONGFUNCTION);
@@ -91,7 +91,7 @@ void ThreadWindows::make_default() {
}
ThreadWindows::ThreadWindows() :
- handle(NULL) {
+ handle(nullptr) {
}
ThreadWindows::~ThreadWindows() {
diff --git a/drivers/winmidi/SCsub b/drivers/winmidi/SCsub
index 4c24925192..4e1b5f2a36 100644
--- a/drivers/winmidi/SCsub
+++ b/drivers/winmidi/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub
index de750525ab..6778ad281e 100644
--- a/drivers/xaudio2/SCsub
+++ b/drivers/xaudio2/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.drivers_sources, "*.cpp")
-env.Append(CPPDEFINES=['XAUDIO2_ENABLED'])
-env.Append(LINKFLAGS=['xaudio2_8.lib'])
+env.Append(CPPDEFINES=["XAUDIO2_ENABLED"])
+env.Append(LINKFLAGS=["xaudio2_8.lib"])
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index 9c7cb4f0f3..120bfa2b36 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -43,7 +43,7 @@ Error AudioDriverXAudio2::init() {
thread_exited = false;
exit_thread = false;
pcm_open = false;
- samples_in = NULL;
+ samples_in = nullptr;
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
// FIXME: speaker_mode seems unused in the Xaudio2 driver so far
@@ -193,11 +193,11 @@ void AudioDriverXAudio2::finish() {
mastering_voice->DestroyVoice();
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
AudioDriverXAudio2::AudioDriverXAudio2() :
- thread(NULL),
+ thread(nullptr),
current_buffer(0) {
wave_format = { 0 };
for (int i = 0; i < AUDIO_BUFFERS; i++) {
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index 108891a288..eb4a6d6e95 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -50,7 +50,7 @@ class AudioDriverXAudio2 : public AudioDriver {
HANDLE buffer_end_event;
XAudio2DriverVoiceCallback() :
- buffer_end_event(CreateEvent(NULL, FALSE, FALSE, NULL)) {}
+ buffer_end_event(CreateEvent(nullptr, FALSE, FALSE, nullptr)) {}
void STDMETHODCALLTYPE OnBufferEnd(void *pBufferContext) {
SetEvent(buffer_end_event);
}
diff --git a/editor/SCsub b/editor/SCsub
index 61562d70d3..13ae85bbf0 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.editor_sources = []
@@ -16,24 +16,24 @@ def _make_doc_data_class_path(to_path):
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");
+ 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('\t{"' + c + '", "' + env.doc_class_path[c] + '"},\n')
+ g.write("\t{nullptr, nullptr}\n")
g.write("};\n")
g.close()
-if env['tools']:
+if env["tools"]:
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
- reg_exporters = 'void register_exporters() {\n'
+ reg_exporters = "void register_exporters() {\n"
for e in env.platform_exporters:
env.add_source_files(env.editor_sources, "#platform/" + e + "/export/export.cpp")
- reg_exporters += '\tregister_' + e + '_exporter();\n'
+ reg_exporters += "\tregister_" + e + "_exporter();\n"
reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
- reg_exporters += '}\n'
+ reg_exporters += "}\n"
# NOTE: It is safe to generate this file here, since this is still executed serially
with open("register_exporters.gen.cpp", "w", encoding="utf-8") as f:
@@ -50,12 +50,12 @@ if env['tools']:
for d in doc_dirs:
try:
- for f in os.listdir(os.path.join(env.Dir('#').abspath, d)):
+ for f in os.listdir(os.path.join(env.Dir("#").abspath, d)):
docs.append("#" + os.path.join(d, f))
except OSError:
pass
- _make_doc_data_class_path(os.path.join(env.Dir('#').abspath, "editor"))
+ _make_doc_data_class_path(os.path.join(env.Dir("#").abspath, "editor"))
docs = sorted(docs)
env.Depends("#editor/doc_data_compressed.gen.h", docs)
@@ -63,32 +63,36 @@ if env['tools']:
import glob
- path = env.Dir('.').abspath
+ path = env.Dir(".").abspath
# Editor translations
tlist = glob.glob(path + "/translations/*.po")
- env.Depends('#editor/editor_translations.gen.h', tlist)
- env.CommandNoCache('#editor/editor_translations.gen.h', tlist, run_in_subprocess(editor_builders.make_editor_translations_header))
+ env.Depends("#editor/editor_translations.gen.h", tlist)
+ env.CommandNoCache(
+ "#editor/editor_translations.gen.h", tlist, run_in_subprocess(editor_builders.make_editor_translations_header)
+ )
# Documentation translations
tlist = glob.glob(env.Dir("#doc").abspath + "/translations/*.po")
- env.Depends('#editor/doc_translations.gen.h', tlist)
- env.CommandNoCache('#editor/doc_translations.gen.h', tlist, run_in_subprocess(editor_builders.make_doc_translations_header))
+ env.Depends("#editor/doc_translations.gen.h", tlist)
+ env.CommandNoCache(
+ "#editor/doc_translations.gen.h", tlist, run_in_subprocess(editor_builders.make_doc_translations_header)
+ )
# Fonts
flist = glob.glob(path + "/../thirdparty/fonts/*.ttf")
flist.extend(glob.glob(path + "/../thirdparty/fonts/*.otf"))
flist.sort()
- env.Depends('#editor/builtin_fonts.gen.h', flist)
- env.CommandNoCache('#editor/builtin_fonts.gen.h', flist, run_in_subprocess(editor_builders.make_fonts_header))
+ env.Depends("#editor/builtin_fonts.gen.h", flist)
+ env.CommandNoCache("#editor/builtin_fonts.gen.h", flist, run_in_subprocess(editor_builders.make_fonts_header))
env.add_source_files(env.editor_sources, "*.cpp")
- SConscript('debugger/SCsub')
- SConscript('fileserver/SCsub')
- SConscript('icons/SCsub')
- SConscript('import/SCsub')
- SConscript('plugins/SCsub')
+ SConscript("debugger/SCsub")
+ SConscript("fileserver/SCsub")
+ SConscript("icons/SCsub")
+ SConscript("import/SCsub")
+ SConscript("plugins/SCsub")
lib = env.add_library("editor", env.editor_sources)
env.Prepend(LIBS=[lib])
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index f3e3025e81..e6a020bf41 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -277,7 +277,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
{
NodePath path = animation->track_get_path(track);
- Node *node = NULL;
+ Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
@@ -1162,11 +1162,11 @@ void AnimationBezierTrackEdit::_bind_methods() {
}
AnimationBezierTrackEdit::AnimationBezierTrackEdit() {
- undo_redo = NULL;
- timeline = NULL;
- root = NULL;
- menu = NULL;
- block_animation_update_ptr = NULL;
+ undo_redo = nullptr;
+ timeline = nullptr;
+ root = nullptr;
+ menu = nullptr;
+ block_animation_update_ptr = nullptr;
moving_selection_attempt = false;
moving_selection = false;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 4f06a753a7..b393ff5fd4 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -242,7 +242,7 @@ public:
args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
} else {
- args.write[idx] = Variant::construct(t, NULL, 0, err);
+ args.write[idx] = Variant::construct(t, nullptr, 0, err);
}
change_notify_deserved = true;
d_new["args"] = args;
@@ -693,7 +693,7 @@ public:
key_ofs = 0;
track = -1;
setting = false;
- root_path = NULL;
+ root_path = nullptr;
}
};
@@ -905,7 +905,7 @@ public:
args.write[idx] = Variant::construct(t, (const Variant **)ptrs, 1, err);
} else {
- args.write[idx] = Variant::construct(t, NULL, 0, err);
+ args.write[idx] = Variant::construct(t, nullptr, 0, err);
}
change_notify_deserved = true;
d_new["args"] = args;
@@ -1389,7 +1389,7 @@ public:
AnimationMultiTrackKeyEdit() {
use_fps = false;
setting = false;
- root_path = NULL;
+ root_path = nullptr;
}
};
@@ -1859,7 +1859,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
use_fps = false;
editing = false;
name_limit = 150 * EDSCALE;
- zoom = NULL;
+ zoom = nullptr;
play_position_pos = 0;
play_position = memnew(Control);
@@ -1958,7 +1958,7 @@ void AnimationTrackEdit::_notification(int p_what) {
ofs += type_icon->get_width() + hsep;
NodePath path = animation->track_get_path(track);
- Node *node = NULL;
+ Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
}
@@ -2483,7 +2483,7 @@ bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant
Vector<StringName> leftover_path;
Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
- Object *obj = NULL;
+ Object *obj = nullptr;
if (res.is_valid()) {
obj = res.ptr();
} else if (node) {
@@ -3090,12 +3090,12 @@ void AnimationTrackEdit::_bind_methods() {
}
AnimationTrackEdit::AnimationTrackEdit() {
- undo_redo = NULL;
- timeline = NULL;
- root = NULL;
- path = NULL;
- path_popup = NULL;
- menu = NULL;
+ undo_redo = nullptr;
+ timeline = nullptr;
+ root = nullptr;
+ path = nullptr;
+ path_popup = nullptr;
+ menu = nullptr;
clicking_on_name = false;
dropping_at = 0;
@@ -3140,7 +3140,7 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_value_track_edit(Object *p_
Callable::CallError ce;
return Object::cast_to<AnimationTrackEdit>(get_script_instance()->call("create_value_track_edit", (const Variant **)&argptrs, 6, ce).operator Object *());
}
- return NULL;
+ return nullptr;
}
AnimationTrackEdit *AnimationTrackEditPlugin::create_audio_track_edit() {
@@ -3148,14 +3148,14 @@ 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;
+ return nullptr;
}
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;
+ return nullptr;
}
///////////////////////////////////////
@@ -3304,7 +3304,7 @@ Ref<Animation> AnimationTrackEditor::get_current_animation() const {
}
void AnimationTrackEditor::_root_removed(Node *p_root) {
- root = NULL;
+ root = nullptr;
}
void AnimationTrackEditor::set_root(Node *p_root) {
@@ -3902,7 +3902,7 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
return PropertyInfo();
}
-static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool *r_valid = NULL) {
+static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool *r_valid = nullptr) {
Vector<String> subindices;
if (r_valid) {
*r_valid = true;
@@ -4123,7 +4123,7 @@ void AnimationTrackEditor::_update_tracks() {
bool use_filter = selected_filter->is_pressed();
for (int i = 0; i < animation->get_track_count(); i++) {
- AnimationTrackEdit *track_edit = NULL;
+ AnimationTrackEdit *track_edit = nullptr;
//find hint and info for plugin
@@ -4184,7 +4184,7 @@ void AnimationTrackEditor::_update_tracks() {
if (animation->track_get_type(i) == Animation::TYPE_ANIMATION) {
NodePath path = animation->track_get_path(i);
- Node *node = NULL;
+ Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
}
@@ -4199,7 +4199,7 @@ void AnimationTrackEditor::_update_tracks() {
}
}
- if (track_edit == NULL) {
+ if (track_edit == nullptr) {
//no valid plugin_found
track_edit = memnew(AnimationTrackEdit);
}
@@ -4752,7 +4752,7 @@ void AnimationTrackEditor::_add_method_key(const String &p_method) {
params.push_back(arg);
} else {
Callable::CallError ce;
- Variant arg = Variant::construct(E->get().arguments[i].type, NULL, 0, ce);
+ Variant arg = Variant::construct(E->get().arguments[i].type, nullptr, 0, ce);
params.push_back(arg);
}
}
@@ -4838,21 +4838,21 @@ void AnimationTrackEditor::_clear_key_edit() {
if (key_edit) {
//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);
+ EditorNode::get_singleton()->push_item(nullptr);
}
//then actually delete it
memdelete(key_edit);
- key_edit = NULL;
+ key_edit = nullptr;
}
if (multi_key_edit) {
if (EditorNode::get_singleton()->get_inspector()->get_edited_object() == multi_key_edit) {
- EditorNode::get_singleton()->push_item(NULL);
+ EditorNode::get_singleton()->push_item(nullptr);
}
memdelete(multi_key_edit);
- multi_key_edit = NULL;
+ multi_key_edit = nullptr;
}
}
@@ -5264,7 +5264,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
for (int i = 0; i < animation->get_track_count(); i++) {
NodePath path = animation->track_get_path(i);
- Node *node = NULL;
+ Node *node = nullptr;
if (root && root->has_node(path)) {
node = root->get_node(path);
@@ -5361,7 +5361,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
undo_redo->create_action(TTR("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;
+ Node *exists = nullptr;
NodePath path = track_clipboard[i].base_path;
if (root) {
@@ -5607,7 +5607,7 @@ void AnimationTrackEditor::_cleanup_animation(Ref<Animation> p_animation) {
bool prop_exists = false;
Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
+ Object *obj = nullptr;
RES res;
Vector<StringName> leftover_path;
@@ -5753,7 +5753,7 @@ void AnimationTrackEditor::_bind_methods() {
}
AnimationTrackEditor::AnimationTrackEditor() {
- root = NULL;
+ root = nullptr;
undo_redo = EditorNode::get_singleton()->get_undo_redo();
@@ -5945,8 +5945,8 @@ AnimationTrackEditor::AnimationTrackEditor() {
icvb->add_child(insert_confirm_bezier);
keying = false;
moving_selection = 0;
- key_edit = NULL;
- multi_key_edit = NULL;
+ key_edit = nullptr;
+ multi_key_edit = nullptr;
box_selection = memnew(Control);
add_child(box_selection);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 7c4cc6db53..96a60cc135 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -379,7 +379,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _root_removed(Node *p_root);
- PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = NULL);
+ PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr);
void _timeline_value_changed(double);
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index 4467366c3f..695c294ad2 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -1335,7 +1335,7 @@ AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_value_track_edit(Obj
return memnew(AnimationTrackEditColor);
}
- return NULL;
+ return nullptr;
}
AnimationTrackEdit *AnimationTrackEditDefaultPlugin::create_audio_track_edit() {
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index f14b12b132..9f6785ec06 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -43,7 +43,7 @@ Variant ArrayPropertyEdit::get_array() const {
Variant arr = o->get(property);
if (!arr.is_array()) {
Callable::CallError ce;
- arr = Variant::construct(default_type, NULL, 0, ce);
+ arr = Variant::construct(default_type, nullptr, 0, ce);
}
return arr;
}
@@ -110,7 +110,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
new_type = arr.get(size - 1).get_type();
}
if (new_type != Variant::NIL) {
- init = Variant::construct(new_type, NULL, 0, ce);
+ init = Variant::construct(new_type, nullptr, 0, ce);
for (int i = size; i < newsize; i++) {
ur->add_do_method(this, "_set_value", i, init);
}
@@ -140,7 +140,7 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
Variant value = arr.get(idx);
if (value.get_type() != type && type >= 0 && type < Variant::VARIANT_MAX) {
Callable::CallError ce;
- Variant new_value = Variant::construct(Variant::Type(type), NULL, 0, ce);
+ Variant new_value = Variant::construct(Variant::Type(type), nullptr, 0, ce);
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("Change Array Value Type"));
diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp
index 64d435a901..fe28c913a7 100644
--- a/editor/audio_stream_preview.cpp
+++ b/editor/audio_stream_preview.cpp
@@ -212,7 +212,7 @@ void AudioStreamPreviewGenerator::_bind_methods() {
ADD_SIGNAL(MethodInfo("preview_updated", PropertyInfo(Variant::INT, "obj_id")));
}
-AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = NULL;
+AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr;
void AudioStreamPreviewGenerator::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
@@ -221,7 +221,7 @@ void AudioStreamPreviewGenerator::_notification(int p_what) {
if (!E->get().generating) {
if (E->get().thread) {
Thread::wait_to_finish(E->get().thread);
- E->get().thread = NULL;
+ E->get().thread = nullptr;
}
if (!ObjectDB::get_instance(E->key())) { //no longer in use, get rid of preview
to_erase.push_back(E->key());
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 26bc6dfaf2..157a9cdca7 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -82,7 +82,7 @@ GotoLineDialog::GotoLineDialog() {
line = memnew(LineEdit);
vbc->add_child(line);
register_text_enter(line);
- text_editor = NULL;
+ text_editor = nullptr;
set_hide_on_ok(false);
}
@@ -1656,7 +1656,7 @@ void CodeTextEditor::update_toggle_scripts_button() {
CodeTextEditor::CodeTextEditor() {
- code_complete_func = NULL;
+ code_complete_func = nullptr;
ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL);
ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS);
ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD | KEY_0);
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 7f03fd30f0..bef5c3c2b0 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -40,7 +40,7 @@
static Node *_find_first_script(Node *p_root, Node *p_node) {
if (p_node != p_root && p_node->get_owner() != p_root) {
- return NULL;
+ return nullptr;
}
if (!p_node->get_script().is_null()) {
return p_node;
@@ -54,7 +54,7 @@ static Node *_find_first_script(Node *p_root, Node *p_node) {
}
}
- return NULL;
+ return nullptr;
}
class ConnectDialogBinds : public Object {
@@ -315,7 +315,7 @@ void ConnectDialog::init(ConnectionData c, bool bEdit) {
source = static_cast<Node *>(c.source);
signal = c.signal;
- tree->set_selected(NULL);
+ tree->set_selected(nullptr);
tree->set_marked(source, true);
if (c.target) {
@@ -574,7 +574,7 @@ void ConnectionsDock::_make_or_edit_connection() {
}
// IMPORTANT NOTE: _disconnect and _connect cause an update_tree, which will delete the object "it" is pointing to.
- it = NULL;
+ it = nullptr;
if (add_script_function) {
editor->emit_signal("script_add_function_request", target, cToMake.method, script_function_args);
@@ -924,7 +924,7 @@ void ConnectionsDock::update_tree() {
icon = get_theme_icon("Object", "EditorIcons");
}
- TreeItem *pitem = NULL;
+ TreeItem *pitem = nullptr;
if (node_signals2.size()) {
pitem = tree->create_item(root);
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 8f29a4f720..91d0d5c32c 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -203,7 +203,7 @@ public:
void set_node(Node *p_node);
void update_tree();
- ConnectionsDock(EditorNode *p_editor = NULL);
+ ConnectionsDock(EditorNode *p_editor = nullptr);
~ConnectionsDock();
};
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 6210b580ba..6cbb1b1791 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -314,7 +314,7 @@ void CreateDialog::_update_search() {
root->set_icon(0, search_options->get_theme_icon(base_type, "EditorIcons"));
}
- TreeItem *to_select = search_box->get_text() == base_type ? root : NULL;
+ TreeItem *to_select = search_box->get_text() == base_type ? root : nullptr;
for (List<StringName>::Element *I = type_list.front(); I; I = I->next()) {
@@ -417,7 +417,7 @@ void CreateDialog::_update_search() {
favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1);
}
- get_ok()->set_disabled(root->get_children() == NULL);
+ get_ok()->set_disabled(root->get_children() == nullptr);
}
void CreateDialog::_confirmed() {
@@ -538,7 +538,7 @@ Object *CreateDialog::instance_selected() {
}
}
- return NULL;
+ return nullptr;
}
void CreateDialog::_item_selected() {
diff --git a/editor/debugger/SCsub b/editor/debugger/SCsub
index 2b1e889fb0..359d04e5df 100644
--- a/editor/debugger/SCsub
+++ b/editor/debugger/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp
index 9587daf93e..00ed2bbc4c 100644
--- a/editor/debugger/editor_debugger_inspector.cpp
+++ b/editor/debugger/editor_debugger_inspector.cpp
@@ -125,7 +125,7 @@ void EditorDebuggerInspector::_object_selected(ObjectID p_object) {
}
ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
- EditorDebuggerRemoteObject *debugObj = NULL;
+ EditorDebuggerRemoteObject *debugObj = nullptr;
SceneDebuggerObject obj;
obj.deserialize(p_arr);
@@ -211,7 +211,7 @@ void EditorDebuggerInspector::clear_cache() {
for (Map<ObjectID, EditorDebuggerRemoteObject *>::Element *E = remote_objects.front(); E; E = E->next()) {
EditorNode *editor = EditorNode::get_singleton();
if (editor->get_editor_history()->get_current() == E->value()->get_instance_id()) {
- editor->push_item(NULL);
+ editor->push_item(nullptr);
}
memdelete(E->value());
}
@@ -221,7 +221,7 @@ void EditorDebuggerInspector::clear_cache() {
Object *EditorDebuggerInspector::get_object(ObjectID p_id) {
if (remote_objects.has(p_id))
return remote_objects[p_id];
- return NULL;
+ return nullptr;
}
void EditorDebuggerInspector::add_stack_variable(const Array &p_array) {
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 5c9b977247..3302b50103 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -47,7 +47,7 @@ void _for_all(TabContainer *p_node, const Func &p_func) {
}
}
-EditorDebuggerNode *EditorDebuggerNode::singleton = NULL;
+EditorDebuggerNode *EditorDebuggerNode::singleton = nullptr;
EditorDebuggerNode::EditorDebuggerNode() {
if (!singleton)
@@ -291,13 +291,13 @@ void EditorDebuggerNode::_notification(int p_what) {
// Take connections.
if (server->is_connection_available()) {
- ScriptEditorDebugger *debugger = NULL;
+ ScriptEditorDebugger *debugger = nullptr;
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
if (debugger || dbg->is_session_active())
return;
debugger = dbg;
});
- if (debugger == NULL) {
+ if (debugger == nullptr) {
if (tabs->get_tab_count() <= 4) { // Max 4 debugging sessions active.
debugger = _add_debugger();
} else {
@@ -356,7 +356,7 @@ void EditorDebuggerNode::_debugger_changed(int p_tab) {
if (get_inspected_remote_object()) {
// Clear inspected object, you can only inspect objects in selected debugger.
// Hopefully, in the future, we will have one inspector per debugger.
- EditorNode::get_singleton()->push_item(NULL);
+ EditorNode::get_singleton()->push_item(nullptr);
}
if (remote_scene_tree->is_visible_in_tree()) {
get_current_debugger()->request_remote_tree();
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 6181ccdb5f..9467442c9a 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -85,9 +85,9 @@ private:
};
Ref<EditorDebuggerServer> server;
- TabContainer *tabs = NULL;
- Button *debugger_button = NULL;
- MenuButton *script_menu = NULL;
+ TabContainer *tabs = nullptr;
+ Button *debugger_button = nullptr;
+ MenuButton *script_menu = nullptr;
Ref<Script> stack_script; // Why?!?
@@ -95,7 +95,7 @@ private:
int last_warning_count = 0;
float inspect_edited_object_timeout = 0;
- EditorDebuggerTree *remote_scene_tree = NULL;
+ EditorDebuggerTree *remote_scene_tree = nullptr;
float remote_scene_tree_timeout = 0.0;
bool auto_switch_remote_scene_tree = false;
bool debug_with_external_editor = false;
diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp
index 427b929ccb..c2b94c79bb 100644
--- a/editor/debugger/editor_debugger_tree.cpp
+++ b/editor/debugger/editor_debugger_tree.cpp
@@ -135,7 +135,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int
// Nodes are in a flatten list, depth first. Use a stack of parents, avoid recursion.
List<Pair<TreeItem *, int>> parents;
for (int i = 0; i < p_tree->nodes.size(); i++) {
- TreeItem *parent = NULL;
+ TreeItem *parent = nullptr;
if (parents.size()) { // Find last parent.
Pair<TreeItem *, int> &p = parents[0];
parent = p.first;
@@ -191,7 +191,7 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int
// Check if parent expects more children.
for (int j = 0; j < parents.size(); j++) {
if (parents[j].first == item) {
- parent = NULL;
+ parent = nullptr;
break; // Might have more children.
}
}
@@ -211,7 +211,7 @@ String EditorDebuggerTree::get_selected_path() {
String EditorDebuggerTree::_get_path(TreeItem *p_item) {
ERR_FAIL_COND_V(!p_item, "");
- if (p_item->get_parent() == NULL) {
+ if (p_item->get_parent() == nullptr) {
return "/root";
}
String text = p_item->get_text(0);
diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h
index d9084bc596..342eb23194 100644
--- a/editor/debugger/editor_debugger_tree.h
+++ b/editor/debugger/editor_debugger_tree.h
@@ -50,8 +50,8 @@ private:
int debugger_id = 0;
bool updating_scene_tree = false;
Set<ObjectID> unfold_cache;
- PopupMenu *item_menu = NULL;
- EditorFileDialog *file_dialog = NULL;
+ PopupMenu *item_menu = nullptr;
+ EditorFileDialog *file_dialog = nullptr;
String _get_path(TreeItem *p_item);
void _scene_tree_folded(Object *p_obj);
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index bdb1ebd4d7..1971abadc4 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -138,7 +138,7 @@ void ScriptEditorDebugger::update_tabs() {
}
void ScriptEditorDebugger::clear_style() {
- tabs->add_theme_style_override("panel", NULL);
+ tabs->add_theme_style_override("panel", nullptr);
}
void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) {
@@ -923,7 +923,7 @@ void ScriptEditorDebugger::stop() {
res_path_cache.clear();
profiler_signature.clear();
- inspector->edit(NULL);
+ inspector->edit(nullptr);
_update_buttons_state();
}
@@ -973,7 +973,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() {
msg.push_back(frame);
_put_msg("get_stack_frame_vars", msg);
} else {
- inspector->edit(NULL);
+ inspector->edit(nullptr);
}
}
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index 7944d7cb99..9cb7dc2edf 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -107,7 +107,7 @@ private:
Button *docontinue;
// Reference to "Remote" tab in scene tree. Needed by _live_edit_set and buttons state.
// Each debugger should have it's tree in the future I guess.
- const Tree *editor_remote_tree = NULL;
+ const Tree *editor_remote_tree = nullptr;
List<Vector<float>> perf_history;
Vector<float> perf_max;
@@ -255,7 +255,7 @@ public:
bool is_skip_breakpoints();
virtual Size2 get_minimum_size() const;
- ScriptEditorDebugger(EditorNode *p_editor = NULL);
+ ScriptEditorDebugger(EditorNode *p_editor = nullptr);
~ScriptEditorDebugger();
};
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 8ba706d4b3..2302fb0780 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -592,7 +592,7 @@ void DependencyErrorDialog::show(Mode p_mode, const String &p_for_file, const Ve
set_title(TTR("Error loading:") + " " + p_for_file.get_file());
files->clear();
- TreeItem *root = files->create_item(NULL);
+ TreeItem *root = files->create_item(nullptr);
for (int i = 0; i < report.size(); i++) {
String dep;
@@ -674,7 +674,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
for (int i = 0; i < efsd->get_subdir_count(); i++) {
- TreeItem *dir_item = NULL;
+ TreeItem *dir_item = nullptr;
if (p_parent) {
dir_item = files->create_item(p_parent);
dir_item->set_text(0, efsd->get_subdir(i)->get_name());
@@ -730,7 +730,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
void OrphanResourcesDialog::refresh() {
HashMap<String, int> refs;
- _fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, NULL);
+ _fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, nullptr);
files->clear();
TreeItem *root = files->create_item();
_fill_owners(EditorFileSystem::get_singleton()->get_filesystem(), refs, root);
diff --git a/editor/dictionary_property_edit.cpp b/editor/dictionary_property_edit.cpp
index 82db639379..7169986b14 100644
--- a/editor/dictionary_property_edit.cpp
+++ b/editor/dictionary_property_edit.cpp
@@ -96,7 +96,7 @@ Node *DictionaryPropertyEdit::get_node() {
Object *o = ObjectDB::get_instance(obj);
if (!o)
- return NULL;
+ return nullptr;
return cast_to<Node>(o);
}
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp
index 66134b4428..096be1fe4b 100644
--- a/editor/doc_data.cpp
+++ b/editor/doc_data.cpp
@@ -265,7 +265,7 @@ void DocData::generate(bool p_basic_types) {
List<PropertyInfo>::Element *EO = own_properties.front();
for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
- bool inherited = EO == NULL;
+ bool inherited = EO == nullptr;
if (EO && EO->get() == E->get()) {
inherited = false;
EO = EO->next();
@@ -372,7 +372,7 @@ void DocData::generate(bool p_basic_types) {
if (skip_setter_getter_methods && setters_getters.has(E->get().name)) {
// Don't skip parametric setters and getters, i.e. method which require
// one or more parameters to define what property should be set or retrieved.
- // E.g. CPUParticles::set_param(Parameter param, float value).
+ // E.g. CPUParticles3D::set_param(Parameter param, float value).
if (E->get().arguments.size() == 0 /* getter */ || (E->get().arguments.size() == 1 && E->get().return_val.type == Variant::NIL /* setter */)) {
continue;
}
@@ -534,7 +534,7 @@ void DocData::generate(bool p_basic_types) {
c.name = cname;
Callable::CallError cerror;
- Variant v = Variant::construct(Variant::Type(i), NULL, 0, cerror);
+ Variant v = Variant::construct(Variant::Type(i), nullptr, 0, cerror);
List<MethodInfo> method_list;
v.get_method_list(&method_list);
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 33ee95c2d8..b0bcc2b448 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -100,7 +100,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St
il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
il->add_theme_constant_override("hseparation", 16 * EDSCALE);
while (*names_ptr) {
- il->add_item(String::utf8(*names_ptr++), NULL, false);
+ il->add_item(String::utf8(*names_ptr++), nullptr, false);
}
il->set_max_columns(il->get_item_count() < 4 || single_column ? 1 : 16);
vbc->add_child(il);
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index d61fe8f08a..74c4102003 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -85,7 +85,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
package_path = p_path;
Set<String> files_sorted;
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(p_path.utf8().get_data(), &io);
@@ -102,7 +102,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
//get filename
unz_file_info info;
char fname[16384];
- unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String name = fname;
files_sorted.insert(name);
@@ -212,7 +212,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
void EditorAssetInstaller::ok_pressed() {
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(package_path.utf8().get_data(), &io);
@@ -234,7 +234,7 @@ void EditorAssetInstaller::ok_pressed() {
//get filename
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String name = fname;
@@ -297,10 +297,10 @@ void EditorAssetInstaller::ok_pressed() {
}
msg += failed_files[i];
}
- if (EditorNode::get_singleton() != NULL)
+ if (EditorNode::get_singleton() != nullptr)
EditorNode::get_singleton()->show_warning(msg);
} else {
- if (EditorNode::get_singleton() != NULL)
+ if (EditorNode::get_singleton() != nullptr)
EditorNode::get_singleton()->show_warning(TTR("Package installed successfully!"), TTR("Success!"));
}
EditorFileSystem::get_singleton()->scan_changes();
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 55bdd2070b..7e499facd5 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -1007,7 +1007,7 @@ void EditorAudioBuses::_update_buses() {
memdelete(bus_hb->get_child(0));
}
- drop_end = NULL;
+ drop_end = nullptr;
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
@@ -1045,7 +1045,7 @@ void EditorAudioBuses::_notification(int p_what) {
if (drop_end) {
drop_end->queue_delete();
- drop_end = NULL;
+ drop_end = nullptr;
}
} break;
case NOTIFICATION_PROCESS: {
@@ -1296,7 +1296,7 @@ void EditorAudioBuses::_bind_methods() {
EditorAudioBuses::EditorAudioBuses() {
- drop_end = NULL;
+ drop_end = nullptr;
top_hb = memnew(HBoxContainer);
add_child(top_hb);
@@ -1402,7 +1402,7 @@ void AudioBusesEditorPlugin::edit(Object *p_node) {
bool AudioBusesEditorPlugin::handles(Object *p_node) const {
- return (Object::cast_to<AudioBusLayout>(p_node) != NULL);
+ return (Object::cast_to<AudioBusLayout>(p_node) != nullptr);
}
void AudioBusesEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 72098c7232..be1551629d 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -133,7 +133,7 @@ public:
void update_bus();
void update_send();
- EditorAudioBus(EditorAudioBuses *p_buses = NULL, bool p_is_master = false);
+ EditorAudioBus(EditorAudioBuses *p_buses = nullptr, bool p_is_master = false);
};
class EditorAudioBusDrop : public Control {
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index a6a383ba58..ed628ff620 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -240,7 +240,7 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu
case BUTTON_MOVE_UP:
case BUTTON_MOVE_DOWN: {
- TreeItem *swap = NULL;
+ TreeItem *swap = nullptr;
if (p_button == BUTTON_MOVE_UP) {
swap = ti->get_prev();
@@ -326,7 +326,7 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
void EditorAutoloadSettings::_autoload_text_entered(const String p_name) {
- if (autoload_add_path->get_line_edit()->get_text() != "" && _autoload_name_is_valid(p_name, NULL)) {
+ if (autoload_add_path->get_line_edit()->get_text() != "" && _autoload_name_is_valid(p_name, nullptr)) {
_autoload_add();
}
}
@@ -334,19 +334,19 @@ void EditorAutoloadSettings::_autoload_text_entered(const String p_name) {
void EditorAutoloadSettings::_autoload_path_text_changed(const String p_path) {
add_autoload->set_disabled(
- p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), NULL));
+ p_path == "" || !_autoload_name_is_valid(autoload_add_name->get_text(), nullptr));
}
void EditorAutoloadSettings::_autoload_text_changed(const String p_name) {
add_autoload->set_disabled(
- autoload_add_path->get_line_edit()->get_text() == "" || !_autoload_name_is_valid(p_name, NULL));
+ autoload_add_path->get_line_edit()->get_text() == "" || !_autoload_name_is_valid(p_name, nullptr));
}
Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
RES res = ResourceLoader::load(p_path);
- ERR_FAIL_COND_V_MSG(res.is_null(), NULL, "Can't autoload: " + p_path + ".");
- Node *n = NULL;
+ ERR_FAIL_COND_V_MSG(res.is_null(), nullptr, "Can't autoload: " + p_path + ".");
+ Node *n = nullptr;
if (res->is_class("PackedScene")) {
Ref<PackedScene> ps = res;
n = ps->instance();
@@ -354,17 +354,17 @@ Node *EditorAutoloadSettings::_create_autoload(const String &p_path) {
Ref<Script> s = res;
StringName ibt = s->get_instance_base_type();
bool valid_type = ClassDB::is_parent_class(ibt, "Node");
- ERR_FAIL_COND_V_MSG(!valid_type, NULL, "Script does not inherit a Node: " + p_path + ".");
+ ERR_FAIL_COND_V_MSG(!valid_type, nullptr, "Script does not inherit a Node: " + p_path + ".");
Object *obj = ClassDB::instance(ibt);
- ERR_FAIL_COND_V_MSG(obj == NULL, NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + ".");
+ ERR_FAIL_COND_V_MSG(obj == nullptr, nullptr, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + ".");
n = Object::cast_to<Node>(obj);
n->set_script(s);
}
- ERR_FAIL_COND_V_MSG(!n, NULL, "Path in autoload not a node or script: " + p_path + ".");
+ ERR_FAIL_COND_V_MSG(!n, nullptr, "Path in autoload not a node or script: " + p_path + ".");
return n;
}
@@ -429,7 +429,7 @@ void EditorAutoloadSettings::update_autoload() {
to_remove.erase(name);
need_to_add = false;
} else {
- info.node = NULL;
+ info.node = nullptr;
}
}
}
@@ -474,7 +474,7 @@ void EditorAutoloadSettings::update_autoload() {
if (info.node) {
info.node->queue_delete();
- info.node = NULL;
+ info.node = nullptr;
}
}
@@ -505,7 +505,7 @@ void EditorAutoloadSettings::update_autoload() {
if (!info->in_editor && !info->is_singleton) {
// No reason to keep this node
memdelete(info->node);
- info->node = NULL;
+ info->node = nullptr;
}
}
@@ -523,7 +523,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control
PackedStringArray autoloads;
- TreeItem *next = tree->get_next_selected(NULL);
+ TreeItem *next = tree->get_next_selected(nullptr);
while (next) {
autoloads.push_back(next->get_text(0));
@@ -604,7 +604,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &
int order = ProjectSettings::get_singleton()->get_order("autoload/" + name);
AutoLoadInfo aux;
- List<AutoLoadInfo>::Element *E = NULL;
+ List<AutoLoadInfo>::Element *E = nullptr;
if (!move_to_back) {
aux.order = order;
@@ -805,9 +805,9 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
}
- if (!info.is_singleton && !info.in_editor && info.node != NULL) {
+ if (!info.is_singleton && !info.in_editor && info.node != nullptr) {
memdelete(info.node);
- info.node = NULL;
+ info.node = nullptr;
}
}
diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h
index 653a1b0a78..2716442ec9 100644
--- a/editor/editor_autoload_settings.h
+++ b/editor/editor_autoload_settings.h
@@ -63,7 +63,7 @@ class EditorAutoloadSettings : public VBoxContainer {
AutoLoadInfo() {
is_singleton = false;
in_editor = false;
- node = NULL;
+ node = nullptr;
}
};
@@ -78,7 +78,7 @@ class EditorAutoloadSettings : public VBoxContainer {
LineEdit *autoload_add_name;
Button *add_autoload;
- bool _autoload_name_is_valid(const String &p_name, String *r_error = NULL);
+ bool _autoload_name_is_valid(const String &p_name, String *r_error = nullptr);
void _autoload_add();
void _autoload_selected();
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index 44c3e50dfc..0c9cf91b2f 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -25,6 +25,7 @@ def make_doc_header(target, source, env):
buf = (docbegin + buf + docend).encode("utf-8")
decomp_size = len(buf)
import zlib
+
buf = zlib.compress(buf)
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
@@ -55,7 +56,7 @@ def make_fonts_header(target, source, env):
# saving uncompressed, since freetype will reference from memory pointer
xl_names = []
for i in range(len(source)):
- with open(source[i], "rb")as f:
+ with open(source[i], "rb") as f:
buf = f.read()
name = os.path.splitext(os.path.basename(source[i]))[0]
@@ -111,7 +112,9 @@ def make_translations_header(target, source, env, category):
g.write("};\n\n")
g.write("static {}TranslationList _{}_translations[] = {{\n".format(category.capitalize(), category))
for x in xl_names:
- g.write("\t{{ \"{}\", {}, {}, _{}_translation_{}_compressed }},\n".format(x[0], str(x[1]), str(x[2]), category, x[0]))
+ g.write(
+ '\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0])
+ )
g.write("\t{NULL, 0, 0, NULL}\n")
g.write("};\n")
@@ -128,5 +131,5 @@ def make_doc_translations_header(target, source, env):
make_translations_header(target, source, env, "doc")
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 1c19327da7..942b4a8ee6 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -270,7 +270,7 @@ EditorPlugin *EditorData::get_editor(Object *p_object) {
return editor_plugins[i];
}
- return NULL;
+ return nullptr;
}
EditorPlugin *EditorData::get_subeditor(Object *p_object) {
@@ -281,7 +281,7 @@ EditorPlugin *EditorData::get_subeditor(Object *p_object) {
return editor_plugins[i];
}
- return NULL;
+ return nullptr;
}
Vector<EditorPlugin *> EditorData::get_subeditors(Object *p_object) {
@@ -302,7 +302,7 @@ EditorPlugin *EditorData::get_editor(String p_name) {
return editor_plugins[i];
}
- return NULL;
+ return nullptr;
}
void EditorData::copy_object_params(Object *p_object) {
@@ -464,7 +464,7 @@ UndoRedo &EditorData::get_undo_redo() {
void EditorData::remove_editor_plugin(EditorPlugin *p_plugin) {
- p_plugin->undo_redo = NULL;
+ p_plugin->undo_redo = nullptr;
editor_plugins.erase(p_plugin);
}
@@ -479,7 +479,7 @@ int EditorData::get_editor_plugin_count() const {
}
EditorPlugin *EditorData::get_editor_plugin(int p_idx) {
- ERR_FAIL_INDEX_V(p_idx, editor_plugins.size(), NULL);
+ ERR_FAIL_INDEX_V(p_idx, editor_plugins.size(), nullptr);
return editor_plugins[p_idx];
}
@@ -506,7 +506,7 @@ Object *EditorData::instance_custom_type(const String &p_type, const String &p_i
Ref<Script> script = get_custom_types()[p_inherits][i].script;
Object *ob = ClassDB::instance(p_inherits);
- ERR_FAIL_COND_V(!ob, NULL);
+ ERR_FAIL_COND_V(!ob, nullptr);
if (ob->is_class("Node")) {
ob->call("set_name", p_type);
}
@@ -516,7 +516,7 @@ Object *EditorData::instance_custom_type(const String &p_type, const String &p_i
}
}
- return NULL;
+ return nullptr;
}
void EditorData::remove_custom_type(const String &p_type) {
@@ -540,7 +540,7 @@ int EditorData::add_edited_scene(int p_at_pos) {
if (p_at_pos < 0)
p_at_pos = edited_scene.size();
EditedScene es;
- es.root = NULL;
+ es.root = nullptr;
es.path = String();
es.history_current = -1;
es.version = 0;
@@ -680,10 +680,10 @@ void EditorData::set_edited_scene(int p_idx) {
}
Node *EditorData::get_edited_scene_root(int p_idx) {
if (p_idx < 0) {
- ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), NULL);
+ ERR_FAIL_INDEX_V(current_edited_scene, edited_scene.size(), nullptr);
return edited_scene[current_edited_scene].root;
} else {
- ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), NULL);
+ ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), nullptr);
return edited_scene[p_idx].root;
}
}
@@ -915,7 +915,7 @@ Object *EditorData::script_class_instance(const String &p_class) {
return obj;
}
}
- return NULL;
+ return nullptr;
}
Ref<Script> EditorData::script_class_load_script(const String &p_class) const {
@@ -1018,7 +1018,7 @@ void EditorSelection::add_node(Node *p_node) {
changed = true;
nl_changed = true;
- Object *meta = NULL;
+ Object *meta = nullptr;
for (List<Object *>::Element *E = editor_plugins.front(); E; E = E->next()) {
meta = E->get()->call("_get_editor_data", p_node);
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 5095ea8479..4f5d68bfed 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -265,7 +265,7 @@ public:
template <class T>
T *get_node_editor_data(Node *p_node) {
if (!selection.has(p_node))
- return NULL;
+ return nullptr;
return Object::cast_to<T>(selection[p_node]);
}
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp
index 5883b5eb1e..e8167070d4 100644
--- a/editor/editor_export.cpp
+++ b/editor/editor_export.cpp
@@ -358,12 +358,12 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat
zipOpenNewFileInZip(zip,
path.utf8().get_data(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
@@ -582,6 +582,14 @@ String EditorExportPlugin::get_ios_cpp_code() const {
return ios_cpp_code;
}
+void EditorExportPlugin::add_ios_project_static_lib(const String &p_path) {
+ ios_project_static_libs.push_back(p_path);
+}
+
+Vector<String> EditorExportPlugin::get_ios_project_static_libs() const {
+ return ios_project_static_libs;
+}
+
void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) {
if (get_script_instance()) {
@@ -617,6 +625,7 @@ void EditorExportPlugin::skip() {
void EditorExportPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_shared_object", "path", "tags"), &EditorExportPlugin::add_shared_object);
+ ClassDB::bind_method(D_METHOD("add_ios_project_static_lib", "path"), &EditorExportPlugin::add_ios_project_static_lib);
ClassDB::bind_method(D_METHOD("add_file", "path", "file", "remap"), &EditorExportPlugin::add_file);
ClassDB::bind_method(D_METHOD("add_ios_framework", "path"), &EditorExportPlugin::add_ios_framework);
ClassDB::bind_method(D_METHOD("add_ios_plist_content", "plist_content"), &EditorExportPlugin::add_ios_plist_content);
@@ -1070,7 +1079,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
FileAccess *src_f;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io);
+ zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io);
ZipData zd;
zd.ep = &ep;
@@ -1080,7 +1089,7 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
if (err != OK && err != ERR_SKIP)
ERR_PRINT("Failed to export project files");
- zipClose(zip, NULL);
+ zipClose(zip, nullptr);
return OK;
}
@@ -1153,7 +1162,7 @@ EditorExportPlatform::EditorExportPlatform() {
////
-EditorExport *EditorExport::singleton = NULL;
+EditorExport *EditorExport::singleton = nullptr;
void EditorExport::_save() {
@@ -1686,7 +1695,7 @@ void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_
EditorExportPlatformPC::EditorExportPlatformPC() {
chmod_flags = -1;
- fixup_embedded_pck_func = NULL;
+ fixup_embedded_pck_func = nullptr;
}
///////////////////////
diff --git a/editor/editor_export.h b/editor/editor_export.h
index 81790eb0a4..f47fe9c95e 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -212,7 +212,7 @@ protected:
FeatureContainers get_feature_containers(const Ref<EditorExportPreset> &p_preset);
bool exists_export_template(String template_file_name, String *err) const;
- String find_export_template(String template_file_name, String *err = NULL) const;
+ String find_export_template(String template_file_name, String *err = nullptr) const;
void gen_export_flags(Vector<String> &r_flags, int p_flags);
public:
@@ -238,9 +238,9 @@ public:
virtual String get_name() const = 0;
virtual Ref<Texture2D> get_logo() const = 0;
- Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = NULL);
+ Error export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr);
- Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = NULL, bool p_embed = false, int64_t *r_embedded_start = NULL, int64_t *r_embedded_size = NULL);
+ Error save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr);
Error save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path);
virtual bool poll_export() { return false; }
@@ -291,6 +291,7 @@ class EditorExportPlugin : public Reference {
bool skipped;
Vector<String> ios_frameworks;
+ Vector<String> ios_project_static_libs;
String ios_plist_content;
String ios_linker_flags;
Vector<String> ios_bundle_files;
@@ -322,6 +323,7 @@ protected:
void add_shared_object(const String &p_path, const Vector<String> &tags);
void add_ios_framework(const String &p_path);
+ void add_ios_project_static_lib(const String &p_path);
void add_ios_plist_content(const String &p_plist_content);
void add_ios_linker_flags(const String &p_flags);
void add_ios_bundle_file(const String &p_path);
@@ -336,6 +338,7 @@ protected:
public:
Vector<String> get_ios_frameworks() const;
+ Vector<String> get_ios_project_static_libs() const;
String get_ios_plist_content() const;
String get_ios_linker_flags() const;
Vector<String> get_ios_bundle_files() const;
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 6e13ec7967..e2b79efb43 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -787,7 +787,7 @@ Ref<EditorFeatureProfile> EditorFeatureProfileManager::get_current_profile() {
return current;
}
-EditorFeatureProfileManager *EditorFeatureProfileManager::singleton = NULL;
+EditorFeatureProfileManager *EditorFeatureProfileManager::singleton = nullptr;
void EditorFeatureProfileManager::_bind_methods() {
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index fca59946ae..71ade56e39 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -44,11 +44,11 @@
#include "scene/gui/margin_container.h"
#include "servers/display_server.h"
-EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = NULL;
-EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = NULL;
+EditorFileDialog::GetIconFunc EditorFileDialog::get_icon_func = nullptr;
+EditorFileDialog::GetIconFunc EditorFileDialog::get_large_icon_func = nullptr;
-EditorFileDialog::RegisterFunc EditorFileDialog::register_func = NULL;
-EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = NULL;
+EditorFileDialog::RegisterFunc EditorFileDialog::register_func = nullptr;
+EditorFileDialog::RegisterFunc EditorFileDialog::unregister_func = nullptr;
VBoxContainer *EditorFileDialog::get_vbox() {
return vbox;
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index ad34b59c5c..c211d5852a 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -41,7 +41,7 @@
#include "editor_resource_preview.h"
#include "editor_settings.h"
-EditorFileSystem *EditorFileSystem::singleton = NULL;
+EditorFileSystem *EditorFileSystem::singleton = nullptr;
//the name is the version, to keep compatibility with different versions of Godot
#define CACHE_FILE_NAME "filesystem_cache6"
@@ -75,7 +75,7 @@ int EditorFileSystemDirectory::get_subdir_count() const {
EditorFileSystemDirectory *EditorFileSystemDirectory::get_subdir(int p_idx) {
- ERR_FAIL_INDEX_V(p_idx, subdirs.size(), NULL);
+ ERR_FAIL_INDEX_V(p_idx, subdirs.size(), nullptr);
return subdirs[p_idx];
}
@@ -176,7 +176,7 @@ void EditorFileSystemDirectory::_bind_methods() {
EditorFileSystemDirectory::EditorFileSystemDirectory() {
modified_time = 0;
- parent = NULL;
+ parent = nullptr;
verified = false;
}
@@ -300,7 +300,7 @@ void EditorFileSystem::_scan_filesystem() {
sp.progress = &scan_progress;
new_filesystem = memnew(EditorFileSystemDirectory);
- new_filesystem->parent = NULL;
+ new_filesystem->parent = nullptr;
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
d->change_dir("res://");
@@ -383,7 +383,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
@@ -430,7 +430,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
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);
+ err = VariantParser::parse_tag_assign_eof(&md5_stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
break;
@@ -622,7 +622,7 @@ void EditorFileSystem::scan() {
memdelete(filesystem);
//file_type_cache.clear();
filesystem = new_filesystem;
- new_filesystem = NULL;
+ new_filesystem = nullptr;
_update_scan_actions();
scanning = false;
emit_signal("filesystem_changed");
@@ -1124,8 +1124,8 @@ void EditorFileSystem::_notification(int p_what) {
}
Thread::wait_to_finish(active_thread);
memdelete(active_thread);
- thread = NULL;
- thread_sources = NULL;
+ thread = nullptr;
+ thread_sources = nullptr;
WARN_PRINT("Scan thread aborted...");
set_process(false);
}
@@ -1134,8 +1134,8 @@ void EditorFileSystem::_notification(int p_what) {
memdelete(filesystem);
if (new_filesystem)
memdelete(new_filesystem);
- filesystem = NULL;
- new_filesystem = NULL;
+ filesystem = nullptr;
+ new_filesystem = nullptr;
} break;
case NOTIFICATION_PROCESS: {
@@ -1152,7 +1152,7 @@ void EditorFileSystem::_notification(int p_what) {
Thread::wait_to_finish(thread_sources);
memdelete(thread_sources);
- thread_sources = NULL;
+ thread_sources = nullptr;
if (_update_scan_actions())
emit_signal("filesystem_changed");
emit_signal("sources_changed", sources_changed.size() > 0);
@@ -1166,10 +1166,10 @@ void EditorFileSystem::_notification(int p_what) {
if (filesystem)
memdelete(filesystem);
filesystem = new_filesystem;
- new_filesystem = NULL;
+ new_filesystem = nullptr;
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
_update_scan_actions();
emit_signal("filesystem_changed");
emit_signal("sources_changed", sources_changed.size() > 0);
@@ -1308,7 +1308,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
String EditorFileSystem::get_file_type(const String &p_file) const {
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
if (!_find_file(p_file, &fs, cpos)) {
@@ -1322,13 +1322,13 @@ String EditorFileSystem::get_file_type(const String &p_file) const {
EditorFileSystemDirectory *EditorFileSystem::find_file(const String &p_file, int *r_index) const {
if (!filesystem || scanning)
- return NULL;
+ return nullptr;
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
if (!_find_file(p_file, &fs, cpos)) {
- return NULL;
+ return nullptr;
}
if (r_index)
@@ -1340,12 +1340,12 @@ EditorFileSystemDirectory *EditorFileSystem::find_file(const String &p_file, int
EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p_path) {
if (!filesystem || scanning)
- return NULL;
+ return nullptr;
String f = ProjectSettings::get_singleton()->localize_path(p_path);
if (!f.begins_with("res://"))
- return NULL;
+ return nullptr;
f = f.substr(6, f.length());
f = f.replace("\\", "/");
@@ -1358,7 +1358,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
Vector<String> path = f.split("/");
if (path.size() == 0)
- return NULL;
+ return nullptr;
EditorFileSystemDirectory *fs = filesystem;
@@ -1374,7 +1374,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p
}
if (idx == -1) {
- return NULL;
+ return nullptr;
} else {
fs = fs->get_subdir(idx);
@@ -1483,7 +1483,7 @@ void EditorFileSystem::_queue_update_script_classes() {
void EditorFileSystem::update_file(const String &p_file) {
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
if (!_find_file(p_file, &fs, cpos)) {
@@ -1684,7 +1684,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
}
md5s->close();
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
bool found = _find_file(file, &fs, cpos);
ERR_FAIL_COND_V_MSG(!found, ERR_UNCONFIGURED, "Can't find file '" + file + "'.");
@@ -1718,7 +1718,7 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector
void EditorFileSystem::_reimport_file(const String &p_file) {
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
bool found = _find_file(p_file, &fs, cpos);
ERR_FAIL_COND_MSG(!found, "Can't find file '" + p_file + "'.");
@@ -1980,7 +1980,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
}
//group may have changed, so also update group reference
- EditorFileSystemDirectory *fs = NULL;
+ EditorFileSystemDirectory *fs = nullptr;
int cpos = -1;
if (_find_file(p_files[i], &fs, cpos)) {
@@ -2131,14 +2131,14 @@ EditorFileSystem::EditorFileSystem() {
singleton = this;
filesystem = memnew(EditorFileSystemDirectory); //like, empty
- filesystem->parent = NULL;
+ filesystem->parent = nullptr;
- thread = NULL;
+ thread = nullptr;
scanning = false;
importing = false;
use_threads = true;
- thread_sources = NULL;
- new_filesystem = NULL;
+ thread_sources = nullptr;
+ new_filesystem = nullptr;
abort_scan = false;
scanning_changes = false;
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h
index 9789dacdc1..55a2ed3d09 100644
--- a/editor/editor_file_system.h
+++ b/editor/editor_file_system.h
@@ -129,9 +129,9 @@ class EditorFileSystem : public Node {
ItemAction() {
action = ACTION_NONE;
- dir = NULL;
- new_dir = NULL;
- new_file = NULL;
+ dir = nullptr;
+ new_dir = nullptr;
+ new_file = nullptr;
}
};
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9d8c46cc2d..a36e2f360e 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -39,10 +39,8 @@
#include "editor_settings.h"
#define CONTRIBUTE_URL "https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html"
-#define CONTRIBUTE2_URL "https://github.com/godotengine/godot-docs"
-#define REQUEST_URL "https://github.com/godotengine/godot-docs/issues/new"
-DocData *EditorHelp::doc = NULL;
+DocData *EditorHelp::doc = nullptr;
void EditorHelp::_init_colors() {
@@ -109,7 +107,7 @@ void EditorHelp::_class_desc_select(const String &p_select) {
String link = p_select.substr(tag_end + 1, p_select.length()).lstrip(" ");
String topic;
- Map<String, int> *table = NULL;
+ Map<String, int> *table = nullptr;
if (tag == "method") {
topic = "class_method";
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 6fba5b1b4c..01a50cad2c 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -317,7 +317,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() {
iterator_doc = EditorHelp::get_doc_data()->class_list.front();
matches.clear();
- matched_item = NULL;
+ matched_item = nullptr;
return true;
}
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 013ba88c30..c92d1d009d 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -71,7 +71,7 @@ Size2 EditorProperty::get_minimum_size() const {
ms.width += check->get_width() + get_theme_constant("hseparation", "CheckBox") + get_theme_constant("hseparator", "Tree");
}
- if (bottom_editor != NULL && bottom_editor->is_visible()) {
+ if (bottom_editor != nullptr && bottom_editor->is_visible()) {
ms.height += get_theme_constant("vseparation", "Tree");
Size2 bems = bottom_editor->get_combined_minimum_size();
//bems.width += get_constant("item_margin", "Tree");
@@ -856,7 +856,7 @@ void EditorProperty::_bind_methods() {
EditorProperty::EditorProperty() {
draw_top_bg = true;
- object = NULL;
+ object = nullptr;
split_ratio = 0.5;
selectable = true;
text_size = 0;
@@ -873,8 +873,8 @@ EditorProperty::EditorProperty() {
property_usage = 0;
selected = false;
selected_focusable = -1;
- label_reference = NULL;
- bottom_editor = NULL;
+ label_reference = nullptr;
+ bottom_editor = nullptr;
}
////////////////////////////////////////////////
////////////////////////////////////////////////
@@ -888,7 +888,7 @@ void EditorInspectorPlugin::add_custom_control(Control *control) {
void EditorInspectorPlugin::add_property_editor(const String &p_for_property, Control *p_prop) {
- ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == NULL);
+ ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == nullptr);
AddedEditor ae;
ae.properties.push_back(p_for_property);
@@ -1257,7 +1257,7 @@ void EditorInspectorSection::_bind_methods() {
}
EditorInspectorSection::EditorInspectorSection() {
- object = NULL;
+ object = nullptr;
foldable = false;
vbox = memnew(VBoxContainer);
vbox_added = false;
@@ -1297,7 +1297,7 @@ EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, V
}
}
}
- return NULL;
+ return nullptr;
}
void EditorInspector::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
@@ -1473,12 +1473,12 @@ void EditorInspector::update_tree() {
}
}
- // TreeItem *current_category = NULL;
+ // TreeItem *current_category = nullptr;
String filter = search_box ? search_box->get_text() : "";
String group;
String group_base;
- VBoxContainer *category_vbox = NULL;
+ VBoxContainer *category_vbox = nullptr;
List<PropertyInfo>
plist;
@@ -1535,7 +1535,7 @@ void EditorInspector::update_tree() {
EditorInspectorCategory *category = memnew(EditorInspectorCategory);
main_vbox->add_child(category);
- category_vbox = NULL; //reset
+ category_vbox = nullptr; //reset
String type = p.name;
category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
@@ -1621,7 +1621,7 @@ void EditorInspector::update_tree() {
continue;
}
- if (category_vbox == NULL) {
+ if (category_vbox == nullptr) {
category_vbox = memnew(VBoxContainer);
main_vbox->add_child(category_vbox);
}
@@ -1659,7 +1659,7 @@ void EditorInspector::update_tree() {
if (current_vbox == main_vbox) {
//do not add directly to the main vbox, given it has no spacing
- if (category_vbox == NULL) {
+ if (category_vbox == nullptr) {
category_vbox = memnew(VBoxContainer);
}
current_vbox = category_vbox;
@@ -2143,7 +2143,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == p_path) {
Callable::CallError ce;
- to_create = Variant::construct(E->get().type, NULL, 0, ce);
+ to_create = Variant::construct(E->get().type, nullptr, 0, ce);
break;
}
}
@@ -2191,7 +2191,7 @@ void EditorInspector::_resource_selected(const String &p_path, RES p_resource) {
void EditorInspector::_node_removed(Node *p_node) {
if (p_node == object) {
- edit(NULL);
+ edit(nullptr);
}
}
@@ -2211,14 +2211,14 @@ void EditorInspector::_notification(int p_what) {
}
}
if (p_what == NOTIFICATION_PREDELETE) {
- edit(NULL); //just in case
+ edit(nullptr); //just in case
}
if (p_what == NOTIFICATION_EXIT_TREE) {
if (!sub_inspector) {
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
- edit(NULL);
+ edit(nullptr);
}
if (p_what == NOTIFICATION_PROCESS) {
@@ -2328,8 +2328,8 @@ void EditorInspector::_bind_methods() {
}
EditorInspector::EditorInspector() {
- object = NULL;
- undo_redo = NULL;
+ object = nullptr;
+ undo_redo = nullptr;
main_vbox = memnew(VBoxContainer);
main_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
main_vbox->add_theme_constant_override("separation", 0);
@@ -2349,7 +2349,7 @@ EditorInspector::EditorInspector() {
update_tree_pending = false;
refresh_countdown = 0;
read_only = false;
- search_box = NULL;
+ search_box = nullptr;
keying = false;
_prop_edited = "property_edited";
set_process(true);
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 91e53edeac..c89a7bcf23 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -66,7 +66,7 @@ void EditorLog::_notification(int p_what) {
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
Ref<DynamicFont> df_output_code = get_theme_font("output_source", "EditorFonts");
if (df_output_code.is_valid()) {
- if (log != NULL) {
+ if (log != nullptr) {
log->add_theme_font_override("normal_font", get_theme_font("output_source", "EditorFonts"));
}
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 2ba67ae879..06968f820b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -174,7 +174,7 @@
#include <stdio.h>
#include <stdlib.h>
-EditorNode *EditorNode::singleton = NULL;
+EditorNode *EditorNode::singleton = nullptr;
void EditorNode::_update_scene_tabs() {
@@ -365,6 +365,9 @@ void EditorNode::_notification(int p_what) {
RS::get_singleton()->camera_effects_set_dof_blur_quality(dof_quality, dof_jitter);
RS::get_singleton()->environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
RS::get_singleton()->screen_space_roughness_limiter_set_active(GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter"), GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve"));
+
+ bool glow_bicubic = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0;
+ RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic);
}
ResourceImporterTexture::get_singleton()->update_imports();
@@ -384,7 +387,7 @@ void EditorNode::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
editor_data.save_editor_external_data();
- FileAccess::set_file_close_fail_notify_callback(NULL);
+ FileAccess::set_file_close_fail_notify_callback(nullptr);
log->deinit(); // do not get messages anymore
editor_data.clear_edited_scenes();
} break;
@@ -511,7 +514,9 @@ void EditorNode::_notification(int p_what) {
p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_theme_icon("HelpSearch", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_theme_icon("Instance", "EditorIcons"));
- p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_theme_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_REPORT_A_BUG), gui_base->get_theme_icon("Instance", "EditorIcons"));
+ p->set_item_icon(p->get_item_index(HELP_SEND_DOCS_FEEDBACK), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_theme_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_theme_icon("Godot", "EditorIcons"));
@@ -861,7 +866,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
file->set_current_path(p_resource->get_path());
if (extensions.size()) {
String ext = p_resource->get_path().get_extension().to_lower();
- if (extensions.find(ext) == NULL) {
+ if (extensions.find(ext) == nullptr) {
file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get()));
}
}
@@ -1118,7 +1123,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
EditorProgress save("save", TTR("Saving Scene"), 4);
- if (editor_data.get_edited_scene_root() != NULL) {
+ if (editor_data.get_edited_scene_root() != nullptr) {
save.step(TTR("Analyzing"), 0);
int c2d = 0;
@@ -1557,7 +1562,7 @@ void EditorNode::_dialog_action(String p_file) {
save_resource_in_path(saving_resource, p_file);
saving_resource = Ref<Resource>();
ObjectID current = editor_history.get_current();
- Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
ERR_FAIL_COND(!current_obj);
current_obj->_change_notify();
} break;
@@ -1703,10 +1708,10 @@ void EditorNode::edit_item(Object *p_object) {
void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) {
if (!p_object) {
- get_inspector()->edit(NULL);
- node_dock->set_node(NULL);
- scene_tree_dock->set_selected(NULL);
- inspector_dock->update(NULL);
+ get_inspector()->edit(nullptr);
+ node_dock->set_node(nullptr);
+ scene_tree_dock->set_selected(nullptr);
+ inspector_dock->update(nullptr);
return;
}
@@ -1767,17 +1772,17 @@ static bool overrides_external_editor(Object *p_object) {
void EditorNode::_edit_current() {
ObjectID current = editor_history.get_current();
- Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
bool inspector_only = editor_history.is_current_inspector_only();
this->current = current_obj;
if (!current_obj) {
- scene_tree_dock->set_selected(NULL);
- get_inspector()->edit(NULL);
- node_dock->set_node(NULL);
- inspector_dock->update(NULL);
+ scene_tree_dock->set_selected(nullptr);
+ get_inspector()->edit(nullptr);
+ node_dock->set_node(nullptr);
+ inspector_dock->update(nullptr);
_display_top_editors(false);
@@ -1798,9 +1803,9 @@ void EditorNode::_edit_current() {
Resource *current_res = Object::cast_to<Resource>(current_obj);
ERR_FAIL_COND(!current_res);
get_inspector()->edit(current_res);
- scene_tree_dock->set_selected(NULL);
- node_dock->set_node(NULL);
- inspector_dock->update(NULL);
+ scene_tree_dock->set_selected(nullptr);
+ node_dock->set_node(nullptr);
+ inspector_dock->update(nullptr);
EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path());
int subr_idx = current_res->get_path().find("::");
@@ -1829,9 +1834,9 @@ void EditorNode::_edit_current() {
scene_tree_dock->set_selected(current_node);
inspector_dock->update(current_node);
} else {
- node_dock->set_node(NULL);
- scene_tree_dock->set_selected(NULL);
- inspector_dock->update(NULL);
+ node_dock->set_node(nullptr);
+ scene_tree_dock->set_selected(nullptr);
+ inspector_dock->update(nullptr);
}
if (get_edited_scene() && get_edited_scene()->get_filename() != String()) {
@@ -1843,7 +1848,7 @@ void EditorNode::_edit_current() {
} else {
- Node *selected_node = NULL;
+ Node *selected_node = nullptr;
if (current_obj->is_class("EditorDebuggerRemoteObject")) {
editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow.");
@@ -1872,9 +1877,9 @@ void EditorNode::_edit_current() {
}
get_inspector()->edit(current_obj);
- node_dock->set_node(NULL);
+ node_dock->set_node(nullptr);
scene_tree_dock->set_selected(selected_node);
- inspector_dock->update(NULL);
+ inspector_dock->update(nullptr);
}
if (current_obj == prev_inspected_object) {
@@ -1900,7 +1905,7 @@ void EditorNode::_edit_current() {
for (int i = 0; i < editor_table.size(); i++) {
if (editor_table[i] == main_plugin && !main_editor_buttons[i]->is_visible()) {
- main_plugin = NULL; //if button is not visible, then no plugin active
+ main_plugin = nullptr; //if button is not visible, then no plugin active
}
}
@@ -2229,7 +2234,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(scene->get_filename());
if (extensions.size()) {
String ext = scene->get_filename().get_extension().to_lower();
- if (extensions.find(ext) == NULL) {
+ if (extensions.find(ext) == nullptr) {
file->set_current_path(scene->get_filename().replacen("." + ext, "." + extensions.front()->get()));
}
}
@@ -2629,9 +2634,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case HELP_QA: {
OS::get_singleton()->shell_open("https://godotengine.org/qa/");
} break;
- case HELP_ISSUES: {
+ case HELP_REPORT_A_BUG: {
OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues");
} break;
+ case HELP_SEND_DOCS_FEEDBACK: {
+ OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues");
+ } break;
case HELP_COMMUNITY: {
OS::get_singleton()->shell_open("https://godotengine.org/community");
} break;
@@ -2739,7 +2747,7 @@ void EditorNode::_discard_changes(const String &p_str) {
case SCENE_TAB_CLOSE: {
Node *scene = editor_data.get_edited_scene_root(tab_closing);
- if (scene != NULL) {
+ if (scene != nullptr) {
String scene_filename = scene->get_filename();
if (scene_filename != "") {
previous_scenes.push_back(scene_filename);
@@ -3119,7 +3127,7 @@ Dictionary EditorNode::_get_main_scene_state() {
void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
- if (get_edited_scene() != p_for_scene && p_for_scene != NULL)
+ if (get_edited_scene() != p_for_scene && p_for_scene != nullptr)
return; //not for this scene
changing_scene = false;
@@ -3414,7 +3422,7 @@ void EditorNode::open_request(const String &p_path) {
if (!opening_prev) {
List<String>::Element *prev_scene = previous_scenes.find(p_path);
- if (prev_scene != NULL) {
+ if (prev_scene != nullptr) {
prev_scene->erase();
}
}
@@ -3636,7 +3644,7 @@ void EditorNode::stop_child_process(OS::ProcessID p_pid) {
}
Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) const {
- ERR_FAIL_COND_V(!p_object, NULL);
+ ERR_FAIL_COND_V(!p_object, nullptr);
Ref<Script> script = p_object->get_script();
@@ -3663,7 +3671,7 @@ Ref<Script> EditorNode::get_object_custom_type_base(const Object *p_object) cons
}
}
- return NULL;
+ return nullptr;
}
StringName EditorNode::get_object_custom_type_name(const Object *p_object) const {
@@ -3709,11 +3717,11 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons
return icon;
}
}
- return NULL;
+ return nullptr;
}
Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const {
- ERR_FAIL_COND_V(!p_object || !gui_base, NULL);
+ ERR_FAIL_COND_V(!p_object || !gui_base, nullptr);
Ref<Script> script = p_object->get_script();
if (script.is_null() && p_object->is_class("Script")) {
@@ -3754,11 +3762,11 @@ Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String
if (p_fallback.length())
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
- return NULL;
+ return nullptr;
}
Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
- ERR_FAIL_COND_V_MSG(p_class.empty(), NULL, "Class name cannot be empty.");
+ ERR_FAIL_COND_V_MSG(p_class.empty(), nullptr, "Class name cannot be empty.");
if (gui_base->has_theme_icon(p_class, "EditorIcons")) {
return gui_base->get_theme_icon(p_class, "EditorIcons");
@@ -3775,7 +3783,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
while (script.is_valid()) {
String current_icon_path;
- script->get_language()->get_global_class_name(script->get_path(), NULL, &current_icon_path);
+ script->get_language()->get_global_class_name(script->get_path(), nullptr, &current_icon_path);
icon = _load_custom_class_icon(current_icon_path);
if (icon.is_valid()) {
return icon;
@@ -3805,7 +3813,7 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, "EditorIcons"))
return gui_base->get_theme_icon(p_fallback, "EditorIcons");
- return NULL;
+ return nullptr;
}
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
@@ -4391,7 +4399,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
String name = names[j];
//find it, in a horribly inefficient way
int atidx = -1;
- Control *node = NULL;
+ Control *node = nullptr;
for (int k = 0; k < DOCK_SLOT_MAX; k++) {
if (!dock_slot[k]->has_node(name))
continue;
@@ -4957,7 +4965,7 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) {
void EditorNode::remove_control_from_dock(Control *p_control) {
- Control *dock = NULL;
+ Control *dock = nullptr;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
if (p_control->get_parent() == dock_slot[i]) {
dock = dock_slot[i];
@@ -5080,7 +5088,7 @@ void EditorNode::add_tool_menu_item(const String &p_name, Object *p_handler, con
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);
+ ERR_FAIL_COND(p_submenu->get_parent() != nullptr);
tool_menu->add_child(p_submenu);
tool_menu->add_submenu_item(p_name, p_submenu->get_name(), TOOLS_CUSTOM);
@@ -5467,7 +5475,7 @@ void EditorNode::_print_handler(void *p_this, const String &p_string, bool p_err
static void _execute_thread(void *p_ud) {
EditorNode::ExecuteThreadArgs *eta = (EditorNode::ExecuteThreadArgs *)p_ud;
- Error err = OS::get_singleton()->execute(eta->path, eta->args, true, NULL, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex);
+ Error err = OS::get_singleton()->execute(eta->path, eta->args, true, nullptr, &eta->output, &eta->exitcode, true, &eta->execute_output_mutex);
print_verbose("Thread exit status: " + itos(eta->exitcode));
if (err != OK) {
eta->exitcode = err;
@@ -6247,7 +6255,8 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Q&A")), HELP_QA);
- p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/issue_tracker", TTR("Issue Tracker")), HELP_ISSUES);
+ p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/report_a_bug", TTR("Report a Bug")), HELP_REPORT_A_BUG);
+ p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/send_docs_feedback", TTR("Send Docs Feedback")), HELP_SEND_DOCS_FEEDBACK);
p->add_icon_shortcut(gui_base->get_theme_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/community", TTR("Community")), HELP_COMMUNITY);
p->add_separator();
p->add_icon_shortcut(gui_base->get_theme_icon("Godot", "EditorIcons"), ED_SHORTCUT("editor/about", TTR("About")), HELP_ABOUT);
@@ -6687,7 +6696,7 @@ EditorNode::EditorNode() {
update_spinner_step_frame = Engine::get_singleton()->get_frames_drawn();
update_spinner_step = 0;
- editor_plugin_screen = NULL;
+ editor_plugin_screen = nullptr;
editor_plugins_over = memnew(EditorPluginList);
editor_plugins_force_over = memnew(EditorPluginList);
editor_plugins_force_input_forwarding = memnew(EditorPluginList);
@@ -6698,7 +6707,7 @@ EditorNode::EditorNode() {
EditorExport::get_singleton()->add_export_plugin(export_text_to_binary_plugin);
_edit_current();
- current = NULL;
+ current = nullptr;
saving_resource = Ref<Resource>();
reference_resource_mem = true;
@@ -6715,7 +6724,7 @@ EditorNode::EditorNode() {
saved_version = 1;
unsaved_cache = true;
- _last_instanced_scene = NULL;
+ _last_instanced_scene = nullptr;
quick_open = memnew(EditorQuickOpen);
gui_base->add_child(quick_open);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 9d251690d2..c6f04b0749 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -194,7 +194,8 @@ private:
HELP_SEARCH,
HELP_DOCS,
HELP_QA,
- HELP_ISSUES,
+ HELP_REPORT_A_BUG,
+ HELP_SEND_DOCS_FEEDBACK,
HELP_COMMUNITY,
HELP_ABOUT,
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 8faaabc1fb..746ebc8292 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -51,7 +51,7 @@ Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_
meshes.push_back(p_meshes[i]);
}
- Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, NULL, p_preview_size);
+ Vector<Ref<Texture2D>> textures = make_mesh_previews(meshes, nullptr, p_preview_size);
Array ret;
for (int i = 0; i < textures.size(); i++) {
ret.push_back(textures[i]);
@@ -97,7 +97,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
}
Transform mesh_xform;
- if (p_transforms != NULL) {
+ if (p_transforms != nullptr) {
mesh_xform = (*p_transforms)[i];
}
@@ -194,7 +194,7 @@ Array EditorInterface::get_open_scenes() const {
int scns_amount = scenes.size();
for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
- if (scenes[idx_scn].root == NULL)
+ if (scenes[idx_scn].root == nullptr)
continue;
ret.push_back(scenes[idx_scn].root->get_filename());
}
@@ -278,7 +278,7 @@ void EditorInterface::set_distraction_free_mode(bool p_enter) {
EditorNode::get_singleton()->set_distraction_free_mode(p_enter);
}
-EditorInterface *EditorInterface::singleton = NULL;
+EditorInterface *EditorInterface::singleton = nullptr;
void EditorInterface::_bind_methods() {
@@ -337,7 +337,7 @@ void EditorPlugin::remove_autoload_singleton(const String &p_name) {
}
ToolButton *EditorPlugin::add_control_to_bottom_panel(Control *p_control, const String &p_title) {
- ERR_FAIL_NULL_V(p_control, NULL);
+ ERR_FAIL_NULL_V(p_control, nullptr);
return EditorNode::get_singleton()->add_bottom_panel_item(p_title, p_control);
}
@@ -914,7 +914,7 @@ void EditorPlugin::_bind_methods() {
}
EditorPlugin::EditorPlugin() :
- undo_redo(NULL),
+ undo_redo(nullptr),
input_event_forwarding_always_enabled(false),
force_draw_over_forwarding_enabled(false),
last_main_screen_name("") {
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 12b042d0e5..2ca96ceed2 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -268,7 +268,7 @@ class EditorPlugins {
public:
static int get_plugin_count() { return creation_func_count; }
static EditorPlugin *create(int p_idx, EditorNode *p_editor) {
- ERR_FAIL_INDEX_V(p_idx, creation_func_count, NULL);
+ ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr);
return creation_funcs[p_idx](p_editor);
}
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index af83e808fc..1f3ff1b332 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -165,8 +165,8 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() {
open_big_text = memnew(ToolButton);
open_big_text->connect("pressed", callable_mp(this, &EditorPropertyMultilineText::_open_big_text));
hb->add_child(open_big_text);
- big_text_dialog = NULL;
- big_text = NULL;
+ big_text_dialog = nullptr;
+ big_text = nullptr;
}
///////////////////// TEXT ENUM /////////////////////////
@@ -303,7 +303,7 @@ EditorPropertyPath::EditorPropertyPath() {
path_edit->set_clip_text(true);
path_hb->add_child(path_edit);
add_focusable(path);
- dialog = NULL;
+ dialog = nullptr;
path_edit->connect("pressed", callable_mp(this, &EditorPropertyPath::_path_pressed));
folder = false;
global = false;
@@ -448,7 +448,7 @@ void EditorPropertyMember::_bind_methods() {
}
EditorPropertyMember::EditorPropertyMember() {
- selector = NULL;
+ selector = nullptr;
property = memnew(Button);
property->set_clip_text(true);
add_child(property);
@@ -1882,7 +1882,7 @@ EditorPropertyColor::EditorPropertyColor() {
void EditorPropertyNodePath::_node_selected(const NodePath &p_path) {
NodePath path = p_path;
- Node *base_node = NULL;
+ Node *base_node = nullptr;
if (!use_path_from_scene_root) {
base_node = Object::cast_to<Node>(get_edited_object());
@@ -1945,7 +1945,7 @@ void EditorPropertyNodePath::update_property() {
}
assign->set_flat(true);
- Node *base_node = NULL;
+ Node *base_node = nullptr;
if (base_hint != NodePath()) {
if (get_tree()->get_root()->has_node(base_hint)) {
base_node = get_tree()->get_root()->get_node(base_hint);
@@ -2008,7 +2008,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
hbc->add_child(clear);
use_path_from_scene_root = false;
- scene_tree = NULL; //do not allocate unnecessarily
+ scene_tree = nullptr; //do not allocate unnecessarily
}
///////////////////// RID /////////////////////////
@@ -2248,7 +2248,7 @@ void EditorPropertyResource::_menu_option(int p_which) {
return;
}
- Object *obj = NULL;
+ Object *obj = nullptr;
if (ScriptServer::is_global_class(intype)) {
obj = ClassDB::instance(ScriptServer::get_global_class_native_base(intype));
@@ -2598,10 +2598,10 @@ void EditorPropertyResource::update_property() {
sub_inspector->refresh();
} else {
if (sub_inspector) {
- set_bottom_editor(NULL);
+ set_bottom_editor(nullptr);
memdelete(sub_inspector_vbox);
- sub_inspector = NULL;
- sub_inspector_vbox = NULL;
+ sub_inspector = nullptr;
+ sub_inspector_vbox = nullptr;
if (opened_editor) {
EditorNode::get_singleton()->hide_top_editors();
opened_editor = false;
@@ -2823,8 +2823,8 @@ void EditorPropertyResource::_bind_methods() {
EditorPropertyResource::EditorPropertyResource() {
opened_editor = false;
- sub_inspector = NULL;
- sub_inspector_vbox = NULL;
+ sub_inspector = nullptr;
+ sub_inspector_vbox = nullptr;
use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector"));
HBoxContainer *hbc = memnew(HBoxContainer);
@@ -2860,8 +2860,8 @@ EditorPropertyResource::EditorPropertyResource() {
edit->connect("gui_input", callable_mp(this, &EditorPropertyResource::_button_input));
add_focusable(edit);
- file = NULL;
- scene_tree = NULL;
+ file = nullptr;
+ scene_tree = nullptr;
dropping = false;
add_to_group("_editor_resource_properties");
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 13eb2e19d6..b4ce60171b 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -199,7 +199,7 @@ void EditorPropertyArray::_change_type_menu(int p_index) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
Variant array = object->get_array();
array.set(changing_type_idx, value);
@@ -263,9 +263,9 @@ void EditorPropertyArray::update_property() {
edit->set_text(String("(Nil) ") + arrtype);
edit->set_pressed(false);
if (vbox) {
- set_bottom_editor(NULL);
+ set_bottom_editor(nullptr);
memdelete(vbox);
- vbox = NULL;
+ vbox = nullptr;
}
return;
}
@@ -340,7 +340,7 @@ void EditorPropertyArray::update_property() {
for (int i = 0; i < amount; i++) {
String prop_name = "indices/" + itos(i + offset);
- EditorProperty *prop = NULL;
+ EditorProperty *prop = nullptr;
Variant value = array.get(i + offset);
Variant::Type value_type = value.get_type();
@@ -353,7 +353,7 @@ void EditorPropertyArray::update_property() {
editor->setup("Object");
prop = editor;
} else {
- prop = EditorInspector::instantiate_property_editor(NULL, value_type, "", subtype_hint, subtype_hint_string, 0);
+ prop = EditorInspector::instantiate_property_editor(nullptr, value_type, "", subtype_hint, subtype_hint_string, 0);
}
prop->set_object_and_property(object.ptr(), prop_name);
@@ -391,9 +391,9 @@ void EditorPropertyArray::update_property() {
} else {
if (vbox) {
- set_bottom_editor(NULL);
+ set_bottom_editor(nullptr);
memdelete(vbox);
- vbox = NULL;
+ vbox = nullptr;
}
}
}
@@ -419,7 +419,7 @@ void EditorPropertyArray::_edit_pressed() {
Variant array = get_edited_object()->get(get_edited_property());
if (!array.is_array()) {
Callable::CallError ce;
- array = Variant::construct(array_type, NULL, 0, ce);
+ array = Variant::construct(array_type, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), array);
}
@@ -450,7 +450,7 @@ void EditorPropertyArray::_length_changed(double p_page) {
for (int i = previous_size; i < size; i++) {
if (array.get(i).get_type() == Variant::NIL) {
Callable::CallError ce;
- array.set(i, Variant::construct(subtype, NULL, 0, ce));
+ array.set(i, Variant::construct(subtype, nullptr, 0, ce));
}
}
}
@@ -460,7 +460,7 @@ void EditorPropertyArray::_length_changed(double p_page) {
// Pool*Array don't initialize their elements, have to do it manually
for (int i = previous_size; i < size; i++) {
Callable::CallError ce;
- array.set(i, Variant::construct(array.get(i).get_type(), NULL, 0, ce));
+ array.set(i, Variant::construct(array.get(i).get_type(), nullptr, 0, ce));
}
}
@@ -505,9 +505,9 @@ EditorPropertyArray::EditorPropertyArray() {
edit->set_toggle_mode(true);
add_child(edit);
add_focusable(edit);
- vbox = NULL;
- page = NULL;
- length = NULL;
+ vbox = nullptr;
+ page = nullptr;
+ length = nullptr;
updating = false;
change_type = memnew(PopupMenu);
add_child(change_type);
@@ -585,7 +585,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
if (changing_type_idx < 0) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
if (changing_type_idx == -1) {
object->set_new_item_key(value);
} else {
@@ -601,7 +601,7 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) {
Variant value;
Callable::CallError ce;
- value = Variant::construct(Variant::Type(p_index), NULL, 0, ce);
+ value = Variant::construct(Variant::Type(p_index), nullptr, 0, ce);
Variant key = dict.get_key_at_index(changing_type_idx);
dict[key] = value;
} else {
@@ -624,9 +624,9 @@ void EditorPropertyDictionary::update_property() {
edit->set_text("Dictionary (Nil)"); //This provides symmetry with the array property.
edit->set_pressed(false);
if (vbox) {
- set_bottom_editor(NULL);
+ set_bottom_editor(nullptr);
memdelete(vbox);
- vbox = NULL;
+ vbox = nullptr;
}
return;
}
@@ -683,7 +683,7 @@ void EditorPropertyDictionary::update_property() {
dict = dict.duplicate();
object->set_dict(dict);
- VBoxContainer *add_vbox = NULL;
+ VBoxContainer *add_vbox = nullptr;
for (int i = 0; i < amount + 2; i++) {
String prop_name;
@@ -702,7 +702,7 @@ void EditorPropertyDictionary::update_property() {
value = object->get_new_item_value();
}
- EditorProperty *prop = NULL;
+ EditorProperty *prop = nullptr;
switch (value.get_type()) {
case Variant::NIL: {
@@ -962,9 +962,9 @@ void EditorPropertyDictionary::update_property() {
} else {
if (vbox) {
- set_bottom_editor(NULL);
+ set_bottom_editor(nullptr);
memdelete(vbox);
- vbox = NULL;
+ vbox = nullptr;
}
}
}
@@ -981,7 +981,7 @@ void EditorPropertyDictionary::_edit_pressed() {
Variant prop_val = get_edited_object()->get(get_edited_property());
if (prop_val.get_type() == Variant::NIL) {
Callable::CallError ce;
- prop_val = Variant::construct(Variant::DICTIONARY, NULL, 0, ce);
+ prop_val = Variant::construct(Variant::DICTIONARY, nullptr, 0, ce);
get_edited_object()->set(get_edited_property(), prop_val);
}
@@ -1012,8 +1012,8 @@ EditorPropertyDictionary::EditorPropertyDictionary() {
edit->set_toggle_mode(true);
add_child(edit);
add_focusable(edit);
- vbox = NULL;
- page = NULL;
+ vbox = nullptr;
+ page = nullptr;
updating = false;
change_type = memnew(PopupMenu);
add_child(change_type);
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 4db8fb98f1..2a4300f833 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -99,7 +99,7 @@ void EditorResourcePreviewGenerator::_bind_methods() {
EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() {
}
-EditorResourcePreview *EditorResourcePreview::singleton = NULL;
+EditorResourcePreview *EditorResourcePreview::singleton = nullptr;
void EditorResourcePreview::_thread_func(void *ud) {
@@ -469,12 +469,12 @@ void EditorResourcePreview::stop() {
}
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
}
EditorResourcePreview::EditorResourcePreview() {
- thread = NULL;
+ thread = nullptr;
singleton = this;
order = 0;
exit = false;
diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp
index 628055cac6..c03fd4f6f5 100644
--- a/editor/editor_run_script.cpp
+++ b/editor/editor_run_script.cpp
@@ -56,7 +56,7 @@ Node *EditorScript::get_scene() {
if (!editor) {
EditorNode::add_io_error("EditorScript::get_scene: " + TTR("Write your logic in the _run() method."));
- return NULL;
+ return nullptr;
}
return editor->get_edited_scene();
@@ -73,7 +73,7 @@ void EditorScript::_run() {
Callable::CallError ce;
ce.error = Callable::CallError::CALL_OK;
- get_script_instance()->call("_run", NULL, 0, ce);
+ get_script_instance()->call("_run", nullptr, 0, ce);
if (ce.error != Callable::CallError::CALL_OK) {
EditorNode::add_io_error(TTR("Couldn't run script:") + "\n " + s->get_path() + "\n" + TTR("Did you forget the '_run' method?"));
@@ -95,5 +95,5 @@ void EditorScript::_bind_methods() {
EditorScript::EditorScript() {
- editor = NULL;
+ editor = nullptr;
}
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index 2c895a3e9d..bccc38ca1b 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -127,7 +127,7 @@ public:
}
SectionedInspectorFilter() {
- edited = NULL;
+ edited = nullptr;
}
};
@@ -142,7 +142,7 @@ void SectionedInspector::_section_selected() {
return;
selected_category = sections->get_selected()->get_metadata(0);
- filter->set_section(selected_category, sections->get_selected()->get_children() == NULL);
+ filter->set_section(selected_category, sections->get_selected()->get_children() == nullptr);
inspector->set_property_prefix(selected_category + "/");
}
@@ -177,8 +177,8 @@ void SectionedInspector::edit(Object *p_object) {
obj = ObjectID();
sections->clear();
- filter->set_edited(NULL);
- inspector->edit(NULL);
+ filter->set_edited(nullptr);
+ inspector->edit(nullptr);
return;
}
@@ -308,7 +308,7 @@ SectionedInspector::SectionedInspector() :
sections(memnew(Tree)),
filter(memnew(SectionedInspectorFilter)),
inspector(memnew(EditorInspector)),
- search_box(NULL) {
+ search_box(nullptr) {
add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up
VBoxContainer *left_vb = memnew(VBoxContainer);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 286ca7b184..7ce6e3edb8 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -53,7 +53,7 @@
// PRIVATE METHODS
-Ref<EditorSettings> EditorSettings::singleton = NULL;
+Ref<EditorSettings> EditorSettings::singleton = nullptr;
// Properties
@@ -177,7 +177,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
_THREAD_SAFE_METHOD_
- const String *k = NULL;
+ const String *k = nullptr;
Set<_EVCSort> vclist;
while ((k = props.next(k))) {
@@ -778,7 +778,7 @@ void EditorSettings::create() {
if (singleton.ptr())
return; //pointless
- DirAccess *dir = NULL;
+ DirAccess *dir = nullptr;
String data_path;
String data_dir;
@@ -1524,7 +1524,7 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) {
if (!EditorSettings::get_singleton()) {
- return NULL;
+ return nullptr;
}
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(p_path);
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 2c115c66cb..4eefe844d2 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -362,7 +362,7 @@ void EditorSpinSlider::_evaluate_input_text() {
return;
}
- Variant v = expr->execute(Array(), NULL, false);
+ Variant v = expr->execute(Array(), nullptr, false);
if (v.get_type() == Variant::NIL)
return;
set_value(v);
diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp
index cd5768551f..1205e0b37c 100644
--- a/editor/editor_sub_scene.cpp
+++ b/editor/editor_sub_scene.cpp
@@ -46,7 +46,7 @@ void EditorSubScene::_path_changed(const String &p_path) {
if (scene) {
memdelete(scene);
- scene = NULL;
+ scene = nullptr;
}
if (p_path == "")
@@ -61,7 +61,7 @@ void EditorSubScene::_path_changed(const String &p_path) {
if (!scene)
return;
- _fill_tree(scene, NULL);
+ _fill_tree(scene, nullptr);
}
void EditorSubScene::_path_browse() {
@@ -72,7 +72,7 @@ void EditorSubScene::_path_browse() {
void EditorSubScene::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
- if (is_visible() && scene == NULL) {
+ if (is_visible() && scene == nullptr) {
_path_browse();
}
}
@@ -209,7 +209,7 @@ void EditorSubScene::move(Node *p_new_parent, Node *p_new_owner) {
if (!is_root) {
memdelete(scene);
}
- scene = NULL;
+ scene = nullptr;
//return selnode;
}
@@ -226,7 +226,7 @@ void EditorSubScene::_bind_methods() {
EditorSubScene::EditorSubScene() {
- scene = NULL;
+ scene = nullptr;
is_root = false;
set_title(TTR("Select Node(s) to Import"));
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ac902854b7..663068b2b5 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -248,7 +248,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
}
}
- ImageLoaderSVG::set_convert_colors(NULL);
+ ImageLoaderSVG::set_convert_colors(nullptr);
#else
WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
#endif
@@ -418,7 +418,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//Register icons + font
// the resolution and the icon color (dark_theme bool) has not changed, so we do not regenerate the icons
- if (p_theme != NULL && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) {
+ if (p_theme != nullptr && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) {
// register already generated icons
for (int i = 0; i < editor_icons_count; i++) {
theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons"));
@@ -427,7 +427,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
editor_register_and_generate_icons(theme, dark_theme, thumb_size);
}
// thumbnail size has changed, so we regenerate the medium sizes
- if (p_theme != NULL && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) {
+ if (p_theme != nullptr && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) {
editor_register_and_generate_icons(p_theme, dark_theme, thumb_size, true);
}
diff --git a/editor/editor_themes.h b/editor/editor_themes.h
index 6e9630804f..4d9bfc56c8 100644
--- a/editor/editor_themes.h
+++ b/editor/editor_themes.h
@@ -33,8 +33,8 @@
#include "scene/resources/theme.h"
-Ref<Theme> create_editor_theme(Ref<Theme> p_theme = NULL);
+Ref<Theme> create_editor_theme(Ref<Theme> p_theme = nullptr);
-Ref<Theme> create_custom_theme(Ref<Theme> p_theme = NULL);
+Ref<Theme> create_custom_theme(Ref<Theme> p_theme = nullptr);
#endif
diff --git a/editor/editor_vcs_interface.cpp b/editor/editor_vcs_interface.cpp
index c420cf44e7..6f3a8d9ea7 100644
--- a/editor/editor_vcs_interface.cpp
+++ b/editor/editor_vcs_interface.cpp
@@ -30,7 +30,7 @@
#include "editor_vcs_interface.h"
-EditorVCSInterface *EditorVCSInterface::singleton = NULL;
+EditorVCSInterface *EditorVCSInterface::singleton = nullptr;
void EditorVCSInterface::_bind_methods() {
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 61ec9c44c2..7cb18432a7 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -184,7 +184,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
// unzClose() will take care of closing the file stored in the unzFile,
// so we don't need to `memdelete(fa)` in this method.
- FileAccess *fa = NULL;
+ FileAccess *fa = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&fa);
unzFile pkg = unzOpen2(p_file.utf8().get_data(), &io);
@@ -203,7 +203,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file = fname;
@@ -258,7 +258,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
ret = unzGoToFirstFile(pkg);
- EditorProgress *p = NULL;
+ EditorProgress *p = nullptr;
if (p_use_progress) {
p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc));
}
@@ -270,7 +270,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_
//get filename
unz_file_info info;
char fname[16384];
- unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file_path(String(fname).simplify_path());
@@ -587,7 +587,7 @@ Error ExportTemplateManager::install_android_template() {
const String &source_zip = templates_path.plus_file("android_source.zip");
ERR_FAIL_COND_V(!FileAccess::exists(source_zip), ERR_CANT_OPEN);
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(source_zip.utf8().get_data(), &io);
@@ -611,7 +611,7 @@ Error ExportTemplateManager::install_android_template() {
// Get file path.
unz_file_info info;
char fpath[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fpath, 16384, nullptr, 0, nullptr, 0);
String path = fpath;
String base_dir = path.get_base_dir();
diff --git a/editor/fileserver/SCsub b/editor/fileserver/SCsub
index 2b1e889fb0..359d04e5df 100644
--- a/editor/fileserver/SCsub
+++ b/editor/fileserver/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index e1fcddda3a..236ae16ccf 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -843,7 +843,7 @@ void FileSystemDock::_tree_activate_file() {
if (selected) {
String path = selected->get_metadata(0);
TreeItem *parent = selected->get_parent();
- bool is_favorite = parent != NULL && parent->get_metadata(0) == "Favorites";
+ bool is_favorite = parent != nullptr && parent->get_metadata(0) == "Favorites";
if ((!is_favorite && path.ends_with("/")) || path == "Favorites") {
bool collapsed = selected->is_collapsed();
@@ -955,7 +955,7 @@ void FileSystemDock::_push_to_history() {
}
void FileSystemDock::_get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const {
- if (efsd == NULL)
+ if (efsd == nullptr)
return;
for (int i = 0; i < efsd->get_subdir_count(); i++) {
@@ -1871,7 +1871,7 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from)
return Variant();
}
- bool is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent();
+ bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_children() == selected->get_parent();
all_favorites &= is_favorite;
all_not_favorites &= !is_favorite;
selected = tree->get_next_selected(selected);
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 61afc9115f..d73180c831 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -708,7 +708,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
TreeItem *file_item;
Map<String, TreeItem *>::Element *E = _file_items.find(fpath);
- if (E == NULL) {
+ if (E == nullptr) {
file_item = _results_display->create_item();
file_item->set_text(0, fpath);
file_item->set_metadata(0, fpath);
@@ -813,7 +813,7 @@ void FindInFilesPanel::_on_result_selected() {
TreeItem *item = _results_display->get_selected();
Map<TreeItem *, Result>::Element *E = _result_items.find(item);
- if (E == NULL)
+ if (E == nullptr)
return;
Result r = E->value();
@@ -845,7 +845,7 @@ void FindInFilesPanel::_on_replace_all_clicked() {
continue;
Map<TreeItem *, Result>::Element *F = _result_items.find(item);
- ERR_FAIL_COND(F == NULL);
+ ERR_FAIL_COND(F == nullptr);
locations.push_back(F->value());
}
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 686ca869a6..7e5d2e87d6 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -68,7 +68,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
keep = false;
}
- TreeItem *node = NULL;
+ TreeItem *node = nullptr;
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()))) {
@@ -122,7 +122,7 @@ bool GroupDialog::_can_edit(Node *p_node, String p_group) {
}
void GroupDialog::_add_pressed() {
- TreeItem *selected = nodes_to_add->get_next_selected(NULL);
+ TreeItem *selected = nodes_to_add->get_next_selected(nullptr);
if (!selected) {
return;
@@ -151,7 +151,7 @@ void GroupDialog::_add_pressed() {
}
void GroupDialog::_removed_pressed() {
- TreeItem *selected = nodes_to_remove->get_next_selected(NULL);
+ TreeItem *selected = nodes_to_remove->get_next_selected(nullptr);
if (!selected) {
return;
@@ -662,7 +662,7 @@ void GroupsEditor::_bind_methods() {
GroupsEditor::GroupsEditor() {
- node = NULL;
+ node = nullptr;
VBoxContainer *vbc = this;
diff --git a/editor/icons/GizmoCPUParticles.svg b/editor/icons/GizmoCPUParticles3D.svg
index d4e86d9c42..d4e86d9c42 100644
--- a/editor/icons/GizmoCPUParticles.svg
+++ b/editor/icons/GizmoCPUParticles3D.svg
diff --git a/editor/icons/GizmoParticles.svg b/editor/icons/GizmoGPUParticles3D.svg
index 1c5d8c5f2d..1c5d8c5f2d 100644
--- a/editor/icons/GizmoParticles.svg
+++ b/editor/icons/GizmoGPUParticles3D.svg
diff --git a/editor/icons/SCsub b/editor/icons/SCsub
index b39c74c66a..f0d51999f0 100644
--- a/editor/icons/SCsub
+++ b/editor/icons/SCsub
@@ -1,21 +1,21 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
from platform_methods import run_in_subprocess
import editor_icons_builders
-make_editor_icons_builder = Builder(action=run_in_subprocess(editor_icons_builders.make_editor_icons_action),
- suffix='.h',
- src_suffix='.svg')
+make_editor_icons_builder = Builder(
+ action=run_in_subprocess(editor_icons_builders.make_editor_icons_action), suffix=".h", src_suffix=".svg"
+)
-env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder
+env["BUILDERS"]["MakeEditorIconsBuilder"] = make_editor_icons_builder
# Editor's own icons
icon_sources = Glob("*.svg")
# Module icons
for module_icons in env.module_icons_paths:
- icon_sources += Glob('#' + module_icons + "/*.svg")
+ icon_sources += Glob("#" + module_icons + "/*.svg")
-env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#editor/editor_icons.gen.h', icon_sources)])
+env.Alias("editor_icons", [env.MakeEditorIconsBuilder("#editor/editor_icons.gen.h", icon_sources)])
diff --git a/editor/icons/SubViewport.svg b/editor/icons/SubViewport.svg
new file mode 100644
index 0000000000..103b1006ad
--- /dev/null
+++ b/editor/icons/SubViewport.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 2c-.5304.0000801-1.0390625.2108475-1.4140625.5859375-.37509.37501-.5858575.8836225-.5859375 1.4140625v8c.0000803.5304.2108475 1.039063.5859375 1.414062.37501.375091.8836225.585858 1.4140625.585938h10c1.1046 0 2-.89543 2-2v-8c0-1.1046-.89543-2-2-2zm0 1h10c.55228.0000096.99999.44772 1 1v8c-.00001.55228-.44772.99999-1 1h-10c-.55228-.00001-.99999-.44772-1-1v-8c.0000096-.55228.44772-.99999 1-1zm3 1c-.5304.0001-1.0390625.2108375-1.4140625.5859375-.37509.375-.5858575.8836225-.5859375 1.4140625v4c.00008.5304.2108475 1.039062.5859375 1.414062.37501.3751.8836225.585838 1.4140625.585938h4c1.1046 0 2-.8954 2-2v-4c0-1.1046-.89543-2-2-2zm0 1h4c.55228 0 .99999.4477 1 1v4c-.00001.5523-.44772 1-1 1h-4c-.55228 0-.99999-.4477-1-1v-4c.00001-.5523.44772-1 1-1z" fill="#e0e0e0" fill-opacity=".996078"/></svg> \ No newline at end of file
diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py
index a00f21c265..d7145abe50 100644
--- a/editor/icons/editor_icons_builders.py
+++ b/editor/icons/editor_icons_builders.py
@@ -22,16 +22,16 @@ def make_editor_icons_action(target, source, env):
icons_string.write('\t"')
- with open(fname, 'rb') as svgf:
+ with open(fname, "rb") as svgf:
b = svgf.read(1)
- while(len(b) == 1):
+ while len(b) == 1:
icons_string.write("\\" + str(hex(ord(b)))[1:])
b = svgf.read(1)
icons_string.write('"')
if fname != svg_icons[-1]:
icons_string.write(",")
- icons_string.write('\n')
+ icons_string.write("\n")
s = StringIO()
s.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
@@ -40,7 +40,7 @@ def make_editor_icons_action(target, source, env):
s.write("static const int editor_icons_count = {};\n".format(len(svg_icons)))
s.write("static const char *editor_icons_sources[] = {\n")
s.write(icons_string.getvalue())
- s.write('};\n\n')
+ s.write("};\n\n")
s.write("static const char *editor_icons_names[] = {\n")
# this is used to store the indices of thumbnail icons
@@ -63,11 +63,11 @@ def make_editor_icons_action(target, source, env):
if fname != svg_icons[-1]:
s.write(",")
- s.write('\n')
+ s.write("\n")
index += 1
- s.write('};\n')
+ s.write("};\n")
if thumb_medium_indices:
s.write("\n\n")
@@ -91,5 +91,5 @@ def make_editor_icons_action(target, source, env):
icons_string.close()
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/editor/import/SCsub b/editor/import/SCsub
index 2b1e889fb0..359d04e5df 100644
--- a/editor/import/SCsub
+++ b/editor/import/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/import/collada.cpp b/editor/import/collada.cpp
index 8ef9d17083..9e49fa9066 100644
--- a/editor/import/collada.cpp
+++ b/editor/import/collada.cpp
@@ -1540,7 +1540,7 @@ Collada::Node *Collada::_parse_visual_node_instance_data(XMLParser &parser) {
}
if (parser.is_empty()) //nothing else to parse...
- return NULL;
+ return nullptr;
while (parser.read() == OK) {
@@ -1548,7 +1548,7 @@ Collada::Node *Collada::_parse_visual_node_instance_data(XMLParser &parser) {
break;
}
- return NULL;
+ return nullptr;
}
Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
@@ -1572,7 +1572,7 @@ Collada::Node *Collada::_parse_visual_scene_node(XMLParser &parser) {
String empty_draw_type = "";
- Node *node = NULL;
+ Node *node = nullptr;
name = parser.has_attribute("name") ? parser.get_attribute_value_safe("name") : parser.get_attribute_value_safe("id");
if (name == "") {
@@ -2140,7 +2140,7 @@ void Collada::_create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton
NodeJoint *nj = static_cast<NodeJoint *>(node);
nj->owner = p_skeleton;
} else {
- p_skeleton = NULL;
+ p_skeleton = nullptr;
}
for (int i = 0; i < node->children.size(); i++) {
@@ -2240,7 +2240,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
SkinControllerData &cd = E->get();
- NodeSkeleton *skeleton = NULL;
+ NodeSkeleton *skeleton = nullptr;
for (Map<String, Transform>::Element *F = cd.bone_rest_map.front(); F; F = F->next()) {
@@ -2257,7 +2257,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
Node *node = state.scene_map[name];
ERR_CONTINUE(node->type != Node::TYPE_JOINT);
- NodeSkeleton *sk = NULL;
+ NodeSkeleton *sk = nullptr;
while (node && !sk) {
diff --git a/editor/import/collada.h b/editor/import/collada.h
index 4707d7d779..b74332fb22 100644
--- a/editor/import/collada.h
+++ b/editor/import/collada.h
@@ -404,7 +404,7 @@ public:
Node() {
noname = false;
type = TYPE_NODE;
- parent = NULL;
+ parent = nullptr;
ignore_anim = false;
}
virtual ~Node() {
@@ -424,7 +424,7 @@ public:
String sid;
NodeJoint() {
type = TYPE_JOINT;
- owner = NULL;
+ owner = nullptr;
}
};
@@ -631,7 +631,7 @@ private: // private stuff
String _read_empty_draw_type(XMLParser &parser);
void _joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner);
- void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton = NULL);
+ void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton = nullptr);
void _find_morph_nodes(VisualScene *p_vscene, Node *p_node);
bool _remove_node(Node *p_parent, Node *p_node);
void _remove_node(VisualScene *p_vscene, Node *p_node);
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 6c089d7020..697ddfba96 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -58,7 +58,7 @@ struct ColladaImport {
List<int> anim_tracks;
NodeMap() {
- node = NULL;
+ node = nullptr;
bone = -1;
}
};
@@ -195,7 +195,7 @@ Error ColladaImport::_create_scene_skeletons(Collada::Node *p_node) {
Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
- Node3D *node = NULL;
+ Node3D *node = nullptr;
switch (p_node->type) {
@@ -318,7 +318,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
} else {
//mesh since nothing else
node = memnew(MeshInstance3D);
- //Object::cast_to<MeshInstance>(node)->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true);
+ //Object::cast_to<MeshInstance3D>(node)->set_flag(GeometryInstance3D::FLAG_USE_BAKED_LIGHT, true);
}
} break;
case Collada::Node::TYPE_SKELETON: {
@@ -536,7 +536,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
/* NORMAL SOURCE */
- const Collada::MeshData::Source *normal_src = NULL;
+ const Collada::MeshData::Source *normal_src = nullptr;
int normal_ofs = 0;
if (p.sources.has("NORMAL")) {
@@ -547,7 +547,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
normal_src = &meshdata.sources[normal_source_id];
}
- const Collada::MeshData::Source *binormal_src = NULL;
+ const Collada::MeshData::Source *binormal_src = nullptr;
int binormal_ofs = 0;
if (p.sources.has("TEXBINORMAL")) {
@@ -558,7 +558,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
binormal_src = &meshdata.sources[binormal_source_id];
}
- const Collada::MeshData::Source *tangent_src = NULL;
+ const Collada::MeshData::Source *tangent_src = nullptr;
int tangent_ofs = 0;
if (p.sources.has("TEXTANGENT")) {
@@ -569,7 +569,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
tangent_src = &meshdata.sources[tangent_source_id];
}
- const Collada::MeshData::Source *uv_src = NULL;
+ const Collada::MeshData::Source *uv_src = nullptr;
int uv_ofs = 0;
if (p.sources.has("TEXCOORD0")) {
@@ -580,7 +580,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
uv_src = &meshdata.sources[uv_source_id];
}
- const Collada::MeshData::Source *uv2_src = NULL;
+ const Collada::MeshData::Source *uv2_src = nullptr;
int uv2_ofs = 0;
if (p.sources.has("TEXCOORD1")) {
@@ -591,7 +591,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
uv2_src = &meshdata.sources[uv2_source_id];
}
- const Collada::MeshData::Source *color_src = NULL;
+ const Collada::MeshData::Source *color_src = nullptr;
int color_ofs = 0;
if (p.sources.has("COLOR")) {
@@ -614,7 +614,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
if (p_skin_controller) {
- const Collada::SkinControllerData::Source *weight_src = NULL;
+ const Collada::SkinControllerData::Source *weight_src = nullptr;
int weight_ofs = 0;
if (p_skin_controller->weights.sources.has("WEIGHT")) {
@@ -1047,7 +1047,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
const Collada::CurveData::Source &interps = cd.sources[cd.control_vertices["INTERPOLATION"]];
ERR_FAIL_COND_V(interps.stride != 1, ERR_INVALID_DATA);
- const Collada::CurveData::Source *tilts = NULL;
+ const Collada::CurveData::Source *tilts = nullptr;
if (cd.control_vertices.has("TILT") && cd.sources.has(cd.control_vertices["TILT"]))
tilts = &cd.sources[cd.control_vertices["TILT"]];
@@ -1091,8 +1091,8 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
ERR_FAIL_COND_V(!mi, ERR_BUG);
- Collada::SkinControllerData *skin = NULL;
- Collada::MorphControllerData *morph = NULL;
+ Collada::SkinControllerData *skin = nullptr;
+ Collada::MorphControllerData *morph = nullptr;
String meshid;
Transform apply_xform;
Vector<int> bone_remap;
@@ -1173,7 +1173,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2];
mesh->set_name(meshdata.name);
- Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh>>(), false);
+ Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, nullptr, Vector<Ref<ArrayMesh>>(), false);
ERR_FAIL_COND_V(err, err);
morphs.push_back(mesh);
@@ -1777,7 +1777,7 @@ Node *EditorSceneImporterCollada::import_scene(const String &p_path, uint32_t p_
Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, p_flags & EditorSceneImporter::IMPORT_USE_COMPRESSION);
- ERR_FAIL_COND_V_MSG(err != OK, NULL, "Cannot load scene from file '" + p_path + "'.");
+ ERR_FAIL_COND_V_MSG(err != OK, nullptr, "Cannot load scene from file '" + p_path + "'.");
if (state.missing_textures.size()) {
diff --git a/editor/import/editor_import_collada.h b/editor/import/editor_import_collada.h
index 822a6450be..932a064e76 100644
--- a/editor/import/editor_import_collada.h
+++ b/editor/import/editor_import_collada.h
@@ -40,7 +40,7 @@ class EditorSceneImporterCollada : public EditorSceneImporter {
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = NULL, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
EditorSceneImporterCollada();
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index 4383b1b084..be4679b6d3 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -52,7 +52,7 @@ public:
virtual int get_import_order() const;
virtual void get_import_options(List<ImportOption> *r_options, int p_preset) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = nullptr);
};
#endif //EDITOR_IMPORT_PLUGIN_H
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 208dc8fc26..6ad2aa4142 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1266,7 +1266,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
}
Vector<uint8_t> data;
- const uint8_t *data_ptr = NULL;
+ const uint8_t *data_ptr = nullptr;
int data_size = 0;
if (d.has("uri")) {
@@ -1307,7 +1307,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
if (mimetype.findn("png") != -1) {
//is a png
- ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, ERR_UNAVAILABLE);
const Ref<Image> img = Image::_png_mem_loader_func(data_ptr, data_size);
@@ -1323,7 +1323,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
if (mimetype.findn("jpeg") != -1) {
//is a jpg
- ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, ERR_UNAVAILABLE);
const Ref<Image> img = Image::_jpg_mem_loader_func(data_ptr, data_size);
@@ -2985,19 +2985,19 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla
//text file
Error err = _parse_glb(p_path, state);
if (err)
- return NULL;
+ return nullptr;
} else {
//text file
Error err = _parse_json(p_path, state);
if (err)
- return NULL;
+ return nullptr;
}
- ERR_FAIL_COND_V(!state.json.has("asset"), NULL);
+ ERR_FAIL_COND_V(!state.json.has("asset"), nullptr);
Dictionary asset = state.json["asset"];
- ERR_FAIL_COND_V(!asset.has("version"), NULL);
+ ERR_FAIL_COND_V(!asset.has("version"), nullptr);
String version = asset["version"];
@@ -3008,77 +3008,77 @@ Node *EditorSceneImporterGLTF::import_scene(const String &p_path, uint32_t p_fla
/* STEP 0 PARSE SCENE */
Error err = _parse_scenes(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 1 PARSE NODES */
err = _parse_nodes(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 2 PARSE BUFFERS */
err = _parse_buffers(state, p_path.get_base_dir());
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 3 PARSE BUFFER VIEWS */
err = _parse_buffer_views(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 4 PARSE ACCESSORS */
err = _parse_accessors(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 5 PARSE IMAGES */
err = _parse_images(state, p_path.get_base_dir());
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 6 PARSE TEXTURES */
err = _parse_textures(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 7 PARSE TEXTURES */
err = _parse_materials(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 9 PARSE SKINS */
err = _parse_skins(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 10 DETERMINE SKELETONS */
err = _determine_skeletons(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 11 CREATE SKELETONS */
err = _create_skeletons(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 12 CREATE SKINS */
err = _create_skins(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 13 PARSE MESHES (we have enough info now) */
err = _parse_meshes(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 14 PARSE CAMERAS */
err = _parse_cameras(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 15 PARSE ANIMATIONS */
err = _parse_animations(state);
if (err != OK)
- return NULL;
+ return nullptr;
/* STEP 16 ASSIGN SCENE NAMES */
_assign_scene_names(state);
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index 79395cca93..d127a87782 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -415,7 +415,7 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = NULL, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps = nullptr, Error *r_err = nullptr);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
EditorSceneImporterGLTF();
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index dd95cb687a..927fac566e 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -51,7 +51,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterBitMap();
~ResourceImporterBitMap();
diff --git a/editor/import/resource_importer_csv.h b/editor/import/resource_importer_csv.h
index 2030dd1f99..7aa48f68de 100644
--- a/editor/import/resource_importer_csv.h
+++ b/editor/import/resource_importer_csv.h
@@ -49,7 +49,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterCSV();
};
diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h
index ec33d6aa16..742f6b8f60 100644
--- a/editor/import/resource_importer_csv_translation.h
+++ b/editor/import/resource_importer_csv_translation.h
@@ -49,7 +49,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterCSVTranslation();
};
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index 6ad77eec1b..abb74d0665 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -50,7 +50,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterImage();
};
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index d472070808..a4cbc81b26 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -259,7 +259,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
Ref<Image> image;
image.instance();
- Error err = ImageLoader::load_image(p_source_file, image, NULL, false, 1.0);
+ Error err = ImageLoader::load_image(p_source_file, image, nullptr, false, 1.0);
if (err != OK)
return err;
@@ -383,7 +383,7 @@ const char *ResourceImporterLayeredTexture::compression_formats[] = {
"etc",
"etc2",
"pvrtc",
- NULL
+ nullptr
};
String ResourceImporterLayeredTexture::get_import_settings_string() const {
@@ -438,7 +438,7 @@ bool ResourceImporterLayeredTexture::are_import_settings_valid(const String &p_p
return valid;
}
-ResourceImporterLayeredTexture *ResourceImporterLayeredTexture::singleton = NULL;
+ResourceImporterLayeredTexture *ResourceImporterLayeredTexture::singleton = nullptr;
ResourceImporterLayeredTexture::ResourceImporterLayeredTexture() {
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index 6a6bc89a81..40e5c9023e 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -114,7 +114,7 @@ public:
void _save_tex(const Vector<Ref<Image> > &p_images, const String &p_to_path, int p_compress_mode, Image::CompressMode p_vram_compression, bool p_mipmaps);
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
void update_imports();
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 4be6f2ed80..6a6eadfa5c 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -428,7 +428,7 @@ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, in
if (r_err) {
*r_err = err;
}
- return NULL;
+ return nullptr;
}
Node3D *scene = memnew(Node3D);
@@ -502,7 +502,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["optimize_mesh"], p_options["scale_mesh"], p_options["offset_mesh"], NULL);
+ Error err = _parse_obj(p_source_file, meshes, true, p_options["generate_tangents"], p_options["optimize_mesh"], p_options["scale_mesh"], p_options["offset_mesh"], nullptr);
ERR_FAIL_COND_V(err != OK, err);
ERR_FAIL_COND_V(meshes.size() != 1, ERR_BUG);
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index 678be45106..7485e60f7b 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -40,7 +40,7 @@ class EditorOBJImporter : public EditorSceneImporter {
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
EditorOBJImporter();
@@ -62,7 +62,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterOBJ();
};
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index fb57773b18..b5766a48a0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -72,7 +72,7 @@ Node *EditorSceneImporter::import_scene(const String &p_path, uint32_t p_flags,
return get_script_instance()->call("_import_scene", p_path, p_flags, p_bake_fps);
}
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
Ref<Animation> EditorSceneImporter::import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) {
@@ -81,7 +81,7 @@ Ref<Animation> EditorSceneImporter::import_animation(const String &p_path, uint3
return get_script_instance()->call("_import_animation", p_path, p_flags);
}
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
//for documenters, these functions are useful when an importer calls an external conversion helper (like, fbx2gltf),
@@ -311,7 +311,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
if (!isroot && _teststr(name, "noimp")) {
memdelete(p_node);
- return NULL;
+ return nullptr;
}
if (Object::cast_to<MeshInstance3D>(p_node)) {
@@ -400,7 +400,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
fixed_name = _fixstr(name, "convcolonly");
}
- ERR_FAIL_COND_V(fixed_name == String(), NULL);
+ ERR_FAIL_COND_V(fixed_name == String(), nullptr);
if (shapes.size()) {
@@ -432,7 +432,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
Object::cast_to<Node3D>(sb)->set_transform(Object::cast_to<Node3D>(p_node)->get_transform());
p_node->replace_by(sb);
memdelete(p_node);
- p_node = NULL;
+ p_node = nullptr;
CollisionShape3D *colshape = memnew(CollisionShape3D);
if (empty_draw_type == "CUBE") {
BoxShape3D *boxShape = memnew(BoxShape3D);
@@ -448,7 +448,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
} else if (empty_draw_type == "IMAGE") {
WorldMarginShape3D *world_margin_shape = memnew(WorldMarginShape3D);
colshape->set_shape(world_margin_shape);
- colshape->set_name("WorldMarginShape");
+ colshape->set_name("WorldMarginShape3D");
} else {
SphereShape3D *sphereShape = memnew(SphereShape3D);
sphereShape->set_radius(1);
@@ -558,7 +558,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
MeshInstance3D *mi = Object::cast_to<MeshInstance3D>(p_node);
Ref<ArrayMesh> mesh = mi->get_mesh();
- ERR_FAIL_COND_V(mesh.is_null(), NULL);
+ ERR_FAIL_COND_V(mesh.is_null(), nullptr);
NavigationRegion3D *nmi = memnew(NavigationRegion3D);
nmi->set_name(_fixstr(name, "navmesh"));
@@ -1229,7 +1229,7 @@ Node *ResourceImporterScene::import_scene_from_other_importer(EditorSceneImporte
break;
}
- ERR_FAIL_COND_V(!importer.is_valid(), NULL);
+ ERR_FAIL_COND_V(!importer.is_valid(), nullptr);
List<String> missing;
Error err;
@@ -1261,7 +1261,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
break;
}
- ERR_FAIL_COND_V(!importer.is_valid(), NULL);
+ ERR_FAIL_COND_V(!importer.is_valid(), nullptr);
return importer->import_animation(p_path, p_flags, p_bake_fps);
}
@@ -1327,7 +1327,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
String root_type = p_options["nodes/root_type"];
root_type = root_type.split(" ")[0]; // full root_type is "ClassName (filename.gd)" for a script global class.
- Ref<Script> root_script = NULL;
+ Ref<Script> root_script = nullptr;
if (ScriptServer::is_global_class(root_type)) {
root_script = ResourceLoader::load(ScriptServer::get_global_class_path(root_type));
root_type = ScriptServer::get_global_class_base(root_type);
@@ -1533,7 +1533,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
return OK;
}
-ResourceImporterScene *ResourceImporterScene::singleton = NULL;
+ResourceImporterScene *ResourceImporterScene::singleton = nullptr;
ResourceImporterScene::ResourceImporterScene() {
singleton = this;
@@ -1550,10 +1550,10 @@ Node *EditorSceneImporterESCN::import_scene(const String &p_path, uint32_t p_fla
Error error;
Ref<PackedScene> ps = ResourceFormatLoaderText::singleton->load(p_path, p_path, &error);
- ERR_FAIL_COND_V_MSG(!ps.is_valid(), NULL, "Cannot load scene as text resource from path '" + p_path + "'.");
+ ERR_FAIL_COND_V_MSG(!ps.is_valid(), nullptr, "Cannot load scene as text resource from path '" + p_path + "'.");
Node *scene = ps->instance();
- ERR_FAIL_COND_V(!scene, NULL);
+ ERR_FAIL_COND_V(!scene, nullptr);
return scene;
}
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index bb01725854..f48f181951 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -66,7 +66,7 @@ public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
EditorSceneImporter() {}
@@ -154,7 +154,7 @@ public:
void _filter_tracks(Node *scene, const String &p_text);
void _optimize_animations(Node *scene, float p_max_lin_error, float p_max_ang_error, float p_max_angle);
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
Node *import_scene_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps);
Ref<Animation> import_animation_from_other_importer(EditorSceneImporter *p_exception, const String &p_path, uint32_t p_flags, int p_bake_fps);
@@ -168,7 +168,7 @@ class EditorSceneImporterESCN : public EditorSceneImporter {
public:
virtual uint32_t get_import_flags() const;
virtual void get_extensions(List<String> *r_extensions) const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps);
};
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index c218697423..f8ed9304b6 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -424,7 +424,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
String normal_map = p_options["roughness/src_normal"];
Ref<Image> normal_image;
- Image::RoughnessChannel roughness_channel;
+ Image::RoughnessChannel roughness_channel = Image::ROUGHNESS_CHANNEL_R;
if (mipmaps && roughness > 1 && FileAccess::exists(normal_map)) {
normal_image.instance();
@@ -434,7 +434,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
}
Ref<Image> image;
image.instance();
- Error err = ImageLoader::load_image(p_source_file, image, NULL, hdr_as_srgb, scale);
+ Error err = ImageLoader::load_image(p_source_file, image, nullptr, hdr_as_srgb, scale);
if (err != OK)
return err;
@@ -575,7 +575,7 @@ const char *ResourceImporterTexture::compression_formats[] = {
"etc",
"etc2",
"pvrtc",
- NULL
+ nullptr
};
String ResourceImporterTexture::get_import_settings_string() const {
@@ -630,7 +630,7 @@ bool ResourceImporterTexture::are_import_settings_valid(const String &p_path) co
return valid;
}
-ResourceImporterTexture *ResourceImporterTexture::singleton = NULL;
+ResourceImporterTexture *ResourceImporterTexture::singleton = nullptr;
ResourceImporterTexture::ResourceImporterTexture() {
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index 5f5fb75585..e1c71ff1b8 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -104,7 +104,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
void update_imports();
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
index a36cae5872..c61fa5c040 100644
--- a/editor/import/resource_importer_texture_atlas.h
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -63,7 +63,7 @@ public:
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
virtual String get_option_group_file() const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths);
ResourceImporterTextureAtlas();
diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h
index 6df5b88b13..bc2f023e6b 100644
--- a/editor/import/resource_importer_wav.h
+++ b/editor/import/resource_importer_wav.h
@@ -162,7 +162,7 @@ public:
}
}
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterWAV();
};
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 223e7a841f..3715547bdc 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -112,7 +112,7 @@ void InspectorDock::_menu_option(int p_option) {
editor_data->get_undo_redo().clear_history();
- editor->get_editor_plugins_over()->edit(NULL);
+ editor->get_editor_plugins_over()->edit(nullptr);
editor->get_editor_plugins_over()->edit(current);
} break;
@@ -166,7 +166,7 @@ void InspectorDock::_resource_file_selected(String p_file) {
void InspectorDock::_save_resource(bool save_as) const {
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -180,7 +180,7 @@ void InspectorDock::_save_resource(bool save_as) const {
void InspectorDock::_unref_resource() const {
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -191,7 +191,7 @@ void InspectorDock::_unref_resource() const {
void InspectorDock::_copy_resource() const {
ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -397,7 +397,7 @@ void InspectorDock::update(Object *p_object) {
editor_path->set_disabled(true);
editor_path->set_text("");
editor_path->set_tooltip("");
- editor_path->set_icon(NULL);
+ editor_path->set_icon(nullptr);
return;
}
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index 40c17a9fc3..ab43e45af7 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -773,17 +773,17 @@ EditorNode3DGizmo::EditorNode3DGizmo() {
valid = false;
billboard_handle = false;
hidden = false;
- base = NULL;
+ base = nullptr;
selected = false;
instanced = false;
- spatial_node = NULL;
- gizmo_plugin = NULL;
+ spatial_node = nullptr;
+ gizmo_plugin = nullptr;
selectable_icon_size = -1.0f;
}
EditorNode3DGizmo::~EditorNode3DGizmo() {
- if (gizmo_plugin != NULL) gizmo_plugin->unregister_gizmo(this);
+ if (gizmo_plugin != nullptr) gizmo_plugin->unregister_gizmo(this);
clear();
}
@@ -812,7 +812,7 @@ LightNode3DGizmoPlugin::LightNode3DGizmoPlugin() {
}
bool LightNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Light3D>(p_spatial) != NULL;
+ return Object::cast_to<Light3D>(p_spatial) != nullptr;
}
String LightNode3DGizmoPlugin::get_name() const {
@@ -1097,7 +1097,7 @@ AudioStreamPlayer3DNode3DGizmoPlugin::AudioStreamPlayer3DNode3DGizmoPlugin() {
}
bool AudioStreamPlayer3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<AudioStreamPlayer3D>(p_spatial) != NULL;
+ return Object::cast_to<AudioStreamPlayer3D>(p_spatial) != nullptr;
}
String AudioStreamPlayer3DNode3DGizmoPlugin::get_name() const {
@@ -1242,7 +1242,7 @@ CameraNode3DGizmoPlugin::CameraNode3DGizmoPlugin() {
}
bool CameraNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Camera3D>(p_spatial) != NULL;
+ return Object::cast_to<Camera3D>(p_spatial) != nullptr;
}
String CameraNode3DGizmoPlugin::get_name() const {
@@ -1493,7 +1493,7 @@ MeshInstanceNode3DGizmoPlugin::MeshInstanceNode3DGizmoPlugin() {
}
bool MeshInstanceNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<MeshInstance3D>(p_spatial) != NULL && Object::cast_to<SoftBody3D>(p_spatial) == NULL;
+ return Object::cast_to<MeshInstance3D>(p_spatial) != nullptr && Object::cast_to<SoftBody3D>(p_spatial) == nullptr;
}
String MeshInstanceNode3DGizmoPlugin::get_name() const {
@@ -1530,7 +1530,7 @@ Sprite3DNode3DGizmoPlugin::Sprite3DNode3DGizmoPlugin() {
}
bool Sprite3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Sprite3D>(p_spatial) != NULL;
+ return Object::cast_to<Sprite3D>(p_spatial) != nullptr;
}
String Sprite3DNode3DGizmoPlugin::get_name() const {
@@ -1593,7 +1593,7 @@ Position3DNode3DGizmoPlugin::Position3DNode3DGizmoPlugin() {
}
bool Position3DNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Position3D>(p_spatial) != NULL;
+ return Object::cast_to<Position3D>(p_spatial) != nullptr;
}
String Position3DNode3DGizmoPlugin::get_name() const {
@@ -1620,7 +1620,7 @@ SkeletonNode3DGizmoPlugin::SkeletonNode3DGizmoPlugin() {
}
bool SkeletonNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Skeleton3D>(p_spatial) != NULL;
+ return Object::cast_to<Skeleton3D>(p_spatial) != nullptr;
}
String SkeletonNode3DGizmoPlugin::get_name() const {
@@ -1827,7 +1827,7 @@ PhysicalBoneNode3DGizmoPlugin::PhysicalBoneNode3DGizmoPlugin() {
}
bool PhysicalBoneNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<PhysicalBone3D>(p_spatial) != NULL;
+ return Object::cast_to<PhysicalBone3D>(p_spatial) != nullptr;
}
String PhysicalBoneNode3DGizmoPlugin::get_name() const {
@@ -1967,11 +1967,11 @@ RayCastNode3DGizmoPlugin::RayCastNode3DGizmoPlugin() {
}
bool RayCastNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<RayCast3D>(p_spatial) != NULL;
+ return Object::cast_to<RayCast3D>(p_spatial) != nullptr;
}
String RayCastNode3DGizmoPlugin::get_name() const {
- return "RayCast";
+ return "RayCast3D";
}
int RayCastNode3DGizmoPlugin::get_priority() const {
@@ -2021,11 +2021,11 @@ SpringArmNode3DGizmoPlugin::SpringArmNode3DGizmoPlugin() {
}
bool SpringArmNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<SpringArm3D>(p_spatial) != NULL;
+ return Object::cast_to<SpringArm3D>(p_spatial) != nullptr;
}
String SpringArmNode3DGizmoPlugin::get_name() const {
- return "SpringArm";
+ return "SpringArm3D";
}
int SpringArmNode3DGizmoPlugin::get_priority() const {
@@ -2041,11 +2041,11 @@ VehicleWheelNode3DGizmoPlugin::VehicleWheelNode3DGizmoPlugin() {
}
bool VehicleWheelNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<VehicleWheel3D>(p_spatial) != NULL;
+ return Object::cast_to<VehicleWheel3D>(p_spatial) != nullptr;
}
String VehicleWheelNode3DGizmoPlugin::get_name() const {
- return "VehicleWheel";
+ return "VehicleWheel3D";
}
int VehicleWheelNode3DGizmoPlugin::get_priority() const {
@@ -2115,11 +2115,11 @@ SoftBodyNode3DGizmoPlugin::SoftBodyNode3DGizmoPlugin() {
}
bool SoftBodyNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<SoftBody3D>(p_spatial) != NULL;
+ return Object::cast_to<SoftBody3D>(p_spatial) != nullptr;
}
String SoftBodyNode3DGizmoPlugin::get_name() const {
- return "SoftBody";
+ return "SoftBody3D";
}
int SoftBodyNode3DGizmoPlugin::get_priority() const {
@@ -2162,7 +2162,7 @@ void SoftBodyNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
String SoftBodyNode3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
- return "SoftBody pin point";
+ return "SoftBody3D pin point";
}
Variant SoftBodyNode3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
@@ -2191,11 +2191,11 @@ VisibilityNotifierGizmoPlugin::VisibilityNotifierGizmoPlugin() {
}
bool VisibilityNotifierGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<VisibilityNotifier3D>(p_spatial) != NULL;
+ return Object::cast_to<VisibilityNotifier3D>(p_spatial) != nullptr;
}
String VisibilityNotifierGizmoPlugin::get_name() const {
- return "VisibilityNotifier";
+ return "VisibilityNotifier3D";
}
int VisibilityNotifierGizmoPlugin::get_priority() const {
@@ -2342,59 +2342,59 @@ void VisibilityNotifierGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
////
-CPUParticlesGizmoPlugin::CPUParticlesGizmoPlugin() {
- create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoCPUParticles", "EditorIcons"));
+CPUParticles3DGizmoPlugin::CPUParticles3DGizmoPlugin() {
+ create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoCPUParticles3D", "EditorIcons"));
}
-bool CPUParticlesGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<CPUParticles3D>(p_spatial) != NULL;
+bool CPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
+ return Object::cast_to<CPUParticles3D>(p_spatial) != nullptr;
}
-String CPUParticlesGizmoPlugin::get_name() const {
- return "CPUParticles";
+String CPUParticles3DGizmoPlugin::get_name() const {
+ return "CPUParticles3D";
}
-int CPUParticlesGizmoPlugin::get_priority() const {
+int CPUParticles3DGizmoPlugin::get_priority() const {
return -1;
}
-bool CPUParticlesGizmoPlugin::is_selectable_when_hidden() const {
+bool CPUParticles3DGizmoPlugin::is_selectable_when_hidden() const {
return true;
}
-void CPUParticlesGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
+void CPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Ref<Material> icon = get_material("particles_icon", p_gizmo);
p_gizmo->add_unscaled_billboard(icon, 0.05);
}
////
-ParticlesGizmoPlugin::ParticlesGizmoPlugin() {
+GPUParticles3DGizmoPlugin::GPUParticles3DGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/particles", Color(0.8, 0.7, 0.4));
create_material("particles_material", gizmo_color);
gizmo_color.a = 0.1;
create_material("particles_solid_material", gizmo_color);
- create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoParticles", "EditorIcons"));
+ create_icon_material("particles_icon", Node3DEditor::get_singleton()->get_theme_icon("GizmoGPUParticles3D", "EditorIcons"));
create_handle_material("handles");
}
-bool ParticlesGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<GPUParticles3D>(p_spatial) != NULL;
+bool GPUParticles3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
+ return Object::cast_to<GPUParticles3D>(p_spatial) != nullptr;
}
-String ParticlesGizmoPlugin::get_name() const {
- return "Particles";
+String GPUParticles3DGizmoPlugin::get_name() const {
+ return "GPUParticles3D";
}
-int ParticlesGizmoPlugin::get_priority() const {
+int GPUParticles3DGizmoPlugin::get_priority() const {
return -1;
}
-bool ParticlesGizmoPlugin::is_selectable_when_hidden() const {
+bool GPUParticles3DGizmoPlugin::is_selectable_when_hidden() const {
return true;
}
-String ParticlesGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
+String GPUParticles3DGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0: return "Size X";
@@ -2407,12 +2407,12 @@ String ParticlesGizmoPlugin::get_handle_name(const EditorNode3DGizmo *p_gizmo, i
return "";
}
-Variant ParticlesGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
+Variant GPUParticles3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx) const {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node());
return particles->get_visibility_aabb();
}
-void ParticlesGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
+void GPUParticles3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node());
@@ -2464,7 +2464,7 @@ void ParticlesGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Cam
}
}
-void ParticlesGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
+void GPUParticles3DGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node());
@@ -2480,7 +2480,7 @@ void ParticlesGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx,
ur->commit_action();
}
-void ParticlesGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
+void GPUParticles3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node());
@@ -2548,7 +2548,7 @@ ReflectionProbeGizmoPlugin::ReflectionProbeGizmoPlugin() {
}
bool ReflectionProbeGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<ReflectionProbe>(p_spatial) != NULL;
+ return Object::cast_to<ReflectionProbe>(p_spatial) != nullptr;
}
String ReflectionProbeGizmoPlugin::get_name() const {
@@ -2736,7 +2736,7 @@ GIProbeGizmoPlugin::GIProbeGizmoPlugin() {
}
bool GIProbeGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<GIProbe>(p_spatial) != NULL;
+ return Object::cast_to<GIProbe>(p_spatial) != nullptr;
}
String GIProbeGizmoPlugin::get_name() const {
@@ -2980,7 +2980,7 @@ void BakedIndirectLightGizmoPlugin::commit_handle(EditorNode3DGizmo *p_gizmo, in
}
bool BakedIndirectLightGizmoPlugin::has_gizmo(Spatial *p_spatial) {
- return Object::cast_to<BakedLightmap>(p_spatial) != NULL;
+ return Object::cast_to<BakedLightmap>(p_spatial) != nullptr;
}
String BakedIndirectLightGizmoPlugin::get_name() const {
@@ -3044,7 +3044,7 @@ CollisionShapeNode3DGizmoPlugin::CollisionShapeNode3DGizmoPlugin() {
}
bool CollisionShapeNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<CollisionShape3D>(p_spatial) != NULL;
+ return Object::cast_to<CollisionShape3D>(p_spatial) != nullptr;
}
String CollisionShapeNode3DGizmoPlugin::get_name() const {
@@ -3672,7 +3672,7 @@ CollisionPolygonNode3DGizmoPlugin::CollisionPolygonNode3DGizmoPlugin() {
}
bool CollisionPolygonNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<CollisionPolygon3D>(p_spatial) != NULL;
+ return Object::cast_to<CollisionPolygon3D>(p_spatial) != nullptr;
}
String CollisionPolygonNode3DGizmoPlugin::get_name() const {
@@ -3721,11 +3721,11 @@ NavigationMeshNode3DGizmoPlugin::NavigationMeshNode3DGizmoPlugin() {
}
bool NavigationMeshNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<NavigationRegion3D>(p_spatial) != NULL;
+ return Object::cast_to<NavigationRegion3D>(p_spatial) != nullptr;
}
String NavigationMeshNode3DGizmoPlugin::get_name() const {
- return "NavigationRegion";
+ return "NavigationRegion3D";
}
int NavigationMeshNode3DGizmoPlugin::get_priority() const {
@@ -4085,7 +4085,7 @@ JointNode3DGizmoPlugin::JointNode3DGizmoPlugin() {
}
bool JointNode3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
- return Object::cast_to<Joint3D>(p_spatial) != NULL;
+ return Object::cast_to<Joint3D>(p_spatial) != nullptr;
}
String JointNode3DGizmoPlugin::get_name() const {
@@ -4101,12 +4101,12 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
p_gizmo->clear();
- Node3D *node_body_a = NULL;
+ Node3D *node_body_a = nullptr;
if (!joint->get_node_a().is_empty()) {
node_body_a = Object::cast_to<Node3D>(joint->get_node(joint->get_node_a()));
}
- Node3D *node_body_b = NULL;
+ Node3D *node_body_b = nullptr;
if (!joint->get_node_b().is_empty()) {
node_body_b = Object::cast_to<Node3D>(joint->get_node(joint->get_node_b()));
}
@@ -4141,8 +4141,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
hinge->get_param(HingeJoint3D::PARAM_LIMIT_UPPER),
hinge->get_flag(HingeJoint3D::FLAG_USE_LIMIT),
points,
- node_body_a ? &body_a_points : NULL,
- node_body_b ? &body_b_points : NULL);
+ node_body_a ? &body_a_points : nullptr,
+ node_body_b ? &body_b_points : nullptr);
p_gizmo->add_collision_segments(points);
p_gizmo->add_collision_segments(body_a_points);
@@ -4166,8 +4166,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
slider->get_param(SliderJoint3D::PARAM_LINEAR_LIMIT_LOWER),
slider->get_param(SliderJoint3D::PARAM_LINEAR_LIMIT_UPPER),
points,
- node_body_a ? &body_a_points : NULL,
- node_body_b ? &body_b_points : NULL);
+ node_body_a ? &body_a_points : nullptr,
+ node_body_b ? &body_b_points : nullptr);
p_gizmo->add_collision_segments(points);
p_gizmo->add_collision_segments(body_a_points);
@@ -4188,8 +4188,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
node_body_b ? node_body_b->get_global_transform() : Transform(),
cone->get_param(ConeTwistJoint3D::PARAM_SWING_SPAN),
cone->get_param(ConeTwistJoint3D::PARAM_TWIST_SPAN),
- node_body_a ? &body_a_points : NULL,
- node_body_b ? &body_b_points : NULL);
+ node_body_a ? &body_a_points : nullptr,
+ node_body_b ? &body_b_points : nullptr);
p_gizmo->add_collision_segments(body_a_points);
p_gizmo->add_collision_segments(body_b_points);
@@ -4229,8 +4229,8 @@ void JointNode3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
gen->get_flag_z(Generic6DOFJoint3D::FLAG_ENABLE_LINEAR_LIMIT),
points,
- node_body_a ? &body_a_points : NULL,
- node_body_a ? &body_b_points : NULL);
+ node_body_a ? &body_a_points : nullptr,
+ node_body_a ? &body_b_points : nullptr);
p_gizmo->add_collision_segments(points);
p_gizmo->add_collision_segments(body_a_points);
diff --git a/editor/node_3d_editor_gizmos.h b/editor/node_3d_editor_gizmos.h
index 014b736a0d..f8339b4c6c 100644
--- a/editor/node_3d_editor_gizmos.h
+++ b/editor/node_3d_editor_gizmos.h
@@ -236,8 +236,8 @@ public:
VisibilityNotifierGizmoPlugin();
};
-class CPUParticlesGizmoPlugin : public EditorNode3DGizmoPlugin {
- GDCLASS(CPUParticlesGizmoPlugin, EditorNode3DGizmoPlugin);
+class CPUParticles3DGizmoPlugin : public EditorNode3DGizmoPlugin {
+ GDCLASS(CPUParticles3DGizmoPlugin, EditorNode3DGizmoPlugin);
public:
bool has_gizmo(Node3D *p_spatial);
@@ -245,12 +245,12 @@ public:
int get_priority() const;
bool is_selectable_when_hidden() const;
void redraw(EditorNode3DGizmo *p_gizmo);
- CPUParticlesGizmoPlugin();
+ CPUParticles3DGizmoPlugin();
};
-class ParticlesGizmoPlugin : public EditorNode3DGizmoPlugin {
+class GPUParticles3DGizmoPlugin : public EditorNode3DGizmoPlugin {
- GDCLASS(ParticlesGizmoPlugin, EditorNode3DGizmoPlugin);
+ GDCLASS(GPUParticles3DGizmoPlugin, EditorNode3DGizmoPlugin);
public:
bool has_gizmo(Node3D *p_spatial);
@@ -264,7 +264,7 @@ public:
void set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point);
void commit_handle(EditorNode3DGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false);
- ParticlesGizmoPlugin();
+ GPUParticles3DGizmoPlugin();
};
class ReflectionProbeGizmoPlugin : public EditorNode3DGizmoPlugin {
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 0c511e4819..a076b1eecc 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -60,7 +60,7 @@ void NodeDock::_notification(int p_what) {
}
}
-NodeDock *NodeDock::singleton = NULL;
+NodeDock *NodeDock::singleton = nullptr;
void NodeDock::update_lists() {
diff --git a/editor/plugins/SCsub b/editor/plugins/SCsub
index 2b1e889fb0..359d04e5df 100644
--- a/editor/plugins/SCsub
+++ b/editor/plugins/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index e3e9eae31a..c26daa3857 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -218,7 +218,7 @@ void AbstractPolygon2DEditor::_notification(int p_what) {
void AbstractPolygon2DEditor::_node_removed(Node *p_node) {
if (p_node == _get_node()) {
- edit(NULL);
+ edit(nullptr);
hide();
canvas_item_editor->update_viewport();
@@ -690,7 +690,7 @@ void AbstractPolygon2DEditor::edit(Node *p_polygon) {
canvas_item_editor->update_viewport();
} else {
- _set_node(NULL);
+ _set_node(nullptr);
}
}
@@ -801,7 +801,7 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c
AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive) {
- canvas_item_editor = NULL;
+ canvas_item_editor = nullptr;
editor = p_editor;
undo_redo = EditorNode::get_undo_redo();
@@ -854,7 +854,7 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) {
} else {
polygon_editor->hide();
- polygon_editor->edit(NULL);
+ polygon_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 86c43ea9ab..eb50df2166 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -589,7 +589,7 @@ void AnimationNodeBlendSpace1DEditor::edit(const Ref<AnimationNode> &p_node) {
}
}
-AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = NULL;
+AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = nullptr;
AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
singleton = this;
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index 843beacfd6..4343535eb6 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -810,7 +810,7 @@ void AnimationNodeBlendSpace2DEditor::_open_editor() {
}
void AnimationNodeBlendSpace2DEditor::_removed_from_graph() {
- EditorNode::get_singleton()->edit_item(NULL);
+ EditorNode::get_singleton()->edit_item(nullptr);
}
void AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled() {
@@ -833,7 +833,7 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() {
ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendSpace2DEditor::_removed_from_graph);
}
-AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL;
+AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = nullptr;
AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 4491c002e3..54c60aba71 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -579,7 +579,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
NodePath path = E->get();
- TreeItem *ti = NULL;
+ TreeItem *ti = nullptr;
String accum;
for (int i = 0; i < path.get_name_count(); i++) {
String name = path.get_name(i);
@@ -608,7 +608,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
}
}
- Node *node = NULL;
+ Node *node = nullptr;
if (base->has_node(accum)) {
node = base->get_node(accum);
}
@@ -710,7 +710,7 @@ void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) {
void AnimationNodeBlendTreeEditor::_removed_from_graph() {
if (is_visible()) {
- EditorNode::get_singleton()->edit_item(NULL);
+ EditorNode::get_singleton()->edit_item(nullptr);
}
}
@@ -756,7 +756,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
}
AnimationTree *graph_player = AnimationTreeEditor::get_singleton()->get_tree();
- AnimationPlayer *player = NULL;
+ AnimationPlayer *player = nullptr;
if (graph_player->has_node(graph_player->get_animation_player())) {
player = Object::cast_to<AnimationPlayer>(graph_player->get_node(graph_player->get_animation_player()));
}
@@ -802,7 +802,7 @@ void AnimationNodeBlendTreeEditor::_bind_methods() {
ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters);
}
-AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL;
+AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = nullptr;
void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) {
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 0b0f93bcb5..d96a3b0bab 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -46,12 +46,12 @@
void AnimationPlayerEditor::_node_removed(Node *p_node) {
if (player && player == p_node) {
- player = NULL;
+ player = nullptr;
set_process(false);
track_editor->set_animation(Ref<Animation>());
- track_editor->set_root(NULL);
+ track_editor->set_root(nullptr);
track_editor->show_select_node_warning(true);
_update_player();
}
@@ -299,7 +299,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
} else {
track_editor->set_animation(Ref<Animation>());
- track_editor->set_root(NULL);
+ track_editor->set_root(nullptr);
}
autoplay->set_pressed(current == player->get_autoplay());
@@ -407,7 +407,7 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
file->set_current_path(p_resource->get_path());
if (extensions.size()) {
String ext = p_resource->get_path().get_extension().to_lower();
- if (extensions.find(ext) == NULL) {
+ if (extensions.find(ext) == nullptr) {
file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get()));
}
}
@@ -729,7 +729,7 @@ void AnimationPlayerEditor::_animation_edit() {
}
} else {
track_editor->set_animation(Ref<Animation>());
- track_editor->set_root(NULL);
+ track_editor->set_root(nullptr);
}
}
@@ -845,10 +845,10 @@ void AnimationPlayerEditor::_update_player() {
frame->set_editable(animlist.size() != 0);
animation->set_disabled(animlist.size() == 0);
autoplay->set_disabled(animlist.size() == 0);
- tool_anim->set_disabled(player == NULL);
+ tool_anim->set_disabled(player == nullptr);
onion_toggle->set_disabled(animlist.size() == 0);
onion_skinning->set_disabled(animlist.size() == 0);
- pin->set_disabled(player == NULL);
+ pin->set_disabled(player == nullptr);
if (!player) {
AnimationPlayerEditor::singleton->get_track_editor()->update_keying();
@@ -1549,7 +1549,7 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning);
}
-AnimationPlayerEditor *AnimationPlayerEditor::singleton = NULL;
+AnimationPlayerEditor *AnimationPlayerEditor::singleton = nullptr;
AnimationPlayer *AnimationPlayerEditor::get_player() const {
@@ -1565,7 +1565,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
set_focus_mode(FOCUS_ALL);
- player = NULL;
+ player = nullptr;
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 8ff8c92f4d..9267c0df5c 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1082,7 +1082,7 @@ void AnimationNodeStateMachineEditor::_open_editor(const String &p_name) {
void AnimationNodeStateMachineEditor::_removed_from_graph() {
- EditorNode::get_singleton()->edit_item(NULL);
+ EditorNode::get_singleton()->edit_item(nullptr);
}
void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
@@ -1241,7 +1241,7 @@ void AnimationNodeStateMachineEditor::_bind_methods() {
ClassDB::bind_method("_open_editor", &AnimationNodeStateMachineEditor::_open_editor);
}
-AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = NULL;
+AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = nullptr;
AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp
index 605696aa75..e771c5610f 100644
--- a/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_tree_editor_plugin.cpp
@@ -169,7 +169,7 @@ void AnimationTreeEditor::_notification(int p_what) {
void AnimationTreeEditor::_bind_methods() {
}
-AnimationTreeEditor *AnimationTreeEditor::singleton = NULL;
+AnimationTreeEditor *AnimationTreeEditor::singleton = nullptr;
void AnimationTreeEditor::add_plugin(AnimationTreeNodeEditorPlugin *p_editor) {
ERR_FAIL_COND(p_editor->get_parent());
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 3b104e34b2..14c44b7973 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -635,7 +635,7 @@ void EditorAssetLibrary::_install_asset() {
EditorAssetLibraryItemDownload *d = Object::cast_to<EditorAssetLibraryItemDownload>(downloads_hb->get_child(i));
if (d && d->get_asset_id() == description->get_asset_id()) {
- if (EditorNode::get_singleton() != NULL)
+ if (EditorNode::get_singleton() != nullptr)
EditorNode::get_singleton()->show_warning(TTR("Download for this asset is already in progress!"));
return;
}
@@ -1305,7 +1305,7 @@ void EditorAssetLibrary::_asset_file_selected(const String &p_file) {
if (asset_installer) {
memdelete(asset_installer);
- asset_installer = NULL;
+ asset_installer = nullptr;
}
asset_installer = memnew(EditorAssetInstaller);
@@ -1500,7 +1500,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
error_tr->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
error_hb->add_child(error_tr);
- description = NULL;
+ description = nullptr;
set_process(true);
set_process_unhandled_input(true);
@@ -1520,7 +1520,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
add_child(asset_open);
asset_open->connect("file_selected", callable_mp(this, &EditorAssetLibrary::_asset_file_selected));
- asset_installer = NULL;
+ asset_installer = nullptr;
}
///////
diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp
index 6bc9562c5a..ba161244d6 100644
--- a/editor/plugins/baked_lightmap_editor_plugin.cpp
+++ b/editor/plugins/baked_lightmap_editor_plugin.cpp
@@ -81,25 +81,25 @@ void BakedLightmapEditorPlugin::make_visible(bool p_visible) {
}
}
-EditorProgress *BakedLightmapEditorPlugin::tmp_progress = NULL;
+EditorProgress *BakedLightmapEditorPlugin::tmp_progress = nullptr;
void BakedLightmapEditorPlugin::bake_func_begin(int p_steps) {
- ERR_FAIL_COND(tmp_progress != NULL);
+ ERR_FAIL_COND(tmp_progress != nullptr);
tmp_progress = memnew(EditorProgress("bake_lightmaps", TTR("Bake Lightmaps"), p_steps, true));
}
bool BakedLightmapEditorPlugin::bake_func_step(int p_step, const String &p_description) {
- ERR_FAIL_COND_V(tmp_progress == NULL, false);
+ ERR_FAIL_COND_V(tmp_progress == nullptr, false);
return tmp_progress->step(p_description, p_step, false);
}
void BakedLightmapEditorPlugin::bake_func_end() {
- ERR_FAIL_COND(tmp_progress == NULL);
+ ERR_FAIL_COND(tmp_progress == nullptr);
memdelete(tmp_progress);
- tmp_progress = NULL;
+ tmp_progress = nullptr;
}
void BakedLightmapEditorPlugin::_bind_methods() {
@@ -116,7 +116,7 @@ BakedLightmapEditorPlugin::BakedLightmapEditorPlugin(EditorNode *p_node) {
bake->hide();
bake->connect("pressed", this, "_bake");
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake);
- lightmap = NULL;
+ lightmap = nullptr;
BakedLightmap::bake_begin_function = bake_func_begin;
BakedLightmap::bake_step_function = bake_func_step;
diff --git a/editor/plugins/camera_3d_editor_plugin.cpp b/editor/plugins/camera_3d_editor_plugin.cpp
index 3d9b74c2da..8bc1374269 100644
--- a/editor/plugins/camera_3d_editor_plugin.cpp
+++ b/editor/plugins/camera_3d_editor_plugin.cpp
@@ -35,15 +35,15 @@
void Camera3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
- Node3DEditor::get_singleton()->set_custom_camera(NULL);
+ node = nullptr;
+ Node3DEditor::get_singleton()->set_custom_camera(nullptr);
hide();
}
}
void Camera3DEditor::_pressed() {
- Node *sn = (node && preview->is_pressed()) ? node : NULL;
+ Node *sn = (node && preview->is_pressed()) ? node : nullptr;
Node3DEditor::get_singleton()->set_custom_camera(sn);
}
@@ -56,13 +56,13 @@ void Camera3DEditor::edit(Node *p_camera) {
if (!node) {
preview->set_pressed(false);
- Node3DEditor::get_singleton()->set_custom_camera(NULL);
+ Node3DEditor::get_singleton()->set_custom_camera(nullptr);
} else {
if (preview->is_pressed())
Node3DEditor::get_singleton()->set_custom_camera(p_camera);
else
- Node3DEditor::get_singleton()->set_custom_camera(NULL);
+ Node3DEditor::get_singleton()->set_custom_camera(nullptr);
}
}
@@ -96,9 +96,9 @@ bool Camera3DEditorPlugin::handles(Object *p_object) const {
void Camera3DEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
- //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera>(p_object));
+ //Node3DEditor::get_singleton()->set_can_preview(Object::cast_to<Camera3D>(p_object));
} else {
- Node3DEditor::get_singleton()->set_can_preview(NULL);
+ Node3DEditor::get_singleton()->set_can_preview(nullptr);
}
}
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index c7ddcd5e46..d8b9fb4d8f 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -503,7 +503,7 @@ Object *CanvasItemEditor::_get_editor_data(Object *p_what) {
CanvasItem *ci = Object::cast_to<CanvasItem>(p_what);
if (!ci)
- return NULL;
+ return nullptr;
return memnew(CanvasItemEditorSelectedItem);
}
@@ -667,7 +667,7 @@ void CanvasItemEditor::_get_bones_at_pos(const Point2 &p_pos, Vector<_SelectResu
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))
+ if (!_get_bone_shape(&bone_shape, nullptr, E))
continue;
// Check if the point is inside the Polygon2D
@@ -1343,7 +1343,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
if (drag_selection.size() == 1) {
new_pos = snap_point(drag_from, SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, drag_selection[0]);
} else {
- new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, NULL, drag_selection);
+ new_pos = snap_point(drag_from, SNAP_OTHER_NODES | SNAP_GRID | SNAP_PIXEL, 0, nullptr, drag_selection);
}
for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
CanvasItem *canvas_item = E->get();
@@ -2031,7 +2031,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
Vector<List<Dictionary>> all_bones_ik_states;
for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
List<Dictionary> bones_ik_states;
- _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states);
+ _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states);
all_bones_ik_states.push_back(bones_ik_states);
}
@@ -2046,7 +2046,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
previous_pos = _get_encompassing_rect_from_list(drag_selection).position;
}
- Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, NULL, drag_selection);
+ Point2 new_pos = snap_point(previous_pos + (drag_to - drag_from), SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL | SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_OTHER_NODES, 0, nullptr, drag_selection);
if (drag_type == DRAG_MOVE_X) {
new_pos.y = previous_pos.y;
@@ -2133,7 +2133,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
Vector<List<Dictionary>> all_bones_ik_states;
for (List<CanvasItem *>::Element *E = drag_selection.front(); E; E = E->next()) {
List<Dictionary> bones_ik_states;
- _save_canvas_item_ik_chain(E->get(), NULL, &bones_ik_states);
+ _save_canvas_item_ik_chain(E->get(), nullptr, &bones_ik_states);
all_bones_ik_states.push_back(bones_ik_states);
}
@@ -2299,7 +2299,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
return true;
// Find the item to select
- CanvasItem *canvas_item = NULL;
+ CanvasItem *canvas_item = nullptr;
// Retrieve the bones
Vector<_SelectResult> selection = Vector<_SelectResult>();
@@ -5800,7 +5800,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
call_deferred("set_state", get_state());
}
-CanvasItemEditor *CanvasItemEditor::singleton = NULL;
+CanvasItemEditor *CanvasItemEditor::singleton = nullptr;
void CanvasItemEditorPlugin::edit(Object *p_object) {
@@ -5886,8 +5886,8 @@ void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) cons
ERR_FAIL_COND(res.is_null());
Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res));
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
- if (texture != NULL || scene != NULL) {
- if (texture != NULL) {
+ if (texture != nullptr || scene != nullptr) {
+ if (texture != nullptr) {
Sprite2D *sprite = memnew(Sprite2D);
sprite->set_texture(texture);
sprite->set_modulate(Color(1, 1, 1, 0.7f));
@@ -5953,7 +5953,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String &
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child);
editor_data->get_undo_redo().add_do_method(child, "set_owner", editor->get_edited_scene());
editor_data->get_undo_redo().add_do_reference(child);
- editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL);
+ editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)nullptr);
}
if (parent) {
@@ -6064,7 +6064,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
continue;
}
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
- if (scene != NULL && scene.is_valid()) {
+ if (scene != nullptr && scene.is_valid()) {
if (!target_node) {
// Without root node act the same as "Load Inherited Scene"
Error err = EditorNode::get_singleton()->load_scene(path, false, true);
@@ -6079,7 +6079,7 @@ void CanvasItemEditorViewport::_perform_drop_data() {
}
} else {
Ref<Texture2D> texture = Ref<Texture2D>(Object::cast_to<Texture2D>(*res));
- if (texture != NULL && texture.is_valid()) {
+ if (texture != nullptr && texture.is_valid()) {
Node *child;
if (default_type == "Light2D")
child = memnew(Light2D);
@@ -6209,7 +6209,7 @@ void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p
list.push_back(root_node);
} else {
drop_pos = p_point;
- target_node = NULL;
+ target_node = nullptr;
}
}
@@ -6258,7 +6258,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
types.push_back("TextureRect");
types.push_back("NinePatchRect");
- target_node = NULL;
+ target_node = nullptr;
editor = p_node;
editor_data = editor->get_scene_tree_dock()->get_editor_data();
canvas_item_editor = p_canvas_item_editor;
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 34965868e0..9f1a92f563 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -613,7 +613,7 @@ public:
SNAP_DEFAULT = SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL,
};
- Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = NULL, List<CanvasItem *> p_other_nodes_exceptions = List<CanvasItem *>());
+ Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, List<CanvasItem *> p_other_nodes_exceptions = List<CanvasItem *>());
float snap_angle(float p_target, float p_start = 0) const;
Transform2D get_canvas_transform() const { return transform; }
diff --git a/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index 3d32c0b698..87e9987aa1 100644
--- a/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -42,7 +42,7 @@ void CollisionPolygon2DEditor::_set_node(Node *p_polygon) {
CollisionPolygon2DEditor::CollisionPolygon2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
- node = NULL;
+ node = nullptr;
}
CollisionPolygon2DEditorPlugin::CollisionPolygon2DEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/collision_polygon_3d_editor_plugin.cpp b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
index 5b35a4826c..26adc5156b 100644
--- a/editor/plugins/collision_polygon_3d_editor_plugin.cpp
+++ b/editor/plugins/collision_polygon_3d_editor_plugin.cpp
@@ -66,7 +66,7 @@ void CollisionPolygon3DEditor::_notification(int p_what) {
void CollisionPolygon3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
if (imgeom->get_parent() == p_node)
p_node->remove_child(imgeom);
hide();
@@ -507,7 +507,7 @@ void CollisionPolygon3DEditor::edit(Node *p_collision_polygon) {
prev_depth = -1;
} else {
- node = NULL;
+ node = nullptr;
if (imgeom->get_parent())
imgeom->get_parent()->remove_child(imgeom);
@@ -523,7 +523,7 @@ void CollisionPolygon3DEditor::_bind_methods() {
CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) {
- node = NULL;
+ node = nullptr;
editor = p_editor;
undo_redo = EditorNode::get_undo_redo();
@@ -591,7 +591,7 @@ void Polygon3DEditorPlugin::make_visible(bool p_visible) {
} else {
collision_polygon_editor->hide();
- collision_polygon_editor->edit(NULL);
+ collision_polygon_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 709ff91fc0..594dd0d0cb 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -39,6 +39,13 @@
#include "scene/resources/rectangle_shape_2d.h"
#include "scene/resources/segment_shape_2d.h"
+void CollisionShape2DEditor::_node_removed(Node *p_node) {
+
+ if (p_node == node) {
+ node = nullptr;
+ }
+}
+
Variant CollisionShape2DEditor::get_handle_value(int idx) const {
switch (shape_type) {
@@ -525,6 +532,20 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
}
}
+void CollisionShape2DEditor::_notification(int p_what) {
+
+ switch (p_what) {
+
+ case NOTIFICATION_ENTER_TREE: {
+ get_tree()->connect("node_removed", callable_mp(this, &CollisionShape2DEditor::_node_removed));
+ } break;
+
+ case NOTIFICATION_EXIT_TREE: {
+ get_tree()->disconnect("node_removed", callable_mp(this, &CollisionShape2DEditor::_node_removed));
+ } break;
+ }
+}
+
void CollisionShape2DEditor::edit(Node *p_node) {
if (!canvas_item_editor) {
@@ -540,7 +561,7 @@ void CollisionShape2DEditor::edit(Node *p_node) {
edit_handle = -1;
shape_type = -1;
- node = NULL;
+ node = nullptr;
}
canvas_item_editor->update_viewport();
@@ -553,8 +574,8 @@ void CollisionShape2DEditor::_bind_methods() {
CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) {
- node = NULL;
- canvas_item_editor = NULL;
+ node = nullptr;
+ canvas_item_editor = nullptr;
editor = p_editor;
undo_redo = p_editor->get_undo_redo();
@@ -576,7 +597,7 @@ bool CollisionShape2DEditorPlugin::handles(Object *p_obj) const {
void CollisionShape2DEditorPlugin::make_visible(bool visible) {
if (!visible) {
- edit(NULL);
+ edit(nullptr);
}
}
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index 025420a886..6bb621c476 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -71,6 +71,8 @@ class CollisionShape2DEditor : public Control {
void _get_current_shape_type();
protected:
+ void _notification(int p_what);
+ void _node_removed(Node *p_node);
static void _bind_methods();
public:
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 022663a61d..b005519a5e 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -251,7 +251,7 @@ void CPUParticles2DEditorPlugin::_bind_methods() {
CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
- particles = NULL;
+ particles = nullptr;
editor = p_node;
undo_redo = editor->get_undo_redo();
diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp
index 887e9e48df..0c2fbaf62a 100644
--- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp
@@ -35,7 +35,7 @@
void CPUParticles3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
hide();
}
}
@@ -128,7 +128,7 @@ void CPUParticles3DEditorPlugin::make_visible(bool p_visible) {
} else {
particles_editor->particles_editor_hb->hide();
particles_editor->hide();
- particles_editor->edit(NULL);
+ particles_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.h b/editor/plugins/cpu_particles_3d_editor_plugin.h
index aac9cc9a2f..796c842e07 100644
--- a/editor/plugins/cpu_particles_3d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_3d_editor_plugin.h
@@ -72,7 +72,7 @@ class CPUParticles3DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual String get_name() const { return "CPUParticles"; }
+ virtual String get_name() const { return "CPUParticles3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 0fd8ea4fb5..71c5a78e0b 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -755,7 +755,7 @@ void CurveEditor::_bind_methods() {
bool EditorInspectorPluginCurve::can_handle(Object *p_object) {
- return Object::cast_to<Curve>(p_object) != NULL;
+ return Object::cast_to<Curve>(p_object) != nullptr;
}
void EditorInspectorPluginCurve::parse_begin(Object *p_object) {
diff --git a/editor/plugins/gi_probe_editor_plugin.cpp b/editor/plugins/gi_probe_editor_plugin.cpp
index 908a32fdb6..6a171c4703 100644
--- a/editor/plugins/gi_probe_editor_plugin.cpp
+++ b/editor/plugins/gi_probe_editor_plugin.cpp
@@ -113,25 +113,25 @@ void GIProbeEditorPlugin::make_visible(bool p_visible) {
}
}
-EditorProgress *GIProbeEditorPlugin::tmp_progress = NULL;
+EditorProgress *GIProbeEditorPlugin::tmp_progress = nullptr;
void GIProbeEditorPlugin::bake_func_begin(int p_steps) {
- ERR_FAIL_COND(tmp_progress != NULL);
+ ERR_FAIL_COND(tmp_progress != nullptr);
tmp_progress = memnew(EditorProgress("bake_gi", TTR("Bake GI Probe"), p_steps));
}
void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) {
- ERR_FAIL_COND(tmp_progress == NULL);
+ ERR_FAIL_COND(tmp_progress == nullptr);
tmp_progress->step(p_description, p_step, false);
}
void GIProbeEditorPlugin::bake_func_end() {
- ERR_FAIL_COND(tmp_progress == NULL);
+ ERR_FAIL_COND(tmp_progress == nullptr);
memdelete(tmp_progress);
- tmp_progress = NULL;
+ tmp_progress = nullptr;
}
void GIProbeEditorPlugin::_giprobe_save_path_and_bake(const String &p_path) {
@@ -163,7 +163,7 @@ GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {
bake_hb->add_child(bake_info);
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake_hb);
- gi_probe = NULL;
+ gi_probe = nullptr;
probe_file = memnew(EditorFileDialog);
probe_file->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
probe_file->add_filter("*.res");
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
index 89bff7ccab..29c47a2b67 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp
@@ -360,7 +360,7 @@ void GPUParticles2DEditorPlugin::_bind_methods() {
GPUParticles2DEditorPlugin::GPUParticles2DEditorPlugin(EditorNode *p_node) {
- particles = NULL;
+ particles = nullptr;
editor = p_node;
undo_redo = editor->get_undo_redo();
diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.h b/editor/plugins/gpu_particles_2d_editor_plugin.h
index 904786ffae..008d04a211 100644
--- a/editor/plugins/gpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/gpu_particles_2d_editor_plugin.h
@@ -87,7 +87,7 @@ protected:
static void _bind_methods();
public:
- virtual String get_name() const { return "Particles2D"; }
+ virtual String get_name() const { return "GPUParticles2D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
index 655f03b7e0..534a228098 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp
@@ -236,7 +236,7 @@ GPUParticles3DEditorBase::GPUParticles3DEditorBase() {
void GPUParticles3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
hide();
}
}
@@ -424,7 +424,7 @@ void GPUParticles3DEditor::_bind_methods() {
GPUParticles3DEditor::GPUParticles3DEditor() {
- node = NULL;
+ node = nullptr;
particles_editor_hb = memnew(HBoxContainer);
Node3DEditor::get_singleton()->add_control_to_menu_panel(particles_editor_hb);
options = memnew(MenuButton);
@@ -476,7 +476,7 @@ void GPUParticles3DEditorPlugin::make_visible(bool p_visible) {
} else {
particles_editor->particles_editor_hb->hide();
particles_editor->hide();
- particles_editor->edit(NULL);
+ particles_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.h b/editor/plugins/gpu_particles_3d_editor_plugin.h
index d730457d01..cf1cff32c0 100644
--- a/editor/plugins/gpu_particles_3d_editor_plugin.h
+++ b/editor/plugins/gpu_particles_3d_editor_plugin.h
@@ -108,7 +108,7 @@ class GPUParticles3DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual String get_name() const { return "Particles"; }
+ virtual String get_name() const { return "GPUParticles3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp
index 54b7840124..67de610ae7 100644
--- a/editor/plugins/gradient_editor_plugin.cpp
+++ b/editor/plugins/gradient_editor_plugin.cpp
@@ -79,7 +79,7 @@ GradientEditor::GradientEditor() {
bool EditorInspectorPluginGradient::can_handle(Object *p_object) {
- return Object::cast_to<Gradient>(p_object) != NULL;
+ return Object::cast_to<Gradient>(p_object) != nullptr;
}
void EditorInspectorPluginGradient::parse_begin(Object *p_object) {
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index 9ae4d2ae9d..1dbc78804b 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -163,7 +163,7 @@ void ItemListOptionButtonPlugin::erase(int p_idx) {
ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() {
- ob = NULL;
+ ob = nullptr;
}
///////////////////////////////////////////////////////////////
@@ -205,7 +205,7 @@ void ItemListPopupMenuPlugin::erase(int p_idx) {
ItemListPopupMenuPlugin::ItemListPopupMenuPlugin() {
- pp = NULL;
+ pp = nullptr;
}
///////////////////////////////////////////////////////////////
@@ -244,7 +244,7 @@ void ItemListItemListPlugin::erase(int p_idx) {
ItemListItemListPlugin::ItemListItemListPlugin() {
- pp = NULL;
+ pp = nullptr;
}
///////////////////////////////////////////////////////////////
@@ -254,7 +254,7 @@ ItemListItemListPlugin::ItemListItemListPlugin() {
void ItemListEditor::_node_removed(Node *p_node) {
if (p_node == item_list) {
- item_list = NULL;
+ item_list = nullptr;
hide();
dialog->hide();
}
@@ -311,7 +311,7 @@ void ItemListEditor::edit(Node *p_item_list) {
if (!item_list) {
selected_idx = -1;
- property_editor->edit(NULL);
+ property_editor->edit(nullptr);
return;
}
@@ -329,7 +329,7 @@ void ItemListEditor::edit(Node *p_item_list) {
}
selected_idx = -1;
- property_editor->edit(NULL);
+ property_editor->edit(nullptr);
}
bool ItemListEditor::handles(Object *p_object) const {
@@ -349,7 +349,7 @@ void ItemListEditor::_bind_methods() {
ItemListEditor::ItemListEditor() {
selected_idx = -1;
- item_list = NULL;
+ item_list = nullptr;
toolbar_button = memnew(ToolButton);
toolbar_button->set_text(TTR("Items"));
@@ -408,7 +408,7 @@ void ItemListEditorPlugin::make_visible(bool p_visible) {
} else {
item_list_editor->hide();
- item_list_editor->edit(NULL);
+ item_list_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 22df287f97..f8550a884b 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -112,7 +112,7 @@ void LightOccluder2DEditor::_create_resource() {
LightOccluder2DEditor::LightOccluder2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
- node = NULL;
+ node = nullptr;
}
LightOccluder2DEditorPlugin::LightOccluder2DEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/line_2d_editor_plugin.cpp b/editor/plugins/line_2d_editor_plugin.cpp
index 4ac9d0af3b..5b887390a6 100644
--- a/editor/plugins/line_2d_editor_plugin.cpp
+++ b/editor/plugins/line_2d_editor_plugin.cpp
@@ -64,7 +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;
+ node = nullptr;
}
Line2DEditorPlugin::Line2DEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index a8b455fdd2..5e657c3b71 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -173,7 +173,7 @@ MeshEditor::MeshEditor() {
bool EditorInspectorPluginMesh::can_handle(Object *p_object) {
- return Object::cast_to<Mesh>(p_object) != NULL;
+ return Object::cast_to<Mesh>(p_object) != nullptr;
}
void EditorInspectorPluginMesh::parse_begin(Object *p_object) {
diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
index a4e7b2df08..7819f62bc7 100644
--- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp
@@ -40,7 +40,7 @@
void MeshInstance3DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
options->hide();
}
}
@@ -337,18 +337,15 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
const Vector2 *r = uv.ptr();
Vector<int> indices = a[Mesh::ARRAY_INDEX];
- const int *ri;
+ const int *ri = nullptr;
int ic;
- bool use_indices;
if (indices.size()) {
ic = indices.size();
ri = indices.ptr();
- use_indices = true;
} else {
ic = uv.size();
- use_indices = false;
}
for (int j = 0; j < ic; j += 3) {
@@ -356,7 +353,7 @@ void MeshInstance3DEditor::_create_uv_lines(int p_layer) {
for (int k = 0; k < 3; k++) {
MeshInstance3DEditorEdgeSort edge;
- if (use_indices) {
+ if (ri) {
edge.a = r[ri[j + k]];
edge.b = r[ri[j + ((k + 1) % 3)]];
} else {
@@ -392,17 +389,17 @@ void MeshInstance3DEditor::_create_outline_mesh() {
Ref<Mesh> mesh = node->get_mesh();
if (mesh.is_null()) {
- err_dialog->set_text(TTR("MeshInstance lacks a Mesh!"));
+ err_dialog->set_text(TTR("MeshInstance3D lacks a Mesh."));
err_dialog->popup_centered();
return;
}
if (mesh->get_surface_count() == 0) {
- err_dialog->set_text(TTR("Mesh has not surface to create outlines from!"));
+ err_dialog->set_text(TTR("Mesh has not surface to create outlines from."));
err_dialog->popup_centered();
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->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES."));
err_dialog->popup_centered();
return;
}
@@ -410,7 +407,7 @@ void MeshInstance3DEditor::_create_outline_mesh() {
Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value());
if (mesho.is_null()) {
- err_dialog->set_text(TTR("Could not create outline!"));
+ err_dialog->set_text(TTR("Could not create outline."));
err_dialog->popup_centered();
return;
}
@@ -447,7 +444,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() {
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshInstance3D", "EditorIcons"));
options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY);
- options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection."));
+ options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody3D and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection."));
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Create Trimesh Collision Sibling"), MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE);
options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is the most accurate (but slowest) option for collision detection."));
@@ -514,7 +511,7 @@ void MeshInstance3DEditorPlugin::make_visible(bool p_visible) {
} else {
mesh_editor->options->hide();
- mesh_editor->edit(NULL);
+ mesh_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp
index 658e3ea565..4f482c2b43 100644
--- a/editor/plugins/multimesh_editor_plugin.cpp
+++ b/editor/plugins/multimesh_editor_plugin.cpp
@@ -37,7 +37,7 @@
void MultiMeshEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
hide();
}
}
@@ -82,7 +82,7 @@ void MultiMeshEditor::_populate() {
if (!ms_instance) {
- err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance)."));
+ err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance3D)."));
err_dialog->popup_centered();
return;
}
@@ -371,7 +371,7 @@ MultiMeshEditor::MultiMeshEditor() {
populate_dialog->add_child(std);
std->connect("selected", callable_mp(this, &MultiMeshEditor::_browsed));
- _last_pp_node = NULL;
+ _last_pp_node = nullptr;
err_dialog = memnew(AcceptDialog);
add_child(err_dialog);
@@ -394,7 +394,7 @@ void MultiMeshEditorPlugin::make_visible(bool p_visible) {
} else {
multimesh_editor->options->hide();
- multimesh_editor->edit(NULL);
+ multimesh_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index 6671d0b6b4..e41b32ac86 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -123,7 +123,7 @@ void NavigationPolygonEditor::_create_resource() {
NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
- node = NULL;
+ node = nullptr;
}
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) :
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 6f6d06b09d..afd8d2d075 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -501,7 +501,7 @@ ObjectID Node3DEditorViewport::_select_ray(const Point2 &p_pos, bool p_append, b
Node *edited_scene = get_tree()->get_edited_scene_root();
ObjectID closest;
- Node *item = NULL;
+ Node *item = nullptr;
float closest_dist = 1e20;
int selected_handle = -1;
@@ -588,7 +588,7 @@ void Node3DEditorViewport::_find_items_at_pos(const Point2 &p_pos, bool &r_inclu
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, nullptr, p_alt_select);
if (!inters)
continue;
@@ -2273,7 +2273,7 @@ static bool is_shortcut_pressed(const String &p_path) {
return false;
}
InputEventKey *k = Object::cast_to<InputEventKey>(shortcut->get_shortcut().ptr());
- if (k == NULL) {
+ if (k == nullptr) {
return false;
}
const InputFilter &input = *InputFilter::get_singleton();
@@ -2386,11 +2386,11 @@ void Node3DEditorViewport::_notification(int p_what) {
_update_freelook(delta);
Node *scene_root = editor->get_scene_tree_dock()->get_editor_data()->get_edited_scene_root();
- if (previewing_cinema && scene_root != NULL) {
+ if (previewing_cinema && scene_root != nullptr) {
Camera3D *cam = scene_root->get_viewport()->get_camera();
- if (cam != NULL && cam != previewing) {
+ if (cam != nullptr && cam != previewing) {
//then switch the viewport's camera to the scene's viewport camera
- if (previewing != NULL) {
+ if (previewing != nullptr) {
previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
}
previewing = cam;
@@ -2950,7 +2950,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
if (current) {
preview_camera->hide();
} else {
- if (previewing != NULL)
+ if (previewing != nullptr)
preview_camera->show();
}
} break;
@@ -3137,7 +3137,7 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
if (!p_activate) {
previewing->disconnect("tree_exiting", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
- previewing = NULL;
+ previewing = nullptr;
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
if (!preview)
preview_camera->hide();
@@ -3157,10 +3157,10 @@ void Node3DEditorViewport::_toggle_camera_preview(bool p_activate) {
void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) {
previewing_cinema = p_activate;
if (!previewing_cinema) {
- if (previewing != NULL)
+ if (previewing != nullptr)
previewing->disconnect("tree_exited", callable_mp(this, &Node3DEditorViewport::_preview_exited_scene));
- previewing = NULL;
+ previewing = nullptr;
RS::get_singleton()->viewport_attach_camera(viewport->get_viewport_rid(), camera->get_camera()); //restore
preview_camera->set_pressed(false);
if (!preview) {
@@ -3503,7 +3503,7 @@ Vector3 Node3DEditorViewport::_get_instance_position(const Point2 &p_pos) const
Vector3 hit_point;
Vector3 hit_normal;
- bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, NULL, false);
+ bool inters = seg->intersect_ray(camera, p_pos, hit_point, hit_normal, nullptr, false);
if (!inters)
continue;
@@ -3568,8 +3568,8 @@ void Node3DEditorViewport::_create_preview(const Vector<String> &files) const {
ERR_CONTINUE(res.is_null());
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
- if (mesh != NULL || scene != NULL) {
- if (mesh != NULL) {
+ if (mesh != nullptr || scene != nullptr) {
+ if (mesh != nullptr) {
MeshInstance3D *mesh_instance = memnew(MeshInstance3D);
mesh_instance->set_mesh(mesh);
preview_node->add_child(mesh_instance);
@@ -3620,10 +3620,10 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
- Node *instanced_scene = NULL;
+ Node *instanced_scene = nullptr;
- if (mesh != NULL || scene != NULL) {
- if (mesh != NULL) {
+ if (mesh != nullptr || scene != nullptr) {
+ if (mesh != nullptr) {
MeshInstance3D *mesh_instance = memnew(MeshInstance3D);
mesh_instance->set_mesh(mesh);
mesh_instance->set_name(path.get_file().get_basename());
@@ -3637,7 +3637,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
}
}
- if (instanced_scene == NULL) {
+ if (instanced_scene == nullptr) {
return false;
}
@@ -3648,7 +3648,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
}
}
- if (scene != NULL) {
+ if (scene != nullptr) {
instanced_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path));
}
@@ -3689,7 +3689,7 @@ void Node3DEditorViewport::_perform_drop_data() {
}
Ref<PackedScene> scene = Ref<PackedScene>(Object::cast_to<PackedScene>(*res));
Ref<Mesh> mesh = Ref<Mesh>(Object::cast_to<Mesh>(*res));
- if (mesh != NULL || scene != NULL) {
+ if (mesh != nullptr || scene != nullptr) {
bool success = _create_instance(target_node, path, drop_pos);
if (!success) {
error_files.push_back(path);
@@ -3964,10 +3964,10 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
preview_camera->set_h_size_flags(0);
preview_camera->hide();
preview_camera->connect("toggled", callable_mp(this, &Node3DEditorViewport::_toggle_camera_preview));
- previewing = NULL;
+ previewing = nullptr;
gizmo_scale = 1.0;
- preview_node = NULL;
+ preview_node = nullptr;
info_label = memnew(Label);
info_label->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -90 * EDSCALE);
@@ -4030,7 +4030,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
surface->add_child(top_right_vbox);
- accept = NULL;
+ accept = nullptr;
freelook_active = false;
freelook_speed = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_base_speed");
@@ -4393,7 +4393,7 @@ Node3DEditorViewportContainer::Node3DEditorViewportContainer() {
///////////////////////////////////////////////////////////////////
-Node3DEditor *Node3DEditor::singleton = NULL;
+Node3DEditor *Node3DEditor::singleton = nullptr;
Node3DEditorSelectedItem::~Node3DEditorSelectedItem() {
@@ -4479,7 +4479,7 @@ Object *Node3DEditor::_get_editor_data(Object *p_what) {
Node3D *sp = Object::cast_to<Node3D>(p_what);
if (!sp)
- return NULL;
+ return nullptr;
Node3DEditorSelectedItem *si = memnew(Node3DEditorSelectedItem);
@@ -5903,7 +5903,7 @@ void Node3DEditor::_toggle_maximize_view(Object *p_viewport) {
void Node3DEditor::_node_removed(Node *p_node) {
if (p_node == selected)
- selected = NULL;
+ selected = nullptr;
}
void Node3DEditor::_register_all_gizmos() {
@@ -5919,8 +5919,8 @@ void Node3DEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<SpringArmNode3DGizmoPlugin>(memnew(SpringArmNode3DGizmoPlugin)));
add_gizmo_plugin(Ref<VehicleWheelNode3DGizmoPlugin>(memnew(VehicleWheelNode3DGizmoPlugin)));
add_gizmo_plugin(Ref<VisibilityNotifierGizmoPlugin>(memnew(VisibilityNotifierGizmoPlugin)));
- add_gizmo_plugin(Ref<ParticlesGizmoPlugin>(memnew(ParticlesGizmoPlugin)));
- add_gizmo_plugin(Ref<CPUParticlesGizmoPlugin>(memnew(CPUParticlesGizmoPlugin)));
+ add_gizmo_plugin(Ref<GPUParticles3DGizmoPlugin>(memnew(GPUParticles3DGizmoPlugin)));
+ add_gizmo_plugin(Ref<CPUParticles3DGizmoPlugin>(memnew(CPUParticles3DGizmoPlugin)));
add_gizmo_plugin(Ref<ReflectionProbeGizmoPlugin>(memnew(ReflectionProbeGizmoPlugin)));
add_gizmo_plugin(Ref<GIProbeGizmoPlugin>(memnew(GIProbeGizmoPlugin)));
// add_gizmo_plugin(Ref<BakedIndirectLightGizmoPlugin>(memnew(BakedIndirectLightGizmoPlugin)));
@@ -5979,7 +5979,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
undo_redo = p_editor->get_undo_redo();
VBoxContainer *vbc = this;
- custom_camera = NULL;
+ custom_camera = nullptr;
singleton = this;
editor = p_editor;
editor_selection = editor->get_editor_selection();
@@ -6315,7 +6315,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
scenario_debug = RenderingServer::SCENARIO_DEBUG_DISABLED;
- selected = NULL;
+ selected = nullptr;
set_process_unhandled_key_input(true);
add_to_group("_spatial_editor_group");
@@ -6761,8 +6761,8 @@ EditorNode3DGizmoPlugin::EditorNode3DGizmoPlugin() {
EditorNode3DGizmoPlugin::~EditorNode3DGizmoPlugin() {
for (int i = 0; i < current_gizmos.size(); ++i) {
- current_gizmos[i]->set_plugin(NULL);
- current_gizmos[i]->get_spatial_node()->set_gizmo(NULL);
+ current_gizmos[i]->set_plugin(nullptr);
+ current_gizmos[i]->get_spatial_node()->set_gizmo(nullptr);
}
if (Node3DEditor::get_singleton()) {
Node3DEditor::get_singleton()->update_all_gizmos();
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 4b9f5a605b..e485edae02 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -123,7 +123,7 @@ public:
Ref<EditorNode3DGizmoPlugin> get_plugin() const { return gizmo_plugin; }
Vector3 get_handle_pos(int p_idx) const;
bool intersect_frustum(const Camera3D *p_camera, const Vector<Plane> &p_frustum);
- bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = NULL, bool p_sec_first = false);
+ bool intersect_ray(Camera3D *p_camera, const Point2 &p_point, Vector3 &r_pos, Vector3 &r_normal, int *r_gizmo_handle = nullptr, bool p_sec_first = false);
virtual void clear();
virtual void create();
@@ -295,7 +295,7 @@ private:
void _clear_selected();
void _select_clicked(bool p_append, bool p_single, bool p_allow_locked = false);
void _select(Node *p_node, bool p_append, bool p_single);
- ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = NULL, bool p_alt_select = false);
+ ObjectID _select_ray(const Point2 &p_pos, bool p_append, bool &r_includes_current, int *r_gizmo_handle = nullptr, bool p_alt_select = false);
void _find_items_at_pos(const Point2 &p_pos, bool &r_includes_current, Vector<_RayResult> &results, bool p_alt_select = false);
Vector3 _get_ray_pos(const Vector2 &p_pos) const;
Vector3 _get_ray(const Vector2 &p_pos) const;
@@ -487,7 +487,7 @@ public:
RID sbox_instance;
Node3DEditorSelectedItem() {
- sp = NULL;
+ sp = nullptr;
last_xform_dirty = true;
}
~Node3DEditorSelectedItem();
@@ -761,7 +761,7 @@ public:
Ref<ArrayMesh> get_scale_plane_gizmo(int idx) const { return scale_plane_gizmo[idx]; }
void update_transform_gizmo();
- void update_all_gizmos(Node *p_node = NULL);
+ void update_all_gizmos(Node *p_node = nullptr);
void snap_selected_nodes_to_floor();
void select_gizmo_highlight_axis(int p_axis);
void set_custom_camera(Node *p_camera) { custom_camera = p_camera; }
@@ -788,7 +788,7 @@ public:
void set_can_preview(Camera3D *p_preview);
Node3DEditorViewport *get_editor_viewport(int p_idx) {
- ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), NULL);
+ ERR_FAIL_INDEX_V(p_idx, static_cast<int>(VIEWPORTS_COUNT), nullptr);
return viewports[p_idx];
}
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 75c5fcb994..4516b7035b 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -56,7 +56,7 @@ void Path2DEditor::_notification(int p_what) {
void Path2DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
hide();
}
}
@@ -288,7 +288,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Vector2 gpoint = mm->get_position();
Ref<Curve2D> curve = node->get_curve();
- if (curve == NULL) return true;
+ if (curve == nullptr) return true;
if (curve->get_point_count() < 2) return true;
// Find edge
@@ -449,7 +449,7 @@ void Path2DEditor::edit(Node *p_path2d) {
// node may have been deleted at this point
if (node && node->is_connected("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed)))
node->disconnect("visibility_changed", callable_mp(this, &Path2DEditor::_node_visibility_changed));
- node = NULL;
+ node = nullptr;
}
}
@@ -532,7 +532,7 @@ void Path2DEditor::_handle_option_pressed(int p_option) {
Path2DEditor::Path2DEditor(EditorNode *p_editor) {
- canvas_item_editor = NULL;
+ canvas_item_editor = nullptr;
editor = p_editor;
undo_redo = editor->get_undo_redo();
mirror_handle_angle = true;
@@ -620,7 +620,7 @@ void Path2DEditorPlugin::make_visible(bool p_visible) {
path2d_editor->hide();
path2d_editor->base_hb->hide();
- path2d_editor->edit(NULL);
+ path2d_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp
index f3729a3e89..3ee8225418 100644
--- a/editor/plugins/path_3d_editor_plugin.cpp
+++ b/editor/plugins/path_3d_editor_plugin.cpp
@@ -460,7 +460,7 @@ void Path3DEditorPlugin::edit(Object *p_object) {
}
} else {
Path3D *pre = path;
- path = NULL;
+ path = nullptr;
if (pre) {
pre->get_curve()->emit_signal("changed");
}
@@ -494,7 +494,7 @@ void Path3DEditorPlugin::make_visible(bool p_visible) {
{
Path3D *pre = path;
- path = NULL;
+ path = nullptr;
if (pre && pre->get_curve().is_valid()) {
pre->get_curve()->emit_signal("changed");
}
@@ -553,11 +553,11 @@ void Path3DEditorPlugin::_notification(int p_what) {
void Path3DEditorPlugin::_bind_methods() {
}
-Path3DEditorPlugin *Path3DEditorPlugin::singleton = NULL;
+Path3DEditorPlugin *Path3DEditorPlugin::singleton = nullptr;
Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) {
- path = NULL;
+ path = nullptr;
editor = p_node;
singleton = this;
mirror_handle_angle = true;
@@ -637,7 +637,7 @@ Ref<EditorNode3DGizmo> PathNode3DGizmoPlugin::create_gizmo(Node3D *p_spatial) {
}
String PathNode3DGizmoPlugin::get_name() const {
- return "Path";
+ return "Path3D";
}
int PathNode3DGizmoPlugin::get_priority() const {
diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h
index ca051295f0..715f8d1bb5 100644
--- a/editor/plugins/path_3d_editor_plugin.h
+++ b/editor/plugins/path_3d_editor_plugin.h
@@ -50,7 +50,7 @@ public:
virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false);
virtual void redraw();
- PathNode3DGizmo(Path3D *p_path = NULL);
+ PathNode3DGizmo(Path3D *p_path = nullptr);
};
class PathNode3DGizmoPlugin : public EditorNode3DGizmoPlugin {
@@ -103,9 +103,7 @@ public:
static Path3DEditorPlugin *singleton;
virtual bool forward_spatial_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event);
- //virtual bool forward_gui_input(const InputEvent& p_event) { return collision_polygon_editor->forward_gui_input(p_event); }
- //virtual Ref<Node3DEditorGizmo> create_spatial_gizmo(Spatial *p_spatial);
- virtual String get_name() const { return "Path"; }
+ virtual String get_name() const { return "Path3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/physical_bone_3d_editor_plugin.cpp b/editor/plugins/physical_bone_3d_editor_plugin.cpp
index dd6d7b109b..6d38f7f318 100644
--- a/editor/plugins/physical_bone_3d_editor_plugin.cpp
+++ b/editor/plugins/physical_bone_3d_editor_plugin.cpp
@@ -49,7 +49,7 @@ void PhysicalBone3DEditor::_set_move_joint() {
PhysicalBone3DEditor::PhysicalBone3DEditor(EditorNode *p_editor) :
editor(p_editor),
- selected(NULL) {
+ selected(nullptr) {
spatial_editor_hb = memnew(HBoxContainer);
spatial_editor_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
@@ -90,7 +90,7 @@ void PhysicalBone3DEditor::show() {
PhysicalBone3DEditorPlugin::PhysicalBone3DEditorPlugin(EditorNode *p_editor) :
editor(p_editor),
- selected(NULL),
+ selected(nullptr),
physical_bone_editor(editor) {}
void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) {
@@ -100,8 +100,8 @@ void PhysicalBone3DEditorPlugin::make_visible(bool p_visible) {
} else {
physical_bone_editor.hide();
- physical_bone_editor.set_selected(NULL);
- selected = NULL;
+ physical_bone_editor.set_selected(nullptr);
+ selected = nullptr;
}
}
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index f570baa885..1f7a5b9968 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -107,7 +107,7 @@ void Polygon2DEditor::_notification(int p_what) {
void Polygon2DEditor::_sync_bones() {
- Skeleton2D *skeleton = NULL;
+ Skeleton2D *skeleton = nullptr;
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();
@@ -1031,7 +1031,7 @@ void Polygon2DEditor::_uv_draw() {
uvs = node->get_polygon();
}
- const float *weight_r;
+ const float *weight_r = nullptr;
if (uv_edit_mode[3]->is_pressed()) {
int bone_selected = -1;
@@ -1044,7 +1044,6 @@ void Polygon2DEditor::_uv_draw() {
}
if (bone_selected != -1 && node->get_bone_weights(bone_selected).size() == uvs.size()) {
-
weight_r = node->get_bone_weights(bone_selected).ptr();
}
}
@@ -1250,7 +1249,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const {
Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
AbstractPolygon2DEditor(p_editor) {
- node = NULL;
+ node = nullptr;
snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2());
snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(10, 10));
use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false);
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 8def56f968..852feeb675 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -181,7 +181,7 @@ void ResourcePreloaderEditor::_update_library() {
tree->clear();
tree->set_hide_root(true);
- TreeItem *root = tree->create_item(NULL);
+ TreeItem *root = tree->create_item(nullptr);
List<StringName> rnames;
preloader->get_resource_list(&rnames);
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index 516c52a8a4..67e836082d 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -88,7 +88,7 @@ void EditorPropertyRootMotion::_node_assign() {
for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
NodePath path = E->get();
- TreeItem *ti = NULL;
+ TreeItem *ti = nullptr;
String accum;
for (int i = 0; i < path.get_name_count(); i++) {
String name = path.get_name(i);
@@ -117,7 +117,7 @@ void EditorPropertyRootMotion::_node_assign() {
}
}
- Node *node = NULL;
+ Node *node = nullptr;
if (base->has_node(accum)) {
node = base->get_node(accum);
}
@@ -212,7 +212,7 @@ void EditorPropertyRootMotion::update_property() {
}
assign->set_flat(true);
- Node *base_node = NULL;
+ Node *base_node = nullptr;
if (base_hint != NodePath()) {
if (get_tree()->get_root()->has_node(base_hint)) {
base_node = get_tree()->get_root()->get_node(base_hint);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 0e867f7b16..dd80fff008 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -193,7 +193,7 @@ void ScriptEditorQuickOpen::_update_search() {
}
}
- get_ok()->set_disabled(root->get_children() == NULL);
+ get_ok()->set_disabled(root->get_children() == nullptr);
}
void ScriptEditorQuickOpen::_confirmed() {
@@ -252,7 +252,7 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() {
/////////////////////////////////
-ScriptEditor *ScriptEditor::script_editor = NULL;
+ScriptEditor *ScriptEditor::script_editor = nullptr;
/*** SCRIPT EDITOR ******/
@@ -321,7 +321,7 @@ void ScriptEditor::_set_execution(REF p_script, int p_line) {
if (!se)
continue;
- if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) {
+ if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) {
se->set_executing_line(p_line);
}
}
@@ -337,7 +337,7 @@ void ScriptEditor::_clear_execution(REF p_script) {
if (!se)
continue;
- if ((script != NULL && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) {
+ if ((script != nullptr && se->get_edited_resource() == p_script) || se->get_edited_resource()->get_path() == script->get_path()) {
se->clear_executing_line();
}
}
@@ -348,7 +348,7 @@ 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 nullptr;
return Object::cast_to<ScriptEditorBase>(tab_container->get_child(selected));
}
@@ -434,7 +434,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
Object::cast_to<ScriptEditorBase>(c)->ensure_focus();
Ref<Script> script = Object::cast_to<ScriptEditorBase>(c)->get_edited_resource();
- if (script != NULL) {
+ if (script != nullptr) {
notify_script_changed(script);
}
@@ -575,7 +575,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
}
Ref<Script> script = current->get_edited_resource();
- if (script != NULL) {
+ if (script != nullptr) {
previous_scripts.push_back(script->get_path());
notify_script_close(script);
}
@@ -737,7 +737,7 @@ void ScriptEditor::_resave_scripts(const String &p_str) {
}
Ref<TextFile> text_file = script;
- if (text_file != NULL) {
+ if (text_file != nullptr) {
se->apply_code();
_save_text_file(text_file, text_file->get_path());
break;
@@ -775,7 +775,7 @@ void ScriptEditor::_reload_scripts() {
}
Ref<Script> script = edited_res;
- if (script != NULL) {
+ if (script != nullptr) {
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), true);
ERR_CONTINUE(!rel_script.is_valid());
script->set_source_code(rel_script->get_source_code());
@@ -784,7 +784,7 @@ void ScriptEditor::_reload_scripts() {
}
Ref<TextFile> text_file = edited_res;
- if (text_file != NULL) {
+ if (text_file != nullptr) {
Error err;
Ref<TextFile> rel_text_file = _load_text_file(text_file->get_path(), &err);
ERR_CONTINUE(!rel_text_file.is_valid());
@@ -961,9 +961,9 @@ Ref<Script> ScriptEditor::_get_current_script() {
if (current) {
Ref<Script> script = current->get_edited_resource();
- return script != NULL ? script : NULL;
+ return script != nullptr ? script : nullptr;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -1093,11 +1093,6 @@ void ScriptEditor::_menu_option(int p_option) {
OS::get_singleton()->shell_open("https://docs.godotengine.org/");
} break;
- case REQUEST_DOCS: {
-
- OS::get_singleton()->shell_open("https://github.com/godotengine/godot-docs/issues/new");
- } break;
-
case WINDOW_NEXT: {
_history_forward();
@@ -1145,7 +1140,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
Ref<TextFile> text_file = current->get_edited_resource();
- if (text_file != NULL) {
+ if (text_file != nullptr) {
current->apply_code();
_save_text_file(text_file, text_file->get_path());
break;
@@ -1169,7 +1164,7 @@ void ScriptEditor::_menu_option(int p_option) {
}
Ref<TextFile> text_file = current->get_edited_resource();
- if (text_file != NULL) {
+ if (text_file != nullptr) {
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
file_dialog_option = FILE_SAVE_AS;
@@ -1198,7 +1193,7 @@ void ScriptEditor::_menu_option(int p_option) {
case FILE_RUN: {
Ref<Script> scr = current->get_edited_resource();
- if (scr == NULL || scr.is_null()) {
+ if (scr == nullptr || scr.is_null()) {
EditorNode::get_singleton()->show_warning(TTR("Can't obtain the script for running."));
break;
}
@@ -1398,7 +1393,6 @@ void ScriptEditor::_notification(int p_what) {
help_search->set_icon(get_theme_icon("HelpSearch", "EditorIcons"));
site_search->set_icon(get_theme_icon("Instance", "EditorIcons"));
- request_docs->set_icon(get_theme_icon("Issue", "EditorIcons"));
script_forward->set_icon(get_theme_icon("Forward", "EditorIcons"));
script_back->set_icon(get_theme_icon("Back", "EditorIcons"));
@@ -1467,7 +1461,7 @@ void ScriptEditor::close_builtin_scripts_from_scene(const String &p_scene) {
if (se) {
Ref<Script> script = se->get_edited_resource();
- if (script == NULL || !script.is_valid())
+ if (script == nullptr || !script.is_valid())
continue;
if (script->get_path().find("::") != -1 && script->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed
@@ -1500,7 +1494,7 @@ void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
continue;
Ref<Script> script = se->get_edited_resource();
- if (script == NULL) {
+ if (script == nullptr) {
continue;
}
@@ -1992,7 +1986,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
const bool should_open = open_dominant || !EditorNode::get_singleton()->is_changing_scene();
- if (script != NULL && script->get_language()->overrides_external_editor()) {
+ if (script != nullptr && script->get_language()->overrides_external_editor()) {
if (should_open) {
Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col);
if (err != OK)
@@ -2070,7 +2064,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
if (!se)
continue;
- if ((script != NULL && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) {
+ if ((script != nullptr && se->get_edited_resource() == p_resource) || se->get_edited_resource()->get_path() == p_resource->get_path()) {
if (should_open) {
if (tab_container->get_current_tab() != i) {
@@ -2092,7 +2086,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
// doesn't have it, make a new one
- ScriptEditorBase *se = NULL;
+ ScriptEditorBase *se = nullptr;
for (int i = script_editor_func_count - 1; i >= 0; i--) {
se = script_editor_funcs[i](p_resource);
@@ -2107,7 +2101,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
SyntaxHighlighter *highlighter = syntax_highlighters_funcs[i]();
se->add_syntax_highlighter(highlighter);
- if (script != NULL && !highlighter_set) {
+ if (script != nullptr && !highlighter_set) {
List<String> languages = highlighter->get_supported_languages();
if (languages.find(script->get_language()->get_name())) {
se->set_syntax_highlighter(highlighter);
@@ -2188,7 +2182,7 @@ void ScriptEditor::save_all_scripts() {
if (edited_res->get_path() != "" && edited_res->get_path().find("local://") == -1 && edited_res->get_path().find("::") == -1) {
Ref<TextFile> text_file = edited_res;
- if (text_file != NULL) {
+ if (text_file != nullptr) {
_save_text_file(text_file, text_file->get_path());
continue;
}
@@ -2574,7 +2568,7 @@ void ScriptEditor::_make_script_list_context_menu() {
context_menu->add_separator();
if (se) {
Ref<Script> scr = se->get_edited_resource();
- if (scr != NULL) {
+ if (scr != nullptr) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/reload_script_soft"), FILE_TOOL_RELOAD_SOFT);
if (!scr.is_null() && scr->is_tool()) {
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/run_file"), FILE_RUN);
@@ -2831,7 +2825,7 @@ void ScriptEditor::_update_history_pos(int p_new_pos) {
Object::cast_to<ScriptEditorBase>(n)->ensure_focus();
Ref<Script> script = Object::cast_to<ScriptEditorBase>(n)->get_edited_resource();
- if (script != NULL) {
+ if (script != nullptr) {
notify_script_changed(script);
}
}
@@ -2872,7 +2866,7 @@ Vector<Ref<Script>> ScriptEditor::get_open_scripts() const {
continue;
Ref<Script> script = se->get_edited_resource();
- if (script != NULL) {
+ if (script != nullptr) {
out_scripts.push_back(script);
}
}
@@ -3260,12 +3254,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
menu_hb->add_child(site_search);
site_search->set_tooltip(TTR("Open Godot online documentation."));
- request_docs = memnew(ToolButton);
- request_docs->set_text(TTR("Request Docs"));
- request_docs->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(REQUEST_DOCS));
- menu_hb->add_child(request_docs);
- request_docs->set_tooltip(TTR("Help improve the Godot documentation by giving feedback."));
-
help_search = memnew(ToolButton);
help_search->set_text(TTR("Search Help"));
help_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option), varray(SEARCH_HELP));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index ec598f0b42..e895867268 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -159,7 +159,6 @@ class ScriptEditor : public PanelContainer {
REPLACE_IN_FILES,
SEARCH_HELP,
SEARCH_WEBSITE,
- REQUEST_DOCS,
HELP_SEARCH_FIND,
HELP_SEARCH_FIND_NEXT,
HELP_SEARCH_FIND_PREVIOUS,
@@ -204,7 +203,6 @@ class ScriptEditor : public PanelContainer {
Button *help_search;
Button *site_search;
- Button *request_docs;
EditorHelpSearch *help_search_dialog;
ItemList *script_list;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 2e95bb92f4..4b8383e1e5 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -747,7 +747,7 @@ static Vector<Node *> _find_all_node_for_script(Node *p_base, Node *p_current, c
static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
if (p_current->get_owner() != p_base && p_base != p_current)
- return NULL;
+ return nullptr;
Ref<Script> c = p_current->get_script();
if (c == p_script)
return p_current;
@@ -757,7 +757,7 @@ static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Scri
return found;
}
- return NULL;
+ return nullptr;
}
static void _find_changed_scripts_for_external_editor(Node *p_base, Node *p_current, Set<Ref<Script>> &r_scripts) {
@@ -999,7 +999,7 @@ void ScriptTextEditor::_validate_symbol(const String &p_symbol) {
}
void ScriptTextEditor::update_toggle_scripts_button() {
- if (code_editor != NULL) {
+ if (code_editor != nullptr) {
code_editor->update_toggle_scripts_button();
}
}
@@ -1436,7 +1436,7 @@ void ScriptTextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter)
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)
+ if (p_highlighter != nullptr)
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(TTR("Standard")), true);
@@ -1444,7 +1444,7 @@ void ScriptTextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter)
void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
Map<String, SyntaxHighlighter *>::Element *el = highlighters.front();
- while (el != NULL) {
+ while (el != nullptr) {
highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false);
el = el->next();
}
@@ -1517,7 +1517,7 @@ bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
- return NULL;
+ return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -1530,7 +1530,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
- return NULL;
+ return nullptr;
}
void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
@@ -1877,7 +1877,7 @@ ScriptTextEditor::ScriptTextEditor() {
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
- highlighters[TTR("Standard")] = NULL;
+ highlighters[TTR("Standard")] = nullptr;
highlighter_menu = memnew(PopupMenu);
highlighter_menu->set_name("highlighter_menu");
edit_menu->get_popup()->add_child(highlighter_menu);
@@ -1944,7 +1944,7 @@ ScriptTextEditor::ScriptTextEditor() {
ScriptTextEditor::~ScriptTextEditor() {
for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) {
- if (E->get() != NULL) {
+ if (E->get() != nullptr) {
memdelete(E->get());
}
}
@@ -1956,7 +1956,7 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<Script>(*p_resource)) {
return memnew(ScriptTextEditor);
}
- return NULL;
+ return nullptr;
}
void ScriptTextEditor::register_editor() {
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 29ebfc8f7a..2a36700105 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -716,7 +716,7 @@ void ShaderEditorPlugin::edit(Object *p_object) {
bool ShaderEditorPlugin::handles(Object *p_object) const {
Shader *shader = Object::cast_to<Shader>(p_object);
- return shader != NULL && shader->is_text_shader();
+ return shader != nullptr && shader->is_text_shader();
}
void ShaderEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/plugins/skeleton_2d_editor_plugin.cpp b/editor/plugins/skeleton_2d_editor_plugin.cpp
index 96b2e56538..c81d3f787e 100644
--- a/editor/plugins/skeleton_2d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_2d_editor_plugin.cpp
@@ -38,7 +38,7 @@
void Skeleton2DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
options->hide();
}
}
@@ -131,7 +131,7 @@ void Skeleton2DEditorPlugin::make_visible(bool p_visible) {
} else {
sprite_editor->options->hide();
- sprite_editor->edit(NULL);
+ sprite_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index ae289dae4b..fac4cb19d8 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -144,7 +144,7 @@ void Skeleton3DEditor::_notification(int p_what) {
void Skeleton3DEditor::_node_removed(Node *p_node) {
if (p_node == skeleton) {
- skeleton = NULL;
+ skeleton = nullptr;
options->hide();
}
}
@@ -153,7 +153,7 @@ void Skeleton3DEditor::_bind_methods() {
}
Skeleton3DEditor::Skeleton3DEditor() {
- skeleton = NULL;
+ skeleton = nullptr;
options = memnew(MenuButton);
Node3DEditor::get_singleton()->add_control_to_menu_panel(options);
@@ -182,7 +182,7 @@ void Skeleton3DEditorPlugin::make_visible(bool p_visible) {
} else {
skeleton_editor->options->hide();
- skeleton_editor->edit(NULL);
+ skeleton_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h
index 606e04bb79..2ba5a817bc 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_3d_editor_plugin.h
@@ -49,7 +49,7 @@ class Skeleton3DEditor : public Node {
PhysicalBone3D *physical_bone;
Transform relative_rest; // Relative to skeleton node
BoneInfo() :
- physical_bone(NULL) {}
+ physical_bone(nullptr) {}
};
Skeleton3D *skeleton;
diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
index 4b6a86bb5a..a22534eac0 100644
--- a/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_ik_3d_editor_plugin.cpp
@@ -90,7 +90,7 @@ SkeletonIK3DEditorPlugin::SkeletonIK3DEditorPlugin(EditorNode *p_node) {
play_btn->hide();
play_btn->connect("pressed", callable_mp(this, &SkeletonIK3DEditorPlugin::_play));
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, play_btn);
- skeleton_ik = NULL;
+ skeleton_ik = nullptr;
}
SkeletonIK3DEditorPlugin::~SkeletonIK3DEditorPlugin() {}
diff --git a/editor/plugins/skeleton_ik_3d_editor_plugin.h b/editor/plugins/skeleton_ik_3d_editor_plugin.h
index 1466d670ba..88472a2963 100644
--- a/editor/plugins/skeleton_ik_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_ik_3d_editor_plugin.h
@@ -51,7 +51,7 @@ protected:
static void _bind_methods();
public:
- virtual String get_name() const { return "SkeletonIK"; }
+ virtual String get_name() const { return "SkeletonIK3D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp
index ce994ee6c7..ab0f15d3d0 100644
--- a/editor/plugins/sprite_2d_editor_plugin.cpp
+++ b/editor/plugins/sprite_2d_editor_plugin.cpp
@@ -42,7 +42,7 @@
void Sprite2DEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
options->hide();
}
}
@@ -593,7 +593,7 @@ void Sprite2DEditorPlugin::make_visible(bool p_visible) {
} else {
sprite_editor->options->hide();
- sprite_editor->edit(NULL);
+ sprite_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/sprite_2d_editor_plugin.h b/editor/plugins/sprite_2d_editor_plugin.h
index d0ebf9c84e..0add77843b 100644
--- a/editor/plugins/sprite_2d_editor_plugin.h
+++ b/editor/plugins/sprite_2d_editor_plugin.h
@@ -104,7 +104,7 @@ class Sprite2DEditorPlugin : public EditorPlugin {
EditorNode *editor;
public:
- virtual String get_name() const { return "Sprite"; }
+ virtual String get_name() const { return "Sprite2D"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index 41db0308c2..fbb6616dea 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -34,7 +34,7 @@
bool EditorInspectorPluginStyleBox::can_handle(Object *p_object) {
- return Object::cast_to<StyleBox>(p_object) != NULL;
+ return Object::cast_to<StyleBox>(p_object) != nullptr;
}
void EditorInspectorPluginStyleBox::parse_begin(Object *p_object) {
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index aa86c48af1..2786a568ea 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -41,7 +41,7 @@ void TextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
TextEdit *te = code_editor->get_text_edit();
te->_set_syntax_highlighting(p_highlighter);
- if (p_highlighter != NULL) {
+ if (p_highlighter != nullptr) {
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);
@@ -49,7 +49,7 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
// little work around. GDScript highlighter goes through text_edit for colours,
// so to remove all colours we need to set and unset them here.
- if (p_highlighter == NULL) { // standard
+ if (p_highlighter == nullptr) { // standard
TextEdit *text_edit = code_editor->get_text_edit();
text_edit->add_theme_color_override("number_color", colors_cache.font_color);
text_edit->add_theme_color_override("function_color", colors_cache.font_color);
@@ -62,7 +62,7 @@ void TextEditor::set_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
void TextEditor::_change_syntax_highlighter(int p_idx) {
Map<String, SyntaxHighlighter *>::Element *el = highlighters.front();
- while (el != NULL) {
+ while (el != nullptr) {
highlighter_menu->set_item_checked(highlighter_menu->get_item_idx_from_text(el->key()), false);
el = el->next();
}
@@ -533,7 +533,7 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
if (Object::cast_to<TextFile>(*p_resource)) {
return memnew(TextEditor);
}
- return NULL;
+ return nullptr;
}
void TextEditor::register_editor() {
@@ -694,7 +694,7 @@ TextEditor::TextEditor() {
convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize")), EDIT_CAPITALIZE);
convert_case->connect("id_pressed", callable_mp(this, &TextEditor::_edit_option));
- highlighters["Standard"] = NULL;
+ highlighters["Standard"] = nullptr;
highlighter_menu = memnew(PopupMenu);
highlighter_menu->set_name("highlighter_menu");
edit_menu->get_popup()->add_child(highlighter_menu);
@@ -727,7 +727,7 @@ TextEditor::TextEditor() {
TextEditor::~TextEditor() {
for (const Map<String, SyntaxHighlighter *>::Element *E = highlighters.front(); E; E = E->next()) {
- if (E->get() != NULL) {
+ if (E->get() != nullptr) {
memdelete(E->get());
}
}
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 3f76854571..c1184c1c89 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -144,7 +144,7 @@ TextureEditor::~TextureEditor() {
//
bool EditorInspectorPluginTexture::can_handle(Object *p_object) {
- return Object::cast_to<ImageTexture>(p_object) != NULL || Object::cast_to<AtlasTexture>(p_object) != NULL || Object::cast_to<StreamTexture>(p_object) != NULL || Object::cast_to<LargeTexture>(p_object) != NULL || Object::cast_to<AnimatedTexture>(p_object) != NULL;
+ return Object::cast_to<ImageTexture>(p_object) != nullptr || Object::cast_to<AtlasTexture>(p_object) != nullptr || Object::cast_to<StreamTexture>(p_object) != nullptr || Object::cast_to<LargeTexture>(p_object) != nullptr || Object::cast_to<AnimatedTexture>(p_object) != nullptr;
}
void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp
index d453598e33..cd69c1e6f9 100644
--- a/editor/plugins/texture_region_editor_plugin.cpp
+++ b/editor/plugins/texture_region_editor_plugin.cpp
@@ -49,7 +49,7 @@ void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
}
void TextureRegionEditor::_region_draw() {
- Ref<Texture2D> base_tex = NULL;
+ Ref<Texture2D> base_tex = nullptr;
if (node_sprite)
base_tex = node_sprite->get_texture();
else if (node_sprite_3d)
@@ -672,7 +672,7 @@ void TextureRegionEditor::_update_autoslice() {
autoslice_is_dirty = false;
autoslice_cache.clear();
- Ref<Texture2D> texture = NULL;
+ Ref<Texture2D> texture = nullptr;
if (node_sprite)
texture = node_sprite->get_texture();
else if (node_sprite_3d)
@@ -767,11 +767,11 @@ void TextureRegionEditor::_notification(int p_what) {
void TextureRegionEditor::_node_removed(Object *p_obj) {
if (p_obj == node_sprite || p_obj == node_sprite_3d || p_obj == node_ninepatch || p_obj == obj_styleBox.ptr() || p_obj == atlas_tex.ptr()) {
- node_sprite = NULL;
- node_sprite_3d = NULL;
- node_ninepatch = NULL;
- obj_styleBox = Ref<StyleBox>(NULL);
- atlas_tex = Ref<AtlasTexture>(NULL);
+ node_sprite = nullptr;
+ node_sprite_3d = nullptr;
+ node_ninepatch = nullptr;
+ obj_styleBox = Ref<StyleBox>(nullptr);
+ atlas_tex = Ref<AtlasTexture>(nullptr);
hide();
}
}
@@ -793,7 +793,7 @@ bool TextureRegionEditor::is_atlas_texture() {
}
bool TextureRegionEditor::is_ninepatch() {
- return node_ninepatch != NULL;
+ return node_ninepatch != nullptr;
}
Sprite3D *TextureRegionEditor::get_sprite_3d() {
@@ -826,11 +826,11 @@ void TextureRegionEditor::edit(Object *p_obj) {
p_obj->add_change_receptor(this);
_edit_region();
} else {
- node_sprite = NULL;
- node_sprite_3d = NULL;
- node_ninepatch = NULL;
- obj_styleBox = Ref<StyleBoxTexture>(NULL);
- atlas_tex = Ref<AtlasTexture>(NULL);
+ node_sprite = nullptr;
+ node_sprite_3d = nullptr;
+ node_ninepatch = nullptr;
+ obj_styleBox = Ref<StyleBoxTexture>(nullptr);
+ atlas_tex = Ref<AtlasTexture>(nullptr);
}
edit_draw->update();
if ((node_sprite && !node_sprite->is_region()) || (node_sprite_3d && !node_sprite_3d->is_region())) {
@@ -850,7 +850,7 @@ void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_pro
}
void TextureRegionEditor::_edit_region() {
- Ref<Texture2D> texture = NULL;
+ Ref<Texture2D> texture = nullptr;
if (node_sprite)
texture = node_sprite->get_texture();
else if (node_sprite_3d)
@@ -896,11 +896,11 @@ Vector2 TextureRegionEditor::snap_point(Vector2 p_target) const {
}
TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
- node_sprite = NULL;
- node_sprite_3d = NULL;
- node_ninepatch = NULL;
- obj_styleBox = Ref<StyleBoxTexture>(NULL);
- atlas_tex = Ref<AtlasTexture>(NULL);
+ node_sprite = nullptr;
+ node_sprite_3d = nullptr;
+ node_ninepatch = nullptr;
+ obj_styleBox = Ref<StyleBoxTexture>(nullptr);
+ atlas_tex = Ref<AtlasTexture>(nullptr);
editor = p_editor;
undo_redo = editor->get_undo_redo();
@@ -1057,7 +1057,7 @@ void TextureRegionEditorPlugin::make_visible(bool p_visible) {
manually_hidden = false;
}
texture_region_button->hide();
- region_editor->edit(NULL);
+ region_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 83dc84a0c2..ce421ac0a5 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -38,6 +38,13 @@
#include "editor/editor_settings.h"
#include "scene/gui/split_container.h"
+void TileMapEditor::_node_removed(Node *p_node) {
+
+ if (p_node == node) {
+ node = nullptr;
+ }
+}
+
void TileMapEditor::_notification(int p_what) {
switch (p_what) {
@@ -60,6 +67,7 @@ void TileMapEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
+ get_tree()->connect("node_removed", callable_mp(this, &TileMapEditor::_node_removed));
paint_button->set_icon(get_theme_icon("Edit", "EditorIcons"));
bucket_fill_button->set_icon(get_theme_icon("Bucket", "EditorIcons"));
picker_button->set_icon(get_theme_icon("ColorPick", "EditorIcons"));
@@ -80,6 +88,10 @@ void TileMapEditor::_notification(int p_what) {
p->set_item_icon(p->get_item_index(OPTION_ERASE_SELECTION), get_theme_icon("Remove", "EditorIcons"));
} break;
+
+ case NOTIFICATION_EXIT_TREE: {
+ get_tree()->disconnect("node_removed", callable_mp(this, &TileMapEditor::_node_removed));
+ } break;
}
}
@@ -627,7 +639,7 @@ Vector<Vector2> TileMapEditor::_bucket_fill(const Point2i &p_start, bool erase,
if (r != bucket_cache_rect)
_clear_bucket_cache();
// Cache grid is not initialized
- if (bucket_cache_visited == NULL) {
+ if (bucket_cache_visited == nullptr) {
bucket_cache_visited = new bool[area];
invalidate_cache = true;
}
@@ -894,7 +906,7 @@ void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Po
void TileMapEditor::_clear_bucket_cache() {
if (bucket_cache_visited) {
delete[] bucket_cache_visited;
- bucket_cache_visited = NULL;
+ bucket_cache_visited = nullptr;
}
}
@@ -1773,7 +1785,7 @@ void TileMapEditor::edit(Node *p_tile_map) {
_update_palette();
} else {
- node = NULL;
+ node = nullptr;
if (canvas_item_editor_viewport->is_connected("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter)))
canvas_item_editor_viewport->disconnect("mouse_entered", callable_mp(this, &TileMapEditor::_canvas_mouse_enter));
@@ -1889,11 +1901,11 @@ void TileMapEditor::_clear_transform() {
TileMapEditor::TileMapEditor(EditorNode *p_editor) {
- node = NULL;
+ node = nullptr;
manual_autotile = false;
priority_atlastile = false;
manual_position = Vector2(0, 0);
- canvas_item_editor_viewport = NULL;
+ canvas_item_editor_viewport = nullptr;
editor = p_editor;
undo_redo = EditorNode::get_undo_redo();
@@ -1906,7 +1918,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
transpose = false;
bucket_cache_tile = -1;
- bucket_cache_visited = NULL;
+ bucket_cache_visited = nullptr;
invalid_cell.resize(1);
invalid_cell.write[0] = TileMap::INVALID_CELL;
@@ -2142,7 +2154,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
tile_map_editor->get_toolbar()->hide();
tile_map_editor->get_toolbar_right()->hide();
tile_map_editor->get_tile_info()->hide();
- tile_map_editor->edit(NULL);
+ tile_map_editor->edit(nullptr);
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index 74969d3e64..f43e5bb5cb 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -211,6 +211,7 @@ class TileMapEditor : public VBoxContainer {
protected:
void _notification(int p_what);
+ void _node_removed(Node *p_node);
static void _bind_methods();
CellOp _get_op_from_cell(const Point2i &p_pos);
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index f479139e4d..d1dda68c1d 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -725,7 +725,7 @@ void TileSetEditor::_on_texture_list_selected(int p_index) {
update_workspace_minsize();
} else {
current_item_index = -1;
- preview->set_texture(NULL);
+ preview->set_texture(nullptr);
workspace->set_custom_minimum_size(Size2i());
update_workspace_tile_mode();
}
@@ -3003,7 +3003,7 @@ void TileSetEditor::select_coord(const Vector2 &coord) {
}
}
if (!found_collision_shape)
- _set_edited_collision_shape(Ref<ConvexPolygonShape2D>(NULL));
+ _set_edited_collision_shape(Ref<ConvexPolygonShape2D>(nullptr));
if (edited_occlusion_shape != tileset->autotile_get_light_occluder(get_current_tile(), coord))
edited_occlusion_shape = tileset->autotile_get_light_occluder(get_current_tile(), coord);
if (edited_navigation_shape != tileset->autotile_get_navigation_polygon(get_current_tile(), coord))
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index 3998a3233b..fe8392593b 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -35,7 +35,7 @@
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
-VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = NULL;
+VersionControlEditorPlugin *VersionControlEditorPlugin::singleton = nullptr;
void VersionControlEditorPlugin::_bind_methods() {
@@ -171,7 +171,7 @@ void VersionControlEditorPlugin::_refresh_stage_area() {
for (int i = 0; i < modified_file_paths.size(); i++) {
file_path = modified_file_paths.get_key_at_index(i);
- TreeItem *found = stage_files->search_item_text(file_path, 0, true);
+ TreeItem *found = stage_files->search_item_text(file_path, nullptr, true);
if (!found) {
ChangeType change_index = (ChangeType)(int)modified_file_paths.get_value_at_index(i);
@@ -385,7 +385,7 @@ void VersionControlEditorPlugin::shut_down() {
}
EditorVCSInterface::get_singleton()->shut_down();
memdelete(EditorVCSInterface::get_singleton());
- EditorVCSInterface::set_singleton(NULL);
+ EditorVCSInterface::set_singleton(nullptr);
EditorNode::get_singleton()->remove_control_from_dock(version_commit_dock);
EditorNode::get_singleton()->remove_bottom_panel_item(version_control_dock);
@@ -438,7 +438,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
set_up_choice->connect("item_selected", callable_mp(this, &VersionControlEditorPlugin::_selected_a_vcs));
set_up_hbc->add_child(set_up_choice);
- set_up_init_settings = NULL;
+ set_up_init_settings = nullptr;
set_up_init_button = memnew(Button);
set_up_init_button->set_text(TTR("Initialize"));
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 594dc400ec..b1bd6392d8 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -52,7 +52,7 @@ Control *VisualShaderNodePlugin::create_editor(const Ref<Resource> &p_parent_res
if (get_script_instance()) {
return get_script_instance()->call("create_editor", p_parent_resource, p_node);
}
- return NULL;
+ return nullptr;
}
void VisualShaderNodePlugin::_bind_methods() {
@@ -352,7 +352,7 @@ void VisualShaderEditor::_update_options_menu() {
for (int i = 0; i < options.size(); i++) {
String path = options[i].category;
Vector<String> subfolders = path.split("/");
- TreeItem *category = NULL;
+ TreeItem *category = nullptr;
if (!folders.has(path)) {
category = root;
@@ -536,7 +536,7 @@ void VisualShaderEditor::_update_graph() {
node->connect("dragged", callable_mp(this, &VisualShaderEditor::_node_dragged), varray(nodes[n_i]));
- Control *custom_editor = NULL;
+ Control *custom_editor = nullptr;
int port_offset = 0;
if (is_group) {
@@ -584,7 +584,7 @@ void VisualShaderEditor::_update_graph() {
custom_editor->call_deferred("_show_prop_names", true);
continue;
}
- custom_editor = NULL;
+ custom_editor = nullptr;
}
if (is_group) {
@@ -1087,7 +1087,7 @@ void VisualShaderEditor::_expression_focus_out(Object *text_edit, int p_node) {
}
void VisualShaderEditor::_rebuild() {
- if (visual_shader != NULL) {
+ if (visual_shader != nullptr) {
EditorNode::get_singleton()->get_log()->clear();
visual_shader->rebuild();
}
@@ -1111,7 +1111,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p
group_node->set_size(size);
- GraphNode *gn = NULL;
+ GraphNode *gn = nullptr;
if (edit_type->get_selected() == p_type) { // check - otherwise the error will be emitted
Node *node2 = graph->get_node(itos(p_node));
gn = Object::cast_to<GraphNode>(node2);
@@ -1126,7 +1126,7 @@ void VisualShaderEditor::_set_node_size(int p_type, int p_node, const Vector2 &p
if (!expression_node.is_null()) {
Control *text_box = expression_node->get_control(0);
Size2 box_size = size;
- if (gn != NULL) {
+ if (gn != nullptr) {
if (box_size.x < 150 * EDSCALE || box_size.y < 0) {
box_size.x = gn->get_size().x;
}
@@ -1274,7 +1274,7 @@ void VisualShaderEditor::_edit_port_default_input(Object *p_button, int p_node,
ERR_FAIL_COND(!button);
Variant value = vsn->get_input_port_default_value(p_port);
property_editor->set_position(button->get_screen_position() + Vector2(0, button->get_size().height));
- property_editor->edit(NULL, "", value.get_type(), value, 0, "");
+ property_editor->edit(nullptr, "", value.get_type(), value, 0, "");
property_editor->popup();
editing_node = p_node;
editing_port = p_port;
@@ -1304,7 +1304,7 @@ void VisualShaderEditor::_add_texture_node(const String &p_path) {
VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
- ERR_FAIL_INDEX_V(p_idx, add_options.size(), NULL);
+ ERR_FAIL_INDEX_V(p_idx, add_options.size(), nullptr);
Ref<VisualShaderNode> vsnode;
@@ -1312,7 +1312,7 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
if (!is_custom && add_options[p_idx].type != String()) {
VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instance(add_options[p_idx].type));
- ERR_FAIL_COND_V(!vsn, NULL);
+ ERR_FAIL_COND_V(!vsn, nullptr);
VisualShaderNodeFloatConstant *constant = Object::cast_to<VisualShaderNodeFloatConstant>(vsn);
@@ -1410,10 +1410,10 @@ VisualShaderNode *VisualShaderEditor::_add_node(int p_idx, int p_op_idx) {
vsnode = Ref<VisualShaderNode>(vsn);
} else {
- ERR_FAIL_COND_V(add_options[p_idx].script.is_null(), NULL);
+ ERR_FAIL_COND_V(add_options[p_idx].script.is_null(), nullptr);
String base_type = add_options[p_idx].script->get_instance_base_type();
VisualShaderNode *vsn = Object::cast_to<VisualShaderNode>(ClassDB::instance(base_type));
- ERR_FAIL_COND_V(!vsn, NULL);
+ ERR_FAIL_COND_V(!vsn, nullptr);
vsnode = Ref<VisualShaderNode>(vsn);
vsnode->set_script(add_options[p_idx].script);
}
@@ -2068,7 +2068,7 @@ void VisualShaderEditor::_member_filter_changed(const String &p_text) {
void VisualShaderEditor::_member_selected() {
TreeItem *item = members->get_selected();
- if (item != NULL && item->has_meta("id")) {
+ if (item != nullptr && item->has_meta("id")) {
members_dialog->get_ok()->set_disabled(false);
highend_label->set_visible(add_options[item->get_meta("id")].highend);
node_desc->set_text(_get_description(item->get_meta("id")));
@@ -2084,7 +2084,7 @@ void VisualShaderEditor::_member_unselected() {
void VisualShaderEditor::_member_create() {
TreeItem *item = members->get_selected();
- if (item != NULL && item->has_meta("id")) {
+ if (item != nullptr && item->has_meta("id")) {
int idx = members->get_selected()->get_meta("id");
_add_node(idx, add_options[idx].sub_func);
members_dialog->hide();
@@ -2298,7 +2298,7 @@ void VisualShaderEditor::_bind_methods() {
ClassDB::bind_method("_is_available", &VisualShaderEditor::_is_available);
}
-VisualShaderEditor *VisualShaderEditor::singleton = NULL;
+VisualShaderEditor *VisualShaderEditor::singleton = nullptr;
VisualShaderEditor::VisualShaderEditor() {
@@ -3129,7 +3129,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
Vector<StringName> properties = p_node->get_editable_properties();
if (properties.size() == 0) {
- return NULL;
+ return nullptr;
}
List<PropertyInfo> props;
@@ -3147,7 +3147,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
}
if (pinfo.size() == 0)
- return NULL;
+ return nullptr;
properties.clear();
@@ -3158,7 +3158,7 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par
EditorProperty *prop = EditorInspector::instantiate_property_editor(node.ptr(), pinfo[i].type, pinfo[i].name, pinfo[i].hint, pinfo[i].hint_string, pinfo[i].usage);
if (!prop)
- return NULL;
+ return nullptr;
if (Object::cast_to<EditorPropertyResource>(prop)) {
Object::cast_to<EditorPropertyResource>(prop)->set_use_sub_inspector(false);
diff --git a/editor/progress_dialog.cpp b/editor/progress_dialog.cpp
index 859718cba4..86df069b8b 100644
--- a/editor/progress_dialog.cpp
+++ b/editor/progress_dialog.cpp
@@ -135,7 +135,7 @@ void BackgroundProgress::end_task(const String &p_task) {
////////////////////////////////////////////////
-ProgressDialog *ProgressDialog::singleton = NULL;
+ProgressDialog *ProgressDialog::singleton = nullptr;
void ProgressDialog::_notification(int p_what) {
}
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 39c24519c0..b30cd89c96 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -196,7 +196,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
name->set_editable(false);
export_path->hide();
runnable->set_disabled(true);
- parameters->edit(NULL);
+ parameters->edit(nullptr);
presets->unselect_all();
duplicate_preset->set_disabled(true);
delete_preset->set_disabled(true);
@@ -1244,7 +1244,7 @@ ProjectExportDialog::ProjectExportDialog() {
delete_preset->set_disabled(true);
script_key_error->hide();
sections->hide();
- parameters->edit(NULL);
+ parameters->edit(nullptr);
// Deletion dialog.
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index d3856cf778..0ca540a33f 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -191,7 +191,7 @@ private:
if (valid_path != "" && !d->file_exists("project.godot")) {
if (valid_path.ends_with(".zip")) {
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io);
@@ -208,7 +208,7 @@ private:
while (ret == UNZ_OK) {
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
if (String(fname).ends_with("project.godot")) {
break;
@@ -522,7 +522,7 @@ private:
zip_path = project_path->get_text();
}
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io);
@@ -543,7 +543,7 @@ private:
//get filename
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String path = fname;
@@ -955,8 +955,8 @@ public:
bool hover;
ProjectListItemControl() {
- favorite_button = NULL;
- icon = NULL;
+ favorite_button = nullptr;
+ icon = nullptr;
icon_needs_reload = true;
hover = false;
}
@@ -1036,7 +1036,7 @@ public:
grayed = p_grayed;
missing = p_missing;
version = p_version;
- control = NULL;
+ control = nullptr;
}
_FORCE_INLINE_ bool operator==(const Item &l) const {
@@ -1236,7 +1236,7 @@ void ProjectList::load_projects() {
// Clear whole list
for (int i = 0; i < _projects.size(); ++i) {
Item &project = _projects.write[i];
- CRASH_COND(project.control == NULL);
+ CRASH_COND(project.control == nullptr);
memdelete(project.control); // Why not queue_free()?
}
_projects.clear();
@@ -1346,7 +1346,7 @@ void ProjectList::create_project_item_control(int p_index) {
ERR_FAIL_COND(p_index != _scroll_children->get_child_count());
Item &item = _projects.write[p_index];
- ERR_FAIL_COND(item.control != NULL); // Already created
+ ERR_FAIL_COND(item.control != nullptr); // Already created
Ref<Texture2D> favorite_icon = get_theme_icon("Favorites", "EditorIcons");
Color font_color = get_theme_color("font_color", "Tree");
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index dfecadeda5..42493191a8 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -41,7 +41,7 @@
#include "scene/gui/margin_container.h"
#include "scene/gui/tab_container.h"
-ProjectSettingsEditor *ProjectSettingsEditor::singleton = NULL;
+ProjectSettingsEditor *ProjectSettingsEditor::singleton = nullptr;
static const char *_button_names[JOY_BUTTON_MAX] = {
"DualShock Cross, Xbox A, Nintendo B",
@@ -750,7 +750,7 @@ void ProjectSettingsEditor::_update_actions() {
item->set_range(1, action["deadzone"]);
item->set_custom_bg_color(1, input_editor->get_theme_color("prop_subsection", "Editor"));
- const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL;
+ const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != nullptr;
const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove");
item->add_button(2, input_editor->get_theme_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
item->add_button(2, input_editor->get_theme_icon("Remove", "EditorIcons"), 2, false, tooltip);
@@ -883,7 +883,7 @@ void ProjectSettingsEditor::_item_add() {
// Initialize the property with the default value for the given type.
// The type list starts at 1 (as we exclude Nil), so add 1 to the selected value.
Callable::CallError ce;
- const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), NULL, 0, ce);
+ const Variant value = Variant::construct(Variant::Type(type->get_selected() + 1), nullptr, 0, ce);
String catname = category->get_text().strip_edges();
String propname = property->get_text().strip_edges();
@@ -1537,7 +1537,7 @@ void ProjectSettingsEditor::_update_translations() {
updating_translations = true;
translation_list->clear();
- TreeItem *root = translation_list->create_item(NULL);
+ TreeItem *root = translation_list->create_item(nullptr);
translation_list->set_hide_root(true);
if (ProjectSettings::get_singleton()->has_setting("locale/translations")) {
@@ -1589,7 +1589,7 @@ void ProjectSettingsEditor::_update_translations() {
translation_locales_list_created = true;
translation_filter->clear();
- root = translation_filter->create_item(NULL);
+ root = translation_filter->create_item(nullptr);
translation_filter->set_hide_root(true);
translation_filter_treeitems.clear();
for (int i = 0; i < s; i++) {
@@ -1622,8 +1622,8 @@ void ProjectSettingsEditor::_update_translations() {
translation_remap->clear();
translation_remap_options->clear();
- root = translation_remap->create_item(NULL);
- TreeItem *root2 = translation_remap_options->create_item(NULL);
+ root = translation_remap->create_item(nullptr);
+ TreeItem *root2 = translation_remap_options->create_item(nullptr);
translation_remap->set_hide_root(true);
translation_remap_options->set_hide_root(true);
translation_res_option_add_button->set_disabled(true);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 8c5b078de0..444cae42c5 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1194,7 +1194,7 @@ void CustomPropertyEditor::_node_path_selected(NodePath p_path) {
} else if (owner) {
- Node *node = NULL;
+ Node *node = nullptr;
if (owner->is_class("Node"))
node = Object::cast_to<Node>(owner);
@@ -1541,7 +1541,7 @@ void CustomPropertyEditor::_modified(String p_string) {
v = value_editor[0]->get_text().to_int();
return;
} else {
- v = expr->execute(Array(), NULL, false);
+ v = expr->execute(Array(), nullptr, false);
}
emit_signal("variant_changed");
@@ -1713,7 +1713,7 @@ real_t CustomPropertyEditor::_parse_real_expression(String text) {
if (err != OK) {
out = value_editor[0]->get_text().to_double();
} else {
- out = expr->execute(Array(), NULL, false);
+ out = expr->execute(Array(), nullptr, false);
}
return out;
}
@@ -1924,7 +1924,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
action_buttons[i]->set_flat(true);
}
- color_picker = NULL;
+ color_picker = nullptr;
file = memnew(EditorFileDialog);
add_child(file);
@@ -1963,7 +1963,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
add_child(menu);
menu->connect("id_pressed", callable_mp(this, &CustomPropertyEditor::_menu_option));
- evaluator = NULL;
+ evaluator = nullptr;
spinbox = memnew(SpinBox);
add_child(spinbox);
@@ -1975,6 +1975,6 @@ CustomPropertyEditor::CustomPropertyEditor() {
slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5);
slider->connect("value_changed", callable_mp(this, &CustomPropertyEditor::_range_modified));
- create_dialog = NULL;
- property_select = NULL;
+ create_dialog = nullptr;
+ property_select = nullptr;
}
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 54b94ebb95..1960ecc604 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -96,7 +96,7 @@ void PropertySelector::_update_search() {
} else if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
+ v = Variant::construct(type, nullptr, 0, ce);
v.get_property_list(&props);
} else {
@@ -116,7 +116,7 @@ void PropertySelector::_update_search() {
}
}
- TreeItem *category = NULL;
+ TreeItem *category = nullptr;
bool found = false;
@@ -152,7 +152,7 @@ void PropertySelector::_update_search() {
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
if (E->get().usage == PROPERTY_USAGE_CATEGORY) {
- if (category && category->get_children() == NULL) {
+ if (category && category->get_children() == nullptr) {
memdelete(category); //old category was unused
}
category = search_options->create_item(root);
@@ -191,7 +191,7 @@ void PropertySelector::_update_search() {
item->set_selectable(0, true);
}
- if (category && category->get_children() == NULL) {
+ if (category && category->get_children() == nullptr) {
memdelete(category); //old category was unused
}
} else {
@@ -201,7 +201,7 @@ void PropertySelector::_update_search() {
if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
+ v = Variant::construct(type, nullptr, 0, ce);
v.get_method_list(&methods);
} else {
@@ -220,14 +220,14 @@ void PropertySelector::_update_search() {
}
}
- TreeItem *category = NULL;
+ TreeItem *category = nullptr;
bool found = false;
bool script_methods = false;
for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
if (E->get().name.begins_with("*")) {
- if (category && category->get_children() == NULL) {
+ if (category && category->get_children() == nullptr) {
memdelete(category); //old category was unused
}
category = search_options->create_item(root);
@@ -310,12 +310,12 @@ void PropertySelector::_update_search() {
}
}
- if (category && category->get_children() == NULL) {
+ if (category && category->get_children() == nullptr) {
memdelete(category); //old category was unused
}
}
- get_ok()->set_disabled(root->get_children() == NULL);
+ get_ok()->set_disabled(root->get_children() == nullptr);
}
void PropertySelector::_confirmed() {
@@ -410,7 +410,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const
type = Variant::NIL;
script = ObjectID();
properties = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = p_virtuals_only;
popup_centered_ratio(0.6);
@@ -427,7 +427,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co
type = Variant::NIL;
script = p_script->get_instance_id();
properties = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
@@ -443,7 +443,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const
type = p_type;
script = ObjectID();
properties = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
@@ -464,7 +464,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str
script = scr->get_instance_id();
}
properties = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
@@ -480,7 +480,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons
type = Variant::NIL;
script = ObjectID();
properties = true;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
@@ -498,7 +498,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script,
type = Variant::NIL;
script = p_script->get_instance_id();
properties = true;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
@@ -515,7 +515,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con
type = p_type;
script = ObjectID();
properties = true;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
popup_centered_ratio(0.6);
diff --git a/editor/pvrtc_compress.cpp b/editor/pvrtc_compress.cpp
index f9efe6a50d..1363fe2942 100644
--- a/editor/pvrtc_compress.cpp
+++ b/editor/pvrtc_compress.cpp
@@ -38,8 +38,8 @@
#include "editor_settings.h"
#include "scene/resources/texture.h"
-static void (*_base_image_compress_pvrtc2_func)(Image *) = NULL;
-static void (*_base_image_compress_pvrtc4_func)(Image *) = NULL;
+static void (*_base_image_compress_pvrtc2_func)(Image *) = nullptr;
+static void (*_base_image_compress_pvrtc4_func)(Image *) = nullptr;
static void _compress_image(Image::CompressMode p_mode, Image *p_image) {
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index 58bb061b58..4d9870235d 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -241,7 +241,7 @@ void EditorQuickOpen::_update_search() {
ti->set_as_cursor(0);
}
- get_ok()->set_disabled(root->get_children() == NULL);
+ get_ok()->set_disabled(root->get_children() == nullptr);
}
void EditorQuickOpen::_confirmed() {
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index c14462f07d..0266ef6a2b 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -45,7 +45,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
scene_tree_editor = p_scene_tree_editor;
undo_redo = p_undo_redo;
- preview_node = NULL;
+ preview_node = nullptr;
set_title(TTR("Batch Rename"));
@@ -369,7 +369,7 @@ void RenameDialog::_update_substitute() {
void RenameDialog::_post_popup() {
EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection();
- preview_node = NULL;
+ preview_node = nullptr;
Array selected_node_list = editor_selection->get_selected_nodes();
ERR_FAIL_COND(selected_node_list.size() == 0);
@@ -386,7 +386,7 @@ void RenameDialog::_update_preview_int(int new_value) {
void RenameDialog::_update_preview(String new_text) {
- if (lock_preview_update || preview_node == NULL)
+ if (lock_preview_update || preview_node == nullptr)
return;
has_errors = false;
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index 1cd0a2cb0f..194dd57648 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -110,7 +110,7 @@ public:
void reset();
void rename();
- RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo = NULL);
+ RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo = nullptr);
~RenameDialog(){};
};
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 4b382f09f4..eaefd04c6b 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -438,7 +438,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
return;
editor_data->get_undo_redo().create_action(TTR("Clear Script"));
- editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)NULL);
+ editor_data->get_undo_redo().add_do_method(editor, "push_item", (Script *)nullptr);
for (int i = 0; i < selection.size(); i++) {
@@ -495,7 +495,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (index < lowest_id) lowest_id = index;
if (E->get()->get_parent() != common_parent)
- common_parent = NULL;
+ common_parent = nullptr;
}
if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0))
@@ -548,7 +548,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().create_action(TTR("Duplicate Node(s)"));
editor_data->get_undo_redo().add_do_method(editor_selection, "clear");
- Node *dupsingle = NULL;
+ Node *dupsingle = nullptr;
List<Node *> editable_children;
selection.sort_custom<Node::Comparator>();
@@ -675,7 +675,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_do_method(node, "add_child", root);
editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename());
editor_data->get_undo_redo().add_do_method(root, "set_filename", String());
- editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)NULL);
+ editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)nullptr);
editor_data->get_undo_redo().add_do_method(root, "set_owner", node);
_node_replace_owner(root, root, node, MODE_DO);
@@ -685,7 +685,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root);
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, node->get_index());
- editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)NULL);
+ editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)nullptr);
editor_data->get_undo_redo().add_undo_method(node, "set_owner", root);
_node_replace_owner(root, root, root, MODE_UNDO);
@@ -962,7 +962,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
case TOOL_CREATE_USER_INTERFACE:
case TOOL_CREATE_FAVORITE: {
- Node *new_node = NULL;
+ Node *new_node = nullptr;
if (TOOL_CREATE_FAVORITE == p_tool) {
String name = selected_favorite_root.get_slicec(' ', 0);
@@ -998,7 +998,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", new_node);
editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_do_reference(new_node);
- editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL);
+ editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)nullptr);
editor_data->get_undo_redo().commit_action();
editor->edit_node(new_node);
@@ -1144,7 +1144,7 @@ void SceneTreeDock::_notification(int p_what) {
} break;
case NOTIFICATION_PROCESS: {
- bool show_create_root = bool(EDITOR_GET("interface/editors/show_scene_tree_root_selection")) && get_tree()->get_edited_scene_root() == NULL;
+ bool show_create_root = bool(EDITOR_GET("interface/editors/show_scene_tree_root_selection")) && get_tree()->get_edited_scene_root() == nullptr;
if (show_create_root != create_root_dialog->is_visible_in_tree() && !remote_tree->is_visible()) {
if (show_create_root) {
@@ -1202,7 +1202,7 @@ void SceneTreeDock::_node_selected() {
if (!node) {
- editor->push_item(NULL);
+ editor->push_item(nullptr);
return;
}
@@ -1466,7 +1466,7 @@ void SceneTreeDock::_node_prerenamed(Node *p_node, const String &p_new_name) {
for (int i = 0; i < p_node->get_child_count(); i++)
_fill_path_renames(base_path, new_base_path, p_node->get_child(i), &path_renames);
- perform_node_renames(NULL, &path_renames);
+ perform_node_renames(nullptr, &path_renames);
}
bool SceneTreeDock::_validate_no_foreign() {
@@ -1662,7 +1662,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
}
}
- perform_node_renames(NULL, &path_renames);
+ perform_node_renames(nullptr, &path_renames);
editor_data->get_undo_redo().commit_action();
}
@@ -1805,7 +1805,7 @@ void SceneTreeDock::_delete_confirm() {
if (entire_scene) {
- editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", (Object *)NULL);
+ editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", (Object *)nullptr);
editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", edited_scene);
editor_data->get_undo_redo().add_undo_method(edited_scene, "set_owner", edited_scene->get_owner());
editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree");
@@ -1822,10 +1822,10 @@ void SceneTreeDock::_delete_confirm() {
if (!n->is_inside_tree() || !n->get_parent())
continue;
- fill_path_renames(n, NULL, &path_renames);
+ fill_path_renames(n, nullptr, &path_renames);
}
- perform_node_renames(NULL, &path_renames);
+ perform_node_renames(nullptr, &path_renames);
//delete for read
for (List<Node *>::Element *E = remove_list.front(); E; E = E->next()) {
Node *n = E->get();
@@ -1859,7 +1859,7 @@ void SceneTreeDock::_delete_confirm() {
if (CanvasItemEditor *editor = CanvasItemEditor::get_singleton())
editor->get_viewport_control()->update();
- editor->push_item(NULL);
+ editor->push_item(nullptr);
// Fixes the EditorHistory from still offering deleted notes
EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
@@ -1908,7 +1908,7 @@ void SceneTreeDock::_selection_changed() {
} else if (selection_size == 1) {
editor->push_item(EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0]);
} else {
- editor->push_item(NULL);
+ editor->push_item(nullptr);
}
_update_script_button();
}
@@ -1958,7 +1958,7 @@ void SceneTreeDock::_do_create(Node *p_parent) {
editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", child);
editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree");
editor_data->get_undo_redo().add_do_reference(child);
- editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL);
+ editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)nullptr);
}
editor_data->get_undo_redo().commit_action();
@@ -1982,7 +1982,7 @@ void SceneTreeDock::_create() {
if (current_option == TOOL_NEW) {
- Node *parent = NULL;
+ Node *parent = nullptr;
if (edited_scene) {
// If root exists in edited scene
@@ -2052,7 +2052,7 @@ void SceneTreeDock::_create() {
}
}
- Node *parent = NULL;
+ Node *parent = nullptr;
if (only_one_top_node)
parent = top_node->get_parent();
else
@@ -2096,7 +2096,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
memdelete(default_oldnode);
}
- editor->push_item(NULL);
+ editor->push_item(nullptr);
//reconnect signals
List<MethodInfo> sl;
@@ -2120,7 +2120,7 @@ void SceneTreeDock::replace_node(Node *p_node, Node *p_by_node, bool p_keep_prop
List<Node *> to_erase;
for (int i = 0; i < n->get_child_count(); i++) {
- if (n->get_child(i)->get_owner() == NULL && n->is_owned_by_parent()) {
+ if (n->get_child(i)->get_owner() == nullptr && n->is_owned_by_parent()) {
to_erase.push_back(n->get_child(i));
}
}
@@ -2267,7 +2267,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
if (p_type == -1) {
//drop at above selected node
if (to_node == EditorNode::get_singleton()->get_edited_scene()) {
- to_node = NULL;
+ to_node = nullptr;
ERR_FAIL_MSG("Cannot perform drop above the root node!");
}
@@ -2282,7 +2282,7 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
return;
}
- Node *lower_sibling = NULL;
+ Node *lower_sibling = nullptr;
if (_has_visible_children(to_node)) {
to_pos = 0;
@@ -2500,8 +2500,8 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
bool is_external = (selection[0]->get_filename() != "");
if (is_external) {
- bool is_inherited = selection[0]->get_scene_inherited_state() != NULL;
- bool is_top_level = selection[0]->get_owner() == NULL;
+ bool is_inherited = selection[0]->get_scene_inherited_state() != nullptr;
+ bool is_top_level = selection[0]->get_owner() == nullptr;
if (is_inherited && is_top_level) {
menu->add_separator();
if (profile_allow_editing) {
@@ -2634,7 +2634,7 @@ void SceneTreeDock::open_script_dialog(Node *p_for_node, bool p_extend) {
}
void SceneTreeDock::add_remote_tree_editor(Control *p_remote) {
- ERR_FAIL_COND(remote_tree != NULL);
+ ERR_FAIL_COND(remote_tree != nullptr);
add_child(p_remote);
remote_tree = p_remote;
remote_tree->hide();
@@ -2787,7 +2787,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
set_name("Scene");
editor = p_editor;
- edited_scene = NULL;
+ edited_scene = nullptr;
editor_data = &p_editor_data;
editor_selection = p_editor_selection;
scene_root = p_scene_root;
@@ -2869,7 +2869,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
edit_local->set_toggle_mode(true);
edit_local->connect("pressed", callable_mp(this, &SceneTreeDock::_local_tree_selected));
- remote_tree = NULL;
+ remote_tree = nullptr;
button_hb->hide();
create_root_dialog = memnew(VBoxContainer);
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index e41ea1ce97..31ef1ce7d0 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -247,10 +247,10 @@ public:
void import_subscene();
void set_edited_scene(Node *p_scene);
void instance(const String &p_file);
- void instance_scenes(const Vector<String> &p_files, Node *p_parent = NULL);
+ void instance_scenes(const Vector<String> &p_files, Node *p_parent = nullptr);
void set_selected(Node *p_node, bool p_emit_selected = false);
void fill_path_renames(Node *p_node, Node *p_new_parent, List<Pair<NodePath, NodePath>> *p_renames);
- void perform_node_renames(Node *p_base, List<Pair<NodePath, NodePath>> *p_renames, Map<Ref<Animation>, Set<int>> *r_rem_anims = NULL);
+ void perform_node_renames(Node *p_base, List<Pair<NodePath, NodePath>> *p_renames, Map<Ref<Animation>, Set<int>> *r_rem_anims = nullptr);
SceneTreeEditor *get_tree_editor() { return scene_tree; }
EditorData *get_editor_data() { return editor_data; }
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 831b7b6775..251c911038 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -42,7 +42,7 @@
Node *SceneTreeEditor::get_scene_node() {
- ERR_FAIL_COND_V(!is_inside_tree(), NULL);
+ ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
return get_tree()->get_edited_scene_root();
}
@@ -78,7 +78,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i
undo_redo->create_action(TTR("Toggle Visible"));
_toggle_visible(n);
List<Node *> selection = editor_selection->get_selected_node_list();
- if (selection.size() > 1 && selection.find(n) != NULL) {
+ if (selection.size() > 1 && selection.find(n) != nullptr) {
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
Node *nv = E->get();
ERR_FAIL_COND(!nv);
@@ -504,7 +504,7 @@ void SceneTreeEditor::_node_removed(Node *p_node) {
}
if (p_node == selected) {
- selected = NULL;
+ selected = nullptr;
emit_signal("node_selected");
}
}
@@ -529,7 +529,7 @@ void SceneTreeEditor::_update_tree() {
updating_tree = true;
tree->clear();
if (get_scene_node()) {
- _add_nodes(get_scene_node(), NULL);
+ _add_nodes(get_scene_node(), nullptr);
last_hash = hash_djb2_one_64(0);
_compute_hash(get_scene_node(), last_hash);
}
@@ -667,7 +667,7 @@ void SceneTreeEditor::_notification(int p_what) {
TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) {
if (!p_node)
- return NULL;
+ return nullptr;
NodePath np = p_node->get_metadata(0);
if (np == p_path)
@@ -682,7 +682,7 @@ TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) {
children = children->get_next();
}
- return NULL;
+ return nullptr;
}
void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
@@ -697,7 +697,7 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
if (selected == p_node)
return;
- TreeItem *item = p_node ? _find(tree->get_root(), p_node->get_path()) : NULL;
+ TreeItem *item = p_node ? _find(tree->get_root(), p_node->get_path()) : nullptr;
if (item) {
// make visible when it's collapsed
@@ -713,7 +713,7 @@ void SceneTreeEditor::set_selected(Node *p_node, bool p_emit_selected) {
} else {
if (!p_node)
- selected = NULL;
+ selected = nullptr;
_update_tree();
selected = p_node;
}
@@ -906,7 +906,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
Vector<Node *> selected;
Vector<Ref<Texture2D>> icons;
- TreeItem *next = tree->get_next_selected(NULL);
+ TreeItem *next = tree->get_next_selected(nullptr);
while (next) {
NodePath np = next->get_metadata(0);
@@ -1117,16 +1117,16 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope
connect_to_script_mode = false;
connecting_signal = false;
- undo_redo = NULL;
+ undo_redo = nullptr;
tree_dirty = true;
- selected = NULL;
+ selected = nullptr;
marked_selectable = false;
marked_children_selectable = false;
can_rename = p_can_rename;
can_open_instance = p_can_open_instance;
display_foreign = false;
- editor_selection = NULL;
+ editor_selection = nullptr;
if (p_label) {
Label *label = memnew(Label);
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 6bd06aff64..8910e8ec3a 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -125,8 +125,8 @@ void EditorSettingsDialog::_notification(int p_what) {
}
} break;
case NOTIFICATION_READY: {
- undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, NULL);
- undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, NULL);
+ undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
+ undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
} break;
case NOTIFICATION_ENTER_TREE: {
@@ -263,7 +263,7 @@ void EditorSettingsDialog::_update_shortcuts() {
// remove sections with no shortcuts
for (Map<String, TreeItem *>::Element *E = sections.front(); E; E = E->next()) {
TreeItem *section = E->get();
- if (section->get_children() == NULL) {
+ if (section->get_children() == nullptr) {
root->remove_child(section);
}
}
@@ -362,7 +362,7 @@ void EditorSettingsDialog::_tabs_tab_changed(int p_tab) {
void EditorSettingsDialog::_focus_current_search_box() {
Control *tab = tabs->get_current_tab_control();
- LineEdit *current_search_box = NULL;
+ LineEdit *current_search_box = nullptr;
if (tab == tab_general)
current_search_box = search_box;
else if (tab == tab_shortcuts)
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index 10859c7c90..749bad5fff 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -10,23 +10,23 @@ import sys
line_nb = False
for arg in sys.argv[1:]:
- if (arg == "--with-line-nb"):
+ if arg == "--with-line-nb":
print("Enabling line numbers in the context locations.")
line_nb = True
else:
os.sys.exit("Non supported argument '" + arg + "'. Aborting.")
-if (not os.path.exists("editor")):
+if not os.path.exists("editor"):
os.sys.exit("ERROR: This script should be started from the root of the git repo.")
matches = []
-for root, dirnames, filenames in os.walk('.'):
+for root, dirnames, filenames in os.walk("."):
dirnames[:] = [d for d in dirnames if d not in ["thirdparty"]]
- for filename in fnmatch.filter(filenames, '*.cpp'):
+ for filename in fnmatch.filter(filenames, "*.cpp"):
matches.append(os.path.join(root, filename))
- for filename in fnmatch.filter(filenames, '*.h'):
+ for filename in fnmatch.filter(filenames, "*.h"):
matches.append(os.path.join(root, filename))
matches.sort()
@@ -51,52 +51,54 @@ msgstr ""
"Content-Transfer-Encoding: 8-bit\\n"
"""
+
def process_file(f, fname):
global main_po, unique_str, unique_loc
l = f.readline()
lc = 1
- while (l):
+ while l:
- patterns = ['RTR(\"', 'TTR(\"', 'TTRC(\"']
+ patterns = ['RTR("', 'TTR("', 'TTRC("']
idx = 0
pos = 0
- while (pos >= 0):
+ while pos >= 0:
pos = l.find(patterns[idx], pos)
- if (pos == -1):
- if (idx < len(patterns) - 1):
+ if pos == -1:
+ if idx < len(patterns) - 1:
idx += 1
pos = 0
continue
pos += len(patterns[idx])
msg = ""
- while (pos < len(l) and (l[pos] != '"' or l[pos - 1] == '\\')):
+ while pos < len(l) and (l[pos] != '"' or l[pos - 1] == "\\"):
msg += l[pos]
pos += 1
- location = os.path.relpath(fname).replace('\\', '/')
- if (line_nb):
+ location = os.path.relpath(fname).replace("\\", "/")
+ if line_nb:
location += ":" + str(lc)
- if (not msg in unique_str):
+ if not msg in unique_str:
main_po += "\n#: " + location + "\n"
main_po += 'msgid "' + msg + '"\n'
main_po += 'msgstr ""\n'
unique_str.append(msg)
unique_loc[msg] = [location]
- elif (not location in unique_loc[msg]):
+ elif not location in unique_loc[msg]:
# Add additional location to previous occurrence too
msg_pos = main_po.find('\nmsgid "' + msg + '"')
- if (msg_pos == -1):
+ if msg_pos == -1:
print("Someone apparently thought writing Python was as easy as GDScript. Ping Akien.")
- main_po = main_po[:msg_pos] + ' ' + location + main_po[msg_pos:]
+ main_po = main_po[:msg_pos] + " " + location + main_po[msg_pos:]
unique_loc[msg].append(location)
l = f.readline()
lc += 1
+
print("Updating the editor.pot template...")
for fname in matches:
@@ -106,7 +108,7 @@ for fname in matches:
with open("editor.pot", "w") as f:
f.write(main_po)
-if (os.name == "posix"):
+if os.name == "posix":
print("Wrapping template at 79 characters for compatibility with Weblate.")
os.system("msgmerge -w79 editor.pot editor.pot > editor.pot.wrap")
shutil.move("editor.pot.wrap", "editor.pot")
@@ -114,7 +116,7 @@ if (os.name == "posix"):
shutil.move("editor.pot", "editor/translations/editor.pot")
# TODO: Make that in a portable way, if we care; if not, kudos to Unix users
-if (os.name == "posix"):
+if os.name == "posix":
added = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \+msgid | wc -l", shell=True)
removed = subprocess.check_output(r"git diff editor/translations/editor.pot | grep \\\-msgid | wc -l", shell=True)
print("\n# Template changes compared to the staged status:")
diff --git a/gles_builders.py b/gles_builders.py
index e4e5fafc85..e8928728fa 100644
--- a/gles_builders.py
+++ b/gles_builders.py
@@ -7,7 +7,6 @@ from platform_methods import subprocess_main
class LegacyGLHeaderStruct:
-
def __init__(self):
self.vertex_lines = []
self.fragment_lines = []
@@ -73,7 +72,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
ifdefline = line.replace("#ifdef ", "").strip()
if line.find("_EN_") != -1:
- enumbase = ifdefline[:ifdefline.find("_EN_")]
+ enumbase = ifdefline[: ifdefline.find("_EN_")]
ifdefline = ifdefline.replace("_EN_", "_")
line = line.replace("_EN_", "_")
if enumbase not in header_data.enums:
@@ -86,12 +85,12 @@ def include_file_in_legacygl_header(filename, header_data, depth):
if line.find("uniform") != -1 and line.lower().find("texunit:") != -1:
# texture unit
- texunitstr = line[line.find(":") + 1:].strip()
+ texunitstr = line[line.find(":") + 1 :].strip()
if texunitstr == "auto":
texunit = "-1"
else:
texunit = str(int(texunitstr))
- uline = line[:line.lower().find("//")]
+ uline = line[: line.lower().find("//")]
uline = uline.replace("uniform", "")
uline = uline.replace("highp", "")
uline = uline.replace(";", "")
@@ -99,10 +98,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
for x in lines:
x = x.strip()
- x = x[x.rfind(" ") + 1:]
+ x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
# unfiorm array
- x = x[:x.find("[")]
+ x = x[: x.find("[")]
if not x in header_data.texunit_names:
header_data.texunits += [(x, texunit)]
@@ -110,10 +109,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
elif line.find("uniform") != -1 and line.lower().find("ubo:") != -1:
# uniform buffer object
- ubostr = line[line.find(":") + 1:].strip()
+ ubostr = line[line.find(":") + 1 :].strip()
ubo = str(int(ubostr))
- uline = line[:line.lower().find("//")]
- uline = uline[uline.find("uniform") + len("uniform"):]
+ uline = line[: line.lower().find("//")]
+ uline = uline[uline.find("uniform") + len("uniform") :]
uline = uline.replace("highp", "")
uline = uline.replace(";", "")
uline = uline.replace("{", "").strip()
@@ -121,10 +120,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
for x in lines:
x = x.strip()
- x = x[x.rfind(" ") + 1:]
+ x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
# unfiorm array
- x = x[:x.find("[")]
+ x = x[: x.find("[")]
if not x in header_data.ubo_names:
header_data.ubos += [(x, ubo)]
@@ -137,10 +136,10 @@ def include_file_in_legacygl_header(filename, header_data, depth):
for x in lines:
x = x.strip()
- x = x[x.rfind(" ") + 1:]
+ x = x[x.rfind(" ") + 1 :]
if x.find("[") != -1:
# unfiorm array
- x = x[:x.find("[")]
+ x = x[: x.find("[")]
if not x in header_data.uniforms:
header_data.uniforms += [x]
@@ -150,7 +149,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
uline = uline.replace("attribute ", "")
uline = uline.replace("highp ", "")
uline = uline.replace(";", "")
- uline = uline[uline.find(" "):].strip()
+ uline = uline[uline.find(" ") :].strip()
if uline.find("//") != -1:
name, bind = uline.split("//")
@@ -163,7 +162,7 @@ def include_file_in_legacygl_header(filename, header_data, depth):
uline = line.replace("out ", "")
uline = uline.replace("highp ", "")
uline = uline.replace(";", "")
- uline = uline[uline.find(" "):].strip()
+ uline = uline[uline.find(" ") :].strip()
if uline.find("//") != -1:
name, bind = uline.split("//")
@@ -200,17 +199,19 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
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:]
+ out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
+ out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
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")
- out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix
+ out_file_class = (
+ out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix
+ )
fd.write("\n\n")
- fd.write("#include \"" + include + "\"\n\n\n")
+ fd.write('#include "' + include + '"\n\n\n')
fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n")
- fd.write("\t virtual String get_shader_name() const { return \"" + out_file_class + "\"; }\n")
+ fd.write('\t virtual String get_shader_name() const { return "' + out_file_class + '"; }\n')
fd.write("public:\n\n")
@@ -228,29 +229,64 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
if header_data.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_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n"
+ )
fd.write("\t#ifdef DEBUG_ENABLED\n ")
- fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; if (!is_version_valid()) return; ERR_FAIL_COND( get_active()!=this ); \n\n ")
+ fd.write(
+ "\t#define _FU if (get_uniform(p_uniform)<0) return; if (!is_version_valid()) return; ERR_FAIL_COND( get_active()!=this ); \n\n "
+ )
fd.write("\t#else\n ")
fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; \n\n ")
fd.write("\t#endif\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, 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 Size2i& p_vec2) { _FU GLint vec2[2]={p_vec2.x,p_vec2.y}; glUniform2iv(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, 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
+ 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, 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 Size2i& p_vec2) { _FU GLint vec2[2]={p_vec2.x,p_vec2.y}; glUniform2iv(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, 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;
@@ -276,9 +312,11 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}
- """)
+ """
+ )
- fd.write("""_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;
@@ -304,9 +342,11 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}
- """)
+ """
+ )
- fd.write("""_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];
@@ -320,7 +360,8 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
}
- """)
+ """
+ )
fd.write("\n\n#undef _FU\n\n\n")
@@ -340,21 +381,25 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
x = header_data.enums[xv]
bits = 1
amt = len(x)
- while (2 ** bits < amt):
+ while 2 ** bits < amt:
bits += 1
strs = "{"
for i in range(amt):
- strs += "\"#define " + x[i] + "\\n\","
+ strs += '"#define ' + x[i] + '\\n",'
c = {}
c["set_mask"] = "uint64_t(" + str(i) + ")<<" + str(bitofs)
- c["clear_mask"] = "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")"
+ c["clear_mask"] = (
+ "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")"
+ )
enum_vals.append(c)
enum_constants.append(x[i])
strs += "NULL}"
- fd.write("\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n")
+ fd.write(
+ "\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n"
+ )
bitofs += bits
fd.write("\t\t};\n\n")
@@ -373,7 +418,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write("\t\tstatic const char* _conditional_strings[]={\n")
if header_data.conditionals:
for x in header_data.conditionals:
- fd.write("\t\t\t\"#define " + x + "\\n\",\n")
+ fd.write('\t\t\t"#define ' + x + '\\n",\n')
conditionals_found.append(x)
fd.write("\t\t};\n\n")
else:
@@ -384,7 +429,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write("\t\tstatic const char* _uniform_strings[]={\n")
if header_data.uniforms:
for x in header_data.uniforms:
- fd.write("\t\t\t\"" + x + "\",\n")
+ fd.write('\t\t\t"' + x + '",\n')
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
@@ -394,7 +439,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
for x in header_data.attributes:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ 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")
@@ -408,9 +453,9 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
name = x[0]
cond = x[1]
if cond in conditionals_found:
- fd.write("\t\t\t{\"" + name + "\"," + str(conditionals_found.index(cond)) + "},\n")
+ fd.write('\t\t\t{"' + name + '",' + str(conditionals_found.index(cond)) + "},\n")
else:
- fd.write("\t\t\t{\"" + name + "\",-1},\n")
+ fd.write('\t\t\t{"' + name + '",-1},\n')
feedback_count += 1
@@ -424,7 +469,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if header_data.texunits:
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
for x in header_data.texunits:
- fd.write("\t\t\t{\"" + x[0] + "\"," + x[1] + "},\n")
+ 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")
@@ -432,7 +477,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if not gles2 and 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\t{"' + x[0] + '",' + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
if gles2:
@@ -445,7 +490,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
for c in x:
fd.write(str(ord(c)) + ",")
- fd.write(str(ord('\n')) + ",")
+ fd.write(str(ord("\n")) + ",")
fd.write("\t\t0};\n\n")
fd.write("\t\tstatic const int _vertex_code_start=" + str(header_data.vertex_offset) + ";\n")
@@ -455,28 +500,73 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
for c in x:
fd.write(str(ord(c)) + ",")
- fd.write(str(ord('\n')) + ",")
+ fd.write(str(ord("\n")) + ",")
fd.write("\t\t0};\n\n")
fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
if output_attribs:
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")
+ 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")
+ 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:
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")
+ 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\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")
@@ -495,12 +585,12 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
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)
-
+ build_legacygl_header(
+ str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True
+ )
class RDHeaderStruct:
-
def __init__(self):
self.vertex_lines = []
self.fragment_lines = []
@@ -594,30 +684,30 @@ def build_rd_header(filename):
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:]
+ out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
+ out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
out_file_ifdef = out_file_base.replace(".", "_").upper()
fd.write("#ifndef " + out_file_ifdef + "_RD\n")
fd.write("#define " + out_file_ifdef + "_RD\n")
out_file_class = out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "ShaderRD"
fd.write("\n")
- fd.write("#include \"servers/rendering/rasterizer_rd/shader_rd.h\"\n\n")
+ fd.write('#include "servers/rendering/rasterizer_rd/shader_rd.h"\n\n')
fd.write("class " + out_file_class + " : public ShaderRD {\n\n")
fd.write("public:\n\n")
fd.write("\t" + out_file_class + "() {\n\n")
- if (len(header_data.compute_lines)):
+ if len(header_data.compute_lines):
fd.write("\t\tstatic const char _compute_code[] = {\n")
for x in header_data.compute_lines:
for c in x:
fd.write(str(ord(c)) + ",")
- fd.write(str(ord('\n')) + ",")
+ fd.write(str(ord("\n")) + ",")
fd.write("\t\t0};\n\n")
- fd.write("\t\tsetup(nullptr, nullptr, _compute_code, \"" + out_file_class + "\");\n")
+ fd.write('\t\tsetup(nullptr, nullptr, _compute_code, "' + out_file_class + '");\n')
fd.write("\t}\n")
else:
@@ -626,17 +716,17 @@ def build_rd_header(filename):
for x in header_data.vertex_lines:
for c in x:
fd.write(str(ord(c)) + ",")
- fd.write(str(ord('\n')) + ",")
+ fd.write(str(ord("\n")) + ",")
fd.write("\t\t0};\n\n")
-
+
fd.write("\t\tstatic const char _fragment_code[]={\n")
for x in header_data.fragment_lines:
for c in x:
fd.write(str(ord(c)) + ",")
- fd.write(str(ord('\n')) + ",")
+ fd.write(str(ord("\n")) + ",")
fd.write("\t\t0};\n\n")
- fd.write("\t\tsetup(_vertex_code, _fragment_code, nullptr, \"" + out_file_class + "\");\n")
+ fd.write('\t\tsetup(_vertex_code, _fragment_code, nullptr, "' + out_file_class + '");\n')
fd.write("\t}\n")
fd.write("};\n\n")
@@ -650,5 +740,5 @@ def build_rd_headers(target, source, env):
build_rd_header(str(x))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/main/SCsub b/main/SCsub
index 0262701d79..7a301b82bc 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
from platform_methods import run_in_subprocess
import main_builders
@@ -14,13 +14,15 @@ env.Depends("#main/splash.gen.h", "#main/splash.png")
env.CommandNoCache("#main/splash.gen.h", "#main/splash.png", run_in_subprocess(main_builders.make_splash))
env.Depends("#main/splash_editor.gen.h", "#main/splash_editor.png")
-env.CommandNoCache("#main/splash_editor.gen.h", "#main/splash_editor.png", run_in_subprocess(main_builders.make_splash_editor))
+env.CommandNoCache(
+ "#main/splash_editor.gen.h", "#main/splash_editor.png", run_in_subprocess(main_builders.make_splash_editor)
+)
env.Depends("#main/app_icon.gen.h", "#main/app_icon.png")
env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", run_in_subprocess(main_builders.make_app_icon))
if env["tools"]:
- SConscript('tests/SCsub')
+ SConscript("tests/SCsub")
lib = env.add_library("main", env.main_sources)
env.Prepend(LIBS=[lib])
diff --git a/main/main.cpp b/main/main.cpp
index 89c8832731..2a525dbe5a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -87,29 +87,29 @@
// Singletons
// Initialized in setup()
-static Engine *engine = NULL;
-static ProjectSettings *globals = NULL;
-static InputFilter *input = NULL;
-static InputMap *input_map = NULL;
-static TranslationServer *translation_server = NULL;
-static Performance *performance = NULL;
-static PackedData *packed_data = NULL;
+static Engine *engine = nullptr;
+static ProjectSettings *globals = nullptr;
+static InputFilter *input = nullptr;
+static InputMap *input_map = nullptr;
+static TranslationServer *translation_server = nullptr;
+static Performance *performance = nullptr;
+static PackedData *packed_data = nullptr;
#ifdef MINIZIP_ENABLED
-static ZipArchive *zip_packed_data = NULL;
+static ZipArchive *zip_packed_data = nullptr;
#endif
-static FileAccessNetworkClient *file_access_network_client = NULL;
-static MessageQueue *message_queue = NULL;
+static FileAccessNetworkClient *file_access_network_client = nullptr;
+static MessageQueue *message_queue = nullptr;
// Initialized in setup2()
-static AudioServer *audio_server = NULL;
-static DisplayServer *display_server = NULL;
-static RenderingServer *rendering_server = NULL;
-static CameraServer *camera_server = NULL;
-static ARVRServer *arvr_server = NULL;
-static PhysicsServer3D *physics_server = NULL;
-static PhysicsServer2D *physics_2d_server = NULL;
-static NavigationServer3D *navigation_server = NULL;
-static NavigationServer2D *navigation_2d_server = NULL;
+static AudioServer *audio_server = nullptr;
+static DisplayServer *display_server = nullptr;
+static RenderingServer *rendering_server = nullptr;
+static CameraServer *camera_server = nullptr;
+static ARVRServer *arvr_server = nullptr;
+static PhysicsServer3D *physics_server = nullptr;
+static PhysicsServer2D *physics_2d_server = nullptr;
+static NavigationServer3D *navigation_server = nullptr;
+static NavigationServer2D *navigation_2d_server = nullptr;
// We error out if setup2() doesn't turn this true
static bool _start_success = false;
@@ -220,7 +220,7 @@ void finalize_display() {
}
void initialize_navigation_server() {
- ERR_FAIL_COND(navigation_server != NULL);
+ ERR_FAIL_COND(navigation_server != nullptr);
navigation_server = NavigationServer3DManager::new_default_server();
navigation_2d_server = memnew(NavigationServer2D);
@@ -228,10 +228,10 @@ void initialize_navigation_server() {
void finalize_navigation_server() {
memdelete(navigation_server);
- navigation_server = NULL;
+ navigation_server = nullptr;
memdelete(navigation_2d_server);
- navigation_2d_server = NULL;
+ navigation_2d_server = nullptr;
}
//#define DEBUG_INIT
@@ -1642,7 +1642,7 @@ bool Main::start() {
game_path = GLOBAL_DEF("application/run/main_scene", "");
}
- MainLoop *main_loop = NULL;
+ MainLoop *main_loop = nullptr;
if (editor) {
main_loop = memnew(SceneTree);
};
@@ -1772,7 +1772,7 @@ bool Main::start() {
RES res = ResourceLoader::load(path);
ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + path);
- Node *n = NULL;
+ Node *n = nullptr;
if (res->is_class("PackedScene")) {
Ref<PackedScene> ps = res;
n = ps->instance();
@@ -1784,7 +1784,7 @@ bool Main::start() {
Object *obj = ClassDB::instance(ibt);
- ERR_CONTINUE_MSG(obj == NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
+ ERR_CONTINUE_MSG(obj == nullptr, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
n = Object::cast_to<Node>(obj);
n->set_script(script_res);
@@ -1811,7 +1811,7 @@ bool Main::start() {
}
#ifdef TOOLS_ENABLED
- EditorNode *editor_node = NULL;
+ EditorNode *editor_node = nullptr;
if (editor) {
editor_node = memnew(EditorNode);
sml->get_root()->add_child(editor_node);
@@ -1961,7 +1961,7 @@ bool Main::start() {
Crypto::load_default_certificates(GLOBAL_DEF("network/ssl/certificates", ""));
if (game_path != "") {
- Node *scene = NULL;
+ Node *scene = nullptr;
Ref<PackedScene> scenedata = ResourceLoader::load(local_game_path);
if (scenedata.is_valid())
scene = scenedata->instance();
diff --git a/main/main_builders.py b/main/main_builders.py
index aebac2b022..2ea774e3b4 100644
--- a/main/main_builders.py
+++ b/main/main_builders.py
@@ -18,7 +18,7 @@ def make_splash(target, source, env):
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(0.14, 0.14, 0.14);\n')
+ g.write("static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);\n")
g.write("static const unsigned char boot_splash_png[] = {\n")
for i in range(len(buf)):
g.write(str(buf[i]) + ",\n")
@@ -37,7 +37,7 @@ def make_splash_editor(target, source, env):
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(0.14, 0.14, 0.14);\n')
+ g.write("static const Color boot_splash_editor_bg_color = Color(0.14, 0.14, 0.14);\n")
g.write("static const unsigned char boot_splash_editor_png[] = {\n")
for i in range(len(buf)):
g.write(str(buf[i]) + ",\n")
@@ -63,5 +63,5 @@ def make_app_icon(target, source, env):
g.write("#endif")
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/main/performance.cpp b/main/performance.cpp
index 335407c9eb..3ca7d7bed8 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -39,7 +39,7 @@
#include "servers/physics_server_3d.h"
#include "servers/rendering_server.h"
-Performance *Performance::singleton = NULL;
+Performance *Performance::singleton = nullptr;
void Performance::_bind_methods() {
diff --git a/main/tests/SCsub b/main/tests/SCsub
index 437d9ed777..cb1d35b12f 100644
--- a/main/tests/SCsub
+++ b/main/tests/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/python
-Import('env')
+Import("env")
env.tests_sources = []
env.add_source_files(env.tests_sources, "*.cpp")
diff --git a/main/tests/test_astar.cpp b/main/tests/test_astar.cpp
index e82d885af2..e0b4a7f2c8 100644
--- a/main/tests/test_astar.cpp
+++ b/main/tests/test_astar.cpp
@@ -351,7 +351,7 @@ TestFunc test_funcs[] = {
test_abcx,
test_add_remove,
test_solutions,
- NULL
+ nullptr
};
MainLoop *test() {
@@ -370,7 +370,7 @@ MainLoop *test() {
}
OS::get_singleton()->print("\n");
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestAStar
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 0e7c45f603..971460c655 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -396,7 +396,7 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
}
}
-static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = NULL) {
+static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = nullptr) {
String txt;
if (p_func->_static)
@@ -947,17 +947,17 @@ MainLoop *test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
if (!test.ends_with(".gd") && !test.ends_with(".gdc")) {
print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test);
- return NULL;
+ return nullptr;
}
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
+ ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
Vector<uint8_t> buf;
int flen = fa->get_len();
@@ -1030,11 +1030,11 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error());
memdelete(fa);
- return NULL;
+ return nullptr;
}
const GDScriptParser::Node *root = parser.get_parse_tree();
- ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, NULL);
+ ERR_FAIL_COND_V(root->type != GDScriptParser::Node::TYPE_CLASS, nullptr);
const GDScriptParser::ClassNode *cnode = static_cast<const GDScriptParser::ClassNode *>(root);
_parser_show_class(cnode, 0, lines);
@@ -1048,7 +1048,7 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Parse Error:\n" + itos(parser.get_error_line()) + ":" + itos(parser.get_error_column()) + ":" + parser.get_error());
memdelete(fa);
- return NULL;
+ return nullptr;
}
Ref<GDScript> gds;
@@ -1059,7 +1059,7 @@ MainLoop *test(TestType p_type) {
if (err) {
print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error());
- return NULL;
+ return nullptr;
}
Ref<GDScript> current = gds;
@@ -1083,7 +1083,7 @@ MainLoop *test(TestType p_type) {
memdelete(fa);
- return NULL;
+ return nullptr;
}
} // namespace TestGDScript
@@ -1093,7 +1093,7 @@ namespace TestGDScript {
MainLoop *test(TestType p_type) {
ERR_PRINT("The GDScript module is disabled, therefore GDScript tests cannot be used.");
- return NULL;
+ return nullptr;
}
} // namespace TestGDScript
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index a9a671e2f1..922a55b88e 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -63,7 +63,7 @@ const char **tests_get_names() {
"gd_bytecode",
"ordered_hash_map",
"astar",
- NULL
+ nullptr
};
return test_names;
@@ -144,7 +144,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
}
print_line("Unknown test: " + p_test);
- return NULL;
+ return nullptr;
}
#else
@@ -152,7 +152,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
const char **tests_get_names() {
static const char *test_names[] = {
- NULL
+ nullptr
};
return test_names;
@@ -160,7 +160,7 @@ const char **tests_get_names() {
MainLoop *test_main(String p_test, const List<String> &p_args) {
- return NULL;
+ return nullptr;
}
#endif
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index 29fa5e73a7..38f7371802 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -475,18 +475,18 @@ MainLoop *test() {
if (cmdlargs.empty()) {
//try editor!
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
if (test == "math") {
// Not a file name but the test name, abort.
// FIXME: This test is ugly as heck, needs fixing :)
- return NULL;
+ return nullptr;
}
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
- ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
+ ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
Vector<uint8_t> buf;
int flen = fa->get_len();
@@ -580,7 +580,7 @@ MainLoop *test() {
List<String> args;
args.push_back("-l");
- Error err = OS::get_singleton()->execute("/bin/ls", args, true, NULL, &ret);
+ Error err = OS::get_singleton()->execute("/bin/ls", args, true, nullptr, &ret);
print_line("error: " + itos(err));
print_line(ret);
@@ -660,6 +660,6 @@ MainLoop *test() {
print_line("scalar /=: " + v);
}
- return NULL;
+ return nullptr;
}
} // namespace TestMath
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index ac53f124d2..cffec7fa77 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -152,6 +152,6 @@ MainLoop *test() {
map.set(5, 1);
}
- return NULL;
+ return nullptr;
}
} // namespace TestOAHashMap
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index a5553217e2..0720eebaf9 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -141,7 +141,7 @@ TestFunc test_funcs[] = {
test_size,
test_iteration,
test_const_iteration,
- 0
+ nullptr
};
@@ -168,6 +168,6 @@ MainLoop *test() {
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestOrderedHashMap
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index dd525d7653..1e85f7f1d2 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -310,7 +310,7 @@ MainLoop *test() {
if (cmdlargs.empty()) {
//try editor!
print_line("usage: godot -test shader_lang <shader>");
- return NULL;
+ return nullptr;
}
String test = cmdlargs.back()->get();
@@ -318,7 +318,7 @@ MainLoop *test() {
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
if (!fa) {
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
String code;
@@ -347,13 +347,13 @@ MainLoop *test() {
if (err) {
print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text());
- return NULL;
+ return nullptr;
} else {
String code2;
recreate_code(&code2, sl.get_shader());
print_line("code:\n\n" + code2);
}
- return NULL;
+ return nullptr;
}
} // namespace TestShaderLang
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 84731746fa..7438e2bae9 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -1071,7 +1071,7 @@ bool test_33() {
OS::get_singleton()->print("\n\nTest 33: parse_utf8(null, -1)\n");
String empty;
- return empty.parse_utf8(NULL, -1);
+ return empty.parse_utf8(nullptr, -1);
}
bool test_34() {
@@ -1164,7 +1164,7 @@ TestFunc test_funcs[] = {
test_33,
test_34,
test_35,
- 0
+ nullptr
};
@@ -1195,6 +1195,6 @@ MainLoop *test() {
OS::get_singleton()->print("Passed %i of %i tests\n", passed, count);
- return NULL;
+ return nullptr;
}
} // namespace TestString
diff --git a/methods.py b/methods.py
index dc82c97361..89a229e4ab 100644
--- a/methods.py
+++ b/methods.py
@@ -8,13 +8,13 @@ def add_source_files(self, sources, files, warn_duplicates=True):
# Convert string to list of absolute paths (including expanding wildcard)
if isinstance(files, (str, bytes)):
# Keep SCons project-absolute path as they are (no wildcard support)
- if files.startswith('#'):
- if '*' in files:
+ if files.startswith("#"):
+ if "*" in files:
print("ERROR: Wildcards can't be expanded in SCons project-absolute path: '{}'".format(files))
return
files = [files]
else:
- dir_path = self.Dir('.').abspath
+ dir_path = self.Dir(".").abspath
files = sorted(glob.glob(dir_path + "/" + files))
# Add each path as compiled Object following environment (self) configuration
@@ -22,7 +22,7 @@ def add_source_files(self, sources, files, warn_duplicates=True):
obj = self.Object(path)
if obj in sources:
if warn_duplicates:
- print("WARNING: Object \"{}\" already included in environment sources.".format(obj))
+ print('WARNING: Object "{}" already included in environment sources.'.format(obj))
else:
continue
sources.append(obj)
@@ -33,20 +33,20 @@ def disable_warnings(self):
if self.msvc:
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
- warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX']
- self.Append(CCFLAGS=['/w'])
- self.Append(CFLAGS=['/w'])
- self.Append(CXXFLAGS=['/w'])
- self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]
- self['CFLAGS'] = [x for x in self['CFLAGS'] if not x in warn_flags]
- self['CXXFLAGS'] = [x for x in self['CXXFLAGS'] if not x in warn_flags]
+ warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"]
+ self.Append(CCFLAGS=["/w"])
+ self.Append(CFLAGS=["/w"])
+ self.Append(CXXFLAGS=["/w"])
+ self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags]
+ self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags]
+ self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags]
else:
- self.Append(CCFLAGS=['-w'])
- self.Append(CFLAGS=['-w'])
- self.Append(CXXFLAGS=['-w'])
+ self.Append(CCFLAGS=["-w"])
+ self.Append(CFLAGS=["-w"])
+ self.Append(CXXFLAGS=["-w"])
-def add_module_version_string(self,s):
+def add_module_version_string(self, s):
self.module_version_string += "." + s
@@ -64,16 +64,16 @@ def update_version(module_version_string=""):
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
f.write("#ifndef VERSION_GENERATED_GEN_H\n")
f.write("#define VERSION_GENERATED_GEN_H\n")
- f.write("#define VERSION_SHORT_NAME \"" + str(version.short_name) + "\"\n")
- f.write("#define VERSION_NAME \"" + str(version.name) + "\"\n")
+ f.write('#define VERSION_SHORT_NAME "' + str(version.short_name) + '"\n')
+ f.write('#define VERSION_NAME "' + str(version.name) + '"\n')
f.write("#define VERSION_MAJOR " + str(version.major) + "\n")
f.write("#define VERSION_MINOR " + str(version.minor) + "\n")
f.write("#define VERSION_PATCH " + str(version.patch) + "\n")
- f.write("#define VERSION_STATUS \"" + str(version.status) + "\"\n")
- f.write("#define VERSION_BUILD \"" + str(build_name) + "\"\n")
- f.write("#define VERSION_MODULE_CONFIG \"" + str(version.module_config) + module_version_string + "\"\n")
+ f.write('#define VERSION_STATUS "' + str(version.status) + '"\n')
+ f.write('#define VERSION_BUILD "' + str(build_name) + '"\n')
+ f.write('#define VERSION_MODULE_CONFIG "' + str(version.module_config) + module_version_string + '"\n')
f.write("#define VERSION_YEAR " + str(version.year) + "\n")
- f.write("#define VERSION_WEBSITE \"" + str(version.website) + "\"\n")
+ f.write('#define VERSION_WEBSITE "' + str(version.website) + '"\n')
f.write("#endif // VERSION_GENERATED_GEN_H\n")
f.close()
@@ -99,7 +99,7 @@ def update_version(module_version_string=""):
else:
githash = head
- fhash.write("#define VERSION_HASH \"" + githash + "\"\n")
+ fhash.write('#define VERSION_HASH "' + githash + '"\n')
fhash.write("#endif // VERSION_HASH_GEN_H\n")
fhash.close()
@@ -158,17 +158,17 @@ def detect_modules():
try:
with open("modules/" + x + "/register_types.h"):
includes_cpp += '#include "modules/' + x + '/register_types.h"\n'
- register_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n'
- register_cpp += '\tregister_' + x + '_types();\n'
- register_cpp += '#endif\n'
- preregister_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n'
- preregister_cpp += '#ifdef MODULE_' + x.upper() + '_HAS_PREREGISTER\n'
- preregister_cpp += '\tpreregister_' + x + '_types();\n'
- preregister_cpp += '#endif\n'
- preregister_cpp += '#endif\n'
- unregister_cpp += '#ifdef MODULE_' + x.upper() + '_ENABLED\n'
- unregister_cpp += '\tunregister_' + x + '_types();\n'
- unregister_cpp += '#endif\n'
+ register_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n"
+ register_cpp += "\tregister_" + x + "_types();\n"
+ register_cpp += "#endif\n"
+ preregister_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n"
+ preregister_cpp += "#ifdef MODULE_" + x.upper() + "_HAS_PREREGISTER\n"
+ preregister_cpp += "\tpreregister_" + x + "_types();\n"
+ preregister_cpp += "#endif\n"
+ preregister_cpp += "#endif\n"
+ unregister_cpp += "#ifdef MODULE_" + x.upper() + "_ENABLED\n"
+ unregister_cpp += "\tunregister_" + x + "_types();\n"
+ unregister_cpp += "#endif\n"
except IOError:
pass
@@ -191,7 +191,12 @@ void register_module_types() {
void unregister_module_types() {
%s
}
-""" % (includes_cpp, preregister_cpp, register_cpp, unregister_cpp)
+""" % (
+ includes_cpp,
+ preregister_cpp,
+ register_cpp,
+ unregister_cpp,
+ )
# NOTE: It is safe to generate this file here, since this is still executed serially
with open("modules/register_module_types.gen.cpp", "w") as f:
@@ -206,7 +211,7 @@ def disable_module(self):
def use_windows_spawn_fix(self, platform=None):
- if (os.name != "nt"):
+ if os.name != "nt":
return # not needed, only for windows
# On Windows, due to the limited command line length, when creating a static library
@@ -217,14 +222,21 @@ def use_windows_spawn_fix(self, platform=None):
# got built correctly regardless the invocation strategy.
# Furthermore, since SCons will rebuild the library from scratch when an object file
# changes, no multiple versions of the same object file will be present.
- self.Replace(ARFLAGS='q')
+ self.Replace(ARFLAGS="q")
def mySubProcess(cmdline, env):
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
+ proc = subprocess.Popen(
+ cmdline,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ startupinfo=startupinfo,
+ shell=False,
+ env=env,
+ )
_, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -235,7 +247,7 @@ def use_windows_spawn_fix(self, platform=None):
def mySpawn(sh, escape, cmd, args, env):
- newargs = ' '.join(args[1:])
+ newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs
rv = 0
@@ -251,15 +263,15 @@ def use_windows_spawn_fix(self, platform=None):
return rv
- self['SPAWN'] = mySpawn
+ self["SPAWN"] = mySpawn
def save_active_platforms(apnames, ap):
for x in ap:
- names = ['logo']
+ names = ["logo"]
if os.path.isfile(x + "/run_icon.png"):
- names.append('run_icon')
+ names.append("run_icon")
for name in names:
pngf = open(x + "/" + name + ".png", "rb")
@@ -269,7 +281,7 @@ def save_active_platforms(apnames, ap):
while len(b) == 1:
str += hex(ord(b))
b = pngf.read(1)
- if (len(b) == 1):
+ if len(b) == 1:
str += ","
str += "};\n"
@@ -289,30 +301,46 @@ def no_verbose(sys, env):
# Colors are disabled in non-TTY environments such as pipes. This means
# that if output is redirected to a file, it will not contain color codes
if sys.stdout.isatty():
- colors['cyan'] = '\033[96m'
- colors['purple'] = '\033[95m'
- colors['blue'] = '\033[94m'
- colors['green'] = '\033[92m'
- colors['yellow'] = '\033[93m'
- colors['red'] = '\033[91m'
- colors['end'] = '\033[0m'
+ colors["cyan"] = "\033[96m"
+ colors["purple"] = "\033[95m"
+ colors["blue"] = "\033[94m"
+ colors["green"] = "\033[92m"
+ colors["yellow"] = "\033[93m"
+ colors["red"] = "\033[91m"
+ colors["end"] = "\033[0m"
else:
- colors['cyan'] = ''
- colors['purple'] = ''
- colors['blue'] = ''
- colors['green'] = ''
- colors['yellow'] = ''
- colors['red'] = ''
- colors['end'] = ''
-
- compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end'])
- java_compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end'])
- compile_shared_source_message = '%sCompiling shared %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end'])
- link_program_message = '%sLinking Program %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end'])
- link_library_message = '%sLinking Static Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end'])
- ranlib_library_message = '%sRanlib Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end'])
- link_shared_library_message = '%sLinking Shared Library %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end'])
- java_library_message = '%sCreating Java Archive %s==> %s$TARGET%s' % (colors['red'], colors['purple'], colors['yellow'], colors['end'])
+ colors["cyan"] = ""
+ colors["purple"] = ""
+ colors["blue"] = ""
+ colors["green"] = ""
+ colors["yellow"] = ""
+ colors["red"] = ""
+ colors["end"] = ""
+
+ compile_source_message = "{}Compiling {}==> {}$SOURCE{}".format(
+ colors["blue"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ java_compile_source_message = "{}Compiling {}==> {}$SOURCE{}".format(
+ colors["blue"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ compile_shared_source_message = "{}Compiling shared {}==> {}$SOURCE{}".format(
+ colors["blue"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ link_program_message = "{}Linking Program {}==> {}$TARGET{}".format(
+ colors["red"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ link_library_message = "{}Linking Static Library {}==> {}$TARGET{}".format(
+ colors["red"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ ranlib_library_message = "{}Ranlib Library {}==> {}$TARGET{}".format(
+ colors["red"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ link_shared_library_message = "{}Linking Shared Library {}==> {}$TARGET{}".format(
+ colors["red"], colors["purple"], colors["yellow"], colors["end"]
+ )
+ java_library_message = "{}Creating Java Archive {}==> {}$TARGET{}".format(
+ colors["red"], colors["purple"], colors["yellow"], colors["end"]
+ )
env.Append(CXXCOMSTR=[compile_source_message])
env.Append(CCCOMSTR=[compile_source_message])
@@ -353,70 +381,79 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_str = ""
# Start with Pre VS 2017 checks which uses VCINSTALLDIR:
- if 'VCINSTALLDIR' in tools_env:
+ if "VCINSTALLDIR" in tools_env:
# print("Checking VCINSTALLDIR")
# find() works with -1 so big ifs below are needed... the simplest solution, in fact
# First test if amd64 and amd64_x86 compilers are present in the path
vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
- if(vc_amd64_compiler_detection_index > -1):
+ if vc_amd64_compiler_detection_index > -1:
vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_str = "amd64"
vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ if vc_amd64_x86_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
vc_chosen_compiler_str = "amd64_x86"
# Now check the 32 bit compilers
vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ if vc_x86_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_x86_compiler_detection_index
vc_chosen_compiler_str = "x86"
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\x86_amd64;")
+ if vc_x86_amd64_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
# and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
- if 'VCTOOLSINSTALLDIR' in tools_env:
+ if "VCTOOLSINSTALLDIR" in tools_env:
# Newer versions have a different path available
- vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
- if(vc_amd64_compiler_detection_index > -1):
+ vc_amd64_compiler_detection_index = (
+ tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X64;")
+ )
+ if vc_amd64_compiler_detection_index > -1:
vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_str = "amd64"
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_amd64_x86_compiler_detection_index = (
+ tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX64\\X86;")
+ )
+ if vc_amd64_x86_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
vc_chosen_compiler_str = "amd64_x86"
- vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_x86_compiler_detection_index = (
+ tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX86\\X86;")
+ )
+ if vc_x86_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_x86_compiler_detection_index
vc_chosen_compiler_str = "x86"
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_x86_amd64_compiler_detection_index = (
+ tools_env["PATH"].upper().find(tools_env["VCTOOLSINSTALLDIR"].upper() + "BIN\\HOSTX86\\X64;")
+ )
+ if vc_x86_amd64_compiler_detection_index > -1 and (
+ vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index
+ ):
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
return vc_chosen_compiler_str
+
def find_visual_c_batch_file(env):
from SCons.Tool.MSCommon.vc import get_default_version, get_host_target, find_batch_file
@@ -424,6 +461,7 @@ def find_visual_c_batch_file(env):
(host_platform, target_platform, _) = get_host_target(env)
return find_batch_file(env, version, host_platform, target_platform)[0]
+
def generate_cpp_hint_file(filename):
if os.path.isfile(filename):
# Don't overwrite an existing hint file since the user may have customized it.
@@ -435,15 +473,19 @@ def generate_cpp_hint_file(filename):
except IOError:
print("Could not write cpp.hint file.")
+
def generate_vs_project(env, num_jobs):
batch_file = find_visual_c_batch_file(env)
if batch_file:
+
def build_commandline(commands):
- common_build_prefix = ['cmd /V /C set "plat=$(PlatformTarget)"',
- '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))',
- 'set "tools=yes"',
- '(if "$(Configuration)"=="release" (set "tools=no"))',
- 'call "' + batch_file + '" !plat!']
+ common_build_prefix = [
+ 'cmd /V /C set "plat=$(PlatformTarget)"',
+ '(if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64"))',
+ 'set "tools=yes"',
+ '(if "$(Configuration)"=="release" (set "tools=no"))',
+ 'call "' + batch_file + '" !plat!',
+ ]
result = " ^& ".join(common_build_prefix + [commands])
return result
@@ -459,87 +501,104 @@ def generate_vs_project(env, num_jobs):
# to double quote off the directory. However, the path ends
# in a backslash, so we need to remove this, lest it escape the
# last double quote off, confusing MSBuild
- env['MSVSBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs))
- env['MSVSREBUILDCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" platform=windows progress=no target=$(Configuration) tools=!tools! vsproj=yes -j' + str(num_jobs))
- env['MSVSCLEANCOM'] = build_commandline('scons --directory="$(ProjectDir.TrimEnd(\'\\\'))" --clean platform=windows progress=no target=$(Configuration) tools=!tools! -j' + str(num_jobs))
+ env["MSVSBUILDCOM"] = build_commandline(
+ "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" platform=windows progress=no target=$(Configuration) tools=!tools! -j"
+ + str(num_jobs)
+ )
+ env["MSVSREBUILDCOM"] = build_commandline(
+ "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" platform=windows progress=no target=$(Configuration) tools=!tools! vsproj=yes -j"
+ + str(num_jobs)
+ )
+ env["MSVSCLEANCOM"] = build_commandline(
+ "scons --directory=\"$(ProjectDir.TrimEnd('\\'))\" --clean platform=windows progress=no target=$(Configuration) tools=!tools! -j"
+ + str(num_jobs)
+ )
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
# required for Visual Studio to understand that it needs to generate an NMAKE
# project. Do not modify without knowing what you are doing.
- debug_variants = ['debug|Win32'] + ['debug|x64']
- release_variants = ['release|Win32'] + ['release|x64']
- release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64']
+ debug_variants = ["debug|Win32"] + ["debug|x64"]
+ release_variants = ["release|Win32"] + ["release|x64"]
+ release_debug_variants = ["release_debug|Win32"] + ["release_debug|x64"]
variants = debug_variants + release_variants + release_debug_variants
- debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe']
- release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
- release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
+ debug_targets = ["bin\\godot.windows.tools.32.exe"] + ["bin\\godot.windows.tools.64.exe"]
+ release_targets = ["bin\\godot.windows.opt.32.exe"] + ["bin\\godot.windows.opt.64.exe"]
+ release_debug_targets = ["bin\\godot.windows.opt.tools.32.exe"] + ["bin\\godot.windows.opt.tools.64.exe"]
targets = debug_targets + release_targets + release_debug_targets
- if not env.get('MSVS'):
- env['MSVS']['PROJECTSUFFIX'] = '.vcxproj'
- env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
+ if not env.get("MSVS"):
+ env["MSVS"]["PROJECTSUFFIX"] = ".vcxproj"
+ env["MSVS"]["SOLUTIONSUFFIX"] = ".sln"
env.MSVSProject(
- target=['#godot' + env['MSVSPROJECTSUFFIX']],
+ target=["#godot" + env["MSVSPROJECTSUFFIX"]],
incs=env.vs_incs,
srcs=env.vs_srcs,
runfile=targets,
buildtarget=targets,
auto_build_solution=1,
- variant=variants)
+ variant=variants,
+ )
else:
- print("Could not locate Visual Studio batch file for setting up the build environment. Not generating VS project.")
+ print("Could not locate Visual Studio batch file to set up the build environment. Not generating VS project.")
+
def precious_program(env, program, sources, **args):
program = env.ProgramOriginal(program, sources, **args)
env.Precious(program)
return program
+
def add_shared_library(env, name, sources, **args):
library = env.SharedLibrary(name, sources, **args)
env.NoCache(library)
return library
+
def add_library(env, name, sources, **args):
library = env.Library(name, sources, **args)
env.NoCache(library)
return library
+
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
+
def detect_darwin_sdk_path(platform, env):
- sdk_name = ''
- if platform == 'osx':
- sdk_name = 'macosx'
- var_name = 'MACOS_SDK_PATH'
- elif platform == 'iphone':
- sdk_name = 'iphoneos'
- var_name = 'IPHONESDK'
- elif platform == 'iphonesimulator':
- sdk_name = 'iphonesimulator'
- var_name = 'IPHONESDK'
+ sdk_name = ""
+ if platform == "osx":
+ sdk_name = "macosx"
+ var_name = "MACOS_SDK_PATH"
+ elif platform == "iphone":
+ sdk_name = "iphoneos"
+ var_name = "IPHONESDK"
+ elif platform == "iphonesimulator":
+ sdk_name = "iphonesimulator"
+ var_name = "IPHONESDK"
else:
raise Exception("Invalid platform argument passed to detect_darwin_sdk_path")
if not env[var_name]:
try:
- sdk_path = subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip().decode("utf-8")
+ sdk_path = subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip().decode("utf-8")
if sdk_path:
env[var_name] = sdk_path
except (subprocess.CalledProcessError, OSError):
print("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
raise
+
def is_vanilla_clang(env):
if not using_clang(env):
return False
- version = subprocess.check_output([env['CXX'], '--version']).strip().decode("utf-8")
+ version = subprocess.check_output([env["CXX"], "--version"]).strip().decode("utf-8")
return not version.startswith("Apple")
@@ -552,20 +611,22 @@ def get_compiler_version(env):
# Not using -dumpversion as some GCC distros only return major, and
# Clang used to return hardcoded 4.2.1: # https://reviews.llvm.org/D56803
try:
- version = subprocess.check_output([env.subst(env['CXX']), '--version']).strip().decode("utf-8")
+ version = subprocess.check_output([env.subst(env["CXX"]), "--version"]).strip().decode("utf-8")
except (subprocess.CalledProcessError, OSError):
print("Couldn't parse CXX environment variable to infer compiler version.")
return None
else: # TODO: Implement for MSVC
return None
- match = re.search('[0-9]+\.[0-9.]+', version)
+ match = re.search("[0-9]+\.[0-9.]+", version)
if match is not None:
- return list(map(int, match.group().split('.')))
+ return list(map(int, match.group().split(".")))
else:
return None
+
def using_gcc(env):
- return 'gcc' in os.path.basename(env["CC"])
+ return "gcc" in os.path.basename(env["CC"])
+
def using_clang(env):
- return 'clang' in os.path.basename(env["CC"])
+ return "clang" in os.path.basename(env["CC"])
diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
index 0b8a508d2f..4b2870b67a 100644
--- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
+++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj
@@ -50,10 +50,10 @@
1FF4C1841F584E3F00A41E41 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
1FF4C1861F584E5600A41E41 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
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>"; };
+ 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>"; };
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; };
+ 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; };
D0BCFE3918AEBDA2004A7AAE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
E360193621F32F37009258C1 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
@@ -62,7 +62,7 @@
D0BCFE3F18AEBDA2004A7AAE /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; };
D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = $binary.pck; sourceTree = "<group>"; };
+ D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = "$binary.pck"; sourceTree = "<group>"; };
/* End PBXFileReference section */
$additional_pbx_files
@@ -155,7 +155,7 @@
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */,
1FF8DBB01FBA9DE1009DE660 /* dummy.cpp */,
);
- path = $binary;
+ path = "$binary";
sourceTree = "<group>";
};
D0BCFE4218AEBDA2004A7AAE /* Supporting Files */ = {
@@ -422,7 +422,7 @@
ARCHS = "$godot_archs";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
- CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
+ CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
@@ -448,7 +448,7 @@
ARCHS = "$godot_archs";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
- CODE_SIGN_ENTITLEMENTS = $binary/$binary.entitlements;
+ CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
CODE_SIGN_IDENTITY = "$code_sign_identity_release";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)";
diff --git a/misc/hooks/README.md b/misc/hooks/README.md
index b18ba7df38..5661c239ed 100644
--- a/misc/hooks/README.md
+++ b/misc/hooks/README.md
@@ -5,16 +5,33 @@ contributors to make sure they comply with our requirements.
## List of hooks
-- Pre-commit hook for clang-format: Applies clang-format to the staged files
- before accepting a commit; blocks the commit and generates a patch if the
- style is not respected.
- Should work on Linux and macOS. You may need to edit the file if your
- clang-format binary is not in the `$PATH`, or if you want to enable colored
- output with pygmentize.
-- Pre-commit hook for makerst: Checks the class reference syntax using `makerst.py`.
- Should work on Linux and macOS.
+- Pre-commit hook for `clang-format`: Applies `clang-format` to the staged
+ files before accepting a commit; blocks the commit and generates a patch if
+ the style is not respected.
+ You may need to edit the file if your `clang-format` binary is not in the
+ `PATH`, or if you want to enable colored output with `pygmentize`.
+- Pre-commit hook for `black`: Applies `black` to the staged Python files
+ before accepting a commit.
+- Pre-commit hook for `makerst`: Checks the class reference syntax using
+ `makerst.py`.
## Installation
-Copy all the files from this folder into your `.git/hooks` folder, and make sure
-the hooks and helper scripts are executable.
+Copy all the files from this folder into your `.git/hooks` folder, and make
+sure the hooks and helper scripts are executable.
+
+#### Linux/MacOS
+
+The hooks rely on bash scripts and tools which should be in the system `PATH`,
+so they should work out of the box on Linux/macOS.
+
+#### Windows
+
+##### clang-format
+- Download LLVM for Windows (version 8 or later) from
+ <https://releases.llvm.org/download.html>
+- Make sure LLVM is added to the `PATH` during installation
+
+##### black
+- Python installation: make sure Python is added to the `PATH`
+- Install `black` - in any console: `pip3 install black`
diff --git a/misc/hooks/pre-commit b/misc/hooks/pre-commit
index 36e9935785..40cb00253b 100755
--- a/misc/hooks/pre-commit
+++ b/misc/hooks/pre-commit
@@ -14,7 +14,7 @@
# as this script. Hooks should return 0 if successful and nonzero to cancel the
# commit. They are executed in the order in which they are listed.
#HOOKS="pre-commit-compile pre-commit-uncrustify"
-HOOKS="pre-commit-clang-format pre-commit-makerst"
+HOOKS="pre-commit-clang-format pre-commit-black pre-commit-makerst"
###########################################################
# There should be no need to change anything below this line.
diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black
new file mode 100755
index 0000000000..2dcc2e8cf1
--- /dev/null
+++ b/misc/hooks/pre-commit-black
@@ -0,0 +1,132 @@
+#!/usr/bin/env bash
+
+# git pre-commit hook that runs a black stylecheck.
+# Based on pre-commit-clang-format.
+
+##################################################################
+# SETTINGS
+# Set path to black binary.
+BLACK=`which black`
+BLACK_OPTIONS="-l 120"
+
+# Remove any older patches from previous commits. Set to true or false.
+DELETE_OLD_PATCHES=false
+
+# File types to parse.
+FILE_NAMES="SConstruct SCsub"
+FILE_EXTS="py"
+
+# Use pygmentize instead of cat to parse diff with highlighting.
+# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
+PYGMENTIZE=`which pygmentize`
+if [ ! -z "$PYGMENTIZE" ]; then
+ READER="pygmentize -l diff"
+else
+ READER=cat
+fi
+
+##################################################################
+# There should be no need to change anything below this line.
+
+. "$(dirname -- "$0")/canonicalize_filename.sh"
+
+# exit on error
+set -e
+
+# check whether the given file matches any of the set extensions
+matches_name_or_extension() {
+ local filename=$(basename "$1")
+ local extension=".${filename##*.}"
+
+ for name in $FILE_NAMES; do [[ "$name" == "$filename" ]] && return 0; done
+ for ext in $FILE_EXTS; do [[ "$ext" == "$extension" ]] && return 0; done
+
+ return 1
+}
+
+# necessary check for initial commit
+if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+if [ ! -x "$BLACK" ] ; then
+ printf "Error: black executable not found.\n"
+ printf "Set the correct path in $(canonicalize_filename "$0").\n"
+ exit 1
+fi
+
+# create a random filename to store our generated patch
+prefix="pre-commit-black"
+suffix="$(date +%s)"
+patch="/tmp/$prefix-$suffix.patch"
+
+# clean up any older black patches
+$DELETE_OLD_PATCHES && rm -f /tmp/$prefix*.patch
+
+# create one patch containing all changes to the files
+git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file;
+do
+ # ignore thirdparty files
+ if grep -q "thirdparty" <<< $file; then
+ continue;
+ fi
+
+ # ignore file if not one of the names or extensions we handle
+ if ! matches_name_or_extension "$file"; then
+ continue;
+ fi
+
+ # format our file with black, create a patch with diff and append it to our $patch
+ # The sed call is necessary to transform the patch from
+ # --- $file timestamp
+ # +++ $file timestamp
+ # to both lines working on the same file and having a/ and b/ prefix.
+ # Else it can not be applied with 'git apply'.
+ "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \
+ sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch"
+done
+
+# if no patch has been generated all is ok, clean up the file stub and exit
+if [ ! -s "$patch" ] ; then
+ printf "Files in this commit comply with the black formatter rules.\n"
+ rm -f "$patch"
+ exit 0
+fi
+
+# a patch has been created, notify the user and exit
+printf "\nThe following differences were found between the code to commit "
+printf "and the black formatter rules:\n\n"
+$READER "$patch"
+printf "\n"
+
+# Allows us to read user input below, assigns stdin to keyboard
+exec < /dev/tty
+
+while true; do
+ read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn
+ case $yn in
+ [Yy] ) git apply $patch;
+ printf "The patch was applied. You can now stage the changes and commit again.\n\n";
+ break
+ ;;
+ [Nn] ) printf "\nYou can apply these changes with:\n git apply $patch\n";
+ printf "(may need to be called from the root directory of your repository)\n";
+ printf "Aborting commit. Apply changes and commit again or skip checking with";
+ printf " --no-verify (not recommended).\n\n";
+ break
+ ;;
+ [Ss] ) git apply $patch;
+ git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file;
+ do git add $file;
+ done
+ printf "The patch was applied and the changed files staged. You can now commit.\n\n";
+ break
+ ;;
+ * ) echo "Please answer yes or no."
+ ;;
+ esac
+done
+exit 1 # we don't commit in any case
diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format
index e309233a8b..c5cf4ecbb1 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -15,28 +15,28 @@
##################################################################
# SETTINGS
-# Set path to clang-format binary
-# CLANG_FORMAT="/usr/bin/clang-format"
+# Set path to clang-format binary.
CLANG_FORMAT=`which clang-format`
# Remove any older patches from previous commits. Set to true or false.
-# DELETE_OLD_PATCHES=false
DELETE_OLD_PATCHES=false
# Only parse files with the extensions in FILE_EXTS. Set to true or false.
# If false every changed file in the commit will be parsed with clang-format.
# If true only files matching one of the extensions are parsed with clang-format.
-# PARSE_EXTS=true
PARSE_EXTS=true
# File types to parse. Only effective when PARSE_EXTS is true.
-# FILE_EXTS=".c .h .cpp .hpp"
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl"
# Use pygmentize instead of cat to parse diff with highlighting.
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
-# READER="pygmentize -l diff"
-READER=cat
+PYGMENTIZE=`which pygmentize`
+if [ ! -z "$PYGMENTIZE" ]; then
+ READER="pygmentize -l diff"
+else
+ READER=cat
+fi
##################################################################
# There should be no need to change anything below this line.
diff --git a/misc/hooks/pre-commit-makerst b/misc/hooks/pre-commit-makerst
index d9b684e73b..b990788b99 100755
--- a/misc/hooks/pre-commit-makerst
+++ b/misc/hooks/pre-commit-makerst
@@ -2,4 +2,11 @@
# Git pre-commit hook that checks the class reference syntax using makerst.py.
-doc/tools/makerst.py doc/classes modules --dry-run
+# Workaround because we can't execute the .py file directly on windows
+PYTHON=python
+py_ver=$($PYTHON -c "import sys; print(sys.version_info.major)")
+if [[ "$py_ver" != "3" ]]; then
+ PYTHON+=3
+fi
+
+$PYTHON doc/tools/makerst.py doc/classes modules --dry-run
diff --git a/misc/scripts/fix_headers.py b/misc/scripts/fix_headers.py
index f0038a8351..7af97eec4b 100755
--- a/misc/scripts/fix_headers.py
+++ b/misc/scripts/fix_headers.py
@@ -37,24 +37,24 @@ files = open("files", "r")
fname = files.readline()
-while (fname != ""):
+while fname != "":
# Handle replacing $filename with actual filename and keep alignment
fsingle = fname.strip()
- if (fsingle.find("/") != -1):
- fsingle = fsingle[fsingle.rfind("/") + 1:]
+ if fsingle.find("/") != -1:
+ fsingle = fsingle[fsingle.rfind("/") + 1 :]
rep_fl = "$filename"
rep_fi = fsingle
len_fl = len(rep_fl)
len_fi = len(rep_fi)
# Pad with spaces to keep alignment
- if (len_fi < len_fl):
+ if len_fi < len_fl:
for x in range(len_fl - len_fi):
rep_fi += " "
- elif (len_fl < len_fi):
+ elif len_fl < len_fi:
for x in range(len_fi - len_fl):
rep_fl += " "
- if (header.find(rep_fl) != -1):
+ if header.find(rep_fl) != -1:
text = header.replace(rep_fl, rep_fi)
else:
text = header.replace("$filename", fsingle)
@@ -71,21 +71,21 @@ while (fname != ""):
line = fileread.readline()
header_done = False
- while (line.strip() == ""): # Skip empty lines at the top
+ while line.strip() == "": # Skip empty lines at the top
line = fileread.readline()
- if (line.find("/**********") == -1): # Godot header starts this way
+ if line.find("/**********") == -1: # Godot header starts this way
# Maybe starting with a non-Godot comment, abort header magic
header_done = True
- while (not header_done): # Handle header now
- if (line.find("/*") != 0): # No more starting with a comment
+ while not header_done: # Handle header now
+ if line.find("/*") != 0: # No more starting with a comment
header_done = True
- if (line.strip() != ""):
+ if line.strip() != "":
text += line
line = fileread.readline()
- while (line != ""): # Dump everything until EOF
+ while line != "": # Dump everything until EOF
text += line
line = fileread.readline()
diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh
index b33cb0a7b4..2eee61a459 100755
--- a/misc/scripts/fix_style.sh
+++ b/misc/scripts/fix_style.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
# Command line arguments
+run_black=false
run_clang_format=false
run_fix_headers=false
-usage="Invalid argument. Usage:\n$0 <option>\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
+usage="Invalid argument. Usage:\n$0 <option>\n\t--black|-b\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
if [ -z "$1" ]; then
echo -e $usage
@@ -12,6 +13,9 @@ fi
while [ $# -gt 0 ]; do
case "$1" in
+ --black|-b)
+ run_black=true
+ ;;
--clang-format|-c)
run_clang_format=true
;;
@@ -19,6 +23,7 @@ while [ $# -gt 0 ]; do
run_fix_headers=true
;;
--all|-a)
+ run_black=true
run_clang_format=true
run_fix_headers=true
;;
@@ -32,6 +37,19 @@ done
echo "Removing generated files, some have binary data and make clang-format freeze."
find -name "*.gen.*" -delete
+# Apply black
+if $run_black; then
+ echo -e "Formatting Python files..."
+ PY_FILES=$(find \( -path "./.git" \
+ -o -path "./thirdparty" \
+ \) -prune \
+ -o \( -name "SConstruct" \
+ -o -name "SCsub" \
+ -o -name "*.py" \
+ \) -print)
+ black -l 120 $PY_FILES
+fi
+
# Apply clang-format
if $run_clang_format; then
# Sync list with pre-commit hook
diff --git a/misc/travis/black-format.sh b/misc/travis/black-format.sh
new file mode 100755
index 0000000000..75b153f6bb
--- /dev/null
+++ b/misc/travis/black-format.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+BLACK=black
+BLACK_OPTIONS="-l 120"
+
+if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+ # Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
+ # so it's problematic when we want an exact commit range for format checks.
+ # We fetch upstream to ensure that we have the proper references to resolve.
+ # Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
+ # updates, as it only includes changes since the previous state of the PR.
+ if [ -z "$(git remote | grep upstream)" ]; then
+ git remote add upstream https://github.com/godotengine/godot \
+ --no-tags -f -t $TRAVIS_BRANCH
+ fi
+ RANGE="upstream/$TRAVIS_BRANCH HEAD"
+else
+ # Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
+ # force pushes.
+ RANGE=HEAD
+fi
+
+FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/| grep -E "(SConstruct|SCsub|\.py)$")
+echo "Checking files:\n$FILES"
+
+# create a random filename to store our generated patch
+prefix="static-check-black"
+suffix="$(date +%s)"
+patch="/tmp/$prefix-$suffix.patch"
+
+for file in $FILES; do
+ "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \
+ sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch"
+done
+
+# if no patch has been generated all is ok, clean up the file stub and exit
+if [ ! -s "$patch" ] ; then
+ printf "Files in this commit comply with the black formatting rules.\n"
+ rm -f "$patch"
+ exit 0
+fi
+
+# a patch has been created, notify the user and exit
+printf "\n*** The following differences were found between the code to commit "
+printf "and the black formatting rules:\n\n"
+pygmentize -l diff "$patch"
+printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
+exit 1
diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh
index a6585578e1..c917744ece 100755
--- a/misc/travis/clang-format.sh
+++ b/misc/travis/clang-format.sh
@@ -8,8 +8,10 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# We fetch upstream to ensure that we have the proper references to resolve.
# Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
# updates, as it only includes changes since the previous state of the PR.
- git remote add upstream https://github.com/godotengine/godot \
- --no-tags -f -t $TRAVIS_BRANCH
+ if [ -z "$(git remote | grep upstream)" ]; then
+ git remote add upstream https://github.com/godotengine/godot \
+ --no-tags -f -t $TRAVIS_BRANCH
+ fi
RANGE="upstream/$TRAVIS_BRANCH HEAD"
else
# Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
@@ -41,6 +43,6 @@ fi
# a patch has been created, notify the user and exit
printf "\n*** The following differences were found between the code to commit "
printf "and the clang-format rules:\n\n"
-cat "$patch"
+pygmentize -l diff "$patch"
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
exit 1
diff --git a/modules/SCsub b/modules/SCsub
index 5b39b18334..1671b398e5 100644
--- a/modules/SCsub
+++ b/modules/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
import modules_builders
env_modules = env.Clone()
-Export('env_modules')
+Export("env_modules")
# Header with MODULE_*_ENABLED defines.
env.CommandNoCache("modules_enabled.gen.h", Value(env.module_list), modules_builders.generate_modules_enabled)
diff --git a/modules/arkit/SCsub b/modules/arkit/SCsub
index c05595ea2a..61c0a8248c 100644
--- a/modules/arkit/SCsub
+++ b/modules/arkit/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_arkit = env_modules.Clone()
@@ -9,4 +9,4 @@ env_arkit = env_modules.Clone()
modules_sources = []
env_arkit.add_source_files(modules_sources, "*.cpp")
env_arkit.add_source_files(modules_sources, "*.mm")
-mod_lib = env_modules.add_library('#bin/libgodot_arkit_module' + env['LIBSUFFIX'], modules_sources)
+mod_lib = env_modules.add_library("#bin/libgodot_arkit_module" + env["LIBSUFFIX"], modules_sources)
diff --git a/modules/arkit/config.py b/modules/arkit/config.py
index 96e41826c5..e68603fc93 100644
--- a/modules/arkit/config.py
+++ b/modules/arkit/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return platform == 'iphone'
+ return platform == "iphone"
+
def configure(env):
pass
diff --git a/modules/assimp/SCsub b/modules/assimp/SCsub
index cef2396dfb..f1d0c742b4 100644
--- a/modules/assimp/SCsub
+++ b/modules/assimp/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_assimp = env_modules.Clone()
@@ -10,85 +10,85 @@ env_assimp = env_modules.Clone()
if True: # env['builtin_assimp']:
thirdparty_dir = "#thirdparty/assimp"
- env_assimp.Prepend(CPPPATH=['#thirdparty/assimp'])
- env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/code'])
- env_assimp.Prepend(CPPPATH=['#thirdparty/assimp/include'])
+ env_assimp.Prepend(CPPPATH=["#thirdparty/assimp"])
+ env_assimp.Prepend(CPPPATH=["#thirdparty/assimp/code"])
+ env_assimp.Prepend(CPPPATH=["#thirdparty/assimp/include"])
- #env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_SINGLETHREADED'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_BOOST_WORKAROUND'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OWN_ZLIB'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_EXPORT'])
+ # env_assimp.Append(CPPDEFINES=['ASSIMP_DOUBLE_PRECISION']) # TODO default to what godot is compiled with for future double support
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_SINGLETHREADED"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_BOOST_WORKAROUND"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OWN_ZLIB"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_EXPORT"])
# Importers we don't need
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3DS_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_3MF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AC_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_AMF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASE_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_ASSBIN_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_B3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BLEND_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_BVH_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_C4D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COB_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_COLLADA_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_CSM_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_DXF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF2_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_GLTF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_HMP_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IFC_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRR_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_IRRMESH_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWO_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_LWS_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_M3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD2_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD3_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MD5_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDC_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MDL_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MMD_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_MS3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NDO_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_NFF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OBJ_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OFF_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OGRE_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_OPENGEX_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_PLY_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3BSP_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_Q3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_RAW_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SIB_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_SMD_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STEP_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_STL_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_TERRAGEN_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X3D_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_XGL_IMPORTER'])
- env_assimp.Append(CPPDEFINES=['ASSIMP_BUILD_NO_X_IMPORTER'])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3DS_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_3MF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_AC_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_AMF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_ASE_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_ASSBIN_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_B3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_BLEND_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_BVH_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_C4D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_COB_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_COLLADA_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_CSM_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_DXF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_GLTF2_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_GLTF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_HMP_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IFC_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IRR_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_IRRMESH_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_LWO_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_LWS_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_M3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD2_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD3_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD5_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MD5_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MDC_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MDL_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MMD_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_MS3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_NDO_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_NFF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OBJ_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OFF_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OGRE_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_OPENGEX_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_PLY_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_Q3BSP_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_Q3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_RAW_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_SIB_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_SMD_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_STEP_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_STL_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_TERRAGEN_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_X3D_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_XGL_IMPORTER"])
+ env_assimp.Append(CPPDEFINES=["ASSIMP_BUILD_NO_X_IMPORTER"])
+
+ if env["platform"] == "windows":
+ env_assimp.Append(CPPDEFINES=["PLATFORM_WINDOWS"])
+ env_assimp.Append(CPPDEFINES=[("PLATFORM", "WINDOWS")])
+ elif env["platform"] == "linuxbsd":
+ env_assimp.Append(CPPDEFINES=["PLATFORM_LINUX"])
+ env_assimp.Append(CPPDEFINES=[("PLATFORM", "LINUX")])
+ elif env["platform"] == "osx":
+ env_assimp.Append(CPPDEFINES=["PLATFORM_DARWIN"])
+ env_assimp.Append(CPPDEFINES=[("PLATFORM", "DARWIN")])
- if(env['platform'] == 'windows'):
- env_assimp.Append(CPPDEFINES=['PLATFORM_WINDOWS'])
- env_assimp.Append(CPPDEFINES=[('PLATFORM', 'WINDOWS')])
- elif(env['platform'] == 'linuxbsd'):
- env_assimp.Append(CPPDEFINES=['PLATFORM_LINUX'])
- env_assimp.Append(CPPDEFINES=[('PLATFORM', 'LINUX')])
- elif(env['platform'] == 'osx'):
- env_assimp.Append(CPPDEFINES=['PLATFORM_DARWIN'])
- env_assimp.Append(CPPDEFINES=[('PLATFORM', 'DARWIN')])
-
env_thirdparty = env_assimp.Clone()
env_thirdparty.disable_warnings()
- env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/CApi/*.cpp'))
- env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Common/*.cpp'))
- env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/PostProcessing/*.cpp'))
- env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/Material/*.cpp'))
- env_thirdparty.add_source_files(env.modules_sources, Glob('#thirdparty/assimp/code/FBX/*.cpp'))
+ env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/CApi/*.cpp"))
+ env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/Common/*.cpp"))
+ env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/PostProcessing/*.cpp"))
+ env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/Material/*.cpp"))
+ env_thirdparty.add_source_files(env.modules_sources, Glob("#thirdparty/assimp/code/FBX/*.cpp"))
# Godot's own source files
env_assimp.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/assimp/config.py b/modules/assimp/config.py
index 098f1eafa9..53b8f2f2e3 100644
--- a/modules/assimp/config.py
+++ b/modules/assimp/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return env['tools']
+ return env["tools"]
+
def configure(env):
pass
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp
index d163512bb3..cc74674eff 100644
--- a/modules/assimp/editor_scene_importer_assimp.cpp
+++ b/modules/assimp/editor_scene_importer_assimp.cpp
@@ -62,7 +62,7 @@ aiBone *get_bone_by_name(const aiScene *scene, aiString bone_name) {
}
}
- return NULL;
+ return nullptr;
}
void EditorSceneImporterAssimp::get_extensions(List<String> *r_extensions) const {
@@ -149,7 +149,7 @@ Node *EditorSceneImporterAssimp::import_scene(const String &p_path, uint32_t p_f
0;
aiScene *scene = (aiScene *)importer.ReadFile(s_path.c_str(), post_process_Steps);
- ERR_FAIL_COND_V_MSG(scene == NULL, NULL, String("Open Asset Import failed to open: ") + String(importer.GetErrorString()));
+ ERR_FAIL_COND_V_MSG(scene == nullptr, nullptr, String("Open Asset Import failed to open: ") + String(importer.GetErrorString()));
return _generate_scene(p_path, scene, p_flags, p_bake_fps, max_bone_weights);
}
@@ -284,7 +284,7 @@ T EditorSceneImporterAssimp::_interpolate_track(const Vector<float> &p_times, co
aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiString name) {
List<aiBone *>::Element *iter;
- aiBone *bone = NULL;
+ aiBone *bone = nullptr;
for (iter = state.bone_stack.front(); iter; iter = iter->next()) {
bone = (aiBone *)iter->get();
@@ -294,32 +294,32 @@ aiBone *EditorSceneImporterAssimp::get_bone_from_stack(ImportState &state, aiStr
}
}
- return NULL;
+ return nullptr;
}
Node3D *
EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps,
const int32_t p_max_bone_weights) {
- ERR_FAIL_COND_V(scene == NULL, NULL);
+ ERR_FAIL_COND_V(scene == nullptr, nullptr);
ImportState state;
state.path = p_path;
state.assimp_scene = scene;
state.max_bone_weights = p_max_bone_weights;
- state.animation_player = NULL;
+ state.animation_player = nullptr;
// populate light map
for (unsigned int l = 0; l < scene->mNumLights; l++) {
aiLight *ai_light = scene->mLights[l];
- ERR_CONTINUE(ai_light == NULL);
+ ERR_CONTINUE(ai_light == nullptr);
state.light_cache[AssimpUtils::get_assimp_string(ai_light->mName)] = l;
}
// fill camera cache
for (unsigned int c = 0; c < scene->mNumCameras; c++) {
aiCamera *ai_camera = scene->mCameras[c];
- ERR_CONTINUE(ai_camera == NULL);
+ ERR_CONTINUE(ai_camera == nullptr);
state.camera_cache[AssimpUtils::get_assimp_string(ai_camera->mName)] = c;
}
@@ -333,7 +333,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
RegenerateBoneStack(state);
- Node *last_valid_parent = NULL;
+ Node *last_valid_parent = nullptr;
List<const aiNode *>::Element *iter;
for (iter = state.nodes.front(); iter; iter = iter->next()) {
@@ -343,7 +343,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
String node_name = AssimpUtils::get_assimp_string(element_assimp_node->mName);
//print_verbose("node: " + node_name);
- Node3D *spatial = NULL;
+ Node3D *spatial = nullptr;
Transform transform = AssimpUtils::assimp_matrix_transform(element_assimp_node->mTransformation);
// retrieve this node bone
@@ -361,13 +361,13 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
if (!state.armature_skeletons.has(element_assimp_node)) {
state.armature_skeletons.insert(element_assimp_node, skeleton);
}
- } else if (bone != NULL) {
+ } else if (bone != nullptr) {
continue;
} else {
spatial = memnew(Node3D);
}
- ERR_CONTINUE_MSG(spatial == NULL, "FBX Import - are we out of ram?");
+ ERR_CONTINUE_MSG(spatial == nullptr, "FBX Import - are we out of ram?");
// we on purpose set the transform and name after creating the node.
spatial->set_name(node_name);
@@ -387,7 +387,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
if (parent_lookup) {
Node3D *parent_node = parent_lookup->value();
- ERR_FAIL_COND_V_MSG(parent_node == NULL, state.root,
+ ERR_FAIL_COND_V_MSG(parent_node == nullptr, state.root,
"Parent node invalid even though lookup successful, out of ram?");
if (spatial != state.root) {
@@ -434,7 +434,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
aiNode *parent_node = bone_node->mParent;
String bone_name = AssimpUtils::get_anim_string_from_assimp(bone->mName);
- ERR_CONTINUE_MSG(armature_for_bone == NULL, "Armature for bone invalid: " + bone_name);
+ ERR_CONTINUE_MSG(armature_for_bone == nullptr, "Armature for bone invalid: " + bone_name);
Skeleton3D *skeleton = state.armature_skeletons[armature_for_bone];
state.skeleton_bone_map[bone] = skeleton;
@@ -454,7 +454,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
skeleton->set_bone_rest(boneIdx, pform);
skeleton->set_bone_pose(boneIdx, pform);
- if (parent_node != NULL) {
+ if (parent_node != nullptr) {
int parent_bone_id = skeleton->find_bone(AssimpUtils::get_anim_string_from_assimp(parent_node->mName));
int current_bone_id = boneIdx;
skeleton->set_bone_parent(current_bone_id, parent_bone_id);
@@ -470,8 +470,8 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
const aiNode *assimp_node = key_value_pair->key();
Node3D *mesh_template = key_value_pair->value();
- ERR_CONTINUE(assimp_node == NULL);
- ERR_CONTINUE(mesh_template == NULL);
+ ERR_CONTINUE(assimp_node == nullptr);
+ ERR_CONTINUE(mesh_template == nullptr);
Node *parent_node = mesh_template->get_parent();
@@ -479,7 +479,7 @@ EditorSceneImporterAssimp::_generate_scene(const String &p_path, aiScene *scene,
continue;
}
- if (parent_node == NULL) {
+ if (parent_node == nullptr) {
print_error("Found invalid parent node!");
continue; // root node
}
@@ -661,7 +661,7 @@ Node *EditorSceneImporterAssimp::get_node_by_name(ImportState &state, String nam
return node;
}
}
- return NULL;
+ return nullptr;
}
/* Bone stack is a fifo handler for multiple armatures since armatures aren't a thing in assimp (yet) */
@@ -691,7 +691,7 @@ void EditorSceneImporterAssimp::RegenerateBoneStack(ImportState &state, aiMesh *
// iterate over all the bones on the mesh for this node only!
for (unsigned int boneIndex = 0; boneIndex < mesh->mNumBones; boneIndex++) {
aiBone *bone = mesh->mBones[boneIndex];
- if (state.bone_stack.find(bone) == NULL) {
+ if (state.bone_stack.find(bone) == nullptr) {
state.bone_stack.push_back(bone);
}
}
@@ -711,7 +711,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
print_verbose("import animation: " + name);
float ticks_per_second = anim->mTicksPerSecond;
- if (state.assimp_scene->mMetaData != NULL && Math::is_equal_approx(ticks_per_second, 0.0f)) {
+ if (state.assimp_scene->mMetaData != nullptr && Math::is_equal_approx(ticks_per_second, 0.0f)) {
int32_t time_mode = 0;
state.assimp_scene->mMetaData->Get("TimeMode", time_mode);
ticks_per_second = AssimpUtils::get_fbx_fps(time_mode, state.assimp_scene);
@@ -747,9 +747,9 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
continue; //do not bother
}
- Skeleton3D *skeleton = NULL;
+ Skeleton3D *skeleton = nullptr;
NodePath node_path;
- aiBone *bone = NULL;
+ aiBone *bone = nullptr;
// Import skeleton bone animation for this track
// Any bone will do, no point in processing more than just what is in the skeleton
@@ -806,7 +806,7 @@ void EditorSceneImporterAssimp::_import_animation(ImportState &state, int p_anim
Node *item = get_node_by_name(state, mesh_name);
ERR_CONTINUE_MSG(!item, "failed to look up node by name");
const MeshInstance3D *mesh_instance = Object::cast_to<MeshInstance3D>(item);
- ERR_CONTINUE(mesh_instance == NULL);
+ ERR_CONTINUE(mesh_instance == nullptr);
String base_path = state.root->get_path_to(mesh_instance);
@@ -940,7 +940,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
}
// Work out normal calculations? - this needs work it doesn't work properly on huestos
- if (ai_mesh->mNormals != NULL) {
+ if (ai_mesh->mNormals != nullptr) {
const aiVector3D normals = ai_mesh->mNormals[j];
const Vector3 godot_normal = Vector3(normals.x, normals.y, normals.z);
st->add_normal(godot_normal);
@@ -1325,8 +1325,8 @@ EditorSceneImporterAssimp::create_mesh(ImportState &state, const aiNode *assimp_
mesh_key += itos(surface_indices[i]);
}
- Skeleton3D *skeleton = NULL;
- aiNode *armature = NULL;
+ Skeleton3D *skeleton = nullptr;
+ aiNode *armature = nullptr;
if (!state.mesh_cache.has(mesh_key)) {
mesh = _generate_mesh_from_surface_indices(state, surface_indices, assimp_node, skin, skeleton);
@@ -1411,9 +1411,9 @@ Node3D *EditorSceneImporterAssimp::create_light(
ImportState &state,
const String &node_name,
Transform &look_at_transform) {
- Light3D *light = NULL;
+ Light3D *light = nullptr;
aiLight *assimp_light = state.assimp_scene->mLights[state.light_cache[node_name]];
- ERR_FAIL_COND_V(!assimp_light, NULL);
+ ERR_FAIL_COND_V(!assimp_light, nullptr);
if (assimp_light->mType == aiLightSource_DIRECTIONAL) {
light = memnew(DirectionalLight3D);
@@ -1422,7 +1422,7 @@ Node3D *EditorSceneImporterAssimp::create_light(
} else if (assimp_light->mType == aiLightSource_SPOT) {
light = memnew(SpotLight3D);
}
- ERR_FAIL_COND_V(light == NULL, NULL);
+ ERR_FAIL_COND_V(light == nullptr, nullptr);
if (assimp_light->mType != aiLightSource_POINT) {
Vector3 pos = Vector3(
@@ -1458,10 +1458,10 @@ Node3D *EditorSceneImporterAssimp::create_camera(
const String &node_name,
Transform &look_at_transform) {
aiCamera *camera = state.assimp_scene->mCameras[state.camera_cache[node_name]];
- ERR_FAIL_COND_V(!camera, NULL);
+ ERR_FAIL_COND_V(!camera, nullptr);
Camera3D *camera_node = memnew(Camera3D);
- ERR_FAIL_COND_V(!camera_node, NULL);
+ ERR_FAIL_COND_V(!camera_node, nullptr);
float near = camera->mClipPlaneNear;
if (Math::is_equal_approx(near, 0.0f)) {
near = 0.1f;
@@ -1483,7 +1483,7 @@ void EditorSceneImporterAssimp::_generate_node(
ImportState &state,
const aiNode *assimp_node) {
- ERR_FAIL_COND(assimp_node == NULL);
+ ERR_FAIL_COND(assimp_node == nullptr);
state.nodes.push_back(assimp_node);
String parent_name = AssimpUtils::get_assimp_string(assimp_node->mParent->mName);
@@ -1498,7 +1498,7 @@ void EditorSceneImporterAssimp::_generate_node(
// is this an armature
// parent null
// and this is the first bone :)
- if (parent_bone == NULL && current_bone) {
+ if (parent_bone == nullptr && current_bone) {
state.armature_nodes.push_back(assimp_node->mParent);
print_verbose("found valid armature: " + parent_name);
}
diff --git a/modules/assimp/editor_scene_importer_assimp.h b/modules/assimp/editor_scene_importer_assimp.h
index 5059138b64..ab00a6c3aa 100644
--- a/modules/assimp/editor_scene_importer_assimp.h
+++ b/modules/assimp/editor_scene_importer_assimp.h
@@ -138,7 +138,7 @@ public:
virtual void get_extensions(List<String> *r_extensions) const;
virtual uint32_t get_import_flags() const;
- virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL);
+ virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr);
Ref<Image> load_image(ImportState &state, const aiScene *p_scene, String p_path);
static void RegenerateBoneStack(ImportState &state);
diff --git a/modules/assimp/import_state.h b/modules/assimp/import_state.h
index b16366b38c..cda1a854f0 100644
--- a/modules/assimp/import_state.h
+++ b/modules/assimp/import_state.h
@@ -118,12 +118,12 @@ struct RecursiveState {
bone(_bone) {}
Transform node_transform;
- Skeleton3D *skeleton = NULL;
- Node3D *new_node = NULL;
+ Skeleton3D *skeleton = nullptr;
+ Node3D *new_node = nullptr;
String node_name;
- aiNode *assimp_node = NULL;
- Node *parent_node = NULL;
- aiBone *bone = NULL;
+ aiNode *assimp_node = nullptr;
+ Node *parent_node = nullptr;
+ aiBone *bone = nullptr;
};
} // namespace AssimpImporter
diff --git a/modules/assimp/import_utils.h b/modules/assimp/import_utils.h
index 30c00f8765..f78931add3 100644
--- a/modules/assimp/import_utils.h
+++ b/modules/assimp/import_utils.h
@@ -233,7 +233,7 @@ public:
static Transform _get_global_assimp_node_transform(const aiNode *p_current_node) {
aiNode const *current_node = p_current_node;
Transform xform;
- while (current_node != NULL) {
+ while (current_node != nullptr) {
xform = assimp_matrix_transform(current_node->mTransformation) * xform;
current_node = current_node->mParent;
}
@@ -319,7 +319,7 @@ public:
*/
static void set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<ImageTexture> texture) {
ERR_FAIL_COND(texture.is_null());
- ERR_FAIL_COND(map_mode == NULL);
+ ERR_FAIL_COND(map_mode == nullptr);
// FIXME: Commented out during Vulkan port.
/*
aiTextureMapMode tex_mode = map_mode[0];
@@ -358,13 +358,13 @@ public:
print_verbose("Open Asset Import: Loading embedded texture " + filename);
if (tex->mHeight == 0) {
if (tex->CheckFormat("png")) {
- ERR_FAIL_COND_V(Image::_png_mem_loader_func == NULL, Ref<Image>());
+ ERR_FAIL_COND_V(Image::_png_mem_loader_func == nullptr, Ref<Image>());
Ref<Image> img = Image::_png_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
state.path_to_image_cache.insert(p_path, img);
return img;
} else if (tex->CheckFormat("jpg")) {
- ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == NULL, Ref<Image>());
+ ERR_FAIL_COND_V(Image::_jpg_mem_loader_func == nullptr, Ref<Image>());
Ref<Image> img = Image::_jpg_mem_loader_func((uint8_t *)tex->pcData, tex->mWidth);
ERR_FAIL_COND_V(img.is_null(), Ref<Image>());
state.path_to_image_cache.insert(p_path, img);
@@ -440,7 +440,7 @@ public:
String &path,
AssimpImageData &image_state) {
aiString ai_filename = aiString();
- if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, NULL, NULL, NULL, NULL, image_state.map_mode)) {
+ if (AI_SUCCESS == ai_material->GetTexture(texture_type, 0, &ai_filename, nullptr, nullptr, nullptr, nullptr, image_state.map_mode)) {
return CreateAssimpTexture(state, ai_filename, filename, path, image_state);
}
diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub
index 63324e920b..dc7b176d24 100644
--- a/modules/basis_universal/SCsub
+++ b/modules/basis_universal/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_basisu = env_modules.Clone()
@@ -9,36 +9,38 @@ env_basisu = env_modules.Clone()
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/basis_universal/"
tool_sources = [
- "basisu_astc_decomp.cpp",
- "basisu_backend.cpp",
- "basisu_basis_file.cpp",
- "basisu_comp.cpp",
- "basisu_enc.cpp",
- "basisu_etc.cpp",
- "basisu_frontend.cpp",
- "basisu_global_selector_palette_helpers.cpp",
- "basisu_gpu_texture.cpp",
- "basisu_pvrtc1_4.cpp",
- "basisu_resample_filters.cpp",
- "basisu_resampler.cpp",
- "basisu_ssim.cpp",
- "lodepng.cpp",
+ "basisu_astc_decomp.cpp",
+ "basisu_backend.cpp",
+ "basisu_basis_file.cpp",
+ "basisu_comp.cpp",
+ "basisu_enc.cpp",
+ "basisu_etc.cpp",
+ "basisu_frontend.cpp",
+ "basisu_global_selector_palette_helpers.cpp",
+ "basisu_gpu_texture.cpp",
+ "basisu_pvrtc1_4.cpp",
+ "basisu_resample_filters.cpp",
+ "basisu_resampler.cpp",
+ "basisu_ssim.cpp",
+ "lodepng.cpp",
]
tool_sources = [thirdparty_dir + file for file in tool_sources]
transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"]
# Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC.
if not env.msvc:
- env_basisu.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path, '-isystem', Dir(thirdparty_dir + "transcoder").path])
+ env_basisu.Append(
+ CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir(thirdparty_dir + "transcoder").path]
+ )
else:
env_basisu.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "transcoder"])
-if env['target'] == "debug":
- env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"])
+if env["target"] == "debug":
+ env_basisu.Append(CPPFLAGS=["-DBASISU_DEVEL_MESSAGES=1", "-DBASISD_ENABLE_DEBUG_FLAGS=1"])
env_thirdparty = env_basisu.Clone()
env_thirdparty.disable_warnings()
-if env['tools']:
+if env["tools"]:
env_thirdparty.add_source_files(env.modules_sources, tool_sources)
env_thirdparty.add_source_files(env.modules_sources, transcoder_sources)
diff --git a/modules/basis_universal/config.py b/modules/basis_universal/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/basis_universal/config.py
+++ b/modules/basis_universal/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp
index bf6bc1debd..f31c889a6d 100644
--- a/modules/basis_universal/register_types.cpp
+++ b/modules/basis_universal/register_types.cpp
@@ -98,7 +98,7 @@ static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image::
params.m_mip_gen = false; //sorry, please some day support provided mipmaps.
params.m_source_images.push_back(buimg);
- BasisDecompressFormat decompress_format;
+ BasisDecompressFormat decompress_format = BASIS_DECOMPRESS_RG;
params.m_check_for_alpha = false;
switch (p_channels) {
@@ -158,8 +158,8 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
const uint8_t *ptr = r;
int size = p_buffer.size();
- basist::transcoder_texture_format format;
- Image::Format imgfmt;
+ basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats;
+ Image::Format imgfmt = Image::FORMAT_MAX;
switch (*(uint32_t *)(ptr)) {
case BASIS_DECOMPRESS_RG: {
@@ -229,7 +229,7 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
ptr += 4;
size -= 4;
- basist::basisu_transcoder tr(NULL);
+ basist::basisu_transcoder tr(nullptr);
ERR_FAIL_COND_V(!tr.validate_header(ptr, size), image);
@@ -282,7 +282,7 @@ void unregister_basis_universal_types() {
#ifdef TOOLS_ENABLED
delete sel_codebook;
- Image::basis_universal_packer = NULL;
+ Image::basis_universal_packer = nullptr;
#endif
- Image::basis_universal_unpacker = NULL;
+ Image::basis_universal_unpacker = nullptr;
}
diff --git a/modules/basis_universal/texture_basisu.cpp b/modules/basis_universal/texture_basisu.cpp
index 9c3cdac36c..2ed0340927 100644
--- a/modules/basis_universal/texture_basisu.cpp
+++ b/modules/basis_universal/texture_basisu.cpp
@@ -105,7 +105,7 @@ void TextureBasisU::set_basisu_data(const Vector<uint8_t>& p_data) {
imgfmt = Image::FORMAT_ETC2_RGBA8;
};
- basist::basisu_transcoder tr(NULL);
+ basist::basisu_transcoder tr(nullptr);
ERR_FAIL_COND(!tr.validate_header(ptr, size));
diff --git a/modules/bmp/SCsub b/modules/bmp/SCsub
index e7da7cf108..4f3405ff28 100644
--- a/modules/bmp/SCsub
+++ b/modules/bmp/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_bmp = env_modules.Clone()
diff --git a/modules/bmp/config.py b/modules/bmp/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/bmp/config.py
+++ b/modules/bmp/config.py
@@ -1,5 +1,6 @@
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
index 71e5076e78..ea2b2b548f 100644
--- a/modules/bmp/image_loader_bmp.cpp
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -38,7 +38,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
Error err = OK;
- if (p_buffer == NULL)
+ if (p_buffer == nullptr)
err = FAILED;
if (err == OK) {
@@ -151,7 +151,7 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,
line -= line_width;
}
- if (p_color_buffer == NULL || color_table_size == 0) { // regular pixels
+ if (p_color_buffer == nullptr || color_table_size == 0) { // regular pixels
p_image->create(width, height, 0, Image::FORMAT_RGBA8, data);
diff --git a/modules/bmp/register_types.cpp b/modules/bmp/register_types.cpp
index d5cc6c5eb3..6220e956d6 100644
--- a/modules/bmp/register_types.cpp
+++ b/modules/bmp/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_bmp.h"
-static ImageLoaderBMP *image_loader_bmp = NULL;
+static ImageLoaderBMP *image_loader_bmp = nullptr;
void register_bmp_types() {
image_loader_bmp = memnew(ImageLoaderBMP);
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index 02d0a31a69..692c749886 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -1,208 +1,203 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_bullet = env_modules.Clone()
# Thirdparty source files
-if env['builtin_bullet']:
+if env["builtin_bullet"]:
# Build only version 2 for now (as of 2.89)
# Sync file list with relevant upstream CMakeLists.txt for each folder.
thirdparty_dir = "#thirdparty/bullet/"
bullet2_src = [
# BulletCollision
- "BulletCollision/BroadphaseCollision/btAxisSweep3.cpp"
- , "BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp"
- , "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp"
- , "BulletCollision/BroadphaseCollision/btDbvt.cpp"
- , "BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp"
- , "BulletCollision/BroadphaseCollision/btDispatcher.cpp"
- , "BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp"
- , "BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp"
- , "BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp"
- , "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp"
- , "BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp"
- , "BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp"
- , "BulletCollision/CollisionDispatch/btCollisionObject.cpp"
- , "BulletCollision/CollisionDispatch/btCollisionWorld.cpp"
- , "BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp"
- , "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp"
- , "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btGhostObject.cpp"
- , "BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp"
- , "BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp"
- , "BulletCollision/CollisionDispatch/btManifoldResult.cpp"
- , "BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp"
- , "BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp"
- , "BulletCollision/CollisionDispatch/btUnionFind.cpp"
- , "BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp"
- , "BulletCollision/CollisionShapes/btBoxShape.cpp"
- , "BulletCollision/CollisionShapes/btBox2dShape.cpp"
- , "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp"
- , "BulletCollision/CollisionShapes/btCapsuleShape.cpp"
- , "BulletCollision/CollisionShapes/btCollisionShape.cpp"
- , "BulletCollision/CollisionShapes/btCompoundShape.cpp"
- , "BulletCollision/CollisionShapes/btConcaveShape.cpp"
- , "BulletCollision/CollisionShapes/btConeShape.cpp"
- , "BulletCollision/CollisionShapes/btConvexHullShape.cpp"
- , "BulletCollision/CollisionShapes/btConvexInternalShape.cpp"
- , "BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp"
- , "BulletCollision/CollisionShapes/btConvexPolyhedron.cpp"
- , "BulletCollision/CollisionShapes/btConvexShape.cpp"
- , "BulletCollision/CollisionShapes/btConvex2dShape.cpp"
- , "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp"
- , "BulletCollision/CollisionShapes/btCylinderShape.cpp"
- , "BulletCollision/CollisionShapes/btEmptyShape.cpp"
- , "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp"
- , "BulletCollision/CollisionShapes/btMiniSDF.cpp"
- , "BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp"
- , "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp"
- , "BulletCollision/CollisionShapes/btMultiSphereShape.cpp"
- , "BulletCollision/CollisionShapes/btOptimizedBvh.cpp"
- , "BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp"
- , "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp"
- , "BulletCollision/CollisionShapes/btSdfCollisionShape.cpp"
- , "BulletCollision/CollisionShapes/btShapeHull.cpp"
- , "BulletCollision/CollisionShapes/btSphereShape.cpp"
- , "BulletCollision/CollisionShapes/btStaticPlaneShape.cpp"
- , "BulletCollision/CollisionShapes/btStridingMeshInterface.cpp"
- , "BulletCollision/CollisionShapes/btTetrahedronShape.cpp"
- , "BulletCollision/CollisionShapes/btTriangleBuffer.cpp"
- , "BulletCollision/CollisionShapes/btTriangleCallback.cpp"
- , "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp"
- , "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp"
- , "BulletCollision/CollisionShapes/btTriangleMesh.cpp"
- , "BulletCollision/CollisionShapes/btTriangleMeshShape.cpp"
- , "BulletCollision/CollisionShapes/btUniformScalingShape.cpp"
- , "BulletCollision/Gimpact/btContactProcessing.cpp"
- , "BulletCollision/Gimpact/btGenericPoolAllocator.cpp"
- , "BulletCollision/Gimpact/btGImpactBvh.cpp"
- , "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp"
- , "BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp"
- , "BulletCollision/Gimpact/btGImpactShape.cpp"
- , "BulletCollision/Gimpact/btTriangleShapeEx.cpp"
- , "BulletCollision/Gimpact/gim_box_set.cpp"
- , "BulletCollision/Gimpact/gim_contact.cpp"
- , "BulletCollision/Gimpact/gim_memory.cpp"
- , "BulletCollision/Gimpact/gim_tri_collision.cpp"
- , "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp"
- , "BulletCollision/NarrowPhaseCollision/btConvexCast.cpp"
- , "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp"
- , "BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp"
- , "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp"
- , "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp"
- , "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp"
- , "BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp"
- , "BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp"
- , "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp"
- , "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp"
- , "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp"
-
+ "BulletCollision/BroadphaseCollision/btAxisSweep3.cpp",
+ "BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp",
+ "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp",
+ "BulletCollision/BroadphaseCollision/btDbvt.cpp",
+ "BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp",
+ "BulletCollision/BroadphaseCollision/btDispatcher.cpp",
+ "BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp",
+ "BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp",
+ "BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp",
+ "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp",
+ "BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp",
+ "BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp",
+ "BulletCollision/CollisionDispatch/btCollisionObject.cpp",
+ "BulletCollision/CollisionDispatch/btCollisionWorld.cpp",
+ "BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp",
+ "BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp",
+ "BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btGhostObject.cpp",
+ "BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp",
+ "BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp",
+ "BulletCollision/CollisionDispatch/btManifoldResult.cpp",
+ "BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp",
+ "BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp",
+ "BulletCollision/CollisionDispatch/btUnionFind.cpp",
+ "BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp",
+ "BulletCollision/CollisionShapes/btBoxShape.cpp",
+ "BulletCollision/CollisionShapes/btBox2dShape.cpp",
+ "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp",
+ "BulletCollision/CollisionShapes/btCapsuleShape.cpp",
+ "BulletCollision/CollisionShapes/btCollisionShape.cpp",
+ "BulletCollision/CollisionShapes/btCompoundShape.cpp",
+ "BulletCollision/CollisionShapes/btConcaveShape.cpp",
+ "BulletCollision/CollisionShapes/btConeShape.cpp",
+ "BulletCollision/CollisionShapes/btConvexHullShape.cpp",
+ "BulletCollision/CollisionShapes/btConvexInternalShape.cpp",
+ "BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp",
+ "BulletCollision/CollisionShapes/btConvexPolyhedron.cpp",
+ "BulletCollision/CollisionShapes/btConvexShape.cpp",
+ "BulletCollision/CollisionShapes/btConvex2dShape.cpp",
+ "BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp",
+ "BulletCollision/CollisionShapes/btCylinderShape.cpp",
+ "BulletCollision/CollisionShapes/btEmptyShape.cpp",
+ "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp",
+ "BulletCollision/CollisionShapes/btMiniSDF.cpp",
+ "BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp",
+ "BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp",
+ "BulletCollision/CollisionShapes/btMultiSphereShape.cpp",
+ "BulletCollision/CollisionShapes/btOptimizedBvh.cpp",
+ "BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp",
+ "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp",
+ "BulletCollision/CollisionShapes/btSdfCollisionShape.cpp",
+ "BulletCollision/CollisionShapes/btShapeHull.cpp",
+ "BulletCollision/CollisionShapes/btSphereShape.cpp",
+ "BulletCollision/CollisionShapes/btStaticPlaneShape.cpp",
+ "BulletCollision/CollisionShapes/btStridingMeshInterface.cpp",
+ "BulletCollision/CollisionShapes/btTetrahedronShape.cpp",
+ "BulletCollision/CollisionShapes/btTriangleBuffer.cpp",
+ "BulletCollision/CollisionShapes/btTriangleCallback.cpp",
+ "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp",
+ "BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp",
+ "BulletCollision/CollisionShapes/btTriangleMesh.cpp",
+ "BulletCollision/CollisionShapes/btTriangleMeshShape.cpp",
+ "BulletCollision/CollisionShapes/btUniformScalingShape.cpp",
+ "BulletCollision/Gimpact/btContactProcessing.cpp",
+ "BulletCollision/Gimpact/btGenericPoolAllocator.cpp",
+ "BulletCollision/Gimpact/btGImpactBvh.cpp",
+ "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp",
+ "BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp",
+ "BulletCollision/Gimpact/btGImpactShape.cpp",
+ "BulletCollision/Gimpact/btTriangleShapeEx.cpp",
+ "BulletCollision/Gimpact/gim_box_set.cpp",
+ "BulletCollision/Gimpact/gim_contact.cpp",
+ "BulletCollision/Gimpact/gim_memory.cpp",
+ "BulletCollision/Gimpact/gim_tri_collision.cpp",
+ "BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp",
+ "BulletCollision/NarrowPhaseCollision/btConvexCast.cpp",
+ "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp",
+ "BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp",
+ "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp",
+ "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp",
+ "BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp",
+ "BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp",
+ "BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp",
+ "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp",
+ "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp",
+ "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp",
# BulletDynamics
- , "BulletDynamics/Character/btKinematicCharacterController.cpp"
- , "BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btContactConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btFixedConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btGearConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp"
- , "BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp"
- , "BulletDynamics/ConstraintSolver/btHingeConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp"
- , "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolverMt.cpp"
- , "BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp"
- , "BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp"
- , "BulletDynamics/ConstraintSolver/btSliderConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btTypedConstraint.cpp"
- , "BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp"
- , "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp"
- , "BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp"
- , "BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp"
- , "BulletDynamics/Dynamics/btRigidBody.cpp"
- , "BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp"
- #, "BulletDynamics/Dynamics/Bullet-C-API.cpp"
- , "BulletDynamics/Vehicle/btRaycastVehicle.cpp"
- , "BulletDynamics/Vehicle/btWheelInfo.cpp"
- , "BulletDynamics/Featherstone/btMultiBody.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyConstraint.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyFixedConstraint.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyMLCPConstraintSolver.cpp"
- , "BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp"
- , "BulletDynamics/Featherstone/btMultiBodySliderConstraint.cpp"
- , "BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp"
- , "BulletDynamics/MLCPSolvers/btDantzigLCP.cpp"
- , "BulletDynamics/MLCPSolvers/btMLCPSolver.cpp"
- , "BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp"
-
+ "BulletDynamics/Character/btKinematicCharacterController.cpp",
+ "BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btContactConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btFixedConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btGearConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp",
+ "BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp",
+ "BulletDynamics/ConstraintSolver/btHingeConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp",
+ "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolverMt.cpp",
+ "BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp",
+ "BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp",
+ "BulletDynamics/ConstraintSolver/btSliderConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btTypedConstraint.cpp",
+ "BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp",
+ "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp",
+ "BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp",
+ "BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp",
+ "BulletDynamics/Dynamics/btRigidBody.cpp",
+ "BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp",
+ # "BulletDynamics/Dynamics/Bullet-C-API.cpp",
+ "BulletDynamics/Vehicle/btRaycastVehicle.cpp",
+ "BulletDynamics/Vehicle/btWheelInfo.cpp",
+ "BulletDynamics/Featherstone/btMultiBody.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyConstraint.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyFixedConstraint.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyMLCPConstraintSolver.cpp",
+ "BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp",
+ "BulletDynamics/Featherstone/btMultiBodySliderConstraint.cpp",
+ "BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp",
+ "BulletDynamics/MLCPSolvers/btDantzigLCP.cpp",
+ "BulletDynamics/MLCPSolvers/btMLCPSolver.cpp",
+ "BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp",
# BulletInverseDynamics
- , "BulletInverseDynamics/IDMath.cpp"
- , "BulletInverseDynamics/MultiBodyTree.cpp"
- , "BulletInverseDynamics/details/MultiBodyTreeInitCache.cpp"
- , "BulletInverseDynamics/details/MultiBodyTreeImpl.cpp"
-
+ "BulletInverseDynamics/IDMath.cpp",
+ "BulletInverseDynamics/MultiBodyTree.cpp",
+ "BulletInverseDynamics/details/MultiBodyTreeInitCache.cpp",
+ "BulletInverseDynamics/details/MultiBodyTreeImpl.cpp",
# BulletSoftBody
- , "BulletSoftBody/btSoftBody.cpp"
- , "BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp"
- , "BulletSoftBody/btSoftBodyHelpers.cpp"
- , "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp"
- , "BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp"
- , "BulletSoftBody/btSoftRigidDynamicsWorld.cpp"
- , "BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp"
- , "BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp"
- , "BulletSoftBody/btDefaultSoftBodySolver.cpp"
- , "BulletSoftBody/btDeformableBackwardEulerObjective.cpp"
- , "BulletSoftBody/btDeformableBodySolver.cpp"
- , "BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp"
- , "BulletSoftBody/btDeformableContactProjection.cpp"
- , "BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp"
- , "BulletSoftBody/btDeformableContactConstraint.cpp"
-
+ "BulletSoftBody/btSoftBody.cpp",
+ "BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp",
+ "BulletSoftBody/btSoftBodyHelpers.cpp",
+ "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp",
+ "BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp",
+ "BulletSoftBody/btSoftRigidDynamicsWorld.cpp",
+ "BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp",
+ "BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp",
+ "BulletSoftBody/btDefaultSoftBodySolver.cpp",
+ "BulletSoftBody/btDeformableBackwardEulerObjective.cpp",
+ "BulletSoftBody/btDeformableBodySolver.cpp",
+ "BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp",
+ "BulletSoftBody/btDeformableContactProjection.cpp",
+ "BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp",
+ "BulletSoftBody/btDeformableContactConstraint.cpp",
# clew
- , "clew/clew.c"
-
+ "clew/clew.c",
# LinearMath
- , "LinearMath/btAlignedAllocator.cpp"
- , "LinearMath/btConvexHull.cpp"
- , "LinearMath/btConvexHullComputer.cpp"
- , "LinearMath/btGeometryUtil.cpp"
- , "LinearMath/btPolarDecomposition.cpp"
- , "LinearMath/btQuickprof.cpp"
- , "LinearMath/btSerializer.cpp"
- , "LinearMath/btSerializer64.cpp"
- , "LinearMath/btThreads.cpp"
- , "LinearMath/btVector3.cpp"
- , "LinearMath/TaskScheduler/btTaskScheduler.cpp"
- , "LinearMath/TaskScheduler/btThreadSupportPosix.cpp"
- , "LinearMath/TaskScheduler/btThreadSupportWin32.cpp"
+ "LinearMath/btAlignedAllocator.cpp",
+ "LinearMath/btConvexHull.cpp",
+ "LinearMath/btConvexHullComputer.cpp",
+ "LinearMath/btGeometryUtil.cpp",
+ "LinearMath/btPolarDecomposition.cpp",
+ "LinearMath/btQuickprof.cpp",
+ "LinearMath/btSerializer.cpp",
+ "LinearMath/btSerializer64.cpp",
+ "LinearMath/btThreads.cpp",
+ "LinearMath/btVector3.cpp",
+ "LinearMath/TaskScheduler/btTaskScheduler.cpp",
+ "LinearMath/TaskScheduler/btThreadSupportPosix.cpp",
+ "LinearMath/TaskScheduler/btThreadSupportWin32.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in bullet2_src]
# Treat Bullet headers as system headers to avoid raising warnings. Not supported on MSVC.
if not env.msvc:
- env_bullet.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path])
+ env_bullet.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path])
else:
env_bullet.Prepend(CPPPATH=[thirdparty_dir])
# if env['target'] == "debug" or env['target'] == "release_debug":
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index 56977d4451..0272350510 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -65,7 +65,7 @@ public:
OverlapState state;
OverlappingObjectData() :
- object(NULL),
+ object(nullptr),
state(OVERLAP_STATE_ENTER) {}
OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) :
object(p_object),
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index 4071723a3e..0f54f848dc 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -43,6 +43,7 @@ btRayShape::btRayShape(btScalar length) :
m_shapeAxis(0, 0, 1) {
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
setLength(length);
+ slipsOnSlope = false;
}
btRayShape::~btRayShape() {
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 5b3fe1bfac..2705c749a2 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -86,7 +86,7 @@ BulletPhysicsServer3D::BulletPhysicsServer3D() :
BulletPhysicsServer3D::~BulletPhysicsServer3D() {}
RID BulletPhysicsServer3D::shape_create(ShapeType p_shape) {
- ShapeBullet *shape = NULL;
+ ShapeBullet *shape = nullptr;
switch (p_shape) {
case SHAPE_PLANE: {
@@ -216,7 +216,7 @@ real_t BulletPhysicsServer3D::space_get_param(RID p_space, SpaceParameter p_para
PhysicsDirectSpaceState3D *BulletPhysicsServer3D::space_get_direct_state(RID p_space) {
SpaceBullet *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, NULL);
+ ERR_FAIL_COND_V(!space, nullptr);
return space->get_direct_state();
}
@@ -252,7 +252,7 @@ RID BulletPhysicsServer3D::area_create() {
void BulletPhysicsServer3D::area_set_space(RID p_area, RID p_space) {
AreaBullet *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
- SpaceBullet *space = NULL;
+ SpaceBullet *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -463,7 +463,7 @@ RID BulletPhysicsServer3D::body_create(BodyMode p_mode, bool p_init_sleeping) {
void BulletPhysicsServer3D::body_set_space(RID p_body, RID p_space) {
RigidBodyBullet *body = rigid_body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
- SpaceBullet *space = NULL;
+ SpaceBullet *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
@@ -861,8 +861,8 @@ bool BulletPhysicsServer3D::body_is_ray_pickable(RID p_body) const {
PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_body) {
RigidBodyBullet *body = rigid_body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, NULL);
- return BulletPhysicsDirectBodyState::get_singleton(body);
+ ERR_FAIL_COND_V(!body, nullptr);
+ return BulletPhysicsDirectBodyState3D::get_singleton(body);
}
bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) {
@@ -900,7 +900,7 @@ void BulletPhysicsServer3D::soft_body_update_rendering_server(RID p_body, class
void BulletPhysicsServer3D::soft_body_set_space(RID p_body, RID p_space) {
SoftBodyBullet *body = soft_body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
- SpaceBullet *space = NULL;
+ SpaceBullet *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
@@ -1214,7 +1214,7 @@ RID BulletPhysicsServer3D::joint_create_pin(RID p_body_A, const Vector3 &p_local
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1282,7 +1282,7 @@ RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform &p_h
ERR_FAIL_COND_V(!body_A, RID());
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1302,7 +1302,7 @@ RID BulletPhysicsServer3D::joint_create_hinge_simple(RID p_body_A, const Vector3
ERR_FAIL_COND_V(!body_A, RID());
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1354,7 +1354,7 @@ RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform &p_
ERR_FAIL_COND_V(!body_A, RID());
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1390,7 +1390,7 @@ RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform
ERR_FAIL_COND_V(!body_A, RID());
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1424,7 +1424,7 @@ RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transfo
ERR_FAIL_COND_V(!body_A, RID());
JointAssertSpace(body_A, "A", RID());
- RigidBodyBullet *body_B = NULL;
+ RigidBodyBullet *body_B = nullptr;
if (p_body_B.is_valid()) {
body_B = rigid_body_owner.getornull(p_body_B);
JointAssertSpace(body_B, "B", RID());
@@ -1503,7 +1503,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
RigidBodyBullet *body = rigid_body_owner.getornull(p_rid);
- body->set_space(NULL);
+ body->set_space(nullptr);
body->remove_all_shapes(true, true);
@@ -1514,7 +1514,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
SoftBodyBullet *body = soft_body_owner.getornull(p_rid);
- body->set_space(NULL);
+ body->set_space(nullptr);
soft_body_owner.free(p_rid);
bulletdelete(body);
@@ -1523,7 +1523,7 @@ void BulletPhysicsServer3D::free(RID p_rid) {
AreaBullet *area = area_owner.getornull(p_rid);
- area->set_space(NULL);
+ area->set_space(nullptr);
area->remove_all_shapes(true, true);
@@ -1553,14 +1553,14 @@ void BulletPhysicsServer3D::free(RID p_rid) {
}
void BulletPhysicsServer3D::init() {
- BulletPhysicsDirectBodyState::initSingleton();
+ BulletPhysicsDirectBodyState3D::initSingleton();
}
void BulletPhysicsServer3D::step(float p_deltaTime) {
if (!active)
return;
- BulletPhysicsDirectBodyState::singleton_setDeltaTime(p_deltaTime);
+ BulletPhysicsDirectBodyState3D::singleton_setDeltaTime(p_deltaTime);
for (int i = 0; i < active_spaces_count; ++i) {
@@ -1575,7 +1575,7 @@ void BulletPhysicsServer3D::flush_queries() {
}
void BulletPhysicsServer3D::finish() {
- BulletPhysicsDirectBodyState::destroySingleton();
+ BulletPhysicsDirectBodyState3D::destroySingleton();
}
int BulletPhysicsServer3D::get_process_info(ProcessInfo p_info) {
@@ -1592,7 +1592,7 @@ CollisionObjectBullet *BulletPhysicsServer3D::get_collisin_object(RID p_object)
if (soft_body_owner.owns(p_object)) {
return soft_body_owner.getornull(p_object);
}
- return NULL;
+ return nullptr;
}
RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID p_object) const {
@@ -1602,5 +1602,5 @@ RigidCollisionObjectBullet *BulletPhysicsServer3D::get_rigid_collisin_object(RID
if (area_owner.owns(p_object)) {
return area_owner.getornull(p_object);
}
- return NULL;
+ return nullptr;
}
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index 1269dac78b..ea9c5e589e 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -254,7 +254,7 @@ public:
// this function only works on physics process, errors and returns null otherwise
virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body);
- virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
+ virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true);
virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
/* SOFT BODY API */
diff --git a/modules/bullet/bullet_utilities.h b/modules/bullet/bullet_utilities.h
index 968cb38ba2..a5e33d9829 100644
--- a/modules/bullet/bullet_utilities.h
+++ b/modules/bullet/bullet_utilities.h
@@ -41,6 +41,6 @@
#define bulletdelete(cl) \
{ \
delete cl; \
- cl = NULL; \
+ cl = nullptr; \
}
#endif
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index 0ce57811d7..1b72c2f577 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -96,10 +96,10 @@ CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
collisionsEnabled(true),
m_isStatic(false),
ray_pickable(false),
- bt_collision_object(NULL),
+ bt_collision_object(nullptr),
body_scale(1., 1., 1.),
force_shape_reset(false),
- space(NULL),
+ space(nullptr),
isTransformChanged(false) {}
CollisionObjectBullet::~CollisionObjectBullet() {
@@ -227,7 +227,7 @@ void CollisionObjectBullet::notify_transform_changed() {
RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) :
CollisionObjectBullet(p_type),
- mainShape(NULL) {
+ mainShape(nullptr) {
}
RigidCollisionObjectBullet::~RigidCollisionObjectBullet() {
@@ -332,7 +332,7 @@ bool RigidCollisionObjectBullet::is_shape_disabled(int p_index) {
void RigidCollisionObjectBullet::shape_changed(int p_shape_index) {
ShapeWrapper &shp = shapes.write[p_shape_index];
if (shp.bt_shape == mainShape) {
- mainShape = NULL;
+ mainShape = nullptr;
}
bulletdelete(shp.bt_shape);
reload_shapes();
@@ -345,7 +345,7 @@ void RigidCollisionObjectBullet::reload_shapes() {
bulletdelete(mainShape);
}
- mainShape = NULL;
+ mainShape = nullptr;
ShapeWrapper *shpWrapper;
const int shape_count = shapes.size();
@@ -398,7 +398,7 @@ void RigidCollisionObjectBullet::internal_shape_destroy(int p_index, bool p_perm
ShapeWrapper &shp = shapes.write[p_index];
shp.shape->remove_owner(this, p_permanentlyFromThisBody);
if (shp.bt_shape == mainShape) {
- mainShape = NULL;
+ mainShape = nullptr;
}
bulletdelete(shp.bt_shape);
}
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index 42ba4aa907..25176458a7 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -76,20 +76,20 @@ public:
bool active;
ShapeWrapper() :
- shape(NULL),
- bt_shape(NULL),
+ shape(nullptr),
+ bt_shape(nullptr),
active(true) {}
ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) :
shape(p_shape),
- bt_shape(NULL),
+ bt_shape(nullptr),
active(p_active) {
set_transform(p_transform);
}
ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) :
shape(p_shape),
- bt_shape(NULL),
+ bt_shape(nullptr),
active(p_active) {
set_transform(p_transform);
}
diff --git a/modules/bullet/config.py b/modules/bullet/config.py
index 92dbcf5cb0..e8ca273f61 100644
--- a/modules/bullet/config.py
+++ b/modules/bullet/config.py
@@ -1,14 +1,17 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
- "BulletPhysicsDirectBodyState",
- "BulletPhysicsServer",
+ "BulletPhysicsDirectBodyState3D",
+ "BulletPhysicsServer3D",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp
index 7e90e2b488..469b58521e 100644
--- a/modules/bullet/constraint_bullet.cpp
+++ b/modules/bullet/constraint_bullet.cpp
@@ -38,8 +38,8 @@
*/
ConstraintBullet::ConstraintBullet() :
- space(NULL),
- constraint(NULL),
+ space(nullptr),
+ constraint(nullptr),
disabled_collisions_between_bodies(true) {}
void ConstraintBullet::setup(btTypedConstraint *p_constraint) {
diff --git a/modules/bullet/constraint_bullet.h b/modules/bullet/constraint_bullet.h
index 89ad150257..1946807bad 100644
--- a/modules/bullet/constraint_bullet.h
+++ b/modules/bullet/constraint_bullet.h
@@ -64,7 +64,7 @@ public:
public:
virtual ~ConstraintBullet() {
bulletdelete(constraint);
- constraint = NULL;
+ constraint = nullptr;
}
_FORCE_INLINE_ btTypedConstraint *get_bt_constraint() { return constraint; }
diff --git a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState3D.xml
index 5ea1b810a1..1c0181bd9c 100644
--- a/modules/bullet/doc_classes/BulletPhysicsDirectBodyState.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsDirectBodyState3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsDirectBodyState" inherits="PhysicsDirectBodyState" version="4.0">
+<class name="BulletPhysicsDirectBodyState3D" inherits="PhysicsDirectBodyState3D" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/doc_classes/BulletPhysicsServer.xml b/modules/bullet/doc_classes/BulletPhysicsServer3D.xml
index af8fb3c02c..b20595b4f6 100644
--- a/modules/bullet/doc_classes/BulletPhysicsServer.xml
+++ b/modules/bullet/doc_classes/BulletPhysicsServer3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="BulletPhysicsServer" inherits="PhysicsServer" version="4.0">
+<class name="BulletPhysicsServer3D" inherits="PhysicsServer3D" version="4.0">
<brief_description>
</brief_description>
<description>
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index a6a01ebaa8..638944df76 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -43,6 +43,12 @@
Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) :
JointBullet() {
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < PhysicsServer3D::G6DOF_JOINT_FLAG_MAX; j++) {
+ flags[i][j] = false;
+ }
+ }
+
Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp
index f3e3a01a52..8e29845a36 100644
--- a/modules/bullet/godot_collision_configuration.cpp
+++ b/modules/bullet/godot_collision_configuration.cpp
@@ -42,7 +42,7 @@
GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
btDefaultCollisionConfiguration(constructionInfo) {
- void *mem = NULL;
+ void *mem = nullptr;
mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16);
m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world);
@@ -98,7 +98,7 @@ btCollisionAlgorithmCreateFunc *GodotCollisionConfiguration::getClosestPointsAlg
GodotSoftCollisionConfiguration::GodotSoftCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
btSoftBodyRigidBodyCollisionConfiguration(constructionInfo) {
- void *mem = NULL;
+ void *mem = nullptr;
mem = btAlignedAlloc(sizeof(GodotRayWorldAlgorithm::CreateFunc), 16);
m_rayWorldCF = new (mem) GodotRayWorldAlgorithm::CreateFunc(world);
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index ad054e3027..ad20a7e451 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -112,7 +112,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
result.rid = gObj->get_self();
result.collider_id = gObj->get_instance_id();
- result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
+ result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id);
++count;
return 1; // not used by bullet
@@ -220,7 +220,7 @@ btScalar GodotAllContactResultCallback::addSingleResult(btManifoldPoint &cp, con
}
result.collider_id = colObj->get_instance_id();
- result.collider = result.collider_id.is_null() ? NULL : ObjectDB::get_instance(result.collider_id);
+ result.collider = result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(result.collider_id);
result.rid = colObj->get_self();
++m_count;
}
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp
index eaac1d650d..4bea9f87c0 100644
--- a/modules/bullet/hinge_joint_bullet.cpp
+++ b/modules/bullet/hinge_joint_bullet.cpp
@@ -96,7 +96,7 @@ real_t HingeJointBullet::get_hinge_angle() {
void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_t p_value) {
switch (p_param) {
case PhysicsServer3D::HINGE_JOINT_BIAS:
- WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated.");
+ WARN_DEPRECATED_MSG("The HingeJoint3D parameter \"bias\" is deprecated.");
break;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
hingeConstraint->setLimit(hingeConstraint->getLowerLimit(), p_value, hingeConstraint->getLimitSoftness(), hingeConstraint->getLimitBiasFactor(), hingeConstraint->getLimitRelaxationFactor());
@@ -128,7 +128,7 @@ void HingeJointBullet::set_param(PhysicsServer3D::HingeJointParam p_param, real_
real_t HingeJointBullet::get_param(PhysicsServer3D::HingeJointParam p_param) const {
switch (p_param) {
case PhysicsServer3D::HINGE_JOINT_BIAS:
- WARN_DEPRECATED_MSG("The HingeJoint parameter \"bias\" is deprecated.");
+ WARN_DEPRECATED_MSG("The HingeJoint3D parameter \"bias\" is deprecated.");
return 0;
case PhysicsServer3D::HINGE_JOINT_LIMIT_UPPER:
return hingeConstraint->getUpperLimit();
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index b92166e653..fc4e1d57de 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -48,141 +48,141 @@
@author AndreaCatania
*/
-BulletPhysicsDirectBodyState *BulletPhysicsDirectBodyState::singleton = NULL;
+BulletPhysicsDirectBodyState3D *BulletPhysicsDirectBodyState3D::singleton = nullptr;
-Vector3 BulletPhysicsDirectBodyState::get_total_gravity() const {
+Vector3 BulletPhysicsDirectBodyState3D::get_total_gravity() const {
Vector3 gVec;
B_TO_G(body->btBody->getGravity(), gVec);
return gVec;
}
-float BulletPhysicsDirectBodyState::get_total_angular_damp() const {
+float BulletPhysicsDirectBodyState3D::get_total_angular_damp() const {
return body->btBody->getAngularDamping();
}
-float BulletPhysicsDirectBodyState::get_total_linear_damp() const {
+float BulletPhysicsDirectBodyState3D::get_total_linear_damp() const {
return body->btBody->getLinearDamping();
}
-Vector3 BulletPhysicsDirectBodyState::get_center_of_mass() const {
+Vector3 BulletPhysicsDirectBodyState3D::get_center_of_mass() const {
Vector3 gVec;
B_TO_G(body->btBody->getCenterOfMassPosition(), gVec);
return gVec;
}
-Basis BulletPhysicsDirectBodyState::get_principal_inertia_axes() const {
+Basis BulletPhysicsDirectBodyState3D::get_principal_inertia_axes() const {
return Basis();
}
-float BulletPhysicsDirectBodyState::get_inverse_mass() const {
+float BulletPhysicsDirectBodyState3D::get_inverse_mass() const {
return body->btBody->getInvMass();
}
-Vector3 BulletPhysicsDirectBodyState::get_inverse_inertia() const {
+Vector3 BulletPhysicsDirectBodyState3D::get_inverse_inertia() const {
Vector3 gVec;
B_TO_G(body->btBody->getInvInertiaDiagLocal(), gVec);
return gVec;
}
-Basis BulletPhysicsDirectBodyState::get_inverse_inertia_tensor() const {
+Basis BulletPhysicsDirectBodyState3D::get_inverse_inertia_tensor() const {
Basis gInertia;
B_TO_G(body->btBody->getInvInertiaTensorWorld(), gInertia);
return gInertia;
}
-void BulletPhysicsDirectBodyState::set_linear_velocity(const Vector3 &p_velocity) {
+void BulletPhysicsDirectBodyState3D::set_linear_velocity(const Vector3 &p_velocity) {
body->set_linear_velocity(p_velocity);
}
-Vector3 BulletPhysicsDirectBodyState::get_linear_velocity() const {
+Vector3 BulletPhysicsDirectBodyState3D::get_linear_velocity() const {
return body->get_linear_velocity();
}
-void BulletPhysicsDirectBodyState::set_angular_velocity(const Vector3 &p_velocity) {
+void BulletPhysicsDirectBodyState3D::set_angular_velocity(const Vector3 &p_velocity) {
body->set_angular_velocity(p_velocity);
}
-Vector3 BulletPhysicsDirectBodyState::get_angular_velocity() const {
+Vector3 BulletPhysicsDirectBodyState3D::get_angular_velocity() const {
return body->get_angular_velocity();
}
-void BulletPhysicsDirectBodyState::set_transform(const Transform &p_transform) {
+void BulletPhysicsDirectBodyState3D::set_transform(const Transform &p_transform) {
body->set_transform(p_transform);
}
-Transform BulletPhysicsDirectBodyState::get_transform() const {
+Transform BulletPhysicsDirectBodyState3D::get_transform() const {
return body->get_transform();
}
-void BulletPhysicsDirectBodyState::add_central_force(const Vector3 &p_force) {
+void BulletPhysicsDirectBodyState3D::add_central_force(const Vector3 &p_force) {
body->apply_central_force(p_force);
}
-void BulletPhysicsDirectBodyState::add_force(const Vector3 &p_force, const Vector3 &p_pos) {
+void BulletPhysicsDirectBodyState3D::add_force(const Vector3 &p_force, const Vector3 &p_pos) {
body->apply_force(p_force, p_pos);
}
-void BulletPhysicsDirectBodyState::add_torque(const Vector3 &p_torque) {
+void BulletPhysicsDirectBodyState3D::add_torque(const Vector3 &p_torque) {
body->apply_torque(p_torque);
}
-void BulletPhysicsDirectBodyState::apply_central_impulse(const Vector3 &p_impulse) {
+void BulletPhysicsDirectBodyState3D::apply_central_impulse(const Vector3 &p_impulse) {
body->apply_central_impulse(p_impulse);
}
-void BulletPhysicsDirectBodyState::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
+void BulletPhysicsDirectBodyState3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
body->apply_impulse(p_pos, p_impulse);
}
-void BulletPhysicsDirectBodyState::apply_torque_impulse(const Vector3 &p_impulse) {
+void BulletPhysicsDirectBodyState3D::apply_torque_impulse(const Vector3 &p_impulse) {
body->apply_torque_impulse(p_impulse);
}
-void BulletPhysicsDirectBodyState::set_sleep_state(bool p_enable) {
+void BulletPhysicsDirectBodyState3D::set_sleep_state(bool p_enable) {
body->set_activation_state(p_enable);
}
-bool BulletPhysicsDirectBodyState::is_sleeping() const {
+bool BulletPhysicsDirectBodyState3D::is_sleeping() const {
return !body->is_active();
}
-int BulletPhysicsDirectBodyState::get_contact_count() const {
+int BulletPhysicsDirectBodyState3D::get_contact_count() const {
return body->collisionsCount;
}
-Vector3 BulletPhysicsDirectBodyState::get_contact_local_position(int p_contact_idx) const {
+Vector3 BulletPhysicsDirectBodyState3D::get_contact_local_position(int p_contact_idx) const {
return body->collisions[p_contact_idx].hitLocalLocation;
}
-Vector3 BulletPhysicsDirectBodyState::get_contact_local_normal(int p_contact_idx) const {
+Vector3 BulletPhysicsDirectBodyState3D::get_contact_local_normal(int p_contact_idx) const {
return body->collisions[p_contact_idx].hitNormal;
}
-float BulletPhysicsDirectBodyState::get_contact_impulse(int p_contact_idx) const {
+float BulletPhysicsDirectBodyState3D::get_contact_impulse(int p_contact_idx) const {
return body->collisions[p_contact_idx].appliedImpulse;
}
-int BulletPhysicsDirectBodyState::get_contact_local_shape(int p_contact_idx) const {
+int BulletPhysicsDirectBodyState3D::get_contact_local_shape(int p_contact_idx) const {
return body->collisions[p_contact_idx].local_shape;
}
-RID BulletPhysicsDirectBodyState::get_contact_collider(int p_contact_idx) const {
+RID BulletPhysicsDirectBodyState3D::get_contact_collider(int p_contact_idx) const {
return body->collisions[p_contact_idx].otherObject->get_self();
}
-Vector3 BulletPhysicsDirectBodyState::get_contact_collider_position(int p_contact_idx) const {
+Vector3 BulletPhysicsDirectBodyState3D::get_contact_collider_position(int p_contact_idx) const {
return body->collisions[p_contact_idx].hitWorldLocation;
}
-ObjectID BulletPhysicsDirectBodyState::get_contact_collider_id(int p_contact_idx) const {
+ObjectID BulletPhysicsDirectBodyState3D::get_contact_collider_id(int p_contact_idx) const {
return body->collisions[p_contact_idx].otherObject->get_instance_id();
}
-int BulletPhysicsDirectBodyState::get_contact_collider_shape(int p_contact_idx) const {
+int BulletPhysicsDirectBodyState3D::get_contact_collider_shape(int p_contact_idx) const {
return body->collisions[p_contact_idx].other_object_shape;
}
-Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position(int p_contact_idx) const {
+Vector3 BulletPhysicsDirectBodyState3D::get_contact_collider_velocity_at_position(int p_contact_idx) const {
RigidBodyBullet::CollisionData &colDat = body->collisions.write[p_contact_idx];
btVector3 hitLocation;
@@ -194,7 +194,7 @@ Vector3 BulletPhysicsDirectBodyState::get_contact_collider_velocity_at_position(
return velocityAtPoint;
}
-PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState::get_space_state() {
+PhysicsDirectSpaceState3D *BulletPhysicsDirectBodyState3D::get_space_state() {
return body->get_space()->get_direct_state();
}
@@ -241,7 +241,7 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
} break;
default:
WARN_PRINT("This shape is not supported for kinematic collision.");
- shapes.write[i].shape = NULL;
+ shapes.write[i].shape = nullptr;
}
}
}
@@ -257,7 +257,7 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) {
RigidBodyBullet::RigidBodyBullet() :
RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
- kinematic_utilities(NULL),
+ kinematic_utilities(nullptr),
locked_axis(0),
mass(1),
gravity_scale(1),
@@ -274,13 +274,13 @@ RigidBodyBullet::RigidBodyBullet() :
countGravityPointSpaces(0),
isScratchedSpaceOverrideModificator(false),
previousActiveState(true),
- force_integration_callback(NULL) {
+ force_integration_callback(nullptr) {
godotMotionState = bulletnew(GodotMotionState(this));
// Initial properties
const btVector3 localInertia(0, 0, 0);
- btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, NULL, localInertia);
+ btRigidBody::btRigidBodyConstructionInfo cInfo(mass, godotMotionState, nullptr, localInertia);
btBody = bulletnew(btRigidBody(cInfo));
reload_shapes();
@@ -291,7 +291,7 @@ RigidBodyBullet::RigidBodyBullet() :
areasWhereIam.resize(maxAreasWhereIam);
for (int i = areasWhereIam.size() - 1; 0 <= i; --i) {
- areasWhereIam.write[i] = NULL;
+ areasWhereIam.write[i] = nullptr;
}
btBody->setSleepingThresholds(0.2, 0.2);
@@ -315,7 +315,7 @@ void RigidBodyBullet::init_kinematic_utilities() {
void RigidBodyBullet::destroy_kinematic_utilities() {
if (kinematic_utilities) {
memdelete(kinematic_utilities);
- kinematic_utilities = NULL;
+ kinematic_utilities = nullptr;
}
}
@@ -359,7 +359,7 @@ void RigidBodyBullet::dispatch_callbacks() {
if (omit_forces_integration)
btBody->clearForces();
- BulletPhysicsDirectBodyState *bodyDirect = BulletPhysicsDirectBodyState::get_singleton(this);
+ BulletPhysicsDirectBodyState3D *bodyDirect = BulletPhysicsDirectBodyState3D::get_singleton(this);
Variant variantBodyDirect = bodyDirect;
@@ -392,7 +392,7 @@ void RigidBodyBullet::set_force_integration_callback(ObjectID p_id, const String
if (force_integration_callback) {
memdelete(force_integration_callback);
- force_integration_callback = NULL;
+ force_integration_callback = nullptr;
}
if (p_id.is_valid()) {
@@ -847,7 +847,7 @@ void RigidBodyBullet::on_enter_area(AreaBullet *p_area) {
}
for (int i = 0; i < areaWhereIamCount; ++i) {
- if (NULL == areasWhereIam[i]) {
+ if (nullptr == areasWhereIam[i]) {
// This area has the highest priority
areasWhereIam.write[i] = p_area;
break;
@@ -894,7 +894,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
}
--areaWhereIamCount;
- areasWhereIam.write[areaWhereIamCount] = NULL; // Even if this is not required, I clear the last element to be safe
+ areasWhereIam.write[areaWhereIamCount] = nullptr; // Even if this is not required, I clear the last element to be safe
if (PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED != p_area->get_spOv_mode()) {
scratch_space_override_modificator();
}
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index bce3511282..95491b1e62 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -45,7 +45,7 @@ class AreaBullet;
class SpaceBullet;
class btRigidBody;
class GodotMotionState;
-class BulletPhysicsDirectBodyState;
+class BulletPhysicsDirectBodyState3D;
/// This class could be used in multi thread with few changes but currently
/// is set to be only in one single thread.
@@ -53,29 +53,29 @@ class BulletPhysicsDirectBodyState;
/// In the system there is only one object at a time that manage all bodies and is
/// created by BulletPhysicsServer3D and is held by the "singleton" variable of this class
/// Each time something require it, the body must be set again.
-class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState3D {
- GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState3D);
+class BulletPhysicsDirectBodyState3D : public PhysicsDirectBodyState3D {
+ GDCLASS(BulletPhysicsDirectBodyState3D, PhysicsDirectBodyState3D);
- static BulletPhysicsDirectBodyState *singleton;
+ static BulletPhysicsDirectBodyState3D *singleton;
public:
/// This class avoid the creation of more object of this class
static void initSingleton() {
if (!singleton) {
- singleton = memnew(BulletPhysicsDirectBodyState);
+ singleton = memnew(BulletPhysicsDirectBodyState3D);
}
}
static void destroySingleton() {
memdelete(singleton);
- singleton = NULL;
+ singleton = nullptr;
}
static void singleton_setDeltaTime(real_t p_deltaTime) {
singleton->deltaTime = p_deltaTime;
}
- static BulletPhysicsDirectBodyState *get_singleton(RigidBodyBullet *p_body) {
+ static BulletPhysicsDirectBodyState3D *get_singleton(RigidBodyBullet *p_body) {
singleton->body = p_body;
return singleton;
}
@@ -85,7 +85,7 @@ public:
real_t deltaTime;
private:
- BulletPhysicsDirectBodyState() {}
+ BulletPhysicsDirectBodyState3D() {}
public:
virtual Vector3 get_total_gravity() const;
@@ -166,7 +166,7 @@ public:
btTransform transform;
KinematicShape() :
- shape(NULL) {}
+ shape(nullptr) {}
bool is_active() const { return shape; }
};
@@ -187,7 +187,7 @@ public:
};
private:
- friend class BulletPhysicsDirectBodyState;
+ friend class BulletPhysicsDirectBodyState3D;
// This is required only for Kinematic movement
KinematicUtilities *kinematic_utilities;
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index 6b73525d10..8ac26a0fdb 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -138,7 +138,7 @@ btScaledBvhTriangleMeshShape *ShapeBullet::create_shape_concave(btBvhTriangleMes
if (p_mesh_shape) {
return bulletnew(btScaledBvhTriangleMeshShape(p_mesh_shape, p_local_scaling));
} else {
- return NULL;
+ return nullptr;
}
}
@@ -362,7 +362,7 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape(const btVector3 &p_i
ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
ShapeBullet(),
- meshShape(NULL) {}
+ meshShape(nullptr) {}
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
if (meshShape) {
@@ -425,7 +425,7 @@ void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) {
btGenerateInternalEdgeInfo(meshShape, triangleInfoMap);
}
} else {
- meshShape = NULL;
+ meshShape = nullptr;
ERR_PRINT("The faces count are 0, the mesh shape cannot be created");
}
notifyShapeChanged();
@@ -434,7 +434,7 @@ void ConcavePolygonShapeBullet::setup(Vector<Vector3> p_faces) {
btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
btCollisionShape *cs = ShapeBullet::create_shape_concave(meshShape);
if (!cs)
- // This is necessary since if 0 faces the creation of concave return NULL
+ // This is necessary since if 0 faces the creation of concave return null
cs = ShapeBullet::create_shape_empty();
cs->setLocalScaling(p_implicit_scale);
prepare(cs);
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp
index 2984bf9c2b..236bdc7c8a 100644
--- a/modules/bullet/soft_body_bullet.cpp
+++ b/modules/bullet/soft_body_bullet.cpp
@@ -37,7 +37,7 @@
SoftBodyBullet::SoftBodyBullet() :
CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY),
- bt_soft_body(NULL),
+ bt_soft_body(nullptr),
isScratched(false),
simulation_precision(5),
total_mass(1.),
@@ -144,7 +144,7 @@ void SoftBodyBullet::destroy_soft_body() {
}
destroyBulletCollisionObject();
- bt_soft_body = NULL;
+ bt_soft_body = nullptr;
}
void SoftBodyBullet::set_soft_transform(const Transform &p_transform) {
@@ -404,7 +404,7 @@ void SoftBodyBullet::setup_soft_body() {
// Soft body setup
setupBulletCollisionObject(bt_soft_body);
- bt_soft_body->m_worldInfo = NULL; // Remove fake world info
+ bt_soft_body->m_worldInfo = nullptr; // Remove fake world info
bt_soft_body->getCollisionShape()->setMargin(0.01);
bt_soft_body->setCollisionFlags(bt_soft_body->getCollisionFlags() & (~(btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT)));
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index c40a1500f0..1659664ff9 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -108,7 +108,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
r_result.shape = btResult.m_shapeId;
r_result.rid = gObj->get_self();
r_result.collider_id = gObj->get_instance_id();
- r_result.collider = r_result.collider_id.is_null() ? NULL : ObjectDB::get_instance(r_result.collider_id);
+ r_result.collider = r_result.collider_id.is_null() ? nullptr : ObjectDB::get_instance(r_result.collider_id);
} else {
WARN_PRINT("The raycast performed has hit a collision object that is not part of Godot scene, please check it.");
}
@@ -309,7 +309,7 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
btPointCollector result;
btGjkPairDetector gjk_pair_detector(&point_shape, convex_shape, space->gjk_simplex_solver, space->gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(input, result, 0);
+ gjk_pair_detector.getClosestPoints(input, result, nullptr);
if (out_distance > result.m_distance) {
out_distance = result.m_distance;
@@ -332,14 +332,14 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
}
SpaceBullet::SpaceBullet() :
- broadphase(NULL),
- collisionConfiguration(NULL),
- dispatcher(NULL),
- solver(NULL),
- dynamicsWorld(NULL),
- soft_body_world_info(NULL),
- ghostPairCallback(NULL),
- godotFilterCallback(NULL),
+ broadphase(nullptr),
+ collisionConfiguration(nullptr),
+ dispatcher(nullptr),
+ solver(nullptr),
+ dynamicsWorld(nullptr),
+ soft_body_world_info(nullptr),
+ ghostPairCallback(nullptr),
+ godotFilterCallback(nullptr),
gravityDirection(0, -1, 0),
gravityMagnitude(10),
contactDebugCount(0),
@@ -511,7 +511,7 @@ void SpaceBullet::remove_soft_body(SoftBodyBullet *p_body) {
if (is_using_soft_world()) {
if (p_body->get_bt_soft_body()) {
static_cast<btSoftRigidDynamicsWorld *>(dynamicsWorld)->removeSoftBody(p_body->get_bt_soft_body());
- p_body->get_bt_soft_body()->m_worldInfo = NULL;
+ p_body->get_bt_soft_body()->m_worldInfo = nullptr;
}
}
}
@@ -539,7 +539,7 @@ void SpaceBullet::remove_all_collision_objects() {
for (int i = dynamicsWorld->getNumCollisionObjects() - 1; 0 <= i; --i) {
btCollisionObject *btObj = dynamicsWorld->getCollisionObjectArray()[i];
CollisionObjectBullet *colObj = static_cast<CollisionObjectBullet *>(btObj->getUserPointer());
- colObj->set_space(NULL);
+ colObj->set_space(nullptr);
}
}
@@ -636,8 +636,8 @@ void SpaceBullet::destroy_world() {
/// The world elements (like: Collision Objects, Constraints, Shapes) are managed by godot
- dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(NULL);
- dynamicsWorld->getPairCache()->setOverlapFilterCallback(NULL);
+ dynamicsWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(nullptr);
+ dynamicsWorld->getPairCache()->setOverlapFilterCallback(nullptr);
bulletdelete(ghostPairCallback);
bulletdelete(godotFilterCallback);
@@ -645,7 +645,7 @@ void SpaceBullet::destroy_world() {
// Deallocate world
dynamicsWorld->~btDiscreteDynamicsWorld();
free(dynamicsWorld);
- dynamicsWorld = NULL;
+ dynamicsWorld = nullptr;
bulletdelete(solver);
bulletdelete(broadphase);
@@ -741,7 +741,7 @@ void SpaceBullet::check_ghost_overlaps() {
static_cast<btConvexShape *>(other_body_shape),
gjk_simplex_solver,
gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
+ gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr);
if (0 >= result.m_distance) {
hasOverlap = true;
@@ -750,10 +750,10 @@ void SpaceBullet::check_ghost_overlaps() {
} else {
- btCollisionObjectWrapper obA(NULL, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
- btCollisionObjectWrapper obB(NULL, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
+ btCollisionObjectWrapper obA(nullptr, area_shape, area->get_bt_ghost(), gjk_input.m_transformA, -1, y);
+ btCollisionObjectWrapper obB(nullptr, other_body_shape, otherObject->get_bt_collision_object(), gjk_input.m_transformB, -1, z);
- btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS);
if (!algorithm)
continue;
@@ -885,8 +885,8 @@ void SpaceBullet::update_gravity() {
#include "scene/3d/immediate_geometry.h"
-static ImmediateGeometry *motionVec(NULL);
-static ImmediateGeometry *normalLine(NULL);
+static ImmediateGeometry3D *motionVec(nullptr);
+static ImmediateGeometry3D *normalLine(nullptr);
static Ref<StandardMaterial3D> red_mat;
static Ref<StandardMaterial3D> blue_mat;
#endif
@@ -897,8 +897,8 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
/// Yes I know this is not good, but I've used it as fast debugging hack.
/// I'm leaving it here just for speedup the other eventual debugs
if (!normalLine) {
- motionVec = memnew(ImmediateGeometry);
- normalLine = memnew(ImmediateGeometry);
+ motionVec = memnew(ImmediateGeometry3D);
+ normalLine = memnew(ImmediateGeometry3D);
SceneTree::get_singleton()->get_current_scene()->add_child(motionVec);
SceneTree::get_singleton()->get_current_scene()->add_child(normalLine);
@@ -951,7 +951,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
Vector3 sup_line;
B_TO_G(body_safe_position.getOrigin(), sup_line);
motionVec->clear();
- motionVec->begin(Mesh::PRIMITIVE_LINES, NULL);
+ motionVec->begin(Mesh::PRIMITIVE_LINES, nullptr);
motionVec->add_vertex(sup_line);
motionVec->add_vertex(sup_line + p_motion * 10);
motionVec->end();
@@ -1028,7 +1028,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
Vector3 sup_line2;
B_TO_G(motion, sup_line2);
normalLine->clear();
- normalLine->begin(Mesh::PRIMITIVE_LINES, NULL);
+ normalLine->begin(Mesh::PRIMITIVE_LINES, nullptr);
normalLine->add_vertex(r_result->collision_point);
normalLine->add_vertex(r_result->collision_point + r_result->collision_normal * 10);
normalLine->end();
@@ -1124,7 +1124,7 @@ public:
if (cs->getNumChildShapes() > 1) {
const btDbvt *tree = cs->getDynamicAabbTree();
- ERR_FAIL_COND_V(tree == NULL, true);
+ ERR_FAIL_COND_V(tree == nullptr, true);
// Transform bounds into compound shape local space
const btTransform other_in_compound_space = co->getWorldTransform().inverse();
@@ -1275,7 +1275,7 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt
// Perform GJK test
btPointCollector result;
btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
+ gjk_pair_detector.getClosestPoints(gjk_input, result, nullptr);
if (0 > result.m_distance) {
// Has penetration
r_delta_recover_movement += result.m_normalOnBInWorld * (result.m_distance * -1 * p_recover_movement_scale);
@@ -1302,10 +1302,10 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC
btTransform tA(p_transformA);
- 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);
+ btCollisionObjectWrapper obA(nullptr, p_shapeA, p_objectA, tA, -1, p_shapeId_A);
+ btCollisionObjectWrapper obB(nullptr, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
- btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CONTACT_POINT_ALGORITHMS);
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, nullptr, BT_CONTACT_POINT_ALGORITHMS);
if (algorithm) {
GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
//discrete collision detection query
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index fce715b48d..f9a8c063fd 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -79,7 +79,7 @@ public:
virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false);
virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, float p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = NULL);
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr);
/// Returns the list of contacts pairs in this order: Local contact, other body contact
virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, float p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
@@ -201,17 +201,17 @@ private:
pointWorld(0, 0, 0),
penetration_distance(1e20),
other_compound_shape_index(0),
- other_collision_object(NULL),
+ other_collision_object(nullptr),
local_shape_most_recovered(0) {}
};
- bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
+ bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
/// This is an API that recover a kinematic object from penetration
/// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions
- bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
+ bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
/// This is an API that recover a kinematic object from penetration
/// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
- bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = NULL);
+ bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btScalar p_recover_movement_scale, btVector3 &r_delta_recover_movement, RecoverResult *r_recover_result = nullptr);
int add_separation_result(PhysicsServer3D::SeparationResult *r_results, const SpaceBullet::RecoverResult &p_recover_result, int p_shape_id, const btCollisionObject *p_other_object) const;
int recover_from_penetration_ray(RigidBodyBullet *p_body, const btTransform &p_body_position, btScalar p_recover_movement_scale, bool p_infinite_inertia, int p_result_max, btVector3 &r_delta_recover_movement, PhysicsServer3D::SeparationResult *r_results);
diff --git a/modules/camera/SCsub b/modules/camera/SCsub
index 23f031f06e..63c4e9fbab 100644
--- a/modules/camera/SCsub
+++ b/modules/camera/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_camera = env_modules.Clone()
@@ -10,7 +10,7 @@ if env["platform"] == "iphone":
modules_sources = []
env_camera.add_source_files(modules_sources, "register_types.cpp")
env_camera.add_source_files(modules_sources, "camera_ios.mm")
- mod_lib = env_modules.add_library('#bin/libgodot_camera_module' + env['LIBSUFFIX'], modules_sources)
+ mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)
elif env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
@@ -19,4 +19,3 @@ elif env["platform"] == "windows":
elif env["platform"] == "osx":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_osx.mm")
-
diff --git a/modules/camera/config.py b/modules/camera/config.py
index d308c04195..87d7542741 100644
--- a/modules/camera/config.py
+++ b/modules/camera/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return platform == 'iphone' or platform == 'osx' or platform == 'windows'
+ return platform == "iphone" or platform == "osx" or platform == "windows"
+
def configure(env):
pass
diff --git a/modules/csg/SCsub b/modules/csg/SCsub
index 57c504efd8..641a42c187 100644
--- a/modules/csg/SCsub
+++ b/modules/csg/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_csg = env_modules.Clone()
diff --git a/modules/csg/config.py b/modules/csg/config.py
index 38ccc66d91..9106cbceca 100644
--- a/modules/csg/config.py
+++ b/modules/csg/config.py
@@ -1,21 +1,24 @@
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",
+ "CSGBox3D",
+ "CSGCombiner3D",
+ "CSGCylinder3D",
+ "CSGMesh3D",
+ "CSGPolygon3D",
+ "CSGPrimitive3D",
+ "CSGShape3D",
+ "CSGSphere3D",
+ "CSGTorus3D",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 848b865efb..5557da3014 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -156,7 +156,7 @@ CSGBrush *CSGShape3D::_get_brush() {
if (brush) {
memdelete(brush);
}
- brush = NULL;
+ brush = nullptr;
CSGBrush *n = _build_brush();
@@ -427,7 +427,7 @@ void CSGShape3D::_update_shape() {
mkif.m_getPosition = mikktGetPosition;
mkif.m_getTexCoord = mikktGetTexCoord;
mkif.m_setTSpace = mikktSetTSpaceDefault;
- mkif.m_setTSpaceBasic = NULL;
+ mkif.m_setTSpaceBasic = nullptr;
SMikkTSpaceContext msc;
msc.m_pInterface = &mkif;
@@ -536,7 +536,7 @@ void CSGShape3D::_notification(int p_what) {
if (parent)
parent->_make_dirty();
- parent = NULL;
+ parent = nullptr;
if (use_collision && is_root_shape() && root_collision_instance.is_valid()) {
PhysicsServer3D::get_singleton()->free(root_collision_instance);
@@ -636,8 +636,8 @@ void CSGShape3D::_bind_methods() {
CSGShape3D::CSGShape3D() {
operation = OPERATION_UNION;
- parent = NULL;
- brush = NULL;
+ parent = nullptr;
+ brush = nullptr;
dirty = false;
snap = 0.001;
use_collision = false;
@@ -650,14 +650,14 @@ CSGShape3D::CSGShape3D() {
CSGShape3D::~CSGShape3D() {
if (brush) {
memdelete(brush);
- brush = NULL;
+ brush = nullptr;
}
}
//////////////////////////////////
CSGBrush *CSGCombiner3D::_build_brush() {
- return NULL; //does not build anything
+ return nullptr; //does not build anything
}
CSGCombiner3D::CSGCombiner3D() {
@@ -713,7 +713,7 @@ CSGPrimitive3D::CSGPrimitive3D() {
CSGBrush *CSGMesh3D::_build_brush() {
if (!mesh.is_valid())
- return NULL;
+ return nullptr;
Vector<Vector3> vertices;
Vector<bool> smooth;
@@ -731,7 +731,7 @@ CSGBrush *CSGMesh3D::_build_brush() {
if (arrays.size() == 0) {
_make_dirty();
- ERR_FAIL_COND_V(arrays.size() == 0, NULL);
+ ERR_FAIL_COND_V(arrays.size() == 0, nullptr);
}
Vector<Vector3> avertices = arrays[Mesh::ARRAY_VERTEX];
@@ -741,19 +741,15 @@ CSGBrush *CSGMesh3D::_build_brush() {
const Vector3 *vr = avertices.ptr();
Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL];
- const Vector3 *nr = NULL;
- bool nr_used = false;
+ const Vector3 *nr = nullptr;
if (anormals.size()) {
nr = anormals.ptr();
- nr_used = true;
}
Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV];
- const Vector2 *uvr = NULL;
- bool uvr_used = false;
+ const Vector2 *uvr = nullptr;
if (auvs.size()) {
uvr = auvs.ptr();
- uvr_used = true;
}
Ref<Material> mat;
@@ -789,10 +785,10 @@ CSGBrush *CSGMesh3D::_build_brush() {
for (int k = 0; k < 3; k++) {
int idx = ir[j + k];
vertex[k] = vr[idx];
- if (nr_used) {
+ if (nr) {
normal[k] = nr[idx];
}
- if (uvr_used) {
+ if (uvr) {
uv[k] = uvr[idx];
}
}
@@ -832,10 +828,10 @@ CSGBrush *CSGMesh3D::_build_brush() {
for (int k = 0; k < 3; k++) {
vertex[k] = vr[j + k];
- if (nr_used) {
+ if (nr) {
normal[k] = nr[j + k];
}
- if (uvr_used) {
+ if (uvr) {
uv[k] = uvr[j + k];
}
}
@@ -857,7 +853,7 @@ CSGBrush *CSGMesh3D::_build_brush() {
}
if (vertices.size() == 0)
- return NULL;
+ return nullptr;
return _create_brush_from_arrays(vertices, uvs, smooth, materials);
}
@@ -1539,7 +1535,7 @@ CSGBrush *CSGTorus3D::_build_brush() {
float max_radius = outer_radius;
if (min_radius == max_radius)
- return NULL; //sorry, can't
+ return nullptr; //sorry, can't
if (min_radius > max_radius) {
SWAP(min_radius, max_radius);
@@ -1764,7 +1760,7 @@ CSGBrush *CSGPolygon3D::_build_brush() {
// set our bounding box
if (polygon.size() < 3)
- return NULL;
+ return nullptr;
Vector<Point2> final_polygon = polygon;
@@ -1775,9 +1771,9 @@ CSGBrush *CSGPolygon3D::_build_brush() {
Vector<int> triangles = Geometry::triangulate_polygon(final_polygon);
if (triangles.size() < 3)
- return NULL;
+ return nullptr;
- Path3D *path = NULL;
+ Path3D *path = nullptr;
Ref<Curve3D> curve;
// get bounds for our polygon
@@ -1800,32 +1796,32 @@ CSGBrush *CSGPolygon3D::_build_brush() {
if (mode == MODE_PATH) {
if (!has_node(path_node))
- return NULL;
+ return nullptr;
Node *n = get_node(path_node);
if (!n)
- return NULL;
+ return nullptr;
path = Object::cast_to<Path3D>(n);
if (!path)
- return NULL;
+ return nullptr;
if (path != path_cache) {
if (path_cache) {
path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
- path_cache = NULL;
+ path_cache = nullptr;
}
path_cache = path;
path_cache->connect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
path_cache->connect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
- path_cache = NULL;
+ path_cache = nullptr;
}
curve = path->get_curve();
if (curve.is_null())
- return NULL;
+ return nullptr;
if (curve->get_baked_length() <= 0)
- return NULL;
+ return nullptr;
}
CSGBrush *brush = memnew(CSGBrush);
@@ -2236,7 +2232,7 @@ void CSGPolygon3D::_notification(int p_what) {
if (path_cache) {
path_cache->disconnect("tree_exited", callable_mp(this, &CSGPolygon3D::_path_exited));
path_cache->disconnect("curve_changed", callable_mp(this, &CSGPolygon3D::_path_changed));
- path_cache = NULL;
+ path_cache = nullptr;
}
}
}
@@ -2261,7 +2257,7 @@ void CSGPolygon3D::_path_changed() {
}
void CSGPolygon3D::_path_exited() {
- path_cache = NULL;
+ path_cache = nullptr;
}
void CSGPolygon3D::_bind_methods() {
@@ -2487,5 +2483,5 @@ CSGPolygon3D::CSGPolygon3D() {
path_local = false;
path_continuous_u = false;
path_joined = false;
- path_cache = NULL;
+ path_cache = nullptr;
}
diff --git a/modules/csg/doc_classes/CSGBox.xml b/modules/csg/doc_classes/CSGBox3D.xml
index e2f0f8488a..492bf68c44 100644
--- a/modules/csg/doc_classes/CSGBox.xml
+++ b/modules/csg/doc_classes/CSGBox3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGBox" inherits="CSGPrimitive" version="4.0">
+<class name="CSGBox3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
A CSG Box shape.
</brief_description>
diff --git a/modules/csg/doc_classes/CSGCombiner.xml b/modules/csg/doc_classes/CSGCombiner.xml
deleted file mode 100644
index ab95d3c3ee..0000000000
--- a/modules/csg/doc_classes/CSGCombiner.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGCombiner" inherits="CSGShape" version="4.0">
- <brief_description>
- A CSG node that allows you to combine other CSG modifiers.
- </brief_description>
- <description>
- For complex arrangements of shapes, it is sometimes needed to add structure to your CSG nodes. The CSGCombiner node allows you to create this structure. The node encapsulates the result of the CSG operations of its children. In this way, it is possible to do operations on one set of shapes that are children of one CSGCombiner node, and a set of separate operations on a second set of shapes that are children of a second CSGCombiner node, and then do an operation that takes the two end results as its input to create the final shape.
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/modules/csg/doc_classes/CSGCombiner3D.xml b/modules/csg/doc_classes/CSGCombiner3D.xml
new file mode 100644
index 0000000000..b55111eee4
--- /dev/null
+++ b/modules/csg/doc_classes/CSGCombiner3D.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="CSGCombiner3D" inherits="CSGShape3D" version="4.0">
+ <brief_description>
+ A CSG node that allows you to combine other CSG modifiers.
+ </brief_description>
+ <description>
+ For complex arrangements of shapes, it is sometimes needed to add structure to your CSG nodes. The CSGCombiner3D node allows you to create this structure. The node encapsulates the result of the CSG operations of its children. In this way, it is possible to do operations on one set of shapes that are children of one CSGCombiner3D node, and a set of separate operations on a second set of shapes that are children of a second CSGCombiner3D node, and then do an operation that takes the two end results as its input to create the final shape.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/csg/doc_classes/CSGCylinder.xml b/modules/csg/doc_classes/CSGCylinder3D.xml
index 2dd8c6a8d0..bfd2a5d5f2 100644
--- a/modules/csg/doc_classes/CSGCylinder.xml
+++ b/modules/csg/doc_classes/CSGCylinder3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGCylinder" inherits="CSGPrimitive" version="4.0">
+<class name="CSGCylinder3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
A CSG Cylinder shape.
</brief_description>
diff --git a/modules/csg/doc_classes/CSGMesh.xml b/modules/csg/doc_classes/CSGMesh3D.xml
index f1fe2c286b..1bab8f4ee9 100644
--- a/modules/csg/doc_classes/CSGMesh.xml
+++ b/modules/csg/doc_classes/CSGMesh3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGMesh" inherits="CSGPrimitive" version="4.0">
+<class name="CSGMesh3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
A CSG Mesh shape that uses a mesh resource.
</brief_description>
diff --git a/modules/csg/doc_classes/CSGPolygon.xml b/modules/csg/doc_classes/CSGPolygon3D.xml
index 02b2e8b03f..c55fa0983e 100644
--- a/modules/csg/doc_classes/CSGPolygon.xml
+++ b/modules/csg/doc_classes/CSGPolygon3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGPolygon" inherits="CSGPrimitive" version="4.0">
+<class name="CSGPolygon3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
Extrudes a 2D polygon shape to create a 3D mesh.
</brief_description>
@@ -17,7 +17,7 @@
<member name="material" type="Material" setter="set_material" getter="get_material">
Material to use for the resulting mesh.
</member>
- <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon.Mode" default="0">
+ <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="CSGPolygon3D.Mode" default="0">
Extrusion mode.
</member>
<member name="path_continuous_u" type="bool" setter="set_path_continuous_u" getter="is_path_continuous_u">
@@ -30,12 +30,12 @@
If [code]true[/code] the start and end of our path are joined together ensuring there is no seam when [member mode] is [constant MODE_PATH].
</member>
<member name="path_local" type="bool" setter="set_path_local" getter="is_path_local">
- If [code]false[/code] we extrude centered on our path, if [code]true[/code] we extrude in relation to the position of our CSGPolygon when [member mode] is [constant MODE_PATH].
+ If [code]false[/code] we extrude centered on our path, if [code]true[/code] we extrude in relation to the position of our CSGPolygon3D when [member mode] is [constant MODE_PATH].
</member>
<member name="path_node" type="NodePath" setter="set_path_node" getter="get_path_node">
- The [Shape] object containing the path along which we extrude when [member mode] is [constant MODE_PATH].
+ The [Shape3D] object containing the path along which we extrude when [member mode] is [constant MODE_PATH].
</member>
- <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon.PathRotation">
+ <member name="path_rotation" type="int" setter="set_path_rotation" getter="get_path_rotation" enum="CSGPolygon3D.PathRotation">
The method by which each slice is rotated along the path when [member mode] is [constant MODE_PATH].
</member>
<member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array( 0, 0, 0, 1, 1, 1, 1, 0 )">
@@ -53,13 +53,13 @@
</members>
<constants>
<constant name="MODE_DEPTH" value="0" enum="Mode">
- Shape is extruded to [member depth].
+ Shape3D is extruded to [member depth].
</constant>
<constant name="MODE_SPIN" value="1" enum="Mode">
- Shape is extruded by rotating it around an axis.
+ Shape3D is extruded by rotating it around an axis.
</constant>
<constant name="MODE_PATH" value="2" enum="Mode">
- Shape is extruded along a path set by a [Shape] set in [member path_node].
+ Shape3D is extruded along a path set by a [Shape3D] set in [member path_node].
</constant>
<constant name="PATH_ROTATION_POLYGON" value="0" enum="PathRotation">
Slice is not rotated.
diff --git a/modules/csg/doc_classes/CSGPrimitive.xml b/modules/csg/doc_classes/CSGPrimitive3D.xml
index ba395b7edd..31b7360fac 100644
--- a/modules/csg/doc_classes/CSGPrimitive.xml
+++ b/modules/csg/doc_classes/CSGPrimitive3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGPrimitive" inherits="CSGShape" version="4.0">
+<class name="CSGPrimitive3D" inherits="CSGShape3D" version="4.0">
<brief_description>
Base class for CSG primitives.
</brief_description>
diff --git a/modules/csg/doc_classes/CSGShape.xml b/modules/csg/doc_classes/CSGShape3D.xml
index 64a2fb1840..43ce988c30 100644
--- a/modules/csg/doc_classes/CSGShape.xml
+++ b/modules/csg/doc_classes/CSGShape3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGShape" inherits="GeometryInstance" version="4.0">
+<class name="CSGShape3D" inherits="GeometryInstance3D" version="4.0">
<brief_description>
The CSG base class.
</brief_description>
@@ -76,7 +76,7 @@
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
The physics layers this CSG shape scans for collisions.
</member>
- <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape.Operation" default="0">
+ <member name="operation" type="int" setter="set_operation" getter="get_operation" enum="CSGShape3D.Operation" default="0">
The operation that is performed on this shape. This is ignored for the first CSG child node as the operation is between this node and the previous child of this nodes parent.
</member>
<member name="snap" type="float" setter="set_snap" getter="get_snap" default="0.001">
diff --git a/modules/csg/doc_classes/CSGSphere.xml b/modules/csg/doc_classes/CSGSphere3D.xml
index 847cc63586..4d5b3be099 100644
--- a/modules/csg/doc_classes/CSGSphere.xml
+++ b/modules/csg/doc_classes/CSGSphere3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGSphere" inherits="CSGPrimitive" version="4.0">
+<class name="CSGSphere3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
A CSG Sphere shape.
</brief_description>
diff --git a/modules/csg/doc_classes/CSGTorus.xml b/modules/csg/doc_classes/CSGTorus3D.xml
index 84a08edaf5..abe3eab913 100644
--- a/modules/csg/doc_classes/CSGTorus.xml
+++ b/modules/csg/doc_classes/CSGTorus3D.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="CSGTorus" inherits="CSGPrimitive" version="4.0">
+<class name="CSGTorus3D" inherits="CSGPrimitive3D" version="4.0">
<brief_description>
A CSG Torus shape.
</brief_description>
diff --git a/modules/csg/register_types.cpp b/modules/csg/register_types.cpp
index 1a12a6706d..40eef84b1b 100644
--- a/modules/csg/register_types.cpp
+++ b/modules/csg/register_types.cpp
@@ -47,15 +47,6 @@ void register_csg_types() {
ClassDB::register_class<CSGPolygon3D>();
ClassDB::register_class<CSGCombiner3D>();
- ClassDB::add_compatibility_class("CSGShape", "CSGShape3D");
- ClassDB::add_compatibility_class("CSGMesh", "CSGMesh3D");
- ClassDB::add_compatibility_class("CSGSphere", "CSGSphere3D");
- ClassDB::add_compatibility_class("CSGBox", "CSGBox3D");
- ClassDB::add_compatibility_class("CSGCylinder", "CSGCylinder3D");
- ClassDB::add_compatibility_class("CSGTorus", "CSGTorus3D");
- ClassDB::add_compatibility_class("CSGPolygon", "CSGPolygon3D");
- ClassDB::add_compatibility_class("CSGCombiner", "CSGCombiner3D");
-
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<EditorPluginCSG>();
#endif
diff --git a/modules/cvtt/SCsub b/modules/cvtt/SCsub
index 746b23ca28..5438f7ebac 100644
--- a/modules/cvtt/SCsub
+++ b/modules/cvtt/SCsub
@@ -1,14 +1,14 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_cvtt = env_modules.Clone()
# Thirdparty source files
thirdparty_dir = "#thirdparty/cvtt/"
thirdparty_sources = [
- "ConvectionKernels.cpp"
+ "ConvectionKernels.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
diff --git a/modules/cvtt/config.py b/modules/cvtt/config.py
index 098f1eafa9..53b8f2f2e3 100644
--- a/modules/cvtt/config.py
+++ b/modules/cvtt/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return env['tools']
+ return env["tools"]
+
def configure(env):
pass
diff --git a/modules/dds/SCsub b/modules/dds/SCsub
index 3d92ff02d6..06980bd670 100644
--- a/modules/dds/SCsub
+++ b/modules/dds/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_dds = env_modules.Clone()
diff --git a/modules/dds/config.py b/modules/dds/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/dds/config.py
+++ b/modules/dds/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index de8088af90..5b89f16277 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -36,7 +36,7 @@
class ResourceFormatDDS : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index 485c33b1a8..c8f4b3885e 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_enet = env_modules.Clone()
# Thirdparty source files
-if env['builtin_enet']:
+if env["builtin_enet"]:
thirdparty_dir = "#thirdparty/enet/"
thirdparty_sources = [
"godot.cpp",
diff --git a/modules/enet/config.py b/modules/enet/config.py
index 3e30bbe778..5fd343c75d 100644
--- a/modules/enet/config.py
+++ b/modules/enet/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"NetworkedMultiplayerENet",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 406eb467f0..444ffae713 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -154,7 +154,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
p_in_bandwidth /* limit incoming bandwidth if > 0 */,
p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
} else {
- host = enet_host_create(NULL /* create a client host */,
+ host = enet_host_create(nullptr /* 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 bandwidth if > 0 */,
@@ -197,7 +197,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
// Initiate connection, allocating enough channels
ENetPeer *peer = enet_host_connect(host, &address, channel_count, unique_id);
- if (peer == NULL) {
+ if (peer == nullptr) {
enet_host_destroy(host);
ERR_FAIL_COND_V_MSG(!peer, ERR_CANT_CREATE, "Couldn't connect to the ENet multiplayer server.");
}
@@ -276,12 +276,12 @@ void NetworkedMultiplayerENet::poll() {
if (E->key() == *new_id)
continue;
// Send existing peers to new peer
- ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
+ ENetPacket *packet = enet_packet_create(nullptr, 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
- packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
+ packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_ADD_PEER, &packet->data[0]);
encode_uint32(*new_id, &packet->data[4]);
enet_peer_send(E->get(), SYSCH_CONFIG, packet);
@@ -320,7 +320,7 @@ void NetworkedMultiplayerENet::poll() {
if (E->key() == *id)
continue;
- ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
+ ENetPacket *packet = enet_packet_create(nullptr, 8, ENET_PACKET_FLAG_RELIABLE);
encode_uint32(SYSMSG_REMOVE_PEER, &packet->data[0]);
encode_uint32(*id, &packet->data[4]);
enet_peer_send(E->get(), SYSCH_CONFIG, packet);
@@ -346,7 +346,7 @@ void NetworkedMultiplayerENet::poll() {
switch (msg) {
case SYSMSG_ADD_PEER: {
- peer_map[id] = NULL;
+ peer_map[id] = nullptr;
emit_signal("peer_connected", id);
} break;
@@ -502,7 +502,7 @@ void NetworkedMultiplayerENet::disconnect_peer(int p_peer, bool now) {
continue;
}
- ENetPacket *packet = enet_packet_create(NULL, 8, ENET_PACKET_FLAG_RELIABLE);
+ ENetPacket *packet = enet_packet_create(nullptr, 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);
@@ -568,7 +568,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
if (transfer_channel > SYSCH_CONFIG)
channel = transfer_channel;
- Map<int, ENetPeer *>::Element *E = NULL;
+ Map<int, ENetPeer *>::Element *E = nullptr;
if (target_peer != 0) {
@@ -576,7 +576,7 @@ Error NetworkedMultiplayerENet::put_packet(const uint8_t *p_buffer, int p_buffer
ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, vformat("Invalid target peer: %d", target_peer));
}
- ENetPacket *packet = enet_packet_create(NULL, p_buffer_size + 8, packet_flags);
+ ENetPacket *packet = enet_packet_create(nullptr, p_buffer_size + 8, packet_flags);
encode_uint32(unique_id, &packet->data[0]); // Source ID
encode_uint32(target_peer, &packet->data[4]); // Dest ID
copymem(&packet->data[8], p_buffer, p_buffer_size);
@@ -625,7 +625,7 @@ void NetworkedMultiplayerENet::_pop_current_packet() {
if (current_packet.packet) {
enet_packet_destroy(current_packet.packet);
- current_packet.packet = NULL;
+ current_packet.packet = nullptr;
current_packet.from = 0;
current_packet.channel = -1;
}
@@ -771,7 +771,7 @@ void NetworkedMultiplayerENet::_setup_compressor() {
case COMPRESS_NONE: {
- enet_host_compress(host, NULL);
+ enet_host_compress(host, nullptr);
} break;
case COMPRESS_RANGE_CODER: {
enet_host_compress_with_range_coder(host);
@@ -794,7 +794,7 @@ IP_Address NetworkedMultiplayerENet::get_peer_address(int p_peer_id) const {
ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), IP_Address(), vformat("Peer ID %d not found in the list of peers.", p_peer_id));
ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, IP_Address(), "Can't get the address of peers other than the server (ID -1) when acting as a client.");
- ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
+ ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, IP_Address(), vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
IP_Address out;
#ifdef GODOT_ENET
@@ -810,7 +810,7 @@ int NetworkedMultiplayerENet::get_peer_port(int p_peer_id) const {
ERR_FAIL_COND_V_MSG(!peer_map.has(p_peer_id), 0, vformat("Peer ID %d not found in the list of peers.", p_peer_id));
ERR_FAIL_COND_V_MSG(!is_server() && p_peer_id != 1, 0, "Can't get the address of peers other than the server (ID -1) when acting as a client.");
- ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == NULL, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
+ ERR_FAIL_COND_V_MSG(peer_map[p_peer_id] == nullptr, 0, vformat("Peer ID %d found in the list of peers, but is null.", p_peer_id));
#ifdef GODOT_ENET
return peer_map[p_peer_id]->address.port;
#else
@@ -910,7 +910,7 @@ NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
server_relay = true;
unique_id = 0;
target_peer = 0;
- current_packet.packet = NULL;
+ current_packet.packet = nullptr;
transfer_mode = TRANSFER_MODE_RELIABLE;
channel_count = SYSCH_MAX;
transfer_channel = -1;
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
index 1742d3534f..383bbf83c3 100644
--- a/modules/etc/SCsub
+++ b/modules/etc/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_etc = env_modules.Clone()
@@ -9,21 +9,21 @@ env_etc = env_modules.Clone()
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/etc2comp/"
thirdparty_sources = [
- "EtcBlock4x4.cpp",
- "EtcBlock4x4Encoding.cpp",
- "EtcBlock4x4Encoding_ETC1.cpp",
- "EtcBlock4x4Encoding_R11.cpp",
- "EtcBlock4x4Encoding_RG11.cpp",
- "EtcBlock4x4Encoding_RGB8A1.cpp",
- "EtcBlock4x4Encoding_RGB8.cpp",
- "EtcBlock4x4Encoding_RGBA8.cpp",
- "Etc.cpp",
- "EtcDifferentialTrys.cpp",
- "EtcFilter.cpp",
- "EtcImage.cpp",
- "EtcIndividualTrys.cpp",
- "EtcMath.cpp",
- "EtcSortedBlockList.cpp",
+ "EtcBlock4x4.cpp",
+ "EtcBlock4x4Encoding.cpp",
+ "EtcBlock4x4Encoding_ETC1.cpp",
+ "EtcBlock4x4Encoding_R11.cpp",
+ "EtcBlock4x4Encoding_RG11.cpp",
+ "EtcBlock4x4Encoding_RGB8A1.cpp",
+ "EtcBlock4x4Encoding_RGB8.cpp",
+ "EtcBlock4x4Encoding_RGBA8.cpp",
+ "Etc.cpp",
+ "EtcDifferentialTrys.cpp",
+ "EtcFilter.cpp",
+ "EtcImage.cpp",
+ "EtcIndividualTrys.cpp",
+ "EtcMath.cpp",
+ "EtcSortedBlockList.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
diff --git a/modules/etc/config.py b/modules/etc/config.py
index 098f1eafa9..53b8f2f2e3 100644
--- a/modules/etc/config.py
+++ b/modules/etc/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return env['tools']
+ return env["tools"]
+
def configure(env):
pass
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index b3f7b1d94f..223830f445 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -192,7 +192,7 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
src_rgba_f[j] = Etc::ColorFloatRGBA::ConvertFromRGBA8(src[si], src[si + 1], src[si + 2], src[si + 3]);
}
- unsigned char *etc_data = NULL;
+ unsigned char *etc_data = nullptr;
unsigned int etc_data_len = 0;
unsigned int extended_width = 0, extended_height = 0;
Etc::Encode((float *)src_rgba_f, mipmap_w, mipmap_h, etc2comp_etc_format, error_metric, effort, num_cpus, num_cpus, &etc_data, &etc_data_len, &extended_width, &extended_height, &encoding_time);
diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h
index d6011993e3..989e203994 100644
--- a/modules/etc/texture_loader_pkm.h
+++ b/modules/etc/texture_loader_pkm.h
@@ -36,7 +36,7 @@
class ResourceFormatPKM : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 9e1853c4cd..bfc1658bb4 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_freetype = env_modules.Clone()
# Thirdparty source files
-if env['builtin_freetype']:
+if env["builtin_freetype"]:
thirdparty_dir = "#thirdparty/freetype/"
thirdparty_sources = [
"src/autofit/autofit.c",
@@ -53,31 +53,31 @@ if env['builtin_freetype']:
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- if env['platform'] == 'uwp':
+ if env["platform"] == "uwp":
# Include header for UWP to fix build issues
- env_freetype.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
+ env_freetype.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"'])
# Globally too, as freetype is used in scene (see bottom)
- env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
+ env.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"'])
env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
# Also needed in main env for scene/
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
- env_freetype.Append(CPPDEFINES=['FT2_BUILD_LIBRARY', 'FT_CONFIG_OPTION_USE_PNG'])
- if (env['target'] == 'debug'):
- env_freetype.Append(CPPDEFINES=['ZLIB_DEBUG'])
+ env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG"])
+ if env["target"] == "debug":
+ env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
# Also requires libpng headers
- if env['builtin_libpng']:
+ if env["builtin_libpng"]:
env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
- sfnt = thirdparty_dir + 'src/sfnt/sfnt.c'
+ sfnt = thirdparty_dir + "src/sfnt/sfnt.c"
# Must be done after all CPPDEFINES are being set so we can copy them.
- if env['platform'] == 'javascript':
+ if env["platform"] == "javascript":
# Forcibly undefine this macro so SIMD is not used in this file,
# since currently unsupported in WASM
tmp_env = env_freetype.Clone()
- tmp_env.Append(CPPFLAGS=['-U__OPTIMIZE__'])
+ tmp_env.Append(CPPFLAGS=["-U__OPTIMIZE__"])
sfnt = tmp_env.Object(sfnt)
thirdparty_sources += [sfnt]
@@ -91,7 +91,7 @@ if env['builtin_freetype']:
# and then plain strings for system library. We insert between the two.
inserted = False
for idx, linklib in enumerate(env["LIBS"]):
- if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object
+ if isinstance(linklib, (str, bytes)): # first system lib such as "X11", otherwise SCons lib object
env["LIBS"].insert(idx, lib)
inserted = True
break
diff --git a/modules/freetype/config.py b/modules/freetype/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/freetype/config.py
+++ b/modules/freetype/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index a18c75fa27..a788175b07 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_gdnative = env_modules.Clone()
env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp")
@@ -12,9 +12,9 @@ env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
-env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
+env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"])
-Export('env_gdnative')
+Export("env_gdnative")
SConscript("net/SCsub")
SConscript("arvr/SCsub")
@@ -25,8 +25,11 @@ SConscript("videodecoder/SCsub")
from platform_methods import run_in_subprocess
import gdnative_builders
-_, gensource = env_gdnative.CommandNoCache(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
- 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_api_struct))
+_, gensource = env_gdnative.CommandNoCache(
+ ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"],
+ "gdnative_api.json",
+ run_in_subprocess(gdnative_builders.build_gdnative_api_struct),
+)
env_gdnative.add_source_files(env.modules_sources, [gensource])
env.use_ptrcall = True
diff --git a/modules/gdnative/android/android_gdn.cpp b/modules/gdnative/android/android_gdn.cpp
index 6e0358342f..bc39be1813 100644
--- a/modules/gdnative/android/android_gdn.cpp
+++ b/modules/gdnative/android/android_gdn.cpp
@@ -50,7 +50,7 @@ JNIEnv *GDAPI godot_android_get_env() {
#ifdef __ANDROID__
return ThreadAndroid::get_env();
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -59,7 +59,7 @@ jobject GDAPI godot_android_get_activity() {
OS_Android *os_android = (OS_Android *)OS::get_singleton();
return os_android->get_godot_java()->get_activity();
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -68,7 +68,7 @@ jobject GDAPI godot_android_get_surface() {
OS_Android *os_android = (OS_Android *)OS::get_singleton();
return os_android->get_godot_java()->get_surface();
#else
- return NULL;
+ return nullptr;
#endif
}
diff --git a/modules/gdnative/arvr/SCsub b/modules/gdnative/arvr/SCsub
index 20eaa99592..0b2db3b504 100644
--- a/modules/gdnative/arvr/SCsub
+++ b/modules/gdnative/arvr/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
-Import('env_gdnative')
+Import("env")
+Import("env_gdnative")
-env_gdnative.add_source_files(env.modules_sources, '*.cpp')
+env_gdnative.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index faa891e624..f14691027a 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -42,15 +42,15 @@ ARVRInterfaceGDNative::ARVRInterfaceGDNative() {
print_verbose("Construct gdnative interface\n");
// we won't have our data pointer until our library gets set
- data = NULL;
+ data = nullptr;
- interface = NULL;
+ interface = nullptr;
}
ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
print_verbose("Destruct gdnative interface\n");
- if (interface != NULL && is_initialized()) {
+ if (interface != nullptr && is_initialized()) {
uninitialize();
};
@@ -59,10 +59,10 @@ ARVRInterfaceGDNative::~ARVRInterfaceGDNative() {
}
void ARVRInterfaceGDNative::cleanup() {
- if (interface != NULL) {
+ if (interface != nullptr) {
interface->destructor(data);
- data = NULL;
- interface = NULL;
+ data = nullptr;
+ interface = nullptr;
}
}
@@ -81,7 +81,7 @@ void ARVRInterfaceGDNative::set_interface(const godot_arvr_interface_gdnative *p
StringName ARVRInterfaceGDNative::get_name() const {
- ERR_FAIL_COND_V(interface == NULL, StringName());
+ ERR_FAIL_COND_V(interface == nullptr, StringName());
godot_string result = interface->get_name(data);
@@ -95,7 +95,7 @@ StringName ARVRInterfaceGDNative::get_name() const {
int ARVRInterfaceGDNative::get_capabilities() const {
int capabilities;
- ERR_FAIL_COND_V(interface == NULL, 0); // 0 = None
+ ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None
capabilities = interface->get_capabilities(data);
@@ -104,21 +104,21 @@ int ARVRInterfaceGDNative::get_capabilities() const {
bool ARVRInterfaceGDNative::get_anchor_detection_is_enabled() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->get_anchor_detection_is_enabled(data);
}
void ARVRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->set_anchor_detection_is_enabled(data, p_enable);
}
int ARVRInterfaceGDNative::get_camera_feed_id() {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) {
return (unsigned int)interface->get_camera_feed_id(data);
@@ -130,7 +130,7 @@ int ARVRInterfaceGDNative::get_camera_feed_id() {
bool ARVRInterfaceGDNative::is_stereo() {
bool stereo;
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
stereo = interface->is_stereo(data);
@@ -139,13 +139,13 @@ bool ARVRInterfaceGDNative::is_stereo() {
bool ARVRInterfaceGDNative::is_initialized() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->is_initialized(data);
}
bool ARVRInterfaceGDNative::initialize() {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
bool initialized = interface->initialize(data);
@@ -153,7 +153,7 @@ bool ARVRInterfaceGDNative::initialize() {
// if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface
ARVRServer *arvr_server = ARVRServer::get_singleton();
- if ((arvr_server != NULL) && (arvr_server->get_primary_interface() == NULL)) {
+ if ((arvr_server != nullptr) && (arvr_server->get_primary_interface() == nullptr)) {
arvr_server->set_primary_interface(this);
};
};
@@ -162,10 +162,10 @@ bool ARVRInterfaceGDNative::initialize() {
}
void ARVRInterfaceGDNative::uninitialize() {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
ARVRServer *arvr_server = ARVRServer::get_singleton();
- if (arvr_server != NULL) {
+ if (arvr_server != nullptr) {
// Whatever happens, make sure this is no longer our primary interface
arvr_server->clear_primary_interface_if(this);
}
@@ -175,7 +175,7 @@ void ARVRInterfaceGDNative::uninitialize() {
Size2 ARVRInterfaceGDNative::get_render_targetsize() {
- ERR_FAIL_COND_V(interface == NULL, Size2());
+ ERR_FAIL_COND_V(interface == nullptr, Size2());
godot_vector2 result = interface->get_render_targetsize(data);
Vector2 *vec = (Vector2 *)&result;
@@ -186,7 +186,7 @@ Size2 ARVRInterfaceGDNative::get_render_targetsize() {
Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform) {
Transform *ret;
- ERR_FAIL_COND_V(interface == NULL, Transform());
+ ERR_FAIL_COND_V(interface == nullptr, Transform());
godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform);
@@ -198,7 +198,7 @@ Transform ARVRInterfaceGDNative::get_transform_for_eye(ARVRInterface::Eyes p_eye
CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) {
CameraMatrix cm;
- ERR_FAIL_COND_V(interface == NULL, CameraMatrix());
+ ERR_FAIL_COND_V(interface == nullptr, CameraMatrix());
interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far);
@@ -207,7 +207,7 @@ CameraMatrix ARVRInterfaceGDNative::get_projection_for_eye(ARVRInterface::Eyes p
unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::Eyes p_eye) {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
if ((interface->version.major > 1) || ((interface->version.major) == 1 && (interface->version.minor >= 1))) {
return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye);
@@ -218,19 +218,19 @@ unsigned int ARVRInterfaceGDNative::get_external_texture_for_eye(ARVRInterface::
void ARVRInterfaceGDNative::commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect);
}
void ARVRInterfaceGDNative::process() {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->process(data);
}
void ARVRInterfaceGDNative::notification(int p_what) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
// this is only available in interfaces that implement 1.1 or later
if ((interface->version.major > 1) || ((interface->version.major == 1) && (interface->version.minor > 0))) {
@@ -265,7 +265,7 @@ godot_transform GDAPI godot_arvr_get_reference_frame() {
Transform *reference_frame_ptr = (Transform *)&reference_frame;
ARVRServer *arvr_server = ARVRServer::get_singleton();
- if (arvr_server != NULL) {
+ if (arvr_server != nullptr) {
*reference_frame_ptr = arvr_server->get_reference_frame();
} else {
godot_transform_new_identity(&reference_frame);
@@ -360,7 +360,7 @@ void GDAPI godot_arvr_remove_controller(godot_int p_controller_id) {
ERR_FAIL_NULL(input);
ARVRPositionalTracker *remove_tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
- if (remove_tracker != NULL) {
+ if (remove_tracker != nullptr) {
// unset our joystick if applicable
int joyid = remove_tracker->get_joy_id();
if (joyid != -1) {
@@ -379,7 +379,7 @@ void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_
ERR_FAIL_NULL(arvr_server);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
Transform *transform = (Transform *)p_transform;
if (p_tracks_orientation) {
tracker->set_orientation(transform->basis);
@@ -398,7 +398,7 @@ void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int
ERR_FAIL_NULL(input);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
int joyid = tracker->get_joy_id();
if (joyid != -1) {
input->joy_button(joyid, p_button, p_is_pressed);
@@ -414,7 +414,7 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p
ERR_FAIL_NULL(input);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
int joyid = tracker->get_joy_id();
if (joyid != -1) {
InputFilter::JoyAxis jx;
@@ -430,7 +430,7 @@ godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) {
ERR_FAIL_NULL_V(arvr_server, 0.0);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
return tracker->get_rumble();
}
diff --git a/modules/gdnative/arvr/config.py b/modules/gdnative/arvr/config.py
index 53bc827027..d22f9454ed 100644
--- a/modules/gdnative/arvr/config.py
+++ b/modules/gdnative/arvr/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py
index b9e5afcdf3..37e25a46d4 100644
--- a/modules/gdnative/config.py
+++ b/modules/gdnative/config.py
@@ -1,9 +1,11 @@
def can_build(env, platform):
return True
+
def configure(env):
env.use_ptrcall = True
+
def get_doc_classes():
return [
"@NativeScript",
@@ -20,5 +22,6 @@ def get_doc_classes():
"WebRTCDataChannelGDNative",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 0457a42f30..d3426044ec 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -248,7 +248,7 @@ void GDNativeLibrary::_bind_methods() {
}
GDNative::GDNative() {
- native_handle = NULL;
+ native_handle = nullptr;
initialized = false;
}
@@ -338,7 +338,7 @@ bool GDNative::initialize() {
if (err || !library_init) {
OS::get_singleton()->close_dynamic_library(native_handle);
- native_handle = NULL;
+ native_handle = nullptr;
ERR_PRINT("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol");
return false;
}
@@ -408,7 +408,7 @@ bool GDNative::terminate() {
Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate);
if (error || !library_terminate) {
OS::get_singleton()->close_dynamic_library(native_handle);
- native_handle = NULL;
+ native_handle = nullptr;
initialized = false;
return true;
}
@@ -426,7 +426,7 @@ bool GDNative::terminate() {
// GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
OS::get_singleton()->close_dynamic_library(native_handle);
- native_handle = NULL;
+ native_handle = nullptr;
return true;
}
@@ -466,7 +466,7 @@ Variant GDNative::call_native(StringName p_native_call_type, StringName p_proced
p_procedure_name,
procedure_handle);
- if (err != OK || procedure_handle == NULL) {
+ if (err != OK || procedure_handle == nullptr) {
return Variant();
}
@@ -544,11 +544,11 @@ Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_reso
}
bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const {
- return Object::cast_to<GDNativeLibrary>(*p_resource) != NULL;
+ return Object::cast_to<GDNativeLibrary>(*p_resource) != nullptr;
}
void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
- if (Object::cast_to<GDNativeLibrary>(*p_resource) != NULL) {
+ if (Object::cast_to<GDNativeLibrary>(*p_resource) != nullptr) {
p_extensions->push_back("gdnlib");
}
}
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index d996b006a5..3175340448 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -95,7 +95,7 @@ godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classnam
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname));
if (class_info)
return (godot_class_constructor)class_info->creation_func;
- return NULL;
+ return nullptr;
}
godot_dictionary GDAPI godot_get_global_constants() {
@@ -173,14 +173,14 @@ godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) {
void *godot_get_class_tag(const godot_string_name *p_class) {
StringName class_name = *(StringName *)p_class;
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name);
- return class_info ? class_info->class_ptr : NULL;
+ return class_info ? class_info->class_ptr : nullptr;
}
godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) {
- if (!p_object) return NULL;
+ if (!p_object) return nullptr;
Object *o = (Object *)p_object;
- return o->is_class_ptr(p_class_tag) ? (godot_object *)o : NULL;
+ return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr;
}
#ifdef __cplusplus
diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py
index 0d95a65b7e..d0094fb869 100644
--- a/modules/gdnative/gdnative_builders.py
+++ b/modules/gdnative/gdnative_builders.py
@@ -8,209 +8,249 @@ from platform_methods import subprocess_main
def _spaced(e):
- return e if e[-1] == '*' else e + ' '
+ return e if e[-1] == "*" else e + " "
def _build_gdnative_api_struct_header(api):
out = [
- '/* THIS FILE IS GENERATED DO NOT EDIT */',
- '#ifndef GODOT_GDNATIVE_API_STRUCT_H',
- '#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 <net/godot_net.h>',
- '#include <pluginscript/godot_pluginscript.h>',
- '#include <videodecoder/godot_videodecoder.h>',
- '',
- '#ifdef __cplusplus',
+ "/* THIS FILE IS GENERATED DO NOT EDIT */",
+ "#ifndef GODOT_GDNATIVE_API_STRUCT_H",
+ "#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 <net/godot_net.h>",
+ "#include <pluginscript/godot_pluginscript.h>",
+ "#include <videodecoder/godot_videodecoder.h>",
+ "",
+ "#ifdef __cplusplus",
'extern "C" {',
- '#endif',
- '',
- 'enum GDNATIVE_API_TYPES {',
- '\tGDNATIVE_' + api['core']['type'] + ','
+ "#endif",
+ "",
+ "enum GDNATIVE_API_TYPES {",
+ "\tGDNATIVE_" + api["core"]["type"] + ",",
]
- for ext in api['extensions']:
- out += ['\tGDNATIVE_EXT_' + ext['type'] + ',']
+ for ext in api["extensions"]:
+ out += ["\tGDNATIVE_EXT_" + ext["type"] + ","]
- out += ['};', '']
+ out += ["};", ""]
def generate_extension_struct(name, ext, include_version=True):
ret_val = []
- if ext['next']:
- ret_val += generate_extension_struct(name, ext['next'])
+ if ext["next"]:
+ ret_val += generate_extension_struct(name, ext["next"])
ret_val += [
- 'typedef struct godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct {',
- '\tunsigned int type;',
- '\tgodot_gdnative_api_version version;',
- '\tconst godot_gdnative_api_struct *next;'
+ "typedef struct godot_gdnative_ext_"
+ + name
+ + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"])))
+ + "_api_struct {",
+ "\tunsigned int type;",
+ "\tgodot_gdnative_api_version version;",
+ "\tconst godot_gdnative_api_struct *next;",
]
- for funcdef in ext['api']:
- args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
- ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
+ for funcdef in ext["api"]:
+ args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]])
+ ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args))
- ret_val += ['} godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct;', '']
+ ret_val += [
+ "} godot_gdnative_ext_"
+ + name
+ + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"])))
+ + "_api_struct;",
+ "",
+ ]
return ret_val
-
def generate_core_extension_struct(core):
ret_val = []
- if core['next']:
- ret_val += generate_core_extension_struct(core['next'])
+ if core["next"]:
+ ret_val += generate_core_extension_struct(core["next"])
ret_val += [
- 'typedef struct godot_gdnative_core_' + ('{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + '_api_struct {',
- '\tunsigned int type;',
- '\tgodot_gdnative_api_version version;',
- '\tconst godot_gdnative_api_struct *next;',
+ "typedef struct godot_gdnative_core_"
+ + ("{0}_{1}".format(core["version"]["major"], core["version"]["minor"]))
+ + "_api_struct {",
+ "\tunsigned int type;",
+ "\tgodot_gdnative_api_version version;",
+ "\tconst godot_gdnative_api_struct *next;",
]
- for funcdef in core['api']:
- args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
- ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
+ for funcdef in core["api"]:
+ args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]])
+ ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args))
- ret_val += ['} godot_gdnative_core_' + '{0}_{1}'.format(core['version']['major'], core['version']['minor']) + '_api_struct;', '']
+ ret_val += [
+ "} godot_gdnative_core_"
+ + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"])
+ + "_api_struct;",
+ "",
+ ]
return ret_val
-
- for ext in api['extensions']:
- name = ext['name']
+ for ext in api["extensions"]:
+ name = ext["name"]
out += generate_extension_struct(name, ext, False)
- if api['core']['next']:
- out += generate_core_extension_struct(api['core']['next'])
+ if api["core"]["next"]:
+ out += generate_core_extension_struct(api["core"]["next"])
out += [
- 'typedef struct godot_gdnative_core_api_struct {',
- '\tunsigned int type;',
- '\tgodot_gdnative_api_version version;',
- '\tconst godot_gdnative_api_struct *next;',
- '\tunsigned int num_extensions;',
- '\tconst godot_gdnative_api_struct **extensions;',
+ "typedef struct godot_gdnative_core_api_struct {",
+ "\tunsigned int type;",
+ "\tgodot_gdnative_api_version version;",
+ "\tconst godot_gdnative_api_struct *next;",
+ "\tunsigned int num_extensions;",
+ "\tconst godot_gdnative_api_struct **extensions;",
]
- for funcdef in api['core']['api']:
- args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
- out.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args))
+ for funcdef in api["core"]["api"]:
+ args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]])
+ out.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args))
out += [
- '} godot_gdnative_core_api_struct;',
- '',
- '#ifdef __cplusplus',
- '}',
- '#endif',
- '',
- '#endif // GODOT_GDNATIVE_API_STRUCT_H',
- ''
+ "} godot_gdnative_core_api_struct;",
+ "",
+ "#ifdef __cplusplus",
+ "}",
+ "#endif",
+ "",
+ "#endif // GODOT_GDNATIVE_API_STRUCT_H",
+ "",
]
- return '\n'.join(out)
+ return "\n".join(out)
def _build_gdnative_api_struct_source(api):
- out = [
- '/* THIS FILE IS GENERATED DO NOT EDIT */',
- '',
- '#include <gdnative_api_struct.gen.h>',
- ''
- ]
+ out = ["/* THIS FILE IS GENERATED DO NOT EDIT */", "", "#include <gdnative_api_struct.gen.h>", ""]
def get_extension_struct_name(name, ext, include_version=True):
- return 'godot_gdnative_ext_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_api_struct'
+ return (
+ "godot_gdnative_ext_"
+ + name
+ + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"])))
+ + "_api_struct"
+ )
def get_extension_struct_instance_name(name, ext, include_version=True):
- return 'api_extension_' + name + ('' if not include_version else ('_{0}_{1}'.format(ext['version']['major'], ext['version']['minor']))) + '_struct'
+ return (
+ "api_extension_"
+ + name
+ + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"])))
+ + "_struct"
+ )
def get_extension_struct_definition(name, ext, include_version=True):
ret_val = []
- if ext['next']:
- ret_val += get_extension_struct_definition(name, ext['next'])
+ if ext["next"]:
+ ret_val += get_extension_struct_definition(name, ext["next"])
ret_val += [
- 'extern const ' + get_extension_struct_name(name, ext, include_version) + ' ' + get_extension_struct_instance_name(name, ext, include_version) + ' = {',
- '\tGDNATIVE_EXT_' + ext['type'] + ',',
- '\t{' + str(ext['version']['major']) + ', ' + str(ext['version']['minor']) + '},',
- '\t' + ('NULL' if not ext['next'] else ('(const godot_gdnative_api_struct *)&' + get_extension_struct_instance_name(name, ext['next']))) + ','
+ "extern const "
+ + get_extension_struct_name(name, ext, include_version)
+ + " "
+ + get_extension_struct_instance_name(name, ext, include_version)
+ + " = {",
+ "\tGDNATIVE_EXT_" + ext["type"] + ",",
+ "\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},",
+ "\t"
+ + (
+ "NULL"
+ if not ext["next"]
+ else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"]))
+ )
+ + ",",
]
- for funcdef in ext['api']:
- ret_val.append('\t%s,' % funcdef['name'])
+ for funcdef in ext["api"]:
+ ret_val.append("\t%s," % funcdef["name"])
- ret_val += ['};\n']
+ ret_val += ["};\n"]
return ret_val
-
def get_core_struct_definition(core):
ret_val = []
- if core['next']:
- ret_val += get_core_struct_definition(core['next'])
+ if core["next"]:
+ ret_val += get_core_struct_definition(core["next"])
ret_val += [
- 'extern const godot_gdnative_core_' + ('{0}_{1}_api_struct api_{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + ' = {',
- '\tGDNATIVE_' + core['type'] + ',',
- '\t{' + str(core['version']['major']) + ', ' + str(core['version']['minor']) + '},',
- '\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['next']['version']['major'], core['next']['version']['minor']))) + ','
+ "extern const godot_gdnative_core_"
+ + ("{0}_{1}_api_struct api_{0}_{1}".format(core["version"]["major"], core["version"]["minor"]))
+ + " = {",
+ "\tGDNATIVE_" + core["type"] + ",",
+ "\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},",
+ "\t"
+ + (
+ "NULL"
+ if not core["next"]
+ else (
+ "(const godot_gdnative_api_struct *)& api_{0}_{1}".format(
+ core["next"]["version"]["major"], core["next"]["version"]["minor"]
+ )
+ )
+ )
+ + ",",
]
- for funcdef in core['api']:
- ret_val.append('\t%s,' % funcdef['name'])
+ for funcdef in core["api"]:
+ ret_val.append("\t%s," % funcdef["name"])
- ret_val += ['};\n']
+ ret_val += ["};\n"]
return ret_val
- for ext in api['extensions']:
- name = ext['name']
+ 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[] = {']
+ out += ["", "const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {"]
- for ext in api['extensions']:
- name = ext['name']
- out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,']
+ for ext in api["extensions"]:
+ name = ext["name"]
+ out += ["\t(godot_gdnative_api_struct *)&api_extension_" + name + "_struct,"]
- out += ['};\n']
+ out += ["};\n"]
- if api['core']['next']:
- out += get_core_struct_definition(api['core']['next'])
+ if api["core"]["next"]:
+ out += get_core_struct_definition(api["core"]["next"])
out += [
- 'extern const godot_gdnative_core_api_struct api_struct = {',
- '\tGDNATIVE_' + api['core']['type'] + ',',
- '\t{' + str(api['core']['version']['major']) + ', ' + str(api['core']['version']['minor']) + '},',
- '\t(const godot_gdnative_api_struct *)&api_1_1,',
- '\t' + str(len(api['extensions'])) + ',',
- '\tgdnative_extensions_pointers,',
+ "extern const godot_gdnative_core_api_struct api_struct = {",
+ "\tGDNATIVE_" + api["core"]["type"] + ",",
+ "\t{" + str(api["core"]["version"]["major"]) + ", " + str(api["core"]["version"]["minor"]) + "},",
+ "\t(const godot_gdnative_api_struct *)&api_1_1,",
+ "\t" + str(len(api["extensions"])) + ",",
+ "\tgdnative_extensions_pointers,",
]
- for funcdef in api['core']['api']:
- out.append('\t%s,' % funcdef['name'])
- out.append('};\n')
+ for funcdef in api["core"]["api"]:
+ out.append("\t%s," % funcdef["name"])
+ out.append("};\n")
- return '\n'.join(out)
+ return "\n".join(out)
def build_gdnative_api_struct(target, source, env):
- with open(source[0], 'r') as fd:
+ with open(source[0], "r") as fd:
api = json.load(fd)
header, source = target
- with open(header, 'w') as fd:
+ with open(header, "w") as fd:
fd.write(_build_gdnative_api_struct_header(api))
- with open(source, 'w') as fd:
+ with open(source, "w") as fd:
fd.write(_build_gdnative_api_struct_source(api))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 9b4c3c794e..10ddd79d3a 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -119,7 +119,7 @@ void GDNativeLibraryEditor::_update_tree() {
new_arch->set_expand_right(0, true);
new_arch->set_metadata(1, E->key());
- platform->set_collapsed(collapsed_items.find(E->get().name) != NULL);
+ platform->set_collapsed(collapsed_items.find(E->get().name) != nullptr);
}
filter->set_text(text);
}
diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h
index 341e7f9e2b..406c3ba663 100644
--- a/modules/gdnative/include/pluginscript/godot_pluginscript.h
+++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h
@@ -60,7 +60,7 @@ typedef struct {
//this is used by script languages that keep a reference counter of their own
//you can make make Ref<> not die when it reaches zero, so deleting the reference
//depends entirely from the script.
- // Note: You can set those function pointer to NULL if not needed.
+ // Note: You can set those function pointer to nullptr if not needed.
void (*refcount_incremented)(godot_pluginscript_instance_data *p_data);
bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die
} godot_pluginscript_instance_desc;
@@ -119,18 +119,18 @@ typedef struct {
const char *name;
const char *type;
const char *extension;
- const char **recognized_extensions; // NULL terminated array
+ const char **recognized_extensions; // nullptr terminated array
godot_pluginscript_language_data *(*init)();
void (*finish)(godot_pluginscript_language_data *p_data);
- const char **reserved_words; // NULL terminated array
- const char **comment_delimiters; // NULL terminated array
- const char **string_delimiters; // NULL terminated array
+ const char **reserved_words; // nullptr terminated array
+ const char **comment_delimiters; // nullptr terminated array
+ const char **string_delimiters; // nullptr terminated array
godot_bool has_named_classes;
godot_bool supports_builtin_mode;
godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name);
godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions);
- int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be NULL
+ int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be nullptr
godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args);
godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint);
void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line);
diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub
index c28a1c8659..4212e87a87 100644
--- a/modules/gdnative/nativescript/SCsub
+++ b/modules/gdnative/nativescript/SCsub
@@ -1,9 +1,9 @@
#!/usr/bin/env python
-Import('env')
-Import('env_gdnative')
+Import("env")
+Import("env_gdnative")
-env_gdnative.add_source_files(env.modules_sources, '*.cpp')
+env_gdnative.add_source_files(env.modules_sources, "*.cpp")
if "platform" in env and env["platform"] in ["linuxbsd", "iphone"]:
env.Append(LINKFLAGS=["-rdynamic"])
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 11fe746e90..3c0cfd0484 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -46,7 +46,7 @@ static Error save_file(const String &p_path, const List<String> &p_content) {
ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
- for (const List<String>::Element *e = p_content.front(); e != NULL; e = e->next()) {
+ for (const List<String>::Element *e = p_content.front(); e != nullptr; e = e->next()) {
file->store_string(e->get());
}
@@ -197,7 +197,7 @@ List<ClassAPI> generate_c_api_classes() {
api.push_back(global_constants_api);
}
- for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) {
+ for (List<StringName>::Element *e = classes.front(); e != nullptr; e = e->next()) {
StringName class_name = e->get();
ClassAPI class_api;
@@ -229,7 +229,7 @@ List<ClassAPI> generate_c_api_classes() {
List<String> constant;
ClassDB::get_integer_constant_list(class_name, &constant, true);
constant.sort_custom<NoCaseComparator>();
- for (List<String>::Element *c = constant.front(); c != NULL; c = c->next()) {
+ for (List<String>::Element *c = constant.front(); c != nullptr; c = c->next()) {
ConstantAPI constant_api;
constant_api.constant_name = c->get();
constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get());
@@ -284,7 +284,7 @@ List<ClassAPI> generate_c_api_classes() {
ClassDB::get_property_list(class_name, &properties, true);
properties.sort_custom<PropertyInfoComparator>();
- for (List<PropertyInfo>::Element *p = properties.front(); p != NULL; p = p->next()) {
+ for (List<PropertyInfo>::Element *p = properties.front(); p != nullptr; p = p->next()) {
PropertyAPI property_api;
property_api.name = p->get().name;
@@ -312,7 +312,7 @@ List<ClassAPI> generate_c_api_classes() {
ClassDB::get_method_list(class_name, &methods, true);
methods.sort_custom<MethodInfoComparator>();
- for (List<MethodInfo>::Element *m = methods.front(); m != NULL; m = m->next()) {
+ for (List<MethodInfo>::Element *m = methods.front(); m != nullptr; m = m->next()) {
MethodAPI method_api;
MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name);
MethodInfo &method_info = m->get();
@@ -392,7 +392,7 @@ List<ClassAPI> generate_c_api_classes() {
enum_api.name = E->get();
ClassDB::get_enum_constants(class_name, E->get(), &value_names, true);
for (List<StringName>::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) {
- int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), NULL);
+ int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr);
enum_api.values.push_back(Pair<int, String>(int_val, val_e->get()));
}
enum_api.values.sort_custom<PairSort<int, String>>();
@@ -417,7 +417,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back("[\n");
- for (const List<ClassAPI>::Element *c = p_api.front(); c != NULL; c = c->next()) {
+ for (const List<ClassAPI>::Element *c = p_api.front(); c != nullptr; c = c->next()) {
ClassAPI api = c->get();
source.push_back("\t{\n");
diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp
index f953206a34..0502458b4f 100644
--- a/modules/gdnative/nativescript/godot_nativescript.cpp
+++ b/modules/gdnative/nativescript/godot_nativescript.cpp
@@ -77,7 +77,7 @@ void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char
}
} else {
- desc.base_data = NULL;
+ desc.base_data = nullptr;
desc.base_native_type = p_base;
}
@@ -111,7 +111,7 @@ void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const
}
} else {
- desc.base_data = NULL;
+ desc.base_data = nullptr;
desc.base_native_type = p_base;
}
@@ -210,11 +210,11 @@ void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const cha
void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance) {
Object *instance = (Object *)p_instance;
if (!instance)
- return NULL;
+ return nullptr;
if (instance->get_script_instance() && instance->get_script_instance()->get_language() == NativeScriptLanguage::get_singleton()) {
return ((NativeScriptInstance *)instance->get_script_instance())->userdata;
}
- return NULL;
+ return nullptr;
}
/*
@@ -319,18 +319,18 @@ const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object)
const Object *o = (Object *)p_object;
if (!o->get_script_instance()) {
- return NULL;
+ return nullptr;
} else {
NativeScript *script = Object::cast_to<NativeScript>(o->get_script_instance()->get_script().ptr());
if (!script) {
- return NULL;
+ return nullptr;
}
if (script->get_script_desc())
return script->get_script_desc()->type_tag;
}
- return NULL;
+ return nullptr;
}
int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_instance_binding_functions p_binding_functions) {
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 80aebaccd1..bf458c15ee 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -204,7 +204,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
NativeScriptDesc *script_data = get_script_desc();
if (!script_data) {
- return NULL;
+ return nullptr;
}
NativeScriptInstance *nsi = memnew(NativeScriptInstance);
@@ -214,7 +214,7 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
#ifndef TOOLS_ENABLED
if (!ScriptServer::is_scripting_enabled()) {
- nsi->userdata = NULL;
+ nsi->userdata = nullptr;
} else {
nsi->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
}
@@ -240,7 +240,7 @@ PlaceHolderScriptInstance *NativeScript::placeholder_instance_create(Object *p_t
return sins;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -738,7 +738,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
r_error.error = Callable::CallError::CALL_OK;
REF ref;
- Object *owner = NULL;
+ Object *owner = nullptr;
if (!(script_data->base_native_type == "")) {
owner = ClassDB::instance(script_data->base_native_type);
@@ -886,7 +886,7 @@ void NativeScriptInstance::get_property_list(List<PropertyInfo> *p_properties) c
E->get().method.method_data,
userdata,
0,
- NULL);
+ nullptr);
Variant res = *(Variant *)&result;
godot_variant_destroy(&result);
@@ -1007,7 +1007,7 @@ void NativeScriptInstance::notification(int p_notification) {
String NativeScriptInstance::to_string(bool *r_valid) {
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
Callable::CallError ce;
- Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce);
if (ce.error == Callable::CallError::CALL_OK) {
if (ret.get_type() != Variant::STRING) {
if (r_valid)
@@ -1026,7 +1026,7 @@ String NativeScriptInstance::to_string(bool *r_valid) {
void NativeScriptInstance::refcount_incremented() {
Callable::CallError err;
- call("_refcount_incremented", NULL, 0, err);
+ call("_refcount_incremented", nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
ERR_PRINT("Failed to invoke _refcount_incremented - should not happen");
}
@@ -1034,7 +1034,7 @@ void NativeScriptInstance::refcount_incremented() {
bool NativeScriptInstance::refcount_decremented() {
Callable::CallError err;
- Variant ret = call("_refcount_decremented", NULL, 0, err);
+ Variant ret = call("_refcount_decremented", nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK && err.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
ERR_PRINT("Failed to invoke _refcount_decremented - should not happen");
return true; // assume we can destroy the object
@@ -1525,14 +1525,14 @@ void NativeScriptLanguage::unregister_binding_functions(int p_idx) {
}
void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_object) {
- ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), NULL);
+ ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), nullptr);
- ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, NULL, "Tried to get binding data for a nativescript binding that does not exist.");
+ ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, nullptr, "Tried to get binding data for a nativescript binding that does not exist.");
Vector<void *> *binding_data = (Vector<void *> *)p_object->get_script_instance_binding(lang_idx);
if (!binding_data)
- return NULL; // should never happen.
+ return nullptr; // should never happen.
if (binding_data->size() <= p_idx) {
// okay, add new elements here.
@@ -1541,7 +1541,7 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec
binding_data->resize(p_idx + 1);
for (int i = old_size; i <= p_idx; i++) {
- (*binding_data).write[i] = NULL;
+ (*binding_data).write[i] = nullptr;
}
}
@@ -1563,7 +1563,7 @@ void *NativeScriptLanguage::alloc_instance_binding_data(Object *p_object) {
binding_data->resize(binding_functions.size());
for (int i = 0; i < binding_functions.size(); i++) {
- (*binding_data).write[i] = NULL;
+ (*binding_data).write[i] = nullptr;
}
binding_instances.insert(binding_data);
@@ -1652,12 +1652,12 @@ void NativeScriptLanguage::set_global_type_tag(int p_idx, StringName p_class_nam
const void *NativeScriptLanguage::get_global_type_tag(int p_idx, StringName p_class_name) const {
if (!global_type_tags.has(p_idx))
- return NULL;
+ return nullptr;
const HashMap<StringName, const void *> &tags = global_type_tags[p_idx];
if (!tags.has(p_class_name))
- return NULL;
+ return nullptr;
const void *tag = tags.get(p_class_name);
@@ -1956,7 +1956,7 @@ Error ResourceFormatSaverNativeScript::save(const String &p_path, const RES &p_r
}
bool ResourceFormatSaverNativeScript::recognize(const RES &p_resource) const {
- return Object::cast_to<NativeScript>(*p_resource) != NULL;
+ return Object::cast_to<NativeScript>(*p_resource) != nullptr;
}
void ResourceFormatSaverNativeScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index aba3f6b2d0..75bbb42664 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -95,7 +95,7 @@ struct NativeScriptDesc {
base(),
base_native_type(),
documentation(),
- type_tag(NULL) {
+ type_tag(nullptr) {
zeromem(&create_func, sizeof(godot_instance_create_func));
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
}
@@ -341,7 +341,7 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
- 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, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
+ 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, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
@@ -389,7 +389,7 @@ public:
inline NativeScriptDesc *NativeScript::get_script_desc() const {
Map<StringName, NativeScriptDesc>::Element *E = NativeScriptLanguage::singleton->library_classes[lib_path].find(class_name);
- return E ? &E->get() : NULL;
+ return E ? &E->get() : nullptr;
}
class NativeReloadNode : public Node {
@@ -406,7 +406,7 @@ public:
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/gdnative/net/SCsub b/modules/gdnative/net/SCsub
index 18ab9986b0..b76500c003 100644
--- a/modules/gdnative/net/SCsub
+++ b/modules/gdnative/net/SCsub
@@ -1,13 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_gdnative')
+Import("env")
+Import("env_gdnative")
env_net = env_gdnative.Clone()
has_webrtc = env_net["module_webrtc_enabled"]
if has_webrtc:
- env_net.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
-
-env_net.add_source_files(env.modules_sources, '*.cpp')
+ env_net.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"])
+env_net.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
index 8c43a79cc5..a95697ea65 100644
--- a/modules/gdnative/net/multiplayer_peer_gdnative.cpp
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.cpp
@@ -31,7 +31,7 @@
#include "multiplayer_peer_gdnative.h"
MultiplayerPeerGDNative::MultiplayerPeerGDNative() {
- interface = NULL;
+ interface = nullptr;
}
MultiplayerPeerGDNative::~MultiplayerPeerGDNative() {
@@ -42,73 +42,73 @@ void MultiplayerPeerGDNative::set_native_multiplayer_peer(const godot_net_multip
}
Error MultiplayerPeerGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_max_packet_size(interface->data);
}
int MultiplayerPeerGDNative::get_available_packet_count() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_packet_count(interface->data);
}
/* NetworkedMultiplayerPeer */
void MultiplayerPeerGDNative::set_transfer_mode(TransferMode p_mode) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND(interface == nullptr);
interface->set_target_peer(interface->data, p_peer_id);
}
int MultiplayerPeerGDNative::get_packet_peer() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_packet_peer(interface->data);
}
bool MultiplayerPeerGDNative::is_server() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->is_server(interface->data);
}
void MultiplayerPeerGDNative::poll() {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->poll(interface->data);
}
int MultiplayerPeerGDNative::get_unique_id() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_unique_id(interface->data);
}
void MultiplayerPeerGDNative::set_refuse_new_connections(bool p_enable) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->set_refuse_new_connections(interface->data, p_enable);
}
bool MultiplayerPeerGDNative::is_refusing_new_connections() const {
- ERR_FAIL_COND_V(interface == NULL, true);
+ ERR_FAIL_COND_V(interface == nullptr, true);
return interface->is_refusing_new_connections(interface->data);
}
NetworkedMultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const {
- ERR_FAIL_COND_V(interface == NULL, CONNECTION_DISCONNECTED);
+ ERR_FAIL_COND_V(interface == nullptr, CONNECTION_DISCONNECTED);
return (ConnectionStatus)interface->get_connection_status(interface->data);
}
diff --git a/modules/gdnative/net/packet_peer_gdnative.cpp b/modules/gdnative/net/packet_peer_gdnative.cpp
index 75e1e0b824..28135df3b6 100644
--- a/modules/gdnative/net/packet_peer_gdnative.cpp
+++ b/modules/gdnative/net/packet_peer_gdnative.cpp
@@ -31,7 +31,7 @@
#include "packet_peer_gdnative.h"
PacketPeerGDNative::PacketPeerGDNative() {
- interface = NULL;
+ interface = nullptr;
}
PacketPeerGDNative::~PacketPeerGDNative() {
@@ -45,22 +45,22 @@ 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_max_packet_size(interface->data);
}
int PacketPeerGDNative::get_available_packet_count() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_packet_count(interface->data);
}
diff --git a/modules/gdnative/net/stream_peer_gdnative.cpp b/modules/gdnative/net/stream_peer_gdnative.cpp
index 22634daf5f..9dcb184115 100644
--- a/modules/gdnative/net/stream_peer_gdnative.cpp
+++ b/modules/gdnative/net/stream_peer_gdnative.cpp
@@ -31,7 +31,7 @@
#include "stream_peer_gdnative.h"
StreamPeerGDNative::StreamPeerGDNative() {
- interface = NULL;
+ interface = nullptr;
}
StreamPeerGDNative::~StreamPeerGDNative() {
@@ -45,27 +45,27 @@ void StreamPeerGDNative::_bind_methods() {
}
Error StreamPeerGDNative::put_data(const uint8_t *p_data, int p_bytes) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 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);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_bytes(interface->data);
}
diff --git a/modules/gdnative/pluginscript/SCsub b/modules/gdnative/pluginscript/SCsub
index 20eaa99592..0b2db3b504 100644
--- a/modules/gdnative/pluginscript/SCsub
+++ b/modules/gdnative/pluginscript/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
-Import('env_gdnative')
+Import("env")
+Import("env_gdnative")
-env_gdnative.add_source_files(env.modules_sources, '*.cpp')
+env_gdnative.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp
index 22e8372130..7d17a7d5ab 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp
@@ -156,7 +156,7 @@ bool PluginScriptInstance::init(PluginScript *p_script, Object *p_owner) {
_script = Ref<PluginScript>(p_script);
_desc = &p_script->_desc->instance_desc;
_data = _desc->init(p_script->_data, (godot_object *)p_owner);
- ERR_FAIL_COND_V(_data == NULL, false);
+ ERR_FAIL_COND_V(_data == nullptr, false);
p_owner->set_script_instance(this);
return true;
}
diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h
index c91ad643a7..6309b6fde3 100644
--- a/modules/gdnative/pluginscript/pluginscript_instance.h
+++ b/modules/gdnative/pluginscript/pluginscript_instance.h
@@ -55,7 +55,7 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
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 Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
virtual void get_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName &p_method) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index 809034744a..dd6758713f 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -74,7 +74,7 @@ public:
virtual void get_comment_delimiters(List<String> *p_delimiters) const;
virtual void get_string_delimiters(List<String> *p_delimiters) const;
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
- 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, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
+ 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 = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp
index 46db20b6c2..3fb22b3f8d 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp
@@ -109,5 +109,5 @@ void ResourceFormatSaverPluginScript::get_recognized_extensions(const RES &p_res
bool ResourceFormatSaverPluginScript::recognize(const RES &p_resource) const {
- return Object::cast_to<PluginScript>(*p_resource) != NULL;
+ return Object::cast_to<PluginScript>(*p_resource) != nullptr;
}
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index a039072fdc..c929be53bd 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -44,7 +44,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader {
public:
ResourceFormatLoaderPluginScript(PluginScriptLanguage *language);
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index b7cbedc51a..a4c84dc0ca 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -69,7 +69,7 @@ PluginScriptInstance *PluginScript::_create_instance(const Variant **p_args, int
} else {
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
memdelete(instance);
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// Construct
@@ -93,7 +93,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
}
REF ref;
- Object *owner = NULL;
+ Object *owner = nullptr;
if (get_instance_base_type() == "") {
owner = memnew(Reference);
@@ -175,7 +175,7 @@ void PluginScript::update_exports() {
// TODO: rename p_this "p_owner" ?
ScriptInstance *PluginScript::instance_create(Object *p_this) {
- ASSERT_SCRIPT_VALID_V(NULL);
+ ASSERT_SCRIPT_VALID_V(nullptr);
// TODO check script validity ?
if (!_tool && !ScriptServer::is_scripting_enabled()) {
#ifdef TOOLS_ENABLED
@@ -185,7 +185,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
update_exports();
return si;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -197,12 +197,12 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) {
// if (EngineDebugger::is_active()) {
// _language->debug_break_parse(get_path(), 0, msg);
// }
- ERR_FAIL_V_MSG(NULL, msg);
+ ERR_FAIL_V_MSG(nullptr, msg);
}
}
Callable::CallError unchecked_error;
- return _create_instance(NULL, 0, p_this, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, unchecked_error);
}
bool PluginScript::instance_has(const Object *p_this) const {
@@ -296,7 +296,7 @@ Error PluginScript::reload(bool p_keep_state) {
_tool = manifest.is_tool;
Dictionary *members = (Dictionary *)&manifest.member_lines;
- for (const Variant *key = members->next(); key != NULL; key = members->next(key)) {
+ for (const Variant *key = members->next(); key != nullptr; key = members->next(key)) {
_member_lines[*key] = (*members)[*key];
}
Array *methods = (Array *)&manifest.methods;
@@ -366,14 +366,14 @@ Error PluginScript::reload(bool p_keep_state) {
void PluginScript::get_script_method_list(List<MethodInfo> *r_methods) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, MethodInfo>::Element *e = _methods_info.front(); e != nullptr; e = e->next()) {
r_methods->push_back(e->get());
}
}
void PluginScript::get_script_property_list(List<PropertyInfo> *r_properties) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, PropertyInfo>::Element *e = _properties_info.front(); e != nullptr; e = e->next()) {
r_properties->push_back(e->get());
}
}
@@ -386,7 +386,7 @@ bool PluginScript::has_method(const StringName &p_method) const {
MethodInfo PluginScript::get_method_info(const StringName &p_method) const {
ASSERT_SCRIPT_VALID_V(MethodInfo());
const Map<StringName, MethodInfo>::Element *e = _methods_info.find(p_method);
- if (e != NULL) {
+ if (e != nullptr) {
return e->get();
} else {
return MethodInfo();
@@ -401,7 +401,7 @@ bool PluginScript::has_property(const StringName &p_method) const {
PropertyInfo PluginScript::get_property_info(const StringName &p_property) const {
ASSERT_SCRIPT_VALID_V(PropertyInfo());
const Map<StringName, PropertyInfo>::Element *e = _properties_info.find(p_property);
- if (e != NULL) {
+ if (e != nullptr) {
return e->get();
} else {
return PropertyInfo();
@@ -412,7 +412,7 @@ bool PluginScript::get_property_default_value(const StringName &p_property, Vari
ASSERT_SCRIPT_VALID_V(false);
#ifdef TOOLS_ENABLED
const Map<StringName, Variant>::Element *e = _properties_default_values.find(p_property);
- if (e != NULL) {
+ if (e != nullptr) {
r_value = e->get();
return true;
} else {
@@ -462,7 +462,7 @@ bool PluginScript::has_script_signal(const StringName &p_signal) const {
void PluginScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
ASSERT_SCRIPT_VALID();
- for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != NULL; e = e->next()) {
+ for (Map<StringName, MethodInfo>::Element *e = _signals_info.front(); e != nullptr; e = e->next()) {
r_signals->push_back(e->get());
}
}
@@ -543,9 +543,9 @@ MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
}
PluginScript::PluginScript() :
- _data(NULL),
- _desc(NULL),
- _language(NULL),
+ _data(nullptr),
+ _desc(nullptr),
+ _language(nullptr),
_tool(false),
_valid(false),
_script_list(this) {
diff --git a/modules/gdnative/videodecoder/SCsub b/modules/gdnative/videodecoder/SCsub
index 04cc8ed604..5948b9a3dd 100644
--- a/modules/gdnative/videodecoder/SCsub
+++ b/modules/gdnative/videodecoder/SCsub
@@ -1,9 +1,9 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_vsdecoder_gdnative = env_modules.Clone()
-env_vsdecoder_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
-env_vsdecoder_gdnative.add_source_files(env.modules_sources, '*.cpp')
+env_vsdecoder_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"])
+env_vsdecoder_gdnative.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index f6e2bad739..fa9f6be5c1 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -33,7 +33,7 @@
#include "core/project_settings.h"
#include "servers/audio_server.h"
-VideoDecoderServer *VideoDecoderServer::instance = NULL;
+VideoDecoderServer *VideoDecoderServer::instance = nullptr;
static VideoDecoderServer decoder_server;
@@ -113,7 +113,7 @@ void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interfac
// VideoStreamPlaybackGDNative starts here.
bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
file = FileAccess::open(p_file, FileAccess::READ);
bool file_opened = interface->open_file(data_struct, file);
@@ -150,7 +150,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
return;
}
time += p_delta;
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->update(data_struct, p_delta);
// Don't mix if there's no audio (num_channels == 0).
@@ -189,7 +189,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
void VideoStreamPlaybackGDNative::update_texture() {
PackedByteArray *pba = (PackedByteArray *)interface->get_videoframe(data_struct);
- if (pba == NULL) {
+ if (pba == nullptr) {
playing = false;
return;
}
@@ -205,19 +205,19 @@ VideoStreamPlaybackGDNative::VideoStreamPlaybackGDNative() :
texture(Ref<ImageTexture>(memnew(ImageTexture))),
playing(false),
paused(false),
- mix_udata(NULL),
- mix_callback(NULL),
+ mix_udata(nullptr),
+ mix_callback(nullptr),
num_channels(-1),
time(0),
seek_backward(false),
mix_rate(0),
delay_compensation(0),
- pcm(NULL),
+ pcm(nullptr),
pcm_write_idx(0),
samples_decoded(0),
- file(NULL),
- interface(NULL),
- data_struct(NULL) {}
+ file(nullptr),
+ interface(nullptr),
+ data_struct(nullptr) {}
VideoStreamPlaybackGDNative::~VideoStreamPlaybackGDNative() {
cleanup();
@@ -228,16 +228,16 @@ void VideoStreamPlaybackGDNative::cleanup() {
interface->destructor(data_struct);
if (pcm)
memfree(pcm);
- pcm = NULL;
+ pcm = nullptr;
time = 0;
num_channels = -1;
- interface = NULL;
- data_struct = NULL;
+ interface = nullptr;
+ data_struct = nullptr;
}
void VideoStreamPlaybackGDNative::set_interface(const godot_videodecoder_interface_gdnative *p_interface) {
- ERR_FAIL_COND(p_interface == NULL);
- if (interface != NULL) {
+ ERR_FAIL_COND(p_interface == nullptr);
+ if (interface != nullptr) {
cleanup();
}
interface = p_interface;
@@ -272,7 +272,7 @@ void VideoStreamPlaybackGDNative::stop() {
}
void VideoStreamPlaybackGDNative::seek(float p_time) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->seek(data_struct, p_time);
if (p_time < time)
seek_backward = true;
@@ -292,13 +292,13 @@ Ref<Texture2D> VideoStreamPlaybackGDNative::get_texture() const {
}
float VideoStreamPlaybackGDNative::get_length() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_length(data_struct);
}
float VideoStreamPlaybackGDNative::get_playback_position() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_playback_position(data_struct);
}
@@ -312,7 +312,7 @@ void VideoStreamPlaybackGDNative::set_loop(bool p_enable) {
}
void VideoStreamPlaybackGDNative::set_audio_track(int p_idx) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->set_audio_track(data_struct, p_idx);
}
@@ -323,13 +323,13 @@ void VideoStreamPlaybackGDNative::set_mix_callback(AudioMixCallback p_callback,
}
int VideoStreamPlaybackGDNative::get_channels() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return (num_channels > 0) ? num_channels : 0;
}
int VideoStreamPlaybackGDNative::get_mix_rate() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return mix_rate;
}
@@ -339,13 +339,13 @@ int VideoStreamPlaybackGDNative::get_mix_rate() const {
Ref<VideoStreamPlayback> VideoStreamGDNative::instance_playback() {
Ref<VideoStreamPlaybackGDNative> pb = memnew(VideoStreamPlaybackGDNative);
VideoDecoderGDNative *decoder = decoder_server.get_decoder(file.get_extension().to_lower());
- if (decoder == NULL)
- return NULL;
+ if (decoder == nullptr)
+ return nullptr;
pb->set_interface(decoder->interface);
pb->set_audio_track(audio_track);
if (pb->open_file(file))
return pb;
- return NULL;
+ return nullptr;
}
void VideoStreamGDNative::set_file(const String &p_file) {
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h
index 21b5245a16..fbc0d4016f 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.h
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.h
@@ -42,7 +42,7 @@ struct VideoDecoderGDNative {
Vector<String> supported_extensions;
VideoDecoderGDNative() :
- interface(NULL),
+ interface(nullptr),
plugin_name("none") {}
VideoDecoderGDNative(const godot_videodecoder_interface_gdnative *p_interface) :
@@ -89,7 +89,7 @@ public:
VideoDecoderGDNative *get_decoder(const String &extension) {
if (extensions.size() == 0 || !extensions.has(extension))
- return NULL;
+ return nullptr;
return decoders[extensions[extension]];
}
@@ -102,7 +102,7 @@ public:
memdelete(decoders[i]);
}
decoders.clear();
- instance = NULL;
+ instance = nullptr;
}
};
@@ -194,12 +194,12 @@ public:
virtual void set_audio_track(int p_track);
virtual Ref<VideoStreamPlayback> instance_playback();
- VideoStreamGDNative() {}
+ VideoStreamGDNative() { audio_track = 0; }
};
class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/gdnavigation/SCsub b/modules/gdnavigation/SCsub
index 9d462f92a7..877d601c6a 100644
--- a/modules/gdnavigation/SCsub
+++ b/modules/gdnavigation/SCsub
@@ -1,25 +1,25 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_navigation = env_modules.Clone()
# Recast Thirdparty source files
-if env['builtin_recast']:
+if env["builtin_recast"]:
thirdparty_dir = "#thirdparty/recastnavigation/Recast/"
thirdparty_sources = [
- "Source/Recast.cpp",
- "Source/RecastAlloc.cpp",
- "Source/RecastArea.cpp",
- "Source/RecastAssert.cpp",
- "Source/RecastContour.cpp",
- "Source/RecastFilter.cpp",
- "Source/RecastLayers.cpp",
- "Source/RecastMesh.cpp",
- "Source/RecastMeshDetail.cpp",
- "Source/RecastRasterization.cpp",
- "Source/RecastRegion.cpp",
+ "Source/Recast.cpp",
+ "Source/RecastAlloc.cpp",
+ "Source/RecastArea.cpp",
+ "Source/RecastAssert.cpp",
+ "Source/RecastContour.cpp",
+ "Source/RecastFilter.cpp",
+ "Source/RecastLayers.cpp",
+ "Source/RecastMesh.cpp",
+ "Source/RecastMeshDetail.cpp",
+ "Source/RecastRasterization.cpp",
+ "Source/RecastRegion.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
@@ -31,11 +31,11 @@ if env['builtin_recast']:
# RVO Thirdparty source files
-if env['builtin_rvo2']:
+if env["builtin_rvo2"]:
thirdparty_dir = "#thirdparty/rvo2"
thirdparty_sources = [
- "/src/Agent.cpp",
- "/src/KdTree.cpp",
+ "/src/Agent.cpp",
+ "/src/KdTree.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
diff --git a/modules/gdnavigation/config.py b/modules/gdnavigation/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/gdnavigation/config.py
+++ b/modules/gdnavigation/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/gdnavigation/gd_navigation_server.cpp b/modules/gdnavigation/gd_navigation_server.cpp
index cade6c8a6d..278c27ae22 100644
--- a/modules/gdnavigation/gd_navigation_server.cpp
+++ b/modules/gdnavigation/gd_navigation_server.cpp
@@ -141,7 +141,7 @@ RID GdNavigationServer::map_create() const {
COMMAND_2(map_set_active, RID, p_map, bool, p_active) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
if (p_active) {
if (!map_is_active(p_map)) {
@@ -154,84 +154,84 @@ COMMAND_2(map_set_active, RID, p_map, bool, p_active) {
bool GdNavigationServer::map_is_active(RID p_map) const {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, false);
+ ERR_FAIL_COND_V(map == nullptr, false);
return active_maps.find(map) >= 0;
}
COMMAND_2(map_set_up, RID, p_map, Vector3, p_up) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
map->set_up(p_up);
}
Vector3 GdNavigationServer::map_get_up(RID p_map) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, Vector3());
+ ERR_FAIL_COND_V(map == nullptr, Vector3());
return map->get_up();
}
COMMAND_2(map_set_cell_size, RID, p_map, real_t, p_cell_size) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
map->set_cell_size(p_cell_size);
}
real_t GdNavigationServer::map_get_cell_size(RID p_map) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, 0);
+ ERR_FAIL_COND_V(map == nullptr, 0);
return map->get_cell_size();
}
COMMAND_2(map_set_edge_connection_margin, RID, p_map, real_t, p_connection_margin) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
map->set_edge_connection_margin(p_connection_margin);
}
real_t GdNavigationServer::map_get_edge_connection_margin(RID p_map) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, 0);
+ ERR_FAIL_COND_V(map == nullptr, 0);
return map->get_edge_connection_margin();
}
Vector<Vector3> GdNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, Vector<Vector3>());
+ ERR_FAIL_COND_V(map == nullptr, Vector<Vector3>());
return map->get_path(p_origin, p_destination, p_optimize);
}
Vector3 GdNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, Vector3());
+ ERR_FAIL_COND_V(map == nullptr, Vector3());
return map->get_closest_point_to_segment(p_from, p_to, p_use_collision);
}
Vector3 GdNavigationServer::map_get_closest_point(RID p_map, const Vector3 &p_point) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, Vector3());
+ ERR_FAIL_COND_V(map == nullptr, Vector3());
return map->get_closest_point(p_point);
}
Vector3 GdNavigationServer::map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, Vector3());
+ ERR_FAIL_COND_V(map == nullptr, Vector3());
return map->get_closest_point_normal(p_point);
}
RID GdNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const {
const NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND_V(map == NULL, RID());
+ ERR_FAIL_COND_V(map == nullptr, RID());
return map->get_closest_point_owner(p_point);
}
@@ -247,20 +247,20 @@ RID GdNavigationServer::region_create() const {
COMMAND_2(region_set_map, RID, p_region, RID, p_map) {
NavRegion *region = region_owner.getornull(p_region);
- ERR_FAIL_COND(region == NULL);
+ ERR_FAIL_COND(region == nullptr);
- if (region->get_map() != NULL) {
+ if (region->get_map() != nullptr) {
if (region->get_map()->get_self() == p_map)
return; // Pointless
region->get_map()->remove_region(region);
- region->set_map(NULL);
+ region->set_map(nullptr);
}
if (p_map.is_valid()) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
map->add_region(region);
region->set_map(map);
@@ -269,21 +269,21 @@ COMMAND_2(region_set_map, RID, p_region, RID, p_map) {
COMMAND_2(region_set_transform, RID, p_region, Transform, p_transform) {
NavRegion *region = region_owner.getornull(p_region);
- ERR_FAIL_COND(region == NULL);
+ ERR_FAIL_COND(region == nullptr);
region->set_transform(p_transform);
}
COMMAND_2(region_set_navmesh, RID, p_region, Ref<NavigationMesh>, p_nav_mesh) {
NavRegion *region = region_owner.getornull(p_region);
- ERR_FAIL_COND(region == NULL);
+ ERR_FAIL_COND(region == nullptr);
region->set_mesh(p_nav_mesh);
}
void GdNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p_node) const {
ERR_FAIL_COND(r_mesh.is_null());
- ERR_FAIL_COND(p_node == NULL);
+ ERR_FAIL_COND(p_node == nullptr);
#ifndef _3D_DISABLED
NavigationMeshGenerator::get_singleton()->clear(r_mesh);
@@ -302,7 +302,7 @@ RID GdNavigationServer::agent_create() const {
COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
if (agent->get_map()) {
if (agent->get_map()->get_self() == p_map)
@@ -311,11 +311,11 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
agent->get_map()->remove_agent(agent);
}
- agent->set_map(NULL);
+ agent->set_map(nullptr);
if (p_map.is_valid()) {
NavMap *map = map_owner.getornull(p_map);
- ERR_FAIL_COND(map == NULL);
+ ERR_FAIL_COND(map == nullptr);
agent->set_map(map);
map->add_agent(agent);
@@ -328,82 +328,82 @@ COMMAND_2(agent_set_map, RID, p_agent, RID, p_map) {
COMMAND_2(agent_set_neighbor_dist, RID, p_agent, real_t, p_dist) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->neighborDist_ = p_dist;
}
COMMAND_2(agent_set_max_neighbors, RID, p_agent, int, p_count) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->maxNeighbors_ = p_count;
}
COMMAND_2(agent_set_time_horizon, RID, p_agent, real_t, p_time) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->timeHorizon_ = p_time;
}
COMMAND_2(agent_set_radius, RID, p_agent, real_t, p_radius) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->radius_ = p_radius;
}
COMMAND_2(agent_set_max_speed, RID, p_agent, real_t, p_max_speed) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->maxSpeed_ = p_max_speed;
}
COMMAND_2(agent_set_velocity, RID, p_agent, Vector3, p_velocity) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->velocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
}
COMMAND_2(agent_set_target_velocity, RID, p_agent, Vector3, p_velocity) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->prefVelocity_ = RVO::Vector3(p_velocity.x, p_velocity.y, p_velocity.z);
}
COMMAND_2(agent_set_position, RID, p_agent, Vector3, p_position) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->position_ = RVO::Vector3(p_position.x, p_position.y, p_position.z);
}
COMMAND_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
agent->get_agent()->ignore_y_ = p_ignore;
}
bool GdNavigationServer::agent_is_map_changed(RID p_agent) const {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND_V(agent == NULL, false);
+ ERR_FAIL_COND_V(agent == nullptr, false);
return agent->is_map_changed();
}
COMMAND_4(agent_set_callback, RID, p_agent, Object *, p_receiver, StringName, p_method, Variant, p_udata) {
RvoAgent *agent = agent_owner.getornull(p_agent);
- ERR_FAIL_COND(agent == NULL);
+ ERR_FAIL_COND(agent == nullptr);
- agent->set_callback(p_receiver == NULL ? ObjectID() : p_receiver->get_instance_id(), p_method, p_udata);
+ agent->set_callback(p_receiver == nullptr ? ObjectID() : p_receiver->get_instance_id(), p_method, p_udata);
if (agent->get_map()) {
- if (p_receiver == NULL) {
+ if (p_receiver == nullptr) {
agent->get_map()->remove_agent_as_controlled(agent);
} else {
agent->get_map()->set_agent_as_controlled(agent);
@@ -419,14 +419,14 @@ COMMAND_1(free, RID, p_object) {
std::vector<NavRegion *> regions = map->get_regions();
for (size_t i(0); i < regions.size(); i++) {
map->remove_region(regions[i]);
- regions[i]->set_map(NULL);
+ regions[i]->set_map(nullptr);
}
// Remove any assigned agent
std::vector<RvoAgent *> agents = map->get_agents();
for (size_t i(0); i < agents.size(); i++) {
map->remove_agent(agents[i]);
- agents[i]->set_map(NULL);
+ agents[i]->set_map(nullptr);
}
active_maps.erase(map);
@@ -437,9 +437,9 @@ COMMAND_1(free, RID, p_object) {
NavRegion *region = region_owner.getornull(p_object);
// Removes this region from the map if assigned
- if (region->get_map() != NULL) {
+ if (region->get_map() != nullptr) {
region->get_map()->remove_region(region);
- region->set_map(NULL);
+ region->set_map(nullptr);
}
region_owner.free(p_object);
@@ -449,9 +449,9 @@ COMMAND_1(free, RID, p_object) {
RvoAgent *agent = agent_owner.getornull(p_object);
// Removes this agent from the map if assigned
- if (agent->get_map() != NULL) {
+ if (agent->get_map() != nullptr) {
agent->get_map()->remove_agent(agent);
- agent->set_map(NULL);
+ agent->set_map(nullptr);
}
agent_owner.free(p_object);
diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp
index 338e49eb9f..7e6a3f7a26 100644
--- a/modules/gdnavigation/nav_map.cpp
+++ b/modules/gdnavigation/nav_map.cpp
@@ -81,8 +81,8 @@ gd::PointKey NavMap::get_point_key(const Vector3 &p_pos) const {
Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p_optimize) const {
- const gd::Polygon *begin_poly = NULL;
- const gd::Polygon *end_poly = NULL;
+ const gd::Polygon *begin_poly = nullptr;
+ const gd::Polygon *end_poly = nullptr;
Vector3 begin_point;
Vector3 end_point;
float begin_d = 1e20;
@@ -146,7 +146,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
open_list.push_back(0);
- const gd::Polygon *reachable_end = NULL;
+ const gd::Polygon *reachable_end = nullptr;
float reachable_d = 1e30;
bool is_reachable = true;
@@ -215,7 +215,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
// so use the further reachable polygon
ERR_BREAK_MSG(is_reachable == false, "It's not expect to not find the most reachable polygons");
is_reachable = false;
- if (reachable_end == NULL) {
+ if (reachable_end == nullptr) {
// The path is not found and there is not a way out.
break;
}
@@ -240,7 +240,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
open_list.clear();
open_list.push_back(0);
- reachable_end = NULL;
+ reachable_end = nullptr;
continue;
}
@@ -249,7 +249,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
least_cost_id = -1;
float least_cost = 1e30;
- for (auto element = open_list.front(); element != NULL; element = element->next()) {
+ for (auto element = open_list.front(); element != nullptr; element = element->next()) {
gd::NavigationPoly *np = &navigation_polys[element->get()];
float cost = np->traveled_distance;
#ifdef USE_ENTRY_POINT
@@ -366,7 +366,7 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
p = &navigation_polys[p->prev_navigation_poly_id];
else
// The end
- p = NULL;
+ p = nullptr;
}
if (path[path.size() - 1] != begin_point)
@@ -637,12 +637,12 @@ void NavMap::sync() {
gd::Connection c;
c.A = &poly;
c.A_edge = p;
- c.B = NULL;
+ c.B = nullptr;
c.B_edge = -1;
connections[ek] = c;
- } else if (connection->get().B == NULL) {
- CRASH_COND(connection->get().A == NULL); // Unreachable
+ } else if (connection->get().B == nullptr) {
+ CRASH_COND(connection->get().A == nullptr); // Unreachable
// Connect the two Polygons by this edge
connection->get().B = &poly;
@@ -657,7 +657,7 @@ void NavMap::sync() {
connection->get().B->edges[connection->get().B_edge].other_edge = connection->get().A_edge;
} else {
// The edge is already connected with another edge, skip.
- ERR_PRINT("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the Navigation's `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problem.");
+ ERR_PRINT("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the Navigation3D's `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problem.");
}
}
}
@@ -667,8 +667,8 @@ void NavMap::sync() {
free_edges.reserve(connections.size());
for (auto connection_element = connections.front(); connection_element; connection_element = connection_element->next()) {
- if (connection_element->get().B == NULL) {
- CRASH_COND(connection_element->get().A == NULL); // Unreachable
+ if (connection_element->get().B == nullptr) {
+ CRASH_COND(connection_element->get().A == nullptr); // Unreachable
CRASH_COND(connection_element->get().A_edge < 0); // Unreachable
// This is a free edge
diff --git a/modules/gdnavigation/nav_region.cpp b/modules/gdnavigation/nav_region.cpp
index 0215821305..b91376f761 100644
--- a/modules/gdnavigation/nav_region.cpp
+++ b/modules/gdnavigation/nav_region.cpp
@@ -37,7 +37,7 @@
*/
NavRegion::NavRegion() :
- map(NULL),
+ map(nullptr),
polygons_dirty(true) {
}
@@ -71,7 +71,7 @@ void NavRegion::update_polygons() {
polygons.clear();
polygons_dirty = false;
- if (map == NULL) {
+ if (map == nullptr) {
return;
}
diff --git a/modules/gdnavigation/nav_utils.h b/modules/gdnavigation/nav_utils.h
index bdf9eb34a8..3401284c31 100644
--- a/modules/gdnavigation/nav_utils.h
+++ b/modules/gdnavigation/nav_utils.h
@@ -90,7 +90,7 @@ struct Edge {
Edge() {
this_edge = -1;
- other_polygon = NULL;
+ other_polygon = nullptr;
other_edge = -1;
}
};
@@ -119,8 +119,8 @@ struct Connection {
int B_edge;
Connection() {
- A = NULL;
- B = NULL;
+ A = nullptr;
+ B = nullptr;
A_edge = -1;
B_edge = -1;
}
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
index 6238acfdc5..abaf73ba6a 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
@@ -40,7 +40,7 @@
void NavigationMeshEditor::_node_removed(Node *p_node) {
if (p_node == node) {
- node = NULL;
+ node = nullptr;
hide();
}
@@ -86,7 +86,7 @@ void NavigationMeshEditor::_clear_pressed() {
void NavigationMeshEditor::edit(NavigationRegion3D *p_nav_region) {
- if (p_nav_region == NULL || node == p_nav_region) {
+ if (p_nav_region == nullptr || node == p_nav_region) {
return;
}
@@ -117,7 +117,7 @@ NavigationMeshEditor::NavigationMeshEditor() {
err_dialog = memnew(AcceptDialog);
add_child(err_dialog);
- node = NULL;
+ node = nullptr;
}
NavigationMeshEditor::~NavigationMeshEditor() {
@@ -142,7 +142,7 @@ void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
navigation_mesh_editor->hide();
navigation_mesh_editor->bake_hbox->hide();
- navigation_mesh_editor->edit(NULL);
+ navigation_mesh_editor->edit(nullptr);
}
}
diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp
index ec19c7b8a3..acb4f0461f 100644
--- a/modules/gdnavigation/navigation_mesh_generator.cpp
+++ b/modules/gdnavigation/navigation_mesh_generator.cpp
@@ -60,7 +60,7 @@
#include "modules/gridmap/grid_map.h"
#endif
-NavigationMeshGenerator *NavigationMeshGenerator::singleton = NULL;
+NavigationMeshGenerator *NavigationMeshGenerator::singleton = nullptr;
void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector<float> &p_verticies) {
p_verticies.push_back(p_vec3.x);
@@ -405,7 +405,7 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
ERR_FAIL_COND(!rcBuildCompactHeightfield(&ctx, cfg.walkableHeight, cfg.walkableClimb, *hf, *chf));
rcFreeHeightField(hf);
- hf = 0;
+ hf = nullptr;
#ifdef TOOLS_ENABLED
if (ep)
@@ -452,9 +452,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
ERR_FAIL_COND(!rcBuildPolyMeshDetail(&ctx, *poly_mesh, *chf, cfg.detailSampleDist, cfg.detailSampleMaxError, *detail_mesh));
rcFreeCompactHeightfield(chf);
- chf = 0;
+ chf = nullptr;
rcFreeContourSet(cset);
- cset = 0;
+ cset = nullptr;
#ifdef TOOLS_ENABLED
if (ep)
@@ -464,9 +464,9 @@ void NavigationMeshGenerator::_build_recast_navigation_mesh(
_convert_detail_mesh_to_native_navigation_mesh(detail_mesh, p_nav_mesh);
rcFreePolyMesh(poly_mesh);
- poly_mesh = 0;
+ poly_mesh = nullptr;
rcFreePolyMeshDetail(detail_mesh);
- detail_mesh = 0;
+ detail_mesh = nullptr;
}
NavigationMeshGenerator *NavigationMeshGenerator::get_singleton() {
@@ -485,7 +485,7 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
ERR_FAIL_COND(!p_nav_mesh.is_valid());
#ifdef TOOLS_ENABLED
- EditorProgress *ep(NULL);
+ EditorProgress *ep(nullptr);
if (Engine::get_singleton()->is_editor_hint()) {
ep = memnew(EditorProgress("bake", TTR("Navigation Mesh Generator Setup:"), 11));
}
@@ -515,11 +515,11 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
if (vertices.size() > 0 && indices.size() > 0) {
- rcHeightfield *hf = NULL;
- rcCompactHeightfield *chf = NULL;
- rcContourSet *cset = NULL;
- rcPolyMesh *poly_mesh = NULL;
- rcPolyMeshDetail *detail_mesh = NULL;
+ rcHeightfield *hf = nullptr;
+ rcCompactHeightfield *chf = nullptr;
+ rcContourSet *cset = nullptr;
+ rcPolyMesh *poly_mesh = nullptr;
+ rcPolyMeshDetail *detail_mesh = nullptr;
_build_recast_navigation_mesh(
p_nav_mesh,
@@ -535,19 +535,19 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
indices);
rcFreeHeightField(hf);
- hf = 0;
+ hf = nullptr;
rcFreeCompactHeightfield(chf);
- chf = 0;
+ chf = nullptr;
rcFreeContourSet(cset);
- cset = 0;
+ cset = nullptr;
rcFreePolyMesh(poly_mesh);
- poly_mesh = 0;
+ poly_mesh = nullptr;
rcFreePolyMeshDetail(detail_mesh);
- detail_mesh = 0;
+ detail_mesh = nullptr;
}
#ifdef TOOLS_ENABLED
diff --git a/modules/gdnavigation/register_types.cpp b/modules/gdnavigation/register_types.cpp
index 9965a89fde..088b26bf17 100644
--- a/modules/gdnavigation/register_types.cpp
+++ b/modules/gdnavigation/register_types.cpp
@@ -47,7 +47,7 @@
*/
#ifndef _3D_DISABLED
-NavigationMeshGenerator *_nav_mesh_generator = NULL;
+NavigationMeshGenerator *_nav_mesh_generator = nullptr;
#endif
NavigationServer3D *new_server() {
diff --git a/modules/gdnavigation/rvo_agent.cpp b/modules/gdnavigation/rvo_agent.cpp
index 677e525bbf..3c39f02c26 100644
--- a/modules/gdnavigation/rvo_agent.cpp
+++ b/modules/gdnavigation/rvo_agent.cpp
@@ -37,7 +37,7 @@
*/
RvoAgent::RvoAgent() :
- map(NULL) {
+ map(nullptr) {
callback.id = ObjectID();
}
@@ -70,7 +70,7 @@ void RvoAgent::dispatch_callback() {
return;
}
Object *obj = ObjectDB::get_instance(callback.id);
- if (obj == NULL) {
+ if (obj == nullptr) {
callback.id = ObjectID();
}
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 74e653ce43..e58a1d8edc 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -1,19 +1,19 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_gdscript = env_modules.Clone()
env_gdscript.add_source_files(env.modules_sources, "*.cpp")
-if env['tools']:
+if env["tools"]:
env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp")
# Those two modules are required for the language server protocol
- if env['module_jsonrpc_enabled'] and env['module_websocket_enabled']:
+ if env["module_jsonrpc_enabled"] and env["module_websocket_enabled"]:
env_gdscript.add_source_files(env.modules_sources, "./language_server/*.cpp")
else:
# Using a define in the disabled case, to avoid having an extra define
# in regular builds where all modules are enabled.
- env_gdscript.Append(CPPDEFINES=['GDSCRIPT_NO_LSP'])
+ env_gdscript.Append(CPPDEFINES=["GDSCRIPT_NO_LSP"])
diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py
index a525eedaaa..185a10bcb2 100644
--- a/modules/gdscript/config.py
+++ b/modules/gdscript/config.py
@@ -1,9 +1,11 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"@GDScript",
@@ -12,5 +14,6 @@ def get_doc_classes():
"GDScriptNativeClass",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index 2f6f9f30a4..9324691df5 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -90,14 +90,18 @@
</return>
<argument index="0" name="condition" type="bool">
</argument>
+ <argument index="1" name="message" type="String" default="&quot;&quot;">
+ </argument>
<description>
- Asserts that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development.
+ Asserts that the [code]condition[/code] is [code]true[/code]. If the [code]condition[/code] is [code]false[/code], an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is [code]true[/code] during development.
+ The optional [code]message[/code] argument, if given, is shown in addition to the generic "Assertion failed" message. You can use this to provide additional details about why the assertion failed.
[codeblock]
# Imagine we always want speed to be between 0 and 20
speed = -10
assert(speed &lt; 20) # True, the program will continue
assert(speed &gt;= 0) # False, the program will stop
assert(speed &gt;= 0 &amp;&amp; speed &lt; 20) # You can also combine the two conditional statements in one check
+ assert(speed &lt; 20, "speed = %f, but the speed limit is 20" % speed) # Show a message with clarifying details
[/codeblock]
</description>
</method>
@@ -1216,7 +1220,7 @@
<description>
Returns whether the given class exists in [ClassDB].
[codeblock]
- type_exists("Sprite") # Returns true
+ type_exists("Sprite2D") # Returns true
type_exists("Variant") # Returns false
[/codeblock]
</description>
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 05e9f8652e..9a4fa5cc86 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -114,13 +114,13 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
if (r_error.error != Callable::CallError::CALL_OK) {
instance->script = Ref<GDScript>();
- instance->owner->set_script_instance(NULL);
+ instance->owner->set_script_instance(nullptr);
{
MutexLock lock(GDScriptLanguage::singleton->lock);
instances.erase(p_owner);
}
- ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, NULL); //error constructing
+ ERR_FAIL_COND_V(r_error.error != Callable::CallError::CALL_OK, nullptr); //error constructing
}
//@TODO make thread safe
@@ -138,7 +138,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
r_error.error = Callable::CallError::CALL_OK;
REF ref;
- Object *owner = NULL;
+ Object *owner = nullptr;
GDScript *_baseptr = this;
while (_baseptr->_base) {
@@ -158,7 +158,7 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Callable::CallErr
ref = REF(r);
}
- GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
+ GDScriptInstance *instance = _create_instance(p_args, p_argcount, owner, r != nullptr, r_error);
if (!instance) {
if (ref.is_null()) {
memdelete(owner); //no owner, sorry
@@ -318,12 +318,12 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
if (EngineDebugger::is_active()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
}
- ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
+ ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
}
}
Callable::CallError unchecked_error;
- return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
}
PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
@@ -333,7 +333,7 @@ PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this)
_update_exports();
return si;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -688,7 +688,7 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p
ERR_FAIL_COND_V_MSG(!E->get()->is_static(), Variant(), "Can't call non-static function '" + String(p_method) + "' in script.");
- return E->get()->call(NULL, p_args, p_argcount, r_error);
+ return E->get()->call(nullptr, p_args, p_argcount, r_error);
}
top = top->_base;
}
@@ -938,9 +938,9 @@ GDScript::GDScript() :
valid = false;
subclass_count = 0;
- initializer = NULL;
- _base = NULL;
- _owner = NULL;
+ initializer = nullptr;
+ _base = nullptr;
+ _owner = nullptr;
tool = false;
#ifdef TOOLS_ENABLED
source_changed_cache = false;
@@ -964,7 +964,7 @@ void GDScript::_save_orphaned_subclasses() {
Vector<ClassRefWithName> weak_subclasses;
// collect subclasses ObjectID and name
for (Map<StringName, Ref<GDScript>>::Element *E = subclasses.front(); E; E = E->next()) {
- E->get()->_owner = NULL; //bye, you are no longer owned cause I died
+ E->get()->_owner = nullptr; //bye, you are no longer owned cause I died
ClassRefWithName subclass;
subclass.id = E->get()->get_instance_id();
subclass.fully_qualified_name = E->get()->fully_qualified_name;
@@ -1028,7 +1028,7 @@ void GDScript::_init_rpc_methods_properties() {
if (sub_E)
cscript = sub_E->get().ptr();
else
- cscript = NULL;
+ cscript = nullptr;
}
// Sort so we are 100% that they are always the same.
@@ -1120,7 +1120,7 @@ bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
if (E) {
if (E->get().getter) {
Callable::CallError err;
- r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, NULL, 0, err);
+ r_ret = const_cast<GDScriptInstance *>(this)->call(E->get().getter, nullptr, 0, err);
if (err.error == Callable::CallError::CALL_OK) {
return true;
}
@@ -1194,7 +1194,7 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
if (E) {
Callable::CallError err;
- Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), NULL, 0, err);
+ Variant ret = const_cast<GDScriptFunction *>(E->get())->call(const_cast<GDScriptInstance *>(this), nullptr, 0, err);
if (err.error == Callable::CallError::CALL_OK) {
ERR_FAIL_COND_MSG(ret.get_type() != Variant::ARRAY, "Wrong type for _get_property_list, must be an array of dictionaries.");
@@ -1351,7 +1351,7 @@ void GDScriptInstance::notification(int p_notification) {
String GDScriptInstance::to_string(bool *r_valid) {
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
Callable::CallError ce;
- Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce);
if (ce.error == Callable::CallError::CALL_OK) {
if (ret.get_type() != Variant::STRING) {
if (r_valid)
@@ -1450,7 +1450,7 @@ void GDScriptInstance::reload_members() {
}
GDScriptInstance::GDScriptInstance() {
- owner = NULL;
+ owner = nullptr;
base_ref = false;
}
@@ -1464,7 +1464,7 @@ GDScriptInstance::~GDScriptInstance() {
/************* SCRIPT LANGUAGE **************/
-GDScriptLanguage *GDScriptLanguage::singleton = NULL;
+GDScriptLanguage *GDScriptLanguage::singleton = nullptr;
String GDScriptLanguage::get_name() const {
@@ -1900,7 +1900,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"remotesync",
"mastersync",
"puppetsync",
- 0
+ nullptr
};
const char **w = _reserved_words;
@@ -1933,7 +1933,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
String source = f->get_as_utf8_string();
GDScriptParser parser;
- parser.parse(source, p_path.get_base_dir(), true, p_path, false, NULL, true);
+ parser.parse(source, p_path.get_base_dir(), true, p_path, false, nullptr, true);
if (parser.get_parse_tree() && parser.get_parse_tree()->type == GDScriptParser::Node::TYPE_CLASS) {
@@ -1954,7 +1954,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
if (subclass->extends_file) {
if (subclass->extends_class.size() == 0) {
get_global_class_name(subclass->extends_file, r_base_type);
- subclass = NULL;
+ subclass = nullptr;
break;
} else {
Vector<StringName> extend_classes = subclass->extends_class;
@@ -1973,7 +1973,7 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
subpath = path.get_base_dir().plus_file(subpath).simplify_path();
}
- if (OK != subparser.parse(subsource, subpath.get_base_dir(), true, subpath, false, NULL, true)) {
+ if (OK != subparser.parse(subsource, subpath.get_base_dir(), true, subpath, false, nullptr, true)) {
break;
}
path = subpath;
@@ -1994,20 +1994,20 @@ String GDScriptLanguage::get_global_class_name(const String &p_path, String *r_b
}
}
if (!found) {
- subclass = NULL;
+ subclass = nullptr;
break;
}
}
}
} else if (subclass->extends_class.size() == 1) {
*r_base_type = subclass->extends_class[0];
- subclass = NULL;
+ subclass = nullptr;
} else {
break;
}
} else {
*r_base_type = "Reference";
- subclass = NULL;
+ subclass = nullptr;
}
}
}
@@ -2168,7 +2168,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"UNSAFE_CALL_ARGUMENT",
"DEPRECATED_KEYWORD",
"STANDALONE_TERNARY",
- NULL
+ nullptr
};
return names[(int)p_code];
@@ -2215,7 +2215,7 @@ GDScriptLanguage::GDScriptLanguage() {
} else {
_debug_max_call_stack = 0;
- _call_stack = NULL;
+ _call_stack = nullptr;
}
#ifdef DEBUG_ENABLED
@@ -2236,7 +2236,7 @@ GDScriptLanguage::~GDScriptLanguage() {
if (_call_stack) {
memdelete_arr(_call_stack);
}
- singleton = NULL;
+ singleton = nullptr;
}
void GDScriptLanguage::add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass) {
@@ -2319,7 +2319,7 @@ void ResourceFormatLoaderGDScript::get_dependencies(const String &p_path, List<S
}
GDScriptParser parser;
- if (OK != parser.parse(source, p_path.get_base_dir(), true, p_path, false, NULL, true)) {
+ if (OK != parser.parse(source, p_path.get_base_dir(), true, p_path, false, nullptr, true)) {
return;
}
@@ -2363,5 +2363,5 @@ void ResourceFormatSaverGDScript::get_recognized_extensions(const RES &p_resourc
}
bool ResourceFormatSaverGDScript::recognize(const RES &p_resource) const {
- return Object::cast_to<GDScript>(*p_resource) != NULL;
+ return Object::cast_to<GDScript>(*p_resource) != nullptr;
}
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 3fedc604bf..2c5876372b 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -260,7 +260,7 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
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 Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
virtual void get_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName &p_method) const;
@@ -483,7 +483,7 @@ public:
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
virtual bool is_using_templates();
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
- 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, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
+ 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 = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
@@ -534,7 +534,7 @@ public:
/* GLOBAL CLASSES */
virtual bool handles_global_class_type(const String &p_type) const;
- virtual String get_global_class_name(const String &p_path, String *r_base_type = NULL, String *r_icon_path = NULL) const;
+ virtual String get_global_class_name(const String &p_path, String *r_base_type = nullptr, String *r_icon_path = nullptr) const;
void add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass);
Ref<GDScript> get_orphan_subclass(const String &p_qualified_name);
@@ -545,7 +545,7 @@ public:
class ResourceFormatLoaderGDScript : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index fb514aab0c..2bbec29043 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -46,7 +46,7 @@ bool GDScriptCompiler::_is_class_member_property(CodeGen &codegen, const StringN
bool GDScriptCompiler::_is_class_member_property(GDScript *owner, const StringName &p_name) {
GDScript *scr = owner;
- GDScriptNativeClass *nc = NULL;
+ GDScriptNativeClass *nc = nullptr;
while (scr) {
if (scr->native.is_valid())
@@ -265,7 +265,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
while (owner) {
GDScript *scr = owner;
- GDScriptNativeClass *nc = NULL;
+ GDScriptNativeClass *nc = nullptr;
while (scr) {
if (scr->constants.has(identifier)) {
@@ -1700,14 +1700,14 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_constant_count = codegen.constant_map.size();
gdfunc->constants.resize(codegen.constant_map.size());
gdfunc->_constants_ptr = gdfunc->constants.ptrw();
- const Variant *K = NULL;
+ const Variant *K = nullptr;
while ((K = codegen.constant_map.next(K))) {
int idx = codegen.constant_map[*K];
gdfunc->constants.write[idx] = *K;
}
} else {
- gdfunc->_constants_ptr = NULL;
+ gdfunc->_constants_ptr = nullptr;
gdfunc->_constant_count = 0;
}
//global names
@@ -1722,7 +1722,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_global_names_count = gdfunc->global_names.size();
} else {
- gdfunc->_global_names_ptr = NULL;
+ gdfunc->_global_names_ptr = nullptr;
gdfunc->_global_names_count = 0;
}
@@ -1746,7 +1746,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
} else {
- gdfunc->_code_ptr = NULL;
+ gdfunc->_code_ptr = nullptr;
gdfunc->_code_size = 0;
}
@@ -1757,7 +1757,7 @@ Error GDScriptCompiler::_parse_function(GDScript *p_script, const GDScriptParser
gdfunc->_default_arg_ptr = &gdfunc->default_arguments[0];
} else {
gdfunc->_default_arg_count = 0;
- gdfunc->_default_arg_ptr = NULL;
+ gdfunc->_default_arg_ptr = nullptr;
}
gdfunc->_argument_count = p_func ? p_func->arguments.size() : 0;
@@ -1838,7 +1838,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
p_script->native = Ref<GDScriptNativeClass>();
p_script->base = Ref<GDScript>();
- p_script->_base = NULL;
+ p_script->_base = nullptr;
p_script->members.clear();
p_script->constants.clear();
for (Map<StringName, GDScriptFunction *>::Element *E = p_script->member_functions.front(); E; E = E->next()) {
@@ -1848,7 +1848,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
p_script->member_indices.clear();
p_script->member_info.clear();
p_script->_signals.clear();
- p_script->initializer = NULL;
+ p_script->initializer = nullptr;
p_script->tool = p_class->tool;
p_script->name = p_class->name;
@@ -1962,7 +1962,7 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar
if (c->base.is_valid()) {
c = c->base.ptr();
} else {
- c = NULL;
+ c = nullptr;
}
}
@@ -2032,14 +2032,14 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
if (!has_initializer) {
//create a constructor
- Error err = _parse_function(p_script, p_class, NULL);
+ Error err = _parse_function(p_script, p_class, nullptr);
if (err)
return err;
}
if (!has_ready && p_class->ready->statements.size()) {
//create a constructor
- Error err = _parse_function(p_script, p_class, NULL, true);
+ Error err = _parse_function(p_script, p_class, nullptr, true);
if (err)
return err;
}
@@ -2077,7 +2077,7 @@ Error GDScriptCompiler::_parse_class_blocks(GDScript *p_script, const GDScriptPa
/* STEP 2, INITIALIZE AND CONSTRUCT */
Callable::CallError ce;
- p_script->initializer->call(instance, NULL, 0, ce);
+ p_script->initializer->call(instance, nullptr, 0, ce);
if (ce.error != Callable::CallError::CALL_OK) {
//well, tough luck, not goinna do anything here
@@ -2162,7 +2162,7 @@ Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_scri
// Create scripts for subclasses beforehand so they can be referenced
_make_scripts(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);
- p_script->_owner = NULL;
+ p_script->_owner = nullptr;
Error err = _parse_class_level(p_script, static_cast<const GDScriptParser::ClassNode *>(root), p_keep_state);
if (err)
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 98e09159ec..1e3cbd661e 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -336,9 +336,9 @@ void GDScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *
ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
if (_debug_parse_err_line >= 0)
- return NULL;
+ return nullptr;
- ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
+ ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, nullptr);
int l = _debug_call_stack_pos - p_level - 1;
ScriptInstance *instance = _call_stack[l].instance;
@@ -430,6 +430,8 @@ void GDScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const
mi.name = "assert";
mi.return_val.type = Variant::NIL;
mi.arguments.push_back(PropertyInfo(Variant::BOOL, "condition"));
+ mi.arguments.push_back(PropertyInfo(Variant::STRING, "message"));
+ mi.default_arguments.push_back(String());
p_functions->push_back(mi);
}
}
@@ -499,10 +501,10 @@ struct GDScriptCompletionContext {
uint32_t depth;
GDScriptCompletionContext() :
- _class(NULL),
- function(NULL),
- block(NULL),
- base(NULL),
+ _class(nullptr),
+ function(nullptr),
+ block(nullptr),
+ base(nullptr),
line(0),
depth(0) {}
};
@@ -514,7 +516,7 @@ struct GDScriptCompletionIdentifier {
const GDScriptParser::Node *assigned_expression;
GDScriptCompletionIdentifier() :
- assigned_expression(NULL) {}
+ assigned_expression(nullptr) {}
};
static void _get_directory_contents(EditorFileSystemDirectory *p_dir, Map<String, ScriptCodeCompletionOption> &r_list) {
@@ -909,7 +911,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
Variant ret = mb->call(baseptr, (const Variant **)argptr.ptr(), argptr.size(), ce);
if (ce.error == Callable::CallError::CALL_OK && ret.get_type() != Variant::NIL) {
- if (ret.get_type() != Variant::OBJECT || ret.operator Object *() != NULL) {
+ if (ret.get_type() != Variant::OBJECT || ret.operator Object *() != nullptr) {
r_type = _type_from_variant(ret);
found = true;
}
@@ -963,7 +965,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
break;
}
- const GDScriptParser::DictionaryNode *dn = NULL;
+ const GDScriptParser::DictionaryNode *dn = nullptr;
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_DICTIONARY) {
dn = static_cast<const GDScriptParser::DictionaryNode *>(op->arguments[0]);
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_DICTIONARY) {
@@ -1017,7 +1019,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
}
// Look if it is a dictionary node
- const GDScriptParser::DictionaryNode *dn = NULL;
+ const GDScriptParser::DictionaryNode *dn = nullptr;
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_DICTIONARY) {
dn = static_cast<const GDScriptParser::DictionaryNode *>(op->arguments[0]);
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_DICTIONARY) {
@@ -1041,7 +1043,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
// Look if it is an array node
if (!found && index.value.is_num()) {
int idx = index.value;
- const GDScriptParser::ArrayNode *an = NULL;
+ const GDScriptParser::ArrayNode *an = nullptr;
if (op->arguments[0]->type == GDScriptParser::Node::TYPE_ARRAY) {
an = static_cast<const GDScriptParser::ArrayNode *>(op->arguments[0]);
} else if (base.assigned_expression && base.assigned_expression->type == GDScriptParser::Node::TYPE_ARRAY) {
@@ -1061,7 +1063,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
found = _guess_identifier_type_from_base(c, base, id, r_type);
} else if (!found && index.type.kind == GDScriptParser::DataType::BUILTIN) {
Callable::CallError err;
- Variant base_val = Variant::construct(base.type.builtin_type, NULL, 0, err);
+ Variant base_val = Variant::construct(base.type.builtin_type, nullptr, 0, err);
bool valid = false;
Variant res = base_val.get(index.value, &valid);
if (valid) {
@@ -1116,9 +1118,9 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G
Callable::CallError ce;
bool v1_use_value = p1.value.get_type() != Variant::NIL && p1.value.get_type() != Variant::OBJECT;
- Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, NULL, 0, ce);
+ Variant v1 = (v1_use_value) ? p1.value : Variant::construct(p1.type.builtin_type, nullptr, 0, ce);
bool v2_use_value = p2.value.get_type() != Variant::NIL && p2.value.get_type() != Variant::OBJECT;
- Variant v2 = (v2_use_value) ? p2.value : Variant::construct(p2.type.builtin_type, NULL, 0, ce);
+ Variant v2 = (v2_use_value) ? p2.value : Variant::construct(p2.type.builtin_type, nullptr, 0, ce);
// avoid potential invalid ops
if ((vop == Variant::OP_DIVIDE || vop == Variant::OP_MODULE) && v2.get_type() == Variant::INT) {
v2 = 1;
@@ -1173,7 +1175,7 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
// Look in blocks first
const GDScriptParser::BlockNode *blk = p_context.block;
int last_assign_line = -1;
- const GDScriptParser::Node *last_assigned_expression = NULL;
+ const GDScriptParser::Node *last_assigned_expression = nullptr;
GDScriptParser::DataType var_type;
while (blk) {
if (blk->variables.has(p_identifier)) {
@@ -1227,7 +1229,7 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
r_type.type.is_meta_type = false; // Right-hand of `is` will be a meta type, but the left-hand value is not
// Not an assignment, it shouldn't carry any value
r_type.value = Variant();
- r_type.assigned_expression = NULL;
+ r_type.assigned_expression = nullptr;
return true;
}
@@ -1271,8 +1273,8 @@ static bool _guess_identifier_type(GDScriptCompletionContext &p_context, const S
return false;
}
GDScriptCompletionContext c = p_context;
- c.function = NULL;
- c.block = NULL;
+ c.function = nullptr;
+ c.block = nullptr;
return _guess_expression_type(c, op->arguments[1], r_type);
}
}
@@ -1534,7 +1536,7 @@ static bool _guess_identifier_type_from_base(GDScriptCompletionContext &p_contex
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return false;
@@ -1612,7 +1614,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
for (int i = 0; i < base_type.class_type->static_functions.size(); i++) {
if (base_type.class_type->static_functions[i]->name == p_method) {
int last_return_line = -1;
- const GDScriptParser::Node *last_returned_value = NULL;
+ const GDScriptParser::Node *last_returned_value = nullptr;
GDScriptCompletionContext c = p_context;
c._class = base_type.class_type;
c.function = base_type.class_type->static_functions[i];
@@ -1629,7 +1631,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
for (int i = 0; i < base_type.class_type->functions.size(); i++) {
if (base_type.class_type->functions[i]->name == p_method) {
int last_return_line = -1;
- const GDScriptParser::Node *last_returned_value = NULL;
+ const GDScriptParser::Node *last_returned_value = nullptr;
GDScriptCompletionContext c = p_context;
c._class = base_type.class_type;
c.function = base_type.class_type->functions[i];
@@ -1704,7 +1706,7 @@ static bool _guess_method_return_type_from_base(GDScriptCompletionContext &p_con
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return false;
}
@@ -1911,8 +1913,8 @@ static void _find_identifiers_in_class(const GDScriptCompletionContext &p_contex
base_type.value = p_context.base;
GDScriptCompletionContext c = p_context;
- c.block = NULL;
- c.function = NULL;
+ c.block = nullptr;
+ c.function = nullptr;
_find_identifiers_in_base(c, base_type, p_only_functions, r_result);
}
@@ -1932,8 +1934,8 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
case GDScriptParser::DataType::CLASS: {
GDScriptCompletionContext c = p_context;
c._class = base_type.class_type;
- c.block = NULL;
- c.function = NULL;
+ c.block = nullptr;
+ c.function = nullptr;
_find_identifiers_in_class(c, _static, p_only_functions, false, r_result);
base_type = base_type.class_type->base_type;
} break;
@@ -2089,7 +2091,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionContext &p_context
} break;
case GDScriptParser::DataType::BUILTIN: {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return;
}
@@ -2153,8 +2155,8 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
while (clss) {
GDScriptCompletionContext c = p_context;
c._class = clss;
- c.block = NULL;
- c.function = NULL;
+ c.block = nullptr;
+ c.function = nullptr;
_find_identifiers_in_class(c, _static, p_only_functions, false, r_result);
_static = true;
clss = clss->owner;
@@ -2188,7 +2190,7 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
"const", "enum", "export", "onready", "static", "var", "break", "continue", "if", "elif",
"else", "for", "pass", "return", "match", "while", "remote", "master", "puppet",
"remotesync", "mastersync", "puppetsync",
- 0
+ nullptr
};
const char **kw = _keywords;
@@ -2373,7 +2375,7 @@ static void _find_call_arguments(const GDScriptCompletionContext &p_context, con
case GDScriptParser::DataType::BUILTIN: {
if (base.get_type() == Variant::NIL) {
Callable::CallError err;
- base = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ base = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
return;
}
@@ -2542,7 +2544,7 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
context.function = parser.get_completion_function();
context.line = parser.get_completion_line();
- if (!context._class || context._class->owner == NULL) {
+ if (!context._class || context._class->owner == nullptr) {
context.base = p_owner;
context.base_path = p_path.get_base_dir();
}
@@ -2626,13 +2628,13 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
}
GDScriptCompletionContext c = context;
- c.function = NULL;
- c.block = NULL;
- c.base = base.value.get_type() == Variant::OBJECT ? base.value.operator Object *() : NULL;
+ c.function = nullptr;
+ c.block = nullptr;
+ c.base = base.value.get_type() == Variant::OBJECT ? base.value.operator Object *() : nullptr;
if (base.type.kind == GDScriptParser::DataType::CLASS) {
c._class = base.type.class_type;
} else {
- c._class = NULL;
+ c._class = nullptr;
}
_find_identifiers_in_base(c, base, is_function, options);
@@ -2818,8 +2820,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
for (Map<StringName, GDScriptParser::ClassNode::Constant>::Element *E = clss->constant_expressions.front(); E; E = E->next()) {
GDScriptCompletionIdentifier constant;
GDScriptCompletionContext c = context;
- c.function = NULL;
- c.block = NULL;
+ c.function = nullptr;
+ c.block = nullptr;
c.line = E->value().expression->line;
if (_guess_expression_type(c, E->value().expression, constant)) {
if (constant.type.has_type && constant.type.is_meta_type) {
@@ -2887,9 +2889,9 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
}
GDScriptCompletionContext c = context;
- c._class = NULL;
- c.function = NULL;
- c.block = NULL;
+ c._class = nullptr;
+ c.function = nullptr;
+ c.block = nullptr;
bool finding = true;
index = index.right(index.find(".") + 1);
while (index.find(".") != -1) {
@@ -2917,8 +2919,8 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path
GDScriptCompletionIdentifier constant;
GDScriptCompletionContext c2 = context;
c2._class = base_type.class_type;
- c2.function = NULL;
- c2.block = NULL;
+ c2.function = nullptr;
+ c2.block = nullptr;
c2.line = E->value().expression->line;
if (_guess_expression_type(c2, E->value().expression, constant)) {
if (constant.type.has_type && constant.type.is_meta_type) {
@@ -3220,7 +3222,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
v = v_ref;
} else {
Callable::CallError err;
- v = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ v = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
break;
}
@@ -3440,7 +3442,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
// 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) {
+ if (enumName != nullptr) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS_ENUM;
r_result.class_name = "@GlobalScope";
r_result.class_member = enumName;
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 0721c25388..ca4d6f6de9 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -45,7 +45,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
#ifdef DEBUG_ENABLED
if (unlikely(!p_instance)) {
r_error = "Cannot access self without instance.";
- return NULL;
+ return nullptr;
}
#endif
return &self;
@@ -58,7 +58,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
#ifdef DEBUG_ENABLED
if (unlikely(!p_instance)) {
r_error = "Cannot access member without instance.";
- return NULL;
+ return nullptr;
}
#endif
//member indexing is O(1)
@@ -69,7 +69,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
//todo change to index!
GDScript *s = p_script;
#ifdef DEBUG_ENABLED
- ERR_FAIL_INDEX_V(address, _global_names_count, NULL);
+ ERR_FAIL_INDEX_V(address, _global_names_count, nullptr);
#endif
const StringName *sn = &_global_names_ptr[address];
@@ -86,31 +86,31 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
s = s->_base;
}
- ERR_FAIL_V_MSG(NULL, "GDScriptCompiler bug.");
+ ERR_FAIL_V_MSG(nullptr, "GDScriptCompiler bug.");
} break;
case ADDR_TYPE_LOCAL_CONSTANT: {
#ifdef DEBUG_ENABLED
- ERR_FAIL_INDEX_V(address, _constant_count, NULL);
+ ERR_FAIL_INDEX_V(address, _constant_count, nullptr);
#endif
return &_constants_ptr[address];
} break;
case ADDR_TYPE_STACK:
case ADDR_TYPE_STACK_VARIABLE: {
#ifdef DEBUG_ENABLED
- ERR_FAIL_INDEX_V(address, _stack_size, NULL);
+ ERR_FAIL_INDEX_V(address, _stack_size, nullptr);
#endif
return &p_stack[address];
} break;
case ADDR_TYPE_GLOBAL: {
#ifdef DEBUG_ENABLED
- ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), NULL);
+ ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), nullptr);
#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);
+ ERR_FAIL_INDEX_V(address, _named_globals_count, nullptr);
#endif
StringName id = _named_globals_ptr[address];
@@ -118,7 +118,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id];
} else {
r_error = "Autoload singleton '" + String(id) + "' has been removed.";
- return NULL;
+ return nullptr;
}
} break;
#endif
@@ -127,8 +127,8 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
} break;
}
- ERR_FAIL_V_MSG(NULL, "Bad code! (unknown addressing mode).");
- return NULL;
+ ERR_FAIL_V_MSG(nullptr, "Bad code! (unknown addressing mode).");
+ return nullptr;
}
#ifdef DEBUG_ENABLED
@@ -272,7 +272,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
Variant self;
Variant static_ref;
Variant retvalue;
- Variant *stack = NULL;
+ Variant *stack = nullptr;
Variant **call_args;
int defarg = 0;
@@ -358,7 +358,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
memnew_placement(&stack[i], Variant);
}
} else {
- stack = NULL;
+ stack = nullptr;
}
if (_call_size) {
@@ -366,12 +366,12 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
call_args = (Variant **)&aptr[sizeof(Variant) * _stack_size];
} else {
- call_args = NULL;
+ call_args = nullptr;
}
} else {
- stack = NULL;
- call_args = NULL;
+ stack = nullptr;
+ call_args = nullptr;
}
if (p_instance) {
@@ -490,7 +490,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GET_VARIANT_PTR(dst, 3);
#ifdef DEBUG_ENABLED
- if (b->get_type() != Variant::OBJECT || b->operator Object *() == NULL) {
+ if (b->get_type() != Variant::OBJECT || b->operator Object *() == nullptr) {
err_text = "Right operand of 'is' is not a class.";
OPCODE_BREAK;
@@ -498,7 +498,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#endif
bool extends_ok = false;
- if (a->get_type() == Variant::OBJECT && a->operator Object *() != NULL) {
+ if (a->get_type() == Variant::OBJECT && a->operator Object *() != nullptr) {
#ifdef DEBUG_ENABLED
bool was_freed;
@@ -855,7 +855,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_BREAK;
}
- if (src->get_type() != Variant::NIL && src->operator Object *() != NULL) {
+ if (src->get_type() != Variant::NIL && src->operator Object *() != nullptr) {
ScriptInstance *scr_inst = src->operator Object *()->get_script_instance();
if (!scr_inst) {
@@ -960,7 +960,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
bool valid = false;
- if (src->get_type() != Variant::NIL && src->operator Object *() != NULL) {
+ if (src->get_type() != Variant::NIL && src->operator Object *() != nullptr) {
ScriptInstance *scr_inst = src->operator Object *()->get_script_instance();
@@ -1099,7 +1099,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
base->call_ptr(*methodname, (const Variant **)argptrs, argc, ret, err);
} else {
- base->call_ptr(*methodname, (const Variant **)argptrs, argc, NULL, err);
+ base->call_ptr(*methodname, (const Variant **)argptrs, argc, nullptr, err);
}
#ifdef DEBUG_ENABLED
if (GDScriptLanguage::get_singleton()->profiling) {
@@ -1137,7 +1137,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
}
#endif
- //_call_func(NULL,base,*methodname,ip,argc,p_instance,stack);
+ //_call_func(nullptr,base,*methodname,ip,argc,p_instance,stack);
ip += argc + 1;
}
DISPATCH_OPCODE;
@@ -1216,7 +1216,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
const GDScript *gds = _script;
- const Map<StringName, GDScriptFunction *>::Element *E = NULL;
+ const Map<StringName, GDScriptFunction *>::Element *E = nullptr;
while (gds->base.ptr()) {
gds = gds->base.ptr();
E = gds->member_functions.find(*methodname);
@@ -1767,7 +1767,7 @@ GDScriptFunction::GDScriptFunction() :
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
name = "<anonymous>";
#ifdef DEBUG_ENABLED
- _func_cname = NULL;
+ _func_cname = nullptr;
{
MutexLock lock(GDScriptLanguage::get_singleton()->lock);
@@ -1834,7 +1834,7 @@ Variant GDScriptFunctionState::_signal_callback(const Variant **p_args, int p_ar
bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
- if (function == NULL)
+ if (function == nullptr)
return false;
if (p_extended_check) {
@@ -1859,7 +1859,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
state.result = p_arg;
Callable::CallError err;
- Variant ret = function->call(NULL, NULL, 0, err, &state);
+ Variant ret = function->call(nullptr, nullptr, 0, err, &state);
bool completed = true;
@@ -1873,7 +1873,7 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
}
}
- function = NULL; //cleaned up;
+ function = nullptr; //cleaned up;
state.result = Variant();
if (completed) {
@@ -1909,12 +1909,12 @@ void GDScriptFunctionState::_bind_methods() {
GDScriptFunctionState::GDScriptFunctionState() {
- function = NULL;
+ function = nullptr;
}
GDScriptFunctionState::~GDScriptFunctionState() {
- if (function != NULL) {
+ if (function != nullptr) {
//never called, deinitialize stack
for (int i = 0; i < state.stack_size; i++) {
Variant *v = (Variant *)&state.stack[sizeof(Variant) * i];
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 0afffcac73..acfc0a95b4 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -105,7 +105,7 @@ struct GDScriptDataType {
return false;
}
- Ref<Script> base = obj && obj->get_script_instance() ? obj->get_script_instance()->get_script() : NULL;
+ Ref<Script> base = obj && obj->get_script_instance() ? obj->get_script_instance()->get_script() : nullptr;
bool valid = false;
while (base.is_valid()) {
if (base == script_type) {
@@ -339,7 +339,7 @@ public:
return default_arguments[p_idx];
}
- Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state = NULL);
+ Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state = nullptr);
_FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const { return rpc_mode; }
GDScriptFunction();
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index aaa308f40f..9154d6eb89 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -858,7 +858,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
PackedByteArray barr;
int len;
- Error err = encode_variant(*p_args[0], NULL, len, full_objects);
+ Error err = encode_variant(*p_args[0], nullptr, len, full_objects);
if (err) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
@@ -908,7 +908,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
Variant ret;
{
const uint8_t *r = varr.ptr();
- Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
+ Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
if (err != OK) {
r_ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -1198,7 +1198,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
}
- r_ret = gdscr->_new(NULL, 0, r_error);
+ r_ret = gdscr->_new(nullptr, 0, r_error);
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
Ref<GDScript> gd_ref = ins->get_script();
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 9c39294e3e..a99d4b96f7 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -242,7 +242,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
Vector<Expression> expression;
- Node *expr = NULL;
+ Node *expr = nullptr;
int op_line = tokenizer->get_token_line(); // when operators are created at the bottom, the line might have been changed (\n found)
@@ -276,12 +276,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
Node *subexpr = _parse_expression(p_parent, p_static, p_allow_assign, p_parsing_constant);
parenthesis--;
if (!subexpr)
- return NULL;
+ return nullptr;
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' in expression");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
@@ -318,7 +318,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token_constant().get_type() != Variant::STRING) {
_set_error("Expected string constant or identifier after '$' or '/'.");
- return NULL;
+ return nullptr;
}
path += String(tokenizer->get_token_constant());
@@ -355,7 +355,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (path == "") {
_set_error("Path expected after $.");
- return NULL;
+ return nullptr;
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -427,7 +427,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
tokenizer->advance();
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
_set_error("Expected '(' after 'preload'");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
@@ -476,7 +476,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (!valid) {
_set_error("expected string constant as 'preload' argument.");
- return NULL;
+ return nullptr;
}
if (!path.is_abs_path() && base_path != "")
@@ -485,7 +485,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (path == self_path) {
_set_error("Can't preload itself (use 'get_script()').");
- return NULL;
+ return nullptr;
}
Ref<Resource> res;
@@ -503,26 +503,26 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (!FileAccess::exists(path)) {
_set_error("Can't preload resource at path: " + path);
- return NULL;
+ return nullptr;
} 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;
+ return nullptr;
}
}
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' after 'preload' path");
- return NULL;
+ return nullptr;
}
Ref<GDScript> gds = res;
if (gds.is_valid() && !gds->is_valid()) {
_set_error("Couldn't fully preload the script, possible cyclic reference or compilation error. Use \"load()\" instead if a cyclic reference is intended.");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
@@ -536,7 +536,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (!current_function) {
_set_error("\"yield()\" can only be used inside function blocks.");
- return NULL;
+ return nullptr;
}
current_function->has_yield = true;
@@ -544,7 +544,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
tokenizer->advance();
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
_set_error("Expected \"(\" after \"yield\".");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
@@ -565,12 +565,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
Node *object = _parse_and_reduce_expression(p_parent, p_static);
if (!object)
- return NULL;
+ return nullptr;
yield->arguments.push_back(object);
if (tokenizer->get_token() != GDScriptTokenizer::TK_COMMA) {
_set_error("Expected \",\" after the first argument of \"yield\".");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
@@ -591,12 +591,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
Node *signal = _parse_and_reduce_expression(p_parent, p_static);
if (!signal)
- return NULL;
+ return nullptr;
yield->arguments.push_back(signal);
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected \")\" after the second argument of \"yield\".");
- return NULL;
+ return nullptr;
}
parenthesis--;
@@ -610,7 +610,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (p_static) {
_set_error("\"self\" isn't allowed in a static function or constant expression.");
- return NULL;
+ return nullptr;
}
//constant defined by tokenizer
SelfNode *self = alloc_node<SelfNode>();
@@ -631,7 +631,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (identifier == StringName()) {
_set_error("Built-in type constant or static function expected after \".\".");
- return NULL;
+ return nullptr;
}
if (!Variant::has_constant(bi_type, identifier)) {
@@ -657,7 +657,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
op->arguments.push_back(id);
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
- return NULL;
+ return nullptr;
expr = op;
} else {
@@ -674,7 +674,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
if (!valid) {
_set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + ".");
- return NULL;
+ return nullptr;
}
}
} else {
@@ -749,7 +749,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
if (!replaced) {
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
- return NULL;
+ return nullptr;
expr = op;
}
} else if (tokenizer->is_token_literal(0, true)) {
@@ -789,7 +789,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (lv->assignments == 0) {
if (!lv->datatype.has_type) {
_set_error("Using assignment with operation on a variable that was never assigned.");
- return NULL;
+ return nullptr;
}
_add_warning(GDScriptWarning::UNASSIGNED_VARIABLE_OP_ASSIGN, -1, identifier.operator String());
}
@@ -912,7 +912,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (e.op != OperatorNode::OP_NOT && tokenizer->get_token() == GDScriptTokenizer::TK_OP_NOT) {
_set_error("Misplaced 'not'.");
- return NULL;
+ return nullptr;
}
expression.push_back(e);
@@ -921,7 +921,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
/*
Node *subexpr=_parse_expression(op,p_static);
if (!subexpr)
- return NULL;
+ return nullptr;
op->arguments.push_back(subexpr);
expr=op;*/
@@ -929,7 +929,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// 'is' operator with built-in type
if (!expr) {
_set_error("Expected identifier before 'is' operator");
- return NULL;
+ return nullptr;
}
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_IS_BUILTIN;
@@ -955,7 +955,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) {
_set_error("Unterminated array");
- return NULL;
+ return nullptr;
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_BRACKET_CLOSE) {
tokenizer->advance();
@@ -966,7 +966,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
if (!expecting_comma) {
_set_error("expression or ']' expected");
- return NULL;
+ return nullptr;
}
expecting_comma = false;
@@ -975,11 +975,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
//parse expression
if (expecting_comma) {
_set_error("',' or ']' expected");
- return NULL;
+ return nullptr;
}
Node *n = _parse_expression(arr, p_static, p_allow_assign, p_parsing_constant);
if (!n)
- return NULL;
+ return nullptr;
arr->elements.push_back(n);
expecting_comma = true;
}
@@ -1001,7 +1001,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
};
- Node *key = NULL;
+ Node *key = nullptr;
Set<Variant> keys;
DictExpect expecting = DICT_EXPECT_KEY;
@@ -1011,17 +1011,17 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) {
_set_error("Unterminated dictionary");
- return NULL;
+ return nullptr;
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_CURLY_BRACKET_CLOSE) {
if (expecting == DICT_EXPECT_COLON) {
_set_error("':' expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_VALUE) {
_set_error("value expected");
- return NULL;
+ return nullptr;
}
tokenizer->advance();
break;
@@ -1032,15 +1032,15 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expecting == DICT_EXPECT_KEY) {
_set_error("key or '}' expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_VALUE) {
_set_error("value expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_COLON) {
_set_error("':' expected");
- return NULL;
+ return nullptr;
}
expecting = DICT_EXPECT_KEY;
@@ -1050,15 +1050,15 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expecting == DICT_EXPECT_KEY) {
_set_error("key or '}' expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_VALUE) {
_set_error("value expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_COMMA) {
_set_error("',' or '}' expected");
- return NULL;
+ return nullptr;
}
expecting = DICT_EXPECT_VALUE;
@@ -1067,11 +1067,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expecting == DICT_EXPECT_COMMA) {
_set_error("',' or '}' expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_COLON) {
_set_error("':' expected");
- return NULL;
+ return nullptr;
}
if (expecting == DICT_EXPECT_KEY) {
@@ -1089,7 +1089,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
//python/js style more flexible
key = _parse_expression(dict, p_static, p_allow_assign, p_parsing_constant);
if (!key)
- return NULL;
+ return nullptr;
expecting = DICT_EXPECT_COLON;
}
}
@@ -1097,7 +1097,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expecting == DICT_EXPECT_VALUE) {
Node *value = _parse_expression(dict, p_static, p_allow_assign, p_parsing_constant);
if (!value)
- return NULL;
+ return nullptr;
expecting = DICT_EXPECT_COMMA;
if (key->type == GDScriptParser::Node::TYPE_CONSTANT) {
@@ -1105,7 +1105,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (keys.has(keyName)) {
_set_error("Duplicate key found in Dictionary literal");
- return NULL;
+ return nullptr;
}
keys.insert(keyName);
}
@@ -1114,7 +1114,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
pair.key = key;
pair.value = value;
dict->elements.push_back(pair);
- key = NULL;
+ key = nullptr;
}
}
}
@@ -1142,12 +1142,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
if (!is_completion) {
_set_error("Expected '(' for parent function call.");
- return NULL;
+ return nullptr;
}
} else {
tokenizer->advance();
if (!_parse_arguments(op, op->arguments, p_static, false, p_parsing_constant)) {
- return NULL;
+ return nullptr;
}
}
@@ -1166,10 +1166,10 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
//find list [ or find dictionary {
_set_error("Error parsing expression, misplaced: " + String(tokenizer->get_token_name(tokenizer->get_token())));
- return NULL; //nothing
+ return nullptr; //nothing
}
- ERR_FAIL_COND_V_MSG(!expr, NULL, "GDScriptParser bug, couldn't figure out what expression is.");
+ ERR_FAIL_COND_V_MSG(!expr, nullptr, "GDScriptParser bug, couldn't figure out what expression is.");
/******************/
/* Parse Indexing */
@@ -1186,7 +1186,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token(1) != GDScriptTokenizer::TK_CURSOR && !tokenizer->is_token_literal(1)) {
// We check with is_token_literal, as this allows us to use match/sync/etc. as a name
_set_error("Expected identifier as member");
- return NULL;
+ return nullptr;
} else if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
//call!!
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1212,7 +1212,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
completion_node = op;
}
if (!_parse_arguments(op, op->arguments, p_static, true, p_parsing_constant))
- return NULL;
+ return nullptr;
expr = op;
} else {
@@ -1251,12 +1251,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
Node *subexpr = _parse_expression(op, p_static, p_allow_assign, p_parsing_constant);
if (!subexpr) {
- return NULL;
+ return nullptr;
}
if (tokenizer->get_token() != GDScriptTokenizer::TK_BRACKET_CLOSE) {
_set_error("Expected ']'");
- return NULL;
+ return nullptr;
}
op->arguments.push_back(expr);
@@ -1276,12 +1276,12 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (tokenizer->get_token() == GDScriptTokenizer::TK_PR_AS) {
if (has_casting) {
_set_error("Unexpected 'as'.");
- return NULL;
+ return nullptr;
}
CastNode *cn = alloc_node<CastNode>();
if (!_parse_type(cn->cast_type)) {
_set_error("Expected type after 'as'.");
- return NULL;
+ return nullptr;
}
has_casting = true;
cn->source_node = expr;
@@ -1313,7 +1313,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
#define _VALIDATE_ASSIGN \
if (!p_allow_assign || has_casting) { \
_set_error("Unexpected assign."); \
- return NULL; \
+ return nullptr; \
} \
p_allow_assign = false;
@@ -1479,7 +1479,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
default: {
_set_error("GDScriptParser bug, invalid operator in expression: " + itos(expression[i].op));
- return NULL;
+ return nullptr;
}
}
@@ -1488,7 +1488,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// <= is used for right to left
if (error) {
_set_error("Unexpected operator");
- return NULL;
+ return nullptr;
}
next_op = i;
min_priority = priority;
@@ -1500,7 +1500,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// OK! create operator..
@@ -1513,7 +1513,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expr_pos == expression.size()) {
//can happen..
_set_error("Unexpected end of expression...");
- return NULL;
+ return nullptr;
}
}
@@ -1532,16 +1532,16 @@ 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...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (next_op >= (expression.size() - 2) || expression[next_op + 2].op != OperatorNode::OP_TERNARY_ELSE) {
_set_error("Expected else after ternary if.");
- return NULL;
+ return nullptr;
}
if (next_op >= (expression.size() - 3)) {
_set_error("Expected value after ternary else.");
- return NULL;
+ return nullptr;
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1551,7 +1551,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (expression[next_op + 1].is_op) {
@@ -1561,7 +1561,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators after ternary if.");
- return NULL;
+ return nullptr;
}
if (expression[next_op + 3].is_op) {
@@ -1571,7 +1571,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators after ternary else.");
- return NULL;
+ return nullptr;
}
op->arguments.push_back(expression[next_op + 1].node); //next expression goes as first
@@ -1588,7 +1588,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1598,7 +1598,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (expression[next_op + 1].is_op) {
@@ -1608,7 +1608,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators.");
- return NULL;
+ return nullptr;
}
op->arguments.push_back(expression[next_op - 1].node); //expression goes as left
@@ -1725,7 +1725,7 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to
if ((op->arguments[0]->type == Node::TYPE_TYPE || (op->arguments[0]->type == Node::TYPE_BUILT_IN_FUNCTION && GDScriptFunctions::is_deterministic(static_cast<BuiltInFunctionNode *>(op->arguments[0])->function))) && last_not_constant == 0) {
//native type constructor or intrinsic function
- const Variant **vptr = NULL;
+ const Variant **vptr = nullptr;
Vector<Variant *> ptrs;
if (op->arguments.size() > 1) {
@@ -2015,10 +2015,10 @@ GDScriptParser::Node *GDScriptParser::_parse_and_reduce_expression(Node *p_paren
Node *expr = _parse_expression(p_parent, p_static, p_allow_assign, p_reduce_const);
if (!expr || error_set)
- return NULL;
+ return nullptr;
expr = _reduce_expression(expr, p_reduce_const);
if (!expr || error_set)
- return NULL;
+ return nullptr;
return expr;
}
@@ -2046,10 +2046,10 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
GDScriptTokenizer::Token token = tokenizer->get_token();
if (error_set)
- return NULL;
+ return nullptr;
if (token == GDScriptTokenizer::TK_EOF) {
- return NULL;
+ return nullptr;
}
switch (token) {
@@ -2078,13 +2078,13 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
break;
} else {
_set_error("'..' pattern only allowed at the end of an array pattern");
- return NULL;
+ return nullptr;
}
}
PatternNode *sub_pattern = _parse_pattern(p_static);
if (!sub_pattern) {
- return NULL;
+ return nullptr;
}
pattern->array.push_back(sub_pattern);
@@ -2097,7 +2097,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
break;
} else {
_set_error("Not a valid pattern");
- return NULL;
+ return nullptr;
}
}
} break;
@@ -2106,7 +2106,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
tokenizer->advance();
if (!tokenizer->is_token_literal()) {
_set_error("Expected identifier for binding variable name.");
- return NULL;
+ return nullptr;
}
pattern->pt_type = GDScriptParser::PatternNode::PT_BIND;
pattern->bind = tokenizer->get_token_literal();
@@ -2115,7 +2115,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
while (bl) {
if (bl->variables.has(pattern->bind)) {
_set_error("Binding name of '" + pattern->bind.operator String() + "' is already declared in this scope.");
- return NULL;
+ return nullptr;
}
bl = bl->parent_block;
}
@@ -2150,19 +2150,19 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
break;
} else {
_set_error("'..' pattern only allowed at the end of a dictionary pattern");
- return NULL;
+ return nullptr;
}
}
Node *key = _parse_and_reduce_expression(pattern, p_static);
if (!key) {
_set_error("Not a valid key in pattern");
- return NULL;
+ return nullptr;
}
if (key->type != GDScriptParser::Node::TYPE_CONSTANT) {
_set_error("Not a constant expression as key");
- return NULL;
+ return nullptr;
}
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
@@ -2171,12 +2171,12 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
PatternNode *value = _parse_pattern(p_static);
if (!value) {
_set_error("Expected pattern in dictionary value");
- return NULL;
+ return nullptr;
}
pattern->dictionary.insert(static_cast<ConstantNode *>(key), value);
} else {
- pattern->dictionary.insert(static_cast<ConstantNode *>(key), NULL);
+ pattern->dictionary.insert(static_cast<ConstantNode *>(key), nullptr);
}
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
@@ -2187,7 +2187,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
break;
} else {
_set_error("Not a valid pattern");
- return NULL;
+ return nullptr;
}
}
} break;
@@ -2200,7 +2200,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
Node *value = _parse_and_reduce_expression(pattern, p_static);
if (!value) {
_set_error("Expect constant expression or variables in a pattern");
- return NULL;
+ return nullptr;
}
if (value->type == Node::TYPE_OPERATOR) {
@@ -2212,19 +2212,19 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) {
if (op_node->op != OperatorNode::OP_INDEX_NAMED) {
_set_error("Invalid operator in pattern. Only index (`A.B`) is allowed");
- return NULL;
+ return nullptr;
}
current_value = op_node->arguments[0];
}
if (current_value->type != Node::TYPE_IDENTIFIER) {
_set_error("Only constant expression or variables allowed in a pattern");
- return NULL;
+ return nullptr;
}
} else if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
_set_error("Only constant expressions or variables allowed in a pattern");
- return NULL;
+ return nullptr;
}
pattern->pt_type = PatternNode::PT_CONSTANT;
@@ -2332,7 +2332,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
return;
}
- OperatorNode *type_comp = NULL;
+ OperatorNode *type_comp = nullptr;
// static type check if possible
if (pattern_type.has_type && to_match_type.has_type) {
@@ -2402,7 +2402,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
// typeof(value_to_match) == TYPE_ARRAY && value_to_match.size() == length
{
- OperatorNode *type_comp = NULL;
+ OperatorNode *type_comp = nullptr;
// static type check if possible
if (to_match_type.has_type) {
// must be an array
@@ -2461,7 +2461,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
for (int i = 0; i < p_pattern->array.size(); i++) {
PatternNode *pattern = p_pattern->array[i];
- Node *condition = NULL;
+ Node *condition = nullptr;
ConstantNode *index = alloc_node<ConstantNode>();
index->value = Variant(i);
@@ -2495,7 +2495,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
// typeof(value_to_match) == TYPE_DICTIONARY && value_to_match.size() == length
{
- OperatorNode *type_comp = NULL;
+ OperatorNode *type_comp = nullptr;
// static type check if possible
if (to_match_type.has_type) {
// must be an dictionary
@@ -2553,7 +2553,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
for (Map<ConstantNode *, PatternNode *>::Element *e = p_pattern->dictionary.front(); e; e = e->next()) {
- Node *condition = NULL;
+ Node *condition = nullptr;
// check for has, then for pattern
@@ -2629,7 +2629,7 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
PatternBranchNode *branch = p_match_statement->branches[i];
MatchNode::CompiledPatternBranch compiled_branch;
- compiled_branch.compiled_pattern = NULL;
+ compiled_branch.compiled_pattern = nullptr;
Map<StringName, Node *> binding;
@@ -2638,7 +2638,7 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
_mark_line_as_safe(pattern->line);
Map<StringName, Node *> bindings;
- Node *resulting_node = NULL;
+ Node *resulting_node = nullptr;
_generate_pattern(pattern, id, resulting_node, bindings);
if (!resulting_node) {
@@ -2838,7 +2838,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
lv->line = var_line;
p_block->statements.push_back(lv);
- Node *assigned = NULL;
+ Node *assigned = nullptr;
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
@@ -3934,7 +3934,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
current_function = function;
Node *arg = _parse_and_reduce_expression(p_class, _static);
- current_function = NULL;
+ current_function = nullptr;
cparent->arguments.push_back(arg);
if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
@@ -3989,7 +3989,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
function->body = block;
current_block = block;
_parse_block(block, _static);
- current_block = NULL;
+ current_block = nullptr;
//arguments
} break;
@@ -4735,7 +4735,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
member.identifier = tokenizer->get_token_literal();
- member.expression = NULL;
+ member.expression = nullptr;
member._export.name = member.identifier;
member.line = tokenizer->get_token_line();
member.usages = 0;
@@ -4815,7 +4815,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
#ifdef TOOLS_ENABLED
Callable::CallError ce;
- member.default_value = Variant::construct(member._export.type, NULL, 0, ce);
+ member.default_value = Variant::construct(member._export.type, nullptr, 0, ce);
#endif
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
@@ -4868,7 +4868,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (cn->value.get_type() == Variant::OBJECT) {
Object *obj = cn->value;
Resource *res = Object::cast_to<Resource>(obj);
- if (res == NULL) {
+ if (res == nullptr) {
_set_error("The exported constant isn't a type or resource.");
return;
}
@@ -5256,7 +5256,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
Ref<GDScript> script;
StringName native;
- ClassNode *base_class = NULL;
+ ClassNode *base_class = nullptr;
if (path != "") {
//path (and optionally subclasses)
@@ -5318,7 +5318,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
_set_error("The class \"" + base + "\" couldn't be fully loaded (script error or cyclic dependency).", p_class->line);
return;
}
- p = NULL;
+ p = nullptr;
} else {
List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props);
@@ -5341,7 +5341,7 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive
_set_error("Class '" + base + "' could not be fully loaded (script error or cyclic inheritance).", p_class->line);
return;
}
- p = NULL;
+ p = nullptr;
}
}
}
@@ -5661,7 +5661,7 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
StringName id = full_name[name_part];
DataType base_type = result;
- ClassNode *p = NULL;
+ ClassNode *p = nullptr;
if (name_part == 0) {
if (ScriptServer::is_global_class(id)) {
String script_path = ScriptServer::get_global_class_path(id);
@@ -5943,7 +5943,7 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper
a = a_ref;
} else {
Callable::CallError err;
- a = Variant::construct(a_type, NULL, 0, err);
+ a = Variant::construct(a_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
r_valid = false;
return DataType();
@@ -5956,7 +5956,7 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper
b = b_ref;
} else {
Callable::CallError err;
- b = Variant::construct(b_type, NULL, 0, err);
+ b = Variant::construct(b_type, nullptr, 0, err);
if (err.error != Callable::CallError::CALL_OK) {
r_valid = false;
return DataType();
@@ -6117,7 +6117,7 @@ bool GDScriptParser::_is_type_compatible(const DataType &p_container, const Data
StringName expr_native;
Ref<Script> expr_script;
- ClassNode *expr_class = NULL;
+ ClassNode *expr_class = nullptr;
switch (p_expression.kind) {
case DataType::NATIVE: {
@@ -6228,7 +6228,7 @@ GDScriptParser::Node *GDScriptParser::_get_default_value_for_type(const DataType
} else {
ConstantNode *c = alloc_node<ConstantNode>();
Callable::CallError err;
- c->value = Variant::construct(p_type.builtin_type, NULL, 0, err);
+ c->value = Variant::construct(p_type.builtin_type, nullptr, 0, err);
result = c;
}
} else {
@@ -6307,7 +6307,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
int idx = current_function->arguments.find(id->name);
node_type = current_function->argument_types[idx];
} else {
- node_type = _reduce_identifier_type(NULL, id->name, id->line, false);
+ node_type = _reduce_identifier_type(nullptr, id->name, id->line, false);
}
} break;
case Node::TYPE_CAST: {
@@ -6541,7 +6541,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
} break;
default: {
Callable::CallError err;
- Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant temp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
bool valid = false;
Variant res = temp.get(member_id->name.operator String(), &valid);
@@ -6670,7 +6670,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
}
default: {
Callable::CallError err;
- Variant temp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant temp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
bool valid = false;
Variant res = temp.get(cn->value, &valid);
@@ -6777,8 +6777,8 @@ bool GDScriptParser::_get_function_signature(DataType &p_base_type, const String
r_default_arg_count = 0;
DataType original_type = p_base_type;
- ClassNode *base = NULL;
- FunctionNode *callee = NULL;
+ ClassNode *base = nullptr;
+ FunctionNode *callee = nullptr;
if (p_base_type.kind == DataType::CLASS) {
base = p_base_type.class_type;
@@ -7111,7 +7111,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
if (base_type.kind == DataType::BUILTIN) {
Callable::CallError err;
- Variant tmp = Variant::construct(base_type.builtin_type, NULL, 0, err);
+ Variant tmp = Variant::construct(base_type.builtin_type, nullptr, 0, err);
if (check_types) {
if (!tmp.has_method(callee_name)) {
@@ -7275,7 +7275,7 @@ bool GDScriptParser::_get_member_type(const DataType &p_base_type, const StringN
DataType base_type = p_base_type;
// Check classes in current file
- ClassNode *base = NULL;
+ ClassNode *base = nullptr;
if (base_type.kind == DataType::CLASS) {
base = base_type.class_type;
}
@@ -7993,8 +7993,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
current_block = current_function->body;
_mark_line_as_safe(current_function->line);
_check_block_types(current_block);
- current_block = NULL;
- current_function = NULL;
+ current_block = nullptr;
+ current_function = nullptr;
if (error_set) return;
}
@@ -8003,8 +8003,8 @@ void GDScriptParser::_check_class_blocks_types(ClassNode *p_class) {
current_block = current_function->body;
_mark_line_as_safe(current_function->line);
_check_block_types(current_block);
- current_block = NULL;
- current_function = NULL;
+ current_block = nullptr;
+ current_function = nullptr;
if (error_set) return;
}
@@ -8053,7 +8053,7 @@ static String _find_function_name(const GDScriptParser::OperatorNode *p_call) {
void GDScriptParser::_check_block_types(BlockNode *p_block) {
- Node *last_var_assign = NULL;
+ Node *last_var_assign = nullptr;
// Check each statement
for (List<Node *>::Element *E = p_block->statements.front(); E; E = E->next()) {
@@ -8444,7 +8444,7 @@ void GDScriptParser::_add_warning(int p_code, int p_line, const Vector<String> &
warn.symbols = p_symbols;
warn.line = p_line == -1 ? tokenizer->get_token_line() : p_line;
- List<GDScriptWarning>::Element *before = NULL;
+ List<GDScriptWarning>::Element *before = nullptr;
for (List<GDScriptWarning>::Element *E = warnings.front(); E; E = E->next()) {
if (E->get().line > warn.line) {
break;
@@ -8511,8 +8511,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
}
current_class = main_class;
- current_function = NULL;
- current_block = NULL;
+ current_function = nullptr;
+ current_block = nullptr;
if (for_completion) check_types = false;
@@ -8575,7 +8575,7 @@ Error GDScriptParser::parse_bytecode(const Vector<uint8_t> &p_bytecode, const St
tokenizer = tb;
Error ret = _parse(p_base_path);
memdelete(tb);
- tokenizer = NULL;
+ tokenizer = nullptr;
return ret;
}
@@ -8596,7 +8596,7 @@ Error GDScriptParser::parse(const String &p_code, const String &p_base_path, boo
tokenizer = tt;
Error ret = _parse(p_base_path);
memdelete(tt);
- tokenizer = NULL;
+ tokenizer = nullptr;
return ret;
}
@@ -8619,21 +8619,21 @@ void GDScriptParser::clear() {
memdelete(l);
}
- head = NULL;
- list = NULL;
+ head = nullptr;
+ list = nullptr;
completion_type = COMPLETION_NONE;
- completion_node = NULL;
- completion_class = NULL;
- completion_function = NULL;
- completion_block = NULL;
- current_block = NULL;
- current_class = NULL;
+ completion_node = nullptr;
+ completion_class = nullptr;
+ completion_function = nullptr;
+ completion_block = nullptr;
+ current_block = nullptr;
+ current_class = nullptr;
completion_found = false;
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
- current_function = NULL;
+ current_function = nullptr;
validating = false;
for_completion = false;
@@ -8650,7 +8650,7 @@ void GDScriptParser::clear() {
dependencies.clear();
error = "";
#ifdef DEBUG_ENABLED
- safe_lines = NULL;
+ safe_lines = nullptr;
#endif // DEBUG_ENABLED
}
@@ -8706,9 +8706,9 @@ int GDScriptParser::get_completion_identifier_is_function() {
GDScriptParser::GDScriptParser() {
- head = NULL;
- list = NULL;
- tokenizer = NULL;
+ head = nullptr;
+ list = nullptr;
+ tokenizer = nullptr;
pending_newline = -1;
clear();
}
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index c74d7dd856..eca5f83f7a 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -102,7 +102,7 @@ public:
infer_type(false),
may_yield(false),
builtin_type(Variant::NIL),
- class_type(NULL) {}
+ class_type(nullptr) {}
};
struct Node {
@@ -201,7 +201,7 @@ public:
extends_used = false;
classname_used = false;
end_line = -1;
- owner = NULL;
+ owner = nullptr;
}
};
@@ -248,11 +248,11 @@ public:
List<BlockNode *> sub_blocks;
int end_line;
BlockNode() {
- if_condition = NULL;
+ if_condition = nullptr;
type = TYPE_BLOCK;
end_line = -1;
- parent_block = NULL;
- parent_class = NULL;
+ parent_block = nullptr;
+ parent_class = nullptr;
has_return = false;
}
};
@@ -276,7 +276,7 @@ public:
virtual void set_datatype(const DataType &p_datatype) { datatype = p_datatype; }
IdentifierNode() {
type = TYPE_IDENTIFIER;
- declared_block = NULL;
+ declared_block = nullptr;
}
};
@@ -292,8 +292,8 @@ public:
virtual void set_datatype(const DataType &p_datatype) { datatype = p_datatype; }
LocalVarNode() {
type = TYPE_LOCAL_VAR;
- assign = NULL;
- assign_op = NULL;
+ assign = nullptr;
+ assign_op = nullptr;
assignments = 0;
usages = 0;
}
@@ -465,8 +465,8 @@ public:
ControlFlowNode() {
type = TYPE_CONTROL_FLOW;
cf_type = CF_IF;
- body = NULL;
- body_else = NULL;
+ body = nullptr;
+ body_else = nullptr;
}
};
@@ -608,7 +608,7 @@ private:
bool _recover_from_completion();
bool _parse_arguments(Node *p_parent, Vector<Node *> &p_args, bool p_static, bool p_can_codecomplete = false, bool p_parsing_constant = false);
- bool _enter_indent_block(BlockNode *p_block = NULL);
+ bool _enter_indent_block(BlockNode *p_block = nullptr);
bool _parse_newline();
Node *_parse_expression(Node *p_parent, bool p_static, bool p_allow_assign = false, bool p_parsing_constant = false);
Node *_reduce_expression(Node *p_node, bool p_to_const = false);
@@ -665,7 +665,7 @@ public:
#ifdef DEBUG_ENABLED
const List<GDScriptWarning> &get_warnings() const { return warnings; }
#endif // DEBUG_ENABLED
- Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = NULL, bool p_dependencies_only = false);
+ Error parse(const String &p_code, const String &p_base_path = "", bool p_just_validate = false, const String &p_self_path = "", bool p_for_completion = false, Set<int> *r_safe_lines = nullptr, bool p_dependencies_only = false);
Error parse_bytecode(const Vector<uint8_t> &p_bytecode, const String &p_base_path = "", const String &p_self_path = "");
bool is_tool_script() const;
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 9064998d32..d42ca52731 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -178,7 +178,7 @@ static const _bit _type_list[] = {
{ Variant::PACKED_VECTOR2_ARRAY, "PackedVector2Array" },
{ Variant::PACKED_VECTOR3_ARRAY, "PackedVector3Array" },
{ Variant::PACKED_COLOR_ARRAY, "PackedColorArray" },
- { Variant::VARIANT_MAX, NULL },
+ { Variant::VARIANT_MAX, nullptr },
};
struct _kws {
@@ -236,7 +236,7 @@ static const _kws _keyword_list[] = {
{ GDScriptTokenizer::TK_WILDCARD, "_" },
{ GDScriptTokenizer::TK_CONST_INF, "INF" },
{ GDScriptTokenizer::TK_CONST_NAN, "NAN" },
- { GDScriptTokenizer::TK_ERROR, NULL }
+ { GDScriptTokenizer::TK_ERROR, nullptr }
};
const char *GDScriptTokenizer::get_token_name(Token p_token) {
@@ -1075,7 +1075,7 @@ void GDScriptTokenizerText::set_code(const String &p_code) {
if (len) {
_code = &code[0];
} else {
- _code = NULL;
+ _code = nullptr;
}
code_pos = 0;
line = 1; //it is stand-ar-ized that lines begin in 1 in code..
@@ -1358,7 +1358,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
}
Map<int, Variant> rev_constant_map;
- const Variant *K = NULL;
+ const Variant *K = nullptr;
while ((K = constant_map.next(K))) {
rev_constant_map[constant_map[*K]] = *K;
}
@@ -1407,7 +1407,7 @@ Vector<uint8_t> GDScriptTokenizerBuffer::parse_code_string(const String &p_code)
int len;
// Objects cannot be constant, never encode objects
- Error err = encode_variant(E->get(), NULL, len, false);
+ Error err = encode_variant(E->get(), nullptr, len, false);
ERR_FAIL_COND_V_MSG(err != OK, Vector<uint8_t>(), "Error when trying to encode Variant.");
int pos = buf.size();
buf.resize(pos + len);
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index 0f6f13944b..b2c6b0e1ab 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -327,7 +327,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
if (default_value_idx >= 0) {
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
- if (const_node == NULL) {
+ if (const_node == nullptr) {
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
if (operator_node) {
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
@@ -507,7 +507,7 @@ String ExtendGDScriptParser::get_uri() const {
}
const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent) const {
- const lsp::DocumentSymbol *ret = NULL;
+ const lsp::DocumentSymbol *ret = nullptr;
if (p_line < p_parent.range.start.line) {
return ret;
} else if (p_parent.range.start.line == p_line) {
@@ -591,7 +591,7 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String
}
}
- return NULL;
+ return nullptr;
}
const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
@@ -602,7 +602,7 @@ const Array &ExtendGDScriptParser::get_member_completions() {
if (member_completions.empty()) {
- const String *name = members.next(NULL);
+ const String *name = members.next(nullptr);
while (name) {
const lsp::DocumentSymbol *symbol = members.get(*name);
@@ -613,11 +613,11 @@ const Array &ExtendGDScriptParser::get_member_completions() {
name = members.next(name);
}
- const String *_class = inner_classes.next(NULL);
+ const String *_class = inner_classes.next(nullptr);
while (_class) {
const ClassMembers *inner_class = inner_classes.getptr(*_class);
- const String *member_name = inner_class->next(NULL);
+ const String *member_name = inner_class->next(nullptr);
while (member_name) {
const lsp::DocumentSymbol *symbol = inner_class->get(*member_name);
lsp::CompletionItem item = symbol->make_completion_item();
@@ -648,7 +648,7 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
if (default_value_idx >= 0) {
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
- if (const_node == NULL) {
+ if (const_node == nullptr) {
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
if (operator_node) {
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
@@ -778,7 +778,7 @@ Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) {
path = p_path;
lines = p_code.split("\n");
- Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, NULL, false);
+ Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, nullptr, false);
update_diagnostics();
update_symbols();
update_document_links(p_code);
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 2243a7b81d..69662e96f7 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -35,7 +35,7 @@
#include "editor/editor_log.h"
#include "editor/editor_node.h"
-GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = NULL;
+GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = nullptr;
Error GDScriptLanguageProtocol::LSPeer::handle_data() {
int read = 0;
@@ -191,7 +191,7 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
Dictionary request = make_notification("gdscrip_client/changeWorkspace", params);
Ref<LSPeer> peer = clients.get(latest_client_id);
- if (peer != NULL) {
+ if (peer != nullptr) {
String msg = JSON::print(request);
msg = format_output(msg);
(*peer)->res_queue.push_back(msg.utf8());
@@ -230,26 +230,26 @@ void GDScriptLanguageProtocol::poll() {
if (server->is_connection_available()) {
on_client_connected();
}
- const int *id = NULL;
+ const int *id = nullptr;
while ((id = clients.next(id))) {
Ref<LSPeer> peer = clients.get(*id);
StreamPeerTCP::Status status = peer->connection->get_status();
if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) {
on_client_disconnected(*id);
- id = NULL;
+ id = nullptr;
} else {
if (peer->connection->get_available_bytes() > 0) {
latest_client_id = *id;
Error err = peer->handle_data();
if (err != OK && err != ERR_BUSY) {
on_client_disconnected(*id);
- id = NULL;
+ id = nullptr;
}
}
Error err = peer->send_data();
if (err != OK && err != ERR_BUSY) {
on_client_disconnected(*id);
- id = NULL;
+ id = nullptr;
}
}
}
@@ -260,7 +260,7 @@ Error GDScriptLanguageProtocol::start(int p_port, const IP_Address &p_bind_ip) {
}
void GDScriptLanguageProtocol::stop() {
- const int *id = NULL;
+ const int *id = nullptr;
while ((id = clients.next(id))) {
Ref<LSPeer> peer = clients.get(*id);
peer->connection->disconnect_from_host();
@@ -274,7 +274,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
p_client_id = latest_client_id;
}
Ref<LSPeer> peer = clients.get(p_client_id);
- ERR_FAIL_COND(peer == NULL);
+ ERR_FAIL_COND(peer == nullptr);
Dictionary message = make_notification(p_method, p_params);
String msg = JSON::print(message);
diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp
index 7170c63058..e1d86ecdd4 100644
--- a/modules/gdscript/language_server/gdscript_language_server.cpp
+++ b/modules/gdscript/language_server/gdscript_language_server.cpp
@@ -35,7 +35,7 @@
#include "editor/editor_node.h"
GDScriptLanguageServer::GDScriptLanguageServer() {
- thread = NULL;
+ thread = nullptr;
thread_running = false;
started = false;
@@ -87,7 +87,7 @@ void GDScriptLanguageServer::start() {
if (protocol.start(port, IP_Address("127.0.0.1")) == OK) {
EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR);
if (use_thread) {
- ERR_FAIL_COND(thread != NULL);
+ ERR_FAIL_COND(thread != nullptr);
thread_running = true;
thread = Thread::create(GDScriptLanguageServer::thread_main, this);
}
@@ -98,11 +98,11 @@ void GDScriptLanguageServer::start() {
void GDScriptLanguageServer::stop() {
if (use_thread) {
- ERR_FAIL_COND(NULL == thread);
+ ERR_FAIL_COND(nullptr == thread);
thread_running = false;
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
protocol.stop();
started = false;
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index fbf8ef2f8f..f065b33570 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -90,12 +90,12 @@ void GDScriptTextDocument::initialize() {
const HashMap<StringName, ClassMembers> &native_members = GDScriptLanguageProtocol::get_singleton()->get_workspace()->native_members;
- const StringName *class_ptr = native_members.next(NULL);
+ const StringName *class_ptr = native_members.next(nullptr);
while (class_ptr) {
const ClassMembers &members = native_members.get(*class_ptr);
- const String *name = members.next(NULL);
+ const String *name = members.next(nullptr);
while (name) {
const lsp::DocumentSymbol *symbol = members.get(*name);
@@ -227,7 +227,7 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
lsp::CompletionParams params;
Variant data = p_params["data"];
- const lsp::DocumentSymbol *symbol = NULL;
+ const lsp::DocumentSymbol *symbol = nullptr;
if (data.get_type() == Variant::DICTIONARY) {
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index 205257b8f2..32fc8f36f0 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -93,7 +93,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_native_symbol(const String &p_
class_name = ClassDB::get_parent_class(class_name);
}
- return NULL;
+ return nullptr;
}
const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_path) const {
@@ -101,7 +101,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
if (S) {
return &(S->get()->get_symbols());
}
- return NULL;
+ return nullptr;
}
void GDScriptWorkspace::reload_all_workspace_scripts() {
@@ -152,7 +152,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_successed_script(const String
if (S) {
return S->get();
}
- return NULL;
+ return nullptr;
}
ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path) {
@@ -164,7 +164,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path)
if (S) {
return S->get();
}
- return NULL;
+ return nullptr;
}
Array GDScriptWorkspace::symbol(const Dictionary &p_params) {
@@ -402,7 +402,7 @@ void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_pa
}
Node *GDScriptWorkspace::_get_owner_scene_node(String p_path) {
- Node *owner_scene_node = NULL;
+ Node *owner_scene_node = nullptr;
List<String> owners;
_get_owners(EditorFileSystem::get_singleton()->get_filesystem(), p_path, owners);
@@ -438,7 +438,7 @@ void GDScriptWorkspace::completion(const lsp::CompletionParams &p_params, List<S
const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocumentPositionParams &p_doc_pos, const String &p_symbol_name, bool p_func_requred) {
- const lsp::DocumentSymbol *symbol = NULL;
+ const lsp::DocumentSymbol *symbol = nullptr;
String path = get_file_path(p_doc_pos.textDocument.uri);
if (const ExtendGDScriptParser *parser = get_parse_result(path)) {
@@ -466,7 +466,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu
} else {
ScriptLanguage::LookupResult ret;
- if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, NULL, ret)) {
+ if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, nullptr, ret)) {
if (ret.type == ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION) {
@@ -506,7 +506,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
Vector2i offset;
symbol_identifier = parser->get_identifier_under_position(p_doc_pos.position, offset);
- const StringName *class_ptr = native_members.next(NULL);
+ const StringName *class_ptr = native_members.next(nullptr);
while (class_ptr) {
const ClassMembers &members = native_members.get(*class_ptr);
if (const lsp::DocumentSymbol *const *symbol = members.getptr(symbol_identifier)) {
@@ -523,7 +523,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
}
const HashMap<String, ClassMembers> &inner_classes = script->get_inner_classes();
- const String *_class = inner_classes.next(NULL);
+ const String *_class = inner_classes.next(nullptr);
while (_class) {
const ClassMembers *inner_class = inner_classes.getptr(*_class);
@@ -552,7 +552,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_native_symbol(const lsp::N
}
}
- return NULL;
+ return nullptr;
}
void GDScriptWorkspace::resolve_document_links(const String &p_uri, List<lsp::DocumentLink> &r_list) {
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index b5eb09d6ba..62b9d94d6c 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -37,7 +37,7 @@
#include "gdscript.h"
#include "gdscript_tokenizer.h"
-GDScriptLanguage *script_language_gd = NULL;
+GDScriptLanguage *script_language_gd = nullptr;
Ref<ResourceFormatLoaderGDScript> resource_loader_gd;
Ref<ResourceFormatSaverGDScript> resource_saver_gd;
diff --git a/modules/glslang/SCsub b/modules/glslang/SCsub
index ae102238f2..c1d23a138b 100644
--- a/modules/glslang/SCsub
+++ b/modules/glslang/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_glslang = env_modules.Clone()
# Thirdparty source files
-if env['builtin_glslang']:
+if env["builtin_glslang"]:
thirdparty_dir = "#thirdparty/glslang/"
thirdparty_sources = [
"glslang/MachineIndependent/RemoveTree.cpp",
@@ -48,10 +48,10 @@ if env['builtin_glslang']:
"SPIRV/doc.cpp",
"SPIRV/SPVRemapper.cpp",
"SPIRV/SpvPostProcess.cpp",
- "SPIRV/Logger.cpp"
+ "SPIRV/Logger.cpp",
]
- if (env["platform"]=="windows"):
+ if env["platform"] == "windows":
thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp")
else:
thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp")
@@ -60,7 +60,7 @@ if env['builtin_glslang']:
# Treat glslang headers as system headers to avoid raising warnings. Not supported on MSVC.
if not env.msvc:
- env_glslang.Append(CPPFLAGS=['-isystem', Dir(thirdparty_dir).path])
+ env_glslang.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path])
else:
env_glslang.Prepend(CPPPATH=[thirdparty_dir])
diff --git a/modules/glslang/config.py b/modules/glslang/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/glslang/config.py
+++ b/modules/glslang/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 62b8a0ff93..970ce534f0 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_gridmap = env_modules.Clone()
diff --git a/modules/gridmap/config.py b/modules/gridmap/config.py
index 5022116c9b..a6319fe1ea 100644
--- a/modules/gridmap/config.py
+++ b/modules/gridmap/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"GridMap",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index 37ebb3e5d5..a213069e19 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" version="4.0">
+<class name="GridMap" inherits="Node3D" version="4.0">
<brief_description>
Node for 3D tile-based maps.
</brief_description>
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 35c214d3cf..df7c2f397f 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -712,7 +712,7 @@ void GridMap::_notification(int p_what) {
_octant_exit_world(E->key());
}
- navigation = NULL;
+ navigation = nullptr;
//_queue_octants_dirty(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS);
//_update_octants_callback();
@@ -1107,7 +1107,7 @@ GridMap::GridMap() {
clip_above = true;
cell_scale = 1.0;
- navigation = NULL;
+ navigation = nullptr;
set_notify_transform(true);
recreating_octants = false;
}
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 4a6cb8762f..eb8feb5bc7 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -42,7 +42,7 @@
void GridMapEditor::_node_removed(Node *p_node) {
if (p_node == node)
- node = NULL;
+ node = nullptr;
}
void GridMapEditor::_configure() {
@@ -896,7 +896,7 @@ void GridMapEditor::update_palette() {
Ref<MeshLibrary> mesh_library = node->get_mesh_library();
if (mesh_library.is_null()) {
- last_mesh_library = NULL;
+ last_mesh_library = nullptr;
search_box->set_text("");
search_box->set_editable(false);
info_message->show();
@@ -1548,7 +1548,7 @@ void GridMapEditorPlugin::make_visible(bool p_visible) {
grid_map_editor->spatial_editor_hb->hide();
grid_map_editor->hide();
- grid_map_editor->edit(NULL);
+ grid_map_editor->edit(nullptr);
grid_map_editor->set_process(false);
}
}
diff --git a/modules/hdr/SCsub b/modules/hdr/SCsub
index c960e8126b..a709397c9a 100644
--- a/modules/hdr/SCsub
+++ b/modules/hdr/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_hdr = env_modules.Clone()
diff --git a/modules/hdr/config.py b/modules/hdr/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/hdr/config.py
+++ b/modules/hdr/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/hdr/register_types.cpp b/modules/hdr/register_types.cpp
index 2ef6b7cd07..5f2d1578c5 100644
--- a/modules/hdr/register_types.cpp
+++ b/modules/hdr/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_hdr.h"
-static ImageLoaderHDR *image_loader_hdr = NULL;
+static ImageLoaderHDR *image_loader_hdr = nullptr;
void register_hdr_types() {
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index 96e8e704dd..8ee8e6dd6e 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_jpg = env_modules.Clone()
diff --git a/modules/jpg/config.py b/modules/jpg/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/jpg/config.py
+++ b/modules/jpg/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp
index f6077d5c68..61375fef10 100644
--- a/modules/jpg/register_types.cpp
+++ b/modules/jpg/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_jpegd.h"
-static ImageLoaderJPG *image_loader_jpg = NULL;
+static ImageLoaderJPG *image_loader_jpg = nullptr;
void register_jpg_types() {
diff --git a/modules/jsonrpc/SCsub b/modules/jsonrpc/SCsub
index 13c9ffb253..fe5312670a 100644
--- a/modules/jsonrpc/SCsub
+++ b/modules/jsonrpc/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_jsonrpc = env_modules.Clone()
env_jsonrpc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/jsonrpc/config.py b/modules/jsonrpc/config.py
index 53bc827027..d22f9454ed 100644
--- a/modules/jsonrpc/config.py
+++ b/modules/jsonrpc/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
diff --git a/modules/jsonrpc/jsonrpc.cpp b/modules/jsonrpc/jsonrpc.cpp
index 014b65e3e2..393269d422 100644
--- a/modules/jsonrpc/jsonrpc.cpp
+++ b/modules/jsonrpc/jsonrpc.cpp
@@ -119,7 +119,7 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem
id = dict["id"];
}
- if (object == NULL || !object->has_method(method)) {
+ if (object == nullptr || !object->has_method(method)) {
ret = make_response_error(JSONRPC::METHOD_NOT_FOUND, "Method not found", id);
} else {
Variant call_ret = object->callv(method, args);
diff --git a/modules/mbedtls/SCsub b/modules/mbedtls/SCsub
index 0c6c703e16..5f5d25a3ee 100755
--- a/modules/mbedtls/SCsub
+++ b/modules/mbedtls/SCsub
@@ -1,11 +1,11 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_mbed_tls = env_modules.Clone()
-if env['builtin_mbedtls']:
+if env["builtin_mbedtls"]:
# Thirdparty source files
thirdparty_sources = [
"aes.c",
@@ -86,7 +86,7 @@ if env['builtin_mbedtls']:
"x509_csr.c",
"x509write_crt.c",
"x509write_csr.c",
- "xtea.c"
+ "xtea.c",
]
thirdparty_dir = "#thirdparty/mbedtls/library/"
diff --git a/modules/mbedtls/config.py b/modules/mbedtls/config.py
index 1c8cd12a2d..d22f9454ed 100755
--- a/modules/mbedtls/config.py
+++ b/modules/mbedtls/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/mbedtls/crypto_mbedtls.cpp b/modules/mbedtls/crypto_mbedtls.cpp
index c8a8240a19..a47a4503a5 100644
--- a/modules/mbedtls/crypto_mbedtls.cpp
+++ b/modules/mbedtls/crypto_mbedtls.cpp
@@ -66,7 +66,7 @@ Error CryptoKeyMbedTLS::load(String p_path) {
}
memdelete(f);
- int ret = mbedtls_pk_parse_key(&pkey, out.ptr(), out.size(), NULL, 0);
+ int ret = mbedtls_pk_parse_key(&pkey, out.ptr(), out.size(), nullptr, 0);
// We MUST zeroize the memory for safety!
mbedtls_platform_zeroize(out.ptrw(), out.size());
ERR_FAIL_COND_V_MSG(ret, FAILED, "Error parsing private key '" + itos(ret) + "'.");
@@ -167,11 +167,11 @@ void CryptoMbedTLS::initialize_crypto() {
}
void CryptoMbedTLS::finalize_crypto() {
- Crypto::_create = NULL;
- Crypto::_load_default_certificates = NULL;
+ Crypto::_create = nullptr;
+ Crypto::_load_default_certificates = nullptr;
if (default_certs) {
memdelete(default_certs);
- default_certs = NULL;
+ default_certs = nullptr;
}
X509CertificateMbedTLS::finalize();
CryptoKeyMbedTLS::finalize();
@@ -180,7 +180,7 @@ void CryptoMbedTLS::finalize_crypto() {
CryptoMbedTLS::CryptoMbedTLS() {
mbedtls_ctr_drbg_init(&ctr_drbg);
mbedtls_entropy_init(&entropy);
- int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
+ int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
if (ret != 0) {
ERR_PRINT(" failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret));
}
@@ -191,17 +191,17 @@ CryptoMbedTLS::~CryptoMbedTLS() {
mbedtls_entropy_free(&entropy);
}
-X509CertificateMbedTLS *CryptoMbedTLS::default_certs = NULL;
+X509CertificateMbedTLS *CryptoMbedTLS::default_certs = nullptr;
X509CertificateMbedTLS *CryptoMbedTLS::get_default_certificates() {
return default_certs;
}
void CryptoMbedTLS::load_default_certificates(String p_path) {
- ERR_FAIL_COND(default_certs != NULL);
+ ERR_FAIL_COND(default_certs != nullptr);
default_certs = memnew(X509CertificateMbedTLS);
- ERR_FAIL_COND(default_certs == NULL);
+ ERR_FAIL_COND(default_certs == nullptr);
if (p_path != "") {
// Use certs defined in project settings.
@@ -227,15 +227,15 @@ Ref<CryptoKey> CryptoMbedTLS::generate_rsa(int p_bytes) {
Ref<CryptoKeyMbedTLS> out;
out.instance();
int ret = mbedtls_pk_setup(&(out->pkey), mbedtls_pk_info_from_type(MBEDTLS_PK_RSA));
- ERR_FAIL_COND_V(ret != 0, NULL);
+ ERR_FAIL_COND_V(ret != 0, nullptr);
ret = mbedtls_rsa_gen_key(mbedtls_pk_rsa(out->pkey), mbedtls_ctr_drbg_random, &ctr_drbg, p_bytes, 65537);
- ERR_FAIL_COND_V(ret != 0, NULL);
+ ERR_FAIL_COND_V(ret != 0, nullptr);
return out;
}
Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoKey> p_key, String p_issuer_name, String p_not_before, String p_not_after) {
Ref<CryptoKeyMbedTLS> key = static_cast<Ref<CryptoKeyMbedTLS>>(p_key);
- ERR_FAIL_COND_V_MSG(key.is_null(), NULL, "Invalid private key argument.");
+ ERR_FAIL_COND_V_MSG(key.is_null(), nullptr, "Invalid private key argument.");
mbedtls_x509write_cert crt;
mbedtls_x509write_crt_init(&crt);
@@ -250,7 +250,7 @@ Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoK
mbedtls_mpi_init(&serial);
uint8_t rand_serial[20];
mbedtls_ctr_drbg_random(&ctr_drbg, rand_serial, 20);
- ERR_FAIL_COND_V(mbedtls_mpi_read_binary(&serial, rand_serial, 20), NULL);
+ ERR_FAIL_COND_V(mbedtls_mpi_read_binary(&serial, rand_serial, 20), nullptr);
mbedtls_x509write_crt_set_serial(&crt, &serial);
mbedtls_x509write_crt_set_validity(&crt, p_not_before.utf8().get_data(), p_not_after.utf8().get_data());
@@ -268,7 +268,7 @@ Ref<X509Certificate> CryptoMbedTLS::generate_self_signed_certificate(Ref<CryptoK
mbedtls_mpi_free(&serial);
mbedtls_x509write_crt_free(&crt);
ERR_PRINT("Generated invalid certificate: " + itos(err));
- return NULL;
+ return nullptr;
}
mbedtls_mpi_free(&serial);
diff --git a/modules/mbedtls/crypto_mbedtls.h b/modules/mbedtls/crypto_mbedtls.h
index 6c1c0e255d..db3d00a5e3 100644
--- a/modules/mbedtls/crypto_mbedtls.h
+++ b/modules/mbedtls/crypto_mbedtls.h
@@ -49,7 +49,7 @@ private:
public:
static CryptoKey *create();
static void make_default() { CryptoKey::_create = create; }
- static void finalize() { CryptoKey::_create = NULL; }
+ static void finalize() { CryptoKey::_create = nullptr; }
virtual Error load(String p_path);
virtual Error save(String p_path);
@@ -78,7 +78,7 @@ private:
public:
static X509Certificate *create();
static void make_default() { X509Certificate::_create = create; }
- static void finalize() { X509Certificate::_create = NULL; }
+ static void finalize() { X509Certificate::_create = nullptr; }
virtual Error load(String p_path);
virtual Error load_from_memory(const uint8_t *p_buffer, int p_len);
diff --git a/modules/mbedtls/dtls_server_mbedtls.cpp b/modules/mbedtls/dtls_server_mbedtls.cpp
index 215b511758..f31f067f4e 100644
--- a/modules/mbedtls/dtls_server_mbedtls.cpp
+++ b/modules/mbedtls/dtls_server_mbedtls.cpp
@@ -65,7 +65,7 @@ void DTLSServerMbedTLS::initialize() {
}
void DTLSServerMbedTLS::finalize() {
- _create = NULL;
+ _create = nullptr;
available = false;
}
diff --git a/modules/mbedtls/packet_peer_mbed_dtls.cpp b/modules/mbedtls/packet_peer_mbed_dtls.cpp
index bdf36ad1b1..b2aa5f5827 100755
--- a/modules/mbedtls/packet_peer_mbed_dtls.cpp
+++ b/modules/mbedtls/packet_peer_mbed_dtls.cpp
@@ -36,11 +36,11 @@
int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
- if (buf == NULL || len <= 0) return 0;
+ if (buf == nullptr || len <= 0) return 0;
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
- ERR_FAIL_COND_V(sp == NULL, 0);
+ ERR_FAIL_COND_V(sp == nullptr, 0);
Error err = sp->base->put_packet((const uint8_t *)buf, len);
if (err == ERR_BUSY) {
@@ -53,11 +53,11 @@ int PacketPeerMbedDTLS::bio_send(void *ctx, const unsigned char *buf, size_t len
int PacketPeerMbedDTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
- if (buf == NULL || len <= 0) return 0;
+ if (buf == nullptr || len <= 0) return 0;
PacketPeerMbedDTLS *sp = (PacketPeerMbedDTLS *)ctx;
- ERR_FAIL_COND_V(sp == NULL, 0);
+ ERR_FAIL_COND_V(sp == nullptr, 0);
int pc = sp->base->get_available_packet_count();
if (pc == 0) {
@@ -125,7 +125,7 @@ Error PacketPeerMbedDTLS::connect_to_peer(Ref<PacketPeerUDP> p_base, bool p_vali
ERR_FAIL_COND_V(err != OK, err);
mbedtls_ssl_set_hostname(ssl_ctx->get_context(), p_for_hostname.utf8().get_data());
- mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
+ mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
mbedtls_ssl_set_timer_cb(ssl_ctx->get_context(), &timer, mbedtls_timing_set_delay, mbedtls_timing_get_delay);
status = STATUS_HANDSHAKING;
@@ -154,7 +154,7 @@ Error PacketPeerMbedDTLS::accept_peer(Ref<PacketPeerUDP> p_base, Ref<CryptoKey>
ERR_FAIL_V_MSG(FAILED, "Error setting DTLS client cookie");
}
- mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
+ mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
mbedtls_ssl_set_timer_cb(ssl_ctx->get_context(), &timer, mbedtls_timing_set_delay, mbedtls_timing_get_delay);
status = STATUS_HANDSHAKING;
@@ -223,7 +223,7 @@ void PacketPeerMbedDTLS::poll() {
ERR_FAIL_COND(!base.is_valid());
- int ret = mbedtls_ssl_read(ssl_ctx->get_context(), NULL, 0);
+ int ret = mbedtls_ssl_read(ssl_ctx->get_context(), nullptr, 0);
if (ret < 0 && ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
@@ -292,6 +292,6 @@ void PacketPeerMbedDTLS::initialize_dtls() {
}
void PacketPeerMbedDTLS::finalize_dtls() {
- _create = NULL;
+ _create = nullptr;
available = false;
}
diff --git a/modules/mbedtls/ssl_context_mbedtls.cpp b/modules/mbedtls/ssl_context_mbedtls.cpp
index 52630bd98c..1ffb9bda05 100644
--- a/modules/mbedtls/ssl_context_mbedtls.cpp
+++ b/modules/mbedtls/ssl_context_mbedtls.cpp
@@ -53,7 +53,7 @@ Error CookieContextMbedTLS::setup() {
mbedtls_ssl_cookie_init(&cookie_ctx);
inited = true;
- int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
+ int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
if (ret != 0) {
clear(); // Never leave unusable resources around.
ERR_FAIL_V_MSG(FAILED, "mbedtls_ctr_drbg_seed returned an error " + itos(ret));
@@ -94,7 +94,7 @@ Error SSLContextMbedTLS::_setup(int p_endpoint, int p_transport, int p_authmode)
mbedtls_entropy_init(&entropy);
inited = true;
- int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0);
+ int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, nullptr, 0);
if (ret != 0) {
clear(); // Never leave unusable resources around.
ERR_FAIL_V_MSG(FAILED, "mbedtls_ctr_drbg_seed returned an error " + itos(ret));
@@ -134,7 +134,7 @@ Error SSLContextMbedTLS::init_server(int p_transport, int p_authmode, Ref<Crypto
}
// Adding CA chain if available.
if (certs->cert.next) {
- mbedtls_ssl_conf_ca_chain(&conf, certs->cert.next, NULL);
+ mbedtls_ssl_conf_ca_chain(&conf, certs->cert.next, nullptr);
}
// DTLS Cookies
if (p_transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM) {
@@ -153,7 +153,7 @@ Error SSLContextMbedTLS::init_client(int p_transport, int p_authmode, Ref<X509Ce
Error err = _setup(MBEDTLS_SSL_IS_CLIENT, p_transport, p_authmode);
ERR_FAIL_COND_V(err != OK, err);
- X509CertificateMbedTLS *cas = NULL;
+ X509CertificateMbedTLS *cas = nullptr;
if (p_valid_cas.is_valid()) {
// Locking CA certificates
@@ -163,14 +163,14 @@ Error SSLContextMbedTLS::init_client(int p_transport, int p_authmode, Ref<X509Ce
} else {
// Fall back to default certificates (no need to lock those).
cas = CryptoMbedTLS::get_default_certificates();
- if (cas == NULL) {
+ if (cas == nullptr) {
clear();
ERR_FAIL_V_MSG(ERR_UNCONFIGURED, "SSL module failed to initialize!");
}
}
// Set valid CAs
- mbedtls_ssl_conf_ca_chain(&conf, &(cas->cert), NULL);
+ mbedtls_ssl_conf_ca_chain(&conf, &(cas->cert), nullptr);
mbedtls_ssl_setup(&ssl, &conf);
return OK;
}
@@ -195,7 +195,7 @@ void SSLContextMbedTLS::clear() {
}
mbedtls_ssl_context *SSLContextMbedTLS::get_context() {
- ERR_FAIL_COND_V(!inited, NULL);
+ ERR_FAIL_COND_V(!inited, nullptr);
return &ssl;
}
diff --git a/modules/mbedtls/stream_peer_mbedtls.cpp b/modules/mbedtls/stream_peer_mbedtls.cpp
index 03c5922267..983095c536 100755
--- a/modules/mbedtls/stream_peer_mbedtls.cpp
+++ b/modules/mbedtls/stream_peer_mbedtls.cpp
@@ -35,11 +35,11 @@
int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len) {
- if (buf == NULL || len <= 0) return 0;
+ if (buf == nullptr || len <= 0) return 0;
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
- ERR_FAIL_COND_V(sp == NULL, 0);
+ ERR_FAIL_COND_V(sp == nullptr, 0);
int sent;
Error err = sp->base->put_partial_data((const uint8_t *)buf, len, sent);
@@ -54,11 +54,11 @@ int StreamPeerMbedTLS::bio_send(void *ctx, const unsigned char *buf, size_t len)
int StreamPeerMbedTLS::bio_recv(void *ctx, unsigned char *buf, size_t len) {
- if (buf == NULL || len <= 0) return 0;
+ if (buf == nullptr || len <= 0) return 0;
StreamPeerMbedTLS *sp = (StreamPeerMbedTLS *)ctx;
- ERR_FAIL_COND_V(sp == NULL, 0);
+ ERR_FAIL_COND_V(sp == nullptr, 0);
int got;
Error err = sp->base->get_partial_data((uint8_t *)buf, len, got);
@@ -112,7 +112,7 @@ Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida
ERR_FAIL_COND_V(err != OK, err);
mbedtls_ssl_set_hostname(ssl_ctx->get_context(), p_for_hostname.utf8().get_data());
- mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
+ mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
status = STATUS_HANDSHAKING;
@@ -133,7 +133,7 @@ Error StreamPeerMbedTLS::accept_stream(Ref<StreamPeer> p_base, Ref<CryptoKey> p_
base = p_base;
- mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, NULL);
+ mbedtls_ssl_set_bio(ssl_ctx->get_context(), this, bio_send, bio_recv, nullptr);
status = STATUS_HANDSHAKING;
@@ -320,5 +320,5 @@ void StreamPeerMbedTLS::initialize_ssl() {
void StreamPeerMbedTLS::finalize_ssl() {
available = false;
- _create = NULL;
+ _create = nullptr;
}
diff --git a/modules/mobile_vr/SCsub b/modules/mobile_vr/SCsub
index 4bd184f025..e6c43228b4 100644
--- a/modules/mobile_vr/SCsub
+++ b/modules/mobile_vr/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_mobile_vr = env_modules.Clone()
-env_mobile_vr.add_source_files(env.modules_sources, '*.cpp')
+env_mobile_vr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/mobile_vr/config.py b/modules/mobile_vr/config.py
index e85fa631dd..ee401c1a2a 100644
--- a/modules/mobile_vr/config.py
+++ b/modules/mobile_vr/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"MobileVRInterface",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index c82a521a43..6b5a70435d 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -327,7 +327,7 @@ bool MobileVRInterface::initialize() {
void MobileVRInterface::uninitialize() {
if (initialized) {
ARVRServer *arvr_server = ARVRServer::get_singleton();
- if (arvr_server != NULL) {
+ if (arvr_server != nullptr) {
// no longer our primary interface
arvr_server->clear_primary_interface_if(this);
}
diff --git a/modules/modules_builders.py b/modules/modules_builders.py
index 0e9cba2b0b..e7be6380d1 100644
--- a/modules/modules_builders.py
+++ b/modules/modules_builders.py
@@ -7,10 +7,10 @@ from platform_methods import subprocess_main
def generate_modules_enabled(target, source, env):
- with open(target[0].path, 'w') as f:
+ with open(target[0].path, "w") as f:
for module in env.module_list:
- f.write('#define %s\n' % ("MODULE_" + module.upper() + "_ENABLED"))
+ f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED"))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index 5f03fafdcf..c723b210cb 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -2,46 +2,56 @@
import build_scripts.mono_configure as mono_configure
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_mono = env_modules.Clone()
-if env_mono['tools']:
+if env_mono["tools"]:
# NOTE: It is safe to generate this file here, since this is still executed serially
import build_scripts.gen_cs_glue_version as gen_cs_glue_version
- gen_cs_glue_version.generate_header('glue/GodotSharp', 'glue/cs_glue_version.gen.h')
+
+ gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h")
# Glue sources
-if env_mono['mono_glue']:
- env_mono.Append(CPPDEFINES=['MONO_GLUE_ENABLED'])
+if env_mono["mono_glue"]:
+ env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"])
import os.path
- if not os.path.isfile('glue/mono_glue.gen.cpp'):
+
+ if not os.path.isfile("glue/mono_glue.gen.cpp"):
raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?")
-if env_mono['tools'] or env_mono['target'] != 'release':
- env_mono.Append(CPPDEFINES=['GD_MONO_HOT_RELOAD'])
+if env_mono["tools"] or env_mono["target"] != "release":
+ env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
# Configure Mono
mono_configure.configure(env, env_mono)
-if env_mono['tools'] and env_mono['mono_glue']:
+if env_mono["tools"] and env_mono["mono_glue"]:
# Build Godot API solution
import build_scripts.api_solution_build as api_solution_build
+
api_sln_cmd = api_solution_build.build(env_mono)
# Build GodotTools
import build_scripts.godot_tools_build as godot_tools_build
+
godot_tools_build.build(env_mono, api_sln_cmd)
# Add sources
-env_mono.add_source_files(env.modules_sources, '*.cpp')
-env_mono.add_source_files(env.modules_sources, 'glue/*.cpp')
-env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
-env_mono.add_source_files(env.modules_sources, 'utils/*.cpp')
+env_mono.add_source_files(env.modules_sources, "*.cpp")
+env_mono.add_source_files(env.modules_sources, "glue/*.cpp")
+env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp")
+env_mono.add_source_files(env.modules_sources, "utils/*.cpp")
+
+env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.cpp")
+
+if env["platform"] in ["osx", "iphone"]:
+ env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.mm")
+ env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.m")
-if env['tools']:
- env_mono.add_source_files(env.modules_sources, 'editor/*.cpp')
+if env["tools"]:
+ env_mono.add_source_files(env.modules_sources, "editor/*.cpp")
diff --git a/modules/mono/build_scripts/api_solution_build.py b/modules/mono/build_scripts/api_solution_build.py
index 639197c285..9abac22df6 100644
--- a/modules/mono/build_scripts/api_solution_build.py
+++ b/modules/mono/build_scripts/api_solution_build.py
@@ -8,21 +8,22 @@ from SCons.Script import Dir
def build_api_solution(source, target, env):
# source and target elements are of type SCons.Node.FS.File, hence why we convert them to str
- module_dir = env['module_dir']
+ module_dir = env["module_dir"]
- solution_path = os.path.join(module_dir, 'glue/GodotSharp/GodotSharp.sln')
+ solution_path = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln")
- build_config = env['solution_build_config']
+ build_config = env["solution_build_config"]
- extra_msbuild_args = ['/p:NoWarn=1591'] # Ignore missing documentation warnings
+ extra_msbuild_args = ["/p:NoWarn=1591"] # Ignore missing documentation warnings
from .solution_builder import build_solution
+
build_solution(env, solution_path, build_config, extra_msbuild_args=extra_msbuild_args)
# Copy targets
- core_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharp', 'bin', build_config))
- editor_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, 'GodotSharpEditor', 'bin', build_config))
+ core_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, "GodotSharp", "bin", build_config))
+ editor_src_dir = os.path.abspath(os.path.join(solution_path, os.pardir, "GodotSharpEditor", "bin", build_config))
dst_dir = os.path.abspath(os.path.join(str(target[0]), os.pardir))
@@ -32,6 +33,7 @@ def build_api_solution(source, target, env):
def copy_target(target_path):
from shutil import copy
+
filename = os.path.basename(target_path)
src_path = os.path.join(core_src_dir, filename)
@@ -45,23 +47,28 @@ def build_api_solution(source, target, env):
def build(env_mono):
- assert env_mono['tools']
+ assert env_mono["tools"]
target_filenames = [
- 'GodotSharp.dll', 'GodotSharp.pdb', 'GodotSharp.xml',
- 'GodotSharpEditor.dll', 'GodotSharpEditor.pdb', 'GodotSharpEditor.xml'
+ "GodotSharp.dll",
+ "GodotSharp.pdb",
+ "GodotSharp.xml",
+ "GodotSharpEditor.dll",
+ "GodotSharpEditor.pdb",
+ "GodotSharpEditor.xml",
]
depend_cmd = []
- for build_config in ['Debug', 'Release']:
- output_dir = Dir('#bin').abspath
- editor_api_dir = os.path.join(output_dir, 'GodotSharp', 'Api', build_config)
+ for build_config in ["Debug", "Release"]:
+ output_dir = Dir("#bin").abspath
+ editor_api_dir = os.path.join(output_dir, "GodotSharp", "Api", build_config)
targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames]
- cmd = env_mono.CommandNoCache(targets, depend_cmd, build_api_solution,
- module_dir=os.getcwd(), solution_build_config=build_config)
+ cmd = env_mono.CommandNoCache(
+ targets, depend_cmd, build_api_solution, module_dir=os.getcwd(), solution_build_config=build_config
+ )
env_mono.AlwaysBuild(cmd)
# Make the Release build of the API solution depend on the Debug build.
diff --git a/modules/mono/build_scripts/gen_cs_glue_version.py b/modules/mono/build_scripts/gen_cs_glue_version.py
index 5d1056c2fc..98bbb4d9be 100644
--- a/modules/mono/build_scripts/gen_cs_glue_version.py
+++ b/modules/mono/build_scripts/gen_cs_glue_version.py
@@ -1,20 +1,20 @@
-
def generate_header(solution_dir, version_header_dst):
import os
+
latest_mtime = 0
for root, dirs, files in os.walk(solution_dir, topdown=True):
- dirs[:] = [d for d in dirs if d not in ['Generated']] # Ignored generated files
- files = [f for f in files if f.endswith('.cs')]
+ dirs[:] = [d for d in dirs if d not in ["Generated"]] # Ignored generated files
+ files = [f for f in files if f.endswith(".cs")]
for file in files:
filepath = os.path.join(root, file)
mtime = os.path.getmtime(filepath)
latest_mtime = mtime if mtime > latest_mtime else latest_mtime
- glue_version = int(latest_mtime) # The latest modified time will do for now
+ glue_version = int(latest_mtime) # The latest modified time will do for now
- with open(version_header_dst, 'w') as version_header:
- version_header.write('/* THIS FILE IS GENERATED DO NOT EDIT */\n')
- version_header.write('#ifndef CS_GLUE_VERSION_H\n')
- version_header.write('#define CS_GLUE_VERSION_H\n\n')
- version_header.write('#define CS_GLUE_VERSION UINT32_C(' + str(glue_version) + ')\n')
- version_header.write('\n#endif // CS_GLUE_VERSION_H\n')
+ with open(version_header_dst, "w") as version_header:
+ version_header.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
+ version_header.write("#ifndef CS_GLUE_VERSION_H\n")
+ version_header.write("#define CS_GLUE_VERSION_H\n\n")
+ version_header.write("#define CS_GLUE_VERSION UINT32_C(" + str(glue_version) + ")\n")
+ version_header.write("\n#endif // CS_GLUE_VERSION_H\n")
diff --git a/modules/mono/build_scripts/godot_tools_build.py b/modules/mono/build_scripts/godot_tools_build.py
index 99341c631e..cffacf2577 100644
--- a/modules/mono/build_scripts/godot_tools_build.py
+++ b/modules/mono/build_scripts/godot_tools_build.py
@@ -8,30 +8,31 @@ from SCons.Script import Dir
def build_godot_tools(source, target, env):
# source and target elements are of type SCons.Node.FS.File, hence why we convert them to str
- module_dir = env['module_dir']
+ module_dir = env["module_dir"]
- solution_path = os.path.join(module_dir, 'editor/GodotTools/GodotTools.sln')
- build_config = 'Debug' if env['target'] == 'debug' else 'Release'
+ solution_path = os.path.join(module_dir, "editor/GodotTools/GodotTools.sln")
+ build_config = "Debug" if env["target"] == "debug" else "Release"
# Custom build target to make sure output is always copied to the data dir.
- extra_build_args = ['/Target:Build;GodotTools:BuildAlwaysCopyToDataDir']
+ extra_build_args = ["/Target:Build;GodotTools:BuildAlwaysCopyToDataDir"]
+
+ from .solution_builder import build_solution, nuget_restore
- from . solution_builder import build_solution, nuget_restore
nuget_restore(env, solution_path)
build_solution(env, solution_path, build_config, extra_build_args)
# No need to copy targets. The GodotTools csproj takes care of copying them.
def build(env_mono, api_sln_cmd):
- assert env_mono['tools']
+ assert env_mono["tools"]
- output_dir = Dir('#bin').abspath
- editor_tools_dir = os.path.join(output_dir, 'GodotSharp', 'Tools')
+ output_dir = Dir("#bin").abspath
+ editor_tools_dir = os.path.join(output_dir, "GodotSharp", "Tools")
- target_filenames = ['GodotTools.dll']
+ target_filenames = ["GodotTools.dll"]
- if env_mono['target'] == 'debug':
- target_filenames += ['GodotTools.pdb']
+ if env_mono["target"] == "debug":
+ target_filenames += ["GodotTools.pdb"]
targets = [os.path.join(editor_tools_dir, filename) for filename in target_filenames]
diff --git a/modules/mono/build_scripts/make_android_mono_config.py b/modules/mono/build_scripts/make_android_mono_config.py
index 4f5a496891..d276d7d886 100644
--- a/modules/mono/build_scripts/make_android_mono_config.py
+++ b/modules/mono/build_scripts/make_android_mono_config.py
@@ -1,23 +1,24 @@
-
def generate_compressed_config(config_src, output_dir):
import os.path
# Source file
- with open(os.path.join(output_dir, 'android_mono_config.gen.cpp'), 'w') as cpp:
- with open(config_src, 'rb') as f:
+ with open(os.path.join(output_dir, "android_mono_config.gen.cpp"), "w") as cpp:
+ with open(config_src, "rb") as f:
buf = f.read()
decompr_size = len(buf)
import zlib
+
buf = zlib.compress(buf)
compr_size = len(buf)
- bytes_seq_str = ''
+ bytes_seq_str = ""
for i, buf_idx in enumerate(range(compr_size)):
if i > 0:
- bytes_seq_str += ', '
+ bytes_seq_str += ", "
bytes_seq_str += str(buf[buf_idx])
- cpp.write('''/* THIS FILE IS GENERATED DO NOT EDIT */
+ cpp.write(
+ """/* THIS FILE IS GENERATED DO NOT EDIT */
#include "android_mono_config.h"
#ifdef ANDROID_ENABLED
@@ -48,4 +49,6 @@ String get_godot_android_mono_config() {
}
#endif // ANDROID_ENABLED
-''' % (compr_size, decompr_size, bytes_seq_str))
+"""
+ % (compr_size, decompr_size, bytes_seq_str)
+ )
diff --git a/modules/mono/build_scripts/mono_configure.py b/modules/mono/build_scripts/mono_configure.py
index 4e101583ef..23f01b3cca 100644
--- a/modules/mono/build_scripts/mono_configure.py
+++ b/modules/mono/build_scripts/mono_configure.py
@@ -5,178 +5,230 @@ import subprocess
from SCons.Script import Dir, Environment
-if os.name == 'nt':
+if os.name == "nt":
from . import mono_reg_utils as monoreg
android_arch_dirs = {
- 'armv7': 'armeabi-v7a',
- 'arm64v8': 'arm64-v8a',
- 'x86': 'x86',
- 'x86_64': 'x86_64'
+ "armv7": "armeabi-v7a",
+ "arm64v8": "arm64-v8a",
+ "x86": "x86",
+ "x86_64": "x86_64",
}
def get_android_out_dir(env):
- return os.path.join(Dir('#platform/android/java/lib/libs').abspath,
- 'release' if env['target'] == 'release' else 'debug',
- android_arch_dirs[env['android_arch']])
-
-
-def find_file_in_dir(directory, files, prefix='', extension=''):
- if not extension.startswith('.'):
- extension = '.' + extension
- for curfile in files:
- if os.path.isfile(os.path.join(directory, prefix + curfile + extension)):
- return curfile
- return ''
-
-
-def copy_file(src_dir, dst_dir, name):
+ return os.path.join(
+ Dir("#platform/android/java/lib/libs").abspath,
+ "release" if env["target"] == "release" else "debug",
+ android_arch_dirs[env["android_arch"]],
+ )
+
+
+def find_name_in_dir_files(directory, names, prefixes=[""], extensions=[""]):
+ for extension in extensions:
+ if extension and not extension.startswith("."):
+ extension = "." + extension
+ for prefix in prefixes:
+ for curname in names:
+ if os.path.isfile(os.path.join(directory, prefix + curname + extension)):
+ return curname
+ return ""
+
+
+def find_file_in_dir(directory, names, prefixes=[""], extensions=[""]):
+ for extension in extensions:
+ if extension and not extension.startswith("."):
+ extension = "." + extension
+ for prefix in prefixes:
+ for curname in names:
+ filename = prefix + curname + extension
+ if os.path.isfile(os.path.join(directory, filename)):
+ return filename
+ return ""
+
+
+def copy_file(src_dir, dst_dir, src_name, dst_name=""):
from shutil import copy
- src_path = os.path.join(Dir(src_dir).abspath, name)
+ src_path = os.path.join(Dir(src_dir).abspath, src_name)
dst_dir = Dir(dst_dir).abspath
if not os.path.isdir(dst_dir):
os.makedirs(dst_dir)
- copy(src_path, dst_dir)
+ if dst_name:
+ copy(src_path, os.path.join(dst_dir, dst_name))
+ else:
+ copy(src_path, dst_dir)
def is_desktop(platform):
- return platform in ['windows', 'osx', 'linuxbsd', 'server', 'uwp', 'haiku']
+ return platform in ["windows", "osx", "linuxbsd", "server", "uwp", "haiku"]
def is_unix_like(platform):
- return platform in ['osx', 'linuxbsd', 'server', 'android', 'haiku']
+ return platform in ["osx", "linuxbsd", "server", "android", "haiku", "iphone"]
def module_supports_tools_on(platform):
- return platform not in ['android', 'javascript']
+ return platform not in ["android", "javascript", "iphone"]
def find_wasm_src_dir(mono_root):
hint_dirs = [
- os.path.join(mono_root, 'src'),
- os.path.join(mono_root, '../src'),
+ os.path.join(mono_root, "src"),
+ os.path.join(mono_root, "../src"),
]
for hint_dir in hint_dirs:
- if os.path.isfile(os.path.join(hint_dir, 'driver.c')):
+ if os.path.isfile(os.path.join(hint_dir, "driver.c")):
return hint_dir
- return ''
+ return ""
def configure(env, env_mono):
- bits = env['bits']
- is_android = env['platform'] == 'android'
- is_javascript = env['platform'] == 'javascript'
+ bits = env["bits"]
+ is_android = env["platform"] == "android"
+ is_javascript = env["platform"] == "javascript"
+ is_ios = env["platform"] == "iphone"
+ is_ios_sim = is_ios and env["arch"] in ["x86", "x86_64"]
- tools_enabled = env['tools']
- mono_static = env['mono_static']
- copy_mono_root = env['copy_mono_root']
+ tools_enabled = env["tools"]
+ mono_static = env["mono_static"]
+ copy_mono_root = env["copy_mono_root"]
- mono_prefix = env['mono_prefix']
+ mono_prefix = env["mono_prefix"]
- mono_lib_names = ['mono-2.0-sgen', 'monosgen-2.0']
+ mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]
- is_travis = os.environ.get('TRAVIS') == 'true'
+ is_travis = os.environ.get("TRAVIS") == "true"
if is_travis:
# Travis CI may have a Mono version lower than 5.12
- env_mono.Append(CPPDEFINES=['NO_PENDING_EXCEPTIONS'])
+ env_mono.Append(CPPDEFINES=["NO_PENDING_EXCEPTIONS"])
- if is_android and not env['android_arch'] in android_arch_dirs:
- raise RuntimeError('This module does not support the specified \'android_arch\': ' + env['android_arch'])
+ if is_android and not env["android_arch"] in android_arch_dirs:
+ raise RuntimeError("This module does not support the specified 'android_arch': " + env["android_arch"])
- if tools_enabled and not module_supports_tools_on(env['platform']):
+ if tools_enabled and not module_supports_tools_on(env["platform"]):
# TODO:
# Android: We have to add the data directory to the apk, concretely the Api and Tools folders.
- raise RuntimeError('This module does not currently support building for this platform with tools enabled')
+ raise RuntimeError("This module does not currently support building for this platform with tools enabled")
if is_android and mono_static:
- # Android: When static linking and doing something that requires libmono-native, we get a dlopen error as libmono-native seems to depend on libmonosgen-2.0
- raise RuntimeError('Statically linking Mono is not currently supported on this platform')
+ # FIXME: When static linking and doing something that requires libmono-native, we get a dlopen error as 'libmono-native'
+ # seems to depend on 'libmonosgen-2.0'. Could be fixed by re-directing to '__Internal' with a dllmap or in the dlopen hook.
+ raise RuntimeError("Statically linking Mono is not currently supported for this platform")
+
+ if not mono_static and (is_javascript or is_ios):
+ raise RuntimeError("Dynamically linking Mono is not currently supported for this platform")
+
+ if not mono_prefix and (os.getenv("MONO32_PREFIX") or os.getenv("MONO64_PREFIX")):
+ print(
+ "WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead"
+ )
+
+ # Although we don't support building with tools for any platform where we currently use static AOT,
+ # if these are supported in the future, we won't be using static AOT for them as that would be
+ # too restrictive for the editor. These builds would probably be made to only use the interpreter.
+ mono_aot_static = (is_ios and not is_ios_sim) and not env["tools"]
- if is_javascript:
- mono_static = True
+ # Static AOT is only supported on the root domain
+ mono_single_appdomain = mono_aot_static
- if not mono_prefix and (os.getenv('MONO32_PREFIX') or os.getenv('MONO64_PREFIX')):
- print("WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead")
+ if mono_single_appdomain:
+ env_mono.Append(CPPDEFINES=["GD_MONO_SINGLE_APPDOMAIN"])
- if env['platform'] == 'windows':
+ if (env["tools"] or env["target"] != "release") and not mono_single_appdomain:
+ env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
+
+ if env["platform"] == "windows":
mono_root = mono_prefix
- if not mono_root and os.name == 'nt':
+ if not mono_root and os.name == "nt":
mono_root = monoreg.find_mono_root_dir(bits)
if not mono_root:
- raise RuntimeError("Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter")
+ raise RuntimeError(
+ "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"
+ )
- print('Found Mono root directory: ' + mono_root)
+ print("Found Mono root directory: " + mono_root)
- mono_lib_path = os.path.join(mono_root, 'lib')
+ mono_lib_path = os.path.join(mono_root, "lib")
env.Append(LIBPATH=mono_lib_path)
- env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))
+
+ lib_suffixes = [".lib"]
- lib_suffix = Environment()['LIBSUFFIX']
+ if not env.msvc:
+ # MingW supports both '.a' and '.lib'
+ lib_suffixes.insert(0, ".a")
if mono_static:
if env.msvc:
- mono_static_lib_name = 'libmono-static-sgen'
+ mono_static_lib_name = "libmono-static-sgen"
else:
- mono_static_lib_name = 'libmonosgen-2.0'
+ 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)
+ mono_static_lib_file = find_file_in_dir(mono_lib_path, [mono_static_lib_name], extensions=lib_suffixes)
+
+ if not mono_static_lib_file:
+ raise RuntimeError("Could not find static mono library in: " + mono_lib_path)
if env.msvc:
- env.Append(LINKFLAGS=mono_static_lib_name + lib_suffix)
+ env.Append(LINKFLAGS=mono_static_lib_file)
- env.Append(LINKFLAGS='Mincore' + lib_suffix)
- env.Append(LINKFLAGS='msvcrt' + lib_suffix)
- env.Append(LINKFLAGS='LIBCMT' + lib_suffix)
- env.Append(LINKFLAGS='Psapi' + lib_suffix)
+ env.Append(LINKFLAGS="Mincore.lib")
+ env.Append(LINKFLAGS="msvcrt.lib")
+ env.Append(LINKFLAGS="LIBCMT.lib")
+ env.Append(LINKFLAGS="Psapi.lib")
else:
- env.Append(LINKFLAGS=os.path.join(mono_lib_path, mono_static_lib_name + lib_suffix))
+ mono_static_lib_file_path = os.path.join(mono_lib_path, mono_static_lib_file)
+ env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_static_lib_file_path, "-Wl,-no-whole-archive"])
- env.Append(LIBS=['psapi'])
- env.Append(LIBS=['version'])
+ env.Append(LIBS=["psapi"])
+ env.Append(LIBS=["version"])
else:
- mono_lib_name = find_file_in_dir(mono_lib_path, mono_lib_names, extension=lib_suffix)
+ mono_lib_name = find_name_in_dir_files(
+ mono_lib_path, mono_lib_names, prefixes=["", "lib"], extensions=lib_suffixes
+ )
if not mono_lib_name:
- raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+ raise RuntimeError("Could not find mono library in: " + mono_lib_path)
if env.msvc:
- env.Append(LINKFLAGS=mono_lib_name + lib_suffix)
+ env.Append(LINKFLAGS=mono_lib_name + ".lib")
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_file = find_file_in_dir(mono_bin_path, mono_lib_names, prefixes=["", "lib"], extensions=[".dll"])
- if not mono_dll_name:
- raise RuntimeError('Could not find mono shared library in: ' + mono_bin_path)
+ if not mono_dll_file:
+ raise RuntimeError("Could not find mono shared library in: " + mono_bin_path)
- copy_file(mono_bin_path, '#bin', mono_dll_name + '.dll')
+ copy_file(mono_bin_path, "#bin", mono_dll_file)
else:
- is_apple = env['platform'] in ['osx', 'iphone']
+ is_apple = env["platform"] in ["osx", "iphone"]
+ is_macos = is_apple and not is_ios
- sharedlib_ext = '.dylib' if is_apple else '.so'
+ sharedlib_ext = ".dylib" if is_apple else ".so"
mono_root = mono_prefix
- mono_lib_path = ''
- mono_so_name = ''
+ mono_lib_path = ""
+ mono_so_file = ""
- if not mono_root and (is_android or is_javascript):
- raise RuntimeError("Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter")
+ if not mono_root and (is_android or is_javascript or is_ios):
+ raise RuntimeError(
+ "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"
+ )
- if not mono_root and is_apple:
+ if not mono_root and is_macos:
# Try with some known directories under OSX
- hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current', '/usr/local/var/homebrew/linked/mono']
+ hint_dirs = ["/Library/Frameworks/Mono.framework/Versions/Current", "/usr/local/var/homebrew/linked/mono"]
for hint_dir in hint_dirs:
if os.path.isdir(hint_dir):
mono_root = hint_dir
@@ -187,126 +239,165 @@ def configure(env, env_mono):
if not mono_root and mono_static:
mono_root = pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext)
if not mono_root:
- raise RuntimeError("Building with mono_static=yes, but failed to find the mono prefix with pkg-config; " + \
- "specify one manually with the 'mono_prefix' SCons parameter")
+ raise RuntimeError(
+ "Building with mono_static=yes, but failed to find the mono prefix with pkg-config; "
+ + "specify one manually with the 'mono_prefix' SCons parameter"
+ )
+
+ if is_ios and not is_ios_sim:
+ env_mono.Append(CPPDEFINES=["IOS_DEVICE"])
if mono_root:
- print('Found Mono root directory: ' + mono_root)
+ print("Found Mono root directory: " + mono_root)
- mono_lib_path = os.path.join(mono_root, 'lib')
+ mono_lib_path = os.path.join(mono_root, "lib")
env.Append(LIBPATH=[mono_lib_path])
- env_mono.Prepend(CPPPATH=os.path.join(mono_root, 'include', 'mono-2.0'))
+ env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))
- mono_lib = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension='.a')
+ mono_lib = find_name_in_dir_files(mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[".a"])
if not mono_lib:
- raise RuntimeError('Could not find mono library in: ' + mono_lib_path)
+ raise RuntimeError("Could not find mono library in: " + mono_lib_path)
- env_mono.Append(CPPDEFINES=['_REENTRANT'])
+ env_mono.Append(CPPDEFINES=["_REENTRANT"])
if mono_static:
- env.Append(LINKFLAGS=['-rdynamic'])
+ env.Append(LINKFLAGS=["-rdynamic"])
- mono_lib_file = os.path.join(mono_lib_path, 'lib' + mono_lib + '.a')
+ mono_lib_file = os.path.join(mono_lib_path, "lib" + mono_lib + ".a")
if is_apple:
- env.Append(LINKFLAGS=['-Wl,-force_load,' + mono_lib_file])
+ if is_macos:
+ env.Append(LINKFLAGS=["-Wl,-force_load," + mono_lib_file])
+ else:
+ arch = env["arch"]
+
+ def copy_mono_lib(libname_wo_ext):
+ copy_file(
+ mono_lib_path, "#bin", libname_wo_ext + ".a", "%s.iphone.%s.a" % (libname_wo_ext, arch)
+ )
+
+ # Copy Mono libraries to the output folder. These are meant to be bundled with
+ # the export templates and added to the Xcode project when exporting a game.
+ copy_mono_lib("lib" + mono_lib)
+ copy_mono_lib("libmono-native")
+ copy_mono_lib("libmono-profiler-log")
+
+ if not is_ios_sim:
+ copy_mono_lib("libmono-ee-interp")
+ copy_mono_lib("libmono-icall-table")
+ copy_mono_lib("libmono-ilgen")
else:
- assert is_desktop(env['platform']) or is_android or is_javascript
- env.Append(LINKFLAGS=['-Wl,-whole-archive', mono_lib_file, '-Wl,-no-whole-archive'])
+ assert is_desktop(env["platform"]) or is_android or is_javascript
+ env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_lib_file, "-Wl,-no-whole-archive"])
if is_javascript:
- env.Append(LIBS=['mono-icall-table', 'mono-native', 'mono-ilgen', 'mono-ee-interp'])
+ env.Append(LIBS=["mono-icall-table", "mono-native", "mono-ilgen", "mono-ee-interp"])
- wasm_src_dir = os.path.join(mono_root, 'src')
+ wasm_src_dir = os.path.join(mono_root, "src")
if not os.path.isdir(wasm_src_dir):
- raise RuntimeError('Could not find mono wasm src directory')
+ raise RuntimeError("Could not find mono wasm src directory")
# Ideally this should be defined only for 'driver.c', but I can't fight scons for another 2 hours
- env_mono.Append(CPPDEFINES=['CORE_BINDINGS'])
-
- env_mono.add_source_files(env.modules_sources, [
- os.path.join(wasm_src_dir, 'driver.c'),
- os.path.join(wasm_src_dir, 'zlib-helper.c'),
- os.path.join(wasm_src_dir, 'corebindings.c')
- ])
-
- env.Append(LINKFLAGS=[
- '--js-library', os.path.join(wasm_src_dir, 'library_mono.js'),
- '--js-library', os.path.join(wasm_src_dir, 'binding_support.js'),
- '--js-library', os.path.join(wasm_src_dir, 'dotnet_support.js')
- ])
+ env_mono.Append(CPPDEFINES=["CORE_BINDINGS"])
+
+ env_mono.add_source_files(
+ env.modules_sources,
+ [
+ os.path.join(wasm_src_dir, "driver.c"),
+ os.path.join(wasm_src_dir, "zlib-helper.c"),
+ os.path.join(wasm_src_dir, "corebindings.c"),
+ ],
+ )
+
+ env.Append(
+ LINKFLAGS=[
+ "--js-library",
+ os.path.join(wasm_src_dir, "library_mono.js"),
+ "--js-library",
+ os.path.join(wasm_src_dir, "binding_support.js"),
+ "--js-library",
+ os.path.join(wasm_src_dir, "dotnet_support.js"),
+ ]
+ )
else:
env.Append(LIBS=[mono_lib])
- if is_apple:
- env.Append(LIBS=['iconv', 'pthread'])
+ if is_macos:
+ env.Append(LIBS=["iconv", "pthread"])
elif is_android:
- pass # Nothing
+ pass # Nothing
+ elif is_ios:
+ pass # Nothing, linking is delegated to the exported Xcode project
elif is_javascript:
- env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
+ env.Append(LIBS=["m", "rt", "dl", "pthread"])
else:
- env.Append(LIBS=['m', 'rt', 'dl', 'pthread'])
+ env.Append(LIBS=["m", "rt", "dl", "pthread"])
if not mono_static:
- mono_so_name = find_file_in_dir(mono_lib_path, mono_lib_names, prefix='lib', extension=sharedlib_ext)
+ mono_so_file = find_file_in_dir(
+ mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext]
+ )
- if not mono_so_name:
- raise RuntimeError('Could not find mono shared library in: ' + mono_lib_path)
-
- copy_file(mono_lib_path, '#bin', 'lib' + mono_so_name + sharedlib_ext)
+ if not mono_so_file:
+ raise RuntimeError("Could not find mono shared library in: " + mono_lib_path)
else:
assert not mono_static
# TODO: Add option to force using pkg-config
- print('Mono root directory not found. Using pkg-config instead')
+ print("Mono root directory not found. Using pkg-config instead")
- env.ParseConfig('pkg-config monosgen-2 --libs')
- env_mono.ParseConfig('pkg-config monosgen-2 --cflags')
+ env.ParseConfig("pkg-config monosgen-2 --libs")
+ env_mono.ParseConfig("pkg-config monosgen-2 --cflags")
tmpenv = Environment()
- tmpenv.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
- tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L')
+ 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:
+ for hint_dir in tmpenv["LIBPATH"]:
+ file_found = find_file_in_dir(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext])
+ if file_found:
mono_lib_path = hint_dir
- mono_so_name = name_found
+ mono_so_file = file_found
break
- if not mono_so_name:
- raise RuntimeError('Could not find mono shared library in: ' + str(tmpenv['LIBPATH']))
+ if not mono_so_file:
+ raise RuntimeError("Could not find mono shared library in: " + str(tmpenv["LIBPATH"]))
if not mono_static:
- libs_output_dir = get_android_out_dir(env) if is_android else '#bin'
- copy_file(mono_lib_path, libs_output_dir, 'lib' + mono_so_name + sharedlib_ext)
+ libs_output_dir = get_android_out_dir(env) if is_android else "#bin"
+ copy_file(mono_lib_path, libs_output_dir, mono_so_file)
if not tools_enabled:
- if is_desktop(env['platform']):
+ if is_desktop(env["platform"]):
if not mono_root:
- mono_root = subprocess.check_output(['pkg-config', 'mono-2', '--variable=prefix']).decode('utf8').strip()
+ mono_root = (
+ subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
+ )
make_template_dir(env, mono_root)
elif is_android:
# Compress Android Mono Config
from . import make_android_mono_config
+
module_dir = os.getcwd()
- config_file_path = os.path.join(module_dir, 'build_scripts', 'mono_android_config.xml')
- make_android_mono_config.generate_compressed_config(config_file_path, 'mono_gd/')
+ config_file_path = os.path.join(module_dir, "build_scripts", "mono_android_config.xml")
+ make_android_mono_config.generate_compressed_config(config_file_path, "mono_gd/")
# Copy the required shared libraries
copy_mono_shared_libs(env, mono_root, None)
elif is_javascript:
- pass # No data directory for this platform
+ pass # No data directory for this platform
+ elif is_ios:
+ pass # No data directory for this platform
if copy_mono_root:
if not mono_root:
- mono_root = subprocess.check_output(['pkg-config', 'mono-2', '--variable=prefix']).decode('utf8').strip()
+ mono_root = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
if tools_enabled:
- copy_mono_root_files(env, mono_root)
+ copy_mono_root_files(env, mono_root)
else:
print("Ignoring option: 'copy_mono_root'; only available for builds with 'tools' enabled.")
@@ -314,26 +405,26 @@ def configure(env, env_mono):
def make_template_dir(env, mono_root):
from shutil import rmtree
- platform = env['platform']
- target = env['target']
+ platform = env["platform"]
+ target = env["target"]
- template_dir_name = ''
+ template_dir_name = ""
assert is_desktop(platform)
- template_dir_name = 'data.mono.%s.%s.%s' % (platform, env['bits'], target)
+ template_dir_name = "data.mono.%s.%s.%s" % (platform, env["bits"], target)
- output_dir = Dir('#bin').abspath
+ output_dir = Dir("#bin").abspath
template_dir = os.path.join(output_dir, template_dir_name)
- template_mono_root_dir = os.path.join(template_dir, 'Mono')
+ template_mono_root_dir = os.path.join(template_dir, "Mono")
if os.path.isdir(template_mono_root_dir):
- rmtree(template_mono_root_dir) # Clean first
+ rmtree(template_mono_root_dir) # Clean first
# Copy etc/mono/
- template_mono_config_dir = os.path.join(template_mono_root_dir, 'etc', 'mono')
+ template_mono_config_dir = os.path.join(template_mono_root_dir, "etc", "mono")
copy_mono_etc_dir(mono_root, template_mono_config_dir, platform)
# Copy the required shared libraries
@@ -347,18 +438,18 @@ def copy_mono_root_files(env, mono_root):
from shutil import rmtree
if not mono_root:
- raise RuntimeError('Mono installation directory not found')
+ raise RuntimeError("Mono installation directory not found")
- output_dir = Dir('#bin').abspath
- editor_mono_root_dir = os.path.join(output_dir, 'GodotSharp', 'Mono')
+ output_dir = Dir("#bin").abspath
+ editor_mono_root_dir = os.path.join(output_dir, "GodotSharp", "Mono")
if os.path.isdir(editor_mono_root_dir):
- rmtree(editor_mono_root_dir) # Clean first
+ rmtree(editor_mono_root_dir) # Clean first
# Copy etc/mono/
- editor_mono_config_dir = os.path.join(editor_mono_root_dir, 'etc', 'mono')
- copy_mono_etc_dir(mono_root, editor_mono_config_dir, env['platform'])
+ editor_mono_config_dir = os.path.join(editor_mono_root_dir, "etc", "mono")
+ copy_mono_etc_dir(mono_root, editor_mono_config_dir, env["platform"])
# Copy the required shared libraries
@@ -366,20 +457,20 @@ def copy_mono_root_files(env, mono_root):
# Copy framework assemblies
- mono_framework_dir = os.path.join(mono_root, 'lib', 'mono', '4.5')
- mono_framework_facades_dir = os.path.join(mono_framework_dir, 'Facades')
+ mono_framework_dir = os.path.join(mono_root, "lib", "mono", "4.5")
+ mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")
- editor_mono_framework_dir = os.path.join(editor_mono_root_dir, 'lib', 'mono', '4.5')
- editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, 'Facades')
+ editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")
+ editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, "Facades")
if not os.path.isdir(editor_mono_framework_dir):
os.makedirs(editor_mono_framework_dir)
if not os.path.isdir(editor_mono_framework_facades_dir):
os.makedirs(editor_mono_framework_facades_dir)
- for assembly in glob(os.path.join(mono_framework_dir, '*.dll')):
+ for assembly in glob(os.path.join(mono_framework_dir, "*.dll")):
copy(assembly, editor_mono_framework_dir)
- for assembly in glob(os.path.join(mono_framework_facades_dir, '*.dll')):
+ for assembly in glob(os.path.join(mono_framework_facades_dir, "*.dll")):
copy(assembly, editor_mono_framework_facades_dir)
@@ -391,28 +482,28 @@ def copy_mono_etc_dir(mono_root, target_mono_config_dir, platform):
if not os.path.isdir(target_mono_config_dir):
os.makedirs(target_mono_config_dir)
- mono_etc_dir = os.path.join(mono_root, 'etc', 'mono')
+ mono_etc_dir = os.path.join(mono_root, "etc", "mono")
if not os.path.isdir(mono_etc_dir):
- mono_etc_dir = ''
+ mono_etc_dir = ""
etc_hint_dirs = []
- if platform != 'windows':
- etc_hint_dirs += ['/etc/mono', '/usr/local/etc/mono']
- if 'MONO_CFG_DIR' in os.environ:
- etc_hint_dirs += [os.path.join(os.environ['MONO_CFG_DIR'], 'mono')]
+ if platform != "windows":
+ etc_hint_dirs += ["/etc/mono", "/usr/local/etc/mono"]
+ if "MONO_CFG_DIR" in os.environ:
+ etc_hint_dirs += [os.path.join(os.environ["MONO_CFG_DIR"], "mono")]
for etc_hint_dir in etc_hint_dirs:
if os.path.isdir(etc_hint_dir):
mono_etc_dir = etc_hint_dir
break
if not mono_etc_dir:
- raise RuntimeError('Mono installation etc directory not found')
+ raise RuntimeError("Mono installation etc directory not found")
- copy_tree(os.path.join(mono_etc_dir, '2.0'), os.path.join(target_mono_config_dir, '2.0'))
- copy_tree(os.path.join(mono_etc_dir, '4.0'), os.path.join(target_mono_config_dir, '4.0'))
- copy_tree(os.path.join(mono_etc_dir, '4.5'), os.path.join(target_mono_config_dir, '4.5'))
- if os.path.isdir(os.path.join(mono_etc_dir, 'mconfig')):
- copy_tree(os.path.join(mono_etc_dir, 'mconfig'), os.path.join(target_mono_config_dir, 'mconfig'))
+ copy_tree(os.path.join(mono_etc_dir, "2.0"), os.path.join(target_mono_config_dir, "2.0"))
+ copy_tree(os.path.join(mono_etc_dir, "4.0"), os.path.join(target_mono_config_dir, "4.0"))
+ copy_tree(os.path.join(mono_etc_dir, "4.5"), os.path.join(target_mono_config_dir, "4.5"))
+ if os.path.isdir(os.path.join(mono_etc_dir, "mconfig")):
+ copy_tree(os.path.join(mono_etc_dir, "mconfig"), os.path.join(target_mono_config_dir, "mconfig"))
- for file in glob(os.path.join(mono_etc_dir, '*')):
+ for file in glob(os.path.join(mono_etc_dir, "*")):
if os.path.isfile(file):
copy(file, target_mono_config_dir)
@@ -424,48 +515,66 @@ def copy_mono_shared_libs(env, mono_root, target_mono_root_dir):
if os.path.isfile(src):
copy(src, dst)
- platform = env['platform']
+ platform = env["platform"]
- if platform == 'windows':
- src_mono_bin_dir = os.path.join(mono_root, 'bin')
- target_mono_bin_dir = os.path.join(target_mono_root_dir, 'bin')
+ if platform == "windows":
+ src_mono_bin_dir = os.path.join(mono_root, "bin")
+ target_mono_bin_dir = os.path.join(target_mono_root_dir, "bin")
if not os.path.isdir(target_mono_bin_dir):
os.makedirs(target_mono_bin_dir)
- mono_posix_helper_name = find_file_in_dir(src_mono_bin_dir, ['MonoPosixHelper', 'libMonoPosixHelper'], extension='.dll')
- copy(os.path.join(src_mono_bin_dir, mono_posix_helper_name + '.dll'), os.path.join(target_mono_bin_dir, 'MonoPosixHelper.dll'))
+ mono_posix_helper_file = find_file_in_dir(
+ src_mono_bin_dir, ["MonoPosixHelper"], prefixes=["", "lib"], extensions=[".dll"]
+ )
+ copy(
+ os.path.join(src_mono_bin_dir, mono_posix_helper_file),
+ os.path.join(target_mono_bin_dir, "MonoPosixHelper.dll"),
+ )
# For newer versions
- btls_dll_path = os.path.join(src_mono_bin_dir, 'libmono-btls-shared.dll')
+ btls_dll_path = os.path.join(src_mono_bin_dir, "libmono-btls-shared.dll")
if os.path.isfile(btls_dll_path):
copy(btls_dll_path, target_mono_bin_dir)
else:
- target_mono_lib_dir = get_android_out_dir(env) if platform == 'android' else os.path.join(target_mono_root_dir, 'lib')
+ target_mono_lib_dir = (
+ get_android_out_dir(env) if platform == "android" else os.path.join(target_mono_root_dir, "lib")
+ )
if not os.path.isdir(target_mono_lib_dir):
os.makedirs(target_mono_lib_dir)
lib_file_names = []
- if platform == 'osx':
- lib_file_names = [lib_name + '.dylib' for lib_name in [
- 'libmono-btls-shared', 'libmono-native-compat', 'libMonoPosixHelper'
- ]]
+ if platform == "osx":
+ lib_file_names = [
+ lib_name + ".dylib"
+ for lib_name in ["libmono-btls-shared", "libmono-native-compat", "libMonoPosixHelper"]
+ ]
elif is_unix_like(platform):
- lib_file_names = [lib_name + '.so' for lib_name in [
- 'libmono-btls-shared', 'libmono-ee-interp', 'libmono-native', 'libMonoPosixHelper',
- 'libmono-profiler-aot', 'libmono-profiler-coverage', 'libmono-profiler-log', 'libMonoSupportW'
- ]]
+ lib_file_names = [
+ lib_name + ".so"
+ for lib_name in [
+ "libmono-btls-shared",
+ "libmono-ee-interp",
+ "libmono-native",
+ "libMonoPosixHelper",
+ "libmono-profiler-aot",
+ "libmono-profiler-coverage",
+ "libmono-profiler-log",
+ "libMonoSupportW",
+ ]
+ ]
for lib_file_name in lib_file_names:
- copy_if_exists(os.path.join(mono_root, 'lib', lib_file_name), target_mono_lib_dir)
+ copy_if_exists(os.path.join(mono_root, "lib", lib_file_name), target_mono_lib_dir)
+
def pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext):
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 ''
+ 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_name_in_dir_files(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[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 ""
diff --git a/modules/mono/build_scripts/mono_reg_utils.py b/modules/mono/build_scripts/mono_reg_utils.py
index 3bae11b167..3090a4759a 100644
--- a/modules/mono/build_scripts/mono_reg_utils.py
+++ b/modules/mono/build_scripts/mono_reg_utils.py
@@ -1,7 +1,7 @@
import os
import platform
-if os.name == 'nt':
+if os.name == "nt":
import sys
import winreg
@@ -10,7 +10,7 @@ def _reg_open_key(key, subkey):
try:
return winreg.OpenKey(key, subkey)
except (WindowsError, OSError):
- if platform.architecture()[0] == '32bit':
+ if platform.architecture()[0] == "32bit":
bitness_sam = winreg.KEY_WOW64_64KEY
else:
bitness_sam = winreg.KEY_WOW64_32KEY
@@ -20,12 +20,12 @@ def _reg_open_key(key, subkey):
def _reg_open_key_bits(key, subkey, bits):
sam = winreg.KEY_READ
- if platform.architecture()[0] == '32bit':
- if bits == '64':
+ if platform.architecture()[0] == "32bit":
+ if bits == "64":
# Force 32bit process to search in 64bit registry
sam |= winreg.KEY_WOW64_64KEY
else:
- if bits == '32':
+ if bits == "32":
# Force 64bit process to search in 32bit registry
sam |= winreg.KEY_WOW64_32KEY
@@ -35,7 +35,7 @@ def _reg_open_key_bits(key, subkey, bits):
def _find_mono_in_reg(subkey, bits):
try:
with _reg_open_key_bits(winreg.HKEY_LOCAL_MACHINE, subkey, bits) as hKey:
- value = winreg.QueryValueEx(hKey, 'SdkInstallRoot')[0]
+ value = winreg.QueryValueEx(hKey, "SdkInstallRoot")[0]
return value
except (WindowsError, OSError):
return None
@@ -44,70 +44,70 @@ def _find_mono_in_reg(subkey, bits):
def _find_mono_in_reg_old(subkey, bits):
try:
with _reg_open_key_bits(winreg.HKEY_LOCAL_MACHINE, subkey, bits) as hKey:
- default_clr = winreg.QueryValueEx(hKey, 'DefaultCLR')[0]
+ default_clr = winreg.QueryValueEx(hKey, "DefaultCLR")[0]
if default_clr:
- return _find_mono_in_reg(subkey + '\\' + default_clr, bits)
+ return _find_mono_in_reg(subkey + "\\" + default_clr, bits)
return None
except (WindowsError, EnvironmentError):
return None
def find_mono_root_dir(bits):
- root_dir = _find_mono_in_reg(r'SOFTWARE\Mono', bits)
+ root_dir = _find_mono_in_reg(r"SOFTWARE\Mono", bits)
if root_dir is not None:
return str(root_dir)
- root_dir = _find_mono_in_reg_old(r'SOFTWARE\Novell\Mono', bits)
+ root_dir = _find_mono_in_reg_old(r"SOFTWARE\Novell\Mono", bits)
if root_dir is not None:
return str(root_dir)
- return ''
+ return ""
def find_msbuild_tools_path_reg():
import subprocess
- vswhere = os.getenv('PROGRAMFILES(X86)')
+ vswhere = os.getenv("PROGRAMFILES(X86)")
if not vswhere:
- vswhere = os.getenv('PROGRAMFILES')
- vswhere += r'\Microsoft Visual Studio\Installer\vswhere.exe'
+ vswhere = os.getenv("PROGRAMFILES")
+ vswhere += r"\Microsoft Visual Studio\Installer\vswhere.exe"
- vswhere_args = ['-latest', '-products', '*', '-requires', 'Microsoft.Component.MSBuild']
+ vswhere_args = ["-latest", "-products", "*", "-requires", "Microsoft.Component.MSBuild"]
try:
lines = subprocess.check_output([vswhere] + vswhere_args).splitlines()
for line in lines:
- parts = line.decode("utf-8").split(':', 1)
+ parts = line.decode("utf-8").split(":", 1)
- if len(parts) < 2 or parts[0] != 'installationPath':
+ if len(parts) < 2 or parts[0] != "installationPath":
continue
val = parts[1].strip()
if not val:
- raise ValueError('Value of `installationPath` entry is empty')
+ raise ValueError("Value of `installationPath` entry is empty")
# Since VS2019, the directory is simply named "Current"
- msbuild_dir = os.path.join(val, 'MSBuild\\Current\\Bin')
+ msbuild_dir = os.path.join(val, "MSBuild\\Current\\Bin")
if os.path.isdir(msbuild_dir):
return msbuild_dir
# Directory name "15.0" is used in VS 2017
- return os.path.join(val, 'MSBuild\\15.0\\Bin')
+ return os.path.join(val, "MSBuild\\15.0\\Bin")
- raise ValueError('Cannot find `installationPath` entry')
+ raise ValueError("Cannot find `installationPath` entry")
except ValueError as e:
- print('Error reading output from vswhere: ' + e.message)
+ print("Error reading output from vswhere: " + e.message)
except WindowsError:
- pass # Fine, vswhere not found
+ pass # Fine, vswhere not found
except (subprocess.CalledProcessError, OSError):
pass
# Try to find 14.0 in the Registry
try:
- subkey = r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0'
+ subkey = r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0"
with _reg_open_key(winreg.HKEY_LOCAL_MACHINE, subkey) as hKey:
- value = winreg.QueryValueEx(hKey, 'MSBuildToolsPath')[0]
+ value = winreg.QueryValueEx(hKey, "MSBuildToolsPath")[0]
return value
except (WindowsError, OSError):
- return ''
+ return ""
diff --git a/modules/mono/build_scripts/solution_builder.py b/modules/mono/build_scripts/solution_builder.py
index d1529a64d2..db6b4ff7aa 100644
--- a/modules/mono/build_scripts/solution_builder.py
+++ b/modules/mono/build_scripts/solution_builder.py
@@ -1,4 +1,3 @@
-
import os
@@ -8,35 +7,38 @@ verbose = False
def find_nuget_unix():
import os
- if 'NUGET_PATH' in os.environ:
- hint_path = os.environ['NUGET_PATH']
+ if "NUGET_PATH" in os.environ:
+ hint_path = os.environ["NUGET_PATH"]
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
- hint_path = os.path.join(hint_path, 'nuget')
+ hint_path = os.path.join(hint_path, "nuget")
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
import os.path
import sys
- hint_dirs = ['/opt/novell/mono/bin']
- if sys.platform == 'darwin':
- hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin', '/usr/local/var/homebrew/linked/mono/bin'] + hint_dirs
+ hint_dirs = ["/opt/novell/mono/bin"]
+ if sys.platform == "darwin":
+ hint_dirs = [
+ "/Library/Frameworks/Mono.framework/Versions/Current/bin",
+ "/usr/local/var/homebrew/linked/mono/bin",
+ ] + hint_dirs
for hint_dir in hint_dirs:
- hint_path = os.path.join(hint_dir, 'nuget')
+ hint_path = os.path.join(hint_dir, "nuget")
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, 'nuget')
+ hint_path = os.path.join(hint_dir, "nuget")
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
@@ -44,30 +46,30 @@ def find_nuget_unix():
def find_nuget_windows(env):
import os
- if 'NUGET_PATH' in os.environ:
- hint_path = os.environ['NUGET_PATH']
+ if "NUGET_PATH" in os.environ:
+ hint_path = os.environ["NUGET_PATH"]
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
- hint_path = os.path.join(hint_path, 'nuget.exe')
+ hint_path = os.path.join(hint_path, "nuget.exe")
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
- from . mono_reg_utils import find_mono_root_dir
+ from .mono_reg_utils import find_mono_root_dir
- mono_root = env['mono_prefix'] or find_mono_root_dir(env['bits'])
+ mono_root = env["mono_prefix"] or find_mono_root_dir(env["bits"])
if mono_root:
- mono_bin_dir = os.path.join(mono_root, 'bin')
- nuget_mono = os.path.join(mono_bin_dir, 'nuget.bat')
+ mono_bin_dir = os.path.join(mono_root, "bin")
+ nuget_mono = os.path.join(mono_bin_dir, "nuget.bat")
if os.path.isfile(nuget_mono):
return nuget_mono
# Standalone NuGet
- 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, 'nuget.exe')
+ hint_path = os.path.join(hint_dir, "nuget.exe")
if os.path.isfile(hint_path) and os.access(hint_path, os.X_OK):
return hint_path
@@ -78,52 +80,55 @@ def find_msbuild_unix(filename):
import os.path
import sys
- hint_dirs = ['/opt/novell/mono/bin']
- if sys.platform == 'darwin':
- hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current/bin', '/usr/local/var/homebrew/linked/mono/bin'] + hint_dirs
+ hint_dirs = ["/opt/novell/mono/bin"]
+ if sys.platform == "darwin":
+ hint_dirs = [
+ "/Library/Frameworks/Mono.framework/Versions/Current/bin",
+ "/usr/local/var/homebrew/linked/mono/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
def find_msbuild_windows(env):
- from . mono_reg_utils import find_mono_root_dir, find_msbuild_tools_path_reg
+ from .mono_reg_utils import find_mono_root_dir, find_msbuild_tools_path_reg
- mono_root = env['mono_prefix'] or find_mono_root_dir(env['bits'])
+ mono_root = env["mono_prefix"] or find_mono_root_dir(env["bits"])
if not mono_root:
- raise RuntimeError('Cannot find mono root directory')
+ raise RuntimeError("Cannot find mono root directory")
- mono_bin_dir = os.path.join(mono_root, 'bin')
- msbuild_mono = os.path.join(mono_bin_dir, 'msbuild.bat')
+ mono_bin_dir = os.path.join(mono_root, "bin")
+ msbuild_mono = os.path.join(mono_bin_dir, "msbuild.bat")
msbuild_tools_path = find_msbuild_tools_path_reg()
if msbuild_tools_path:
- return (os.path.join(msbuild_tools_path, 'MSBuild.exe'), {})
+ return (os.path.join(msbuild_tools_path, "MSBuild.exe"), {})
if os.path.isfile(msbuild_mono):
# The (Csc/Vbc/Fsc)ToolExe environment variables are required when
# building with Mono's MSBuild. They must point to the batch files
# in Mono's bin directory to make sure they are executed with 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')
+ "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, mono_msbuild_env)
@@ -132,7 +137,7 @@ def find_msbuild_windows(env):
def run_command(command, args, env_override=None, name=None):
def cmd_args_to_str(cmd_args):
- return ' '.join([arg if not ' ' in arg else '"%s"' % arg for arg in cmd_args])
+ return " ".join([arg if not " " in arg else '"%s"' % arg for arg in cmd_args])
args = [command] + args
@@ -143,6 +148,7 @@ def run_command(command, args, env_override=None, name=None):
print("Running '%s': %s" % (name, cmd_args_to_str(args)))
import subprocess
+
try:
if env_override is None:
subprocess.check_call(args)
@@ -154,61 +160,61 @@ def run_command(command, args, env_override=None, name=None):
def nuget_restore(env, *args):
global verbose
- verbose = env['verbose']
+ verbose = env["verbose"]
# Find NuGet
- nuget_path = find_nuget_windows(env) if os.name == 'nt' else find_nuget_unix()
+ nuget_path = find_nuget_windows(env) if os.name == "nt" else find_nuget_unix()
if nuget_path is None:
- raise RuntimeError('Cannot find NuGet executable')
+ raise RuntimeError("Cannot find NuGet executable")
- print('NuGet path: ' + nuget_path)
+ print("NuGet path: " + nuget_path)
# Do NuGet restore
- run_command(nuget_path, ['restore'] + list(args), name='nuget restore')
+ run_command(nuget_path, ["restore"] + list(args), name="nuget restore")
def build_solution(env, solution_path, build_config, extra_msbuild_args=[]):
global verbose
- verbose = env['verbose']
+ verbose = env["verbose"]
msbuild_env = os.environ.copy()
# Needed when running from Developer Command Prompt for VS
- if 'PLATFORM' in msbuild_env:
- del msbuild_env['PLATFORM']
+ if "PLATFORM" in msbuild_env:
+ del msbuild_env["PLATFORM"]
# Find MSBuild
- if os.name == 'nt':
+ if os.name == "nt":
msbuild_info = find_msbuild_windows(env)
if msbuild_info is None:
- raise RuntimeError('Cannot find MSBuild executable')
+ raise RuntimeError("Cannot find MSBuild executable")
msbuild_path = msbuild_info[0]
msbuild_env.update(msbuild_info[1])
else:
- msbuild_path = find_msbuild_unix('msbuild')
+ msbuild_path = find_msbuild_unix("msbuild")
if msbuild_path is None:
- xbuild_fallback = env['xbuild_fallback']
+ xbuild_fallback = env["xbuild_fallback"]
- if xbuild_fallback and os.name == 'nt':
- print('Option \'xbuild_fallback\' not supported on Windows')
+ if xbuild_fallback and os.name == "nt":
+ print("Option 'xbuild_fallback' not supported on Windows")
xbuild_fallback = False
if xbuild_fallback:
- print('Cannot find MSBuild executable, trying with xbuild')
- print('Warning: xbuild is deprecated')
+ print("Cannot find MSBuild executable, trying with xbuild")
+ print("Warning: xbuild is deprecated")
- msbuild_path = find_msbuild_unix('xbuild')
+ msbuild_path = find_msbuild_unix("xbuild")
if msbuild_path is None:
- raise RuntimeError('Cannot find xbuild executable')
+ raise RuntimeError("Cannot find xbuild executable")
else:
- raise RuntimeError('Cannot find MSBuild executable')
+ raise RuntimeError("Cannot find MSBuild executable")
- print('MSBuild path: ' + msbuild_path)
+ print("MSBuild path: " + msbuild_path)
# Build solution
- msbuild_args = [solution_path, '/p:Configuration=' + build_config]
+ msbuild_args = [solution_path, "/p:Configuration=" + build_config]
msbuild_args += extra_msbuild_args
- run_command(msbuild_path, msbuild_args, env_override=msbuild_env, name='msbuild')
+ run_command(msbuild_path, msbuild_args, env_override=msbuild_env, name="msbuild")
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp
index b04e53bd81..384685d04b 100644
--- a/modules/mono/class_db_api_json.cpp
+++ b/modules/mono/class_db_api_json.cpp
@@ -42,7 +42,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
List<StringName> names;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = ClassDB::classes.next(k))) {
@@ -67,7 +67,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->method_map.next(k))) {
@@ -132,7 +132,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->constant_map.next(k))) {
@@ -160,7 +160,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->signal_map.next(k))) {
@@ -196,7 +196,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) {
List<StringName> snames;
- k = NULL;
+ k = nullptr;
while ((k = t->property_setget.next(k))) {
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 3ee1618366..106ca6e028 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -1,43 +1,70 @@
+supported_platforms = ["windows", "osx", "linuxbsd", "server", "android", "haiku", "javascript", "iphone"]
+
+
def can_build(env, platform):
return True
def configure(env):
- if env['platform'] not in ['windows', 'osx', 'linuxbsd', 'server', 'android', 'haiku', 'javascript']:
- raise RuntimeError('This module does not currently support building for this platform')
+ platform = env["platform"]
+
+ if platform not in supported_platforms:
+ raise RuntimeError("This module does not currently support building for this platform")
env.use_ptrcall = True
- env.add_module_version_string('mono')
+ env.add_module_version_string("mono")
from SCons.Script import BoolVariable, PathVariable, Variables, Help
+ default_mono_static = platform in ["iphone", "javascript"]
+ default_mono_bundles_zlib = platform in ["javascript"]
+
envvars = Variables()
- envvars.Add(PathVariable('mono_prefix', 'Path to the mono installation directory for the target platform and architecture', '', PathVariable.PathAccept))
- envvars.Add(BoolVariable('mono_static', 'Statically link mono', False))
- envvars.Add(BoolVariable('mono_glue', 'Build with the mono glue sources', True))
- envvars.Add(BoolVariable('copy_mono_root', 'Make a copy of the mono installation directory to bundle with the editor', False))
- envvars.Add(BoolVariable('xbuild_fallback', 'If MSBuild is not found, fallback to xbuild', False))
+ envvars.Add(
+ PathVariable(
+ "mono_prefix",
+ "Path to the mono installation directory for the target platform and architecture",
+ "",
+ PathVariable.PathAccept,
+ )
+ )
+ envvars.Add(BoolVariable("mono_static", "Statically link mono", default_mono_static))
+ envvars.Add(BoolVariable("mono_glue", "Build with the mono glue sources", True))
+ envvars.Add(
+ BoolVariable(
+ "copy_mono_root", "Make a copy of the mono installation directory to bundle with the editor", False
+ )
+ )
+ envvars.Add(BoolVariable("xbuild_fallback", "If MSBuild is not found, fallback to xbuild", False))
+
+ # TODO: It would be great if this could be detected automatically instead
+ envvars.Add(
+ BoolVariable(
+ "mono_bundles_zlib", "Specify if the Mono runtime was built with bundled zlib", default_mono_bundles_zlib
+ )
+ )
+
envvars.Update(env)
Help(envvars.GenerateHelpText(env))
- if env['platform'] == 'javascript':
- # Mono wasm already has zlib builtin, so we need this workaround to avoid symbol collisions
- print('Compiling with Mono wasm disables \'builtin_zlib\'')
- env['builtin_zlib'] = False
+ if env["mono_bundles_zlib"]:
+ # Mono may come with zlib bundled for WASM or on newer version when built with MinGW.
+ print("This Mono runtime comes with zlib bundled. Disabling 'builtin_zlib'...")
+ env["builtin_zlib"] = False
thirdparty_zlib_dir = "#thirdparty/zlib/"
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
def get_doc_classes():
return [
- '@C#',
- 'CSharpScript',
- 'GodotSharp',
+ "@C#",
+ "CSharpScript",
+ "GodotSharp",
]
def get_doc_path():
- return 'doc_classes'
+ return "doc_classes"
def is_enabled():
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 28bacbd0f0..0b5d3c8dbc 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -158,7 +158,7 @@ void CSharpLanguage::finish() {
if (gdmono) {
memdelete(gdmono);
- gdmono = NULL;
+ gdmono = nullptr;
}
// Clear here, after finalizing all domains to make sure there is nothing else referencing the elements.
@@ -316,7 +316,8 @@ void CSharpLanguage::get_string_delimiters(List<String> *p_delimiters) const {
p_delimiters->push_back("' '"); // character literal
p_delimiters->push_back("\" \""); // regular string literal
- p_delimiters->push_back("@\" \""); // verbatim string literal
+ // Verbatim string literals (`@" "`) don't render correctly, so don't highlight them.
+ // Generic string highlighting suffices as a workaround for now.
}
static String get_base_class_name(const String &p_base_class_name, const String p_class_name) {
@@ -613,7 +614,7 @@ Vector<ScriptLanguage::StackInfo> CSharpLanguage::stack_trace_get_info(MonoObjec
GD_MONO_SCOPE_THREAD_ATTACH;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoArray *frames = CACHED_METHOD_THUNK(System_Diagnostics_StackTrace, GetFrames).invoke(p_stack_trace, &exc);
@@ -678,14 +679,14 @@ void CSharpLanguage::pre_unsafe_unreference(Object *p_obj) {
void CSharpLanguage::frame() {
- if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != NULL) {
+ if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != nullptr) {
const Ref<MonoGCHandleRef> &task_scheduler_handle = GDMonoCache::cached_data.task_scheduler_handle;
if (task_scheduler_handle.is_valid()) {
MonoObject *task_scheduler = task_scheduler_handle->get_target();
if (task_scheduler) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(GodotTaskScheduler, Activate).invoke(task_scheduler, &exc);
if (exc) {
@@ -763,7 +764,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() {
if (proj_assembly) {
String proj_asm_path = proj_assembly->get_path();
- if (!FileAccess::exists(proj_assembly->get_path())) {
+ if (!FileAccess::exists(proj_asm_path)) {
// Maybe it wasn't loaded from the default path, so check this as well
proj_asm_path = GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(appname_safe);
if (!FileAccess::exists(proj_asm_path))
@@ -812,7 +813,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
Array serialized_data;
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TrySerializeDelegate).invoke(delegate, managed_serialized_data, &exc);
if (exc) {
@@ -945,7 +946,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// Restore Variant properties state, it will be kept by the placeholder until the next script reloading
for (List<Pair<StringName, Variant>>::Element *G = scr->pending_reload_state[obj_id].properties.front(); G; G = G->next()) {
- placeholder->property_set_fallback(G->get().first, G->get().second, NULL);
+ placeholder->property_set_fallback(G->get().first, G->get().second, nullptr);
}
scr->pending_reload_state.erase(obj_id);
@@ -979,12 +980,12 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
GDMonoAssembly *project_assembly = gdmono->get_project_assembly();
// Search in project and tools assemblies first as those are the most likely to have the class
- GDMonoClass *script_class = (project_assembly ? project_assembly->get_class(class_namespace, class_name) : NULL);
+ GDMonoClass *script_class = (project_assembly ? project_assembly->get_class(class_namespace, class_name) : nullptr);
#ifdef TOOLS_ENABLED
if (!script_class) {
GDMonoAssembly *tools_assembly = gdmono->get_tools_assembly();
- script_class = (tools_assembly ? tools_assembly->get_class(class_namespace, class_name) : NULL);
+ script_class = (tools_assembly ? tools_assembly->get_class(class_namespace, class_name) : nullptr);
}
#endif
@@ -1055,7 +1056,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
continue;
}
#else
- CRASH_COND(si != NULL);
+ CRASH_COND(si != nullptr);
#endif
// Re-create script instance
obj->set_script(script); // will create the script instance as well
@@ -1104,9 +1105,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
const CSharpScript::EventSignal &event_signal = match->value();
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
- MonoDelegate *delegate = NULL;
+ MonoDelegate *delegate = nullptr;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TryDeserializeDelegate).invoke(managed_serialized_data, &delegate, &exc);
if (exc) {
@@ -1115,7 +1116,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
}
if (success) {
- ERR_CONTINUE(delegate == NULL);
+ ERR_CONTINUE(delegate == nullptr);
event_signal.field->set_value(csi->get_mono_object(), (MonoObject *)delegate);
} else if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Failed to deserialize event signal delegate\n");
@@ -1140,9 +1141,9 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
const Array &serialized_data = elem->value();
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
- MonoDelegate *delegate = NULL;
+ MonoDelegate *delegate = nullptr;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TryDeserializeDelegate).invoke(managed_serialized_data, &delegate, &exc);
if (exc) {
@@ -1151,7 +1152,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
}
if (success) {
- ERR_CONTINUE(delegate == NULL);
+ ERR_CONTINUE(delegate == nullptr);
managed_callable->set_delegate(delegate);
} else if (OS::get_singleton()->is_stdout_verbose()) {
OS::get_singleton()->print("Failed to deserialize delegate\n");
@@ -1291,7 +1292,7 @@ void CSharpLanguage::_on_scripts_domain_unloaded() {
for (SelfList<ManagedCallable> *elem = ManagedCallable::instances.first(); elem; elem = elem->next()) {
ManagedCallable *managed_callable = elem->self();
managed_callable->delegate_handle.release();
- managed_callable->delegate_invoke = NULL;
+ managed_callable->delegate_invoke = nullptr;
}
}
@@ -1306,17 +1307,17 @@ void CSharpLanguage::_editor_init_callback() {
// Initialize GodotSharpEditor
GDMonoClass *editor_klass = GDMono::get_singleton()->get_tools_assembly()->get_class("GodotTools", "GodotSharpEditor");
- CRASH_COND(editor_klass == NULL);
+ CRASH_COND(editor_klass == nullptr);
MonoObject *mono_object = mono_object_new(mono_domain_get(), editor_klass->get_mono_ptr());
- CRASH_COND(mono_object == NULL);
+ CRASH_COND(mono_object == nullptr);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::runtime_object_init(mono_object, editor_klass, &exc);
UNHANDLED_EXCEPTION(exc);
EditorPlugin *godotsharp_editor = Object::cast_to<EditorPlugin>(GDMonoMarshal::mono_object_to_variant(mono_object));
- CRASH_COND(godotsharp_editor == NULL);
+ CRASH_COND(godotsharp_editor == nullptr);
// Enable it as a plugin
EditorNode::add_editor_plugin(godotsharp_editor);
@@ -1353,7 +1354,7 @@ void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, MonoGCH
// already released and could have been replaced) or if we can't get its target MonoObject*
// (which doesn't necessarily mean it was released, and we want it released in order to
// avoid locking other threads unnecessarily).
- if (target == p_expected_obj || target == NULL) {
+ if (target == p_expected_obj || target == nullptr) {
p_gchandle.release();
}
}
@@ -1379,7 +1380,7 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b
// I don't trust you
if (p_object->get_script_instance()) {
CSharpInstance *csharp_instance = CAST_CSHARP_INSTANCE(p_object->get_script_instance());
- CRASH_COND(csharp_instance != NULL && !csharp_instance->is_destructing_script_instance());
+ CRASH_COND(csharp_instance != nullptr && !csharp_instance->is_destructing_script_instance());
}
#endif
@@ -1433,7 +1434,7 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) {
CSharpScriptBinding script_binding;
if (!setup_csharp_script_binding(script_binding, p_object))
- return NULL;
+ return nullptr;
return (void *)insert_script_binding(p_object, script_binding);
}
@@ -1445,7 +1446,7 @@ Map<Object *, CSharpScriptBinding>::Element *CSharpLanguage::insert_script_bindi
void CSharpLanguage::free_instance_binding_data(void *p_data) {
- if (GDMono::get_singleton() == NULL) {
+ if (GDMono::get_singleton() == nullptr) {
#ifdef DEBUG_ENABLED
CRASH_COND(!script_bindings.empty());
#endif
@@ -1470,7 +1471,7 @@ void CSharpLanguage::free_instance_binding_data(void *p_data) {
// This is done to avoid trying to dispose the native instance from Dispose(bool).
MonoObject *mono_object = script_binding.gchandle.get_target();
if (mono_object) {
- CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, NULL);
+ CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, nullptr);
}
script_binding.gchandle.release();
}
@@ -1562,7 +1563,7 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
Reference *ref = Object::cast_to<Reference>(p_owner);
- instance->base_ref = ref != NULL;
+ instance->base_ref = ref != nullptr;
instance->owner = p_owner;
instance->gchandle = p_gchandle;
@@ -1576,7 +1577,7 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
MonoObject *CSharpInstance::get_mono_object() const {
- ERR_FAIL_COND_V(gchandle.is_released(), NULL);
+ ERR_FAIL_COND_V(gchandle.is_released(), nullptr);
return gchandle.get_target();
}
@@ -1661,7 +1662,7 @@ bool CSharpInstance::get(const StringName &p_name, Variant &r_ret) const {
GDMonoProperty *property = top->get_property(p_name);
if (property) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *value = property->get_value(mono_object, &exc);
if (exc) {
r_ret = Variant();
@@ -1742,7 +1743,7 @@ void CSharpInstance::get_event_signals_state_for_reloading(List<Pair<StringName,
Array serialized_data;
MonoObject *managed_serialized_data = GDMonoMarshal::variant_to_mono_object(serialized_data);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
bool success = (bool)CACHED_METHOD_THUNK(DelegateUtils, TrySerializeDelegate).invoke(delegate_field_value, managed_serialized_data, &exc);
if (exc) {
@@ -1909,7 +1910,7 @@ bool CSharpInstance::_reference_owner_unsafe() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
- CRASH_COND(owner == NULL);
+ CRASH_COND(owner == nullptr);
CRASH_COND(unsafe_referenced); // already referenced
#endif
@@ -1931,7 +1932,7 @@ bool CSharpInstance::_unreference_owner_unsafe() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
- CRASH_COND(owner == NULL);
+ CRASH_COND(owner == nullptr);
#endif
if (!unsafe_referenced)
@@ -1952,13 +1953,13 @@ bool CSharpInstance::_unreference_owner_unsafe() {
MonoObject *CSharpInstance::_internal_new_managed() {
// Search the constructor first, to fail with an error if it's not found before allocating anything else.
GDMonoMethod *ctor = script->script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
- ERR_FAIL_NULL_V_MSG(ctor, NULL,
+ ERR_FAIL_NULL_V_MSG(ctor, nullptr,
"Cannot create script instance because the class does not define a parameterless constructor: '" + script->get_path() + "'.");
CSharpLanguage::get_singleton()->release_script_gchandle(gchandle);
- ERR_FAIL_NULL_V(owner, NULL);
- ERR_FAIL_COND_V(script.is_null(), NULL);
+ ERR_FAIL_NULL_V(owner, nullptr);
+ ERR_FAIL_COND_V(script.is_null(), nullptr);
MonoObject *mono_object = mono_object_new(mono_domain_get(), script->script_class->get_mono_ptr());
@@ -1970,9 +1971,9 @@ MonoObject *CSharpInstance::_internal_new_managed() {
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
CRASH_COND(die == true);
- owner = NULL;
+ owner = nullptr;
- ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object.");
+ ERR_FAIL_V_MSG(nullptr, "Failed to allocate memory for the object.");
}
// Tie managed to unmanaged
@@ -1984,7 +1985,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, owner);
// Construct
- ctor->invoke_raw(mono_object, NULL);
+ ctor->invoke_raw(mono_object, nullptr);
return mono_object;
}
@@ -2065,7 +2066,7 @@ void CSharpInstance::refcount_incremented() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
- CRASH_COND(owner == NULL);
+ CRASH_COND(owner == nullptr);
#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
@@ -2088,7 +2089,7 @@ bool CSharpInstance::refcount_decremented() {
#ifdef DEBUG_ENABLED
CRASH_COND(!base_ref);
- CRASH_COND(owner == NULL);
+ CRASH_COND(owner == nullptr);
#endif
Reference *ref_owner = Object::cast_to<Reference>(owner);
@@ -2180,7 +2181,7 @@ void CSharpInstance::notification(int p_notification) {
MonoObject *mono_object = get_mono_object();
ERR_FAIL_NULL(mono_object);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::dispose(mono_object, &exc);
if (exc) {
@@ -2225,13 +2226,13 @@ String CSharpInstance::to_string(bool *r_valid) {
MonoObject *mono_object = get_mono_object();
- if (mono_object == NULL) {
+ if (mono_object == nullptr) {
if (r_valid)
*r_valid = false;
return String();
}
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoString *result = GDMonoUtils::object_to_string(mono_object, &exc);
if (exc) {
@@ -2241,7 +2242,7 @@ String CSharpInstance::to_string(bool *r_valid) {
return String();
}
- if (result == NULL) {
+ if (result == nullptr) {
if (r_valid)
*r_valid = false;
return String();
@@ -2275,13 +2276,13 @@ CSharpInstance::~CSharpInstance() {
// This destructor is not called from the owners destructor.
// This could be being called from the owner's set_script_instance method,
// meaning this script is being replaced with another one. If this is the case,
- // we must call Dispose here, because Dispose calls owner->set_script_instance(NULL)
+ // we must call Dispose here, because Dispose calls owner->set_script_instance(nullptr)
// and that would mess up with the new script instance if called later.
MonoObject *mono_object = gchandle.get_target();
if (mono_object) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::dispose(mono_object, &exc);
if (exc) {
@@ -2311,7 +2312,7 @@ CSharpInstance::~CSharpInstance() {
CRASH_COND(die == true); // `owner_keep_alive` holds a reference, so it can't die
void *data = owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
- CRASH_COND(data == NULL);
+ CRASH_COND(data == nullptr);
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
@@ -2454,11 +2455,11 @@ bool CSharpScript::_update_exports() {
GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
- ERR_FAIL_NULL_V_MSG(ctor, NULL,
+ ERR_FAIL_NULL_V_MSG(ctor, false,
"Cannot construct temporary MonoObject because the class does not define a parameterless constructor: '" + get_path() + "'.");
- MonoException *ctor_exc = NULL;
- ctor->invoke(tmp_object, NULL, &ctor_exc);
+ MonoException *ctor_exc = nullptr;
+ ctor->invoke(tmp_object, nullptr, &ctor_exc);
Object *tmp_native = GDMonoMarshal::unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(tmp_object));
@@ -2466,7 +2467,7 @@ bool CSharpScript::_update_exports() {
// TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
- tmp_object = NULL;
+ tmp_object = nullptr;
ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
GDMonoUtils::debug_print_unhandled_exception(ctor_exc);
@@ -2513,7 +2514,7 @@ bool CSharpScript::_update_exports() {
exported_members_cache.push_front(prop_info);
if (tmp_object) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret = property->get_value(tmp_object, &exc);
if (exc) {
exported_members_defval_cache[member_name] = Variant();
@@ -2532,11 +2533,11 @@ bool CSharpScript::_update_exports() {
}
// Need to check this here, before disposal
- bool base_ref = Object::cast_to<Reference>(tmp_native) != NULL;
+ bool base_ref = Object::cast_to<Reference>(tmp_native) != nullptr;
// Dispose the temporary managed instance
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::dispose(tmp_object, &exc);
if (exc) {
@@ -2545,7 +2546,7 @@ bool CSharpScript::_update_exports() {
}
GDMonoUtils::free_gchandle(tmp_pinned_gchandle);
- tmp_object = NULL;
+ tmp_object = nullptr;
if (tmp_native && !base_ref) {
Node *node = Object::cast_to<Node>(tmp_native);
@@ -2608,9 +2609,9 @@ void CSharpScript::load_script_signals(GDMonoClass *p_class, GDMonoClass *p_nati
List<StringName> found_event_signals;
- void *iter = NULL;
- MonoEvent *raw_event = NULL;
- while ((raw_event = mono_class_get_events(top->get_mono_ptr(), &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoEvent *raw_event = nullptr;
+ while ((raw_event = mono_class_get_events(top->get_mono_ptr(), &iter)) != nullptr) {
MonoCustomAttrInfo *event_attrs = mono_custom_attrs_from_event(top->get_mono_ptr(), raw_event);
if (event_attrs) {
if (mono_custom_attrs_has_attr(event_attrs, CACHED_CLASS(SignalAttribute)->get_mono_ptr())) {
@@ -2810,7 +2811,7 @@ int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, Manage
// Instead of using mono_field_get_value_object, we can do this without boxing. Check the
// internal mono functions: ves_icall_System_Enum_GetEnumValuesAndNames and the get_enum_field.
- MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, NULL);
+ MonoObject *val_obj = mono_field_get_value_object(mono_domain_get(), field, nullptr);
ERR_FAIL_NULL_V_MSG(val_obj, -1, "Failed to get '" + enum_field_name + "' constant enum value.");
@@ -2834,7 +2835,7 @@ int CSharpScript::_try_get_member_export_hint(IMonoClassMember *p_member, Manage
}
} else if (p_variant_type == Variant::OBJECT && CACHED_CLASS(GodotResource)->is_assignable_from(p_type.type_class)) {
GDMonoClass *field_native_class = GDMonoUtils::get_class_native_base(p_type.type_class);
- CRASH_COND(field_native_class == NULL);
+ CRASH_COND(field_native_class == nullptr);
r_hint = PROPERTY_HINT_RESOURCE_TYPE;
r_hint_string = String(NATIVE_GDMONOCLASS_NAME(field_native_class));
@@ -2876,14 +2877,14 @@ void CSharpScript::_clear() {
tool = false;
valid = false;
- base = NULL;
- native = NULL;
- script_class = NULL;
+ base = nullptr;
+ native = nullptr;
+ script_class = nullptr;
}
Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
- if (unlikely(GDMono::get_singleton() == NULL)) {
+ if (unlikely(GDMono::get_singleton() == nullptr)) {
// Probably not the best error but eh.
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
return Variant();
@@ -2897,7 +2898,7 @@ Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, i
GDMonoMethod *method = top->get_method(p_method, p_argcount);
if (method && method->is_static()) {
- MonoObject *result = method->invoke(NULL, p_args);
+ MonoObject *result = method->invoke(nullptr, p_args);
if (result) {
return GDMonoMarshal::mono_object_to_variant(result);
@@ -2959,7 +2960,7 @@ Ref<CSharpScript> CSharpScript::create_for_managed_type(GDMonoClass *p_class, GD
// This method should not fail, only assertions allowed
- CRASH_COND(p_class == NULL);
+ CRASH_COND(p_class == nullptr);
// TODO OPTIMIZE: Cache the 'CSharpScript' associated with this 'p_class' instead of allocating a new one every time
Ref<CSharpScript> script = memnew(CSharpScript);
@@ -2973,13 +2974,13 @@ void CSharpScript::initialize_for_managed_type(Ref<CSharpScript> p_script, GDMon
// This method should not fail, only assertions allowed
- CRASH_COND(p_class == NULL);
+ CRASH_COND(p_class == nullptr);
p_script->name = p_class->get_name();
p_script->script_class = p_class;
p_script->native = p_native;
- CRASH_COND(p_script->native == NULL);
+ CRASH_COND(p_script->native == nullptr);
GDMonoClass *base = p_script->script_class->get_parent_class();
@@ -3045,12 +3046,12 @@ bool CSharpScript::can_instance() const {
// For tool scripts, this will never fire if the class is not found. That's because we
// don't know if it's a tool script if we can't find the class to access the attributes.
if (extra_cond && !script_class) {
- if (GDMono::get_singleton()->get_project_assembly() == NULL) {
+ if (GDMono::get_singleton()->get_project_assembly() == nullptr) {
// The project assembly is not loaded
- ERR_FAIL_V_MSG(NULL, "Cannot instance script because the project assembly is not loaded. Script: '" + get_path() + "'.");
+ ERR_FAIL_V_MSG(false, "Cannot instance script because the project assembly is not loaded. Script: '" + get_path() + "'.");
} else {
// The project assembly is loaded, but the class could not found
- ERR_FAIL_V_MSG(NULL, "Cannot instance script because the class '" + name + "' could not be found. Script: '" + get_path() + "'.");
+ ERR_FAIL_V_MSG(false, "Cannot instance script because the class '" + name + "' could not be found. Script: '" + get_path() + "'.");
}
}
@@ -3073,13 +3074,13 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
// Search the constructor first, to fail with an error if it's not found before allocating anything else.
GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), p_argcount);
- if (ctor == NULL) {
- ERR_FAIL_COND_V_MSG(p_argcount == 0, NULL,
+ if (ctor == nullptr) {
+ ERR_FAIL_COND_V_MSG(p_argcount == 0, nullptr,
"Cannot create script instance. The class '" + script_class->get_full_name() +
"' does not define a parameterless constructor." +
(get_path().empty() ? String() : " Path: '" + get_path() + "'."));
- ERR_FAIL_V_MSG(NULL, "Constructor not found.");
+ ERR_FAIL_V_MSG(nullptr, "Constructor not found.");
}
Ref<Reference> ref;
@@ -3091,13 +3092,13 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
// If the object had a script instance binding, dispose it before adding the CSharpInstance
if (p_owner->has_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index())) {
void *data = p_owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
- CRASH_COND(data == NULL);
+ CRASH_COND(data == nullptr);
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
if (script_binding.inited && !script_binding.gchandle.is_released()) {
MonoObject *mono_object = script_binding.gchandle.get_target();
if (mono_object) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::dispose(mono_object, &exc);
if (exc) {
@@ -3122,15 +3123,15 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
if (!mono_object) {
// Important to clear this before destroying the script instance here
instance->script = Ref<CSharpScript>();
- instance->owner = NULL;
+ instance->owner = nullptr;
bool die = instance->_unreference_owner_unsafe();
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
CRASH_COND(die == true);
- p_owner->set_script_instance(NULL);
+ p_owner->set_script_instance(nullptr);
r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL;
- ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object.");
+ ERR_FAIL_V_MSG(nullptr, "Failed to allocate memory for the object.");
}
// Tie managed to unmanaged
@@ -3176,7 +3177,7 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::Cal
ref = REF(r);
}
- CSharpInstance *instance = _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
+ CSharpInstance *instance = _create_instance(p_args, p_argcount, owner, r != nullptr, r_error);
if (!instance) {
if (ref.is_null()) {
memdelete(owner); //no owner, sorry
@@ -3205,15 +3206,15 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
"Script inherits from native type '" + String(native_name) +
"', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
}
- ERR_FAIL_V_MSG(NULL, "Script inherits from native type '" + String(native_name) +
- "', so it can't be instanced in object of type: '" + p_this->get_class() + "'.");
+ ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(native_name) +
+ "', so it can't be instanced in object of type: '" + p_this->get_class() + "'.");
}
}
GD_MONO_SCOPE_THREAD_ATTACH;
Callable::CallError unchecked_error;
- return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error);
+ return _create_instance(nullptr, 0, p_this, Object::cast_to<Reference>(p_this) != nullptr, unchecked_error);
}
PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_this) {
@@ -3224,7 +3225,7 @@ PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_t
_update_exports();
return si;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -3332,7 +3333,7 @@ Error CSharpScript::reload(bool p_keep_state) {
script_class = project_assembly->get_object_derived_class(name);
}
- valid = script_class != NULL;
+ valid = script_class != nullptr;
if (script_class) {
#ifdef DEBUG_ENABLED
@@ -3354,7 +3355,7 @@ Error CSharpScript::reload(bool p_keep_state) {
native = GDMonoUtils::get_class_native_base(script_class);
- CRASH_COND(native == NULL);
+ CRASH_COND(native == nullptr);
GDMonoClass *base_class = script_class->get_parent_class();
@@ -3766,7 +3767,7 @@ void ResourceFormatSaverCSharpScript::get_recognized_extensions(const RES &p_res
bool ResourceFormatSaverCSharpScript::recognize(const RES &p_resource) const {
- return Object::cast_to<CSharpScript>(p_resource.ptr()) != NULL;
+ return Object::cast_to<CSharpScript>(p_resource.ptr()) != nullptr;
}
CSharpLanguage::StringNameCache::StringNameCache() {
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 53b4aa6c20..29c33b50bb 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -77,8 +77,8 @@ public:
};
struct EventSignal {
- GDMonoField *field = NULL;
- GDMonoMethod *invoke_method = NULL;
+ GDMonoField *field = nullptr;
+ GDMonoMethod *invoke_method = nullptr;
Vector<SignalParameter> parameters;
};
@@ -331,8 +331,8 @@ struct CSharpScriptBinding {
CSharpScriptBinding() :
inited(false),
- wrapper_class(NULL),
- owner(NULL) {
+ wrapper_class(nullptr),
+ owner(nullptr) {
}
};
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
new file mode 100755
index 0000000000..f1765f7e19
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
@@ -0,0 +1,618 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using GodotTools.Internals;
+using Directory = GodotTools.Utils.Directory;
+using File = GodotTools.Utils.File;
+using OS = GodotTools.Utils.OS;
+using Path = System.IO.Path;
+
+namespace GodotTools.Export
+{
+ public struct AotOptions
+ {
+ public bool EnableLLVM;
+ public bool LLVMOnly;
+ public string LLVMPath;
+ public string LLVMOutputPath;
+
+ public bool FullAot;
+
+ private bool _useInterpreter;
+ public bool UseInterpreter { get => _useInterpreter && !LLVMOnly; set => _useInterpreter = value; }
+
+ public string[] ExtraAotOptions;
+ public string[] ExtraOptimizerOptions;
+
+ public string ToolchainPath;
+ }
+
+ public static class AotBuilder
+ {
+ public static void CompileAssemblies(ExportPlugin exporter, AotOptions aotOpts, string[] features, string platform, bool isDebug, string bclDir, string outputDir, string outputDataDir, IDictionary<string, string> assemblies)
+ {
+ // TODO: WASM
+
+ string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{Process.GetCurrentProcess().Id}");
+
+ if (!Directory.Exists(aotTempDir))
+ Directory.CreateDirectory(aotTempDir);
+
+ var assembliesPrepared = new Dictionary<string, string>();
+
+ foreach (var dependency in assemblies)
+ {
+ string assemblyName = dependency.Key;
+ string assemblyPath = dependency.Value;
+
+ string assemblyPathInBcl = Path.Combine(bclDir, assemblyName + ".dll");
+
+ if (File.Exists(assemblyPathInBcl))
+ {
+ // Don't create teporaries for assemblies from the BCL
+ assembliesPrepared.Add(assemblyName, assemblyPathInBcl);
+ }
+ else
+ {
+ string tempAssemblyPath = Path.Combine(aotTempDir, assemblyName + ".dll");
+ File.Copy(assemblyPath, tempAssemblyPath);
+ assembliesPrepared.Add(assemblyName, tempAssemblyPath);
+ }
+ }
+
+ if (platform == OS.Platforms.iOS)
+ {
+ var architectures = GetEnablediOSArchs(features).ToArray();
+ CompileAssembliesForiOS(exporter, isDebug, architectures, aotOpts, aotTempDir, assembliesPrepared, bclDir);
+ }
+ else if (platform == OS.Platforms.Android)
+ {
+ var abis = GetEnabledAndroidAbis(features).ToArray();
+ CompileAssembliesForAndroid(exporter, isDebug, abis, aotOpts, aotTempDir, assembliesPrepared, bclDir);
+ }
+ else
+ {
+ string bits = features.Contains("64") ? "64" : features.Contains("32") ? "32" : null;
+ CompileAssembliesForDesktop(exporter, platform, isDebug, bits, aotOpts, aotTempDir, outputDataDir, assembliesPrepared, bclDir);
+ }
+ }
+
+ public static void CompileAssembliesForAndroid(ExportPlugin exporter, bool isDebug, string[] abis, AotOptions aotOpts, string aotTempDir, IDictionary<string, string> assemblies, string bclDir)
+ {
+
+ foreach (var assembly in assemblies)
+ {
+ string assemblyName = assembly.Key;
+ string assemblyPath = assembly.Value;
+
+ // Not sure if the 'lib' prefix is an Android thing or just Godot being picky,
+ // but we use '-aot-' as well just in case to avoid conflicts with other libs.
+ string outputFileName = "lib-aot-" + assemblyName + ".dll.so";
+
+ foreach (string abi in abis)
+ {
+ string aotAbiTempDir = Path.Combine(aotTempDir, abi);
+ string soFilePath = Path.Combine(aotAbiTempDir, outputFileName);
+
+ var compilerArgs = GetAotCompilerArgs(OS.Platforms.Android, isDebug, abi, aotOpts, assemblyPath, soFilePath);
+
+ // Make sure the output directory exists
+ Directory.CreateDirectory(aotAbiTempDir);
+
+ string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", $"{OS.Platforms.Android}-{abi}");
+
+ ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir);
+
+ // The Godot exporter expects us to pass the abi in the tags parameter
+ exporter.AddSharedObject(soFilePath, tags: new[] { abi });
+ }
+ }
+ }
+
+ public static void CompileAssembliesForDesktop(ExportPlugin exporter, string platform, bool isDebug, string bits, AotOptions aotOpts, string aotTempDir, string outputDataDir, IDictionary<string, string> assemblies, string bclDir)
+ {
+ foreach (var assembly in assemblies)
+ {
+ string assemblyName = assembly.Key;
+ string assemblyPath = assembly.Value;
+
+ string outputFileExtension = platform == OS.Platforms.Windows ? ".dll" :
+ platform == OS.Platforms.OSX ? ".dylib" :
+ ".so";
+
+ string outputFileName = assemblyName + ".dll" + outputFileExtension;
+ string tempOutputFilePath = Path.Combine(aotTempDir, outputFileName);
+
+ var compilerArgs = GetAotCompilerArgs(platform, isDebug, bits, aotOpts, assemblyPath, tempOutputFilePath);
+
+ string compilerDirPath = GetMonoCrossDesktopDirName(platform, bits);
+
+ ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir);
+
+ if (platform == OS.Platforms.OSX)
+ {
+ exporter.AddSharedObject(tempOutputFilePath, tags: null);
+ }
+ else
+ {
+ string outputDataLibDir = Path.Combine(outputDataDir, "Mono", platform == OS.Platforms.Windows ? "bin" : "lib");
+ File.Copy(tempOutputFilePath, Path.Combine(outputDataLibDir, outputFileName));
+ }
+ }
+ }
+
+ public static void CompileAssembliesForiOS(ExportPlugin exporter, bool isDebug, string[] architectures, AotOptions aotOpts, string aotTempDir, IDictionary<string, string> assemblies, string bclDir)
+ {
+ var cppCode = new StringBuilder();
+ var aotModuleInfoSymbols = new List<string>(assemblies.Count);
+
+ // {arch: paths}
+ var objFilePathsForiOSArch = architectures.ToDictionary(arch => arch, arch => new List<string>(assemblies.Count));
+
+ foreach (var assembly in assemblies)
+ {
+ string assemblyName = assembly.Key;
+ string assemblyPath = assembly.Value;
+
+ string asmFileName = assemblyName + ".dll.S";
+ string objFileName = assemblyName + ".dll.o";
+
+ foreach (string arch in architectures)
+ {
+ string aotArchTempDir = Path.Combine(aotTempDir, arch);
+ string asmFilePath = Path.Combine(aotArchTempDir, asmFileName);
+
+ var compilerArgs = GetAotCompilerArgs(OS.Platforms.iOS, isDebug, arch, aotOpts, assemblyPath, asmFilePath);
+
+ // Make sure the output directory exists
+ Directory.CreateDirectory(aotArchTempDir);
+
+ string compilerDirPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", $"{OS.Platforms.iOS}-{arch}");
+
+ ExecuteCompiler(FindCrossCompiler(compilerDirPath), compilerArgs, bclDir);
+
+ // Assembling
+ bool isSim = arch == "i386" || arch == "x86_64"; // Shouldn't really happen as we don't do AOT for the simulator
+ string versionMinName = isSim ? "iphonesimulator" : "iphoneos";
+ string iOSPlatformName = isSim ? "iPhoneSimulator" : "iPhoneOS";
+ const string versionMin = "10.0"; // TODO: Turn this hard-coded version into an exporter setting
+ string iOSSdkPath = Path.Combine(XcodeHelper.XcodePath,
+ $"Contents/Developer/Platforms/{iOSPlatformName}.platform/Developer/SDKs/{iOSPlatformName}.sdk");
+
+ string objFilePath = Path.Combine(aotArchTempDir, objFileName);
+
+ var clangArgs = new List<string>()
+ {
+ "-isysroot", iOSSdkPath,
+ "-Qunused-arguments",
+ $"-m{versionMinName}-version-min={versionMin}",
+ "-arch", arch,
+ "-c",
+ "-o", objFilePath,
+ "-x", "assembler"
+ };
+
+ if (isDebug)
+ clangArgs.Add("-DDEBUG");
+
+ clangArgs.Add(asmFilePath);
+
+ int clangExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("clang"), clangArgs);
+ if (clangExitCode != 0)
+ throw new Exception($"Command 'clang' exited with code: {clangExitCode}");
+
+ objFilePathsForiOSArch[arch].Add(objFilePath);
+ }
+
+ aotModuleInfoSymbols.Add($"mono_aot_module_{AssemblyNameToAotSymbol(assemblyName)}_info");
+ }
+
+ // Generate driver code
+ cppCode.AppendLine("#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)");
+ cppCode.AppendLine("#define IOS_DEVICE");
+ cppCode.AppendLine("#endif");
+
+ cppCode.AppendLine("#ifdef IOS_DEVICE");
+ cppCode.AppendLine("extern \"C\" {");
+ cppCode.AppendLine("// Mono API");
+ cppCode.AppendLine(@"
+typedef enum {
+MONO_AOT_MODE_NONE,
+MONO_AOT_MODE_NORMAL,
+MONO_AOT_MODE_HYBRID,
+MONO_AOT_MODE_FULL,
+MONO_AOT_MODE_LLVMONLY,
+MONO_AOT_MODE_INTERP,
+MONO_AOT_MODE_INTERP_LLVMONLY,
+MONO_AOT_MODE_LLVMONLY_INTERP,
+MONO_AOT_MODE_LAST = 1000,
+} MonoAotMode;");
+ cppCode.AppendLine("void mono_jit_set_aot_mode(MonoAotMode);");
+ cppCode.AppendLine("void mono_aot_register_module(void *);");
+
+ if (aotOpts.UseInterpreter)
+ {
+ cppCode.AppendLine("void mono_ee_interp_init(const char *);");
+ cppCode.AppendLine("void mono_icall_table_init();");
+ cppCode.AppendLine("void mono_marshal_ilgen_init();");
+ cppCode.AppendLine("void mono_method_builder_ilgen_init();");
+ cppCode.AppendLine("void mono_sgen_mono_ilgen_init();");
+ }
+
+ foreach (string symbol in aotModuleInfoSymbols)
+ cppCode.AppendLine($"extern void *{symbol};");
+
+ cppCode.AppendLine("void gd_mono_setup_aot() {");
+
+ foreach (string symbol in aotModuleInfoSymbols)
+ cppCode.AppendLine($"\tmono_aot_register_module({symbol});");
+
+ if (aotOpts.UseInterpreter)
+ {
+ cppCode.AppendLine("\tmono_icall_table_init();");
+ cppCode.AppendLine("\tmono_marshal_ilgen_init();");
+ cppCode.AppendLine("\tmono_method_builder_ilgen_init();");
+ cppCode.AppendLine("\tmono_sgen_mono_ilgen_init();");
+ cppCode.AppendLine("\tmono_ee_interp_init(0);");
+ }
+
+ string aotModeStr = null;
+
+ if (aotOpts.LLVMOnly)
+ {
+ aotModeStr = "MONO_AOT_MODE_LLVMONLY"; // --aot=llvmonly
+ }
+ else
+ {
+ if (aotOpts.UseInterpreter)
+ aotModeStr = "MONO_AOT_MODE_INTERP"; // --aot=interp or --aot=interp,full
+ else if (aotOpts.FullAot)
+ aotModeStr = "MONO_AOT_MODE_FULL"; // --aot=full
+ }
+
+ // One of the options above is always set for iOS
+ Debug.Assert(aotModeStr != null);
+
+ cppCode.AppendLine($"\tmono_jit_set_aot_mode({aotModeStr});");
+
+ cppCode.AppendLine("} // gd_mono_setup_aot");
+ cppCode.AppendLine("} // extern \"C\"");
+ cppCode.AppendLine("#endif // IOS_DEVICE");
+
+ // Add the driver code to the Xcode project
+ exporter.AddIosCppCode(cppCode.ToString());
+
+ // Archive the AOT object files into a static library
+
+ var arFilePathsForAllArchs = new List<string>();
+ string projectAssemblyName = GodotSharpEditor.ProjectAssemblyName;
+
+ foreach (var archPathsPair in objFilePathsForiOSArch)
+ {
+ string arch = archPathsPair.Key;
+ var objFilePaths = archPathsPair.Value;
+
+ string arOutputFilePath = Path.Combine(aotTempDir, $"lib-aot-{projectAssemblyName}.{arch}.a");
+
+ var arArgs = new List<string>()
+ {
+ "cr",
+ arOutputFilePath
+ };
+
+ foreach (string objFilePath in objFilePaths)
+ arArgs.Add(objFilePath);
+
+ int arExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("ar"), arArgs);
+ if (arExitCode != 0)
+ throw new Exception($"Command 'ar' exited with code: {arExitCode}");
+
+ arFilePathsForAllArchs.Add(arOutputFilePath);
+ }
+
+ // It's lipo time
+
+ string fatOutputFileName = $"lib-aot-{projectAssemblyName}.fat.a";
+ string fatOutputFilePath = Path.Combine(aotTempDir, fatOutputFileName);
+
+ var lipoArgs = new List<string>();
+ lipoArgs.Add("-create");
+ lipoArgs.AddRange(arFilePathsForAllArchs);
+ lipoArgs.Add("-output");
+ lipoArgs.Add(fatOutputFilePath);
+
+ int lipoExitCode = OS.ExecuteCommand(XcodeHelper.FindXcodeTool("lipo"), lipoArgs);
+ if (lipoExitCode != 0)
+ throw new Exception($"Command 'lipo' exited with code: {lipoExitCode}");
+
+ // TODO: Add the AOT lib and interpreter libs as device only to supress warnings when targeting the simulator
+
+ // Add the fat AOT static library to the Xcode project
+ exporter.AddIosProjectStaticLib(fatOutputFilePath);
+
+ // Add the required Mono libraries to the Xcode project
+
+ string MonoLibFile(string libFileName) => libFileName + ".iphone.fat.a";
+
+ string MonoLibFromTemplate(string libFileName) =>
+ Path.Combine(Internal.FullTemplatesDir, "iphone-mono-libs", MonoLibFile(libFileName));
+
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmonosgen-2.0"));
+
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-native"));
+
+ if (aotOpts.UseInterpreter)
+ {
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-ee-interp"));
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-icall-table"));
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-ilgen"));
+ }
+
+ // TODO: Turn into an exporter option
+ bool enableProfiling = false;
+ if (enableProfiling)
+ exporter.AddIosProjectStaticLib(MonoLibFromTemplate("libmono-profiler-log"));
+
+ // Add frameworks required by Mono to the Xcode project
+ exporter.AddIosFramework("libiconv.tbd");
+ exporter.AddIosFramework("GSS.framework");
+ exporter.AddIosFramework("CFNetwork.framework");
+
+ // Force load and export dynamic are needed for the linker to not strip required symbols.
+ // In theory we shouldn't be relying on this for P/Invoked functions (as is the case with
+ // functions in System.Native/libmono-native). Instead, we should use cecil to search for
+ // DllImports in assemblies and pass them to 'ld' as '-u/--undefined {pinvoke_symbol}'.
+ exporter.AddIosLinkerFlags("-rdynamic");
+ exporter.AddIosLinkerFlags($"-force_load \"$(SRCROOT)/{MonoLibFile("libmono-native")}\"");
+ }
+
+ /// Converts an assembly name to a valid symbol name in the same way the AOT compiler does
+ private static string AssemblyNameToAotSymbol(string assemblyName)
+ {
+ var builder = new StringBuilder();
+
+ foreach (var charByte in Encoding.UTF8.GetBytes(assemblyName))
+ {
+ char @char = (char)charByte;
+ builder.Append(Char.IsLetterOrDigit(@char) || @char == '_' ? @char : '_');
+ }
+
+ return builder.ToString();
+ }
+
+ private static IEnumerable<string> GetAotCompilerArgs(string platform, bool isDebug, string target, AotOptions aotOpts, string assemblyPath, string outputFilePath)
+ {
+ // TODO: LLVM
+
+ bool aotSoftDebug = isDebug && !aotOpts.EnableLLVM;
+ bool aotDwarfDebug = platform == OS.Platforms.iOS;
+
+ var aotOptions = new List<string>();
+ var optimizerOptions = new List<string>();
+
+ if (aotOpts.LLVMOnly)
+ {
+ aotOptions.Add("llvmonly");
+ }
+ else
+ {
+ // Can be both 'interp' and 'full'
+ if (aotOpts.UseInterpreter)
+ aotOptions.Add("interp");
+ if (aotOpts.FullAot)
+ aotOptions.Add("full");
+ }
+
+ aotOptions.Add(aotSoftDebug ? "soft-debug" : "nodebug");
+
+ if (aotDwarfDebug)
+ aotOptions.Add("dwarfdebug");
+
+ if (platform == OS.Platforms.Android)
+ {
+ string abi = target;
+
+ string androidToolchain = aotOpts.ToolchainPath;
+
+ if (string.IsNullOrEmpty(androidToolchain))
+ {
+ androidToolchain = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "android-toolchains", $"{abi}"); // TODO: $"{abi}-{apiLevel}{(clang?"clang":"")}"
+
+ if (!Directory.Exists(androidToolchain))
+ throw new FileNotFoundException("Missing android toolchain. Specify one in the AOT export settings.");
+ }
+ else if (!Directory.Exists(androidToolchain))
+ {
+ throw new FileNotFoundException("Android toolchain not found: " + androidToolchain);
+ }
+
+ var androidToolPrefixes = new Dictionary<string, string>
+ {
+ ["armeabi-v7a"] = "arm-linux-androideabi-",
+ ["arm64-v8a"] = "aarch64-linux-android-",
+ ["x86"] = "i686-linux-android-",
+ ["x86_64"] = "x86_64-linux-android-"
+ };
+
+ aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi]));
+
+ string triple = GetAndroidTriple(abi);
+ aotOptions.Add($"mtriple={triple}");
+ }
+ else if (platform == OS.Platforms.iOS)
+ {
+ if (!aotOpts.LLVMOnly && !aotOpts.UseInterpreter)
+ optimizerOptions.Add("gsharedvt");
+
+ aotOptions.Add("static");
+
+ // I couldn't get the Mono cross-compiler to do assembling, so we'll have to do it ourselves
+ aotOptions.Add("asmonly");
+
+ aotOptions.Add("direct-icalls");
+
+ if (aotSoftDebug)
+ aotOptions.Add("no-direct-calls");
+
+ if (aotOpts.LLVMOnly || !aotOpts.UseInterpreter)
+ aotOptions.Add("direct-pinvoke");
+
+ string arch = target;
+ aotOptions.Add($"mtriple={arch}-ios");
+ }
+
+ aotOptions.Add($"outfile={outputFilePath}");
+
+ if (aotOpts.EnableLLVM)
+ {
+ aotOptions.Add($"llvm-path={aotOpts.LLVMPath}");
+ aotOptions.Add($"llvm-outfile={aotOpts.LLVMOutputPath}");
+ }
+
+ if (aotOpts.ExtraAotOptions.Length > 0)
+ aotOptions.AddRange(aotOpts.ExtraAotOptions);
+
+ if (aotOpts.ExtraOptimizerOptions.Length > 0)
+ optimizerOptions.AddRange(aotOpts.ExtraOptimizerOptions);
+
+ string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option;
+ string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption));
+
+ var runtimeArgs = new List<string>();
+
+ // The '--debug' runtime option is required when using the 'soft-debug' and 'dwarfdebug' AOT options
+ if (aotSoftDebug || aotDwarfDebug)
+ runtimeArgs.Add("--debug");
+
+ if (aotOpts.EnableLLVM)
+ runtimeArgs.Add("--llvm");
+
+ runtimeArgs.Add(aotOptions.Count > 0 ? $"--aot={OptionsToString(aotOptions)}" : "--aot");
+
+ if (optimizerOptions.Count > 0)
+ runtimeArgs.Add($"-O={OptionsToString(optimizerOptions)}");
+
+ runtimeArgs.Add(assemblyPath);
+
+ return runtimeArgs;
+ }
+
+ private static void ExecuteCompiler(string compiler, IEnumerable<string> compilerArgs, string bclDir)
+ {
+ // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead
+ string CmdLineArgsToString(IEnumerable<string> args)
+ {
+ // Not perfect, but as long as we are careful...
+ return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg));
+ }
+
+ using (var process = new Process())
+ {
+ process.StartInfo = new ProcessStartInfo(compiler, CmdLineArgsToString(compilerArgs))
+ {
+ UseShellExecute = false
+ };
+
+ process.StartInfo.EnvironmentVariables.Remove("MONO_ENV_OPTIONS");
+ process.StartInfo.EnvironmentVariables.Remove("MONO_THREADS_SUSPEND");
+ process.StartInfo.EnvironmentVariables.Add("MONO_PATH", bclDir);
+
+ Console.WriteLine($"Running: \"{process.StartInfo.FileName}\" {process.StartInfo.Arguments}");
+
+ if (!process.Start())
+ throw new Exception("Failed to start process for Mono AOT compiler");
+
+ process.WaitForExit();
+
+ if (process.ExitCode != 0)
+ throw new Exception($"Mono AOT compiler exited with code: {process.ExitCode}");
+ }
+ }
+
+ private static IEnumerable<string> GetEnablediOSArchs(string[] features)
+ {
+ var iosArchs = new[]
+ {
+ "armv7",
+ "arm64"
+ };
+
+ return iosArchs.Where(features.Contains);
+ }
+
+ private static IEnumerable<string> GetEnabledAndroidAbis(string[] features)
+ {
+ var androidAbis = new[]
+ {
+ "armeabi-v7a",
+ "arm64-v8a",
+ "x86",
+ "x86_64"
+ };
+
+ return androidAbis.Where(features.Contains);
+ }
+
+ private static string GetAndroidTriple(string abi)
+ {
+ var abiArchs = new Dictionary<string, string>
+ {
+ ["armeabi-v7a"] = "armv7",
+ ["arm64-v8a"] = "aarch64-v8a",
+ ["x86"] = "i686",
+ ["x86_64"] = "x86_64"
+ };
+
+ string arch = abiArchs[abi];
+
+ return $"{arch}-linux-android";
+ }
+
+ private static string GetMonoCrossDesktopDirName(string platform, string bits)
+ {
+ switch (platform)
+ {
+ case OS.Platforms.Windows:
+ case OS.Platforms.UWP:
+ {
+ string arch = bits == "64" ? "x86_64" : "i686";
+ return $"windows-{arch}";
+ }
+ case OS.Platforms.OSX:
+ {
+ Debug.Assert(bits == null || bits == "64");
+ string arch = "x86_64";
+ return $"{platform}-{arch}";
+ }
+ case OS.Platforms.X11:
+ case OS.Platforms.Server:
+ {
+ string arch = bits == "64" ? "x86_64" : "i686";
+ return $"linux-{arch}";
+ }
+ case OS.Platforms.Haiku:
+ {
+ string arch = bits == "64" ? "x86_64" : "i686";
+ return $"{platform}-{arch}";
+ }
+ default:
+ throw new NotSupportedException($"Platform not supported: {platform}");
+ }
+ }
+
+ // TODO: Replace this for a specific path for each platform
+ private static string FindCrossCompiler(string monoCrossBin)
+ {
+ string exeExt = OS.IsWindows ? ".exe" : string.Empty;
+
+ var files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono-sgen{exeExt}", SearchOption.TopDirectoryOnly);
+ if (files.Length > 0)
+ return Path.Combine(monoCrossBin, files[0].Name);
+
+ throw new FileNotFoundException($"Cannot find the mono runtime executable in {monoCrossBin}");
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index 022005ad0b..d782d4e61b 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -29,15 +29,13 @@ namespace GodotTools.Export
All = CJK | MidEast | Other | Rare | West
}
- private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string platform)
+ private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string bclDir)
{
- var codesets = (I18NCodesets) ProjectSettings.GetSetting("mono/export/i18n_codesets");
+ var codesets = (I18NCodesets)ProjectSettings.GetSetting("mono/export/i18n_codesets");
if (codesets == I18NCodesets.None)
return;
- string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir();
-
void AddI18NAssembly(string name) => assemblies.Add(name, Path.Combine(bclDir, $"{name}.dll"));
AddI18NAssembly("I18N");
@@ -73,6 +71,7 @@ namespace GodotTools.Export
GlobalDef("mono/export/aot/enabled", false);
GlobalDef("mono/export/aot/full_aot", false);
+ GlobalDef("mono/export/aot/use_interpreter", true);
// --aot or --aot=opt1,opt2 (use 'mono --aot=help AuxAssembly.dll' to list AOT options)
GlobalDef("mono/export/aot/extra_aot_options", new string[] { });
@@ -86,9 +85,11 @@ namespace GodotTools.Export
private void AddFile(string srcPath, string dstPath, bool remap = false)
{
+ // Add file to the PCK
AddFile(dstPath.Replace("\\", "/"), File.ReadAllBytes(srcPath), remap);
}
+ // With this method we can override how a file is exported in the PCK
public override void _ExportFile(string path, string type, string[] features)
{
base._ExportFile(path, type, features);
@@ -110,6 +111,8 @@ namespace GodotTools.Export
// Sadly, Godot prints errors when adding an empty file (nothing goes wrong, it's just noise).
// Because of this, we add a file which contains a line break.
AddFile(path, System.Text.Encoding.UTF8.GetBytes("\n"), remap: false);
+
+ // Tell the Godot exporter that we already took care of the file
Skip();
}
}
@@ -167,12 +170,7 @@ namespace GodotTools.Export
var dependencies = new Godot.Collections.Dictionary<string, string>();
- var projectDllName = (string)ProjectSettings.GetSetting("application/config/name");
- if (projectDllName.Empty())
- {
- projectDllName = "UnnamedProject";
- }
-
+ string projectDllName = GodotSharpEditor.ProjectAssemblyName;
string projectDllSrcDir = Path.Combine(GodotSharpDirs.ResTempAssembliesBaseDir, buildConfig);
string projectDllSrcPath = Path.Combine(projectDllSrcDir, $"{projectDllName}.dll");
@@ -189,10 +187,12 @@ namespace GodotTools.Export
dependencies["Mono.Android"] = monoAndroidAssemblyPath;
}
+ string bclDir = DeterminePlatformBclDir(platform);
+
var initialDependencies = dependencies.Duplicate();
- internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, DeterminePlatformBclDir(platform), dependencies);
+ internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, bclDir, dependencies);
- AddI18NAssemblies(dependencies, platform);
+ AddI18NAssemblies(dependencies, bclDir);
string outputDataDir = null;
@@ -227,11 +227,34 @@ namespace GodotTools.Export
}
}
- // AOT
+ // AOT compilation
+ bool aotEnabled = platform == OS.Platforms.iOS || (bool)ProjectSettings.GetSetting("mono/export/aot/enabled");
- if ((bool)ProjectSettings.GetSetting("mono/export/aot/enabled"))
+ if (aotEnabled)
{
- AotCompileDependencies(features, platform, isDebug, outputDir, outputDataDir, dependencies);
+ string aotToolchainPath = null;
+
+ if (platform == OS.Platforms.Android)
+ aotToolchainPath = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
+
+ if (aotToolchainPath == string.Empty)
+ aotToolchainPath = null; // Don't risk it being used as current working dir
+
+ // TODO: LLVM settings are hard-coded and disabled for now
+ var aotOpts = new AotOptions
+ {
+ EnableLLVM = false,
+ LLVMOnly = false,
+ LLVMPath = "",
+ LLVMOutputPath = "",
+ FullAot = platform == OS.Platforms.iOS || (bool)(ProjectSettings.GetSetting("mono/export/aot/full_aot") ?? false),
+ UseInterpreter = (bool)ProjectSettings.GetSetting("mono/export/aot/use_interpreter"),
+ ExtraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options") ?? new string[] { },
+ ExtraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options") ?? new string[] { },
+ ToolchainPath = aotToolchainPath
+ };
+
+ AotBuilder.CompileAssemblies(this, aotOpts, features, platform, isDebug, bclDir, outputDir, outputDataDir, dependencies);
}
}
@@ -258,7 +281,8 @@ namespace GodotTools.Export
{
string target = isDebug ? "release_debug" : "release";
- // NOTE: Bits is ok for now as all platforms with a data directory have it, but that may change in the future.
+ // NOTE: Bits is ok for now as all platforms with a data directory only have one or two architectures.
+ // However, this may change in the future if we add arm linux or windows desktop templates.
string bits = features.Contains("64") ? "64" : "32";
string TemplateDirName() => $"data.mono.{platform}.{bits}.{target}";
@@ -284,7 +308,7 @@ namespace GodotTools.Export
if (!validTemplatePathFound)
throw new FileNotFoundException("Data template directory not found", templateDirPath);
- string outputDataDir = Path.Combine(outputDir, DataDirName);
+ string outputDataDir = Path.Combine(outputDir, DetermineDataDirNameForProject());
if (Directory.Exists(outputDataDir))
Directory.Delete(outputDataDir, recursive: true); // Clean first
@@ -304,333 +328,10 @@ namespace GodotTools.Export
return outputDataDir;
}
- private void AotCompileDependencies(string[] features, string platform, bool isDebug, string outputDir, string outputDataDir, IDictionary<string, string> dependencies)
- {
- // TODO: WASM
-
- string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir();
-
- string aotTempDir = Path.Combine(Path.GetTempPath(), $"godot-aot-{Process.GetCurrentProcess().Id}");
-
- if (!Directory.Exists(aotTempDir))
- Directory.CreateDirectory(aotTempDir);
-
- var assemblies = new Dictionary<string, string>();
-
- foreach (var dependency in dependencies)
- {
- string assemblyName = dependency.Key;
- string assemblyPath = dependency.Value;
-
- string assemblyPathInBcl = Path.Combine(bclDir, assemblyName + ".dll");
-
- if (File.Exists(assemblyPathInBcl))
- {
- // Don't create teporaries for assemblies from the BCL
- assemblies.Add(assemblyName, assemblyPathInBcl);
- }
- else
- {
- string tempAssemblyPath = Path.Combine(aotTempDir, assemblyName + ".dll");
- File.Copy(assemblyPath, tempAssemblyPath);
- assemblies.Add(assemblyName, tempAssemblyPath);
- }
- }
-
- foreach (var assembly in assemblies)
- {
- string assemblyName = assembly.Key;
- string assemblyPath = assembly.Value;
-
- string sharedLibExtension = platform == OS.Platforms.Windows ? ".dll" :
- platform == OS.Platforms.OSX ? ".dylib" :
- platform == OS.Platforms.HTML5 ? ".wasm" :
- ".so";
-
- string outputFileName = assemblyName + ".dll" + sharedLibExtension;
-
- if (platform == OS.Platforms.Android)
- {
- // Not sure if the 'lib' prefix is an Android thing or just Godot being picky,
- // but we use '-aot-' as well just in case to avoid conflicts with other libs.
- outputFileName = "lib-aot-" + outputFileName;
- }
-
- string outputFilePath = null;
- string tempOutputFilePath;
-
- switch (platform)
- {
- case OS.Platforms.OSX:
- tempOutputFilePath = Path.Combine(aotTempDir, outputFileName);
- break;
- case OS.Platforms.Android:
- tempOutputFilePath = Path.Combine(aotTempDir, "%%ANDROID_ABI%%", outputFileName);
- break;
- case OS.Platforms.HTML5:
- tempOutputFilePath = Path.Combine(aotTempDir, outputFileName);
- outputFilePath = Path.Combine(outputDir, outputFileName);
- break;
- default:
- tempOutputFilePath = Path.Combine(aotTempDir, outputFileName);
- outputFilePath = Path.Combine(outputDataDir, "Mono", platform == OS.Platforms.Windows ? "bin" : "lib", outputFileName);
- break;
- }
-
- var data = new Dictionary<string, string>();
- var enabledAndroidAbis = platform == OS.Platforms.Android ? GetEnabledAndroidAbis(features).ToArray() : null;
-
- if (platform == OS.Platforms.Android)
- {
- Debug.Assert(enabledAndroidAbis != null);
-
- foreach (var abi in enabledAndroidAbis)
- {
- data["abi"] = abi;
- var outputFilePathForThisAbi = tempOutputFilePath.Replace("%%ANDROID_ABI%%", abi);
-
- AotCompileAssembly(platform, isDebug, data, assemblyPath, outputFilePathForThisAbi);
-
- AddSharedObject(outputFilePathForThisAbi, tags: new[] { abi });
- }
- }
- else
- {
- string bits = features.Contains("64") ? "64" : features.Contains("64") ? "32" : null;
-
- if (bits != null)
- data["bits"] = bits;
-
- AotCompileAssembly(platform, isDebug, data, assemblyPath, tempOutputFilePath);
-
- if (platform == OS.Platforms.OSX)
- {
- AddSharedObject(tempOutputFilePath, tags: null);
- }
- else
- {
- Debug.Assert(outputFilePath != null);
- File.Copy(tempOutputFilePath, outputFilePath);
- }
- }
- }
- }
-
- private static void AotCompileAssembly(string platform, bool isDebug, Dictionary<string, string> data, string assemblyPath, string outputFilePath)
- {
- // Make sure the output directory exists
- Directory.CreateDirectory(outputFilePath.GetBaseDir());
-
- string exeExt = OS.IsWindows ? ".exe" : string.Empty;
-
- string monoCrossDirName = DetermineMonoCrossDirName(platform, data);
- string monoCrossRoot = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "aot-compilers", monoCrossDirName);
- string monoCrossBin = Path.Combine(monoCrossRoot, "bin");
-
- string toolPrefix = DetermineToolPrefix(monoCrossBin);
- string monoExeName = System.IO.File.Exists(Path.Combine(monoCrossBin, $"{toolPrefix}mono{exeExt}")) ? "mono" : "mono-sgen";
-
- string compilerCommand = Path.Combine(monoCrossBin, $"{toolPrefix}{monoExeName}{exeExt}");
-
- bool fullAot = (bool)ProjectSettings.GetSetting("mono/export/aot/full_aot");
-
- string EscapeOption(string option) => option.Contains(',') ? $"\"{option}\"" : option;
- string OptionsToString(IEnumerable<string> options) => string.Join(",", options.Select(EscapeOption));
-
- var aotOptions = new List<string>();
- var optimizerOptions = new List<string>();
-
- if (fullAot)
- aotOptions.Add("full");
-
- aotOptions.Add(isDebug ? "soft-debug" : "nodebug");
-
- if (platform == OS.Platforms.Android)
- {
- string abi = data["abi"];
-
- string androidToolchain = (string)ProjectSettings.GetSetting("mono/export/aot/android_toolchain_path");
-
- if (string.IsNullOrEmpty(androidToolchain))
- {
- androidToolchain = Path.Combine(GodotSharpDirs.DataEditorToolsDir, "android-toolchains", $"{abi}"); // TODO: $"{abi}-{apiLevel}{(clang?"clang":"")}"
-
- if (!Directory.Exists(androidToolchain))
- throw new FileNotFoundException("Missing android toolchain. Specify one in the AOT export settings.");
- }
- else if (!Directory.Exists(androidToolchain))
- {
- throw new FileNotFoundException("Android toolchain not found: " + androidToolchain);
- }
-
- var androidToolPrefixes = new Dictionary<string, string>
- {
- ["armeabi-v7a"] = "arm-linux-androideabi-",
- ["arm64-v8a"] = "aarch64-linux-android-",
- ["x86"] = "i686-linux-android-",
- ["x86_64"] = "x86_64-linux-android-"
- };
-
- aotOptions.Add("tool-prefix=" + Path.Combine(androidToolchain, "bin", androidToolPrefixes[abi]));
-
- string triple = GetAndroidTriple(abi);
- aotOptions.Add($"mtriple={triple}");
- }
-
- aotOptions.Add($"outfile={outputFilePath}");
-
- var extraAotOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_aot_options");
- var extraOptimizerOptions = (string[])ProjectSettings.GetSetting("mono/export/aot/extra_optimizer_options");
-
- if (extraAotOptions.Length > 0)
- aotOptions.AddRange(extraAotOptions);
-
- if (extraOptimizerOptions.Length > 0)
- optimizerOptions.AddRange(extraOptimizerOptions);
-
- var compilerArgs = new List<string>();
-
- if (isDebug)
- compilerArgs.Add("--debug"); // Required for --aot=soft-debug
-
- compilerArgs.Add(aotOptions.Count > 0 ? $"--aot={OptionsToString(aotOptions)}" : "--aot");
-
- if (optimizerOptions.Count > 0)
- compilerArgs.Add($"-O={OptionsToString(optimizerOptions)}");
-
- compilerArgs.Add(ProjectSettings.GlobalizePath(assemblyPath));
-
- // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead
- string CmdLineArgsToString(IEnumerable<string> args)
- {
- // Not perfect, but as long as we are careful...
- return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg));
- }
-
- using (var process = new Process())
- {
- process.StartInfo = new ProcessStartInfo(compilerCommand, CmdLineArgsToString(compilerArgs))
- {
- UseShellExecute = false
- };
-
- string platformBclDir = DeterminePlatformBclDir(platform);
- process.StartInfo.EnvironmentVariables.Add("MONO_PATH", string.IsNullOrEmpty(platformBclDir) ?
- typeof(object).Assembly.Location.GetBaseDir() :
- platformBclDir);
-
- Console.WriteLine($"Running: \"{process.StartInfo.FileName}\" {process.StartInfo.Arguments}");
-
- if (!process.Start())
- throw new Exception("Failed to start process for Mono AOT compiler");
-
- process.WaitForExit();
-
- if (process.ExitCode != 0)
- throw new Exception($"Mono AOT compiler exited with error code: {process.ExitCode}");
-
- if (!System.IO.File.Exists(outputFilePath))
- throw new Exception("Mono AOT compiler finished successfully but the output file is missing");
- }
- }
-
- private static string DetermineMonoCrossDirName(string platform, IReadOnlyDictionary<string, string> data)
- {
- switch (platform)
- {
- case OS.Platforms.Windows:
- case OS.Platforms.UWP:
- {
- string arch = data["bits"] == "64" ? "x86_64" : "i686";
- return $"windows-{arch}";
- }
- case OS.Platforms.OSX:
- {
- string arch = "x86_64";
- return $"{platform}-{arch}";
- }
- case OS.Platforms.X11:
- case OS.Platforms.Server:
- {
- string arch = data["bits"] == "64" ? "x86_64" : "i686";
- return $"linux-{arch}";
- }
- case OS.Platforms.Haiku:
- {
- string arch = data["bits"] == "64" ? "x86_64" : "i686";
- return $"{platform}-{arch}";
- }
- case OS.Platforms.Android:
- {
- string abi = data["abi"];
- return $"{platform}-{abi}";
- }
- case OS.Platforms.HTML5:
- return "wasm-wasm32";
- default:
- throw new NotSupportedException($"Platform not supported: {platform}");
- }
- }
-
- private static string DetermineToolPrefix(string monoCrossBin)
- {
- string exeExt = OS.IsWindows ? ".exe" : string.Empty;
-
- if (System.IO.File.Exists(Path.Combine(monoCrossBin, $"mono{exeExt}")))
- return string.Empty;
-
- if (System.IO.File.Exists(Path.Combine(monoCrossBin, $"mono-sgen{exeExt}" + exeExt)))
- return string.Empty;
-
- var files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono{exeExt}" + exeExt, SearchOption.TopDirectoryOnly);
- if (files.Length > 0)
- {
- string fileName = files[0].Name;
- return fileName.Substring(0, fileName.Length - $"mono{exeExt}".Length);
- }
-
- files = new DirectoryInfo(monoCrossBin).GetFiles($"*mono-sgen{exeExt}" + exeExt, SearchOption.TopDirectoryOnly);
- if (files.Length > 0)
- {
- string fileName = files[0].Name;
- return fileName.Substring(0, fileName.Length - $"mono-sgen{exeExt}".Length);
- }
-
- throw new FileNotFoundException($"Cannot find the mono runtime executable in {monoCrossBin}");
- }
-
- private static IEnumerable<string> GetEnabledAndroidAbis(string[] features)
- {
- var androidAbis = new[]
- {
- "armeabi-v7a",
- "arm64-v8a",
- "x86",
- "x86_64"
- };
-
- return androidAbis.Where(features.Contains);
- }
-
- private static string GetAndroidTriple(string abi)
- {
- var abiArchs = new Dictionary<string, string>
- {
- ["armeabi-v7a"] = "armv7",
- ["arm64-v8a"] = "aarch64-v8a",
- ["x86"] = "i686",
- ["x86_64"] = "x86_64"
- };
-
- string arch = abiArchs[abi];
-
- return $"{arch}-linux-android";
- }
-
private static bool PlatformHasTemplateDir(string platform)
{
// OSX export templates are contained in a zip, so we place our custom template inside it and let Godot do the rest.
- return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform);
+ return !new[] { OS.Platforms.OSX, OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform);
}
private static string DeterminePlatformFromFeatures(IEnumerable<string> features)
@@ -665,7 +366,7 @@ namespace GodotTools.Export
if (PlatformRequiresCustomBcl(platform))
throw new FileNotFoundException($"Missing BCL (Base Class Library) for platform: {platform}");
- platformBclDir = null; // Use the one we're running on
+ platformBclDir = typeof(object).Assembly.Location; // Use the one we're running on
}
}
@@ -678,7 +379,7 @@ namespace GodotTools.Export
/// </summary>
private static bool PlatformRequiresCustomBcl(string platform)
{
- if (new[] { OS.Platforms.Android, OS.Platforms.HTML5 }.Contains(platform))
+ if (new[] { OS.Platforms.Android, OS.Platforms.iOS, OS.Platforms.HTML5 }.Contains(platform))
return true;
// The 'net_4_x' BCL is not compatible between Windows and the other platforms.
@@ -707,6 +408,8 @@ namespace GodotTools.Export
return "net_4_x";
case OS.Platforms.Android:
return "monodroid";
+ case OS.Platforms.iOS:
+ return "monotouch";
case OS.Platforms.HTML5:
return "wasm";
default:
@@ -714,14 +417,11 @@ namespace GodotTools.Export
}
}
- private static string DataDirName
+ private static string DetermineDataDirNameForProject()
{
- get
- {
- var appName = (string)ProjectSettings.GetSetting("application/config/name");
- string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
- return $"data_{appNameSafe}";
- }
+ var appName = (string)ProjectSettings.GetSetting("application/config/name");
+ string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
+ return $"data_{appNameSafe}";
}
[MethodImpl(MethodImplOptions.InternalCall)]
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs b/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs
new file mode 100755
index 0000000000..219b7a698a
--- /dev/null
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/XcodeHelper.cs
@@ -0,0 +1,93 @@
+using System;
+using System.IO;
+
+namespace GodotTools.Export
+{
+ public static class XcodeHelper
+ {
+ private static string _XcodePath = null;
+
+ public static string XcodePath
+ {
+ get
+ {
+ if (_XcodePath == null)
+ {
+ _XcodePath = FindXcode();
+
+ if (_XcodePath == null)
+ throw new Exception("Could not find Xcode");
+ }
+
+ return _XcodePath;
+ }
+ }
+
+ private static string FindSelectedXcode()
+ {
+ var outputWrapper = new Godot.Collections.Array();
+
+ int exitCode = Godot.OS.Execute("xcode-select", new string[] { "--print-path" }, blocking: true, output: outputWrapper);
+
+ if (exitCode == 0)
+ {
+ string output = (string)outputWrapper[0];
+ return output.Trim();
+ }
+
+ Console.Error.WriteLine($"'xcode-select --print-path' exited with code: {exitCode}");
+
+ return null;
+ }
+
+ public static string FindXcode()
+ {
+ string selectedXcode = FindSelectedXcode();
+ if (selectedXcode != null)
+ {
+ if (Directory.Exists(Path.Combine(selectedXcode, "Contents", "Developer")))
+ return selectedXcode;
+
+ // The path already pointed to Contents/Developer
+ var dirInfo = new DirectoryInfo(selectedXcode);
+ if (dirInfo.Name != "Developer" || dirInfo.Parent.Name != "Contents")
+ {
+ Console.WriteLine(Path.GetDirectoryName(selectedXcode));
+ Console.WriteLine(System.IO.Directory.GetParent(selectedXcode).Name);
+ Console.Error.WriteLine("Unrecognized path for selected Xcode");
+ }
+ else
+ {
+ return System.IO.Path.GetFullPath($"{selectedXcode}/../..");
+ }
+ }
+ else
+ {
+ Console.Error.WriteLine("Could not find the selected Xcode; trying with a hint path");
+ }
+
+ const string XcodeHintPath = "/Applications/Xcode.app";
+
+ if (Directory.Exists(XcodeHintPath))
+ {
+ if (Directory.Exists(Path.Combine(XcodeHintPath, "Contents", "Developer")))
+ return XcodeHintPath;
+
+ Console.Error.WriteLine($"Found Xcode at '{XcodeHintPath}' but it's missing the 'Contents/Developer' sub-directory");
+ }
+
+ return null;
+ }
+
+ public static string FindXcodeTool(string toolName)
+ {
+ string XcodeDefaultToolchain = Path.Combine(XcodePath, "Contents", "Developer", "Toolchains", "XcodeDefault.xctoolchain");
+
+ string path = Path.Combine(XcodeDefaultToolchain, "usr", "bin", toolName);
+ if (File.Exists(path))
+ return path;
+
+ throw new FileNotFoundException($"Cannot find Xcode tool: {toolName}");
+ }
+ }
+}
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index e6d5dd9895..afe7670165 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -36,6 +36,17 @@ namespace GodotTools
public BottomPanel BottomPanel { get; private set; }
+ public static string ProjectAssemblyName
+ {
+ get
+ {
+ var projectAssemblyName = (string)ProjectSettings.GetSetting("application/config/name");
+ if (string.IsNullOrEmpty(projectAssemblyName))
+ projectAssemblyName = "UnnamedProject";
+ return projectAssemblyName;
+ }
+ }
+
private bool CreateProjectSolution()
{
using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 3))
@@ -45,9 +56,7 @@ namespace GodotTools
string resourceDir = ProjectSettings.GlobalizePath("res://");
string path = resourceDir;
- string name = (string)ProjectSettings.GetSetting("application/config/name");
- if (name.Empty())
- name = "UnnamedProject";
+ string name = ProjectAssemblyName;
string guid = CsProjOperations.GenerateGameProject(path, name);
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
index 379dfd9f7d..ac9379adf8 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
@@ -51,7 +51,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Build\MsBuildFinder.cs" />
+ <Compile Include="Export\AotBuilder.cs" />
<Compile Include="Export\ExportPlugin.cs" />
+ <Compile Include="Export\XcodeHelper.cs" />
<Compile Include="ExternalEditorId.cs" />
<Compile Include="Ides\GodotIdeManager.cs" />
<Compile Include="Ides\GodotIdeServer.cs" />
diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
index 11a4109d97..b057ac12c6 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs
@@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
+using JetBrains.Annotations;
namespace GodotTools.Utils
{
@@ -26,6 +27,7 @@ namespace GodotTools.Utils
public const string UWP = "UWP";
public const string Haiku = "Haiku";
public const string Android = "Android";
+ public const string iOS = "iOS";
public const string HTML5 = "HTML5";
}
@@ -38,6 +40,7 @@ namespace GodotTools.Utils
public const string UWP = "uwp";
public const string Haiku = "haiku";
public const string Android = "android";
+ public const string iOS = "iphone";
public const string HTML5 = "javascript";
}
@@ -50,6 +53,7 @@ namespace GodotTools.Utils
[Names.UWP] = Platforms.UWP,
[Names.Haiku] = Platforms.Haiku,
[Names.Android] = Platforms.Android,
+ [Names.iOS] = Platforms.iOS,
[Names.HTML5] = Platforms.HTML5
};
@@ -65,6 +69,7 @@ namespace GodotTools.Utils
private static readonly Lazy<bool> _isUWP = new Lazy<bool>(() => IsOS(Names.UWP));
private static readonly Lazy<bool> _isHaiku = new Lazy<bool>(() => IsOS(Names.Haiku));
private static readonly Lazy<bool> _isAndroid = new Lazy<bool>(() => IsOS(Names.Android));
+ private static readonly Lazy<bool> _isiOS = new Lazy<bool>(() => IsOS(Names.iOS));
private static readonly Lazy<bool> _isHTML5 = new Lazy<bool>(() => IsOS(Names.HTML5));
public static bool IsWindows => _isWindows.Value || IsUWP;
@@ -74,10 +79,11 @@ namespace GodotTools.Utils
public static bool IsUWP => _isUWP.Value;
public static bool IsHaiku => _isHaiku.Value;
public static bool IsAndroid => _isAndroid.Value;
+ public static bool IsiOS => _isiOS.Value;
public static bool IsHTML5 => _isHTML5.Value;
private static bool? _isUnixCache;
- private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android };
+ private static readonly string[] UnixLikePlatforms = { Names.OSX, Names.X11, Names.Server, Names.Haiku, Names.Android, Names.iOS };
public static bool IsUnixLike()
{
@@ -91,12 +97,12 @@ namespace GodotTools.Utils
public static char PathSep => IsWindows ? ';' : ':';
- public static string PathWhich(string name)
+ public static string PathWhich([NotNull] string name)
{
return IsWindows ? PathWhichWindows(name) : PathWhichUnix(name);
}
- private static string PathWhichWindows(string name)
+ private static string PathWhichWindows([NotNull] string name)
{
string[] windowsExts = Environment.GetEnvironmentVariable("PATHEXT")?.Split(PathSep) ?? new string[] { };
string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep);
@@ -121,7 +127,7 @@ namespace GodotTools.Utils
select path + ext).FirstOrDefault(File.Exists);
}
- private static string PathWhichUnix(string name)
+ private static string PathWhichUnix([NotNull] string name)
{
string[] pathDirs = Environment.GetEnvironmentVariable("PATH")?.Split(PathSep);
@@ -163,5 +169,33 @@ namespace GodotTools.Utils
User32Dll.AllowSetForegroundWindow(process.Id); // allows application to focus itself
}
}
+
+ public static int ExecuteCommand(string command, IEnumerable<string> arguments)
+ {
+ // TODO: Once we move to .NET Standard 2.1 we can use ProcessStartInfo.ArgumentList instead
+ string CmdLineArgsToString(IEnumerable<string> args)
+ {
+ // Not perfect, but as long as we are careful...
+ return string.Join(" ", args.Select(arg => arg.Contains(" ") ? $@"""{arg}""" : arg));
+ }
+
+ var startInfo = new ProcessStartInfo(command, CmdLineArgsToString(arguments));
+
+ Console.WriteLine($"Executing: \"{startInfo.FileName}\" {startInfo.Arguments}");
+
+ // Print the output
+ startInfo.RedirectStandardOutput = false;
+ startInfo.RedirectStandardError = false;
+
+ startInfo.UseShellExecute = false;
+
+ using (var process = new Process { StartInfo = startInfo })
+ {
+ process.Start();
+ process.WaitForExit();
+
+ return process.ExitCode;
+ }
+ }
}
}
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index 9a5de6db16..6cd10a94f9 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -411,7 +411,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append("\"/>");
} else {
// Try to find as global enum constant
- const EnumInterface *target_ienum = NULL;
+ const EnumInterface *target_ienum = nullptr;
for (const List<EnumInterface>::Element *E = global_enums.front(); E; E = E->next()) {
target_ienum = &E->get();
@@ -449,7 +449,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append("\"/>");
} else {
// Try to find as enum constant in the current class
- const EnumInterface *target_ienum = NULL;
+ const EnumInterface *target_ienum = nullptr;
for (const List<EnumInterface>::Element *E = target_itype->enums.front(); E; E = E->next()) {
target_ienum = &E->get();
@@ -782,7 +782,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
const ConstantInterface &iconstant = E->get();
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
- String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL);
+ String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr);
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
if (summary_lines.size()) {
@@ -843,7 +843,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) {
const ConstantInterface &iconstant = F->get();
if (iconstant.const_doc && iconstant.const_doc->description.size()) {
- String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), NULL);
+ String xml_summary = bbcode_to_xml(fix_doc_description(iconstant.const_doc->description), nullptr);
Vector<String> summary_lines = xml_summary.length() ? xml_summary.split("\n") : Vector<String>();
if (summary_lines.size()) {
@@ -1494,7 +1494,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
if (idx_arg.type.cname != name_cache.type_int) {
// Assume the index parameter is an enum
const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
- CRASH_COND(idx_arg_type == NULL);
+ CRASH_COND(idx_arg_type == nullptr);
p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index));
} else {
p_output.append(itos(p_iprop.index));
@@ -1522,7 +1522,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
if (idx_arg.type.cname != name_cache.type_int) {
// Assume the index parameter is an enum
const TypeInterface *idx_arg_type = _get_type_or_null(idx_arg.type);
- CRASH_COND(idx_arg_type == NULL);
+ CRASH_COND(idx_arg_type == nullptr);
p_output.append("(" + idx_arg_type->proxy_name + ")" + itos(p_iprop.index) + ", ");
} else {
p_output.append(itos(p_iprop.index) + ", ");
@@ -2121,7 +2121,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
if (return_type->is_object_type) {
ptrcall_return_type = return_type->is_reference ? "Ref<Reference>" : return_type->c_type;
- initialization = return_type->is_reference ? "" : " = NULL";
+ initialization = return_type->is_reference ? "" : " = nullptr";
} else {
ptrcall_return_type = return_type->c_type;
}
@@ -2130,10 +2130,10 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
p_output.append(" " C_LOCAL_RET);
p_output.append(initialization + ";\n");
- String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "NULL" : return_type->c_type_out + "()";
+ String fail_ret = return_type->c_type_out.ends_with("*") && !return_type->ret_as_byref_arg ? "nullptr" : return_type->c_type_out + "()";
if (return_type->ret_as_byref_arg) {
- p_output.append("\tif (" CS_PARAM_INSTANCE " == NULL) { *arg_ret = ");
+ p_output.append("\tif (" CS_PARAM_INSTANCE " == nullptr) { *arg_ret = ");
p_output.append(fail_ret);
p_output.append("; ERR_FAIL_MSG(\"Parameter ' arg_ret ' is null.\"); }\n");
} else {
@@ -2198,8 +2198,8 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
}
} else {
p_output.append("\t" CS_PARAM_METHODBIND "->ptrcall(" CS_PARAM_INSTANCE ", ");
- p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "NULL, ");
- p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "NULL);\n");
+ p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ", " : "nullptr, ");
+ p_output.append(!ret_void ? "&" C_LOCAL_RET ");\n" : "nullptr);\n");
}
if (!ret_void) {
@@ -2241,11 +2241,11 @@ const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_null(con
// 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);
+ ERR_FAIL_NULL_V(int_match, nullptr);
return &int_match->get();
}
- return NULL;
+ return nullptr;
}
const BindingsGenerator::TypeInterface *BindingsGenerator::_get_type_or_placeholder(const TypeReference &p_typeref) {
@@ -2412,7 +2412,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
iprop.proxy_name = iprop.proxy_name.replace("/", "__"); // Some members have a slash...
- iprop.prop_doc = NULL;
+ iprop.prop_doc = nullptr;
for (int i = 0; i < itype.class_doc->properties.size(); i++) {
const DocData::PropertyDoc &prop_doc = itype.class_doc->properties[i];
@@ -2457,7 +2457,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
PropertyInfo return_info = method_info.return_val;
- MethodBind *m = imethod.is_virtual ? NULL : ClassDB::get_method(type_cname, method_info.name);
+ MethodBind *m = imethod.is_virtual ? nullptr : ClassDB::get_method(type_cname, method_info.name);
imethod.is_vararg = m && m->is_vararg();
@@ -2603,7 +2603,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
// Populate signals
const HashMap<StringName, MethodInfo> &signal_map = class_info->signal_map;
- const StringName *k = NULL;
+ const StringName *k = nullptr;
while ((k = signal_map.next(k))) {
SignalInterface isignal;
@@ -2685,7 +2685,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ClassDB::get_integer_constant_list(type_cname, &constants, true);
const HashMap<StringName, List<StringName>> &enum_map = class_info->enum_map;
- k = NULL;
+ k = nullptr;
while ((k = enum_map.next(k))) {
StringName enum_proxy_cname = *k;
@@ -2707,7 +2707,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
- iconstant.const_doc = NULL;
+ iconstant.const_doc = nullptr;
for (int i = 0; i < itype.class_doc->constants.size(); i++) {
const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i];
@@ -2742,7 +2742,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value);
- iconstant.const_doc = NULL;
+ iconstant.const_doc = nullptr;
for (int i = 0; i < itype.class_doc->constants.size(); i++) {
const DocData::ConstantDoc &const_doc = itype.class_doc->constants[i];
@@ -3262,7 +3262,7 @@ void BindingsGenerator::_populate_global_constants() {
String constant_name = GlobalConstants::get_global_constant_name(i);
- const DocData::ConstantDoc *const_doc = NULL;
+ const DocData::ConstantDoc *const_doc = nullptr;
for (int j = 0; j < global_scope_doc.constants.size(); j++) {
const DocData::ConstantDoc &curr_const_doc = global_scope_doc.constants[j];
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index bebe489d02..7c87c688db 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -176,7 +176,7 @@ class BindingsGenerator {
is_virtual = false;
requires_object_call = false;
is_internal = false;
- method_doc = NULL;
+ method_doc = nullptr;
is_deprecated = false;
}
};
@@ -202,7 +202,7 @@ class BindingsGenerator {
}
SignalInterface() {
- method_doc = NULL;
+ method_doc = nullptr;
is_deprecated = false;
}
};
@@ -376,7 +376,7 @@ class BindingsGenerator {
return &E->get();
}
- return NULL;
+ return nullptr;
}
const PropertyInterface *find_property_by_name(const StringName &p_cname) const {
@@ -385,7 +385,7 @@ class BindingsGenerator {
return &E->get();
}
- return NULL;
+ return nullptr;
}
const PropertyInterface *find_property_by_proxy_name(const String &p_proxy_name) const {
@@ -394,7 +394,7 @@ class BindingsGenerator {
return &E->get();
}
- return NULL;
+ return nullptr;
}
const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const {
@@ -403,7 +403,7 @@ class BindingsGenerator {
return &E->get();
}
- return NULL;
+ return nullptr;
}
private:
@@ -498,7 +498,7 @@ class BindingsGenerator {
c_arg_in = "%s";
- class_doc = NULL;
+ class_doc = nullptr;
}
};
@@ -622,7 +622,7 @@ class BindingsGenerator {
if (it->get().name == p_name) return it;
it = it->next();
}
- return NULL;
+ return nullptr;
}
const ConstantInterface *find_constant_by_name(const String &p_name, const List<ConstantInterface> &p_constants) const {
@@ -631,7 +631,7 @@ class BindingsGenerator {
return &E->get();
}
- return NULL;
+ return nullptr;
}
inline String get_unique_sig(const TypeInterface &p_type) {
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index 872f45ba91..e5c2d023d3 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -57,8 +57,8 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str
Variant item_type = p_item_type;
Variant include = p_include;
const Variant *args[3] = { &project_path, &item_type, &include };
- MonoException *exc = NULL;
- klass->get_method("AddItemToProjectChecked", 3)->invoke(NULL, args, &exc);
+ MonoException *exc = nullptr;
+ klass->get_method("AddItemToProjectChecked", 3)->invoke(nullptr, args, &exc);
if (exc) {
GDMonoUtils::debug_print_unhandled_exception(exc);
diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp
index 31996a03d0..283d4beb8e 100644
--- a/modules/mono/editor/editor_internal_calls.cpp
+++ b/modules/mono/editor/editor_internal_calls.cpp
@@ -95,7 +95,7 @@ MonoString *godot_icall_GodotSharpDirs_MonoSolutionsDir() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_mono_solutions_dir());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -103,7 +103,7 @@ MonoString *godot_icall_GodotSharpDirs_BuildLogsDirs() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_build_logs_dir());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -111,7 +111,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectSlnPath() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_sln_path());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -119,7 +119,7 @@ MonoString *godot_icall_GodotSharpDirs_ProjectCsProjPath() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_project_csproj_path());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -127,7 +127,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorToolsDir() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_tools_dir());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -135,7 +135,7 @@ MonoString *godot_icall_GodotSharpDirs_DataEditorPrebuiltApiDir() {
#ifdef TOOLS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_editor_prebuilt_api_dir());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -151,7 +151,7 @@ MonoString *godot_icall_GodotSharpDirs_DataMonoBinDir() {
#ifdef WINDOWS_ENABLED
return GDMonoMarshal::mono_string_from_godot(GodotSharpDirs::get_data_mono_bin_dir());
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -202,7 +202,7 @@ uint32_t godot_icall_BindingsGenerator_CsGlueVersion() {
}
int32_t godot_icall_ScriptClassParser_ParseFile(MonoString *p_filepath, MonoObject *p_classes, MonoString **r_error_str) {
- *r_error_str = NULL;
+ *r_error_str = nullptr;
String filepath = GDMonoMarshal::mono_string_to_godot(p_filepath);
@@ -335,7 +335,7 @@ MonoString *godot_icall_Internal_MonoWindowsInstallRoot() {
String install_root_dir = GDMono::get_singleton()->get_mono_reg_info().install_root_dir;
return GDMonoMarshal::mono_string_from_godot(install_root_dir);
#else
- return NULL;
+ return nullptr;
#endif
}
diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp
index ce0b6ad0e6..324013e5e2 100644
--- a/modules/mono/editor/godotsharp_export.cpp
+++ b/modules/mono/editor/godotsharp_export.cpp
@@ -59,7 +59,7 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
if (r_dependencies.has(ref_name))
continue;
- GDMonoAssembly *ref_assembly = NULL;
+ GDMonoAssembly *ref_assembly = nullptr;
String path;
bool has_extension = ref_name.ends_with(".dll") || ref_name.ends_with(".exe");
@@ -70,21 +70,21 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
path = search_dir.plus_file(ref_name);
if (FileAccess::exists(path)) {
GDMono::get_singleton()->load_assembly_from(ref_name.get_basename(), path, &ref_assembly, true);
- if (ref_assembly != NULL)
+ if (ref_assembly != nullptr)
break;
}
} else {
path = search_dir.plus_file(ref_name + ".dll");
if (FileAccess::exists(path)) {
GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true);
- if (ref_assembly != NULL)
+ if (ref_assembly != nullptr)
break;
}
path = search_dir.plus_file(ref_name + ".exe");
if (FileAccess::exists(path)) {
GDMono::get_singleton()->load_assembly_from(ref_name, path, &ref_assembly, true);
- if (ref_assembly != NULL)
+ if (ref_assembly != nullptr)
break;
}
}
@@ -92,7 +92,8 @@ Error get_assembly_dependencies(GDMonoAssembly *p_assembly, const Vector<String>
ERR_FAIL_COND_V_MSG(!ref_assembly, ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + ref_name + "'.");
- r_dependencies[ref_name] = ref_assembly->get_path();
+ // Use the path we got from the search. Don't try to get the path from the loaded assembly as we can't trust it will be from the selected BCL dir.
+ r_dependencies[ref_name] = path;
Error err = get_assembly_dependencies(ref_assembly, p_search_dirs, r_dependencies);
ERR_FAIL_COND_V_MSG(err != OK, err, "Cannot load one of the dependencies for the assembly: '" + ref_name + "'.");
@@ -116,7 +117,7 @@ Error get_exported_assembly_dependencies(const Dictionary &p_initial_dependencie
String assembly_name = *key;
String assembly_path = p_initial_dependencies[*key];
- GDMonoAssembly *assembly = NULL;
+ GDMonoAssembly *assembly = nullptr;
bool load_success = GDMono::get_singleton()->load_assembly_from(assembly_name, assembly_path, &assembly, /* refonly: */ true);
ERR_FAIL_COND_V_MSG(!load_success, ERR_CANT_RESOLVE, "Cannot load assembly (refonly): '" + assembly_name + "'.");
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs
index a0f105d55e..c4c911b863 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DynamicObject.cs
@@ -23,7 +23,7 @@ namespace Godot
/// <example>
/// This sample shows how to use <see cref="Godot.DynamicGodotObject"/> to dynamically access the engine members of a <see cref="Godot.Object"/>.
/// <code>
- /// dynamic sprite = GetNode("Sprite").DynamicGodotObject;
+ /// dynamic sprite = GetNode("Sprite2D").DynamicGodotObject;
/// sprite.add_child(this);
///
/// if ((sprite.hframes * sprite.vframes) &gt; 0)
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 120668d1ef..f370883320 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -51,7 +51,7 @@ Object *godot_icall_Object_Ctor(MonoObject *p_obj) {
void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_ptr == NULL);
+ CRASH_COND(p_ptr == nullptr);
#endif
if (p_ptr->get_script_instance()) {
@@ -59,7 +59,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
if (cs_instance) {
if (!cs_instance->is_destructing_script_instance()) {
cs_instance->mono_object_disposed(p_obj);
- p_ptr->set_script_instance(NULL);
+ p_ptr->set_script_instance(nullptr);
}
return;
}
@@ -80,7 +80,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolean p_is_finalizer) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_ptr == NULL);
+ CRASH_COND(p_ptr == nullptr);
// This is only called with Reference derived classes
CRASH_COND(!Object::cast_to<Reference>(p_ptr));
#endif
@@ -99,7 +99,7 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
if (delete_owner) {
memdelete(ref);
} else if (remove_script_instance) {
- ref->set_script_instance(NULL);
+ ref->set_script_instance(nullptr);
}
}
return;
@@ -141,7 +141,7 @@ MethodBind *godot_icall_Object_ClassDB_get_method(StringName *p_type, MonoString
MonoObject *godot_icall_Object_weakref(Object *p_ptr) {
if (!p_ptr)
- return NULL;
+ return nullptr;
Ref<WeakRef> wref;
Reference *ref = Object::cast_to<Reference>(p_ptr);
@@ -149,7 +149,7 @@ MonoObject *godot_icall_Object_weakref(Object *p_ptr) {
if (ref) {
REF r = ref;
if (!r.is_valid())
- return NULL;
+ return nullptr;
wref.instance();
wref->set_ref(r);
@@ -230,7 +230,7 @@ MonoBoolean godot_icall_DynamicGodotObject_SetMember(Object *p_ptr, MonoString *
MonoString *godot_icall_Object_ToString(Object *p_ptr) {
#ifdef DEBUG_ENABLED
// Cannot happen in C#; would get an ObjectDisposedException instead.
- CRASH_COND(p_ptr == NULL);
+ CRASH_COND(p_ptr == nullptr);
#endif
// Can't call 'Object::to_string()' here, as that can end up calling 'ToString' again resulting in an endless circular loop.
String result = "[" + p_ptr->get_class() + ":" + itos(p_ptr->get_instance_id()) + "]";
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index b7fa7fcab2..4e3dc9c4ea 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -49,7 +49,7 @@ void godot_icall_Array_Dtor(Array *ptr) {
MonoObject *godot_icall_Array_At(Array *ptr, int index) {
if (index < 0 || index >= ptr->size()) {
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
- return NULL;
+ return nullptr;
}
return GDMonoMarshal::variant_to_mono_object(ptr->operator[](index));
}
@@ -57,7 +57,7 @@ MonoObject *godot_icall_Array_At(Array *ptr, int index) {
MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class) {
if (index < 0 || index >= ptr->size()) {
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
- return NULL;
+ return nullptr;
}
return GDMonoMarshal::variant_to_mono_object(ptr->operator[](index), ManagedType(type_encoding, type_class));
}
@@ -162,28 +162,28 @@ void godot_icall_Dictionary_Dtor(Dictionary *ptr) {
MonoObject *godot_icall_Dictionary_GetValue(Dictionary *ptr, MonoObject *key) {
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
- if (ret == NULL) {
+ if (ret == nullptr) {
MonoObject *exc = mono_object_new(mono_domain_get(), CACHED_CLASS(KeyNotFoundException)->get_mono_ptr());
#ifdef DEBUG_ENABLED
CRASH_COND(!exc);
#endif
GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
GDMonoUtils::set_pending_exception((MonoException *)exc);
- return NULL;
+ return nullptr;
}
return GDMonoMarshal::variant_to_mono_object(ret);
}
MonoObject *godot_icall_Dictionary_GetValue_Generic(Dictionary *ptr, MonoObject *key, uint32_t type_encoding, GDMonoClass *type_class) {
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
- if (ret == NULL) {
+ if (ret == nullptr) {
MonoObject *exc = mono_object_new(mono_domain_get(), CACHED_CLASS(KeyNotFoundException)->get_mono_ptr());
#ifdef DEBUG_ENABLED
CRASH_COND(!exc);
#endif
GDMonoUtils::runtime_object_init(exc, CACHED_CLASS(KeyNotFoundException));
GDMonoUtils::set_pending_exception((MonoException *)exc);
- return NULL;
+ return nullptr;
}
return GDMonoMarshal::variant_to_mono_object(ret, ManagedType(type_encoding, type_class));
}
@@ -207,7 +207,7 @@ int godot_icall_Dictionary_Count(Dictionary *ptr) {
void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value) {
Variant varKey = GDMonoMarshal::mono_object_to_variant(key);
Variant *ret = ptr->getptr(varKey);
- if (ret != NULL) {
+ if (ret != nullptr) {
GDMonoUtils::set_pending_exception(mono_get_exception_argument("key", "An element with the same key already exists"));
return;
}
@@ -221,7 +221,7 @@ void godot_icall_Dictionary_Clear(Dictionary *ptr) {
MonoBoolean godot_icall_Dictionary_Contains(Dictionary *ptr, MonoObject *key, MonoObject *value) {
// no dupes
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
- return ret != NULL && *ret == GDMonoMarshal::mono_object_to_variant(value);
+ return ret != nullptr && *ret == GDMonoMarshal::mono_object_to_variant(value);
}
MonoBoolean godot_icall_Dictionary_ContainsKey(Dictionary *ptr, MonoObject *key) {
@@ -241,7 +241,7 @@ MonoBoolean godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, Mono
// no dupes
Variant *ret = ptr->getptr(varKey);
- if (ret != NULL && *ret == GDMonoMarshal::mono_object_to_variant(value)) {
+ if (ret != nullptr && *ret == GDMonoMarshal::mono_object_to_variant(value)) {
ptr->erase(varKey);
return true;
}
@@ -251,8 +251,8 @@ MonoBoolean godot_icall_Dictionary_Remove(Dictionary *ptr, MonoObject *key, Mono
MonoBoolean godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key, MonoObject **value) {
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
- if (ret == NULL) {
- *value = NULL;
+ if (ret == nullptr) {
+ *value = nullptr;
return false;
}
*value = GDMonoMarshal::variant_to_mono_object(ret);
@@ -261,8 +261,8 @@ MonoBoolean godot_icall_Dictionary_TryGetValue(Dictionary *ptr, MonoObject *key,
MonoBoolean godot_icall_Dictionary_TryGetValue_Generic(Dictionary *ptr, MonoObject *key, MonoObject **value, uint32_t type_encoding, GDMonoClass *type_class) {
Variant *ret = ptr->getptr(GDMonoMarshal::mono_object_to_variant(key));
- if (ret == NULL) {
- *value = NULL;
+ if (ret == nullptr) {
+ *value = nullptr;
return false;
}
*value = GDMonoMarshal::variant_to_mono_object(ret, ManagedType(type_encoding, type_class));
diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp
index 1576d31a3b..2da39a916a 100644
--- a/modules/mono/glue/gd_glue.cpp
+++ b/modules/mono/glue/gd_glue.cpp
@@ -45,7 +45,7 @@
MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_objects) {
Variant ret;
PackedByteArray varr = GDMonoMarshal::mono_array_to_PackedByteArray(p_bytes);
- Error err = decode_variant(ret, varr.ptr(), varr.size(), NULL, p_allow_objects);
+ Error err = decode_variant(ret, varr.ptr(), varr.size(), nullptr, p_allow_objects);
if (err != OK) {
ret = RTR("Not enough bytes for decoding bytes, or invalid format.");
}
@@ -57,7 +57,7 @@ MonoObject *godot_icall_GD_convert(MonoObject *p_what, int32_t p_type) {
const Variant *args[1] = { &what };
Callable::CallError ce;
Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce);
- ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, NULL);
+ ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, nullptr);
return GDMonoMarshal::variant_to_mono_object(ret);
}
@@ -76,7 +76,7 @@ void godot_icall_GD_print(MonoArray *p_what) {
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
if (exc) {
@@ -98,7 +98,7 @@ void godot_icall_GD_printerr(MonoArray *p_what) {
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
if (exc) {
@@ -119,7 +119,7 @@ void godot_icall_GD_printraw(MonoArray *p_what) {
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
if (exc) {
@@ -140,7 +140,7 @@ void godot_icall_GD_prints(MonoArray *p_what) {
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
if (exc) {
@@ -164,7 +164,7 @@ void godot_icall_GD_printt(MonoArray *p_what) {
for (int i = 0; i < length; i++) {
MonoObject *elem = mono_array_get(p_what, MonoObject *, i);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
String elem_str = GDMonoMarshal::mono_object_to_variant_string(elem, &exc);
if (exc) {
@@ -259,8 +259,8 @@ MonoArray *godot_icall_GD_var2bytes(MonoObject *p_var, MonoBoolean p_full_object
PackedByteArray barr;
int len;
- Error err = encode_variant(var, NULL, len, p_full_objects);
- ERR_FAIL_COND_V_MSG(err != OK, NULL, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
+ Error err = encode_variant(var, nullptr, len, p_full_objects);
+ ERR_FAIL_COND_V_MSG(err != OK, nullptr, "Unexpected error encoding variable to bytes, likely unserializable type found (Object or RID).");
barr.resize(len);
encode_variant(var, barr.ptrw(), len, p_full_objects);
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 8130b0cc39..ee99a300b9 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -70,7 +70,7 @@ void godot_register_glue_header_icalls() {
#include "../mono_gd/gd_mono_utils.h"
#define GODOTSHARP_INSTANCE_OBJECT(m_instance, m_type) \
- static ClassDB::ClassInfo *ci = NULL; \
+ static ClassDB::ClassInfo *ci = nullptr; \
if (!ci) { \
ci = ClassDB::classes.getptr(m_type); \
} \
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 828ab73c82..fe8b925257 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -40,7 +40,7 @@
#endif
#ifdef ANDROID_ENABLED
-#include "mono_gd/gd_mono_android.h"
+#include "mono_gd/support/mono-support.h"
#endif
#include "mono_gd/gd_mono.h"
@@ -169,7 +169,7 @@ private:
data_mono_etc_dir = data_mono_root_dir.plus_file("etc");
#ifdef ANDROID_ENABLED
- data_mono_lib_dir = GDMonoAndroid::get_app_native_lib_dir();
+ data_mono_lib_dir = gdmono::android::support::get_app_native_lib_dir();
#else
data_mono_lib_dir = data_mono_root_dir.plus_file("lib");
#endif
@@ -206,7 +206,7 @@ private:
data_mono_etc_dir = data_mono_root_dir.plus_file("etc");
#ifdef ANDROID_ENABLED
- data_mono_lib_dir = GDMonoAndroid::get_app_native_lib_dir();
+ data_mono_lib_dir = gdmono::android::support::get_app_native_lib_dir();
#else
data_mono_lib_dir = data_mono_root_dir.plus_file("lib");
data_game_assemblies_dir = data_dir_root.plus_file("Assemblies");
diff --git a/modules/mono/managed_callable.cpp b/modules/mono/managed_callable.cpp
index a9cf64d1cc..dfd78a8244 100644
--- a/modules/mono/managed_callable.cpp
+++ b/modules/mono/managed_callable.cpp
@@ -99,7 +99,7 @@ void ManagedCallable::call(const Variant **p_arguments, int p_argcount, Variant
MonoObject *delegate = delegate_handle.get_target();
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret = delegate_invoke->invoke(delegate, p_arguments, &exc);
if (exc) {
@@ -119,7 +119,7 @@ void ManagedCallable::set_delegate(MonoDelegate *p_delegate) {
ManagedCallable::ManagedCallable(MonoDelegate *p_delegate) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_delegate == NULL);
+ CRASH_COND(p_delegate == nullptr);
#endif
set_delegate(p_delegate);
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index 4b6d7269e9..e362d5affb 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -34,7 +34,7 @@
void MonoGCHandleData::release() {
#ifdef DEBUG_ENABLED
- CRASH_COND(handle && GDMono::get_singleton() == NULL);
+ CRASH_COND(handle && GDMono::get_singleton() == nullptr);
#endif
if (handle && GDMono::get_singleton()->is_runtime_initialized()) {
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 705b2265ba..fbcb405b0d 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -53,7 +53,7 @@ struct MonoGCHandleData {
_FORCE_INLINE_ bool is_released() const { return !handle; }
_FORCE_INLINE_ bool is_weak() const { return type == gdmono::GCHandleType::WEAK_HANDLE; }
- _FORCE_INLINE_ MonoObject *get_target() const { return handle ? mono_gchandle_get_target(handle) : NULL; }
+ _FORCE_INLINE_ MonoObject *get_target() const { return handle ? mono_gchandle_get_target(handle) : nullptr; }
void release();
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index eb4c263745..306a1997ab 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -58,14 +58,25 @@
#ifdef ANDROID_ENABLED
#include "android_mono_config.h"
-#include "gd_mono_android.h"
+#include "support/android_support.h"
+#elif defined(IPHONE_ENABLED)
+#include "support/ios_support.h"
+#endif
+
+#if defined(TOOL_ENABLED) && defined(GD_MONO_SINGLE_APPDOMAIN)
+// This will no longer be the case if we replace appdomains with AssemblyLoadContext
+#error "Editor build requires support for multiple appdomains"
+#endif
+
+#if defined(GD_MONO_HOT_RELOAD) && defined(GD_MONO_SINGLE_APPDOMAIN)
+#error "Hot reloading requires multiple appdomains"
#endif
// TODO:
// This has turn into a gigantic mess. There's too much going on here. Too much #ifdef as well.
// It's just painful to read... It needs to be re-structured. Please, clean this up, future me.
-GDMono *GDMono::singleton = NULL;
+GDMono *GDMono::singleton = nullptr;
namespace {
@@ -178,7 +189,14 @@ MonoDomain *gd_initialize_mono_runtime() {
gd_mono_debug_init();
#endif
- return mono_jit_init_version("GodotEngine.RootDomain", "v4.0.30319");
+#if defined(IPHONE_ENABLED) || defined(ANDROID_ENABLED)
+ // I don't know whether this actually matters or not
+ const char *runtime_version = "mobile";
+#else
+ const char *runtime_version = "v4.0.30319";
+#endif
+
+ return mono_jit_init_version("GodotEngine.RootDomain", runtime_version);
}
#endif
@@ -314,14 +332,22 @@ void GDMono::initialize() {
determine_mono_dirs(assembly_rootdir, config_dir);
// Leak if we call mono_set_dirs more than once
- mono_set_dirs(assembly_rootdir.length() ? assembly_rootdir.utf8().get_data() : NULL,
- config_dir.length() ? config_dir.utf8().get_data() : NULL);
+ mono_set_dirs(assembly_rootdir.length() ? assembly_rootdir.utf8().get_data() : nullptr,
+ config_dir.length() ? config_dir.utf8().get_data() : nullptr);
add_mono_shared_libs_dir_to_path();
#endif
+#ifdef ANDROID_ENABLED
+ mono_config_parse_memory(get_godot_android_mono_config().utf8().get_data());
+#else
+ mono_config_parse(nullptr);
+#endif
+
#if defined(ANDROID_ENABLED)
- GDMonoAndroid::initialize();
+ gdmono::android::support::initialize();
+#elif defined(IPHONE_ENABLED)
+ gdmono::ios::support::initialize();
#endif
GDMonoAssembly::initialize();
@@ -330,13 +356,7 @@ void GDMono::initialize() {
gd_mono_profiler_init();
#endif
-#ifdef ANDROID_ENABLED
- mono_config_parse_memory(get_godot_android_mono_config().utf8().get_data());
-#else
- mono_config_parse(NULL);
-#endif
-
- mono_install_unhandled_exception_hook(&unhandled_exception_hook, NULL);
+ mono_install_unhandled_exception_hook(&unhandled_exception_hook, nullptr);
#ifndef TOOLS_ENABLED
// Exported games that don't use C# must still work. They likely don't ship with mscorlib.
@@ -355,7 +375,7 @@ void GDMono::initialize() {
#endif
// NOTE: Internal calls must be registered after the Mono runtime initialization.
- // Otherwise registration fails with the error: 'assertion 'hash != NULL' failed'.
+ // Otherwise registration fails with the error: 'assertion 'hash != nullptr' failed'.
root_domain = gd_initialize_mono_runtime();
ERR_FAIL_NULL_MSG(root_domain, "Mono: Failed to initialize runtime.");
@@ -371,15 +391,19 @@ void GDMono::initialize() {
print_verbose("Mono: Runtime initialized");
#if defined(ANDROID_ENABLED)
- GDMonoAndroid::register_internal_calls();
+ gdmono::android::support::register_internal_calls();
#endif
// mscorlib assembly MUST be present at initialization
bool corlib_loaded = _load_corlib_assembly();
ERR_FAIL_COND_MSG(!corlib_loaded, "Mono: Failed to load mscorlib assembly.");
+#ifndef GD_MONO_SINGLE_APPDOMAIN
Error domain_load_err = _load_scripts_domain();
ERR_FAIL_COND_MSG(domain_load_err != OK, "Mono: Failed to load scripts domain.");
+#else
+ scripts_domain = root_domain;
+#endif
_register_internal_calls();
@@ -491,11 +515,15 @@ void GDMono::add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly) {
assemblies[p_domain_id][p_assembly->get_name()] = p_assembly;
}
-GDMonoAssembly **GDMono::get_loaded_assembly(const String &p_name) {
+GDMonoAssembly *GDMono::get_loaded_assembly(const String &p_name) {
+
+ if (p_name == "mscorlib")
+ return get_corlib_assembly();
MonoDomain *domain = mono_domain_get();
uint32_t domain_id = domain ? mono_domain_get_id(domain) : 0;
- return assemblies[domain_id].getptr(p_name);
+ GDMonoAssembly **result = assemblies[domain_id].getptr(p_name);
+ return result ? *result : nullptr;
}
bool GDMono::load_assembly(const String &p_name, GDMonoAssembly **r_assembly, bool p_refonly) {
@@ -517,7 +545,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
print_verbose("Mono: Loading assembly " + p_name + (p_refonly ? " (refonly)" : "") + "...");
MonoImageOpenStatus status = MONO_IMAGE_OK;
- MonoAssembly *assembly = mono_assembly_load_full(p_aname, NULL, &status, p_refonly);
+ MonoAssembly *assembly = mono_assembly_load_full(p_aname, nullptr, &status, p_refonly);
if (!assembly)
return false;
@@ -528,7 +556,7 @@ bool GDMono::load_assembly(const String &p_name, MonoAssemblyName *p_aname, GDMo
GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name);
- ERR_FAIL_COND_V(stored_assembly == NULL, false);
+ ERR_FAIL_COND_V(stored_assembly == nullptr, false);
ERR_FAIL_COND_V((*stored_assembly)->get_assembly() != assembly, false);
*r_assembly = *stored_assembly;
@@ -549,14 +577,6 @@ bool GDMono::load_assembly_from(const String &p_name, const String &p_path, GDMo
if (!assembly)
return false;
-#ifdef DEBUG_ENABLED
- uint32_t domain_id = mono_domain_get_id(mono_domain_get());
- GDMonoAssembly **stored_assembly = assemblies[domain_id].getptr(p_name);
-
- ERR_FAIL_COND_V(stored_assembly == NULL, false);
- ERR_FAIL_COND_V(*stored_assembly != assembly, false);
-#endif
-
*r_assembly = assembly;
print_verbose("Mono: Assembly " + p_name + (p_refonly ? " (refonly)" : "") + " loaded from path: " + (*r_assembly)->get_path());
@@ -576,15 +596,15 @@ ApiAssemblyInfo::Version ApiAssemblyInfo::Version::get_from_loaded_assembly(GDMo
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));
+ api_assembly_version.godot_api_hash = GDMonoMarshal::unbox<uint64_t>(api_hash_field->get_value(nullptr));
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));
+ api_assembly_version.bindings_version = GDMonoMarshal::unbox<uint32_t>(binds_ver_field->get_value(nullptr));
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));
+ api_assembly_version.cs_glue_version = GDMonoMarshal::unbox<uint32_t>(cs_glue_ver_field->get_value(nullptr));
}
return api_assembly_version;
@@ -715,7 +735,7 @@ bool GDMono::_temp_domain_load_are_assemblies_out_of_sync(const String &p_config
GDMono::LoadedApiAssembly temp_editor_api_assembly;
if (!_try_load_api_assemblies(temp_core_api_assembly, temp_editor_api_assembly,
- p_config, /* refonly: */ true, /* loaded_callback: */ NULL)) {
+ p_config, /* refonly: */ true, /* loaded_callback: */ nullptr)) {
return temp_core_api_assembly.out_of_sync || temp_editor_api_assembly.out_of_sync;
}
@@ -894,8 +914,8 @@ void GDMono::_load_api_assemblies() {
bool api_assemblies_loaded = _try_load_api_assemblies_preset();
+#if defined(TOOLS_ENABLED) && !defined(GD_MONO_SINGLE_APPDOMAIN)
if (!api_assemblies_loaded) {
-#ifdef TOOLS_ENABLED
// The API assemblies are out of sync or some other error happened. Fine, try one more time, but
// this time update them from the prebuilt assemblies directory before trying to load them again.
@@ -916,8 +936,8 @@ void GDMono::_load_api_assemblies() {
// 4. Try loading the updated assemblies
api_assemblies_loaded = _try_load_api_assemblies_preset();
-#endif
}
+#endif
if (!api_assemblies_loaded) {
// welp... too bad
@@ -982,8 +1002,8 @@ void GDMono::_install_trace_listener() {
GDMonoClass *debug_utils = get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, "DebuggingUtils");
GDMonoMethod *install_func = debug_utils->get_method("InstallTraceListener");
- MonoException *exc = NULL;
- install_func->invoke_raw(NULL, NULL, &exc);
+ MonoException *exc = nullptr;
+ install_func->invoke_raw(nullptr, nullptr, &exc);
if (exc) {
GDMonoUtils::debug_print_unhandled_exception(exc);
ERR_PRINT("Failed to install 'System.Diagnostics.Trace' listener.");
@@ -991,9 +1011,10 @@ void GDMono::_install_trace_listener() {
#endif
}
+#ifndef GD_MONO_SINGLE_APPDOMAIN
Error GDMono::_load_scripts_domain() {
- ERR_FAIL_COND_V(scripts_domain != NULL, ERR_BUG);
+ ERR_FAIL_COND_V(scripts_domain != nullptr, ERR_BUG);
print_verbose("Mono: Loading scripts domain...");
@@ -1010,7 +1031,7 @@ Error GDMono::_unload_scripts_domain() {
ERR_FAIL_NULL_V(scripts_domain, ERR_BUG);
- print_verbose("Mono: Unloading scripts domain...");
+ print_verbose("Mono: Finalizing scripts domain...");
if (mono_domain_get() != root_domain)
mono_domain_set(root_domain, true);
@@ -1029,21 +1050,23 @@ Error GDMono::_unload_scripts_domain() {
_domain_assemblies_cleanup(mono_domain_get_id(scripts_domain));
- core_api_assembly.assembly = NULL;
+ core_api_assembly.assembly = nullptr;
#ifdef TOOLS_ENABLED
- editor_api_assembly.assembly = NULL;
+ editor_api_assembly.assembly = nullptr;
#endif
- project_assembly = NULL;
+ project_assembly = nullptr;
#ifdef TOOLS_ENABLED
- tools_assembly = NULL;
- tools_project_editor_assembly = NULL;
+ tools_assembly = nullptr;
+ tools_project_editor_assembly = nullptr;
#endif
MonoDomain *domain = scripts_domain;
- scripts_domain = NULL;
+ scripts_domain = nullptr;
+
+ print_verbose("Mono: Unloading scripts domain...");
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
mono_domain_try_unload(domain, (MonoObject **)&exc);
if (exc) {
@@ -1054,6 +1077,7 @@ Error GDMono::_unload_scripts_domain() {
return OK;
}
+#endif
#ifdef GD_MONO_HOT_RELOAD
Error GDMono::reload_scripts_domain() {
@@ -1092,9 +1116,10 @@ Error GDMono::reload_scripts_domain() {
}
#endif
+#ifndef GD_MONO_SINGLE_APPDOMAIN
Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
- CRASH_COND(p_domain == NULL);
+ CRASH_COND(p_domain == nullptr);
CRASH_COND(p_domain == GDMono::get_singleton()->get_scripts_domain()); // Should use _unload_scripts_domain() instead
String domain_name = mono_domain_get_friendly_name(p_domain);
@@ -1112,7 +1137,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
_domain_assemblies_cleanup(mono_domain_get_id(p_domain));
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
mono_domain_try_unload(p_domain, (MonoObject **)&exc);
if (exc) {
@@ -1123,6 +1148,7 @@ Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) {
return OK;
}
+#endif
GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) {
@@ -1134,7 +1160,7 @@ GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) {
uint32_t domain_id = mono_domain_get_id(mono_domain_get());
HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[domain_id];
- const String *k = NULL;
+ const String *k = nullptr;
while ((k = domain_assemblies.next(k))) {
GDMonoAssembly *assembly = domain_assemblies.get(*k);
if (assembly->get_image() == image) {
@@ -1145,30 +1171,34 @@ GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) {
}
}
- return NULL;
+ return nullptr;
}
GDMonoClass *GDMono::get_class(const StringName &p_namespace, const StringName &p_name) {
+ GDMonoClass *klass = corlib_assembly->get_class(p_namespace, p_name);
+ if (klass)
+ return klass;
+
uint32_t domain_id = mono_domain_get_id(mono_domain_get());
HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[domain_id];
- const String *k = NULL;
+ const String *k = nullptr;
while ((k = domain_assemblies.next(k))) {
GDMonoAssembly *assembly = domain_assemblies.get(*k);
- GDMonoClass *klass = assembly->get_class(p_namespace, p_name);
+ klass = assembly->get_class(p_namespace, p_name);
if (klass)
return klass;
}
- return NULL;
+ return nullptr;
}
void GDMono::_domain_assemblies_cleanup(uint32_t p_domain_id) {
HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[p_domain_id];
- const String *k = NULL;
+ const String *k = nullptr;
while ((k = domain_assemblies.next(k))) {
memdelete(domain_assemblies.get(*k));
}
@@ -1202,14 +1232,14 @@ GDMono::GDMono() {
runtime_initialized = false;
finalizing_scripts_domain = false;
- root_domain = NULL;
- scripts_domain = NULL;
+ root_domain = nullptr;
+ scripts_domain = nullptr;
- corlib_assembly = NULL;
- project_assembly = NULL;
+ corlib_assembly = nullptr;
+ project_assembly = nullptr;
#ifdef TOOLS_ENABLED
- tools_assembly = NULL;
- tools_project_editor_assembly = NULL;
+ tools_assembly = nullptr;
+ tools_project_editor_assembly = nullptr;
#endif
api_core_hash = 0;
@@ -1223,18 +1253,50 @@ GDMono::GDMono() {
GDMono::~GDMono() {
if (is_runtime_initialized()) {
+#ifndef GD_MONO_SINGLE_APPDOMAIN
if (scripts_domain) {
Error err = _unload_scripts_domain();
if (err != OK) {
ERR_PRINT("Mono: Failed to unload scripts domain.");
}
}
+#else
+ CRASH_COND(scripts_domain != root_domain);
+
+ print_verbose("Mono: Finalizing scripts domain...");
+
+ if (mono_domain_get() != root_domain)
+ mono_domain_set(root_domain, true);
+
+ finalizing_scripts_domain = true;
+
+ if (!mono_domain_finalize(root_domain, 2000)) {
+ ERR_PRINT("Mono: Domain finalization timeout.");
+ }
+
+ finalizing_scripts_domain = false;
- const uint32_t *k = NULL;
+ mono_gc_collect(mono_gc_max_generation());
+
+ GDMonoCache::clear_godot_api_cache();
+
+ _domain_assemblies_cleanup(mono_domain_get_id(root_domain));
+
+ core_api_assembly.assembly = nullptr;
+
+ project_assembly = nullptr;
+
+ root_domain = nullptr;
+ scripts_domain = nullptr;
+
+ // Leave the rest to 'mono_jit_cleanup'
+#endif
+
+ const uint32_t *k = nullptr;
while ((k = assemblies.next(k))) {
HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies.get(*k);
- const String *kk = NULL;
+ const String *kk = nullptr;
while ((kk = domain_assemblies.next(kk))) {
memdelete(domain_assemblies.get(*kk));
}
@@ -1245,22 +1307,22 @@ GDMono::~GDMono() {
mono_jit_cleanup(root_domain);
-#if defined(ANDROID_ENABLED)
- GDMonoAndroid::cleanup();
-#endif
-
print_verbose("Mono: Finalized");
runtime_initialized = false;
}
+#if defined(ANDROID_ENABLED)
+ gdmono::android::support::cleanup();
+#endif
+
if (gdmono_log)
memdelete(gdmono_log);
- singleton = NULL;
+ singleton = nullptr;
}
-_GodotSharp *_GodotSharp::singleton = NULL;
+_GodotSharp *_GodotSharp::singleton = nullptr;
void _GodotSharp::attach_thread() {
@@ -1288,7 +1350,7 @@ int32_t _GodotSharp::get_scripts_domain_id() {
bool _GodotSharp::is_scripts_domain_loaded() {
- return GDMono::get_singleton()->is_runtime_initialized() && GDMono::get_singleton()->get_scripts_domain() != NULL;
+ return GDMono::get_singleton()->is_runtime_initialized() && GDMono::get_singleton()->get_scripts_domain() != nullptr;
}
bool _GodotSharp::_is_domain_finalizing_for_unload(int32_t p_domain_id) {
@@ -1353,5 +1415,5 @@ _GodotSharp::_GodotSharp() {
_GodotSharp::~_GodotSharp() {
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index 9528c64f8d..4898833e8e 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -91,7 +91,7 @@ public:
bool out_of_sync;
LoadedApiAssembly() :
- assembly(NULL),
+ assembly(nullptr),
out_of_sync(false) {
}
};
@@ -144,8 +144,10 @@ private:
void _register_internal_calls();
+#ifndef GD_MONO_SINGLE_APPDOMAIN
Error _load_scripts_domain();
Error _unload_scripts_domain();
+#endif
void _domain_assemblies_cleanup(uint32_t p_domain_id);
@@ -198,7 +200,7 @@ public:
#ifdef TOOLS_ENABLED
bool copy_prebuilt_api_assembly(ApiAssemblyInfo::Type p_api_type, const String &p_config);
- String update_api_assemblies_from_prebuilt(const String &p_config, const bool *p_core_api_out_of_sync = NULL, const bool *p_editor_api_out_of_sync = NULL);
+ String update_api_assemblies_from_prebuilt(const String &p_config, const bool *p_core_api_out_of_sync = nullptr, const bool *p_editor_api_out_of_sync = nullptr);
#endif
static GDMono *get_singleton() { return singleton; }
@@ -209,7 +211,7 @@ public:
// Do not use these, unless you know what you're doing
void add_assembly(uint32_t p_domain_id, GDMonoAssembly *p_assembly);
- GDMonoAssembly **get_loaded_assembly(const String &p_name);
+ GDMonoAssembly *get_loaded_assembly(const String &p_name);
_FORCE_INLINE_ bool is_runtime_initialized() const { return runtime_initialized && !mono_runtime_is_shutting_down() /* stays true after shutdown finished */; }
@@ -263,7 +265,7 @@ public:
this->prev_domain = prev_domain;
mono_domain_set(p_domain, false);
} else {
- this->prev_domain = NULL;
+ this->prev_domain = nullptr;
}
}
diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp
index 6da1db249c..8439769d84 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.cpp
+++ b/modules/mono/mono_gd/gd_mono_assembly.cpp
@@ -42,9 +42,6 @@
#include "gd_mono_cache.h"
#include "gd_mono_class.h"
-bool GDMonoAssembly::no_search = false;
-bool GDMonoAssembly::in_preload = false;
-
Vector<String> GDMonoAssembly::search_dirs;
void GDMonoAssembly::fill_search_dirs(Vector<String> &r_search_dirs, const String &p_custom_config, const String &p_custom_bcl_dir) {
@@ -94,19 +91,30 @@ void GDMonoAssembly::fill_search_dirs(Vector<String> &r_search_dirs, const Strin
#endif
}
+// This is how these assembly loading hooks work:
+//
+// - The 'search' hook checks if the assembly has already been loaded, to avoid loading again.
+// - The 'preload' hook does the actual loading and is only called if the
+// 'search' hook didn't find the assembly in the list of loaded assemblies.
+// - The 'load' hook is called after the assembly has been loaded. Its job is to add the
+// assembly to the list of loaded assemblies so that the 'search' hook can look it up.
+
void GDMonoAssembly::assembly_load_hook(MonoAssembly *assembly, void *user_data) {
- if (no_search)
- return;
-
- // If our search and preload hooks fail to load the assembly themselves, the mono runtime still might.
- // Just do Assembly.LoadFrom("/Full/Path/On/Disk.dll");
- // In this case, we wouldn't have the assembly known in GDMono, which causes crashes
- // if any class inside the assembly is looked up by Godot.
- // And causing a lookup like that is as easy as throwing an exception defined in it...
- // No, we can't make the assembly load hooks smart enough because they get passed a MonoAssemblyName* only,
- // not the disk path passed to say Assembly.LoadFrom().
- _wrap_mono_assembly(assembly);
+ String name = String::utf8(mono_assembly_name_get_name(mono_assembly_get_name(assembly)));
+
+ MonoImage *image = mono_assembly_get_image(assembly);
+
+ GDMonoAssembly *gdassembly = memnew(GDMonoAssembly(name, image, assembly));
+
+#ifdef GD_MONO_HOT_RELOAD
+ const char *path = mono_image_get_filename(image);
+ if (FileAccess::exists(path))
+ gdassembly->modified_time = FileAccess::get_modified_time(path);
+#endif
+
+ MonoDomain *domain = mono_domain_get();
+ GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, gdassembly);
}
MonoAssembly *GDMonoAssembly::assembly_search_hook(MonoAssemblyName *aname, void *user_data) {
@@ -132,71 +140,24 @@ MonoAssembly *GDMonoAssembly::_search_hook(MonoAssemblyName *aname, void *user_d
String name = String::utf8(mono_assembly_name_get_name(aname));
bool has_extension = name.ends_with(".dll") || name.ends_with(".exe");
- if (no_search)
- return NULL;
-
- GDMonoAssembly **loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
+ GDMonoAssembly *loaded_asm = GDMono::get_singleton()->get_loaded_assembly(has_extension ? name.get_basename() : name);
if (loaded_asm)
- return (*loaded_asm)->get_assembly();
-
- no_search = true; // Avoid the recursion madness
-
- GDMonoAssembly *res = _load_assembly_search(name, search_dirs, refonly);
-
- no_search = false;
+ return loaded_asm->get_assembly();
- return res ? res->get_assembly() : NULL;
+ return nullptr;
}
-static thread_local MonoImage *image_corlib_loading = NULL;
-
MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **, void *user_data, bool refonly) {
(void)user_data; // UNUSED
- {
- // If we find the assembly here, we load it with 'mono_assembly_load_from_full',
- // which in turn invokes load hooks before returning the MonoAssembly to us.
- // One of the load hooks is 'load_aot_module'. This hook can end up calling preload hooks
- // again for the same assembly in certain in certain circumstances (the 'do_load_image' part).
- // If this is the case and we return NULL due to the no_search condition below,
- // it will result in an internal crash later on. Therefore we need to return the assembly we didn't
- // get yet from 'mono_assembly_load_from_full'. Luckily we have the image, which already got it.
- // This must be done here. If done in search hooks, it would cause 'mono_assembly_load_from_full'
- // to think another MonoAssembly for this assembly was already loaded, making it delete its own,
- // when in fact both pointers were the same... This hooks thing is confusing.
- if (image_corlib_loading) {
- return mono_image_get_assembly(image_corlib_loading);
- }
- }
-
- if (no_search)
- return NULL;
-
- no_search = true;
- in_preload = true;
-
String name = String::utf8(mono_assembly_name_get_name(aname));
- bool has_extension = name.ends_with(".dll");
-
- GDMonoAssembly *res = NULL;
- 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();
-
- res = _load_assembly_search("mscorlib.dll", search_dirs, refonly);
- }
-
- no_search = false;
- in_preload = false;
-
- return res ? res->get_assembly() : NULL;
+ return _load_assembly_search(name, search_dirs, refonly);
}
-GDMonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly) {
+MonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly) {
- GDMonoAssembly *res = NULL;
+ MonoAssembly *res = nullptr;
String path;
bool has_extension = p_name.ends_with(".dll") || p_name.ends_with(".exe");
@@ -207,28 +168,28 @@ GDMonoAssembly *GDMonoAssembly::_load_assembly_search(const String &p_name, cons
if (has_extension) {
path = search_dir.plus_file(p_name);
if (FileAccess::exists(path)) {
- res = _load_assembly_from(p_name.get_basename(), path, p_refonly);
- if (res != NULL)
+ res = _real_load_assembly_from(path, p_refonly);
+ if (res != nullptr)
return res;
}
} else {
path = search_dir.plus_file(p_name + ".dll");
if (FileAccess::exists(path)) {
- res = _load_assembly_from(p_name, path, p_refonly);
- if (res != NULL)
+ res = _real_load_assembly_from(path, p_refonly);
+ if (res != nullptr)
return res;
}
path = search_dir.plus_file(p_name + ".exe");
if (FileAccess::exists(path)) {
- res = _load_assembly_from(p_name, path, p_refonly);
- if (res != NULL)
+ res = _real_load_assembly_from(path, p_refonly);
+ if (res != nullptr)
return res;
}
}
}
- return NULL;
+ return nullptr;
}
String GDMonoAssembly::find_assembly(const String &p_name) {
@@ -258,91 +219,50 @@ String GDMonoAssembly::find_assembly(const String &p_name) {
return String();
}
-GDMonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path, bool p_refonly) {
-
- GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path));
-
- 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;
-}
-
-void GDMonoAssembly::_wrap_mono_assembly(MonoAssembly *assembly) {
- String name = String::utf8(mono_assembly_name_get_name(mono_assembly_get_name(assembly)));
-
- MonoImage *image = mono_assembly_get_image(assembly);
-
- GDMonoAssembly *gdassembly = memnew(GDMonoAssembly(name, mono_image_get_filename(image)));
- Error err = gdassembly->wrapper_for_image(image);
-
- if (err != OK) {
- memdelete(gdassembly);
- ERR_FAIL();
- }
-
- MonoDomain *domain = mono_domain_get();
- GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, gdassembly);
-}
-
void GDMonoAssembly::initialize() {
fill_search_dirs(search_dirs);
- 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);
- mono_install_assembly_load_hook(&assembly_load_hook, NULL);
+ mono_install_assembly_search_hook(&assembly_search_hook, nullptr);
+ mono_install_assembly_refonly_search_hook(&assembly_refonly_search_hook, nullptr);
+ mono_install_assembly_preload_hook(&assembly_preload_hook, nullptr);
+ mono_install_assembly_refonly_preload_hook(&assembly_refonly_preload_hook, nullptr);
+ mono_install_assembly_load_hook(&assembly_load_hook, nullptr);
}
-Error GDMonoAssembly::load(bool p_refonly) {
-
- ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);
-
- refonly = p_refonly;
+MonoAssembly *GDMonoAssembly::_real_load_assembly_from(const String &p_path, bool 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);
+ Vector<uint8_t> data = FileAccess::get_file_as_array(p_path);
+ ERR_FAIL_COND_V_MSG(data.empty(), nullptr, "Could read the assembly in the specified location");
String image_filename;
#ifdef ANDROID_ENABLED
- if (path.begins_with("res://")) {
- image_filename = path.substr(6, path.length());
+ if (p_path.begins_with("res://")) {
+ image_filename = p_path.substr(6, p_path.length());
} else {
- image_filename = ProjectSettings::get_singleton()->globalize_path(path);
+ image_filename = ProjectSettings::get_singleton()->globalize_path(p_path);
}
#else
// FIXME: globalize_path does not work on exported games
- image_filename = ProjectSettings::get_singleton()->globalize_path(path);
+ image_filename = ProjectSettings::get_singleton()->globalize_path(p_path);
#endif
MonoImageOpenStatus status = MONO_IMAGE_OK;
- image = mono_image_open_from_data_with_name(
+ MonoImage *image = mono_image_open_from_data_with_name(
(char *)&data[0], data.size(),
- true, &status, refonly,
- image_filename.utf8().get_data());
+ true, &status, p_refonly,
+ image_filename.utf8());
- ERR_FAIL_COND_V(status != MONO_IMAGE_OK, ERR_FILE_CANT_OPEN);
- ERR_FAIL_NULL_V(image, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(status != MONO_IMAGE_OK || !image, nullptr, "Failed to open assembly image from the loaded data");
#ifdef DEBUG_ENABLED
Vector<uint8_t> pdb_data;
- String pdb_path(path + ".pdb");
+ String pdb_path(p_path + ".pdb");
if (!FileAccess::exists(pdb_path)) {
- pdb_path = path.get_basename() + ".pdb"; // without .dll
+ pdb_path = p_path.get_basename() + ".pdb"; // without .dll
if (!FileAccess::exists(pdb_path))
goto no_pdb;
@@ -357,44 +277,21 @@ no_pdb:
#endif
- bool is_corlib_preload = in_preload && name == "mscorlib";
-
- if (is_corlib_preload)
- image_corlib_loading = image;
+ status = MONO_IMAGE_OK;
- assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, refonly);
+ MonoAssembly *assembly = mono_assembly_load_from_full(image, image_filename.utf8().get_data(), &status, p_refonly);
- if (is_corlib_preload)
- image_corlib_loading = NULL;
-
- ERR_FAIL_COND_V(status != MONO_IMAGE_OK || assembly == NULL, ERR_FILE_CANT_OPEN);
+ ERR_FAIL_COND_V_MSG(status != MONO_IMAGE_OK || !assembly, nullptr, "Failed to load assembly for image");
// Decrement refcount which was previously incremented by mono_image_open_from_data_with_name
mono_image_close(image);
- loaded = true;
- modified_time = last_modified_time;
-
- return OK;
-}
-
-Error GDMonoAssembly::wrapper_for_image(MonoImage *p_image) {
-
- ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);
-
- assembly = mono_image_get_assembly(p_image);
- ERR_FAIL_NULL_V(assembly, FAILED);
-
- image = p_image;
-
- loaded = true;
-
- return OK;
+ return assembly;
}
void GDMonoAssembly::unload() {
- ERR_FAIL_COND(!loaded);
+ ERR_FAIL_NULL(image); // Should not be called if already unloaded
for (Map<MonoClass *, GDMonoClass *>::Element *E = cached_raw.front(); E; E = E->next()) {
memdelete(E->value());
@@ -403,14 +300,17 @@ void GDMonoAssembly::unload() {
cached_classes.clear();
cached_raw.clear();
- assembly = NULL;
- image = NULL;
- loaded = false;
+ assembly = nullptr;
+ image = nullptr;
+}
+
+String GDMonoAssembly::get_path() const {
+ return String::utf8(mono_image_get_filename(image));
}
GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const StringName &p_name) {
- ERR_FAIL_COND_V(!loaded, NULL);
+ ERR_FAIL_NULL_V(image, nullptr);
ClassKey key(p_namespace, p_name);
@@ -422,7 +322,7 @@ GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const Stri
MonoClass *mono_class = mono_class_from_name(image, String(p_namespace).utf8(), String(p_name).utf8());
if (!mono_class)
- return NULL;
+ return nullptr;
GDMonoClass *wrapped_class = memnew(GDMonoClass(p_namespace, p_name, mono_class, this));
@@ -434,7 +334,7 @@ GDMonoClass *GDMonoAssembly::get_class(const StringName &p_namespace, const Stri
GDMonoClass *GDMonoAssembly::get_class(MonoClass *p_mono_class) {
- ERR_FAIL_COND_V(!loaded, NULL);
+ ERR_FAIL_NULL_V(image, nullptr);
Map<MonoClass *, GDMonoClass *>::Element *match = cached_raw.find(p_mono_class);
@@ -454,7 +354,7 @@ GDMonoClass *GDMonoAssembly::get_class(MonoClass *p_mono_class) {
GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class) {
- GDMonoClass *match = NULL;
+ GDMonoClass *match = nullptr;
if (gdobject_class_cache_updated) {
Map<StringName, GDMonoClass *>::Element *result = gdobject_class_cache.find(p_class);
@@ -486,7 +386,7 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class)
GDMonoClass *current_nested = nested_classes.front()->get();
nested_classes.pop_back();
- void *iter = NULL;
+ void *iter = nullptr;
while (true) {
MonoClass *raw_nested = mono_class_get_nested_types(current_nested->get_mono_ptr(), &iter);
@@ -514,32 +414,38 @@ GDMonoClass *GDMonoAssembly::get_object_derived_class(const StringName &p_class)
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;
-#ifdef DEBUG_ENABLED
- CRASH_COND(!FileAccess::exists(p_path));
-#endif
- no_search = true;
- GDMonoAssembly *res = _load_assembly_from(p_name, p_path, p_refonly);
- no_search = false;
- return res;
-}
+ if (p_name == "mscorlib" || p_name == "mscorlib.dll")
+ return GDMono::get_singleton()->get_corlib_assembly();
-GDMonoAssembly::GDMonoAssembly(const String &p_name, const String &p_path) {
+ // We need to manually call the search hook in this case, as it won't be called in the next step
+ MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8());
+ MonoAssembly *assembly = mono_assembly_invoke_search_hook(aname);
+ mono_assembly_name_free(aname);
+ mono_free(aname);
+
+ if (!assembly) {
+ assembly = _real_load_assembly_from(p_path, p_refonly);
+ ERR_FAIL_NULL_V(assembly, nullptr);
+ }
- loaded = false;
- gdobject_class_cache_updated = false;
- name = p_name;
- path = p_path;
- refonly = false;
- modified_time = 0;
- assembly = NULL;
- image = NULL;
+ GDMonoAssembly *loaded_asm = GDMono::get_singleton()->get_loaded_assembly(p_name);
+ ERR_FAIL_NULL_V_MSG(loaded_asm, nullptr, "Loaded assembly missing from table. Did we not receive the load hook?");
+
+ return loaded_asm;
+}
+
+GDMonoAssembly::GDMonoAssembly(const String &p_name, MonoImage *p_image, MonoAssembly *p_assembly) :
+ name(p_name),
+ image(p_image),
+ assembly(p_assembly),
+#ifdef GD_MONO_HOT_RELOAD
+ modified_time(0),
+#endif
+ gdobject_class_cache_updated(false) {
}
GDMonoAssembly::~GDMonoAssembly() {
- if (loaded)
+ if (image)
unload();
}
diff --git a/modules/mono/mono_gd/gd_mono_assembly.h b/modules/mono/mono_gd/gd_mono_assembly.h
index 4740e10339..43c8225b74 100644
--- a/modules/mono/mono_gd/gd_mono_assembly.h
+++ b/modules/mono/mono_gd/gd_mono_assembly.h
@@ -68,24 +68,20 @@ class GDMonoAssembly {
StringName class_name;
};
- MonoAssembly *assembly;
+ String name;
MonoImage *image;
+ MonoAssembly *assembly;
- bool refonly;
- bool loaded;
-
- String name;
- String path;
+#ifdef GD_MONO_HOT_RELOAD
uint64_t modified_time;
-
- HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes;
- Map<MonoClass *, GDMonoClass *> cached_raw;
+#endif
bool gdobject_class_cache_updated;
Map<StringName, GDMonoClass *> gdobject_class_cache;
- static bool no_search;
- static bool in_preload;
+ HashMap<ClassKey, GDMonoClass *, ClassKey::Hasher> cached_classes;
+ Map<MonoClass *, GDMonoClass *> cached_raw;
+
static Vector<String> search_dirs;
static void assembly_load_hook(MonoAssembly *assembly, void *user_data);
@@ -97,25 +93,24 @@ class GDMonoAssembly {
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);
- static GDMonoAssembly *_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly);
- static void _wrap_mono_assembly(MonoAssembly *assembly);
+ static MonoAssembly *_real_load_assembly_from(const String &p_path, bool p_refonly);
+ static MonoAssembly *_load_assembly_search(const String &p_name, const Vector<String> &p_search_dirs, bool p_refonly);
friend class GDMono;
static void initialize();
public:
- 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; }
_FORCE_INLINE_ String get_name() const { return name; }
- _FORCE_INLINE_ String get_path() const { return path; }
+
+#ifdef GD_MONO_HOT_RELOAD
_FORCE_INLINE_ uint64_t get_modified_time() const { return modified_time; }
+#endif
+
+ String get_path() const;
GDMonoClass *get_class(const StringName &p_namespace, const StringName &p_name);
GDMonoClass *get_class(MonoClass *p_mono_class);
@@ -128,7 +123,7 @@ public:
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(const String &p_name, MonoImage *p_image, MonoAssembly *p_assembly);
~GDMonoAssembly();
};
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index e493098211..40cc41122b 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -40,11 +40,11 @@ namespace GDMonoCache {
CachedData cached_data;
-#define CACHE_AND_CHECK(m_var, m_val) \
- { \
- CRASH_COND(m_var != NULL); \
- m_var = m_val; \
- ERR_FAIL_COND_MSG(m_var == NULL, "Mono Cache: Member " #m_var " is null."); \
+#define CACHE_AND_CHECK(m_var, m_val) \
+ { \
+ CRASH_COND(m_var != nullptr); \
+ m_var = m_val; \
+ ERR_FAIL_COND_MSG(m_var == nullptr, "Mono Cache: Member " #m_var " is null."); \
}
#define CACHE_CLASS_AND_CHECK(m_class, m_val) CACHE_AND_CHECK(cached_data.class_##m_class, m_val)
@@ -54,12 +54,12 @@ CachedData cached_data;
#define CACHE_METHOD_AND_CHECK(m_class, m_method, m_val) CACHE_AND_CHECK(cached_data.method_##m_class##_##m_method, m_val)
#define CACHE_PROPERTY_AND_CHECK(m_class, m_property, m_val) CACHE_AND_CHECK(cached_data.property_##m_class##_##m_property, m_val)
-#define CACHE_METHOD_THUNK_AND_CHECK_IMPL(m_var, m_val) \
- { \
- CRASH_COND(!m_var.is_null()); \
- ERR_FAIL_COND_MSG(m_val == NULL, "Mono Cache: Method for member " #m_var " is null."); \
- m_var.set_from_method(m_val); \
- ERR_FAIL_COND_MSG(m_var.is_null(), "Mono Cache: Member " #m_var " is null."); \
+#define CACHE_METHOD_THUNK_AND_CHECK_IMPL(m_var, m_val) \
+ { \
+ CRASH_COND(!m_var.is_null()); \
+ ERR_FAIL_COND_MSG(m_val == nullptr, "Mono Cache: Method for member " #m_var " is null."); \
+ m_var.set_from_method(m_val); \
+ ERR_FAIL_COND_MSG(m_var.is_null(), "Mono Cache: Member " #m_var " is null."); \
}
#define CACHE_METHOD_THUNK_AND_CHECK(m_class, m_method, m_val) CACHE_METHOD_THUNK_AND_CHECK_IMPL(cached_data.methodthunk_##m_class##_##m_method, m_val)
@@ -68,93 +68,93 @@ void CachedData::clear_corlib_cache() {
corlib_cache_updated = false;
- class_MonoObject = NULL;
- class_bool = NULL;
- class_int8_t = NULL;
- class_int16_t = NULL;
- class_int32_t = NULL;
- class_int64_t = NULL;
- class_uint8_t = NULL;
- class_uint16_t = NULL;
- class_uint32_t = NULL;
- class_uint64_t = NULL;
- class_float = NULL;
- class_double = NULL;
- class_String = NULL;
- class_IntPtr = NULL;
-
- class_System_Collections_IEnumerable = NULL;
- class_System_Collections_IDictionary = NULL;
+ class_MonoObject = nullptr;
+ class_bool = nullptr;
+ class_int8_t = nullptr;
+ class_int16_t = nullptr;
+ class_int32_t = nullptr;
+ class_int64_t = nullptr;
+ class_uint8_t = nullptr;
+ class_uint16_t = nullptr;
+ class_uint32_t = nullptr;
+ class_uint64_t = nullptr;
+ class_float = nullptr;
+ class_double = nullptr;
+ class_String = nullptr;
+ class_IntPtr = nullptr;
+
+ class_System_Collections_IEnumerable = nullptr;
+ class_System_Collections_IDictionary = nullptr;
#ifdef DEBUG_ENABLED
- class_System_Diagnostics_StackTrace = NULL;
+ class_System_Diagnostics_StackTrace = nullptr;
methodthunk_System_Diagnostics_StackTrace_GetFrames.nullify();
- method_System_Diagnostics_StackTrace_ctor_bool = NULL;
- method_System_Diagnostics_StackTrace_ctor_Exception_bool = NULL;
+ method_System_Diagnostics_StackTrace_ctor_bool = nullptr;
+ method_System_Diagnostics_StackTrace_ctor_Exception_bool = nullptr;
#endif
- class_KeyNotFoundException = NULL;
+ class_KeyNotFoundException = nullptr;
}
void CachedData::clear_godot_api_cache() {
godot_api_cache_updated = false;
- rawclass_Dictionary = NULL;
-
- class_Vector2 = NULL;
- class_Vector2i = NULL;
- class_Rect2 = NULL;
- class_Rect2i = NULL;
- class_Transform2D = NULL;
- class_Vector3 = NULL;
- class_Vector3i = NULL;
- class_Basis = NULL;
- class_Quat = NULL;
- class_Transform = NULL;
- class_AABB = NULL;
- class_Color = NULL;
- class_Plane = NULL;
- class_StringName = NULL;
- class_NodePath = NULL;
- class_RID = NULL;
- class_GodotObject = NULL;
- class_GodotResource = NULL;
- class_Node = NULL;
- class_Control = NULL;
- class_Node3D = NULL;
- class_WeakRef = NULL;
- class_Callable = NULL;
- class_SignalInfo = NULL;
- class_Array = NULL;
- class_Dictionary = NULL;
- class_MarshalUtils = NULL;
- class_ISerializationListener = NULL;
+ rawclass_Dictionary = nullptr;
+
+ class_Vector2 = nullptr;
+ class_Vector2i = nullptr;
+ class_Rect2 = nullptr;
+ class_Rect2i = nullptr;
+ class_Transform2D = nullptr;
+ class_Vector3 = nullptr;
+ class_Vector3i = nullptr;
+ class_Basis = nullptr;
+ class_Quat = nullptr;
+ class_Transform = nullptr;
+ class_AABB = nullptr;
+ class_Color = nullptr;
+ class_Plane = nullptr;
+ class_StringName = nullptr;
+ class_NodePath = nullptr;
+ class_RID = nullptr;
+ class_GodotObject = nullptr;
+ class_GodotResource = nullptr;
+ class_Node = nullptr;
+ class_Control = nullptr;
+ class_Node3D = nullptr;
+ class_WeakRef = nullptr;
+ class_Callable = nullptr;
+ class_SignalInfo = nullptr;
+ class_Array = nullptr;
+ class_Dictionary = nullptr;
+ class_MarshalUtils = nullptr;
+ class_ISerializationListener = nullptr;
#ifdef DEBUG_ENABLED
- class_DebuggingUtils = NULL;
+ class_DebuggingUtils = nullptr;
methodthunk_DebuggingUtils_GetStackFrameInfo.nullify();
#endif
- class_ExportAttribute = NULL;
- field_ExportAttribute_hint = NULL;
- field_ExportAttribute_hintString = NULL;
- class_SignalAttribute = NULL;
- class_ToolAttribute = NULL;
- class_RemoteAttribute = NULL;
- class_MasterAttribute = NULL;
- class_PuppetAttribute = NULL;
- class_RemoteSyncAttribute = NULL;
- class_MasterSyncAttribute = NULL;
- class_PuppetSyncAttribute = NULL;
- class_GodotMethodAttribute = NULL;
- field_GodotMethodAttribute_methodName = NULL;
-
- field_GodotObject_ptr = NULL;
- field_StringName_ptr = NULL;
- field_NodePath_ptr = NULL;
- field_Image_ptr = NULL;
- field_RID_ptr = NULL;
+ class_ExportAttribute = nullptr;
+ field_ExportAttribute_hint = nullptr;
+ field_ExportAttribute_hintString = nullptr;
+ class_SignalAttribute = nullptr;
+ class_ToolAttribute = nullptr;
+ class_RemoteAttribute = nullptr;
+ class_MasterAttribute = nullptr;
+ class_PuppetAttribute = nullptr;
+ class_RemoteSyncAttribute = nullptr;
+ class_MasterSyncAttribute = nullptr;
+ class_PuppetSyncAttribute = nullptr;
+ class_GodotMethodAttribute = nullptr;
+ field_GodotMethodAttribute_methodName = nullptr;
+
+ field_GodotObject_ptr = nullptr;
+ field_StringName_ptr = nullptr;
+ field_NodePath_ptr = nullptr;
+ field_Image_ptr = nullptr;
+ field_RID_ptr = nullptr;
methodthunk_GodotObject_Dispose.nullify();
methodthunk_Array_GetPtr.nullify();
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
index 648f5f6c6b..ede4203e35 100644
--- a/modules/mono/mono_gd/gd_mono_class.cpp
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -40,7 +40,7 @@ String GDMonoClass::get_full_name(MonoClass *p_mono_class) {
// mono_type_get_full_name is not exposed to embedders, but this seems to do the job
MonoReflectionType *type_obj = mono_type_get_object(mono_domain_get(), get_mono_type(p_mono_class));
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoString *str = GDMonoUtils::object_to_string((MonoObject *)type_obj, &exc);
UNHANDLED_EXCEPTION(exc);
@@ -76,12 +76,12 @@ bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const {
GDMonoClass *GDMonoClass::get_parent_class() {
MonoClass *parent_mono_class = mono_class_get_parent(mono_class);
- return parent_mono_class ? GDMono::get_singleton()->get_class(parent_mono_class) : NULL;
+ return parent_mono_class ? GDMono::get_singleton()->get_class(parent_mono_class) : nullptr;
}
GDMonoClass *GDMonoClass::get_nesting_class() {
MonoClass *nesting_type = mono_class_get_nesting_type(mono_class);
- return nesting_type ? GDMono::get_singleton()->get_class(nesting_type) : NULL;
+ return nesting_type ? GDMono::get_singleton()->get_class(nesting_type) : nullptr;
}
#ifdef TOOLS_ENABLED
@@ -92,9 +92,9 @@ Vector<MonoClassField *> GDMonoClass::get_enum_fields() {
Vector<MonoClassField *> enum_fields;
- void *iter = NULL;
- MonoClassField *raw_field = NULL;
- while ((raw_field = mono_class_get_fields(get_mono_ptr(), &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoClassField *raw_field = nullptr;
+ while ((raw_field = mono_class_get_fields(get_mono_ptr(), &iter)) != nullptr) {
uint32_t field_flags = mono_field_get_flags(raw_field);
// Enums have an instance field named value__ which holds the value of the enum.
@@ -126,21 +126,21 @@ bool GDMonoClass::has_attribute(GDMonoClass *p_attr_class) {
MonoObject *GDMonoClass::get_attribute(GDMonoClass *p_attr_class) {
#ifdef DEBUG_ENABLED
- ERR_FAIL_NULL_V(p_attr_class, NULL);
+ ERR_FAIL_NULL_V(p_attr_class, nullptr);
#endif
if (!attrs_fetched)
fetch_attributes();
if (!attributes)
- return NULL;
+ return nullptr;
return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr());
}
void GDMonoClass::fetch_attributes() {
- ERR_FAIL_COND(attributes != NULL);
+ ERR_FAIL_COND(attributes != nullptr);
attributes = mono_custom_attrs_from_class(get_mono_ptr());
attrs_fetched = true;
@@ -153,9 +153,9 @@ void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base
if (methods_fetched)
return;
- void *iter = NULL;
- MonoMethod *raw_method = NULL;
- while ((raw_method = mono_class_get_methods(get_mono_ptr(), &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoMethod *raw_method = nullptr;
+ while ((raw_method = mono_class_get_methods(get_mono_ptr(), &iter)) != nullptr) {
StringName name = mono_method_get_name(raw_method);
// get_method implicitly fetches methods and adds them to this->methods
@@ -198,7 +198,7 @@ void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base
}
#endif
- uint32_t flags = mono_method_get_flags(method->mono_method, NULL);
+ uint32_t flags = mono_method_get_flags(method->mono_method, nullptr);
if (!(flags & MONO_METHOD_ATTR_VIRTUAL))
continue;
@@ -242,21 +242,21 @@ void GDMonoClass::fetch_methods_with_godot_api_checks(GDMonoClass *p_native_base
GDMonoMethod *GDMonoClass::get_fetched_method_unknown_params(const StringName &p_name) {
- ERR_FAIL_COND_V(!methods_fetched, NULL);
+ ERR_FAIL_COND_V(!methods_fetched, nullptr);
- const MethodKey *k = NULL;
+ const MethodKey *k = nullptr;
while ((k = methods.next(k))) {
if (k->name == p_name)
return methods.get(*k);
}
- return NULL;
+ return nullptr;
}
bool GDMonoClass::has_fetched_method_unknown_params(const StringName &p_name) {
- return get_fetched_method_unknown_params(p_name) != NULL;
+ return get_fetched_method_unknown_params(p_name) != nullptr;
}
bool GDMonoClass::implements_interface(GDMonoClass *p_interface) {
@@ -274,7 +274,7 @@ GDMonoMethod *GDMonoClass::get_method(const StringName &p_name, int p_params_cou
return *match;
if (methods_fetched)
- return NULL;
+ return nullptr;
MonoMethod *raw_method = mono_class_get_method_from_name(mono_class, String(p_name).utf8().get_data(), p_params_count);
@@ -285,7 +285,7 @@ GDMonoMethod *GDMonoClass::get_method(const StringName &p_name, int p_params_cou
return method;
}
- return NULL;
+ return nullptr;
}
GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method) {
@@ -307,7 +307,7 @@ GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method, const StringName
GDMonoMethod *GDMonoClass::get_method(MonoMethod *p_raw_method, const StringName &p_name, int p_params_count) {
- ERR_FAIL_NULL_V(p_raw_method, NULL);
+ ERR_FAIL_NULL_V(p_raw_method, nullptr);
MethodKey key = MethodKey(p_name, p_params_count);
@@ -328,7 +328,7 @@ GDMonoMethod *GDMonoClass::get_method_with_desc(const String &p_description, boo
MonoMethod *method = mono_method_desc_search_in_class(desc, mono_class);
mono_method_desc_free(desc);
- ERR_FAIL_COND_V(mono_method_get_class(method) != mono_class, NULL);
+ ERR_FAIL_COND_V(mono_method_get_class(method) != mono_class, nullptr);
return get_method(method);
}
@@ -341,7 +341,7 @@ GDMonoField *GDMonoClass::get_field(const StringName &p_name) {
return result->value();
if (fields_fetched)
- return NULL;
+ return nullptr;
MonoClassField *raw_field = mono_class_get_field_from_name(mono_class, String(p_name).utf8().get_data());
@@ -352,7 +352,7 @@ GDMonoField *GDMonoClass::get_field(const StringName &p_name) {
return field;
}
- return NULL;
+ return nullptr;
}
const Vector<GDMonoField *> &GDMonoClass::get_all_fields() {
@@ -360,9 +360,9 @@ const Vector<GDMonoField *> &GDMonoClass::get_all_fields() {
if (fields_fetched)
return fields_list;
- void *iter = NULL;
- MonoClassField *raw_field = NULL;
- while ((raw_field = mono_class_get_fields(mono_class, &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoClassField *raw_field = nullptr;
+ while ((raw_field = mono_class_get_fields(mono_class, &iter)) != nullptr) {
StringName name = mono_field_get_name(raw_field);
Map<StringName, GDMonoField *>::Element *match = fields.find(name);
@@ -389,7 +389,7 @@ GDMonoProperty *GDMonoClass::get_property(const StringName &p_name) {
return result->value();
if (properties_fetched)
- return NULL;
+ return nullptr;
MonoProperty *raw_property = mono_class_get_property_from_name(mono_class, String(p_name).utf8().get_data());
@@ -400,7 +400,7 @@ GDMonoProperty *GDMonoClass::get_property(const StringName &p_name) {
return property;
}
- return NULL;
+ return nullptr;
}
const Vector<GDMonoProperty *> &GDMonoClass::get_all_properties() {
@@ -408,9 +408,9 @@ const Vector<GDMonoProperty *> &GDMonoClass::get_all_properties() {
if (properties_fetched)
return properties_list;
- void *iter = NULL;
- MonoProperty *raw_property = NULL;
- while ((raw_property = mono_class_get_properties(mono_class, &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoProperty *raw_property = nullptr;
+ while ((raw_property = mono_class_get_properties(mono_class, &iter)) != nullptr) {
StringName name = mono_property_get_name(raw_property);
Map<StringName, GDMonoProperty *>::Element *match = properties.find(name);
@@ -433,9 +433,9 @@ const Vector<GDMonoClass *> &GDMonoClass::get_all_delegates() {
if (delegates_fetched)
return delegates_list;
- void *iter = NULL;
- MonoClass *raw_class = NULL;
- while ((raw_class = mono_class_get_nested_types(mono_class, &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoClass *raw_class = nullptr;
+ while ((raw_class = mono_class_get_nested_types(mono_class, &iter)) != nullptr) {
if (mono_class_is_delegate(raw_class)) {
StringName name = mono_class_get_name(raw_class);
@@ -459,9 +459,9 @@ const Vector<GDMonoClass *> &GDMonoClass::get_all_delegates() {
const Vector<GDMonoMethod *> &GDMonoClass::get_all_methods() {
if (!method_list_fetched) {
- void *iter = NULL;
- MonoMethod *raw_method = NULL;
- while ((raw_method = mono_class_get_methods(get_mono_ptr(), &iter)) != NULL) {
+ void *iter = nullptr;
+ MonoMethod *raw_method = nullptr;
+ while ((raw_method = mono_class_get_methods(get_mono_ptr(), &iter)) != nullptr) {
method_list.push_back(memnew(GDMonoMethod(mono_method_get_name(raw_method), raw_method)));
}
@@ -479,7 +479,7 @@ GDMonoClass::GDMonoClass(const StringName &p_namespace, const StringName &p_name
assembly = p_assembly;
attrs_fetched = false;
- attributes = NULL;
+ attributes = nullptr;
methods_fetched = false;
method_list_fetched = false;
@@ -512,7 +512,7 @@ GDMonoClass::~GDMonoClass() {
Vector<GDMonoMethod *> deleted_methods;
deleted_methods.resize(methods.size());
- const MethodKey *k = NULL;
+ const MethodKey *k = nullptr;
while ((k = methods.next(k))) {
GDMonoMethod *method = methods.get(*k);
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 11942c47d9..3f4e5fe5ac 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -116,7 +116,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
case MONO_TYPE_STRING: {
if (p_value.get_type() == Variant::NIL) {
// Otherwise, Variant -> String would return the string "Null"
- MonoString *mono_string = NULL;
+ MonoString *mono_string = nullptr;
mono_field_set_value(p_object, mono_field, mono_string);
} else {
MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value);
@@ -623,19 +623,19 @@ bool GDMonoField::has_attribute(GDMonoClass *p_attr_class) {
}
MonoObject *GDMonoField::get_attribute(GDMonoClass *p_attr_class) {
- ERR_FAIL_NULL_V(p_attr_class, NULL);
+ ERR_FAIL_NULL_V(p_attr_class, nullptr);
if (!attrs_fetched)
fetch_attributes();
if (!attributes)
- return NULL;
+ return nullptr;
return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr());
}
void GDMonoField::fetch_attributes() {
- ERR_FAIL_COND(attributes != NULL);
+ ERR_FAIL_COND(attributes != nullptr);
attributes = mono_custom_attrs_from_field(owner->get_mono_ptr(), mono_field);
attrs_fetched = true;
}
@@ -671,7 +671,7 @@ GDMonoField::GDMonoField(MonoClassField *p_mono_field, GDMonoClass *p_owner) {
type.type_class = GDMono::get_singleton()->get_class(field_type_class);
attrs_fetched = false;
- attributes = NULL;
+ attributes = nullptr;
}
GDMonoField::~GDMonoField() {
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index 53e642f317..1898785699 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -61,7 +61,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
GDMonoClass *native = GDMonoUtils::get_class_native_base(klass);
- CRASH_COND(native == NULL);
+ CRASH_COND(native == nullptr);
if (native == klass) {
// If it's just a wrapper Godot class and not a custom inheriting class, then attach a
@@ -119,7 +119,7 @@ void unhandled_exception(MonoException *p_exc) {
if (GDMono::get_singleton()->get_unhandled_exception_policy() == GDMono::POLICY_TERMINATE_APP) {
// Too bad 'mono_invoke_unhandled_exception_hook' is not exposed to embedders
- GDMono::unhandled_exception_hook((MonoObject *)p_exc, NULL);
+ GDMono::unhandled_exception_hook((MonoObject *)p_exc, nullptr);
GD_UNREACHABLE();
} else {
#ifdef DEBUG_ENABLED
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index 76828a66e0..ca16c2b76a 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -46,13 +46,13 @@ static CharString get_default_log_level() {
#endif
}
-GDMonoLog *GDMonoLog::singleton = NULL;
+GDMonoLog *GDMonoLog::singleton = nullptr;
-#if !defined(JAVASCRIPT_ENABLED)
+#ifdef GD_MONO_LOG_ENABLED
static int get_log_level_id(const char *p_log_level) {
- const char *valid_log_levels[] = { "error", "critical", "warning", "message", "info", "debug", NULL };
+ const char *valid_log_levels[] = { "error", "critical", "warning", "message", "info", "debug", nullptr };
int i = 0;
while (valid_log_levels[i]) {
@@ -191,7 +191,7 @@ GDMonoLog::GDMonoLog() {
GDMonoLog::~GDMonoLog() {
- singleton = NULL;
+ singleton = nullptr;
if (log_file) {
log_file->close();
@@ -213,7 +213,7 @@ GDMonoLog::GDMonoLog() {
GDMonoLog::~GDMonoLog() {
- singleton = NULL;
+ singleton = nullptr;
}
#endif // !defined(JAVASCRIPT_ENABLED)
diff --git a/modules/mono/mono_gd/gd_mono_log.h b/modules/mono/mono_gd/gd_mono_log.h
index ecf4c78b1a..1fc21f7df5 100644
--- a/modules/mono/mono_gd/gd_mono_log.h
+++ b/modules/mono/mono_gd/gd_mono_log.h
@@ -35,13 +35,18 @@
#include "core/typedefs.h"
-#if !defined(JAVASCRIPT_ENABLED)
+#if !defined(JAVASCRIPT_ENABLED) && !defined(IPHONE_ENABLED)
+// We have custom mono log callbacks for WASM and iOS
+#define GD_MONO_LOG_ENABLED
+#endif
+
+#ifdef GD_MONO_LOG_ENABLED
#include "core/os/file_access.h"
#endif
class GDMonoLog {
-#if !defined(JAVASCRIPT_ENABLED)
+#ifdef GD_MONO_LOG_ENABLED
int log_level_id;
FileAccess *log_file;
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 0de5352752..1878038f44 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -410,7 +410,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
case MONO_TYPE_STRING: {
if (p_var->get_type() == Variant::NIL)
- return NULL; // Otherwise, Variant -> String would return the string "Null"
+ return nullptr; // Otherwise, Variant -> String would return the string "Null"
return (MonoObject *)mono_string_from_godot(p_var->operator String());
} break;
@@ -537,7 +537,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
return BOX_ENUM(enum_baseclass, val);
}
default: {
- ERR_FAIL_V_MSG(NULL, "Attempted to convert Variant to a managed enum value of unmarshallable base type.");
+ ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to a managed enum value of unmarshallable base type.");
}
}
}
@@ -577,7 +577,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
if (array_type->eklass == CACHED_CLASS_RAW(Color))
return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray());
- ERR_FAIL_V_MSG(NULL, "Attempted to convert Variant to a managed array of unmarshallable element type.");
+ ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to a managed array of unmarshallable element type.");
} break;
case MONO_TYPE_CLASS: {
@@ -749,7 +749,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
case Variant::PACKED_COLOR_ARRAY:
return (MonoObject *)PackedColorArray_to_mono_array(p_var->operator PackedColorArray());
default:
- return NULL;
+ return nullptr;
}
break;
case MONO_TYPE_GENERICINST: {
@@ -792,8 +792,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
} break;
}
- ERR_FAIL_V_MSG(NULL, "Attempted to convert Variant to an unmarshallable managed type. Name: '" +
- p_type.type_class->get_name() + "' Encoding: " + itos(p_type.type_encoding) + ".");
+ ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to an unmarshallable managed type. Name: '" +
+ p_type.type_class->get_name() + "' Encoding: " + itos(p_type.type_encoding) + ".");
}
Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type, bool p_fail_with_err = true) {
@@ -831,7 +831,7 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
return unbox<double>(p_obj);
case MONO_TYPE_STRING: {
- if (p_obj == NULL)
+ if (p_obj == nullptr)
return Variant(); // NIL
return mono_string_to_godot_not_null((MonoString *)p_obj);
} break;
@@ -935,7 +935,7 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
// GodotObject
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
Object *ptr = unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_obj));
- if (ptr != NULL) {
+ if (ptr != nullptr) {
Reference *ref = Object::cast_to<Reference>(ptr);
return ref ? Variant(Ref<Reference>(ref)) : Variant(ptr);
}
@@ -958,14 +958,14 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
}
if (CACHED_CLASS(Array) == type_class) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
Array *ptr = CACHED_METHOD_THUNK(Array, GetPtr).invoke(p_obj, &exc);
UNHANDLED_EXCEPTION(exc);
return ptr ? Variant(*ptr) : Variant();
}
if (CACHED_CLASS(Dictionary) == type_class) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
Dictionary *ptr = CACHED_METHOD_THUNK(Dictionary, GetPtr).invoke(p_obj, &exc);
UNHANDLED_EXCEPTION(exc);
return ptr ? Variant(*ptr) : Variant();
@@ -996,14 +996,14 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
MonoReflectionType *reftype = mono_type_get_object(mono_domain_get(), p_type.type_class->get_mono_type());
if (GDMonoUtils::Marshal::type_is_generic_dictionary(reftype)) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret = p_type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNHANDLED_EXCEPTION(exc);
return *unbox<Dictionary *>(ret);
}
if (GDMonoUtils::Marshal::type_is_generic_array(reftype)) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret = p_type.type_class->get_method("GetPtr")->invoke(p_obj, &exc);
UNHANDLED_EXCEPTION(exc);
return *unbox<Array *>(ret);
@@ -1064,9 +1064,9 @@ String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc) {
ManagedType type = ManagedType::from_class(mono_object_get_class(p_obj));
Variant var = GDMonoMarshal::mono_object_to_variant_no_err(p_obj, type);
- if (var.get_type() == Variant::NIL && p_obj != NULL) {
+ if (var.get_type() == Variant::NIL && p_obj != nullptr) {
// Cannot convert MonoObject* to Variant; fallback to 'ToString()'.
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoString *mono_str = GDMonoUtils::object_to_string(p_obj, &exc);
if (exc) {
@@ -1393,7 +1393,7 @@ Callable managed_to_callable(const M_Callable &p_managed_callable) {
} else {
Object *target = p_managed_callable.target ?
unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_callable.target)) :
- NULL;
+ nullptr;
StringName *method_ptr = unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_callable.method_string_name));
StringName method = method_ptr ? *method_ptr : StringName();
return Callable(target, method);
@@ -1408,7 +1408,7 @@ M_Callable callable_to_managed(const Callable &p_callable) {
if (compare_equal_func == ManagedCallable::compare_equal_func_ptr) {
ManagedCallable *managed_callable = static_cast<ManagedCallable *>(custom);
return {
- NULL, NULL,
+ nullptr, nullptr,
managed_callable->get_delegate()
};
} else if (compare_equal_func == SignalAwaiterCallable::compare_equal_func_ptr) {
@@ -1416,30 +1416,30 @@ M_Callable callable_to_managed(const Callable &p_callable) {
return {
GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(signal_awaiter_callable->get_object())),
GDMonoUtils::create_managed_from(signal_awaiter_callable->get_signal()),
- NULL
+ nullptr
};
} else if (compare_equal_func == EventSignalCallable::compare_equal_func_ptr) {
EventSignalCallable *event_signal_callable = static_cast<EventSignalCallable *>(custom);
return {
GDMonoUtils::unmanaged_get_managed(ObjectDB::get_instance(event_signal_callable->get_object())),
GDMonoUtils::create_managed_from(event_signal_callable->get_signal()),
- NULL
+ nullptr
};
}
// Some other CallableCustom. We only support ManagedCallable.
- return { NULL, NULL, NULL };
+ return { nullptr, nullptr, nullptr };
} else {
MonoObject *target_managed = GDMonoUtils::unmanaged_get_managed(p_callable.get_object());
MonoObject *method_string_name_managed = GDMonoUtils::create_managed_from(p_callable.get_method());
- return { target_managed, method_string_name_managed, NULL };
+ return { target_managed, method_string_name_managed, nullptr };
}
}
Signal managed_to_signal_info(const M_SignalInfo &p_managed_signal) {
Object *owner = p_managed_signal.owner ?
unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_signal.owner)) :
- NULL;
+ nullptr;
StringName *name_ptr = unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_signal.name_string_name));
StringName name = name_ptr ? *name_ptr : StringName();
return Signal(owner, name);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 7d09f46b00..8b405291a7 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -63,7 +63,7 @@ T *unbox_addr(MonoObject *p_obj) {
#define BOX_PTR(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(IntPtr), x)
#define BOX_ENUM(m_enum_class, x) mono_value_box(mono_domain_get(), m_enum_class, &x)
-Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_variant = NULL);
+Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_variant = nullptr);
bool try_get_array_element_type(const ManagedType &p_array_type, ManagedType &r_elem_type);
bool try_get_dictionary_key_value_types(const ManagedType &p_dictionary_type, ManagedType &r_key_type, ManagedType &r_value_type);
@@ -81,7 +81,7 @@ _FORCE_INLINE_ String mono_string_to_godot_not_null(MonoString *p_mono_string) {
}
_FORCE_INLINE_ String mono_string_to_godot(MonoString *p_mono_string) {
- if (p_mono_string == NULL)
+ if (p_mono_string == nullptr)
return String();
return mono_string_to_godot_not_null(p_mono_string);
diff --git a/modules/mono/mono_gd/gd_mono_method.cpp b/modules/mono/mono_gd/gd_mono_method.cpp
index e6a1ec2697..c8cc5247c6 100644
--- a/modules/mono/mono_gd/gd_mono_method.cpp
+++ b/modules/mono/mono_gd/gd_mono_method.cpp
@@ -58,9 +58,9 @@ void GDMonoMethod::_update_signature(MonoMethodSignature *p_method_sig) {
}
}
- void *iter = NULL;
+ void *iter = nullptr;
MonoType *param_raw_type;
- while ((param_raw_type = mono_signature_get_params(p_method_sig, &iter)) != NULL) {
+ while ((param_raw_type = mono_signature_get_params(p_method_sig, &iter)) != nullptr) {
ManagedType param_type;
param_type.type_encoding = mono_type_get_type(param_raw_type);
@@ -81,11 +81,11 @@ GDMonoClass *GDMonoMethod::get_enclosing_class() const {
}
bool GDMonoMethod::is_static() {
- return mono_method_get_flags(mono_method, NULL) & MONO_METHOD_ATTR_STATIC;
+ return mono_method_get_flags(mono_method, nullptr) & MONO_METHOD_ATTR_STATIC;
}
IMonoClassMember::Visibility GDMonoMethod::get_visibility() {
- switch (mono_method_get_flags(mono_method, NULL) & MONO_METHOD_ATTR_ACCESS_MASK) {
+ switch (mono_method_get_flags(mono_method, nullptr) & MONO_METHOD_ATTR_ACCESS_MASK) {
case MONO_METHOD_ATTR_PRIVATE:
return IMonoClassMember::PRIVATE;
case MONO_METHOD_ATTR_FAM_AND_ASSEM:
@@ -102,7 +102,7 @@ IMonoClassMember::Visibility GDMonoMethod::get_visibility() {
}
MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params, MonoException **r_exc) const {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret;
if (params_count > 0) {
@@ -115,11 +115,11 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params,
ret = GDMonoUtils::runtime_invoke_array(mono_method, p_object, params, &exc);
} else {
- ret = GDMonoUtils::runtime_invoke(mono_method, p_object, NULL, &exc);
+ ret = GDMonoUtils::runtime_invoke(mono_method, p_object, nullptr, &exc);
}
if (exc) {
- ret = NULL;
+ ret = nullptr;
if (r_exc) {
*r_exc = exc;
} else {
@@ -131,16 +131,16 @@ MonoObject *GDMonoMethod::invoke(MonoObject *p_object, const Variant **p_params,
}
MonoObject *GDMonoMethod::invoke(MonoObject *p_object, MonoException **r_exc) const {
- ERR_FAIL_COND_V(get_parameters_count() > 0, NULL);
- return invoke_raw(p_object, NULL, r_exc);
+ ERR_FAIL_COND_V(get_parameters_count() > 0, nullptr);
+ return invoke_raw(p_object, nullptr, r_exc);
}
MonoObject *GDMonoMethod::invoke_raw(MonoObject *p_object, void **p_params, MonoException **r_exc) const {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoObject *ret = GDMonoUtils::runtime_invoke(mono_method, p_object, p_params, &exc);
if (exc) {
- ret = NULL;
+ ret = nullptr;
if (r_exc) {
*r_exc = exc;
} else {
@@ -164,19 +164,19 @@ bool GDMonoMethod::has_attribute(GDMonoClass *p_attr_class) {
}
MonoObject *GDMonoMethod::get_attribute(GDMonoClass *p_attr_class) {
- ERR_FAIL_NULL_V(p_attr_class, NULL);
+ ERR_FAIL_NULL_V(p_attr_class, nullptr);
if (!attrs_fetched)
fetch_attributes();
if (!attributes)
- return NULL;
+ return nullptr;
return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr());
}
void GDMonoMethod::fetch_attributes() {
- ERR_FAIL_COND(attributes != NULL);
+ ERR_FAIL_COND(attributes != nullptr);
attributes = mono_custom_attrs_from_method(mono_method);
attrs_fetched = true;
}
@@ -281,7 +281,7 @@ GDMonoMethod::GDMonoMethod(StringName p_name, MonoMethod *p_method) {
method_info_fetched = false;
attrs_fetched = false;
- attributes = NULL;
+ attributes = nullptr;
_update_signature();
}
diff --git a/modules/mono/mono_gd/gd_mono_method.h b/modules/mono/mono_gd/gd_mono_method.h
index d4379f41fe..54b2eba3e8 100644
--- a/modules/mono/mono_gd/gd_mono_method.h
+++ b/modules/mono/mono_gd/gd_mono_method.h
@@ -76,9 +76,9 @@ public:
_FORCE_INLINE_ int get_parameters_count() const { return params_count; }
_FORCE_INLINE_ ManagedType get_return_type() const { return return_type; }
- MonoObject *invoke(MonoObject *p_object, const Variant **p_params, MonoException **r_exc = NULL) const;
- MonoObject *invoke(MonoObject *p_object, MonoException **r_exc = NULL) const;
- MonoObject *invoke_raw(MonoObject *p_object, void **p_params, MonoException **r_exc = NULL) const;
+ MonoObject *invoke(MonoObject *p_object, const Variant **p_params, MonoException **r_exc = nullptr) const;
+ MonoObject *invoke(MonoObject *p_object, MonoException **r_exc = nullptr) const;
+ MonoObject *invoke_raw(MonoObject *p_object, void **p_params, MonoException **r_exc = nullptr) const;
String get_full_name(bool p_signature = false) const;
String get_full_name_no_class() const;
diff --git a/modules/mono/mono_gd/gd_mono_method_thunk.h b/modules/mono/mono_gd/gd_mono_method_thunk.h
index d8c9a5eb02..0e05e974e9 100644
--- a/modules/mono/mono_gd/gd_mono_method_thunk.h
+++ b/modules/mono/mono_gd/gd_mono_method_thunk.h
@@ -39,7 +39,7 @@
#include "gd_mono_method.h"
#include "gd_mono_utils.h"
-#if !defined(JAVASCRIPT_ENABLED)
+#if !defined(JAVASCRIPT_ENABLED) && !defined(IPHONE_ENABLED)
#define HAVE_METHOD_THUNKS
#endif
@@ -60,16 +60,16 @@ public:
}
_FORCE_INLINE_ bool is_null() {
- return mono_method_thunk == NULL;
+ return mono_method_thunk == nullptr;
}
_FORCE_INLINE_ void nullify() {
- mono_method_thunk = NULL;
+ mono_method_thunk = nullptr;
}
_FORCE_INLINE_ void set_from_method(GDMonoMethod *p_mono_method) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_mono_method == NULL);
+ CRASH_COND(p_mono_method == nullptr);
CRASH_COND(p_mono_method->get_return_type().type_encoding != MONO_TYPE_VOID);
if (p_mono_method->is_static()) {
@@ -82,7 +82,7 @@ public:
}
GDMonoMethodThunk() :
- mono_method_thunk(NULL) {
+ mono_method_thunk(nullptr) {
}
explicit GDMonoMethodThunk(GDMonoMethod *p_mono_method) {
@@ -106,16 +106,16 @@ public:
}
_FORCE_INLINE_ bool is_null() {
- return mono_method_thunk == NULL;
+ return mono_method_thunk == nullptr;
}
_FORCE_INLINE_ void nullify() {
- mono_method_thunk = NULL;
+ mono_method_thunk = nullptr;
}
_FORCE_INLINE_ void set_from_method(GDMonoMethod *p_mono_method) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_mono_method == NULL);
+ CRASH_COND(p_mono_method == nullptr);
CRASH_COND(p_mono_method->get_return_type().type_encoding == MONO_TYPE_VOID);
if (p_mono_method->is_static()) {
@@ -128,12 +128,12 @@ public:
}
GDMonoMethodThunkR() :
- mono_method_thunk(NULL) {
+ mono_method_thunk(nullptr) {
}
explicit GDMonoMethodThunkR(GDMonoMethod *p_mono_method) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_mono_method == NULL);
+ CRASH_COND(p_mono_method == nullptr);
#endif
mono_method_thunk = (M)mono_method_get_unmanaged_thunk(p_mono_method->get_mono_ptr());
}
@@ -146,7 +146,7 @@ struct VariadicInvokeMonoMethodImpl {
static void invoke(GDMonoMethod *p_mono_method, P1 p_arg1, ParamTypes... p_args, MonoException **r_exc) {
if (p_mono_method->is_static()) {
void *args[ThunkParamCount] = { p_arg1, p_args... };
- p_mono_method->invoke_raw(NULL, args, r_exc);
+ p_mono_method->invoke_raw(nullptr, args, r_exc);
} else {
void *args[ThunkParamCount] = { p_args... };
p_mono_method->invoke_raw((MonoObject *)p_arg1, args, r_exc);
@@ -167,7 +167,7 @@ struct VariadicInvokeMonoMethod<0> {
#ifdef DEBUG_ENABLED
CRASH_COND(!p_mono_method->is_static());
#endif
- p_mono_method->invoke_raw(NULL, NULL, r_exc);
+ p_mono_method->invoke_raw(nullptr, nullptr, r_exc);
}
};
@@ -176,9 +176,9 @@ struct VariadicInvokeMonoMethod<1, P1> {
static void invoke(GDMonoMethod *p_mono_method, P1 p_arg1, MonoException **r_exc) {
if (p_mono_method->is_static()) {
void *args[1] = { p_arg1 };
- p_mono_method->invoke_raw(NULL, args, r_exc);
+ p_mono_method->invoke_raw(nullptr, args, r_exc);
} else {
- p_mono_method->invoke_raw((MonoObject *)p_arg1, NULL, r_exc);
+ p_mono_method->invoke_raw((MonoObject *)p_arg1, nullptr, r_exc);
}
}
};
@@ -203,7 +203,7 @@ struct VariadicInvokeMonoMethodRImpl {
static R invoke(GDMonoMethod *p_mono_method, P1 p_arg1, ParamTypes... p_args, MonoException **r_exc) {
if (p_mono_method->is_static()) {
void *args[ThunkParamCount] = { p_arg1, p_args... };
- MonoObject *r = p_mono_method->invoke_raw(NULL, args, r_exc);
+ MonoObject *r = p_mono_method->invoke_raw(nullptr, args, r_exc);
return unbox_if_needed<R>(r, p_mono_method->get_return_type());
} else {
void *args[ThunkParamCount] = { p_args... };
@@ -226,7 +226,7 @@ struct VariadicInvokeMonoMethodR<0, R> {
#ifdef DEBUG_ENABLED
CRASH_COND(!p_mono_method->is_static());
#endif
- MonoObject *r = p_mono_method->invoke_raw(NULL, NULL, r_exc);
+ MonoObject *r = p_mono_method->invoke_raw(nullptr, nullptr, r_exc);
return unbox_if_needed<R>(r, p_mono_method->get_return_type());
}
};
@@ -236,10 +236,10 @@ struct VariadicInvokeMonoMethodR<1, R, P1> {
static R invoke(GDMonoMethod *p_mono_method, P1 p_arg1, MonoException **r_exc) {
if (p_mono_method->is_static()) {
void *args[1] = { p_arg1 };
- MonoObject *r = p_mono_method->invoke_raw(NULL, args, r_exc);
+ MonoObject *r = p_mono_method->invoke_raw(nullptr, args, r_exc);
return unbox_if_needed<R>(r, p_mono_method->get_return_type());
} else {
- MonoObject *r = p_mono_method->invoke_raw((MonoObject *)p_arg1, NULL, r_exc);
+ MonoObject *r = p_mono_method->invoke_raw((MonoObject *)p_arg1, nullptr, r_exc);
return unbox_if_needed<R>(r, p_mono_method->get_return_type());
}
}
@@ -256,16 +256,16 @@ public:
}
_FORCE_INLINE_ bool is_null() {
- return mono_method == NULL;
+ return mono_method == nullptr;
}
_FORCE_INLINE_ void nullify() {
- mono_method = NULL;
+ mono_method = nullptr;
}
_FORCE_INLINE_ void set_from_method(GDMonoMethod *p_mono_method) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_mono_method == NULL);
+ CRASH_COND(p_mono_method == nullptr);
CRASH_COND(p_mono_method->get_return_type().type_encoding != MONO_TYPE_VOID);
if (p_mono_method->is_static()) {
@@ -278,7 +278,7 @@ public:
}
GDMonoMethodThunk() :
- mono_method(NULL) {
+ mono_method(nullptr) {
}
explicit GDMonoMethodThunk(GDMonoMethod *p_mono_method) {
@@ -297,16 +297,16 @@ public:
}
_FORCE_INLINE_ bool is_null() {
- return mono_method == NULL;
+ return mono_method == nullptr;
}
_FORCE_INLINE_ void nullify() {
- mono_method = NULL;
+ mono_method = nullptr;
}
_FORCE_INLINE_ void set_from_method(GDMonoMethod *p_mono_method) {
#ifdef DEBUG_ENABLED
- CRASH_COND(p_mono_method == NULL);
+ CRASH_COND(p_mono_method == nullptr);
CRASH_COND(p_mono_method->get_return_type().type_encoding == MONO_TYPE_VOID);
if (p_mono_method->is_static()) {
@@ -319,7 +319,7 @@ public:
}
GDMonoMethodThunkR() :
- mono_method(NULL) {
+ mono_method(nullptr) {
}
explicit GDMonoMethodThunkR(GDMonoMethod *p_mono_method) {
diff --git a/modules/mono/mono_gd/gd_mono_property.cpp b/modules/mono/mono_gd/gd_mono_property.cpp
index 3b5ce58d80..c3e7598f2d 100644
--- a/modules/mono/mono_gd/gd_mono_property.cpp
+++ b/modules/mono/mono_gd/gd_mono_property.cpp
@@ -57,7 +57,7 @@ GDMonoProperty::GDMonoProperty(MonoProperty *p_mono_property, GDMonoClass *p_own
MonoMethodSignature *setter_sig = mono_method_signature(prop_method);
- void *iter = NULL;
+ void *iter = nullptr;
MonoType *param_raw_type = mono_signature_get_params(setter_sig, &iter);
type.type_encoding = mono_type_get_type(param_raw_type);
@@ -66,7 +66,7 @@ GDMonoProperty::GDMonoProperty(MonoProperty *p_mono_property, GDMonoClass *p_own
}
attrs_fetched = false;
- attributes = NULL;
+ attributes = nullptr;
}
GDMonoProperty::~GDMonoProperty() {
@@ -77,17 +77,17 @@ GDMonoProperty::~GDMonoProperty() {
bool GDMonoProperty::is_static() {
MonoMethod *prop_method = mono_property_get_get_method(mono_property);
- if (prop_method == NULL)
+ if (prop_method == nullptr)
prop_method = mono_property_get_set_method(mono_property);
- return mono_method_get_flags(prop_method, NULL) & MONO_METHOD_ATTR_STATIC;
+ return mono_method_get_flags(prop_method, nullptr) & MONO_METHOD_ATTR_STATIC;
}
IMonoClassMember::Visibility GDMonoProperty::get_visibility() {
MonoMethod *prop_method = mono_property_get_get_method(mono_property);
- if (prop_method == NULL)
+ if (prop_method == nullptr)
prop_method = mono_property_get_set_method(mono_property);
- switch (mono_method_get_flags(prop_method, NULL) & MONO_METHOD_ATTR_ACCESS_MASK) {
+ switch (mono_method_get_flags(prop_method, nullptr) & MONO_METHOD_ATTR_ACCESS_MASK) {
case MONO_METHOD_ATTR_PRIVATE:
return IMonoClassMember::PRIVATE;
case MONO_METHOD_ATTR_FAM_AND_ASSEM:
@@ -116,36 +116,36 @@ bool GDMonoProperty::has_attribute(GDMonoClass *p_attr_class) {
}
MonoObject *GDMonoProperty::get_attribute(GDMonoClass *p_attr_class) {
- ERR_FAIL_NULL_V(p_attr_class, NULL);
+ ERR_FAIL_NULL_V(p_attr_class, nullptr);
if (!attrs_fetched)
fetch_attributes();
if (!attributes)
- return NULL;
+ return nullptr;
return mono_custom_attrs_get_attr(attributes, p_attr_class->get_mono_ptr());
}
void GDMonoProperty::fetch_attributes() {
- ERR_FAIL_COND(attributes != NULL);
+ ERR_FAIL_COND(attributes != nullptr);
attributes = mono_custom_attrs_from_property(owner->get_mono_ptr(), mono_property);
attrs_fetched = true;
}
bool GDMonoProperty::has_getter() {
- return mono_property_get_get_method(mono_property) != NULL;
+ return mono_property_get_get_method(mono_property) != nullptr;
}
bool GDMonoProperty::has_setter() {
- return mono_property_get_set_method(mono_property) != NULL;
+ return mono_property_get_set_method(mono_property) != nullptr;
}
void GDMonoProperty::set_value(MonoObject *p_object, MonoObject *p_value, MonoException **r_exc) {
MonoMethod *prop_method = mono_property_get_set_method(mono_property);
MonoArray *params = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), 1);
mono_array_setref(params, 0, p_value);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::runtime_invoke_array(prop_method, p_object, params, &exc);
if (exc) {
if (r_exc) {
@@ -157,7 +157,7 @@ void GDMonoProperty::set_value(MonoObject *p_object, MonoObject *p_value, MonoEx
}
void GDMonoProperty::set_value(MonoObject *p_object, void **p_params, MonoException **r_exc) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::property_set_value(mono_property, p_object, p_params, &exc);
if (exc) {
@@ -170,11 +170,11 @@ void GDMonoProperty::set_value(MonoObject *p_object, void **p_params, MonoExcept
}
MonoObject *GDMonoProperty::get_value(MonoObject *p_object, MonoException **r_exc) {
- MonoException *exc = NULL;
- MonoObject *ret = GDMonoUtils::property_get_value(mono_property, p_object, NULL, &exc);
+ MonoException *exc = nullptr;
+ MonoObject *ret = GDMonoUtils::property_get_value(mono_property, p_object, nullptr, &exc);
if (exc) {
- ret = NULL;
+ ret = nullptr;
if (r_exc) {
*r_exc = exc;
} else {
diff --git a/modules/mono/mono_gd/gd_mono_property.h b/modules/mono/mono_gd/gd_mono_property.h
index 2aec64f565..4653758a86 100644
--- a/modules/mono/mono_gd/gd_mono_property.h
+++ b/modules/mono/mono_gd/gd_mono_property.h
@@ -65,9 +65,9 @@ public:
_FORCE_INLINE_ ManagedType get_type() const { return type; }
- void set_value(MonoObject *p_object, MonoObject *p_value, MonoException **r_exc = NULL);
- void set_value(MonoObject *p_object, void **p_params, MonoException **r_exc = NULL);
- MonoObject *get_value(MonoObject *p_object, MonoException **r_exc = NULL);
+ void set_value(MonoObject *p_object, MonoObject *p_value, MonoException **r_exc = nullptr);
+ void set_value(MonoObject *p_object, void **p_params, MonoException **r_exc = nullptr);
+ MonoObject *get_value(MonoObject *p_object, MonoException **r_exc = nullptr);
bool get_bool_value(MonoObject *p_object);
int get_int_value(MonoObject *p_object);
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index cdb26ae61b..00119ced88 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -57,7 +57,7 @@ namespace GDMonoUtils {
MonoObject *unmanaged_get_managed(Object *unmanaged) {
if (!unmanaged)
- return NULL;
+ return nullptr;
if (unmanaged->get_script_instance()) {
CSharpInstance *cs_instance = CAST_CSHARP_INSTANCE(unmanaged->get_script_instance());
@@ -71,7 +71,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
void *data = unmanaged->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
- ERR_FAIL_NULL_V(data, NULL);
+ ERR_FAIL_NULL_V(data, nullptr);
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->value();
@@ -82,7 +82,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
// Already had a binding that needs to be setup
CSharpLanguage::get_singleton()->setup_csharp_script_binding(script_binding, unmanaged);
- ERR_FAIL_COND_V(!script_binding.inited, NULL);
+ ERR_FAIL_COND_V(!script_binding.inited, nullptr);
}
}
@@ -99,11 +99,11 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
#ifdef DEBUG_ENABLED
CRASH_COND(script_binding.type_name == StringName());
- CRASH_COND(script_binding.wrapper_class == NULL);
+ CRASH_COND(script_binding.wrapper_class == nullptr);
#endif
MonoObject *mono_object = GDMonoUtils::create_managed_for_godot_object(script_binding.wrapper_class, script_binding.type_name, unmanaged);
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
gchandle = MonoGCHandleData::new_strong_handle(mono_object);
@@ -127,10 +127,15 @@ void set_main_thread(MonoThread *p_thread) {
}
MonoThread *attach_current_thread() {
- ERR_FAIL_COND_V(!GDMono::get_singleton()->is_runtime_initialized(), NULL);
+ ERR_FAIL_COND_V(!GDMono::get_singleton()->is_runtime_initialized(), nullptr);
MonoDomain *scripts_domain = GDMono::get_singleton()->get_scripts_domain();
+#ifndef GD_MONO_SINGLE_APPDOMAIN
MonoThread *mono_thread = mono_thread_attach(scripts_domain ? scripts_domain : mono_get_root_domain());
- ERR_FAIL_NULL_V(mono_thread, NULL);
+#else
+ // The scripts domain is the root domain
+ MonoThread *mono_thread = mono_thread_attach(scripts_domain);
+#endif
+ ERR_FAIL_NULL_V(mono_thread, nullptr);
return mono_thread;
}
@@ -152,7 +157,7 @@ MonoThread *get_current_thread() {
}
bool is_thread_attached() {
- return mono_domain_get() != NULL;
+ return mono_domain_get() != nullptr;
}
uint32_t new_strong_gchandle(MonoObject *p_object) {
@@ -174,11 +179,11 @@ void free_gchandle(uint32_t p_gchandle) {
void runtime_object_init(MonoObject *p_this_obj, GDMonoClass *p_class, MonoException **r_exc) {
GDMonoMethod *ctor = p_class->get_method(".ctor", 0);
ERR_FAIL_NULL(ctor);
- ctor->invoke_raw(p_this_obj, NULL, r_exc);
+ ctor->invoke_raw(p_this_obj, nullptr, r_exc);
}
bool mono_delegate_equal(MonoDelegate *p_a, MonoDelegate *p_b) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(Delegate, Equals).invoke((MonoObject *)p_a, (MonoObject *)p_b, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -221,18 +226,18 @@ GDMonoClass *get_class_native_base(GDMonoClass *p_class) {
if (assembly == GDMono::get_singleton()->get_editor_api_assembly())
return klass;
#endif
- } while ((klass = klass->get_parent_class()) != NULL);
+ } while ((klass = klass->get_parent_class()) != nullptr);
- return NULL;
+ return nullptr;
}
MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringName &p_native, Object *p_object) {
bool parent_is_object_class = ClassDB::is_parent_class(p_object->get_class_name(), p_native);
- ERR_FAIL_COND_V_MSG(!parent_is_object_class, NULL,
+ ERR_FAIL_COND_V_MSG(!parent_is_object_class, nullptr,
"Type inherits from native type '" + p_native + "', so it can't be instanced in object of type: '" + p_object->get_class() + "'.");
MonoObject *mono_object = mono_object_new(mono_domain_get(), p_class->get_mono_ptr());
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
CACHED_FIELD(GodotObject, ptr)->set_value_raw(mono_object, p_object);
@@ -244,7 +249,7 @@ MonoObject *create_managed_for_godot_object(GDMonoClass *p_class, const StringNa
MonoObject *create_managed_from(const StringName &p_from) {
MonoObject *mono_object = mono_object_new(mono_domain_get(), CACHED_CLASS_RAW(StringName));
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
// Construct
GDMonoUtils::runtime_object_init(mono_object, CACHED_CLASS(StringName));
@@ -256,7 +261,7 @@ MonoObject *create_managed_from(const StringName &p_from) {
MonoObject *create_managed_from(const NodePath &p_from) {
MonoObject *mono_object = mono_object_new(mono_domain_get(), CACHED_CLASS_RAW(NodePath));
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
// Construct
GDMonoUtils::runtime_object_init(mono_object, CACHED_CLASS(NodePath));
@@ -268,7 +273,7 @@ MonoObject *create_managed_from(const NodePath &p_from) {
MonoObject *create_managed_from(const RID &p_from) {
MonoObject *mono_object = mono_object_new(mono_domain_get(), CACHED_CLASS_RAW(RID));
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
// Construct
GDMonoUtils::runtime_object_init(mono_object, CACHED_CLASS(RID));
@@ -280,15 +285,15 @@ MonoObject *create_managed_from(const RID &p_from) {
MonoObject *create_managed_from(const Array &p_from, GDMonoClass *p_class) {
MonoObject *mono_object = mono_object_new(mono_domain_get(), p_class->get_mono_ptr());
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
// Search constructor that takes a pointer as parameter
MonoMethod *m;
- void *iter = NULL;
+ void *iter = nullptr;
while ((m = mono_class_get_methods(p_class->get_mono_ptr(), &iter))) {
if (strcmp(mono_method_get_name(m), ".ctor") == 0) {
MonoMethodSignature *sig = mono_method_signature(m);
- void *front = NULL;
+ void *front = nullptr;
if (mono_signature_get_param_count(sig) == 1 &&
mono_class_from_mono_type(mono_signature_get_params(sig, &front)) == CACHED_CLASS(IntPtr)->get_mono_ptr()) {
break;
@@ -296,12 +301,12 @@ MonoObject *create_managed_from(const Array &p_from, GDMonoClass *p_class) {
}
}
- CRASH_COND(m == NULL);
+ CRASH_COND(m == nullptr);
Array *new_array = memnew(Array(p_from));
void *args[1] = { &new_array };
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::runtime_invoke(m, mono_object, args, &exc);
UNHANDLED_EXCEPTION(exc);
@@ -310,15 +315,15 @@ MonoObject *create_managed_from(const Array &p_from, GDMonoClass *p_class) {
MonoObject *create_managed_from(const Dictionary &p_from, GDMonoClass *p_class) {
MonoObject *mono_object = mono_object_new(mono_domain_get(), p_class->get_mono_ptr());
- ERR_FAIL_NULL_V(mono_object, NULL);
+ ERR_FAIL_NULL_V(mono_object, nullptr);
// Search constructor that takes a pointer as parameter
MonoMethod *m;
- void *iter = NULL;
+ void *iter = nullptr;
while ((m = mono_class_get_methods(p_class->get_mono_ptr(), &iter))) {
if (strcmp(mono_method_get_name(m), ".ctor") == 0) {
MonoMethodSignature *sig = mono_method_signature(m);
- void *front = NULL;
+ void *front = nullptr;
if (mono_signature_get_param_count(sig) == 1 &&
mono_class_from_mono_type(mono_signature_get_params(sig, &front)) == CACHED_CLASS(IntPtr)->get_mono_ptr()) {
break;
@@ -326,12 +331,12 @@ MonoObject *create_managed_from(const Dictionary &p_from, GDMonoClass *p_class)
}
}
- CRASH_COND(m == NULL);
+ CRASH_COND(m == nullptr);
Dictionary *new_dict = memnew(Dictionary(p_from));
void *args[1] = { &new_dict };
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
GDMonoUtils::runtime_invoke(m, mono_object, args, &exc);
UNHANDLED_EXCEPTION(exc);
@@ -341,7 +346,7 @@ MonoObject *create_managed_from(const Dictionary &p_from, GDMonoClass *p_class)
MonoDomain *create_domain(const String &p_friendly_name) {
print_verbose("Mono: Creating domain '" + p_friendly_name + "'...");
- MonoDomain *domain = mono_domain_create_appdomain((char *)p_friendly_name.utf8().get_data(), NULL);
+ MonoDomain *domain = mono_domain_create_appdomain((char *)p_friendly_name.utf8().get_data(), nullptr);
if (domain) {
// Workaround to avoid this exception:
@@ -366,7 +371,7 @@ String get_exception_name_and_message(MonoException *p_exc) {
res += ": ";
MonoProperty *prop = mono_class_get_property_from_name(klass, "Message");
- MonoString *msg = (MonoString *)property_get_value(prop, (MonoObject *)p_exc, NULL, NULL);
+ MonoString *msg = (MonoString *)property_get_value(prop, (MonoObject *)p_exc, nullptr, nullptr);
res += GDMonoMarshal::mono_string_to_godot(msg);
return res;
@@ -377,7 +382,7 @@ void set_exception_message(MonoException *p_exc, String message) {
MonoProperty *prop = mono_class_get_property_from_name(klass, "Message");
MonoString *msg = GDMonoMarshal::mono_string_from_godot(message);
void *params[1] = { msg };
- property_set_value(prop, (MonoObject *)p_exc, params, NULL);
+ property_set_value(prop, (MonoObject *)p_exc, params, nullptr);
}
void debug_print_unhandled_exception(MonoException *p_exc) {
@@ -410,14 +415,14 @@ void debug_send_unhandled_exception_error(MonoException *p_exc) {
Vector<ScriptLanguage::StackInfo> si;
String exc_msg;
- while (p_exc != NULL) {
+ while (p_exc != nullptr) {
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 };
- MonoException *unexpected_exc = NULL;
+ MonoException *unexpected_exc = nullptr;
CACHED_METHOD(System_Diagnostics_StackTrace, ctor_Exception_bool)->invoke_raw(stack_trace, ctor_args, &unexpected_exc);
if (unexpected_exc) {
@@ -426,7 +431,7 @@ void debug_send_unhandled_exception_error(MonoException *p_exc) {
}
Vector<ScriptLanguage::StackInfo> _si;
- if (stack_trace != NULL) {
+ if (stack_trace != nullptr) {
_si = CSharpLanguage::get_singleton()->stack_trace_get_info(stack_trace);
for (int i = _si.size() - 1; i >= 0; i--)
si.insert(0, _si[i]);
@@ -436,10 +441,10 @@ void debug_send_unhandled_exception_error(MonoException *p_exc) {
GDMonoClass *exc_class = GDMono::get_singleton()->get_class(mono_get_exception_class());
GDMonoProperty *inner_exc_prop = exc_class->get_property("InnerException");
- CRASH_COND(inner_exc_prop == NULL);
+ CRASH_COND(inner_exc_prop == nullptr);
MonoObject *inner_exc = inner_exc_prop->get_value((MonoObject *)p_exc);
- if (inner_exc != NULL)
+ if (inner_exc != nullptr)
si.insert(0, separator);
p_exc = (MonoException *)inner_exc;
@@ -565,7 +570,7 @@ namespace Marshal {
bool type_is_generic_array(MonoReflectionType *p_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericArray).invoke(p_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -573,27 +578,27 @@ bool type_is_generic_array(MonoReflectionType *p_reftype) {
bool type_is_generic_dictionary(MonoReflectionType *p_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, TypeIsGenericDictionary).invoke(p_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
}
void array_get_element_type(MonoReflectionType *p_array_reftype, MonoReflectionType **r_elem_reftype) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, ArrayGetElementType).invoke(p_array_reftype, r_elem_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
}
void dictionary_get_key_value_types(MonoReflectionType *p_dict_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype) {
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, DictionaryGetKeyValueTypes).invoke(p_dict_reftype, r_key_reftype, r_value_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
}
bool generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, GenericIEnumerableIsAssignableFromType).invoke(p_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -601,7 +606,7 @@ bool generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype) {
bool generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryIsAssignableFromType).invoke(p_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -609,7 +614,7 @@ bool generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype) {
bool generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_elem_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, GenericIEnumerableIsAssignableFromType_with_info).invoke(p_reftype, r_elem_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -617,7 +622,7 @@ bool generic_ienumerable_is_assignable_from(MonoReflectionType *p_reftype, MonoR
bool generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype) {
NO_GLUE_RET(false);
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
MonoBoolean res = CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryIsAssignableFromType_with_info).invoke(p_reftype, r_key_reftype, r_value_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return (bool)res;
@@ -626,7 +631,7 @@ bool generic_idictionary_is_assignable_from(MonoReflectionType *p_reftype, MonoR
Array enumerable_to_array(MonoObject *p_enumerable) {
NO_GLUE_RET(Array());
Array result;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, EnumerableToArray).invoke(p_enumerable, &result, &exc);
UNHANDLED_EXCEPTION(exc);
return result;
@@ -635,7 +640,7 @@ Array enumerable_to_array(MonoObject *p_enumerable) {
Dictionary idictionary_to_dictionary(MonoObject *p_idictionary) {
NO_GLUE_RET(Dictionary());
Dictionary result;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, IDictionaryToDictionary).invoke(p_idictionary, &result, &exc);
UNHANDLED_EXCEPTION(exc);
return result;
@@ -644,23 +649,23 @@ Dictionary idictionary_to_dictionary(MonoObject *p_idictionary) {
Dictionary generic_idictionary_to_dictionary(MonoObject *p_generic_idictionary) {
NO_GLUE_RET(Dictionary());
Dictionary result;
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, GenericIDictionaryToDictionary).invoke(p_generic_idictionary, &result, &exc);
UNHANDLED_EXCEPTION(exc);
return result;
}
GDMonoClass *make_generic_array_type(MonoReflectionType *p_elem_reftype) {
- NO_GLUE_RET(NULL);
- MonoException *exc = NULL;
+ NO_GLUE_RET(nullptr);
+ MonoException *exc = nullptr;
MonoReflectionType *reftype = CACHED_METHOD_THUNK(MarshalUtils, MakeGenericArrayType).invoke(p_elem_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return GDMono::get_singleton()->get_class(mono_class_from_mono_type(mono_reflection_type_get_type(reftype)));
}
GDMonoClass *make_generic_dictionary_type(MonoReflectionType *p_key_reftype, MonoReflectionType *p_value_reftype) {
- NO_GLUE_RET(NULL);
- MonoException *exc = NULL;
+ NO_GLUE_RET(nullptr);
+ MonoException *exc = nullptr;
MonoReflectionType *reftype = CACHED_METHOD_THUNK(MarshalUtils, MakeGenericDictionaryType).invoke(p_key_reftype, p_value_reftype, &exc);
UNHANDLED_EXCEPTION(exc);
return GDMono::get_singleton()->get_class(mono_class_from_mono_type(mono_reflection_type_get_type(reftype)));
@@ -669,7 +674,7 @@ GDMonoClass *make_generic_dictionary_type(MonoReflectionType *p_key_reftype, Mon
} // namespace Marshal
ScopeThreadAttach::ScopeThreadAttach() :
- mono_thread(NULL) {
+ mono_thread(nullptr) {
if (likely(GDMono::get_singleton()->is_runtime_initialized()) && unlikely(!mono_domain_get())) {
mono_thread = GDMonoUtils::attach_current_thread();
}
@@ -682,7 +687,7 @@ ScopeThreadAttach::~ScopeThreadAttach() {
}
StringName get_native_godot_class_name(GDMonoClass *p_class) {
- MonoObject *native_name_obj = p_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL);
+ MonoObject *native_name_obj = p_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(nullptr);
StringName *ptr = GDMonoMarshal::unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(native_name_obj));
return ptr ? *ptr : StringName();
}
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index fd02907d87..b850e1be9b 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -41,7 +41,7 @@
#include "core/reference.h"
#define UNHANDLED_EXCEPTION(m_exc) \
- if (unlikely(m_exc != NULL)) { \
+ if (unlikely(m_exc != nullptr)) { \
GDMonoUtils::debug_unhandled_exception(m_exc); \
GD_UNREACHABLE(); \
}
@@ -77,7 +77,7 @@ _FORCE_INLINE_ void hash_combine(uint32_t &p_hash, const uint32_t &p_with_hash)
/**
* If the object has a csharp script, returns the target of the gchandle stored in the script instance
* Otherwise returns a newly constructed MonoObject* which is attached to the object
- * Returns NULL on error
+ * Returns nullptr on error
*/
MonoObject *unmanaged_get_managed(Object *unmanaged);
@@ -89,7 +89,7 @@ MonoThread *get_current_thread();
bool is_thread_attached();
_FORCE_INLINE_ bool is_main_thread() {
- return mono_domain_get() != NULL && mono_thread_get_main() == mono_thread_current();
+ return mono_domain_get() != nullptr && mono_thread_get_main() == mono_thread_current();
}
uint32_t new_strong_gchandle(MonoObject *p_object);
@@ -97,7 +97,7 @@ uint32_t new_strong_gchandle_pinned(MonoObject *p_object);
uint32_t new_weak_gchandle(MonoObject *p_object);
void free_gchandle(uint32_t p_gchandle);
-void runtime_object_init(MonoObject *p_this_obj, GDMonoClass *p_class, MonoException **r_exc = NULL);
+void runtime_object_init(MonoObject *p_this_obj, GDMonoClass *p_class, MonoException **r_exc = nullptr);
bool mono_delegate_equal(MonoDelegate *p_a, MonoDelegate *p_b);
diff --git a/modules/mono/mono_gd/managed_type.h b/modules/mono/mono_gd/managed_type.h
index 11b832d0cc..84d1837853 100644
--- a/modules/mono/mono_gd/managed_type.h
+++ b/modules/mono/mono_gd/managed_type.h
@@ -46,7 +46,7 @@ struct ManagedType {
ManagedType() :
type_encoding(0),
- type_class(NULL) {
+ type_class(nullptr) {
}
ManagedType(int p_type_encoding, GDMonoClass *p_type_class) :
diff --git a/modules/mono/mono_gd/gd_mono_android.cpp b/modules/mono/mono_gd/support/android_support.cpp
index 761368878f..8bcdeec9dd 100644..100755
--- a/modules/mono/mono_gd/gd_mono_android.cpp
+++ b/modules/mono/mono_gd/support/android_support.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* gd_mono_android.cpp */
+/* android_support.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "gd_mono_android.h"
+#include "android_support.h"
#if defined(ANDROID_ENABLED)
@@ -49,14 +49,16 @@
#include "platform/android/os_android.h"
#include "platform/android/thread_jandroid.h"
-#include "../utils/path_utils.h"
-#include "../utils/string_utils.h"
-#include "gd_mono_cache.h"
-#include "gd_mono_marshal.h"
+#include "../../utils/path_utils.h"
+#include "../../utils/string_utils.h"
+#include "../gd_mono_cache.h"
+#include "../gd_mono_marshal.h"
// Warning: JNI boilerplate ahead... continue at your own risk
-namespace GDMonoAndroid {
+namespace gdmono {
+namespace android {
+namespace support {
template <typename T>
struct ScopedLocalRef {
@@ -67,7 +69,7 @@ struct ScopedLocalRef {
_FORCE_INLINE_ operator T() const { return local_ref; }
_FORCE_INLINE_ operator jvalue() const { return (jvalue)local_ref; }
- _FORCE_INLINE_ operator bool() const { return local_ref != NULL; }
+ _FORCE_INLINE_ operator bool() const { return local_ref != nullptr; }
_FORCE_INLINE_ bool operator==(std::nullptr_t) const {
return local_ref == nullptr;
@@ -122,7 +124,7 @@ String determine_app_native_lib_dir() {
String result;
- const char *const nativeLibraryDirUtf8 = env->GetStringUTFChars(nativeLibraryDir, NULL);
+ const char *const nativeLibraryDirUtf8 = env->GetStringUTFChars(nativeLibraryDir, nullptr);
if (nativeLibraryDirUtf8) {
result.parse_utf8(nativeLibraryDirUtf8);
env->ReleaseStringUTFChars(nativeLibraryDir, nativeLibraryDirUtf8);
@@ -150,21 +152,21 @@ int gd_mono_convert_dl_flags(int flags) {
return lflags;
}
-#ifndef GD_MONO_ANDROID_SO_NAME
-#define GD_MONO_ANDROID_SO_NAME "libmonosgen-2.0.so"
+#ifndef GD_MONO_SO_NAME
+#define GD_MONO_SO_NAME "libmonosgen-2.0.so"
#endif
-const char *mono_so_name = GD_MONO_ANDROID_SO_NAME;
+const char *mono_so_name = GD_MONO_SO_NAME;
const char *godot_so_name = "libgodot_android.so";
-void *mono_dl_handle = NULL;
-void *godot_dl_handle = NULL;
+void *mono_dl_handle = nullptr;
+void *godot_dl_handle = nullptr;
void *try_dlopen(const String &p_so_path, int p_flags) {
if (!FileAccess::exists(p_so_path)) {
if (OS::get_singleton()->is_stdout_verbose())
OS::get_singleton()->print("Cannot find shared library: '%s'\n", p_so_path.utf8().get_data());
- return NULL;
+ return nullptr;
}
int lflags = gd_mono_convert_dl_flags(p_flags);
@@ -174,7 +176,7 @@ void *try_dlopen(const String &p_so_path, int p_flags) {
if (!handle) {
if (OS::get_singleton()->is_stdout_verbose())
OS::get_singleton()->print("Failed to open shared library: '%s'. Error: '%s'\n", p_so_path.utf8().get_data(), dlerror());
- return NULL;
+ return nullptr;
}
if (OS::get_singleton()->is_stdout_verbose())
@@ -184,7 +186,7 @@ void *try_dlopen(const String &p_so_path, int p_flags) {
}
void *gd_mono_android_dlopen(const char *p_name, int p_flags, char **r_err, void *p_user_data) {
- if (p_name == NULL) {
+ if (p_name == nullptr) {
// __Internal
if (!mono_dl_handle) {
@@ -209,7 +211,7 @@ void *gd_mono_android_dlopen(const char *p_name, int p_flags, char **r_err, void
return try_dlopen(so_path, p_flags);
}
- return NULL;
+ return nullptr;
}
void *gd_mono_android_dlsym(void *p_handle, const char *p_name, char **r_err, void *p_user_data) {
@@ -230,7 +232,7 @@ void *gd_mono_android_dlsym(void *p_handle, const char *p_name, char **r_err, vo
if (r_err)
*r_err = str_format_new("%s\n", dlerror());
- return NULL;
+ return nullptr;
}
void *gd_mono_android_dlclose(void *p_handle, void *p_user_data) {
@@ -238,9 +240,9 @@ void *gd_mono_android_dlclose(void *p_handle, void *p_user_data) {
// Not sure if this ever happens. Does Mono close the handle for the main module?
if (p_handle == mono_dl_handle)
- mono_dl_handle = NULL;
+ mono_dl_handle = nullptr;
- return NULL;
+ return nullptr;
}
int32_t build_version_sdk_int = 0;
@@ -265,7 +267,7 @@ int32_t get_build_version_sdk_int() {
return build_version_sdk_int;
}
-jobject certStore = NULL; // KeyStore
+jobject certStore = nullptr; // KeyStore
MonoBoolean _gd_mono_init_cert_store() {
// The JNI code is the equivalent of:
@@ -293,7 +295,7 @@ MonoBoolean _gd_mono_init_cert_store() {
if (jni_exception_check(env))
return 0;
- env->CallVoidMethod(certStoreLocal, load, NULL);
+ env->CallVoidMethod(certStoreLocal, load, nullptr);
if (jni_exception_check(env))
return 0;
@@ -317,7 +319,7 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) {
if (!mono_error_ok(&mono_error)) {
ERR_PRINT(String() + "Failed to convert MonoString* to UTF-8: '" + mono_error_get_message(&mono_error) + "'.");
mono_error_cleanup(&mono_error);
- return NULL;
+ return nullptr;
}
JNIEnv *env = ThreadAndroid::get_env();
@@ -326,20 +328,20 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) {
mono_free(alias_utf8);
ScopedLocalRef<jclass> keyStoreClass(env, env->FindClass("java/security/KeyStore"));
- ERR_FAIL_NULL_V(keyStoreClass, NULL);
+ ERR_FAIL_NULL_V(keyStoreClass, nullptr);
ScopedLocalRef<jclass> certificateClass(env, env->FindClass("java/security/cert/Certificate"));
- ERR_FAIL_NULL_V(certificateClass, NULL);
+ ERR_FAIL_NULL_V(certificateClass, nullptr);
jmethodID getCertificate = env->GetMethodID(keyStoreClass, "getCertificate", "(Ljava/lang/String;)Ljava/security/cert/Certificate;");
- ERR_FAIL_NULL_V(getCertificate, NULL);
+ ERR_FAIL_NULL_V(getCertificate, nullptr);
jmethodID getEncoded = env->GetMethodID(certificateClass, "getEncoded", "()[B");
- ERR_FAIL_NULL_V(getEncoded, NULL);
+ ERR_FAIL_NULL_V(getEncoded, nullptr);
ScopedLocalRef<jobject> certificate(env, env->CallObjectMethod(certStore, getCertificate, js_alias.get()));
if (!certificate)
- return NULL;
+ return nullptr;
ScopedLocalRef<jbyteArray> encoded(env, (jbyteArray)env->CallObjectMethod(certificate, getEncoded));
jsize encodedLength = env->GetArrayLength(encoded);
@@ -352,11 +354,16 @@ MonoArray *_gd_mono_android_cert_store_lookup(MonoString *p_alias) {
return encoded_ret;
}
+void register_internal_calls() {
+ mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_init_cert_store", (void *)_gd_mono_init_cert_store);
+ mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_android_cert_store_lookup", (void *)_gd_mono_android_cert_store_lookup);
+}
+
void initialize() {
// We need to set this environment variable to make the monodroid BCL use btls instead of legacy as the default provider
OS::get_singleton()->set_environment("XA_TLS_PROVIDER", "btls");
- mono_dl_fallback_register(gd_mono_android_dlopen, gd_mono_android_dlsym, gd_mono_android_dlclose, NULL);
+ mono_dl_fallback_register(gd_mono_android_dlopen, gd_mono_android_dlsym, gd_mono_android_dlclose, nullptr);
String app_native_lib_dir = get_app_native_lib_dir();
String so_path = path::join(app_native_lib_dir, godot_so_name);
@@ -364,31 +371,28 @@ void initialize() {
godot_dl_handle = try_dlopen(so_path, gd_mono_convert_dl_flags(MONO_DL_LAZY));
}
-void register_internal_calls() {
- mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_init_cert_store", (void *)_gd_mono_init_cert_store);
- mono_add_internal_call("Android.Runtime.AndroidEnvironment::_gd_mono_android_cert_store_lookup", (void *)_gd_mono_android_cert_store_lookup);
-}
-
void cleanup() {
// This is called after shutting down the Mono runtime
if (mono_dl_handle)
- gd_mono_android_dlclose(mono_dl_handle, NULL);
+ gd_mono_android_dlclose(mono_dl_handle, nullptr);
if (godot_dl_handle)
- gd_mono_android_dlclose(godot_dl_handle, NULL);
+ gd_mono_android_dlclose(godot_dl_handle, nullptr);
JNIEnv *env = ThreadAndroid::get_env();
if (certStore) {
env->DeleteGlobalRef(certStore);
- certStore = NULL;
+ certStore = nullptr;
}
}
-} // namespace GDMonoAndroid
+} // namespace support
+} // namespace android
+} // namespace gdmono
-using namespace GDMonoAndroid;
+using namespace gdmono::android::support;
// The following are P/Invoke functions required by the monodroid profile of the BCL.
// These are P/Invoke functions and not internal calls, hence why they use
@@ -417,7 +421,7 @@ GD_PINVOKE_EXPORT int32_t monodroid_get_system_property(const char *p_name, char
memcpy(*r_value, prop_value_str, len);
(*r_value)[len] = '\0';
} else {
- *r_value = NULL;
+ *r_value = nullptr;
}
}
@@ -604,7 +608,7 @@ GD_PINVOKE_EXPORT int32_t _monodroid_get_dns_servers(void **r_dns_servers_array)
if (!r_dns_servers_array)
return -1;
- *r_dns_servers_array = NULL;
+ *r_dns_servers_array = nullptr;
char *dns_servers[dns_servers_len];
int dns_servers_count = 0;
@@ -648,23 +652,23 @@ GD_PINVOKE_EXPORT const char *_monodroid_timezone_get_default_id() {
JNIEnv *env = ThreadAndroid::get_env();
ScopedLocalRef<jclass> timeZoneClass(env, env->FindClass("java/util/TimeZone"));
- ERR_FAIL_NULL_V(timeZoneClass, NULL);
+ ERR_FAIL_NULL_V(timeZoneClass, nullptr);
jmethodID getDefault = env->GetStaticMethodID(timeZoneClass, "getDefault", "()Ljava/util/TimeZone;");
- ERR_FAIL_NULL_V(getDefault, NULL);
+ ERR_FAIL_NULL_V(getDefault, nullptr);
jmethodID getID = env->GetMethodID(timeZoneClass, "getID", "()Ljava/lang/String;");
- ERR_FAIL_NULL_V(getID, NULL);
+ ERR_FAIL_NULL_V(getID, nullptr);
ScopedLocalRef<jobject> defaultTimeZone(env, env->CallStaticObjectMethod(timeZoneClass, getDefault));
if (!defaultTimeZone)
- return NULL;
+ return nullptr;
ScopedLocalRef<jstring> defaultTimeZoneID(env, (jstring)env->CallObjectMethod(defaultTimeZone, getID));
if (!defaultTimeZoneID)
- return NULL;
+ return nullptr;
const char *default_time_zone_id = env->GetStringUTFChars(defaultTimeZoneID, 0);
diff --git a/modules/mono/mono_gd/gd_mono_android.h b/modules/mono/mono_gd/support/android_support.h
index 0e04847924..dc2e6c95ed 100644..100755
--- a/modules/mono/mono_gd/gd_mono_android.h
+++ b/modules/mono/mono_gd/support/android_support.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* gd_mono_android.h */
+/* android_support.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,25 +28,28 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GD_MONO_ANDROID_H
-#define GD_MONO_ANDROID_H
+#ifndef ANDROID_SUPPORT_H
+#define ANDROID_SUPPORT_H
#if defined(ANDROID_ENABLED)
#include "core/ustring.h"
-namespace GDMonoAndroid {
+namespace gdmono {
+namespace android {
+namespace support {
String get_app_native_lib_dir();
void initialize();
+void cleanup();
void register_internal_calls();
-void cleanup();
-
-} // namespace GDMonoAndroid
+} // namespace support
+} // namespace android
+} // namespace gdmono
#endif // ANDROID_ENABLED
-#endif // GD_MONO_ANDROID_H
+#endif // ANDROID_SUPPORT_H
diff --git a/modules/mono/mono_gd/support/ios_support.h b/modules/mono/mono_gd/support/ios_support.h
new file mode 100755
index 0000000000..e28af120e3
--- /dev/null
+++ b/modules/mono/mono_gd/support/ios_support.h
@@ -0,0 +1,51 @@
+/*************************************************************************/
+/* ios_support.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 IOS_SUPPORT_H
+#define IOS_SUPPORT_H
+
+#if defined(IPHONE_ENABLED)
+
+#include "core/ustring.h"
+
+namespace gdmono {
+namespace ios {
+namespace support {
+
+void initialize();
+void cleanup();
+
+} // namespace support
+} // namespace ios
+} // namespace gdmono
+
+#endif // IPHONE_ENABLED
+
+#endif // IOS_SUPPORT_H
diff --git a/modules/mono/mono_gd/support/ios_support.mm b/modules/mono/mono_gd/support/ios_support.mm
new file mode 100755
index 0000000000..e3d1a647fd
--- /dev/null
+++ b/modules/mono/mono_gd/support/ios_support.mm
@@ -0,0 +1,151 @@
+/*************************************************************************/
+/* ios_support.mm */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 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 "ios_support.h"
+
+#if defined(IPHONE_ENABLED)
+
+#import <Foundation/Foundation.h>
+#include <os/log.h>
+
+#include "core/ustring.h"
+
+#include "../gd_mono_marshal.h"
+
+// Implemented mostly following: https://github.com/mono/mono/blob/master/sdks/ios/app/runtime.m
+
+// Definition generated by the Godot exporter
+extern "C" void gd_mono_setup_aot();
+
+namespace gdmono {
+namespace ios {
+namespace support {
+
+void ios_mono_log_callback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) {
+ os_log_info(OS_LOG_DEFAULT, "(%s %s) %s", log_domain, log_level, message);
+ if (fatal) {
+ os_log_info(OS_LOG_DEFAULT, "Exit code: %d.", 1);
+ exit(1);
+ }
+}
+
+void initialize() {
+ mono_dllmap_insert(NULL, "System.Native", NULL, "__Internal", NULL);
+ mono_dllmap_insert(NULL, "System.IO.Compression.Native", NULL, "__Internal", NULL);
+ mono_dllmap_insert(NULL, "System.Security.Cryptography.Native.Apple", NULL, "__Internal", NULL);
+
+#ifdef IOS_DEVICE
+ // This function is defined in an auto-generated source file
+ gd_mono_setup_aot();
+#endif
+
+ mono_set_signal_chaining(true);
+ mono_set_crash_chaining(true);
+}
+
+void cleanup() {
+}
+
+} // namespace support
+} // namespace ios
+} // namespace gdmono
+
+// The following are P/Invoke functions required by the monotouch profile of the BCL.
+// These are P/Invoke functions and not internal calls, hence why they use
+// 'mono_bool' and 'const char*' instead of 'MonoBoolean' and 'MonoString*'.
+
+#define GD_PINVOKE_EXPORT extern "C" __attribute__((visibility("default")))
+
+GD_PINVOKE_EXPORT const char *xamarin_get_locale_country_code() {
+ NSLocale *locale = [NSLocale currentLocale];
+ NSString *countryCode = [locale objectForKey:NSLocaleCountryCode];
+ if (countryCode == NULL) {
+ return strdup("US");
+ }
+ return strdup([countryCode UTF8String]);
+}
+
+GD_PINVOKE_EXPORT void xamarin_log(const uint16_t *p_unicode_message) {
+ int length = 0;
+ const uint16_t *ptr = p_unicode_message;
+ while (*ptr++)
+ length += sizeof(uint16_t);
+ NSString *msg = [[NSString alloc] initWithBytes:p_unicode_message length:length encoding:NSUTF16LittleEndianStringEncoding];
+
+ os_log_info(OS_LOG_DEFAULT, "%{public}@", msg);
+}
+
+GD_PINVOKE_EXPORT const char *xamarin_GetFolderPath(int p_folder) {
+ NSSearchPathDirectory dd = (NSSearchPathDirectory)p_folder;
+ NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:dd inDomains:NSUserDomainMask] lastObject];
+ NSString *path = [url path];
+ return strdup([path UTF8String]);
+}
+
+GD_PINVOKE_EXPORT char *xamarin_timezone_get_local_name() {
+ NSTimeZone *tz = nil;
+ tz = [NSTimeZone localTimeZone];
+ NSString *name = [tz name];
+ return (name != nil) ? strdup([name UTF8String]) : strdup("Local");
+}
+
+GD_PINVOKE_EXPORT char **xamarin_timezone_get_names(uint32_t *p_count) {
+ NSArray *array = [NSTimeZone knownTimeZoneNames];
+ *p_count = array.count;
+ char **result = (char **)malloc(sizeof(char *) * (*p_count));
+ for (uint32_t i = 0; i < *p_count; i++) {
+ NSString *s = [array objectAtIndex:i];
+ result[i] = strdup(s.UTF8String);
+ }
+ return result;
+}
+
+GD_PINVOKE_EXPORT void *xamarin_timezone_get_data(const char *p_name, uint32_t *p_size) { // FIXME: uint32_t since Dec 2019, unsigned long before
+ NSTimeZone *tz = nil;
+ if (p_name) {
+ NSString *n = [[NSString alloc] initWithUTF8String:p_name];
+ tz = [[[NSTimeZone alloc] initWithName:n] autorelease];
+ [n release];
+ } else {
+ tz = [NSTimeZone localTimeZone];
+ }
+ NSData *data = [tz data];
+ *p_size = [data length];
+ void *result = malloc(*p_size);
+ memcpy(result, data.bytes, *p_size);
+ return result;
+}
+
+GD_PINVOKE_EXPORT void xamarin_start_wwan(const char *p_uri) {
+ // FIXME: What's this for? No idea how to implement.
+ os_log_error(OS_LOG_DEFAULT, "Not implemented: 'xamarin_start_wwan'");
+}
+
+#endif // IPHONE_ENABLED
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
index 4823ba3679..94431e7c30 100644
--- a/modules/mono/register_types.cpp
+++ b/modules/mono/register_types.cpp
@@ -34,11 +34,11 @@
#include "csharp_script.h"
-CSharpLanguage *script_language_cs = NULL;
+CSharpLanguage *script_language_cs = nullptr;
Ref<ResourceFormatLoaderCSharpScript> resource_loader_cs;
Ref<ResourceFormatSaverCSharpScript> resource_saver_cs;
-_GodotSharp *_godotsharp = NULL;
+_GodotSharp *_godotsharp = nullptr;
void register_mono_types() {
ClassDB::register_class<CSharpScript>();
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index 25e5a41215..e77a2e98f2 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -121,7 +121,7 @@ void SignalAwaiterCallable::call(const Variant **p_arguments, int p_argcount, Va
return;
}
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
CACHED_METHOD_THUNK(SignalAwaiter, SignalCallback).invoke(awaiter, signal_args, &exc);
if (exc) {
@@ -210,7 +210,7 @@ void EventSignalCallable::call(const Variant **p_arguments, int p_argcount, Vari
return;
}
- MonoException *exc = NULL;
+ MonoException *exc = nullptr;
event_signal->invoke_method->invoke(delegate_field_value, p_arguments, &exc);
if (exc) {
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
index c1cd5f1db4..8f0ad8ba5e 100644
--- a/modules/mono/utils/mono_reg_utils.cpp
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -73,13 +73,13 @@ LONG _RegKeyQueryString(HKEY hKey, const String &p_value_name, String &r_value)
buffer.resize(512);
DWORD dwBufferSize = buffer.size();
- LONG res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+ LONG res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, nullptr, (LPBYTE)buffer.ptr(), &dwBufferSize);
if (res == ERROR_MORE_DATA) {
// dwBufferSize now contains the actual size
Vector<WCHAR> buffer;
buffer.resize(dwBufferSize);
- res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+ res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, nullptr, (LPBYTE)buffer.ptr(), &dwBufferSize);
}
if (res == ERROR_SUCCESS) {
@@ -180,7 +180,7 @@ String find_msbuild_tools_path() {
String output;
int exit_code;
- OS::get_singleton()->execute(vswhere_path, vswhere_args, true, NULL, &output, &exit_code);
+ OS::get_singleton()->execute(vswhere_path, vswhere_args, true, nullptr, &output, &exit_code);
if (exit_code == 0) {
Vector<String> lines = output.split("\n");
diff --git a/modules/mono/utils/osx_utils.cpp b/modules/mono/utils/osx_utils.cpp
index 432b306414..8fadf3c109 100644
--- a/modules/mono/utils/osx_utils.cpp
+++ b/modules/mono/utils/osx_utils.cpp
@@ -39,9 +39,9 @@
bool osx_is_app_bundle_installed(const String &p_bundle_id) {
- CFURLRef app_url = NULL;
- CFStringRef bundle_id = CFStringCreateWithCString(NULL, p_bundle_id.utf8(), kCFStringEncodingUTF8);
- OSStatus result = LSFindApplicationForInfo(kLSUnknownCreator, bundle_id, NULL, NULL, &app_url);
+ CFURLRef app_url = nullptr;
+ CFStringRef bundle_id = CFStringCreateWithCString(nullptr, p_bundle_id.utf8(), kCFStringEncodingUTF8);
+ OSStatus result = LSFindApplicationForInfo(kLSUnknownCreator, bundle_id, nullptr, nullptr, &app_url);
CFRelease(bundle_id);
if (app_url)
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
index 545da6c79e..973375a471 100644
--- a/modules/mono/utils/path_utils.cpp
+++ b/modules/mono/utils/path_utils.cpp
@@ -80,7 +80,7 @@ String find_executable(const String &p_name) {
String cwd() {
#ifdef WINDOWS_ENABLED
- const DWORD expected_size = ::GetCurrentDirectoryW(0, NULL);
+ const DWORD expected_size = ::GetCurrentDirectoryW(0, nullptr);
String buffer;
buffer.resize((int)expected_size);
@@ -90,7 +90,7 @@ String cwd() {
return buffer.simplify_path();
#else
char buffer[PATH_MAX];
- if (::getcwd(buffer, sizeof(buffer)) == NULL)
+ if (::getcwd(buffer, sizeof(buffer)) == nullptr)
return ".";
String result;
@@ -114,12 +114,12 @@ String realpath(const String &p_path) {
// Open file without read/write access
HANDLE hFile = ::CreateFileW(p_path.c_str(), 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile == INVALID_HANDLE_VALUE)
return p_path;
- const DWORD expected_size = ::GetFinalPathNameByHandleW(hFile, NULL, 0, FILE_NAME_NORMALIZED);
+ const DWORD expected_size = ::GetFinalPathNameByHandleW(hFile, nullptr, 0, FILE_NAME_NORMALIZED);
if (expected_size == 0) {
::CloseHandle(hFile);
@@ -133,7 +133,7 @@ String realpath(const String &p_path) {
::CloseHandle(hFile);
return buffer.simplify_path();
#elif UNIX_ENABLED
- char *resolved_path = ::realpath(p_path.utf8().get_data(), NULL);
+ char *resolved_path = ::realpath(p_path.utf8().get_data(), nullptr);
if (!resolved_path)
return p_path;
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index 49c4fb3f73..907811355f 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -212,7 +212,7 @@ String str_format(const char *p_format, ...) {
#define gd_vscprintf(m_format, m_args_copy) _vscprintf(m_format, m_args_copy)
#else
#define gd_vsnprintf(m_buffer, m_count, m_format, m_args_copy) vsnprintf(m_buffer, m_count, m_format, m_args_copy)
-#define gd_vscprintf(m_format, m_args_copy) vsnprintf(NULL, 0, p_format, m_args_copy)
+#define gd_vscprintf(m_format, m_args_copy) vsnprintf(nullptr, 0, p_format, m_args_copy)
#endif
String str_format(const char *p_format, va_list p_list) {
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 44c7963cd3..e768fb4ae8 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Only kept to build the thirdparty library used by the theora and webm
# modules.
@@ -9,7 +9,7 @@ Import('env_modules')
env_ogg = env_modules.Clone()
# Thirdparty source files
-if env['builtin_libogg']:
+if env["builtin_libogg"]:
thirdparty_dir = "#thirdparty/libogg/"
thirdparty_sources = [
"bitwise.c",
diff --git a/modules/ogg/config.py b/modules/ogg/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/ogg/config.py
+++ b/modules/ogg/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub
index 311d33b047..52d8b145ef 100644
--- a/modules/opensimplex/SCsub
+++ b/modules/opensimplex/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_opensimplex = env_modules.Clone()
diff --git a/modules/opensimplex/config.py b/modules/opensimplex/config.py
index c1010ad433..90b85dbd70 100644
--- a/modules/opensimplex/config.py
+++ b/modules/opensimplex/config.py
@@ -1,14 +1,17 @@
def can_build(env, platform):
- return True
+ return True
+
def configure(env):
- pass
+ pass
+
def get_doc_classes():
return [
"NoiseTexture",
- "OpenSimplexNoise"
+ "OpenSimplexNoise",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp
index 1a08ec416f..ec67030a65 100644
--- a/modules/opensimplex/noise_texture.cpp
+++ b/modules/opensimplex/noise_texture.cpp
@@ -34,7 +34,7 @@
NoiseTexture::NoiseTexture() {
update_queued = false;
- noise_thread = NULL;
+ noise_thread = nullptr;
regen_queued = false;
first_time = true;
@@ -114,7 +114,7 @@ void NoiseTexture::_thread_done(const Ref<Image> &p_image) {
_set_texture_data(p_image);
Thread::wait_to_finish(noise_thread);
memdelete(noise_thread);
- noise_thread = NULL;
+ noise_thread = nullptr;
if (regen_queued) {
noise_thread = Thread::create(_thread_function, this);
regen_queued = false;
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index fec2911d6d..e51590d808 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Only kept to build the thirdparty library used by the webm module.
# AudioStreamOpus was dropped in 3.0 due to incompatibility with the new audio
@@ -10,11 +10,10 @@ Import('env_modules')
env_opus = env_modules.Clone()
# Thirdparty source files
-if env['builtin_opus']:
+if env["builtin_opus"]:
thirdparty_dir = "#thirdparty/opus/"
thirdparty_sources = [
-
# Sync with opus_sources.mk
"opus.c",
"opus_decoder.c",
@@ -23,17 +22,14 @@ if env['builtin_opus']:
"opus_multistream_encoder.c",
"opus_multistream_decoder.c",
"repacketizer.c",
-
"analysis.c",
"mlp.c",
"mlp_data.c",
-
# Sync with libopusfile Makefile.am
"info.c",
"internal.c",
"opusfile.c",
"stream.c",
-
# Sync with celt_sources.mk
"celt/bands.c",
"celt/celt.c",
@@ -53,12 +49,11 @@ if env['builtin_opus']:
"celt/quant_bands.c",
"celt/rate.c",
"celt/vq.c",
- #"celt/arm/arm_celt_map.c",
- #"celt/arm/armcpu.c",
- #"celt/arm/celt_ne10_fft.c",
- #"celt/arm/celt_ne10_mdct.c",
- #"celt/arm/celt_neon_intr.c",
-
+ # "celt/arm/arm_celt_map.c",
+ # "celt/arm/armcpu.c",
+ # "celt/arm/celt_ne10_fft.c",
+ # "celt/arm/celt_ne10_mdct.c",
+ # "celt/arm/celt_neon_intr.c",
# Sync with silk_sources.mk
"silk/CNG.c",
"silk/code_signs.c",
@@ -207,7 +202,7 @@ if env['builtin_opus']:
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
# also requires libogg
- if env['builtin_libogg']:
+ if env["builtin_libogg"]:
env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
env_opus.Append(CPPDEFINES=["HAVE_CONFIG_H"])
@@ -223,14 +218,14 @@ if env['builtin_opus']:
env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
if env["platform"] == "android":
- if ("android_arch" in env and env["android_arch"] == "armv7"):
+ if "android_arch" in env and env["android_arch"] == "armv7":
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
- elif ("android_arch" in env and env["android_arch"] == "arm64v8"):
+ elif "android_arch" in env and env["android_arch"] == "arm64v8":
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
elif env["platform"] == "iphone":
- if ("arch" in env and env["arch"] == "arm"):
+ if "arch" in env and env["arch"] == "arm":
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
- elif ("arch" in env and env["arch"] == "arm64"):
+ elif "arch" in env and env["arch"] == "arm64":
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
env_thirdparty = env_opus.Clone()
diff --git a/modules/opus/config.py b/modules/opus/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/opus/config.py
+++ b/modules/opus/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index 18da38fbbd..e0baf851f1 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_pvr = env_modules.Clone()
diff --git a/modules/pvr/config.py b/modules/pvr/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/pvr/config.py
+++ b/modules/pvr/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 179c6f692b..10d4d71f5e 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -534,7 +534,7 @@ static void decompress_pvrtc(PVRTCBlock *p_comp_img, const int p_2bit, const int
// local neighbourhood of blocks
PVRTCBlock *p_blocks[2][2];
- PVRTCBlock *prev[2][2] = { { NULL, NULL }, { NULL, NULL } };
+ PVRTCBlock *prev[2][2] = { { nullptr, nullptr }, { nullptr, nullptr } };
struct
{
diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index c990c3612b..642323db35 100644
--- a/modules/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
@@ -36,7 +36,7 @@
class ResourceFormatPVR : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/regex/SCsub b/modules/regex/SCsub
index 6238cd3d9f..753650adcb 100644
--- a/modules/regex/SCsub
+++ b/modules/regex/SCsub
@@ -1,16 +1,16 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_regex = env_modules.Clone()
-if env['builtin_pcre2']:
- thirdparty_dir = '#thirdparty/pcre2/src/'
- thirdparty_flags = ['PCRE2_STATIC', 'HAVE_CONFIG_H']
+if env["builtin_pcre2"]:
+ thirdparty_dir = "#thirdparty/pcre2/src/"
+ thirdparty_flags = ["PCRE2_STATIC", "HAVE_CONFIG_H"]
- if env['builtin_pcre2_with_jit']:
- thirdparty_flags.append('SUPPORT_JIT')
+ if env["builtin_pcre2_with_jit"]:
+ thirdparty_flags.append("SUPPORT_JIT")
thirdparty_sources = [
"pcre2_auto_possess.c",
@@ -24,7 +24,7 @@ if env['builtin_pcre2']:
"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_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 42cfe3b43c..df9f44cb95 100644
--- a/modules/regex/config.py
+++ b/modules/regex/config.py
@@ -1,14 +1,17 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"RegEx",
"RegExMatch",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp
index 53d1a1dd65..25cc580591 100644
--- a/modules/regex/regex.cpp
+++ b/modules/regex/regex.cpp
@@ -80,7 +80,7 @@ Dictionary RegExMatch::get_names() const {
Dictionary result;
- for (const Map<String, int>::Element *i = names.front(); i != NULL; i = i->next()) {
+ for (const Map<String, int>::Element *i = names.front(); i != nullptr; i = i->next()) {
result[i->key()] = i->value();
}
@@ -180,14 +180,14 @@ void RegEx::clear() {
if (code) {
pcre2_code_free_16((pcre2_code_16 *)code);
- code = NULL;
+ code = nullptr;
}
} else {
if (code) {
pcre2_code_free_32((pcre2_code_32 *)code);
- code = NULL;
+ code = nullptr;
}
}
}
@@ -242,7 +242,7 @@ Error RegEx::compile(const String &p_pattern) {
Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end) const {
- ERR_FAIL_COND_V(!is_valid(), NULL);
+ ERR_FAIL_COND_V(!is_valid(), nullptr);
Ref<RegExMatch> result = memnew(RegExMatch);
@@ -263,7 +263,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
if (res < 0) {
pcre2_match_data_free_16(match);
- return NULL;
+ return nullptr;
}
uint32_t size = pcre2_get_ovector_count_16(match);
@@ -295,7 +295,7 @@ Ref<RegExMatch> RegEx::search(const String &p_subject, int p_offset, int p_end)
pcre2_match_data_free_32(match);
pcre2_match_context_free_32(mctx);
- return NULL;
+ return nullptr;
}
uint32_t size = pcre2_get_ovector_count_32(match);
@@ -431,7 +431,7 @@ String RegEx::sub(const String &p_subject, const String &p_replacement, bool p_a
bool RegEx::is_valid() const {
- return (code != NULL);
+ return (code != nullptr);
}
String RegEx::get_pattern() const {
@@ -479,26 +479,26 @@ RegEx::RegEx() {
if (sizeof(CharType) == 2) {
- general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL);
+ general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);
} else {
- general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL);
+ general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
}
- code = NULL;
+ code = nullptr;
}
RegEx::RegEx(const String &p_pattern) {
if (sizeof(CharType) == 2) {
- general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, NULL);
+ general_ctx = pcre2_general_context_create_16(&_regex_malloc, &_regex_free, nullptr);
} else {
- general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, NULL);
+ general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
}
- code = NULL;
+ code = nullptr;
compile(p_pattern);
}
diff --git a/modules/squish/SCsub b/modules/squish/SCsub
index 15320bcd0c..b31032403f 100644
--- a/modules/squish/SCsub
+++ b/modules/squish/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_squish = env_modules.Clone()
# Thirdparty source files
-if env['builtin_squish']:
+if env["builtin_squish"]:
thirdparty_dir = "#thirdparty/squish/"
thirdparty_sources = [
"alpha.cpp",
diff --git a/modules/squish/config.py b/modules/squish/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/squish/config.py
+++ b/modules/squish/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/stb_vorbis/SCsub b/modules/stb_vorbis/SCsub
index d14939a3b1..266c87c802 100644
--- a/modules/stb_vorbis/SCsub
+++ b/modules/stb_vorbis/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_stb_vorbis = env_modules.Clone()
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index e5d0e0b12d..9609c234ec 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -130,7 +130,7 @@ Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() {
Ref<AudioStreamPlaybackOGGVorbis> ovs;
- ERR_FAIL_COND_V(data == NULL, ovs);
+ ERR_FAIL_COND_V(data == nullptr, ovs);
ovs.instance();
ovs->vorbis_stream = Ref<AudioStreamOGGVorbis>(this);
@@ -144,7 +144,7 @@ Ref<AudioStreamPlayback> AudioStreamOGGVorbis::instance_playback() {
if (!ovs->ogg_stream) {
memfree(ovs->ogg_alloc.alloc_buffer);
- ovs->ogg_alloc.alloc_buffer = NULL;
+ ovs->ogg_alloc.alloc_buffer = nullptr;
ERR_FAIL_COND_V(!ovs->ogg_stream, Ref<AudioStreamPlaybackOGGVorbis>());
}
@@ -159,7 +159,7 @@ String AudioStreamOGGVorbis::get_stream_name() const {
void AudioStreamOGGVorbis::clear_data() {
if (data) {
memfree(data);
- data = NULL;
+ data = nullptr;
data_len = 0;
}
}
@@ -172,7 +172,7 @@ void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) {
uint32_t alloc_try = 1024;
Vector<char> alloc_mem;
char *w;
- stb_vorbis *ogg_stream = NULL;
+ stb_vorbis *ogg_stream = nullptr;
stb_vorbis_alloc ogg_alloc;
while (alloc_try < MAX_TEST_MEM) {
@@ -194,7 +194,7 @@ void AudioStreamOGGVorbis::set_data(const Vector<uint8_t> &p_data) {
} else {
ERR_FAIL_COND(alloc_try == MAX_TEST_MEM);
- ERR_FAIL_COND(ogg_stream == NULL);
+ ERR_FAIL_COND(ogg_stream == nullptr);
stb_vorbis_info info = stb_vorbis_get_info(ogg_stream);
@@ -274,7 +274,7 @@ void AudioStreamOGGVorbis::_bind_methods() {
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
- data = NULL;
+ data = nullptr;
data_len = 0;
length = 0;
sample_rate = 1;
diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py
index 200b8dfd50..1eb0a8cf33 100644
--- a/modules/stb_vorbis/config.py
+++ b/modules/stb_vorbis/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"AudioStreamOGGVorbis",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
index 43541bcf3c..8d6f71a456 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
@@ -50,7 +50,7 @@ public:
virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
- virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = nullptr, Variant *r_metadata = nullptr);
ResourceImporterOGGVorbis();
};
diff --git a/modules/svg/SCsub b/modules/svg/SCsub
index 7961d1f33e..0bfba34fe5 100644
--- a/modules/svg/SCsub
+++ b/modules/svg/SCsub
@@ -1,14 +1,14 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_svg = env_modules.Clone()
# Thirdparty source files
thirdparty_dir = "#thirdparty/nanosvg/"
thirdparty_sources = [
- "nanosvg.cc"
+ "nanosvg.cc",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
diff --git a/modules/svg/config.py b/modules/svg/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/svg/config.py
+++ b/modules/svg/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index e9d30d015a..3c2784f8de 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -65,7 +65,7 @@ inline void change_nsvg_paint_color(NSVGpaint *p_paint, const uint32_t p_old, co
void ImageLoaderSVG::_convert_colors(NSVGimage *p_svg_image) {
- for (NSVGshape *shape = p_svg_image->shapes; shape != NULL; shape = shape->next) {
+ for (NSVGshape *shape = p_svg_image->shapes; shape != nullptr; shape = shape->next) {
for (int i = 0; i < replace_colors.old_colors.size(); i++) {
change_nsvg_paint_color(&(shape->stroke), replace_colors.old_colors[i], replace_colors.new_colors[i]);
@@ -98,7 +98,7 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const Vector<uint8_t> *p
NSVGimage *svg_image;
const uint8_t *src_r = p_data->ptr();
svg_image = nsvgParse((char *)src_r, "px", 96);
- if (svg_image == NULL) {
+ if (svg_image == nullptr) {
ERR_PRINT("SVG Corrupted");
return ERR_FILE_CORRUPT;
}
diff --git a/modules/svg/image_loader_svg.h b/modules/svg/image_loader_svg.h
index def2885199..0fa4a0fdf4 100644
--- a/modules/svg/image_loader_svg.h
+++ b/modules/svg/image_loader_svg.h
@@ -63,7 +63,7 @@ class ImageLoaderSVG : public ImageFormatLoader {
static Error _create_image(Ref<Image> p_image, const Vector<uint8_t> *p_data, float p_scale, bool upsample, bool convert_colors = false);
public:
- static void set_convert_colors(Dictionary *p_replace_color = NULL);
+ static void set_convert_colors(Dictionary *p_replace_color = nullptr);
static Error create_image_from_string(Ref<Image> p_image, const char *p_svg_str, float p_scale, bool upsample, bool convert_colors = false);
virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale);
diff --git a/modules/svg/register_types.cpp b/modules/svg/register_types.cpp
index b0782dae88..37875313aa 100644
--- a/modules/svg/register_types.cpp
+++ b/modules/svg/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_svg.h"
-static ImageLoaderSVG *image_loader_svg = NULL;
+static ImageLoaderSVG *image_loader_svg = nullptr;
void register_svg_types() {
diff --git a/modules/tga/SCsub b/modules/tga/SCsub
index 7e405f405c..067caa6ea0 100644
--- a/modules/tga/SCsub
+++ b/modules/tga/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_tga = env_modules.Clone()
diff --git a/modules/tga/config.py b/modules/tga/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/tga/config.py
+++ b/modules/tga/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp
index 0e904fdd76..fc9d727bb0 100644
--- a/modules/tga/image_loader_tga.cpp
+++ b/modules/tga/image_loader_tga.cpp
@@ -283,7 +283,7 @@ Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
uint8_t *uncompressed_buffer_w = uncompressed_buffer.ptrw();
const uint8_t *uncompressed_buffer_r;
- const uint8_t *buffer = NULL;
+ const uint8_t *buffer = nullptr;
if (is_encoded) {
diff --git a/modules/tga/register_types.cpp b/modules/tga/register_types.cpp
index 359f4d785e..0d9268ebbf 100644
--- a/modules/tga/register_types.cpp
+++ b/modules/tga/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_tga.h"
-static ImageLoaderTGA *image_loader_tga = NULL;
+static ImageLoaderTGA *image_loader_tga = nullptr;
void register_tga_types() {
diff --git a/modules/theora/SCsub b/modules/theora/SCsub
index ff65d2f8ec..a01e65b4b0 100644
--- a/modules/theora/SCsub
+++ b/modules/theora/SCsub
@@ -1,71 +1,71 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_theora = env_modules.Clone()
# Thirdparty source files
-if env['builtin_libtheora']:
+if env["builtin_libtheora"]:
thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [
- #"analyze.c",
- #"apiwrapper.c",
+ # "analyze.c",
+ # "apiwrapper.c",
"bitpack.c",
"cpu.c",
- #"decapiwrapper.c",
+ # "decapiwrapper.c",
"decinfo.c",
"decode.c",
"dequant.c",
- #"encapiwrapper.c",
- #"encfrag.c",
- #"encinfo.c",
- #"encode.c",
- #"encoder_disabled.c",
- #"enquant.c",
- #"fdct.c",
+ # "encapiwrapper.c",
+ # "encfrag.c",
+ # "encinfo.c",
+ # "encode.c",
+ # "encoder_disabled.c",
+ # "enquant.c",
+ # "fdct.c",
"fragment.c",
"huffdec.c",
- #"huffenc.c",
+ # "huffenc.c",
"idct.c",
"info.c",
"internal.c",
- #"mathops.c",
- #"mcenc.c",
+ # "mathops.c",
+ # "mcenc.c",
"quant.c",
- #"rate.c",
+ # "rate.c",
"state.c",
- #"tokenize.c",
+ # "tokenize.c",
]
thirdparty_sources_x86 = [
- #"x86/mmxencfrag.c",
- #"x86/mmxfdct.c",
+ # "x86/mmxencfrag.c",
+ # "x86/mmxfdct.c",
"x86/mmxfrag.c",
"x86/mmxidct.c",
"x86/mmxstate.c",
- #"x86/sse2fdct.c",
- #"x86/x86enc.c",
+ # "x86/sse2fdct.c",
+ # "x86/x86enc.c",
"x86/x86state.c",
]
thirdparty_sources_x86_vc = [
- #"x86_vc/mmxencfrag.c",
- #"x86_vc/mmxfdct.c",
+ # "x86_vc/mmxencfrag.c",
+ # "x86_vc/mmxfdct.c",
"x86_vc/mmxfrag.c",
"x86_vc/mmxidct.c",
"x86_vc/mmxstate.c",
- #"x86_vc/x86enc.c",
+ # "x86_vc/x86enc.c",
"x86_vc/x86state.c",
]
- if (env["x86_libtheora_opt_gcc"]):
+ if env["x86_libtheora_opt_gcc"]:
thirdparty_sources += thirdparty_sources_x86
- if (env["x86_libtheora_opt_vc"]):
+ if env["x86_libtheora_opt_vc"]:
thirdparty_sources += thirdparty_sources_x86_vc
- if (env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]):
+ if env["x86_libtheora_opt_gcc"] or env["x86_libtheora_opt_vc"]:
env_theora.Append(CPPDEFINES=["OC_X86_ASM"])
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
@@ -73,9 +73,9 @@ if env['builtin_libtheora']:
env_theora.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
- if env['builtin_libogg']:
+ if env["builtin_libogg"]:
env_theora.Prepend(CPPPATH=["#thirdparty/libogg"])
- if env['builtin_libvorbis']:
+ if env["builtin_libvorbis"]:
env_theora.Prepend(CPPPATH=["#thirdparty/libvorbis"])
env_thirdparty = env_theora.Clone()
diff --git a/modules/theora/config.py b/modules/theora/config.py
index c7713d7607..413acce2df 100644
--- a/modules/theora/config.py
+++ b/modules/theora/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"VideoStreamTheora",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index ee44c6bf05..e5fb6f996d 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -144,7 +144,7 @@ void VideoStreamPlaybackTheora::clear() {
thread_sem->post(); //just in case
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
ring_buffer.clear();
#endif
@@ -159,7 +159,7 @@ void VideoStreamPlaybackTheora::clear() {
if (file) {
memdelete(file);
}
- file = NULL;
+ file = nullptr;
playing = false;
};
@@ -167,7 +167,7 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
ERR_FAIL_COND(playing);
ogg_packet op;
- th_setup_info *ts = NULL;
+ th_setup_info *ts = nullptr;
file_name = p_file;
if (file) {
@@ -674,7 +674,7 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
- file = NULL;
+ file = nullptr;
theora_p = 0;
vorbis_p = 0;
videobuf_ready = 0;
@@ -685,8 +685,8 @@ VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
buffering = false;
texture = Ref<ImageTexture>(memnew(ImageTexture));
- mix_callback = NULL;
- mix_udata = NULL;
+ mix_callback = nullptr;
+ mix_udata = nullptr;
audio_track = 0;
delay_compensation = 0;
audio_frames_wrote = 0;
@@ -696,7 +696,7 @@ VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
ring_buffer.resize(rb_power);
read_buffer.resize(RB_SIZE_KB * 1024);
thread_sem = Semaphore::create();
- thread = NULL;
+ thread = nullptr;
thread_exit = false;
thread_eof = false;
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index da3558ce34..cd7bff7adb 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -187,7 +187,7 @@ public:
class ResourceFormatLoaderTheora : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/tinyexr/SCsub b/modules/tinyexr/SCsub
index 97f9797b58..e7fd44fabd 100644
--- a/modules/tinyexr/SCsub
+++ b/modules/tinyexr/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_tinyexr = env_modules.Clone()
diff --git a/modules/tinyexr/config.py b/modules/tinyexr/config.py
index 098f1eafa9..53b8f2f2e3 100644
--- a/modules/tinyexr/config.py
+++ b/modules/tinyexr/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return env['tools']
+ return env["tools"]
+
def configure(env):
pass
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index 41938f5b42..1c0f3cd03e 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -56,7 +56,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
EXRVersion exr_version;
EXRImage exr_image;
EXRHeader exr_header;
- const char *err = NULL;
+ const char *err = nullptr;
InitEXRHeader(&exr_header);
@@ -194,7 +194,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
const float *r_channel_start = reinterpret_cast<const float *>(tile.images[idxR]);
const float *g_channel_start = reinterpret_cast<const float *>(tile.images[idxG]);
const float *b_channel_start = reinterpret_cast<const float *>(tile.images[idxB]);
- const float *a_channel_start = NULL;
+ const float *a_channel_start = nullptr;
if (idxA != -1) {
a_channel_start = reinterpret_cast<const float *>(tile.images[idxA]);
@@ -206,7 +206,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
const float *r_channel = r_channel_start + y * tile_width;
const float *g_channel = g_channel_start + y * tile_width;
const float *b_channel = b_channel_start + y * tile_width;
- const float *a_channel = NULL;
+ const float *a_channel = nullptr;
if (a_channel_start) {
a_channel = a_channel_start + y * tile_width;
diff --git a/modules/tinyexr/register_types.cpp b/modules/tinyexr/register_types.cpp
index d8529fd893..af05a411e1 100644
--- a/modules/tinyexr/register_types.cpp
+++ b/modules/tinyexr/register_types.cpp
@@ -33,7 +33,7 @@
#include "image_loader_tinyexr.h"
#include "image_saver_tinyexr.h"
-static ImageLoaderTinyEXR *image_loader_tinyexr = NULL;
+static ImageLoaderTinyEXR *image_loader_tinyexr = nullptr;
void register_tinyexr_types() {
@@ -47,5 +47,5 @@ void unregister_tinyexr_types() {
memdelete(image_loader_tinyexr);
- Image::save_exr_func = NULL;
+ Image::save_exr_func = nullptr;
}
diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub
index 3f56a69594..2e129e15ca 100644
--- a/modules/upnp/SCsub
+++ b/modules/upnp/SCsub
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_upnp = env_modules.Clone()
# Thirdparty source files
-if env['builtin_miniupnpc']:
+if env["builtin_miniupnpc"]:
thirdparty_dir = "#thirdparty/miniupnpc/"
thirdparty_sources = [
"miniupnpc.c",
diff --git a/modules/upnp/config.py b/modules/upnp/config.py
index 8724ff1a51..3e15b940a1 100644
--- a/modules/upnp/config.py
+++ b/modules/upnp/config.py
@@ -1,14 +1,17 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"UPNP",
- "UPNPDevice"
+ "UPNPDevice",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp
index 5ef7575b0c..856f4188aa 100644
--- a/modules/upnp/upnp.cpp
+++ b/modules/upnp/upnp.cpp
@@ -54,9 +54,9 @@ int UPNP::discover(int timeout, int ttl, const String &device_filter) {
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);
+ devlist = upnpDiscover(timeout, discover_multicast_if.utf8().get_data(), nullptr, 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);
+ devlist = upnpDiscoverAll(timeout, discover_multicast_if.utf8().get_data(), nullptr, discover_local_port, discover_ipv6, ttl, &error);
}
if (error != UPNPDISCOVER_SUCCESS) {
@@ -133,7 +133,7 @@ void UPNP::parse_igd(Ref<UPNPDevice> dev, UPNPDev *devlist) {
parserootdesc(xml, size, &data);
free(xml);
- xml = 0;
+ xml = nullptr;
GetUPNPUrls(urls, &data, dev->get_description_url().utf8().get_data(), 0);
@@ -235,20 +235,20 @@ int UPNP::get_device_count() const {
}
Ref<UPNPDevice> UPNP::get_device(int index) const {
- ERR_FAIL_INDEX_V(index, devices.size(), NULL);
+ ERR_FAIL_INDEX_V(index, devices.size(), nullptr);
return devices.get(index);
}
void UPNP::add_device(Ref<UPNPDevice> device) {
- ERR_FAIL_COND(device == NULL);
+ ERR_FAIL_COND(device == nullptr);
devices.push_back(device);
}
void UPNP::set_device(int index, Ref<UPNPDevice> device) {
ERR_FAIL_INDEX(index, devices.size());
- ERR_FAIL_COND(device == NULL);
+ ERR_FAIL_COND(device == nullptr);
devices.set(index, device);
}
@@ -264,17 +264,17 @@ void UPNP::clear_devices() {
}
Ref<UPNPDevice> UPNP::get_gateway() const {
- ERR_FAIL_COND_V(devices.size() < 1, NULL);
+ ERR_FAIL_COND_V(devices.size() < 1, nullptr);
for (int i = 0; i < devices.size(); i++) {
Ref<UPNPDevice> dev = get_device(i);
- if (dev != NULL && dev->is_valid_gateway()) {
+ if (dev != nullptr && dev->is_valid_gateway()) {
return dev;
}
}
- return NULL;
+ return nullptr;
}
void UPNP::set_discover_multicast_if(const String &m_if) {
@@ -304,7 +304,7 @@ bool UPNP::is_discover_ipv6() const {
String UPNP::query_external_address() const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == NULL) {
+ if (dev == nullptr) {
return "";
}
@@ -314,7 +314,7 @@ String UPNP::query_external_address() const {
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) {
+ if (dev == nullptr) {
return UPNP_RESULT_NO_GATEWAY;
}
@@ -326,7 +326,7 @@ int UPNP::add_port_mapping(int port, int port_internal, String desc, String prot
int UPNP::delete_port_mapping(int port, String proto) const {
Ref<UPNPDevice> dev = get_gateway();
- if (dev == NULL) {
+ if (dev == nullptr) {
return UPNP_RESULT_NO_GATEWAY;
}
diff --git a/modules/upnp/upnp_device.cpp b/modules/upnp/upnp_device.cpp
index 6edfbc2d7d..c21826d14d 100644
--- a/modules/upnp/upnp_device.cpp
+++ b/modules/upnp/upnp_device.cpp
@@ -65,10 +65,10 @@ int UPNPDevice::add_port_mapping(int port, int port_internal, String desc, Strin
itos(port).utf8().get_data(),
itos(port_internal).utf8().get_data(),
igd_our_addr.utf8().get_data(),
- desc.empty() ? 0 : desc.utf8().get_data(),
+ desc.empty() ? nullptr : 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);
+ nullptr, // Remote host, always nullptr as IGDs don't support it
+ duration > 0 ? itos(duration).utf8().get_data() : nullptr);
ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i));
@@ -84,7 +84,7 @@ int UPNPDevice::delete_port_mapping(int port, String proto) const {
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
+ nullptr // Remote host, always nullptr as IGDs don't support it
);
ERR_FAIL_COND_V(i != UPNPCOMMAND_SUCCESS, UPNP::upnp_result(i));
diff --git a/modules/vhacd/SCsub b/modules/vhacd/SCsub
index 685976dc33..ecd432b275 100644
--- a/modules/vhacd/SCsub
+++ b/modules/vhacd/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_vhacd = env_modules.Clone()
@@ -19,7 +19,7 @@ thirdparty_sources = [
"src/btAlignedAllocator.cpp",
"src/vhacdRaycastMesh.cpp",
"src/VHACD.cpp",
- "src/btConvexHullComputer.cpp"
+ "src/btConvexHullComputer.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
diff --git a/modules/vhacd/config.py b/modules/vhacd/config.py
index 9ced70d2fb..d22f9454ed 100644
--- a/modules/vhacd/config.py
+++ b/modules/vhacd/config.py
@@ -1,6 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
-
diff --git a/modules/vhacd/register_types.cpp b/modules/vhacd/register_types.cpp
index 7deb20f6e7..c006a9deec 100644
--- a/modules/vhacd/register_types.cpp
+++ b/modules/vhacd/register_types.cpp
@@ -84,5 +84,5 @@ void register_vhacd_types() {
}
void unregister_vhacd_types() {
- Mesh::convex_composition_function = NULL;
+ Mesh::convex_composition_function = nullptr;
}
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 3c3d2caa57..16faea08d7 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_vs = env_modules.Clone()
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py
index 087a13a200..bd459ca344 100644
--- a/modules/visual_script/config.py
+++ b/modules/visual_script/config.py
@@ -1,9 +1,11 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"@VisualScript",
@@ -56,5 +58,6 @@ def get_doc_classes():
"VisualScriptYield",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index 63bd88ad81..5ea84a32c4 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -41,9 +41,9 @@
#include "visual_script_nodes.h"
#include "visual_script_yield_nodes.h"
-VisualScriptLanguage *visual_script_language = NULL;
+VisualScriptLanguage *visual_script_language = nullptr;
#ifdef TOOLS_ENABLED
-static _VisualScriptEditor *vs_editor_singleton = NULL;
+static _VisualScriptEditor *vs_editor_singleton = nullptr;
#endif
void register_visual_script_types() {
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index d00cc6986f..b52dfe1733 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -94,7 +94,7 @@ void VisualScriptNode::validate_input_default_values() {
default_input_values[i] = Variant::construct(expected, &existingp, 1, ce, false);
if (ce.error != Callable::CallError::CALL_OK) {
//could not convert? force..
- default_input_values[i] = Variant::construct(expected, NULL, 0, ce, false);
+ default_input_values[i] = Variant::construct(expected, nullptr, 0, ce, false);
}
}
}
@@ -158,8 +158,8 @@ VisualScriptNode::VisualScriptNode() {
VisualScriptNodeInstance::VisualScriptNodeInstance() {
- sequence_outputs = NULL;
- input_ports = NULL;
+ sequence_outputs = nullptr;
+ input_ports = nullptr;
}
VisualScriptNodeInstance::~VisualScriptNodeInstance() {
@@ -1594,7 +1594,7 @@ void VisualScriptInstance::_dependency_step(VisualScriptNodeInstance *node, int
output_args[i] = &variant_stack[node->output_ports[i]];
}
- Variant *working_mem = node->working_mem_idx >= 0 ? &variant_stack[node->working_mem_idx] : (Variant *)NULL;
+ Variant *working_mem = node->working_mem_idx >= 0 ? &variant_stack[node->working_mem_idx] : (Variant *)nullptr;
node->step(input_args, output_args, VisualScriptNodeInstance::START_MODE_BEGIN_SEQUENCE, working_mem, r_error, error_str);
//ignore return
@@ -1615,8 +1615,8 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
const Variant **input_args = (const Variant **)(sequence_bits + f->node_count);
Variant **output_args = (Variant **)(input_args + max_input_args);
int flow_max = f->flow_stack_size;
- int *flow_stack = flow_max ? (int *)(output_args + max_output_args) : (int *)NULL;
- int *pass_stack = flow_stack ? (int *)(flow_stack + flow_max) : (int *)NULL;
+ int *flow_stack = flow_max ? (int *)(output_args + max_output_args) : (int *)nullptr;
+ int *pass_stack = flow_stack ? (int *)(flow_stack + flow_max) : (int *)nullptr;
String error_str;
@@ -1624,7 +1624,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
bool error = false;
int current_node_id = f->node;
Variant return_value;
- Variant *working_mem = NULL;
+ Variant *working_mem = nullptr;
int flow_stack_pos = p_flow_stack_pos;
@@ -1643,7 +1643,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
VSDEBUG("AT STACK POS: " + itos(flow_stack_pos));
//setup working mem
- working_mem = node->working_mem_idx >= 0 ? &variant_stack[node->working_mem_idx] : (Variant *)NULL;
+ working_mem = node->working_mem_idx >= 0 ? &variant_stack[node->working_mem_idx] : (Variant *)nullptr;
VSDEBUG("WORKING MEM: " + itos(node->working_mem_idx));
@@ -1817,7 +1817,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
break; //exit function requested, bye
}
- VisualScriptNodeInstance *next = NULL; //next node
+ VisualScriptNodeInstance *next = nullptr; //next node
if ((ret == output || ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) && node->sequence_output_count) {
//if no exit bit was set, and has sequence outputs, guess next node
@@ -2033,8 +2033,8 @@ Variant VisualScriptInstance::call(const StringName &p_method, const Variant **p
const Variant **input_args = (const Variant **)(sequence_bits + f->node_count);
Variant **output_args = (Variant **)(input_args + max_input_args);
int flow_max = f->flow_stack_size;
- int *flow_stack = flow_max ? (int *)(output_args + max_output_args) : (int *)NULL;
- int *pass_stack = flow_stack ? (int *)(flow_stack + flow_max) : (int *)NULL;
+ int *flow_stack = flow_max ? (int *)(output_args + max_output_args) : (int *)nullptr;
+ int *pass_stack = flow_stack ? (int *)(flow_stack + flow_max) : (int *)nullptr;
for (int i = 0; i < f->node_count; i++) {
sequence_bits[i] = false; //all starts as false
@@ -2097,7 +2097,7 @@ void VisualScriptInstance::notification(int p_notification) {
String VisualScriptInstance::to_string(bool *r_valid) {
if (has_method(CoreStringNames::get_singleton()->_to_string)) {
Callable::CallError ce;
- Variant ret = call(CoreStringNames::get_singleton()->_to_string, NULL, 0, ce);
+ Variant ret = call(CoreStringNames::get_singleton()->_to_string, nullptr, 0, ce);
if (ce.error == Callable::CallError::CALL_OK) {
if (ret.get_type() != Variant::STRING) {
if (r_valid)
@@ -2237,12 +2237,12 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
instance->id = F->key();
instance->input_port_count = node->get_input_value_port_count();
- instance->input_ports = NULL;
+ instance->input_ports = nullptr;
instance->output_port_count = node->get_output_value_port_count();
- instance->output_ports = NULL;
+ instance->output_ports = nullptr;
instance->sequence_output_count = node->get_output_sequence_port_count();
instance->sequence_index = function.node_count++;
- instance->sequence_outputs = NULL;
+ instance->sequence_outputs = nullptr;
instance->pass_idx = -1;
if (instance->input_port_count) {
@@ -2263,7 +2263,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
if (instance->sequence_output_count) {
instance->sequence_outputs = memnew_arr(VisualScriptNodeInstance *, instance->sequence_output_count);
for (int i = 0; i < instance->sequence_output_count; i++) {
- instance->sequence_outputs[i] = NULL; //if it remains null, flow ends here
+ instance->sequence_outputs[i] = nullptr; //if it remains null, flow ends here
}
}
@@ -2797,7 +2797,7 @@ int VisualScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, in
return 0;
}
-VisualScriptLanguage *VisualScriptLanguage::singleton = NULL;
+VisualScriptLanguage *VisualScriptLanguage::singleton = nullptr;
void VisualScriptLanguage::add_register_func(const String &p_name, VisualScriptNodeRegisterFunc p_func) {
@@ -2844,7 +2844,7 @@ VisualScriptLanguage::VisualScriptLanguage() {
} else {
_debug_max_call_stack = 0;
- _call_stack = NULL;
+ _call_stack = nullptr;
}
}
@@ -2853,5 +2853,5 @@ VisualScriptLanguage::~VisualScriptLanguage() {
if (_call_stack) {
memdelete_arr(_call_stack);
}
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 20273316b4..29309aa156 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -420,7 +420,7 @@ public:
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
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 Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = nullptr) const;
virtual void get_method_list(List<MethodInfo> *p_list) const;
virtual bool has_method(const StringName &p_method) const;
@@ -596,7 +596,7 @@ public:
virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
virtual bool is_using_templates();
virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script);
- 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, List<ScriptLanguage::Warning> *r_warnings = NULL, Set<int> *r_safe_lines = NULL) const;
+ 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 = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
virtual bool supports_builtin_mode() const;
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 07f152efd4..39d8f7c082 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1231,7 +1231,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
PackedByteArray barr;
int len;
bool full_objects = *p_inputs[1];
- Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
+ Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
if (err) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
@@ -1267,7 +1267,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
Variant ret;
{
const uint8_t *r = varr.ptr();
- Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
+ Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
if (err != OK) {
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 19771ef373..30522930c7 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -182,7 +182,7 @@ public:
_change_notify();
}
- VisualScriptEditorSignalEdit() { undo_redo = NULL; }
+ VisualScriptEditorSignalEdit() { undo_redo = nullptr; }
};
class VisualScriptEditorVariableEdit : public Object {
@@ -335,7 +335,7 @@ public:
_change_notify();
}
- VisualScriptEditorVariableEdit() { undo_redo = NULL; }
+ VisualScriptEditorVariableEdit() { undo_redo = nullptr; }
};
static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
@@ -1932,7 +1932,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
- return NULL;
+ return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -1945,7 +1945,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
- return NULL;
+ return nullptr;
}
void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
@@ -3447,7 +3447,7 @@ void VisualScriptEditor::connect_data(Ref<VisualScriptNode> vnode_old, Ref<Visua
undo_redo->create_action(TTR("Connect Node Data"));
VisualScriptReturn *vnode_return = Object::cast_to<VisualScriptReturn>(vnode.ptr());
- if (vnode_return != NULL && vnode_old->get_output_value_port_count() > 0) {
+ if (vnode_return != nullptr && vnode_old->get_output_value_port_count() > 0) {
vnode_return->set_enable_return_value(true);
}
if (vnode_old->get_output_value_port_count() <= 0) {
@@ -3713,11 +3713,11 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
void VisualScriptEditor::connect_seq(Ref<VisualScriptNode> vnode_old, Ref<VisualScriptNode> vnode_new, int new_id) {
VisualScriptOperator *vnode_operator = Object::cast_to<VisualScriptOperator>(vnode_new.ptr());
- if (vnode_operator != NULL && !vnode_operator->has_input_sequence_port()) {
+ if (vnode_operator != nullptr && !vnode_operator->has_input_sequence_port()) {
return;
}
VisualScriptConstructor *vnode_constructor = Object::cast_to<VisualScriptConstructor>(vnode_new.ptr());
- if (vnode_constructor != NULL) {
+ if (vnode_constructor != nullptr) {
return;
}
if (vnode_old->get_output_sequence_port_count() <= 0) {
@@ -3889,7 +3889,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
}
}
- if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) {
+ if (default_value_edit->edit(nullptr, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) {
if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT)
default_value_edit->popup_centered_ratio();
else
@@ -4878,10 +4878,10 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
return memnew(VisualScriptEditor);
}
- return NULL;
+ return nullptr;
}
-VisualScriptEditor::Clipboard *VisualScriptEditor::clipboard = NULL;
+VisualScriptEditor::Clipboard *VisualScriptEditor::clipboard = nullptr;
void VisualScriptEditor::free_clipboard() {
if (clipboard)
@@ -4917,7 +4917,7 @@ Ref<VisualScriptNode> _VisualScriptEditor::create_node_custom(const String &p_na
return node;
}
-_VisualScriptEditor *_VisualScriptEditor::singleton = NULL;
+_VisualScriptEditor *_VisualScriptEditor::singleton = nullptr;
Map<String, REF> _VisualScriptEditor::custom_nodes;
_VisualScriptEditor::_VisualScriptEditor() {
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index c52315a477..71ed483d65 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -652,12 +652,12 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
while (true) {
//keep appending stuff to expression
- ENode *expr = NULL;
+ ENode *expr = nullptr;
Token tk;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
switch (tk.type) {
case TK_CURLY_BRACKET_OPEN: {
@@ -675,18 +675,18 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//parse an expression
ENode *expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
dn->dict.push_back(expr2);
_get_token(tk);
if (tk.type != TK_COLON) {
_set_error("Expected ':'");
- return NULL;
+ return nullptr;
}
expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
dn->dict.push_back(expr2);
@@ -719,7 +719,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//parse an expression
ENode *expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
an->array.push_back(expr2);
cofs = str_ofs;
@@ -739,11 +739,11 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//a suexpression
ENode *e = _parse_expression();
if (error_set)
- return NULL;
+ return nullptr;
_get_token(tk);
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')'");
- return NULL;
+ return nullptr;
}
expr = e;
@@ -766,7 +766,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
expr = input;
} else {
_set_error("Invalid input identifier '" + what + "'. For script variables, use self (locals are for inputs)." + what);
- return NULL;
+ return nullptr;
}
} break;
case TK_SELF: {
@@ -786,7 +786,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
ConstructorNode *constructor = alloc_node<ConstructorNode>();
@@ -803,7 +803,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//parse an expression
ENode *expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
constructor->arguments.push_back(expr2);
@@ -827,7 +827,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
@@ -844,7 +844,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//parse an expression
ENode *expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
bifunc->arguments.push_back(expr2);
@@ -886,7 +886,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
default: {
_set_error("Expected expression.");
- return NULL;
+ return nullptr;
} break;
}
@@ -896,7 +896,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
int cofs2 = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
bool done = false;
@@ -909,14 +909,14 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
ENode *what = _parse_expression();
if (!what)
- return NULL;
+ return nullptr;
index->index = what;
_get_token(tk);
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']' at end of index.");
- return NULL;
+ return nullptr;
}
expr = index;
@@ -926,7 +926,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_IDENTIFIER) {
_set_error("Expected identifier after '.'");
- return NULL;
+ return nullptr;
}
StringName identifier = tk.value;
@@ -950,7 +950,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
//parse an expression
ENode *expr2 = _parse_expression();
if (!expr2)
- return NULL;
+ return nullptr;
func_call->arguments.push_back(expr2);
@@ -1000,7 +1000,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
int cofs = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
Variant::Operator op = Variant::OP_MAX;
@@ -1107,7 +1107,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
default: {
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
- return NULL;
+ return nullptr;
}
}
@@ -1124,7 +1124,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// OK! create operator..
@@ -1137,7 +1137,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (expr_pos == expression.size()) {
//can happen..
_set_error("Unexpected end of expression...");
- return NULL;
+ return nullptr;
}
}
@@ -1147,7 +1147,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
OperatorNode *op = alloc_node<OperatorNode>();
op->op = expression[i].op;
op->nodes[0] = expression[i + 1].node;
- op->nodes[1] = NULL;
+ op->nodes[1] = nullptr;
expression.write[i].is_op = false;
expression.write[i].node = op;
expression.remove(i + 1);
@@ -1157,7 +1157,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1166,7 +1166,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (expression[next_op + 1].is_op) {
@@ -1176,7 +1176,7 @@ VisualScriptExpression::ENode *VisualScriptExpression::_parse_expression() {
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators.");
- return NULL;
+ return nullptr;
}
op->nodes[0] = expression[next_op - 1].node; //expression goes as left
@@ -1199,8 +1199,8 @@ bool VisualScriptExpression::_compile_expression() {
if (nodes) {
memdelete(nodes);
- nodes = NULL;
- root = NULL;
+ nodes = nullptr;
+ root = nullptr;
}
error_str = String();
@@ -1210,11 +1210,11 @@ bool VisualScriptExpression::_compile_expression() {
root = _parse_expression();
if (error_set) {
- root = NULL;
+ root = nullptr;
if (nodes) {
memdelete(nodes);
}
- nodes = NULL;
+ nodes = nullptr;
return true;
}
@@ -1478,8 +1478,8 @@ VisualScriptExpression::VisualScriptExpression() {
output_type = Variant::NIL;
expression_dirty = true;
error_set = true;
- root = NULL;
- nodes = NULL;
+ root = nullptr;
+ nodes = nullptr;
sequenced = false;
}
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index d131713ef0..61b50ff99d 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -138,7 +138,7 @@ class VisualScriptExpression : public VisualScriptNode {
Type type;
- ENode() { next = NULL; }
+ ENode() { next = nullptr; }
virtual ~ENode() {
if (next) {
memdelete(next);
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 011432ef39..3b6ae369ae 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -58,7 +58,7 @@ bool VisualScriptFunctionCall::has_input_sequence_port() const {
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
- return NULL;
+ return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -71,7 +71,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
- return NULL;
+ return nullptr;
}
#endif
@@ -80,33 +80,33 @@ Node *VisualScriptFunctionCall::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
- return NULL;
+ return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
- return NULL;
+ return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
- return NULL;
+ return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
- return NULL;
+ return nullptr;
if (!script_node->has_node(base_path))
- return NULL;
+ return nullptr;
Node *path_to = script_node->get_node(base_path);
return path_to;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -955,34 +955,34 @@ Node *VisualScriptPropertySet::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
- return NULL;
+ return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
- return NULL;
+ return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
- return NULL;
+ return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
- return NULL;
+ return nullptr;
if (!script_node->has_node(base_path))
- return NULL;
+ return nullptr;
Node *path_to = script_node->get_node(base_path);
return path_to;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -1021,7 +1021,7 @@ void VisualScriptPropertySet::_adjust_input_index(PropertyInfo &pinfo) const {
Variant v;
Callable::CallError ce;
- v = Variant::construct(pinfo.type, NULL, 0, ce);
+ v = Variant::construct(pinfo.type, nullptr, 0, ce);
Variant i = v.get(index);
pinfo.type = i.get_type();
}
@@ -1168,7 +1168,7 @@ void VisualScriptPropertySet::_update_cache() {
Variant v;
Callable::CallError ce;
- v = Variant::construct(basic_type, NULL, 0, ce);
+ v = Variant::construct(basic_type, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -1185,7 +1185,7 @@ void VisualScriptPropertySet::_update_cache() {
StringName type;
Ref<Script> script;
- Node *node = NULL;
+ Node *node = nullptr;
if (call_mode == CALL_MODE_NODE_PATH) {
@@ -1410,7 +1410,7 @@ void VisualScriptPropertySet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Callable::CallError ce;
- Variant v = Variant::construct(type_cache.type, NULL, 0, ce);
+ Variant v = Variant::construct(type_cache.type, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -1735,34 +1735,34 @@ Node *VisualScriptPropertyGet::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
- return NULL;
+ return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
- return NULL;
+ return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
- return NULL;
+ return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
- return NULL;
+ return nullptr;
if (!script_node->has_node(base_path))
- return NULL;
+ return nullptr;
Node *path_to = script_node->get_node(base_path);
return path_to;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -1876,7 +1876,7 @@ void VisualScriptPropertyGet::_update_cache() {
Variant v;
Callable::CallError ce;
- v = Variant::construct(basic_type, NULL, 0, ce);
+ v = Variant::construct(basic_type, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
@@ -1894,7 +1894,7 @@ void VisualScriptPropertyGet::_update_cache() {
StringName type;
Ref<Script> script;
- Node *node = NULL;
+ Node *node = nullptr;
if (call_mode == CALL_MODE_NODE_PATH) {
@@ -2125,7 +2125,7 @@ void VisualScriptPropertyGet::_validate_property(PropertyInfo &property) const {
if (property.name == "index") {
Callable::CallError ce;
- Variant v = Variant::construct(type_cache, NULL, 0, ce);
+ Variant v = Variant::construct(type_cache, nullptr, 0, ce);
List<PropertyInfo> plist;
v.get_property_list(&plist);
String options = "";
@@ -2501,7 +2501,7 @@ void register_visual_script_func_nodes() {
Variant::Type t = Variant::Type(i);
String type_name = Variant::get_type_name(t);
Callable::CallError ce;
- Variant vt = Variant::construct(t, NULL, 0, ce);
+ Variant vt = Variant::construct(t, nullptr, 0, ce);
List<MethodInfo> ml;
vt.get_method_list(&ml);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 1b496dad32..97c2686cd5 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -1483,7 +1483,7 @@ void VisualScriptConstant::set_constant_type(Variant::Type p_type) {
type = p_type;
Callable::CallError ce;
- value = Variant::construct(type, NULL, 0, ce);
+ value = Variant::construct(type, nullptr, 0, ce);
ports_changed_notify();
_change_notify();
}
@@ -2548,7 +2548,7 @@ VisualScriptNodeInstance *VisualScriptSceneNode::instance(VisualScriptInstance *
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
- return NULL;
+ return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -2561,7 +2561,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
- return NULL;
+ return nullptr;
}
#endif
@@ -4006,7 +4006,7 @@ void VisualScriptDeconstruct::_update_elements() {
elements.clear();
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
+ v = Variant::construct(type, nullptr, 0, ce);
List<PropertyInfo> pinfo;
v.get_property_list(&pinfo);
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index d749e3257a..f57853078d 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -97,7 +97,7 @@ void VisualScriptPropertySelector::_update_search() {
for (List<StringName>::Element *E = base_list.front(); E; E = E->next()) {
List<MethodInfo> methods;
List<PropertyInfo> props;
- TreeItem *category = NULL;
+ TreeItem *category = nullptr;
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
vbc->get_theme_icon("Variant", "EditorIcons"),
vbc->get_theme_icon("bool", "EditorIcons"),
@@ -196,7 +196,7 @@ void VisualScriptPropertySelector::_update_search() {
if (type != Variant::NIL) {
Variant v;
Callable::CallError ce;
- v = Variant::construct(type, NULL, 0, ce);
+ v = Variant::construct(type, nullptr, 0, ce);
v.get_method_list(&methods);
} else {
@@ -264,7 +264,7 @@ void VisualScriptPropertySelector::_update_search() {
item->set_metadata(2, connecting);
}
- if (category && category->get_children() == NULL) {
+ if (category && category->get_children() == nullptr) {
memdelete(category); //old category was unused
}
}
@@ -304,12 +304,12 @@ void VisualScriptPropertySelector::_update_search() {
}
TreeItem *selected_item = search_options->search_item_text(search_box->get_text());
- if (!found && selected_item != NULL) {
+ if (!found && selected_item != nullptr) {
selected_item->select(0);
found = true;
}
- get_ok()->set_disabled(root->get_children() == NULL);
+ get_ok()->set_disabled(root->get_children() == nullptr);
}
void VisualScriptPropertySelector::create_visualscript_item(const String &name, TreeItem *const root, const String &search_input, const String &text) {
@@ -481,7 +481,7 @@ void VisualScriptPropertySelector::_item_selected() {
List<String> *names = memnew(List<String>);
VisualScriptLanguage::singleton->get_registered_node_names(names);
- if (names->find(name) != NULL) {
+ if (names->find(name) != nullptr) {
Ref<VisualScriptOperator> operator_node = VisualScriptLanguage::singleton->create_node_from_name(name);
if (operator_node.is_valid()) {
Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(operator_node->get_class_name());
@@ -536,7 +536,7 @@ void VisualScriptPropertySelector::select_method_from_base_type(const String &p_
selected = p_current;
type = Variant::NIL;
properties = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = p_virtuals_only;
show_window(.5f);
@@ -561,7 +561,7 @@ void VisualScriptPropertySelector::select_from_base_type(const String &p_base, c
type = Variant::NIL;
properties = true;
visual_script_generic = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = p_virtuals_only;
show_window(.5f);
@@ -585,7 +585,7 @@ void VisualScriptPropertySelector::select_from_script(const Ref<Script> &p_scrip
script = p_script->get_instance_id();
properties = true;
visual_script_generic = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
show_window(.5f);
@@ -607,7 +607,7 @@ void VisualScriptPropertySelector::select_from_basic_type(Variant::Type p_type,
type = p_type;
properties = true;
visual_script_generic = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
show_window(.5f);
@@ -628,7 +628,7 @@ void VisualScriptPropertySelector::select_from_action(const String &p_type, cons
type = Variant::NIL;
properties = false;
visual_script_generic = false;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
show_window(.5f);
@@ -670,7 +670,7 @@ void VisualScriptPropertySelector::select_from_visual_script(const String &p_bas
type = Variant::NIL;
properties = true;
visual_script_generic = true;
- instance = NULL;
+ instance = nullptr;
virtuals_only = false;
show_window(.5f);
if (clear_text)
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index 858074742e..b300aec385 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -228,7 +228,7 @@ bool VisualScriptYieldSignal::has_input_sequence_port() const {
static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const Ref<Script> &script) {
if (p_edited_scene != p_current_node && p_current_node->get_owner() != p_edited_scene)
- return NULL;
+ return nullptr;
Ref<Script> scr = p_current_node->get_script();
@@ -241,7 +241,7 @@ static Node *_find_script_node(Node *p_edited_scene, Node *p_current_node, const
return n;
}
- return NULL;
+ return nullptr;
}
#endif
@@ -250,33 +250,33 @@ Node *VisualScriptYieldSignal::_get_base_node() const {
#ifdef TOOLS_ENABLED
Ref<Script> script = get_visual_script();
if (!script.is_valid())
- return NULL;
+ return nullptr;
MainLoop *main_loop = OS::get_singleton()->get_main_loop();
SceneTree *scene_tree = Object::cast_to<SceneTree>(main_loop);
if (!scene_tree)
- return NULL;
+ return nullptr;
Node *edited_scene = scene_tree->get_edited_scene_root();
if (!edited_scene)
- return NULL;
+ return nullptr;
Node *script_node = _find_script_node(edited_scene, edited_scene, script);
if (!script_node)
- return NULL;
+ return nullptr;
if (!script_node->has_node(base_path))
- return NULL;
+ return nullptr;
Node *path_to = script_node->get_node(base_path);
return path_to;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -516,7 +516,7 @@ public:
} else {
//yield
- Object *object = NULL;
+ Object *object = nullptr;
switch (call_mode) {
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index bde4359595..05d46757d3 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Only kept to build the thirdparty library used by the theora and webm
# modules. We now use stb_vorbis for AudioStreamOGGVorbis.
@@ -11,11 +11,11 @@ env_vorbis = env_modules.Clone()
stub = True
# Thirdparty source files
-if env['builtin_libvorbis']:
+if env["builtin_libvorbis"]:
thirdparty_dir = "#thirdparty/libvorbis/"
thirdparty_sources = [
- #"analysis.c",
- #"barkmel.c",
+ # "analysis.c",
+ # "barkmel.c",
"bitrate.c",
"block.c",
"codebook.c",
@@ -29,14 +29,14 @@ if env['builtin_libvorbis']:
"mapping0.c",
"mdct.c",
"psy.c",
- #"psytune.c",
+ # "psytune.c",
"registry.c",
"res0.c",
"sharedbook.c",
"smallft.c",
"synthesis.c",
- #"tone.c",
- #"vorbisenc.c",
+ # "tone.c",
+ # "vorbisenc.c",
"vorbisfile.c",
"window.c",
]
@@ -46,7 +46,7 @@ if env['builtin_libvorbis']:
env_vorbis.Prepend(CPPPATH=[thirdparty_dir])
# also requires libogg
- if env['builtin_libogg']:
+ if env["builtin_libogg"]:
env_vorbis.Prepend(CPPPATH=["#thirdparty/libogg"])
env_thirdparty = env_vorbis.Clone()
diff --git a/modules/vorbis/config.py b/modules/vorbis/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/vorbis/config.py
+++ b/modules/vorbis/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/webm/SCsub b/modules/webm/SCsub
index 32e6727656..247b4ead37 100644
--- a/modules/webm/SCsub
+++ b/modules/webm/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_webm = env_modules.Clone()
@@ -18,14 +18,14 @@ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_webm.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus
-if env['builtin_libogg']:
+if env["builtin_libogg"]:
env_webm.Prepend(CPPPATH=["#thirdparty/libogg"])
-if env['builtin_libvorbis']:
+if env["builtin_libvorbis"]:
env_webm.Prepend(CPPPATH=["#thirdparty/libvorbis"])
-if env['builtin_opus']:
+if env["builtin_opus"]:
env_webm.Prepend(CPPPATH=["#thirdparty/opus"])
-if env['builtin_libvpx']:
+if env["builtin_libvpx"]:
env_webm.Prepend(CPPPATH=["#thirdparty/libvpx"])
SConscript("libvpx/SCsub")
diff --git a/modules/webm/config.py b/modules/webm/config.py
index ba4dcce2f5..93b49d177a 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -1,13 +1,16 @@
def can_build(env, platform):
- return platform not in ['iphone']
+ return platform not in ["iphone"]
+
def configure(env):
pass
+
def get_doc_classes():
return [
"VideoStreamWebm",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index 6aed8a16f5..dd6866ad0e 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Thirdparty sources
@@ -9,9 +9,7 @@ libvpx_dir = "#thirdparty/libvpx/"
libvpx_sources = [
"vp8/vp8_dx_iface.c",
-
"vp8/common/generic/systemdependent.c",
-
"vp8/common/alloccommon.c",
"vp8/common/blockd.c",
"vp8/common/copy_c.c",
@@ -37,16 +35,12 @@ libvpx_sources = [
"vp8/common/swapyv12buffer.c",
"vp8/common/treecoder.c",
"vp8/common/vp8_loopfilter.c",
-
"vp8/decoder/dboolhuff.c",
"vp8/decoder/decodeframe.c",
"vp8/decoder/decodemv.c",
"vp8/decoder/detokenize.c",
"vp8/decoder/onyxd_if.c",
-
-
"vp9/vp9_dx_iface.c",
-
"vp9/common/vp9_alloccommon.c",
"vp9/common/vp9_blockd.c",
"vp9/common/vp9_common_data.c",
@@ -69,21 +63,16 @@ libvpx_sources = [
"vp9/common/vp9_seg_common.c",
"vp9/common/vp9_thread_common.c",
"vp9/common/vp9_tile_common.c",
-
"vp9/decoder/vp9_decodeframe.c",
"vp9/decoder/vp9_decodemv.c",
"vp9/decoder/vp9_decoder.c",
"vp9/decoder/vp9_detokenize.c",
"vp9/decoder/vp9_dsubexp.c",
"vp9/decoder/vp9_dthread.c",
-
-
"vpx/src/vpx_codec.c",
"vpx/src/vpx_decoder.c",
"vpx/src/vpx_image.c",
"vpx/src/vpx_psnr.c",
-
-
"vpx_dsp/bitreader.c",
"vpx_dsp/bitreader_buffer.c",
"vpx_dsp/intrapred.c",
@@ -92,18 +81,11 @@ libvpx_sources = [
"vpx_dsp/prob.c",
"vpx_dsp/vpx_convolve.c",
"vpx_dsp/vpx_dsp_rtcd.c",
-
-
"vpx_mem/vpx_mem.c",
-
-
"vpx_scale/vpx_scale_rtcd.c",
-
"vpx_scale/generic/yv12config.c",
"vpx_scale/generic/yv12extend.c",
-
-
- "vpx_util/vpx_thread.c"
+ "vpx_util/vpx_thread.c",
]
libvpx_sources_mt = [
@@ -114,29 +96,23 @@ libvpx_sources_intrin_x86 = [
"vp8/common/x86/filter_x86.c",
"vp8/common/x86/loopfilter_x86.c",
"vp8/common/x86/vp8_asm_stubs.c",
-
-
- "vpx_dsp/x86/vpx_asm_stubs.c"
+ "vpx_dsp/x86/vpx_asm_stubs.c",
]
libvpx_sources_intrin_x86_mmx = [
"vp8/common/x86/idct_blk_mmx.c",
]
libvpx_sources_intrin_x86_sse2 = [
"vp8/common/x86/idct_blk_sse2.c",
-
-
"vp9/common/x86/vp9_idct_intrin_sse2.c",
-
-
"vpx_dsp/x86/inv_txfm_sse2.c",
"vpx_dsp/x86/loopfilter_sse2.c",
]
libvpx_sources_intrin_x86_ssse3 = [
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c"
+ "vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c",
]
libvpx_sources_intrin_x86_avx2 = [
"vpx_dsp/x86/loopfilter_avx2.c",
- "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c"
+ "vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c",
]
libvpx_sources_x86asm = [
"vp8/common/x86/copy_sse2.asm",
@@ -153,8 +129,6 @@ libvpx_sources_x86asm = [
"vp8/common/x86/subpixel_sse2.asm",
"vp8/common/x86/subpixel_ssse3.asm",
"vp8/common/x86/vp8_loopfilter_mmx.asm",
-
-
"vpx_dsp/x86/intrapred_sse2.asm",
"vpx_dsp/x86/intrapred_ssse3.asm",
"vpx_dsp/x86/inv_wht_sse2.asm",
@@ -163,21 +137,15 @@ libvpx_sources_x86asm = [
"vpx_dsp/x86/vpx_subpixel_8t_ssse3.asm",
"vpx_dsp/x86/vpx_subpixel_bilinear_sse2.asm",
"vpx_dsp/x86/vpx_subpixel_bilinear_ssse3.asm",
-
-
- "vpx_ports/emms.asm"
+ "vpx_ports/emms.asm",
]
libvpx_sources_x86_64asm = [
"vp8/common/x86/loopfilter_block_sse2_x86_64.asm",
-
-
- "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm"
+ "vpx_dsp/x86/inv_txfm_ssse3_x86_64.asm",
]
libvpx_sources_arm = [
"vpx_ports/arm_cpudetect.c",
-
-
"vp8/common/arm/loopfilter_arm.c",
]
libvpx_sources_arm_neon = [
@@ -196,12 +164,8 @@ libvpx_sources_arm_neon = [
"vp8/common/arm/neon/shortidct4x4llm_neon.c",
"vp8/common/arm/neon/sixtappredict_neon.c",
"vp8/common/arm/neon/vp8_loopfilter_neon.c",
-
-
"vp9/common/arm/neon/vp9_iht4x4_add_neon.c",
"vp9/common/arm/neon/vp9_iht8x8_add_neon.c",
-
-
"vpx_dsp/arm/idct16x16_1_add_neon.c",
"vpx_dsp/arm/idct16x16_add_neon.c",
"vpx_dsp/arm/idct16x16_neon.c",
@@ -220,22 +184,22 @@ libvpx_sources_arm_neon = [
"vpx_dsp/arm/vpx_convolve8_neon.c",
"vpx_dsp/arm/vpx_convolve_avg_neon.c",
"vpx_dsp/arm/vpx_convolve_copy_neon.c",
- "vpx_dsp/arm/vpx_convolve_neon.c"
+ "vpx_dsp/arm/vpx_convolve_neon.c",
]
libvpx_sources_arm_neon_gas = [
"vpx_dsp/arm/gas/intrapred_neon_asm.s",
"vpx_dsp/arm/gas/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas/save_reg_neon.s"
+ "vpx_dsp/arm/gas/save_reg_neon.s",
]
libvpx_sources_arm_neon_armasm_ms = [
"vpx_dsp/arm/armasm_ms/intrapred_neon_asm.asm",
"vpx_dsp/arm/armasm_ms/loopfilter_mb_neon.asm",
- "vpx_dsp/arm/armasm_ms/save_reg_neon.asm"
+ "vpx_dsp/arm/armasm_ms/save_reg_neon.asm",
]
libvpx_sources_arm_neon_gas_apple = [
"vpx_dsp/arm/gas_apple/intrapred_neon_asm.s",
"vpx_dsp/arm/gas_apple/loopfilter_mb_neon.s",
- "vpx_dsp/arm/gas_apple/save_reg_neon.s"
+ "vpx_dsp/arm/gas_apple/save_reg_neon.s",
]
libvpx_sources = [libvpx_dir + file for file in libvpx_sources]
@@ -258,25 +222,43 @@ env_libvpx = env_modules.Clone()
env_libvpx.disable_warnings()
env_libvpx.Prepend(CPPPATH=[libvpx_dir])
-webm_multithread = env["platform"] != 'javascript'
+webm_multithread = env["platform"] != "javascript"
cpu_bits = env["bits"]
webm_cpu_x86 = False
webm_cpu_arm = False
-if env["platform"] == 'uwp':
- if 'arm' in env["PROGSUFFIX"]:
+if env["platform"] == "uwp":
+ if "arm" in env["PROGSUFFIX"]:
webm_cpu_arm = True
else:
webm_cpu_x86 = True
else:
import platform
- is_x11_or_server_arm = ((env["platform"] == 'linuxbsd' or env["platform"] == 'server') and (platform.machine().startswith('arm') or platform.machine().startswith('aarch')))
- is_ios_x86 = (env["platform"] == 'iphone' and ("arch" in env and env["arch"].startswith('x86')))
- is_android_x86 = (env["platform"] == 'android' and env["android_arch"].startswith('x86'))
+
+ is_x11_or_server_arm = (env["platform"] == "linuxbsd" or env["platform"] == "server") and (
+ platform.machine().startswith("arm") or platform.machine().startswith("aarch")
+ )
+ is_ios_x86 = env["platform"] == "iphone" and ("arch" in env and env["arch"].startswith("x86"))
+ is_android_x86 = env["platform"] == "android" and env["android_arch"].startswith("x86")
if is_android_x86:
- cpu_bits = '32' if env["android_arch"] == 'x86' else '64'
- webm_cpu_x86 = not is_x11_or_server_arm and (cpu_bits == '32' or cpu_bits == '64') and (env["platform"] == 'windows' or env["platform"] == 'linuxbsd' or env["platform"] == 'osx' or env["platform"] == 'haiku' or is_android_x86 or is_ios_x86)
- webm_cpu_arm = is_x11_or_server_arm or (not is_ios_x86 and env["platform"] == 'iphone') or (not is_android_x86 and env["platform"] == 'android')
+ cpu_bits = "32" if env["android_arch"] == "x86" else "64"
+ webm_cpu_x86 = (
+ not is_x11_or_server_arm
+ and (cpu_bits == "32" or cpu_bits == "64")
+ and (
+ env["platform"] == "windows"
+ or env["platform"] == "linuxbsd"
+ or env["platform"] == "osx"
+ or env["platform"] == "haiku"
+ or is_android_x86
+ or is_ios_x86
+ )
+ )
+ webm_cpu_arm = (
+ is_x11_or_server_arm
+ or (not is_ios_x86 and env["platform"] == "iphone")
+ or (not is_android_x86 and env["platform"] == "android")
+ )
if webm_cpu_x86:
import subprocess
@@ -306,38 +288,43 @@ if webm_cpu_x86:
webm_simd_optimizations = False
if webm_cpu_x86:
- if env["platform"] == 'windows' or env["platform"] == 'uwp':
- env_libvpx["ASFORMAT"] = 'win'
- elif env["platform"] == 'osx' or env["platform"] == "iphone":
- env_libvpx["ASFORMAT"] = 'macho'
+ if env["platform"] == "windows" or env["platform"] == "uwp":
+ env_libvpx["ASFORMAT"] = "win"
+ elif env["platform"] == "osx" or env["platform"] == "iphone":
+ env_libvpx["ASFORMAT"] = "macho"
else:
- env_libvpx["ASFORMAT"] = 'elf'
+ env_libvpx["ASFORMAT"] = "elf"
env_libvpx["ASFORMAT"] += cpu_bits
- env_libvpx["AS"] = 'yasm'
- env_libvpx["ASFLAGS"] = '-I' + libvpx_dir[1:] + ' -f $ASFORMAT -D $ASCPU'
- env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
+ env_libvpx["AS"] = "yasm"
+ env_libvpx["ASFLAGS"] = "-I" + libvpx_dir[1:] + " -f $ASFORMAT -D $ASCPU"
+ env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES"
- if cpu_bits == '32':
- env_libvpx["ASCPU"] = 'X86_32'
- elif cpu_bits == '64':
- env_libvpx["ASCPU"] = 'X86_64'
+ if cpu_bits == "32":
+ env_libvpx["ASCPU"] = "X86_32"
+ elif cpu_bits == "64":
+ env_libvpx["ASCPU"] = "X86_64"
- env_libvpx.Append(CPPDEFINES=['WEBM_X86ASM'])
+ env_libvpx.Append(CPPDEFINES=["WEBM_X86ASM"])
webm_simd_optimizations = True
if webm_cpu_arm:
- if env["platform"] == 'iphone':
- env_libvpx["ASFLAGS"] = '-arch armv7'
- elif env["platform"] == 'android' and env["android_arch"] == 'armv7' or env["platform"] == 'linuxbsd' or env["platform"] == 'server':
- env_libvpx["ASFLAGS"] = '-mfpu=neon'
- elif env["platform"] == 'uwp':
- env_libvpx["AS"] = 'armasm'
- env_libvpx["ASFLAGS"] = ''
- env_libvpx["ASCOM"] = '$AS $ASFLAGS -o $TARGET $SOURCES'
-
- env_libvpx.Append(CPPDEFINES=['WEBM_ARMASM'])
+ if env["platform"] == "iphone":
+ env_libvpx["ASFLAGS"] = "-arch armv7"
+ elif (
+ env["platform"] == "android"
+ and env["android_arch"] == "armv7"
+ or env["platform"] == "linuxbsd"
+ or env["platform"] == "server"
+ ):
+ env_libvpx["ASFLAGS"] = "-mfpu=neon"
+ elif env["platform"] == "uwp":
+ env_libvpx["AS"] = "armasm"
+ env_libvpx["ASFLAGS"] = ""
+ env_libvpx["ASCOM"] = "$AS $ASFLAGS -o $TARGET $SOURCES"
+
+ env_libvpx.Append(CPPDEFINES=["WEBM_ARMASM"])
webm_simd_optimizations = True
@@ -350,45 +337,49 @@ if webm_multithread:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_mt)
if webm_cpu_x86:
- is_clang_or_gcc = ('gcc' in os.path.basename(env["CC"])) or ('clang' in os.path.basename(env["CC"])) or ("osxcross" in env)
+ is_clang_or_gcc = (
+ ("gcc" in os.path.basename(env["CC"])) or ("clang" in os.path.basename(env["CC"])) or ("osxcross" in env)
+ )
env_libvpx_mmx = env_libvpx.Clone()
- if cpu_bits == '32' and is_clang_or_gcc:
- env_libvpx_mmx.Append(CCFLAGS=['-mmmx'])
+ if cpu_bits == "32" and is_clang_or_gcc:
+ env_libvpx_mmx.Append(CCFLAGS=["-mmmx"])
env_libvpx_mmx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_mmx)
env_libvpx_sse2 = env_libvpx.Clone()
- if cpu_bits == '32' and is_clang_or_gcc:
- env_libvpx_sse2.Append(CCFLAGS=['-msse2'])
+ if cpu_bits == "32" and is_clang_or_gcc:
+ env_libvpx_sse2.Append(CCFLAGS=["-msse2"])
env_libvpx_sse2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_sse2)
env_libvpx_ssse3 = env_libvpx.Clone()
if is_clang_or_gcc:
- env_libvpx_ssse3.Append(CCFLAGS=['-mssse3'])
+ env_libvpx_ssse3.Append(CCFLAGS=["-mssse3"])
env_libvpx_ssse3.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_ssse3)
env_libvpx_avx2 = env_libvpx.Clone()
if is_clang_or_gcc:
- env_libvpx_avx2.Append(CCFLAGS=['-mavx2'])
+ env_libvpx_avx2.Append(CCFLAGS=["-mavx2"])
env_libvpx_avx2.add_source_files(env.modules_sources, libvpx_sources_intrin_x86_avx2)
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_intrin_x86)
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86asm)
- if cpu_bits == '64':
+ if cpu_bits == "64":
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
- if env["platform"] == 'android':
+ if env["platform"] == "android":
env_libvpx.Prepend(CPPPATH=[libvpx_dir + "third_party/android"])
env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
env_libvpx_neon = env_libvpx.Clone()
env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
- if env["platform"] == 'uwp':
+ if env["platform"] == "uwp":
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_armasm_ms)
- elif env["platform"] == 'iphone':
+ elif env["platform"] == "iphone":
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm_neon_gas_apple)
- elif (is_x11_or_server_arm and cpu_bits == '32') or (env["platform"] == 'android' and 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/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 265383831e..ca78d664f7 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -96,17 +96,17 @@ private:
VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() :
audio_track(0),
- webm(NULL),
- video(NULL),
- audio(NULL),
- video_frames(NULL),
- audio_frame(NULL),
+ webm(nullptr),
+ video(nullptr),
+ audio(nullptr),
+ video_frames(nullptr),
+ audio_frame(nullptr),
video_frames_pos(0),
video_frames_capacity(0),
num_decoded_samples(0),
samples_offset(-1),
- mix_callback(NULL),
- mix_udata(NULL),
+ mix_callback(nullptr),
+ mix_udata(nullptr),
playing(false),
paused(false),
delay_compensation(0.0),
@@ -114,7 +114,7 @@ VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() :
video_frame_delay(0.0),
video_pos(0.0),
texture(memnew(ImageTexture)),
- pcm(NULL) {}
+ pcm(nullptr) {}
VideoStreamPlaybackWebm::~VideoStreamPlaybackWebm() {
delete_pointers();
@@ -137,7 +137,7 @@ bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
} else {
memdelete(audio);
- audio = NULL;
+ audio = nullptr;
}
frame_data.resize((webm->getWidth() * webm->getHeight()) << 2);
@@ -149,10 +149,10 @@ bool VideoStreamPlaybackWebm::open_file(const String &p_file) {
return true;
}
memdelete(video);
- video = NULL;
+ video = nullptr;
}
memdelete(webm);
- webm = NULL;
+ webm = nullptr;
return false;
}
@@ -162,13 +162,13 @@ void VideoStreamPlaybackWebm::stop() {
delete_pointers();
- pcm = NULL;
+ pcm = nullptr;
- audio_frame = NULL;
- video_frames = NULL;
+ audio_frame = nullptr;
+ video_frames = nullptr;
- video = NULL;
- audio = NULL;
+ video = nullptr;
+ audio = nullptr;
open_file(file_name); //Should not fail here...
@@ -447,7 +447,7 @@ Ref<VideoStreamPlayback> VideoStreamWebm::instance_playback() {
pb->set_audio_track(audio_track);
if (pb->open_file(file))
return pb;
- return NULL;
+ return nullptr;
}
void VideoStreamWebm::set_file(const String &p_file) {
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index 3feaa1278f..bc209e0057 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -128,7 +128,7 @@ public:
class ResourceFormatLoaderWebm : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index 666628bb44..58f2bb35e6 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_webp = env_modules.Clone()
# Thirdparty source files
-if env['builtin_libwebp']:
+if env["builtin_libwebp"]:
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [
"dec/alpha_dec.c",
diff --git a/modules/webp/config.py b/modules/webp/config.py
index 1c8cd12a2d..d22f9454ed 100644
--- a/modules/webp/config.py
+++ b/modules/webp/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 09a8985472..0998977bb4 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -52,7 +52,7 @@ static Vector<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_quali
Vector<uint8_t> data = img->get_data();
const uint8_t *r = data.ptr();
- uint8_t *dst_buff = NULL;
+ uint8_t *dst_buff = nullptr;
size_t dst_size = 0;
if (img->get_format() == Image::FORMAT_RGB8) {
@@ -101,9 +101,9 @@ static Ref<Image> _webp_lossy_unpack(const Vector<uint8_t> &p_buffer) {
bool errdec = false;
if (features.has_alpha) {
- errdec = WebPDecodeRGBAInto(&r[4], size, dst_w, datasize, 4 * features.width) == NULL;
+ errdec = WebPDecodeRGBAInto(&r[4], size, dst_w, datasize, 4 * features.width) == nullptr;
} else {
- errdec = WebPDecodeRGBInto(&r[4], size, dst_w, datasize, 3 * features.width) == NULL;
+ errdec = WebPDecodeRGBInto(&r[4], size, dst_w, datasize, 3 * features.width) == nullptr;
}
ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image.");
@@ -128,9 +128,9 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p
bool errdec = false;
if (features.has_alpha) {
- errdec = WebPDecodeRGBAInto(p_buffer, p_buffer_len, dst_w, datasize, 4 * features.width) == NULL;
+ errdec = WebPDecodeRGBAInto(p_buffer, p_buffer_len, dst_w, datasize, 4 * features.width) == nullptr;
} else {
- errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w, datasize, 3 * features.width) == NULL;
+ errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w, datasize, 3 * features.width) == nullptr;
}
ERR_FAIL_COND_V_MSG(errdec, ERR_FILE_CORRUPT, "Failed decoding WebP image.");
diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp
index 12a0c05f44..fe945b01d4 100644
--- a/modules/webp/register_types.cpp
+++ b/modules/webp/register_types.cpp
@@ -32,7 +32,7 @@
#include "image_loader_webp.h"
-static ImageLoaderWEBP *image_loader_webp = NULL;
+static ImageLoaderWEBP *image_loader_webp = nullptr;
void register_webp_types() {
diff --git a/modules/webrtc/SCsub b/modules/webrtc/SCsub
index 868553b879..20b4c8f8d2 100644
--- a/modules/webrtc/SCsub
+++ b/modules/webrtc/SCsub
@@ -1,15 +1,15 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Thirdparty source files
env_webrtc = env_modules.Clone()
use_gdnative = env_webrtc["module_gdnative_enabled"]
-if use_gdnative: # GDNative is retained in Javascript for export compatibility
- env_webrtc.Append(CPPDEFINES=['WEBRTC_GDNATIVE_ENABLED'])
+if use_gdnative: # GDNative is retained in Javascript for export compatibility
+ env_webrtc.Append(CPPDEFINES=["WEBRTC_GDNATIVE_ENABLED"])
env_webrtc.Prepend(CPPPATH=["#modules/gdnative/include/"])
env_webrtc.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webrtc/config.py b/modules/webrtc/config.py
index 48b4c33c5d..0a075ccef1 100644
--- a/modules/webrtc/config.py
+++ b/modules/webrtc/config.py
@@ -1,15 +1,18 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"WebRTCPeerConnection",
"WebRTCDataChannel",
- "WebRTCMultiplayer"
+ "WebRTCMultiplayer",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/webrtc/webrtc_data_channel_gdnative.cpp b/modules/webrtc/webrtc_data_channel_gdnative.cpp
index b0c4b473fc..67ad2c07ce 100644
--- a/modules/webrtc/webrtc_data_channel_gdnative.cpp
+++ b/modules/webrtc/webrtc_data_channel_gdnative.cpp
@@ -39,94 +39,94 @@ void WebRTCDataChannelGDNative::_bind_methods() {
}
WebRTCDataChannelGDNative::WebRTCDataChannelGDNative() {
- interface = NULL;
+ interface = nullptr;
}
WebRTCDataChannelGDNative::~WebRTCDataChannelGDNative() {
}
Error WebRTCDataChannelGDNative::poll() {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->poll(interface->data);
}
void WebRTCDataChannelGDNative::close() {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->close(interface->data);
}
void WebRTCDataChannelGDNative::set_write_mode(WriteMode p_mode) {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->set_write_mode(interface->data, p_mode);
}
WebRTCDataChannel::WriteMode WebRTCDataChannelGDNative::get_write_mode() const {
- ERR_FAIL_COND_V(interface == NULL, WRITE_MODE_BINARY);
+ ERR_FAIL_COND_V(interface == nullptr, WRITE_MODE_BINARY);
return (WriteMode)interface->get_write_mode(interface->data);
}
bool WebRTCDataChannelGDNative::was_string_packet() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->was_string_packet(interface->data);
}
WebRTCDataChannel::ChannelState WebRTCDataChannelGDNative::get_ready_state() const {
- ERR_FAIL_COND_V(interface == NULL, STATE_CLOSED);
+ ERR_FAIL_COND_V(interface == nullptr, STATE_CLOSED);
return (ChannelState)interface->get_ready_state(interface->data);
}
String WebRTCDataChannelGDNative::get_label() const {
- ERR_FAIL_COND_V(interface == NULL, "");
+ ERR_FAIL_COND_V(interface == nullptr, "");
return String(interface->get_label(interface->data));
}
bool WebRTCDataChannelGDNative::is_ordered() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->is_ordered(interface->data);
}
int WebRTCDataChannelGDNative::get_id() const {
- ERR_FAIL_COND_V(interface == NULL, -1);
+ ERR_FAIL_COND_V(interface == nullptr, -1);
return interface->get_id(interface->data);
}
int WebRTCDataChannelGDNative::get_max_packet_life_time() const {
- ERR_FAIL_COND_V(interface == NULL, -1);
+ ERR_FAIL_COND_V(interface == nullptr, -1);
return interface->get_max_packet_life_time(interface->data);
}
int WebRTCDataChannelGDNative::get_max_retransmits() const {
- ERR_FAIL_COND_V(interface == NULL, -1);
+ ERR_FAIL_COND_V(interface == nullptr, -1);
return interface->get_max_retransmits(interface->data);
}
String WebRTCDataChannelGDNative::get_protocol() const {
- ERR_FAIL_COND_V(interface == NULL, "");
+ ERR_FAIL_COND_V(interface == nullptr, "");
return String(interface->get_protocol(interface->data));
}
bool WebRTCDataChannelGDNative::is_negotiated() const {
- ERR_FAIL_COND_V(interface == NULL, false);
+ ERR_FAIL_COND_V(interface == nullptr, false);
return interface->is_negotiated(interface->data);
}
Error WebRTCDataChannelGDNative::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->get_packet(interface->data, r_buffer, &r_buffer_size);
}
Error WebRTCDataChannelGDNative::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->put_packet(interface->data, p_buffer, p_buffer_size);
}
int WebRTCDataChannelGDNative::get_max_packet_size() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_max_packet_size(interface->data);
}
int WebRTCDataChannelGDNative::get_available_packet_count() const {
- ERR_FAIL_COND_V(interface == NULL, 0);
+ ERR_FAIL_COND_V(interface == nullptr, 0);
return interface->get_available_packet_count(interface->data);
}
diff --git a/modules/webrtc/webrtc_data_channel_js.cpp b/modules/webrtc/webrtc_data_channel_js.cpp
index 37203a4ec9..1b360720a2 100644
--- a/modules/webrtc/webrtc_data_channel_js.cpp
+++ b/modules/webrtc/webrtc_data_channel_js.cpp
@@ -334,7 +334,7 @@ WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
stringToUTF8(str, ptr, len+1);
return ptr;
}, js_id);
- if(str != NULL) {
+ if(str != nullptr) {
_label.parse_utf8(str);
EM_ASM({ _free($0) }, str);
}
@@ -347,7 +347,7 @@ WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
stringToUTF8(str, ptr, len+1);
return ptr;
}, js_id);
- if(str != NULL) {
+ if(str != nullptr) {
_protocol.parse_utf8(str);
EM_ASM({ _free($0) }, str);
}
diff --git a/modules/webrtc/webrtc_multiplayer.cpp b/modules/webrtc/webrtc_multiplayer.cpp
index c24ae3468f..78a4d1e61a 100644
--- a/modules/webrtc/webrtc_multiplayer.cpp
+++ b/modules/webrtc/webrtc_multiplayer.cpp
@@ -316,7 +316,7 @@ Error WebRTCMultiplayer::put_packet(const uint8_t *p_buffer, int p_buffer_size)
break;
}
- Map<int, Ref<ConnectedPeer>>::Element *E = NULL;
+ Map<int, Ref<ConnectedPeer>>::Element *E = nullptr;
if (target_peer > 0) {
@@ -371,6 +371,7 @@ WebRTCMultiplayer::WebRTCMultiplayer() {
unique_id = 0;
next_packet_peer = 0;
target_peer = 0;
+ client_count = 0;
transfer_mode = TRANSFER_MODE_RELIABLE;
refuse_connections = false;
connection_status = CONNECTION_DISCONNECTED;
diff --git a/modules/webrtc/webrtc_peer_connection.cpp b/modules/webrtc/webrtc_peer_connection.cpp
index 90c62e2495..399e4f09ff 100644
--- a/modules/webrtc/webrtc_peer_connection.cpp
+++ b/modules/webrtc/webrtc_peer_connection.cpp
@@ -30,7 +30,7 @@
#include "webrtc_peer_connection.h"
-WebRTCPeerConnection *(*WebRTCPeerConnection::_create)() = NULL;
+WebRTCPeerConnection *(*WebRTCPeerConnection::_create)() = nullptr;
Ref<WebRTCPeerConnection> WebRTCPeerConnection::create_ref() {
@@ -40,7 +40,7 @@ Ref<WebRTCPeerConnection> WebRTCPeerConnection::create_ref() {
WebRTCPeerConnection *WebRTCPeerConnection::create() {
if (!_create)
- return NULL;
+ return nullptr;
return _create();
}
diff --git a/modules/webrtc/webrtc_peer_connection_gdnative.cpp b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
index 411ad50275..f082646629 100644
--- a/modules/webrtc/webrtc_peer_connection_gdnative.cpp
+++ b/modules/webrtc/webrtc_peer_connection_gdnative.cpp
@@ -36,12 +36,12 @@
#include "modules/gdnative/nativescript/nativescript.h"
#include "webrtc_data_channel_gdnative.h"
-const godot_net_webrtc_library *WebRTCPeerConnectionGDNative::default_library = NULL;
+const godot_net_webrtc_library *WebRTCPeerConnectionGDNative::default_library = nullptr;
Error WebRTCPeerConnectionGDNative::set_default_library(const godot_net_webrtc_library *p_lib) {
if (default_library) {
const godot_net_webrtc_library *old = default_library;
- default_library = NULL;
+ default_library = nullptr;
old->unregistered();
}
default_library = p_lib;
@@ -64,54 +64,54 @@ void WebRTCPeerConnectionGDNative::_bind_methods() {
}
WebRTCPeerConnectionGDNative::WebRTCPeerConnectionGDNative() {
- interface = NULL;
+ interface = nullptr;
}
WebRTCPeerConnectionGDNative::~WebRTCPeerConnectionGDNative() {
}
Error WebRTCPeerConnectionGDNative::initialize(Dictionary p_config) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->initialize(interface->data, (const godot_dictionary *)&p_config);
}
Ref<WebRTCDataChannel> WebRTCPeerConnectionGDNative::create_data_channel(String p_label, Dictionary p_options) {
- ERR_FAIL_COND_V(interface == NULL, NULL);
+ ERR_FAIL_COND_V(interface == nullptr, nullptr);
return (WebRTCDataChannel *)interface->create_data_channel(interface->data, p_label.utf8().get_data(), (const godot_dictionary *)&p_options);
}
Error WebRTCPeerConnectionGDNative::create_offer() {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->create_offer(interface->data);
}
Error WebRTCPeerConnectionGDNative::set_local_description(String p_type, String p_sdp) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->set_local_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
}
Error WebRTCPeerConnectionGDNative::set_remote_description(String p_type, String p_sdp) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->set_remote_description(interface->data, p_type.utf8().get_data(), p_sdp.utf8().get_data());
}
Error WebRTCPeerConnectionGDNative::add_ice_candidate(String sdpMidName, int sdpMlineIndexName, String sdpName) {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->add_ice_candidate(interface->data, sdpMidName.utf8().get_data(), sdpMlineIndexName, sdpName.utf8().get_data());
}
Error WebRTCPeerConnectionGDNative::poll() {
- ERR_FAIL_COND_V(interface == NULL, ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(interface == nullptr, ERR_UNCONFIGURED);
return (Error)interface->poll(interface->data);
}
void WebRTCPeerConnectionGDNative::close() {
- ERR_FAIL_COND(interface == NULL);
+ ERR_FAIL_COND(interface == nullptr);
interface->close(interface->data);
}
WebRTCPeerConnection::ConnectionState WebRTCPeerConnectionGDNative::get_connection_state() const {
- ERR_FAIL_COND_V(interface == NULL, STATE_DISCONNECTED);
+ ERR_FAIL_COND_V(interface == nullptr, STATE_DISCONNECTED);
return (ConnectionState)interface->get_connection_state(interface->data);
}
diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp
index a84dabab72..593c3a5162 100644
--- a/modules/webrtc/webrtc_peer_connection_js.cpp
+++ b/modules/webrtc/webrtc_peer_connection_js.cpp
@@ -279,7 +279,7 @@ Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_chan
}
}, _js_id, p_channel.utf8().get_data(), config.utf8().get_data());
/* clang-format on */
- ERR_FAIL_COND_V(id == 0, NULL);
+ ERR_FAIL_COND_V(id == 0, nullptr);
return memnew(WebRTCDataChannelJS(id));
}
diff --git a/modules/websocket/SCsub b/modules/websocket/SCsub
index 033169411f..af60055855 100644
--- a/modules/websocket/SCsub
+++ b/modules/websocket/SCsub
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
# Thirdparty source files
env_ws = env_modules.Clone()
-if env['builtin_wslay'] and not env["platform"] == "javascript": # already builtin for javascript
+if env["builtin_wslay"] and not env["platform"] == "javascript": # already builtin for javascript
wslay_dir = "#thirdparty/wslay/"
wslay_sources = [
"wslay_net.c",
diff --git a/modules/websocket/config.py b/modules/websocket/config.py
index f59ef432b4..9e27a1a0fe 100644
--- a/modules/websocket/config.py
+++ b/modules/websocket/config.py
@@ -1,16 +1,19 @@
def can_build(env, platform):
return True
+
def configure(env):
pass
+
def get_doc_classes():
return [
"WebSocketClient",
"WebSocketMultiplayerPeer",
"WebSocketPeer",
- "WebSocketServer"
+ "WebSocketServer",
]
+
def get_doc_path():
return "doc_classes"
diff --git a/modules/websocket/emws_server.cpp b/modules/websocket/emws_server.cpp
index 8ceefa42b6..95cffb4775 100644
--- a/modules/websocket/emws_server.cpp
+++ b/modules/websocket/emws_server.cpp
@@ -50,7 +50,7 @@ bool EMWSServer::has_peer(int p_id) const {
}
Ref<WebSocketPeer> EMWSServer::get_peer(int p_id) const {
- return NULL;
+ return nullptr;
}
Vector<String> EMWSServer::get_protocols() const {
diff --git a/modules/websocket/packet_buffer.h b/modules/websocket/packet_buffer.h
index ea3658c827..5f5f0e20cd 100644
--- a/modules/websocket/packet_buffer.h
+++ b/modules/websocket/packet_buffer.h
@@ -63,7 +63,7 @@ public:
ERR_FAIL_COND_V(p_info && _packets.space_left() < 1, ERR_OUT_OF_MEMORY);
#endif
- // If p_info is NULL, only the payload is written
+ // If p_info is nullptr, only the payload is written
if (p_info) {
_Packet p;
p.size = p_size;
@@ -71,7 +71,7 @@ public:
_packets.write(p);
}
- // If p_payload is NULL, only the packet information is written.
+ // If p_payload is nullptr, only the packet information is written.
if (p_payload) {
_payload.write((const uint8_t *)p_payload, p_size);
}
diff --git a/modules/websocket/websocket_macros.h b/modules/websocket/websocket_macros.h
index 8aa01a70ed..f7eafcff1f 100644
--- a/modules/websocket/websocket_macros.h
+++ b/modules/websocket/websocket_macros.h
@@ -56,13 +56,13 @@ public:\
static CNAME *create() {\
\
if (!_create)\
- return NULL;\
+ return nullptr;\
return _create();\
}\
protected:\
#define GDCINULL(CNAME) \
-CNAME *(*CNAME::_create)() = NULL;
+CNAME *(*CNAME::_create)() = nullptr;
#define GDCIIMPL(IMPNAME, CNAME) \
public:\
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index 9eb1445b35..9b71b32e33 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -42,7 +42,7 @@ WebSocketMultiplayerPeer::WebSocketMultiplayerPeer() {
_current_packet.source = 0;
_current_packet.destination = 0;
_current_packet.size = 0;
- _current_packet.data = NULL;
+ _current_packet.data = nullptr;
}
WebSocketMultiplayerPeer::~WebSocketMultiplayerPeer() {
@@ -74,12 +74,12 @@ int WebSocketMultiplayerPeer::_gen_unique_id() const {
void WebSocketMultiplayerPeer::_clear() {
_peer_map.clear();
- if (_current_packet.data != NULL)
+ if (_current_packet.data != nullptr)
memfree(_current_packet.data);
for (List<Packet>::Element *E = _incoming_packets.front(); E; E = E->next()) {
memfree(E->get().data);
- E->get().data = NULL;
+ E->get().data = nullptr;
}
_incoming_packets.clear();
@@ -109,9 +109,9 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff
r_buffer_size = 0;
- if (_current_packet.data != NULL) {
+ if (_current_packet.data != nullptr) {
memfree(_current_packet.data);
- _current_packet.data = NULL;
+ _current_packet.data = nullptr;
}
_current_packet = _incoming_packets.front()->get();
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index bada750ec2..9f05500eb9 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -279,7 +279,7 @@ void WSLClient::poll() {
Ref<WebSocketPeer> WSLClient::get_peer(int p_peer_id) const {
- ERR_FAIL_COND_V(p_peer_id != 1, NULL);
+ ERR_FAIL_COND_V(p_peer_id != 1, nullptr);
return _peer;
}
@@ -298,7 +298,7 @@ NetworkedMultiplayerPeer::ConnectionStatus WSLClient::get_connection_status() co
void WSLClient::disconnect_from_host(int p_code, String p_reason) {
_peer->close(p_code, p_reason);
- _connection = Ref<StreamPeer>(NULL);
+ _connection = Ref<StreamPeer>(nullptr);
_tcp = Ref<StreamPeerTCP>(memnew(StreamPeerTCP));
_key = "";
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index ff32e83dc1..44b71f70f4 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -69,7 +69,7 @@ void WSLPeer::_wsl_destroy(struct PeerData **p_data) {
}
wslay_event_context_free(data->ctx);
memdelete(data);
- *p_data = NULL;
+ *p_data = nullptr;
}
bool WSLPeer::_wsl_poll(struct PeerData *p_data) {
@@ -163,9 +163,9 @@ wslay_event_callbacks wsl_callbacks = {
wsl_recv_callback,
wsl_send_callback,
wsl_genmask_callback,
- NULL, /* on_frame_recv_start_callback */
- NULL, /* on_frame_recv_callback */
- NULL, /* on_frame_recv_end_callback */
+ nullptr, /* on_frame_recv_start_callback */
+ nullptr, /* on_frame_recv_callback */
+ nullptr, /* on_frame_recv_end_callback */
wsl_msg_recv_callback
};
@@ -199,8 +199,8 @@ Error WSLPeer::parse_message(const wslay_event_on_msg_recv_arg *arg) {
}
void WSLPeer::make_context(PeerData *p_data, unsigned int p_in_buf_size, unsigned int p_in_pkt_size, unsigned int p_out_buf_size, unsigned int p_out_pkt_size) {
- ERR_FAIL_COND(_data != NULL);
- ERR_FAIL_COND(p_data == NULL);
+ ERR_FAIL_COND(_data != nullptr);
+ ERR_FAIL_COND(p_data == nullptr);
_in_buffer.resize(p_in_pkt_size, p_in_buf_size);
_packet_buffer.resize((1 << MAX(p_in_buf_size, p_out_buf_size)));
@@ -229,7 +229,7 @@ void WSLPeer::poll() {
return;
if (_wsl_poll(_data)) {
- _data = NULL;
+ _data = nullptr;
}
}
@@ -284,7 +284,7 @@ bool WSLPeer::was_string_packet() const {
bool WSLPeer::is_connected_to_host() const {
- return _data != NULL;
+ return _data != nullptr;
}
void WSLPeer::close_now() {
@@ -330,7 +330,7 @@ void WSLPeer::invalidate() {
}
WSLPeer::WSLPeer() {
- _data = NULL;
+ _data = nullptr;
_is_string = 0;
close_code = -1;
write_mode = WRITE_MODE_BINARY;
@@ -341,7 +341,7 @@ WSLPeer::~WSLPeer() {
close();
invalidate();
_wsl_destroy(&_data);
- _data = NULL;
+ _data = nullptr;
}
#endif // JAVASCRIPT_ENABLED
diff --git a/modules/websocket/wsl_peer.h b/modules/websocket/wsl_peer.h
index 00549cd9bc..3b0639831a 100644
--- a/modules/websocket/wsl_peer.h
+++ b/modules/websocket/wsl_peer.h
@@ -67,10 +67,10 @@ public:
valid = false;
is_server = false;
id = 1;
- ctx = NULL;
- obj = NULL;
+ ctx = nullptr;
+ obj = nullptr;
closing = false;
- peer = NULL;
+ peer = nullptr;
}
};
diff --git a/modules/websocket/wsl_server.cpp b/modules/websocket/wsl_server.cpp
index b66cdf3ea2..6f155a6ffa 100644
--- a/modules/websocket/wsl_server.cpp
+++ b/modules/websocket/wsl_server.cpp
@@ -265,7 +265,7 @@ bool WSLServer::has_peer(int p_id) const {
}
Ref<WebSocketPeer> WSLServer::get_peer(int p_id) const {
- ERR_FAIL_COND_V(!has_peer(p_id), NULL);
+ ERR_FAIL_COND_V(!has_peer(p_id), nullptr);
return _peer_map[p_id];
}
diff --git a/modules/xatlas_unwrap/SCsub b/modules/xatlas_unwrap/SCsub
index b242fd4673..c659349d05 100644
--- a/modules/xatlas_unwrap/SCsub
+++ b/modules/xatlas_unwrap/SCsub
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-Import('env')
-Import('env_modules')
+Import("env")
+Import("env_modules")
env_xatlas_unwrap = env_modules.Clone()
# Thirdparty source files
-if env['builtin_xatlas']:
+if env["builtin_xatlas"]:
thirdparty_dir = "#thirdparty/xatlas/"
thirdparty_sources = [
"xatlas.cpp",
diff --git a/modules/xatlas_unwrap/config.py b/modules/xatlas_unwrap/config.py
index bd092bdc16..2e73c51626 100644
--- a/modules/xatlas_unwrap/config.py
+++ b/modules/xatlas_unwrap/config.py
@@ -1,5 +1,6 @@
def can_build(env, platform):
- return (env['tools'] and platform not in ["android", "ios"])
+ return env["tools"] and platform not in ["android", "ios"]
+
def configure(env):
pass
diff --git a/modules/xatlas_unwrap/register_types.cpp b/modules/xatlas_unwrap/register_types.cpp
index c69b566525..e293dfd50c 100644
--- a/modules/xatlas_unwrap/register_types.cpp
+++ b/modules/xatlas_unwrap/register_types.cpp
@@ -52,7 +52,7 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
input_mesh.vertexPositionStride = sizeof(float) * 3;
input_mesh.vertexNormalData = p_normals;
input_mesh.vertexNormalStride = sizeof(uint32_t) * 3;
- input_mesh.vertexUvData = NULL;
+ input_mesh.vertexUvData = nullptr;
input_mesh.vertexUvStride = 0;
xatlas::ChartOptions chart_options;
@@ -68,7 +68,7 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
ERR_FAIL_COND_V_MSG(err != xatlas::AddMeshError::Enum::Success, false, xatlas::StringForEnum(err));
printf("Generate..\n");
- xatlas::Generate(atlas, chart_options, NULL, pack_options);
+ xatlas::Generate(atlas, chart_options, nullptr, pack_options);
*r_size_hint_x = atlas->width;
*r_size_hint_y = atlas->height;
diff --git a/platform/SCsub b/platform/SCsub
index 40cacce674..5194a19518 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -1,30 +1,30 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.platform_sources = []
# Register platform-exclusive APIs
reg_apis_inc = '#include "register_platform_apis.h"\n'
-reg_apis = 'void register_platform_apis() {\n'
-unreg_apis = 'void unregister_platform_apis() {\n'
+reg_apis = "void register_platform_apis() {\n"
+unreg_apis = "void unregister_platform_apis() {\n"
for platform in env.platform_apis:
platform_dir = env.Dir(platform)
- env.add_source_files(env.platform_sources, platform + '/api/api.cpp')
- reg_apis += '\tregister_' + platform + '_api();\n'
- unreg_apis += '\tunregister_' + platform + '_api();\n'
+ env.add_source_files(env.platform_sources, platform + "/api/api.cpp")
+ reg_apis += "\tregister_" + platform + "_api();\n"
+ unreg_apis += "\tunregister_" + platform + "_api();\n"
reg_apis_inc += '#include "' + platform + '/api/api.h"\n'
-reg_apis_inc += '\n'
-reg_apis += '}\n\n'
-unreg_apis += '}\n'
+reg_apis_inc += "\n"
+reg_apis += "}\n\n"
+unreg_apis += "}\n"
# NOTE: It is safe to generate this file here, since this is still execute serially
-with open('register_platform_apis.gen.cpp', 'w', encoding="utf-8") as f:
+with open("register_platform_apis.gen.cpp", "w", encoding="utf-8") as f:
f.write(reg_apis_inc)
f.write(reg_apis)
f.write(unreg_apis)
-env.add_source_files(env.platform_sources, 'register_platform_apis.gen.cpp')
+env.add_source_files(env.platform_sources, "register_platform_apis.gen.cpp")
-lib = env.add_library('platform', env.platform_sources)
+lib = env.add_library("platform", env.platform_sources)
env.Prepend(LIBS=[lib])
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 5ca5ce548c..f39eb8b889 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -1,24 +1,24 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
android_files = [
- 'os_android.cpp',
- 'file_access_android.cpp',
- 'audio_driver_opensl.cpp',
- 'file_access_jandroid.cpp',
- 'dir_access_jandroid.cpp',
- 'thread_jandroid.cpp',
- 'net_socket_android.cpp',
- 'audio_driver_jandroid.cpp',
- 'java_godot_lib_jni.cpp',
- 'java_class_wrapper.cpp',
- 'java_godot_wrapper.cpp',
- 'java_godot_io_wrapper.cpp',
- 'jni_utils.cpp',
- 'android_keys_utils.cpp',
- 'vulkan/vk_renderer_jni.cpp',
- 'plugin/godot_plugin_jni.cpp'
+ "os_android.cpp",
+ "file_access_android.cpp",
+ "audio_driver_opensl.cpp",
+ "file_access_jandroid.cpp",
+ "dir_access_jandroid.cpp",
+ "thread_jandroid.cpp",
+ "net_socket_android.cpp",
+ "audio_driver_jandroid.cpp",
+ "java_godot_lib_jni.cpp",
+ "java_class_wrapper.cpp",
+ "java_godot_wrapper.cpp",
+ "java_godot_io_wrapper.cpp",
+ "jni_utils.cpp",
+ "android_keys_utils.cpp",
+ "vulkan/vk_renderer_jni.cpp",
+ "plugin/godot_plugin_jni.cpp",
]
env_android = env.Clone()
@@ -29,30 +29,34 @@ for x in android_files:
env_thirdparty = env_android.Clone()
env_thirdparty.disable_warnings()
-android_objects.append(env_thirdparty.SharedObject('#thirdparty/misc/ifaddrs-android.cc'))
+android_objects.append(env_thirdparty.SharedObject("#thirdparty/misc/ifaddrs-android.cc"))
lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
-lib_arch_dir = ''
-if env['android_arch'] == 'armv7':
- lib_arch_dir = 'armeabi-v7a'
-elif env['android_arch'] == 'arm64v8':
- lib_arch_dir = 'arm64-v8a'
-elif env['android_arch'] == 'x86':
- lib_arch_dir = 'x86'
-elif env['android_arch'] == 'x86_64':
- lib_arch_dir = 'x86_64'
+lib_arch_dir = ""
+if env["android_arch"] == "armv7":
+ lib_arch_dir = "armeabi-v7a"
+elif env["android_arch"] == "arm64v8":
+ lib_arch_dir = "arm64-v8a"
+elif env["android_arch"] == "x86":
+ lib_arch_dir = "x86"
+elif env["android_arch"] == "x86_64":
+ lib_arch_dir = "x86_64"
else:
- print('WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin')
+ print("WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin")
-if lib_arch_dir != '':
- if env['target'] == 'release':
- lib_type_dir = 'release'
+if lib_arch_dir != "":
+ if env["target"] == "release":
+ lib_type_dir = "release"
else: # release_debug, debug
- lib_type_dir = 'debug'
+ lib_type_dir = "debug"
- out_dir = '#platform/android/java/lib/libs/' + lib_type_dir + '/' + lib_arch_dir
- env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
+ out_dir = "#platform/android/java/lib/libs/" + lib_type_dir + "/" + lib_arch_dir
+ env_android.Command(
+ out_dir + "/libgodot_android.so", "#bin/libgodot" + env["SHLIBSUFFIX"], Move("$TARGET", "$SOURCE")
+ )
- stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
- env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
+ stl_lib_path = (
+ str(env["ANDROID_NDK_ROOT"]) + "/sources/cxx-stl/llvm-libc++/libs/" + lib_arch_dir + "/libc++_shared.so"
+ )
+ env_android.Command(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE"))
diff --git a/platform/android/api/api.cpp b/platform/android/api/api.cpp
index 7efb545524..ef11b12971 100644
--- a/platform/android/api/api.cpp
+++ b/platform/android/api/api.cpp
@@ -34,7 +34,7 @@
#include "java_class_wrapper.h"
#if !defined(ANDROID_ENABLED)
-static JavaClassWrapper *java_class_wrapper = NULL;
+static JavaClassWrapper *java_class_wrapper = nullptr;
#endif
void register_android_api() {
@@ -73,7 +73,7 @@ Variant JavaObject::call(const StringName &, const Variant **, int, Callable::Ca
return Variant();
}
-JavaClassWrapper *JavaClassWrapper::singleton = NULL;
+JavaClassWrapper *JavaClassWrapper::singleton = nullptr;
Ref<JavaClass> JavaClassWrapper::wrap(const String &) {
return Ref<JavaClass>();
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h
index d7322deb81..59fcd94b4d 100644
--- a/platform/android/api/java_class_wrapper.h
+++ b/platform/android/api/java_class_wrapper.h
@@ -236,7 +236,7 @@ public:
Ref<JavaClass> wrap(const String &p_class);
#ifdef ANDROID_ENABLED
- JavaClassWrapper(jobject p_activity = NULL);
+ JavaClassWrapper(jobject p_activity = nullptr);
#else
JavaClassWrapper();
#endif
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index e94dad9ac6..802d85e7be 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -34,7 +34,7 @@
#include "core/project_settings.h"
#include "thread_jandroid.h"
-AudioDriverAndroid *AudioDriverAndroid::s_ad = NULL;
+AudioDriverAndroid *AudioDriverAndroid::s_ad = nullptr;
jobject AudioDriverAndroid::io;
jmethodID AudioDriverAndroid::_init_audio;
@@ -46,10 +46,10 @@ jclass AudioDriverAndroid::cls;
int AudioDriverAndroid::audioBufferFrames = 0;
int AudioDriverAndroid::mix_rate = 44100;
bool AudioDriverAndroid::quit = false;
-jobject AudioDriverAndroid::audioBuffer = NULL;
-void *AudioDriverAndroid::audioBufferPinned = NULL;
+jobject AudioDriverAndroid::audioBuffer = nullptr;
+void *AudioDriverAndroid::audioBufferPinned = nullptr;
Mutex AudioDriverAndroid::mutex;
-int32_t *AudioDriverAndroid::audioBuffer32 = NULL;
+int32_t *AudioDriverAndroid::audioBuffer32 = nullptr;
const char *AudioDriverAndroid::get_name() const {
@@ -83,7 +83,7 @@ Error AudioDriverAndroid::init() {
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
- ERR_FAIL_COND_V(audioBuffer == NULL, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V(audioBuffer == nullptr, ERR_INVALID_PARAMETER);
audioBuffer = env->NewGlobalRef(audioBuffer);
@@ -181,8 +181,8 @@ void AudioDriverAndroid::finish() {
if (audioBuffer) {
env->DeleteGlobalRef(audioBuffer);
- audioBuffer = NULL;
- audioBufferPinned = NULL;
+ audioBuffer = nullptr;
+ audioBufferPinned = nullptr;
}
active = false;
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index 222120f81f..e59850e016 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -83,7 +83,7 @@ void AudioDriverOpenSL::_buffer_callbacks(
ad->_buffer_callback(queueItf);
}
-AudioDriverOpenSL *AudioDriverOpenSL::s_ad = NULL;
+AudioDriverOpenSL *AudioDriverOpenSL::s_ad = nullptr;
const char *AudioDriverOpenSL::get_name() const {
@@ -96,7 +96,7 @@ Error AudioDriverOpenSL::init() {
SLEngineOption EngineOption[] = {
{ (SLuint32)SL_ENGINEOPTION_THREADSAFE, (SLuint32)SL_BOOLEAN_TRUE }
};
- res = slCreateEngine(&sl, 1, EngineOption, 0, NULL, NULL);
+ res = slCreateEngine(&sl, 1, EngineOption, 0, nullptr, nullptr);
ERR_FAIL_COND_V_MSG(res != SL_RESULT_SUCCESS, ERR_INVALID_PARAMETER, "Could not initialize OpenSL.");
res = (*sl)->Realize(sl, SL_BOOLEAN_FALSE);
@@ -161,7 +161,7 @@ void AudioDriverOpenSL::start() {
locator_outputmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
locator_outputmix.outputMix = OutputMix;
audioSink.pLocator = (void *)&locator_outputmix;
- audioSink.pFormat = NULL;
+ audioSink.pFormat = nullptr;
/* Initialize the context for Buffer queue callbacks */
//cntxt.pDataBase = (void*)&pcmData;
//cntxt.pData = cntxt.pDataBase;
@@ -228,9 +228,9 @@ Error AudioDriverOpenSL::capture_init_device() {
SL_DATALOCATOR_IODEVICE,
SL_IODEVICE_AUDIOINPUT,
SL_DEFAULTDEVICEID_AUDIOINPUT,
- NULL
+ nullptr
};
- SLDataSource recSource = { &loc_dev, NULL };
+ SLDataSource recSource = { &loc_dev, nullptr };
SLDataLocator_AndroidSimpleBufferQueue loc_bq = {
SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE,
diff --git a/platform/android/detect.py b/platform/android/detect.py
index ff3ca0706c..ed0643e3b3 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -13,7 +13,7 @@ def get_name():
def can_build():
- return ("ANDROID_NDK_ROOT" in os.environ)
+ return "ANDROID_NDK_ROOT" in os.environ
def get_platform(platform):
@@ -24,33 +24,33 @@ def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
return [
- ('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
- ('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
- EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'arm64v8', 'x86', 'x86_64')),
- BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
+ ("ANDROID_NDK_ROOT", "Path to the Android NDK", os.environ.get("ANDROID_NDK_ROOT", 0)),
+ ("ndk_platform", 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
+ EnumVariable("android_arch", "Target architecture", "armv7", ("armv7", "arm64v8", "x86", "x86_64")),
+ BoolVariable("android_neon", "Enable NEON support (armv7 only)", True),
]
def get_flags():
return [
- ('tools', False),
+ ("tools", False),
]
def create(env):
- tools = env['TOOLS']
+ tools = env["TOOLS"]
if "mingw" in tools:
- tools.remove('mingw')
+ tools.remove("mingw")
if "applelink" in tools:
tools.remove("applelink")
- env.Tool('gcc')
+ env.Tool("gcc")
return env.Clone(tools=tools)
def configure(env):
# Workaround for MinGW. See:
# http://www.scons.org/wiki/LongCmdLinesOnWin32
- if (os.name == "nt"):
+ if os.name == "nt":
import subprocess
@@ -58,8 +58,15 @@ def configure(env):
# print("SPAWNED : " + cmdline)
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
+ 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()
if rv:
@@ -70,7 +77,7 @@ def configure(env):
def mySpawn(sh, escape, cmd, args, env):
- newargs = ' '.join(args[1:])
+ newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs
rv = 0
@@ -85,50 +92,54 @@ def configure(env):
return rv
- env['SPAWN'] = mySpawn
+ env["SPAWN"] = mySpawn
# Architecture
- if env['android_arch'] not in ['armv7', 'arm64v8', 'x86', 'x86_64']:
- env['android_arch'] = 'armv7'
+ if env["android_arch"] not in ["armv7", "arm64v8", "x86", "x86_64"]:
+ env["android_arch"] = "armv7"
neon_text = ""
- if env["android_arch"] == "armv7" and env['android_neon']:
+ if env["android_arch"] == "armv7" and env["android_neon"]:
neon_text = " (with NEON)"
- print("Building for Android (" + env['android_arch'] + ")" + neon_text)
+ print("Building for Android (" + env["android_arch"] + ")" + neon_text)
can_vectorize = True
- if env['android_arch'] == 'x86':
- env['ARCH'] = 'arch-x86'
+ if env["android_arch"] == "x86":
+ env["ARCH"] = "arch-x86"
env.extra_suffix = ".x86" + env.extra_suffix
target_subpath = "x86-4.9"
abi_subpath = "i686-linux-android"
arch_subpath = "x86"
env["x86_libtheora_opt_gcc"] = True
- if env['android_arch'] == 'x86_64':
+ if env["android_arch"] == "x86_64":
if get_platform(env["ndk_platform"]) < 21:
- print("WARNING: android_arch=x86_64 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21")
+ print(
+ "WARNING: android_arch=x86_64 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21"
+ )
env["ndk_platform"] = "android-21"
- env['ARCH'] = 'arch-x86_64'
+ env["ARCH"] = "arch-x86_64"
env.extra_suffix = ".x86_64" + env.extra_suffix
target_subpath = "x86_64-4.9"
abi_subpath = "x86_64-linux-android"
arch_subpath = "x86_64"
env["x86_libtheora_opt_gcc"] = True
elif env["android_arch"] == "armv7":
- env['ARCH'] = 'arch-arm'
+ env["ARCH"] = "arch-arm"
target_subpath = "arm-linux-androideabi-4.9"
abi_subpath = "arm-linux-androideabi"
arch_subpath = "armeabi-v7a"
- if env['android_neon']:
+ if env["android_neon"]:
env.extra_suffix = ".armv7.neon" + env.extra_suffix
else:
env.extra_suffix = ".armv7" + env.extra_suffix
elif env["android_arch"] == "arm64v8":
if get_platform(env["ndk_platform"]) < 21:
- print("WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21")
+ print(
+ "WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting ndk_platform=android-21"
+ )
env["ndk_platform"] = "android-21"
- env['ARCH'] = 'arch-arm64'
+ env["ARCH"] = "arch-arm64"
target_subpath = "aarch64-linux-android-4.9"
abi_subpath = "aarch64-linux-android"
arch_subpath = "arm64-v8a"
@@ -136,40 +147,40 @@ def configure(env):
# Build type
- if (env["target"].startswith("release")):
- if (env["optimize"] == "speed"): # optimize for speed (default)
- env.Append(LINKFLAGS=['-O2'])
- env.Append(CCFLAGS=['-O2', '-fomit-frame-pointer'])
- env.Append(CPPDEFINES=['NDEBUG'])
+ if env["target"].startswith("release"):
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Append(LINKFLAGS=["-O2"])
+ env.Append(CCFLAGS=["-O2", "-fomit-frame-pointer"])
+ env.Append(CPPDEFINES=["NDEBUG"])
else: # optimize for size
- env.Append(CCFLAGS=['-Os'])
- env.Append(CPPDEFINES=['NDEBUG'])
- env.Append(LINKFLAGS=['-Os'])
-
- if (can_vectorize):
- env.Append(CCFLAGS=['-ftree-vectorize'])
- if (env["target"] == "release_debug"):
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
- elif (env["target"] == "debug"):
- env.Append(LINKFLAGS=['-O0'])
- env.Append(CCFLAGS=['-O0', '-g', '-fno-limit-debug-info'])
- env.Append(CPPDEFINES=['_DEBUG', 'DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
- env.Append(CPPFLAGS=['-UNDEBUG'])
+ env.Append(CCFLAGS=["-Os"])
+ env.Append(CPPDEFINES=["NDEBUG"])
+ env.Append(LINKFLAGS=["-Os"])
+
+ if can_vectorize:
+ env.Append(CCFLAGS=["-ftree-vectorize"])
+ if env["target"] == "release_debug":
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
+ elif env["target"] == "debug":
+ env.Append(LINKFLAGS=["-O0"])
+ env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
+ env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
+ env.Append(CPPFLAGS=["-UNDEBUG"])
# Compiler configuration
- env['SHLIBSUFFIX'] = '.so'
+ env["SHLIBSUFFIX"] = ".so"
- if env['PLATFORM'] == 'win32':
- env.Tool('gcc')
+ if env["PLATFORM"] == "win32":
+ env.Tool("gcc")
env.use_windows_spawn_fix()
- if (sys.platform.startswith("linux")):
+ if sys.platform.startswith("linux"):
host_subpath = "linux-x86_64"
- elif (sys.platform.startswith("darwin")):
+ elif sys.platform.startswith("darwin"):
host_subpath = "darwin-x86_64"
- elif (sys.platform.startswith('win')):
- if (platform.machine().endswith('64')):
+ elif sys.platform.startswith("win"):
+ if platform.machine().endswith("64"):
host_subpath = "windows-x86_64"
else:
host_subpath = "windows"
@@ -179,22 +190,22 @@ def configure(env):
tools_path = gcc_toolchain_path + "/" + abi_subpath + "/bin"
# For Clang to find NDK tools in preference of those system-wide
- env.PrependENVPath('PATH', tools_path)
+ env.PrependENVPath("PATH", tools_path)
ccache_path = os.environ.get("CCACHE")
if ccache_path is None:
- env['CC'] = compiler_path + '/clang'
- env['CXX'] = compiler_path + '/clang++'
+ env["CC"] = compiler_path + "/clang"
+ env["CXX"] = compiler_path + "/clang++"
else:
# there aren't any ccache wrappers available for Android,
# to enable caching we need to prepend the path to the ccache binary
- env['CC'] = ccache_path + ' ' + compiler_path + '/clang'
- env['CXX'] = ccache_path + ' ' + compiler_path + '/clang++'
- env['AR'] = tools_path + "/ar"
- env['RANLIB'] = tools_path + "/ranlib"
- env['AS'] = tools_path + "/as"
+ env["CC"] = ccache_path + " " + compiler_path + "/clang"
+ env["CXX"] = ccache_path + " " + compiler_path + "/clang++"
+ env["AR"] = tools_path + "/ar"
+ env["RANLIB"] = tools_path + "/ranlib"
+ env["AS"] = tools_path + "/as"
- common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path]
+ common_opts = ["-fno-integrated-as", "-gcc-toolchain", gcc_toolchain_path]
# Compile flags
@@ -202,14 +213,14 @@ def configure(env):
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
# Disable exceptions and rtti on non-tools (template) builds
- if env['tools']:
- env.Append(CXXFLAGS=['-frtti'])
+ if env["tools"]:
+ env.Append(CXXFLAGS=["-frtti"])
else:
- env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions'])
+ env.Append(CXXFLAGS=["-fno-rtti", "-fno-exceptions"])
# Don't use dynamic_cast, necessary with no-rtti.
- env.Append(CPPDEFINES=['NO_SAFE_CAST'])
+ env.Append(CPPDEFINES=["NO_SAFE_CAST"])
- lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
+ lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env["ndk_platform"] + "/" + env["ARCH"]
# Using NDK unified headers (NDK r15+)
sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot"
@@ -217,35 +228,37 @@ def configure(env):
env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
# For unified headers this define has to be set manually
- env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))])
+ env.Append(CPPDEFINES=[("__ANDROID_API__", str(get_platform(env["ndk_platform"])))])
- env.Append(CCFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split())
- env.Append(CPPDEFINES=['NO_STATVFS', 'GLES_ENABLED'])
+ env.Append(
+ CCFLAGS="-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing".split()
+ )
+ env.Append(CPPDEFINES=["NO_STATVFS", "GLES_ENABLED"])
- env['neon_enabled'] = False
- if env['android_arch'] == 'x86':
- target_opts = ['-target', 'i686-none-linux-android']
+ env["neon_enabled"] = False
+ if env["android_arch"] == "x86":
+ target_opts = ["-target", "i686-none-linux-android"]
# The NDK adds this if targeting API < 21, so we can drop it when Godot targets it at least
- env.Append(CCFLAGS=['-mstackrealign'])
+ env.Append(CCFLAGS=["-mstackrealign"])
- elif env['android_arch'] == 'x86_64':
- target_opts = ['-target', 'x86_64-none-linux-android']
+ elif env["android_arch"] == "x86_64":
+ target_opts = ["-target", "x86_64-none-linux-android"]
elif env["android_arch"] == "armv7":
- target_opts = ['-target', 'armv7-none-linux-androideabi']
- env.Append(CCFLAGS='-march=armv7-a -mfloat-abi=softfp'.split())
- env.Append(CPPDEFINES=['__ARM_ARCH_7__', '__ARM_ARCH_7A__'])
- if env['android_neon']:
- env['neon_enabled'] = True
- env.Append(CCFLAGS=['-mfpu=neon'])
- env.Append(CPPDEFINES=['__ARM_NEON__'])
+ target_opts = ["-target", "armv7-none-linux-androideabi"]
+ env.Append(CCFLAGS="-march=armv7-a -mfloat-abi=softfp".split())
+ env.Append(CPPDEFINES=["__ARM_ARCH_7__", "__ARM_ARCH_7A__"])
+ if env["android_neon"]:
+ env["neon_enabled"] = True
+ env.Append(CCFLAGS=["-mfpu=neon"])
+ env.Append(CPPDEFINES=["__ARM_NEON__"])
else:
- env.Append(CCFLAGS=['-mfpu=vfpv3-d16'])
+ env.Append(CCFLAGS=["-mfpu=vfpv3-d16"])
elif env["android_arch"] == "arm64v8":
- target_opts = ['-target', 'aarch64-none-linux-android']
- env.Append(CCFLAGS=['-mfix-cortex-a53-835769'])
- env.Append(CPPDEFINES=['__ARM_ARCH_8A__'])
+ target_opts = ["-target", "aarch64-none-linux-android"]
+ env.Append(CCFLAGS=["-mfix-cortex-a53-835769"])
+ env.Append(CPPDEFINES=["__ARM_ARCH_8A__"])
env.Append(CCFLAGS=target_opts)
env.Append(CCFLAGS=common_opts)
@@ -254,29 +267,55 @@ def configure(env):
ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
- env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++'])
+ env.Append(LINKFLAGS=["-Wl,--exclude-libs,libgcc.a", "-Wl,--exclude-libs,libatomic.a", "-nostdlib++"])
else:
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"])
- env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
+ env.Append(
+ LINKFLAGS=[
+ env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"
+ ]
+ )
+ env.Append(LINKFLAGS=["-shared", "--sysroot=" + lib_sysroot, "-Wl,--warn-shared-textrel"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"])
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"])
+ env.Append(
+ LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"]
+ )
if env["android_arch"] == "armv7":
- env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split())
- env.Append(LINKFLAGS='-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now'.split())
- env.Append(LINKFLAGS='-Wl,-soname,libgodot_android.so -Wl,--gc-sections'.split())
+ env.Append(LINKFLAGS="-Wl,--fix-cortex-a8".split())
+ env.Append(LINKFLAGS="-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now".split())
+ env.Append(LINKFLAGS="-Wl,-soname,libgodot_android.so -Wl,--gc-sections".split())
env.Append(LINKFLAGS=target_opts)
env.Append(LINKFLAGS=common_opts)
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/' + target_subpath + '/prebuilt/' +
- host_subpath + '/lib/gcc/' + abi_subpath + '/4.9.x'])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] +
- '/toolchains/' + target_subpath + '/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib'])
-
- env.Prepend(CPPPATH=['#platform/android'])
- env.Append(CPPDEFINES=['ANDROID_ENABLED', 'UNIX_ENABLED', 'NO_FCNTL'])
- env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'GLESv2', 'android', 'log', 'z', 'dl'])
+ env.Append(
+ LIBPATH=[
+ env["ANDROID_NDK_ROOT"]
+ + "/toolchains/"
+ + target_subpath
+ + "/prebuilt/"
+ + host_subpath
+ + "/lib/gcc/"
+ + abi_subpath
+ + "/4.9.x"
+ ]
+ )
+ env.Append(
+ LIBPATH=[
+ env["ANDROID_NDK_ROOT"]
+ + "/toolchains/"
+ + target_subpath
+ + "/prebuilt/"
+ + host_subpath
+ + "/"
+ + abi_subpath
+ + "/lib"
+ ]
+ )
+
+ env.Prepend(CPPPATH=["#platform/android"])
+ env.Append(CPPDEFINES=["ANDROID_ENABLED", "UNIX_ENABLED", "NO_FCNTL"])
+ env.Append(LIBS=["OpenSLES", "EGL", "GLESv3", "GLESv2", "android", "log", "z", "dl"])
# Return NDK version string in source.properties (adapted from the Chromium project).
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index ebcac884db..f8571e6277 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -34,12 +34,12 @@
#include "string_android.h"
#include "thread_jandroid.h"
-jobject DirAccessJAndroid::io = NULL;
-jclass DirAccessJAndroid::cls = NULL;
-jmethodID DirAccessJAndroid::_dir_open = NULL;
-jmethodID DirAccessJAndroid::_dir_next = NULL;
-jmethodID DirAccessJAndroid::_dir_close = NULL;
-jmethodID DirAccessJAndroid::_dir_is_dir = NULL;
+jobject DirAccessJAndroid::io = nullptr;
+jclass DirAccessJAndroid::cls = nullptr;
+jmethodID DirAccessJAndroid::_dir_open = nullptr;
+jmethodID DirAccessJAndroid::_dir_next = nullptr;
+jmethodID DirAccessJAndroid::_dir_close = nullptr;
+jmethodID DirAccessJAndroid::_dir_is_dir = nullptr;
DirAccess *DirAccessJAndroid::create_fs() {
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index e7d4bc6c51..b6c30d120c 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -194,7 +194,7 @@ static const char *android_perms[] = {
"WRITE_SOCIAL_STREAM",
"WRITE_SYNC_SETTINGS",
"WRITE_USER_DICTIONARY",
- NULL
+ nullptr
};
struct LauncherIcon {
@@ -274,7 +274,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
List<String> args;
args.push_back("devices");
int ec;
- OS::get_singleton()->execute(adb, args, true, NULL, &devices, &ec);
+ OS::get_singleton()->execute(adb, args, true, nullptr, &devices, &ec);
Vector<String> ds = devices.split("\n");
Vector<String> ldevices;
@@ -332,7 +332,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
int ec2;
String dp;
- OS::get_singleton()->execute(adb, args, true, NULL, &dp, &ec2);
+ OS::get_singleton()->execute(adb, args, true, nullptr, &dp, &ec2);
Vector<String> props = dp.split("\n");
String vendor;
@@ -447,7 +447,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
return pname;
}
- bool is_package_name_valid(const String &p_package, String *r_error = NULL) const {
+ bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const {
String pname = p_package;
@@ -537,7 +537,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
".scn", // Binary scenes are usually already compressed
".stex", // Streamable textures are usually already compressed
// Trailer for easier processing
- NULL
+ nullptr
};
for (const char **ext = unconditional_compress_ext; *ext; ++ext) {
@@ -591,11 +591,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
zipOpenNewFileInZip(ed->apk,
p_path.utf8().get_data(),
&zipfi,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
compression_method,
Z_DEFAULT_COMPRESSION);
@@ -1530,7 +1530,7 @@ public:
args.push_back("uninstall");
args.push_back(get_package_name(package_name));
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ err = OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
}
print_line("Installing to device (please wait...): " + devices[p_device].name);
@@ -1545,7 +1545,7 @@ public:
args.push_back("-r");
args.push_back(tmp_export_path);
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ err = OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
if (err || rv != 0) {
EditorNode::add_io_error("Could not install to device.");
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@@ -1563,7 +1563,7 @@ public:
args.push_back(devices[p_device].id);
args.push_back("reverse");
args.push_back("--remove-all");
- OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
if (p_debug_flags & DEBUG_FLAG_REMOTE_DEBUG) {
@@ -1575,7 +1575,7 @@ public:
args.push_back("tcp:" + itos(dbg_port));
args.push_back("tcp:" + itos(dbg_port));
- OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
print_line("Reverse result: " + itos(rv));
}
@@ -1590,7 +1590,7 @@ public:
args.push_back("tcp:" + itos(fs_port));
args.push_back("tcp:" + itos(fs_port));
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ err = OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
print_line("Reverse result2: " + itos(rv));
}
} else {
@@ -1619,7 +1619,7 @@ public:
args.push_back("-n");
args.push_back(get_package_name(package_name) + "/com.godot.game.GodotApp");
- err = OS::get_singleton()->execute(adb, args, true, NULL, NULL, &rv);
+ err = OS::get_singleton()->execute(adb, args, true, nullptr, nullptr, &rv);
if (err || rv != 0) {
EditorNode::add_io_error("Could not execute on device.");
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@@ -1806,7 +1806,7 @@ public:
/*{ used for debug
int ec;
String pipe;
- OS::get_singleton()->execute(build_command, cmdline, true, NULL, NULL, &ec);
+ OS::get_singleton()->execute(build_command, cmdline, true, nullptr, nullptr, &ec);
print_line("exit code: " + itos(ec));
}
*/
@@ -1851,7 +1851,7 @@ public:
return ERR_FILE_BAD_PATH;
}
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
if (ep.step("Creating APK...", 0)) {
@@ -1868,7 +1868,7 @@ public:
int ret = unzGoToFirstFile(pkg);
zlib_filefunc_def io2 = io;
- FileAccess *dst_f = NULL;
+ FileAccess *dst_f = nullptr;
io2.opaque = &dst_f;
String tmp_unaligned_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpexport-unaligned.apk");
@@ -1879,7 +1879,7 @@ public:
return m_err; \
}
- zipFile unaligned_apk = zipOpen2(tmp_unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+ zipFile unaligned_apk = zipOpen2(tmp_unaligned_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io2);
bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer");
bool immersive = p_preset->get("screen/immersive_mode");
@@ -1937,7 +1937,7 @@ public:
//get filename
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
bool skip = false;
@@ -2001,11 +2001,11 @@ public:
zipOpenNewFileInZip(unaligned_apk,
file.utf8().get_data(),
&zipfi,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
uncompressed ? 0 : Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
@@ -2108,11 +2108,11 @@ public:
zipOpenNewFileInZip(unaligned_apk,
"assets/_cl_",
&zipfi,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0, // No compress (little size gain and potentially slower startup)
Z_DEFAULT_COMPRESSION);
@@ -2120,7 +2120,7 @@ public:
zipCloseFileInZip(unaligned_apk);
}
- zipClose(unaligned_apk, NULL);
+ zipClose(unaligned_apk, nullptr);
unzClose(pkg);
if (err != OK) {
@@ -2188,7 +2188,7 @@ public:
args.push_back(tmp_unaligned_path);
args.push_back(user);
int retval;
- OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval);
+ OS::get_singleton()->execute(jarsigner, args, true, nullptr, nullptr, &retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' returned with error #" + itos(retval));
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@@ -2205,7 +2205,7 @@ public:
args.push_back(tmp_unaligned_path);
args.push_back("-verbose");
- OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval);
+ OS::get_singleton()->execute(jarsigner, args, true, nullptr, nullptr, &retval);
if (retval) {
EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use a jarsigner from OpenJDK 8.");
CLEANUP_AND_RETURN(ERR_CANT_CREATE);
@@ -2230,9 +2230,9 @@ public:
ret = unzGoToFirstFile(tmp_unaligned);
io2 = io;
- dst_f = NULL;
+ dst_f = nullptr;
io2.opaque = &dst_f;
- zipFile final_apk = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+ zipFile final_apk = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io2);
// Take files from the unaligned APK and write them out to the aligned one
// in raw mode, i.e. not uncompressing and recompressing, aligning them as needed,
@@ -2245,7 +2245,7 @@ public:
char fname[16384];
char extra[16384];
- ret = unzGetCurrentFileInfo(tmp_unaligned, &info, fname, 16384, extra, 16384 - ZIP_ALIGNMENT, NULL, 0);
+ ret = unzGetCurrentFileInfo(tmp_unaligned, &info, fname, 16384, extra, 16384 - ZIP_ALIGNMENT, nullptr, 0);
String file = fname;
@@ -2277,9 +2277,9 @@ public:
&zipfi,
extra,
info.size_file_extra + padding,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
method,
level,
1); // raw write
@@ -2291,7 +2291,7 @@ public:
ret = unzGoToNextFile(tmp_unaligned);
}
- zipClose(final_apk, NULL);
+ zipClose(final_apk, nullptr);
unzClose(tmp_unaligned);
CLEANUP_AND_RETURN(OK);
diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp
index 965342b364..fa805ec4f3 100644
--- a/platform/android/file_access_android.cpp
+++ b/platform/android/file_access_android.cpp
@@ -31,7 +31,7 @@
#include "file_access_android.h"
#include "core/print_string.h"
-AAssetManager *FileAccessAndroid::asset_manager = NULL;
+AAssetManager *FileAccessAndroid::asset_manager = nullptr;
/*void FileAccessAndroid::make_default() {
@@ -68,12 +68,12 @@ void FileAccessAndroid::close() {
if (!a)
return;
AAsset_close(a);
- a = NULL;
+ a = nullptr;
}
bool FileAccessAndroid::is_open() const {
- return a != NULL;
+ return a != nullptr;
}
void FileAccessAndroid::seek(size_t p_position) {
@@ -175,7 +175,7 @@ bool FileAccessAndroid::file_exists(const String &p_path) {
}
FileAccessAndroid::FileAccessAndroid() {
- a = NULL;
+ a = nullptr;
eof = false;
}
diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp
index db3aa4255e..e088eca8ef 100644
--- a/platform/android/file_access_jandroid.cpp
+++ b/platform/android/file_access_jandroid.cpp
@@ -33,7 +33,7 @@
#include "thread_jandroid.h"
#include <unistd.h>
-jobject FileAccessJAndroid::io = NULL;
+jobject FileAccessJAndroid::io = nullptr;
jclass FileAccessJAndroid::cls;
jmethodID FileAccessJAndroid::_file_open = 0;
jmethodID FileAccessJAndroid::_file_get_size = 0;
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 13550c4b11..6b9105b8e5 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -40,7 +40,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
JNIEnv *env = ThreadAndroid::get_env();
- MethodInfo *method = NULL;
+ MethodInfo *method = nullptr;
for (List<MethodInfo>::Element *E = M->get().front(); E; E = E->next()) {
if (!p_instance && !E->get()._static) {
@@ -160,7 +160,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
r_error.error = Callable::CallError::CALL_OK;
- jvalue *argv = NULL;
+ jvalue *argv = nullptr;
if (method->param_types.size()) {
@@ -173,7 +173,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
switch (method->param_types[i]) {
case ARG_TYPE_VOID: {
//can't happen
- argv[i].l = NULL; //I hope this works
+ argv[i].l = nullptr; //I hope this works
} break;
case ARG_TYPE_BOOLEAN: {
@@ -285,7 +285,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
argv[i].l = jo->instance;
} else {
- argv[i].l = NULL; //I hope this works
+ argv[i].l = nullptr; //I hope this works
}
} break;
@@ -386,7 +386,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
case ARG_ARRAY_BIT | ARG_TYPE_STRING: {
Array arr = *p_args[i];
- jobjectArray a = env->NewObjectArray(arr.size(), env->FindClass("java/lang/String"), NULL);
+ jobjectArray a = env->NewObjectArray(arr.size(), env->FindClass("java/lang/String"), nullptr);
for (int j = 0; j < arr.size(); j++) {
String s = arr[j];
@@ -400,7 +400,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
} break;
case ARG_ARRAY_BIT | ARG_TYPE_CLASS: {
- argv[i].l = NULL;
+ argv[i].l = nullptr;
} break;
}
}
@@ -520,7 +520,7 @@ bool JavaClass::_call_method(JavaObject *p_instance, const StringName &p_method,
Variant JavaClass::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) {
Variant ret;
- bool found = _call_method(NULL, p_method, p_args, p_argcount, r_error, ret);
+ bool found = _call_method(nullptr, p_method, p_args, p_argcount, r_error, ret);
if (found) {
return ret;
}
@@ -1205,7 +1205,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
int mods = env->CallIntMethod(obj, Field_getModifiers);
if ((mods & 0x8) && (mods & 0x10) && (mods & 0x1)) { //static final public!
- jobject objc = env->CallObjectMethod(obj, Field_get, NULL);
+ jobject objc = env->CallObjectMethod(obj, Field_get, nullptr);
if (objc) {
uint32_t sig;
@@ -1236,7 +1236,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
return Ref<JavaClass>();
}
-JavaClassWrapper *JavaClassWrapper::singleton = NULL;
+JavaClassWrapper *JavaClassWrapper::singleton = nullptr;
JavaClassWrapper::JavaClassWrapper(jobject p_activity) {
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index e018ee69f0..9d44ab4619 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -52,10 +52,10 @@
#include <unistd.h>
-static JavaClassWrapper *java_class_wrapper = NULL;
-static OS_Android *os_android = NULL;
-static GodotJavaWrapper *godot_java = NULL;
-static GodotIOJavaWrapper *godot_io_java = NULL;
+static JavaClassWrapper *java_class_wrapper = nullptr;
+static OS_Android *os_android = nullptr;
+static GodotJavaWrapper *godot_java = nullptr;
+static GodotIOJavaWrapper *godot_io_java = nullptr;
static bool initialized = false;
static int step = 0;
@@ -123,14 +123,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_ondestroy(JNIEnv *env
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jclass clazz, jobjectArray p_cmdline) {
ThreadAndroid::setup_thread();
- const char **cmdline = NULL;
- jstring *j_cmdline = NULL;
+ const char **cmdline = nullptr;
+ jstring *j_cmdline = nullptr;
int cmdlen = 0;
if (p_cmdline) {
cmdlen = env->GetArrayLength(p_cmdline);
if (cmdlen) {
cmdline = (const char **)malloc((cmdlen + 1) * sizeof(const char *));
- cmdline[cmdlen] = NULL;
+ cmdline[cmdlen] = nullptr;
j_cmdline = (jstring *)malloc(cmdlen * sizeof(jstring));
for (int i = 0; i < cmdlen; i++) {
@@ -430,7 +430,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_callobject(JNIEnv *en
obj->call(str_method, (const Variant **)vptr, count, err);
// something
- env->PopLocalFrame(NULL);
+ env->PopLocalFrame(nullptr);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *env, jclass clazz, jint ID, jstring method, jobjectArray params) {
@@ -456,7 +456,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *
obj->call_deferred(str_method, args[0], args[1], args[2], args[3], args[4]);
// something
- env->PopLocalFrame(NULL);
+ env->PopLocalFrame(nullptr);
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_requestPermissionResult(JNIEnv *env, jclass clazz, jstring p_permission, jboolean p_result) {
diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp
index 2a540bb4a9..8ef99dfab0 100644
--- a/platform/android/java_godot_wrapper.cpp
+++ b/platform/android/java_godot_wrapper.cpp
@@ -80,13 +80,13 @@ jobject GodotJavaWrapper::get_activity() {
jobject GodotJavaWrapper::get_member_object(const char *p_name, const char *p_class, JNIEnv *p_env) {
if (cls) {
- if (p_env == NULL)
+ if (p_env == nullptr)
p_env = ThreadAndroid::get_env();
jfieldID fid = p_env->GetStaticFieldID(cls, p_name, p_class);
return p_env->GetStaticObjectField(cls, fid);
} else {
- return NULL;
+ return nullptr;
}
}
@@ -96,13 +96,13 @@ jobject GodotJavaWrapper::get_class_loader() {
jmethodID getClassLoader = env->GetMethodID(cls, "getClassLoader", "()Ljava/lang/ClassLoader;");
return env->CallObjectMethod(godot_instance, getClassLoader);
} else {
- return NULL;
+ return nullptr;
}
}
void GodotJavaWrapper::on_video_init(JNIEnv *p_env) {
if (_on_video_init)
- if (p_env == NULL)
+ if (p_env == nullptr)
p_env = ThreadAndroid::get_env();
p_env->CallVoidMethod(godot_instance, _on_video_init);
@@ -110,7 +110,7 @@ void GodotJavaWrapper::on_video_init(JNIEnv *p_env) {
void GodotJavaWrapper::on_godot_main_loop_started(JNIEnv *p_env) {
if (_on_godot_main_loop_started) {
- if (p_env == NULL) {
+ if (p_env == nullptr) {
p_env = ThreadAndroid::get_env();
}
}
@@ -119,7 +119,7 @@ void GodotJavaWrapper::on_godot_main_loop_started(JNIEnv *p_env) {
void GodotJavaWrapper::restart(JNIEnv *p_env) {
if (_restart)
- if (p_env == NULL)
+ if (p_env == nullptr)
p_env = ThreadAndroid::get_env();
p_env->CallVoidMethod(godot_instance, _restart);
@@ -127,7 +127,7 @@ void GodotJavaWrapper::restart(JNIEnv *p_env) {
void GodotJavaWrapper::force_quit(JNIEnv *p_env) {
if (_finish)
- if (p_env == NULL)
+ if (p_env == nullptr)
p_env = ThreadAndroid::get_env();
p_env->CallVoidMethod(godot_instance, _finish);
@@ -244,7 +244,7 @@ jobject GodotJavaWrapper::get_surface() {
JNIEnv *env = ThreadAndroid::get_env();
return env->CallObjectMethod(godot_instance, _get_surface);
} else {
- return NULL;
+ return nullptr;
}
}
diff --git a/platform/android/java_godot_wrapper.h b/platform/android/java_godot_wrapper.h
index fb77c8ba6a..89d6b6db46 100644
--- a/platform/android/java_godot_wrapper.h
+++ b/platform/android/java_godot_wrapper.h
@@ -68,14 +68,14 @@ public:
~GodotJavaWrapper();
jobject get_activity();
- jobject get_member_object(const char *p_name, const char *p_class, JNIEnv *p_env = NULL);
+ jobject get_member_object(const char *p_name, const char *p_class, JNIEnv *p_env = nullptr);
jobject get_class_loader();
- void on_video_init(JNIEnv *p_env = NULL);
- void on_godot_main_loop_started(JNIEnv *p_env = NULL);
- void restart(JNIEnv *p_env = NULL);
- void force_quit(JNIEnv *p_env = NULL);
+ void on_video_init(JNIEnv *p_env = nullptr);
+ void on_godot_main_loop_started(JNIEnv *p_env = nullptr);
+ void restart(JNIEnv *p_env = nullptr);
+ void force_quit(JNIEnv *p_env = nullptr);
void set_keep_screen_on(bool p_enabled);
void alert(const String &p_message, const String &p_title);
int get_gles_version_code();
diff --git a/platform/android/jni_utils.cpp b/platform/android/jni_utils.cpp
index 3fa4e80884..ded79a668f 100644
--- a/platform/android/jni_utils.cpp
+++ b/platform/android/jni_utils.cpp
@@ -130,7 +130,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a
env->CallVoidMethodA(jdict, set_keys, &val);
env->DeleteLocalRef(jkeys);
- jobjectArray jvalues = env->NewObjectArray(keys.size(), env->FindClass("java/lang/Object"), NULL);
+ jobjectArray jvalues = env->NewObjectArray(keys.size(), env->FindClass("java/lang/Object"), nullptr);
for (int j = 0; j < keys.size(); j++) {
Variant var = dict[keys[j]];
@@ -211,7 +211,7 @@ String _get_class_name(JNIEnv *env, jclass cls, bool *array) {
Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
- if (obj == NULL) {
+ if (obj == nullptr) {
return Variant();
}
@@ -384,7 +384,7 @@ Variant::Type get_jni_type(const String &p_type) {
{ "[F", Variant::PACKED_FLOAT32_ARRAY },
{ "[Ljava.lang.String;", Variant::PACKED_STRING_ARRAY },
{ "org.godotengine.godot.Dictionary", Variant::DICTIONARY },
- { NULL, Variant::NIL }
+ { nullptr, Variant::NIL }
};
int idx = 0;
@@ -417,7 +417,7 @@ const char *get_jni_sig(const String &p_type) {
{ "[B", "[B" },
{ "[F", "[F" },
{ "[Ljava.lang.String;", "[Ljava/lang/String;" },
- { NULL, "V" }
+ { nullptr, "V" }
};
int idx = 0;
diff --git a/platform/android/jni_utils.h b/platform/android/jni_utils.h
index 925340a680..b9ee243308 100644
--- a/platform/android/jni_utils.h
+++ b/platform/android/jni_utils.h
@@ -40,7 +40,7 @@ struct jvalret {
jobject obj;
jvalue val;
- jvalret() { obj = NULL; }
+ jvalret() { obj = nullptr; }
};
jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_arg, bool force_jobject = false);
@@ -106,7 +106,7 @@ public:
}
}
- jvalue *v = NULL;
+ jvalue *v = nullptr;
if (p_argcount) {
@@ -201,7 +201,7 @@ public:
} break;
default: {
- env->PopLocalFrame(NULL);
+ env->PopLocalFrame(nullptr);
ERR_FAIL_V(Variant());
} break;
}
@@ -211,7 +211,7 @@ public:
to_erase.pop_front();
}
- env->PopLocalFrame(NULL);
+ env->PopLocalFrame(nullptr);
return ret;
}
@@ -235,7 +235,7 @@ public:
}
JNISingleton() {
- instance = NULL;
+ instance = nullptr;
}
};
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 537230826c..344377d673 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -71,7 +71,7 @@ const char *OS_Android::get_video_driver_name(int p_driver) const {
case VIDEO_DRIVER_GLES2:
return "GLES2";
}
- ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
+ ERR_FAIL_V_MSG(nullptr, "Invalid video driver index: " + itos(p_driver) + ".");
}
int OS_Android::get_audio_driver_count() const {
@@ -754,12 +754,12 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god
default_videomode.fullscreen = true;
default_videomode.resizable = false;
- main_loop = NULL;
- gl_extensions = NULL;
- //rasterizer = NULL;
+ main_loop = nullptr;
+ gl_extensions = nullptr;
+ //rasterizer = nullptr;
use_gl2 = false;
- rendering_server = NULL;
+ rendering_server = nullptr;
godot_java = p_godot_java;
godot_io_java = p_godot_io_java;
diff --git a/platform/android/string_android.h b/platform/android/string_android.h
index 51c488c8cc..88ccd3b652 100644
--- a/platform/android/string_android.h
+++ b/platform/android/string_android.h
@@ -40,13 +40,13 @@
* @param env JNI environment instance. If null obtained by ThreadAndroid::get_env().
* @return Godot string instance.
*/
-static inline String jstring_to_string(jstring source, JNIEnv *env = NULL) {
+static inline String jstring_to_string(jstring source, JNIEnv *env = nullptr) {
String result;
if (source) {
if (!env) {
env = ThreadAndroid::get_env();
}
- const char *const source_utf8 = env->GetStringUTFChars(source, NULL);
+ const char *const source_utf8 = env->GetStringUTFChars(source, nullptr);
if (source_utf8) {
result.parse_utf8(source_utf8);
env->ReleaseStringUTFChars(source, source_utf8);
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index 98b61ad755..729327f6f0 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -66,7 +66,7 @@ void *ThreadAndroid::thread_callback(void *userdata) {
pthread_setspecific(thread_id_key, (void *)memnew(ID(t->id)));
t->callback(t->user);
ScriptServer::thread_exit();
- return NULL;
+ return nullptr;
}
Thread *ThreadAndroid::create_func_jandroid(ThreadCreateCallback p_callback, void *p_user, const Settings &) {
@@ -100,7 +100,7 @@ void ThreadAndroid::wait_to_finish_func_jandroid(Thread *p_thread) {
ERR_FAIL_COND(!tp);
ERR_FAIL_COND(tp->pthread == 0);
- pthread_join(tp->pthread, NULL);
+ pthread_join(tp->pthread, nullptr);
tp->pthread = 0;
}
@@ -108,21 +108,21 @@ void ThreadAndroid::_thread_destroyed(void *value) {
/* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */
JNIEnv *env = (JNIEnv *)value;
- if (env != NULL) {
+ if (env != nullptr) {
java_vm->DetachCurrentThread();
- pthread_setspecific(jvm_key, NULL);
+ pthread_setspecific(jvm_key, nullptr);
}
}
pthread_key_t ThreadAndroid::jvm_key;
-JavaVM *ThreadAndroid::java_vm = NULL;
+JavaVM *ThreadAndroid::java_vm = nullptr;
void ThreadAndroid::setup_thread() {
if (pthread_getspecific(jvm_key))
return; //already setup
JNIEnv *env;
- java_vm->AttachCurrentThread(&env, NULL);
+ java_vm->AttachCurrentThread(&env, nullptr);
pthread_setspecific(jvm_key, (void *)env);
}
@@ -142,8 +142,8 @@ JNIEnv *ThreadAndroid::get_env() {
setup_thread();
}
- JNIEnv *env = NULL;
- java_vm->AttachCurrentThread(&env, NULL);
+ JNIEnv *env = nullptr;
+ java_vm->AttachCurrentThread(&env, nullptr);
return env;
}
diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub
index 592f56bbbf..dbff6c5ae9 100644
--- a/platform/haiku/SCsub
+++ b/platform/haiku/SCsub
@@ -1,28 +1,25 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
common_haiku = [
- 'os_haiku.cpp',
- 'context_gl_haiku.cpp',
- 'haiku_application.cpp',
- 'haiku_direct_window.cpp',
- 'haiku_gl_view.cpp',
- 'key_mapping_haiku.cpp',
- 'audio_driver_media_kit.cpp'
+ "os_haiku.cpp",
+ "context_gl_haiku.cpp",
+ "haiku_application.cpp",
+ "haiku_direct_window.cpp",
+ "haiku_gl_view.cpp",
+ "key_mapping_haiku.cpp",
+ "audio_driver_media_kit.cpp",
]
-target = env.add_program(
- '#bin/godot',
- ['godot_haiku.cpp'] + common_haiku
-)
+target = env.add_program("#bin/godot", ["godot_haiku.cpp"] + common_haiku)
-command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef',
- ['rc -o $TARGET $SOURCE'])
+command = env.Command("#bin/godot.rsrc", "#platform/haiku/godot.rdef", ["rc -o $TARGET $SOURCE"])
def addResourcesAction(target=None, source=None, env=None):
- return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
+ return env.Execute("xres -o " + File(target)[0].path + " bin/godot.rsrc")
+
env.AddPostAction(target, addResourcesAction)
env.Depends(target, command)
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 0a5df14743..94c9e83368 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -34,7 +34,7 @@
#include "core/project_settings.h"
-int32_t *AudioDriverMediaKit::samples_in = NULL;
+int32_t *AudioDriverMediaKit::samples_in = nullptr;
Error AudioDriverMediaKit::init() {
active = false;
@@ -59,12 +59,12 @@ Error AudioDriverMediaKit::init() {
&format,
"godot_sound_server",
AudioDriverMediaKit::PlayBuffer,
- NULL,
+ nullptr,
this);
if (player->InitCheck() != B_OK) {
fprintf(stderr, "MediaKit ERR: can not create a BSoundPlayer instance\n");
- ERR_FAIL_COND_V(player == NULL, ERR_CANT_OPEN);
+ ERR_FAIL_COND_V(player == nullptr, ERR_CANT_OPEN);
}
player->Start();
@@ -126,7 +126,7 @@ void AudioDriverMediaKit::finish() {
}
AudioDriverMediaKit::AudioDriverMediaKit() {
- player = NULL;
+ player = nullptr;
}
AudioDriverMediaKit::~AudioDriverMediaKit() {
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index dd72294816..0b84df8f9b 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -12,7 +12,7 @@ def get_name():
def can_build():
- if (os.name != "posix" or sys.platform == "darwin"):
+ if os.name != "posix" or sys.platform == "darwin":
return False
return True
@@ -22,41 +22,40 @@ def get_opts():
from SCons.Variables import EnumVariable
return [
- EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
+ EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")),
]
def get_flags():
- return [
- ]
+ return []
def configure(env):
## Build type
- if (env["target"] == "release"):
- env.Prepend(CCFLAGS=['-O3'])
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
+ if env["target"] == "release":
+ env.Prepend(CCFLAGS=["-O3"])
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
- elif (env["target"] == "release_debug"):
- env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
+ elif env["target"] == "release_debug":
+ env.Prepend(CCFLAGS=["-O2", "-DDEBUG_ENABLED"])
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
- elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ elif env["target"] == "debug":
+ env.Prepend(CCFLAGS=["-g3", "-DDEBUG_ENABLED", "-DDEBUG_MEMORY_ENABLED"])
## Architecture
- is64 = sys.maxsize > 2**32
- if (env["bits"] == "default"):
+ is64 = sys.maxsize > 2 ** 32
+ if env["bits"] == "default":
env["bits"] = "64" if is64 else "32"
## Compiler configuration
@@ -66,89 +65,94 @@ def configure(env):
## Dependencies
- if not env['builtin_libwebp']:
- env.ParseConfig('pkg-config libwebp --cflags --libs')
+ 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']:
- env['builtin_freetype'] = True
- env['builtin_libpng'] = True
- env['builtin_zlib'] = True
+ if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]:
+ env["builtin_freetype"] = True
+ env["builtin_libpng"] = True
+ env["builtin_zlib"] = True
- if not env['builtin_freetype']:
- env.ParseConfig('pkg-config freetype2 --cflags --libs')
+ if not env["builtin_freetype"]:
+ env.ParseConfig("pkg-config freetype2 --cflags --libs")
- if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng16 --cflags --libs')
+ if not env["builtin_libpng"]:
+ env.ParseConfig("pkg-config libpng16 --cflags --libs")
- if not env['builtin_bullet']:
+ if not env["builtin_bullet"]:
# We need at least version 2.88
import subprocess
- bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip()
+
+ bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip()
if bullet_version < "2.88":
# Abort as system bullet was requested but too old
- print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.88"))
+ print(
+ "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(
+ bullet_version, "2.88"
+ )
+ )
sys.exit(255)
- env.ParseConfig('pkg-config bullet --cflags --libs')
+ env.ParseConfig("pkg-config bullet --cflags --libs")
- if not env['builtin_enet']:
- env.ParseConfig('pkg-config libenet --cflags --libs')
+ if not env["builtin_enet"]:
+ env.ParseConfig("pkg-config libenet --cflags --libs")
- if not env['builtin_squish']:
- env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if not env["builtin_squish"]:
+ env.ParseConfig("pkg-config libsquish --cflags --libs")
- if not env['builtin_zstd']:
- env.ParseConfig('pkg-config libzstd --cflags --libs')
+ if not env["builtin_zstd"]:
+ env.ParseConfig("pkg-config libzstd --cflags --libs")
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- if not env['builtin_libtheora']:
- 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')
+ if not env["builtin_libtheora"]:
+ 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")
- if not env['builtin_libvpx']:
- env.ParseConfig('pkg-config vpx --cflags --libs')
+ if not env["builtin_libvpx"]:
+ env.ParseConfig("pkg-config vpx --cflags --libs")
- if not env['builtin_libvorbis']:
- env['builtin_libogg'] = False # Needed to link against system libvorbis
- env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+ if not env["builtin_libvorbis"]:
+ env["builtin_libogg"] = False # Needed to link against system libvorbis
+ env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs")
- if not env['builtin_opus']:
- env['builtin_libogg'] = False # Needed to link against system opus
- env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+ if not env["builtin_opus"]:
+ env["builtin_libogg"] = False # Needed to link against system opus
+ env.ParseConfig("pkg-config opus opusfile --cflags --libs")
- if not env['builtin_libogg']:
- env.ParseConfig('pkg-config ogg --cflags --libs')
+ 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 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_wslay']:
- env.ParseConfig('pkg-config libwslay --cflags --libs')
+ if not env["builtin_wslay"]:
+ env.ParseConfig("pkg-config libwslay --cflags --libs")
- if not env['builtin_mbedtls']:
+ 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'])
+ env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
- if not env['builtin_miniupnpc']:
+ if not env["builtin_miniupnpc"]:
# No pkgconfig file so far, hardcode default paths.
env.Prepend(CPPPATH=["/system/develop/headers/x86/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')
+ if not env["builtin_pcre2"]:
+ env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
## Flags
- env.Prepend(CPPPATH=['#platform/haiku'])
- env.Append(CPPDEFINES=['UNIX_ENABLED', 'OPENGL_ENABLED', 'GLES_ENABLED'])
- env.Append(CPPDEFINES=['MEDIA_KIT_ENABLED'])
- env.Append(CPPDEFINES=['PTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
- env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
+ env.Prepend(CPPPATH=["#platform/haiku"])
+ env.Append(CPPDEFINES=["UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED"])
+ env.Append(CPPDEFINES=["MEDIA_KIT_ENABLED"])
+ env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) # TODO: enable when we have pthread_setname_np
+ env.Append(LIBS=["be", "game", "media", "network", "bnetapi", "z", "GL"])
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 18e1862d33..0a40f847f4 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -42,10 +42,10 @@ HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
last_button_mask = 0;
last_key_modifier_state = 0;
- view = NULL;
- update_runner = NULL;
- input = NULL;
- main_loop = NULL;
+ view = nullptr;
+ update_runner = nullptr;
+ input = nullptr;
+ main_loop = nullptr;
}
HaikuDirectWindow::~HaikuDirectWindow() {
@@ -278,7 +278,7 @@ void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
event->set_echo(message->HasInt32("be:key_repeat"));
event->set_unicode(0);
- const char *bytes = NULL;
+ const char *bytes = nullptr;
if (message->FindString("bytes", &bytes) == B_OK) {
event->set_unicode(BUnicodeChar::FromUTF8(&bytes));
}
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index 7939ea0a1e..07cb18d7cd 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -85,7 +85,7 @@ int OS_Haiku::get_current_video_driver() const {
}
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
- main_loop = NULL;
+ main_loop = nullptr;
current_video_mode = p_desired;
app = new HaikuApplication();
@@ -142,7 +142,7 @@ void OS_Haiku::finalize() {
memdelete(main_loop);
}
- main_loop = NULL;
+ main_loop = nullptr;
rendering_server->finish();
memdelete(rendering_server);
@@ -169,8 +169,8 @@ void OS_Haiku::delete_main_loop() {
memdelete(main_loop);
}
- main_loop = NULL;
- window->SetMainLoop(NULL);
+ main_loop = nullptr;
+ window->SetMainLoop(nullptr);
}
void OS_Haiku::release_rendering_thread() {
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 1f82f51888..a48629f720 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -1,31 +1,35 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
iphone_lib = [
- 'godot_iphone.cpp',
- 'os_iphone.cpp',
- 'semaphore_iphone.cpp',
- 'gl_view.mm',
- 'main.m',
- 'app_delegate.mm',
- 'view_controller.mm',
- 'game_center.mm',
- 'in_app_store.mm',
- 'icloud.mm',
- 'ios.mm',
- 'vulkan_context_iphone.mm',
+ "godot_iphone.cpp",
+ "os_iphone.cpp",
+ "semaphore_iphone.cpp",
+ "gl_view.mm",
+ "main.m",
+ "app_delegate.mm",
+ "view_controller.mm",
+ "game_center.mm",
+ "in_app_store.mm",
+ "icloud.mm",
+ "ios.mm",
+ "vulkan_context_iphone.mm",
]
env_ios = env.Clone()
-ios_lib = env_ios.add_library('iphone', iphone_lib)
+ios_lib = env_ios.add_library("iphone", iphone_lib)
+
def combine_libs(target=None, source=None, env=None):
lib_path = target[0].srcnode().abspath
if "osxcross" in env:
- libtool = '$IPHONEPATH/usr/bin/${ios_triple}libtool'
+ 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]))
+ 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)
+combine_command = env_ios.Command("#bin/libgodot" + env_ios["LIBSUFFIX"], [ios_lib] + env_ios["LIBS"], combine_libs)
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index e01950c1db..3e6c2f0ecf 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -2,6 +2,7 @@ import os
import sys
from methods import detect_darwin_sdk_path
+
def is_active():
return True
@@ -12,7 +13,7 @@ def get_name():
def can_build():
- if sys.platform == 'darwin' or ("OSXCROSS_IOS" in os.environ):
+ if sys.platform == "darwin" or ("OSXCROSS_IOS" in os.environ):
return True
return False
@@ -20,22 +21,31 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable
+
return [
- ('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
- ('IPHONESDK', 'Path to the iPhone SDK', ''),
- BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', False),
- BoolVariable('game_center', 'Support for game center', True),
- BoolVariable('store_kit', 'Support for in-app store', True),
- BoolVariable('icloud', 'Support for iCloud', True),
- BoolVariable('ios_exceptions', 'Enable exceptions', False),
- ('ios_triple', 'Triple for ios toolchain', ''),
+ (
+ "IPHONEPATH",
+ "Path to iPhone toolchain",
+ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
+ ),
+ ("IPHONESDK", "Path to the iPhone SDK", ""),
+ BoolVariable(
+ "use_static_mvk",
+ "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)",
+ False,
+ ),
+ BoolVariable("game_center", "Support for game center", True),
+ BoolVariable("store_kit", "Support for in-app store", True),
+ BoolVariable("icloud", "Support for iCloud", True),
+ BoolVariable("ios_exceptions", "Enable exceptions", False),
+ ("ios_triple", "Triple for ios toolchain", ""),
]
def get_flags():
return [
- ('tools', False),
+ ("tools", False),
]
@@ -43,32 +53,32 @@ def configure(env):
## Build type
- if (env["target"].startswith("release")):
- env.Append(CPPDEFINES=['NDEBUG', ('NS_BLOCK_ASSERTIONS', 1)])
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Append(CCFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer'])
- env.Append(LINKFLAGS=['-O2'])
- else: #optimize for size
- env.Append(CCFLAGS=['-Os', '-ftree-vectorize'])
- env.Append(LINKFLAGS=['-Os'])
+ if env["target"].startswith("release"):
+ env.Append(CPPDEFINES=["NDEBUG", ("NS_BLOCK_ASSERTIONS", 1)])
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Append(CCFLAGS=["-O2", "-ftree-vectorize", "-fomit-frame-pointer"])
+ env.Append(LINKFLAGS=["-O2"])
+ else: # optimize for size
+ env.Append(CCFLAGS=["-Os", "-ftree-vectorize"])
+ env.Append(LINKFLAGS=["-Os"])
if env["target"] == "release_debug":
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-gdwarf-2', '-O0'])
- env.Append(CPPDEFINES=['_DEBUG', ('DEBUG', 1), 'DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
+ elif env["target"] == "debug":
+ env.Append(CCFLAGS=["-gdwarf-2", "-O0"])
+ env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
- if (env["use_lto"]):
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto'])
+ if env["use_lto"]:
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto"])
## Architecture
if env["arch"] == "x86": # i386
env["bits"] = "32"
elif env["arch"] == "x86_64":
env["bits"] = "64"
- elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm
+ elif env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32": # arm
env["arch"] = "arm"
env["bits"] = "32"
else: # armv64
@@ -81,108 +91,145 @@ def configure(env):
if "OSXCROSS_IOS" in os.environ:
env["osxcross"] = True
- env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
+ env["ENV"]["PATH"] = env["IPHONEPATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]
- compiler_path = '$IPHONEPATH/usr/bin/${ios_triple}'
- s_compiler_path = '$IPHONEPATH/Developer/usr/bin/'
+ compiler_path = "$IPHONEPATH/usr/bin/${ios_triple}"
+ s_compiler_path = "$IPHONEPATH/Developer/usr/bin/"
ccache_path = os.environ.get("CCACHE")
if ccache_path is None:
- env['CC'] = compiler_path + 'clang'
- env['CXX'] = compiler_path + 'clang++'
- env['S_compiler'] = s_compiler_path + 'gcc'
+ env["CC"] = compiler_path + "clang"
+ env["CXX"] = compiler_path + "clang++"
+ env["S_compiler"] = s_compiler_path + "gcc"
else:
# there aren't any ccache wrappers available for iOS,
# to enable caching we need to prepend the path to the ccache binary
- env['CC'] = ccache_path + ' ' + compiler_path + 'clang'
- env['CXX'] = ccache_path + ' ' + compiler_path + 'clang++'
- env['S_compiler'] = ccache_path + ' ' + s_compiler_path + 'gcc'
- env['AR'] = compiler_path + 'ar'
- env['RANLIB'] = compiler_path + 'ranlib'
+ env["CC"] = ccache_path + " " + compiler_path + "clang"
+ env["CXX"] = ccache_path + " " + compiler_path + "clang++"
+ env["S_compiler"] = ccache_path + " " + s_compiler_path + "gcc"
+ env["AR"] = compiler_path + "ar"
+ env["RANLIB"] = compiler_path + "ranlib"
## Compile flags
- if (env["arch"] == "x86" or env["arch"] == "x86_64"):
- detect_darwin_sdk_path('iphonesimulator', env)
- env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
+ if env["arch"] == "x86" or env["arch"] == "x86_64":
+ detect_darwin_sdk_path("iphonesimulator", env)
+ env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
arch_flag = "i386" if env["arch"] == "x86" else env["arch"]
- env.Append(CCFLAGS=('-arch ' + arch_flag + ' -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0').split())
- elif (env["arch"] == "arm"):
- detect_darwin_sdk_path('iphone', env)
- env.Append(CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=10.0 -MMD -MT dependencies'.split())
- elif (env["arch"] == "arm64"):
- detect_darwin_sdk_path('iphone', env)
- env.Append(CCFLAGS='-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=10.0 -isysroot $IPHONESDK'.split())
- env.Append(CPPDEFINES=['NEED_LONG_INT'])
- env.Append(CPPDEFINES=['LIBYUV_DISABLE_NEON'])
+ env.Append(
+ CCFLAGS=(
+ "-arch "
+ + arch_flag
+ + " -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK -mios-simulator-version-min=10.0"
+ ).split()
+ )
+ elif env["arch"] == "arm":
+ detect_darwin_sdk_path("iphone", env)
+ env.Append(
+ CCFLAGS='-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=10.0 -MMD -MT dependencies'.split()
+ )
+ elif env["arch"] == "arm64":
+ detect_darwin_sdk_path("iphone", env)
+ env.Append(
+ CCFLAGS="-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -miphoneos-version-min=10.0 -isysroot $IPHONESDK".split()
+ )
+ env.Append(CPPDEFINES=["NEED_LONG_INT"])
+ env.Append(CPPDEFINES=["LIBYUV_DISABLE_NEON"])
# Disable exceptions on non-tools (template) builds
- if not env['tools']:
- if env['ios_exceptions']:
- env.Append(CCFLAGS=['-fexceptions'])
+ if not env["tools"]:
+ if env["ios_exceptions"]:
+ env.Append(CCFLAGS=["-fexceptions"])
else:
- env.Append(CCFLAGS=['-fno-exceptions'])
+ env.Append(CCFLAGS=["-fno-exceptions"])
## Link flags
- if (env["arch"] == "x86" or env["arch"] == "x86_64"):
+ if env["arch"] == "x86" or env["arch"] == "x86_64":
arch_flag = "i386" if env["arch"] == "x86" else env["arch"]
- env.Append(LINKFLAGS=['-arch', arch_flag, '-mios-simulator-version-min=10.0',
- '-isysroot', '$IPHONESDK',
- '-Xlinker',
- '-objc_abi_version',
- '-Xlinker', '2',
- '-F$IPHONESDK',
- ])
- elif (env["arch"] == "arm"):
- env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=10.0'])
- if (env["arch"] == "arm64"):
- env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=10.0'])
-
- env.Append(LINKFLAGS=['-isysroot', '$IPHONESDK',
- '-framework', 'AudioToolbox',
- '-framework', 'AVFoundation',
- '-framework', 'CoreAudio',
- '-framework', 'CoreGraphics',
- '-framework', 'CoreMedia',
- '-framework', 'CoreVideo',
- '-framework', 'CoreMotion',
- '-framework', 'Foundation',
- '-framework', 'GameController',
- '-framework', 'MediaPlayer',
- '-framework', 'Metal',
- '-framework', 'QuartzCore',
- '-framework', 'Security',
- '-framework', 'SystemConfiguration',
- '-framework', 'UIKit',
- '-framework', 'ARKit',
- ])
+ env.Append(
+ LINKFLAGS=[
+ "-arch",
+ arch_flag,
+ "-mios-simulator-version-min=10.0",
+ "-isysroot",
+ "$IPHONESDK",
+ "-Xlinker",
+ "-objc_abi_version",
+ "-Xlinker",
+ "2",
+ "-F$IPHONESDK",
+ ]
+ )
+ elif env["arch"] == "arm":
+ env.Append(LINKFLAGS=["-arch", "armv7", "-Wl,-dead_strip", "-miphoneos-version-min=10.0"])
+ if env["arch"] == "arm64":
+ env.Append(LINKFLAGS=["-arch", "arm64", "-Wl,-dead_strip", "-miphoneos-version-min=10.0"])
+
+ env.Append(
+ LINKFLAGS=[
+ "-isysroot",
+ "$IPHONESDK",
+ "-framework",
+ "AudioToolbox",
+ "-framework",
+ "AVFoundation",
+ "-framework",
+ "CoreAudio",
+ "-framework",
+ "CoreGraphics",
+ "-framework",
+ "CoreMedia",
+ "-framework",
+ "CoreVideo",
+ "-framework",
+ "CoreMotion",
+ "-framework",
+ "Foundation",
+ "-framework",
+ "GameController",
+ "-framework",
+ "MediaPlayer",
+ "-framework",
+ "Metal",
+ "-framework",
+ "QuartzCore",
+ "-framework",
+ "Security",
+ "-framework",
+ "SystemConfiguration",
+ "-framework",
+ "UIKit",
+ "-framework",
+ "ARKit",
+ ]
+ )
# Feature options
- if env['game_center']:
- env.Append(CPPDEFINES=['GAME_CENTER_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'GameKit'])
+ if env["game_center"]:
+ env.Append(CPPDEFINES=["GAME_CENTER_ENABLED"])
+ env.Append(LINKFLAGS=["-framework", "GameKit"])
- if env['store_kit']:
- env.Append(CPPDEFINES=['STOREKIT_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'StoreKit'])
+ if env["store_kit"]:
+ env.Append(CPPDEFINES=["STOREKIT_ENABLED"])
+ env.Append(LINKFLAGS=["-framework", "StoreKit"])
- if env['icloud']:
- env.Append(CPPDEFINES=['ICLOUD_ENABLED'])
+ if env["icloud"]:
+ env.Append(CPPDEFINES=["ICLOUD_ENABLED"])
- env.Prepend(CPPPATH=['$IPHONESDK/usr/include',
- '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers',
- ])
+ env.Prepend(
+ CPPPATH=["$IPHONESDK/usr/include", "$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers",]
+ )
- env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
+ env["ENV"]["CODESIGN_ALLOCATE"] = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
- env.Prepend(CPPPATH=['#platform/iphone'])
- env.Append(CPPDEFINES=['IPHONE_ENABLED', 'UNIX_ENABLED', 'COREAUDIO_ENABLED'])
+ env.Prepend(CPPPATH=["#platform/iphone"])
+ env.Append(CPPDEFINES=["IPHONE_ENABLED", "UNIX_ENABLED", "COREAUDIO_ENABLED"])
- env.Append(CPPDEFINES=['VULKAN_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'IOSurface'])
- if (env['use_static_mvk']):
- env.Append(LINKFLAGS=['-framework', 'MoltenVK'])
- env['builtin_vulkan'] = False
- elif not env['builtin_vulkan']:
- env.Append(LIBS=['vulkan'])
+ env.Append(CPPDEFINES=["VULKAN_ENABLED"])
+ env.Append(LINKFLAGS=["-framework", "IOSurface"])
+ if env["use_static_mvk"]:
+ env.Append(LINKFLAGS=["-framework", "MoltenVK"])
+ env["builtin_vulkan"] = False
+ elif not env["builtin_vulkan"]:
+ env.Append(LIBS=["vulkan"])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 08f3c3f91f..3efe338ac7 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -71,8 +71,8 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
String modules_buildphase;
String modules_buildgrp;
};
-
struct ExportArchitecture {
+
String name;
bool is_default;
@@ -106,7 +106,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Error _export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, Vector<IOSExportAsset> &r_exported_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<SharedObject> &p_libraries, Vector<IOSExportAsset> &r_exported_assets);
- bool is_package_name_valid(const String &p_package, String *r_error = NULL) const {
+ bool is_package_name_valid(const String &p_package, String *r_error = nullptr) const {
String pname = p_package;
@@ -795,7 +795,7 @@ void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPrese
String pbx_resources_refs;
const String file_info_format = String("$build_id = {isa = PBXBuildFile; fileRef = $ref_id; };\n") +
- "$ref_id = {isa = PBXFileReference; lastKnownFileType = $file_type; name = $name; path = \"$file_path\"; sourceTree = \"<group>\"; };\n";
+ "$ref_id = {isa = PBXFileReference; lastKnownFileType = $file_type; name = \"$name\"; path = \"$file_path\"; sourceTree = \"<group>\"; };\n";
for (int i = 0; i < p_additional_assets.size(); ++i) {
String build_id = (++current_id).str();
String ref_id = (++current_id).str();
@@ -925,6 +925,13 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir
Vector<String> frameworks = export_plugins[i]->get_ios_frameworks();
Error err = _export_additional_assets(p_out_dir, frameworks, true, r_exported_assets);
ERR_FAIL_COND_V(err, err);
+
+ Vector<String> project_static_libs = export_plugins[i]->get_ios_project_static_libs();
+ for (int j = 0; j < project_static_libs.size(); j++)
+ project_static_libs.write[j] = project_static_libs[j].get_file(); // Only the file name as it's copied to the project
+ err = _export_additional_assets(p_out_dir, project_static_libs, true, r_exported_assets);
+ ERR_FAIL_COND_V(err, err);
+
Vector<String> ios_bundle_files = export_plugins[i]->get_ios_bundle_files();
err = _export_additional_assets(p_out_dir, ios_bundle_files, false, r_exported_assets);
ERR_FAIL_COND_V(err, err);
@@ -1076,7 +1083,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
ERR_FAIL_COND_V(!tmp_app_path, ERR_CANT_CREATE);
print_line("Unzipping...");
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile src_pkg_zip = unzOpen2(src_pkg_name.utf8().get_data(), &io);
if (!src_pkg_zip) {
@@ -1098,7 +1105,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
//get filename
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file = fname;
@@ -1202,6 +1209,22 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
return ERR_FILE_NOT_FOUND;
}
+ // Copy project static libs to the project
+ Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins();
+ for (int i = 0; i < export_plugins.size(); i++) {
+ Vector<String> project_static_libs = export_plugins[i]->get_ios_project_static_libs();
+ for (int j = 0; j < project_static_libs.size(); j++) {
+ const String &static_lib_path = project_static_libs[j];
+ String dest_lib_file_path = dest_dir + static_lib_path.get_file();
+ Error lib_copy_err = tmp_app_path->copy(static_lib_path, dest_lib_file_path);
+ if (lib_copy_err != OK) {
+ ERR_PRINT("Can't copy '" + static_lib_path + "'.");
+ memdelete(tmp_app_path);
+ return lib_copy_err;
+ }
+ }
+ }
+
String iconset_dir = dest_dir + binary_name + "/Images.xcassets/AppIcon.appiconset/";
err = OK;
if (!tmp_app_path->dir_exists(iconset_dir)) {
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index 8c3eddc5f7..3e67362e16 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -36,7 +36,7 @@
#include <string.h>
#include <unistd.h>
-static OSIPhone *os = NULL;
+static OSIPhone *os = nullptr;
extern "C" {
int add_path(int p_argc, char **p_args);
@@ -71,7 +71,7 @@ int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
for (int i = 0; i < argc; i++) {
fargv[i] = argv[i];
};
- fargv[argc] = NULL;
+ fargv[argc] = nullptr;
argc = add_path(argc, fargv);
argc = add_cmdline(argc, fargv);
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index fe912621bb..3ef521a61a 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -68,7 +68,7 @@ const char *OSIPhone::get_video_driver_name(int p_driver) const {
case VIDEO_DRIVER_GLES2:
return "GLES2";
}
- ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
+ ERR_FAIL_V_MSG(nullptr, "Invalid video driver index: " + itos(p_driver) + ".");
};
OSIPhone *OSIPhone::get_singleton() {
@@ -339,7 +339,7 @@ void OSIPhone::delete_main_loop() {
memdelete(main_loop);
};
- main_loop = NULL;
+ main_loop = nullptr;
};
void OSIPhone::finalize() {
@@ -608,7 +608,7 @@ bool OSIPhone::_check_internal_feature_support(const String &p_feature) {
// so we use this as a hack to ensure certain code is called before
// everything else, but after all units are initialized.
typedef void (*init_callback)();
-static init_callback *ios_init_callbacks = NULL;
+static init_callback *ios_init_callbacks = nullptr;
static int ios_init_callbacks_count = 0;
static int ios_init_callbacks_capacity = 0;
@@ -631,12 +631,12 @@ OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
ios_init_callbacks[i]();
}
free(ios_init_callbacks);
- ios_init_callbacks = NULL;
+ ios_init_callbacks = nullptr;
ios_init_callbacks_count = 0;
ios_init_callbacks_capacity = 0;
- main_loop = NULL;
- rendering_server = NULL;
+ main_loop = nullptr;
+ rendering_server = nullptr;
VideoMode vm;
vm.fullscreen = true;
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index d3cd8f76b7..7239648937 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -1,67 +1,63 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
javascript_files = [
- 'audio_driver_javascript.cpp',
- 'http_client_javascript.cpp',
- 'javascript_eval.cpp',
- 'javascript_main.cpp',
- 'os_javascript.cpp',
+ "audio_driver_javascript.cpp",
+ "http_client_javascript.cpp",
+ "javascript_eval.cpp",
+ "javascript_main.cpp",
+ "os_javascript.cpp",
]
-build_targets = ['#bin/godot${PROGSUFFIX}.js', '#bin/godot${PROGSUFFIX}.wasm']
-if env['threads_enabled']:
- build_targets.append('#bin/godot${PROGSUFFIX}.worker.js')
+build_targets = ["#bin/godot${PROGSUFFIX}.js", "#bin/godot${PROGSUFFIX}.wasm"]
+if env["threads_enabled"]:
+ build_targets.append("#bin/godot${PROGSUFFIX}.worker.js")
build = env.add_program(build_targets, javascript_files)
js_libraries = [
- 'http_request.js',
+ "http_request.js",
]
for lib in js_libraries:
- env.Append(LINKFLAGS=['--js-library', env.File(lib).path])
+ env.Append(LINKFLAGS=["--js-library", env.File(lib).path])
env.Depends(build, js_libraries)
js_modules = [
- 'id_handler.js',
+ "id_handler.js",
]
for module in js_modules:
- env.Append(LINKFLAGS=['--pre-js', env.File(module).path])
+ env.Append(LINKFLAGS=["--pre-js", env.File(module).path])
env.Depends(build, js_modules)
engine = [
- 'engine/preloader.js',
- 'engine/loader.js',
- 'engine/utils.js',
- 'engine/engine.js',
+ "engine/preloader.js",
+ "engine/loader.js",
+ "engine/utils.js",
+ "engine/engine.js",
]
-externs = [
- env.File('#platform/javascript/engine/externs.js')
-]
-js_engine = env.CreateEngineFile('#bin/godot${PROGSUFFIX}.engine.js', engine, externs)
+externs = [env.File("#platform/javascript/engine/externs.js")]
+js_engine = env.CreateEngineFile("#bin/godot${PROGSUFFIX}.engine.js", engine, externs)
env.Depends(js_engine, externs)
wrap_list = [
build[0],
js_engine,
]
-js_wrapped = env.Textfile('#bin/godot', [env.File(f) for f in wrap_list], TEXTFILESUFFIX='${PROGSUFFIX}.wrapped.js')
+js_wrapped = env.Textfile("#bin/godot", [env.File(f) for f in wrap_list], TEXTFILESUFFIX="${PROGSUFFIX}.wrapped.js")
-zip_dir = env.Dir('#bin/.javascript_zip')
-out_files = [
- zip_dir.File('godot.js'),
- zip_dir.File('godot.wasm'),
- zip_dir.File('godot.html')
-]
-in_files = [
- js_wrapped,
- build[1],
- '#misc/dist/html/full-size.html'
-]
-if env['threads_enabled']:
+zip_dir = env.Dir("#bin/.javascript_zip")
+out_files = [zip_dir.File("godot.js"), zip_dir.File("godot.wasm"), zip_dir.File("godot.html")]
+in_files = [js_wrapped, build[1], "#misc/dist/html/full-size.html"]
+if env["threads_enabled"]:
in_files.append(build[2])
- out_files.append(zip_dir.File('godot.worker.js'))
+ out_files.append(zip_dir.File("godot.worker.js"))
zip_files = env.InstallAs(out_files, in_files)
-env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET')
+env.Zip(
+ "#bin/godot",
+ zip_files,
+ ZIPROOT=zip_dir,
+ ZIPSUFFIX="${PROGSUFFIX}${ZIPSUFFIX}",
+ ZIPCOMSTR="Archving $SOURCES as $TARGET",
+)
diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp
index 88de13d771..45cb82b351 100644
--- a/platform/javascript/api/api.cpp
+++ b/platform/javascript/api/api.cpp
@@ -46,7 +46,7 @@ void unregister_javascript_api() {
memdelete(javascript_eval);
}
-JavaScript *JavaScript::singleton = NULL;
+JavaScript *JavaScript::singleton = nullptr;
JavaScript *JavaScript::get_singleton() {
@@ -55,7 +55,7 @@ JavaScript *JavaScript::get_singleton() {
JavaScript::JavaScript() {
- ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist.");
+ ERR_FAIL_COND_MSG(singleton != nullptr, "JavaScript singleton already exist.");
singleton = this;
}
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index d63c6a40a5..8f857478e5 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.cpp
@@ -32,7 +32,7 @@
#include <emscripten.h>
-AudioDriverJavaScript *AudioDriverJavaScript::singleton = NULL;
+AudioDriverJavaScript *AudioDriverJavaScript::singleton = nullptr;
const char *AudioDriverJavaScript::get_name() const {
@@ -200,7 +200,7 @@ void AudioDriverJavaScript::finish() {
if (internal_buffer) {
memdelete_arr(internal_buffer);
- internal_buffer = NULL;
+ internal_buffer = nullptr;
}
_driver_id = 0;
}
@@ -264,7 +264,7 @@ Error AudioDriverJavaScript::capture_stop() {
AudioDriverJavaScript::AudioDriverJavaScript() {
_driver_id = 0;
- internal_buffer = NULL;
+ internal_buffer = nullptr;
buffer_length = 0;
singleton = this;
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index fb02752aa7..9486e10717 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -2,37 +2,39 @@ import os
from emscripten_helpers import parse_config, run_closure_compiler, create_engine_file
+
def is_active():
return True
def get_name():
- return 'JavaScript'
+ return "JavaScript"
def can_build():
- return 'EM_CONFIG' in os.environ or os.path.exists(os.path.expanduser('~/.emscripten'))
+ 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),
- BoolVariable('threads_enabled', 'Enable WebAssembly Threads support (limited browser support)', False),
- BoolVariable('use_closure_compiler', 'Use closure compiler to minimize Javascript code', False),
+ BoolVariable("javascript_eval", "Enable JavaScript eval interface", True),
+ BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", False),
+ BoolVariable("use_closure_compiler", "Use closure compiler to minimize Javascript code", False),
]
def get_flags():
return [
- ('tools', False),
- ('builtin_pcre2_with_jit', False),
+ ("tools", False),
+ ("builtin_pcre2_with_jit", False),
# Disabling the mbedtls module reduces file size.
# The module has little use due to the limited networking functionality
# in this platform. For the available networking methods, the browser
# manages TLS.
- ('module_mbedtls_enabled', False),
+ ("module_mbedtls_enabled", False),
]
@@ -40,125 +42,125 @@ def configure(env):
## Build type
- if env['target'] == 'release':
+ if env["target"] == "release":
# Use -Os to prioritize optimizing for reduced file size. This is
# particularly valuable for the web platform because it directly
# decreases download time.
# -Os reduces file size by around 5 MiB over -O3. -Oz only saves about
# 100 KiB over -Os, which does not justify the negative impact on
# run-time performance.
- env.Append(CCFLAGS=['-Os'])
- env.Append(LINKFLAGS=['-Os'])
- elif env['target'] == 'release_debug':
- env.Append(CCFLAGS=['-Os'])
- env.Append(LINKFLAGS=['-Os'])
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
+ env.Append(CCFLAGS=["-Os"])
+ env.Append(LINKFLAGS=["-Os"])
+ elif env["target"] == "release_debug":
+ env.Append(CCFLAGS=["-Os"])
+ env.Append(LINKFLAGS=["-Os"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
# Retain function names for backtraces at the cost of file size.
- env.Append(LINKFLAGS=['--profiling-funcs'])
- else: # 'debug'
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
- env.Append(CCFLAGS=['-O1', '-g'])
- env.Append(LINKFLAGS=['-O1', '-g'])
- env.Append(LINKFLAGS=['-s', 'ASSERTIONS=1'])
-
- if env['tools']:
- if not env['threads_enabled']:
- raise RuntimeError("Threads must be enabled to build the editor. Please add the 'threads_enabled=yes' option")
+ env.Append(LINKFLAGS=["--profiling-funcs"])
+ else: # 'debug'
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
+ env.Append(CCFLAGS=["-O1", "-g"])
+ env.Append(LINKFLAGS=["-O1", "-g"])
+ env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
+
+ if env["tools"]:
+ if not env["threads_enabled"]:
+ raise RuntimeError(
+ "Threads must be enabled to build the editor. Please add the 'threads_enabled=yes' option"
+ )
# Tools need more memory. Initial stack memory in bytes. See `src/settings.js` in emscripten repository (will be renamed to INITIAL_MEMORY).
- env.Append(LINKFLAGS=['-s', 'TOTAL_MEMORY=33554432'])
+ env.Append(LINKFLAGS=["-s", "TOTAL_MEMORY=33554432"])
else:
# Disable exceptions and rtti on non-tools (template) builds
# These flags help keep the file size down.
- env.Append(CCFLAGS=['-fno-exceptions', '-fno-rtti'])
+ env.Append(CCFLAGS=["-fno-exceptions", "-fno-rtti"])
# Don't use dynamic_cast, necessary with no-rtti.
- env.Append(CPPDEFINES=['NO_SAFE_CAST'])
+ env.Append(CPPDEFINES=["NO_SAFE_CAST"])
## Copy env variables.
- env['ENV'] = os.environ
+ env["ENV"] = os.environ
# LTO
- if env['use_lto']:
- env.Append(CCFLAGS=['-s', 'WASM_OBJECT_FILES=0'])
- env.Append(LINKFLAGS=['-s', 'WASM_OBJECT_FILES=0'])
- env.Append(LINKFLAGS=['--llvm-lto', '1'])
+ if env["use_lto"]:
+ env.Append(CCFLAGS=["-s", "WASM_OBJECT_FILES=0"])
+ env.Append(LINKFLAGS=["-s", "WASM_OBJECT_FILES=0"])
+ env.Append(LINKFLAGS=["--llvm-lto", "1"])
# Closure compiler
- if env['use_closure_compiler']:
+ if env["use_closure_compiler"]:
# For emscripten support code.
- env.Append(LINKFLAGS=['--closure', '1'])
+ env.Append(LINKFLAGS=["--closure", "1"])
# Register builder for our Engine files
- jscc = env.Builder(generator=run_closure_compiler, suffix='.cc.js', src_suffix='.js')
- env.Append(BUILDERS = {'BuildJS' : jscc})
+ jscc = env.Builder(generator=run_closure_compiler, suffix=".cc.js", src_suffix=".js")
+ env.Append(BUILDERS={"BuildJS": jscc})
# Add method that joins/compiles our Engine files.
env.AddMethod(create_engine_file, "CreateEngineFile")
# Closure compiler extern and support for ecmascript specs (const, let, etc).
- env['ENV']['EMCC_CLOSURE_ARGS'] = '--language_in ECMASCRIPT6'
+ env["ENV"]["EMCC_CLOSURE_ARGS"] = "--language_in ECMASCRIPT6"
em_config = parse_config()
- env.PrependENVPath('PATH', em_config['EMCC_ROOT'])
+ env.PrependENVPath("PATH", em_config["EMCC_ROOT"])
- env['CC'] = 'emcc'
- env['CXX'] = 'em++'
- env['LINK'] = 'emcc'
+ env["CC"] = "emcc"
+ env["CXX"] = "em++"
+ env["LINK"] = "emcc"
- env['AR'] = 'emar'
- env['RANLIB'] = 'emranlib'
+ env["AR"] = "emar"
+ 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)}'
+ 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'] = ''
+ 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']
+ env["PROGSUFFIX"] = ""
+ env["LIBPREFIX"] = "lib"
+ env["LIBSUFFIX"] = ".bc"
+ env["LIBPREFIXES"] = ["$LIBPREFIX"]
+ env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
- env.Prepend(CPPPATH=['#platform/javascript'])
- env.Append(CPPDEFINES=['JAVASCRIPT_ENABLED', 'UNIX_ENABLED'])
+ env.Prepend(CPPPATH=["#platform/javascript"])
+ env.Append(CPPDEFINES=["JAVASCRIPT_ENABLED", "UNIX_ENABLED"])
- if env['javascript_eval']:
- env.Append(CPPDEFINES=['JAVASCRIPT_EVAL_ENABLED'])
+ if env["javascript_eval"]:
+ env.Append(CPPDEFINES=["JAVASCRIPT_EVAL_ENABLED"])
# Thread support (via SharedArrayBuffer).
- if env['threads_enabled']:
- env.Append(CPPDEFINES=['PTHREAD_NO_RENAME'])
- env.Append(CCFLAGS=['-s', 'USE_PTHREADS=1'])
- env.Append(LINKFLAGS=['-s', 'USE_PTHREADS=1'])
- env.Append(LINKFLAGS=['-s', 'PTHREAD_POOL_SIZE=4'])
- env.Append(LINKFLAGS=['-s', 'WASM_MEM_MAX=2048MB'])
+ if env["threads_enabled"]:
+ env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"])
+ env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
+ env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
+ env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=4"])
+ env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])
else:
- env.Append(CPPDEFINES=['NO_THREADS'])
+ env.Append(CPPDEFINES=["NO_THREADS"])
# Reduce code size by generating less support code (e.g. skip NodeJS support).
- env.Append(LINKFLAGS=['-s', 'ENVIRONMENT=web,worker'])
+ env.Append(LINKFLAGS=["-s", "ENVIRONMENT=web,worker"])
# We use IDBFS in javascript_main.cpp. Since Emscripten 1.39.1 it needs to
# be linked explicitly.
- env.Append(LIBS=['idbfs.js'])
+ env.Append(LIBS=["idbfs.js"])
- env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
- env.Append(LINKFLAGS=['-s', 'MODULARIZE=1', '-s', 'EXPORT_NAME="Godot"'])
+ env.Append(LINKFLAGS=["-s", "BINARYEN=1"])
+ env.Append(LINKFLAGS=["-s", "MODULARIZE=1", "-s", 'EXPORT_NAME="Godot"'])
# 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'])
+ 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", "USE_WEBGL2=1"])
- env.Append(LINKFLAGS=['-s', 'INVOKE_RUN=0'])
+ env.Append(LINKFLAGS=["-s", "INVOKE_RUN=0"])
# callMain for manual start, FS for preloading.
- env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS=["callMain", "FS"]'])
+ env.Append(LINKFLAGS=["-s", 'EXTRA_EXPORTED_RUNTIME_METHODS=["callMain", "FS"]'])
diff --git a/platform/javascript/emscripten_helpers.py b/platform/javascript/emscripten_helpers.py
index bda5b40a74..a55c9d3f48 100644
--- a/platform/javascript/emscripten_helpers.py
+++ b/platform/javascript/emscripten_helpers.py
@@ -1,7 +1,8 @@
import os
+
def parse_config():
- em_config_file = os.getenv('EM_CONFIG') or os.path.expanduser('~/.emscripten')
+ 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)
@@ -13,25 +14,25 @@ def parse_config():
exec(f.read(), em_config)
except StandardError as e:
raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e))
- normalized['EMCC_ROOT'] = em_config.get('EMSCRIPTEN_ROOT')
- normalized['NODE_JS'] = em_config.get('NODE_JS')
- normalized['CLOSURE_BIN'] = os.path.join(normalized['EMCC_ROOT'], 'node_modules', '.bin', 'google-closure-compiler')
+ normalized["EMCC_ROOT"] = em_config.get("EMSCRIPTEN_ROOT")
+ normalized["NODE_JS"] = em_config.get("NODE_JS")
+ normalized["CLOSURE_BIN"] = os.path.join(normalized["EMCC_ROOT"], "node_modules", ".bin", "google-closure-compiler")
return normalized
def run_closure_compiler(target, source, env, for_signature):
cfg = parse_config()
- cmd = [cfg['NODE_JS'], cfg['CLOSURE_BIN']]
- cmd.extend(['--compilation_level', 'ADVANCED_OPTIMIZATIONS'])
- for f in env['JSEXTERNS']:
- cmd.extend(['--externs', f.get_abspath()])
+ cmd = [cfg["NODE_JS"], cfg["CLOSURE_BIN"]]
+ cmd.extend(["--compilation_level", "ADVANCED_OPTIMIZATIONS"])
+ for f in env["JSEXTERNS"]:
+ cmd.extend(["--externs", f.get_abspath()])
for f in source:
- cmd.extend(['--js', f.get_abspath()])
- cmd.extend(['--js_output_file', target[0].get_abspath()])
- return ' '.join(cmd)
+ cmd.extend(["--js", f.get_abspath()])
+ cmd.extend(["--js_output_file", target[0].get_abspath()])
+ return " ".join(cmd)
def create_engine_file(env, target, source, externs):
- if env['use_closure_compiler']:
+ if env["use_closure_compiler"]:
return env.BuildJS(target, source, JSEXTERNS=externs)
return env.Textfile(target, [env.File(s) for s in source])
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index da61425747..39faae2d17 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -390,7 +390,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
return error;
}
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
unzFile pkg = unzOpen2(template_path.utf8().get_data(), &io);
@@ -410,7 +410,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
//get filename
unz_file_info info;
char fname[16384];
- unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
+ unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file = fname;
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 472384cf30..863c207896 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -88,8 +88,8 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve
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(),
- password.empty() ? NULL : password.utf8().get_data());
+ username.empty() ? nullptr : username.utf8().get_data(),
+ password.empty() ? nullptr : password.utf8().get_data());
for (int i = 0; i < p_headers.size(); i++) {
int header_separator = p_headers[i].find(": ");
diff --git a/platform/javascript/http_request.h b/platform/javascript/http_request.h
index 57dc4f0d9f..54e98c1927 100644
--- a/platform/javascript/http_request.h
+++ b/platform/javascript/http_request.h
@@ -49,7 +49,7 @@ extern int godot_xhr_new();
extern void godot_xhr_reset(int p_xhr_id);
extern bool godot_xhr_free(int p_xhr_id);
-extern int godot_xhr_open(int p_xhr_id, const char *p_method, const char *p_url, const char *p_user = NULL, const char *p_password = NULL);
+extern int godot_xhr_open(int p_xhr_id, const char *p_method, const char *p_url, const char *p_user = nullptr, const char *p_password = nullptr);
extern void godot_xhr_set_request_header(int p_xhr_id, const char *p_header, const char *p_value);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 40c42a5c03..ad06aef86e 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -167,7 +167,7 @@ void OS_JavaScript::set_window_maximized(bool p_enabled) {
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
- strategy.canvasResizedCallback = NULL;
+ strategy.canvasResizedCallback = nullptr;
emscripten_enter_soft_fullscreen(GODOT_CANVAS_SELECTOR, &strategy);
window_maximized = p_enabled;
}
@@ -196,7 +196,7 @@ void OS_JavaScript::set_window_fullscreen(bool p_enabled) {
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
- strategy.canvasResizedCallback = NULL;
+ strategy.canvasResizedCallback = nullptr;
EMSCRIPTEN_RESULT result = emscripten_request_fullscreen_strategy(GODOT_CANVAS_SELECTOR, false, &strategy);
ERR_FAIL_COND_MSG(result == EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED, "Enabling fullscreen is only possible from an input callback for the HTML5 platform.");
ERR_FAIL_COND_MSG(result != EMSCRIPTEN_RESULT_SUCCESS, "Enabling fullscreen is only possible from an input callback for the HTML5 platform.");
@@ -541,10 +541,10 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
PackedByteArray png;
size_t len;
PackedByteArray data = image->get_data();
- ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL));
+ ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, nullptr));
png.resize(len);
- ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL));
+ ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, nullptr));
char *object_url;
/* clang-format off */
@@ -824,7 +824,7 @@ const char *OS_JavaScript::get_video_driver_name(int p_driver) const {
case VIDEO_DRIVER_GLES2:
return "GLES2";
}
- ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
+ ERR_FAIL_V_MSG(nullptr, "Invalid video driver index: " + itos(p_driver) + ".");
}
// Audio
@@ -969,11 +969,11 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
#define EM_CHECK(ev) \
if (result != EMSCRIPTEN_RESULT_SUCCESS) \
ERR_PRINT("Error while setting " #ev " callback: Code " + itos(result));
-#define SET_EM_CALLBACK(target, ev, cb) \
- result = emscripten_set_##ev##_callback(target, NULL, true, &cb); \
+#define SET_EM_CALLBACK(target, ev, cb) \
+ result = emscripten_set_##ev##_callback(target, nullptr, true, &cb); \
EM_CHECK(ev)
-#define SET_EM_CALLBACK_NOTARGET(ev, cb) \
- result = emscripten_set_##ev##_callback(NULL, true, &cb); \
+#define SET_EM_CALLBACK_NOTARGET(ev, cb) \
+ result = emscripten_set_##ev##_callback(nullptr, true, &cb); \
EM_CHECK(ev)
// These callbacks from Emscripten's html5.h suffice to access most
// JavaScript APIs. For APIs that are not (sufficiently) exposed, EM_ASM
@@ -1072,7 +1072,7 @@ bool OS_JavaScript::main_loop_iterate() {
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
- strategy.canvasResizedCallback = NULL;
+ strategy.canvasResizedCallback = nullptr;
emscripten_enter_soft_fullscreen(GODOT_CANVAS_SELECTOR, &strategy);
} else {
emscripten_set_canvas_element_size(GODOT_CANVAS_SELECTOR, windowed_size.width, windowed_size.height);
@@ -1182,10 +1182,10 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) {
PackedByteArray png;
size_t len;
PackedByteArray data = icon->get_data();
- ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL));
+ ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, nullptr));
png.resize(len);
- ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL));
+ ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, nullptr));
/* clang-format off */
EM_ASM_ARGS({
@@ -1284,7 +1284,7 @@ OS_JavaScript::OS_JavaScript(int p_argc, char *p_argv[]) {
just_exited_fullscreen = false;
transparency_enabled = false;
- main_loop = NULL;
+ main_loop = nullptr;
idb_available = false;
sync_wait_time = -1;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 368e9a2155..81fe4cf0cc 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -145,7 +145,7 @@ public:
void run_async();
bool main_loop_iterate();
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub
index f3f65e216e..ae75a75830 100644
--- a/platform/linuxbsd/SCsub
+++ b/platform/linuxbsd/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
from platform_methods import run_in_subprocess
import platform_linuxbsd_builders
@@ -14,10 +14,9 @@ common_x11 = [
"display_server_x11.cpp",
"vulkan_context_x11.cpp",
"key_mapping_x11.cpp",
-
]
-prog = env.add_program('#bin/godot', ['godot_linuxbsd.cpp'] + common_x11)
+prog = env.add_program("#bin/godot", ["godot_linuxbsd.cpp"] + common_x11)
if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_linuxbsd_builders.make_debug_linuxbsd))
diff --git a/platform/linuxbsd/context_gl_x11.cpp b/platform/linuxbsd/context_gl_x11.cpp
index 5442af3bef..308d68521a 100644
--- a/platform/linuxbsd/context_gl_x11.cpp
+++ b/platform/linuxbsd/context_gl_x11.cpp
@@ -52,7 +52,7 @@ struct ContextGL_X11_Private {
void ContextGL_X11::release_current() {
- glXMakeCurrent(x11_display, None, NULL);
+ glXMakeCurrent(x11_display, None, nullptr);
}
void ContextGL_X11::make_current() {
@@ -117,7 +117,7 @@ Error ContextGL_X11::initialize() {
int fbcount;
GLXFBConfig fbconfig = 0;
- XVisualInfo *vi = NULL;
+ XVisualInfo *vi = nullptr;
XSetWindowAttributes swa;
swa.event_mask = StructureNotifyMask;
@@ -136,7 +136,7 @@ Error ContextGL_X11::initialize() {
XRenderPictFormat *pict_format = XRenderFindVisualFormat(x11_display, vi->visual);
if (!pict_format) {
XFree(vi);
- vi = NULL;
+ vi = nullptr;
continue;
}
@@ -208,9 +208,9 @@ int ContextGL_X11::get_window_height() {
void ContextGL_X11::set_use_vsync(bool p_use) {
static bool setup = false;
- static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
- static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL;
- static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
+ static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = nullptr;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = nullptr;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr;
if (!setup) {
setup = true;
diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp
index 1b3804e3ed..dbdb15918e 100644
--- a/platform/linuxbsd/crash_handler_linuxbsd.cpp
+++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp
@@ -46,7 +46,7 @@
#include <stdlib.h>
static void handle_crash(int sig) {
- if (OS::get_singleton() == NULL) {
+ if (OS::get_singleton() == nullptr) {
abort();
}
@@ -79,7 +79,7 @@ static void handle_crash(int sig) {
if (dladdr(bt_buffer[i], &info) && info.dli_sname) {
if (info.dli_sname[0] == '_') {
int status;
- char *demangled = abi::__cxa_demangle(info.dli_sname, NULL, 0, &status);
+ char *demangled = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, &status);
if (status == 0 && demangled) {
snprintf(fname, 1024, "%s", demangled);
@@ -102,7 +102,7 @@ static void handle_crash(int sig) {
// Try to get the file/line number using addr2line
int ret;
- Error err = OS::get_singleton()->execute(String("addr2line"), args, true, NULL, &output, &ret);
+ Error err = OS::get_singleton()->execute(String("addr2line"), args, true, nullptr, &output, &ret);
if (err == OK) {
output.erase(output.length() - 1, 1);
}
@@ -132,9 +132,9 @@ void CrashHandler::disable() {
return;
#ifdef CRASH_HANDLER_ENABLED
- signal(SIGSEGV, NULL);
- signal(SIGFPE, NULL);
- signal(SIGILL, NULL);
+ signal(SIGSEGV, nullptr);
+ signal(SIGFPE, nullptr);
+ signal(SIGILL, nullptr);
#endif
disabled = true;
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 1a395efffe..5d8b4fba48 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -13,64 +13,65 @@ def get_name():
def can_build():
- if (os.name != "posix" or sys.platform == "darwin"):
+ if os.name != "posix" or sys.platform == "darwin":
return False
# Check the minimal dependencies
x11_error = os.system("pkg-config --version > /dev/null")
- if (x11_error):
+ if x11_error:
return False
x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
return False
x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
print("xcursor not found.. x11 disabled.")
return False
x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
print("xinerama not found.. x11 disabled.")
return False
x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
print("xrandr not found.. x11 disabled.")
return False
x11_error = os.system("pkg-config xrender --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
print("xrender not found.. x11 disabled.")
return False
x11_error = os.system("pkg-config xi --modversion > /dev/null ")
- if (x11_error):
+ if x11_error:
print("xi not found.. Aborting.")
return False
return True
+
def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
return [
- BoolVariable('use_llvm', 'Use the LLVM compiler', False),
- BoolVariable('use_lld', 'Use the LLD linker', False),
- BoolVariable('use_thinlto', 'Use ThinLTO', False),
- BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
- BoolVariable('use_coverage', 'Test Godot coverage', False),
- BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
- BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
- BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
- BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
- BoolVariable('pulseaudio', 'Detect and use PulseAudio', True),
- BoolVariable('udev', 'Use udev for gamepad connection callbacks', 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),
- BoolVariable('execinfo', 'Use libexecinfo on systems where glibc is not available', False),
+ BoolVariable("use_llvm", "Use the LLVM compiler", False),
+ BoolVariable("use_lld", "Use the LLD linker", False),
+ BoolVariable("use_thinlto", "Use ThinLTO", False),
+ BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False),
+ BoolVariable("use_coverage", "Test Godot coverage", False),
+ BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
+ BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
+ BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False),
+ BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False),
+ BoolVariable("pulseaudio", "Detect and use PulseAudio", True),
+ BoolVariable("udev", "Use udev for gamepad connection callbacks", 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),
+ BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
]
@@ -83,286 +84,294 @@ def configure(env):
## Build type
- if (env["target"] == "release"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O3'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "release_debug"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g3'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
- env.Append(LINKFLAGS=['-rdynamic'])
+ if env["target"] == "release":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O3"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "release_debug":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "debug":
+ env.Prepend(CCFLAGS=["-g3"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
+ env.Append(LINKFLAGS=["-rdynamic"])
## Architecture
- is64 = sys.maxsize > 2**32
- if (env["bits"] == "default"):
+ is64 = sys.maxsize > 2 ** 32
+ if env["bits"] == "default":
env["bits"] = "64" if is64 else "32"
## Compiler configuration
- if 'CXX' in env and 'clang' in os.path.basename(env['CXX']):
+ if "CXX" in env and "clang" in os.path.basename(env["CXX"]):
# Convenience check to enforce the use_llvm overrides when CXX is clang(++)
- env['use_llvm'] = True
+ env["use_llvm"] = True
- if env['use_llvm']:
- if ('clang++' not in os.path.basename(env['CXX'])):
+ if env["use_llvm"]:
+ if "clang++" not in os.path.basename(env["CXX"]):
env["CC"] = "clang"
env["CXX"] = "clang++"
env["LINK"] = "clang++"
- env.Append(CPPDEFINES=['TYPED_METHOD_BIND'])
+ env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
env.extra_suffix = ".llvm" + env.extra_suffix
- if env['use_lld']:
- if env['use_llvm']:
- env.Append(LINKFLAGS=['-fuse-ld=lld'])
- if env['use_thinlto']:
+ if env["use_lld"]:
+ if env["use_llvm"]:
+ env.Append(LINKFLAGS=["-fuse-ld=lld"])
+ if env["use_thinlto"]:
# A convenience so you don't need to write use_lto too when using SCons
- env['use_lto'] = True
+ env["use_lto"] = True
else:
print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
sys.exit(255)
- if env['use_coverage']:
- env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
- env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ if env["use_coverage"]:
+ env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"])
+ env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"])
- if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
+ if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"]:
env.extra_suffix += "s"
- if env['use_ubsan']:
- env.Append(CCFLAGS=['-fsanitize=undefined'])
- env.Append(LINKFLAGS=['-fsanitize=undefined'])
+ if env["use_ubsan"]:
+ env.Append(CCFLAGS=["-fsanitize=undefined"])
+ env.Append(LINKFLAGS=["-fsanitize=undefined"])
- if env['use_asan']:
- env.Append(CCFLAGS=['-fsanitize=address'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
+ if env["use_asan"]:
+ env.Append(CCFLAGS=["-fsanitize=address"])
+ env.Append(LINKFLAGS=["-fsanitize=address"])
- if env['use_lsan']:
- env.Append(CCFLAGS=['-fsanitize=leak'])
- env.Append(LINKFLAGS=['-fsanitize=leak'])
+ if env["use_lsan"]:
+ env.Append(CCFLAGS=["-fsanitize=leak"])
+ env.Append(LINKFLAGS=["-fsanitize=leak"])
- if env['use_tsan']:
- env.Append(CCFLAGS=['-fsanitize=thread'])
- env.Append(LINKFLAGS=['-fsanitize=thread'])
+ if env["use_tsan"]:
+ env.Append(CCFLAGS=["-fsanitize=thread"])
+ env.Append(LINKFLAGS=["-fsanitize=thread"])
- if env['use_lto']:
- if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ if env["use_lto"]:
+ if not env["use_llvm"] and env.GetOption("num_jobs") > 1:
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))])
else:
- if env['use_lld'] and env['use_thinlto']:
- env.Append(CCFLAGS=['-flto=thin'])
- env.Append(LINKFLAGS=['-flto=thin'])
+ if env["use_lld"] and env["use_thinlto"]:
+ env.Append(CCFLAGS=["-flto=thin"])
+ env.Append(LINKFLAGS=["-flto=thin"])
else:
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto'])
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto"])
- if not env['use_llvm']:
- env['RANLIB'] = 'gcc-ranlib'
- env['AR'] = 'gcc-ar'
+ if not env["use_llvm"]:
+ env["RANLIB"] = "gcc-ranlib"
+ env["AR"] = "gcc-ar"
- env.Append(CCFLAGS=['-pipe'])
- env.Append(LINKFLAGS=['-pipe'])
+ env.Append(CCFLAGS=["-pipe"])
+ env.Append(LINKFLAGS=["-pipe"])
# -fpie and -no-pie is supported on GCC 6+ and Clang 4+, both below our
# minimal requirements.
- env.Append(CCFLAGS=['-fpie'])
- env.Append(LINKFLAGS=['-no-pie'])
+ env.Append(CCFLAGS=["-fpie"])
+ env.Append(LINKFLAGS=["-no-pie"])
## Dependencies
- env.ParseConfig('pkg-config x11 --cflags --libs')
- 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')
- env.ParseConfig('pkg-config xi --cflags --libs')
+ env.ParseConfig("pkg-config x11 --cflags --libs")
+ 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")
+ env.ParseConfig("pkg-config xi --cflags --libs")
- if (env['touch']):
- env.Append(CPPDEFINES=['TOUCH_ENABLED'])
+ if env["touch"]:
+ env.Append(CPPDEFINES=["TOUCH_ENABLED"])
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
# 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']:
- env['builtin_freetype'] = True
- env['builtin_libpng'] = True
- env['builtin_zlib'] = True
+ if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]:
+ env["builtin_freetype"] = True
+ env["builtin_libpng"] = True
+ env["builtin_zlib"] = True
- if not env['builtin_freetype']:
- env.ParseConfig('pkg-config freetype2 --cflags --libs')
+ if not env["builtin_freetype"]:
+ env.ParseConfig("pkg-config freetype2 --cflags --libs")
- if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng16 --cflags --libs')
+ if not env["builtin_libpng"]:
+ env.ParseConfig("pkg-config libpng16 --cflags --libs")
- if not env['builtin_bullet']:
+ if not env["builtin_bullet"]:
# We need at least version 2.89
import subprocess
- bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip()
+
+ bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip()
if str(bullet_version) < "2.89":
# Abort as system bullet was requested but too old
- print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.89"))
+ print(
+ "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(
+ bullet_version, "2.89"
+ )
+ )
sys.exit(255)
- env.ParseConfig('pkg-config bullet --cflags --libs')
+ env.ParseConfig("pkg-config bullet --cflags --libs")
if False: # not env['builtin_assimp']:
# FIXME: Add min version check
- env.ParseConfig('pkg-config assimp --cflags --libs')
+ env.ParseConfig("pkg-config assimp --cflags --libs")
- if not env['builtin_enet']:
- env.ParseConfig('pkg-config libenet --cflags --libs')
+ if not env["builtin_enet"]:
+ env.ParseConfig("pkg-config libenet --cflags --libs")
- if not env['builtin_squish']:
- env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if not env["builtin_squish"]:
+ env.ParseConfig("pkg-config libsquish --cflags --libs")
- if not env['builtin_zstd']:
- env.ParseConfig('pkg-config libzstd --cflags --libs')
+ if not env["builtin_zstd"]:
+ env.ParseConfig("pkg-config libzstd --cflags --libs")
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- if not env['builtin_libtheora']:
- 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')
+ if not env["builtin_libtheora"]:
+ 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']
+ 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')
+ if not env["builtin_libvpx"]:
+ env.ParseConfig("pkg-config vpx --cflags --libs")
- if not env['builtin_libvorbis']:
- env['builtin_libogg'] = False # Needed to link against system libvorbis
- env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+ if not env["builtin_libvorbis"]:
+ env["builtin_libogg"] = False # Needed to link against system libvorbis
+ env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs")
- if not env['builtin_opus']:
- env['builtin_libogg'] = False # Needed to link against system opus
- env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+ if not env["builtin_opus"]:
+ env["builtin_libogg"] = False # Needed to link against system opus
+ env.ParseConfig("pkg-config opus opusfile --cflags --libs")
- if not env['builtin_libogg']:
- env.ParseConfig('pkg-config ogg --cflags --libs')
+ 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_libwebp"]:
+ env.ParseConfig("pkg-config libwebp --cflags --libs")
- if not env['builtin_mbedtls']:
+ 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'])
+ env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
- if not env['builtin_wslay']:
- env.ParseConfig('pkg-config libwslay --cflags --libs')
+ if not env["builtin_wslay"]:
+ env.ParseConfig("pkg-config libwslay --cflags --libs")
- if not env['builtin_miniupnpc']:
+ if not env["builtin_miniupnpc"]:
# No pkgconfig file so far, hardcode default paths.
env.Prepend(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')
+ if not env["builtin_pcre2"]:
+ env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
## Flags
- if (os.system("pkg-config --exists alsa") == 0): # 0 means found
+ if os.system("pkg-config --exists alsa") == 0: # 0 means found
print("Enabling ALSA")
env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
- # Don't parse --cflags, we don't need to add /usr/include/alsa to include path
- env.ParseConfig('pkg-config alsa --libs')
+ # Don't parse --cflags, we don't need to add /usr/include/alsa to include path
+ env.ParseConfig("pkg-config alsa --libs")
else:
print("ALSA libraries not found, disabling driver")
- if env['pulseaudio']:
- if (os.system("pkg-config --exists libpulse") == 0): # 0 means found
+ if env["pulseaudio"]:
+ if os.system("pkg-config --exists libpulse") == 0: # 0 means found
print("Enabling PulseAudio")
env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
- env.ParseConfig('pkg-config --cflags --libs libpulse')
+ env.ParseConfig("pkg-config --cflags --libs libpulse")
else:
print("PulseAudio development libraries not found, disabling driver")
- if (platform.system() == "Linux"):
+ if platform.system() == "Linux":
env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
- if env['udev']:
- if (os.system("pkg-config --exists libudev") == 0): # 0 means found
+ if env["udev"]:
+ if os.system("pkg-config --exists libudev") == 0: # 0 means found
print("Enabling udev support")
env.Append(CPPDEFINES=["UDEV_ENABLED"])
- env.ParseConfig('pkg-config libudev --cflags --libs')
+ env.ParseConfig("pkg-config libudev --cflags --libs")
else:
print("libudev development libraries not found, disabling udev support")
# Linkflags below this line should typically stay the last ones
- if not env['builtin_zlib']:
- env.ParseConfig('pkg-config zlib --cflags --libs')
+ if not env["builtin_zlib"]:
+ env.ParseConfig("pkg-config zlib --cflags --libs")
- env.Prepend(CPPPATH=['#platform/linuxbsd'])
- env.Append(CPPDEFINES=['X11_ENABLED', 'UNIX_ENABLED'])
+ env.Prepend(CPPPATH=["#platform/linuxbsd"])
+ env.Append(CPPDEFINES=["X11_ENABLED", "UNIX_ENABLED"])
- env.Append(CPPDEFINES=['VULKAN_ENABLED'])
- if not env['builtin_vulkan']:
- env.ParseConfig('pkg-config vulkan --cflags --libs')
- if not env['builtin_glslang']:
+ env.Append(CPPDEFINES=["VULKAN_ENABLED"])
+ if not env["builtin_vulkan"]:
+ env.ParseConfig("pkg-config vulkan --cflags --libs")
+ if not env["builtin_glslang"]:
# No pkgconfig file for glslang so far
- env.Append(LIBS=['glslang', 'SPIRV'])
+ env.Append(LIBS=["glslang", "SPIRV"])
- #env.Append(CPPDEFINES=['OPENGL_ENABLED'])
- env.Append(LIBS=['GL'])
+ # env.Append(CPPDEFINES=['OPENGL_ENABLED'])
+ env.Append(LIBS=["GL"])
- env.Append(LIBS=['pthread'])
+ env.Append(LIBS=["pthread"])
- if (platform.system() == "Linux"):
- env.Append(LIBS=['dl'])
+ if platform.system() == "Linux":
+ env.Append(LIBS=["dl"])
- if (platform.system().find("BSD") >= 0):
+ if platform.system().find("BSD") >= 0:
env["execinfo"] = True
if env["execinfo"]:
- env.Append(LIBS=['execinfo'])
+ env.Append(LIBS=["execinfo"])
- if not env['tools']:
+ if not env["tools"]:
import subprocess
import re
- linker_version_str = subprocess.check_output([env.subst(env["LINK"]), '-Wl,--version']).decode("utf-8")
- gnu_ld_version = re.search('^GNU ld [^$]*(\d+\.\d+)$', linker_version_str, re.MULTILINE)
+
+ linker_version_str = subprocess.check_output([env.subst(env["LINK"]), "-Wl,--version"]).decode("utf-8")
+ gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE)
if not gnu_ld_version:
- print("Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld")
+ print(
+ "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld"
+ )
else:
if float(gnu_ld_version.group(1)) >= 2.30:
- env.Append(LINKFLAGS=['-T', 'platform/linuxbsd/pck_embed.ld'])
+ env.Append(LINKFLAGS=["-T", "platform/linuxbsd/pck_embed.ld"])
else:
- env.Append(LINKFLAGS=['-T', 'platform/linuxbsd/pck_embed.legacy.ld'])
+ env.Append(LINKFLAGS=["-T", "platform/linuxbsd/pck_embed.legacy.ld"])
## Cross-compilation
- if (is64 and env["bits"] == "32"):
- env.Append(CCFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu'])
- elif (not is64 and env["bits"] == "64"):
- env.Append(CCFLAGS=['-m64'])
- env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
+ if is64 and env["bits"] == "32":
+ env.Append(CCFLAGS=["-m32"])
+ env.Append(LINKFLAGS=["-m32", "-L/usr/lib/i386-linux-gnu"])
+ elif not is64 and env["bits"] == "64":
+ env.Append(CCFLAGS=["-m64"])
+ env.Append(LINKFLAGS=["-m64", "-L/usr/lib/i686-linux-gnu"])
# Link those statically for portability
- if env['use_static_cpp']:
- env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
+ if env["use_static_cpp"]:
+ env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp
index 69b0837e6c..1bec65ff04 100644
--- a/platform/linuxbsd/detect_prime_x11.cpp
+++ b/platform/linuxbsd/detect_prime_x11.cpp
@@ -67,12 +67,12 @@ vendor vendormap[] = {
{ "Intel", 20 },
{ "nouveau", 10 },
{ "Mesa Project", 0 },
- { NULL, 0 }
+ { nullptr, 0 }
};
// Runs inside a child. Exiting will not quit the engine.
void create_context() {
- Display *x11_display = XOpenDisplay(NULL);
+ Display *x11_display = XOpenDisplay(nullptr);
Window x11_window;
GLXContext glx_context;
@@ -91,7 +91,7 @@ void create_context() {
int fbcount;
GLXFBConfig fbconfig = 0;
- XVisualInfo *vi = NULL;
+ XVisualInfo *vi = nullptr;
XSetWindowAttributes swa;
swa.event_mask = StructureNotifyMask;
@@ -114,7 +114,7 @@ void create_context() {
None
};
- glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, NULL, true, context_attribs);
+ glx_context = glXCreateContextAttribsARB(x11_display, fbconfig, nullptr, true, context_attribs);
swa.colormap = XCreateColormap(x11_display, RootWindow(x11_display, vi->screen), vi->visual, AllocNone);
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, 10, 10, 0, vi->depth, InputOutput, vi->visual, valuemask, &swa);
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index c2b5657081..47497eb95f 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -902,7 +902,7 @@ void DisplayServerX11::window_set_position(const Point2i &p_position, WindowID p
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
if (format == 32 && len == 4 && data) {
long *extents = (long *)data;
@@ -1091,7 +1091,7 @@ Size2i DisplayServerX11::window_get_real_size(WindowID p_window) const {
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, 4, False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
if (format == 32 && len == 4 && data) {
long *extents = (long *)data;
@@ -1116,7 +1116,7 @@ bool DisplayServerX11::window_is_maximize_allowed(WindowID p_window) const {
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
int result = XGetWindowProperty(
x11_display,
@@ -1402,7 +1402,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
bool retval = false;
int result = XGetWindowProperty(
@@ -1453,7 +1453,7 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
int result = XGetWindowProperty(
x11_display,
@@ -1592,7 +1592,7 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
int format;
unsigned long len;
unsigned long remaining;
- unsigned char *data = NULL;
+ unsigned char *data = nullptr;
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, sizeof(Hints), False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
if (data && (format == 32) && (len >= 5)) {
borderless = !((Hints *)data)->decorations;
@@ -1719,8 +1719,8 @@ void DisplayServerX11::window_set_ime_position(const Point2i &p_pos, WindowID p_
::XPoint spot;
spot.x = short(p_pos.x);
spot.y = short(p_pos.y);
- XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
- XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, NULL);
+ XVaNestedList preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, nullptr);
+ XSetICValues(wd.xic, XNPreeditAttributes, preedit_attr, nullptr);
XFree(preedit_attr);
}
@@ -1827,7 +1827,7 @@ void DisplayServerX11::cursor_set_custom_image(const RES &p_cursor, CursorShape
*(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32();
}
- ERR_FAIL_COND(cursor_image->pixels == NULL);
+ ERR_FAIL_COND(cursor_image->pixels == nullptr);
// Save it for a further usage
cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image);
@@ -1900,14 +1900,14 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display,
int actual_format;
unsigned long nitems;
unsigned long bytes_after;
- unsigned char *ret = 0;
+ unsigned char *ret = nullptr;
int read_bytes = 1024;
//Keep trying to read the property until there are no
//bytes unread.
do {
- if (ret != 0)
+ if (ret != nullptr)
XFree(ret);
XGetWindowProperty(p_display, p_window, p_property, 0, read_bytes, False, AnyPropertyType,
@@ -2006,8 +2006,8 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
XKeyEvent xkeyevent_no_mod = *xkeyevent;
xkeyevent_no_mod.state &= ~ShiftMask;
xkeyevent_no_mod.state &= ~ControlMask;
- XLookupString(xkeyevent, str, 256, &keysym_unicode, NULL);
- XLookupString(&xkeyevent_no_mod, NULL, 0, &keysym_keycode, NULL);
+ XLookupString(xkeyevent, str, 256, &keysym_unicode, nullptr);
+ XLookupString(&xkeyevent_no_mod, nullptr, 0, &keysym_keycode, nullptr);
// Meanwhile, XLookupString returns keysyms useful for unicode.
@@ -2170,7 +2170,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
#undef ABSDIFF
if (peek_event.type == KeyPress && threshold < 5) {
KeySym rk;
- XLookupString((XKeyEvent *)&peek_event, str, 256, &rk, NULL);
+ XLookupString((XKeyEvent *)&peek_event, str, 256, &rk, nullptr);
if (rk == keysym_keycode) {
XEvent event;
XNextEvent(x11_display, &event); //erase next event
@@ -2232,10 +2232,10 @@ void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
WARN_PRINT("Input method stopped");
DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
- ds->xim = NULL;
+ ds->xim = nullptr;
for (Map<WindowID, WindowData>::Element *E = ds->windows.front(); E; E = E->next()) {
- E->get().xic = NULL;
+ E->get().xic = nullptr;
}
}
@@ -3222,11 +3222,11 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
if (xim && xim_style) {
- wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)NULL);
- if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, NULL) != NULL) {
+ wd.xic = XCreateIC(xim, XNInputStyle, xim_style, XNClientWindow, wd.x11_window, XNFocusWindow, wd.x11_window, (char *)nullptr);
+ if (XGetICValues(wd.xic, XNFilterEvents, &im_event_mask, nullptr) != nullptr) {
WARN_PRINT("XGetICValues couldn't obtain XNFilterEvents value");
XDestroyIC(wd.xic);
- wd.xic = NULL;
+ wd.xic = nullptr;
}
if (wd.xic) {
XUnsetICFocus(wd.xic);
@@ -3235,7 +3235,7 @@ DisplayServerX11::WindowID DisplayServerX11::_create_window(WindowMode p_mode, u
}
} else {
- wd.xic = NULL;
+ wd.xic = nullptr;
WARN_PRINT("XCreateIC couldn't create wd.xic");
}
@@ -3374,9 +3374,18 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK;
+ current_cursor = CURSOR_ARROW;
+ mouse_mode = MOUSE_MODE_VISIBLE;
+
+ for (int i = 0; i < CURSOR_MAX; i++) {
+
+ cursors[i] = None;
+ img[i] = nullptr;
+ }
+
last_button_state = 0;
- xmbstring = NULL;
+ xmbstring = nullptr;
last_click_ms = 0;
last_click_button_index = -1;
@@ -3389,7 +3398,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
XInitThreads(); //always use threads
/** XLIB INITIALIZATION **/
- x11_display = XOpenDisplay(NULL);
+ x11_display = XOpenDisplay(nullptr);
if (!x11_display) {
ERR_PRINT("X11 Display is not available");
@@ -3397,10 +3406,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
return;
}
- char *modifiers = NULL;
+ char *modifiers = nullptr;
Bool xkb_dar = False;
XAutoRepeatOn(x11_display);
- xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, NULL);
+ xkb_dar = XkbSetDetectableAutoRepeat(x11_display, True, nullptr);
// Try to support IME if detectable auto-repeat is supported
if (xkb_dar == True) {
@@ -3412,7 +3421,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
#endif
}
- if (modifiers == NULL) {
+ if (modifiers == nullptr) {
if (OS::get_singleton()->is_stdout_verbose()) {
WARN_PRINT("IME is disabled");
}
@@ -3421,8 +3430,8 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
const char *err;
- xrr_get_monitors = NULL;
- xrr_free_monitors = NULL;
+ xrr_get_monitors = nullptr;
+ xrr_free_monitors = nullptr;
int xrandr_major = 0;
int xrandr_minor = 0;
int event_base, error_base;
@@ -3443,7 +3452,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (!xrr_free_monitors) {
err = dlerror();
fprintf(stderr, "could not find XRRFreeMonitors\nError: %s\n", err);
- xrr_get_monitors = NULL;
+ xrr_get_monitors = nullptr;
}
}
}
@@ -3457,9 +3466,9 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
return;
}
- xim = XOpenIM(x11_display, NULL, NULL, NULL);
+ xim = XOpenIM(x11_display, nullptr, nullptr, nullptr);
- if (xim == NULL) {
+ if (xim == nullptr) {
WARN_PRINT("XOpenIM failed");
xim_style = 0L;
} else {
@@ -3467,14 +3476,14 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
im_destroy_callback.client_data = (::XPointer)(this);
im_destroy_callback.callback = (::XIMProc)(_xim_destroy_callback);
if (XSetIMValues(xim, XNDestroyCallback, &im_destroy_callback,
- NULL) != NULL) {
+ nullptr) != nullptr) {
WARN_PRINT("Error setting XIM destroy callback");
}
- ::XIMStyles *xim_styles = NULL;
+ ::XIMStyles *xim_styles = nullptr;
xim_style = 0L;
- char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
- if (imvalret != NULL || xim_styles == NULL) {
+ char *imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, nullptr);
+ if (imvalret != nullptr || xim_styles == nullptr) {
fprintf(stderr, "Input method doesn't support any styles\n");
}
@@ -3523,7 +3532,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
context_vulkan = memnew(VulkanContextX11);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
- context_vulkan = NULL;
+ context_vulkan = nullptr;
r_error = ERR_CANT_CREATE;
ERR_FAIL_MSG("Could not initialize Vulkan");
}
@@ -3532,7 +3541,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
// Init context and rendering device
#if defined(OPENGL_ENABLED)
if (rendering_driver == "opengl_es") {
- if (getenv("DRI_PRIME") == NULL) {
+ if (getenv("DRI_PRIME") == nullptr) {
int use_prime = -1;
if (getenv("PRIMUS_DISPLAY") ||
@@ -3578,7 +3587,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
if (context_gles2->initialize() != OK) {
memdelete(context_gles2);
- context_gles2 = NULL;
+ context_gles2 = nullptr;
ERR_FAIL_V(ERR_UNAVAILABLE);
}
@@ -3589,7 +3598,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
RasterizerGLES2::make_current();
} else {
memdelete(context_gles2);
- context_gles2 = NULL;
+ context_gles2 = nullptr;
ERR_FAIL_V(ERR_UNAVAILABLE);
}
}
@@ -3652,14 +3661,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
for (int i = 0; i < CURSOR_MAX; i++) {
- cursors[i] = None;
- img[i] = NULL;
- }
-
- current_cursor = CURSOR_ARROW;
-
- for (int i = 0; i < CURSOR_MAX; i++) {
-
static const char *cursor_file[] = {
"left_ptr",
"xterm",
@@ -3682,7 +3683,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
img[i] = XcursorLibraryLoadImage(cursor_file[i], cursor_theme, cursor_size);
if (!img[i]) {
- const char *fallback = NULL;
+ const char *fallback = nullptr;
switch (i) {
case CURSOR_POINTING_HAND:
@@ -3731,7 +3732,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
fallback = "help";
break;
}
- if (fallback != NULL) {
+ if (fallback != nullptr) {
img[i] = XcursorLibraryLoadImage(fallback, cursor_theme, cursor_size);
}
}
@@ -3831,7 +3832,7 @@ DisplayServerX11::~DisplayServerX11() {
for (int i = 0; i < CURSOR_MAX; i++) {
if (cursors[i] != None)
XFreeCursor(x11_display, cursors[i]);
- if (img[i] != NULL)
+ if (img[i] != nullptr)
XcursorImageDestroy(img[i]);
};
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index aa10be555c..113e504e9b 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -193,7 +193,6 @@ class DisplayServerX11 : public DisplayServer {
void _handle_key_event(WindowID p_window, XKeyEvent *p_event, bool p_echo = false);
- bool force_quit;
bool minimized;
bool window_has_focus;
bool do_mouse_warp;
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp
index c4c793093d..381eb909ba 100644
--- a/platform/linuxbsd/joypad_linux.cpp
+++ b/platform/linuxbsd/joypad_linux.cpp
@@ -54,7 +54,7 @@ JoypadLinux::Joypad::Joypad() {
dpad = 0;
devpath = "";
for (int i = 0; i < MAX_ABS; i++) {
- abs_info[i] = NULL;
+ abs_info[i] = nullptr;
}
}
@@ -146,9 +146,9 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) {
void JoypadLinux::monitor_joypads(udev *p_udev) {
- udev_device *dev = NULL;
+ udev_device *dev = nullptr;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
- udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(mon, "input", nullptr);
udev_monitor_enable_receiving(mon);
int fd = udev_monitor_get_fd(mon);
@@ -163,7 +163,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
tv.tv_sec = 0;
tv.tv_usec = 0;
- ret = select(fd + 1, &fds, NULL, NULL, &tv);
+ ret = select(fd + 1, &fds, nullptr, nullptr, &tv);
/* Check if our file descriptor has received data. */
if (ret > 0 && FD_ISSET(fd, &fds)) {
@@ -299,7 +299,7 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
joy->abs_info[i] = memnew(input_absinfo);
if (ioctl(joy->fd, EVIOCGABS(i), joy->abs_info[i]) < 0) {
memdelete(joy->abs_info[i]);
- joy->abs_info[i] = NULL;
+ joy->abs_info[i] = nullptr;
}
}
}
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index 084453bdc6..5b9a25bd8b 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -87,7 +87,7 @@ void OS_LinuxBSD::finalize() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
#ifdef ALSAMIDI_ENABLED
driver_alsamidi.close();
@@ -107,7 +107,7 @@ void OS_LinuxBSD::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_LinuxBSD::set_main_loop(MainLoop *p_main_loop) {
@@ -230,7 +230,7 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir) const {
String pipe;
List<String> arg;
arg.push_back(xdgparam);
- Error err = const_cast<OS_LinuxBSD *>(this)->execute("xdg-user-dir", arg, true, NULL, &pipe);
+ Error err = const_cast<OS_LinuxBSD *>(this)->execute("xdg-user-dir", arg, true, nullptr, &pipe);
if (err != OK)
return ".";
return pipe.strip_edges();
@@ -351,7 +351,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
mv_args.push_back(p_path);
mv_args.push_back(trash_can);
int retval;
- err = execute("mv", mv_args, true, NULL, NULL, &retval);
+ err = execute("mv", mv_args, true, nullptr, nullptr, &retval);
// Issue an error if "mv" failed to move the given resource to the trash can.
if (err != OK || retval != 0) {
@@ -364,7 +364,7 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) {
OS_LinuxBSD::OS_LinuxBSD() {
- main_loop = NULL;
+ main_loop = nullptr;
force_quit = false;
#ifdef PULSEAUDIO_ENABLED
diff --git a/platform/linuxbsd/platform_linuxbsd_builders.py b/platform/linuxbsd/platform_linuxbsd_builders.py
index a72306a9c0..58234f3748 100644
--- a/platform/linuxbsd/platform_linuxbsd_builders.py
+++ b/platform/linuxbsd/platform_linuxbsd_builders.py
@@ -8,10 +8,10 @@ from platform_methods import subprocess_main
def make_debug_linuxbsd(target, source, env):
- os.system('objcopy --only-keep-debug {0} {0}.debugsymbols'.format(target[0]))
- os.system('strip --strip-debug --strip-unneeded {0}'.format(target[0]))
- os.system('objcopy --add-gnu-debuglink={0}.debugsymbols {0}'.format(target[0]))
+ os.system("objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
+ os.system("strip --strip-debug --strip-unneeded {0}".format(target[0]))
+ os.system("objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp
index d0e1b1678c..1798a7026e 100644
--- a/platform/linuxbsd/vulkan_context_x11.cpp
+++ b/platform/linuxbsd/vulkan_context_x11.cpp
@@ -39,13 +39,13 @@ Error VulkanContextX11::window_create(DisplayServer::WindowID p_window_id, ::Win
VkXlibSurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
- createInfo.pNext = NULL;
+ createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.dpy = p_display;
createInfo.window = p_window;
VkSurfaceKHR surface;
- VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, NULL, &surface);
+ VkResult err = vkCreateXlibSurfaceKHR(_get_instance(), &createInfo, nullptr, &surface);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
return _window_create(p_window_id, surface, p_width, p_height);
}
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index 4ec8aeab6d..ad62db358b 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -1,23 +1,22 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
from platform_methods import run_in_subprocess
import platform_osx_builders
files = [
- 'crash_handler_osx.mm',
- 'os_osx.mm',
- 'display_server_osx.mm',
- 'godot_main_osx.mm',
- 'dir_access_osx.mm',
- 'joypad_osx.cpp',
- 'vulkan_context_osx.mm',
- 'context_gl_osx.mm'
+ "crash_handler_osx.mm",
+ "os_osx.mm",
+ "display_server_osx.mm",
+ "godot_main_osx.mm",
+ "dir_access_osx.mm",
+ "joypad_osx.cpp",
+ "vulkan_context_osx.mm",
+ "context_gl_osx.mm",
]
-prog = env.add_program('#bin/godot', files)
+prog = env.add_program("#bin/godot", files)
if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_osx_builders.make_debug_osx))
-
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 12ca5c10dc..29aa8ece19 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -14,7 +14,7 @@ def get_name():
def can_build():
- if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)):
+ if sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ):
return True
return False
@@ -24,52 +24,55 @@ def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
return [
- ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
- ('MACOS_SDK_PATH', 'Path to the macOS SDK', ''),
- BoolVariable('use_static_mvk', 'Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)', 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('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
- BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
- BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
+ ("osxcross_sdk", "OSXCross SDK version", "darwin14"),
+ ("MACOS_SDK_PATH", "Path to the macOS SDK", ""),
+ BoolVariable(
+ "use_static_mvk",
+ "Link MoltenVK statically as Level-0 driver (better portability) or use Vulkan ICD loader (enables validation layers)",
+ 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("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
+ BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
+ BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", False),
]
def get_flags():
- return [
- ]
+ return []
def configure(env):
- ## Build type
-
- if (env["target"] == "release"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O3', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os','-ftree-vectorize', '-msse2'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "release_debug"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED'])
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g3'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
+ ## Build type
+
+ if env["target"] == "release":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize", "-msse2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize", "-msse2"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "release_debug":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "debug":
+ env.Prepend(CCFLAGS=["-g3"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
## Architecture
@@ -83,86 +86,109 @@ def configure(env):
if "OSXCROSS_ROOT" in os.environ:
env["osxcross"] = True
- if not "osxcross" in env: # regular native build
- env.Append(CCFLAGS=['-arch', 'x86_64'])
- env.Append(LINKFLAGS=['-arch', 'x86_64'])
- if (env["macports_clang"] != 'no'):
+ if not "osxcross" in env: # regular native build
+ env.Append(CCFLAGS=["-arch", "x86_64"])
+ env.Append(LINKFLAGS=["-arch", "x86_64"])
+ if env["macports_clang"] != "no":
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
mpclangver = env["macports_clang"]
env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang"
env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
- env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar"
- env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
- env['AS'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as"
- env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define
+ env["AR"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar"
+ env["RANLIB"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
+ env["AS"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as"
+ env.Append(CPPDEFINES=["__MACPORTS__"]) # hack to fix libvpx MM256_BROADCASTSI128_SI256 define
else:
- env['CC'] = 'clang'
- env['CXX'] = 'clang++'
+ env["CC"] = "clang"
+ env["CXX"] = "clang++"
- detect_darwin_sdk_path('osx', env)
- env.Append(CCFLAGS=['-isysroot', '$MACOS_SDK_PATH'])
- env.Append(LINKFLAGS=['-isysroot', '$MACOS_SDK_PATH'])
+ detect_darwin_sdk_path("osx", env)
+ env.Append(CCFLAGS=["-isysroot", "$MACOS_SDK_PATH"])
+ env.Append(LINKFLAGS=["-isysroot", "$MACOS_SDK_PATH"])
- else: # osxcross build
+ else: # osxcross build
root = os.environ.get("OSXCROSS_ROOT", 0)
basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
ccache_path = os.environ.get("CCACHE")
if ccache_path is None:
- env['CC'] = basecmd + "cc"
- env['CXX'] = basecmd + "c++"
+ env["CC"] = basecmd + "cc"
+ env["CXX"] = basecmd + "c++"
else:
# there aren't any ccache wrappers available for OS X cross-compile,
# to enable caching we need to prepend the path to the ccache binary
- env['CC'] = ccache_path + ' ' + basecmd + "cc"
- env['CXX'] = ccache_path + ' ' + basecmd + "c++"
- env['AR'] = basecmd + "ar"
- env['RANLIB'] = basecmd + "ranlib"
- env['AS'] = basecmd + "as"
- env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define
-
- if (env["CXX"] == "clang++"):
- env.Append(CPPDEFINES=['TYPED_METHOD_BIND'])
+ env["CC"] = ccache_path + " " + basecmd + "cc"
+ env["CXX"] = ccache_path + " " + basecmd + "c++"
+ env["AR"] = basecmd + "ar"
+ env["RANLIB"] = basecmd + "ranlib"
+ env["AS"] = basecmd + "as"
+ env.Append(CPPDEFINES=["__MACPORTS__"]) # hack to fix libvpx MM256_BROADCASTSI128_SI256 define
+
+ if env["CXX"] == "clang++":
+ env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
env["CC"] = "clang"
env["LINK"] = "clang++"
- if env['use_ubsan'] or env['use_asan'] or env['use_tsan']:
+ if env["use_ubsan"] or env["use_asan"] or env["use_tsan"]:
env.extra_suffix += "s"
- if env['use_ubsan']:
- env.Append(CCFLAGS=['-fsanitize=undefined'])
- env.Append(LINKFLAGS=['-fsanitize=undefined'])
+ if env["use_ubsan"]:
+ env.Append(CCFLAGS=["-fsanitize=undefined"])
+ env.Append(LINKFLAGS=["-fsanitize=undefined"])
- if env['use_asan']:
- env.Append(CCFLAGS=['-fsanitize=address'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
+ if env["use_asan"]:
+ env.Append(CCFLAGS=["-fsanitize=address"])
+ env.Append(LINKFLAGS=["-fsanitize=address"])
- if env['use_tsan']:
- env.Append(CCFLAGS=['-fsanitize=thread'])
- env.Append(LINKFLAGS=['-fsanitize=thread'])
+ if env["use_tsan"]:
+ env.Append(CCFLAGS=["-fsanitize=thread"])
+ env.Append(LINKFLAGS=["-fsanitize=thread"])
## Dependencies
- if env['builtin_libtheora']:
+ if env["builtin_libtheora"]:
env["x86_libtheora_opt_gcc"] = True
## Flags
- env.Prepend(CPPPATH=['#platform/osx'])
- env.Append(CPPDEFINES=['OSX_ENABLED', 'UNIX_ENABLED', 'APPLE_STYLE_KEYS', 'COREAUDIO_ENABLED', 'COREMIDI_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMIDI', '-framework', 'IOKit', '-framework', 'ForceFeedback', '-framework', 'CoreVideo', '-framework', 'AVFoundation', '-framework', 'CoreMedia'])
- env.Append(LIBS=['pthread', 'z'])
-
- env.Append(CPPDEFINES=['VULKAN_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'Metal', '-framework', 'QuartzCore', '-framework', 'IOSurface'])
- if (env['use_static_mvk']):
- env.Append(LINKFLAGS=['-framework', 'MoltenVK'])
- env['builtin_vulkan'] = False
- elif not env['builtin_vulkan']:
- env.Append(LIBS=['vulkan'])
-
- #env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
-
- env.Append(CCFLAGS=['-mmacosx-version-min=10.12'])
- env.Append(LINKFLAGS=['-mmacosx-version-min=10.12'])
+ env.Prepend(CPPPATH=["#platform/osx"])
+ env.Append(CPPDEFINES=["OSX_ENABLED", "UNIX_ENABLED", "APPLE_STYLE_KEYS", "COREAUDIO_ENABLED", "COREMIDI_ENABLED"])
+ env.Append(
+ LINKFLAGS=[
+ "-framework",
+ "Cocoa",
+ "-framework",
+ "Carbon",
+ "-framework",
+ "AudioUnit",
+ "-framework",
+ "CoreAudio",
+ "-framework",
+ "CoreMIDI",
+ "-framework",
+ "IOKit",
+ "-framework",
+ "ForceFeedback",
+ "-framework",
+ "CoreVideo",
+ "-framework",
+ "AVFoundation",
+ "-framework",
+ "CoreMedia",
+ ]
+ )
+ env.Append(LIBS=["pthread", "z"])
+
+ env.Append(CPPDEFINES=["VULKAN_ENABLED"])
+ env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"])
+ if env["use_static_mvk"]:
+ env.Append(LINKFLAGS=["-framework", "MoltenVK"])
+ env["builtin_vulkan"] = False
+ elif not env["builtin_vulkan"]:
+ env.Append(LIBS=["vulkan"])
+
+ # env.Append(CPPDEFINES=['GLES_ENABLED', 'OPENGL_ENABLED'])
+
+ env.Append(CCFLAGS=["-mmacosx-version-min=10.12"])
+ env.Append(LINKFLAGS=["-mmacosx-version-min=10.12"])
diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h
index 33f483bd0e..86ceb51763 100644
--- a/platform/osx/display_server_osx.h
+++ b/platform/osx/display_server_osx.h
@@ -71,8 +71,8 @@ public:
const NSMenu *_get_menu_root(const String &p_menu_root) const;
NSMenu *_get_menu_root(const String &p_menu_root);
- NSMenu *apple_menu = NULL;
- NSMenu *dock_menu = NULL;
+ NSMenu *apple_menu = nullptr;
+ NSMenu *dock_menu = nullptr;
Map<String, NSMenu *> submenu;
struct KeyEvent {
@@ -95,7 +95,7 @@ public:
id window_view;
#if defined(OPENGL_ENABLED)
- ContextGL_OSX *context_gles2 = NULL;
+ ContextGL_OSX *context_gles2 = nullptr;
#endif
Point2i mouse_pos;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index dbe52da912..c2df9c7082 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -402,7 +402,7 @@ Error EditorExportPlatformOSX::_code_sign(const Ref<EditorExportPreset> &p_prese
args.push_back(p_path);
String str;
- Error err = OS::get_singleton()->execute("codesign", args, true, NULL, &str, NULL, true);
+ Error err = OS::get_singleton()->execute("codesign", args, true, nullptr, &str, nullptr, true);
ERR_FAIL_COND_V(err != OK, err);
print_line("codesign (" + p_path + "): " + str);
@@ -435,7 +435,7 @@ Error EditorExportPlatformOSX::_create_dmg(const String &p_dmg_path, const Strin
args.push_back(p_app_path_name);
String str;
- Error err = OS::get_singleton()->execute("hdiutil", args, true, NULL, &str, NULL, true);
+ Error err = OS::get_singleton()->execute("hdiutil", args, true, nullptr, &str, nullptr, true);
ERR_FAIL_COND_V(err != OK, err);
print_line("hdiutil returned: " + str);
@@ -476,7 +476,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
return ERR_FILE_BAD_PATH;
}
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
if (ep.step("Creating app", 0)) {
@@ -507,11 +507,11 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
Error err = OK;
String tmp_app_path_name = "";
zlib_filefunc_def io2 = io;
- FileAccess *dst_f = NULL;
+ FileAccess *dst_f = nullptr;
io2.opaque = &dst_f;
- zipFile dst_pkg_zip = NULL;
+ zipFile dst_pkg_zip = nullptr;
- DirAccess *tmp_app_path = NULL;
+ DirAccess *tmp_app_path = nullptr;
String export_format = use_dmg() && p_path.ends_with("dmg") ? "dmg" : "zip";
if (export_format == "dmg") {
// We're on OSX so we can export to DMG, but first we create our application bundle
@@ -539,7 +539,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
} else {
// Open our destination zip file
- dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io2);
+ dst_pkg_zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, nullptr, &io2);
if (!dst_pkg_zip) {
err = ERR_CANT_CREATE;
}
@@ -555,7 +555,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
//get filename
unz_file_info info;
char fname[16384];
- ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(src_pkg_zip, &info, fname, 16384, nullptr, 0, nullptr, 0);
String file = fname;
@@ -672,11 +672,11 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
zipOpenNewFileInZip(dst_pkg_zip,
file.utf8().get_data(),
&fi,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
@@ -754,12 +754,12 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (err == OK) {
zipOpenNewFileInZip(dst_pkg_zip,
(pkg_name + ".app/Contents/Resources/" + pkg_name + ".pck").utf8().get_data(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
@@ -791,12 +791,12 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
zipOpenNewFileInZip(dst_pkg_zip,
(pkg_name + ".app/Contents/Frameworks/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(),
- NULL,
- NULL,
+ nullptr,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
@@ -811,7 +811,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
if (dst_pkg_zip) {
- zipClose(dst_pkg_zip, NULL);
+ zipClose(dst_pkg_zip, nullptr);
}
return err;
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index f2d9de6fbd..643acd8944 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -34,13 +34,13 @@
#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad")
-static JoypadOSX *self = NULL;
+static JoypadOSX *self = nullptr;
joypad::joypad() {
- device_ref = NULL;
- ff_device = NULL;
- ff_axes = NULL;
- ff_directions = NULL;
+ device_ref = nullptr;
+ ff_device = nullptr;
+ ff_axes = nullptr;
+ ff_directions = nullptr;
ffservice = 0;
ff_timestamp = 0;
id = 0;
@@ -53,7 +53,7 @@ joypad::joypad() {
ff_effect.dwTriggerButton = FFEB_NOTRIGGER;
ff_effect.dwStartDelay = 0;
ff_effect.dwTriggerRepeatInterval = 0;
- ff_effect.lpEnvelope = NULL;
+ ff_effect.lpEnvelope = nullptr;
ff_effect.cbTypeSpecificParams = sizeof(FFCONSTANTFORCE);
ff_effect.lpvTypeSpecificParams = &ff_constant_force;
ff_effect.dwSize = sizeof(ff_effect);
@@ -105,7 +105,7 @@ void joypad::add_hid_element(IOHIDElementRef p_element) {
const IOHIDElementCookie cookie = IOHIDElementGetCookie(p_element);
const uint32_t usagePage = IOHIDElementGetUsagePage(p_element);
const uint32_t usage = IOHIDElementGetUsage(p_element);
- Vector<rec_element> *list = NULL;
+ Vector<rec_element> *list = nullptr;
switch (IOHIDElementGetType(p_element)) {
case kIOHIDElementTypeInput_Misc:
@@ -249,7 +249,7 @@ void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (is_joypad(p_device)) {
configure_joypad(p_device, &new_joypad);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
- if (IOHIDDeviceGetService != NULL) {
+ if (IOHIDDeviceGetService != nullptr) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) {
@@ -330,7 +330,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
input->joy_connection_changed(id, true, name, guid);
}
- CFArrayRef array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
+ CFArrayRef array = IOHIDDeviceCopyMatchingElements(p_device_ref, nullptr, kIOHIDOptionsTypeNone);
if (array) {
p_joy->add_hid_elements(array);
CFRelease(array);
@@ -531,7 +531,7 @@ bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const {
}
static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 usage, int *okay) {
- CFDictionaryRef retval = NULL;
+ CFDictionaryRef retval = nullptr;
CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
const void *keys[2] = { (void *)CFSTR(kIOHIDDeviceUsagePageKey), (void *)CFSTR(kIOHIDDeviceUsageKey) };
@@ -562,8 +562,8 @@ void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
- IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL);
- IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, joypad_removed_callback, NULL);
+ IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, nullptr);
+ IOHIDManagerRegisterDeviceRemovalCallback(hid_manager, joypad_removed_callback, nullptr);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) {
@@ -582,7 +582,7 @@ JoypadOSX::JoypadOSX(InputFilter *in) {
(void *)create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
};
const size_t n_elements = sizeof(vals) / sizeof(vals[0]);
- CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : NULL;
+ CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : nullptr;
for (size_t i = 0; i < n_elements; i++) {
if (vals[i]) {
@@ -592,7 +592,7 @@ JoypadOSX::JoypadOSX(InputFilter *in) {
if (array) {
hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
- if (hid_manager != NULL) {
+ if (hid_manager != nullptr) {
config_hid_manager(array);
}
CFRelease(array);
@@ -608,5 +608,5 @@ JoypadOSX::~JoypadOSX() {
IOHIDManagerUnscheduleFromRunLoop(hid_manager, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
IOHIDManagerClose(hid_manager, kIOHIDOptionsTypeNone);
CFRelease(hid_manager);
- hid_manager = NULL;
+ hid_manager = nullptr;
}
diff --git a/platform/osx/platform_osx_builders.py b/platform/osx/platform_osx_builders.py
index 81997f674b..953ed479db 100644
--- a/platform/osx/platform_osx_builders.py
+++ b/platform/osx/platform_osx_builders.py
@@ -8,14 +8,14 @@ from platform_methods import subprocess_main
def make_debug_osx(target, source, env):
- if (env["macports_clang"] != 'no'):
+ if env["macports_clang"] != "no":
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
mpclangver = env["macports_clang"]
- os.system(mpprefix + '/libexec/llvm-' + mpclangver + '/bin/llvm-dsymutil {0} -o {0}.dSYM'.format(target[0]))
+ os.system(mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-dsymutil {0} -o {0}.dSYM".format(target[0]))
else:
- os.system('dsymutil {0} -o {0}.dSYM'.format(target[0]))
- os.system('strip -u -r {0}'.format(target[0]))
+ os.system("dsymutil {0} -o {0}.dSYM".format(target[0]))
+ os.system("strip -u -r {0}".format(target[0]))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/platform/server/SCsub b/platform/server/SCsub
index 8364164114..15b9af4d25 100644
--- a/platform/server/SCsub
+++ b/platform/server/SCsub
@@ -2,15 +2,15 @@
import sys
-Import('env')
+Import("env")
-common_server = [\
- "os_server.cpp",\
+common_server = [
+ "os_server.cpp",
]
if sys.platform == "darwin":
- common_server.append("#platform/osx/crash_handler_osx.mm")
+ common_server.append("#platform/osx/crash_handler_osx.mm")
else:
- common_server.append("#platform/x11/crash_handler_x11.cpp")
+ common_server.append("#platform/x11/crash_handler_x11.cpp")
-prog = env.add_program('#bin/godot_server', ['godot_server.cpp'] + common_server)
+prog = env.add_program("#bin/godot_server", ["godot_server.cpp"] + common_server)
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 4ea4bddddd..a73810cdf4 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -5,6 +5,7 @@ import sys
# This file is mostly based on platform/x11/detect.py.
# If editing this file, make sure to apply relevant changes here too.
+
def is_active():
return True
@@ -14,14 +15,14 @@ def get_name():
def get_program_suffix():
- if (sys.platform == "darwin"):
+ if sys.platform == "darwin":
return "osx"
return "linuxbsd"
def can_build():
- if (os.name != "posix"):
+ if os.name != "posix":
return False
return True
@@ -29,17 +30,18 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
+
return [
- BoolVariable('use_llvm', 'Use the LLVM compiler', False),
- BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
- BoolVariable('use_coverage', 'Test Godot coverage', False),
- BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
- BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
- BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
- BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', 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('execinfo', 'Use libexecinfo on systems where glibc is not available', False),
+ BoolVariable("use_llvm", "Use the LLVM compiler", False),
+ BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False),
+ BoolVariable("use_coverage", "Test Godot coverage", False),
+ BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
+ BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN))", False),
+ BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN))", False),
+ BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN))", 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("execinfo", "Use libexecinfo on systems where glibc is not available", False),
]
@@ -52,89 +54,89 @@ def configure(env):
## Build type
- if (env["target"] == "release"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O3'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "release_debug"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Prepend(CCFLAGS=['-O2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "debug"):
- env.Prepend(CCFLAGS=['-g3'])
- env.Prepend(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
- env.Append(LINKFLAGS=['-rdynamic'])
+ if env["target"] == "release":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O3"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "release_debug":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Prepend(CCFLAGS=["-O2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "debug":
+ env.Prepend(CCFLAGS=["-g3"])
+ env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
+ env.Append(LINKFLAGS=["-rdynamic"])
## Architecture
- is64 = sys.maxsize > 2**32
- if (env["bits"] == "default"):
+ is64 = sys.maxsize > 2 ** 32
+ if env["bits"] == "default":
env["bits"] = "64" if is64 else "32"
## Compiler configuration
- if 'CXX' in env and 'clang' in os.path.basename(env['CXX']):
+ if "CXX" in env and "clang" in os.path.basename(env["CXX"]):
# Convenience check to enforce the use_llvm overrides when CXX is clang(++)
- env['use_llvm'] = True
+ env["use_llvm"] = True
- if env['use_llvm']:
- if ('clang++' not in os.path.basename(env['CXX'])):
+ if env["use_llvm"]:
+ if "clang++" not in os.path.basename(env["CXX"]):
env["CC"] = "clang"
env["CXX"] = "clang++"
env["LINK"] = "clang++"
- env.Append(CPPDEFINES=['TYPED_METHOD_BIND'])
+ env.Append(CPPDEFINES=["TYPED_METHOD_BIND"])
env.extra_suffix = ".llvm" + env.extra_suffix
- if env['use_coverage']:
- env.Append(CCFLAGS=['-ftest-coverage', '-fprofile-arcs'])
- env.Append(LINKFLAGS=['-ftest-coverage', '-fprofile-arcs'])
+ if env["use_coverage"]:
+ env.Append(CCFLAGS=["-ftest-coverage", "-fprofile-arcs"])
+ env.Append(LINKFLAGS=["-ftest-coverage", "-fprofile-arcs"])
- if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
+ if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"]:
env.extra_suffix += "s"
- if env['use_ubsan']:
- env.Append(CCFLAGS=['-fsanitize=undefined'])
- env.Append(LINKFLAGS=['-fsanitize=undefined'])
+ if env["use_ubsan"]:
+ env.Append(CCFLAGS=["-fsanitize=undefined"])
+ env.Append(LINKFLAGS=["-fsanitize=undefined"])
- if env['use_asan']:
- env.Append(CCFLAGS=['-fsanitize=address'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
+ if env["use_asan"]:
+ env.Append(CCFLAGS=["-fsanitize=address"])
+ env.Append(LINKFLAGS=["-fsanitize=address"])
- if env['use_lsan']:
- env.Append(CCFLAGS=['-fsanitize=leak'])
- env.Append(LINKFLAGS=['-fsanitize=leak'])
+ if env["use_lsan"]:
+ env.Append(CCFLAGS=["-fsanitize=leak"])
+ env.Append(LINKFLAGS=["-fsanitize=leak"])
- if env['use_tsan']:
- env.Append(CCFLAGS=['-fsanitize=thread'])
- env.Append(LINKFLAGS=['-fsanitize=thread'])
+ if env["use_tsan"]:
+ env.Append(CCFLAGS=["-fsanitize=thread"])
+ env.Append(LINKFLAGS=["-fsanitize=thread"])
- if env['use_lto']:
- env.Append(CCFLAGS=['-flto'])
- if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
- env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ if env["use_lto"]:
+ env.Append(CCFLAGS=["-flto"])
+ if not env["use_llvm"] and env.GetOption("num_jobs") > 1:
+ env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))])
else:
- env.Append(LINKFLAGS=['-flto'])
- if not env['use_llvm']:
- env['RANLIB'] = 'gcc-ranlib'
- env['AR'] = 'gcc-ar'
+ env.Append(LINKFLAGS=["-flto"])
+ if not env["use_llvm"]:
+ env["RANLIB"] = "gcc-ranlib"
+ env["AR"] = "gcc-ar"
- env.Append(CCFLAGS=['-pipe'])
- env.Append(LINKFLAGS=['-pipe'])
+ env.Append(CCFLAGS=["-pipe"])
+ env.Append(LINKFLAGS=["-pipe"])
## Dependencies
@@ -142,109 +144,114 @@ def configure(env):
# 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']:
- env['builtin_freetype'] = True
- env['builtin_libpng'] = True
- env['builtin_zlib'] = True
+ if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]:
+ env["builtin_freetype"] = True
+ env["builtin_libpng"] = True
+ env["builtin_zlib"] = True
- if not env['builtin_freetype']:
- env.ParseConfig('pkg-config freetype2 --cflags --libs')
+ if not env["builtin_freetype"]:
+ env.ParseConfig("pkg-config freetype2 --cflags --libs")
- if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng16 --cflags --libs')
+ if not env["builtin_libpng"]:
+ env.ParseConfig("pkg-config libpng16 --cflags --libs")
- if not env['builtin_bullet']:
+ if not env["builtin_bullet"]:
# We need at least version 2.89
import subprocess
- bullet_version = subprocess.check_output(['pkg-config', 'bullet', '--modversion']).strip()
+
+ bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip()
if str(bullet_version) < "2.89":
# Abort as system bullet was requested but too old
- print("Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(bullet_version, "2.89"))
+ print(
+ "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format(
+ bullet_version, "2.89"
+ )
+ )
sys.exit(255)
- env.ParseConfig('pkg-config bullet --cflags --libs')
+ env.ParseConfig("pkg-config bullet --cflags --libs")
if False: # not env['builtin_assimp']:
# FIXME: Add min version check
- env.ParseConfig('pkg-config assimp --cflags --libs')
+ env.ParseConfig("pkg-config assimp --cflags --libs")
- if not env['builtin_enet']:
- env.ParseConfig('pkg-config libenet --cflags --libs')
+ if not env["builtin_enet"]:
+ env.ParseConfig("pkg-config libenet --cflags --libs")
- if not env['builtin_squish']:
- env.ParseConfig('pkg-config libsquish --cflags --libs')
+ if not env["builtin_squish"]:
+ env.ParseConfig("pkg-config libsquish --cflags --libs")
- if not env['builtin_zstd']:
- env.ParseConfig('pkg-config libzstd --cflags --libs')
+ if not env["builtin_zstd"]:
+ env.ParseConfig("pkg-config libzstd --cflags --libs")
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- if not env['builtin_libtheora']:
- 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')
+ if not env["builtin_libtheora"]:
+ 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']
+ 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')
+ if not env["builtin_libvpx"]:
+ env.ParseConfig("pkg-config vpx --cflags --libs")
- if not env['builtin_libvorbis']:
- env['builtin_libogg'] = False # Needed to link against system libvorbis
- env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+ if not env["builtin_libvorbis"]:
+ env["builtin_libogg"] = False # Needed to link against system libvorbis
+ env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs")
- if not env['builtin_opus']:
- env['builtin_libogg'] = False # Needed to link against system opus
- env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+ if not env["builtin_opus"]:
+ env["builtin_libogg"] = False # Needed to link against system opus
+ env.ParseConfig("pkg-config opus opusfile --cflags --libs")
- if not env['builtin_libogg']:
- env.ParseConfig('pkg-config ogg --cflags --libs')
+ 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_libwebp"]:
+ env.ParseConfig("pkg-config libwebp --cflags --libs")
- if not env['builtin_mbedtls']:
+ 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'])
+ env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"])
- if not env['builtin_wslay']:
- env.ParseConfig('pkg-config libwslay --cflags --libs')
+ if not env["builtin_wslay"]:
+ env.ParseConfig("pkg-config libwslay --cflags --libs")
- if not env['builtin_miniupnpc']:
+ if not env["builtin_miniupnpc"]:
# No pkgconfig file so far, hardcode default paths.
env.Prepend(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')
+ if not env["builtin_pcre2"]:
+ env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
## Flags
# Linkflags below this line should typically stay the last ones
- if not env['builtin_zlib']:
- env.ParseConfig('pkg-config zlib --cflags --libs')
+ if not env["builtin_zlib"]:
+ env.ParseConfig("pkg-config zlib --cflags --libs")
- env.Prepend(CPPPATH=['#platform/server'])
- env.Append(CPPDEFINES=['SERVER_ENABLED', 'UNIX_ENABLED'])
+ env.Prepend(CPPPATH=["#platform/server"])
+ env.Append(CPPDEFINES=["SERVER_ENABLED", "UNIX_ENABLED"])
- if (platform.system() == "Darwin"):
- env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-lz', '-framework', 'IOKit'])
+ if platform.system() == "Darwin":
+ env.Append(LINKFLAGS=["-framework", "Cocoa", "-framework", "Carbon", "-lz", "-framework", "IOKit"])
- env.Append(LIBS=['pthread'])
+ env.Append(LIBS=["pthread"])
- if (platform.system() == "Linux"):
- env.Append(LIBS=['dl'])
+ if platform.system() == "Linux":
+ env.Append(LIBS=["dl"])
- if (platform.system().find("BSD") >= 0):
+ if platform.system().find("BSD") >= 0:
env["execinfo"] = True
if env["execinfo"]:
- env.Append(LIBS=['execinfo'])
+ env.Append(LIBS=["execinfo"])
# Link those statically for portability
- if env['use_static_cpp']:
- env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++'])
+ if env["use_static_cpp"]:
+ env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 6b26ceed57..0fda0663a2 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -74,7 +74,7 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
args = OS::get_singleton()->get_cmdline_args();
current_videomode = p_desired;
- main_loop = NULL;
+ main_loop = nullptr;
RasterizerDummy::make_current();
@@ -99,7 +99,7 @@ void OS_Server::finalize() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
rendering_server->finish();
memdelete(rendering_server);
@@ -163,7 +163,7 @@ void OS_Server::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_Server::set_main_loop(MainLoop *p_main_loop) {
@@ -289,7 +289,7 @@ String OS_Server::get_system_dir(SystemDir p_dir) const {
String pipe;
List<String> arg;
arg.push_back(xdgparam);
- Error err = const_cast<OS_Server *>(this)->execute("xdg-user-dir", arg, true, NULL, &pipe);
+ Error err = const_cast<OS_Server *>(this)->execute("xdg-user-dir", arg, true, nullptr, &pipe);
if (err != OK)
return ".";
return pipe.strip_edges();
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index 620d8c3c3a..4358b0eead 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -1,21 +1,21 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
files = [
- 'thread_uwp.cpp',
- '#platform/windows/key_mapping_windows.cpp',
- '#platform/windows/windows_terminal_logger.cpp',
- 'joypad_uwp.cpp',
- 'context_egl_uwp.cpp',
- 'app.cpp',
- 'os_uwp.cpp',
+ "thread_uwp.cpp",
+ "#platform/windows/key_mapping_windows.cpp",
+ "#platform/windows/windows_terminal_logger.cpp",
+ "joypad_uwp.cpp",
+ "context_egl_uwp.cpp",
+ "app.cpp",
+ "os_uwp.cpp",
]
if "build_angle" in env and env["build_angle"]:
- cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None))
+ cmd = env.AlwaysBuild(env.ANGLE("libANGLE.lib", None))
-prog = env.add_program('#bin/godot', files)
+prog = env.add_program("#bin/godot", files)
if "build_angle" in env and env["build_angle"]:
env.Depends(prog, [cmd])
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index ccb4b43373..d3870b0b6c 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -507,12 +507,12 @@ void App::UpdateWindowSize(Size size) {
char **App::get_command_line(unsigned int *out_argc) {
- static char *fail_cl[] = { "--path", "game", NULL };
+ static char *fail_cl[] = { "--path", "game", nullptr };
*out_argc = 2;
FILE *f = _wfopen(L"__cl__.cl", L"rb");
- if (f == NULL) {
+ if (f == nullptr) {
wprintf(L"Couldn't open command line file.\n");
return fail_cl;
@@ -558,7 +558,7 @@ char **App::get_command_line(unsigned int *out_argc) {
if (r == strlen) {
- int warg_size = MultiByteToWideChar(CP_UTF8, 0, arg, -1, NULL, 0);
+ int warg_size = MultiByteToWideChar(CP_UTF8, 0, arg, -1, nullptr, 0);
wchar_t *warg = new wchar_t[warg_size];
MultiByteToWideChar(CP_UTF8, 0, arg, -1, warg, warg_size);
@@ -583,14 +583,14 @@ char **App::get_command_line(unsigned int *out_argc) {
for (int i = 0; i < cl.Size; i++) {
- int arg_size = WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, NULL, 0, NULL, NULL);
+ int arg_size = WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, nullptr, 0, nullptr, nullptr);
char *arg = new char[arg_size];
- WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, arg, arg_size, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, cl.GetAt(i)->Data(), -1, arg, arg_size, nullptr, nullptr);
ret[i] = arg;
}
- ret[cl.Size] = NULL;
+ ret[cl.Size] = nullptr;
*out_argc = cl.Size;
return ret;
diff --git a/platform/uwp/context_egl_uwp.cpp b/platform/uwp/context_egl_uwp.cpp
index 7ac9489bb4..bc8ca2e36c 100644
--- a/platform/uwp/context_egl_uwp.cpp
+++ b/platform/uwp/context_egl_uwp.cpp
@@ -155,7 +155,7 @@ Error ContextEGL_UWP::initialize() {
throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL");
}
- if (eglGetConfigs(display, NULL, 0, &numConfigs) == EGL_FALSE) {
+ if (eglGetConfigs(display, nullptr, 0, &numConfigs) == EGL_FALSE) {
throw Exception::CreateException(E_FAIL, L"Failed to get EGLConfig count");
}
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 000bd18e7d..669bfe6814 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -12,11 +12,11 @@ def get_name():
def can_build():
- if (os.name == "nt"):
+ if os.name == "nt":
# building natively on windows!
- if (os.getenv("VSINSTALLDIR")):
+ if os.getenv("VSINSTALLDIR"):
- if (os.getenv("ANGLE_SRC_PATH") is None):
+ if os.getenv("ANGLE_SRC_PATH") is None:
return False
return True
@@ -25,16 +25,16 @@ def can_build():
def get_opts():
return [
- ('msvc_version', 'MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)', None),
+ ("msvc_version", "MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)", None),
]
def get_flags():
return [
- ('tools', False),
- ('xaudio2', True),
- ('builtin_pcre2_with_jit', False),
+ ("tools", False),
+ ("xaudio2", True),
+ ("builtin_pcre2_with_jit", False),
]
@@ -42,45 +42,53 @@ def configure(env):
env.msvc = True
- if (env["bits"] != "default"):
+ if env["bits"] != "default":
print("Error: bits argument is disabled for MSVC")
- print("""
+ 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=uwp) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
- """)
+ """
+ )
sys.exit()
## Build type
- if (env["target"] == "release"):
- env.Append(CCFLAGS=['/O2', '/GL'])
- env.Append(CCFLAGS=['/MD'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
+ if env["target"] == "release":
+ env.Append(CCFLAGS=["/O2", "/GL"])
+ env.Append(CCFLAGS=["/MD"])
+ env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS", "/LTCG"])
- elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2', '/Zi'])
- env.Append(CCFLAGS=['/MD'])
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+ elif env["target"] == "release_debug":
+ env.Append(CCFLAGS=["/O2", "/Zi"])
+ env.Append(CCFLAGS=["/MD"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
+ env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['/Zi'])
- env.Append(CCFLAGS=['/MDd'])
- env.Append(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- env.Append(LINKFLAGS=['/DEBUG'])
+ elif env["target"] == "debug":
+ env.Append(CCFLAGS=["/Zi"])
+ env.Append(CCFLAGS=["/MDd"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
+ env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
+ env.Append(LINKFLAGS=["/DEBUG"])
## Compiler configuration
- env['ENV'] = os.environ
- vc_base_path = os.environ['VCTOOLSINSTALLDIR'] if "VCTOOLSINSTALLDIR" in os.environ else os.environ['VCINSTALLDIR']
+ env["ENV"] = os.environ
+ vc_base_path = os.environ["VCTOOLSINSTALLDIR"] if "VCTOOLSINSTALLDIR" in os.environ else os.environ["VCINSTALLDIR"]
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
- env.Prepend(CPPPATH=[angle_root + '/include'])
+ env.Prepend(CPPPATH=[angle_root + "/include"])
jobs = str(env.GetOption("num_jobs"))
- angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
+ angle_build_cmd = (
+ "msbuild.exe "
+ + angle_root
+ + "/winrt/10/src/angle.sln /nologo /v:m /m:"
+ + jobs
+ + " /p:Configuration=Release /p:Platform="
+ )
if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
env["build_angle"] = True
@@ -88,49 +96,51 @@ def configure(env):
## Architecture
arch = ""
- if str(os.getenv('Platform')).lower() == "arm":
+ if str(os.getenv("Platform")).lower() == "arm":
print("Compiled program architecture will be an ARM executable. (forcing bits=32).")
arch = "arm"
env["bits"] = "32"
- env.Append(LINKFLAGS=['/MACHINE:ARM'])
- env.Append(LIBPATH=[vc_base_path + 'lib/store/arm'])
+ env.Append(LINKFLAGS=["/MACHINE:ARM"])
+ env.Append(LIBPATH=[vc_base_path + "lib/store/arm"])
angle_build_cmd += "ARM"
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib'])
+ env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_ARM/lib"])
else:
- compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+ compiler_version_str = methods.detect_visual_c_compiler_version(env["ENV"])
- if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+ if compiler_version_str == "amd64" or compiler_version_str == "x86_amd64":
env["bits"] = "64"
print("Compiled program architecture will be a x64 executable (forcing bits=64).")
- elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+ elif compiler_version_str == "x86" or compiler_version_str == "amd64_x86":
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 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.")
+ 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"):
+ if env["bits"] == "32":
arch = "x86"
angle_build_cmd += "Win32"
- env.Append(LINKFLAGS=['/MACHINE:X86'])
- env.Append(LIBPATH=[vc_base_path + 'lib/store'])
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
+ env.Append(LINKFLAGS=["/MACHINE:X86"])
+ env.Append(LIBPATH=[vc_base_path + "lib/store"])
+ env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_Win32/lib"])
else:
arch = "x64"
angle_build_cmd += "x64"
- env.Append(LINKFLAGS=['/MACHINE:X64'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
+ env.Append(LINKFLAGS=["/MACHINE:X64"])
+ env.Append(LIBPATH=[os.environ["VCINSTALLDIR"] + "lib/store/amd64"])
+ env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_x64/lib"])
env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
@@ -138,39 +148,61 @@ def configure(env):
## Compile flags
- env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows'])
- env.Append(CPPDEFINES=['UWP_ENABLED', 'WINDOWS_ENABLED', 'TYPED_METHOD_BIND'])
- env.Append(CPPDEFINES=['GLES_ENABLED', 'GL_GLEXT_PROTOTYPES', 'EGL_EGLEXT_PROTOTYPES', 'ANGLE_ENABLED'])
- winver = "0x0602" # Windows 8 is the minimum target for UWP build
- env.Append(CPPDEFINES=[('WINVER', winver), ('_WIN32_WINNT', winver), 'WIN32'])
-
- env.Append(CPPDEFINES=['__WRL_NO_DEFAULT_LIB__', ('PNG_ABORT', 'abort')])
-
- env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
- env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])
-
- env.Append(CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split())
- env.Append(CPPDEFINES=['_UNICODE', 'UNICODE', ('WINAPI_FAMILY', 'WINAPI_FAMILY_APP')])
- env.Append(CXXFLAGS=['/ZW'])
- env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
+ env.Prepend(CPPPATH=["#platform/uwp", "#drivers/windows"])
+ env.Append(CPPDEFINES=["UWP_ENABLED", "WINDOWS_ENABLED", "TYPED_METHOD_BIND"])
+ env.Append(CPPDEFINES=["GLES_ENABLED", "GL_GLEXT_PROTOTYPES", "EGL_EGLEXT_PROTOTYPES", "ANGLE_ENABLED"])
+ winver = "0x0602" # Windows 8 is the minimum target for UWP build
+ env.Append(CPPDEFINES=[("WINVER", winver), ("_WIN32_WINNT", winver), "WIN32"])
+
+ env.Append(CPPDEFINES=["__WRL_NO_DEFAULT_LIB__", ("PNG_ABORT", "abort")])
+
+ env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/store/references"])
+ env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/x86/store/references"])
+
+ env.Append(
+ CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split()
+ )
+ env.Append(CPPDEFINES=["_UNICODE", "UNICODE", ("WINAPI_FAMILY", "WINAPI_FAMILY_APP")])
+ env.Append(CXXFLAGS=["/ZW"])
+ env.Append(
+ CCFLAGS=[
+ "/AI",
+ vc_base_path + "\\vcpackages",
+ "/AI",
+ os.environ["WINDOWSSDKDIR"] + "\\References\\CommonConfiguration\\Neutral",
+ ]
+ )
## Link flags
- env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
+ env.Append(
+ LINKFLAGS=[
+ "/MANIFEST:NO",
+ "/NXCOMPAT",
+ "/DYNAMICBASE",
+ "/WINMD",
+ "/APPCONTAINER",
+ "/ERRORREPORT:PROMPT",
+ "/NOLOGO",
+ "/TLBID:1",
+ '/NODEFAULTLIB:"kernel32.lib"',
+ '/NODEFAULTLIB:"ole32.lib"',
+ ]
+ )
LIBS = [
- 'WindowsApp',
- 'mincore',
- 'ws2_32',
- 'libANGLE',
- 'libEGL',
- 'libGLESv2',
- 'bcrypt',
+ "WindowsApp",
+ "mincore",
+ "ws2_32",
+ "libANGLE",
+ "libEGL",
+ "libGLESv2",
+ "bcrypt",
]
env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])
# Incremental linking fix
- env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
- env['BUILDERS']['Program'] = methods.precious_program
+ env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
+ env["BUILDERS"]["Program"] = methods.precious_program
- env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
+ env.Append(BUILDERS={"ANGLE": env.Builder(action=angle_build_cmd)})
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 533293387d..06bf738dc1 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -54,7 +54,7 @@ static const char *uwp_capabilities[] = {
"internetClient",
"internetClientServer",
"privateNetworkClientServer",
- NULL
+ nullptr
};
static const char *uwp_uap_capabilities[] = {
"appointments",
@@ -71,7 +71,7 @@ static const char *uwp_uap_capabilities[] = {
"userAccountInformation",
"videosLibrary",
"voipCall",
- NULL
+ nullptr
};
static const char *uwp_device_capabilities[] = {
"bluetooth",
@@ -79,7 +79,7 @@ static const char *uwp_device_capabilities[] = {
"microphone",
"proximity",
"webcam",
- NULL
+ nullptr
};
class AppxPackager {
@@ -478,7 +478,7 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
// Data for compression
z_stream strm;
- FileAccess *strm_f = NULL;
+ FileAccess *strm_f = nullptr;
Vector<uint8_t> strm_in;
strm_in.resize(BLOCK_SIZE);
Vector<uint8_t> strm_out;
@@ -641,7 +641,7 @@ void AppxPackager::finish() {
package->close();
memdelete(package);
- package = NULL;
+ package = nullptr;
}
AppxPackager::AppxPackager() {}
@@ -670,7 +670,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
static const char *invalid_names[] = {
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7",
"COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
- NULL
+ nullptr
};
const char **t = invalid_names;
@@ -726,7 +726,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
"snow", "springGreen", "steelBlue", "tan", "teal", "thistle",
"tomato", "transparent", "turquoise", "violet", "wheat", "white",
"whiteSmoke", "yellow", "yellowGreen",
- NULL
+ nullptr
};
const char **color = valid_colors;
@@ -876,22 +876,22 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
Vector<uint8_t> _get_image_data(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
Vector<uint8_t> data;
- StreamTexture *image = NULL;
+ StreamTexture *image = nullptr;
if (p_path.find("StoreLogo") != -1) {
- image = p_preset->get("images/store_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/store_logo")));
+ image = p_preset->get("images/store_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/store_logo")));
} else if (p_path.find("Square44x44Logo") != -1) {
- image = p_preset->get("images/square44x44_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square44x44_logo")));
+ image = p_preset->get("images/square44x44_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square44x44_logo")));
} else if (p_path.find("Square71x71Logo") != -1) {
- image = p_preset->get("images/square71x71_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square71x71_logo")));
+ image = p_preset->get("images/square71x71_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square71x71_logo")));
} else if (p_path.find("Square150x150Logo") != -1) {
- image = p_preset->get("images/square150x150_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square150x150_logo")));
+ image = p_preset->get("images/square150x150_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square150x150_logo")));
} else if (p_path.find("Square310x310Logo") != -1) {
- image = p_preset->get("images/square310x310_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square310x310_logo")));
+ image = p_preset->get("images/square310x310_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/square310x310_logo")));
} else if (p_path.find("Wide310x150Logo") != -1) {
- image = p_preset->get("images/wide310x150_logo").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/wide310x150_logo")));
+ image = p_preset->get("images/wide310x150_logo").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/wide310x150_logo")));
} else if (p_path.find("SplashScreen") != -1) {
- image = p_preset->get("images/splash_screen").is_zero() ? NULL : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/splash_screen")));
+ image = p_preset->get("images/splash_screen").is_zero() ? nullptr : Object::cast_to<StreamTexture>(((Object *)p_preset->get("images/splash_screen")));
} else {
ERR_PRINT("Unable to load logo");
}
@@ -961,7 +961,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
".scn", // Binary scenes are usually already compressed
".stex", // Streamable textures are usually already compressed
// Trailer for easier processing
- NULL
+ nullptr
};
for (const char **ext = unconditional_compress_ext; *ext; ++ext) {
@@ -1251,7 +1251,7 @@ public:
AppxPackager packager;
packager.init(fa_pack);
- FileAccess *src_f = NULL;
+ FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
if (ep.step("Creating package...", 0)) {
@@ -1283,7 +1283,7 @@ public:
// get file name
unz_file_info info;
char fname[16834];
- ret = unzGetCurrentFileInfo(pkg, &info, fname, 16834, NULL, 0, NULL, 0);
+ ret = unzGetCurrentFileInfo(pkg, &info, fname, 16834, nullptr, 0, nullptr, 0);
String path = fname;
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 85719d13ae..f5e989b370 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -180,7 +180,7 @@ void OS_UWP::screen_size_changed() {
Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
- main_loop = NULL;
+ main_loop = nullptr;
outside = true;
// FIXME: Hardcoded for now, add Vulkan support.
@@ -193,7 +193,7 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (gl_context->initialize() != OK) {
memdelete(gl_context);
- gl_context = NULL;
+ gl_context = nullptr;
gl_initialization_error = true;
}
@@ -333,7 +333,7 @@ void OS_UWP::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_UWP::set_main_loop(MainLoop *p_main_loop) {
@@ -347,7 +347,7 @@ void OS_UWP::finalize() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
rendering_server->finish();
memdelete(rendering_server);
@@ -773,9 +773,9 @@ void OS_UWP::hide_virtual_keyboard() {
static String format_error_message(DWORD id) {
- LPWSTR messageBuffer = NULL;
+ LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
+ nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
String msg = "Error " + itos(id) + ": " + String(messageBuffer, size);
@@ -869,14 +869,14 @@ OS_UWP::OS_UWP() {
stdo = fopen("stdout.txt", "wb");
#endif
- gl_context = NULL;
+ gl_context = nullptr;
display_request = ref new Windows::System::Display::DisplayRequest();
managed_object = ref new ManagedType;
managed_object->os = this;
- mouse_mode_changed = CreateEvent(NULL, TRUE, FALSE, L"os_mouse_mode_changed");
+ mouse_mode_changed = CreateEvent(nullptr, TRUE, FALSE, L"os_mouse_mode_changed");
AudioDriverManager::add_driver(&audio_driver);
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index de3b094ef4..ad0efa1d03 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -202,7 +202,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr);
virtual Error kill(const ProcessID &p_pid);
virtual bool has_environment(const String &p_var) const;
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 89ee4dfa7a..daffe59f34 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
import os
from platform_methods import run_in_subprocess
@@ -15,17 +15,17 @@ common_win = [
"joypad_windows.cpp",
"windows_terminal_logger.cpp",
"vulkan_context_win.cpp",
- "context_gl_windows.cpp"
+ "context_gl_windows.cpp",
]
-res_file = 'godot_res.rc'
+res_file = "godot_res.rc"
res_target = "godot_res" + env["OBJSUFFIX"]
res_obj = env.RES(res_target, res_file)
-prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
+prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
-if env['vsproj']:
+if env["vsproj"]:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file]
env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"]
for x in common_win:
diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp
index ad62e3a306..5a36b5546d 100644
--- a/platform/windows/context_gl_windows.cpp
+++ b/platform/windows/context_gl_windows.cpp
@@ -52,7 +52,7 @@ typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int
void ContextGL_Windows::release_current() {
- wglMakeCurrent(hDC, NULL);
+ wglMakeCurrent(hDC, nullptr);
}
void ContextGL_Windows::make_current() {
@@ -185,10 +185,10 @@ Error ContextGL_Windows::initialize() {
0
}; //zero indicates the end of the array
- PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method
+ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = nullptr; //pointer to the method
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
- if (wglCreateContextAttribsARB == NULL) //OpenGL 3.0 is not supported
+ if (wglCreateContextAttribsARB == nullptr) //OpenGL 3.0 is not supported
{
wglDeleteContext(hRC);
return ERR_CANT_CREATE;
@@ -199,7 +199,7 @@ Error ContextGL_Windows::initialize() {
wglDeleteContext(hRC);
return ERR_CANT_CREATE; // Return false
}
- wglMakeCurrent(hDC, NULL);
+ wglMakeCurrent(hDC, nullptr);
wglDeleteContext(hRC);
hRC = new_hRC;
diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp
index 6145751e00..1d9eba22d8 100644
--- a/platform/windows/crash_handler_windows.cpp
+++ b/platform/windows/crash_handler_windows.cpp
@@ -121,7 +121,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
DWORD cbNeeded;
std::vector<HMODULE> module_handles(1);
- if (OS::get_singleton() == NULL || OS::get_singleton()->is_disable_crash_handler() || IsDebuggerPresent()) {
+ if (OS::get_singleton() == nullptr || OS::get_singleton()->is_disable_crash_handler() || IsDebuggerPresent()) {
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -131,7 +131,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_CRASH);
// Load the symbols:
- if (!SymInitialize(process, NULL, false))
+ if (!SymInitialize(process, nullptr, false))
return EXCEPTION_CONTINUE_SEARCH;
SymSetOptions(SymGetOptions() | SYMOPT_LOAD_LINES | SYMOPT_UNDNAME);
@@ -193,7 +193,7 @@ DWORD CrashHandlerException(EXCEPTION_POINTERS *ep) {
n++;
}
- if (!StackWalk64(image_type, process, hThread, &frame, context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
+ if (!StackWalk64(image_type, process, hThread, &frame, context, nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr))
break;
} while (frame.AddrReturn.Offset != 0 && n < 256);
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index cc859c0339..9f79e92dcb 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -14,10 +14,10 @@ def get_name():
def can_build():
- if (os.name == "nt"):
+ if os.name == "nt":
# Building natively on Windows
# If VCINSTALLDIR is set in the OS environ, use traditional Godot logic to set up MSVC
- if (os.getenv("VCINSTALLDIR")): # MSVC, manual setup
+ if os.getenv("VCINSTALLDIR"): # MSVC, manual setup
return True
# Otherwise, let SCons find MSVC if installed, or else Mingw.
@@ -26,18 +26,18 @@ def can_build():
# null compiler.
return True
- if (os.name == "posix"):
+ if os.name == "posix":
# Cross-compiling with MinGW-w64 (old MinGW32 is not supported)
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if (os.getenv("MINGW32_PREFIX")):
+ if os.getenv("MINGW32_PREFIX"):
mingw32 = os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
+ if os.getenv("MINGW64_PREFIX"):
mingw64 = os.getenv("MINGW64_PREFIX")
test = "gcc --version > /dev/null 2>&1"
- if (os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
+ if os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0:
return True
return False
@@ -48,47 +48,47 @@ def get_opts():
mingw32 = ""
mingw64 = ""
- if (os.name == "posix"):
+ if os.name == "posix":
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if (os.getenv("MINGW32_PREFIX")):
+ if os.getenv("MINGW32_PREFIX"):
mingw32 = os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
+ if os.getenv("MINGW64_PREFIX"):
mingw64 = os.getenv("MINGW64_PREFIX")
return [
- ('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
- ('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
+ ("mingw_prefix_32", "MinGW prefix (Win32)", mingw32),
+ ("mingw_prefix_64", "MinGW prefix (Win64)", mingw64),
# Targeted Windows version: 7 (and later), minimum supported version
# 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 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),
- BoolVariable('use_llvm', 'Use the LLVM compiler', False),
- BoolVariable('use_thinlto', 'Use ThinLTO', False),
+ ("target_win_version", "Targeted Windows version, >= 0x0601 (Windows 7)", "0x0601"),
+ 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),
+ BoolVariable("use_llvm", "Use the LLVM compiler", False),
+ BoolVariable("use_thinlto", "Use ThinLTO", False),
]
def get_flags():
- return [
- ]
+ return []
def build_res_file(target, source, env):
- if (env["bits"] == "32"):
- cmdbase = env['mingw_prefix_32']
+ if env["bits"] == "32":
+ cmdbase = env["mingw_prefix_32"]
else:
- cmdbase = env['mingw_prefix_64']
- cmdbase = cmdbase + 'windres --include-dir . '
+ cmdbase = env["mingw_prefix_64"]
+ cmdbase = cmdbase + "windres --include-dir . "
import subprocess
+
for x in range(len(source)):
- cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
+ cmd = cmdbase + "-i " + str(source[x]) + " -o " + str(target[x])
try:
out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]):
@@ -100,12 +100,14 @@ def build_res_file(target, source, env):
def setup_msvc_manual(env):
"""Set up env to use MSVC manually, using VCINSTALLDIR"""
- if (env["bits"] != "default"):
- print("""
+ 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
@@ -114,18 +116,21 @@ def setup_msvc_manual(env):
env["x86_libtheora_opt_vc"] = True
# find compiler manually
- compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+ 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"):
+ 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"):
+ 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.")
+ 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"""
@@ -138,103 +143,127 @@ def setup_msvc_auto(env):
# (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
+ 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'
+ 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["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"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Append(CCFLAGS=['/O2'])
- else: # optimize for size
- env.Append(CCFLAGS=['/O1'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
- env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
- env.Append(LINKFLAGS=['/OPT:REF'])
-
- elif (env["target"] == "release_debug"):
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Append(CCFLAGS=['/O2'])
- else: # optimize for size
- env.Append(CCFLAGS=['/O1'])
- env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- env.Append(LINKFLAGS=['/OPT:REF'])
-
- 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'])
-
- if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes"):
- env.AppendUnique(CCFLAGS=['/Z7'])
- env.AppendUnique(LINKFLAGS=['/DEBUG'])
+ if env["target"] == "release":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Append(CCFLAGS=["/O2"])
+ else: # optimize for size
+ env.Append(CCFLAGS=["/O1"])
+ env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
+ env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])
+ env.Append(LINKFLAGS=["/OPT:REF"])
+
+ elif env["target"] == "release_debug":
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Append(CCFLAGS=["/O2"])
+ else: # optimize for size
+ env.Append(CCFLAGS=["/O1"])
+ env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"])
+ env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
+ env.Append(LINKFLAGS=["/OPT:REF"])
+
+ 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"])
+
+ if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes":
+ env.AppendUnique(CCFLAGS=["/Z7"])
+ env.AppendUnique(LINKFLAGS=["/DEBUG"])
## Compile/link flags
- env.AppendUnique(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
- if int(env['MSVC_VERSION'].split('.')[0]) >= 14: #vs2015 and later
- env.AppendUnique(CCFLAGS=['/utf-8'])
- env.AppendUnique(CXXFLAGS=['/TP']) # assume all sources are C++
- if manual_msvc_config: # should be automatic if SCons found it
+ env.AppendUnique(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"])
+ if int(env["MSVC_VERSION"].split(".")[0]) >= 14: # vs2015 and later
+ env.AppendUnique(CCFLAGS=["/utf-8"])
+ 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.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
else:
print("Missing environment variable: WindowsSdkDir")
- env.AppendUnique(CPPDEFINES = ['WINDOWS_ENABLED',
- 'WASAPI_ENABLED', 'WINMIDI_ENABLED',
- 'TYPED_METHOD_BIND',
- 'WIN32', 'MSVC',
- 'WINVER=%s' % env["target_win_version"],
- '_WIN32_WINNT=%s' % env["target_win_version"]])
- env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros
+ env.AppendUnique(
+ CPPDEFINES=[
+ "WINDOWS_ENABLED",
+ "WASAPI_ENABLED",
+ "WINMIDI_ENABLED",
+ "TYPED_METHOD_BIND",
+ "WIN32",
+ "MSVC",
+ "WINVER=%s" % env["target_win_version"],
+ "_WIN32_WINNT=%s" % env["target_win_version"],
+ ]
+ )
+ env.AppendUnique(CPPDEFINES=["NOMINMAX"]) # disable bogus min/max WinDef.h macros
if env["bits"] == "64":
- env.AppendUnique(CPPDEFINES=['_WIN64'])
+ env.AppendUnique(CPPDEFINES=["_WIN64"])
## Libs
- LIBS = ['winmm', 'dsound', 'kernel32', 'ole32', 'oleaut32',
- 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32',
- 'shell32', 'advapi32', 'dinput8', 'dxguid', 'imm32', 'bcrypt', 'Avrt',
- 'dwmapi']
+ LIBS = [
+ "winmm",
+ "dsound",
+ "kernel32",
+ "ole32",
+ "oleaut32",
+ "user32",
+ "gdi32",
+ "IPHLPAPI",
+ "Shlwapi",
+ "wsock32",
+ "Ws2_32",
+ "shell32",
+ "advapi32",
+ "dinput8",
+ "dxguid",
+ "imm32",
+ "bcrypt",
+ "Avrt",
+ "dwmapi",
+ ]
- env.AppendUnique(CPPDEFINES=['VULKAN_ENABLED'])
- if not env['builtin_vulkan']:
- LIBS += ['vulkan']
+ env.AppendUnique(CPPDEFINES=["VULKAN_ENABLED"])
+ if not env["builtin_vulkan"]:
+ LIBS += ["vulkan"]
else:
- LIBS += ['cfgmgr32']
+ LIBS += ["cfgmgr32"]
- #env.AppendUnique(CPPDEFINES = ['OPENGL_ENABLED'])
- LIBS += ['opengl32']
+ # env.AppendUnique(CPPDEFINES = ['OPENGL_ENABLED'])
+ LIBS += ["opengl32"]
env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
@@ -246,23 +275,24 @@ def configure_msvc(env, manual_msvc_config):
## LTO
- if (env["use_lto"]):
- env.AppendUnique(CCFLAGS=['/GL'])
- env.AppendUnique(ARFLAGS=['/LTCG'])
+ if env["use_lto"]:
+ env.AppendUnique(CCFLAGS=["/GL"])
+ env.AppendUnique(ARFLAGS=["/LTCG"])
if env["progress"]:
- env.AppendUnique(LINKFLAGS=['/LTCG:STATUS'])
+ env.AppendUnique(LINKFLAGS=["/LTCG:STATUS"])
else:
- env.AppendUnique(LINKFLAGS=['/LTCG'])
+ env.AppendUnique(LINKFLAGS=["/LTCG"])
if manual_msvc_config:
env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
# Incremental linking fix
- env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
- env['BUILDERS']['Program'] = methods.precious_program
+ env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
+ env["BUILDERS"]["Program"] = methods.precious_program
+
+ env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
- env.AppendUnique(LINKFLAGS=['/STACK:' + str(STACK_SIZE)])
def configure_mingw(env):
# Workaround for MinGW. See:
@@ -271,125 +301,148 @@ def configure_mingw(env):
## Build type
- if (env["target"] == "release"):
- env.Append(CCFLAGS=['-msse2'])
+ if env["target"] == "release":
+ env.Append(CCFLAGS=["-msse2"])
- if (env["optimize"] == "speed"): #optimize for speed (default)
- if (env["bits"] == "64"):
- env.Append(CCFLAGS=['-O3'])
+ if env["optimize"] == "speed": # optimize for speed (default)
+ if env["bits"] == "64":
+ env.Append(CCFLAGS=["-O3"])
else:
- env.Append(CCFLAGS=['-O2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
-
-
- env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
-
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
-
- elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2'])
- env.Append(CPPDEFINES=['DEBUG_ENABLED'])
- if (env["debug_symbols"] == "yes"):
- env.Prepend(CCFLAGS=['-g1'])
- if (env["debug_symbols"] == "full"):
- env.Prepend(CCFLAGS=['-g2'])
- if (env["optimize"] == "speed"): #optimize for speed (default)
- env.Append(CCFLAGS=['-O2'])
- else: #optimize for size
- env.Prepend(CCFLAGS=['-Os'])
-
- elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g3'])
- env.Append(CPPDEFINES=['DEBUG_ENABLED', 'DEBUG_MEMORY_ENABLED'])
+ env.Append(CCFLAGS=["-O2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+
+ env.Append(LINKFLAGS=["-Wl,--subsystem,windows"])
+
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+
+ elif env["target"] == "release_debug":
+ env.Append(CCFLAGS=["-O2"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
+ if env["debug_symbols"] == "yes":
+ env.Prepend(CCFLAGS=["-g1"])
+ if env["debug_symbols"] == "full":
+ env.Prepend(CCFLAGS=["-g2"])
+ if env["optimize"] == "speed": # optimize for speed (default)
+ env.Append(CCFLAGS=["-O2"])
+ else: # optimize for size
+ env.Prepend(CCFLAGS=["-Os"])
+
+ elif env["target"] == "debug":
+ env.Append(CCFLAGS=["-g3"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
## Compiler configuration
if os.name != "nt":
env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
- if (env["bits"] == "default"):
- if (os.name == "nt"):
+ 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
+ else: # default to 64-bit on Linux
env["bits"] = "64"
mingw_prefix = ""
- if (env["bits"] == "32"):
- env.Append(LINKFLAGS=['-static'])
- env.Append(LINKFLAGS=['-static-libgcc'])
- env.Append(LINKFLAGS=['-static-libstdc++'])
+ 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'])
+ env.Append(LINKFLAGS=["-static"])
mingw_prefix = env["mingw_prefix_64"]
- if env['use_llvm']:
+ if env["use_llvm"]:
env["CC"] = mingw_prefix + "clang"
- env['AS'] = mingw_prefix + "as"
+ env["AS"] = mingw_prefix + "as"
env["CXX"] = mingw_prefix + "clang++"
- env['AR'] = mingw_prefix + "ar"
- env['RANLIB'] = mingw_prefix + "ranlib"
+ env["AR"] = mingw_prefix + "ar"
+ env["RANLIB"] = mingw_prefix + "ranlib"
env["LINK"] = mingw_prefix + "clang++"
else:
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["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
- if env['use_lto']:
- if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ if env["use_lto"]:
+ if not env["use_llvm"] and env.GetOption("num_jobs") > 1:
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto=" + str(env.GetOption("num_jobs"))])
else:
- if env['use_thinlto']:
- env.Append(CCFLAGS=['-flto=thin'])
- env.Append(LINKFLAGS=['-flto=thin'])
+ if env["use_thinlto"]:
+ env.Append(CCFLAGS=["-flto=thin"])
+ env.Append(LINKFLAGS=["-flto=thin"])
else:
- env.Append(CCFLAGS=['-flto'])
- env.Append(LINKFLAGS=['-flto'])
+ env.Append(CCFLAGS=["-flto"])
+ env.Append(LINKFLAGS=["-flto"])
- env.Append(LINKFLAGS=['-Wl,--stack,' + str(STACK_SIZE)])
+ env.Append(LINKFLAGS=["-Wl,--stack," + str(STACK_SIZE)])
## Compile flags
- env.Append(CCFLAGS=['-mwindows'])
-
- env.Append(CPPDEFINES=['WINDOWS_ENABLED', 'WASAPI_ENABLED', 'WINMIDI_ENABLED'])
- env.Append(CPPDEFINES=[('WINVER', env['target_win_version']), ('_WIN32_WINNT', env['target_win_version'])])
- env.Append(LIBS=['mingw32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt', 'avrt', 'uuid', 'dwmapi'])
-
- env.Append(CPPDEFINES=['VULKAN_ENABLED'])
- if not env['builtin_vulkan']:
- env.Append(LIBS=['vulkan'])
+ env.Append(CCFLAGS=["-mwindows"])
+
+ env.Append(CPPDEFINES=["WINDOWS_ENABLED", "WASAPI_ENABLED", "WINMIDI_ENABLED"])
+ env.Append(CPPDEFINES=[("WINVER", env["target_win_version"]), ("_WIN32_WINNT", env["target_win_version"])])
+ env.Append(
+ LIBS=[
+ "mingw32",
+ "dsound",
+ "ole32",
+ "d3d9",
+ "winmm",
+ "gdi32",
+ "iphlpapi",
+ "shlwapi",
+ "wsock32",
+ "ws2_32",
+ "kernel32",
+ "oleaut32",
+ "dinput8",
+ "dxguid",
+ "ksuser",
+ "imm32",
+ "bcrypt",
+ "avrt",
+ "uuid",
+ "dwmapi",
+ ]
+ )
+
+ env.Append(CPPDEFINES=["VULKAN_ENABLED"])
+ if not env["builtin_vulkan"]:
+ env.Append(LIBS=["vulkan"])
else:
- env.Append(LIBS=['cfgmgr32'])
+ env.Append(LIBS=["cfgmgr32"])
## TODO !!! Reenable when OpenGLES Rendering Device is implemented !!!
- #env.Append(CPPDEFINES=['OPENGL_ENABLED'])
- env.Append(LIBS=['opengl32'])
+ # env.Append(CPPDEFINES=['OPENGL_ENABLED'])
+ env.Append(LIBS=["opengl32"])
- env.Append(CPPDEFINES=['MINGW_ENABLED', ('MINGW_HAS_SECURE_API', 1)])
+ env.Append(CPPDEFINES=["MINGW_ENABLED", ("MINGW_HAS_SECURE_API", 1)])
# resrc
- env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
+ env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})
+
def configure(env):
# At this point the env has been set up with basic tools/compilers.
- env.Prepend(CPPPATH=['#platform/windows'])
+ env.Prepend(CPPPATH=["#platform/windows"])
- print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
+ print("Configuring for Windows: target=%s, bits=%s" % (env["target"], env["bits"]))
- if (os.name == "nt"):
- env['ENV'] = os.environ # this makes build less repeatable, but simplifies some things
- env['ENV']['TMP'] = os.environ['TMP']
+ if os.name == "nt":
+ env["ENV"] = os.environ # this makes build less repeatable, but simplifies some things
+ env["ENV"]["TMP"] = os.environ["TMP"]
# First figure out which compiler, version, and target arch we're using
if os.getenv("VCINSTALLDIR") and not env["use_mingw"]:
@@ -397,7 +450,7 @@ def configure(env):
setup_msvc_manual(env)
env.msvc = True
manual_msvc_config = True
- elif env.get('MSVC_VERSION', '') and not env["use_mingw"]:
+ elif env.get("MSVC_VERSION", "") and not env["use_mingw"]:
setup_msvc_auto(env)
env.msvc = True
manual_msvc_config = False
@@ -409,5 +462,5 @@ def configure(env):
if env.msvc:
configure_msvc(env, manual_msvc_config)
- else: # MinGW
+ else: # MinGW
configure_mingw(env)
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 836fa5946a..01a99df6b4 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -43,9 +43,9 @@
#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
- LPWSTR messageBuffer = NULL;
+ LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
+ nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
String msg = "Error " + itos(id) + ": " + String(messageBuffer, size);
@@ -83,7 +83,7 @@ String DisplayServerWindows::get_name() const {
}
void DisplayServerWindows::alert(const String &p_alert, const String &p_title) {
- MessageBoxW(NULL, p_alert.c_str(), p_title.c_str(), MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
+ MessageBoxW(nullptr, p_alert.c_str(), p_title.c_str(), MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
}
void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
@@ -106,11 +106,11 @@ void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
}
} else {
ReleaseCapture();
- ClipCursor(NULL);
+ ClipCursor(nullptr);
}
if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_HIDDEN) {
- hCursor = SetCursor(NULL);
+ hCursor = SetCursor(nullptr);
} else {
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
@@ -182,7 +182,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
EmptyClipboard();
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE, (text.length() + 1) * sizeof(CharType));
- ERR_FAIL_COND_MSG(mem == NULL, "Unable to allocate memory for clipboard contents.");
+ ERR_FAIL_COND_MSG(mem == nullptr, "Unable to allocate memory for clipboard contents.");
LPWSTR lptstrCopy = (LPWSTR)GlobalLock(mem);
memcpy(lptstrCopy, text.c_str(), (text.length() + 1) * sizeof(CharType));
@@ -193,7 +193,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
// set the CF_TEXT version (not needed?)
CharString utf8 = text.utf8();
mem = GlobalAlloc(GMEM_MOVEABLE, utf8.length() + 1);
- ERR_FAIL_COND_MSG(mem == NULL, "Unable to allocate memory for clipboard contents.");
+ ERR_FAIL_COND_MSG(mem == nullptr, "Unable to allocate memory for clipboard contents.");
LPTSTR ptr = (LPTSTR)GlobalLock(mem);
memcpy(ptr, utf8.get_data(), utf8.length());
@@ -220,10 +220,10 @@ String DisplayServerWindows::clipboard_get() const {
if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
- if (mem != NULL) {
+ if (mem != nullptr) {
LPWSTR ptr = (LPWSTR)GlobalLock(mem);
- if (ptr != NULL) {
+ if (ptr != nullptr) {
ret = String((CharType *)ptr);
GlobalUnlock(mem);
@@ -233,10 +233,10 @@ String DisplayServerWindows::clipboard_get() const {
} else if (IsClipboardFormatAvailable(CF_TEXT)) {
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
- if (mem != NULL) {
+ if (mem != nullptr) {
LPTSTR ptr = (LPTSTR)GlobalLock(mem);
- if (ptr != NULL) {
+ if (ptr != nullptr) {
ret.parse_utf8((const char *)ptr);
GlobalUnlock(mem);
@@ -277,7 +277,7 @@ int DisplayServerWindows::get_screen_count() const {
_THREAD_SAFE_METHOD_
int data = 0;
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcCount, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcCount, (LPARAM)&data);
return data;
}
@@ -303,7 +303,7 @@ Point2i DisplayServerWindows::screen_get_position(int p_screen) const {
_THREAD_SAFE_METHOD_
EnumPosData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Point2() };
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcPos, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcPos, (LPARAM)&data);
return data.pos;
}
@@ -336,7 +336,7 @@ Size2i DisplayServerWindows::screen_get_size(int p_screen) const {
_THREAD_SAFE_METHOD_
EnumSizeData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Size2() };
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcSize, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcSize, (LPARAM)&data);
return data.size;
}
@@ -364,7 +364,7 @@ Rect2i DisplayServerWindows::screen_get_usable_rect(int p_screen) const {
_THREAD_SAFE_METHOD_
EnumRectData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, Rect2i() };
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcUsableSize, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcUsableSize, (LPARAM)&data);
return data.rect;
}
@@ -385,15 +385,15 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
int dpiX = 96, dpiY = 96;
- static HMODULE Shcore = NULL;
+ static HMODULE Shcore = nullptr;
typedef HRESULT(WINAPI * GetDPIForMonitor_t)(HMONITOR hmonitor, _MonitorDpiType dpiType, UINT * dpiX, UINT * dpiY);
- static GetDPIForMonitor_t getDPIForMonitor = NULL;
+ static GetDPIForMonitor_t getDPIForMonitor = nullptr;
- if (Shcore == NULL) {
+ if (Shcore == nullptr) {
Shcore = LoadLibraryW(L"Shcore.dll");
- getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : NULL;
+ getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : nullptr;
- if ((Shcore == NULL) || (getDPIForMonitor == NULL)) {
+ if ((Shcore == nullptr) || (getDPIForMonitor == nullptr)) {
if (Shcore)
FreeLibrary(Shcore);
Shcore = (HMODULE)INVALID_HANDLE_VALUE;
@@ -412,11 +412,11 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
} else {
static int overallX = 0, overallY = 0;
if (overallX <= 0 || overallY <= 0) {
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
if (hdc) {
overallX = GetDeviceCaps(hdc, LOGPIXELSX);
overallY = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
}
}
if (overallX > 0 && overallY > 0) {
@@ -443,7 +443,7 @@ int DisplayServerWindows::screen_get_dpi(int p_screen) const {
_THREAD_SAFE_METHOD_
EnumDpiData data = { 0, p_screen == SCREEN_OF_MAIN_WINDOW ? window_get_current_screen() : p_screen, 72 };
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcDpi, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcDpi, (LPARAM)&data);
return data.dpi;
}
bool DisplayServerWindows::screen_is_touchscreen(int p_screen) const {
@@ -618,7 +618,7 @@ int DisplayServerWindows::window_get_current_screen(WindowID p_window) const {
ERR_FAIL_COND_V(!windows.has(p_window), -1);
EnumScreenData data = { 0, 0, MonitorFromWindow(windows[p_window].hWnd, MONITOR_DEFAULTTONEAREST) };
- EnumDisplayMonitors(NULL, NULL, _MonitorEnumProcScreen, (LPARAM)&data);
+ EnumDisplayMonitors(nullptr, nullptr, _MonitorEnumProcScreen, (LPARAM)&data);
return data.screen;
}
void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_window) {
@@ -734,7 +734,7 @@ void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_pa
wd_window.transient_parent = INVALID_WINDOW_ID;
wd_parent.transient_children.erase(p_window);
- SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, NULL);
+ SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, 0L);
} else {
ERR_FAIL_COND(!windows.has(p_parent));
ERR_FAIL_COND_MSG(wd_window.transient_parent != INVALID_WINDOW_ID, "Window already has a transient parent");
@@ -1019,7 +1019,8 @@ bool DisplayServerWindows::window_is_maximize_allowed(WindowID p_window) const {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(!windows.has(p_window), false);
- const WindowData &wd = windows[p_window];
+
+ // FIXME: Implement this, or confirm that it should always be true.
return true; //no idea
}
@@ -1049,14 +1050,17 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
} break;
case WINDOW_FLAG_TRANSPARENT: {
+ // FIXME: Implement.
} break;
case WINDOW_FLAG_NO_FOCUS: {
wd.no_focus = p_enabled;
_update_window_style(p_window);
} break;
+ case WINDOW_FLAG_MAX: break;
}
}
+
bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window) const {
_THREAD_SAFE_METHOD_
@@ -1078,7 +1082,13 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window
} break;
case WINDOW_FLAG_TRANSPARENT: {
+ // FIXME: Implement.
+ } break;
+ case WINDOW_FLAG_NO_FOCUS: {
+
+ return wd.no_focus;
} break;
+ case WINDOW_FLAG_MAX: break;
}
return false;
@@ -1214,7 +1224,7 @@ void DisplayServerWindows::cursor_set_shape(CursorShape p_shape) {
IDC_HELP
};
- if (cursors[p_shape] != NULL) {
+ if (cursors[p_shape] != nullptr) {
SetCursor(cursors[p_shape]);
} else {
SetCursor(LoadCursor(hInstance, win_cursors[p_shape]));
@@ -1229,7 +1239,7 @@ DisplayServer::CursorShape DisplayServerWindows::cursor_get_shape() const {
void DisplayServerWindows::GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTransparent, OUT HBITMAP &hAndMaskBitmap, OUT HBITMAP &hXorMaskBitmap) {
// Get the system display DC
- HDC hDC = GetDC(NULL);
+ HDC hDC = GetDC(nullptr);
// Create helper DC
HDC hMainDC = CreateCompatibleDC(hDC);
@@ -1245,7 +1255,7 @@ void DisplayServerWindows::GetMaskBitmaps(HBITMAP hSourceBitmap, COLORREF clrTra
hXorMaskBitmap = CreateCompatibleBitmap(hDC, bm.bmWidth, bm.bmHeight); // color
// Release the system display DC
- ReleaseDC(NULL, hDC);
+ ReleaseDC(nullptr, hDC);
// Select the bitmaps to helper DC
HBITMAP hOldMainBitmap = (HBITMAP)SelectObject(hMainDC, hSourceBitmap);
@@ -1349,12 +1359,12 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
COLORREF clrTransparent = -1;
// Create the AND and XOR masks for the bitmap
- HBITMAP hAndMask = NULL;
- HBITMAP hXorMask = NULL;
+ HBITMAP hAndMask = nullptr;
+ HBITMAP hXorMask = nullptr;
GetMaskBitmaps(bitmap, clrTransparent, hAndMask, hXorMask);
- if (NULL == hAndMask || NULL == hXorMask) {
+ if (NULL == hAndMask || nullptr == hXorMask) {
memfree(buffer);
DeleteObject(bitmap);
return;
@@ -1384,11 +1394,11 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
}
}
- if (hAndMask != NULL) {
+ if (hAndMask != nullptr) {
DeleteObject(hAndMask);
}
- if (hXorMask != NULL) {
+ if (hXorMask != nullptr) {
DeleteObject(hXorMask);
}
@@ -1398,7 +1408,7 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
// Reset to default system cursor
if (cursors[p_shape]) {
DestroyIcon(cursors[p_shape]);
- cursors[p_shape] = NULL;
+ cursors[p_shape] = nullptr;
}
CursorShape c = cursor_shape;
@@ -1460,7 +1470,7 @@ DisplayServer::LatinKeyboardVariant DisplayServerWindows::get_latin_keyboard_var
name[0] = 0;
GetKeyboardLayoutNameA(name);
- unsigned long hex = strtoul(name, NULL, 16);
+ unsigned long hex = strtoul(name, nullptr, 16);
int i = 0;
while (azerty[i] != 0) {
@@ -1493,7 +1503,7 @@ void DisplayServerWindows::process_events() {
joypad->process_joypads();
}
- while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
+ while (PeekMessageW(&msg, nullptr, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessageW(&msg);
@@ -1882,7 +1892,6 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
_send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST);
- //force_quit=true;
return 0; // Jump Back
}
case WM_MOUSELEAVE: {
@@ -1900,9 +1909,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
UINT dwSize;
- GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER));
+ GetRawInputData((HRAWINPUT)lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER));
LPBYTE lpb = new BYTE[dwSize];
- if (lpb == NULL) {
+ if (lpb == nullptr) {
return 0;
}
@@ -2425,7 +2434,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
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);
+ hBitmap = CreateDIBSection(hDC_dib, &bmi, DIB_RGB_COLORS, (void **)&dib_data, nullptr, 0x0);
SelectObject(hDC_dib, hBitmap);
ZeroMemory(dib_data, dib_size.x * dib_size.y * 4);
@@ -2551,16 +2560,16 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
if (LOWORD(lParam) == HTCLIENT) {
if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED)) {
//Hide the cursor
- if (hCursor == NULL)
- hCursor = SetCursor(NULL);
+ if (hCursor == nullptr)
+ hCursor = SetCursor(nullptr);
else
- SetCursor(NULL);
+ SetCursor(nullptr);
} else {
- if (hCursor != NULL) {
+ if (hCursor != nullptr) {
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
cursor_set_shape(c);
- hCursor = NULL;
+ hCursor = nullptr;
}
}
}
@@ -2572,7 +2581,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
const int buffsize = 4096;
wchar_t buf[buffsize];
- int fcount = DragQueryFileW(hDropInfo, 0xFFFFFFFF, NULL, 0);
+ int fcount = DragQueryFileW(hDropInfo, 0xFFFFFFFF, nullptr, 0);
Vector<String> files;
@@ -2723,9 +2732,9 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
WindowRect.top,
WindowRect.right - WindowRect.left,
WindowRect.bottom - WindowRect.top,
- NULL, NULL, hInstance, NULL);
+ nullptr, nullptr, hInstance, nullptr);
if (!wd.hWnd) {
- MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
+ MessageBoxW(nullptr, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
return INVALID_WINDOW_ID;
}
#ifdef VULKAN_ENABLED
@@ -2733,7 +2742,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
if (rendering_driver == "vulkan") {
if (context_vulkan->window_create(id, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) == -1) {
memdelete(context_vulkan);
- context_vulkan = NULL;
+ context_vulkan = nullptr;
ERR_FAIL_V(INVALID_WINDOW_ID);
}
}
@@ -2805,7 +2814,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (OS::get_singleton()->is_hidpi_allowed()) {
HMODULE Shcore = LoadLibraryW(L"Shcore.dll");
- if (Shcore != NULL) {
+ if (Shcore != nullptr) {
typedef HRESULT(WINAPI * SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
@@ -2823,15 +2832,15 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
//wc.hInstance = hInstance;
- wc.hInstance = hInstance ? hInstance : GetModuleHandle(NULL);
- wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
- wc.hCursor = NULL; //LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
+ wc.hInstance = hInstance ? hInstance : GetModuleHandle(nullptr);
+ wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
+ wc.hCursor = nullptr; //LoadCursor(nullptr, IDC_ARROW);
+ wc.hbrBackground = nullptr;
+ wc.lpszMenuName = nullptr;
wc.lpszClassName = L"Engine";
if (!RegisterClassExW(&wc)) {
- MessageBox(NULL, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
+ MessageBox(nullptr, "Failed To Register The Window Class.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
r_error = ERR_UNAVAILABLE;
return;
}
@@ -2858,7 +2867,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
context_vulkan = memnew(VulkanContextWindows);
if (context_vulkan->initialize() != OK) {
memdelete(context_vulkan);
- context_vulkan = NULL;
+ context_vulkan = nullptr;
r_error = ERR_UNAVAILABLE;
return;
}
@@ -2871,7 +2880,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (context_gles2->initialize() != OK) {
memdelete(context_gles2);
- context_gles2 = NULL;
+ context_gles2 = nullptr;
ERR_FAIL_V(ERR_UNAVAILABLE);
}
@@ -2883,7 +2892,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
RasterizerGLES2::make_current();
} else {
memdelete(context_gles2);
- context_gles2 = NULL;
+ context_gles2 = nullptr;
ERR_FAIL_V(ERR_UNAVAILABLE);
}
}
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index e2c2fd7253..5cd240ffb0 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -266,7 +266,6 @@ class DisplayServerWindows : public DisplayServer {
bool shift_mem = false;
bool control_mem = false;
bool meta_mem = false;
- bool force_quit = false;
uint32_t last_button_state = 0;
bool use_raw_input = false;
bool drop_events = false;
@@ -274,7 +273,7 @@ class DisplayServerWindows : public DisplayServer {
WNDCLASSEXW wc;
- HCURSOR cursors[CURSOR_MAX] = { NULL };
+ HCURSOR cursors[CURSOR_MAX] = { nullptr };
CursorShape cursor_shape;
Map<CursorShape, Vector<Variant>> cursors_cache;
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 78a3fc8f79..d63067587c 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -315,7 +315,7 @@ Error EditorExportPlatformWindows::_code_sign(const Ref<EditorExportPreset> &p_p
#endif
String str;
- Error err = OS::get_singleton()->execute(signtool_path, args, true, NULL, &str, NULL, true);
+ Error err = OS::get_singleton()->execute(signtool_path, args, true, nullptr, &str, nullptr, true);
ERR_FAIL_COND_V(err != OK, err);
print_line("codesign (" + p_path + "): " + str);
diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp
index dcc12b7649..28884f70d2 100644
--- a/platform/windows/godot_windows.cpp
+++ b/platform/windows/godot_windows.cpp
@@ -121,23 +121,23 @@ CommandLineToArgvA(
i++;
}
_argv[j] = '\0';
- argv[argc] = NULL;
+ argv[argc] = nullptr;
(*_argc) = argc;
return argv;
}
char *wc_to_utf8(const wchar_t *wc) {
- int ulen = WideCharToMultiByte(CP_UTF8, 0, wc, -1, NULL, 0, NULL, NULL);
+ int ulen = WideCharToMultiByte(CP_UTF8, 0, wc, -1, nullptr, 0, nullptr, nullptr);
char *ubuf = new char[ulen + 1];
- WideCharToMultiByte(CP_UTF8, 0, wc, -1, ubuf, ulen, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, wc, -1, ubuf, ulen, nullptr, nullptr);
ubuf[ulen] = 0;
return ubuf;
}
int widechar_main(int argc, wchar_t **argv) {
- OS_Windows os(NULL);
+ OS_Windows os(nullptr);
setlocale(LC_CTYPE, "");
@@ -202,9 +202,9 @@ int main(int _argc, char **_argv) {
#endif
}
-HINSTANCE godot_hinstance = NULL;
+HINSTANCE godot_hinstance = nullptr;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
godot_hinstance = hInstance;
- return main(0, NULL);
+ return main(0, nullptr);
}
diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp
index 9de1b7b194..437c3b733d 100644
--- a/platform/windows/joypad_windows.cpp
+++ b/platform/windows/joypad_windows.cpp
@@ -57,10 +57,10 @@ JoypadWindows::JoypadWindows(HWND *hwnd) {
input = InputFilter::get_singleton();
hWnd = hwnd;
joypad_count = 0;
- dinput = NULL;
- xinput_dll = NULL;
- xinput_get_state = NULL;
- xinput_set_state = NULL;
+ dinput = nullptr;
+ xinput_dll = nullptr;
+ xinput_get_state = nullptr;
+ xinput_set_state = nullptr;
load_xinput();
@@ -68,7 +68,7 @@ JoypadWindows::JoypadWindows(HWND *hwnd) {
attached_joypads[i] = false;
HRESULT result;
- result = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&dinput, NULL);
+ result = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, (void **)&dinput, nullptr);
if (FAILED(result)) {
printf("failed init DINPUT: %ld\n", result);
}
@@ -105,10 +105,10 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
if (p_guid == &IID_ValveStreamingGamepad || p_guid == &IID_X360WiredGamepad || p_guid == &IID_X360WirelessGamepad)
return true;
- PRAWINPUTDEVICELIST dev_list = NULL;
+ PRAWINPUTDEVICELIST dev_list = nullptr;
unsigned int dev_list_count = 0;
- if (GetRawInputDeviceList(NULL, &dev_list_count, sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) {
+ if (GetRawInputDeviceList(nullptr, &dev_list_count, sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) {
return false;
}
dev_list = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * dev_list_count);
@@ -130,7 +130,7 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
(GetRawInputDeviceInfoA(dev_list[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != (UINT)-1) &&
(MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == (LONG)p_guid->Data1) &&
(GetRawInputDeviceInfoA(dev_list[i].hDevice, RIDI_DEVICENAME, &dev_name, &nameSize) != (UINT)-1) &&
- (strstr(dev_name, "IG_") != NULL)) {
+ (strstr(dev_name, "IG_") != nullptr)) {
free(dev_list);
return true;
@@ -157,7 +157,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) {
return false;
}
- hr = dinput->CreateDevice(instance->guidInstance, &joy->di_joy, NULL);
+ hr = dinput->CreateDevice(instance->guidInstance, &joy->di_joy, nullptr);
if (FAILED(hr)) {
return false;
diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h
index f010fd08ff..0db789c335 100644
--- a/platform/windows/joypad_windows.h
+++ b/platform/windows/joypad_windows.h
@@ -39,9 +39,9 @@
#ifndef SAFE_RELEASE // when Windows Media Device M? is not present
#define SAFE_RELEASE(x) \
- if (x != NULL) { \
+ if (x != nullptr) { \
x->Release(); \
- x = NULL; \
+ x = nullptr; \
}
#endif
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 4112135cec..0a67a591b7 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -81,9 +81,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#ifdef DEBUG_ENABLED
static String format_error_message(DWORD id) {
- LPWSTR messageBuffer = NULL;
+ LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
+ nullptr, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, nullptr);
String msg = "Error " + itos(id) + ": " + String(messageBuffer, size);
@@ -129,7 +129,7 @@ void RedirectIOToConsole() {
*stdout = *fp;
- setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stdout, nullptr, _IONBF, 0);
// redirect unbuffered STDIN to the console
@@ -141,7 +141,7 @@ void RedirectIOToConsole() {
*stdin = *fp;
- setvbuf(stdin, NULL, _IONBF, 0);
+ setvbuf(stdin, nullptr, _IONBF, 0);
// redirect unbuffered STDERR to the console
@@ -153,7 +153,7 @@ void RedirectIOToConsole() {
*stderr = *fp;
- setvbuf(stderr, NULL, _IONBF, 0);
+ setvbuf(stderr, nullptr, _IONBF, 0);
// make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog
@@ -213,14 +213,14 @@ void OS_Windows::initialize() {
process_map = memnew((Map<ProcessID, ProcessInfo>));
IP_Unix::make_default();
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_Windows::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_Windows::set_main_loop(MainLoop *p_main_loop) {
@@ -237,7 +237,7 @@ void OS_Windows::finalize() {
if (main_loop)
memdelete(main_loop);
- main_loop = NULL;
+ main_loop = nullptr;
}
void OS_Windows::finalize_core() {
@@ -263,14 +263,14 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han
PAddDllDirectory add_dll_directory = (PAddDllDirectory)GetProcAddress(GetModuleHandle("kernel32.dll"), "AddDllDirectory");
PRemoveDllDirectory remove_dll_directory = (PRemoveDllDirectory)GetProcAddress(GetModuleHandle("kernel32.dll"), "RemoveDllDirectory");
- bool has_dll_directory_api = ((add_dll_directory != NULL) && (remove_dll_directory != NULL));
- DLL_DIRECTORY_COOKIE cookie = NULL;
+ bool has_dll_directory_api = ((add_dll_directory != nullptr) && (remove_dll_directory != nullptr));
+ DLL_DIRECTORY_COOKIE cookie = nullptr;
if (p_also_set_library_path && has_dll_directory_api) {
cookie = add_dll_directory(path.get_base_dir().c_str());
}
- p_library_handle = (void *)LoadLibraryExW(path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
+ p_library_handle = (void *)LoadLibraryExW(path.c_str(), nullptr, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + format_error_message(GetLastError()) + ".");
if (cookie) {
@@ -490,7 +490,7 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
modstr.resize(cmdline.size());
for (int i = 0; i < cmdline.size(); i++)
modstr.write[i] = cmdline[i];
- int ret = CreateProcessW(NULL, modstr.ptrw(), NULL, NULL, 0, NORMAL_PRIORITY_CLASS & CREATE_NO_WINDOW, NULL, NULL, si_w, &pi.pi);
+ int ret = CreateProcessW(nullptr, modstr.ptrw(), nullptr, nullptr, 0, NORMAL_PRIORITY_CLASS & CREATE_NO_WINDOW, nullptr, nullptr, si_w, &pi.pi);
ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK);
if (p_blocking) {
@@ -542,7 +542,7 @@ Error OS_Windows::set_cwd(const String &p_cwd) {
String OS_Windows::get_executable_path() const {
wchar_t bufname[4096];
- GetModuleFileNameW(NULL, bufname, 4096);
+ GetModuleFileNameW(nullptr, bufname, 4096);
String s = bufname;
return s;
}
@@ -550,12 +550,12 @@ String OS_Windows::get_executable_path() const {
bool OS_Windows::has_environment(const String &p_var) const {
#ifdef MINGW_ENABLED
- return _wgetenv(p_var.c_str()) != NULL;
+ return _wgetenv(p_var.c_str()) != nullptr;
#else
wchar_t *env;
size_t len;
_wdupenv_s(&env, &len, p_var.c_str());
- const bool has_env = env != NULL;
+ const bool has_env = env != nullptr;
free(env);
return has_env;
#endif
@@ -588,7 +588,7 @@ String OS_Windows::get_stdin_string(bool p_block) {
Error OS_Windows::shell_open(String p_uri) {
- ShellExecuteW(NULL, NULL, p_uri.c_str(), NULL, NULL, SW_SHOWNORMAL);
+ ShellExecuteW(nullptr, nullptr, p_uri.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
return OK;
}
@@ -739,7 +739,7 @@ String OS_Windows::get_system_dir(SystemDir p_dir) const {
}
PWSTR szPath;
- HRESULT res = SHGetKnownFolderPath(id, 0, NULL, &szPath);
+ HRESULT res = SHGetKnownFolderPath(id, 0, nullptr, &szPath);
ERR_FAIL_COND_V(res != S_OK, String());
String path = String(szPath);
CoTaskMemFree(szPath);
@@ -794,11 +794,11 @@ Error OS_Windows::move_to_trash(const String &p_path) {
sf.hwnd = main_window;
sf.wFunc = FO_DELETE;
sf.pFrom = from;
- sf.pTo = NULL;
+ sf.pTo = nullptr;
sf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION;
sf.fAnyOperationsAborted = FALSE;
- sf.hNameMappings = NULL;
- sf.lpszProgressTitle = NULL;
+ sf.hNameMappings = nullptr;
+ sf.lpszProgressTitle = nullptr;
int ret = SHFileOperationW(&sf);
delete[] from;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 29280eb17c..6bdfc75ebb 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -130,7 +130,7 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr);
virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
diff --git a/platform/windows/platform_windows_builders.py b/platform/windows/platform_windows_builders.py
index a1ad3b8b50..22e33b51b4 100644
--- a/platform/windows/platform_windows_builders.py
+++ b/platform/windows/platform_windows_builders.py
@@ -9,14 +9,14 @@ from platform_methods import subprocess_main
def make_debug_mingw(target, source, env):
mingw_prefix = ""
- if (env["bits"] == "32"):
+ if env["bits"] == "32":
mingw_prefix = env["mingw_prefix_32"]
else:
mingw_prefix = env["mingw_prefix_64"]
- os.system(mingw_prefix + 'objcopy --only-keep-debug {0} {0}.debugsymbols'.format(target[0]))
- os.system(mingw_prefix + 'strip --strip-debug --strip-unneeded {0}'.format(target[0]))
- os.system(mingw_prefix + 'objcopy --add-gnu-debuglink={0}.debugsymbols {0}'.format(target[0]))
+ os.system(mingw_prefix + "objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
+ os.system(mingw_prefix + "strip --strip-debug --strip-unneeded {0}".format(target[0]))
+ os.system(mingw_prefix + "objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
-if __name__ == '__main__':
+if __name__ == "__main__":
subprocess_main(globals())
diff --git a/platform/windows/vulkan_context_win.cpp b/platform/windows/vulkan_context_win.cpp
index 66b5cf8113..98aa21411f 100644
--- a/platform/windows/vulkan_context_win.cpp
+++ b/platform/windows/vulkan_context_win.cpp
@@ -39,13 +39,13 @@ int VulkanContextWindows::window_create(DisplayServer::WindowID p_window_id, HWN
VkWin32SurfaceCreateInfoKHR createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
- createInfo.pNext = NULL;
+ createInfo.pNext = nullptr;
createInfo.flags = 0;
createInfo.hinstance = p_instance;
createInfo.hwnd = p_window;
VkSurfaceKHR surface;
- VkResult err = vkCreateWin32SurfaceKHR(_get_instance(), &createInfo, NULL, &surface);
+ VkResult err = vkCreateWin32SurfaceKHR(_get_instance(), &createInfo, nullptr, &surface);
ERR_FAIL_COND_V(err, -1);
return _window_create(p_window_id, surface, p_width, p_height);
}
diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp
index 520b654b94..884d95e082 100644
--- a/platform/windows/windows_terminal_logger.cpp
+++ b/platform/windows/windows_terminal_logger.cpp
@@ -49,7 +49,7 @@ void WindowsTerminalLogger::logv(const char *p_format, va_list p_list, bool p_er
len = BUFFER_SIZE; // Output is too big, will be truncated
buf[len] = 0;
- int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, NULL, 0);
+ int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, nullptr, 0);
if (wlen < 0)
return;
diff --git a/platform_methods.py b/platform_methods.py
index eed76bc8a8..805d7de82a 100644
--- a/platform_methods.py
+++ b/platform_methods.py
@@ -11,7 +11,6 @@ JSON_SERIALIZABLE_TYPES = (bool, int, float, str)
def run_in_subprocess(builder_function):
-
@functools.wraps(builder_function)
def wrapper(target, source, env):
@@ -20,38 +19,36 @@ def run_in_subprocess(builder_function):
source = [node.srcnode().abspath for node in source]
# Short circuit on non-Windows platforms, no need to run in subprocess
- if sys.platform not in ('win32', 'cygwin'):
+ if sys.platform not in ("win32", "cygwin"):
return builder_function(target, source, env)
# Identify module
module_name = builder_function.__module__
function_name = builder_function.__name__
module_path = sys.modules[module_name].__file__
- if module_path.endswith('.pyc') or module_path.endswith('.pyo'):
+ if module_path.endswith(".pyc") or module_path.endswith(".pyo"):
module_path = module_path[:-1]
# Subprocess environment
subprocess_env = os.environ.copy()
- subprocess_env['PYTHONPATH'] = os.pathsep.join([os.getcwd()] + sys.path)
+ subprocess_env["PYTHONPATH"] = os.pathsep.join([os.getcwd()] + sys.path)
# Keep only JSON serializable environment items
- filtered_env = dict(
- (key, value)
- for key, value in env.items()
- if isinstance(value, JSON_SERIALIZABLE_TYPES)
- )
+ filtered_env = dict((key, value) for key, value in env.items() if isinstance(value, JSON_SERIALIZABLE_TYPES))
# Save parameters
args = (target, source, filtered_env)
data = dict(fn=function_name, args=args)
- json_path = os.path.join(os.environ['TMP'], uuid.uuid4().hex + '.json')
- with open(json_path, 'wt') as json_file:
+ json_path = os.path.join(os.environ["TMP"], uuid.uuid4().hex + ".json")
+ with open(json_path, "wt") as json_file:
json.dump(data, json_file, indent=2)
json_file_size = os.stat(json_path).st_size
- print('Executing builder function in subprocess: '
- 'module_path=%r, parameter_file=%r, parameter_file_size=%r, target=%r, source=%r' % (
- module_path, json_path, json_file_size, target, source))
+ print(
+ "Executing builder function in subprocess: "
+ "module_path=%r, parameter_file=%r, parameter_file_size=%r, target=%r, source=%r"
+ % (module_path, json_path, json_file_size, target, source)
+ )
try:
exit_code = subprocess.call([sys.executable, module_path, json_path], env=subprocess_env)
finally:
@@ -59,13 +56,15 @@ def run_in_subprocess(builder_function):
os.remove(json_path)
except (OSError, IOError) as e:
# Do not fail the entire build if it cannot delete a temporary file
- print('WARNING: Could not delete temporary file: path=%r; [%s] %s' %
- (json_path, e.__class__.__name__, e))
+ print(
+ "WARNING: Could not delete temporary file: path=%r; [%s] %s" % (json_path, e.__class__.__name__, e)
+ )
# Must succeed
if exit_code:
raise RuntimeError(
- 'Failed to run builder function in subprocess: module_path=%r; data=%r' % (module_path, data))
+ "Failed to run builder function in subprocess: module_path=%r; data=%r" % (module_path, data)
+ )
return wrapper
@@ -75,5 +74,5 @@ def subprocess_main(namespace):
with open(sys.argv[1]) as json_file:
data = json.load(json_file)
- fn = namespace[data['fn']]
- fn(*data['args'])
+ fn = namespace[data["fn"]]
+ fn(*data["args"])
diff --git a/scene/2d/SCsub b/scene/2d/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/2d/SCsub
+++ b/scene/2d/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index 4cedfc0c20..fc34f967ce 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -652,7 +652,7 @@ void AnimatedSprite2D::_reset_timeout() {
void AnimatedSprite2D::set_animation(const StringName &p_animation) {
- ERR_FAIL_COND_MSG(frames == NULL, vformat("There is no animation with name '%s'.", p_animation));
+ ERR_FAIL_COND_MSG(frames == nullptr, vformat("There is no animation with name '%s'.", p_animation));
ERR_FAIL_COND_MSG(frames->get_animation_names().find(p_animation) == -1, vformat("There is no animation with name '%s'.", p_animation));
if (animation == p_animation)
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index 4ccff07416..c46b6eeb5c 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -407,8 +407,8 @@ void Area2D::set_monitoring(bool p_enable) {
PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout);
} else {
- PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName());
- PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName());
+ PhysicsServer2D::get_singleton()->area_set_monitor_callback(get_rid(), nullptr, StringName());
+ PhysicsServer2D::get_singleton()->area_set_area_monitor_callback(get_rid(), nullptr, StringName());
_clear_monitoring();
}
}
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 6d8d981974..d8af14a3fb 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -264,7 +264,7 @@ void Camera2D::_notification(int p_what) {
}
remove_from_group(group_name);
remove_from_group(canvas_group_name);
- viewport = NULL;
+ viewport = nullptr;
} break;
case NOTIFICATION_DRAW: {
@@ -433,7 +433,7 @@ void Camera2D::clear_current() {
current = false;
if (is_inside_tree()) {
- get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_make_current", (Object *)(NULL));
+ get_tree()->call_group_flags(SceneTree::GROUP_CALL_REALTIME, group_name, "_make_current", (Object *)nullptr);
}
}
@@ -794,7 +794,7 @@ Camera2D::Camera2D() {
first = true;
smoothing_enabled = false;
limit_smoothing_enabled = false;
- custom_viewport = NULL;
+ custom_viewport = nullptr;
process_mode = CAMERA2D_PROCESS_IDLE;
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 5535043432..d82f4a2f2b 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -233,7 +233,7 @@ Transform2D CollisionObject2D::shape_owner_get_transform(uint32_t p_owner) const
Object *CollisionObject2D::shape_owner_get_owner(uint32_t p_owner) const {
- ERR_FAIL_COND_V(!shapes.has(p_owner), NULL);
+ ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr);
return shapes[p_owner].owner;
}
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index 8874f61bb7..e931f20f40 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -60,7 +60,7 @@ class CollisionObject2D : public Node2D {
disabled = false;
one_way_collision = false;
one_way_collision_margin = 0;
- owner = NULL;
+ owner = nullptr;
}
};
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp
index 5880045e90..1e48b2d67f 100644
--- a/scene/2d/collision_polygon_2d.cpp
+++ b/scene/2d/collision_polygon_2d.cpp
@@ -129,7 +129,7 @@ void CollisionPolygon2D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
case NOTIFICATION_DRAW: {
@@ -319,7 +319,7 @@ CollisionPolygon2D::CollisionPolygon2D() {
aabb = Rect2(-10, -10, 20, 20);
build_mode = BUILD_SOLIDS;
set_notify_local_transform(true);
- parent = NULL;
+ parent = nullptr;
owner_id = 0;
disabled = false;
one_way_collision = false;
diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp
index cb2953cc15..b1dbc57c94 100644
--- a/scene/2d/collision_shape_2d.cpp
+++ b/scene/2d/collision_shape_2d.cpp
@@ -96,7 +96,7 @@ void CollisionShape2D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
case NOTIFICATION_DRAW: {
@@ -249,7 +249,7 @@ CollisionShape2D::CollisionShape2D() {
rect = Rect2(-Point2(10, 10), Point2(20, 20));
set_notify_local_transform(true);
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
disabled = false;
one_way_collision = false;
one_way_collision_margin = 1.0;
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index ba604c086e..0a6b091a51 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -976,7 +976,7 @@ void CPUParticles2D::_update_particle_data_buffer() {
int pc = particles.size();
int *ow;
- int *order = NULL;
+ int *order = nullptr;
float *w = particle_data.ptrw();
const Particle *r = particles.ptr();
@@ -1145,7 +1145,7 @@ void CPUParticles2D::_notification(int p_what) {
void CPUParticles2D::convert_from_particles(Node *p_particles) {
GPUParticles2D *particles = Object::cast_to<GPUParticles2D>(p_particles);
- ERR_FAIL_COND_MSG(!particles, "Only Particles2D nodes can be converted to CPUParticles2D.");
+ ERR_FAIL_COND_MSG(!particles, "Only GPUParticles2D nodes can be converted to CPUParticles2D.");
set_emitting(particles->is_emitting());
set_amount(particles->get_amount());
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index fd9706eb2a..de3f8fa09e 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -229,7 +229,7 @@ bool GPUParticles2D::get_fractional_delta() const {
String GPUParticles2D::get_configuration_warning() const {
if (RenderingServer::get_singleton()->is_low_end()) {
- return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
+ return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles2D node instead. You can use the \"Convert to CPUParticles2D\" option for this purpose.");
}
String warnings;
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 6cbb0d2a39..4d49f4762f 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -49,8 +49,8 @@ void Joint2D::_update_joint(bool p_only_free) {
if (p_only_free || !is_inside_tree())
return;
- Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL;
- Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL;
+ Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)nullptr;
+ Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)nullptr;
if (!node_a || !node_b)
return;
diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp
index 3385f2fbe0..6b06f2227a 100644
--- a/scene/2d/line_builder.cpp
+++ b/scene/2d/line_builder.cpp
@@ -95,9 +95,9 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) {
LineBuilder::LineBuilder() {
joint_mode = Line2D::LINE_JOINT_SHARP;
width = 10;
- curve = NULL;
+ curve = nullptr;
default_color = Color(0.4, 0.5, 1);
- gradient = NULL;
+ gradient = nullptr;
sharp_limit = 2.f;
round_precision = 8;
begin_cap_mode = Line2D::LINE_CAP_NONE;
@@ -147,8 +147,8 @@ void LineBuilder::build() {
float current_distance1 = 0.f;
float total_distance = 0.f;
float width_factor = 1.f;
- _interpolate_color = gradient != NULL;
- bool retrieve_curve = curve != NULL;
+ _interpolate_color = gradient != nullptr;
+ bool retrieve_curve = curve != nullptr;
bool distance_required = _interpolate_color ||
retrieve_curve ||
texture_mode == Line2D::LINE_TEXTURE_TILE ||
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index c70d5ab1fe..32da46e8a8 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -98,12 +98,12 @@ void NavigationAgent2D::_notification(int p_what) {
// Search the navigation node and set it
{
- Navigation2D *nav = NULL;
+ Navigation2D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation2D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -114,8 +114,8 @@ void NavigationAgent2D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- agent_parent = NULL;
- set_navigation(NULL);
+ agent_parent = nullptr;
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
@@ -134,8 +134,8 @@ void NavigationAgent2D::_notification(int p_what) {
}
NavigationAgent2D::NavigationAgent2D() :
- agent_parent(NULL),
- navigation(NULL),
+ agent_parent(nullptr),
+ navigation(nullptr),
agent(RID()),
target_desired_distance(1.0),
path_max_distance(3.0),
@@ -160,12 +160,12 @@ void NavigationAgent2D::set_navigation(Navigation2D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationAgent2D::set_navigation_node(Node *p_nav) {
Navigation2D *nav = Object::cast_to<Navigation2D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
@@ -225,7 +225,7 @@ Vector2 NavigationAgent2D::get_target_location() const {
Vector2 NavigationAgent2D::get_next_location() {
update_navigation();
if (navigation_path.size() == 0) {
- ERR_FAIL_COND_V(agent_parent == NULL, Vector2());
+ ERR_FAIL_COND_V(agent_parent == nullptr, Vector2());
return agent_parent->get_global_transform().get_origin();
} else {
return navigation_path[nav_path_index];
@@ -233,7 +233,7 @@ Vector2 NavigationAgent2D::get_next_location() {
}
real_t NavigationAgent2D::distance_to_target() const {
- ERR_FAIL_COND_V(agent_parent == NULL, 0.0);
+ ERR_FAIL_COND_V(agent_parent == nullptr, 0.0);
return agent_parent->get_global_transform().get_origin().distance_to(target_location);
}
@@ -288,8 +288,8 @@ String NavigationAgent2D::get_configuration_warning() const {
void NavigationAgent2D::update_navigation() {
- if (agent_parent == NULL) return;
- if (navigation == NULL) return;
+ if (agent_parent == nullptr) return;
+ if (navigation == nullptr) return;
if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp
index 4c6e777e73..50d02ca507 100644
--- a/scene/2d/navigation_obstacle_2d.cpp
+++ b/scene/2d/navigation_obstacle_2d.cpp
@@ -49,12 +49,12 @@ void NavigationObstacle2D::_notification(int p_what) {
// Search the navigation node and set it
{
- Navigation2D *nav = NULL;
+ Navigation2D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation2D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -65,7 +65,7 @@ void NavigationObstacle2D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- set_navigation(NULL);
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
@@ -79,7 +79,7 @@ void NavigationObstacle2D::_notification(int p_what) {
}
NavigationObstacle2D::NavigationObstacle2D() :
- navigation(NULL),
+ navigation(nullptr),
agent(RID()) {
agent = NavigationServer2D::get_singleton()->agent_create();
}
@@ -94,12 +94,12 @@ void NavigationObstacle2D::set_navigation(Navigation2D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer2D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationObstacle2D::set_navigation_node(Node *p_nav) {
Navigation2D *nav = Object::cast_to<Navigation2D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index f0839b4597..d77fd5b097 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -281,7 +281,7 @@ void NavigationPolygon::make_polygons_from_outlines() {
for (int l = 0; l < olsize2; l++) {
- if (Geometry::segment_intersects_segment_2d(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], NULL)) {
+ if (Geometry::segment_intersects_segment_2d(r[0], outside_point, r2[l], r2[(l + 1) % olsize2], nullptr)) {
interscount++;
}
}
@@ -449,7 +449,7 @@ void NavigationRegion2D::_notification(int p_what) {
NavigationServer2D::get_singleton()->region_set_map(region, RID());
}
- navigation = NULL;
+ navigation = nullptr;
} break;
case NOTIFICATION_DRAW: {
@@ -574,7 +574,7 @@ NavigationRegion2D::NavigationRegion2D() {
set_notify_transform(true);
region = NavigationServer2D::get_singleton()->region_create();
- navigation = NULL;
+ navigation = nullptr;
}
NavigationRegion2D::~NavigationRegion2D() {
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 3e807f12dc..d55b21bc24 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -242,7 +242,7 @@ void PathFollow2D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
- path = NULL;
+ path = nullptr;
} break;
}
}
@@ -421,7 +421,7 @@ PathFollow2D::PathFollow2D() {
offset = 0;
h_offset = 0;
v_offset = 0;
- path = NULL;
+ path = nullptr;
rotate = true;
cubic = true;
loop = true;
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 942d2aac24..21dc9537ec 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -157,7 +157,7 @@ void PhysicsBody2D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
- ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type.");
+ ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody2D type.");
PhysicsServer2D::get_singleton()->body_add_collision_exception(get_rid(), physics_body->get_rid());
}
@@ -165,7 +165,7 @@ void PhysicsBody2D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
PhysicsBody2D *physics_body = Object::cast_to<PhysicsBody2D>(p_node);
- ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody type.");
+ ERR_FAIL_COND_MSG(!physics_body, "Collision exception only works between two objects of PhysicsBody2D type.");
PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
}
@@ -362,7 +362,7 @@ struct _RigidBody2DInOut {
bool RigidBody2D::_test_motion(const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<PhysicsTestMotionResult2D> &p_result) {
- PhysicsServer2D::MotionResult *r = NULL;
+ PhysicsServer2D::MotionResult *r = nullptr;
if (p_result.is_valid())
r = p_result->get_result_ptr();
return PhysicsServer2D::get_singleton()->body_test_motion(get_rid(), get_global_transform(), p_motion, p_infinite_inertia, p_margin, r);
@@ -474,7 +474,7 @@ void RigidBody2D::_direct_state_changed(Object *p_state) {
contact_monitor->locked = false;
}
- state = NULL;
+ state = nullptr;
}
void RigidBody2D::set_mode(Mode p_mode) {
@@ -780,7 +780,7 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) {
}
memdelete(contact_monitor);
- contact_monitor = NULL;
+ contact_monitor = nullptr;
} else {
contact_monitor = memnew(ContactMonitor);
@@ -790,7 +790,7 @@ void RigidBody2D::set_contact_monitor(bool p_enabled) {
bool RigidBody2D::is_contact_monitor_enabled() const {
- return contact_monitor != NULL;
+ return contact_monitor != nullptr;
}
void RigidBody2D::_notification(int p_what) {
@@ -950,14 +950,14 @@ RigidBody2D::RigidBody2D() :
angular_damp = -1;
max_contacts_reported = 0;
- state = NULL;
+ state = nullptr;
angular_velocity = 0;
sleeping = false;
ccd_mode = CCD_MODE_DISABLED;
custom_integrator = false;
- contact_monitor = NULL;
+ contact_monitor = nullptr;
can_sleep = true;
PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
@@ -1281,7 +1281,7 @@ void KinematicBody2D::set_sync_to_physics(bool p_enable) {
set_only_update_transform_changes(true);
set_notify_local_transform(true);
} else {
- PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, "");
+ PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, "");
set_only_update_transform_changes(false);
set_notify_local_transform(false);
}
@@ -1368,12 +1368,12 @@ KinematicBody2D::KinematicBody2D() :
}
KinematicBody2D::~KinematicBody2D() {
if (motion_cache.is_valid()) {
- motion_cache->owner = NULL;
+ motion_cache->owner = nullptr;
}
for (int i = 0; i < slide_colliders.size(); i++) {
if (slide_colliders[i].is_valid()) {
- slide_colliders.write[i]->owner = NULL;
+ slide_colliders.write[i]->owner = nullptr;
}
}
}
@@ -1394,7 +1394,7 @@ Vector2 KinematicCollision2D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision2D::get_local_shape() const {
- if (!owner) return NULL;
+ if (!owner) return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
@@ -1405,7 +1405,7 @@ Object *KinematicCollision2D::get_collider() const {
return ObjectDB::get_instance(collision.collider);
}
- return NULL;
+ return nullptr;
}
ObjectID KinematicCollision2D::get_collider_id() const {
@@ -1422,7 +1422,7 @@ Object *KinematicCollision2D::get_collider_shape() const {
}
}
- return NULL;
+ return nullptr;
}
int KinematicCollision2D::get_collider_shape_index() const {
@@ -1468,5 +1468,5 @@ KinematicCollision2D::KinematicCollision2D() {
collision.collider_shape = 0;
collision.local_shape = 0;
- owner = NULL;
+ owner = nullptr;
}
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 8d20053c6e..84c1828b47 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -103,7 +103,7 @@ void Polygon2D::_notification(int p_what) {
if (polygon.size() < 3)
return;
- Skeleton2D *skeleton_node = NULL;
+ Skeleton2D *skeleton_node = nullptr;
if (has_node(skeleton)) {
skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton));
}
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index ed971b1c3a..9d6c7304ce 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -79,7 +79,7 @@ bool RayCast2D::is_colliding() const {
Object *RayCast2D::get_collider() const {
if (against.is_null())
- return NULL;
+ return nullptr;
return ObjectDB::get_instance(against);
}
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 2be6b6a75c..86c9ff6076 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -35,7 +35,7 @@ void Bone2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
Node *parent = get_parent();
parent_bone = Object::cast_to<Bone2D>(parent);
- skeleton = NULL;
+ skeleton = nullptr;
while (parent) {
skeleton = Object::cast_to<Skeleton2D>(parent);
if (skeleton)
@@ -73,9 +73,9 @@ void Bone2D::_notification(int p_what) {
}
}
skeleton->_make_bone_setup_dirty();
- skeleton = NULL;
+ skeleton = nullptr;
}
- parent_bone = NULL;
+ parent_bone = nullptr;
}
}
void Bone2D::_bind_methods() {
@@ -157,8 +157,8 @@ String Bone2D::get_configuration_warning() const {
}
Bone2D::Bone2D() {
- skeleton = NULL;
- parent_bone = NULL;
+ skeleton = nullptr;
+ parent_bone = nullptr;
skeleton_index = -1;
default_length = 16;
set_notify_local_transform(true);
@@ -257,8 +257,8 @@ int Skeleton2D::get_bone_count() const {
Bone2D *Skeleton2D::get_bone(int p_idx) {
- ERR_FAIL_COND_V(!is_inside_tree(), NULL);
- ERR_FAIL_INDEX_V(p_idx, bones.size(), NULL);
+ ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
+ ERR_FAIL_INDEX_V(p_idx, bones.size(), nullptr);
return bones[p_idx].bone;
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index c468389040..1cf12e4421 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -103,8 +103,8 @@ void TileMap::_notification(int p_what) {
q.occluder_instances.clear();
}
- collision_parent = NULL;
- navigation = NULL;
+ collision_parent = nullptr;
+ navigation = nullptr;
} break;
@@ -314,7 +314,7 @@ void TileMap::_add_shape(int &shape_idx, const Quadrant &p_q, const Ref<Shape2D>
int real_index = collision_parent->shape_owner_get_shape_index(p_q.shape_owner_id, shape_idx);
RID rid = collision_parent->get_rid();
- if (Object::cast_to<Area2D>(collision_parent) != NULL) {
+ if (Object::cast_to<Area2D>(collision_parent) != nullptr) {
ps->area_set_shape_transform(rid, real_index, get_transform() * xform);
} else {
ps->body_set_shape_transform(rid, real_index, get_transform() * xform);
@@ -921,7 +921,7 @@ void TileMap::make_bitmask_area_dirty(const Vector2 &p_pos) {
for (int x = p_pos.x - 1; x <= p_pos.x + 1; x++) {
for (int y = p_pos.y - 1; y <= p_pos.y + 1; y++) {
PosKey p(x, y);
- if (dirty_bitmask.find(p) == NULL) {
+ if (dirty_bitmask.find(p) == nullptr) {
dirty_bitmask.push_back(p);
}
}
@@ -962,7 +962,7 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
ERR_FAIL_COND_MSG(tile_set.is_null(), "Cannot update cell bitmask if Tileset is not open.");
PosKey p(p_x, p_y);
Map<PosKey, Cell>::Element *E = tile_map.find(p);
- if (E != NULL) {
+ if (E != nullptr) {
int id = get_cell(p_x, p_y);
if (tile_set->tile_get_tile_mode(id) == TileSet::AUTO_TILE) {
uint16_t mask = 0;
@@ -1368,7 +1368,7 @@ void TileMap::set_collision_use_parent(bool p_use_parent) {
if (use_parent && is_inside_tree()) {
collision_parent = Object::cast_to<CollisionObject2D>(get_parent());
} else {
- collision_parent = NULL;
+ collision_parent = nullptr;
}
_recreate_quadrants();
@@ -1959,9 +1959,9 @@ TileMap::TileMap() {
mode = MODE_SQUARE;
half_offset = HALF_OFFSET_DISABLED;
use_parent = false;
- collision_parent = NULL;
+ collision_parent = nullptr;
use_kinematic = false;
- navigation = NULL;
+ navigation = nullptr;
y_sort_mode = false;
compatibility_mode = false;
centered_textures = false;
diff --git a/scene/3d/SCsub b/scene/3d/SCsub
index 45b96bd9c4..ce69e8aa19 100644
--- a/scene/3d/SCsub
+++ b/scene/3d/SCsub
@@ -1,8 +1,8 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if env['disable_3d']:
+if env["disable_3d"]:
env.add_source_files(env.scene_sources, "node_3d.cpp")
env.add_source_files(env.scene_sources, "skeleton_3d.cpp")
else:
diff --git a/scene/3d/area_3d.cpp b/scene/3d/area_3d.cpp
index 5b02a91793..17ae553e5e 100644
--- a/scene/3d/area_3d.cpp
+++ b/scene/3d/area_3d.cpp
@@ -301,8 +301,8 @@ void Area3D::set_monitoring(bool p_enable) {
PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_body_inout);
PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), this, SceneStringNames::get_singleton()->_area_inout);
} else {
- PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), NULL, StringName());
- PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), NULL, StringName());
+ PhysicsServer3D::get_singleton()->area_set_monitor_callback(get_rid(), nullptr, StringName());
+ PhysicsServer3D::get_singleton()->area_set_area_monitor_callback(get_rid(), nullptr, StringName());
_clear_monitoring();
}
}
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index ce7c885a40..537c094ceb 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -40,14 +40,14 @@ void ARVRCamera::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
// need to find our ARVROrigin parent and let it know we're its camera!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin != NULL) {
+ if (origin != nullptr) {
origin->set_tracked_camera(this);
}
}; break;
case NOTIFICATION_EXIT_TREE: {
// need to find our ARVROrigin parent and let it know we're no longer its camera!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin != NULL) {
+ if (origin != nullptr) {
origin->clear_tracked_camera_if(this);
}
}; break;
@@ -60,7 +60,7 @@ String ARVRCamera::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRCamera must have an ARVROrigin node as its parent.");
};
@@ -192,7 +192,7 @@ void ARVRController::_notification(int p_what) {
// find the tracker for our controller
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// this controller is currently turned off
is_active = false;
button_states = 0;
@@ -279,7 +279,7 @@ String ARVRController::get_controller_name(void) const {
ERR_FAIL_NULL_V(arvr_server, String());
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return String("Not connected");
};
@@ -292,7 +292,7 @@ int ARVRController::get_joystick_id() const {
ERR_FAIL_NULL_V(arvr_server, 0);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// No tracker? no joystick id... (0 is our first joystick)
return -1;
};
@@ -324,7 +324,7 @@ real_t ARVRController::get_rumble() const {
ERR_FAIL_NULL_V(arvr_server, 0.0);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return 0.0;
};
@@ -337,7 +337,7 @@ void ARVRController::set_rumble(real_t p_rumble) {
ERR_FAIL_NULL(arvr_server);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker != NULL) {
+ if (tracker != nullptr) {
tracker->set_rumble(p_rumble);
};
};
@@ -356,7 +356,7 @@ ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const {
ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN);
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN;
};
@@ -369,7 +369,7 @@ String ARVRController::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRController must have an ARVROrigin node as its parent.");
};
@@ -407,7 +407,7 @@ void ARVRAnchor::_notification(int p_what) {
// find the tracker for our anchor
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
// this anchor is currently not available
is_active = false;
} else {
@@ -479,7 +479,7 @@ String ARVRAnchor::get_anchor_name(void) const {
ERR_FAIL_NULL_V(arvr_server, String());
ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_ANCHOR, anchor_id);
- if (tracker == NULL) {
+ if (tracker == nullptr) {
return String("Not connected");
};
@@ -496,7 +496,7 @@ String ARVRAnchor::get_configuration_warning() const {
// must be child node of ARVROrigin!
ARVROrigin *origin = Object::cast_to<ARVROrigin>(get_parent());
- if (origin == NULL) {
+ if (origin == nullptr) {
return TTR("ARVRAnchor must have an ARVROrigin node as its parent.");
};
@@ -535,7 +535,7 @@ String ARVROrigin::get_configuration_warning() const {
if (!is_visible() || !is_inside_tree())
return String();
- if (tracked_camera == NULL)
+ if (tracked_camera == nullptr)
return TTR("ARVROrigin requires an ARVRCamera child node.");
return String();
@@ -553,7 +553,7 @@ void ARVROrigin::set_tracked_camera(ARVRCamera *p_tracked_camera) {
void ARVROrigin::clear_tracked_camera_if(ARVRCamera *p_tracked_camera) {
if (tracked_camera == p_tracked_camera) {
- tracked_camera = NULL;
+ tracked_camera = nullptr;
};
};
@@ -591,7 +591,7 @@ void ARVROrigin::_notification(int p_what) {
// check if we have a primary interface
Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface();
- if (arvr_interface.is_valid() && tracked_camera != NULL) {
+ if (arvr_interface.is_valid() && tracked_camera != nullptr) {
// get our positioning transform for our headset
Transform t = arvr_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, Transform());
@@ -613,7 +613,7 @@ void ARVROrigin::_notification(int p_what) {
};
ARVROrigin::ARVROrigin() {
- tracked_camera = NULL;
+ tracked_camera = nullptr;
};
ARVROrigin::~ARVROrigin(){
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index bddf748be7..097368853e 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "audio_stream_player_3d.h"
+
#include "core/engine.h"
#include "scene/3d/area_3d.h"
#include "scene/3d/camera_3d.h"
@@ -96,7 +97,7 @@ static const Vector3 speaker_directions[7] = {
};
void AudioStreamPlayer3D::_calc_output_vol(const Vector3 &source_dir, real_t tightness, AudioStreamPlayer3D::Output &output) {
- unsigned int speaker_count; // only main speakers (no LFE)
+ unsigned int speaker_count = 0; // only main speakers (no LFE)
switch (AudioServer::get_singleton()->get_speaker_mode()) {
case AudioServer::SPEAKER_MODE_STEREO:
speaker_count = 2;
@@ -400,7 +401,7 @@ void AudioStreamPlayer3D::_notification(int p_what) {
PhysicsDirectSpaceState3D::ShapeResult sr[MAX_INTERSECT_AREAS];
int areas = space_state->intersect_point(global_pos, sr, MAX_INTERSECT_AREAS, Set<RID>(), area_mask, false, true);
- Area3D *area = NULL;
+ Area3D *area = nullptr;
for (int i = 0; i < areas; i++) {
if (!sr[i].collider)
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 1cce0c77d5..13e08339e2 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -82,7 +82,7 @@ private:
Output() {
filter_gain = 0;
- viewport = NULL;
+ viewport = nullptr;
reverb_bus_index = -1;
bus_index = -1;
}
diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp
index 05e3f3fefa..6bde56104e 100644
--- a/scene/3d/baked_lightmap.cpp
+++ b/scene/3d/baked_lightmap.cpp
@@ -193,9 +193,9 @@ BakedLightmapData::~BakedLightmapData() {
///////////////////////////
-BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = NULL;
-BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = NULL;
-BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = NULL;
+BakedLightmap::BakeBeginFunc BakedLightmap::bake_begin_function = nullptr;
+BakedLightmap::BakeStepFunc BakedLightmap::bake_step_function = nullptr;
+BakedLightmap::BakeEndFunc BakedLightmap::bake_end_function = nullptr;
void BakedLightmap::set_bake_cell_size(float p_cell_size) {
bake_cell_size = p_cell_size;
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 7980c15f89..30ab4d463b 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -138,7 +138,7 @@ void Camera3D::_notification(int p_what) {
if (viewport) {
viewport->_camera_remove(this);
- viewport = NULL;
+ viewport = nullptr;
}
} break;
@@ -241,7 +241,7 @@ void Camera3D::clear_current(bool p_enable_next) {
return;
if (get_viewport()->get_camera() == this) {
- get_viewport()->_camera_set(NULL);
+ get_viewport()->_camera_set(nullptr);
if (p_enable_next) {
get_viewport()->_camera_make_next_current(this);
@@ -703,7 +703,7 @@ Camera3D::Camera3D() {
near = 0;
far = 0;
current = false;
- viewport = NULL;
+ viewport = nullptr;
force_change = false;
mode = PROJECTION_PERSPECTIVE;
set_perspective(70.0, 0.05, 100.0);
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index da37ca8ae2..e6cd7bfe7e 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -245,7 +245,7 @@ Transform CollisionObject3D::shape_owner_get_transform(uint32_t p_owner) const {
Object *CollisionObject3D::shape_owner_get_owner(uint32_t p_owner) const {
- ERR_FAIL_COND_V(!shapes.has(p_owner), NULL);
+ ERR_FAIL_COND_V(!shapes.has(p_owner), nullptr);
return shapes[p_owner].owner;
}
@@ -374,7 +374,7 @@ String CollisionObject3D::get_configuration_warning() const {
if (!warning.empty()) {
warning += "\n\n";
}
- warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape or CollisionPolygon as a child to define its shape.");
+ warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape.");
}
return warning;
diff --git a/scene/3d/collision_object_3d.h b/scene/3d/collision_object_3d.h
index 6a70f56caa..67d3aed3c8 100644
--- a/scene/3d/collision_object_3d.h
+++ b/scene/3d/collision_object_3d.h
@@ -56,7 +56,7 @@ class CollisionObject3D : public Node3D {
ShapeData() {
disabled = false;
- owner = NULL;
+ owner = nullptr;
}
};
diff --git a/scene/3d/collision_polygon_3d.cpp b/scene/3d/collision_polygon_3d.cpp
index c8b1b728bc..66bd903eeb 100644
--- a/scene/3d/collision_polygon_3d.cpp
+++ b/scene/3d/collision_polygon_3d.cpp
@@ -112,7 +112,7 @@ void CollisionPolygon3D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
}
}
@@ -165,11 +165,11 @@ bool CollisionPolygon3D::is_disabled() const {
String CollisionPolygon3D::get_configuration_warning() const {
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- return TTR("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.");
+ return TTR("CollisionPolygon3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape.");
}
if (polygon.empty()) {
- return TTR("An empty CollisionPolygon has no effect on collision.");
+ return TTR("An empty CollisionPolygon3D has no effect on collision.");
}
return String();
@@ -201,7 +201,7 @@ CollisionPolygon3D::CollisionPolygon3D() {
aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
depth = 1.0;
set_notify_local_transform(true);
- parent = NULL;
+ parent = nullptr;
owner_id = 0;
disabled = false;
}
diff --git a/scene/3d/collision_shape_3d.cpp b/scene/3d/collision_shape_3d.cpp
index e736f20614..a66e84ac3c 100644
--- a/scene/3d/collision_shape_3d.cpp
+++ b/scene/3d/collision_shape_3d.cpp
@@ -29,6 +29,10 @@
/*************************************************************************/
#include "collision_shape_3d.h"
+
+#include "core/math/quick_hull.h"
+#include "mesh_instance_3d.h"
+#include "physics_body_3d.h"
#include "scene/resources/box_shape_3d.h"
#include "scene/resources/capsule_shape_3d.h"
#include "scene/resources/concave_polygon_shape_3d.h"
@@ -37,10 +41,8 @@
#include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h"
#include "servers/rendering_server.h"
+
//TODO: Implement CylinderShape and HeightMapShape?
-#include "core/math/quick_hull.h"
-#include "mesh_instance_3d.h"
-#include "physics_body_3d.h"
void CollisionShape3D::make_convex_from_brothers() {
@@ -103,7 +105,7 @@ void CollisionShape3D::_notification(int p_what) {
parent->remove_shape_owner(owner_id);
}
owner_id = 0;
- parent = NULL;
+ parent = nullptr;
} break;
}
}
@@ -116,17 +118,17 @@ void CollisionShape3D::resource_changed(RES res) {
String CollisionShape3D::get_configuration_warning() const {
if (!Object::cast_to<CollisionObject3D>(get_parent())) {
- return TTR("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.");
+ return TTR("CollisionShape3D only serves to provide a collision shape to a CollisionObject3D derived node. Please only use it as a child of Area3D, StaticBody3D, RigidBody3D, KinematicBody3D, etc. to give them a shape.");
}
if (!shape.is_valid()) {
- return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it.");
+ return TTR("A shape must be provided for CollisionShape3D to function. Please create a shape resource for it.");
}
if (Object::cast_to<RigidBody3D>(get_parent())) {
if (Object::cast_to<ConcavePolygonShape3D>(*shape)) {
if (Object::cast_to<RigidBody3D>(get_parent())->get_mode() != RigidBody3D::MODE_STATIC) {
- return TTR("ConcavePolygonShape doesn't support RigidBody in another mode than static.");
+ return TTR("ConcavePolygonShape3D doesn't support RigidBody3D in another mode than static.");
}
}
}
@@ -198,8 +200,8 @@ CollisionShape3D::CollisionShape3D() {
//indicator = RenderingServer::get_singleton()->mesh_create();
disabled = false;
- debug_shape = NULL;
- parent = NULL;
+ debug_shape = nullptr;
+ parent = nullptr;
owner_id = 0;
set_notify_local_transform(true);
}
@@ -215,7 +217,7 @@ void CollisionShape3D::_update_debug_shape() {
if (debug_shape) {
debug_shape->queue_delete();
- debug_shape = NULL;
+ debug_shape = nullptr;
}
Ref<Shape3D> s = get_shape();
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp
index 4350d4da25..12c105b0f4 100644
--- a/scene/3d/cpu_particles_3d.cpp
+++ b/scene/3d/cpu_particles_3d.cpp
@@ -208,13 +208,13 @@ String CPUParticles3D::get_configuration_warning() const {
if (get_mesh().is_valid()) {
mesh_found = true;
for (int j = 0; j < get_mesh()->get_surface_count(); j++) {
- anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != NULL;
+ anim_material_found = Object::cast_to<ShaderMaterial>(get_mesh()->surface_get_material(j).ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_mesh()->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
}
- anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL;
+ anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
@@ -228,7 +228,7 @@ String CPUParticles3D::get_configuration_warning() const {
get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) {
if (warnings != String())
warnings += "\n";
- warnings += "- " + TTR("CPUParticles animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".");
+ warnings += "- " + TTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\".");
}
return warnings;
@@ -1022,7 +1022,7 @@ void CPUParticles3D::_update_particle_data_buffer() {
int pc = particles.size();
int *ow;
- int *order = NULL;
+ int *order = nullptr;
float *w = particle_data.ptrw();
const Particle *r = particles.ptr();
@@ -1206,7 +1206,7 @@ void CPUParticles3D::_notification(int p_what) {
void CPUParticles3D::convert_from_particles(Node *p_particles) {
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_particles);
- ERR_FAIL_COND_MSG(!particles, "Only Particles nodes can be converted to CPUParticles.");
+ ERR_FAIL_COND_MSG(!particles, "Only GPUParticles3D nodes can be converted to CPUParticles3D.");
set_emitting(particles->is_emitting());
set_amount(particles->get_amount());
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index a46cd90612..6d571ee4f2 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -293,6 +293,7 @@ GIProbeData::GIProbeData() {
propagation = 0.7;
anisotropy_strength = 0.5;
interior = false;
+ use_two_bounces = false;
probe = RS::get_singleton()->gi_probe_create();
}
@@ -402,9 +403,9 @@ void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
}
}
-GIProbe::BakeBeginFunc GIProbe::bake_begin_function = NULL;
-GIProbe::BakeStepFunc GIProbe::bake_step_function = NULL;
-GIProbe::BakeEndFunc GIProbe::bake_end_function = NULL;
+GIProbe::BakeBeginFunc GIProbe::bake_begin_function = nullptr;
+GIProbe::BakeStepFunc GIProbe::bake_step_function = nullptr;
+GIProbe::BakeEndFunc GIProbe::bake_end_function = nullptr;
Vector3i GIProbe::get_estimated_cell_size() const {
static const int subdiv_value[SUBDIV_MAX] = { 6, 7, 8, 9 };
@@ -511,7 +512,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
void GIProbe::_debug_bake() {
- bake(NULL, true);
+ bake(nullptr, true);
}
AABB GIProbe::get_aabb() const {
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index c00ee2cb73..28b533e82d 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -161,7 +161,7 @@ public:
Vector3 get_extents() const;
Vector3i get_estimated_cell_size() const;
- void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false);
+ void bake(Node *p_from_node = nullptr, bool p_create_visual_debug = false);
virtual AABB get_aabb() const;
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const;
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index ad45228ca8..7744c477cb 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -241,7 +241,7 @@ bool GPUParticles3D::get_fractional_delta() const {
String GPUParticles3D::get_configuration_warning() const {
if (RenderingServer::get_singleton()->is_low_end()) {
- return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles node instead. You can use the \"Convert to CPUParticles\" option for this purpose.");
+ return TTR("GPU-based particles are not supported by the GLES2 video driver.\nUse the CPUParticles3D node instead. You can use the \"Convert to CPUParticles3D\" option for this purpose.");
}
String warnings;
@@ -253,7 +253,7 @@ String GPUParticles3D::get_configuration_warning() const {
if (draw_passes[i].is_valid()) {
meshes_found = true;
for (int j = 0; j < draw_passes[i]->get_surface_count(); j++) {
- anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != NULL;
+ anim_material_found = Object::cast_to<ShaderMaterial>(draw_passes[i]->surface_get_material(j).ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(draw_passes[i]->surface_get_material(j).ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
}
@@ -261,7 +261,7 @@ String GPUParticles3D::get_configuration_warning() const {
}
}
- anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != NULL;
+ anim_material_found = anim_material_found || Object::cast_to<ShaderMaterial>(get_material_override().ptr()) != nullptr;
StandardMaterial3D *spat = Object::cast_to<StandardMaterial3D>(get_material_override().ptr());
anim_material_found = anim_material_found || (spat && spat->get_billboard_mode() == StandardMaterial3D::BILLBOARD_PARTICLES);
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 7fc7fe2bf5..be3b369724 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -336,7 +336,7 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
Light3D::Light3D() {
type = RenderingServer::LIGHT_DIRECTIONAL;
- ERR_PRINT("Light should not be instanced directly; use the DirectionalLight, OmniLight or SpotLight subtypes instead.");
+ ERR_PRINT("Light3D should not be instanced directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead.");
}
Light3D::~Light3D() {
@@ -464,7 +464,7 @@ String SpotLight3D::get_configuration_warning() const {
warning += "\n\n";
}
- warning += TTR("A SpotLight with an angle wider than 90 degrees cannot cast shadows.");
+ warning += TTR("A SpotLight3D with an angle wider than 90 degrees cannot cast shadows.");
}
return warning;
diff --git a/scene/3d/listener_3d.cpp b/scene/3d/listener_3d.cpp
index f352eb24b1..426e34ea80 100644
--- a/scene/3d/listener_3d.cpp
+++ b/scene/3d/listener_3d.cpp
@@ -131,7 +131,7 @@ void Listener3D::clear_current() {
return;
if (get_viewport()->get_listener() == this) {
- get_viewport()->_listener_set(NULL);
+ get_viewport()->_listener_set(nullptr);
get_viewport()->_listener_make_next_current(this);
}
}
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp
index 284bbd7091..d56a095a5b 100644
--- a/scene/3d/mesh_instance_3d.cpp
+++ b/scene/3d/mesh_instance_3d.cpp
@@ -217,11 +217,11 @@ Vector<Face3> MeshInstance3D::get_faces(uint32_t p_usage_flags) const {
Node *MeshInstance3D::create_trimesh_collision_node() {
if (mesh.is_null())
- return NULL;
+ return nullptr;
Ref<Shape3D> shape = mesh->create_trimesh_shape();
if (shape.is_null())
- return NULL;
+ return nullptr;
StaticBody3D *static_body = memnew(StaticBody3D);
CollisionShape3D *cshape = memnew(CollisionShape3D);
@@ -247,11 +247,11 @@ void MeshInstance3D::create_trimesh_collision() {
Node *MeshInstance3D::create_convex_collision_node() {
if (mesh.is_null())
- return NULL;
+ return nullptr;
Ref<Shape3D> shape = mesh->create_convex_shape();
if (shape.is_null())
- return NULL;
+ return nullptr;
StaticBody3D *static_body = memnew(StaticBody3D);
CollisionShape3D *cshape = memnew(CollisionShape3D);
@@ -305,6 +305,23 @@ Ref<Material> MeshInstance3D::get_surface_material(int p_surface) const {
return materials[p_surface];
}
+Ref<Material> MeshInstance3D::get_active_material(int p_surface) const {
+
+ if (get_material_override() != Ref<Material>()) {
+ return get_material_override();
+ } else if (p_surface < materials.size()) {
+ return materials[p_surface];
+ } else {
+ Ref<Mesh> mesh = get_mesh();
+
+ if (mesh.is_null() || p_surface >= mesh->get_surface_count()) {
+ return Ref<Material>();
+ }
+
+ return mesh->surface_get_material(p_surface);
+ }
+}
+
void MeshInstance3D::_mesh_changed() {
materials.resize(mesh->get_surface_count());
@@ -397,6 +414,7 @@ void MeshInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_surface_material_count"), &MeshInstance3D::get_surface_material_count);
ClassDB::bind_method(D_METHOD("set_surface_material", "surface", "material"), &MeshInstance3D::set_surface_material);
ClassDB::bind_method(D_METHOD("get_surface_material", "surface"), &MeshInstance3D::get_surface_material);
+ ClassDB::bind_method(D_METHOD("get_active_material", "surface"), &MeshInstance3D::get_active_material);
ClassDB::bind_method(D_METHOD("create_trimesh_collision"), &MeshInstance3D::create_trimesh_collision);
ClassDB::set_method_flags("MeshInstance3D", "create_trimesh_collision", METHOD_FLAGS_DEFAULT);
diff --git a/scene/3d/mesh_instance_3d.h b/scene/3d/mesh_instance_3d.h
index e45f68e295..914148f427 100644
--- a/scene/3d/mesh_instance_3d.h
+++ b/scene/3d/mesh_instance_3d.h
@@ -84,6 +84,7 @@ public:
int get_surface_material_count() const;
void set_surface_material(int p_surface, const Ref<Material> &p_material);
Ref<Material> get_surface_material(int p_surface) const;
+ Ref<Material> get_active_material(int p_surface) const;
Node *create_trimesh_collision_node();
void create_trimesh_collision();
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 76f1d4688d..0449ab15b7 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -106,12 +106,12 @@ void NavigationAgent3D::_notification(int p_what) {
// Search the navigation node and set it
{
- Navigation3D *nav = NULL;
+ Navigation3D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation3D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -122,8 +122,8 @@ void NavigationAgent3D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- agent_parent = NULL;
- set_navigation(NULL);
+ agent_parent = nullptr;
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
@@ -142,8 +142,8 @@ void NavigationAgent3D::_notification(int p_what) {
}
NavigationAgent3D::NavigationAgent3D() :
- agent_parent(NULL),
- navigation(NULL),
+ agent_parent(nullptr),
+ navigation(nullptr),
agent(RID()),
target_desired_distance(1.0),
navigation_height_offset(0.0),
@@ -170,12 +170,12 @@ void NavigationAgent3D::set_navigation(Navigation3D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationAgent3D::set_navigation_node(Node *p_nav) {
Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
@@ -244,7 +244,7 @@ Vector3 NavigationAgent3D::get_target_location() const {
Vector3 NavigationAgent3D::get_next_location() {
update_navigation();
if (navigation_path.size() == 0) {
- ERR_FAIL_COND_V(agent_parent == NULL, Vector3());
+ ERR_FAIL_COND_V(agent_parent == nullptr, Vector3());
return agent_parent->get_global_transform().origin;
} else {
return navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0);
@@ -252,7 +252,7 @@ Vector3 NavigationAgent3D::get_next_location() {
}
real_t NavigationAgent3D::distance_to_target() const {
- ERR_FAIL_COND_V(agent_parent == NULL, 0.0);
+ ERR_FAIL_COND_V(agent_parent == nullptr, 0.0);
return agent_parent->get_global_transform().origin.distance_to(target_location);
}
@@ -298,7 +298,7 @@ void NavigationAgent3D::_avoidance_done(Vector3 p_new_velocity) {
String NavigationAgent3D::get_configuration_warning() const {
if (!Object::cast_to<Node3D>(get_parent())) {
- return TTR("The NavigationAgent can be used only under a spatial node.");
+ return TTR("The NavigationAgent3D can be used only under a spatial node.");
}
return String();
@@ -306,8 +306,8 @@ String NavigationAgent3D::get_configuration_warning() const {
void NavigationAgent3D::update_navigation() {
- if (agent_parent == NULL) return;
- if (navigation == NULL) return;
+ if (agent_parent == nullptr) return;
+ if (navigation == nullptr) return;
if (update_frame_id == Engine::get_singleton()->get_physics_frames()) return;
update_frame_id = Engine::get_singleton()->get_physics_frames();
diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp
index 63c273b4ca..2ee2008799 100644
--- a/scene/3d/navigation_obstacle_3d.cpp
+++ b/scene/3d/navigation_obstacle_3d.cpp
@@ -49,12 +49,12 @@ void NavigationObstacle3D::_notification(int p_what) {
// Search the navigation node and set it
{
- Navigation3D *nav = NULL;
+ Navigation3D *nav = nullptr;
Node *p = get_parent();
- while (p != NULL) {
+ while (p != nullptr) {
nav = Object::cast_to<Navigation3D>(p);
- if (nav != NULL)
- p = NULL;
+ if (nav != nullptr)
+ p = nullptr;
else
p = p->get_parent();
}
@@ -65,7 +65,7 @@ void NavigationObstacle3D::_notification(int p_what) {
set_physics_process_internal(true);
} break;
case NOTIFICATION_EXIT_TREE: {
- set_navigation(NULL);
+ set_navigation(nullptr);
set_physics_process_internal(false);
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
@@ -87,7 +87,7 @@ void NavigationObstacle3D::_notification(int p_what) {
}
NavigationObstacle3D::NavigationObstacle3D() :
- navigation(NULL),
+ navigation(nullptr),
agent(RID()) {
agent = NavigationServer3D::get_singleton()->agent_create();
}
@@ -102,12 +102,12 @@ void NavigationObstacle3D::set_navigation(Navigation3D *p_nav) {
return; // Pointless
navigation = p_nav;
- NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == NULL ? RID() : navigation->get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
}
void NavigationObstacle3D::set_navigation_node(Node *p_nav) {
Navigation3D *nav = Object::cast_to<Navigation3D>(p_nav);
- ERR_FAIL_COND(nav == NULL);
+ ERR_FAIL_COND(nav == nullptr);
set_navigation(nav);
}
@@ -118,7 +118,7 @@ Node *NavigationObstacle3D::get_navigation_node() const {
String NavigationObstacle3D::get_configuration_warning() const {
if (!Object::cast_to<Node3D>(get_parent())) {
- return TTR("The NavigationObstacle only serves to provide collision avoidance to a spatial object.");
+ return TTR("The NavigationObstacle3D only serves to provide collision avoidance to a spatial object.");
}
return String();
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 4bb2c72172..043b816033 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "navigation_region_3d.h"
+
#include "core/os/thread.h"
#include "mesh_instance_3d.h"
#include "navigation_3d.h"
@@ -122,9 +123,9 @@ void NavigationRegion3D::_notification(int p_what) {
if (debug_view) {
debug_view->queue_delete();
- debug_view = NULL;
+ debug_view = nullptr;
}
- navigation = NULL;
+ navigation = nullptr;
} break;
}
}
@@ -183,18 +184,18 @@ void _bake_navigation_mesh(void *p_user_data) {
}
void NavigationRegion3D::bake_navigation_mesh() {
- ERR_FAIL_COND(bake_thread != NULL);
+ ERR_FAIL_COND(bake_thread != nullptr);
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
args->nav_region = this;
bake_thread = Thread::create(_bake_navigation_mesh, args);
- ERR_FAIL_COND(bake_thread == NULL);
+ ERR_FAIL_COND(bake_thread == nullptr);
}
void NavigationRegion3D::_bake_finished(Ref<NavigationMesh> p_nav_mesh) {
set_navigation_mesh(p_nav_mesh);
- bake_thread = NULL;
+ bake_thread = nullptr;
}
String NavigationRegion3D::get_configuration_warning() const {
@@ -214,7 +215,7 @@ String NavigationRegion3D::get_configuration_warning() const {
c = Object::cast_to<Node3D>(c->get_parent());
}
- return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data.");
+ return TTR("NavigationRegion3D must be a child or grandchild to a Navigation3D node. It only provides navigation data.");
}
void NavigationRegion3D::_bind_methods() {
@@ -246,9 +247,9 @@ NavigationRegion3D::NavigationRegion3D() {
set_notify_transform(true);
region = NavigationServer3D::get_singleton()->region_create();
- navigation = NULL;
- debug_view = NULL;
- bake_thread = NULL;
+ navigation = nullptr;
+ debug_view = nullptr;
+ bake_thread = nullptr;
}
NavigationRegion3D::~NavigationRegion3D() {
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 7f444d59bf..0b7407e049 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -134,7 +134,7 @@ void Node3D::_notification(int p_what) {
if (data.parent)
data.C = data.parent->data.children.push_back(this);
else
- data.C = NULL;
+ data.C = nullptr;
if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) {
@@ -158,14 +158,14 @@ void Node3D::_notification(int p_what) {
get_tree()->xform_change_list.remove(&xform_change);
if (data.C)
data.parent->data.children.erase(data.C);
- data.parent = NULL;
- data.C = NULL;
+ data.parent = nullptr;
+ data.C = nullptr;
data.toplevel_active = false;
} break;
case NOTIFICATION_ENTER_WORLD: {
data.inside_world = true;
- data.viewport = NULL;
+ data.viewport = nullptr;
Node *parent = get_parent();
while (parent && !data.viewport) {
data.viewport = Object::cast_to<Viewport>(parent);
@@ -176,7 +176,7 @@ void Node3D::_notification(int p_what) {
if (get_script_instance()) {
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, nullptr, 0);
}
#ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) {
@@ -208,10 +208,10 @@ void Node3D::_notification(int p_what) {
if (get_script_instance()) {
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, NULL, 0);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_world, nullptr, 0);
}
- data.viewport = NULL;
+ data.viewport = nullptr;
data.inside_world = false;
} break;
@@ -829,7 +829,7 @@ Node3D::Node3D() :
data.toplevel = false;
data.toplevel_active = false;
data.scale = Vector3(1, 1, 1);
- data.viewport = NULL;
+ data.viewport = nullptr;
data.inside_world = false;
data.visible = true;
data.disable_scale = false;
@@ -840,8 +840,8 @@ Node3D::Node3D() :
#endif
data.notify_local_transform = false;
data.notify_transform = false;
- data.parent = NULL;
- data.C = NULL;
+ data.parent = nullptr;
+ data.C = nullptr;
}
Node3D::~Node3D() {
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp
index 2169f664ea..f06135f53d 100644
--- a/scene/3d/path_3d.cpp
+++ b/scene/3d/path_3d.cpp
@@ -229,7 +229,7 @@ void PathFollow3D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
- path = NULL;
+ path = nullptr;
} break;
}
}
@@ -262,11 +262,11 @@ String PathFollow3D::get_configuration_warning() const {
return String();
if (!Object::cast_to<Path3D>(get_parent())) {
- return TTR("PathFollow only works when set as a child of a Path node.");
+ return TTR("PathFollow3D only works when set as a child of a Path3D node.");
} else {
Path3D *path = Object::cast_to<Path3D>(get_parent());
if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) {
- return TTR("PathFollow's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path's Curve resource.");
+ return TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.");
}
}
@@ -409,7 +409,7 @@ PathFollow3D::PathFollow3D() {
delta_offset = 0;
h_offset = 0;
v_offset = 0;
- path = NULL;
+ path = nullptr;
rotation_mode = ROTATION_XYZ;
cubic = true;
loop = true;
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index f6ba9f4d28..2b6eb8ac8a 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -128,7 +128,7 @@ void PhysicsBody3D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
PhysicsServer3D::get_singleton()->body_add_collision_exception(get_rid(), collision_object->get_rid());
}
@@ -136,7 +136,7 @@ void PhysicsBody3D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
PhysicsServer3D::get_singleton()->body_remove_collision_exception(get_rid(), collision_object->get_rid());
}
@@ -406,7 +406,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) {
_RigidBodyInOut *toadd = (_RigidBodyInOut *)alloca(state->get_contact_count() * sizeof(_RigidBodyInOut));
int toadd_count = 0; //state->get_contact_count();
- RigidBody_RemoveAction *toremove = (RigidBody_RemoveAction *)alloca(rc * sizeof(RigidBody_RemoveAction));
+ RigidBody3D_RemoveAction *toremove = (RigidBody3D_RemoveAction *)alloca(rc * sizeof(RigidBody3D_RemoveAction));
int toremove_count = 0;
//put the ones to add
@@ -474,7 +474,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) {
contact_monitor->locked = false;
}
- state = NULL;
+ state = nullptr;
}
void RigidBody3D::_notification(int p_what) {
@@ -744,7 +744,7 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) {
}
memdelete(contact_monitor);
- contact_monitor = NULL;
+ contact_monitor = nullptr;
} else {
contact_monitor = memnew(ContactMonitor);
@@ -754,7 +754,7 @@ void RigidBody3D::set_contact_monitor(bool p_enabled) {
bool RigidBody3D::is_contact_monitor_enabled() const {
- return contact_monitor != NULL;
+ return contact_monitor != nullptr;
}
void RigidBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) {
@@ -794,7 +794,7 @@ String RigidBody3D::get_configuration_warning() const {
if (warning != String()) {
warning += "\n\n";
}
- warning += TTR("Size changes to RigidBody (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
+ warning += TTR("Size changes to RigidBody3D (in character or rigid modes) will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
return warning;
@@ -910,7 +910,7 @@ RigidBody3D::RigidBody3D() :
mass = 1;
max_contacts_reported = 0;
- state = NULL;
+ state = nullptr;
gravity_scale = 1;
linear_damp = -1;
@@ -921,7 +921,7 @@ RigidBody3D::RigidBody3D() :
ccd = false;
custom_integrator = false;
- contact_monitor = NULL;
+ contact_monitor = nullptr;
can_sleep = true;
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
@@ -1321,12 +1321,12 @@ KinematicBody3D::KinematicBody3D() :
KinematicBody3D::~KinematicBody3D() {
if (motion_cache.is_valid()) {
- motion_cache->owner = NULL;
+ motion_cache->owner = nullptr;
}
for (int i = 0; i < slide_colliders.size(); i++) {
if (slide_colliders[i].is_valid()) {
- slide_colliders.write[i]->owner = NULL;
+ slide_colliders.write[i]->owner = nullptr;
}
}
}
@@ -1346,7 +1346,7 @@ Vector3 KinematicCollision3D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision3D::get_local_shape() const {
- if (!owner) return NULL;
+ if (!owner) return nullptr;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
@@ -1357,7 +1357,7 @@ Object *KinematicCollision3D::get_collider() const {
return ObjectDB::get_instance(collision.collider);
}
- return NULL;
+ return nullptr;
}
ObjectID KinematicCollision3D::get_collider_id() const {
@@ -1374,7 +1374,7 @@ Object *KinematicCollision3D::get_collider_shape() const {
}
}
- return NULL;
+ return nullptr;
}
int KinematicCollision3D::get_collider_shape_index() const {
@@ -1420,7 +1420,7 @@ KinematicCollision3D::KinematicCollision3D() {
collision.collider_shape = 0;
collision.local_shape = 0;
- owner = NULL;
+ owner = nullptr;
}
///////////////////////////////////////
@@ -2078,7 +2078,7 @@ void PhysicalBone3D::_notification(int p_what) {
parent_skeleton->unbind_physical_bone_from_bone(bone_id);
}
}
- parent_skeleton = NULL;
+ parent_skeleton = nullptr;
if (joint.is_valid()) {
PhysicsServer3D::get_singleton()->free(joint);
joint = RID();
@@ -2181,7 +2181,7 @@ void PhysicalBone3D::_bind_methods() {
Skeleton3D *PhysicalBone3D::find_skeleton_parent(Node *p_parent) {
if (!p_parent) {
- return NULL;
+ return nullptr;
}
Skeleton3D *s = Object::cast_to<Skeleton3D>(p_parent);
return s ? s : find_skeleton_parent(p_parent->get_parent());
@@ -2333,7 +2333,7 @@ void PhysicalBone3D::set_joint_type(JointType p_joint_type) {
if (joint_data)
memdelete(joint_data);
- joint_data = NULL;
+ joint_data = nullptr;
switch (p_joint_type) {
case JOINT_TYPE_PIN:
joint_data = memnew(PinJointData);
@@ -2501,8 +2501,8 @@ PhysicalBone3D::PhysicalBone3D() :
#ifdef TOOLS_ENABLED
gizmo_move_joint(false),
#endif
- joint_data(NULL),
- parent_skeleton(NULL),
+ joint_data(nullptr),
+ parent_skeleton(nullptr),
simulate_physics(false),
_internal_simulate_physics(false),
bone_id(-1),
@@ -2588,7 +2588,7 @@ void PhysicalBone3D::_stop_physics_simulation() {
PhysicsServer3D::get_singleton()->body_set_collision_mask(get_rid(), 0);
}
if (_internal_simulate_physics) {
- PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), NULL, "");
+ PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), nullptr, "");
parent_skeleton->set_bone_global_pose_override(bone_id, Transform(), 0.0, false);
set_as_toplevel(false);
_internal_simulate_physics = false;
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index ed7cfa8733..bf7854b68d 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -156,7 +156,7 @@ protected:
tagged = false;
}
};
- struct RigidBody_RemoveAction {
+ struct RigidBody3D_RemoveAction {
ObjectID body_id;
ShapePair pair;
diff --git a/scene/3d/physics_joint_3d.cpp b/scene/3d/physics_joint_3d.cpp
index f6b3e79300..591c17a91e 100644
--- a/scene/3d/physics_joint_3d.cpp
+++ b/scene/3d/physics_joint_3d.cpp
@@ -45,8 +45,8 @@ void Joint3D::_update_joint(bool p_only_free) {
if (p_only_free || !is_inside_tree())
return;
- Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)NULL;
- Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)NULL;
+ Node *node_a = has_node(get_node_a()) ? get_node(get_node_a()) : (Node *)nullptr;
+ Node *node_b = has_node(get_node_b()) ? get_node(get_node_b()) : (Node *)nullptr;
PhysicsBody3D *body_a = Object::cast_to<PhysicsBody3D>(node_a);
PhysicsBody3D *body_b = Object::cast_to<PhysicsBody3D>(node_b);
diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp
index d00af3b128..a18da61656 100644
--- a/scene/3d/ray_cast_3d.cpp
+++ b/scene/3d/ray_cast_3d.cpp
@@ -81,7 +81,7 @@ bool RayCast3D::is_colliding() const {
Object *RayCast3D::get_collider() const {
if (against.is_null())
- return NULL;
+ return nullptr;
return ObjectDB::get_instance(against);
}
@@ -387,7 +387,7 @@ void RayCast3D::_clear_debug_shape() {
else
memdelete(mi);
- debug_shape = NULL;
+ debug_shape = nullptr;
}
RayCast3D::RayCast3D() {
@@ -398,7 +398,7 @@ RayCast3D::RayCast3D() {
against_shape = 0;
collision_mask = 1;
cast_to = Vector3(0, -1, 0);
- debug_shape = NULL;
+ debug_shape = nullptr;
exclude_parent_body = true;
collide_with_areas = false;
collide_with_bodies = true;
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 1b05641c9d..59a6e23005 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -685,19 +685,19 @@ void Skeleton3D::bind_physical_bone_to_bone(int p_bone, PhysicalBone3D *p_physic
void Skeleton3D::unbind_physical_bone_from_bone(int p_bone) {
ERR_FAIL_INDEX(p_bone, bones.size());
- bones.write[p_bone].physical_bone = NULL;
+ bones.write[p_bone].physical_bone = nullptr;
_rebuild_physical_bones_cache();
}
PhysicalBone3D *Skeleton3D::get_physical_bone(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
return bones[p_bone].physical_bone;
}
PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
if (bones[p_bone].cache_parent_physical_bone) {
return bones[p_bone].cache_parent_physical_bone;
@@ -707,11 +707,11 @@ PhysicalBone3D *Skeleton3D::get_physical_bone_parent(int p_bone) {
}
PhysicalBone3D *Skeleton3D::_get_physical_bone_parent(int p_bone) {
- ERR_FAIL_INDEX_V(p_bone, bones.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bone, bones.size(), nullptr);
const int parent_bone = bones[p_bone].parent;
if (0 > parent_bone) {
- return NULL;
+ return nullptr;
}
PhysicalBone3D *pb = bones[parent_bone].physical_bone;
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index 2ae04aa575..08b8691658 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -112,8 +112,8 @@ private:
global_pose_override_amount = 0;
global_pose_override_reset = false;
#ifndef _3D_DISABLED
- physical_bone = NULL;
- cache_parent_physical_bone = NULL;
+ physical_bone = nullptr;
+ cache_parent_physical_bone = nullptr;
#endif // _3D_DISABLED
}
};
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index a6c3e25399..7366290ed3 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -42,7 +42,7 @@ FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::find_child
return &children.write[i];
}
}
- return NULL;
+ return nullptr;
}
FabrikInverseKinematic::ChainItem *FabrikInverseKinematic::ChainItem::add_child(const BoneId p_bone_id) {
@@ -65,7 +65,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
chain.chain_root.initial_transform = p_task->skeleton->get_bone_global_pose(chain.chain_root.bone);
chain.chain_root.current_pos = chain.chain_root.initial_transform.origin;
chain.chain_root.pb = p_task->skeleton->get_physical_bone(chain.chain_root.bone);
- chain.middle_chain_item = NULL;
+ chain.middle_chain_item = nullptr;
// Holds all IDs that are composing a single chain in reverse order
Vector<BoneId> chain_ids;
@@ -119,7 +119,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
}
if (!middle_chain_item_id)
- chain.middle_chain_item = NULL;
+ chain.middle_chain_item = nullptr;
// Initialize current tip
chain.tips.write[x].chain_item = sub_chain;
@@ -226,14 +226,14 @@ void FabrikInverseKinematic::solve_simple_forwards(Chain &r_chain, bool p_solve_
if (p_solve_magnet && sub_chain_root == r_chain.middle_chain_item) {
// In case of magnet solving this is the tip
- sub_chain_root = NULL;
+ sub_chain_root = nullptr;
} else {
sub_chain_root = &child;
}
} else {
// Is tip
- sub_chain_root = NULL;
+ sub_chain_root = nullptr;
}
}
}
@@ -251,7 +251,7 @@ FabrikInverseKinematic::Task *FabrikInverseKinematic::create_simple_task(Skeleto
if (!build_chain(task)) {
free_task(task);
- return NULL;
+ return nullptr;
}
return task;
@@ -328,7 +328,7 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
if (!ci->children.empty())
ci = &ci->children.write[0];
else
- ci = NULL;
+ ci = nullptr;
}
}
@@ -432,14 +432,14 @@ SkeletonIK3D::SkeletonIK3D() :
use_magnet(false),
min_distance(0.01),
max_iterations(10),
- skeleton(NULL),
- target_node_override(NULL),
- task(NULL) {
+ skeleton(nullptr),
+ target_node_override(nullptr),
+ task(nullptr) {
}
SkeletonIK3D::~SkeletonIK3D() {
FabrikInverseKinematic::free_task(task);
- task = NULL;
+ task = nullptr;
}
void SkeletonIK3D::set_root_bone(const StringName &p_root_bone) {
@@ -479,7 +479,7 @@ const Transform &SkeletonIK3D::get_target_transform() const {
void SkeletonIK3D::set_target_node(const NodePath &p_node) {
target_node_path_override = p_node;
- target_node_override = NULL;
+ target_node_override = nullptr;
reload_goal();
}
@@ -550,7 +550,7 @@ Transform SkeletonIK3D::_get_target_transform() {
void SkeletonIK3D::reload_chain() {
FabrikInverseKinematic::free_task(task);
- task = NULL;
+ task = nullptr;
if (!skeleton)
return;
diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h
index ebfebd1e66..5fbbe6e9e7 100644
--- a/scene/3d/skeleton_ik_3d.h
+++ b/scene/3d/skeleton_ik_3d.h
@@ -64,9 +64,9 @@ class FabrikInverseKinematic {
Vector3 current_ori;
ChainItem() :
- parent_item(NULL),
+ parent_item(nullptr),
bone(-1),
- pb(NULL),
+ pb(nullptr),
length(0) {}
ChainItem *find_child(const BoneId p_bone_id);
@@ -78,8 +78,8 @@ class FabrikInverseKinematic {
const EndEffector *end_effector;
ChainTip() :
- chain_item(NULL),
- end_effector(NULL) {}
+ chain_item(nullptr),
+ end_effector(nullptr) {}
ChainTip(ChainItem *p_chain_item, const EndEffector *p_end_effector) :
chain_item(p_chain_item),
@@ -115,7 +115,7 @@ public:
Transform goal_global_transform;
Task() :
- skeleton(NULL),
+ skeleton(nullptr),
min_distance(0.01),
max_iterations(10),
root_bone(-1) {}
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp
index ee9ce1dd71..6092818252 100644
--- a/scene/3d/soft_body_3d.cpp
+++ b/scene/3d/soft_body_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "soft_body_3d.h"
+
#include "core/list.h"
#include "core/object.h"
#include "core/os/os.h"
@@ -98,7 +99,7 @@ void SoftBodyRenderingServerHandler::set_aabb(const AABB &p_aabb) {
SoftBody3D::PinnedPoint::PinnedPoint() :
point_index(-1),
- spatial_attachment(NULL) {
+ spatial_attachment(nullptr) {
}
SoftBody3D::PinnedPoint::PinnedPoint(const PinnedPoint &obj_tocopy) {
@@ -402,7 +403,7 @@ String SoftBody3D::get_configuration_warning() const {
if (!warning.empty())
warning += "\n\n";
- warning += TTR("Size changes to SoftBody will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
+ warning += TTR("Size changes to SoftBody3D will be overridden by the physics engine when running.\nChange the size in children collision shapes instead.");
}
return warning;
@@ -453,7 +454,7 @@ void SoftBody3D::prepare_physics_server() {
if (get_mesh().is_valid())
PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, get_mesh());
else
- PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, NULL);
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr);
return;
}
@@ -465,7 +466,7 @@ void SoftBody3D::prepare_physics_server() {
RS::get_singleton()->connect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
} else {
- PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, NULL);
+ PhysicsServer3D::get_singleton()->soft_body_set_mesh(physics_rid, nullptr);
if (RS::get_singleton()->is_connected("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh))) {
RS::get_singleton()->disconnect("frame_pre_draw", callable_mp(this, &SoftBody3D::_draw_soft_mesh));
}
@@ -585,14 +586,14 @@ Array SoftBody3D::get_collision_exceptions() {
void SoftBody3D::add_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
PhysicsServer3D::get_singleton()->soft_body_add_collision_exception(physics_rid, collision_object->get_rid());
}
void SoftBody3D::remove_collision_exception_with(Node *p_node) {
ERR_FAIL_NULL(p_node);
CollisionObject3D *collision_object = Object::cast_to<CollisionObject3D>(p_node);
- ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject.");
+ ERR_FAIL_COND_MSG(!collision_object, "Collision exception only works between two CollisionObject3Ds.");
PhysicsServer3D::get_singleton()->soft_body_remove_collision_exception(physics_rid, collision_object->get_rid());
}
@@ -807,7 +808,7 @@ void SoftBody3D::_remove_pinned_point(int p_point_index) {
int SoftBody3D::_get_pinned_point(int p_point_index, SoftBody3D::PinnedPoint *&r_point) const {
const int id = _has_pinned_point(p_point_index);
if (-1 == id) {
- r_point = NULL;
+ r_point = nullptr;
return -1;
} else {
r_point = const_cast<SoftBody3D::PinnedPoint *>(&pinned_points.ptr()[id]);
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 360e95e76a..85e5ebc475 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -83,8 +83,8 @@ void SpriteBase3D::_notification(int p_what) {
if (parent_sprite) {
parent_sprite->children.erase(pI);
- pI = NULL;
- parent_sprite = NULL;
+ pI = nullptr;
+ parent_sprite = nullptr;
}
}
}
@@ -364,8 +364,8 @@ SpriteBase3D::SpriteBase3D() {
centered = true;
hflip = false;
vflip = false;
- parent_sprite = NULL;
- pI = NULL;
+ parent_sprite = nullptr;
+ pI = nullptr;
for (int i = 0; i < FLAG_MAX; i++)
flags[i] = i == FLAG_TRANSPARENT || i == FLAG_DOUBLE_SIDED;
@@ -441,7 +441,7 @@ void Sprite3D::_draw() {
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
- if (atlas_tex != NULL) {
+ if (atlas_tex != nullptr) {
src_tsize[0] = atlas_tex->get_atlas()->get_width();
src_tsize[1] = atlas_tex->get_atlas()->get_height();
}
@@ -775,7 +775,7 @@ void AnimatedSprite3D::_draw() {
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
- if (atlas_tex != NULL) {
+ if (atlas_tex != nullptr) {
src_tsize[0] = atlas_tex->get_atlas()->get_width();
src_tsize[1] = atlas_tex->get_atlas()->get_height();
}
diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp
index 5984b776b2..5c2fa59a21 100644
--- a/scene/3d/vehicle_body_3d.cpp
+++ b/scene/3d/vehicle_body_3d.cpp
@@ -99,13 +99,13 @@ void VehicleWheel3D::_notification(int p_what) {
if (!cb)
return;
cb->wheels.erase(this);
- body = NULL;
+ body = nullptr;
}
}
String VehicleWheel3D::get_configuration_warning() const {
if (!Object::cast_to<VehicleBody3D>(get_parent())) {
- return TTR("VehicleWheel serves to provide a wheel system to a VehicleBody. Please use it as a child of a VehicleBody.");
+ return TTR("VehicleWheel3D serves to provide a wheel system to a VehicleBody3D. Please use it as a child of a VehicleBody3D.");
}
return String();
@@ -285,7 +285,7 @@ void VehicleWheel3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01,or_greater"), "set_engine_force", "get_engine_force");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
- ADD_GROUP("VehicleBody Motion", "");
+ ADD_GROUP("VehicleBody3D Motion", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering");
ADD_GROUP("Wheel", "wheel_");
@@ -385,7 +385,7 @@ VehicleWheel3D::VehicleWheel3D() {
m_clippedInvContactDotSuspension = 1.0;
m_raycastInfo.m_isInContact = false;
- body = NULL;
+ body = nullptr;
}
void VehicleBody3D::_update_wheel_transform(VehicleWheel3D &wheel, PhysicsDirectBodyState3D *s) {
@@ -454,7 +454,7 @@ real_t VehicleBody3D::_ray_cast(int p_idx, PhysicsDirectBodyState3D *s) {
bool col = ss->intersect_ray(source, target, rr, exclude);
- wheel.m_raycastInfo.m_groundObject = 0;
+ wheel.m_raycastInfo.m_groundObject = nullptr;
if (col) {
param = source.distance_to(rr.position) / source.distance_to(target);
@@ -917,7 +917,7 @@ void VehicleBody3D::_direct_state_changed(Object *p_state) {
wheel.m_deltaRotation *= real_t(0.99); //damping of rotation when not in contact
}
- state = NULL;
+ state = nullptr;
}
void VehicleBody3D::set_engine_force(float p_engine_force) {
@@ -988,7 +988,7 @@ VehicleBody3D::VehicleBody3D() {
engine_force = 0;
brake = 0;
- state = NULL;
+ state = nullptr;
ccd = false;
exclude.insert(get_rid());
diff --git a/scene/SCsub b/scene/SCsub
index 1c5b87b87a..f9fc00f3f2 100644
--- a/scene/SCsub
+++ b/scene/SCsub
@@ -1,16 +1,16 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.scene_sources = []
# Thirdparty code
thirdparty_dir = "#thirdparty/misc/"
thirdparty_sources = [
- # C++ sources
- "easing_equations.cpp",
- # C sources
- "mikktspace.c",
+ # C++ sources
+ "easing_equations.cpp",
+ # C sources
+ "mikktspace.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
@@ -23,14 +23,14 @@ env.add_source_files(env.scene_sources, "*.cpp")
# Chain load SCsubs
-SConscript('main/SCsub')
-SConscript('gui/SCsub')
-SConscript('3d/SCsub')
-SConscript('2d/SCsub')
-SConscript('animation/SCsub')
-SConscript('audio/SCsub')
-SConscript('resources/SCsub')
-SConscript('debugger/SCsub')
+SConscript("main/SCsub")
+SConscript("gui/SCsub")
+SConscript("3d/SCsub")
+SConscript("2d/SCsub")
+SConscript("animation/SCsub")
+SConscript("audio/SCsub")
+SConscript("resources/SCsub")
+SConscript("debugger/SCsub")
# Build it all as a library
diff --git a/scene/animation/SCsub b/scene/animation/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/animation/SCsub
+++ b/scene/animation/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 8ba7a38628..570735ad87 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -41,7 +41,7 @@ StringName AnimationNodeAnimation::get_animation() const {
return animation;
}
-Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = NULL;
+Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = nullptr;
void AnimationNodeAnimation::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp
index 79a7c36e7f..ab8be47b4d 100644
--- a/scene/animation/animation_cache.cpp
+++ b/scene/animation/animation_cache.cpp
@@ -287,7 +287,7 @@ void AnimationCache::set_all(float p_time, float p_delta) {
if (!args.size()) {
- call_track(i, name, NULL, 0, err);
+ call_track(i, name, nullptr, 0, err);
} else {
Vector<const Variant *> argptrs;
@@ -332,7 +332,7 @@ void AnimationCache::set_root(Node *p_root) {
AnimationCache::AnimationCache() {
- root = NULL;
+ root = nullptr;
cache_dirty = true;
cache_valid = false;
}
diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h
index 20147f060b..23312ca7ec 100644
--- a/scene/animation/animation_cache.h
+++ b/scene/animation/animation_cache.h
@@ -50,12 +50,12 @@ class AnimationCache : public Object {
Vector<StringName> subpath;
bool valid;
Path() {
- object = NULL;
- skeleton = NULL;
- node = NULL;
+ object = nullptr;
+ skeleton = nullptr;
+ node = nullptr;
bone_idx = -1;
valid = false;
- spatial = NULL;
+ spatial = nullptr;
}
};
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index ce1e75a61d..9f5e06c43d 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -225,7 +225,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta
}
//find the last cost transition
- List<int>::Element *least_cost_transition = NULL;
+ List<int>::Element *least_cost_transition = nullptr;
float least_cost = 1e20;
for (List<int>::Element *E = open_list.front(); E; E = E->next()) {
@@ -516,6 +516,11 @@ AnimationNodeStateMachinePlayback::AnimationNodeStateMachinePlayback() {
len_current = 0;
fading_time = 0;
stop_request = false;
+ len_total = 0.0;
+ pos_current = 0.0;
+ loops_current = 0;
+ fading_pos = 0.0;
+ start_request_travel = false;
}
///////////////////////////////////////////////////////
@@ -525,7 +530,7 @@ void AnimationNodeStateMachine::get_parameter_list(List<PropertyInfo> *r_list) c
List<StringName> advance_conditions;
for (int i = 0; i < transitions.size(); i++) {
StringName ac = transitions[i].transition->get_advance_condition_name();
- if (ac != StringName() && advance_conditions.find(ac) == NULL) {
+ if (ac != StringName() && advance_conditions.find(ac) == nullptr) {
advance_conditions.push_back(ac);
}
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 6c870682a6..00f0dce0d6 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -244,7 +244,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
for (int i = 0; i < a->get_track_count(); i++) {
- p_anim->node_cache.write[i] = NULL;
+ p_anim->node_cache.write[i] = nullptr;
RES resource;
Vector<StringName> leftover_path;
Node *child = parent->get_node_and_resource(a->track_get_path(i), resource, leftover_path);
@@ -293,13 +293,13 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
p_anim->node_cache[i]->bone_idx = p_anim->node_cache[i]->skeleton->find_bone(bone_name);
if (p_anim->node_cache[i]->bone_idx < 0) {
// broken track (nonexistent bone)
- p_anim->node_cache[i]->skeleton = NULL;
- p_anim->node_cache[i]->spatial = NULL;
+ p_anim->node_cache[i]->skeleton = nullptr;
+ p_anim->node_cache[i]->spatial = nullptr;
ERR_CONTINUE(p_anim->node_cache[i]->bone_idx < 0);
}
} else {
// no property, just use spatialnode
- p_anim->node_cache[i]->skeleton = NULL;
+ p_anim->node_cache[i]->skeleton = nullptr;
}
}
}
@@ -830,7 +830,7 @@ void AnimationPlayer::_animation_process2(float p_delta, bool p_started) {
c.seeked = false;
}
- List<Blend>::Element *prev = NULL;
+ List<Blend>::Element *prev = nullptr;
for (List<Blend>::Element *E = c.blend.back(); E; E = prev) {
Blend &b = E->get();
@@ -1296,7 +1296,7 @@ void AnimationPlayer::stop(bool p_reset) {
Playback &c = playback;
c.blend.clear();
if (p_reset) {
- c.current.from = NULL;
+ c.current.from = nullptr;
c.current.speed_scale = 1;
c.current.pos = 0;
}
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 32bed6f4d6..c134aff707 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -118,9 +118,9 @@ private:
Variant capture;
PropertyAnim() :
- owner(NULL),
+ owner(nullptr),
special(SP_NONE),
- object(NULL),
+ object(nullptr),
accum_pass(0) {}
};
@@ -135,9 +135,9 @@ private:
uint64_t accum_pass;
BezierAnim() :
- owner(NULL),
+ owner(nullptr),
bezier_accum(0.0),
- object(NULL),
+ object(nullptr),
accum_pass(0) {}
};
@@ -145,10 +145,10 @@ private:
TrackNodeCache() :
id(0),
- node(NULL),
- spatial(NULL),
- node_2d(NULL),
- skeleton(NULL),
+ node(nullptr),
+ spatial(nullptr),
+ node_2d(nullptr),
+ skeleton(nullptr),
bone_idx(-1),
accum_pass(0),
audio_playing(false),
@@ -212,7 +212,7 @@ private:
pos = 0;
speed_scale = 1.0;
- from = NULL;
+ from = nullptr;
}
};
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 0e1089cc6a..f8b3ca291b 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -128,8 +128,8 @@ float AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *
float t = process(p_time, p_seek);
- state = NULL;
- parent = NULL;
+ state = nullptr;
+ parent = nullptr;
base_path = StringName();
connections.clear();
@@ -164,7 +164,7 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
//inputs.write[p_input].last_pass = state->last_pass;
float activity = 0;
- float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
+ float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);
@@ -202,7 +202,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
blendw[i] = 0.0; //all to zero by default
}
- const NodePath *K = NULL;
+ const NodePath *K = nullptr;
while ((K = filter.next(K))) {
if (!state->track_map.has(*K)) {
continue;
@@ -316,7 +316,7 @@ String AnimationNode::get_caption() const {
void AnimationNode::add_input(const String &p_name) {
//root nodes can't add inputs
- ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != NULL);
+ ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != nullptr);
Input input;
ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1);
input.name = p_name;
@@ -374,7 +374,7 @@ Array AnimationNode::_get_filters() const {
Array paths;
- const NodePath *K = NULL;
+ const NodePath *K = nullptr;
while ((K = filter.next(K))) {
paths.push_back(String(*K)); //use strings, so sorting is possible
}
@@ -453,8 +453,8 @@ void AnimationNode::_bind_methods() {
AnimationNode::AnimationNode() {
- state = NULL;
- parent = NULL;
+ state = nullptr;
+ parent = nullptr;
filter_enabled = false;
}
@@ -558,17 +558,17 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
NodePath path = anim->track_get_path(i);
Animation::TrackType track_type = anim->track_get_type(i);
- TrackCache *track = NULL;
+ TrackCache *track = nullptr;
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)) {
+ if (track && (track->type != track_type || ObjectDB::get_instance(track->object_id) == nullptr)) {
playing_caches.erase(track);
memdelete(track);
track_cache.erase(path);
- track = NULL;
+ track = nullptr;
}
if (!track) {
@@ -615,7 +615,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
TrackCacheTransform *track_xform = memnew(TrackCacheTransform);
track_xform->spatial = spatial;
- track_xform->skeleton = NULL;
+ track_xform->skeleton = nullptr;
track_xform->bone_idx = -1;
if (path.get_subname_count() == 1 && Object::cast_to<Skeleton3D>(spatial)) {
@@ -700,7 +700,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
List<NodePath> to_delete;
- const NodePath *K = NULL;
+ const NodePath *K = nullptr;
while ((K = track_cache.next(K))) {
TrackCache *tc = track_cache[*K];
if (tc->setup_pass != setup_pass) {
@@ -717,7 +717,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
state.track_map.clear();
- K = NULL;
+ K = nullptr;
int idx = 0;
while ((K = track_cache.next(K))) {
state.track_map[*K] = idx;
@@ -733,7 +733,7 @@ bool AnimationTree::_update_caches(AnimationPlayer *player) {
void AnimationTree::_clear_caches() {
- const NodePath *K = NULL;
+ const NodePath *K = nullptr;
while ((K = track_cache.next(K))) {
memdelete(track_cache[*K]);
}
@@ -829,11 +829,11 @@ void AnimationTree::_process_graph(float p_delta) {
if (started) {
//if started, seek
- root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, 0, true, Vector<StringName>());
+ root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, nullptr, &state, 0, true, Vector<StringName>());
started = false;
}
- root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, p_delta, false, Vector<StringName>());
+ root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, nullptr, &state, p_delta, false, Vector<StringName>());
}
if (!state.valid) {
@@ -1224,7 +1224,7 @@ void AnimationTree::_process_graph(float p_delta) {
{
// finally, set the tracks
- const NodePath *K = NULL;
+ const NodePath *K = nullptr;
while ((K = track_cache.next(K))) {
TrackCache *track = track_cache[*K];
if (track->process_pass != process_pass)
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index faf4333f1d..d558170f23 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -101,7 +101,7 @@ public:
Array _get_filters() const;
void _set_filters(const Array &p_filters);
friend class AnimationNodeBlendTree;
- float _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, 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);
+ float _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, 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 = nullptr);
protected:
void blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend);
@@ -186,7 +186,7 @@ private:
root_motion = false;
setup_pass = 0;
process_pass = 0;
- object = NULL;
+ object = nullptr;
}
virtual ~TrackCache() {}
};
@@ -202,9 +202,9 @@ private:
TrackCacheTransform() {
type = Animation::TYPE_TRANSFORM;
- spatial = NULL;
+ spatial = nullptr;
bone_idx = -1;
- skeleton = NULL;
+ skeleton = nullptr;
}
};
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 628568afbb..bc28c38e2c 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -297,7 +297,7 @@ Variant Tween::_get_initial_val(const InterpolateData &p_data) const {
case TARGETING_METHOD: {
// Get the object that is being targeted
Object *object = ObjectDB::get_instance(p_data.target_id);
- ERR_FAIL_COND_V(object == NULL, p_data.initial_val);
+ ERR_FAIL_COND_V(object == nullptr, p_data.initial_val);
// Are we targeting a property or a method?
Variant initial_val;
@@ -309,7 +309,7 @@ Variant Tween::_get_initial_val(const InterpolateData &p_data) const {
} else {
// Call the method and get the initial value from it
Callable::CallError error;
- initial_val = object->call(p_data.target_key[0], NULL, 0, error);
+ initial_val = object->call(p_data.target_key[0], nullptr, 0, error);
ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val);
}
return initial_val;
@@ -329,7 +329,7 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const {
case FOLLOW_METHOD: {
// Get the object that is being followed
Object *target = ObjectDB::get_instance(p_data.target_id);
- ERR_FAIL_COND_V(target == NULL, p_data.initial_val);
+ ERR_FAIL_COND_V(target == nullptr, p_data.initial_val);
// We want to figure out the final value
Variant final_val;
@@ -341,7 +341,7 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const {
} else {
// We're looking at a method. Call the method on the target object
Callable::CallError error;
- final_val = target->call(p_data.target_key[0], NULL, 0, error);
+ final_val = target->call(p_data.target_key[0], nullptr, 0, error);
ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val);
}
@@ -371,7 +371,7 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
case FOLLOW_METHOD: {
// We're following an object, so grab that instance
Object *target = ObjectDB::get_instance(p_data.target_id);
- ERR_FAIL_COND_V(target == NULL, p_data.initial_val);
+ ERR_FAIL_COND_V(target == nullptr, p_data.initial_val);
// We want to figure out the final value
Variant final_val;
@@ -383,7 +383,7 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
} else {
// We're looking at a method. Call the method on the target object
Callable::CallError error;
- final_val = target->call(p_data.target_key[0], NULL, 0, error);
+ final_val = target->call(p_data.target_key[0], nullptr, 0, error);
ERR_FAIL_COND_V(error.error != Callable::CallError::CALL_OK, p_data.initial_val);
}
@@ -607,7 +607,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) {
// Get the object we want to apply the new value to
Object *object = ObjectDB::get_instance(p_data.id);
- ERR_FAIL_COND_V(object == NULL, false);
+ ERR_FAIL_COND_V(object == nullptr, false);
// What kind of data are we mutating?
switch (p_data.type) {
@@ -634,7 +634,7 @@ bool Tween::_apply_tween_value(InterpolateData &p_data, Variant &value) {
object->call(p_data.key[0], (const Variant **)arg, 1, error);
} else {
// Don't pass any argument
- object->call(p_data.key[0], NULL, 0, error);
+ object->call(p_data.key[0], nullptr, 0, error);
}
// Did we get an error from the function call?
@@ -700,7 +700,7 @@ void Tween::_tween_process(float p_delta) {
// Get the target object for this interpolation
Object *object = ObjectDB::get_instance(data.id);
- if (object == NULL)
+ if (object == nullptr)
continue;
// Are we still delaying this tween?
@@ -860,7 +860,7 @@ void Tween::reset(Object *p_object, StringName p_key) {
// Get the target object
InterpolateData &data = E->get();
Object *object = ObjectDB::get_instance(data.id);
- if (object == NULL)
+ if (object == nullptr)
continue;
// Do we have the correct object and key?
@@ -901,7 +901,7 @@ void Tween::stop(Object *p_object, StringName p_key) {
// Get the object the tween is targeting
InterpolateData &data = E->get();
Object *object = ObjectDB::get_instance(data.id);
- if (object == NULL)
+ if (object == nullptr)
continue;
// Is this the correct object and does it have the given key?
@@ -937,7 +937,7 @@ void Tween::resume(Object *p_object, StringName p_key) {
// Grab the object
InterpolateData &data = E->get();
Object *object = ObjectDB::get_instance(data.id);
- if (object == NULL)
+ if (object == nullptr)
continue;
// If the object and string key match, activate it
@@ -975,7 +975,7 @@ void Tween::remove(Object *p_object, StringName p_key) {
// Get the target object
InterpolateData &data = E->get();
Object *object = ObjectDB::get_instance(data.id);
- if (object == NULL)
+ if (object == nullptr)
continue;
// If the target object and string key match, queue it for removal
@@ -1264,7 +1264,7 @@ void Tween::_build_interpolation(InterpolateType p_interpolation_type, Object *p
// Validate and apply interpolation data
// Give it the object
- ERR_FAIL_COND_MSG(p_object == NULL, "Invalid object provided to Tween.");
+ ERR_FAIL_COND_MSG(p_object == nullptr, "Invalid object provided to Tween.");
data.id = p_object->get_instance_id();
// Validate the initial and final values
@@ -1335,7 +1335,7 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant
if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
// Build the interpolation data
- _build_interpolation(INTER_PROPERTY, p_object, &p_property, NULL, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
+ _build_interpolation(INTER_PROPERTY, p_object, &p_property, nullptr, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
}
void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_initial_val, Variant p_final_val, real_t p_duration, TransitionType p_trans_type, EaseType p_ease_type, real_t p_delay) {
@@ -1350,7 +1350,7 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_
if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
// Build the interpolation data
- _build_interpolation(INTER_METHOD, p_object, NULL, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
+ _build_interpolation(INTER_METHOD, p_object, nullptr, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
}
void Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_callback, VARIANT_ARG_DECLARE) {
@@ -1361,7 +1361,7 @@ void Tween::interpolate_callback(Object *p_object, real_t p_duration, String p_c
}
// Check that the target object is valid
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
// Duration cannot be negative
ERR_FAIL_COND(p_duration < 0);
@@ -1418,7 +1418,7 @@ void Tween::interpolate_deferred_callback(Object *p_object, real_t p_duration, S
}
// Check that the target object is valid
- ERR_FAIL_COND(p_object == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
// No negative durations allowed
ERR_FAIL_COND(p_duration < 0);
@@ -1486,8 +1486,8 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
// Confirm the source and target objects are valid
- ERR_FAIL_COND(p_object == NULL);
- ERR_FAIL_COND(p_target == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
+ ERR_FAIL_COND(p_target == nullptr);
// No negative durations
ERR_FAIL_COND(p_duration < 0);
@@ -1547,8 +1547,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
// Verify the source and target objects are valid
- ERR_FAIL_COND(p_object == NULL);
- ERR_FAIL_COND(p_target == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
+ ERR_FAIL_COND(p_target == nullptr);
// No negative durations
ERR_FAIL_COND(p_duration < 0);
@@ -1566,7 +1566,7 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
// Call the method to get the target value
Callable::CallError error;
- Variant target_val = p_target->call(p_target_method, NULL, 0, error);
+ Variant target_val = p_target->call(p_target_method, nullptr, 0, error);
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert target INT values to FLOAT as they are better for interpolation
@@ -1610,8 +1610,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
// Verify both objects are valid
- ERR_FAIL_COND(p_object == NULL);
- ERR_FAIL_COND(p_initial == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
+ ERR_FAIL_COND(p_initial == nullptr);
// No negative durations
ERR_FAIL_COND(p_duration < 0);
@@ -1676,8 +1676,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
// Make sure the given objects are valid
- ERR_FAIL_COND(p_object == NULL);
- ERR_FAIL_COND(p_initial == NULL);
+ ERR_FAIL_COND(p_object == nullptr);
+ ERR_FAIL_COND(p_initial == nullptr);
// No negative durations
ERR_FAIL_COND(p_duration < 0);
@@ -1695,7 +1695,7 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
// Call the method to get the initial value
Callable::CallError error;
- Variant initial_val = p_initial->call(p_initial_method, NULL, 0, error);
+ Variant initial_val = p_initial->call(p_initial_method, nullptr, 0, error);
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert initial INT values to FLOAT as they aer better for interpolation
diff --git a/scene/audio/SCsub b/scene/audio/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/audio/SCsub
+++ b/scene/audio/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp
index 2582bab200..f612944a62 100644
--- a/scene/audio/audio_stream_player.cpp
+++ b/scene/audio/audio_stream_player.cpp
@@ -36,7 +36,7 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) {
int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
- AudioFrame *targets[4] = { NULL, NULL, NULL, NULL };
+ AudioFrame *targets[4] = { nullptr, nullptr, nullptr, nullptr };
if (AudioServer::get_singleton()->get_speaker_mode() == AudioServer::SPEAKER_MODE_STEREO) {
targets[0] = AudioServer::get_singleton()->thread_get_channel_mix_buffer(bus_index, 0);
diff --git a/scene/debugger/SCsub b/scene/debugger/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/debugger/SCsub
+++ b/scene/debugger/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 359f936793..8cb63c4ab5 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -40,7 +40,7 @@
void SceneDebugger::initialize() {
#ifdef DEBUG_ENABLED
LiveEditor::singleton = memnew(LiveEditor);
- EngineDebugger::register_message_capture("scene", EngineDebugger::Capture(NULL, SceneDebugger::parse_message));
+ EngineDebugger::register_message_capture("scene", EngineDebugger::Capture(nullptr, SceneDebugger::parse_message));
#endif
}
@@ -51,7 +51,7 @@ void SceneDebugger::deinitialize() {
if (EngineDebugger::has_capture("scene"))
EngineDebugger::unregister_message_capture("scene");
memdelete(LiveEditor::singleton);
- LiveEditor::singleton = NULL;
+ LiveEditor::singleton = nullptr;
}
#endif
}
@@ -279,7 +279,7 @@ SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) {
}
} else if (Script *s = Object::cast_to<Script>(obj)) {
// Add script constants (no instance).
- _parse_script_properties(s, NULL);
+ _parse_script_properties(s, nullptr);
}
// Add base object properties.
@@ -373,7 +373,7 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) {
var = res->get_path();
} else { //only send information that can be sent..
int len = 0; //test how big is this to encode
- encode_variant(var, NULL, len);
+ encode_variant(var, nullptr, len);
if (len > p_max_size) { //limit to max size
hint = PROPERTY_HINT_OBJECT_TOO_BIG;
hint_string = "";
@@ -478,7 +478,7 @@ void SceneDebuggerTree::deserialize(const Array &p_arr) {
}
/// LiveEditor
-LiveEditor *LiveEditor::singleton = NULL;
+LiveEditor *LiveEditor::singleton = nullptr;
LiveEditor *LiveEditor::get_singleton() {
return singleton;
}
@@ -515,7 +515,7 @@ void LiveEditor::_node_set_func(int p_id, const StringName &p_prop, const Varian
return;
NodePath np = live_edit_node_path_cache[p_id];
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -553,7 +553,7 @@ void LiveEditor::_node_call_func(int p_id, const StringName &p_method, VARIANT_A
return;
NodePath np = live_edit_node_path_cache[p_id];
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -626,7 +626,7 @@ void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_typ
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -664,7 +664,7 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p
if (!ps.is_valid())
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -697,7 +697,7 @@ void LiveEditor::_remove_node_func(const NodePath &p_at) {
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -728,7 +728,7 @@ void LiveEditor::_remove_and_keep_node_func(const NodePath &p_at, ObjectID p_kee
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -762,7 +762,7 @@ void LiveEditor::_restore_node_func(ObjectID p_id, const NodePath &p_at, int p_a
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -808,7 +808,7 @@ void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
@@ -841,7 +841,7 @@ void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new
if (!scene_tree)
return;
- Node *base = NULL;
+ Node *base = nullptr;
if (scene_tree->root->has_node(live_edit_root))
base = scene_tree->root->get_node(live_edit_root);
diff --git a/scene/gui/SCsub b/scene/gui/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/gui/SCsub
+++ b/scene/gui/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index a05ac08e9d..1cdc6f8057 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -498,7 +498,7 @@ BaseButton *ButtonGroup::get_pressed_button() {
return E->get();
}
- return NULL;
+ return nullptr;
}
void ButtonGroup::_bind_methods() {
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 2ec9bb2292..5e0f4c91e8 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -80,7 +80,7 @@ void ColorPicker::_notification(int p_what) {
} break;
case NOTIFICATION_WM_CLOSE_REQUEST: {
- if (screen != NULL && screen->is_visible())
+ if (screen != nullptr && screen->is_visible())
screen->hide();
} break;
}
@@ -275,7 +275,7 @@ void ColorPicker::_text_type_toggled() {
c_text->set_editable(false);
} else {
text_type->set_text("#");
- text_type->set_icon(NULL);
+ text_type->set_icon(nullptr);
c_text->set_editable(true);
}
@@ -732,7 +732,7 @@ ColorPicker::ColorPicker() :
changing_color = false;
presets_enabled = true;
presets_visible = true;
- screen = NULL;
+ screen = nullptr;
HBoxContainer *hb_edit = memnew(HBoxContainer);
add_child(hb_edit);
@@ -1024,8 +1024,8 @@ ColorPickerButton::ColorPickerButton() {
// Initialization is now done deferred,
// this improves performance in the inspector as the color picker
// can be expensive to initialize.
- picker = NULL;
- popup = NULL;
+ picker = nullptr;
+ popup = nullptr;
edit_alpha = true;
set_toggle_mode(true);
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 0d982dbc02..de6233f359 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -455,13 +455,13 @@ void Control::remove_child_notify(Node *p_child) {
Control *child_c = Object::cast_to<Control>(p_child);
if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) {
- _propagate_theme_changed(child_c, NULL, NULL);
+ _propagate_theme_changed(child_c, nullptr, nullptr);
}
Window *child_w = Object::cast_to<Window>(p_child);
if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) {
- _propagate_theme_changed(child_w, NULL, NULL);
+ _propagate_theme_changed(child_w, nullptr, nullptr);
}
}
@@ -495,7 +495,7 @@ void Control::_notification(int p_notification) {
data.parent = Object::cast_to<Control>(get_parent());
Node *parent = this; //meh
- Control *parent_control = NULL;
+ Control *parent_control = nullptr;
bool subwindow = false;
while (parent) {
@@ -548,7 +548,7 @@ void Control::_notification(int p_notification) {
if (data.parent_canvas_item) {
data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed));
- data.parent_canvas_item = NULL;
+ data.parent_canvas_item = nullptr;
} else if (!is_set_as_toplevel()) {
//disconnect viewport
get_viewport()->disconnect("size_changed", callable_mp(this, &Control::_size_changed));
@@ -556,11 +556,11 @@ void Control::_notification(int p_notification) {
if (data.RI) {
get_viewport()->_gui_remove_root_control(data.RI);
- data.RI = NULL;
+ data.RI = nullptr;
}
- data.parent = NULL;
- data.parent_canvas_item = NULL;
+ data.parent = nullptr;
+ data.parent_canvas_item = nullptr;
/*
if (data.theme_owner && data.theme.is_null()) {
data.theme_owner=NULL;
@@ -621,7 +621,7 @@ void Control::_notification(int p_notification) {
if (!is_visible_in_tree()) {
- if (get_viewport() != NULL)
+ if (get_viewport() != nullptr)
get_viewport()->_gui_hid_control(this);
//remove key focus
@@ -753,7 +753,7 @@ Size2 Control::get_minimum_size() const {
if (si) {
Callable::CallError ce;
- Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, NULL, 0, ce);
+ Variant s = si->call(SceneStringNames::get_singleton()->_get_minimum_size, nullptr, 0, ce);
if (ce.error == Callable::CallError::CALL_OK)
return s;
}
@@ -799,8 +799,8 @@ bool Control::_find_theme_item(Control *p_theme_owner, Window *p_theme_owner_win
theme_owner_window = parent_w->theme_owner_window;
} else {
- theme_owner = NULL;
- theme_owner_window = NULL;
+ theme_owner = nullptr;
+ theme_owner_window = nullptr;
}
}
}
@@ -843,8 +843,8 @@ bool Control::_has_theme_item(Control *p_theme_owner, Window *p_theme_owner_wind
theme_owner_window = parent_w->theme_owner_window;
} else {
- theme_owner = NULL;
- theme_owner_window = NULL;
+ theme_owner = nullptr;
+ theme_owner_window = nullptr;
}
}
}
@@ -1034,37 +1034,37 @@ int Control::get_constants(Control *p_theme_owner, Window *p_theme_owner_window,
bool Control::has_theme_icon_override(const StringName &p_name) const {
const Ref<Texture2D> *tex = data.icon_override.getptr(p_name);
- return tex != NULL;
+ return tex != nullptr;
}
bool Control::has_theme_shader_override(const StringName &p_name) const {
const Ref<Shader> *sdr = data.shader_override.getptr(p_name);
- return sdr != NULL;
+ return sdr != nullptr;
}
bool Control::has_theme_stylebox_override(const StringName &p_name) const {
const Ref<StyleBox> *style = data.style_override.getptr(p_name);
- return style != NULL;
+ return style != nullptr;
}
bool Control::has_theme_font_override(const StringName &p_name) const {
const Ref<Font> *font = data.font_override.getptr(p_name);
- return font != NULL;
+ return font != nullptr;
}
bool Control::has_theme_color_override(const StringName &p_name) const {
const Color *color = data.color_override.getptr(p_name);
- return color != NULL;
+ return color != nullptr;
}
bool Control::has_theme_constant_override(const StringName &p_name) const {
const int *constant = data.constant_override.getptr(p_name);
- return constant != NULL;
+ return constant != nullptr;
}
bool Control::has_theme_icon(const StringName &p_name, const StringName &p_type) const {
@@ -1890,17 +1890,17 @@ void Control::set_focus_mode(FocusMode p_focus_mode) {
static Control *_next_control(Control *p_from) {
if (p_from->is_set_as_toplevel())
- return NULL; // can't go above
+ return nullptr; // can't go above
Control *parent = Object::cast_to<Control>(p_from->get_parent());
if (!parent) {
- return NULL;
+ return nullptr;
}
int next = p_from->get_position_in_parent();
- ERR_FAIL_INDEX_V(next, parent->get_child_count(), NULL);
+ ERR_FAIL_INDEX_V(next, parent->get_child_count(), nullptr);
for (int i = (next + 1); i < parent->get_child_count(); i++) {
Control *c = Object::cast_to<Control>(parent->get_child(i));
@@ -1927,9 +1927,9 @@ Control *Control::find_next_valid_focus() const {
Control *c;
if (n) {
c = Object::cast_to<Control>(n);
- ERR_FAIL_COND_V_MSG(!c, NULL, "Next focus node is not a control: " + n->get_name() + ".");
+ ERR_FAIL_COND_V_MSG(!c, nullptr, "Next focus node is not a control: " + n->get_name() + ".");
} else {
- return NULL;
+ return nullptr;
}
if (c->is_visible() && c->get_focus_mode() != FOCUS_NONE)
return c;
@@ -1937,7 +1937,7 @@ Control *Control::find_next_valid_focus() const {
// find next child
- Control *next_child = NULL;
+ Control *next_child = nullptr;
for (int i = 0; i < from->get_child_count(); i++) {
@@ -1974,7 +1974,7 @@ Control *Control::find_next_valid_focus() const {
}
if (next_child == this) // no next control->
- return (get_focus_mode() == FOCUS_ALL) ? next_child : NULL;
+ return (get_focus_mode() == FOCUS_ALL) ? next_child : nullptr;
if (next_child) {
if (next_child->get_focus_mode() == FOCUS_ALL)
return next_child;
@@ -1983,12 +1983,12 @@ Control *Control::find_next_valid_focus() const {
break;
}
- return NULL;
+ return nullptr;
}
static Control *_prev_control(Control *p_from) {
- Control *child = NULL;
+ Control *child = nullptr;
for (int i = p_from->get_child_count() - 1; i >= 0; i--) {
Control *c = Object::cast_to<Control>(p_from->get_child(i));
@@ -2018,9 +2018,9 @@ Control *Control::find_prev_valid_focus() const {
Control *c;
if (n) {
c = Object::cast_to<Control>(n);
- ERR_FAIL_COND_V_MSG(!c, NULL, "Previous focus node is not a control: " + n->get_name() + ".");
+ ERR_FAIL_COND_V_MSG(!c, nullptr, "Previous focus node is not a control: " + n->get_name() + ".");
} else {
- return NULL;
+ return nullptr;
}
if (c->is_visible() && c->get_focus_mode() != FOCUS_NONE)
return c;
@@ -2028,7 +2028,7 @@ Control *Control::find_prev_valid_focus() const {
// find prev child
- Control *prev_child = NULL;
+ Control *prev_child = nullptr;
if (from->is_set_as_toplevel() || !Object::cast_to<Control>(from->get_parent())) {
@@ -2060,7 +2060,7 @@ Control *Control::find_prev_valid_focus() const {
}
if (prev_child == this) // no prev control->
- return (get_focus_mode() == FOCUS_ALL) ? prev_child : NULL;
+ return (get_focus_mode() == FOCUS_ALL) ? prev_child : nullptr;
if (prev_child->get_focus_mode() == FOCUS_ALL)
return prev_child;
@@ -2068,7 +2068,7 @@ Control *Control::find_prev_valid_focus() const {
from = prev_child;
}
- return NULL;
+ return nullptr;
}
Control::FocusMode Control::get_focus_mode() const {
@@ -2221,7 +2221,7 @@ Control *Control::make_custom_tooltip(const String &p_text) const {
if (get_script_instance()) {
return const_cast<Control *>(this)->call("_make_custom_tooltip", p_text);
}
- return NULL;
+ return nullptr;
}
void Control::set_default_cursor_shape(CursorShape p_shape) {
@@ -2288,19 +2288,19 @@ NodePath Control::get_focus_previous() const {
Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
- ERR_FAIL_INDEX_V((int)p_margin, 4, NULL);
+ ERR_FAIL_INDEX_V((int)p_margin, 4, nullptr);
if (p_count >= MAX_NEIGHBOUR_SEARCH_COUNT)
- return NULL;
+ return nullptr;
if (!data.focus_neighbour[p_margin].is_empty()) {
- Control *c = NULL;
+ Control *c = nullptr;
Node *n = get_node(data.focus_neighbour[p_margin]);
if (n) {
c = Object::cast_to<Control>(n);
- ERR_FAIL_COND_V_MSG(!c, NULL, "Neighbor focus node is not a control: " + n->get_name() + ".");
+ ERR_FAIL_COND_V_MSG(!c, nullptr, "Neighbor focus node is not a control: " + n->get_name() + ".");
} else {
- return NULL;
+ return nullptr;
}
bool valid = true;
if (!c->is_visible())
@@ -2315,7 +2315,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
}
float dist = 1e7;
- Control *result = NULL;
+ Control *result = nullptr;
Point2 points[4];
@@ -2357,7 +2357,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
}
if (!base)
- return NULL;
+ return nullptr;
_window_find_focus_neighbour(vdir, base, points, maxd, dist, &result);
@@ -2515,7 +2515,7 @@ Control::MouseFilter Control::get_mouse_filter() const {
Control *Control::get_focus_owner() const {
- ERR_FAIL_COND_V(!is_inside_tree(), NULL);
+ ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
return get_viewport()->_gui_get_focus_owner();
}
@@ -2991,19 +2991,19 @@ void Control::_bind_methods() {
}
Control::Control() {
- data.parent = NULL;
+ data.parent = nullptr;
data.mouse_filter = MOUSE_FILTER_STOP;
- data.RI = NULL;
- data.theme_owner = NULL;
- data.theme_owner_window = NULL;
+ data.RI = nullptr;
+ data.theme_owner = nullptr;
+ data.theme_owner_window = nullptr;
data.default_cursor = CURSOR_ARROW;
data.h_size_flags = SIZE_FILL;
data.v_size_flags = SIZE_FILL;
data.expand = 1;
data.rotation = 0;
- data.parent_canvas_item = NULL;
+ data.parent_canvas_item = nullptr;
data.scale = Vector2(1, 1);
data.block_minimum_size_adjust = false;
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index a4f0338f00..6be74d8d29 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -34,11 +34,11 @@
#include "core/print_string.h"
#include "scene/gui/label.h"
-FileDialog::GetIconFunc FileDialog::get_icon_func = NULL;
-FileDialog::GetIconFunc FileDialog::get_large_icon_func = NULL;
+FileDialog::GetIconFunc FileDialog::get_icon_func = nullptr;
+FileDialog::GetIconFunc FileDialog::get_large_icon_func = nullptr;
-FileDialog::RegisterFunc FileDialog::register_func = NULL;
-FileDialog::RegisterFunc FileDialog::unregister_func = NULL;
+FileDialog::RegisterFunc FileDialog::register_func = nullptr;
+FileDialog::RegisterFunc FileDialog::unregister_func = nullptr;
VBoxContainer *FileDialog::get_vbox() {
return vbox;
@@ -195,7 +195,7 @@ void FileDialog::_action_pressed() {
if (mode == FILE_MODE_OPEN_FILES) {
- TreeItem *ti = tree->get_next_selected(NULL);
+ TreeItem *ti = tree->get_next_selected(nullptr);
String fbase = dir_access->get_current_dir();
Vector<String> files;
@@ -543,7 +543,7 @@ void FileDialog::update_file_list() {
files.pop_front();
}
- if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == NULL)
+ if (tree->get_root() && tree->get_root()->get_children() && tree->get_selected() == nullptr)
tree->get_root()->get_children()->select(0);
}
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index fd7935b376..e37e93e2a9 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -854,7 +854,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (in_box)
gn->set_selected(box_selection_mode_aditive);
else
- gn->set_selected(previus_selected.find(gn) != NULL);
+ gn->set_selected(previus_selected.find(gn) != nullptr);
}
top_layer->update();
@@ -872,7 +872,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (!gn)
continue;
- gn->set_selected(previus_selected.find(gn) != NULL);
+ gn->set_selected(previus_selected.find(gn) != nullptr);
}
top_layer->update();
} else {
@@ -922,7 +922,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
- GraphNode *gn = NULL;
+ GraphNode *gn = nullptr;
for (int i = get_child_count() - 1; i >= 0; i--) {
@@ -1323,7 +1323,7 @@ GraphEdit::GraphEdit() {
set_focus_mode(FOCUS_ALL);
awaiting_scroll_offset_update = false;
- top_layer = NULL;
+ top_layer = nullptr;
top_layer = memnew(GraphEditFilter(this));
add_child(top_layer);
top_layer->set_mouse_filter(MOUSE_FILTER_PASS);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index c28a60ff87..5dbc5bc50d 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -593,7 +593,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseButton> mb = p_ev;
if (mb.is_valid()) {
- ERR_FAIL_COND_MSG(get_parent_control() == NULL, "GraphNode must be the child of a GraphEdit node.");
+ ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 1ffc9712cc..bedcef2df2 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -282,7 +282,7 @@ void Label::_notification(int p_what) {
from = from->next;
}
- wc = to ? to->next : 0;
+ wc = to ? to->next : nullptr;
line++;
}
}
@@ -404,7 +404,7 @@ void Label::regenerate_word_cache() {
line_count = 1;
total_char_cache = 0;
- WordCache *last = NULL;
+ WordCache *last = nullptr;
for (int i = 0; i <= xl_text.length(); i++) {
@@ -447,7 +447,7 @@ void Label::regenerate_word_cache() {
}
if (i < xl_text.length() && xl_text[i] == ' ') {
- if (line_width > 0 || last == NULL || last->char_pos != WordCache::CHAR_WRAPLINE) {
+ if (line_width > 0 || last == nullptr || last->char_pos != WordCache::CHAR_WRAPLINE) {
space_count++;
line_width += space_width;
} else {
@@ -697,7 +697,7 @@ Label::Label(const String &p_text) {
align = ALIGN_LEFT;
valign = VALIGN_TOP;
xl_text = "";
- word_cache = NULL;
+ word_cache = nullptr;
word_cache_dirty = true;
autowrap = false;
line_count = 0;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 6c5f77f874..b9b7560f2e 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -630,7 +630,7 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) {
int selected = selection.end - selection.begin;
Ref<Font> font = get_theme_font("font");
- if (font != NULL) {
+ if (font != nullptr) {
for (int i = selection.begin; i < selection.end; i++)
cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
@@ -1001,7 +1001,7 @@ void LineEdit::paste_text() {
}
void LineEdit::undo() {
- if (undo_stack_pos == NULL) {
+ if (undo_stack_pos == nullptr) {
if (undo_stack.size() <= 1) {
return;
}
@@ -1023,7 +1023,7 @@ void LineEdit::undo() {
}
void LineEdit::redo() {
- if (undo_stack_pos == NULL) {
+ if (undo_stack_pos == nullptr) {
return;
}
if (undo_stack_pos == undo_stack.back()) {
@@ -1096,7 +1096,7 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) {
while (ofs < text.length()) {
int char_w = 0;
- if (font != NULL) {
+ if (font != nullptr) {
char_w = font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
pixel_ofs += char_w;
@@ -1148,7 +1148,7 @@ int LineEdit::get_cursor_pixel_pos() {
}
while (ofs < cursor_pos) {
- if (font != NULL) {
+ if (font != nullptr) {
pixel_ofs += font->get_char_size(pass ? secret_character[0] : text[ofs]).width;
}
ofs++;
@@ -1207,7 +1207,7 @@ void LineEdit::delete_char() {
if ((text.length() <= 0) || (cursor_pos == 0)) return;
Ref<Font> font = get_theme_font("font");
- if (font != NULL) {
+ if (font != nullptr) {
cached_width -= font->get_char_size(pass ? secret_character[0] : text[cursor_pos - 1]).width;
}
@@ -1226,7 +1226,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
if (text.size() > 0) {
Ref<Font> font = get_theme_font("font");
- if (font != NULL) {
+ if (font != nullptr) {
for (int i = p_from_column; i < p_to_column; i++)
cached_width -= font->get_char_size(pass ? secret_character[0] : text[i]).width;
}
@@ -1709,7 +1709,7 @@ void LineEdit::_emit_text_change() {
void LineEdit::update_cached_width() {
Ref<Font> font = get_theme_font("font");
cached_width = 0;
- if (font != NULL) {
+ if (font != nullptr) {
String text = get_text();
for (int i = 0; i < text.length(); i++) {
cached_width += font->get_char_size(pass ? secret_character[0] : text[i]).width;
@@ -1720,7 +1720,7 @@ void LineEdit::update_cached_width() {
void LineEdit::update_placeholder_width() {
Ref<Font> font = get_theme_font("font");
cached_placeholder_width = 0;
- if (font != NULL) {
+ if (font != nullptr) {
for (int i = 0; i < placeholder_translated.length(); i++) {
cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width;
}
@@ -1729,7 +1729,7 @@ void LineEdit::update_placeholder_width() {
void LineEdit::_clear_redo() {
_create_undo_state();
- if (undo_stack_pos == NULL) {
+ if (undo_stack_pos == nullptr) {
return;
}
@@ -1744,7 +1744,7 @@ void LineEdit::_clear_redo() {
void LineEdit::_clear_undo_stack() {
undo_stack.clear();
- undo_stack_pos = NULL;
+ undo_stack_pos = nullptr;
_create_undo_state();
}
@@ -1865,7 +1865,7 @@ void LineEdit::_bind_methods() {
LineEdit::LineEdit() {
- undo_stack_pos = NULL;
+ undo_stack_pos = nullptr;
_create_undo_state();
align = ALIGN_LEFT;
cached_width = 0;
diff --git a/scene/gui/panel.cpp b/scene/gui/panel.cpp
index ae51463a15..a17d0eb9c6 100644
--- a/scene/gui/panel.cpp
+++ b/scene/gui/panel.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "panel.h"
+
#include "core/print_string.h"
void Panel::_notification(int p_what) {
@@ -54,7 +55,11 @@ void Panel::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mode"), &Panel::get_mode);
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Background,Foreground"), "set_mode", "get_mode");
+
+ BIND_ENUM_CONSTANT(MODE_BACKGROUND);
+ BIND_ENUM_CONSTANT(MODE_FOREGROUND);
}
+
Panel::Panel() {
// Has visible stylebox, so stop by default.
set_mouse_filter(MOUSE_FILTER_STOP);
diff --git a/scene/gui/panel.h b/scene/gui/panel.h
index 739c64c0a6..75e266b6a6 100644
--- a/scene/gui/panel.h
+++ b/scene/gui/panel.h
@@ -40,7 +40,7 @@ class Panel : public Control {
public:
enum Mode {
MODE_BACKGROUND,
- MODE_FOREGROUND
+ MODE_FOREGROUND,
};
private:
@@ -59,4 +59,5 @@ public:
};
VARIANT_ENUM_CAST(Panel::Mode)
-#endif
+
+#endif // PANEL_H
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index c096dc94cb..1e933c9aa1 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -394,7 +394,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (allow_search && k.is_valid() && k->get_unicode()) {
+ if (allow_search && k.is_valid() && k->get_unicode() && k->is_pressed()) {
uint64_t now = OS::get_singleton()->get_ticks_msec();
uint64_t diff = now - search_time_msec;
@@ -1514,6 +1514,7 @@ PopupMenu::PopupMenu() {
submenu_over = -1;
initial_button_mask = 0;
during_grabbed_click = false;
+ invalidated_click = false;
allow_search = false;
search_time_msec = 0;
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index adc5f81465..ab2f64e1b4 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -236,7 +236,7 @@ void Range::_unref_shared() {
shared->owners.erase(this);
if (shared->owners.size() == 0) {
memdelete(shared);
- shared = NULL;
+ shared = nullptr;
}
}
}
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index d17eec4050..5fb2243aff 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -53,7 +53,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
return p_item->subitems.front()->get();
} else if (!p_item->parent) {
- return NULL;
+ return nullptr;
} else if (p_item->E->next()) {
return p_item->E->next()->get();
@@ -66,7 +66,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
if (p_item->parent)
return p_item->E->next()->get();
else
- return NULL;
+ return nullptr;
}
} else {
@@ -74,7 +74,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
return p_item->subitems.front()->get();
} else if (p_item->type == ITEM_FRAME) {
- return NULL;
+ return nullptr;
} else if (p_item->E->next()) {
return p_item->E->next()->get();
@@ -87,11 +87,11 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
if (p_item->type != ITEM_FRAME)
return p_item->E->next()->get();
else
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
}
RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
@@ -101,7 +101,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
return p_item->subitems.back()->get();
} else if (!p_item->parent) {
- return NULL;
+ return nullptr;
} else if (p_item->E->prev()) {
return p_item->E->prev()->get();
@@ -114,7 +114,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
if (p_item->parent)
return p_item->E->prev()->get();
else
- return NULL;
+ return nullptr;
}
} else {
@@ -122,7 +122,7 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
return p_item->subitems.back()->get();
} else if (p_item->type == ITEM_FRAME) {
- return NULL;
+ return nullptr;
} else if (p_item->E->prev()) {
return p_item->E->prev()->get();
@@ -135,11 +135,11 @@ RichTextLabel::Item *RichTextLabel::_get_prev_item(Item *p_item, bool p_free) {
if (p_item->type != ITEM_FRAME)
return p_item->E->prev()->get();
else
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
}
Rect2 RichTextLabel::_get_text_rect() {
@@ -158,7 +158,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
ci = get_canvas_item();
if (r_click_item)
- *r_click_item = NULL;
+ *r_click_item = nullptr;
}
Line &l = p_frame->lines.write[p_line];
Item *it = l.from;
@@ -356,7 +356,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
Color font_color_shadow;
bool underline = false;
bool strikethrough = false;
- ItemFade *fade = NULL;
+ ItemFade *fade = nullptr;
int it_char_start = p_char_count;
Vector<ItemFX *> fx_stack = Vector<ItemFX *>();
@@ -915,7 +915,7 @@ void RichTextLabel::_update_scroll() {
void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, float p_delta_time) {
Item *it = p_frame;
while (it) {
- ItemFX *ifx = NULL;
+ ItemFX *ifx = nullptr;
if (it->type == ITEM_CUSTOMFX || it->type == ITEM_SHAKE || it->type == ITEM_WAVE || it->type == ITEM_TORNADO || it->type == ITEM_RAINBOW) {
ifx = static_cast<ItemFX *>(it);
@@ -928,7 +928,7 @@ void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, float p_delta_
ifx->elapsed_time += p_delta_time;
- ItemShake *shake = NULL;
+ ItemShake *shake = nullptr;
if (it->type == ITEM_SHAKE) {
shake = static_cast<ItemShake *>(it);
@@ -952,7 +952,7 @@ void RichTextLabel::_notification(int p_what) {
case NOTIFICATION_MOUSE_EXIT: {
if (meta_hovering) {
- meta_hovering = NULL;
+ meta_hovering = nullptr;
emit_signal("meta_hover_ended", current_meta);
current_meta = false;
update();
@@ -1022,7 +1022,7 @@ void RichTextLabel::_notification(int p_what) {
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, font_color_shadow, use_outline, shadow_ofs, 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(), nullptr, nullptr, nullptr, total_chars);
total_chars += main->lines[from_line].char_count;
from_line++;
@@ -1040,7 +1040,7 @@ void RichTextLabel::_notification(int p_what) {
void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item, int *r_click_char, bool *r_outside) {
if (r_click_item)
- *r_click_item = NULL;
+ *r_click_item = nullptr;
Rect2 text_rect = _get_text_rect();
int ofs = vscroll->get_value();
@@ -1086,11 +1086,11 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const
return CURSOR_ARROW; //invalid
int line = 0;
- Item *item = NULL;
+ Item *item = nullptr;
bool outside;
((RichTextLabel *)(this))->_find_click(main, p_pos, &item, &line, &outside);
- if (item && !outside && ((RichTextLabel *)(this))->_find_meta(item, NULL))
+ if (item && !outside && ((RichTextLabel *)(this))->_find_meta(item, nullptr))
return CURSOR_POINTING_HAND;
return CURSOR_ARROW;
@@ -1108,7 +1108,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed() && !b->is_doubleclick()) {
scroll_updated = false;
int line = 0;
- Item *item = NULL;
+ Item *item = nullptr;
bool outside;
_find_click(main, b->get_position(), &item, &line, &outside);
@@ -1122,9 +1122,9 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
// Erase previous selection.
if (selection.active) {
- selection.from = NULL;
+ selection.from = nullptr;
selection.from_char = '\0';
- selection.to = NULL;
+ selection.to = nullptr;
selection.to_char = '\0';
selection.active = false;
@@ -1136,7 +1136,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
//doubleclick: select word
int line = 0;
- Item *item = NULL;
+ Item *item = nullptr;
bool outside;
_find_click(main, b->get_position(), &item, &line, &outside);
@@ -1163,11 +1163,11 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
}
} else if (!b->is_pressed()) {
- selection.click = NULL;
+ selection.click = nullptr;
if (!b->is_doubleclick() && !scroll_updated) {
int line = 0;
- Item *item = NULL;
+ Item *item = nullptr;
bool outside;
_find_click(main, b->get_position(), &item, &line, &outside);
@@ -1276,7 +1276,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
return;
int line = 0;
- Item *item = NULL;
+ Item *item = nullptr;
bool outside;
_find_click(main, m->get_position(), &item, &line, &outside);
@@ -1325,7 +1325,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
emit_signal("meta_hover_started", meta);
}
} else if (meta_hovering) {
- meta_hovering = NULL;
+ meta_hovering = nullptr;
emit_signal("meta_hover_ended", current_meta);
current_meta = false;
}
@@ -1641,7 +1641,7 @@ void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline)
}
}
- if (current_frame->lines[current_frame->lines.size() - 1].from == NULL) {
+ if (current_frame->lines[current_frame->lines.size() - 1].from == nullptr) {
current_frame->lines.write[current_frame->lines.size() - 1].from = p_item;
}
p_item->line = current_frame->lines.size() - 1;
@@ -1938,7 +1938,7 @@ void RichTextLabel::push_cell() {
item->cell = true;
item->parent_line = item->parent_frame->lines.size() - 1;
item->lines.resize(1);
- item->lines.write[0].from = NULL;
+ item->lines.write[0].from = nullptr;
item->first_invalid_line = 0;
}
@@ -1969,7 +1969,7 @@ void RichTextLabel::clear() {
main->lines.resize(1);
main->first_invalid_line = 0;
update();
- selection.click = NULL;
+ selection.click = nullptr;
selection.active = false;
current_idx = 1;
@@ -2953,7 +2953,7 @@ RichTextLabel::RichTextLabel() {
tab_size = 4;
default_align = ALIGN_LEFT;
underline_meta = true;
- meta_hovering = NULL;
+ meta_hovering = nullptr;
override_selected_font_color = false;
scroll_visible = false;
@@ -2977,7 +2977,7 @@ RichTextLabel::RichTextLabel() {
current_idx = 1;
use_bbcode = false;
- selection.click = NULL;
+ selection.click = nullptr;
selection.active = false;
selection.enabled = false;
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index dd439208af..7f2b5facb9 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -98,7 +98,7 @@ private:
int maximum_width;
Line() {
- from = NULL;
+ from = nullptr;
char_count = 0;
}
};
@@ -119,9 +119,11 @@ private:
}
Item() {
- parent = NULL;
- E = NULL;
+ parent = nullptr;
+ E = nullptr;
line = 0;
+ index = 0;
+ type = ITEM_FRAME;
}
virtual ~Item() { _clear_children(); }
};
@@ -135,7 +137,7 @@ private:
ItemFrame() {
type = ITEM_FRAME;
- parent_frame = NULL;
+ parent_frame = nullptr;
cell = false;
parent_line = 0;
}
@@ -368,8 +370,8 @@ 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 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);
+ 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 = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr, int p_char_count = 0);
+ void _find_click(ItemFrame *p_frame, const Point2i &p_click, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr);
Ref<Font> _find_font(Item *p_item);
int _find_margin(Item *p_item, const Ref<Font> &p_base_font);
@@ -377,7 +379,7 @@ private:
Color _find_color(Item *p_item, const Color &p_default_color);
bool _find_underline(Item *p_item);
bool _find_strikethrough(Item *p_item);
- bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = NULL);
+ bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = nullptr);
bool _find_layout_subitem(Item *from, Item *to);
bool _find_by_type(Item *p_item, ItemType p_type);
void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack);
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 5e9541730e..1c63c25e28 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -308,7 +308,7 @@ void ScrollBar::_notification(int p_what) {
drag_node->disconnect("tree_exiting", callable_mp(this, &ScrollBar::_drag_node_exit));
}
- drag_node = NULL;
+ drag_node = nullptr;
}
if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
@@ -542,7 +542,7 @@ void ScrollBar::_drag_node_exit() {
if (drag_node) {
drag_node->disconnect("gui_input", callable_mp(this, &ScrollBar::_drag_node_input));
}
- drag_node = NULL;
+ drag_node = nullptr;
}
void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
@@ -616,7 +616,7 @@ void ScrollBar::set_drag_node(const NodePath &p_path) {
}
}
- drag_node = NULL;
+ drag_node = nullptr;
drag_node_path = p_path;
if (is_inside_tree()) {
@@ -662,7 +662,7 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
orientation = p_orientation;
highlight = HIGHLIGHT_NONE;
custom_step = -1;
- drag_node = NULL;
+ drag_node = nullptr;
drag.active = false;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index ccfa8ebf63..8572d570fb 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -60,7 +60,7 @@ void SpinBox::_text_entered(const String &p_string) {
return;
}
- Variant value = expr->execute(Array(), NULL, false);
+ Variant value = expr->execute(Array(), nullptr, false);
if (value.get_type() != Variant::NIL) {
set_value(value);
_value_changed(0);
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 4eb614a9ac..de892a4fb9 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -50,7 +50,7 @@ Control *SplitContainer::_getch(int p_idx) const {
idx++;
}
- return NULL;
+ return nullptr;
}
void SplitContainer::_resort() {
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 7cecbf7fa2..de80049862 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -602,7 +602,7 @@ Control *TabContainer::get_tab_control(int p_idx) const {
if (p_idx >= 0 && p_idx < tabs.size())
return tabs[p_idx];
else
- return NULL;
+ return nullptr;
}
Control *TabContainer::get_current_tab_control() const {
@@ -611,7 +611,7 @@ Control *TabContainer::get_current_tab_control() const {
if (current >= 0 && current < tabs.size())
return tabs[current];
else
- return NULL;
+ return nullptr;
}
void TabContainer::remove_child_notify(Node *p_child) {
@@ -1041,7 +1041,7 @@ TabContainer::TabContainer() {
previous = 0;
align = ALIGN_CENTER;
tabs_visible = true;
- popup = NULL;
+ popup = nullptr;
drag_to_rearrange_enabled = false;
tabs_rearrange_group = -1;
use_hidden_tabs_for_min_size = false;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7071652f2a..36e35897d1 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2186,7 +2186,7 @@ Vector2i TextEdit::_get_cursor_pixel_pos() {
int x = cache.style_normal->get_margin(MARGIN_LEFT) + cache.line_number_w + cache.breakpoint_gutter_width + cache.fold_gutter_width + cache.info_gutter_width - cursor.x_ofs;
int ix = 0;
while (ix < rows2[0].size() && ix < cursor.column) {
- if (cache.font != NULL) {
+ if (cache.font != nullptr) {
x += cache.font->get_char_size(rows2[0].get(ix)).width;
}
ix++;
@@ -3990,7 +3990,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
text.set_breakpoint(p_line, false);
text.set_hidden(p_line, false);
- text.set_info_icon(p_line, NULL, "");
+ text.set_info_icon(p_line, nullptr, "");
}
text.set_line_wrap_amount(p_line, -1);
@@ -6087,7 +6087,7 @@ void TextEdit::_do_text_op(const TextOperation &p_op, bool p_reverse) {
void TextEdit::_clear_redo() {
- if (undo_stack_pos == NULL)
+ if (undo_stack_pos == nullptr)
return; // Nothing to clear.
_push_current_op();
@@ -6103,7 +6103,7 @@ void TextEdit::undo() {
_push_current_op();
- if (undo_stack_pos == NULL) {
+ if (undo_stack_pos == nullptr) {
if (!undo_stack.size())
return; // Nothing to undo.
@@ -6152,7 +6152,7 @@ void TextEdit::redo() {
_push_current_op();
- if (undo_stack_pos == NULL)
+ if (undo_stack_pos == nullptr)
return; // Nothing to do.
deselect();
@@ -6184,7 +6184,7 @@ void TextEdit::clear_undo_history() {
saved_version = 0;
current_op.type = TextOperation::TYPE_NONE;
- undo_stack_pos = NULL;
+ undo_stack_pos = nullptr;
undo_stack.clear();
}
@@ -6633,8 +6633,8 @@ void TextEdit::_update_completion_candidates() {
const CharType *tgt = &option.display[0];
const CharType *tgt_lower = &display_lower[0];
- const CharType *ssq_last_tgt = NULL;
- const CharType *ssq_lower_last_tgt = NULL;
+ const CharType *ssq_last_tgt = nullptr;
+ const CharType *ssq_lower_last_tgt = nullptr;
for (; *tgt; tgt++, tgt_lower++) {
if (*ssq == *tgt) {
@@ -6701,7 +6701,7 @@ void TextEdit::query_code_comple() {
bool ignored = completion_active && !completion_options.empty();
if (ignored) {
ScriptCodeCompletionOption::Kind kind = ScriptCodeCompletionOption::KIND_PLAIN_TEXT;
- const ScriptCodeCompletionOption *previous_option = NULL;
+ const ScriptCodeCompletionOption *previous_option = nullptr;
for (int i = 0; i < completion_options.size(); i++) {
const ScriptCodeCompletionOption &current_option = completion_options[i];
if (!previous_option) {
@@ -7259,7 +7259,7 @@ TextEdit::TextEdit() {
wrap_at = 0;
wrap_right_offset = 10;
set_focus_mode(FOCUS_ALL);
- syntax_highlighter = NULL;
+ syntax_highlighter = nullptr;
_update_caches();
cache.row_height = 1;
cache.line_spacing = 1;
@@ -7323,7 +7323,7 @@ TextEdit::TextEdit() {
current_op.type = TextOperation::TYPE_NONE;
undo_enabled = true;
- undo_stack_pos = NULL;
+ undo_stack_pos = nullptr;
setting_text = false;
last_dblclk = 0;
current_op.version = 0;
@@ -7333,7 +7333,7 @@ TextEdit::TextEdit() {
completion_enabled = false;
completion_active = false;
completion_line_ofs = 0;
- tooltip_obj = NULL;
+ tooltip_obj = nullptr;
line_numbers = false;
line_numbers_zero_padded = false;
line_length_guidelines = false;
@@ -7394,7 +7394,7 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int
return syntax_highlighting_cache[p_line];
}
- if (syntax_highlighter != NULL) {
+ if (syntax_highlighter != nullptr) {
Map<int, HighlighterInfo> color_map = syntax_highlighter->_get_line_syntax_highlighting(p_line);
syntax_highlighting_cache[p_line] = color_map;
return color_map;
@@ -7508,7 +7508,7 @@ Map<int, TextEdit::HighlighterInfo> TextEdit::_get_line_syntax_highlighting(int
if (col) {
for (int k = j - 1; k >= 0; k--) {
if (str[k] == '.') {
- col = NULL; // Member indexing not allowed.
+ col = nullptr; // Member indexing not allowed.
break;
} else if (str[k] > 32) {
break;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 7d096f7897..ef8c39d32f 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -530,7 +530,7 @@ private:
protected:
virtual String get_tooltip(const Point2 &p_pos) const;
- void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL);
+ void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = nullptr, int *r_end_char = nullptr);
void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
void _insert_text_at_cursor(const String &p_text);
void _gui_input(const Ref<InputEvent> &p_gui_input);
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 87425b49cd..a7acaae8df 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -71,7 +71,7 @@ void TreeItem::move_to_bottom() {
parent->children = next;
}
last->next = this;
- next = NULL;
+ next = nullptr;
}
Size2 TreeItem::Cell::get_icon_size() const {
@@ -371,7 +371,7 @@ TreeItem *TreeItem::get_next() {
TreeItem *TreeItem::get_prev() {
if (!parent || parent->children == this)
- return NULL;
+ return nullptr;
TreeItem *prev = parent->children;
while (prev && prev->next != this)
@@ -400,7 +400,7 @@ TreeItem *TreeItem::get_prev_visible(bool p_wrap) {
current = current->parent;
if (current == tree->root && tree->hide_root) {
- return NULL;
+ return nullptr;
} else if (!current) {
if (p_wrap) {
current = this;
@@ -410,7 +410,7 @@ TreeItem *TreeItem::get_prev_visible(bool p_wrap) {
temp = temp->get_next_visible();
}
} else {
- return NULL;
+ return nullptr;
}
}
} else {
@@ -450,7 +450,7 @@ TreeItem *TreeItem::get_next_visible(bool p_wrap) {
if (p_wrap)
return tree->root;
else
- return NULL;
+ return nullptr;
} else {
current = current->next;
}
@@ -472,7 +472,7 @@ void TreeItem::remove_child(TreeItem *p_item) {
*c = (*c)->next;
- aux->parent = NULL;
+ aux->parent = nullptr;
return;
}
@@ -890,11 +890,11 @@ void TreeItem::clear_children() {
TreeItem *aux = c;
c = c->get_next();
- aux->parent = 0; // so it won't try to recursively autoremove from me in here
+ aux->parent = nullptr; // so it won't try to recursively autoremove from me in here
memdelete(aux);
}
- children = 0;
+ children = nullptr;
};
TreeItem::TreeItem(Tree *p_tree) {
@@ -904,9 +904,9 @@ TreeItem::TreeItem(Tree *p_tree) {
disable_folding = false;
custom_min_height = 0;
- parent = 0; // parent item
- next = 0; // next in list
- children = 0; //child items
+ parent = nullptr; // parent item
+ next = nullptr; // next in list
+ children = nullptr; //child items
}
TreeItem::~TreeItem() {
@@ -918,29 +918,29 @@ TreeItem::~TreeItem() {
if (tree && tree->root == this) {
- tree->root = 0;
+ tree->root = nullptr;
}
if (tree && tree->popup_edited_item == this) {
- tree->popup_edited_item = NULL;
+ tree->popup_edited_item = nullptr;
tree->pressing_for_editor = false;
}
if (tree && tree->cache.hover_item == this) {
- tree->cache.hover_item = NULL;
+ tree->cache.hover_item = nullptr;
}
if (tree && tree->selected_item == this)
- tree->selected_item = NULL;
+ tree->selected_item = nullptr;
if (tree && tree->drop_mode_over == this)
- tree->drop_mode_over = NULL;
+ tree->drop_mode_over = nullptr;
if (tree && tree->single_select_defer == this)
- tree->single_select_defer = NULL;
+ tree->single_select_defer = nullptr;
if (tree && tree->edited_item == this) {
- tree->edited_item = NULL;
+ tree->edited_item = nullptr;
tree->pressing_for_editor = false;
}
}
@@ -1498,7 +1498,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
int parent_ofs = p_pos.x + ((p_item->disable_folding || hide_folding) ? cache.hseparation : cache.item_margin);
Point2i root_pos = Point2i(root_ofs, children_pos.y + label_h / 2) - cache.offset + p_draw_ofs;
- if (c->get_children() != NULL)
+ if (c->get_children() != nullptr)
root_pos -= Point2i(cache.arrow->get_width(), 0);
float line_width = 1.0;
@@ -2131,7 +2131,7 @@ void Tree::popup_select(int p_option) {
void Tree::_go_left() {
if (selected_col == 0) {
- if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) {
+ if (selected_item->get_children() != nullptr && !selected_item->is_collapsed()) {
selected_item->set_collapsed(true);
} else {
if (columns.size() == 1) { // goto parent with one column
@@ -2160,7 +2160,7 @@ void Tree::_go_left() {
void Tree::_go_right() {
if (selected_col == (columns.size() - 1)) {
- if (selected_item->get_children() != NULL && selected_item->is_collapsed()) {
+ if (selected_item->get_children() != nullptr && selected_item->is_collapsed()) {
selected_item->set_collapsed(false);
} else if (selected_item->get_next_visible()) {
selected_col = 0;
@@ -2181,7 +2181,7 @@ void Tree::_go_right() {
}
void Tree::_go_up() {
- TreeItem *prev = NULL;
+ TreeItem *prev = nullptr;
if (!selected_item) {
prev = get_last_item();
selected_col = 0;
@@ -2221,7 +2221,7 @@ void Tree::_go_up() {
}
void Tree::_go_down() {
- TreeItem *next = NULL;
+ TreeItem *next = nullptr;
if (!selected_item) {
if (root) {
@@ -2324,7 +2324,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (!cursor_can_exit_tree) accept_event();
- TreeItem *next = NULL;
+ TreeItem *next = nullptr;
if (!selected_item)
return;
next = selected_item;
@@ -2362,7 +2362,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (!cursor_can_exit_tree) accept_event();
- TreeItem *prev = NULL;
+ TreeItem *prev = nullptr;
if (!selected_item)
return;
prev = selected_item;
@@ -2584,7 +2584,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (single_select_defer) {
select_single_item(single_select_defer, root, single_select_defer_column);
- single_select_defer = NULL;
+ single_select_defer = nullptr;
}
range_click_timer->stop();
@@ -2609,7 +2609,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
pressing_for_editor = false;
}
- if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != NULL) {
+ if (cache.click_type == Cache::CLICK_BUTTON && cache.click_item != nullptr) {
// make sure in case of wrong reference after reconstructing whole TreeItems
cache.click_item = get_item_at_position(cache.click_pos);
emit_signal("button_pressed", cache.click_item, cache.click_column, cache.click_id);
@@ -2617,7 +2617,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
cache.click_type = Cache::CLICK_NONE;
cache.click_index = -1;
cache.click_id = -1;
- cache.click_item = NULL;
+ cache.click_item = nullptr;
cache.click_column = 0;
if (drag_touching) {
@@ -2711,7 +2711,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
}
if (b->get_button_index() == BUTTON_LEFT) {
- if (get_item_at_position(b->get_position()) == NULL && !b->get_shift() && !b->get_control() && !b->get_command())
+ if (get_item_at_position(b->get_position()) == nullptr && !b->get_shift() && !b->get_control() && !b->get_command())
emit_signal("nothing_selected");
}
}
@@ -2946,7 +2946,7 @@ void Tree::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAG_BEGIN) {
- single_select_defer = NULL;
+ single_select_defer = nullptr;
if (cache.scroll_speed > 0) {
scrolling = true;
set_physics_process_internal(true);
@@ -3076,7 +3076,7 @@ void Tree::_notification(int p_what) {
if (p_what == NOTIFICATION_RESIZED || p_what == NOTIFICATION_TRANSFORM_CHANGED) {
- if (popup_edited_item != NULL) {
+ if (popup_edited_item != nullptr) {
Rect2 rect = popup_edited_item->get_meta("__focus_rect");
Vector2 ofs(0, (text_editor->get_size().height - rect.size.height) / 2);
Point2i textedpos = get_global_position() + rect.position - ofs;
@@ -3097,18 +3097,18 @@ Size2 Tree::get_minimum_size() const {
TreeItem *Tree::create_item(TreeItem *p_parent, int p_idx) {
- ERR_FAIL_COND_V(blocked > 0, NULL);
+ ERR_FAIL_COND_V(blocked > 0, nullptr);
- TreeItem *ti = NULL;
+ TreeItem *ti = nullptr;
if (p_parent) {
// Append or insert a new item to the given parent.
ti = memnew(TreeItem(this));
- ERR_FAIL_COND_V(!ti, NULL);
+ ERR_FAIL_COND_V(!ti, nullptr);
ti->cells.resize(columns.size());
- TreeItem *prev = NULL;
+ TreeItem *prev = nullptr;
TreeItem *c = p_parent->children;
int idx = 0;
@@ -3132,7 +3132,7 @@ TreeItem *Tree::create_item(TreeItem *p_parent, int p_idx) {
if (!root) {
// No root exists, make the given item the new root.
ti = memnew(TreeItem(this));
- ERR_FAIL_COND_V(!ti, NULL);
+ ERR_FAIL_COND_V(!ti, nullptr);
ti->cells.resize(columns.size());
root = ti;
@@ -3227,7 +3227,7 @@ void Tree::deselect_all() {
ERR_FAIL_COND(item == prev_item);
}
- selected_item = NULL;
+ selected_item = nullptr;
selected_col = -1;
update();
@@ -3235,7 +3235,7 @@ void Tree::deselect_all() {
bool Tree::is_anything_selected() {
- return (selected_item != NULL);
+ return (selected_item != nullptr);
}
void Tree::clear() {
@@ -3253,12 +3253,12 @@ void Tree::clear() {
if (root) {
memdelete(root);
- root = NULL;
+ root = nullptr;
};
- selected_item = NULL;
- edited_item = NULL;
- popup_edited_item = NULL;
+ selected_item = nullptr;
+ edited_item = nullptr;
+ popup_edited_item = nullptr;
update();
};
@@ -3315,10 +3315,10 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) {
/*
if (!p_item)
- return NULL;
+ return nullptr;
*/
if (!root)
- return NULL;
+ return nullptr;
while (true) {
@@ -3338,8 +3338,8 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) {
while (!p_item->next) {
p_item = p_item->parent;
- if (p_item == NULL)
- return NULL;
+ if (p_item == nullptr)
+ return nullptr;
}
p_item = p_item->next;
@@ -3351,7 +3351,7 @@ TreeItem *Tree::get_next_selected(TreeItem *p_item) {
return p_item;
}
- return NULL;
+ return nullptr;
}
int Tree::get_column_width(int p_column) const {
@@ -3458,7 +3458,7 @@ int Tree::get_item_offset(TreeItem *p_item) const {
while (!it->next) {
it = it->parent;
- if (it == NULL)
+ if (it == nullptr)
return 0;
}
@@ -3626,7 +3626,7 @@ TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_c
break;
}
- return NULL;
+ return nullptr;
}
TreeItem *Tree::search_item_text(const String &p_find, int *r_col, bool p_selectable) {
@@ -3636,7 +3636,7 @@ TreeItem *Tree::search_item_text(const String &p_find, int *r_col, bool p_select
if (!from)
from = root;
if (!from)
- return NULL;
+ return nullptr;
return _search_item_text(from->get_next_visible(true), p_find, r_col, p_selectable);
}
@@ -3649,7 +3649,7 @@ TreeItem *Tree::get_item_with_text(const String &p_find) const {
}
}
}
- return NULL;
+ return nullptr;
}
void Tree::_do_incr_search(const String &p_add) {
@@ -3703,7 +3703,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
pos.x -= w;
}
- return NULL;
+ return nullptr;
} else {
pos.y -= h;
@@ -3714,7 +3714,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
}
if (p_item->is_collapsed())
- return NULL; // do not try children, it's collapsed
+ return nullptr; // do not try children, it's collapsed
TreeItem *n = p_item->get_children();
while (n) {
@@ -3728,7 +3728,7 @@ TreeItem *Tree::_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_
n = n->get_next();
}
- return NULL;
+ return nullptr;
}
int Tree::get_column_at_position(const Point2 &p_pos) const {
@@ -3790,7 +3790,7 @@ TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const {
pos -= cache.bg->get_offset();
pos.y -= _get_title_button_height();
if (pos.y < 0)
- return NULL;
+ return nullptr;
if (h_scroll->is_visible_in_tree())
pos.x += h_scroll->get_value();
@@ -3806,7 +3806,7 @@ TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const {
}
}
- return NULL;
+ return nullptr;
}
String Tree::get_tooltip(const Point2 &p_pos) const {
@@ -3883,7 +3883,7 @@ void Tree::set_drop_mode_flags(int p_flags) {
return;
drop_mode_flags = p_flags;
if (drop_mode_flags == 0) {
- drop_mode_over = NULL;
+ drop_mode_over = nullptr;
}
update();
@@ -4015,17 +4015,17 @@ Tree::Tree() {
selected_col = 0;
columns.resize(1);
- selected_item = NULL;
- edited_item = NULL;
+ selected_item = nullptr;
+ edited_item = nullptr;
selected_col = -1;
edited_col = -1;
hide_root = false;
select_mode = SELECT_SINGLE;
- root = 0;
- popup_menu = NULL;
- popup_edited_item = NULL;
- text_editor = NULL;
+ root = nullptr;
+ popup_menu = nullptr;
+ popup_edited_item = nullptr;
+ text_editor = nullptr;
set_focus_mode(FOCUS_ALL);
popup_menu = memnew(PopupMenu);
@@ -4078,7 +4078,7 @@ Tree::Tree() {
cache.hover_index = -1;
cache.click_index = -1;
cache.click_id = -1;
- cache.click_item = NULL;
+ cache.click_item = nullptr;
cache.click_column = 0;
cache.hover_cell = -1;
last_keypress = 0;
@@ -4098,9 +4098,9 @@ Tree::Tree() {
hide_folding = false;
drop_mode_flags = 0;
- drop_mode_over = NULL;
+ drop_mode_over = nullptr;
drop_mode_section = 0;
- single_select_defer = NULL;
+ single_select_defer = nullptr;
scrolling = false;
allow_rmb_select = false;
@@ -4108,7 +4108,7 @@ Tree::Tree() {
set_clip_contents(true);
- cache.hover_item = NULL;
+ cache.hover_item = nullptr;
cache.hover_cell = -1;
allow_reselect = false;
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index becbe76598..87c2588a12 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -383,7 +383,7 @@ private:
//void draw_item_text(String p_text,const Ref<Texture2D>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color);
void draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color);
int draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 &p_draw_size, TreeItem *p_item);
- void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = NULL, bool *r_in_range = NULL, bool p_force_deselect = false);
+ void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = nullptr, bool *r_in_range = nullptr, bool p_force_deselect = false);
int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod);
void _text_editor_enter(String p_text);
void _text_editor_modal_close();
@@ -584,7 +584,7 @@ public:
bool edit_selected();
// First item that starts with the text, from the current focused item down and wraps around.
- TreeItem *search_item_text(const String &p_find, int *r_col = NULL, bool p_selectable = false);
+ TreeItem *search_item_text(const String &p_find, int *r_col = nullptr, bool p_selectable = false);
// First item that matches the whole text, from the first item down.
TreeItem *get_item_with_text(const String &p_find) const;
diff --git a/scene/main/SCsub b/scene/main/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/main/SCsub
+++ b/scene/main/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 4a415415f1..6fb5cbacbd 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -43,9 +43,9 @@
#include "servers/rendering_server.h"
Mutex CanvasItemMaterial::material_mutex;
-SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = NULL;
+SelfList<CanvasItemMaterial>::List *CanvasItemMaterial::dirty_materials = nullptr;
Map<CanvasItemMaterial::MaterialKey, CanvasItemMaterial::ShaderData> CanvasItemMaterial::shader_map;
-CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = NULL;
+CanvasItemMaterial::ShaderNames *CanvasItemMaterial::shader_names = nullptr;
void CanvasItemMaterial::init_shaders() {
@@ -62,7 +62,7 @@ void CanvasItemMaterial::finish_shaders() {
memdelete(dirty_materials);
memdelete(shader_names);
- dirty_materials = NULL;
+ dirty_materials = nullptr;
}
void CanvasItemMaterial::_update_shader() {
@@ -411,7 +411,7 @@ void CanvasItem::hide() {
_change_notify("visible");
}
-CanvasItem *CanvasItem::current_item_drawn = NULL;
+CanvasItem *CanvasItem::current_item_drawn = nullptr;
CanvasItem *CanvasItem::get_current_item_drawn() {
return current_item_drawn;
}
@@ -435,9 +435,9 @@ void CanvasItem::_update_callback() {
notification(NOTIFICATION_DRAW);
emit_signal(SceneStringNames::get_singleton()->draw);
if (get_script_instance()) {
- get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0);
+ get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, nullptr, 0);
}
- current_item_drawn = NULL;
+ current_item_drawn = nullptr;
drawing = false;
}
//todo updating = false
@@ -504,7 +504,7 @@ void CanvasItem::_enter_canvas() {
Node *n = this;
- canvas_layer = NULL;
+ canvas_layer = nullptr;
while (n) {
@@ -554,7 +554,7 @@ void CanvasItem::_exit_canvas() {
notification(NOTIFICATION_EXIT_CANVAS, true); //reverse the notification
RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, RID());
- canvas_layer = NULL;
+ canvas_layer = nullptr;
group = "";
}
@@ -617,7 +617,7 @@ void CanvasItem::_notification(int p_what) {
_exit_canvas();
if (C) {
Object::cast_to<CanvasItem>(get_parent())->children_items.erase(C);
- C = NULL;
+ C = nullptr;
}
if (window) {
window->disconnect(SceneStringNames::get_singleton()->visibility_changed, callable_mp(this, &CanvasItem::_window_visibility_changed));
@@ -703,7 +703,7 @@ bool CanvasItem::is_set_as_toplevel() const {
CanvasItem *CanvasItem::get_parent_item() const {
if (toplevel)
- return NULL;
+ return nullptr;
return Object::cast_to<CanvasItem>(get_parent());
}
@@ -1470,7 +1470,7 @@ CanvasItem::CanvasItem() :
behind = false;
block_transform_notify = false;
//viewport=NULL;
- canvas_layer = NULL;
+ canvas_layer = nullptr;
use_parent_material = false;
global_invalid = true;
notify_local_transform = false;
@@ -1481,7 +1481,7 @@ CanvasItem::CanvasItem() :
texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
- C = NULL;
+ C = nullptr;
}
CanvasItem::~CanvasItem() {
diff --git a/scene/main/canvas_layer.cpp b/scene/main/canvas_layer.cpp
index e6a665d035..15f64390de 100644
--- a/scene/main/canvas_layer.cpp
+++ b/scene/main/canvas_layer.cpp
@@ -320,13 +320,13 @@ void CanvasLayer::_bind_methods() {
CanvasLayer::CanvasLayer() {
- vp = NULL;
+ vp = nullptr;
scale = Vector2(1, 1);
rot = 0;
locrotscale_dirty = false;
layer = 1;
canvas = RS::get_singleton()->canvas_create();
- custom_viewport = NULL;
+ custom_viewport = nullptr;
sort_index = 0;
follow_viewport = false;
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index fee2ada76d..dc0da015ac 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -162,12 +162,12 @@ void HTTPRequest::cancel_request() {
thread_request_quit = true;
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
}
if (file) {
memdelete(file);
- file = NULL;
+ file = nullptr;
}
client->close();
body.resize(0);
@@ -566,7 +566,7 @@ void HTTPRequest::_bind_methods() {
HTTPRequest::HTTPRequest() {
- thread = NULL;
+ thread = nullptr;
port = 80;
redirections = 0;
@@ -583,7 +583,7 @@ HTTPRequest::HTTPRequest() {
thread_done = false;
downloaded = 0;
body_size_limit = -1;
- file = NULL;
+ file = nullptr;
timer = memnew(Timer);
timer->set_one_shot(true);
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp
index fe238af1c4..78958a7a1c 100644
--- a/scene/main/instance_placeholder.cpp
+++ b/scene/main/instance_placeholder.cpp
@@ -77,11 +77,11 @@ String InstancePlaceholder::get_instance_path() const {
Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene> &p_custom_scene) {
- ERR_FAIL_COND_V(!is_inside_tree(), NULL);
+ ERR_FAIL_COND_V(!is_inside_tree(), nullptr);
Node *base = get_parent();
if (!base)
- return NULL;
+ return nullptr;
Ref<PackedScene> ps;
if (p_custom_scene.is_valid())
@@ -90,10 +90,10 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene
ps = ResourceLoader::load(path, "PackedScene");
if (!ps.is_valid())
- return NULL;
+ return nullptr;
Node *scene = ps->instance();
if (!scene)
- return NULL;
+ return nullptr;
scene->set_name(get_name());
int pos = get_position_in_parent();
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index b882b9ead6..6b46ffd8ad 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -82,7 +82,7 @@ void Node::_notification(int p_notification) {
if (data.parent)
data.pause_owner = data.parent->data.pause_owner;
else
- data.pause_owner = NULL;
+ data.pause_owner = nullptr;
} else {
data.pause_owner = this;
}
@@ -112,17 +112,17 @@ void Node::_notification(int p_notification) {
if (data.unhandled_key_input)
remove_from_group("_vp_unhandled_key_input" + itos(get_viewport()->get_instance_id()));
- data.pause_owner = NULL;
+ data.pause_owner = nullptr;
if (data.path_cache) {
memdelete(data.path_cache);
- data.path_cache = NULL;
+ data.path_cache = nullptr;
}
} break;
case NOTIFICATION_PATH_CHANGED: {
if (data.path_cache) {
memdelete(data.path_cache);
- data.path_cache = NULL;
+ data.path_cache = nullptr;
}
} break;
case NOTIFICATION_READY: {
@@ -149,7 +149,7 @@ void Node::_notification(int p_notification) {
set_physics_process(true);
}
- get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
+ get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, nullptr, 0);
}
} break;
@@ -158,11 +158,11 @@ void Node::_notification(int p_notification) {
} break;
case NOTIFICATION_PREDELETE: {
- set_owner(NULL);
+ set_owner(nullptr);
while (data.owned.size()) {
- data.owned.front()->get()->set_owner(NULL);
+ data.owned.front()->get()->set_owner(nullptr);
}
if (data.parent) {
@@ -226,7 +226,7 @@ void Node::_propagate_enter_tree() {
if (get_script_instance()) {
- get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, NULL, 0);
+ get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, nullptr, 0);
}
emit_signal(SceneStringNames::get_singleton()->tree_entered);
@@ -278,7 +278,7 @@ void Node::_propagate_exit_tree() {
if (get_script_instance()) {
- get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0);
+ get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, nullptr, 0);
}
emit_signal(SceneStringNames::get_singleton()->tree_exiting);
@@ -290,17 +290,17 @@ void Node::_propagate_exit_tree() {
for (Map<StringName, GroupData>::Element *E = data.grouped.front(); E; E = E->next()) {
data.tree->remove_from_group(E->key(), this);
- E->get().group = NULL;
+ E->get().group = nullptr;
}
- data.viewport = NULL;
+ data.viewport = nullptr;
if (data.tree)
data.tree->tree_changed();
data.inside_tree = false;
data.ready_notified = false;
- data.tree = NULL;
+ data.tree = nullptr;
data.depth = -1;
}
@@ -423,7 +423,7 @@ void Node::set_pause_mode(PauseMode p_mode) {
if ((data.pause_mode == PAUSE_MODE_INHERIT) == prev_inherits)
return; ///nothing changed
- Node *owner = NULL;
+ Node *owner = nullptr;
if (data.pause_mode == PAUSE_MODE_INHERIT) {
@@ -914,7 +914,7 @@ void Node::set_process_priority(int p_priority) {
data.process_priority = p_priority;
// Make sure we are in SceneTree.
- if (data.tree == NULL) {
+ if (data.tree == nullptr) {
return;
}
@@ -1295,7 +1295,7 @@ void Node::_propagate_validate_owner() {
if (!found) {
data.owner->data.owned.erase(data.OW);
- data.owner = NULL;
+ data.owner = nullptr;
}
}
@@ -1336,7 +1336,7 @@ void Node::remove_child(Node *p_child) {
//if (data.scene) { does not matter
- p_child->_set_tree(NULL);
+ p_child->_set_tree(nullptr);
//}
remove_child_notify(p_child);
@@ -1354,7 +1354,7 @@ void Node::remove_child(Node *p_child) {
children[i]->notification(NOTIFICATION_MOVED_IN_PARENT);
}
- p_child->data.parent = NULL;
+ p_child->data.parent = nullptr;
p_child->data.pos = -1;
// validate owner
@@ -1371,7 +1371,7 @@ int Node::get_child_count() const {
}
Node *Node::get_child(int p_index) const {
- ERR_FAIL_INDEX_V(p_index, data.children.size(), NULL);
+ ERR_FAIL_INDEX_V(p_index, data.children.size(), nullptr);
return data.children[p_index];
}
@@ -1386,19 +1386,19 @@ Node *Node::_get_child_by_name(const StringName &p_name) const {
return cd[i];
}
- return NULL;
+ return nullptr;
}
Node *Node::get_node_or_null(const NodePath &p_path) const {
if (p_path.is_empty()) {
- return NULL;
+ return nullptr;
}
- ERR_FAIL_COND_V_MSG(!data.inside_tree && p_path.is_absolute(), NULL, "Can't use get_node() with absolute paths from outside the active scene tree.");
+ ERR_FAIL_COND_V_MSG(!data.inside_tree && p_path.is_absolute(), nullptr, "Can't use get_node() with absolute paths from outside the active scene tree.");
- Node *current = NULL;
- Node *root = NULL;
+ Node *current = nullptr;
+ Node *root = nullptr;
if (!p_path.is_absolute()) {
current = const_cast<Node *>(this); //start from this
@@ -1412,7 +1412,7 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
for (int i = 0; i < p_path.get_name_count(); i++) {
StringName name = p_path.get_name(i);
- Node *next = NULL;
+ Node *next = nullptr;
if (name == SceneStringNames::get_singleton()->dot) { // .
@@ -1420,18 +1420,18 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
} else if (name == SceneStringNames::get_singleton()->doubledot) { // ..
- if (current == NULL || !current->data.parent)
- return NULL;
+ if (current == nullptr || !current->data.parent)
+ return nullptr;
next = current->data.parent;
- } else if (current == NULL) {
+ } else if (current == nullptr) {
if (name == root->get_name())
next = root;
} else {
- next = NULL;
+ next = nullptr;
for (int j = 0; j < current->data.children.size(); j++) {
@@ -1443,8 +1443,8 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
break;
}
}
- if (next == NULL) {
- return NULL;
+ if (next == nullptr) {
+ return nullptr;
};
}
current = next;
@@ -1456,13 +1456,13 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
Node *Node::get_node(const NodePath &p_path) const {
Node *node = get_node_or_null(p_path);
- ERR_FAIL_COND_V_MSG(!node, NULL, "Node not found: " + p_path + ".");
+ ERR_FAIL_COND_V_MSG(!node, nullptr, "Node not found: " + p_path + ".");
return node;
}
bool Node::has_node(const NodePath &p_path) const {
- return get_node_or_null(p_path) != NULL;
+ return get_node_or_null(p_path) != nullptr;
}
Node *Node::find_node(const String &p_mask, bool p_recursive, bool p_owned) const {
@@ -1482,7 +1482,7 @@ Node *Node::find_node(const String &p_mask, bool p_recursive, bool p_owned) cons
if (ret)
return ret;
}
- return NULL;
+ return nullptr;
}
Node *Node::get_parent() const {
@@ -1500,7 +1500,7 @@ Node *Node::find_parent(const String &p_mask) const {
p = p->data.parent;
}
- return NULL;
+ return nullptr;
}
bool Node::is_a_parent_of(const Node *p_node) const {
@@ -1607,8 +1607,8 @@ void Node::set_owner(Node *p_owner) {
if (data.owner) {
data.owner->data.owned.erase(data.OW);
- data.OW = NULL;
- data.owner = NULL;
+ data.OW = nullptr;
+ data.owner = nullptr;
}
ERR_FAIL_COND(p_owner == this);
@@ -1663,7 +1663,7 @@ Node *Node::find_common_parent_with(const Node *p_node) const {
}
if (!common_parent)
- return NULL;
+ return nullptr;
return const_cast<Node *>(common_parent);
}
@@ -1762,7 +1762,7 @@ void Node::add_to_group(const StringName &p_identifier, bool p_persistent) {
if (data.tree) {
gd.group = data.tree->add_to_group(p_identifier, this);
} else {
- gd.group = NULL;
+ gd.group = nullptr;
}
gd.persistent = p_persistent;
@@ -1935,7 +1935,7 @@ void Node::remove_and_skip() {
continue;
remove_child(c_node);
- c_node->_propagate_replace_owner(this, NULL);
+ c_node->_propagate_replace_owner(this, nullptr);
children.push_back(c_node);
clear = false;
break;
@@ -1949,7 +1949,7 @@ void Node::remove_and_skip() {
Node *c_node = children.front()->get();
data.parent->add_child(c_node);
- c_node->_propagate_replace_owner(NULL, new_owner);
+ c_node->_propagate_replace_owner(nullptr, new_owner);
children.pop_front();
}
@@ -2049,7 +2049,7 @@ int Node::get_position_in_parent() const {
Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const {
- Node *node = NULL;
+ Node *node = nullptr;
bool instanced = false;
@@ -2063,25 +2063,25 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
} else if ((p_flags & DUPLICATE_USE_INSTANCING) && get_filename() != String()) {
Ref<PackedScene> res = ResourceLoader::load(get_filename());
- ERR_FAIL_COND_V(res.is_null(), NULL);
+ ERR_FAIL_COND_V(res.is_null(), nullptr);
PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED;
#ifdef TOOLS_ENABLED
if (p_flags & DUPLICATE_FROM_EDITOR)
ges = PackedScene::GEN_EDIT_STATE_INSTANCE;
#endif
node = res->instance(ges);
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_COND_V(!node, nullptr);
instanced = true;
} else {
Object *obj = ClassDB::instance(get_class());
- ERR_FAIL_COND_V(!obj, NULL);
+ ERR_FAIL_COND_V(!obj, nullptr);
node = Object::cast_to<Node>(obj);
if (!node)
memdelete(obj);
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_COND_V(!node, nullptr);
}
if (get_filename() != "") { //an instance
@@ -2189,7 +2189,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (!dup) {
memdelete(node);
- return NULL;
+ return nullptr;
}
node->add_child(dup);
@@ -2204,14 +2204,14 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (!parent) {
memdelete(node);
- return NULL;
+ return nullptr;
}
Node *dup = E->get()->_duplicate(p_flags, r_duplimap);
if (!dup) {
memdelete(node);
- return NULL;
+ return nullptr;
}
parent->add_child(dup);
@@ -2256,7 +2256,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
if (get_owner() != get_parent()->get_owner())
return;
- Node *node = NULL;
+ Node *node = nullptr;
if (get_filename() != "") {
@@ -2369,15 +2369,15 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const {
- ERR_FAIL_COND_V(get_filename() != "", NULL);
+ ERR_FAIL_COND_V(get_filename() != "", nullptr);
Object *obj = ClassDB::instance(get_class());
- ERR_FAIL_COND_V_MSG(!obj, NULL, "Node: Could not duplicate: " + String(get_class()) + ".");
+ ERR_FAIL_COND_V_MSG(!obj, nullptr, "Node: Could not duplicate: " + String(get_class()) + ".");
Node *node = Object::cast_to<Node>(obj);
if (!node) {
memdelete(obj);
- ERR_FAIL_V_MSG(NULL, "Node: Could not duplicate: " + String(get_class()) + ".");
+ ERR_FAIL_V_MSG(nullptr, "Node: Could not duplicate: " + String(get_class()) + ".");
}
node->set_name(get_name());
@@ -2591,7 +2591,7 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str
r_res = RES();
r_leftover_subpath = Vector<StringName>();
if (!node)
- return NULL;
+ return nullptr;
if (p_path.get_subname_count()) {
@@ -2601,7 +2601,7 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str
Variant new_res_v = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j));
if (new_res_v.get_type() == Variant::NIL) { // Found nothing on that path
- return NULL;
+ return nullptr;
}
RES new_res = new_res_v;
@@ -2623,8 +2623,8 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str
void Node::_set_tree(SceneTree *p_tree) {
- SceneTree *tree_changed_a = NULL;
- SceneTree *tree_changed_b = NULL;
+ SceneTree *tree_changed_a = nullptr;
+ SceneTree *tree_changed_b = nullptr;
//ERR_FAIL_COND(p_scene && data.parent && !data.parent->data.scene); //nobug if both are null
@@ -3012,8 +3012,8 @@ Node::Node() {
data.pos = -1;
data.depth = -1;
data.blocked = 0;
- data.parent = NULL;
- data.tree = NULL;
+ data.parent = nullptr;
+ data.tree = nullptr;
data.physics_process = false;
data.idle_process = false;
data.process_priority = 0;
@@ -3022,18 +3022,18 @@ Node::Node() {
data.inside_tree = false;
data.ready_notified = false;
- data.owner = NULL;
- data.OW = NULL;
+ data.owner = nullptr;
+ data.OW = nullptr;
data.input = false;
data.unhandled_input = false;
data.unhandled_key_input = false;
data.pause_mode = PAUSE_MODE_INHERIT;
- data.pause_owner = NULL;
+ data.pause_owner = nullptr;
data.network_master = 1; //server by default
- data.path_cache = NULL;
+ data.path_cache = nullptr;
data.parent_owned = false;
data.in_constructor = true;
- data.viewport = NULL;
+ data.viewport = nullptr;
data.use_placeholder = false;
data.display_folded = false;
data.ready_first = true;
diff --git a/scene/main/node.h b/scene/main/node.h
index cf25a92be6..292ec0e291 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -180,7 +180,7 @@ private:
void _duplicate_signals(const Node *p_original, Node *p_copy) const;
void _duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const;
- Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = NULL) const;
+ Node *_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap = nullptr) const;
Array _get_children() const;
Array _get_groups() const;
@@ -286,7 +286,7 @@ public:
Node *find_parent(const String &p_mask) const;
_FORCE_INLINE_ SceneTree *get_tree() const {
- ERR_FAIL_COND_V(!data.tree, NULL);
+ ERR_FAIL_COND_V(!data.tree, nullptr);
return data.tree;
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 15c0a7666e..41f31617d2 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -112,7 +112,7 @@ void SceneTree::node_added(Node *p_node) {
void SceneTree::node_removed(Node *p_node) {
if (current_scene == p_node) {
- current_scene = NULL;
+ current_scene = nullptr;
}
emit_signal(node_removed_name, p_node);
if (call_lock > 0)
@@ -539,10 +539,10 @@ void SceneTree::finish() {
MainLoop::finish();
if (root) {
- root->_set_tree(NULL);
+ root->_set_tree(nullptr);
root->_propagate_after_exit_tree();
memdelete(root); //delete root
- root = NULL;
+ root = nullptr;
}
// cleanup timers
@@ -1037,7 +1037,7 @@ Node *SceneTree::get_edited_scene_root() const {
#ifdef TOOLS_ENABLED
return edited_scene_root;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -1056,7 +1056,7 @@ void SceneTree::_change_scene(Node *p_to) {
if (current_scene) {
memdelete(current_scene);
- current_scene = NULL;
+ current_scene = nullptr;
}
// If we're quitting, abort.
@@ -1082,7 +1082,7 @@ Error SceneTree::change_scene(const String &p_path) {
}
Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) {
- Node *new_scene = NULL;
+ Node *new_scene = nullptr;
if (p_scene.is_valid()) {
new_scene = p_scene->instance();
ERR_FAIL_COND_V(!new_scene, ERR_CANT_CREATE);
@@ -1321,7 +1321,7 @@ void SceneTree::_bind_methods() {
BIND_ENUM_CONSTANT(GROUP_CALL_UNIQUE);
}
-SceneTree *SceneTree::singleton = NULL;
+SceneTree *SceneTree::singleton = nullptr;
SceneTree::IdleCallback SceneTree::idle_callbacks[SceneTree::MAX_IDLE_CALLBACKS];
int SceneTree::idle_callback_count = 0;
@@ -1372,7 +1372,7 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li
SceneTree::SceneTree() {
- if (singleton == NULL) singleton = this;
+ if (singleton == nullptr) singleton = this;
_quit = false;
accept_quit = true;
quit_on_go_back = true;
@@ -1392,7 +1392,7 @@ SceneTree::SceneTree() {
physics_process_time = 1;
idle_process_time = 1;
- root = NULL;
+ root = nullptr;
pause = false;
current_frame = 0;
current_event = 0;
@@ -1419,7 +1419,7 @@ SceneTree::SceneTree() {
//root->set_world_2d( Ref<World2D>( memnew( World2D )));
root->set_as_audio_listener(true);
root->set_as_audio_listener_2d(true);
- current_scene = NULL;
+ current_scene = nullptr;
int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x,AndroidVR 2x,AndroidVR 4x"));
@@ -1463,16 +1463,16 @@ SceneTree::SceneTree() {
root->connect("focus_entered", callable_mp(this, &SceneTree::_main_window_focus_in));
#ifdef TOOLS_ENABLED
- edited_scene_root = NULL;
+ edited_scene_root = nullptr;
#endif
}
SceneTree::~SceneTree() {
if (root) {
- root->_set_tree(NULL);
+ root->_set_tree(nullptr);
root->_propagate_after_exit_tree();
memdelete(root);
}
- if (singleton == this) singleton = NULL;
+ if (singleton == this) singleton = nullptr;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index b95e81a702..7b860df352 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -61,7 +61,7 @@ void ViewportTexture::setup_local_to_scene() {
vp->viewport_textures.erase(this);
}
- vp = NULL;
+ vp = nullptr;
Node *local_scene = get_local_scene();
if (!local_scene) {
@@ -148,7 +148,7 @@ void ViewportTexture::_bind_methods() {
ViewportTexture::ViewportTexture() {
- vp = NULL;
+ vp = nullptr;
set_local_to_scene(true);
}
@@ -190,17 +190,17 @@ Viewport::GUI::GUI() {
embedding_subwindows = false;
dragging = false;
- mouse_focus = NULL;
+ mouse_focus = nullptr;
forced_mouse_focus = false;
- mouse_click_grabber = NULL;
+ mouse_click_grabber = nullptr;
mouse_focus_mask = 0;
- key_focus = NULL;
- mouse_over = NULL;
- drag_mouse_over = NULL;
+ key_focus = nullptr;
+ mouse_over = nullptr;
+ drag_mouse_over = nullptr;
- tooltip = NULL;
- tooltip_popup = NULL;
- tooltip_label = NULL;
+ tooltip = nullptr;
+ tooltip_popup = nullptr;
+ tooltip_label = nullptr;
}
/////////////////////////////////////
@@ -455,7 +455,7 @@ void Viewport::_notification(int p_what) {
parent = get_parent()->get_viewport();
RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, parent->get_viewport_rid());
} else {
- parent = NULL;
+ parent = nullptr;
}
current_canvas = find_world_2d()->get_canvas();
@@ -489,10 +489,10 @@ void Viewport::_notification(int p_what) {
case NOTIFICATION_READY: {
#ifndef _3D_DISABLED
if (listeners.size() && !listener) {
- Listener3D *first = NULL;
+ Listener3D *first = nullptr;
for (Set<Listener3D *>::Element *E = listeners.front(); E; E = E->next()) {
- if (first == NULL || first->is_greater_than(E->get())) {
+ if (first == nullptr || first->is_greater_than(E->get())) {
first = E->get();
}
}
@@ -503,10 +503,10 @@ void Viewport::_notification(int p_what) {
if (cameras.size() && !camera) {
//there are cameras but no current camera, pick first in tree and make it current
- Camera3D *first = NULL;
+ Camera3D *first = nullptr;
for (Set<Camera3D *>::Element *E = cameras.front(); E; E = E->next()) {
- if (first == NULL || first->is_greater_than(E->get())) {
+ if (first == nullptr || first->is_greater_than(E->get())) {
first = E->get();
}
}
@@ -586,7 +586,7 @@ void Viewport::_notification(int p_what) {
#ifndef _3D_DISABLED
Vector2 last_pos(1e20, 1e20);
- CollisionObject3D *last_object = NULL;
+ CollisionObject3D *last_object = nullptr;
ObjectID last_id;
#endif
PhysicsDirectSpaceState3D::RayResult result;
@@ -1059,7 +1059,7 @@ void Viewport::_listener_remove(Listener3D *p_listener) {
listeners.erase(p_listener);
if (listener == p_listener) {
- listener = NULL;
+ listener = nullptr;
}
}
@@ -1073,14 +1073,14 @@ void Viewport::_listener_make_next_current(Listener3D *p_exclude) {
continue;
if (!E->get()->is_inside_tree())
continue;
- if (listener != NULL)
+ if (listener != nullptr)
return;
E->get()->make_current();
}
} else {
// Attempt to reset listener to the camera position
- if (camera != NULL) {
+ if (camera != nullptr) {
_update_listener();
_camera_transform_changed_notify();
}
@@ -1134,7 +1134,7 @@ void Viewport::_camera_remove(Camera3D *p_camera) {
cameras.erase(p_camera);
if (camera == p_camera) {
camera->notification(Camera3D::NOTIFICATION_LOST_CURRENT);
- camera = NULL;
+ camera = nullptr;
}
}
@@ -1147,7 +1147,7 @@ void Viewport::_camera_make_next_current(Camera3D *p_exclude) {
continue;
if (!E->get()->is_inside_tree())
continue;
- if (camera != NULL)
+ if (camera != nullptr)
return;
E->get()->make_current();
@@ -1528,12 +1528,12 @@ void Viewport::_gui_sort_roots() {
void Viewport::_gui_cancel_tooltip() {
- gui.tooltip = NULL;
+ gui.tooltip = nullptr;
gui.tooltip_timer = -1;
if (gui.tooltip_popup) {
gui.tooltip_popup->queue_delete();
- gui.tooltip_popup = NULL;
- gui.tooltip_label = NULL;
+ gui.tooltip_popup = nullptr;
+ gui.tooltip_label = nullptr;
}
}
@@ -1571,7 +1571,7 @@ void Viewport::_gui_show_tooltip() {
return;
}
- Control *which = NULL;
+ Control *which = nullptr;
String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos), &which);
tooltip = tooltip.strip_edges();
if (tooltip.length() == 0)
@@ -1579,8 +1579,8 @@ void Viewport::_gui_show_tooltip() {
if (gui.tooltip_popup) {
memdelete(gui.tooltip_popup);
- gui.tooltip_popup = NULL;
- gui.tooltip_label = NULL;
+ gui.tooltip_popup = nullptr;
+ gui.tooltip_label = nullptr;
}
if (!which) {
@@ -1651,7 +1651,7 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu
Ref<InputEventPanGesture> pn = p_input;
cant_stop_me_now = pn.is_valid() || cant_stop_me_now;
- bool ismouse = ev.is_valid() || Object::cast_to<InputEventMouseMotion>(*p_input) != NULL;
+ bool ismouse = ev.is_valid() || Object::cast_to<InputEventMouseMotion>(*p_input) != nullptr;
CanvasItem *ci = p_control;
while (ci) {
@@ -1741,23 +1741,23 @@ Control *Viewport::_gui_find_control(const Point2 &p_global) {
return ret;
}
- return NULL;
+ return nullptr;
}
Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform) {
if (Object::cast_to<Viewport>(p_node))
- return NULL;
+ return nullptr;
if (!p_node->is_visible()) {
//return _find_next_visible_control_at_pos(p_node,p_global,r_inv_xform);
- return NULL; //canvas item hidden, discard
+ return nullptr; //canvas item hidden, discard
}
Transform2D matrix = p_xform * p_node->get_transform();
// matrix.basis_determinant() == 0.0f implies that node does not exist on scene
if (matrix.basis_determinant() == 0.0f)
- return NULL;
+ return nullptr;
Control *c = Object::cast_to<Control>(p_node);
@@ -1776,7 +1776,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
}
if (!c)
- return NULL;
+ return nullptr;
matrix.affine_invert();
@@ -1785,7 +1785,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_
r_inv_xform = matrix;
return c;
} else
- return NULL;
+ return nullptr;
}
bool Viewport::_gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_check) {
@@ -1938,7 +1938,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.drag_preview) {
memdelete(gui.drag_preview);
- gui.drag_preview = NULL;
+ gui.drag_preview = nullptr;
}
_propagate_viewport_notification(this, NOTIFICATION_DRAG_END);
//change mouse accordingly
@@ -1957,7 +1957,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.drag_preview && mb->get_button_index() == BUTTON_LEFT) {
memdelete(gui.drag_preview);
- gui.drag_preview = NULL;
+ gui.drag_preview = nullptr;
}
gui.drag_data = Variant();
@@ -1985,7 +1985,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
//disable mouse focus if needed before calling input, this makes popups on mouse press event work better, as the release will never be received otherwise
if (gui.mouse_focus_mask == 0) {
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
}
@@ -2011,7 +2011,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
gui.last_mouse_pos = mpos;
- Control *over = NULL;
+ Control *over = nullptr;
// D&D
if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & BUTTON_MASK_LEFT) {
@@ -2031,15 +2031,15 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
gui.drag_data = control->get_drag_data(control->get_global_transform_with_canvas().affine_inverse().xform(mpos) - gui.drag_accum);
if (gui.drag_data.get_type() != Variant::NIL) {
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
gui.mouse_focus_mask = 0;
break;
} else {
- if (gui.drag_preview != NULL) {
+ if (gui.drag_preview != nullptr) {
ERR_PRINT("Don't set a drag preview and return null data. Preview was deleted and drag request ignored.");
memdelete(gui.drag_preview);
- gui.drag_preview = NULL;
+ gui.drag_preview = nullptr;
}
gui.dragging = false;
}
@@ -2395,7 +2395,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
}
}
- Control *from = gui.key_focus ? gui.key_focus : NULL; //hmm
+ Control *from = gui.key_focus ? gui.key_focus : nullptr; //hmm
//keyboard focus
//if (from && p_event->is_pressed() && !p_event->get_alt() && !p_event->get_metakey() && !p_event->key->get_command()) {
@@ -2405,7 +2405,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
bool mods = k.is_valid() && (k->get_control() || k->get_alt() || k->get_shift() || k->get_metakey());
if (from && p_event->is_pressed()) {
- Control *next = NULL;
+ Control *next = nullptr;
InputFilter *input = InputFilter::get_singleton();
@@ -2463,7 +2463,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control *
gui.dragging = true;
gui.drag_data = p_data;
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
if (p_control) {
_gui_set_drag_preview(p_base, p_control);
@@ -2475,7 +2475,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) {
ERR_FAIL_NULL(p_control);
ERR_FAIL_COND(!Object::cast_to<Control>((Object *)p_control));
ERR_FAIL_COND(p_control->is_inside_tree());
- ERR_FAIL_COND(p_control->get_parent() != NULL);
+ ERR_FAIL_COND(p_control->get_parent() != nullptr);
if (gui.drag_preview) {
memdelete(gui.drag_preview);
@@ -2519,9 +2519,9 @@ void Viewport::_gui_hid_control(Control *p_control) {
if (gui.key_focus == p_control)
_gui_remove_focus();
if (gui.mouse_over == p_control)
- gui.mouse_over = NULL;
+ gui.mouse_over = nullptr;
if (gui.drag_mouse_over == p_control)
- gui.drag_mouse_over = NULL;
+ gui.drag_mouse_over = nullptr;
if (gui.tooltip == p_control)
_gui_cancel_tooltip();
}
@@ -2529,28 +2529,28 @@ void Viewport::_gui_hid_control(Control *p_control) {
void Viewport::_gui_remove_control(Control *p_control) {
if (gui.mouse_focus == p_control) {
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
gui.mouse_focus_mask = 0;
}
if (gui.last_mouse_focus == p_control) {
- gui.last_mouse_focus = NULL;
+ gui.last_mouse_focus = nullptr;
}
if (gui.key_focus == p_control)
- gui.key_focus = NULL;
+ gui.key_focus = nullptr;
if (gui.mouse_over == p_control)
- gui.mouse_over = NULL;
+ gui.mouse_over = nullptr;
if (gui.drag_mouse_over == p_control)
- gui.drag_mouse_over = NULL;
+ gui.drag_mouse_over = nullptr;
if (gui.tooltip == p_control)
- gui.tooltip = NULL;
+ gui.tooltip = nullptr;
}
void Viewport::_gui_remove_focus() {
if (gui.key_focus) {
Node *f = gui.key_focus;
- gui.key_focus = NULL;
+ gui.key_focus = nullptr;
f->notification(Control::NOTIFICATION_FOCUS_EXIT, true);
}
}
@@ -2583,7 +2583,7 @@ void Viewport::_drop_mouse_focus() {
Control *c = gui.mouse_focus;
int mask = gui.mouse_focus_mask;
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
gui.mouse_focus_mask = 0;
@@ -2645,7 +2645,7 @@ void Viewport::_post_gui_grab_click_focus() {
// Redundant grab requests were made
return;
}
- gui.mouse_click_grabber = NULL;
+ gui.mouse_click_grabber = nullptr;
if (gui.mouse_focus) {
@@ -3063,7 +3063,7 @@ void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coor
get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this);
//call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_input","_unhandled_input",ev);
- if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != NULL) {
+ if (!is_input_handled() && Object::cast_to<InputEventKey>(*ev) != nullptr) {
get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this);
//call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_key_input","_unhandled_key_input",ev);
}
@@ -3539,11 +3539,11 @@ Viewport::Viewport() {
//internal_listener_2d = SpatialSound2DServer::get_singleton()->listener_create();
audio_listener_2d = false;
transparent_bg = false;
- parent = NULL;
- listener = NULL;
- camera = NULL;
+ parent = nullptr;
+ listener = nullptr;
+ camera = nullptr;
override_canvas_transform = false;
- canvas_layers.insert(NULL); // This eases picking code (interpreted as the canvas of the Viewport)
+ canvas_layers.insert(nullptr); // This eases picking code (interpreted as the canvas of the Viewport)
gen_mipmaps = false;
@@ -3577,15 +3577,15 @@ Viewport::Viewport() {
gui.tooltip_delay = GLOBAL_DEF("gui/timers/tooltip_delay_sec", 0.5);
ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers
- gui.tooltip = NULL;
- gui.tooltip_label = NULL;
- gui.drag_preview = NULL;
+ gui.tooltip = nullptr;
+ gui.tooltip_label = nullptr;
+ gui.drag_preview = nullptr;
gui.drag_attempted = false;
gui.canvas_sort_index = 0;
gui.roots_order_dirty = false;
- gui.mouse_focus = NULL;
+ gui.mouse_focus = nullptr;
gui.forced_mouse_focus = false;
- gui.last_mouse_focus = NULL;
+ gui.last_mouse_focus = nullptr;
gui.subwindow_focused = nullptr;
gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
@@ -3612,7 +3612,7 @@ Viewport::~Viewport() {
//erase itself from viewport textures
for (Set<ViewportTexture *>::Element *E = viewport_textures.front(); E; E = E->next()) {
- E->get()->vp = NULL;
+ E->get()->vp = nullptr;
}
RenderingServer::get_singleton()->free(viewport);
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index d0b22b5553..8982869783 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -374,7 +374,7 @@ private:
void _gui_remove_root_control(List<Control *>::Element *RI);
- String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Control **r_which = NULL);
+ String _gui_get_tooltip(Control *p_control, const Vector2 &p_pos, Control **r_which = nullptr);
void _gui_cancel_tooltip();
void _gui_show_tooltip();
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 3a8f7ebb60..45982e0e93 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1108,13 +1108,13 @@ void Window::remove_child_notify(Node *p_child) {
Control *child_c = Object::cast_to<Control>(p_child);
if (child_c && (child_c->data.theme_owner || child_c->data.theme_owner_window) && child_c->data.theme.is_null()) {
- Control::_propagate_theme_changed(child_c, NULL, NULL);
+ Control::_propagate_theme_changed(child_c, nullptr, nullptr);
}
Window *child_w = Object::cast_to<Window>(p_child);
if (child_w && (child_w->theme_owner || child_w->theme_owner_window) && child_w->theme.is_null()) {
- Control::_propagate_theme_changed(child_w, NULL, NULL);
+ Control::_propagate_theme_changed(child_w, nullptr, nullptr);
}
if (is_inside_tree() && wrap_controls) {
@@ -1285,7 +1285,7 @@ void Window::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_exclusive", "exclusive"), &Window::set_exclusive);
ClassDB::bind_method(D_METHOD("is_exclusive"), &Window::is_exclusive);
- ClassDB::bind_method(D_METHOD("can_draw"), &Window::is_transient);
+ ClassDB::bind_method(D_METHOD("can_draw"), &Window::can_draw);
ClassDB::bind_method(D_METHOD("has_focus"), &Window::has_focus);
ClassDB::bind_method(D_METHOD("grab_focus"), &Window::grab_focus);
diff --git a/scene/main/window.h b/scene/main/window.h
index be07762f20..adaa5ca3be 100644
--- a/scene/main/window.h
+++ b/scene/main/window.h
@@ -43,7 +43,7 @@ public:
MODE_WINDOWED = DisplayServer::WINDOW_MODE_WINDOWED,
MODE_MINIMIZED = DisplayServer::WINDOW_MODE_MINIMIZED,
MODE_MAXIMIZED = DisplayServer::WINDOW_MODE_MAXIMIZED,
- MODE_FULLSCREEN = DisplayServer::WINDOW_MODE_FULLSCREEN
+ MODE_FULLSCREEN = DisplayServer::WINDOW_MODE_FULLSCREEN,
};
enum Flags {
@@ -59,7 +59,6 @@ public:
CONTENT_SCALE_MODE_DISABLED,
CONTENT_SCALE_MODE_OBJECTS,
CONTENT_SCALE_MODE_PIXELS,
-
};
enum ContentScaleAspect {
@@ -68,10 +67,10 @@ public:
CONTENT_SCALE_ASPECT_KEEP_WIDTH,
CONTENT_SCALE_ASPECT_KEEP_HEIGHT,
CONTENT_SCALE_ASPECT_EXPAND,
-
};
+
enum {
- DEFAULT_WINDOW_SIZE = 100
+ DEFAULT_WINDOW_SIZE = 100,
};
private:
@@ -258,8 +257,8 @@ public:
~Window();
};
-VARIANT_ENUM_CAST(Window::Window::Mode);
-VARIANT_ENUM_CAST(Window::Window::Flags);
+VARIANT_ENUM_CAST(Window::Mode);
+VARIANT_ENUM_CAST(Window::Flags);
VARIANT_ENUM_CAST(Window::ContentScaleMode);
VARIANT_ENUM_CAST(Window::ContentScaleAspect);
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 774d943efe..22c000fae7 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -270,6 +270,7 @@ void register_scene_types() {
ClassDB::register_virtual_class<InstancePlaceholder>();
ClassDB::register_virtual_class<Viewport>();
+ ClassDB::register_class<SubViewport>();
ClassDB::register_class<ViewportTexture>();
ClassDB::register_class<HTTPRequest>();
ClassDB::register_class<Timer>();
@@ -754,6 +755,8 @@ void register_scene_types() {
ClassDB::add_compatibility_class("Area", "Area3D");
ClassDB::add_compatibility_class("BoneAttachment", "BoneAttachment3D");
ClassDB::add_compatibility_class("BoxShape", "BoxShape3D");
+ ClassDB::add_compatibility_class("BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D");
+ ClassDB::add_compatibility_class("BulletPhysicsServer", "BulletPhysicsServer3D");
ClassDB::add_compatibility_class("Camera", "Camera3D");
ClassDB::add_compatibility_class("CapsuleShape", "CapsuleShape3D");
ClassDB::add_compatibility_class("ClippedCamera", "ClippedCamera3D");
@@ -764,8 +767,19 @@ void register_scene_types() {
ClassDB::add_compatibility_class("ConeTwistJoint", "ConeTwistJoint3D");
ClassDB::add_compatibility_class("ConvexPolygonShape", "ConvexPolygonShape3D");
ClassDB::add_compatibility_class("CPUParticles", "CPUParticles3D");
+ ClassDB::add_compatibility_class("CSGBox", "CSGBox3D");
+ ClassDB::add_compatibility_class("CSGCombiner", "CSGCombiner3D");
+ ClassDB::add_compatibility_class("CSGCylinder", "CSGCylinder3D");
+ ClassDB::add_compatibility_class("CSGMesh", "CSGMesh3D");
+ ClassDB::add_compatibility_class("CSGPolygon", "CSGPolygon3D");
+ ClassDB::add_compatibility_class("CSGPrimitive", "CSGPrimitive3D");
+ ClassDB::add_compatibility_class("CSGShape", "CSGShape3D");
+ ClassDB::add_compatibility_class("CSGSphere", "CSGSphere3D");
+ ClassDB::add_compatibility_class("CSGTorus", "CSGTorus3D");
ClassDB::add_compatibility_class("CylinderShape", "CylinderShape3D");
ClassDB::add_compatibility_class("DirectionalLight", "DirectionalLight3D");
+ ClassDB::add_compatibility_class("EditorSpatialGizmo", "EditorNode3DGizmo");
+ ClassDB::add_compatibility_class("EditorSpatialGizmoPlugin", "EditorNode3DGizmoPlugin");
ClassDB::add_compatibility_class("Generic6DOFJoint", "Generic6DOFJoint3D");
ClassDB::add_compatibility_class("HeightMapShape", "HeightMapShape3D");
ClassDB::add_compatibility_class("HingeJoint", "HingeJoint3D");
@@ -783,6 +797,8 @@ void register_scene_types() {
ClassDB::add_compatibility_class("NavigationObstacle", "NavigationObstacle3D");
ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
ClassDB::add_compatibility_class("NavigationRegion", "NavigationRegion3D");
+ ClassDB::add_compatibility_class("Navigation2DServer", "NavigationServer2D");
+ ClassDB::add_compatibility_class("NavigationServer", "NavigationServer3D");
ClassDB::add_compatibility_class("OmniLight", "OmniLight3D");
ClassDB::add_compatibility_class("Particles", "GPUParticles3D");
ClassDB::add_compatibility_class("Particles2D", "GPUParticles2D");
@@ -816,6 +832,7 @@ void register_scene_types() {
ClassDB::add_compatibility_class("SliderJoint", "SliderJoint3D");
ClassDB::add_compatibility_class("SoftBody", "SoftBody3D");
ClassDB::add_compatibility_class("Spatial", "Node3D");
+ ClassDB::add_compatibility_class("SpatialGizmo", "Node3DGizmo");
ClassDB::add_compatibility_class("SpatialMaterial", "StandardMaterial3D");
ClassDB::add_compatibility_class("SpatialVelocityTracker", "VelocityTracker3D");
ClassDB::add_compatibility_class("SphereShape", "SphereShape3D");
diff --git a/scene/resources/SCsub b/scene/resources/SCsub
index 5e5b6f8fd5..3a86b22835 100644
--- a/scene/resources/SCsub
+++ b/scene/resources/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 36d5df52df..e4e5177a8c 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -84,7 +84,10 @@ private:
float transition;
float time; // time in secs
- Key() { transition = 1; }
+ Key() {
+ transition = 1;
+ time = 0;
+ }
};
// transform key holds either Vector3 or Quaternion
diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp
index 06b65e4b4a..d630a1f3ee 100644
--- a/scene/resources/audio_stream_sample.cpp
+++ b/scene/resources/audio_stream_sample.cpp
@@ -482,7 +482,7 @@ void AudioStreamSample::set_data(const Vector<uint8_t> &p_data) {
AudioServer::get_singleton()->lock();
if (data) {
memfree(data);
- data = NULL;
+ data = nullptr;
data_bytes = 0;
}
@@ -654,14 +654,14 @@ AudioStreamSample::AudioStreamSample() {
loop_begin = 0;
loop_end = 0;
mix_rate = 44100;
- data = NULL;
+ data = nullptr;
data_bytes = 0;
}
AudioStreamSample::~AudioStreamSample() {
if (data) {
memfree(data);
- data = NULL;
+ data = nullptr;
data_bytes = 0;
}
}
diff --git a/scene/resources/default_theme/SCsub b/scene/resources/default_theme/SCsub
index b01e2fd54d..fc61250247 100644
--- a/scene/resources/default_theme/SCsub
+++ b/scene/resources/default_theme/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.scene_sources, "*.cpp")
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 0c45779307..e6f09eb034 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -890,9 +890,9 @@ void make_default_theme(bool p_hidpi, Ref<Font> p_font) {
void clear_default_theme() {
- Theme::set_project_default(NULL);
- Theme::set_default(NULL);
- Theme::set_default_icon(NULL);
- Theme::set_default_style(NULL);
- Theme::set_default_font(NULL);
+ Theme::set_project_default(nullptr);
+ Theme::set_default(nullptr);
+ Theme::set_default_icon(nullptr);
+ Theme::set_default_style(nullptr);
+ Theme::set_default_font(nullptr);
}
diff --git a/scene/resources/default_theme/make_header.py b/scene/resources/default_theme/make_header.py
index cf0ccf1c3a..efad3b2815 100755
--- a/scene/resources/default_theme/make_header.py
+++ b/scene/resources/default_theme/make_header.py
@@ -13,7 +13,7 @@ os.chdir(os.path.dirname(os.path.realpath(__file__)))
f = open("theme_data.h", "wb")
-f.write(b"// THIS FILE HAS BEEN AUTOGENERATED, DON\'T EDIT!!\n")
+f.write(b"// THIS FILE HAS BEEN AUTOGENERATED, DON'T EDIT!!\n")
# Generate png image block
f.write(b"\n// png image block\n")
@@ -31,17 +31,17 @@ for x in pixmaps:
pngf = open(x, "rb")
b = pngf.read(1)
- while(len(b) == 1):
+ while len(b) == 1:
f.write(hex(ord(b)).encode(enc))
b = pngf.read(1)
- if (len(b) == 1):
+ if len(b) == 1:
f.write(b", ")
f.write(b"\n};\n")
pngf.close()
# Generate shaders block
-f.write(b"\n// shaders block\n");
+f.write(b"\n// shaders block\n")
shaders = glob.glob("*.gsl")
shaders.sort()
@@ -56,15 +56,15 @@ for x in shaders:
sf = open(x, "rb")
b = sf.readline()
- while(b != ""):
- if (b.endswith("\r\n")):
+ while b != "":
+ if b.endswith("\r\n"):
b = b[:-2]
- if (b.endswith("\n")):
+ if b.endswith("\n"):
b = b[:-1]
- s = ' \"' + b
+ s = ' "' + b
f.write(s.encode(enc))
b = sf.readline()
- if (b != ""):
+ if b != "":
f.write(b'"\n')
f.write(b'";\n')
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 107f07ec7d..a613b01376 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -107,7 +107,7 @@ DynamicFontData::DynamicFontData() {
antialiased = true;
force_autohinter = false;
hinting = DynamicFontData::HINTING_NORMAL;
- font_mem = NULL;
+ font_mem = nullptr;
font_mem_size = 0;
}
@@ -124,7 +124,7 @@ Error DynamicFontAtSize::_load() {
ERR_FAIL_COND_V_MSG(error != 0, ERR_CANT_CREATE, "Error initializing FreeType.");
// FT_OPEN_STREAM is extremely slow only on Android.
- if (OS::get_singleton()->get_name() == "Android" && font->font_mem == NULL && font->font_path != String()) {
+ if (OS::get_singleton()->get_name() == "Android" && font->font_mem == nullptr && font->font_path != String()) {
// cache font only once for each font->font_path
if (_fontdata.has(font->font_path)) {
@@ -148,7 +148,7 @@ Error DynamicFontAtSize::_load() {
}
}
- if (font->font_mem == NULL && font->font_path != String()) {
+ if (font->font_mem == nullptr && font->font_path != String()) {
FileAccess *f = FileAccess::open(font->font_path, FileAccess::READ);
if (!f) {
@@ -157,7 +157,7 @@ Error DynamicFontAtSize::_load() {
}
memset(&stream, 0, sizeof(FT_StreamRec));
- stream.base = NULL;
+ stream.base = nullptr;
stream.size = f->get_len();
stream.pos = 0;
stream.descriptor.pointer = f;
@@ -245,7 +245,7 @@ float DynamicFontAtSize::get_descent() const {
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)));
+ ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr)));
if (!chr->found) {
@@ -269,7 +269,7 @@ const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFon
//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)));
+ ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr)));
}
return Pair<const Character *, DynamicFontAtSize *>(chr, const_cast<DynamicFontAtSize *>(this));
@@ -565,7 +565,7 @@ DynamicFontAtSize::Character DynamicFontAtSize::_make_outline_char(CharType p_ch
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)
+ if (FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, nullptr, 1) != 0)
goto cleanup_glyph;
glyph_bitmap = (FT_BitmapGlyph)glyph;
@@ -992,11 +992,12 @@ void DynamicFont::_bind_methods() {
Mutex DynamicFont::dynamic_font_mutex;
-SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = NULL;
+SelfList<DynamicFont>::List *DynamicFont::dynamic_fonts = nullptr;
DynamicFont::DynamicFont() :
font_list(this) {
+ valid = false;
cache_id.size = 16;
outline_cache_id.size = 16;
spacing_top = 0;
@@ -1020,7 +1021,7 @@ void DynamicFont::initialize_dynamic_fonts() {
void DynamicFont::finish_dynamic_fonts() {
memdelete(dynamic_fonts);
- dynamic_fonts = NULL;
+ dynamic_fonts = nullptr;
}
void DynamicFont::update_oversampling() {
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 88b1df039e..9e628fc35a 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -302,7 +302,7 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType);
class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 89937238c1..2203f8d1be 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -345,7 +345,7 @@ void Environment::_validate_property(PropertyInfo &property) const {
"ssao_",
"glow_",
"adjustment_",
- NULL
+ nullptr
};
@@ -354,7 +354,7 @@ void Environment::_validate_property(PropertyInfo &property) const {
"tonemap_",
"ss_reflections_",
"ssao_",
- NULL
+ nullptr
};
@@ -546,7 +546,7 @@ float Environment::get_ssao_edge_sharpness() const {
void Environment::set_glow_enabled(bool p_enabled) {
glow_enabled = p_enabled;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
_change_notify();
}
@@ -564,7 +564,7 @@ void Environment::set_glow_level(int p_level, bool p_enabled) {
else
glow_levels &= ~(1 << p_level);
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
bool Environment::is_glow_level_enabled(int p_level) const {
@@ -577,7 +577,7 @@ void Environment::set_glow_intensity(float p_intensity) {
glow_intensity = p_intensity;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_intensity() const {
@@ -587,7 +587,7 @@ float Environment::get_glow_intensity() const {
void Environment::set_glow_strength(float p_strength) {
glow_strength = p_strength;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_strength() const {
@@ -597,7 +597,7 @@ float Environment::get_glow_strength() const {
void Environment::set_glow_mix(float p_mix) {
glow_mix = p_mix;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_mix() const {
@@ -608,7 +608,7 @@ void Environment::set_glow_bloom(float p_threshold) {
glow_bloom = p_threshold;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_bloom() const {
@@ -619,7 +619,7 @@ void Environment::set_glow_blend_mode(GlowBlendMode p_mode) {
glow_blend_mode = p_mode;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
_change_notify();
}
Environment::GlowBlendMode Environment::get_glow_blend_mode() const {
@@ -631,7 +631,7 @@ void Environment::set_glow_hdr_bleed_threshold(float p_threshold) {
glow_hdr_bleed_threshold = p_threshold;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_hdr_bleed_threshold() const {
@@ -642,7 +642,7 @@ void Environment::set_glow_hdr_luminance_cap(float p_amount) {
glow_hdr_luminance_cap = p_amount;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_hdr_luminance_cap() const {
@@ -653,24 +653,13 @@ void Environment::set_glow_hdr_bleed_scale(float p_scale) {
glow_hdr_bleed_scale = p_scale;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
+ RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap);
}
float Environment::get_glow_hdr_bleed_scale() const {
return glow_hdr_bleed_scale;
}
-void Environment::set_glow_bicubic_upscale(bool p_enable) {
-
- glow_bicubic_upscale = p_enable;
- RS::get_singleton()->environment_set_glow(environment, glow_enabled, glow_levels, glow_intensity, glow_strength, glow_mix, glow_bloom, RS::EnvironmentGlowBlendMode(glow_blend_mode), glow_hdr_bleed_threshold, glow_hdr_bleed_threshold, glow_hdr_luminance_cap, glow_bicubic_upscale);
-}
-
-bool Environment::is_glow_bicubic_upscale_enabled() const {
-
- return glow_bicubic_upscale;
-}
-
void Environment::set_fog_enabled(bool p_enabled) {
fog_enabled = p_enabled;
@@ -1067,9 +1056,6 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_glow_hdr_bleed_scale", "scale"), &Environment::set_glow_hdr_bleed_scale);
ClassDB::bind_method(D_METHOD("get_glow_hdr_bleed_scale"), &Environment::get_glow_hdr_bleed_scale);
- ClassDB::bind_method(D_METHOD("set_glow_bicubic_upscale", "enabled"), &Environment::set_glow_bicubic_upscale);
- ClassDB::bind_method(D_METHOD("is_glow_bicubic_upscale_enabled"), &Environment::is_glow_bicubic_upscale_enabled);
-
ADD_GROUP("Glow", "glow_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_enabled"), "set_glow_enabled", "is_glow_enabled");
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "glow_levels/1"), "set_glow_level", "is_glow_level_enabled", 0);
@@ -1088,7 +1074,6 @@ void Environment::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_threshold", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_threshold", "get_glow_hdr_bleed_threshold");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_luminance_cap", PROPERTY_HINT_RANGE, "0.0,256.0,0.01"), "set_glow_hdr_luminance_cap", "get_glow_hdr_luminance_cap");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "glow_hdr_scale", PROPERTY_HINT_RANGE, "0.0,4.0,0.01"), "set_glow_hdr_bleed_scale", "get_glow_hdr_bleed_scale");
- ADD_PROPERTY(PropertyInfo(Variant::BOOL, "glow_bicubic_upscale"), "set_glow_bicubic_upscale", "is_glow_bicubic_upscale_enabled");
ClassDB::bind_method(D_METHOD("set_adjustment_enable", "enabled"), &Environment::set_adjustment_enable);
ClassDB::bind_method(D_METHOD("is_adjustment_enabled"), &Environment::is_adjustment_enabled);
@@ -1209,7 +1194,6 @@ Environment::Environment() :
glow_hdr_bleed_threshold = 1.0;
glow_hdr_luminance_cap = 12.0;
glow_hdr_bleed_scale = 2.0;
- glow_bicubic_upscale = false;
fog_enabled = false;
fog_color = Color(0.5, 0.5, 0.5);
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index 657c7190e5..83f9a3f509 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -146,7 +146,6 @@ private:
float glow_hdr_bleed_threshold;
float glow_hdr_bleed_scale;
float glow_hdr_luminance_cap;
- bool glow_bicubic_upscale;
bool fog_enabled;
Color fog_color;
@@ -318,9 +317,6 @@ public:
void set_glow_hdr_bleed_scale(float p_scale);
float get_glow_hdr_bleed_scale() const;
- void set_glow_bicubic_upscale(bool p_enable);
- bool is_glow_bicubic_upscale_enabled() const;
-
void set_fog_enabled(bool p_enabled);
bool is_fog_enabled() const;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 8914cf8097..192eefbf6a 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -128,7 +128,7 @@ Vector<int> BitmapFont::_get_chars() const {
Vector<int> chars;
- const CharType *key = NULL;
+ const CharType *key = nullptr;
while ((key = char_map.next(key))) {
@@ -382,7 +382,7 @@ Vector<CharType> BitmapFont::get_char_keys() const {
Vector<CharType> chars;
chars.resize(char_map.size());
- const CharType *ct = NULL;
+ const CharType *ct = nullptr;
int count = 0;
while ((ct = char_map.next(ct))) {
@@ -528,7 +528,7 @@ Size2 Font::get_wordwrap_string_size(const String &p_string, float p_width) cons
void BitmapFont::set_fallback(const Ref<BitmapFont> &p_fallback) {
- for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != NULL; fallback_child = fallback_child->get_fallback()) {
+ for (Ref<BitmapFont> fallback_child = p_fallback; fallback_child != nullptr; fallback_child = fallback_child->get_fallback()) {
ERR_FAIL_COND_MSG(fallback_child == this, "Can't set as fallback one of its parents to prevent crashes due to recursive loop.");
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 076532f390..ce75f27e2a 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -200,7 +200,7 @@ public:
class ResourceFormatLoaderBMFont : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index f52b755ed3..84c1c9d734 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -40,7 +40,7 @@
void Material::set_next_pass(const Ref<Material> &p_pass) {
- for (Ref<Material> pass_child = p_pass; pass_child != NULL; pass_child = pass_child->get_next_pass()) {
+ for (Ref<Material> pass_child = p_pass; pass_child != nullptr; pass_child = pass_child->get_next_pass()) {
ERR_FAIL_COND_MSG(pass_child == this, "Can't set as next_pass one of its parents to prevent crashes due to recursive loop.");
}
@@ -290,9 +290,9 @@ ShaderMaterial::~ShaderMaterial() {
/////////////////////////////////
Mutex BaseMaterial3D::material_mutex;
-SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = NULL;
+SelfList<BaseMaterial3D>::List *BaseMaterial3D::dirty_materials = nullptr;
Map<BaseMaterial3D::MaterialKey, BaseMaterial3D::ShaderData> BaseMaterial3D::shader_map;
-BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = NULL;
+BaseMaterial3D::ShaderNames *BaseMaterial3D::shader_names = nullptr;
void BaseMaterial3D::init_shaders() {
@@ -375,7 +375,7 @@ void BaseMaterial3D::finish_shaders() {
}
memdelete(dirty_materials);
- dirty_materials = NULL;
+ dirty_materials = nullptr;
memdelete(shader_names);
}
@@ -2641,7 +2641,7 @@ bool StandardMaterial3D::_set(const StringName &p_name, const Variant &p_value)
{ "depth_flip_binormal", "heightmap_flip_binormal" },
{ "depth_texture", "heightmap_texture" },
- { NULL, NULL },
+ { nullptr, nullptr },
};
int idx = 0;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index b37b7f9751..6bb5be15f3 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -37,7 +37,7 @@
#include <stdlib.h>
-Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = NULL;
+Mesh::ConvexDecompositionFunc Mesh::convex_composition_function = nullptr;
Ref<TriangleMesh> Mesh::generate_triangle_mesh() const {
@@ -372,7 +372,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>());
{
- int *ir = NULL;
+ int *ir = nullptr;
Vector<int> indices = arrays[ARRAY_INDEX];
bool has_indices = false;
Vector<Vector3> vertices = arrays[ARRAY_VERTEX];
@@ -1359,7 +1359,7 @@ void ArrayMesh::regen_normalmaps() {
}
//dirty hack
-bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = NULL;
+bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) = nullptr;
struct ArrayMeshLightmapSurface {
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 8b7f8288b8..76d96786bc 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -58,30 +58,30 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
const Vector3 *vr = varray.ptr();
- const Vector3 *nr = NULL;
+ const Vector3 *nr = nullptr;
if (arrays[Mesh::ARRAY_NORMAL].get_type() != Variant::NIL)
nr = arrays[Mesh::ARRAY_NORMAL].operator Vector<Vector3>().ptr();
- const real_t *ta = NULL;
+ const real_t *ta = nullptr;
if (arrays[Mesh::ARRAY_TANGENT].get_type() != Variant::NIL)
ta = arrays[Mesh::ARRAY_TANGENT].operator Vector<real_t>().ptr();
- const Vector2 *uv = NULL;
+ const Vector2 *uv = nullptr;
if (arrays[Mesh::ARRAY_TEX_UV].get_type() != Variant::NIL)
uv = arrays[Mesh::ARRAY_TEX_UV].operator Vector<Vector2>().ptr();
- const Vector2 *uv2 = NULL;
+ const Vector2 *uv2 = nullptr;
if (arrays[Mesh::ARRAY_TEX_UV2].get_type() != Variant::NIL)
uv2 = arrays[Mesh::ARRAY_TEX_UV2].operator Vector<Vector2>().ptr();
- const Color *col = NULL;
+ const Color *col = nullptr;
if (arrays[Mesh::ARRAY_COLOR].get_type() != Variant::NIL)
col = arrays[Mesh::ARRAY_COLOR].operator Vector<Color>().ptr();
- const int *bo = NULL;
+ const int *bo = nullptr;
if (arrays[Mesh::ARRAY_BONES].get_type() != Variant::NIL)
bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr();
- const real_t *we = NULL;
+ const real_t *we = nullptr;
if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL)
we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr();
@@ -202,43 +202,43 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
v.resize(vcount);
Vector3 *vr = v.ptrw();
- Vector3 *nr = NULL;
+ Vector3 *nr = nullptr;
if (format & Mesh::ARRAY_FORMAT_NORMAL) {
n.resize(vcount);
nr = n.ptrw();
}
- real_t *ta = NULL;
+ real_t *ta = nullptr;
if (format & Mesh::ARRAY_FORMAT_TANGENT) {
t.resize(vcount * 4);
ta = t.ptrw();
}
- Vector2 *uv = NULL;
+ Vector2 *uv = nullptr;
if (format & Mesh::ARRAY_FORMAT_TEX_UV) {
u.resize(vcount);
uv = u.ptrw();
}
- Vector2 *uv2 = NULL;
+ Vector2 *uv2 = nullptr;
if (format & Mesh::ARRAY_FORMAT_TEX_UV2) {
u2.resize(vcount);
uv2 = u2.ptrw();
}
- Color *col = NULL;
+ Color *col = nullptr;
if (format & Mesh::ARRAY_FORMAT_COLOR) {
c.resize(vcount);
col = c.ptrw();
}
- int *bo = NULL;
+ int *bo = nullptr;
if (format & Mesh::ARRAY_FORMAT_BONES) {
b.resize(vcount * 4);
bo = b.ptrw();
}
- real_t *we = NULL;
+ real_t *we = nullptr;
if (format & Mesh::ARRAY_FORMAT_WEIGHTS) {
w.resize(vcount * 4);
we = w.ptrw();
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 549c29a7f3..633771506e 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -51,25 +51,25 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
// nodes where instancing failed (because something is missing)
List<Node *> stray_instances;
-#define NODE_FROM_ID(p_name, p_id) \
- Node *p_name; \
- if (p_id & FLAG_ID_IS_PATH) { \
- NodePath np = node_paths[p_id & FLAG_MASK]; \
- p_name = ret_nodes[0]->get_node_or_null(np); \
- } else { \
- ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, NULL); \
- p_name = ret_nodes[p_id & FLAG_MASK]; \
+#define NODE_FROM_ID(p_name, p_id) \
+ Node *p_name; \
+ if (p_id & FLAG_ID_IS_PATH) { \
+ NodePath np = node_paths[p_id & FLAG_MASK]; \
+ p_name = ret_nodes[0]->get_node_or_null(np); \
+ } else { \
+ ERR_FAIL_INDEX_V(p_id &FLAG_MASK, nc, nullptr); \
+ p_name = ret_nodes[p_id & FLAG_MASK]; \
}
int nc = nodes.size();
- ERR_FAIL_COND_V(nc == 0, NULL);
+ ERR_FAIL_COND_V(nc == 0, nullptr);
- const StringName *snames = NULL;
+ const StringName *snames = nullptr;
int sname_count = names.size();
if (sname_count)
snames = &names[0];
- const Variant *props = NULL;
+ const Variant *props = nullptr;
int prop_count = variants.size();
if (prop_count)
props = &variants[0];
@@ -88,11 +88,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
const NodeData &n = nd[i];
- Node *parent = NULL;
+ Node *parent = nullptr;
if (i > 0) {
- ERR_FAIL_COND_V_MSG(n.parent == -1, NULL, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name]));
+ ERR_FAIL_COND_V_MSG(n.parent == -1, nullptr, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name]));
NODE_FROM_ID(nparent, n.parent);
#ifdef DEBUG_ENABLED
if (!nparent && (n.parent & FLAG_ID_IS_PATH)) {
@@ -103,14 +103,14 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
parent = nparent;
}
- Node *node = NULL;
+ Node *node = nullptr;
if (i == 0 && base_scene_idx >= 0) {
//scene inheritance on root node
Ref<PackedScene> sdata = props[base_scene_idx];
- ERR_FAIL_COND_V(!sdata.is_valid(), NULL);
+ ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_COND_V(!node, nullptr);
if (p_edit_state != GEN_EDIT_STATE_DISABLED) {
node->set_scene_inherited_state(sdata->get_state());
}
@@ -123,9 +123,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
if (disable_placeholders) {
Ref<PackedScene> sdata = ResourceLoader::load(path, "PackedScene");
- ERR_FAIL_COND_V(!sdata.is_valid(), NULL);
+ ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE);
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_COND_V(!node, nullptr);
} else {
InstancePlaceholder *ip = memnew(InstancePlaceholder);
ip->set_instance_path(path);
@@ -134,9 +134,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
node->set_scene_instance_load_placeholder(true);
} else {
Ref<PackedScene> sdata = props[n.instance & FLAG_MASK];
- ERR_FAIL_COND_V(!sdata.is_valid(), NULL);
+ ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
node = sdata->instance(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE);
- ERR_FAIL_COND_V(!node, NULL);
+ ERR_FAIL_COND_V(!node, nullptr);
}
} else if (n.type == TYPE_INSTANCED) {
@@ -155,7 +155,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
if (!Object::cast_to<Node>(obj)) {
if (obj) {
memdelete(obj);
- obj = NULL;
+ obj = nullptr;
}
WARN_PRINT(String("Warning node of type " + snames[n.type].operator String() + " does not exist.").ascii().get_data());
if (n.parent >= 0 && n.parent < nc && ret_nodes[n.parent]) {
@@ -193,8 +193,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
for (int j = 0; j < nprop_count; j++) {
bool valid;
- ERR_FAIL_INDEX_V(nprops[j].name, sname_count, NULL);
- ERR_FAIL_INDEX_V(nprops[j].value, prop_count, NULL);
+ ERR_FAIL_INDEX_V(nprops[j].name, sname_count, nullptr);
+ ERR_FAIL_INDEX_V(nprops[j].value, prop_count, nullptr);
if (snames[nprops[j].name] == CoreStringNames::get_singleton()->_script) {
//work around to avoid old script variables from disappearing, should be the proper fix to:
@@ -260,7 +260,7 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
//groups
for (int j = 0; j < n.groups.size(); j++) {
- ERR_FAIL_INDEX_V(n.groups[j], sname_count, NULL);
+ ERR_FAIL_INDEX_V(n.groups[j], sname_count, nullptr);
node->add_to_group(snames[n.groups[j]], true);
}
@@ -315,8 +315,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
for (int i = 0; i < cc; i++) {
const ConnectionData &c = cdata[i];
- //ERR_FAIL_INDEX_V( c.from, nc, NULL );
- //ERR_FAIL_INDEX_V( c.to, nc, NULL );
+ //ERR_FAIL_INDEX_V( c.from, nc, nullptr );
+ //ERR_FAIL_INDEX_V( c.to, nc, nullptr );
NODE_FROM_ID(cfrom, c.from);
NODE_FROM_ID(cto, c.to);
@@ -450,7 +450,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
nd.instance = _vm_get_variant(instance, variant_map);
}
}
- n = NULL;
+ n = nullptr;
} else {
if (n->get_filename() != String()) {
//is an instance
@@ -773,7 +773,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
}
}
- nl = NULL;
+ nl = nullptr;
} else {
if (nl->get_filename() != String()) {
//is an instance
@@ -896,7 +896,7 @@ Error SceneState::pack(Node *p_scene) {
}
variants.resize(variant_map.size());
- const Variant *K = NULL;
+ const Variant *K = nullptr;
while ((K = variant_map.next(K))) {
int idx = variant_map[*K];
@@ -1689,12 +1689,12 @@ bool PackedScene::can_instance() const {
Node *PackedScene::instance(GenEditState p_edit_state) const {
#ifndef TOOLS_ENABLED
- ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, NULL, "Edit state is only for editors, does not work without tools compiled.");
+ ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, nullptr, "Edit state is only for editors, does not work without tools compiled.");
#endif
Node *s = state->instance((SceneState::GenEditState)p_edit_state);
if (!s)
- return NULL;
+ return nullptr;
if (p_edit_state != GEN_EDIT_STATE_DISABLED) {
s->set_scene_instance_state(state);
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 63766c1756..83430aef9e 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -31,9 +31,9 @@
#include "particles_material.h"
Mutex ParticlesMaterial::material_mutex;
-SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = NULL;
+SelfList<ParticlesMaterial>::List *ParticlesMaterial::dirty_materials = nullptr;
Map<ParticlesMaterial::MaterialKey, ParticlesMaterial::ShaderData> ParticlesMaterial::shader_map;
-ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = NULL;
+ParticlesMaterial::ShaderNames *ParticlesMaterial::shader_names = nullptr;
void ParticlesMaterial::init_shaders() {
@@ -104,7 +104,7 @@ void ParticlesMaterial::init_shaders() {
void ParticlesMaterial::finish_shaders() {
memdelete(dirty_materials);
- dirty_materials = NULL;
+ dirty_materials = nullptr;
memdelete(shader_names);
}
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index eff0721cef..c3daedf918 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -42,7 +42,7 @@ bool PolygonPathFinder::_is_point_inside(const Vector2 &p_point) const {
Vector2 a = points[e.points[0]].pos;
Vector2 b = points[e.points[1]].pos;
- if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, NULL)) {
+ if (Geometry::segment_intersects_segment_2d(a, b, p_point, outside_point, nullptr)) {
crosses++;
}
}
@@ -119,7 +119,7 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int>
Vector2 a = points[e.points[0]].pos;
Vector2 b = points[e.points[1]].pos;
- if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) {
+ if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) {
valid = false;
break;
}
@@ -209,7 +209,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
Vector2 a = points[e.points[0]].pos;
Vector2 b = points[e.points[1]].pos;
- if (Geometry::segment_intersects_segment_2d(a, b, from, to, NULL)) {
+ if (Geometry::segment_intersects_segment_2d(a, b, from, to, nullptr)) {
can_see_eachother = false;
break;
}
@@ -268,7 +268,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
e.points[0] != ignore_from_edge.points[0] &&
e.points[1] != ignore_from_edge.points[0]) {
- if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, NULL)) {
+ if (Geometry::segment_intersects_segment_2d(a, b, from, points[i].pos, nullptr)) {
valid_a = false;
}
}
@@ -281,7 +281,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector
e.points[0] != ignore_to_edge.points[0] &&
e.points[1] != ignore_to_edge.points[0]) {
- if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, NULL)) {
+ if (Geometry::segment_intersects_segment_2d(a, b, to, points[i].pos, nullptr)) {
valid_b = false;
}
}
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 0792af2143..46e8575018 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -164,7 +164,7 @@ void PrimitiveMesh::surface_set_material(int p_idx, const Ref<Material> &p_mater
}
Ref<Material> PrimitiveMesh::surface_get_material(int p_idx) const {
- ERR_FAIL_INDEX_V(p_idx, 1, NULL);
+ ERR_FAIL_INDEX_V(p_idx, 1, nullptr);
return material;
}
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 238bdf05ef..5068bb548f 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -795,7 +795,7 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p
ignore_resource_parsing = true;
//FileAccess
- FileAccess *fw = NULL;
+ FileAccess *fw = nullptr;
String base_path = local_path.get_base_dir();
@@ -961,7 +961,7 @@ void ResourceLoaderText::open(FileAccess *p_f, bool p_skip_first_tag) {
rp.ext_func = _parse_ext_resources;
rp.sub_func = _parse_sub_resources;
- rp.func = NULL;
+ rp.func = nullptr;
rp.userdata = this;
}
@@ -1392,7 +1392,7 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const
return loader.rename_dependencies(f, p_path, p_map);
}
-ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = NULL;
+ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr;
Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path, const String &p_dst_path) {
@@ -1674,7 +1674,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
RES res = E->get();
ERR_CONTINUE(!resource_set.has(res));
- bool main = (E->next() == NULL);
+ bool main = (E->next() == nullptr);
if (main && packed_scene.is_valid())
break; //save as a scene
@@ -1880,7 +1880,7 @@ void ResourceFormatSaverText::get_recognized_extensions(const RES &p_resource, L
p_extensions->push_back("tres"); //text resource
}
-ResourceFormatSaverText *ResourceFormatSaverText::singleton = NULL;
+ResourceFormatSaverText *ResourceFormatSaverText::singleton = nullptr;
ResourceFormatSaverText::ResourceFormatSaverText() {
singleton = this;
}
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index 2425ac7f6c..fbbd2e3346 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -134,7 +134,7 @@ public:
class ResourceFormatLoaderText : public ResourceFormatLoader {
public:
static ResourceFormatLoaderText *singleton;
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index e65457ed76..cf0cec362c 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -84,7 +84,7 @@ public:
_FORCE_INLINE_ StringName remap_param(const StringName &p_param) const {
if (params_cache_dirty)
- get_param_list(NULL);
+ get_param_list(nullptr);
const Map<StringName, StringName>::Element *E = params_cache.find(p_param);
if (E)
@@ -102,7 +102,7 @@ VARIANT_ENUM_CAST(Shader::Mode);
class ResourceFormatLoaderShader : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/scene/resources/shape_2d.cpp b/scene/resources/shape_2d.cpp
index 7984dadbc5..4fe585053a 100644
--- a/scene/resources/shape_2d.cpp
+++ b/scene/resources/shape_2d.cpp
@@ -50,13 +50,13 @@ bool Shape2D::collide_with_motion(const Transform2D &p_local_xform, const Vector
ERR_FAIL_COND_V(p_shape.is_null(), false);
int r;
- return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, NULL, 0, r);
+ return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, p_local_motion, p_shape->get_rid(), p_shape_xform, p_shape_motion, nullptr, 0, r);
}
bool Shape2D::collide(const Transform2D &p_local_xform, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform) {
ERR_FAIL_COND_V(p_shape.is_null(), false);
int r;
- return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), NULL, 0, r);
+ return PhysicsServer2D::get_singleton()->shape_collide(get_rid(), p_local_xform, Vector2(), p_shape->get_rid(), p_shape_xform, Vector2(), nullptr, 0, r);
}
Array Shape2D::collide_with_motion_and_get_contacts(const Transform2D &p_local_xform, const Vector2 &p_local_motion, const Ref<Shape2D> &p_shape, const Transform2D &p_shape_xform, const Vector2 &p_shape_motion) {
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index fee6bd1b54..4b392e23b7 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -854,7 +854,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons
const tbool bIsOrientationPreserving, const int iFace, const int iVert) {
TangentGenerationContextUserData &triangle_data = *reinterpret_cast<TangentGenerationContextUserData *>(pContext->m_pUserData);
- Vertex *vtx = NULL;
+ Vertex *vtx = nullptr;
if (triangle_data.indices.size() > 0) {
int index = triangle_data.indices[iFace * 3 + iVert]->get();
if (index < triangle_data.vertices.size()) {
@@ -864,7 +864,7 @@ void SurfaceTool::mikktSetTSpaceDefault(const SMikkTSpaceContext *pContext, cons
vtx = &triangle_data.vertices[iFace * 3 + iVert]->get();
}
- if (vtx != NULL) {
+ if (vtx != nullptr) {
vtx->tangent = Vector3(fvTangent[0], fvTangent[1], fvTangent[2]);
vtx->binormal = Vector3(-fvBiTangent[0], -fvBiTangent[1], -fvBiTangent[2]); // for some reason these are reversed, something with the coordinate system in Godot
}
@@ -882,7 +882,7 @@ void SurfaceTool::generate_tangents() {
mkif.m_getPosition = mikktGetPosition;
mkif.m_getTexCoord = mikktGetTexCoord;
mkif.m_setTSpace = mikktSetTSpaceDefault;
- mkif.m_setTSpaceBasic = NULL;
+ mkif.m_setTSpaceBasic = nullptr;
SMikkTSpaceContext msc;
msc.m_pInterface = &mkif;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 74b6a16d41..749dff24f2 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -525,9 +525,9 @@ void StreamTexture::_requested_normal(void *p_ud) {
request_normal_callback(stex);
}
-StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = NULL;
-StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = NULL;
-StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = NULL;
+StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback = nullptr;
+StreamTexture::TextureFormatRoughnessRequestCallback StreamTexture::request_roughness_callback = nullptr;
+StreamTexture::TextureFormatRequestCallback StreamTexture::request_normal_callback = nullptr;
Image::Format StreamTexture::get_format() const {
@@ -637,7 +637,7 @@ Error StreamTexture::load(const String &p_path) {
RS::get_singleton()->texture_set_detect_3d_callback(texture, _requested_3d, this);
} else {
//print_line("not requesting detect 3D at " + p_path);
- RS::get_singleton()->texture_set_detect_3d_callback(texture, NULL, NULL);
+ RS::get_singleton()->texture_set_detect_3d_callback(texture, nullptr, nullptr);
}
if (request_roughness) {
@@ -645,7 +645,7 @@ Error StreamTexture::load(const String &p_path) {
RS::get_singleton()->texture_set_detect_roughness_callback(texture, _requested_roughness, this);
} else {
//print_line("not requesting detect srgb at " + p_path);
- RS::get_singleton()->texture_set_detect_roughness_callback(texture, NULL, NULL);
+ RS::get_singleton()->texture_set_detect_roughness_callback(texture, nullptr, nullptr);
}
if (request_normal) {
@@ -653,7 +653,7 @@ Error StreamTexture::load(const String &p_path) {
RS::get_singleton()->texture_set_detect_normal_callback(texture, _requested_normal, this);
} else {
//print_line("not requesting detect normal at " + p_path);
- RS::get_singleton()->texture_set_detect_normal_callback(texture, NULL, NULL);
+ RS::get_singleton()->texture_set_detect_normal_callback(texture, nullptr, nullptr);
}
#endif
@@ -1869,7 +1869,7 @@ AnimatedTexture::AnimatedTexture() {
#ifndef NO_THREADS
rw_lock = RWLock::create();
#else
- rw_lock = NULL;
+ rw_lock = nullptr;
#endif
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index c3bbbd5ee6..18f70baa07 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -213,7 +213,7 @@ public:
class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
@@ -421,7 +421,7 @@ public:
COMPRESSION_UNCOMPRESSED
};
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr);
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;
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index d67f5f9ff2..98ebf048dc 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -230,11 +230,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
List<PropertyInfo> list;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = icon_map.next(key))) {
- const StringName *key2 = NULL;
+ const StringName *key2 = nullptr;
while ((key2 = icon_map[*key].next(key2))) {
@@ -242,11 +242,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- key = NULL;
+ key = nullptr;
while ((key = style_map.next(key))) {
- const StringName *key2 = NULL;
+ const StringName *key2 = nullptr;
while ((key2 = style_map[*key].next(key2))) {
@@ -254,11 +254,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- key = NULL;
+ key = nullptr;
while ((key = font_map.next(key))) {
- const StringName *key2 = NULL;
+ const StringName *key2 = nullptr;
while ((key2 = font_map[*key].next(key2))) {
@@ -266,11 +266,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- key = NULL;
+ key = nullptr;
while ((key = color_map.next(key))) {
- const StringName *key2 = NULL;
+ const StringName *key2 = nullptr;
while ((key2 = color_map[*key].next(key2))) {
@@ -278,11 +278,11 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
- key = NULL;
+ key = nullptr;
while ((key = constant_map.next(key))) {
- const StringName *key2 = NULL;
+ const StringName *key2 = nullptr;
while ((key2 = constant_map[*key].next(key2))) {
@@ -417,7 +417,7 @@ void Theme::get_icon_list(StringName p_type, List<StringName> *p_list) const {
if (!icon_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = icon_map[p_type].next(key))) {
@@ -440,7 +440,7 @@ Ref<Shader> Theme::get_shader(const StringName &p_name, const StringName &p_type
if (shader_map.has(p_type) && shader_map[p_type].has(p_name) && shader_map[p_type][p_name].is_valid()) {
return shader_map[p_type][p_name];
} else {
- return NULL;
+ return nullptr;
}
}
@@ -464,7 +464,7 @@ void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list)
if (!shader_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = shader_map[p_type].next(key))) {
@@ -530,7 +530,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const
if (!style_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = style_map[p_type].next(key))) {
@@ -541,7 +541,7 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const
void Theme::get_stylebox_types(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = style_map.next(key))) {
p_list->push_back(*key);
}
@@ -604,7 +604,7 @@ void Theme::get_font_list(StringName p_type, List<StringName> *p_list) const {
if (!font_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = font_map[p_type].next(key))) {
@@ -654,7 +654,7 @@ void Theme::get_color_list(StringName p_type, List<StringName> *p_list) const {
if (!color_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = color_map[p_type].next(key))) {
@@ -704,7 +704,7 @@ void Theme::get_constant_list(StringName p_type, List<StringName> *p_list) const
if (!constant_map.has(p_type))
return;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = constant_map[p_type].next(key))) {
@@ -716,9 +716,9 @@ void Theme::clear() {
//these need disconnecting
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = icon_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = icon_map[*K].next(L))) {
Ref<Texture2D> icon = icon_map[*K][*L];
if (icon.is_valid()) {
@@ -729,9 +729,9 @@ void Theme::clear() {
}
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = style_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = style_map[*K].next(L))) {
Ref<StyleBox> style = style_map[*K][*L];
if (style.is_valid()) {
@@ -742,9 +742,9 @@ void Theme::clear() {
}
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = font_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = font_map[*K].next(L))) {
Ref<Font> font = font_map[*K][*L];
if (font.is_valid()) {
@@ -781,9 +781,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) {
//these need reconnecting, so add normally
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = p_other->icon_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = p_other->icon_map[*K].next(L))) {
set_icon(*L, *K, p_other->icon_map[*K][*L]);
}
@@ -791,9 +791,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) {
}
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = p_other->style_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = p_other->style_map[*K].next(L))) {
set_stylebox(*L, *K, p_other->style_map[*K][*L]);
}
@@ -801,9 +801,9 @@ void Theme::copy_theme(const Ref<Theme> &p_other) {
}
{
- const StringName *K = NULL;
+ const StringName *K = nullptr;
while ((K = p_other->font_map.next(K))) {
- const StringName *L = NULL;
+ const StringName *L = nullptr;
while ((L = p_other->font_map[*K].next(L))) {
set_font(*L, *K, p_other->font_map[*K][*L]);
}
@@ -825,35 +825,35 @@ void Theme::get_type_list(List<StringName> *p_list) const {
ERR_FAIL_NULL(p_list);
Set<StringName> types;
- const StringName *key = NULL;
+ const StringName *key = nullptr;
while ((key = icon_map.next(key))) {
types.insert(*key);
}
- key = NULL;
+ key = nullptr;
while ((key = style_map.next(key))) {
types.insert(*key);
}
- key = NULL;
+ key = nullptr;
while ((key = font_map.next(key))) {
types.insert(*key);
}
- key = NULL;
+ key = nullptr;
while ((key = color_map.next(key))) {
types.insert(*key);
}
- key = NULL;
+ key = nullptr;
while ((key = constant_map.next(key))) {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 27305cfff1..6f8a53be1a 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -620,7 +620,7 @@ Vector2 TileSet::autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask,
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
//First try to forward selection to script
if (p_tilemap_node->get_class_name() == "TileMap") {
- if (get_script_instance() != NULL) {
+ if (get_script_instance() != nullptr) {
if (get_script_instance()->has_method("_forward_subtile_selection")) {
Variant ret = get_script_instance()->call("_forward_subtile_selection", p_id, p_bitmask, p_tilemap_node, p_tile_location);
if (ret.get_type() == Variant::VECTOR2) {
@@ -681,7 +681,7 @@ Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilem
ERR_FAIL_COND_V(!tile_map.has(p_id), Vector2());
//First try to forward selection to script
- if (get_script_instance() != NULL) {
+ if (get_script_instance() != nullptr) {
if (get_script_instance()->has_method("_forward_atlas_subtile_selection")) {
Variant ret = get_script_instance()->call("_forward_atlas_subtile_selection", p_id, p_tilemap_node, p_tile_location);
if (ret.get_type() == Variant::VECTOR2) {
@@ -1108,7 +1108,7 @@ bool TileSet::is_tile_bound(int p_drawn_id, int p_neighbor_id) {
if (p_drawn_id == p_neighbor_id) {
return true;
- } else if (get_script_instance() != NULL) {
+ } else if (get_script_instance() != nullptr) {
if (get_script_instance()->has_method("_is_tile_bound")) {
Variant ret = get_script_instance()->call("_is_tile_bound", p_drawn_id, p_neighbor_id);
if (ret.get_type() == Variant::BOOL) {
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index 5252c560a4..05b43dfb89 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -194,8 +194,8 @@ public:
void autotile_set_bitmask(int p_id, Vector2 p_coord, uint32_t p_flag);
uint32_t autotile_get_bitmask(int p_id, Vector2 p_coord);
const Map<Vector2, uint32_t> &autotile_get_bitmask_map(int p_id);
- Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2());
- Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = NULL, const Vector2 &p_tile_location = Vector2());
+ Vector2 autotile_get_subtile_for_bitmask(int p_id, uint16_t p_bitmask, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
+ Vector2 atlastile_get_subtile_by_priority(int p_id, const Node *p_tilemap_node = nullptr, const Vector2 &p_tile_location = Vector2());
void tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape);
Ref<Shape2D> tile_get_shape(int p_id, int p_shape_id) const;
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index c47e80c807..f70f54412b 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -881,7 +881,7 @@ VisualShader::RenderModeEnums VisualShader::render_mode_enums[] = {
{ Shader::MODE_SPATIAL, "diffuse" },
{ Shader::MODE_SPATIAL, "specular" },
{ Shader::MODE_CANVAS_ITEM, "blend" },
- { Shader::MODE_CANVAS_ITEM, NULL }
+ { Shader::MODE_CANVAS_ITEM, nullptr }
};
static const char *type_string[VisualShader::TYPE_MAX] = {
@@ -1085,12 +1085,12 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const {
}
p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
- if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != NULL) {
+ if (Object::cast_to<VisualShaderNodeGroupBase>(E->get().node.ptr()) != nullptr) {
p_list->push_back(PropertyInfo(Variant::VECTOR2, prop_name + "/size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/input_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/output_ports", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
- if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != NULL) {
+ if (Object::cast_to<VisualShaderNodeExpression>(E->get().node.ptr()) != nullptr) {
p_list->push_back(PropertyInfo(Variant::STRING, prop_name + "/expression", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR));
}
}
@@ -1478,7 +1478,7 @@ void VisualShader::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_node", "type", "id"), &VisualShader::remove_node);
ClassDB::bind_method(D_METHOD("is_node_connection", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection);
- ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::is_node_connection);
+ ClassDB::bind_method(D_METHOD("can_connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::can_connect_nodes);
ClassDB::bind_method(D_METHOD("connect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::connect_nodes);
ClassDB::bind_method(D_METHOD("disconnect_nodes", "type", "from_node", "from_port", "to_node", "to_port"), &VisualShader::disconnect_nodes);
@@ -1687,7 +1687,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::ports[] = {
{ Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "sky_coords", "vec3(SKY_COORDS, 0.0)" },
{ Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
- { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL },
+ { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr },
};
const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = {
@@ -1736,7 +1736,7 @@ const VisualShaderNodeInput::Port VisualShaderNodeInput::preview_ports[] = {
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "1.0" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_VECTOR, "velocity", "vec3(0.0, 0.0, 1.0)" },
{ Shader::MODE_PARTICLES, VisualShader::TYPE_VERTEX, VisualShaderNode::PORT_TYPE_SCALAR, "time", "TIME" },
- { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL },
+ { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr },
};
int VisualShaderNodeInput::get_input_port_count() const {
@@ -2034,7 +2034,7 @@ const VisualShaderNodeOutput::Port VisualShaderNodeOutput::ports[] = {
{ Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_VECTOR, "color", "COLOR" },
{ Shader::MODE_SKY, VisualShader::TYPE_FRAGMENT, VisualShaderNode::PORT_TYPE_SCALAR, "alpha", "ALPHA" },
- { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, NULL, NULL },
+ { Shader::MODE_MAX, VisualShader::TYPE_MAX, VisualShaderNode::PORT_TYPE_TRANSFORM, nullptr, nullptr },
};
int VisualShaderNodeOutput::get_input_port_count() const {
@@ -2565,7 +2565,7 @@ void VisualShaderNodeGroupBase::set_control(Control *p_control, int p_index) {
}
Control *VisualShaderNodeGroupBase::get_control(int p_index) {
- ERR_FAIL_COND_V(!controls.has(p_index), NULL);
+ ERR_FAIL_COND_V(!controls.has(p_index), nullptr);
return controls[p_index];
}
diff --git a/scene/resources/world_3d.cpp b/scene/resources/world_3d.cpp
index 8e45b22cbf..dee00dd82a 100644
--- a/scene/resources/world_3d.cpp
+++ b/scene/resources/world_3d.cpp
@@ -348,7 +348,7 @@ void World3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects");
ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario");
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", 0), "", "get_direct_space_state");
}
World3D::World3D() {
@@ -365,7 +365,7 @@ World3D::World3D() {
ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::FLOAT, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
#ifdef _3D_DISABLED
- indexer = NULL;
+ indexer = nullptr;
#else
indexer = memnew(SpatialIndexer);
#endif
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index 1f0365dab9..ad996e7d50 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -30,7 +30,7 @@
#include "scene_string_names.h"
-SceneStringNames *SceneStringNames::singleton = NULL;
+SceneStringNames *SceneStringNames::singleton = nullptr;
SceneStringNames::SceneStringNames() {
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index e255ebb3cb..58e8c28454 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -44,7 +44,7 @@ class SceneStringNames {
static void create() { singleton = memnew(SceneStringNames); }
static void free() {
memdelete(singleton);
- singleton = NULL;
+ singleton = nullptr;
}
SceneStringNames();
diff --git a/servers/SCsub b/servers/SCsub
index 7706b99d87..7080a110da 100644
--- a/servers/SCsub
+++ b/servers/SCsub
@@ -1,16 +1,16 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.servers_sources = []
env.add_source_files(env.servers_sources, "*.cpp")
-SConscript('arvr/SCsub')
-SConscript('camera/SCsub')
-SConscript('physics_3d/SCsub')
-SConscript('physics_2d/SCsub')
-SConscript('rendering/SCsub')
-SConscript('audio/SCsub')
+SConscript("arvr/SCsub")
+SConscript("camera/SCsub")
+SConscript("physics_3d/SCsub")
+SConscript("physics_2d/SCsub")
+SConscript("rendering/SCsub")
+SConscript("audio/SCsub")
lib = env.add_library("servers", env.servers_sources)
diff --git a/servers/arvr/SCsub b/servers/arvr/SCsub
index d730144861..86681f9c74 100644
--- a/servers/arvr/SCsub
+++ b/servers/arvr/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index 724414ae96..f5597d8974 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -33,7 +33,7 @@
#include "arvr/arvr_positional_tracker.h"
#include "core/project_settings.h"
-ARVRServer *ARVRServer::singleton = NULL;
+ARVRServer *ARVRServer::singleton = nullptr;
ARVRServer *ARVRServer::get_singleton() {
return singleton;
@@ -109,7 +109,7 @@ Transform ARVRServer::get_reference_frame() const {
};
void ARVRServer::center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height) {
- if (primary_interface != NULL) {
+ if (primary_interface != nullptr) {
// clear our current reference frame or we'll end up double adjusting it
reference_frame = Transform();
@@ -142,7 +142,7 @@ 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) {
+ if (primary_interface != nullptr) {
hmd_transform = primary_interface->get_transform_for_eye(ARVRInterface::EYE_MONO, hmd_transform);
};
return hmd_transform;
@@ -189,7 +189,7 @@ int ARVRServer::get_interface_count() const {
};
Ref<ARVRInterface> ARVRServer::get_interface(int p_index) const {
- ERR_FAIL_INDEX_V(p_index, interfaces.size(), NULL);
+ ERR_FAIL_INDEX_V(p_index, interfaces.size(), nullptr);
return interfaces[p_index];
};
@@ -205,7 +205,7 @@ Ref<ARVRInterface> ARVRServer::find_interface(const String &p_name) const {
};
};
- ERR_FAIL_COND_V(idx == -1, NULL);
+ ERR_FAIL_COND_V(idx == -1, nullptr);
return interfaces[idx];
};
@@ -296,13 +296,13 @@ int ARVRServer::get_tracker_count() const {
};
ARVRPositionalTracker *ARVRServer::get_tracker(int p_index) const {
- ERR_FAIL_INDEX_V(p_index, trackers.size(), NULL);
+ ERR_FAIL_INDEX_V(p_index, trackers.size(), nullptr);
return trackers[p_index];
};
ARVRPositionalTracker *ARVRServer::find_by_type_and_id(TrackerType p_tracker_type, int p_tracker_id) const {
- ERR_FAIL_COND_V(p_tracker_id == 0, NULL);
+ ERR_FAIL_COND_V(p_tracker_id == 0, nullptr);
for (int i = 0; i < trackers.size(); i++) {
if (trackers[i]->get_type() == p_tracker_type && trackers[i]->get_tracker_id() == p_tracker_id) {
@@ -310,7 +310,7 @@ ARVRPositionalTracker *ARVRServer::find_by_type_and_id(TrackerType p_tracker_typ
};
};
- return NULL;
+ return nullptr;
};
Ref<ARVRInterface> ARVRServer::get_primary_interface() const {
@@ -382,5 +382,5 @@ ARVRServer::~ARVRServer() {
trackers.remove(0);
}
- singleton = NULL;
+ singleton = nullptr;
};
diff --git a/servers/audio/SCsub b/servers/audio/SCsub
index 3c18c18043..5021e578c3 100644
--- a/servers/audio/SCsub
+++ b/servers/audio/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp
index 69b098edfc..ed67e8902a 100644
--- a/servers/audio/audio_driver_dummy.cpp
+++ b/servers/audio/audio_driver_dummy.cpp
@@ -38,7 +38,7 @@ Error AudioDriverDummy::init() {
active = false;
thread_exited = false;
exit_thread = false;
- samples_in = NULL;
+ samples_in = nullptr;
mix_rate = DEFAULT_MIX_RATE;
speaker_mode = SPEAKER_MODE_STEREO;
@@ -119,12 +119,12 @@ void AudioDriverDummy::finish() {
};
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
};
AudioDriverDummy::AudioDriverDummy() {
- thread = NULL;
+ thread = nullptr;
};
AudioDriverDummy::~AudioDriverDummy(){
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index c0bf4f3a55..2771fc177b 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -237,7 +237,7 @@ AudioFilterSW::AudioFilterSW() {
AudioFilterSW::Processor::Processor() {
- set_filter(NULL);
+ set_filter(nullptr);
}
void AudioFilterSW::Processor::set_filter(AudioFilterSW *p_filter, bool p_clear_history) {
diff --git a/servers/audio/audio_rb_resampler.cpp b/servers/audio/audio_rb_resampler.cpp
index 092c3315ee..0ac7ddc7a9 100644
--- a/servers/audio/audio_rb_resampler.cpp
+++ b/servers/audio/audio_rb_resampler.cpp
@@ -203,18 +203,18 @@ void AudioRBResampler::clear() {
//should be stopped at this point but just in case
memdelete_arr(rb);
memdelete_arr(read_buf);
- rb = NULL;
+ rb = nullptr;
offset = 0;
rb_read_pos = 0;
rb_write_pos = 0;
- read_buf = NULL;
+ read_buf = nullptr;
}
AudioRBResampler::AudioRBResampler() {
- rb = NULL;
+ rb = nullptr;
offset = 0;
- read_buf = NULL;
+ read_buf = nullptr;
rb_read_pos = 0;
rb_write_pos = 0;
diff --git a/servers/audio/audio_rb_resampler.h b/servers/audio/audio_rb_resampler.h
index 8cd9714d57..40cf3e4cd7 100644
--- a/servers/audio/audio_rb_resampler.h
+++ b/servers/audio/audio_rb_resampler.h
@@ -69,7 +69,7 @@ public:
}
_FORCE_INLINE_ bool is_ready() const {
- return rb != NULL;
+ return rb != nullptr;
}
_FORCE_INLINE_ int get_total() const {
diff --git a/servers/audio/effects/SCsub b/servers/audio/effects/SCsub
index d730144861..86681f9c74 100644
--- a/servers/audio/effects/SCsub
+++ b/servers/audio/effects/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index 56529e208e..a74ac3c007 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -363,4 +363,7 @@ AudioEffectPitchShift::AudioEffectPitchShift() {
pitch_scale = 1.0;
oversampling = 4;
fft_size = FFT_SIZE_2048;
+ wet = 0.0;
+ dry = 0.0;
+ filter = false;
}
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp
index 8f0c55ad83..f2784679b5 100644
--- a/servers/audio/effects/audio_effect_record.cpp
+++ b/servers/audio/effects/audio_effect_record.cpp
@@ -178,14 +178,14 @@ Ref<AudioEffectInstance> AudioEffectRecord::instance() {
void AudioEffectRecord::ensure_thread_stopped() {
recording_active = false;
- if (current_instance != 0) {
+ if (current_instance != nullptr) {
current_instance->finish();
}
}
void AudioEffectRecord::set_recording_active(bool p_record) {
if (p_record) {
- if (current_instance == 0) {
+ if (current_instance == nullptr) {
WARN_PRINT("Recording should not be set as active before Godot has initialized.");
recording_active = false;
return;
@@ -217,8 +217,8 @@ Ref<AudioStreamSample> AudioEffectRecord::get_recording() const {
Vector<uint8_t> dst_data;
- ERR_FAIL_COND_V(current_instance.is_null(), NULL);
- ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, NULL);
+ ERR_FAIL_COND_V(current_instance.is_null(), nullptr);
+ ERR_FAIL_COND_V(current_instance->recording_data.size() == 0, nullptr);
if (dst_format == AudioStreamSample::FORMAT_8_BITS) {
int data_size = current_instance->recording_data.size();
diff --git a/servers/audio/effects/audio_stream_generator.cpp b/servers/audio/effects/audio_stream_generator.cpp
index 5f24cf3d6b..d272a2cdf7 100644
--- a/servers/audio/effects/audio_stream_generator.cpp
+++ b/servers/audio/effects/audio_stream_generator.cpp
@@ -205,7 +205,7 @@ void AudioStreamGeneratorPlayback::_bind_methods() {
}
AudioStreamGeneratorPlayback::AudioStreamGeneratorPlayback() {
- generator = NULL;
+ generator = nullptr;
skips = 0;
active = false;
mixed = 0;
diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp
index 9946a5eeef..ea2174f1d4 100644
--- a/servers/audio/effects/reverb.cpp
+++ b/servers/audio/effects/reverb.cpp
@@ -314,7 +314,7 @@ void Reverb::clear_buffers() {
if (comb[i].buffer)
memdelete_arr(comb[i].buffer);
- comb[i].buffer = 0;
+ comb[i].buffer = nullptr;
}
for (int i = 0; i < MAX_ALLPASS; i++) {
@@ -322,7 +322,7 @@ void Reverb::clear_buffers() {
if (allpass[i].buffer)
memdelete_arr(allpass[i].buffer);
- allpass[i].buffer = 0;
+ allpass[i].buffer = nullptr;
}
}
@@ -342,7 +342,7 @@ Reverb::Reverb() {
hpf_h2 = 0;
input_buffer = memnew_arr(float, INPUT_BUFFER_MAX_SIZE);
- echo_buffer = 0;
+ echo_buffer = nullptr;
configure_buffers();
update_parameters();
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 02e6d0f2d4..90033d4a87 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -45,7 +45,7 @@
#define MARK_EDITED
#endif
-AudioDriver *AudioDriver::singleton = NULL;
+AudioDriver *AudioDriver::singleton = nullptr;
AudioDriver *AudioDriver::get_singleton() {
return singleton;
@@ -215,7 +215,7 @@ void AudioDriverManager::initialize(int p_driver) {
AudioDriver *AudioDriverManager::get_driver(int p_driver) {
- ERR_FAIL_INDEX_V(p_driver, driver_count, NULL);
+ ERR_FAIL_INDEX_V(p_driver, driver_count, nullptr);
return drivers[p_driver];
}
@@ -322,7 +322,7 @@ void AudioServer::_mix_step() {
bus->soloed = true;
} else {
- bus = NULL;
+ bus = nullptr;
}
} while (bus);
@@ -388,7 +388,7 @@ void AudioServer::_mix_step() {
//process send
- Bus *send = NULL;
+ Bus *send = nullptr;
if (i > 0) {
//everything has a send save for master bus
@@ -476,8 +476,8 @@ bool AudioServer::thread_has_channel_mix_buffer(int p_bus, int p_buffer) const {
AudioFrame *AudioServer::thread_get_channel_mix_buffer(int p_bus, int p_buffer) {
- ERR_FAIL_INDEX_V(p_bus, buses.size(), NULL);
- ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), NULL);
+ ERR_FAIL_INDEX_V(p_bus, buses.size(), nullptr);
+ ERR_FAIL_INDEX_V(p_buffer, buses[p_bus]->channels.size(), nullptr);
AudioFrame *data = buses.write[p_bus]->channels.write[p_buffer].buffer.ptrw();
@@ -1129,7 +1129,7 @@ double AudioServer::get_time_since_last_mix() const {
return AudioDriver::get_singleton()->get_time_since_last_mix();
}
-AudioServer *AudioServer::singleton = NULL;
+AudioServer *AudioServer::singleton = nullptr;
void AudioServer::add_callback(AudioCallback p_callback, void *p_userdata) {
lock();
@@ -1372,7 +1372,7 @@ AudioServer::AudioServer() {
AudioServer::~AudioServer() {
- singleton = NULL;
+ singleton = nullptr;
}
/////////////////////////////////
diff --git a/servers/camera/SCsub b/servers/camera/SCsub
index ccc76e823f..c949f3bb25 100644
--- a/servers/camera/SCsub
+++ b/servers/camera/SCsub
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
-Export('env')
+Export("env")
diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp
index 1a86ff1af4..3caea6b7c3 100644
--- a/servers/camera_server.cpp
+++ b/servers/camera_server.cpp
@@ -35,7 +35,7 @@
////////////////////////////////////////////////////////
// CameraServer
-CameraServer::CreateFunc CameraServer::create_func = NULL;
+CameraServer::CreateFunc CameraServer::create_func = nullptr;
void CameraServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_feed", "index"), &CameraServer::get_feed);
@@ -54,7 +54,7 @@ void CameraServer::_bind_methods() {
BIND_ENUM_CONSTANT(FEED_CBCR_IMAGE);
};
-CameraServer *CameraServer::singleton = NULL;
+CameraServer *CameraServer::singleton = nullptr;
CameraServer *CameraServer::get_singleton() {
return singleton;
@@ -92,7 +92,7 @@ Ref<CameraFeed> CameraServer::get_feed_by_id(int p_id) {
int index = get_feed_index(p_id);
if (index == -1) {
- return NULL;
+ return nullptr;
} else {
return feeds[index];
}
@@ -132,7 +132,7 @@ void CameraServer::remove_feed(const Ref<CameraFeed> &p_feed) {
};
Ref<CameraFeed> CameraServer::get_feed(int p_index) {
- ERR_FAIL_INDEX_V(p_index, feeds.size(), NULL);
+ ERR_FAIL_INDEX_V(p_index, feeds.size(), nullptr);
return feeds[p_index];
};
@@ -167,5 +167,5 @@ CameraServer::CameraServer() {
};
CameraServer::~CameraServer() {
- singleton = NULL;
+ singleton = nullptr;
};
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 9798c57707..da1a68a179 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "display_server.h"
+
#include "core/input/input_filter.h"
#include "scene/resources/texture.h"
@@ -434,7 +435,7 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("native_video_unpause"), &DisplayServer::native_video_unpause);
ClassDB::bind_method(D_METHOD("dialog_show", "title", "description", "buttons", "callback"), &DisplayServer::dialog_show);
- ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_show);
+ ClassDB::bind_method(D_METHOD("dialog_input_text", "title", "description", "existing_text", "callback"), &DisplayServer::dialog_input_text);
ClassDB::bind_method(D_METHOD("get_latin_keyboard_variant"), &DisplayServer::get_latin_keyboard_variant);
@@ -517,11 +518,6 @@ void DisplayServer::_bind_methods() {
BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT);
BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS);
BIND_ENUM_CONSTANT(WINDOW_FLAG_MAX);
- BIND_ENUM_CONSTANT(WINDOW_FLAG_RESIZE_DISABLED_BIT);
- BIND_ENUM_CONSTANT(WINDOW_FLAG_BORDERLESS_BIT);
- BIND_ENUM_CONSTANT(WINDOW_FLAG_ALWAYS_ON_TOP_BIT);
- BIND_ENUM_CONSTANT(WINDOW_FLAG_TRANSPARENT_BIT);
- BIND_ENUM_CONSTANT(WINDOW_FLAG_NO_FOCUS_BIT);
BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTY);
BIND_ENUM_CONSTANT(LATIN_KEYBOARD_QWERTZ);
diff --git a/servers/display_server.h b/servers/display_server.h
index c0e92891a3..1956bcafca 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -200,6 +200,10 @@ public:
WINDOW_FLAG_TRANSPARENT,
WINDOW_FLAG_NO_FOCUS,
WINDOW_FLAG_MAX,
+ };
+
+ // Separate enum otherwise we get warnings in switches not handling all values.
+ enum WindowFlagsBit {
WINDOW_FLAG_RESIZE_DISABLED_BIT = (1 << WINDOW_FLAG_RESIZE_DISABLED),
WINDOW_FLAG_BORDERLESS_BIT = (1 << WINDOW_FLAG_BORDERLESS),
WINDOW_FLAG_ALWAYS_ON_TOP_BIT = (1 << WINDOW_FLAG_ALWAYS_ON_TOP),
diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp
index fe9eaa5736..17f2232c72 100644
--- a/servers/navigation_server_2d.cpp
+++ b/servers/navigation_server_2d.cpp
@@ -37,7 +37,7 @@
@author AndreaCatania
*/
-NavigationServer2D *NavigationServer2D::singleton = NULL;
+NavigationServer2D *NavigationServer2D::singleton = nullptr;
#define FORWARD_0_C(FUNC_NAME) \
NavigationServer2D::FUNC_NAME() \
@@ -167,7 +167,7 @@ NavigationServer2D::NavigationServer2D() {
}
NavigationServer2D::~NavigationServer2D() {
- singleton = NULL;
+ singleton = nullptr;
}
RID FORWARD_0_C(map_create);
diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h
index af914e5ba9..d7384bae74 100644
--- a/servers/navigation_server_2d.h
+++ b/servers/navigation_server_2d.h
@@ -39,7 +39,7 @@
#include "core/rid.h"
#include "scene/2d/navigation_region_2d.h"
-// This server exposes the 3D `NavigationServer` features in the 2D world.
+// This server exposes the `NavigationServer3D` features in the 2D world.
class NavigationServer2D : public Object {
GDCLASS(NavigationServer2D, Object);
diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp
index 3e7a8e816e..67a4d0e413 100644
--- a/servers/navigation_server_3d.cpp
+++ b/servers/navigation_server_3d.cpp
@@ -34,7 +34,7 @@
#include "navigation_server_3d.h"
-NavigationServer3D *NavigationServer3D::singleton = NULL;
+NavigationServer3D *NavigationServer3D::singleton = nullptr;
void NavigationServer3D::_bind_methods() {
@@ -87,21 +87,21 @@ NavigationServer3D *NavigationServer3D::get_singleton_mut() {
}
NavigationServer3D::NavigationServer3D() {
- ERR_FAIL_COND(singleton != NULL);
+ ERR_FAIL_COND(singleton != nullptr);
singleton = this;
}
NavigationServer3D::~NavigationServer3D() {
- singleton = NULL;
+ singleton = nullptr;
}
-NavigationServer3DCallback NavigationServer3DManager::create_callback = NULL;
+NavigationServer3DCallback NavigationServer3DManager::create_callback = nullptr;
void NavigationServer3DManager::set_default_server(NavigationServer3DCallback p_callback) {
create_callback = p_callback;
}
NavigationServer3D *NavigationServer3DManager::new_default_server() {
- ERR_FAIL_COND_V(create_callback == NULL, NULL);
+ ERR_FAIL_COND_V(create_callback == nullptr, nullptr);
return create_callback();
}
diff --git a/servers/physics_2d/SCsub b/servers/physics_2d/SCsub
index d730144861..86681f9c74 100644
--- a/servers/physics_2d/SCsub
+++ b/servers/physics_2d/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/physics_2d/area_pair_2d_sw.cpp b/servers/physics_2d/area_pair_2d_sw.cpp
index 669f27bcc8..0e70a626c2 100644
--- a/servers/physics_2d/area_pair_2d_sw.cpp
+++ b/servers/physics_2d/area_pair_2d_sw.cpp
@@ -37,7 +37,7 @@ bool AreaPair2DSW::setup(real_t p_step) {
if (area->is_shape_set_as_disabled(area_shape) || body->is_shape_set_as_disabled(body_shape)) {
result = false;
- } else if (area->test_collision_mask(body) && CollisionSolver2DSW::solve(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), Vector2(), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), Vector2(), NULL, this)) {
+ } else if (area->test_collision_mask(body) && CollisionSolver2DSW::solve(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), Vector2(), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), Vector2(), nullptr, this)) {
result = true;
}
@@ -100,7 +100,7 @@ bool Area2Pair2DSW::setup(real_t p_step) {
bool result = false;
if (area_a->is_shape_set_as_disabled(shape_a) || area_b->is_shape_set_as_disabled(shape_b)) {
result = false;
- } else if (area_a->test_collision_mask(area_b) && CollisionSolver2DSW::solve(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), Vector2(), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), Vector2(), NULL, this)) {
+ } else if (area_a->test_collision_mask(area_b) && CollisionSolver2DSW::solve(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), Vector2(), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), Vector2(), nullptr, this)) {
result = true;
}
diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp
index 11cf1339bc..39e28fd002 100644
--- a/servers/physics_2d/body_2d_sw.cpp
+++ b/servers/physics_2d/body_2d_sw.cpp
@@ -538,8 +538,8 @@ void Body2DSW::integrate_forces(real_t p_step) {
_update_shapes_with_motion(motion);
}
- // damp_area=NULL; // clear the area, so it is set in the next frame
- def_area = NULL; // clear the area, so it is set in the next frame
+ // damp_area=nullptr; // clear the area, so it is set in the next frame
+ def_area = nullptr; // clear the area, so it is set in the next frame
contact_count = 0;
}
@@ -650,7 +650,7 @@ void Body2DSW::set_force_integration_callback(ObjectID p_id, const StringName &p
if (fi_callback) {
memdelete(fi_callback);
- fi_callback = NULL;
+ fi_callback = nullptr;
}
if (p_id.is_valid()) {
@@ -682,8 +682,8 @@ Body2DSW::Body2DSW() :
omit_force_integration = false;
applied_torque = 0;
island_step = 0;
- island_next = NULL;
- island_list_next = NULL;
+ island_next = nullptr;
+ island_list_next = nullptr;
_set_static(false);
first_time_kinematic = false;
linear_damp = -1;
@@ -697,7 +697,7 @@ Body2DSW::Body2DSW() :
still_time = 0;
continuous_cd_mode = PhysicsServer2D::CCD_MODE_DISABLED;
can_sleep = true;
- fi_callback = NULL;
+ fi_callback = nullptr;
}
Body2DSW::~Body2DSW() {
@@ -706,7 +706,7 @@ Body2DSW::~Body2DSW() {
memdelete(fi_callback);
}
-PhysicsDirectBodyState2DSW *PhysicsDirectBodyState2DSW::singleton = NULL;
+PhysicsDirectBodyState2DSW *PhysicsDirectBodyState2DSW::singleton = nullptr;
PhysicsDirectSpaceState2D *PhysicsDirectBodyState2DSW::get_space_state() {
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index e463377c7b..0514b263b4 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -419,7 +419,7 @@ public:
virtual real_t get_step() const { return step; }
PhysicsDirectBodyState2DSW() {
singleton = this;
- body = NULL;
+ body = nullptr;
}
};
diff --git a/servers/physics_2d/broad_phase_2d_basic.cpp b/servers/physics_2d/broad_phase_2d_basic.cpp
index 11bf8712ac..5e3a13f4dd 100644
--- a/servers/physics_2d/broad_phase_2d_basic.cpp
+++ b/servers/physics_2d/broad_phase_2d_basic.cpp
@@ -65,7 +65,7 @@ void BroadPhase2DBasic::remove(ID p_id) {
CollisionObject2DSW *BroadPhase2DBasic::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().owner;
}
bool BroadPhase2DBasic::is_static(ID p_id) const {
@@ -158,7 +158,7 @@ void BroadPhase2DBasic::update() {
if (pair_ok && !E) {
- void *data = NULL;
+ void *data = nullptr;
if (pair_callback)
data = pair_callback(elem_A->owner, elem_A->subindex, elem_B->owner, elem_B->subindex, unpair_userdata);
pair_map.insert(key, data);
@@ -175,8 +175,8 @@ BroadPhase2DSW *BroadPhase2DBasic::_create() {
BroadPhase2DBasic::BroadPhase2DBasic() {
current = 1;
- unpair_callback = NULL;
- unpair_userdata = NULL;
- pair_callback = NULL;
- pair_userdata = NULL;
+ unpair_callback = nullptr;
+ unpair_userdata = nullptr;
+ pair_callback = nullptr;
+ pair_userdata = nullptr;
}
diff --git a/servers/physics_2d/broad_phase_2d_basic.h b/servers/physics_2d/broad_phase_2d_basic.h
index fea5668c89..7d02590af9 100644
--- a/servers/physics_2d/broad_phase_2d_basic.h
+++ b/servers/physics_2d/broad_phase_2d_basic.h
@@ -91,8 +91,8 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
index 711ff9f1f7..2cb021258a 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp
@@ -394,7 +394,7 @@ void BroadPhase2DHashGrid::remove(ID p_id) {
CollisionObject2DSW *BroadPhase2DHashGrid::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().owner;
}
bool BroadPhase2DHashGrid::is_static(ID p_id) const {
@@ -646,7 +646,7 @@ BroadPhase2DHashGrid::BroadPhase2DHashGrid() {
ProjectSettings::get_singleton()->set_custom_property_info("physics/2d/large_object_surface_threshold_in_cells", PropertyInfo(Variant::INT, "physics/2d/large_object_surface_threshold_in_cells", PROPERTY_HINT_RANGE, "0,1024,1,or_greater"));
for (uint32_t i = 0; i < hash_table_size; i++)
- hash_table[i] = NULL;
+ hash_table[i] = nullptr;
pass = 1;
current = 0;
diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.h b/servers/physics_2d/broad_phase_2d_hash_grid.h
index e75b51c19d..dc29d0c619 100644
--- a/servers/physics_2d/broad_phase_2d_hash_grid.h
+++ b/servers/physics_2d/broad_phase_2d_hash_grid.h
@@ -44,7 +44,7 @@ class BroadPhase2DHashGrid : public BroadPhase2DSW {
PairData() {
colliding = false;
rc = 1;
- ud = NULL;
+ ud = nullptr;
}
};
@@ -177,8 +177,8 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_2d/broad_phase_2d_sw.cpp b/servers/physics_2d/broad_phase_2d_sw.cpp
index c9e1dd8758..5ba557e70a 100644
--- a/servers/physics_2d/broad_phase_2d_sw.cpp
+++ b/servers/physics_2d/broad_phase_2d_sw.cpp
@@ -30,7 +30,7 @@
#include "broad_phase_2d_sw.h"
-BroadPhase2DSW::CreateFunction BroadPhase2DSW::create_func = NULL;
+BroadPhase2DSW::CreateFunction BroadPhase2DSW::create_func = nullptr;
BroadPhase2DSW::~BroadPhase2DSW() {
}
diff --git a/servers/physics_2d/broad_phase_2d_sw.h b/servers/physics_2d/broad_phase_2d_sw.h
index c7777d9d92..5e42c72d83 100644
--- a/servers/physics_2d/broad_phase_2d_sw.h
+++ b/servers/physics_2d/broad_phase_2d_sw.h
@@ -58,8 +58,8 @@ public:
virtual bool is_static(ID p_id) const = 0;
virtual int get_subindex(ID p_id) const = 0;
- virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_segment(const Vector2 &p_from, const Vector2 &p_to, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
+ virtual int cull_aabb(const Rect2 &p_aabb, CollisionObject2DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0;
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index a6891372c2..0ec293c042 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -266,7 +266,7 @@ CollisionObject2DSW::CollisionObject2DSW(Type p_type) :
_static = true;
type = p_type;
- space = NULL;
+ space = nullptr;
collision_mask = 1;
collision_layer = 1;
pickable = true;
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index 217c93c6da..a954cb3de3 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -145,7 +145,7 @@ static void _generate_contacts_from_supports(const Vector2 *p_points_A, int p_po
_generate_contacts_point_edge,
},
{
- 0,
+ nullptr,
_generate_contacts_edge_edge,
}
};
@@ -1060,25 +1060,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, false, false>,
_collision_segment_capsule<false, false, false>,
_collision_segment_convex_polygon<false, false, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, false, false>,
_collision_circle_rectangle<false, false, false>,
_collision_circle_capsule<false, false, false>,
_collision_circle_convex_polygon<false, false, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, false, false>,
_collision_rectangle_capsule<false, false, false>,
_collision_rectangle_convex_polygon<false, false, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, false, false>,
_collision_capsule_convex_polygon<false, false, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, false, false> }
};
@@ -1089,25 +1089,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, false, false>,
_collision_segment_capsule<true, false, false>,
_collision_segment_convex_polygon<true, false, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, false, false>,
_collision_circle_rectangle<true, false, false>,
_collision_circle_capsule<true, false, false>,
_collision_circle_convex_polygon<true, false, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, false, false>,
_collision_rectangle_capsule<true, false, false>,
_collision_rectangle_convex_polygon<true, false, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, false, false>,
_collision_capsule_convex_polygon<true, false, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, false, false> }
};
@@ -1118,25 +1118,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, true, false>,
_collision_segment_capsule<false, true, false>,
_collision_segment_convex_polygon<false, true, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, true, false>,
_collision_circle_rectangle<false, true, false>,
_collision_circle_capsule<false, true, false>,
_collision_circle_convex_polygon<false, true, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, true, false>,
_collision_rectangle_capsule<false, true, false>,
_collision_rectangle_convex_polygon<false, true, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, true, false>,
_collision_capsule_convex_polygon<false, true, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, true, false> }
};
@@ -1147,25 +1147,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, true, false>,
_collision_segment_capsule<true, true, false>,
_collision_segment_convex_polygon<true, true, false> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, true, false>,
_collision_circle_rectangle<true, true, false>,
_collision_circle_capsule<true, true, false>,
_collision_circle_convex_polygon<true, true, false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, true, false>,
_collision_rectangle_capsule<true, true, false>,
_collision_rectangle_convex_polygon<true, true, false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, true, false>,
_collision_capsule_convex_polygon<true, true, false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, true, false> }
};
@@ -1176,25 +1176,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, false, true>,
_collision_segment_capsule<false, false, true>,
_collision_segment_convex_polygon<false, false, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, false, true>,
_collision_circle_rectangle<false, false, true>,
_collision_circle_capsule<false, false, true>,
_collision_circle_convex_polygon<false, false, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, false, true>,
_collision_rectangle_capsule<false, false, true>,
_collision_rectangle_convex_polygon<false, false, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, false, true>,
_collision_capsule_convex_polygon<false, false, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, false, true> }
};
@@ -1205,25 +1205,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, false, true>,
_collision_segment_capsule<true, false, true>,
_collision_segment_convex_polygon<true, false, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, false, true>,
_collision_circle_rectangle<true, false, true>,
_collision_circle_capsule<true, false, true>,
_collision_circle_convex_polygon<true, false, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, false, true>,
_collision_rectangle_capsule<true, false, true>,
_collision_rectangle_convex_polygon<true, false, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, false, true>,
_collision_capsule_convex_polygon<true, false, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, false, true> }
};
@@ -1234,25 +1234,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<false, true, true>,
_collision_segment_capsule<false, true, true>,
_collision_segment_convex_polygon<false, true, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<false, true, true>,
_collision_circle_rectangle<false, true, true>,
_collision_circle_capsule<false, true, true>,
_collision_circle_convex_polygon<false, true, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<false, true, true>,
_collision_rectangle_capsule<false, true, true>,
_collision_rectangle_convex_polygon<false, true, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<false, true, true>,
_collision_capsule_convex_polygon<false, true, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false, true, true> }
};
@@ -1263,25 +1263,25 @@ bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D
_collision_segment_rectangle<true, true, true>,
_collision_segment_capsule<true, true, true>,
_collision_segment_convex_polygon<true, true, true> },
- { 0,
+ { nullptr,
_collision_circle_circle<true, true, true>,
_collision_circle_rectangle<true, true, true>,
_collision_circle_capsule<true, true, true>,
_collision_circle_convex_polygon<true, true, true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_rectangle_rectangle<true, true, true>,
_collision_rectangle_capsule<true, true, true>,
_collision_rectangle_convex_polygon<true, true, true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_capsule_capsule<true, true, true>,
_collision_capsule_convex_polygon<true, true, true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true, true, true> }
};
diff --git a/servers/physics_2d/collision_solver_2d_sat.h b/servers/physics_2d/collision_solver_2d_sat.h
index 105cb9104d..6bb485f561 100644
--- a/servers/physics_2d/collision_solver_2d_sat.h
+++ b/servers/physics_2d/collision_solver_2d_sat.h
@@ -33,6 +33,6 @@
#include "collision_solver_2d_sw.h"
-bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
+bool sat_2d_calculate_penetration(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CollisionSolver2DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
#endif // COLLISION_SOLVER_2D_SAT_H
diff --git a/servers/physics_2d/collision_solver_2d_sw.h b/servers/physics_2d/collision_solver_2d_sw.h
index e73ee8fd7e..f39cfee0a9 100644
--- a/servers/physics_2d/collision_solver_2d_sw.h
+++ b/servers/physics_2d/collision_solver_2d_sw.h
@@ -40,11 +40,11 @@ public:
private:
static bool solve_static_line(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result);
static void concave_callback(void *p_userdata, Shape2DSW *p_convex);
- static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static bool solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = NULL);
+ static bool solve_concave(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve_raycast(const Shape2DSW *p_shape_A, const Vector2 &p_motion_A, const Transform2D &p_transform_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, Vector2 *sep_axis = nullptr);
public:
- static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve(const Shape2DSW *p_shape_A, const Transform2D &p_transform_A, const Vector2 &p_motion_A, const Shape2DSW *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, Vector2 *sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
};
#endif // COLLISION_SOLVER_2D_SW_H
diff --git a/servers/physics_2d/constraint_2d_sw.h b/servers/physics_2d/constraint_2d_sw.h
index b5c994cbdd..f8eb16214f 100644
--- a/servers/physics_2d/constraint_2d_sw.h
+++ b/servers/physics_2d/constraint_2d_sw.h
@@ -45,7 +45,7 @@ class Constraint2DSW {
RID self;
protected:
- Constraint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0) {
+ Constraint2DSW(Body2DSW **p_body_ptr = nullptr, int p_body_count = 0) {
_body_ptr = p_body_ptr;
_body_count = p_body_count;
island_step = 0;
diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h
index f4aeb6e3c8..a0d25dc70d 100644
--- a/servers/physics_2d/joints_2d_sw.h
+++ b/servers/physics_2d/joints_2d_sw.h
@@ -51,7 +51,7 @@ public:
_FORCE_INLINE_ real_t get_max_bias() const { return max_bias; }
virtual PhysicsServer2D::JointType get_type() const = 0;
- Joint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0) :
+ Joint2DSW(Body2DSW **p_body_ptr = nullptr, int p_body_count = 0) :
Constraint2DSW(p_body_ptr, p_body_count) {
bias = 0;
max_force = max_bias = 3.40282e+38;
@@ -86,7 +86,7 @@ public:
void set_param(PhysicsServer2D::PinJointParam p_param, real_t p_value);
real_t get_param(PhysicsServer2D::PinJointParam p_param) const;
- PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = NULL);
+ PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = nullptr);
~PinJoint2DSW();
};
diff --git a/servers/physics_2d/physics_server_2d_sw.cpp b/servers/physics_2d/physics_server_2d_sw.cpp
index e2a482e960..871e2aba1d 100644
--- a/servers/physics_2d/physics_server_2d_sw.cpp
+++ b/servers/physics_2d/physics_server_2d_sw.cpp
@@ -42,7 +42,7 @@
RID PhysicsServer2DSW::_shape_create(ShapeType p_shape) {
- Shape2DSW *shape = NULL;
+ Shape2DSW *shape = nullptr;
switch (p_shape) {
case SHAPE_LINE: {
@@ -227,7 +227,7 @@ bool PhysicsServer2DSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_
if (p_result_max == 0) {
- return CollisionSolver2DSW::solve(shape_A, p_xform_A, p_motion_A, shape_B, p_xform_B, p_motion_B, NULL, NULL);
+ return CollisionSolver2DSW::solve(shape_A, p_xform_A, p_motion_A, shape_B, p_xform_B, p_motion_B, nullptr, nullptr);
}
CollCbkData cbk;
@@ -313,8 +313,8 @@ int PhysicsServer2DSW::space_get_contact_count(RID p_space) const {
PhysicsDirectSpaceState2D *PhysicsServer2DSW::space_get_direct_state(RID p_space) {
Space2DSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, NULL);
- ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!space, nullptr);
+ ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), nullptr, "Space state is inaccessible right now, wait for iteration or physics process notification.");
return space->get_direct_state();
}
@@ -332,7 +332,7 @@ void PhysicsServer2DSW::area_set_space(RID p_area, RID p_space) {
Area2DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
- Space2DSW *space = NULL;
+ Space2DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -596,7 +596,7 @@ void PhysicsServer2DSW::body_set_space(RID p_body, RID p_space) {
Body2DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
- Space2DSW *space = NULL;
+ Space2DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -1069,15 +1069,15 @@ int PhysicsServer2DSW::body_test_ray_separation(RID p_body, const Transform2D &p
PhysicsDirectBodyState2D *PhysicsServer2DSW::body_get_direct_state(RID p_body) {
- ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
if (!body_owner.owns(p_body))
- return NULL;
+ return nullptr;
Body2DSW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, NULL);
- ERR_FAIL_COND_V(!body->get_space(), NULL);
- ERR_FAIL_COND_V_MSG(body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!body, nullptr);
+ ERR_FAIL_COND_V(!body->get_space(), nullptr);
+ ERR_FAIL_COND_V_MSG(body->get_space()->is_locked(), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
direct_state->body = body;
return direct_state;
@@ -1142,7 +1142,7 @@ RID PhysicsServer2DSW::pin_joint_create(const Vector2 &p_pos, RID p_body_a, RID
Body2DSW *A = body_owner.getornull(p_body_a);
ERR_FAIL_COND_V(!A, RID());
- Body2DSW *B = NULL;
+ Body2DSW *B = nullptr;
if (body_owner.owns(p_body_b)) {
B = body_owner.getornull(p_body_b);
ERR_FAIL_COND_V(!B, RID());
@@ -1276,7 +1276,7 @@ void PhysicsServer2DSW::free(RID p_rid) {
_clear_query(area->get_monitor_query());
*/
- area->set_space(NULL);
+ area->set_space(nullptr);
while (area->get_shape_count()) {
@@ -1291,7 +1291,7 @@ void PhysicsServer2DSW::free(RID p_rid) {
while (space->get_objects().size()) {
CollisionObject2DSW *co = (CollisionObject2DSW *)space->get_objects().front()->get();
- co->set_space(NULL);
+ co->set_space(nullptr);
}
active_spaces.erase(space);
@@ -1444,7 +1444,7 @@ int PhysicsServer2DSW::get_process_info(ProcessInfo p_info) {
return 0;
}
-PhysicsServer2DSW *PhysicsServer2DSW::singletonsw = NULL;
+PhysicsServer2DSW *PhysicsServer2DSW::singletonsw = nullptr;
PhysicsServer2DSW::PhysicsServer2DSW() {
diff --git a/servers/physics_2d/physics_server_2d_sw.h b/servers/physics_2d/physics_server_2d_sw.h
index 9dfa8bf474..918958ffe2 100644
--- a/servers/physics_2d/physics_server_2d_sw.h
+++ b/servers/physics_2d/physics_server_2d_sw.h
@@ -249,7 +249,7 @@ public:
virtual void body_set_pickable(RID p_body, bool p_pickable);
- virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
+ virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true);
virtual int body_test_ray_separation(RID p_body, const Transform2D &p_transform, bool p_infinite_inertia, Vector2 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
// this function only works on physics process, errors and returns null otherwise
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.cpp b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
index 5f65e296fd..0a89a76615 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.cpp
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.cpp
@@ -126,7 +126,7 @@ void PhysicsServer2DWrapMT::finish() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
} else {
physics_2d_server->finish();
}
@@ -150,7 +150,7 @@ PhysicsServer2DWrapMT::PhysicsServer2DWrapMT(PhysicsServer2D *p_contained, bool
physics_2d_server = p_contained;
create_thread = p_create_thread;
- thread = NULL;
+ thread = nullptr;
step_pending = 0;
step_thread_up = false;
diff --git a/servers/physics_2d/physics_server_2d_wrap_mt.h b/servers/physics_2d/physics_server_2d_wrap_mt.h
index ffd46feebd..7e61927378 100644
--- a/servers/physics_2d/physics_server_2d_wrap_mt.h
+++ b/servers/physics_2d/physics_server_2d_wrap_mt.h
@@ -112,7 +112,7 @@ public:
// this function only works on physics process, errors and returns null otherwise
PhysicsDirectSpaceState2D *space_get_direct_state(RID p_space) {
- ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
+ ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), nullptr);
return physics_2d_server->space_get_direct_state(p_space);
}
@@ -255,7 +255,7 @@ public:
FUNC2(body_set_pickable, RID, bool);
- bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) {
+ bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) {
ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), false);
return physics_2d_server->body_test_motion(p_body, p_from, p_motion, p_infinite_inertia, p_margin, r_result, p_exclude_raycast_shapes);
@@ -270,7 +270,7 @@ public:
// this function only works on physics process, errors and returns null otherwise
PhysicsDirectBodyState2D *body_get_direct_state(RID p_body) {
- ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), NULL);
+ ERR_FAIL_COND_V(main_thread != Thread::get_caller_id(), nullptr);
return physics_2d_server->body_get_direct_state(p_body);
}
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index 5fefb9595f..06096d674a 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -643,7 +643,7 @@ void ConvexPolygonShape2DSW::set_data(const Variant &p_data) {
if (points)
memdelete_arr(points);
- points = NULL;
+ points = nullptr;
point_count = 0;
if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) {
@@ -706,7 +706,7 @@ Variant ConvexPolygonShape2DSW::get_data() const {
ConvexPolygonShape2DSW::ConvexPolygonShape2DSW() {
- points = NULL;
+ points = nullptr;
point_count = 0;
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index cba190995f..7ae2e9769f 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -222,7 +222,7 @@ int PhysicsDirectSpaceState2DSW::intersect_shape(const RID &p_shape, const Trans
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), NULL, NULL, NULL, p_margin))
+ if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), nullptr, nullptr, nullptr, p_margin))
continue;
r_results[cc].collider_id = col_obj->get_instance_id();
@@ -265,12 +265,12 @@ bool PhysicsDirectSpaceState2DSW::cast_motion(const RID &p_shape, const Transfor
Transform2D col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
- if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
+ if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, nullptr, p_margin)) {
continue;
}
//test initial overlap
- if (CollisionSolver2DSW::solve(shape, p_xform, Vector2(), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(shape, p_xform, Vector2(), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, nullptr, p_margin)) {
return false;
}
@@ -285,7 +285,7 @@ bool PhysicsDirectSpaceState2DSW::cast_motion(const RID &p_shape, const Transfor
real_t ofs = (low + hi) * 0.5;
Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(shape, p_xform, p_motion * ofs, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, &sep, p_margin);
+ bool collided = CollisionSolver2DSW::solve(shape, p_xform, p_motion * ofs, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), nullptr, nullptr, &sep, p_margin);
if (collided) {
@@ -348,7 +348,7 @@ bool PhysicsDirectSpaceState2DSW::collide_shape(RID p_shape, const Transform2D &
cbk.valid_dir = Vector2();
cbk.valid_depth = 0;
- if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, nullptr, p_margin)) {
collided = cbk.amount > 0;
}
}
@@ -415,7 +415,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
_RestCallbackData2D rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = space->test_motion_min_contact_depth;
@@ -435,7 +435,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
rcd.object = col_obj;
rcd.shape = shape_idx;
rcd.local_shape = 0;
- bool sc = CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -464,7 +464,7 @@ bool PhysicsDirectSpaceState2DSW::rest_info(RID p_shape, const Transform2D &p_sh
PhysicsDirectSpaceState2DSW::PhysicsDirectSpaceState2DSW() {
- space = NULL;
+ space = nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -613,7 +613,7 @@ int Space2DSW::test_body_ray_separation(Body2DSW *p_body, const Transform2D &p_t
*/
Shape2DSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, nullptr, p_margin)) {
if (cbk.amount > 0) {
collided = true;
}
@@ -818,7 +818,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
bool did_collide = false;
Shape2DSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, NULL, separation_margin)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), cbkres, cbkptr, nullptr, separation_margin)) {
did_collide = cbk.passed > current_passed; //more passed, so collision actually existed
}
@@ -925,12 +925,12 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
Transform2D col_obj_shape_xform = col_obj->get_transform() * col_obj->get_shape_transform(col_shape_idx);
//test initial overlap, does it collide if going all the way?
- if (!CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion, against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, NULL, 0)) {
+ if (!CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion, against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, nullptr, 0)) {
continue;
}
//test initial overlap
- if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, NULL, 0)) {
+ if (CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, nullptr, 0)) {
if (col_obj->is_shape_set_as_one_way_collision(col_shape_idx)) {
continue;
@@ -950,7 +950,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
real_t ofs = (low + hi) * 0.5;
Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * ofs, against_shape, col_obj_shape_xform, Vector2(), NULL, NULL, &sep, 0);
+ bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * ofs, against_shape, col_obj_shape_xform, Vector2(), nullptr, nullptr, &sep, 0);
if (collided) {
@@ -1018,7 +1018,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
_RestCallbackData2D rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = test_motion_min_contact_depth;
@@ -1081,7 +1081,7 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
rcd.object = col_obj;
rcd.shape = shape_idx;
rcd.local_shape = j;
- bool sc = CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver2DSW::solve(body_shape, body_shape_xform, Vector2(), against_shape, col_obj_shape_xform, Vector2(), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -1156,7 +1156,7 @@ void *Space2DSW::_broadphase_pair(CollisionObject2DSW *A, int p_subindex_A, Coll
return b;
}
- return NULL;
+ return nullptr;
}
void Space2DSW::_broadphase_unpair(CollisionObject2DSW *A, int p_subindex_A, CollisionObject2DSW *B, int p_subindex_B, void *p_data, void *p_self) {
@@ -1351,7 +1351,7 @@ Space2DSW::Space2DSW() {
broadphase = BroadPhase2DSW::create_func();
broadphase->set_pair_callback(_broadphase_pair, this);
broadphase->set_unpair_callback(_broadphase_unpair, this);
- area = NULL;
+ area = nullptr;
direct_access = memnew(PhysicsDirectSpaceState2DSW);
direct_access->space = this;
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index 198fccdb80..6f3bcfec13 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -60,7 +60,7 @@ void Step2DSW::_populate_island(Body2DSW *p_body, Body2DSW **p_island, Constrain
bool Step2DSW::_setup_island(Constraint2DSW *p_island, real_t p_delta) {
Constraint2DSW *ci = p_island;
- Constraint2DSW *prev_ci = NULL;
+ Constraint2DSW *prev_ci = nullptr;
bool removed_root = false;
while (ci) {
bool process = ci->setup(p_delta);
@@ -164,8 +164,8 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
/* GENERATE CONSTRAINT ISLANDS */
- Body2DSW *island_list = NULL;
- Constraint2DSW *constraint_island_list = NULL;
+ Body2DSW *island_list = nullptr;
+ Constraint2DSW *constraint_island_list = nullptr;
b = body_list->first();
int island_count = 0;
@@ -175,8 +175,8 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
if (body->get_island_step() != _step) {
- Body2DSW *island = NULL;
- Constraint2DSW *constraint_island = NULL;
+ Body2DSW *island = nullptr;
+ Constraint2DSW *constraint_island = nullptr;
_populate_island(body, &island, &constraint_island);
island->set_island_list_next(island_list);
@@ -202,7 +202,7 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
if (c->get_island_step() == _step)
continue;
c->set_island_step(_step);
- c->set_island_next(NULL);
+ c->set_island_next(nullptr);
c->set_island_list_next(constraint_island_list);
constraint_island_list = c;
}
@@ -219,7 +219,7 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
{
Constraint2DSW *ci = constraint_island_list;
- Constraint2DSW *prev_ci = NULL;
+ Constraint2DSW *prev_ci = nullptr;
while (ci) {
if (_setup_island(ci, p_delta)) {
diff --git a/servers/physics_3d/SCsub b/servers/physics_3d/SCsub
index c5cc889112..df7b521693 100644
--- a/servers/physics_3d/SCsub
+++ b/servers/physics_3d/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/physics_3d/area_pair_3d_sw.cpp b/servers/physics_3d/area_pair_3d_sw.cpp
index e92a3a0dd1..fa2fb2dabb 100644
--- a/servers/physics_3d/area_pair_3d_sw.cpp
+++ b/servers/physics_3d/area_pair_3d_sw.cpp
@@ -37,7 +37,7 @@ bool AreaPair3DSW::setup(real_t p_step) {
if (area->is_shape_set_as_disabled(area_shape) || body->is_shape_set_as_disabled(body_shape)) {
result = false;
- } else if (area->test_collision_mask(body) && CollisionSolver3DSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), NULL, this)) {
+ } else if (area->test_collision_mask(body) && CollisionSolver3DSW::solve_static(body->get_shape(body_shape), body->get_transform() * body->get_shape_transform(body_shape), area->get_shape(area_shape), area->get_transform() * area->get_shape_transform(area_shape), nullptr, this)) {
result = true;
}
@@ -100,7 +100,7 @@ bool Area2Pair3DSW::setup(real_t p_step) {
bool result = false;
if (area_a->is_shape_set_as_disabled(shape_a) || area_b->is_shape_set_as_disabled(shape_b)) {
result = false;
- } else if (area_a->test_collision_mask(area_b) && CollisionSolver3DSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), NULL, this)) {
+ } else if (area_a->test_collision_mask(area_b) && CollisionSolver3DSW::solve_static(area_a->get_shape(shape_a), area_a->get_transform() * area_a->get_shape_transform(shape_a), area_b->get_shape(shape_b), area_b->get_transform() * area_b->get_shape_transform(shape_b), nullptr, this)) {
result = true;
}
diff --git a/servers/physics_3d/body_3d_sw.cpp b/servers/physics_3d/body_3d_sw.cpp
index 6a00e4f471..fea5aed6ad 100644
--- a/servers/physics_3d/body_3d_sw.cpp
+++ b/servers/physics_3d/body_3d_sw.cpp
@@ -569,7 +569,7 @@ void Body3DSW::integrate_forces(real_t p_step) {
_update_shapes_with_motion(motion);
}
- def_area = NULL; // clear the area, so it is set in the next frame
+ def_area = nullptr; // clear the area, so it is set in the next frame
contact_count = 0;
}
@@ -746,7 +746,7 @@ void Body3DSW::set_force_integration_callback(ObjectID p_id, const StringName &p
if (fi_callback) {
memdelete(fi_callback);
- fi_callback = NULL;
+ fi_callback = nullptr;
}
if (p_id.is_valid()) {
@@ -781,8 +781,8 @@ Body3DSW::Body3DSW() :
omit_force_integration = false;
//applied_torque=0;
island_step = 0;
- island_next = NULL;
- island_list_next = NULL;
+ island_next = nullptr;
+ island_list_next = nullptr;
first_time_kinematic = false;
first_integration = false;
_set_static(false);
@@ -797,7 +797,7 @@ Body3DSW::Body3DSW() :
still_time = 0;
continuous_cd = false;
can_sleep = true;
- fi_callback = NULL;
+ fi_callback = nullptr;
}
Body3DSW::~Body3DSW() {
@@ -806,7 +806,7 @@ Body3DSW::~Body3DSW() {
memdelete(fi_callback);
}
-PhysicsDirectBodyState3DSW *PhysicsDirectBodyState3DSW::singleton = NULL;
+PhysicsDirectBodyState3DSW *PhysicsDirectBodyState3DSW::singleton = nullptr;
PhysicsDirectSpaceState3D *PhysicsDirectBodyState3DSW::get_space_state() {
diff --git a/servers/physics_3d/body_3d_sw.h b/servers/physics_3d/body_3d_sw.h
index 368dd59b06..b553cf0670 100644
--- a/servers/physics_3d/body_3d_sw.h
+++ b/servers/physics_3d/body_3d_sw.h
@@ -468,7 +468,7 @@ public:
virtual real_t get_step() const { return step; }
PhysicsDirectBodyState3DSW() {
singleton = this;
- body = NULL;
+ body = nullptr;
}
};
diff --git a/servers/physics_3d/broad_phase_3d_basic.cpp b/servers/physics_3d/broad_phase_3d_basic.cpp
index bea87a45ca..08ea219869 100644
--- a/servers/physics_3d/broad_phase_3d_basic.cpp
+++ b/servers/physics_3d/broad_phase_3d_basic.cpp
@@ -34,7 +34,7 @@
BroadPhase3DSW::ID BroadPhase3DBasic::create(CollisionObject3DSW *p_object, int p_subindex) {
- ERR_FAIL_COND_V(p_object == NULL, 0);
+ ERR_FAIL_COND_V(p_object == nullptr, 0);
current++;
@@ -88,7 +88,7 @@ void BroadPhase3DBasic::remove(ID p_id) {
CollisionObject3DSW *BroadPhase3DBasic::get_object(ID p_id) const {
const Map<ID, Element>::Element *E = element_map.find(p_id);
- ERR_FAIL_COND_V(!E, NULL);
+ ERR_FAIL_COND_V(!E, nullptr);
return E->get().owner;
}
bool BroadPhase3DBasic::is_static(ID p_id) const {
@@ -201,7 +201,7 @@ void BroadPhase3DBasic::update() {
if (pair_ok && !E) {
- void *data = NULL;
+ void *data = nullptr;
if (pair_callback)
data = pair_callback(elem_A->owner, elem_A->subindex, elem_B->owner, elem_B->subindex, unpair_userdata);
pair_map.insert(key, data);
@@ -218,8 +218,8 @@ BroadPhase3DSW *BroadPhase3DBasic::_create() {
BroadPhase3DBasic::BroadPhase3DBasic() {
current = 1;
- unpair_callback = NULL;
- unpair_userdata = NULL;
- pair_callback = NULL;
- pair_userdata = NULL;
+ unpair_callback = nullptr;
+ unpair_userdata = nullptr;
+ pair_callback = nullptr;
+ pair_userdata = nullptr;
}
diff --git a/servers/physics_3d/broad_phase_3d_basic.h b/servers/physics_3d/broad_phase_3d_basic.h
index 9b20b7619a..563dda6931 100644
--- a/servers/physics_3d/broad_phase_3d_basic.h
+++ b/servers/physics_3d/broad_phase_3d_basic.h
@@ -92,9 +92,9 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_3d/broad_phase_3d_sw.cpp b/servers/physics_3d/broad_phase_3d_sw.cpp
index 5e367a7736..1a20fdd0cb 100644
--- a/servers/physics_3d/broad_phase_3d_sw.cpp
+++ b/servers/physics_3d/broad_phase_3d_sw.cpp
@@ -30,7 +30,7 @@
#include "broad_phase_3d_sw.h"
-BroadPhase3DSW::CreateFunction BroadPhase3DSW::create_func = NULL;
+BroadPhase3DSW::CreateFunction BroadPhase3DSW::create_func = nullptr;
BroadPhase3DSW::~BroadPhase3DSW() {
}
diff --git a/servers/physics_3d/broad_phase_3d_sw.h b/servers/physics_3d/broad_phase_3d_sw.h
index 47d09a8b1d..5950489619 100644
--- a/servers/physics_3d/broad_phase_3d_sw.h
+++ b/servers/physics_3d/broad_phase_3d_sw.h
@@ -58,9 +58,9 @@ public:
virtual bool is_static(ID p_id) const = 0;
virtual int get_subindex(ID p_id) const = 0;
- virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
- virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL) = 0;
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr) = 0;
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata) = 0;
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata) = 0;
diff --git a/servers/physics_3d/broad_phase_octree.cpp b/servers/physics_3d/broad_phase_octree.cpp
index 50ac17e027..264ab21e1e 100644
--- a/servers/physics_3d/broad_phase_octree.cpp
+++ b/servers/physics_3d/broad_phase_octree.cpp
@@ -55,7 +55,7 @@ void BroadPhaseOctree::remove(ID p_id) {
CollisionObject3DSW *BroadPhaseOctree::get_object(ID p_id) const {
CollisionObject3DSW *it = octree.get(p_id);
- ERR_FAIL_COND_V(!it, NULL);
+ ERR_FAIL_COND_V(!it, nullptr);
return it;
}
bool BroadPhaseOctree::is_static(ID p_id) const {
@@ -86,7 +86,7 @@ void *BroadPhaseOctree::_pair_callback(void *self, OctreeElementID p_A, Collisio
BroadPhaseOctree *bpo = (BroadPhaseOctree *)(self);
if (!bpo->pair_callback)
- return NULL;
+ return nullptr;
return bpo->pair_callback(p_object_A, subindex_A, p_object_B, subindex_B, bpo->pair_userdata);
}
@@ -123,7 +123,7 @@ BroadPhase3DSW *BroadPhaseOctree::_create() {
BroadPhaseOctree::BroadPhaseOctree() {
octree.set_pair_callback(_pair_callback, this);
octree.set_unpair_callback(_unpair_callback, this);
- pair_callback = NULL;
- pair_userdata = NULL;
- unpair_userdata = NULL;
+ pair_callback = nullptr;
+ pair_userdata = nullptr;
+ unpair_userdata = nullptr;
}
diff --git a/servers/physics_3d/broad_phase_octree.h b/servers/physics_3d/broad_phase_octree.h
index 25cf5b32da..0ad59d8b0c 100644
--- a/servers/physics_3d/broad_phase_octree.h
+++ b/servers/physics_3d/broad_phase_octree.h
@@ -57,9 +57,9 @@ public:
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
- virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
- virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = NULL);
+ virtual int cull_point(const Vector3 &p_point, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_segment(const Vector3 &p_from, const Vector3 &p_to, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
+ virtual int cull_aabb(const AABB &p_aabb, CollisionObject3DSW **p_results, int p_max_results, int *p_result_indices = nullptr);
virtual void set_pair_callback(PairCallback p_pair_callback, void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback, void *p_userdata);
diff --git a/servers/physics_3d/collision_object_3d_sw.cpp b/servers/physics_3d/collision_object_3d_sw.cpp
index ba13d70e4f..24715d211d 100644
--- a/servers/physics_3d/collision_object_3d_sw.cpp
+++ b/servers/physics_3d/collision_object_3d_sw.cpp
@@ -231,7 +231,7 @@ CollisionObject3DSW::CollisionObject3DSW(Type p_type) :
_static = true;
type = p_type;
- space = NULL;
+ space = nullptr;
collision_layer = 1;
collision_mask = 1;
diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp
index 0a7a9caf91..5096b080ab 100644
--- a/servers/physics_3d/collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/collision_solver_3d_sat.cpp
@@ -241,13 +241,13 @@ static void _generate_contacts_from_supports(const Vector3 *p_points_A, int p_po
_generate_contacts_point_face,
},
{
- 0,
+ nullptr,
_generate_contacts_edge_edge,
_generate_contacts_face_face,
},
{
- 0,
- 0,
+ nullptr,
+ nullptr,
_generate_contacts_face_face,
}
};
@@ -1483,36 +1483,36 @@ bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_tr
_collision_sphere_cylinder<false>,
_collision_sphere_convex_polygon<false>,
_collision_sphere_face<false> },
- { 0,
+ { nullptr,
_collision_box_box<false>,
_collision_box_capsule<false>,
_collision_box_cylinder<false>,
_collision_box_convex_polygon<false>,
_collision_box_face<false> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_capsule_capsule<false>,
_collision_capsule_cylinder<false>,
_collision_capsule_convex_polygon<false>,
_collision_capsule_face<false> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_cylinder_cylinder<false>,
_collision_cylinder_convex_polygon<false>,
_collision_cylinder_face<false> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<false>,
_collision_convex_polygon_face<false> },
- { 0,
- 0,
- 0,
- 0,
- 0,
- 0 },
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr },
};
static const CollisionFunc collision_table_margin[6][6] = {
@@ -1522,36 +1522,36 @@ bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_tr
_collision_sphere_cylinder<true>,
_collision_sphere_convex_polygon<true>,
_collision_sphere_face<true> },
- { 0,
+ { nullptr,
_collision_box_box<true>,
_collision_box_capsule<true>,
_collision_box_cylinder<true>,
_collision_box_convex_polygon<true>,
_collision_box_face<true> },
- { 0,
- 0,
+ { nullptr,
+ nullptr,
_collision_capsule_capsule<true>,
_collision_capsule_cylinder<true>,
_collision_capsule_convex_polygon<true>,
_collision_capsule_face<true> },
- { 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
_collision_cylinder_cylinder<true>,
_collision_cylinder_convex_polygon<true>,
_collision_cylinder_face<true> },
- { 0,
- 0,
- 0,
- 0,
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_collision_convex_polygon_convex_polygon<true>,
_collision_convex_polygon_face<true> },
- { 0,
- 0,
- 0,
- 0,
- 0,
- 0 },
+ { nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr },
};
_CollectorCallback callback;
diff --git a/servers/physics_3d/collision_solver_3d_sat.h b/servers/physics_3d/collision_solver_3d_sat.h
index c8ffd8e660..5eccfda9ac 100644
--- a/servers/physics_3d/collision_solver_3d_sat.h
+++ b/servers/physics_3d/collision_solver_3d_sat.h
@@ -33,6 +33,6 @@
#include "collision_solver_3d_sw.h"
-bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector3 *r_prev_axis = NULL, real_t p_margin_a = 0, real_t p_margin_b = 0);
+bool sat_calculate_penetration(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CollisionSolver3DSW::CallbackResult p_result_callback, void *p_userdata, bool p_swap = false, Vector3 *r_prev_axis = nullptr, real_t p_margin_a = 0, real_t p_margin_b = 0);
#endif // COLLISION_SOLVER_SAT_H
diff --git a/servers/physics_3d/collision_solver_3d_sw.cpp b/servers/physics_3d/collision_solver_3d_sw.cpp
index 26de49c96f..5d31e1f546 100644
--- a/servers/physics_3d/collision_solver_3d_sw.cpp
+++ b/servers/physics_3d/collision_solver_3d_sw.cpp
@@ -125,7 +125,7 @@ void CollisionSolver3DSW::concave_callback(void *p_userdata, Shape3DSW *p_convex
_ConcaveCollisionInfo &cinfo = *(_ConcaveCollisionInfo *)(p_userdata);
cinfo.aabb_tests++;
- bool collided = collision_solver(cinfo.shape_A, *cinfo.transform_A, p_convex, *cinfo.transform_B, cinfo.result_callback, cinfo.userdata, cinfo.swap_result, NULL, cinfo.margin_A, cinfo.margin_B);
+ bool collided = collision_solver(cinfo.shape_A, *cinfo.transform_A, p_convex, *cinfo.transform_B, cinfo.result_callback, cinfo.userdata, cinfo.swap_result, nullptr, cinfo.margin_A, cinfo.margin_B);
if (!collided)
return;
@@ -316,8 +316,8 @@ bool CollisionSolver3DSW::solve_distance(const Shape3DSW *p_shape_A, const Trans
cinfo.transform_A = &p_transform_A;
cinfo.shape_A = p_shape_A;
cinfo.transform_B = &p_transform_B;
- cinfo.result_callback = NULL;
- cinfo.userdata = NULL;
+ cinfo.result_callback = nullptr;
+ cinfo.userdata = nullptr;
cinfo.swap_result = false;
cinfo.collided = false;
cinfo.collisions = 0;
diff --git a/servers/physics_3d/collision_solver_3d_sw.h b/servers/physics_3d/collision_solver_3d_sw.h
index ec76a4217e..13f54ca8fb 100644
--- a/servers/physics_3d/collision_solver_3d_sw.h
+++ b/servers/physics_3d/collision_solver_3d_sw.h
@@ -46,8 +46,8 @@ private:
static bool solve_distance_plane(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B);
public:
- static bool solve_static(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = NULL, real_t p_margin_A = 0, real_t p_margin_B = 0);
- static bool solve_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = NULL);
+ static bool solve_static(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, CallbackResult p_result_callback, void *p_userdata, Vector3 *r_sep_axis = nullptr, real_t p_margin_A = 0, real_t p_margin_B = 0);
+ static bool solve_distance(const Shape3DSW *p_shape_A, const Transform &p_transform_A, const Shape3DSW *p_shape_B, const Transform &p_transform_B, Vector3 &r_point_A, Vector3 &r_point_B, const AABB &p_concave_hint, Vector3 *r_sep_axis = nullptr);
};
#endif // COLLISION_SOLVER__SW_H
diff --git a/servers/physics_3d/constraint_3d_sw.h b/servers/physics_3d/constraint_3d_sw.h
index b9d3ac4f12..5e2b00404b 100644
--- a/servers/physics_3d/constraint_3d_sw.h
+++ b/servers/physics_3d/constraint_3d_sw.h
@@ -46,7 +46,7 @@ class Constraint3DSW {
RID self;
protected:
- Constraint3DSW(Body3DSW **p_body_ptr = NULL, int p_body_count = 0) {
+ Constraint3DSW(Body3DSW **p_body_ptr = nullptr, int p_body_count = 0) {
_body_ptr = p_body_ptr;
_body_count = p_body_count;
island_step = 0;
diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp
index bd0d429e7b..db37f261ce 100644
--- a/servers/physics_3d/gjk_epa.cpp
+++ b/servers/physics_3d/gjk_epa.cpp
@@ -515,14 +515,14 @@ struct GJK
{
sFace* root;
U count;
- sList() : root(0),count(0) {}
+ sList() : root(nullptr),count(0) {}
};
struct sHorizon
{
sFace* cf;
sFace* ff;
U nf;
- sHorizon() : cf(0),ff(0),nf(0) {}
+ sHorizon() : cf(nullptr),ff(nullptr),nf(0) {}
};
struct eStatus { enum _ {
Valid,
@@ -559,7 +559,7 @@ struct GJK
}
static inline void append(sList& list,sFace* face)
{
- face->l[0] = 0;
+ face->l[0] = nullptr;
face->l[1] = list.root;
if(list.root) list.root->l[0]=face;
list.root = face;
@@ -720,13 +720,13 @@ struct GJK
} else m_status=eStatus::Degenerated;
remove(m_hull,face);
append(m_stock,face);
- return(0);
+ return(nullptr);
}
// -- GODOT start --
//m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces;
m_status=eStatus::OutOfFaces;
// -- GODOT end --
- return(0);
+ return(nullptr);
}
sFace* findbest()
{
diff --git a/servers/physics_3d/joints/SCsub b/servers/physics_3d/joints/SCsub
index d730144861..86681f9c74 100644
--- a/servers/physics_3d/joints/SCsub
+++ b/servers/physics_3d/joints/SCsub
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/physics_3d/joints_3d_sw.h b/servers/physics_3d/joints_3d_sw.h
index 435ee2301d..0f2d4892a8 100644
--- a/servers/physics_3d/joints_3d_sw.h
+++ b/servers/physics_3d/joints_3d_sw.h
@@ -38,7 +38,7 @@ class Joint3DSW : public Constraint3DSW {
public:
virtual PhysicsServer3D::JointType get_type() const = 0;
- _FORCE_INLINE_ Joint3DSW(Body3DSW **p_body_ptr = NULL, int p_body_count = 0) :
+ _FORCE_INLINE_ Joint3DSW(Body3DSW **p_body_ptr = nullptr, int p_body_count = 0) :
Constraint3DSW(p_body_ptr, p_body_count) {
}
};
diff --git a/servers/physics_3d/physics_server_3d_sw.cpp b/servers/physics_3d/physics_server_3d_sw.cpp
index da84630088..bc42c2fd9e 100644
--- a/servers/physics_3d/physics_server_3d_sw.cpp
+++ b/servers/physics_3d/physics_server_3d_sw.cpp
@@ -45,7 +45,7 @@
RID PhysicsServer3DSW::shape_create(ShapeType p_shape) {
- Shape3DSW *shape = NULL;
+ Shape3DSW *shape = nullptr;
switch (p_shape) {
case SHAPE_PLANE: {
@@ -70,7 +70,7 @@ RID PhysicsServer3DSW::shape_create(ShapeType p_shape) {
} break;
case SHAPE_CYLINDER: {
- ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
+ ERR_FAIL_V_MSG(RID(), "CylinderShape3D is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
} break;
case SHAPE_CONVEX_POLYGON: {
@@ -195,8 +195,8 @@ real_t PhysicsServer3DSW::space_get_param(RID p_space, SpaceParameter p_param) c
PhysicsDirectSpaceState3D *PhysicsServer3DSW::space_get_direct_state(RID p_space) {
Space3DSW *space = space_owner.getornull(p_space);
- ERR_FAIL_COND_V(!space, NULL);
- ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!space, nullptr);
+ ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), nullptr, "Space state is inaccessible right now, wait for iteration or physics process notification.");
return space->get_direct_state();
}
@@ -235,7 +235,7 @@ void PhysicsServer3DSW::area_set_space(RID p_area, RID p_space) {
Area3DSW *area = area_owner.getornull(p_area);
ERR_FAIL_COND(!area);
- Space3DSW *space = NULL;
+ Space3DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -492,7 +492,7 @@ void PhysicsServer3DSW::body_set_space(RID p_body, RID p_space) {
Body3DSW *body = body_owner.getornull(p_body);
ERR_FAIL_COND(!body);
- Space3DSW *space = NULL;
+ Space3DSW *space = nullptr;
if (p_space.is_valid()) {
space = space_owner.getornull(p_space);
ERR_FAIL_COND(!space);
@@ -978,8 +978,8 @@ int PhysicsServer3DSW::body_test_ray_separation(RID p_body, const Transform &p_t
PhysicsDirectBodyState3D *PhysicsServer3DSW::body_get_direct_state(RID p_body) {
Body3DSW *body = body_owner.getornull(p_body);
- ERR_FAIL_COND_V(!body, NULL);
- ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
+ ERR_FAIL_COND_V(!body, nullptr);
+ ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), nullptr, "Body state is inaccessible right now, wait for iteration or physics process notification.");
direct_state->body = body;
return direct_state;
@@ -1341,7 +1341,7 @@ void PhysicsServer3DSW::free(RID p_rid) {
_clear_query(body->get_direct_state_query());
*/
- body->set_space(NULL);
+ body->set_space(nullptr);
while (body->get_shape_count()) {
@@ -1360,7 +1360,7 @@ void PhysicsServer3DSW::free(RID p_rid) {
_clear_query(area->get_monitor_query());
*/
- area->set_space(NULL);
+ area->set_space(nullptr);
while (area->get_shape_count()) {
@@ -1375,7 +1375,7 @@ void PhysicsServer3DSW::free(RID p_rid) {
while (space->get_objects().size()) {
CollisionObject3DSW *co = (CollisionObject3DSW *)space->get_objects().front()->get();
- co->set_space(NULL);
+ co->set_space(nullptr);
}
active_spaces.erase(space);
@@ -1572,7 +1572,7 @@ void PhysicsServer3DSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &
}
}
-PhysicsServer3DSW *PhysicsServer3DSW::singleton = NULL;
+PhysicsServer3DSW *PhysicsServer3DSW::singleton = nullptr;
PhysicsServer3DSW::PhysicsServer3DSW() {
singleton = this;
BroadPhase3DSW::create_func = BroadPhaseOctree::_create;
diff --git a/servers/physics_3d/physics_server_3d_sw.h b/servers/physics_3d/physics_server_3d_sw.h
index 67123084c1..6e79d9eceb 100644
--- a/servers/physics_3d/physics_server_3d_sw.h
+++ b/servers/physics_3d/physics_server_3d_sw.h
@@ -237,7 +237,7 @@ public:
virtual void body_set_ray_pickable(RID p_body, bool p_enable);
virtual bool body_is_ray_pickable(RID p_body) const;
- virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true);
+ virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true);
virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, float p_margin = 0.001);
// this function only works on physics process, errors and returns null otherwise
diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp
index 52253d615a..61c32b779a 100644
--- a/servers/physics_3d/shape_3d_sw.cpp
+++ b/servers/physics_3d/shape_3d_sw.cpp
@@ -1385,8 +1385,8 @@ _VolumeSW_BVH *_volume_sw_build_bvh(_VolumeSW_BVH_Element *p_elements, int p_siz
if (p_size == 1) {
//leaf
bvh->aabb = p_elements[0].aabb;
- bvh->left = NULL;
- bvh->right = NULL;
+ bvh->left = nullptr;
+ bvh->right = nullptr;
bvh->face_index = p_elements->face_index;
count++;
return bvh;
diff --git a/servers/physics_3d/space_3d_sw.cpp b/servers/physics_3d/space_3d_sw.cpp
index 9bd507e178..bd8e89a8f5 100644
--- a/servers/physics_3d/space_3d_sw.cpp
+++ b/servers/physics_3d/space_3d_sw.cpp
@@ -83,7 +83,7 @@ int PhysicsDirectSpaceState3DSW::intersect_point(const Vector3 &p_point, ShapeRe
if (r_results[cc].collider_id.is_valid())
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
else
- r_results[cc].collider = NULL;
+ r_results[cc].collider = nullptr;
r_results[cc].rid = col_obj->get_self();
r_results[cc].shape = shape_idx;
@@ -162,7 +162,7 @@ bool PhysicsDirectSpaceState3DSW::intersect_ray(const Vector3 &p_from, const Vec
if (r_result.collider_id.is_valid())
r_result.collider = ObjectDB::get_instance(r_result.collider_id);
else
- r_result.collider = NULL;
+ r_result.collider = nullptr;
r_result.normal = res_normal;
r_result.position = res_point;
r_result.rid = res_obj->get_self();
@@ -203,7 +203,7 @@ int PhysicsDirectSpaceState3DSW::intersect_shape(const RID &p_shape, const Trans
const CollisionObject3DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- if (!CollisionSolver3DSW::solve_static(shape, p_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), NULL, NULL, NULL, p_margin, 0))
+ if (!CollisionSolver3DSW::solve_static(shape, p_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), nullptr, nullptr, nullptr, p_margin, 0))
continue;
if (r_results) {
@@ -211,7 +211,7 @@ int PhysicsDirectSpaceState3DSW::intersect_shape(const RID &p_shape, const Trans
if (r_results[cc].collider_id.is_valid())
r_results[cc].collider = ObjectDB::get_instance(r_results[cc].collider_id);
else
- r_results[cc].collider = NULL;
+ r_results[cc].collider = nullptr;
r_results[cc].rid = col_obj->get_self();
r_results[cc].shape = shape_idx;
}
@@ -364,7 +364,7 @@ bool PhysicsDirectSpaceState3DSW::collide_shape(RID p_shape, const Transform &p_
continue;
}
- if (CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, nullptr, p_margin)) {
collided = true;
}
}
@@ -415,7 +415,7 @@ bool PhysicsDirectSpaceState3DSW::rest_info(RID p_shape, const Transform &p_shap
_RestCallbackData rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = space->test_motion_min_contact_depth;
@@ -432,7 +432,7 @@ bool PhysicsDirectSpaceState3DSW::rest_info(RID p_shape, const Transform &p_shap
rcd.object = col_obj;
rcd.shape = shape_idx;
- bool sc = CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver3DSW::solve_static(shape, p_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -501,7 +501,7 @@ Vector3 PhysicsDirectSpaceState3DSW::get_closest_point_to_object_volume(RID p_ob
PhysicsDirectSpaceState3DSW::PhysicsDirectSpaceState3DSW() {
- space = NULL;
+ space = nullptr;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -621,7 +621,7 @@ int Space3DSW::test_body_ray_separation(Body3DSW *p_body, const Transform &p_tra
}
Shape3DSW *against_shape = col_obj->get_shape(shape_idx);
- if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, against_shape, col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, against_shape, col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, nullptr, p_margin)) {
if (cbk.amount > 0) {
collided = true;
}
@@ -775,7 +775,7 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform &p_from, cons
const CollisionObject3DSW *col_obj = intersection_query_results[i];
int shape_idx = intersection_query_subindex_results[i];
- if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, NULL, p_margin)) {
+ if (CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), cbkres, cbkptr, nullptr, p_margin)) {
collided = cbk.amount > 0;
}
}
@@ -935,7 +935,7 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform &p_from, cons
_RestCallbackData rcd;
rcd.best_len = 0;
- rcd.best_object = NULL;
+ rcd.best_object = nullptr;
rcd.best_shape = 0;
rcd.min_allowed_depth = test_motion_min_contact_depth;
@@ -953,7 +953,7 @@ bool Space3DSW::test_body_motion(Body3DSW *p_body, const Transform &p_from, cons
rcd.object = col_obj;
rcd.shape = shape_idx;
- bool sc = CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, NULL, p_margin);
+ bool sc = CollisionSolver3DSW::solve_static(body_shape, body_shape_xform, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), _rest_cbk_result, &rcd, nullptr, p_margin);
if (!sc)
continue;
}
@@ -1030,7 +1030,7 @@ void *Space3DSW::_broadphase_pair(CollisionObject3DSW *A, int p_subindex_A, Coll
return b;
}
- return NULL;
+ return nullptr;
}
void Space3DSW::_broadphase_unpair(CollisionObject3DSW *A, int p_subindex_A, CollisionObject3DSW *B, int p_subindex_B, void *p_data, void *p_self) {
@@ -1226,7 +1226,7 @@ Space3DSW::Space3DSW() {
broadphase = BroadPhase3DSW::create_func();
broadphase->set_pair_callback(_broadphase_pair, this);
broadphase->set_unpair_callback(_broadphase_unpair, this);
- area = NULL;
+ area = nullptr;
direct_access = memnew(PhysicsDirectSpaceState3DSW);
direct_access->space = this;
diff --git a/servers/physics_3d/space_3d_sw.h b/servers/physics_3d/space_3d_sw.h
index fb4fb6aa1f..3634834952 100644
--- a/servers/physics_3d/space_3d_sw.h
+++ b/servers/physics_3d/space_3d_sw.h
@@ -51,7 +51,7 @@ public:
virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false);
virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = NULL);
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &p_closest_safe, real_t &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr);
virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false);
virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const;
diff --git a/servers/physics_3d/step_3d_sw.cpp b/servers/physics_3d/step_3d_sw.cpp
index dda88b45c6..1a7d5f8cec 100644
--- a/servers/physics_3d/step_3d_sw.cpp
+++ b/servers/physics_3d/step_3d_sw.cpp
@@ -88,7 +88,7 @@ void Step3DSW::_solve_island(Constraint3DSW *p_island, int p_iterations, real_t
{
Constraint3DSW *ci = p_island;
- Constraint3DSW *prev = NULL;
+ Constraint3DSW *prev = nullptr;
while (ci) {
if (ci->get_priority() < at_priority) {
if (prev) {
@@ -177,8 +177,8 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
/* GENERATE CONSTRAINT ISLANDS */
- Body3DSW *island_list = NULL;
- Constraint3DSW *constraint_island_list = NULL;
+ Body3DSW *island_list = nullptr;
+ Constraint3DSW *constraint_island_list = nullptr;
b = body_list->first();
int island_count = 0;
@@ -188,8 +188,8 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
if (body->get_island_step() != _step) {
- Body3DSW *island = NULL;
- Constraint3DSW *constraint_island = NULL;
+ Body3DSW *island = nullptr;
+ Constraint3DSW *constraint_island = nullptr;
_populate_island(body, &island, &constraint_island);
island->set_island_list_next(island_list);
@@ -215,7 +215,7 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) {
if (c->get_island_step() == _step)
continue;
c->set_island_step(_step);
- c->set_island_next(NULL);
+ c->set_island_next(nullptr);
c->set_island_list_next(constraint_island_list);
constraint_island_list = c;
}
diff --git a/servers/physics_server_2d.cpp b/servers/physics_server_2d.cpp
index 11fa2acc1a..48c51b5350 100644
--- a/servers/physics_server_2d.cpp
+++ b/servers/physics_server_2d.cpp
@@ -34,7 +34,7 @@
#include "core/print_string.h"
#include "core/project_settings.h"
-PhysicsServer2D *PhysicsServer2D::singleton = NULL;
+PhysicsServer2D *PhysicsServer2D::singleton = nullptr;
void PhysicsDirectBodyState2D::integrate_forces() {
@@ -531,7 +531,7 @@ PhysicsTestMotionResult2D::PhysicsTestMotionResult2D() {
bool PhysicsServer2D::_body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin, const Ref<PhysicsTestMotionResult2D> &p_result) {
- MotionResult *r = NULL;
+ MotionResult *r = nullptr;
if (p_result.is_valid())
r = p_result->get_result_ptr();
return body_test_motion(p_body, p_from, p_motion, p_infinite_inertia, p_margin, r);
@@ -771,7 +771,7 @@ PhysicsServer2D::PhysicsServer2D() {
PhysicsServer2D::~PhysicsServer2D() {
- singleton = NULL;
+ singleton = nullptr;
}
Vector<PhysicsServer2DManager::ClassInfo> PhysicsServer2DManager::physics_2d_servers;
@@ -826,14 +826,14 @@ String PhysicsServer2DManager::get_server_name(int p_id) {
}
PhysicsServer2D *PhysicsServer2DManager::new_default_server() {
- ERR_FAIL_COND_V(default_server_id == -1, NULL);
+ ERR_FAIL_COND_V(default_server_id == -1, nullptr);
return physics_2d_servers[default_server_id].create_callback();
}
PhysicsServer2D *PhysicsServer2DManager::new_server(const String &p_name) {
int id = find_server_id(p_name);
if (id == -1) {
- return NULL;
+ return nullptr;
} else {
return physics_2d_servers[id].create_callback();
}
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 632371565c..8c833b390f 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -513,7 +513,7 @@ public:
}
};
- virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin = 0.001, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
+ virtual bool body_test_motion(RID p_body, const Transform2D &p_from, const Vector2 &p_motion, bool p_infinite_inertia, float p_margin = 0.001, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) = 0;
struct SeparationResult {
@@ -644,7 +644,7 @@ class PhysicsServer2DManager {
ClassInfo() :
name(""),
- create_callback(NULL) {}
+ create_callback(nullptr) {}
ClassInfo(String p_name, CreatePhysicsServer2DCallback p_create_callback) :
name(p_name),
diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp
index 0ee471231b..a5a02fd1bd 100644
--- a/servers/physics_server_3d.cpp
+++ b/servers/physics_server_3d.cpp
@@ -34,7 +34,7 @@
#include "core/print_string.h"
#include "core/project_settings.h"
-PhysicsServer3D *PhysicsServer3D::singleton = NULL;
+PhysicsServer3D *PhysicsServer3D::singleton = nullptr;
void PhysicsDirectBodyState3D::integrate_forces() {
@@ -725,13 +725,13 @@ void PhysicsServer3D::_bind_methods() {
PhysicsServer3D::PhysicsServer3D() {
- ERR_FAIL_COND(singleton != NULL);
+ ERR_FAIL_COND(singleton != nullptr);
singleton = this;
}
PhysicsServer3D::~PhysicsServer3D() {
- singleton = NULL;
+ singleton = nullptr;
}
Vector<PhysicsServer3DManager::ClassInfo> PhysicsServer3DManager::physics_servers;
@@ -786,14 +786,14 @@ String PhysicsServer3DManager::get_server_name(int p_id) {
}
PhysicsServer3D *PhysicsServer3DManager::new_default_server() {
- ERR_FAIL_COND_V(default_server_id == -1, NULL);
+ ERR_FAIL_COND_V(default_server_id == -1, nullptr);
return physics_servers[default_server_id].create_callback();
}
PhysicsServer3D *PhysicsServer3DManager::new_server(const String &p_name) {
int id = find_server_id(p_name);
if (id == -1) {
- return NULL;
+ return nullptr;
} else {
return physics_servers[id].create_callback();
}
diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h
index ddef8a9b20..a2f08b3ed8 100644
--- a/servers/physics_server_3d.h
+++ b/servers/physics_server_3d.h
@@ -189,7 +189,7 @@ public:
Vector3 linear_velocity; //velocity at contact point
};
- virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = NULL) = 0;
+ virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr) = 0;
virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, float p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set<RID> &p_exclude = Set<RID>(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) = 0;
@@ -500,7 +500,7 @@ public:
}
};
- virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = NULL, bool p_exclude_raycast_shapes = true) = 0;
+ virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) = 0;
struct SeparationResult {
@@ -785,7 +785,7 @@ class PhysicsServer3DManager {
ClassInfo() :
name(""),
- create_callback(NULL) {}
+ create_callback(nullptr) {}
ClassInfo(String p_name, CreatePhysicsServer3DCallback p_create_callback) :
name(p_name),
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index c53ffcc7b5..64b48bea50 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -68,7 +68,7 @@
#include "rendering_server.h"
#include "servers/rendering/shader_types.h"
-ShaderTypes *shader_types = NULL;
+ShaderTypes *shader_types = nullptr;
PhysicsServer3D *_createGodotPhysics3DCallback() {
return memnew(PhysicsServer3DSW);
@@ -194,10 +194,10 @@ void register_server_singletons() {
Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer", NavigationServer3D::get_singleton_mut()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer2D", NavigationServer2D::get_singleton_mut()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationServer3D", NavigationServer3D::get_singleton_mut()));
Engine::get_singleton()->add_singleton(Engine::Singleton("ARVRServer", ARVRServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("CameraServer", CameraServer::get_singleton()));
}
diff --git a/servers/rendering/SCsub b/servers/rendering/SCsub
index fca18bfea0..5ea0d40486 100644
--- a/servers/rendering/SCsub
+++ b/servers/rendering/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/rendering/rasterizer.cpp b/servers/rendering/rasterizer.cpp
index a3f93a3f8c..f62e0a43a6 100644
--- a/servers/rendering/rasterizer.cpp
+++ b/servers/rendering/rasterizer.cpp
@@ -33,7 +33,7 @@
#include "core/os/os.h"
#include "core/print_string.h"
-Rasterizer *(*Rasterizer::_create_func)() = NULL;
+Rasterizer *(*Rasterizer::_create_func)() = nullptr;
void RasterizerScene::InstanceDependency::instance_notify_changed(bool p_aabb, bool p_dependencies) {
for (Map<InstanceBase *, uint32_t>::Element *E = instances.front(); E; E = E->next()) {
@@ -67,9 +67,9 @@ Rasterizer *Rasterizer::create() {
return _create_func();
}
-RasterizerCanvas *RasterizerCanvas::singleton = NULL;
+RasterizerCanvas *RasterizerCanvas::singleton = nullptr;
-RasterizerStorage *RasterizerStorage::base_singleton = NULL;
+RasterizerStorage *RasterizerStorage::base_singleton = nullptr;
RasterizerStorage::RasterizerStorage() {
diff --git a/servers/rendering/rasterizer.h b/servers/rendering/rasterizer.h
index f63d1077bb..fca1352870 100644
--- a/servers/rendering/rasterizer.h
+++ b/servers/rendering/rasterizer.h
@@ -75,7 +75,8 @@ public:
virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) = 0;
#endif
- virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0;
+ virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) = 0;
+ virtual void environment_glow_set_use_bicubic_upscale(bool p_enable) = 0;
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;
@@ -218,7 +219,7 @@ public:
baked_light = false;
dynamic_gi = false;
redraw_if_visible = false;
- lightmap_capture = NULL;
+ lightmap_capture = nullptr;
}
virtual ~InstanceBase() {
@@ -750,10 +751,10 @@ public:
energy = 1.0;
item_shadow_mask = -1;
mode = RS::CANVAS_LIGHT_MODE_ADD;
- // texture_cache = NULL;
- next_ptr = NULL;
- mask_next_ptr = NULL;
- filter_next_ptr = NULL;
+ // texture_cache = nullptr;
+ next_ptr = nullptr;
+ mask_next_ptr = nullptr;
+ filter_next_ptr = nullptr;
use_shadow = false;
shadow_buffer_size = 2048;
shadow_filter = RS::CANVAS_LIGHT_FILTER_NONE;
@@ -1004,7 +1005,7 @@ public:
//must update rect
- if (commands == NULL) {
+ if (commands == nullptr) {
rect = Rect2();
rect_dirty = false;
@@ -1114,12 +1115,12 @@ public:
template <class T>
T *alloc_command() {
T *command;
- if (commands == NULL) {
+ if (commands == nullptr) {
// As the most common use case of canvas items is to
// use only one command, the first is done with it's
// own allocation. The rest of them use blocks.
command = memnew(T);
- command->next = NULL;
+ command->next = nullptr;
commands = command;
last_command = command;
} else {
@@ -1146,7 +1147,7 @@ public:
//allocate block and add to the linked list
void *memory = c->memory + c->usage;
command = memnew_placement(memory, T);
- command->next = NULL;
+ command->next = nullptr;
last_command->next = command;
last_command = command;
c->usage += sizeof(T);
@@ -1171,7 +1172,7 @@ public:
Command *n = c->next;
if (c == commands) {
memdelete(commands);
- commands = NULL;
+ commands = nullptr;
} else {
c->~Command();
}
@@ -1185,36 +1186,36 @@ public:
}
}
- last_command = NULL;
- commands = NULL;
+ last_command = nullptr;
+ commands = nullptr;
current_block = 0;
clip = false;
rect_dirty = true;
- final_clip_owner = NULL;
- material_owner = NULL;
+ final_clip_owner = nullptr;
+ material_owner = nullptr;
light_masked = false;
}
Item() {
- commands = NULL;
- last_command = NULL;
+ commands = nullptr;
+ last_command = nullptr;
current_block = 0;
light_mask = 1;
- vp_render = NULL;
- next = NULL;
- final_clip_owner = NULL;
+ vp_render = nullptr;
+ next = nullptr;
+ final_clip_owner = nullptr;
clip = false;
final_modulate = Color(1, 1, 1, 1);
visible = true;
rect_dirty = true;
custom_rect = false;
behind = false;
- material_owner = NULL;
- copy_back_buffer = NULL;
+ material_owner = nullptr;
+ copy_back_buffer = nullptr;
distance_field = false;
light_masked = false;
update_when_visible = false;
z_final = 0;
- custom_data = NULL;
+ custom_data = nullptr;
}
virtual ~Item() {
clear();
@@ -1247,7 +1248,7 @@ public:
LightOccluderInstance() {
enabled = true;
- next = NULL;
+ next = nullptr;
light_mask = 1;
cull_cache = RS::CANVAS_OCCLUDER_POLYGON_CULL_DISABLED;
}
diff --git a/servers/rendering/rasterizer_rd/SCsub b/servers/rendering/rasterizer_rd/SCsub
index cc17feeb05..6a2e682c67 100644
--- a/servers/rendering/rasterizer_rd/SCsub
+++ b/servers/rendering/rasterizer_rd/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env.add_source_files(env.servers_sources, "*.cpp")
diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
index 8d52ffd7b9..ba4f4c4acb 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp
@@ -1220,7 +1220,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(sizeof(float) * 4 * 5));
glVertexAttribDivisor(10, 1);
glEnableVertexAttribArray(11); //color
- glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, NULL);
+ glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, nullptr);
glVertexAttribDivisor(11, 1);
glEnableVertexAttribArray(12); //custom
glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(sizeof(float) * 4 * 2));
@@ -1262,7 +1262,7 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(sizeof(float) * 4 * 5));
glVertexAttribDivisor(10, 1);
glEnableVertexAttribArray(11); //color
- glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, NULL);
+ glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, nullptr);
glVertexAttribDivisor(11, 1);
glEnableVertexAttribArray(12); //custom
glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, CAST_INT_TO_UCHAR_PTR(sizeof(float) * 4 * 2));
@@ -1314,13 +1314,13 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
if (current_clip && reclip) {
//will make it re-enable clipping if needed afterwards
- current_clip = NULL;
+ current_clip = nullptr;
}
}
void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, RID p_screen_uniform_set) {
- Item *current_clip = NULL;
+ Item *current_clip = nullptr;
Transform2D canvas_transform_inverse = p_canvas_transform_inverse;
@@ -1369,7 +1369,7 @@ void RasterizerCanvasRD::_render_items(RID p_to_render_target, int p_item_count,
if (ci->material != prev_material) {
- MaterialData *material_data = NULL;
+ MaterialData *material_data = nullptr;
if (ci->material.is_valid()) {
material_data = (MaterialData *)storage->material_get_data(ci->material, RasterizerStorageRD::SHADER_TYPE_2D);
}
@@ -2532,7 +2532,7 @@ RasterizerCanvasRD::~RasterizerCanvasRD() {
//anything remains?
if (bindings.texture_bindings.size()) {
ERR_PRINT("Some texture bindings were not properly freed (leaked canvasitems?");
- const TextureBindingID *key = NULL;
+ const TextureBindingID *key = nullptr;
while ((key = bindings.texture_bindings.next(key))) {
TextureBinding *tb = bindings.texture_bindings[*key];
tb->reference_count = 1;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
index 0c151975bc..83b431eaf6 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.h
@@ -383,7 +383,7 @@ class RasterizerCanvasRD : public RasterizerCanvas {
for (int i = 0; i < DEFAULT_MAX_LIGHTS_PER_ITEM; i++) {
light_cache[i].light_version = 0;
- light_cache[i].light = NULL;
+ light_cache[i].light = nullptr;
}
light_cache_count = 0xFFFFFFFF;
}
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index bf3cd045f1..10d83b0c26 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -1074,12 +1074,12 @@ void RasterizerSceneHighEndRD::_add_geometry(InstanceBase *p_instance, uint32_t
}
}
- MaterialData *material = NULL;
+ MaterialData *material = nullptr;
if (m_src.is_valid()) {
material = (MaterialData *)storage->material_get_data(m_src, RasterizerStorageRD::SHADER_TYPE_3D);
if (!material || !material->shader_data->valid) {
- material = NULL;
+ material = nullptr;
}
}
@@ -1203,7 +1203,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
case RS::INSTANCE_MESH: {
- const RID *materials = NULL;
+ const RID *materials = nullptr;
uint32_t surface_count;
materials = storage->mesh_get_surface_count_and_materials(inst->base, surface_count);
@@ -1237,7 +1237,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
continue;
}
- const RID *materials = NULL;
+ const RID *materials = nullptr;
uint32_t surface_count;
materials = storage->mesh_get_surface_count_and_materials(mesh, surface_count);
@@ -1258,7 +1258,7 @@ void RasterizerSceneHighEndRD::_fill_render_list(InstanceBase **p_cull_result, i
RasterizerStorageGLES3::Immediate *immediate = storage->immediate_owner.getornull(inst->base);
ERR_CONTINUE(!immediate);
- _add_geometry(immediate, inst, NULL, -1, p_depth_pass, p_shadow_pass);
+ _add_geometry(immediate, inst, nullptr, -1, p_depth_pass, p_shadow_pass);
} break;
case RS::INSTANCE_PARTICLES: {
@@ -1637,7 +1637,7 @@ void RasterizerSceneHighEndRD::_setup_lights(RID *p_light_cull_result, int p_lig
void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, 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_gi_probe_cull_result, int p_gi_probe_cull_count, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, const Color &p_default_bg_color) {
- RenderBufferDataHighEnd *render_buffer = NULL;
+ RenderBufferDataHighEnd *render_buffer = nullptr;
if (p_render_buffer.is_valid()) {
render_buffer = (RenderBufferDataHighEnd *)render_buffers_get_data(p_render_buffer);
}
@@ -1937,13 +1937,13 @@ void RasterizerSceneHighEndRD::_render_scene(RID p_render_buffer, const Transfor
//_render_list
#if 0
if (state.directional_light_count == 0) {
- directional_light = NULL;
- _render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, p_cam_transform, p_cam_projection, env_radiance_tex, false, true, false, false, shadow_atlas != NULL);
+ directional_light = nullptr;
+ _render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, p_cam_transform, p_cam_projection, env_radiance_tex, false, true, false, false, shadow_atlas != nullptr);
} else {
for (int i = 0; i < state.directional_light_count; i++) {
directional_light = directional_lights[i];
- _setup_directional_light(i, p_cam_transform.affine_inverse(), shadow_atlas != NULL && shadow_atlas->size > 0);
- _render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, p_cam_transform, p_cam_projection, env_radiance_tex, false, true, false, i > 0, shadow_atlas != NULL);
+ _setup_directional_light(i, p_cam_transform.affine_inverse(), shadow_atlas != nullptr && shadow_atlas->size > 0);
+ _render_list(&render_list.elements[render_list.max_elements - render_list.alpha_element_count], render_list.alpha_element_count, p_cam_transform, p_cam_projection, env_radiance_tex, false, true, false, i > 0, shadow_atlas != nullptr);
}
}
#endif
@@ -2366,7 +2366,7 @@ void RasterizerSceneHighEndRD::_update_render_buffers_uniform_set(RID p_render_b
}
}
-RasterizerSceneHighEndRD *RasterizerSceneHighEndRD::singleton = NULL;
+RasterizerSceneHighEndRD *RasterizerSceneHighEndRD::singleton = nullptr;
void RasterizerSceneHighEndRD::set_time(double p_time, double p_step) {
time = p_time;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h
index 4c3422cedb..683a1fc82d 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.h
@@ -489,7 +489,7 @@ class RasterizerSceneHighEndRD : public RasterizerSceneRD {
_FORCE_INLINE_ Element *add_element() {
if (element_count + alpha_element_count >= max_elements)
- return NULL;
+ return nullptr;
elements[element_count] = &base_elements[element_count];
return elements[element_count++];
}
@@ -497,7 +497,7 @@ class RasterizerSceneHighEndRD : public RasterizerSceneRD {
_FORCE_INLINE_ Element *add_alpha_element() {
if (element_count + alpha_element_count >= max_elements)
- return NULL;
+ return nullptr;
int idx = max_elements - alpha_element_count - 1;
elements[idx] = &base_elements[idx];
alpha_element_count++;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
index 842f7046c9..7a0869e7c1 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp
@@ -465,12 +465,12 @@ void RasterizerSceneRD::_draw_sky(bool p_can_continue, RID p_fb, RID p_environme
RID sky_material = sky_get_material(environment_get_sky(p_environment));
- SkyMaterialData *material = NULL;
+ SkyMaterialData *material = nullptr;
if (sky_material.is_valid()) {
material = (SkyMaterialData *)storage->material_get_data(sky_material, RasterizerStorageRD::SHADER_TYPE_SKY);
if (!material || !material->shader_data->valid) {
- material = NULL;
+ material = nullptr;
}
}
@@ -551,12 +551,12 @@ void RasterizerSceneRD::_setup_sky(RID p_environment, const Vector3 &p_position,
RID sky_material = sky_get_material(environment_get_sky(p_environment));
- SkyMaterialData *material = NULL;
+ SkyMaterialData *material = nullptr;
if (sky_material.is_valid()) {
material = (SkyMaterialData *)storage->material_get_data(sky_material, RasterizerStorageRD::SHADER_TYPE_SKY);
if (!material || !material->shader_data->valid) {
- material = NULL;
+ material = nullptr;
}
}
@@ -688,12 +688,12 @@ void RasterizerSceneRD::_update_sky(RID p_environment, const CameraMatrix &p_pro
RID sky_material = sky_get_material(environment_get_sky(p_environment));
- SkyMaterialData *material = NULL;
+ SkyMaterialData *material = nullptr;
if (sky_material.is_valid()) {
material = (SkyMaterialData *)storage->material_get_data(sky_material, RasterizerStorageRD::SHADER_TYPE_SKY);
if (!material || !material->shader_data->valid) {
- material = NULL;
+ material = nullptr;
}
}
@@ -1211,7 +1211,7 @@ void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMa
env->auto_exp_scale = p_auto_exp_scale;
}
-void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) {
+void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) {
Environent *env = environment_owner.getornull(p_env);
ERR_FAIL_COND(!env);
@@ -1225,7 +1225,10 @@ void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_lev
env->glow_hdr_bleed_threshold = p_hdr_bleed_threshold;
env->glow_hdr_bleed_scale = p_hdr_bleed_scale;
env->glow_hdr_luminance_cap = p_hdr_luminance_cap;
- env->glow_bicubic_upscale = p_bicubic_upscale;
+}
+
+void RasterizerSceneRD::environment_glow_set_use_bicubic_upscale(bool p_enable) {
+ glow_bicubic_upscale = p_enable;
}
void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) {
@@ -3339,7 +3342,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu
tonemap.glow_level_flags = glow_mask;
tonemap.glow_texture_size.x = rb->blur[1].mipmaps[0].width;
tonemap.glow_texture_size.y = rb->blur[1].mipmaps[0].height;
- tonemap.glow_use_bicubic_upscale = env->glow_bicubic_upscale;
+ tonemap.glow_use_bicubic_upscale = glow_bicubic_upscale;
tonemap.glow_texture = rb->blur[1].texture;
} else {
tonemap.glow_texture = storage->texture_rd_get_default(RasterizerStorageRD::DEFAULT_RD_TEXTURE_BLACK);
@@ -3466,7 +3469,7 @@ bool RasterizerSceneRD::is_using_radiance_cubemap_array() const {
RasterizerSceneRD::RenderBufferData *RasterizerSceneRD::render_buffers_get_data(RID p_render_buffers) {
RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers);
- ERR_FAIL_COND_V(!rb, NULL);
+ ERR_FAIL_COND_V(!rb, nullptr);
return rb->data;
}
@@ -3795,7 +3798,7 @@ float RasterizerSceneRD::screen_space_roughness_limiter_get_curve() const {
return screen_space_roughness_limiter_curve;
}
-RasterizerSceneRD *RasterizerSceneRD::singleton = NULL;
+RasterizerSceneRD *RasterizerSceneRD::singleton = nullptr;
RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
storage = p_storage;
@@ -4008,6 +4011,7 @@ RasterizerSceneRD::RasterizerSceneRD(RasterizerStorageRD *p_storage) {
environment_set_ssao_quality(RS::EnvironmentSSAOQuality(int(GLOBAL_GET("rendering/quality/ssao/quality"))), GLOBAL_GET("rendering/quality/ssao/half_size"));
screen_space_roughness_limiter = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter");
screen_space_roughness_limiter_curve = GLOBAL_GET("rendering/quality/filters/screen_space_roughness_limiter_curve");
+ glow_bicubic_upscale = int(GLOBAL_GET("rendering/quality/glow/upscale_mode")) > 0;
}
RasterizerSceneRD::~RasterizerSceneRD() {
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
index 0a1cc8ebd7..dbdaf2f447 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
@@ -571,7 +571,7 @@ private:
Rect2 atlas_rect;
};
- RS::LightType light_type;
+ RS::LightType light_type = RS::LIGHT_DIRECTIONAL;
ShadowTransform shadow_transform[4];
@@ -581,7 +581,7 @@ private:
Vector3 light_vector;
Vector3 spot_vector;
- float linear_att;
+ float linear_att = 0.0;
uint64_t shadow_pass = 0;
uint64_t last_scene_pass = 0;
@@ -590,7 +590,7 @@ private:
uint32_t light_index = 0;
uint32_t light_directional_index = 0;
- uint32_t current_shadow_atlas_key;
+ uint32_t current_shadow_atlas_key = 0;
Vector2 dp;
@@ -646,7 +646,6 @@ private:
float glow_hdr_bleed_threshold = 1.0;
float glow_hdr_luminance_cap = 12.0;
float glow_hdr_bleed_scale = 2.0;
- bool glow_bicubic_upscale = false;
/// SSAO
@@ -662,6 +661,7 @@ private:
RS::EnvironmentSSAOQuality ssao_quality = RS::ENV_SSAO_QUALITY_MEDIUM;
bool ssao_half_size = false;
+ bool glow_bicubic_upscale = false;
static uint64_t auto_exposure_counter;
@@ -827,7 +827,8 @@ public:
bool is_environment(RID p_env) const;
- void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale);
+ void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap);
+ void environment_glow_set_use_bicubic_upscale(bool p_enable);
void environment_set_fog(RID p_env, bool p_enable, float p_begin, float p_end, RID p_gradient_texture) {}
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 83af15602c..322e89ef9a 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "rasterizer_storage_rd.h"
+
#include "core/engine.h"
#include "core/project_settings.h"
#include "servers/rendering/shader_language.h"
@@ -861,7 +862,7 @@ Size2 RasterizerStorageRD::texture_size_with_proxy(RID p_proxy) {
RID RasterizerStorageRD::shader_create() {
Shader shader;
- shader.data = NULL;
+ shader.data = nullptr;
shader.type = SHADER_TYPE_MAX;
return shader_owner.make_rid(shader);
@@ -889,7 +890,7 @@ void RasterizerStorageRD::shader_set_code(RID p_shader, const String &p_code) {
if (new_type != shader->type) {
if (shader->data) {
memdelete(shader->data);
- shader->data = NULL;
+ shader->data = nullptr;
}
for (Set<Material *>::Element *E = shader->owners.front(); E; E = E->next()) {
@@ -898,7 +899,7 @@ void RasterizerStorageRD::shader_set_code(RID p_shader, const String &p_code) {
material->shader_type = new_type;
if (material->data) {
memdelete(material->data);
- material->data = NULL;
+ material->data = nullptr;
}
}
@@ -990,10 +991,10 @@ void RasterizerStorageRD::shader_set_data_request_function(ShaderType p_shader_t
RID RasterizerStorageRD::material_create() {
Material material;
- material.data = NULL;
- material.shader = NULL;
+ material.data = nullptr;
+ material.shader = nullptr;
material.shader_type = SHADER_TYPE_MAX;
- material.update_next = NULL;
+ material.update_next = nullptr;
material.update_requested = false;
material.uniform_dirty = false;
material.texture_dirty = false;
@@ -1025,12 +1026,12 @@ void RasterizerStorageRD::material_set_shader(RID p_material, RID p_shader) {
if (material->data) {
memdelete(material->data);
- material->data = NULL;
+ material->data = nullptr;
}
if (material->shader) {
material->shader->owners.erase(material);
- material->shader = NULL;
+ material->shader = nullptr;
material->shader_type = SHADER_TYPE_MAX;
}
@@ -1049,7 +1050,7 @@ void RasterizerStorageRD::material_set_shader(RID p_material, RID p_shader) {
return;
}
- ERR_FAIL_COND(shader->data == NULL);
+ ERR_FAIL_COND(shader->data == nullptr);
material->data = material_data_request_func[shader->type](shader->data);
material->data->set_next_pass(material->next_pass);
@@ -1664,7 +1665,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va
RasterizerStorageRD *singleton = (RasterizerStorageRD *)RasterizerStorage::base_singleton;
#ifdef TOOLS_ENABLED
Texture *roughness_detect_texture = nullptr;
- RS::TextureDetectRoughnessChannel roughness_channel;
+ RS::TextureDetectRoughnessChannel roughness_channel = RS::TEXTURE_DETECT_ROUGNHESS_R;
Texture *normal_detect_texture = nullptr;
#endif
@@ -1769,10 +1770,10 @@ void RasterizerStorageRD::_update_queued_materials() {
material->update_requested = false;
material->texture_dirty = false;
material->uniform_dirty = false;
- material->update_next = NULL;
+ material->update_next = nullptr;
material = next;
}
- material_update_list = NULL;
+ material_update_list = nullptr;
}
/* MESH API */
@@ -4452,10 +4453,10 @@ String RasterizerStorageRD::get_captured_timestamp_name(uint32_t p_index) const
RasterizerStorageRD::RasterizerStorageRD() {
for (int i = 0; i < SHADER_TYPE_MAX; i++) {
- shader_data_request_func[i] = NULL;
+ shader_data_request_func[i] = nullptr;
}
- material_update_list = NULL;
+ material_update_list = nullptr;
{ //create default textures
RD::TextureFormat tformat;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index e69be644d7..49f77e49e1 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -218,7 +218,7 @@ private:
struct Mesh {
struct Surface {
- RS::PrimitiveType primitive;
+ RS::PrimitiveType primitive = RS::PRIMITIVE_POINTS;
uint32_t format = 0;
RID vertex_buffer;
@@ -232,8 +232,8 @@ private:
// cache-efficient structure.
struct Version {
- uint32_t input_mask;
- RD::VertexFormatID vertex_format;
+ uint32_t input_mask = 0;
+ RD::VertexFormatID vertex_format = 0;
RID vertex_array;
};
@@ -246,7 +246,7 @@ private:
uint32_t index_count = 0;
struct LOD {
- float edge_length;
+ float edge_length = 0.0;
RID index_buffer;
RID index_array;
};
@@ -456,9 +456,9 @@ private:
RID color;
//used for retrieving from CPU
- RD::DataFormat color_format;
- RD::DataFormat color_format_srgb;
- Image::Format image_format;
+ RD::DataFormat color_format = RD::DATA_FORMAT_R4G4_UNORM_PACK8;
+ RD::DataFormat color_format_srgb = RD::DATA_FORMAT_R4G4_UNORM_PACK8;
+ Image::Format image_format = Image::FORMAT_L8;
bool flags[RENDER_TARGET_FLAG_MAX];
@@ -604,7 +604,7 @@ public:
_FORCE_INLINE_ MaterialData *material_get_data(RID p_material, ShaderType p_shader_type) {
Material *material = material_owner.getornull(p_material);
if (!material || material->shader_type != p_shader_type) {
- return NULL;
+ return nullptr;
} else {
return material->data;
}
@@ -640,10 +640,10 @@ public:
_FORCE_INLINE_ const RID *mesh_get_surface_count_and_materials(RID p_mesh, uint32_t &r_surface_count) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
- ERR_FAIL_COND_V(!mesh, NULL);
+ ERR_FAIL_COND_V(!mesh, nullptr);
r_surface_count = mesh->surface_count;
if (r_surface_count == 0) {
- return NULL;
+ return nullptr;
}
if (mesh->material_cache.empty()) {
mesh->material_cache.resize(mesh->surface_count);
@@ -1037,7 +1037,7 @@ public:
void lightmap_capture_set_energy(RID p_capture, float p_energy) {}
float lightmap_capture_get_energy(RID p_capture) const { return 0.0; }
const Vector<LightmapCaptureOctree> *lightmap_capture_get_octree_ptr(RID p_capture) const {
- return NULL;
+ return nullptr;
}
/* PARTICLES */
diff --git a/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
index 4ee020aa69..2bfdb7fffe 100644
--- a/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
+++ b/servers/rendering/rasterizer_rd/render_pipeline_vertex_format_cache_rd.cpp
@@ -57,7 +57,7 @@ void RenderPipelineVertexFormatCacheRD::_clear() {
}
version_count = 0;
memfree(versions);
- versions = NULL;
+ versions = nullptr;
}
}
@@ -88,7 +88,7 @@ void RenderPipelineVertexFormatCacheRD::clear() {
RenderPipelineVertexFormatCacheRD::RenderPipelineVertexFormatCacheRD() {
version_count = 0;
- versions = NULL;
+ versions = nullptr;
input_mask = 0;
}
diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
index b3a4b0ede8..4a0b4f02b1 100644
--- a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp
@@ -303,7 +303,7 @@ void ShaderCompilerRD::_dump_function_deps(const SL::ShaderNode *p_node, const S
_dump_function_deps(p_node, E->get(), p_func_code, r_to_add, added);
- SL::FunctionNode *fnode = NULL;
+ SL::FunctionNode *fnode = nullptr;
for (int i = 0; i < p_node->functions.size(); i++) {
if (p_node->functions[i].name == E->get()) {
@@ -572,7 +572,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
function = fnode;
current_func_name = fnode->name;
function_code[fnode->name] = _dump_node_code(fnode->body, p_level + 1, r_gen_code, p_actions, p_default_actions, p_assigning);
- function = NULL;
+ function = nullptr;
}
//place functions in actual code
@@ -605,7 +605,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
_dump_function_deps(pnode, fnode->name, function_code, r_gen_code.fragment_global, added_fragment);
r_gen_code.light = function_code[light_name];
}
- function = NULL;
+ function = nullptr;
}
//code+=dump_node_code(pnode->body,p_level);
@@ -798,12 +798,12 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
else
code = _mkid(anode->name);
- if (anode->call_expression != NULL) {
+ if (anode->call_expression != nullptr) {
code += ".";
code += _dump_node_code(anode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
}
- if (anode->index_expression != NULL) {
+ if (anode->index_expression != nullptr) {
code += "[";
code += _dump_node_code(anode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
@@ -1025,7 +1025,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
case SL::Node::TYPE_MEMBER: {
SL::MemberNode *mnode = (SL::MemberNode *)p_node;
code = _dump_node_code(mnode->owner, p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + "." + mnode->name;
- if (mnode->index_expression != NULL) {
+ if (mnode->index_expression != nullptr) {
code += "[";
code += _dump_node_code(mnode->index_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning);
code += "]";
@@ -1048,7 +1048,7 @@ Error ShaderCompilerRD::compile(RS::ShaderMode p_mode, const String &p_code, Ide
print_line(itos(i + 1) + " " + 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);
+ _err_print_error(nullptr, p_path.utf8().get_data(), parser.get_error_line(), parser.get_error_text().utf8().get_data(), ERR_HANDLER_SHADER);
return err;
}
@@ -1066,7 +1066,7 @@ Error ShaderCompilerRD::compile(RS::ShaderMode p_mode, const String &p_code, Ide
used_flag_pointers.clear();
shader = parser.get_shader();
- function = NULL;
+ function = nullptr;
_dump_node_code(shader, 1, r_gen_code, *p_actions, actions, false);
return OK;
diff --git a/servers/rendering/rasterizer_rd/shader_rd.cpp b/servers/rendering/rasterizer_rd/shader_rd.cpp
index 3dcfd0faf9..d60a58813e 100644
--- a/servers/rendering/rasterizer_rd/shader_rd.cpp
+++ b/servers/rendering/rasterizer_rd/shader_rd.cpp
@@ -191,7 +191,7 @@ RID ShaderRD::version_create() {
version.dirty = true;
version.valid = false;
version.initialize_needed = true;
- version.variants = NULL;
+ version.variants = nullptr;
return version_owner.make_rid(version);
}
@@ -203,7 +203,7 @@ void ShaderRD::_clear_version(Version *p_version) {
}
memdelete_arr(p_version->variants);
- p_version->variants = NULL;
+ p_version->variants = nullptr;
}
}
@@ -394,7 +394,7 @@ void ShaderRD::_compile_version(Version *p_version) {
}
}
memdelete_arr(p_version->variants);
- p_version->variants = NULL;
+ p_version->variants = nullptr;
return;
}
diff --git a/servers/rendering/rasterizer_rd/shaders/SCsub b/servers/rendering/rasterizer_rd/shaders/SCsub
index 2dcb2a703f..6e852e2dc5 100644
--- a/servers/rendering/rasterizer_rd/shaders/SCsub
+++ b/servers/rendering/rasterizer_rd/shaders/SCsub
@@ -1,24 +1,24 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
-if 'RD_GLSL' in env['BUILDERS']:
- env.RD_GLSL('canvas.glsl');
- env.RD_GLSL('canvas_occlusion.glsl');
- env.RD_GLSL('blur.glsl');
- env.RD_GLSL('cubemap_roughness.glsl');
- env.RD_GLSL('cubemap_downsampler.glsl');
- env.RD_GLSL('cubemap_filter.glsl');
- env.RD_GLSL('scene_high_end.glsl');
- env.RD_GLSL('sky.glsl');
- env.RD_GLSL('tonemap.glsl');
- env.RD_GLSL('copy.glsl');
- env.RD_GLSL('giprobe.glsl');
- env.RD_GLSL('giprobe_debug.glsl');
- env.RD_GLSL('giprobe_sdf.glsl');
- env.RD_GLSL('luminance_reduce.glsl');
- env.RD_GLSL('bokeh_dof.glsl');
- env.RD_GLSL('ssao.glsl');
- env.RD_GLSL('ssao_minify.glsl');
- env.RD_GLSL('ssao_blur.glsl');
- env.RD_GLSL('roughness_limiter.glsl');
+if "RD_GLSL" in env["BUILDERS"]:
+ env.RD_GLSL("canvas.glsl")
+ env.RD_GLSL("canvas_occlusion.glsl")
+ env.RD_GLSL("blur.glsl")
+ env.RD_GLSL("cubemap_roughness.glsl")
+ env.RD_GLSL("cubemap_downsampler.glsl")
+ env.RD_GLSL("cubemap_filter.glsl")
+ env.RD_GLSL("scene_high_end.glsl")
+ env.RD_GLSL("sky.glsl")
+ env.RD_GLSL("tonemap.glsl")
+ env.RD_GLSL("copy.glsl")
+ env.RD_GLSL("giprobe.glsl")
+ env.RD_GLSL("giprobe_debug.glsl")
+ env.RD_GLSL("giprobe_sdf.glsl")
+ env.RD_GLSL("luminance_reduce.glsl")
+ env.RD_GLSL("bokeh_dof.glsl")
+ env.RD_GLSL("ssao.glsl")
+ env.RD_GLSL("ssao_minify.glsl")
+ env.RD_GLSL("ssao_blur.glsl")
+ env.RD_GLSL("roughness_limiter.glsl")
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index 3c1795161d..a3799b0e4d 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -30,14 +30,14 @@
#include "rendering_device.h"
-RenderingDevice *RenderingDevice::singleton = NULL;
+RenderingDevice *RenderingDevice::singleton = nullptr;
RenderingDevice *RenderingDevice::get_singleton() {
return singleton;
}
-RenderingDevice::ShaderCompileFunction RenderingDevice::compile_function = NULL;
-RenderingDevice::ShaderCacheFunction RenderingDevice::cache_function = NULL;
+RenderingDevice::ShaderCompileFunction RenderingDevice::compile_function = nullptr;
+RenderingDevice::ShaderCacheFunction RenderingDevice::cache_function = nullptr;
void RenderingDevice::shader_set_compile_function(ShaderCompileFunction p_function) {
compile_function = p_function;
diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h
index 4705bcaa75..a639ff3641 100644
--- a/servers/rendering/rendering_device.h
+++ b/servers/rendering/rendering_device.h
@@ -563,7 +563,7 @@ public:
/**** SHADER ****/
/****************/
- virtual Vector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = NULL, bool p_allow_cache = true);
+ virtual Vector<uint8_t> shader_compile_from_source(ShaderStage p_stage, const String &p_source_code, ShaderLanguage p_language = SHADER_LANGUAGE_GLSL, String *r_error = nullptr, bool p_allow_cache = true);
static void shader_set_compile_function(ShaderCompileFunction p_function);
static void shader_set_cache_function(ShaderCacheFunction p_function);
diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp
index 261bd4c275..5d6dcfd2c1 100644
--- a/servers/rendering/rendering_server_canvas.cpp
+++ b/servers/rendering/rendering_server_canvas.cpp
@@ -43,14 +43,14 @@ void RenderingServerCanvas::_render_canvas_item_tree(RID p_to_render_target, Can
memset(z_last_list, 0, z_range * sizeof(RasterizerCanvas::Item *));
for (int i = 0; i < p_child_item_count; i++) {
- _cull_canvas_item(p_child_items[i].item, p_transform, p_clip_rect, Color(1, 1, 1, 1), 0, z_list, z_last_list, NULL, NULL);
+ _cull_canvas_item(p_child_items[i].item, p_transform, p_clip_rect, Color(1, 1, 1, 1), 0, z_list, z_last_list, nullptr, nullptr);
}
if (p_canvas_item) {
- _cull_canvas_item(p_canvas_item, p_transform, p_clip_rect, Color(1, 1, 1, 1), 0, z_list, z_last_list, NULL, NULL);
+ _cull_canvas_item(p_canvas_item, p_transform, p_clip_rect, Color(1, 1, 1, 1), 0, z_list, z_last_list, nullptr, nullptr);
}
- RasterizerCanvas::Item *list = NULL;
- RasterizerCanvas::Item *list_end = NULL;
+ RasterizerCanvas::Item *list = nullptr;
+ RasterizerCanvas::Item *list_end = nullptr;
for (int i = 0; i < z_range; i++) {
if (!z_list[i])
@@ -78,7 +78,7 @@ void _collect_ysort_children(RenderingServerCanvas::Item *p_canvas_item, Transfo
r_items[r_index] = child_items[i];
child_items[i]->ysort_xform = p_transform;
child_items[i]->ysort_pos = p_transform.xform(child_items[i]->xform.elements[2]);
- child_items[i]->material_owner = child_items[i]->use_parent_material ? p_material_owner : NULL;
+ child_items[i]->material_owner = child_items[i]->use_parent_material ? p_material_owner : nullptr;
}
r_index++;
@@ -92,7 +92,7 @@ void _collect_ysort_children(RenderingServerCanvas::Item *p_canvas_item, Transfo
void _mark_ysort_dirty(RenderingServerCanvas::Item *ysort_owner, RID_PtrOwner<RenderingServerCanvas::Item> &canvas_item_owner) {
do {
ysort_owner->ysort_children_count = -1;
- ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : NULL;
+ ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : nullptr;
} while (ysort_owner && ysort_owner->sort_y);
}
@@ -118,7 +118,7 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
ci->material_owner = p_material_owner;
else {
p_material_owner = ci;
- ci->material_owner = NULL;
+ ci->material_owner = nullptr;
}
Color modulate(ci->modulate.r * p_modulate.r, ci->modulate.g * p_modulate.g, ci->modulate.b * p_modulate.b, ci->modulate.a * p_modulate.a);
@@ -130,7 +130,7 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
Item **child_items = ci->child_items.ptrw();
if (ci->clip) {
- if (p_canvas_clip != NULL) {
+ if (p_canvas_clip != nullptr) {
ci->final_clip_rect = p_canvas_clip->final_clip_rect.clip(global_rect);
} else {
ci->final_clip_rect = global_rect;
@@ -145,7 +145,7 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
if (ci->ysort_children_count == -1) {
ci->ysort_children_count = 0;
- _collect_ysort_children(ci, Transform2D(), p_material_owner, NULL, ci->ysort_children_count);
+ _collect_ysort_children(ci, Transform2D(), p_material_owner, nullptr, ci->ysort_children_count);
}
child_item_count = ci->ysort_children_count;
@@ -183,7 +183,7 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
RenderingServerRaster::redraw_request();
}
- if ((ci->commands != NULL && p_clip_rect.intersects(global_rect, true)) || ci->vp_render || ci->copy_back_buffer) {
+ if ((ci->commands != nullptr && p_clip_rect.intersects(global_rect, true)) || ci->vp_render || ci->copy_back_buffer) {
//something to draw?
ci->final_transform = xform;
ci->final_modulate = Color(modulate.r * ci->self_modulate.r, modulate.g * ci->self_modulate.g, modulate.b * ci->self_modulate.b, modulate.a * ci->self_modulate.a);
@@ -204,7 +204,7 @@ void RenderingServerCanvas::_cull_canvas_item(Item *p_canvas_item, const Transfo
ci->z_final = p_z;
- ci->next = NULL;
+ ci->next = nullptr;
}
for (int i = 0; i < child_item_count; i++) {
@@ -265,30 +265,30 @@ void RenderingServerCanvas::render_canvas(RID p_render_target, Canvas *p_canvas,
if (!has_mirror) {
- _render_canvas_item_tree(p_render_target, ci, l, NULL, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, ci, l, nullptr, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
} else {
//used for parallaxlayer mirroring
for (int i = 0; i < l; i++) {
const Canvas::ChildItem &ci2 = p_canvas->child_items[i];
- _render_canvas_item_tree(p_render_target, NULL, 0, ci2.item, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, p_transform, p_clip_rect, p_canvas->modulate, p_lights);
//mirroring (useful for scrolling backgrounds)
if (ci2.mirror.x != 0) {
Transform2D xform2 = p_transform * Transform2D(0, Vector2(ci2.mirror.x, 0));
- _render_canvas_item_tree(p_render_target, NULL, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
}
if (ci2.mirror.y != 0) {
Transform2D xform2 = p_transform * Transform2D(0, Vector2(0, ci2.mirror.y));
- _render_canvas_item_tree(p_render_target, NULL, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
}
if (ci2.mirror.y != 0 && ci2.mirror.x != 0) {
Transform2D xform2 = p_transform * Transform2D(0, ci2.mirror);
- _render_canvas_item_tree(p_render_target, NULL, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
+ _render_canvas_item_tree(p_render_target, nullptr, 0, ci2.item, xform2, p_clip_rect, p_canvas->modulate, p_lights);
}
}
}
@@ -946,12 +946,12 @@ void RenderingServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool
Item *canvas_item = canvas_item_owner.getornull(p_item);
ERR_FAIL_COND(!canvas_item);
- if (bool(canvas_item->copy_back_buffer != NULL) != p_enable) {
+ if (bool(canvas_item->copy_back_buffer != nullptr) != p_enable) {
if (p_enable) {
canvas_item->copy_back_buffer = memnew(RasterizerCanvas::Item::CopyBackBuffer);
} else {
memdelete(canvas_item->copy_back_buffer);
- canvas_item->copy_back_buffer = NULL;
+ canvas_item->copy_back_buffer = nullptr;
}
}
diff --git a/servers/rendering/rendering_server_canvas.h b/servers/rendering/rendering_server_canvas.h
index c79b74f287..9da11462db 100644
--- a/servers/rendering/rendering_server_canvas.h
+++ b/servers/rendering/rendering_server_canvas.h
@@ -59,7 +59,7 @@ public:
Item() {
children_order_dirty = true;
- E = NULL;
+ E = nullptr;
z_index = 0;
modulate = Color(1, 1, 1, 1);
self_modulate = Color(1, 1, 1, 1);
diff --git a/servers/rendering/rendering_server_globals.cpp b/servers/rendering/rendering_server_globals.cpp
index 251cf64184..5a270520a9 100644
--- a/servers/rendering/rendering_server_globals.cpp
+++ b/servers/rendering/rendering_server_globals.cpp
@@ -30,11 +30,11 @@
#include "rendering_server_globals.h"
-RasterizerStorage *RenderingServerGlobals::storage = NULL;
-RasterizerCanvas *RenderingServerGlobals::canvas_render = NULL;
-RasterizerScene *RenderingServerGlobals::scene_render = NULL;
-Rasterizer *RenderingServerGlobals::rasterizer = NULL;
+RasterizerStorage *RenderingServerGlobals::storage = nullptr;
+RasterizerCanvas *RenderingServerGlobals::canvas_render = nullptr;
+RasterizerScene *RenderingServerGlobals::scene_render = nullptr;
+Rasterizer *RenderingServerGlobals::rasterizer = nullptr;
-RenderingServerCanvas *RenderingServerGlobals::canvas = NULL;
-RenderingServerViewport *RenderingServerGlobals::viewport = NULL;
-RenderingServerScene *RenderingServerGlobals::scene = NULL;
+RenderingServerCanvas *RenderingServerGlobals::canvas = nullptr;
+RenderingServerViewport *RenderingServerGlobals::viewport = nullptr;
+RenderingServerScene *RenderingServerGlobals::scene = nullptr;
diff --git a/servers/rendering/rendering_server_raster.h b/servers/rendering/rendering_server_raster.h
index d69968868e..7c18bf91ce 100644
--- a/servers/rendering/rendering_server_raster.h
+++ b/servers/rendering/rendering_server_raster.h
@@ -527,7 +527,8 @@ public:
BIND9(environment_set_ssao, RID, bool, float, float, float, float, float, EnvironmentSSAOBlur, float)
BIND2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool)
- BIND12(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, bool)
+ BIND11(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float)
+ BIND1(environment_glow_set_use_bicubic_upscale, bool)
BIND9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float)
diff --git a/servers/rendering/rendering_server_scene.cpp b/servers/rendering/rendering_server_scene.cpp
index 04e4b8dace..65823e11aa 100644
--- a/servers/rendering/rendering_server_scene.cpp
+++ b/servers/rendering/rendering_server_scene.cpp
@@ -194,7 +194,7 @@ void *RenderingServerScene::_instance_pair(void *p_self, OctreeElementID, Instan
return gi_probe->lights.insert(A);
}
- return NULL;
+ return nullptr;
}
void RenderingServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *udata) {
@@ -375,7 +375,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) {
#endif
if (instance->scenario && light->D) {
instance->scenario->directional_lights.erase(light->D);
- light->D = NULL;
+ light->D = nullptr;
}
RSG::scene_render->free(light->instance);
} break;
@@ -416,7 +416,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) {
Instance *capture = (Instance *)instance->lightmap_capture;
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(capture->base_data);
lightmap_capture->users.erase(instance);
- instance->lightmap_capture = NULL;
+ instance->lightmap_capture = nullptr;
instance->lightmap = RID();
}
@@ -429,7 +429,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) {
if (instance->base_data) {
memdelete(instance->base_data);
- instance->base_data = NULL;
+ instance->base_data = nullptr;
}
instance->blend_values.clear();
@@ -533,7 +533,7 @@ void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario)
#endif
if (light->D) {
instance->scenario->directional_lights.erase(light->D);
- light->D = NULL;
+ light->D = nullptr;
}
} break;
case RS::INSTANCE_REFLECTION_PROBE: {
@@ -564,7 +564,7 @@ void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario)
}
}
- instance->scenario = NULL;
+ instance->scenario = nullptr;
}
if (p_scenario.is_valid()) {
@@ -720,7 +720,7 @@ void RenderingServerScene::instance_set_use_lightmap(RID p_instance, RID p_light
InstanceLightmapCaptureData *lightmap_capture = static_cast<InstanceLightmapCaptureData *>(((Instance *)instance->lightmap_capture)->base_data);
lightmap_capture->users.erase(instance);
instance->lightmap = RID();
- instance->lightmap_capture = NULL;
+ instance->lightmap_capture = nullptr;
}
if (p_lightmap_instance.is_valid()) {
@@ -744,16 +744,16 @@ void RenderingServerScene::instance_set_custom_aabb(RID p_instance, AABB p_aabb)
if (p_aabb != AABB()) {
// Set custom AABB
- if (instance->custom_aabb == NULL)
+ if (instance->custom_aabb == nullptr)
instance->custom_aabb = memnew(AABB);
*instance->custom_aabb = p_aabb;
} else {
// Clear custom AABB
- if (instance->custom_aabb != NULL) {
+ if (instance->custom_aabb != nullptr) {
memdelete(instance->custom_aabb);
- instance->custom_aabb = NULL;
+ instance->custom_aabb = nullptr;
}
}
@@ -2259,7 +2259,7 @@ void RenderingServerScene::render_empty_scene(RID p_render_buffers, RID p_scenar
else
environment = scenario->fallback_environment;
RENDER_TIMESTAMP("Render Empty Scene ");
- RSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, NULL, 0, NULL, 0, NULL, 0, NULL, 0, environment, RID(), p_shadow_atlas, scenario->reflection_atlas, RID(), 0);
+ RSG::scene_render->render_scene(p_render_buffers, Transform(), CameraMatrix(), true, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, environment, RID(), p_shadow_atlas, scenario->reflection_atlas, RID(), 0);
#endif
}
@@ -2827,7 +2827,7 @@ bool RenderingServerScene::free(RID p_rid) {
return true;
}
-RenderingServerScene *RenderingServerScene::singleton = NULL;
+RenderingServerScene *RenderingServerScene::singleton = nullptr;
RenderingServerScene::RenderingServerScene() {
diff --git a/servers/rendering/rendering_server_scene.h b/servers/rendering/rendering_server_scene.h
index 9e09136216..41641b7c75 100644
--- a/servers/rendering/rendering_server_scene.h
+++ b/servers/rendering/rendering_server_scene.h
@@ -196,7 +196,7 @@ public:
update_item(this) {
octree_id = 0;
- scenario = NULL;
+ scenario = nullptr;
update_aabb = false;
update_dependencies = false;
@@ -213,9 +213,9 @@ public:
last_render_pass = 0;
last_frame_pass = 0;
version = 1;
- base_data = NULL;
+ base_data = nullptr;
- custom_aabb = NULL;
+ custom_aabb = nullptr;
}
~Instance() {
@@ -301,9 +301,9 @@ public:
InstanceLightData() {
shadow_dirty = true;
- D = NULL;
+ D = nullptr;
last_version = 0;
- baked_light = NULL;
+ baked_light = nullptr;
}
};
diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp
index f80b914760..aa65101ddf 100644
--- a/servers/rendering/rendering_server_viewport.cpp
+++ b/servers/rendering/rendering_server_viewport.cpp
@@ -67,7 +67,7 @@ void RenderingServerViewport::_draw_3d(Viewport *p_viewport, ARVRInterface::Eyes
RENDER_TIMESTAMP(">Begin Rendering 3D Scene");
Ref<ARVRInterface> arvr_interface;
- if (ARVRServer::get_singleton() != NULL) {
+ if (ARVRServer::get_singleton() != nullptr) {
arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
}
@@ -128,9 +128,9 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface
Map<Viewport::CanvasKey, Viewport::CanvasData *> canvas_map;
Rect2 clip_rect(0, 0, p_viewport->size.x, p_viewport->size.y);
- RasterizerCanvas::Light *lights = NULL;
- RasterizerCanvas::Light *lights_with_shadow = NULL;
- RasterizerCanvas::Light *lights_with_mask = NULL;
+ RasterizerCanvas::Light *lights = nullptr;
+ RasterizerCanvas::Light *lights_with_shadow = nullptr;
+ RasterizerCanvas::Light *lights_with_mask = nullptr;
Rect2 shadow_rect;
int light_count = 0;
@@ -160,7 +160,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface
cl->filter_next_ptr = lights;
lights = cl;
- // cl->texture_cache = NULL;
+ // cl->texture_cache = nullptr;
Transform2D scale;
scale.scale(cl->rect_cache.size);
scale.elements[2] = cl->rect_cache.position;
@@ -169,7 +169,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface
if (cl->use_shadow) {
cl->shadows_next_ptr = lights_with_shadow;
- if (lights_with_shadow == NULL) {
+ if (lights_with_shadow == nullptr) {
shadow_rect = cl->xform_cache.xform(cl->rect_cache);
} else {
shadow_rect = shadow_rect.merge(cl->xform_cache.xform(cl->rect_cache));
@@ -196,7 +196,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface
if (lights_with_shadow) {
//update shadows if any
- RasterizerCanvas::LightOccluderInstance *occluders = NULL;
+ RasterizerCanvas::LightOccluderInstance *occluders = nullptr;
RENDER_TIMESTAMP(">Render 2D Shadows");
RENDER_TIMESTAMP("Cull Occluders");
@@ -249,7 +249,7 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface
Transform2D xform = _canvas_get_transform(p_viewport, canvas, E->get(), clip_rect.size);
- RasterizerCanvas::Light *canvas_lights = NULL;
+ RasterizerCanvas::Light *canvas_lights = nullptr;
RasterizerCanvas::Light *ptr = lights;
while (ptr) {
@@ -297,7 +297,7 @@ void RenderingServerViewport::draw_viewports() {
// get our arvr interface in case we need it
Ref<ARVRInterface> arvr_interface;
- if (ARVRServer::get_singleton() != NULL) {
+ if (ARVRServer::get_singleton() != nullptr) {
arvr_interface = ARVRServer::get_singleton()->get_primary_interface();
// process all our active interfaces
diff --git a/servers/rendering/rendering_server_wrap_mt.cpp b/servers/rendering/rendering_server_wrap_mt.cpp
index 5d6d523901..aa3bf583c7 100644
--- a/servers/rendering/rendering_server_wrap_mt.cpp
+++ b/servers/rendering/rendering_server_wrap_mt.cpp
@@ -132,7 +132,7 @@ void RenderingServerWrapMT::finish() {
Thread::wait_to_finish(thread);
memdelete(thread);
- thread = NULL;
+ thread = nullptr;
} else {
rendering_server->finish();
}
@@ -168,7 +168,7 @@ void RenderingServerWrapMT::set_use_vsync_callback(bool p_enable) {
singleton_mt->call_set_use_vsync(p_enable);
}
-RenderingServerWrapMT *RenderingServerWrapMT::singleton_mt = NULL;
+RenderingServerWrapMT *RenderingServerWrapMT::singleton_mt = nullptr;
RenderingServerWrapMT::RenderingServerWrapMT(RenderingServer *p_contained, bool p_create_thread) :
command_queue(p_create_thread) {
@@ -178,7 +178,7 @@ RenderingServerWrapMT::RenderingServerWrapMT(RenderingServer *p_contained, bool
rendering_server = p_contained;
create_thread = p_create_thread;
- thread = NULL;
+ thread = nullptr;
draw_pending = 0;
draw_thread_up = false;
pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc");
diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h
index ee4065094b..bcd1344f44 100644
--- a/servers/rendering/rendering_server_wrap_mt.h
+++ b/servers/rendering/rendering_server_wrap_mt.h
@@ -442,7 +442,8 @@ public:
FUNC2(environment_set_ssao_quality, EnvironmentSSAOQuality, bool)
- FUNC12(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float, bool)
+ FUNC11(environment_set_glow, RID, bool, int, float, float, float, float, EnvironmentGlowBlendMode, float, float, float)
+ FUNC1(environment_glow_set_use_bicubic_upscale, bool)
FUNC9(environment_set_tonemap, RID, EnvironmentToneMapper, float, float, bool, float, float, float, float)
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index cf2a01c07c..76a81a4a1c 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -328,7 +328,7 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = {
{ TK_REPEAT_ENABLE, "repeat_enable" },
{ TK_REPEAT_DISABLE, "repeat_disable" },
{ TK_SHADER_TYPE, "shader_type" },
- { TK_ERROR, NULL }
+ { TK_ERROR, nullptr }
};
ShaderLanguage::Token ShaderLanguage::_get_token() {
@@ -879,7 +879,7 @@ void ShaderLanguage::clear() {
current_function = StringName();
completion_type = COMPLETION_NONE;
- completion_block = NULL;
+ completion_block = nullptr;
completion_function = StringName();
completion_class = SubClassTag::TAG_GLOBAL;
completion_struct = StringName();
@@ -913,7 +913,7 @@ bool ShaderLanguage::_find_identifier(const BlockNode *p_block, bool p_allow_rea
return true;
}
- FunctionNode *function = NULL;
+ FunctionNode *function = nullptr;
while (p_block) {
@@ -2107,14 +2107,14 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = {
//array
{ "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, true },
- { NULL, TYPE_VOID, { TYPE_VOID }, TAG_GLOBAL, false }
+ { nullptr, TYPE_VOID, { TYPE_VOID }, TAG_GLOBAL, false }
};
const ShaderLanguage::BuiltinFuncOutArgs ShaderLanguage::builtin_func_out_args[] = {
//constructors
{ "modf", 1 },
- { NULL, 0 }
+ { nullptr, 0 }
};
bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str) {
@@ -3150,7 +3150,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
while (true) {
- Node *expr = NULL;
+ Node *expr = nullptr;
TkPos prepos = _get_tkpos();
Token tk = _get_token();
TkPos pos = _get_tkpos();
@@ -3162,14 +3162,14 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
expr = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!expr)
- return NULL;
+ return nullptr;
tk = _get_token();
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' in expression");
- return NULL;
+ return nullptr;
}
} else if (tk.type == TK_REAL_CONSTANT) {
@@ -3214,7 +3214,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
//make sure void is not used in expression
_set_error("Void value not allowed in Expression");
- return NULL;
+ return nullptr;
} else if (is_token_nonvoid_datatype(tk.type)) {
//basic type constructor
@@ -3234,7 +3234,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '(' after type name");
- return NULL;
+ return nullptr;
}
int carg = -1;
@@ -3250,11 +3250,11 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
if (!ok)
- return NULL;
+ return nullptr;
if (!_validate_function_call(p_block, p_builtin_types, func, &func->return_cache, &func->struct_name)) {
_set_error("No matching constructor found for: '" + String(funcname->name) + "'");
- return NULL;
+ return nullptr;
}
expr = _reduce_expression(p_block, func);
@@ -3265,7 +3265,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
StringName identifier;
- StructNode *pstruct = NULL;
+ StructNode *pstruct = nullptr;
bool struct_init = false;
_get_completable_identifier(p_block, COMPLETION_IDENTIFIER, identifier);
@@ -3317,7 +3317,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
} else {
if (!is_token_variable_datatype(tk.type)) {
_set_error("Invalid data type for array");
- return NULL;
+ return nullptr;
}
type2 = get_token_datatype(tk.type);
}
@@ -3335,7 +3335,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!n || n->type != Node::TYPE_CONSTANT || n->get_datatype() != TYPE_INT) {
_set_error("Expected single integer constant > 0");
- return NULL;
+ return nullptr;
}
ConstantNode *cnode = (ConstantNode *)n;
@@ -3343,24 +3343,24 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
array_size2 = cnode->values[0].sint;
if (array_size2 <= 0) {
_set_error("Expected single integer constant > 0");
- return NULL;
+ return nullptr;
}
} else {
_set_error("Expected single integer constant > 0");
- return NULL;
+ return nullptr;
}
tk = _get_token();
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']'");
- return NULL;
+ return nullptr;
} else {
tk = _get_token();
}
}
} else {
_set_error("Expected '['");
- return NULL;
+ return nullptr;
}
if (type != type2 || struct_name != struct_name2 || array_size != array_size2) {
@@ -3383,7 +3383,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
error_str += itos(array_size);
error_str += "]'";
_set_error(error_str);
- return NULL;
+ return nullptr;
}
}
@@ -3396,12 +3396,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!n) {
- return NULL;
+ return nullptr;
}
if (type != n->get_datatype() || struct_name != n->get_datatype_name()) {
_set_error("Invalid assignment of '" + (n->get_datatype() == TYPE_STRUCT ? n->get_datatype_name() : get_datatype_name(n->get_datatype())) + "' to '" + (type == TYPE_STRUCT ? struct_name : get_datatype_name(type)) + "'");
- return NULL;
+ return nullptr;
}
tk = _get_token();
@@ -3419,30 +3419,30 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
_set_error("Expected '}' or ','");
else
_set_error("Expected ')' or ','");
- return NULL;
+ return nullptr;
}
}
if (an->initializer.size() != array_size) {
_set_error("Array size mismatch");
- return NULL;
+ return nullptr;
}
} else {
_set_error("Expected array initialization!");
- return NULL;
+ return nullptr;
}
nexpr = an;
} else {
nexpr = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!nexpr) {
- return NULL;
+ return nullptr;
}
Node *node = pstruct->members[i];
if (!_compare_datatypes_in_nodes(pstruct->members[i], nexpr)) {
String type_name = nexpr->get_datatype() == TYPE_STRUCT ? nexpr->get_datatype_name() : get_datatype_name(nexpr->get_datatype());
String type_name2 = node->get_datatype() == TYPE_STRUCT ? node->get_datatype_name() : get_datatype_name(node->get_datatype());
_set_error("Invalid assignment of '" + type_name + "' to '" + type_name2 + "'");
- return NULL;
+ return nullptr;
}
}
@@ -3450,7 +3450,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_COMMA) {
_set_error("Expected ','");
- return NULL;
+ return nullptr;
}
}
func->arguments.push_back(nexpr);
@@ -3458,7 +3458,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')'");
- return NULL;
+ return nullptr;
}
expr = func;
@@ -3482,7 +3482,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
while (bnode) {
if (bnode->variables.has(name)) {
_set_error("Expected function name");
- return NULL;
+ return nullptr;
}
bnode = bnode->parent_block;
}
@@ -3514,11 +3514,11 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
if (!ok)
- return NULL;
+ return nullptr;
if (!_validate_function_call(p_block, p_builtin_types, func, &func->return_cache, &func->struct_name)) {
_set_error("No matching function found for: '" + String(funcname->name) + "'");
- return NULL;
+ return nullptr;
}
completion_class = TAG_GLOBAL; // reset sub-class
if (function_index >= 0) {
@@ -3529,7 +3529,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (call_function) {
//get current base function
- FunctionNode *base_function = NULL;
+ FunctionNode *base_function = nullptr;
{
BlockNode *b = p_block;
@@ -3544,7 +3544,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
}
- ERR_FAIL_COND_V(!base_function, NULL); //bug, wtf
+ ERR_FAIL_COND_V(!base_function, nullptr); //bug, wtf
for (int i = 0; i < call_function->arguments.size(); i++) {
int argidx = i + 1;
@@ -3556,7 +3556,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
error = true;
} else if (n->type == Node::TYPE_ARRAY) {
ArrayNode *an = static_cast<ArrayNode *>(n);
- if (an->call_expression != NULL) {
+ if (an->call_expression != nullptr) {
error = true;
}
} else if (n->type == Node::TYPE_VARIABLE) {
@@ -3584,7 +3584,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
if (error) {
_set_error(vformat("Constant value cannot be passed for '%s' parameter!", _get_qualifier_str(call_function->arguments[i].qualifier)));
- return NULL;
+ return nullptr;
}
}
if (is_sampler_type(call_function->arguments[i].type)) {
@@ -3599,12 +3599,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
ERR_CONTINUE(u->type != call_function->arguments[i].type); //this should have been validated previously
//propagate
if (!_propagate_function_call_sampler_uniform_settings(name, i, u->filter, u->repeat)) {
- return NULL;
+ return nullptr;
}
} else if (p_builtin_types.has(varname)) {
//a built-in
if (!_propagate_function_call_sampler_builtin_reference(name, i, varname)) {
- return NULL;
+ return nullptr;
}
} else {
//or this comes from an argument, but nothing else can be a sampler
@@ -3653,30 +3653,30 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
if (!found) {
_set_error("Unknown identifier in expression: " + String(identifier));
- return NULL;
+ return nullptr;
}
} else {
if (!_find_identifier(p_block, false, p_builtin_types, identifier, &data_type, &ident_type, &is_const, &array_size, &struct_name)) {
_set_error("Unknown identifier in expression: " + String(identifier));
- return NULL;
+ return nullptr;
}
if (ident_type == IDENTIFIER_FUNCTION) {
_set_error("Can't use function as identifier: " + String(identifier));
- return NULL;
+ return nullptr;
}
}
- Node *index_expression = NULL;
- Node *call_expression = NULL;
+ Node *index_expression = nullptr;
+ Node *call_expression = nullptr;
if (array_size > 0) {
tk = _get_token();
if (tk.type != TK_BRACKET_OPEN && tk.type != TK_PERIOD) {
_set_error("Expected '[' or '.'");
- return NULL;
+ return nullptr;
}
if (tk.type == TK_PERIOD) {
@@ -3685,17 +3685,17 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
call_expression = _parse_and_reduce_expression(p_block, p_builtin_types);
p_block->block_tag = SubClassTag::TAG_GLOBAL;
if (!call_expression)
- return NULL;
+ return nullptr;
data_type = call_expression->get_datatype();
} else { // indexing
index_expression = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!index_expression)
- return NULL;
+ return nullptr;
if (index_expression->get_datatype() != TYPE_INT && index_expression->get_datatype() != TYPE_UINT) {
_set_error("Only integer expressions are allowed for indexing");
- return NULL;
+ return nullptr;
}
if (index_expression->type == Node::TYPE_CONSTANT) {
@@ -3705,7 +3705,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
int value = cnode->values[0].sint;
if (value < 0 || value >= array_size) {
_set_error(vformat("Index [%s] out of range [%s..%s]", value, 0, array_size - 1));
- return NULL;
+ return nullptr;
}
}
}
@@ -3714,7 +3714,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']'");
- return NULL;
+ return nullptr;
}
}
@@ -3750,18 +3750,18 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
case TK_OP_BIT_INVERT: e.op = OP_BIT_INVERT; break;
case TK_OP_INCREMENT: e.op = OP_INCREMENT; break;
case TK_OP_DECREMENT: e.op = OP_DECREMENT; break;
- default: ERR_FAIL_V(NULL);
+ default: ERR_FAIL_V(nullptr);
}
expression.push_back(e);
continue;
} else {
_set_error("Expected expression, found: " + get_token_text(tk));
- return NULL;
+ return nullptr;
//nothing
}
- ERR_FAIL_COND_V(!expr, NULL);
+ ERR_FAIL_COND_V(!expr, nullptr);
/* OK now see what's NEXT to the operator.. */
/* OK now see what's NEXT to the operator.. */
@@ -3791,7 +3791,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (identifier == StringName()) {
_set_error("Expected identifier as member");
- return NULL;
+ return nullptr;
}
String ident = identifier;
@@ -4042,12 +4042,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (mix_error) {
_set_error("Cannot combine symbols from different sets in expression ." + ident);
- return NULL;
+ return nullptr;
}
if (!ok) {
_set_error("Invalid member for " + (dt == TYPE_STRUCT ? st : get_datatype_name(dt)) + " expression: ." + ident);
- return NULL;
+ return nullptr;
}
MemberNode *mn = alloc_node<MemberNode>();
@@ -4066,16 +4066,16 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type == TK_PERIOD) {
_set_error("Nested array length() is not yet implemented");
- return NULL;
+ return nullptr;
} else if (tk.type == TK_BRACKET_OPEN) {
Node *index_expression = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!index_expression)
- return NULL;
+ return nullptr;
if (index_expression->get_datatype() != TYPE_INT && index_expression->get_datatype() != TYPE_UINT) {
_set_error("Only integer expressions are allowed for indexing");
- return NULL;
+ return nullptr;
}
if (index_expression->type == Node::TYPE_CONSTANT) {
@@ -4085,7 +4085,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
int value = cnode->values[0].sint;
if (value < 0 || value >= array_size) {
_set_error(vformat("Index [%s] out of range [%s..%s]", value, 0, array_size - 1));
- return NULL;
+ return nullptr;
}
}
}
@@ -4094,13 +4094,13 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']'");
- return NULL;
+ return nullptr;
}
mn->index_expression = index_expression;
} else {
_set_error("Expected '[' or '.'");
- return NULL;
+ return nullptr;
}
}
@@ -4120,11 +4120,11 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
Node *index = _parse_and_reduce_expression(p_block, p_builtin_types);
if (!index)
- return NULL;
+ return nullptr;
if (index->get_datatype() != TYPE_INT && index->get_datatype() != TYPE_UINT) {
_set_error("Only integer datatypes are allowed for indexing");
- return NULL;
+ return nullptr;
}
DataType member_type = TYPE_VOID;
@@ -4139,7 +4139,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
uint32_t index_constant = static_cast<ConstantNode *>(index)->values[0].uint;
if (index_constant >= 2) {
_set_error("Index out of range (0-1)");
- return NULL;
+ return nullptr;
}
}
@@ -4162,7 +4162,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
uint32_t index_constant = static_cast<ConstantNode *>(index)->values[0].uint;
if (index_constant >= 3) {
_set_error("Index out of range (0-2)");
- return NULL;
+ return nullptr;
}
}
@@ -4184,7 +4184,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
uint32_t index_constant = static_cast<ConstantNode *>(index)->values[0].uint;
if (index_constant >= 4) {
_set_error("Index out of range (0-3)");
- return NULL;
+ return nullptr;
}
}
@@ -4199,7 +4199,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
break;
default: {
_set_error("Object of type '" + (expr->get_datatype() == TYPE_STRUCT ? expr->get_datatype_name() : get_datatype_name(expr->get_datatype())) + "' can't be indexed");
- return NULL;
+ return nullptr;
}
}
@@ -4213,7 +4213,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
tk = _get_token();
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']' after indexing expression");
- return NULL;
+ return nullptr;
}
} else if (tk.type == TK_OP_INCREMENT || tk.type == TK_OP_DECREMENT) {
@@ -4224,12 +4224,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (!_validate_operator(op, &op->return_cache)) {
_set_error("Invalid base type for increment/decrement operator");
- return NULL;
+ return nullptr;
}
if (!_validate_assign(expr, p_builtin_types)) {
_set_error("Invalid use of increment/decrement operator in constant expression.");
- return NULL;
+ return nullptr;
}
expr = op;
} else {
@@ -4287,7 +4287,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
case TK_COLON: o.op = OP_SELECT_ELSE; break;
default: {
_set_error("Invalid token for operator: " + get_token_text(tk));
- return NULL;
+ return nullptr;
}
}
@@ -4379,7 +4379,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
break;
default:
- ERR_FAIL_V(NULL); //unexpected operator
+ ERR_FAIL_V(nullptr); //unexpected operator
}
if (priority < min_priority) {
@@ -4392,7 +4392,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
}
- ERR_FAIL_COND_V(next_op == -1, NULL);
+ ERR_FAIL_COND_V(next_op == -1, nullptr);
// OK! create operator..
// OK! create operator..
@@ -4405,7 +4405,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (expr_pos == expression.size()) {
//can happen..
_set_error("Unexpected end of expression...");
- return NULL;
+ return nullptr;
}
}
@@ -4417,7 +4417,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if ((op->op == OP_INCREMENT || op->op == OP_DECREMENT) && !_validate_assign(expression[i + 1].node, p_builtin_types)) {
_set_error("Can't use increment/decrement operator in constant expression.");
- return NULL;
+ return nullptr;
}
op->arguments.push_back(expression[i + 1].node);
@@ -4433,7 +4433,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
at += get_datatype_name(op->arguments[j]->get_datatype());
}
_set_error("Invalid arguments to unary operator '" + get_operator_text(op->op) + "' :" + at);
- return NULL;
+ return nullptr;
}
expression.remove(i + 1);
}
@@ -4442,12 +4442,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (next_op + 2 >= expression.size() || !expression[next_op + 2].is_op || expression[next_op + 2].op != OP_SELECT_ELSE) {
_set_error("Missing matching ':' for select operator");
- return NULL;
+ return nullptr;
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -4467,7 +4467,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
at += get_datatype_name(op->arguments[i]->get_datatype());
}
_set_error("Invalid argument to ternary ?: operator: " + at);
- return NULL;
+ return nullptr;
}
for (int i = 0; i < 4; i++) {
@@ -4478,7 +4478,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -4487,7 +4487,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (_is_operator_assign(op->op)) {
@@ -4496,7 +4496,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
if (!_validate_assign(expression[next_op - 1].node, p_builtin_types, &assign_message)) {
_set_error(assign_message);
- return NULL;
+ return nullptr;
}
}
@@ -4528,7 +4528,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
}
}
_set_error("Invalid arguments to operator '" + get_operator_text(op->op) + "' :" + at);
- return NULL;
+ return nullptr;
}
expression.remove(next_op);
@@ -4658,7 +4658,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_and_reduce_expression(BlockNode *p_
ShaderLanguage::Node *expr = _parse_expression(p_block, p_builtin_types);
if (!expr) //errored
- return NULL;
+ return nullptr;
expr = _reduce_expression(p_block, expr);
@@ -4741,7 +4741,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
tk = _get_token();
- Node *vardecl = NULL;
+ Node *vardecl = nullptr;
while (true) {
@@ -4752,7 +4752,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
StringName name = tk.text;
ShaderLanguage::IdentifierType itype;
- if (_find_identifier(p_block, true, p_builtin_types, name, (ShaderLanguage::DataType *)0, &itype)) {
+ if (_find_identifier(p_block, true, p_builtin_types, name, (ShaderLanguage::DataType *)nullptr, &itype)) {
if (itype != IDENTIFIER_FUNCTION) {
_set_error("Redefinition of '" + String(name) + "'");
return ERR_PARSE_ERROR;
@@ -5025,7 +5025,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
VariableDeclarationNode::Declaration decl;
decl.name = name;
- decl.initializer = NULL;
+ decl.initializer = nullptr;
//variable created with assignment! must parse an expression
Node *n = _parse_and_reduce_expression(p_block, p_builtin_types);
@@ -5061,7 +5061,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
VariableDeclarationNode::Declaration decl;
decl.name = name;
- decl.initializer = NULL;
+ decl.initializer = nullptr;
node->declarations.push_back(decl);
}
@@ -5070,6 +5070,10 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
p_block->variables[name] = var;
if (tk.type == TK_COMMA) {
+ if (p_block->block_type == BlockNode::BLOCK_TYPE_FOR) {
+ _set_error("Multiple declarations in 'for' loop are not implemented yet.");
+ return ERR_PARSE_ERROR;
+ }
tk = _get_token();
//another variable
} else if (tk.type == TK_SEMICOLON) {
@@ -5322,7 +5326,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
// while() {}
bool is_do = tk.type == TK_CF_DO;
- BlockNode *do_block = NULL;
+ BlockNode *do_block = nullptr;
if (is_do) {
do_block = alloc_node<BlockNode>();
@@ -5394,6 +5398,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui
cf->flow_op = FLOW_OP_FOR;
BlockNode *init_block = alloc_node<BlockNode>();
+ init_block->block_type = BlockNode::BLOCK_TYPE_FOR;
init_block->parent_block = p_block;
init_block->single_statement = true;
cf->blocks.push_back(init_block);
@@ -5689,7 +5694,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
while (true) {
StringName mode;
- _get_completable_identifier(NULL, COMPLETION_RENDER_MODE, mode);
+ _get_completable_identifier(nullptr, COMPLETION_RENDER_MODE, mode);
if (mode == StringName()) {
_set_error("Expected identifier for render mode");
@@ -5893,7 +5898,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
name = tk.text;
- if (_find_identifier(NULL, false, Map<StringName, BuiltInInfo>(), name)) {
+ if (_find_identifier(nullptr, false, Map<StringName, BuiltInInfo>(), name)) {
_set_error("Redefinition of '" + String(name) + "'");
return ERR_PARSE_ERROR;
}
@@ -6069,7 +6074,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
if (tk.type == TK_OP_ASSIGN) {
- Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>());
+ Node *expr = _parse_and_reduce_expression(nullptr, Map<StringName, BuiltInInfo>());
if (!expr)
return ERR_PARSE_ERROR;
if (expr->type != Node::TYPE_CONSTANT) {
@@ -6186,14 +6191,14 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
}
_set_tkpos(prev_pos);
- _get_completable_identifier(NULL, COMPLETION_MAIN_FUNCTION, name);
+ _get_completable_identifier(nullptr, COMPLETION_MAIN_FUNCTION, name);
if (name == StringName()) {
_set_error("Expected function name after datatype");
return ERR_PARSE_ERROR;
}
- if (_find_identifier(NULL, false, Map<StringName, BuiltInInfo>(), name)) {
+ if (_find_identifier(nullptr, false, Map<StringName, BuiltInInfo>(), name)) {
_set_error("Redefinition of '" + String(name) + "'");
return ERR_PARSE_ERROR;
}
@@ -6217,7 +6222,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
constant.type = is_struct ? TYPE_STRUCT : type;
constant.type_str = struct_name;
constant.precision = precision;
- constant.initializer = NULL;
+ constant.initializer = nullptr;
if (tk.type == TK_OP_ASSIGN) {
@@ -6227,7 +6232,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
}
//variable created with assignment! must parse an expression
- Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>());
+ Node *expr = _parse_and_reduce_expression(nullptr, Map<StringName, BuiltInInfo>());
if (!expr)
return ERR_PARSE_ERROR;
if (expr->type == Node::TYPE_OPERATOR && ((OperatorNode *)expr)->op == OP_CALL) {
@@ -6261,7 +6266,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
}
name = tk.text;
- if (_find_identifier(NULL, false, Map<StringName, BuiltInInfo>(), name)) {
+ if (_find_identifier(nullptr, false, Map<StringName, BuiltInInfo>(), name)) {
_set_error("Redefinition of '" + String(name) + "'");
return ERR_PARSE_ERROR;
}
@@ -6400,7 +6405,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
pname = tk.text;
ShaderLanguage::IdentifierType itype;
- if (_find_identifier(func_node->body, false, builtin_types, pname, (ShaderLanguage::DataType *)0, &itype)) {
+ if (_find_identifier(func_node->body, false, builtin_types, pname, (ShaderLanguage::DataType *)nullptr, &itype)) {
if (itype != IDENTIFIER_FUNCTION) {
_set_error("Redefinition of '" + String(pname) + "'");
return ERR_PARSE_ERROR;
@@ -6640,7 +6645,7 @@ Error ShaderLanguage::compile(const String &p_code, const Map<StringName, Functi
code = p_code;
- nodes = NULL;
+ nodes = nullptr;
shader = alloc_node<ShaderNode>();
Error err = _parse_shader(p_functions, p_render_modes, p_shader_types);
@@ -6657,7 +6662,7 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
code = p_code;
- nodes = NULL;
+ nodes = nullptr;
shader = alloc_node<ShaderNode>();
_parse_shader(p_functions, p_render_modes, p_shader_types);
@@ -6996,7 +7001,7 @@ ShaderLanguage::ShaderNode *ShaderLanguage::get_shader() {
ShaderLanguage::ShaderLanguage() {
- nodes = NULL;
+ nodes = nullptr;
completion_class = TAG_GLOBAL;
}
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index bdc15cc4aa..beabae0dda 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -342,7 +342,7 @@ public:
virtual String get_datatype_name() const { return ""; }
Node(Type t) :
- next(NULL),
+ next(nullptr),
type(t) {}
virtual ~Node() {}
};
@@ -423,8 +423,8 @@ public:
ArrayNode() :
Node(TYPE_ARRAY),
datatype_cache(TYPE_VOID),
- index_expression(NULL),
- call_expression(NULL),
+ index_expression(nullptr),
+ call_expression(nullptr),
is_const(false) {}
};
@@ -487,6 +487,7 @@ public:
enum BlockType {
BLOCK_TYPE_STANDART,
+ BLOCK_TYPE_FOR,
BLOCK_TYPE_SWITCH,
BLOCK_TYPE_CASE,
BLOCK_TYPE_DEFAULT,
@@ -510,8 +511,8 @@ public:
BlockNode() :
Node(TYPE_BLOCK),
- parent_function(NULL),
- parent_block(NULL),
+ parent_function(nullptr),
+ parent_block(nullptr),
block_type(BLOCK_TYPE_STANDART),
block_tag(SubClassTag::TAG_GLOBAL),
single_statement(false) {}
@@ -549,8 +550,8 @@ public:
basetype_const(false),
datatype(TYPE_VOID),
array_size(0),
- owner(NULL),
- index_expression(NULL),
+ owner(nullptr),
+ index_expression(nullptr),
has_swizzling_duplicates(false) {}
};
@@ -591,7 +592,7 @@ public:
Node(TYPE_FUNCTION),
return_type(TYPE_VOID),
return_precision(PRECISION_DEFAULT),
- body(NULL),
+ body(nullptr),
can_discard(false) {}
};
@@ -732,7 +733,7 @@ public:
static bool is_token_nonvoid_datatype(TokenType p_type);
static bool is_token_operator(TokenType p_type);
- static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = NULL);
+ static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = nullptr);
static DataType get_scalar_type(DataType p_type);
static int get_cardinality(DataType p_type);
static bool is_scalar_type(DataType p_type);
@@ -824,10 +825,10 @@ private:
IDENTIFIER_CONSTANT,
};
- bool _find_identifier(const BlockNode *p_block, bool p_allow_reassign, const Map<StringName, BuiltInInfo> &p_builtin_types, const StringName &p_identifier, DataType *r_data_type = NULL, IdentifierType *r_type = NULL, bool *r_is_const = NULL, int *r_array_size = NULL, StringName *r_struct_name = NULL);
+ bool _find_identifier(const BlockNode *p_block, bool p_allow_reassign, const Map<StringName, BuiltInInfo> &p_builtin_types, const StringName &p_identifier, DataType *r_data_type = nullptr, IdentifierType *r_type = nullptr, bool *r_is_const = nullptr, int *r_array_size = nullptr, StringName *r_struct_name = nullptr);
bool _is_operator_assign(Operator p_op) const;
- bool _validate_assign(Node *p_node, const Map<StringName, BuiltInInfo> &p_builtin_types, String *r_message = NULL);
- bool _validate_operator(OperatorNode *p_op, DataType *r_ret_type = NULL);
+ bool _validate_assign(Node *p_node, const Map<StringName, BuiltInInfo> &p_builtin_types, String *r_message = nullptr);
+ bool _validate_operator(OperatorNode *p_op, DataType *r_ret_type = nullptr);
struct BuiltinFuncDef {
enum { MAX_ARGS = 5 };
@@ -860,7 +861,7 @@ private:
bool _compare_datatypes_in_nodes(Node *a, Node *b) const;
bool _validate_function_call(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, DataType *r_ret_type, StringName *r_ret_type_str);
- bool _parse_function_arguments(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, int *r_complete_arg = NULL);
+ bool _parse_function_arguments(BlockNode *p_block, const Map<StringName, BuiltInInfo> &p_builtin_types, OperatorNode *p_func, int *r_complete_arg = nullptr);
bool _propagate_function_call_sampler_uniform_settings(StringName p_name, int p_argument, TextureFilter p_filter, TextureRepeat p_repeat);
bool _propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin);
diff --git a/servers/rendering/shader_types.cpp b/servers/rendering/shader_types.cpp
index b144d6d612..ba7b992e51 100644
--- a/servers/rendering/shader_types.cpp
+++ b/servers/rendering/shader_types.cpp
@@ -44,7 +44,7 @@ const Set<String> &ShaderTypes::get_types() {
return shader_types;
}
-ShaderTypes *ShaderTypes::singleton = NULL;
+ShaderTypes *ShaderTypes::singleton = nullptr;
static ShaderLanguage::BuiltInInfo constt(ShaderLanguage::DataType p_type) {
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 084b8f7952..b29fb76b0e 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -33,8 +33,8 @@
#include "core/method_bind_ext.gen.inc"
#include "core/project_settings.h"
-RenderingServer *RenderingServer::singleton = NULL;
-RenderingServer *(*RenderingServer::create_func)() = NULL;
+RenderingServer *RenderingServer::singleton = nullptr;
+RenderingServer *(*RenderingServer::create_func)() = nullptr;
RenderingServer *RenderingServer::get_singleton() {
@@ -43,12 +43,12 @@ RenderingServer *RenderingServer::get_singleton() {
RenderingServer *RenderingServer::create() {
- ERR_FAIL_COND_V(singleton, NULL);
+ ERR_FAIL_COND_V(singleton, nullptr);
if (create_func)
return create_func();
- return NULL;
+ return nullptr;
}
Array RenderingServer::_texture_debug_usage_bind() {
@@ -333,7 +333,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
uint8_t *vw = r_vertex_array.ptrw();
- uint8_t *iw = NULL;
+ uint8_t *iw = nullptr;
if (r_index_array.size()) {
iw = r_index_array.ptrw();
}
@@ -1802,7 +1802,7 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("environment_set_bg_energy", "env", "energy"), &RenderingServer::environment_set_bg_energy);
ClassDB::bind_method(D_METHOD("environment_set_canvas_max_layer", "env", "max_layer"), &RenderingServer::environment_set_canvas_max_layer);
ClassDB::bind_method(D_METHOD("environment_set_ambient_light", "env", "color", "ambient", "energy", "sky_contibution", "reflection_source", "ao_color"), &RenderingServer::environment_set_ambient_light, DEFVAL(RS::ENV_AMBIENT_SOURCE_BG), DEFVAL(1.0), DEFVAL(0.0), DEFVAL(RS::ENV_REFLECTION_SOURCE_BG), DEFVAL(Color()));
- ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap", "bicubic_upscale"), &RenderingServer::environment_set_glow);
+ ClassDB::bind_method(D_METHOD("environment_set_glow", "env", "enable", "level_flags", "intensity", "strength", "mix", "bloom_threshold", "blend_mode", "hdr_bleed_threshold", "hdr_bleed_scale", "hdr_luminance_cap"), &RenderingServer::environment_set_glow);
ClassDB::bind_method(D_METHOD("environment_set_tonemap", "env", "tone_mapper", "exposure", "white", "auto_exposure", "min_luminance", "max_luminance", "auto_exp_speed", "auto_exp_grey"), &RenderingServer::environment_set_tonemap);
ClassDB::bind_method(D_METHOD("environment_set_adjustment", "env", "enable", "brightness", "contrast", "saturation", "ramp"), &RenderingServer::environment_set_adjustment);
ClassDB::bind_method(D_METHOD("environment_set_ssr", "env", "enable", "max_steps", "fade_in", "fade_out", "depth_tolerance", "roughness"), &RenderingServer::environment_set_ssr);
@@ -2355,9 +2355,13 @@ RenderingServer::RenderingServer() {
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/screen_space_roughness_limiter", PropertyInfo(Variant::INT, "rendering/quality/filters/screen_space_roughness_limiter", PROPERTY_HINT_ENUM, "Disabled,Enabled (Small Cost)"));
GLOBAL_DEF("rendering/quality/filters/screen_space_roughness_limiter_curve", 1.0);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/screen_space_roughness_limiter_curve", PropertyInfo(Variant::FLOAT, "rendering/quality/filters/screen_space_roughness_limiter_curve", PROPERTY_HINT_EXP_EASING, "0.01,8,0.01"));
+
+ GLOBAL_DEF("rendering/quality/glow/upscale_mode", 1);
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/glow/upscale_mode", PropertyInfo(Variant::INT, "rendering/quality/glow/upscale_mode", PROPERTY_HINT_ENUM, "Linear (Fast),Bicubic (Slower)"));
+ GLOBAL_DEF("rendering/quality/glow/upscale_mode.mobile", 0);
}
RenderingServer::~RenderingServer() {
- singleton = NULL;
+ singleton = nullptr;
}
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 76f16bd7f6..702a66405a 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -733,7 +733,9 @@ public:
ENV_GLOW_BLEND_MODE_REPLACE,
ENV_GLOW_BLEND_MODE_MIX,
};
- virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, bool p_bicubic_upscale) = 0;
+ virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) = 0;
+
+ virtual void environment_glow_set_use_bicubic_upscale(bool p_enable) = 0;
enum EnvironmentToneMapper {
ENV_TONE_MAPPER_LINEAR,
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 3d41c9d166..95a6902089 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -574,6 +574,8 @@ Files extracted from upstream source:
`vk_enum_string_helper.h` is taken from the matching `Vulkan-ValidationLayers`
SDK release: https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/master/layers/generated/vk_enum_string_helper.h
+Includes custom change to disable MSVC pragma, might be upstreamed via:
+https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/1666
`vk_mem_alloc.h` is taken from https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
Version: 2.3.0
diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
index 5656556db9..5c7ebed788 100644
--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
+++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
@@ -508,7 +508,7 @@ namespace Etc
int iMaxRed1 = iColor1Red + (int)a_uiRadius;
if (iMaxRed1 > 15)
{
- iMinRed1 = 15;
+ iMaxRed1 = 15;
}
int iMinGreen1 = iColor1Green - (int)a_uiRadius;
@@ -519,7 +519,7 @@ namespace Etc
int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
if (iMaxGreen1 > 15)
{
- iMinGreen1 = 15;
+ iMaxGreen1 = 15;
}
int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
@@ -530,7 +530,7 @@ namespace Etc
int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
if (iMaxBlue1 > 15)
{
- iMinBlue1 = 15;
+ iMaxBlue1 = 15;
}
int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
@@ -545,7 +545,7 @@ namespace Etc
int iMaxRed2 = iColor2Red + (int)a_uiRadius;
if (iMaxRed2 > 15)
{
- iMinRed2 = 15;
+ iMaxRed2 = 15;
}
int iMinGreen2 = iColor2Green - (int)a_uiRadius;
@@ -556,7 +556,7 @@ namespace Etc
int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
if (iMaxGreen2 > 15)
{
- iMinGreen2 = 15;
+ iMaxGreen2 = 15;
}
int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
@@ -567,7 +567,7 @@ namespace Etc
int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
if (iMaxBlue2 > 15)
{
- iMinBlue2 = 15;
+ iMaxBlue2 = 15;
}
for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
@@ -761,7 +761,7 @@ namespace Etc
int iMaxRed1 = iColor1Red + (int)a_uiRadius;
if (iMaxRed1 > 15)
{
- iMinRed1 = 15;
+ iMaxRed1 = 15;
}
int iMinGreen1 = iColor1Green - (int)a_uiRadius;
@@ -772,7 +772,7 @@ namespace Etc
int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
if (iMaxGreen1 > 15)
{
- iMinGreen1 = 15;
+ iMaxGreen1 = 15;
}
int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
@@ -783,7 +783,7 @@ namespace Etc
int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
if (iMaxBlue1 > 15)
{
- iMinBlue1 = 15;
+ iMaxBlue1 = 15;
}
int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
@@ -798,7 +798,7 @@ namespace Etc
int iMaxRed2 = iColor2Red + (int)a_uiRadius;
if (iMaxRed2 > 15)
{
- iMinRed2 = 15;
+ iMaxRed2 = 15;
}
int iMinGreen2 = iColor2Green - (int)a_uiRadius;
@@ -809,7 +809,7 @@ namespace Etc
int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
if (iMaxGreen2 > 15)
{
- iMinGreen2 = 15;
+ iMaxGreen2 = 15;
}
int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
@@ -820,7 +820,7 @@ namespace Etc
int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
if (iMaxBlue2 > 15)
{
- iMinBlue2 = 15;
+ iMaxBlue2 = 15;
}
for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
index ba2b42fb05..b94b64e68c 100644
--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
+++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
@@ -847,7 +847,7 @@ namespace Etc
int iMaxRed1 = iColor1Red + (int)a_uiRadius;
if (iMaxRed1 > 15)
{
- iMinRed1 = 15;
+ iMaxRed1 = 15;
}
int iMinGreen1 = iColor1Green - (int)a_uiRadius;
@@ -858,7 +858,7 @@ namespace Etc
int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
if (iMaxGreen1 > 15)
{
- iMinGreen1 = 15;
+ iMaxGreen1 = 15;
}
int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
@@ -869,7 +869,7 @@ namespace Etc
int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
if (iMaxBlue1 > 15)
{
- iMinBlue1 = 15;
+ iMaxBlue1 = 15;
}
int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
@@ -884,7 +884,7 @@ namespace Etc
int iMaxRed2 = iColor2Red + (int)a_uiRadius;
if (iMaxRed2 > 15)
{
- iMinRed2 = 15;
+ iMaxRed2 = 15;
}
int iMinGreen2 = iColor2Green - (int)a_uiRadius;
@@ -895,7 +895,7 @@ namespace Etc
int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
if (iMaxGreen2 > 15)
{
- iMinGreen2 = 15;
+ iMaxGreen2 = 15;
}
int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
@@ -906,7 +906,7 @@ namespace Etc
int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
if (iMaxBlue2 > 15)
{
- iMinBlue2 = 15;
+ iMaxBlue2 = 15;
}
for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
@@ -1108,7 +1108,7 @@ namespace Etc
int iMaxRed1 = iColor1Red + (int)a_uiRadius;
if (iMaxRed1 > 15)
{
- iMinRed1 = 15;
+ iMaxRed1 = 15;
}
int iMinGreen1 = iColor1Green - (int)a_uiRadius;
@@ -1119,7 +1119,7 @@ namespace Etc
int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
if (iMaxGreen1 > 15)
{
- iMinGreen1 = 15;
+ iMaxGreen1 = 15;
}
int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
@@ -1130,7 +1130,7 @@ namespace Etc
int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
if (iMaxBlue1 > 15)
{
- iMinBlue1 = 15;
+ iMaxBlue1 = 15;
}
int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
@@ -1145,7 +1145,7 @@ namespace Etc
int iMaxRed2 = iColor2Red + (int)a_uiRadius;
if (iMaxRed2 > 15)
{
- iMinRed2 = 15;
+ iMaxRed2 = 15;
}
int iMinGreen2 = iColor2Green - (int)a_uiRadius;
@@ -1156,7 +1156,7 @@ namespace Etc
int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
if (iMaxGreen2 > 15)
{
- iMinGreen2 = 15;
+ iMaxGreen2 = 15;
}
int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
@@ -1167,7 +1167,7 @@ namespace Etc
int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
if (iMaxBlue2 > 15)
{
- iMinBlue2 = 15;
+ iMaxBlue2 = 15;
}
for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
diff --git a/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch b/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch
new file mode 100644
index 0000000000..ea9b5640b6
--- /dev/null
+++ b/thirdparty/etc2comp/patches/fix-rgba8-max-channels.patch
@@ -0,0 +1,224 @@
+diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
+index 5656556db9..5c7ebed788 100644
+--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
++++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8.cpp
+@@ -508,7 +508,7 @@ namespace Etc
+ int iMaxRed1 = iColor1Red + (int)a_uiRadius;
+ if (iMaxRed1 > 15)
+ {
+- iMinRed1 = 15;
++ iMaxRed1 = 15;
+ }
+
+ int iMinGreen1 = iColor1Green - (int)a_uiRadius;
+@@ -519,7 +519,7 @@ namespace Etc
+ int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
+ if (iMaxGreen1 > 15)
+ {
+- iMinGreen1 = 15;
++ iMaxGreen1 = 15;
+ }
+
+ int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
+@@ -530,7 +530,7 @@ namespace Etc
+ int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
+ if (iMaxBlue1 > 15)
+ {
+- iMinBlue1 = 15;
++ iMaxBlue1 = 15;
+ }
+
+ int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
+@@ -545,7 +545,7 @@ namespace Etc
+ int iMaxRed2 = iColor2Red + (int)a_uiRadius;
+ if (iMaxRed2 > 15)
+ {
+- iMinRed2 = 15;
++ iMaxRed2 = 15;
+ }
+
+ int iMinGreen2 = iColor2Green - (int)a_uiRadius;
+@@ -556,7 +556,7 @@ namespace Etc
+ int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
+ if (iMaxGreen2 > 15)
+ {
+- iMinGreen2 = 15;
++ iMaxGreen2 = 15;
+ }
+
+ int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
+@@ -567,7 +567,7 @@ namespace Etc
+ int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
+ if (iMaxBlue2 > 15)
+ {
+- iMinBlue2 = 15;
++ iMaxBlue2 = 15;
+ }
+
+ for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
+@@ -761,7 +761,7 @@ namespace Etc
+ int iMaxRed1 = iColor1Red + (int)a_uiRadius;
+ if (iMaxRed1 > 15)
+ {
+- iMinRed1 = 15;
++ iMaxRed1 = 15;
+ }
+
+ int iMinGreen1 = iColor1Green - (int)a_uiRadius;
+@@ -772,7 +772,7 @@ namespace Etc
+ int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
+ if (iMaxGreen1 > 15)
+ {
+- iMinGreen1 = 15;
++ iMaxGreen1 = 15;
+ }
+
+ int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
+@@ -783,7 +783,7 @@ namespace Etc
+ int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
+ if (iMaxBlue1 > 15)
+ {
+- iMinBlue1 = 15;
++ iMaxBlue1 = 15;
+ }
+
+ int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
+@@ -798,7 +798,7 @@ namespace Etc
+ int iMaxRed2 = iColor2Red + (int)a_uiRadius;
+ if (iMaxRed2 > 15)
+ {
+- iMinRed2 = 15;
++ iMaxRed2 = 15;
+ }
+
+ int iMinGreen2 = iColor2Green - (int)a_uiRadius;
+@@ -809,7 +809,7 @@ namespace Etc
+ int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
+ if (iMaxGreen2 > 15)
+ {
+- iMinGreen2 = 15;
++ iMaxGreen2 = 15;
+ }
+
+ int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
+@@ -820,7 +820,7 @@ namespace Etc
+ int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
+ if (iMaxBlue2 > 15)
+ {
+- iMinBlue2 = 15;
++ iMaxBlue2 = 15;
+ }
+
+ for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
+diff --git a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
+index ba2b42fb05..b94b64e68c 100644
+--- a/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
++++ b/thirdparty/etc2comp/EtcBlock4x4Encoding_RGB8A1.cpp
+@@ -847,7 +847,7 @@ namespace Etc
+ int iMaxRed1 = iColor1Red + (int)a_uiRadius;
+ if (iMaxRed1 > 15)
+ {
+- iMinRed1 = 15;
++ iMaxRed1 = 15;
+ }
+
+ int iMinGreen1 = iColor1Green - (int)a_uiRadius;
+@@ -858,7 +858,7 @@ namespace Etc
+ int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
+ if (iMaxGreen1 > 15)
+ {
+- iMinGreen1 = 15;
++ iMaxGreen1 = 15;
+ }
+
+ int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
+@@ -869,7 +869,7 @@ namespace Etc
+ int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
+ if (iMaxBlue1 > 15)
+ {
+- iMinBlue1 = 15;
++ iMaxBlue1 = 15;
+ }
+
+ int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
+@@ -884,7 +884,7 @@ namespace Etc
+ int iMaxRed2 = iColor2Red + (int)a_uiRadius;
+ if (iMaxRed2 > 15)
+ {
+- iMinRed2 = 15;
++ iMaxRed2 = 15;
+ }
+
+ int iMinGreen2 = iColor2Green - (int)a_uiRadius;
+@@ -895,7 +895,7 @@ namespace Etc
+ int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
+ if (iMaxGreen2 > 15)
+ {
+- iMinGreen2 = 15;
++ iMaxGreen2 = 15;
+ }
+
+ int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
+@@ -906,7 +906,7 @@ namespace Etc
+ int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
+ if (iMaxBlue2 > 15)
+ {
+- iMinBlue2 = 15;
++ iMaxBlue2 = 15;
+ }
+
+ for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
+@@ -1108,7 +1108,7 @@ namespace Etc
+ int iMaxRed1 = iColor1Red + (int)a_uiRadius;
+ if (iMaxRed1 > 15)
+ {
+- iMinRed1 = 15;
++ iMaxRed1 = 15;
+ }
+
+ int iMinGreen1 = iColor1Green - (int)a_uiRadius;
+@@ -1119,7 +1119,7 @@ namespace Etc
+ int iMaxGreen1 = iColor1Green + (int)a_uiRadius;
+ if (iMaxGreen1 > 15)
+ {
+- iMinGreen1 = 15;
++ iMaxGreen1 = 15;
+ }
+
+ int iMinBlue1 = iColor1Blue - (int)a_uiRadius;
+@@ -1130,7 +1130,7 @@ namespace Etc
+ int iMaxBlue1 = iColor1Blue + (int)a_uiRadius;
+ if (iMaxBlue1 > 15)
+ {
+- iMinBlue1 = 15;
++ iMaxBlue1 = 15;
+ }
+
+ int iColor2Red = m_frgbaOriginalColor2_TAndH.IntRed(15.0f);
+@@ -1145,7 +1145,7 @@ namespace Etc
+ int iMaxRed2 = iColor2Red + (int)a_uiRadius;
+ if (iMaxRed2 > 15)
+ {
+- iMinRed2 = 15;
++ iMaxRed2 = 15;
+ }
+
+ int iMinGreen2 = iColor2Green - (int)a_uiRadius;
+@@ -1156,7 +1156,7 @@ namespace Etc
+ int iMaxGreen2 = iColor2Green + (int)a_uiRadius;
+ if (iMaxGreen2 > 15)
+ {
+- iMinGreen2 = 15;
++ iMaxGreen2 = 15;
+ }
+
+ int iMinBlue2 = iColor2Blue - (int)a_uiRadius;
+@@ -1167,7 +1167,7 @@ namespace Etc
+ int iMaxBlue2 = iColor2Blue + (int)a_uiRadius;
+ if (iMaxBlue2 > 15)
+ {
+- iMinBlue2 = 15;
++ iMaxBlue2 = 15;
+ }
+
+ for (unsigned int uiDistance = 0; uiDistance < TH_DISTANCES; uiDistance++)
diff --git a/thirdparty/vulkan/vk_enum_string_helper.h b/thirdparty/vulkan/vk_enum_string_helper.h
index 00c2b9d1d5..1c99b31270 100644
--- a/thirdparty/vulkan/vk_enum_string_helper.h
+++ b/thirdparty/vulkan/vk_enum_string_helper.h
@@ -31,7 +31,7 @@
#pragma once
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning( disable : 4065 )
#endif