Compare commits

..

1102 commits

Author SHA1 Message Date
Rémi Verschelde
7864ac8019
Merge pull request #111299 from stuartcarnie/swift_build
Build: Fix container build path for swift
2025-10-18 11:45:54 +02:00
Rémi Verschelde
816ec99355
Merge pull request #111771 from Repiteo/core/suppress-gcc-false-positive
Core: Sidestep GCC false-positive
2025-10-18 08:53:27 +02:00
Thaddeus Crews
acdb8667b5
Core: Sidestep GCC false-positive 2025-10-17 18:57:34 -05:00
Thaddeus Crews
540ea0b96c
Merge pull request #111761 from Ivorforce/fixed-array-warn
Fix false positive warning with `FixedVector` array bounds in gcc.
2025-10-17 11:26:49 -05:00
Thaddeus Crews
6ae1caecaf
Merge pull request #109431 from dsnopek/openxr-composition-layer-safe-multithreaded-rendering
Make `OpenXRCompositionLayer` and its children safe for multithreaded rendering
2025-10-17 09:07:44 -05:00
Thaddeus Crews
8aebfb7776
Merge pull request #109839 from vaner-org/blendspace-double-click
Double-click BlendSpace points to open their editor
2025-10-17 09:07:43 -05:00
Thaddeus Crews
4a7ca086a3
Merge pull request #109605 from vaner-org/statemachine-play-highlight-fix
Correctly reset StateMachine opacity when a node is played or renamed
2025-10-17 09:07:42 -05:00
Thaddeus Crews
fd8ddca49a
Merge pull request #111649 from KoBeWi/DESNAME
Improvements to ProjectManager's `_update_theme()`
2025-10-17 09:07:40 -05:00
Thaddeus Crews
fc985d7769
Merge pull request #111745 from benbot/benbot/seems-wrong
Fix the LODs array returned by `mesh_get_surface`
2025-10-17 09:07:39 -05:00
Thaddeus Crews
d5942cf5fd
Merge pull request #109792 from vaner-org/blendspace-better-cursor
Make BlendSpace selection tool consistent with StateMachine/BlendTree functionality
2025-10-17 09:07:39 -05:00
Lukas Tenbrink
6733345f73 Fix false positive warning with FixedVector array bounds in gcc. 2025-10-17 13:11:33 +02:00
Ben Botwin
7613123048 fixes the lods array returned by mesh_get_surface 2025-10-16 17:26:48 -04:00
kobewi
8f1b411556 Improvements to ProjectManager's _update_theme() 2025-10-16 20:16:20 +02:00
Thaddeus Crews
60710df3b6
Merge pull request #94047 from KoBeWi/resource_printer
Improve `to_string()` and add it to Resource
2025-10-16 12:48:11 -05:00
Thaddeus Crews
769505fef3
Merge pull request #111703 from timothyqiu/glsl-utf8
Fix error when compute shaders contain Unicode comment
2025-10-16 12:48:10 -05:00
Thaddeus Crews
94818a5313
Merge pull request #111509 from passivestar/orbit-snapping
Implement orbit snapping in 3D viewport
2025-10-16 12:48:09 -05:00
Thaddeus Crews
026efbb0f5
Merge pull request #111733 from DarioSamo/rendering-device-shutdown-fix
Do not begin a new frame during RenderingDevice's shutdown.
2025-10-16 12:48:08 -05:00
Thaddeus Crews
f3ebee1f79
Merge pull request #111211 from superherointj/enet-warning
System-provided ENet warning
2025-10-16 12:48:07 -05:00
Thaddeus Crews
9e96c7d9b8
Merge pull request #110378 from timothyqiu/rtl-preview
Make text-related nodes translation domain aware
2025-10-16 12:48:05 -05:00
Thaddeus Crews
2edad6860a
Merge pull request #111658 from brycehutchings/bryceh_d3d12_native_handle_fixes
Fix D3D12 rendering device driver returning pointers to internal types for get_resource_native_handle instead of proper D3D12 primitives
2025-10-16 12:48:04 -05:00
Thaddeus Crews
13404515fb
Merge pull request #111523 from Joy-less/fix-IsStaticallyResolvable
Fix `IsStaticallyResolvable`
2025-10-16 12:48:03 -05:00
Dario
af584b1ba8 Do not begin a new frame during RenderingDevice's shutdown. 2025-10-16 13:47:18 -03:00
passivestar
d739700178 Implement orbit snapping in 3D viewport 2025-10-16 12:46:14 +04:00
Haoyu Qiu
73afe696d2 Fix error when compute shaders contain Unicode comment 2025-10-16 11:21:14 +08:00
Thaddeus Crews
20430236e7
Merge pull request #107999 from timothyqiu/translation-cleanup
Clean up editor translation related methods
2025-10-15 16:31:09 -05:00
Thaddeus Crews
49219de402
Merge pull request #108862 from timothyqiu/plural-rules
Move context and plural support to `Translation`
2025-10-15 16:31:07 -05:00
Thaddeus Crews
1ae616d7d8
Merge pull request #111672 from OverShifted/patch-1
Fix typo in mutex documentation
2025-10-15 16:31:06 -05:00
Thaddeus Crews
ca524532e6
Merge pull request #111663 from LanzaSchneider/patch-4
Fix compilation errors when `disable_xr=yes`
2025-10-15 16:31:05 -05:00
Thaddeus Crews
57e041d357
Merge pull request #111657 from bruvzg/mac26_gl_hang
[macOS] Fix ~500ms hang on transparent OpenGL window creation on macOS 26.
2025-10-15 16:31:03 -05:00
Thaddeus Crews
71031e4adb
Merge pull request #108422 from stuartcarnie/108115_metal_cpu_read_bit
Metal: Fix `texture_get_data` other linear formats
2025-10-15 16:31:02 -05:00
Thaddeus Crews
710a6e0303
Merge pull request #111652 from DarioSamo/opaque-list-key
Organize render surface sorting key for optimizing API performance.
2025-10-15 16:31:01 -05:00
Stuart Carnie
a281e91c5a Metal: Fix texture_get_data other linear formats
Introduce a specialised `texture_get_data` for `RenderDeviceDriver`,
which can retrieve the texture data from the GPU driver for shared
textures (`TEXTURE_USAGE_CPU_READ_BIT`).

Closes #108115
2025-10-16 06:46:51 +11:00
Bryce Hutchings
1f7e7de82b Fix D3D12 driver returning internal types to RenderingDevice's texture_get_native_handle/get_driver_resource 2025-10-15 10:35:38 -07:00
Dario
b49aea89d0 Organize render surface sorting key for optimizing API performance. 2025-10-15 11:35:02 -03:00
Sepehr Kalanaki
1e8fd575a9
Fix typo in mutex documentation
Change "more times that" to "more times than"
2025-10-15 12:05:19 +03:30
Clay John
36b92128b1
Merge pull request #110671 from allenwp/environment-glow-consistent
Blend glow before tonemapping and change default to screen.
2025-10-14 21:29:43 -07:00
Lanza
80ce18918e
fix: compilation errors when disable_xr=yes 2025-10-15 09:09:43 +08:00
Thaddeus Crews
1e9d0ff925
Merge pull request #111578 from Kaleb-Reid/fix-shadow-cull-material
Use correct shadow material in some cases in Mobile
2025-10-14 17:13:42 -05:00
Thaddeus Crews
a364d6ad75
Merge pull request #111561 from StarryWorm/core/variant-includes-rework
Core: Fix missing includes in `type_info.h`
2025-10-14 17:13:40 -05:00
Thaddeus Crews
68b897225e
Merge pull request #111624 from Meorge/feat/project-manager-show-in-file-manager
Add "Show in File Manager" button to sidebar of Project Manager
2025-10-14 17:13:39 -05:00
Pāvels Nadtočajevs
a63dd0704f
[macOS] Fix ~500ms hang on transparent OpenGL window creation on macOS 26. 2025-10-15 00:03:55 +03:00
Kaleb Reid
8a8bd02860 Use correct shadow material in some cases in Mobile 2025-10-14 13:44:09 -07:00
Stuart Carnie
ad74ed68c1 Build: Fix container build path for swift 2025-10-15 06:32:31 +11:00
Thaddeus Crews
0400b703e4
Merge pull request #111577 from Kaleb-Reid/fix-lightmap-luminance
Apply luminance multiplier in copy_cubemap_to_panorama
2025-10-14 10:31:34 -05:00
Thaddeus Crews
9cdf3ff3ff
Merge pull request #111639 from timothyqiu/freshy-leaky
X11: Fix memory leak in `screen_get_refresh_rate()`
2025-10-14 10:31:32 -05:00
Thaddeus Crews
0b47123768
Merge pull request #111542 from sockeye-d/script-editor-allow-echo
Allow keyboard echo for ScriptEditor tab manipulation events
2025-10-14 10:31:31 -05:00
Thaddeus Crews
9554c2bc56
Merge pull request #93713 from KoBeWi/scene_data_in_script_cache
Store script states for built-in scripts
2025-10-14 10:31:30 -05:00
Thaddeus Crews
4d3a899c64
Merge pull request #111633 from YYF233333/ccb-include
Remove `callable_bind.h` from `object.h`
2025-10-14 10:31:29 -05:00
Thaddeus Crews
920552812e
Merge pull request #111566 from Repiteo/scons/mingw-big-obj
SCons: Enable MinGW big objects universally
2025-10-14 10:31:28 -05:00
Thaddeus Crews
9659dc13bd
Merge pull request #102888 from Shaderd00d/clear_transform
Add shortcuts to reset position, rotation and scale in Spatial and Canvas Item Editor
2025-10-14 10:31:27 -05:00
Thaddeus Crews
b7bbdfd31c
Merge pull request #111591 from br0b/master
Fix description of `Viewport::set_input_as_handled`
2025-10-14 10:31:26 -05:00
Thaddeus Crews
79e533679c
Merge pull request #111620 from Ivorforce/node-no-display-server
Remove `display_server.h` transitive include from `node.h`.
2025-10-14 10:31:25 -05:00
Thaddeus Crews
e6768b5db4
Merge pull request #111095 from Meorge/feat/margincontainer-viz
Visualize MarginContainer margins when selected
2025-10-14 10:31:24 -05:00
Thaddeus Crews
c2720efb28
Merge pull request #110690 from KoBeWi/shortcut_to_shorcuts
Keep shortcut selected when clearing filter
2025-10-14 10:31:23 -05:00
Thaddeus Crews
879d4439e7
Merge pull request #111617 from HolonProduction/hotfix
Add missing initialization for bitpacked object members
2025-10-14 10:31:22 -05:00
StarryWorm
c17e76572d Fix type_info.h includes 2025-10-14 11:12:41 -04:00
Haoyu Qiu
66e5bce653 X11: Fix memory leak in screen_get_refresh_rate 2025-10-14 20:30:05 +08:00
Robert Grigoryan
b3bb376391 Fix description of Viewport::set_input_as_handled
The method stops the `InputEvent` from propagating up, not down.
2025-10-14 11:06:54 +02:00
Yufeng Ying
7d3c25d083 Remove callable_bind.h from object.h 2025-10-14 16:24:05 +08:00
Kaleb Reid
8173f43770 Apply luminance multiplier in copy_cubemap_to_panorama 2025-10-13 21:41:03 -07:00
Malcolm Anderson
769007c707 Add "Show in File Manager" button to sidebar of Project Manager 2025-10-13 17:56:49 -07:00
Thaddeus Crews
e825169957
Merge pull request #107836 from aaronfranke/gltf-without-nodes
GLTF: Allow parsing glTF files without nodes
2025-10-13 19:29:03 -05:00
Thaddeus Crews
4ae535b3b9
Merge pull request #111419 from YeldhamDev/numbers_numbers_numbers
Add source lines to file locations on POT generation
2025-10-13 19:29:01 -05:00
Thaddeus Crews
c0c75561d2
Merge pull request #111129 from DarioSamo/particle-pipeline-deferral
Push pipeline compilation of various effects to the worker thread pool.
2025-10-13 19:29:00 -05:00
Thaddeus Crews
8ce4f80dd9
Merge pull request #106263 from lodetrick/tabbar-individual-colors
Add support for custom font colors in the TabBar
2025-10-13 19:28:58 -05:00
Thaddeus Crews
d3285f5468
Merge pull request #111185 from WhalesState/vp-disable-xr
More XR disable for Viewport and export.
2025-10-13 19:28:56 -05:00
Thaddeus Crews
c6df8d3253
Merge pull request #111476 from kleonc/canvas_item_draw_set_transform_fix_rotation_scale_order
Fix rotation/scale order in `CanvasItem::draw_set_transform`
2025-10-13 19:28:55 -05:00
Thaddeus Crews
988a7f7bdf
Merge pull request #111507 from nikitalita/fix-skeleton-dynamic-physics
Scene importer: Fix skeleton path when physics body type is dynamic
2025-10-13 19:28:53 -05:00
Thaddeus Crews
0b4cca38ea
Merge pull request #111538 from MajorMcDoom/xr-tracker-name-optimization
Make `XRPose` only set name on creation instead of on pose update
2025-10-13 19:28:51 -05:00
Thaddeus Crews
8be090c03a
Merge pull request #111569 from DeeJayLSP/harfbuzz-update
Update HarfBuzz to 12.1.0
2025-10-13 19:28:49 -05:00
Thaddeus Crews
c5754ccc52
Merge pull request #111310 from Caaz/patch-1
Update tutorial link for calling Javascript from script
2025-10-13 19:28:48 -05:00
Thaddeus Crews
21a6488c7f
Merge pull request #109421 from aaronfranke/gltf-export-mesh-name
GLTF: Preserve mesh names on export
2025-10-13 19:28:46 -05:00
Thaddeus Crews
3dbd7d36d0
Merge pull request #111461 from DeeJayLSP/fthb
Use HarfBuzz to fix variant hinting in `TextServerAdvanced`
2025-10-13 19:28:44 -05:00
Thaddeus Crews
cd74a9cb12
Merge pull request #111206 from j20001970/camera-feed-datatype-changed
Emit `format_changed` on CameraFeed datatype change
2025-10-13 19:28:42 -05:00
Thaddeus Crews
cd13a9df14
Merge pull request #111621 from scgm0/Fix-some-compilation-errors
Fix some compilation errors
2025-10-13 19:28:41 -05:00
Thaddeus Crews
58894136b7
Merge pull request #107395 from lodetrick/bottom-panel-margin-fixes
Fix TabContainer Editor theming and remove Debugger style hacks
2025-10-13 19:28:39 -05:00
Thaddeus Crews
40dde2a9a1
Merge pull request #111139 from Calinou/doc-node2d-look-at-get-angle-to
Document link between `Node2D.look_at()` and `Node2D.get_angle_to()`
2025-10-13 19:28:37 -05:00
Thaddeus Crews
3ef37d7bf3
Merge pull request #111586 from KoBeWi/some_favorites_are_bigger_because_they_are_more_favored
Fix favorites icon size in FileSystem dock
2025-10-13 19:28:36 -05:00
Thaddeus Crews
2568505535
Merge pull request #108065 from lodetrick/range-hint-cleanup
Clean up numeric EditorProperty `setup()` methods
2025-10-13 19:28:34 -05:00
Lukas Tenbrink
1e0b41ab27 Remove display_server.h transitive include from node.h. 2025-10-14 00:43:02 +02:00
scgm0
cbc960c997 Fix some compilation errors 2025-10-14 05:54:58 +08:00
HolonProduction
bad44931a8 Add missing initialization for bitpacked object members 2025-10-13 21:55:44 +02:00
Logan Detrick
914a72f8a4 Give TabBar overridable colors per tab 2025-10-13 11:52:07 -07:00
Hugo Locurcio
082766a990
Document link between Node2D.look_at() and Node2D.get_angle_to()
These methods are closely related, as `Node2D.get_angle_to()` can
be used to get the rotation value that is being applied to `look_at()`
without actually applying it to the node.
2025-10-13 20:47:55 +02:00
DeeJayLSP
276e1c222c Update HarfBuzz to 12.1.0 2025-10-13 15:12:33 -03:00
Thaddeus Crews
fc7065d2b4
Merge pull request #111487 from AThousandShips/fix_2d_build_2
Fix 2D builds (again)
2025-10-13 12:30:16 -05:00
Thaddeus Crews
599fd7344a
Merge pull request #111356 from blueskythlikesclouds/d3d12-spec-constant-patch-fix
Fix specialization constant patching on D3D12.
2025-10-13 12:30:15 -05:00
Thaddeus Crews
31f9ed087e
Merge pull request #110650 from WhalesState/node-cache-less-dirty
Optimize children cache updates and refine special-case handling
2025-10-13 12:30:14 -05:00
Thaddeus Crews
c9b72fcfb6
Merge pull request #111481 from Ivorforce/texture-less-includes
Remove extraneous includes from `texture.h`.
2025-10-13 12:30:13 -05:00
Thaddeus Crews
bb4d0638c4
Merge pull request #109816 from SatLess/ArraysArePeopleToo
Add `Make_Unique_Recursive` option for `Resources` with `Arrays` and `Dictionaries`
2025-10-13 12:30:11 -05:00
Thaddeus Crews
e560ea47d4
Merge pull request #70646 from KoBeWi/relatable_offset
Add `pivot_offset_ratio` property to Control
2025-10-13 12:30:10 -05:00
Thaddeus Crews
094eb99a43
Merge pull request #111601 from AThousandShips/fix_build_objprof
Fix use of outdated macros in ObjectDBProfiler
2025-10-13 12:30:09 -05:00
Thaddeus Crews
10c333a8f1
Merge pull request #111313 from bruvzg/emb_res
Fix editor embedded windows partially resizing.
2025-10-13 12:30:08 -05:00
Thaddeus Crews
dc05e0f907
Merge pull request #111596 from kb173/fix-vr-visible-layers
Fix `CAMERA_VISIBLE_LAYERS` in multiview camera (VR) not aligning with the camera's cull mask
2025-10-13 12:30:06 -05:00
Thaddeus Crews
43438fec2a
Merge pull request #111529 from wagnerfs/fix-windows-native-filedialog-filters
Fix Windows native FileDialog filters not showing descriptions
2025-10-13 12:30:05 -05:00
Thaddeus Crews
1274facd44
Merge pull request #111434 from ChristophHaag/initialize_XrRenderModelPropertiesEXT_type
Ensure `XrRenderModelPropertiesEXT::type` is initialized
2025-10-13 12:30:04 -05:00
Thaddeus Crews
2b1fa0f10c
Merge pull request #111111 from bruvzg/outl_warn
[Label] Add MSDF pixel range/outline configuration warning.
2025-10-13 12:30:03 -05:00
Thaddeus Crews
dcb9a0d030
Merge pull request #110151 from FifthTundraG/tabbar_horizontal_scrolling
Add horizontal scrolling to `TabBar`
2025-10-13 12:30:02 -05:00
Thaddeus Crews
08c200e82f
Merge pull request #111527 from DenisCiammaricone/fix-inline-object-parse
Fix editor inline color display of color from `Color.from_rgba8`
2025-10-13 12:30:00 -05:00
Thaddeus Crews
5e7f7735a4
Merge pull request #86468 from KoBeWi/always_has_been
Move script name to top
2025-10-13 12:29:59 -05:00
Thaddeus Crews
02f48683b5
Merge pull request #111556 from kleonc/fix_show_members_overview_editor_setting_tooltip
Fix `text_editor/script_list/show_members_overview` editor setting docs/tooltip
2025-10-13 12:29:58 -05:00
Thaddeus Crews
0450686035
Merge pull request #111460 from KoBeWi/dialoging_shortcut_files
Rework FileDialog shortcuts
2025-10-13 12:29:57 -05:00
Denis Ciammaricone
7e2f6c3ebc Fix editor inline color display of color from Color.from_rgba8 2025-10-13 19:12:17 +02:00
FifthTundraG
14f7cbd74c Add horizontal scrolling to TabBar 2025-10-13 13:05:25 -04:00
Thaddeus Crews
d86a428994
SCons: Enable mingw big objects in more contexts 2025-10-13 11:00:03 -05:00
Karl Office
7a49918c89 fix: set visible layers in multiview camera 2025-10-13 17:31:01 +02:00
A Thousand Ships
ac05ce5226
Fix use of outdated macros in ObjectDBProfiler
These were renamed but were missed in this PR and fails with disable
deprecated.
2025-10-13 17:25:45 +02:00
Dario
ba268416d5 Push pipeline compilation of various effects to the worker thread pool. 2025-10-13 12:00:23 -03:00
kobewi
7cee91f05b Fix favorites icon size in FileSystem dock 2025-10-13 13:58:10 +02:00
Rémi Verschelde
4219ce91f2
Merge pull request #110485 from bruvzg/aemb_dtr
Fix iOS/visionOS export plugin crash on exit.
2025-10-13 07:35:19 +02:00
Sat
12ced6c83b Add support for making arrays and dictionaries with Resources unique 2025-10-12 23:11:09 -03:00
Wagner
f835707f7a Fix Windows native FileDialog filters not showing descriptions 2025-10-12 16:22:45 -03:00
Jason Kuo
2e00156657 Emit format_changed on CameraFeed datatype change 2025-10-13 00:26:29 +08:00
kleonc
5ea0b9d60d Fix show_members_overview editor setting docs/tooltip 2025-10-12 15:03:03 +02:00
kobewi
206d4a0fb3 Move script name to top 2025-10-12 14:10:44 +02:00
fish
8e3499a961 Allow keyboard echo for script_editor/next_script, script_editor/prev_script, script_editor/window_move_up, and script_editor/window_move_down events 2025-10-11 20:09:55 -07:00
Zi Ye
e38bbf88e5 Make XRPose only set name on creation, instead of on every update. 2025-10-11 20:24:23 -05:00
Joyless
a5ce9c3706 Fix IsStaticallyResolvable 2025-10-11 21:20:01 +01:00
kobewi
263a2bdec6 Rework FileDialog shortcuts 2025-10-11 14:37:40 +02:00
nikitalita
03923c6ed7 scene importer: Fix skeleton path when physics body type is dynamic 2025-10-11 04:39:14 -07:00
Thaddeus Crews
cb7cd815ee
Merge pull request #111496 from godotengine/revert-108837-json-handle-nan-inf
Revert "Handle NaN and Infinity in JSON stringify function"
2025-10-10 20:47:39 -05:00
Clay John
8b06cdf277
Revert "Handle NaN and Infinity in JSON stringify function" 2025-10-10 18:22:24 -07:00
DeeJayLSP
70f180975b Use HarfBuzz to fix variant hinting in TextServerAdvanced 2025-10-10 18:01:03 -03:00
A Thousand Ships
a872b54a3b
Fix 2D builds (again) 2025-10-10 20:44:50 +02:00
Lukas Tenbrink
985e6178b4 Remove extraneous includes from texture.h. 2025-10-10 18:39:16 +02:00
Allen Pestaluky
cafc012b05 Blend Environment glow before tonemapping and change default blend mode to screen.
Additionally, change the minimum `tonemap_white` parameter to `1.0`; users can increase `tonemap_exposure` for a similar effect to decreasing `tonemap_white` below `1.0`.

Co-authored-by: Hei <40064911+Lielay9@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-10-10 12:08:08 -04:00
Thaddeus Crews
16a11ac88b
Merge pull request #111358 from Ivorforce/no-variant-hasher
Remove `VariantHasher` and `VariantComparator` in favour of specialising `HashMapHasherDefault` and `HashMapComparatorDefault`.
2025-10-10 10:26:12 -05:00
Thaddeus Crews
3e1af9a12a
Merge pull request #109021 from KoBeWi/visual_code
Don't save code property of VisualShader
2025-10-10 10:26:11 -05:00
Thaddeus Crews
e33f89fe27
Merge pull request #111323 from HolonProduction/rm-script
Remove `Object::script`
2025-10-10 10:26:09 -05:00
Thaddeus Crews
d10eca9c59
Merge pull request #111448 from Giganzo/sprite-frames-editor-shortcut-name
Use Title Case for shortcut names in SpriteFramesEditorPlugin
2025-10-10 10:26:08 -05:00
Thaddeus Crews
edcbdc5706
Merge pull request #107573 from lodetrick/tilemap-hide-overlay
Fade TileMap editor overlay when zoomed out
2025-10-10 10:26:07 -05:00
Thaddeus Crews
89ce203427
Merge pull request #106997 from Ivorforce/fixed-move-semantics
Fix `FixedVector` move and copy semantics.
2025-10-10 10:26:06 -05:00
Thaddeus Crews
99ab454a64
Merge pull request #111473 from KoBeWi/easing-i18n-redux
Fix some easing presets not translated
2025-10-10 10:26:04 -05:00
Thaddeus Crews
c417769226
Merge pull request #111470 from Ivorforce/debug-circular-include
Remove circular unneeded `debug_adapter_protocol.h` include from `debug_adapter_parser.h`
2025-10-10 10:26:03 -05:00
Thaddeus Crews
4ea49aecaf
Merge pull request #110990 from timothyqiu/x11-min-max
X11: Fix minimization of maximized windows
2025-10-10 10:26:02 -05:00
Thaddeus Crews
d4a87d9bb3
Merge pull request #106636 from Ivorforce/dictionary-mutating-fix
Fix `Dictionary::operator[]` from C++ accidentally modifying `const` dictionaries.
2025-10-10 10:26:01 -05:00
Thaddeus Crews
8150cb9200
Merge pull request #111403 from AeioMuch/fix_double_precision_wrong_indexes
Fix wrong indices used for transform & UBO matrix for double precision build
2025-10-10 10:25:59 -05:00
Thaddeus Crews
d598753c1a
Merge pull request #111466 from BastiaanOlij/fix_gles3_lightmap_uv2_attrib
Ensure uv2_attrib(_input) is available when rendering lightmap.
2025-10-10 10:25:58 -05:00
Thaddeus Crews
dd3b17de88
Merge pull request #105449 from raulsntos/MissingNode/recording_signals
Add `recording_signals` to MissingNode, and rename `MTVIRTUAL` to `DEBUG_VIRTUAL`
2025-10-10 10:25:57 -05:00
Thaddeus Crews
cf9e2ea6da
Merge pull request #111432 from zorbathut/pr/libgodot_linux_fix
Fix LibGodot build errors on Linux.
2025-10-10 10:25:56 -05:00
Thaddeus Crews
21e5b41642
Merge pull request #108837 from aaronfranke/json-handle-nan-inf
Handle NaN and Infinity in JSON stringify function
2025-10-10 10:25:55 -05:00
Thaddeus Crews
fb01d80e88
Merge pull request #111393 from xuhuisheng/dev/auto_expand_selected
Should expand root when `auto_expand` is on
2025-10-10 10:25:53 -05:00
kleonc
2dce5172e2 Fix rotation/scale order in CanvasItem::draw_set_transform 2025-10-10 15:09:25 +02:00
kobewi
b9f7f2d767 Fix some easing presets not translated
Co-authored-by: Haoyu Qiu <timothyqiu32@gmail.com>
2025-10-10 13:21:56 +02:00
Ben Rog-Wilhelm
0a584250ae Fix: Libgodot build on Linux. 2025-10-10 04:31:14 -05:00
Lukas Tenbrink
56abd0ece3 Remove circular unneeded debug_adapter_protocol.h include from debug_adapter_parser.h. 2025-10-10 10:40:47 +02:00
Bastiaan Olij
3a003b2d96 Ensure uv2_attrib(_input) is available when rendering lightmap. 2025-10-10 14:17:34 +11:00
Raul Santos
09ad9e535b
Rename MTVIRTUAL to DEBUG_VIRTUAL 2025-10-09 22:11:18 +02:00
Raul Santos
fdecca2f18
Add recording_signals to MissingNode
Allows connecting unknown signals to MissingNode so they aren't lost when the Node type is missing.
2025-10-09 22:08:59 +02:00
AeioMuch
dae2122388 Fix wrong indexes for double precision 2025-10-09 22:01:41 +02:00
Thaddeus Crews
295e465fe4
Merge pull request #111454 from KoBeWi/buy_default
Enable script templates by default
2025-10-09 11:46:59 -05:00
Thaddeus Crews
91a1798474
Merge pull request #109084 from allenwp/add-spatial-shader-debanding
Add material debanding for use in Mobile rendering method.
2025-10-09 11:46:58 -05:00
Thaddeus Crews
aa88eb2a75
Merge pull request #73688 from Calinou/advanced-import-settings-tweak-property-hints
Tweak physics property hints in the 3D Advanced Import Settings dialog
2025-10-09 11:46:56 -05:00
Thaddeus Crews
3f3a8562fb
Merge pull request #89367 from KoBeWi/locale_shift
Allow rearranging translation list via drag and drop
2025-10-09 11:46:55 -05:00
Thaddeus Crews
db3407370c
Merge pull request #111445 from akien-mga/basisu-git-2025-10-09
basis_universal: Sync with latest Git to solve more warnings
2025-10-09 11:46:54 -05:00
Thaddeus Crews
09ea0cf899
Merge pull request #111444 from lawnjelly/fti_fix_scene_tree_depth_limit4
FTI - Fix `SceneTreeFTI` depth limit behaviour
2025-10-09 11:46:53 -05:00
Thaddeus Crews
092b7c6427
Merge pull request #110799 from AR-DEV-1/master
Update Godot's .NET version from 6.0 to 8.0
2025-10-09 11:46:51 -05:00
Thaddeus Crews
c41e47034e
Merge pull request #111342 from Ivorforce/dict-assert-no-string
Assert that `dictionary.h` does not include `String`, and that neither of the fundamental containers include `Object`
2025-10-09 11:46:50 -05:00
Thaddeus Crews
4ab22026b6
Merge pull request #111405 from Ivorforce/node-no-mesh
Remove transitive rendering includes from `node.h`
2025-10-09 11:46:49 -05:00
Thaddeus Crews
894d6ba13f
Merge pull request #76267 from Calinou/editor-theme-extra-borders-tooltip
Add a border to tooltips when using the Draw Extra Borders editor setting
2025-10-09 11:46:48 -05:00
Thaddeus Crews
5913469309
Merge pull request #111431 from Ivorforce/registration-order-3
Reorder registration of types, to register supertypes before subtypes.
2025-10-09 11:46:47 -05:00
Thaddeus Crews
755934f5f0
Merge pull request #111012 from KoBeWi/activate_never
Delete "Activate now?" button
2025-10-09 11:46:45 -05:00
Thaddeus Crews
538fd69243
Merge pull request #111425 from stuartcarnie/macos_crash_handler
MacOS: Improve crash handler performance
2025-10-09 11:46:44 -05:00
Thaddeus Crews
7efb51c9d3
Merge pull request #111361 from Ivorforce/cleanup-hashfuncs
Clean up `hashfuncs.h`
2025-10-09 11:46:43 -05:00
Christoph Haag
e33e069508 initialize XrRenderModelPropertiesEXT 2025-10-09 18:45:13 +02:00
kobewi
a299004622 Enable script templates by default 2025-10-09 16:33:07 +02:00
Rémi Verschelde
845f9f73cd
basis_universal: Sync with latest Git to solve more warnings 2025-10-09 12:41:57 +02:00
Giganzo
3a3894e22c Use Title Case for shortcut names in SpriteFramesEditorPlugin 2025-10-09 12:04:03 +02:00
lawnjelly
cee37f0234 FTI - Fix SceneTreeFTI depth limit behaviour
Fixes off by one bug, and increases the limit slightly.
2025-10-09 10:56:01 +01:00
Lukas Tenbrink
9843a016f5 Reorder registration of types, to register supertypes before subtypes. 2025-10-09 11:50:32 +02:00
kobewi
e6783dbdd1 Improve to_string() and add it to Resource 2025-10-09 00:54:38 +02:00
Logan Detrick
7998b5e8d2 Cleanup EditorProperty setup methods 2025-10-08 15:52:46 -07:00
Allen Pestaluky
bd9d1bf070 Add material debanding for use in Mobile rendering method.
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-10-08 16:22:41 -04:00
Michael Alexsander
0de3f8b21f
Add source lines to file locations on POT generation 2025-10-08 16:43:22 -03:00
Stuart Carnie
33cc3c125d MacOS: Improve crash handler performance
The most significant change is the version calls `atos` with a batch of
addresses, rather than one at a time. Reduces large stack traces down
to about a second or less (after OS caching).
2025-10-09 06:19:21 +11:00
Thaddeus Crews
9a5d6d1049
Merge pull request #111389 from nikitalita/gltf-fix-export-prop
Fix segfault in GLTFDocument::export_object_model_property
2025-10-08 13:56:42 -05:00
Thaddeus Crews
4ad9114c54
Merge pull request #111386 from YeldhamDev/scrcon_focus_fix
Fix incorrect margins in `ScrollContainer` with focus border enabled
2025-10-08 13:56:41 -05:00
Thaddeus Crews
1cf0bc2c6c
Merge pull request #111321 from blueskythlikesclouds/d3d12-region-fix
Fix D3D12 not checking for fullscreen clear region correctly.
2025-10-08 13:56:40 -05:00
Thaddeus Crews
52d32cee8d
Merge pull request #111383 from Ivorforce/core-types-update-2
Register core singleton types before instantiating them.
2025-10-08 13:56:39 -05:00
Thaddeus Crews
8f4d8dfd2d
Merge pull request #111411 from akien-mga/scons-disable-fast_unsafe-on-dev_build
SCons: Don't activate `fast_unsafe` automatically on `dev_build`
2025-10-08 13:56:37 -05:00
Thaddeus Crews
e20acd3fe3
Merge pull request #111289 from HolonProduction/rm-has-named-classes
Move deprecated `has_named_classes` from `ScriptLanguage` to `ScriptLanguageExtension`
2025-10-08 13:56:37 -05:00
Thaddeus Crews
0091d30e3e
Merge pull request #108818 from bruvzg/no_cli_over
Add project setting and build option to disable `override.cfg` and related CLI arguments.
2025-10-08 13:56:35 -05:00
Thaddeus Crews
7c033002b0
Merge pull request #110863 from kisg/libgodot_migeran_core
LibGodot: Core - Build Godot Engine as a Library
2025-10-08 13:56:34 -05:00
Thaddeus Crews
4bb612126e
Merge pull request #111402 from Ivorforce/world-3d-no-compositor
Remove `compositor.h` include from `world_3d.h`.
2025-10-08 13:56:33 -05:00
Thaddeus Crews
e5ee1911a9
Merge pull request #110853 from Kaleb-Reid/compat-fix-reflections
Ensure reflection atlas is valid before rendering
2025-10-08 13:56:32 -05:00
Thaddeus Crews
7093ca3dbe
Merge pull request #111396 from bruvzg/steam_tr_bld
Fix Steam time tracker build.
2025-10-08 13:56:31 -05:00
Thaddeus Crews
d3c5141e2e
Merge pull request #111298 from Onebit5/fix-filedialog-translation-parser
Fix GDScript translation parser for FileDialog.add_filter() two-parameter format
2025-10-08 13:56:30 -05:00
Onebit
d223b0ccbc Fix GDScript translation parser for FileDialog.add_filter() two-parameter format
The parser only handled the single-parameter semicolon format and thew
an error with two-parameter format. This fix supports both formats.

Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2025-10-08 19:45:21 +02:00
Rémi Verschelde
fa57282a1e
SCons: Don't activate fast_unsafe automatically on dev_build
We experienced first hand why it's called unsafe, and so we should leave it
as an explicit choice for contributors, informing themselves of the caveats.

See #111408.
2025-10-08 15:48:12 +02:00
Thaddeus Crews
4ad11b6af3
Merge pull request #111408 from mihe/jolt/version-crash-fix
Fix crash in Jolt when doing incremental builds
2025-10-08 08:11:07 -05:00
superherointj
24f23c5cdb System-provided ENet warning
Warning from documentation: https://github.com/godotengine/godot/tree/master/thirdparty#enet
2025-10-08 08:51:09 -03:00
Mikael Hermansson
a2d0e17187 Fix crash in Jolt when doing incremental builds 2025-10-08 13:41:38 +02:00
Lukas Tenbrink
33689d7beb Remove transitive mesh.h, rendering_server.h and shader.h includes from node.h. 2025-10-08 12:16:52 +02:00
Lukas Tenbrink
207e8c1b92 Remove compositor.h include from world_3d.h. 2025-10-08 11:25:23 +02:00
Skyth
36b7e77f03 Fix specialization constant patching on D3D12. 2025-10-08 09:37:35 +03:00
Pāvels Nadtočajevs
71443372fa
Fix Steam time tracker build. 2025-10-08 09:13:11 +03:00
xuhuisheng
4ba09aceb9 should expand root when auto_expand is on 2025-10-08 13:19:23 +08:00
Kaleb Reid
f2d0ea6d40 Ensure reflection atlas is valid before rendering 2025-10-07 22:05:22 -07:00
nikitalita
bca701f0eb fix segfault in GLTFDocument::export_object_model_property 2025-10-07 18:42:54 -07:00
Hugo Locurcio
f9fc0a243c Tweak physics property hints in the 3D Advanced Import Settings dialog
- Mention the node types explicitly in the body type.
- Add performance hints for shape type.
2025-10-08 01:50:10 +02:00
Michael Alexsander
e9a5208c8b
Fix incorrect margins in ScrollContainer with focus border enabled 2025-10-07 20:49:33 -03:00
Hugo Locurcio
7fe3a661b4 Add a border to tooltips when using the Draw Extra Borders editor setting
This distinguishes tooltips from the background when using the
Black (OLED) editor theme preset.
2025-10-08 01:47:06 +02:00
Thaddeus Crews
d61cd9149a
Merge pull request #111327 from Ivorforce/gdvirtual-shorten-get-method-info
Simplify `gdvirtual.gen.inc` `_get_method_info` arguments with a helper function.
2025-10-07 17:15:12 -05:00
Thaddeus Crews
f457855148
Merge pull request #111227 from clayjohn/RD-scene-shader-crash
Fix scene shader crash due to rename of view matrix and inverse view matrix
2025-10-07 17:15:11 -05:00
Thaddeus Crews
194d76e571
Merge pull request #111284 from arkology/sprite-frames-editor-translation
Improve auto-translation of `SpriteFramesEditor`
2025-10-07 17:15:10 -05:00
Thaddeus Crews
ef853bbc06
Merge pull request #111347 from Ivorforce/no-algorithm
Add `max()` to `Span`, replacing `<algorithm>` include from `rendering_device_commons.h`
2025-10-07 17:15:09 -05:00
Thaddeus Crews
0f7bf2913f
Merge pull request #111249 from HolonProduction/owner-node
Store `ThemeOwner` owner directly as `Node*`
2025-10-07 17:15:08 -05:00
Thaddeus Crews
5626f0bf0b
Merge pull request #93296 from rune-scape/editor-node-inheritance
EditorPlugin: Allow instance base type inheriting EditorPlugin
2025-10-07 17:15:07 -05:00
Thaddeus Crews
8276e512d6
Merge pull request #110767 from Ryan-000/Fix-AnimationPlayer-to-use-StringName
Fix AnimationPlayer to use StringName instead of String in the exposed API.
2025-10-07 17:15:06 -05:00
Thaddeus Crews
72cf639020
Merge pull request #111178 from PhairZ/anim-is-paused
Expose `is_valid()` from `AnimationPlayer` to make detecting paused animations possible.
2025-10-07 17:15:04 -05:00
Thaddeus Crews
91ad968557
Merge pull request #111242 from WhalesState/2d-link
Fix 2D debug templates linking
2025-10-07 17:15:03 -05:00
Thaddeus Crews
e878d5a2fb
Merge pull request #111304 from HolonProduction/rm-last-vp-rect
Remove unused members from `Viewport`
2025-10-07 17:15:02 -05:00
Thaddeus Crews
6ef2c7b34b
Merge pull request #110823 from Calinou/ui-builtin-actions-all-devices
Allow all gamepad devices for built-in `ui_*` input actions
2025-10-07 17:15:00 -05:00
Lukas Tenbrink
b3ec2edc04 Register core singleton types before instantiating them. 2025-10-07 23:10:00 +02:00
clayjohn
c7276273d8 Fix scene shader crash due to rename of view matrix and inverse view matrix 2025-10-07 13:36:23 -07:00
Lukas Tenbrink
1fa332cad4 Add max() to Span.
Remove `<algorithm>` include from `rendering_device_commons.h`, using `Span` instead.
2025-10-07 22:26:32 +02:00
Lukas Tenbrink
5df5c2212a Simplify gdvirtual.gen.inc _get_method_info arguments with a helper function.
# Conflicts:
#	core/object/make_virtuals.py
2025-10-07 22:23:43 +02:00
Thaddeus Crews
ec7d25d355
Merge pull request #111102 from timothyqiu/velocity-delta
Fix description about CharacterBody velocity and delta
2025-10-07 11:54:45 -05:00
Thaddeus Crews
ccccb9d3cb
Merge pull request #111258 from Koyper/fix_rich_text_label_bullet_list_issues
[RichTextLabel] Fix bullet list font color and formatting issues
2025-10-07 11:54:43 -05:00
Thaddeus Crews
cb164a38f2
Merge pull request #107384 from Kaleb-Reid/compat-directional-cull-mask
Implement DirectionalLight3D cull masks in Compatibility
2025-10-07 11:54:42 -05:00
Thaddeus Crews
9c63619f20
Merge pull request #111318 from Ivorforce/registration-order-1
Improve type registration order in `register_core_types.cpp`.
2025-10-07 11:54:41 -05:00
Thaddeus Crews
651d278e1d
Merge pull request #110965 from mihe/jolt/v5.4.0
Jolt: Update to 5.4.0
2025-10-07 11:54:39 -05:00
Thaddeus Crews
9efb50bad7
Merge pull request #111250 from scgm0/Fix-RichTextLabel-Focus
Fix RichTextLabel Focus Box
2025-10-07 11:54:39 -05:00
Thaddeus Crews
4bfe73ccd9
Merge pull request #111346 from Repiteo/scons/remove-system-includes
Scons: Remove system includes
2025-10-07 11:54:37 -05:00
Thaddeus Crews
a75c738ece
Merge pull request #111345 from YeldhamDev/fix_string_include
Fix compilation failure in resource test file
2025-10-07 11:54:36 -05:00
Thaddeus Crews
9f6088dafa
Merge pull request #111273 from GlitchedCode922/infinite_project_duplicator
Project Manager: Prohibit duplicating a project into itself
2025-10-07 11:54:35 -05:00
Thaddeus Crews
89e3587cd8
Merge pull request #111339 from HolonProduction/obj-pack
Bitpack more `Object` booleans
2025-10-07 11:54:34 -05:00
Thaddeus Crews
916bfee528
Merge pull request #111230 from GabCoolDude/color_picker_tooltip_fix
Fix color text's tooltip not being updated when the intensity is more than 0
2025-10-07 11:54:33 -05:00
Thaddeus Crews
1c643549f3
Merge pull request #111337 from Ivorforce/gdvirtual-init-virtual-ptr
Abstract `Object` virtual pointer init into a method instead of duplicating it across `gdvirtual.gen.inc`
2025-10-07 11:54:31 -05:00
Thaddeus Crews
e3c64cff24
Merge pull request #111368 from AThousandShips/fix_build_win
[Windows] Fix MinGW build
2025-10-07 11:54:30 -05:00
Thaddeus Crews
a1974604fe
Merge pull request #108227 from Meorge/bugfix/kill-subtweens
Propagate `Tween.kill()` to subtweens
2025-10-07 11:54:29 -05:00
Koyper
faf1ab126d Fix RichTextLabel bullet list font issues 2025-10-07 09:52:34 -05:00
A Thousand Ships
f81f08e5bf
[Windows] Fix MinGW build
`file_access.h` was removed from the include hierarchy and wasn't caught
by CI as it only occurs with MinGW builds
2025-10-07 16:06:04 +02:00
Michael Alexsander
fdaf00af0e
Fix compilation failure in resource test file 2025-10-07 10:45:00 -03:00
Thaddeus Crews
b95024752a
SCons: Remove system includes 2025-10-07 08:11:29 -05:00
Rémi Verschelde
56d5624e88
Merge pull request #111355 from bruvzg/zero_w_2
Enforce zero width spaces and joiners with missing font. Do not warn about missing non-visual characters.
2025-10-07 14:34:10 +02:00
Rémi Verschelde
fda0e83bd5
Merge pull request #111192 from Nintorch/fix-joy-weird-presses
Fix invalid reported joypad presses
2025-10-07 14:34:05 +02:00
Rémi Verschelde
7abe27ba09
Merge pull request #111068 from KoBeWi/bruh💀
Fix Quick Open history
2025-10-07 14:34:00 +02:00
Rémi Verschelde
e1a6334b56
Merge pull request #111001 from bruvzg/ts_no_ft
Fix text servers build with disabled FreeType.
2025-10-07 14:33:55 +02:00
Rémi Verschelde
bb01fa25bf
Merge pull request #110925 from rburing/obj_bump_multiplier
OBJ importer: Support bump multiplier (normal scale)
2025-10-07 14:33:50 +02:00
Rémi Verschelde
d4c0fcba3b
Merge pull request #110881 from Paeniche/master
Fix /tutorial added twice in offline docs
2025-10-07 14:33:41 +02:00
Lukas Tenbrink
f678729f89 Clean up hashfuncs.h: Move long functions to hashfuncs.cpp and replace static with inline. Remove hash_make_uint64_t and hash_make_uint32_t. 2025-10-07 13:50:18 +02:00
Lukas Tenbrink
d2ee378d1c Remove VariantHasher and VariantComparator in favour of specializing HashMapHasherDefault and HashMapComparatorDefault. 2025-10-07 13:47:39 +02:00
Mikael Hermansson
cf75064c71 Jolt: Update to 5.4.0 2025-10-07 13:43:40 +02:00
Rémi Verschelde
9052d31c68
Merge pull request #111331 from Repiteo/scons/revert-cppextpath
Revert "SCons: Add `CPPEXTPATH` for external includes"
2025-10-07 13:07:19 +02:00
Rémi Verschelde
9a25d56b1f
Merge pull request #111316 from bruvzg/res_manifest
[Windows] Fix application manifest in exported projects with modified resources.
2025-10-07 13:07:15 +02:00
Rémi Verschelde
30398802f8
Merge pull request #111136 from KoBeWi/redo_consistency_left_the_chat
Set correct saved history after clearing
2025-10-07 13:07:11 +02:00
Rémi Verschelde
1cab5e1b1c
Merge pull request #110982 from TokageItLab/fix-rm-animtree-bw
Fix backward/pingpong root motion in AnimationTree
2025-10-07 13:07:06 +02:00
Rémi Verschelde
a177d33ca7
Merge pull request #110738 from YeldhamDev/oops_guess_we_needed_that
Fix selection of remote tree using the keyboard
2025-10-07 13:07:02 +02:00
Rémi Verschelde
546ead2abd
Merge pull request #109795 from bruvzg/mac_reg_policy
[macOS] Always use "Regular" activation policy for GUI, and headless main loop for command line only tools.
2025-10-07 13:06:56 +02:00
Rémi Verschelde
a6e44be2dc
Merge pull request #105587 from deralmas/framing-this-moment
Wayland: Emulate frame event for old `wl_seat` versions
2025-10-07 13:06:47 +02:00
Pāvels Nadtočajevs
fda161f976
Enforce zero width spaces and joiners with missing font. Do not warn about missing non-visual characters. 2025-10-07 13:10:24 +03:00
Gergely Kis
6c44c80c62 LibGodot: Core - Build Godot Engine as a Library
* Add a new GodotInstance GDCLASS that provides startup and iteration commands to control a Godot instance.
* Adds a libgodot_create_godot_instance entry point that creates a new Godot instance and returns a GodotInstance object.
* Adds a libgodot_destroy_godot_instance entry point that destroys the Godot instance.

Sample Apps: https://github.com/migeran/libgodot_project

Developed by [Migeran](https://migeran.com)

Sponsors & Acknowledgements:

* Initial development sponsored by [Smirk Software](https://www.smirk.gg/)
* Rebasing to Godot 4.3 and further development sponsored by [Xibbon Inc.](https://xibbon.com)
* The GDExtension registration of the host process & build system changes were based
  on @Faolan-Rad's LibGodot PR: https://github.com/godotengine/godot/pull/72883
* Thanks to Ben Rog-Wilhelm (Zorbathut) for creating a smaller, minimal version for easier review.
* Thanks to Ernest Lee (iFire) for his support

Co-Authored-By: Gabor Koncz <gabor.koncz@migeran.com>
Co-Authored-By: Ben Rog-Wilhelm <zorba-github@pavlovian.net>
2025-10-07 02:15:41 +02:00
Lukas Tenbrink
91c48b3151 Abstract Object virtual pointer init into a method instead of duplicating it across gdvirtual.gen.inc. 2025-10-07 00:12:40 +02:00
Lukas Tenbrink
839e0358b3 Assert that dictionary.h does not include String, and that neither of the fundamental containers include Object. 2025-10-06 23:03:27 +02:00
Ryan
35999a16dd Fix AnimationPlayer to use StringName instead of String
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-10-06 16:29:40 -04:00
HolonProduction
7b2e148687 Bitpack more Object booleans 2025-10-06 22:01:22 +02:00
Thaddeus Crews
c01c7b800d
Merge pull request #111221 from Ivorforce/ahashmap-no-hashmap-include
Remove `hash_map.h` include from `a_hash_map.h`, and remove cross conversion operators
2025-10-06 14:34:15 -05:00
Thaddeus Crews
9fc656d2bf
Merge pull request #110676 from YeldhamDev/can_you_bezier_a_marker
Show marker lines/sections in the animation bezier editor
2025-10-06 14:34:14 -05:00
Thaddeus Crews
62abe9e6e7
Merge pull request #111216 from AdvanceControl/master
Fix incorrect docs example in Dictionary.set description
2025-10-06 14:34:13 -05:00
Thaddeus Crews
48ebbc438e
Merge pull request #111117 from YeldhamDev/focus_corner_cases_fix
Fix cases where `LineEdit` can still show focus with mouse events
2025-10-06 14:34:12 -05:00
Thaddeus Crews
f1f9f54ac3
Merge pull request #111244 from Ivorforce/dont-include-array
Remove `Array` include from `dictionary.h` and `ustring.h`.
2025-10-06 14:34:10 -05:00
Thaddeus Crews
e437cfa280
Merge pull request #111307 from BastiaanOlij/openxr_persistence_layout_issue
Fix small code layout issue in persistence scope initialisation
2025-10-06 14:34:09 -05:00
Thaddeus Crews
5ee1384cbd
Merge pull request #110506 from TokageItLab/reset-mod
Fix Reset on Save corrupt poses if scene has multiple Skeletons
2025-10-06 14:34:08 -05:00
Thaddeus Crews
ce98fae6e8
Merge pull request #111302 from hijawesam/fix/encryption-docs-link
Editor: Fix 'More Info…' link in Export/Encryption
2025-10-06 14:34:06 -05:00
Thaddeus Crews
fdc235f496
Merge pull request #110884 from Kaleb-Reid/fix-spotlight-aabb
Use correct AABB for SpotLight3Ds when `spot_angle > 90`
2025-10-06 14:34:05 -05:00
Thaddeus Crews
36b76fc84c
Merge pull request #110915 from Kaleb-Reid/compat-clear-buffers
Clear intermediate buffers when not in use in Compatibility
2025-10-06 14:34:04 -05:00
Thaddeus Crews
aae2def236
Merge pull request #111266 from HolonProduction/completion-filter-internal
Autocompletion: Filter ClassDB argument options
2025-10-06 14:34:02 -05:00
Thaddeus Crews
8d6426ef1a
Merge pull request #111297 from Repiteo/core/header-cleanup-config
Core: Clean up headers in `core/config`, forward-declare `MainLoop` in `OS`
2025-10-06 14:34:00 -05:00
Thaddeus Crews
b17aa3343a
Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
Mounir Tohami
9894256e3a More XR disable for Viewport and export. 2025-10-06 20:15:07 +03:00
David Snopek
093d191909 Make OpenXRCompositionLayer and its children safe for multithreaded rendering 2025-10-06 10:51:20 -05:00
Lukas Tenbrink
d6036462b1 Remove hash_map.h include from a_hash_map.h, and remove cross conversion operators. 2025-10-06 17:20:31 +02:00
HolonProduction
2adecffbc3 Remove Object::script 2025-10-06 16:27:53 +02:00
Lukas Tenbrink
dc5e615a1d Remove Array include from dictionary.h and ustring.h. 2025-10-06 16:21:36 +02:00
Thaddeus Crews
5935a32e32
Core: Cleanup headers in core/config
- `MainLoop` now forward-declared in `OS`
2025-10-06 09:20:56 -05:00
Thaddeus Crews
d413181b8a
Merge pull request #111224 from Repiteo/ci/scons-bump
CI: Bump SCons version [4.9.0→4.10.0]
2025-10-06 09:06:50 -05:00
Thaddeus Crews
d1d28c0bcf
Merge pull request #111223 from Ivorforce/remove-iterator-include
Replace `std::size` usage with `std_size` to avoid `<iterator>` include.
2025-10-06 09:06:49 -05:00
Thaddeus Crews
93a5f4fab2
Merge pull request #111222 from Repiteo/ci/codeowners-tweaks
CI: Fix `CODEOWNERS` inconsistencies
2025-10-06 09:06:47 -05:00
Thaddeus Crews
fa1c53bb8e
Merge pull request #111204 from syntaxerror247/suspend-btn
Android Editor: Update suspend button icon in GameMenuBar
2025-10-06 09:06:46 -05:00
Thaddeus Crews
788745e5b8
Merge pull request #108644 from bnjmntmm/secure-android-surface
Use of `XrSwapchainCreateFlags` for `OpenXRCompositionLayer`
2025-10-06 09:06:45 -05:00
Thaddeus Crews
12aa435bbb
Merge pull request #107740 from Kaleb-Reid/compat-directional-shadow-scatter
Apply sun scatter from lights with shadows in compatibility
2025-10-06 09:06:44 -05:00
Thaddeus Crews
6ece891ae6
Merge pull request #110684 from Kaleb-Reid/fix-compat-refraction
Use correct screen-space to ndc equation in Compatibility refraction
2025-10-06 09:06:43 -05:00
Thaddeus Crews
6febc2bf96
Merge pull request #111066 from Ivorforce/memory-namespace
Change `Memory` from a class into a namespace.
2025-10-06 09:06:42 -05:00
Thaddeus Crews
d8df20a2e6
Merge pull request #110932 from Ivorforce/string-buffer-size-comment
Add comments to `String::size` to lead people to `length()` and explain the difference.
2025-10-06 09:06:40 -05:00
Thaddeus Crews
9f4f16c588
Merge pull request #110672 from Kaleb-Reid/fallback-scaling-type
Use correct scaling type when falling back to bilinear
2025-10-06 09:06:39 -05:00
Thaddeus Crews
f85dc0720d
Merge pull request #111303 from Kaleb-Reid/fix-dof-msaa-mobile
Use resolved depth texture for DOF with MSAA in Mobile
2025-10-06 09:06:38 -05:00
Thaddeus Crews
686b56fae9
Merge pull request #106434 from Ivorforce/invert-hashfuncs
Reduce cross project includes by rewriting `HashMapHasherDefault`.
2025-10-06 09:06:37 -05:00
Thaddeus Crews
dd6ffaabdc
Merge pull request #105793 from Ivorforce/gdtype-the-first
Core: Add initial architecture for first-class `Object` types. Optimize `is_class`
2025-10-06 09:06:36 -05:00
Thaddeus Crews
e8535bc27e
Merge pull request #111292 from WhalesState/tree-tooltip-crash
Fix Tree column title tooltip crash.
2025-10-06 09:06:34 -05:00
Thaddeus Crews
d364dacac1
Merge pull request #110004 from Kaleb-Reid/divide-luminance
Divide screen texture by luminance multiplier in compatibility
2025-10-06 09:06:33 -05:00
Thaddeus Crews
30a0a41982
Merge pull request #111274 from chocola-mint/include-optimization-logger
Remove `file_access.h` and `script_backtrace.h` includes from `logger.h`.
2025-10-06 09:06:32 -05:00
Thaddeus Crews
5b2d91ef31
Merge pull request #111270 from chocola-mint/include-optimization-control
Remove `timer.h` include from `control.h`.
2025-10-06 09:06:31 -05:00
Thaddeus Crews
43a9999852
Merge pull request #111260 from devloglogan/compat-motion-vec-fix
Add null check when getting motion vector fbo
2025-10-06 09:06:30 -05:00
Thaddeus Crews
ef5ecd95d7
Merge pull request #111254 from Ivorforce/object-no-rb-rw
Remove `rw_lock.h` and `rb_map.h` includes from `object.h`.
2025-10-06 09:06:29 -05:00
Thaddeus Crews
925d7003f8
Merge pull request #111253 from mortifiedtux/that_header_is_a_execute
Make basis_universal `basisu_astc_hdr_6x6_enc.h` non-executable
2025-10-06 09:06:28 -05:00
Thaddeus Crews
dac4704447
Merge pull request #111248 from J4RH/colorpicker-reverting-fix
Check that ColorPickerButton popup is currently open in `_modal_closed()`
2025-10-06 09:06:27 -05:00
Thaddeus Crews
f9a2ecd184
Merge pull request #111116 from KoBeWi/fdm
Unify FileDialog context menus
2025-10-06 09:06:25 -05:00
Thaddeus Crews
3b04c8464c
Merge pull request #107273 from DexterFstone/add-game-speed-controls
Add game speed controls to the embedded game window
2025-10-06 09:06:24 -05:00
Thaddeus Crews
660bf91360
Merge pull request #111240 from Kaleb-Reid/compat-fix-backbuffer
Always use RenderSceneBuffers to manage backbuffer in Compatibility 3D
2025-10-06 09:06:23 -05:00
Skyth
b568b06970 Fix D3D12 not checking for fullscreen clear region correctly. 2025-10-06 16:56:05 +03:00
Michael Alexsander
984b52a972
Fix cases where LineEdit can still show focus with mouse events 2025-10-06 10:19:35 -03:00
Rémi Verschelde
ef5cd99604
Merge pull request #106837 from reduz/unique-node-ids2
Add unique Node IDs to support base and instantiated scene refactorings
2025-10-06 14:08:24 +02:00
Rémi Verschelde
e277b3f0ce
Merge pull request #111301 from stuartcarnie/macos_disable_opengl
macOS: Move includes inside `#ifdef` so OpenGL can be disabled
2025-10-06 14:08:20 +02:00
Rémi Verschelde
1043c3fd64
Merge pull request #111300 from stuartcarnie/net_unix_error_spam
Unix: Don't print an error if `bind` fails
2025-10-06 14:08:16 +02:00
Rémi Verschelde
bc0342b3ef
Merge pull request #111290 from HolonProduction/lsp-restart
LSP: Fix repeated restart attempts
2025-10-06 14:08:12 +02:00
Rémi Verschelde
900bd07d10
Merge pull request #111125 from BlueCube3310/lightmap-sort-bitshift
Fix LightmapGI not being correctly applied to objects
2025-10-06 14:08:07 +02:00
Rémi Verschelde
6f0f5a9bd0
Merge pull request #111058 from timothyqiu/wnohang
Unix: Fix retrieval of PID exit code
2025-10-06 14:08:03 +02:00
Rémi Verschelde
480f3d1119
Merge pull request #110017 from bruvzg/acomp_col_check
Add column boundary check in the autocompletion.
2025-10-06 14:07:53 +02:00
arkology
cb321840a1 Improve auto-translation of SpriteFramesEditor 2025-10-06 11:02:35 +00:00
Juan
faddd60c40
Add unique Node IDs to support base and instantiated scene refactorings
The main goal of this PR is to safeguard when a base or instantiated scene changes (nodes renamed, moved or readded),
that the hierarchy is still maintained and the node and its overridden properties can be preserved.

What it does:
* Implements unique node IDs.
* These IDs act as a fallback to names when saving.
* The IDs are **USED AS A FALLBACK**, so they are just an addition. It should not break any current existing scene.
* If a scene renames or moves a node, inherited or instantiated scenes will no longer lose reference to it.

Unlike the previous approach, this one is intended to be a fallback, only used if the node is not found.
This makes it safer to implement and ensure that, at worst case, we fail to find the node, but nothing breaks.
2025-10-06 12:55:38 +02:00
Lukas Tenbrink
40b9d003af Improve type registration order in register_core_types.cpp. 2025-10-06 10:53:31 +02:00
Pāvels Nadtočajevs
91fc0c3756
[Windows] Fix application manifest in exported projects with modified resources. 2025-10-06 11:33:02 +03:00
Pāvels Nadtočajevs
0d056cf294
Fix editor embedded windows partially resizing. 2025-10-06 09:12:20 +03:00
Clay John
60b7b8b16e
Merge pull request #111234 from Kaleb-Reid/compat-fix-depth-scaling
Fix warning spam in Compatibility when using depth texture
2025-10-05 21:33:00 -07:00
Daniel Cavazos
3fa500d2f3
Update tutorial link for calling Javascript from script 2025-10-05 21:32:19 -07:00
Bastiaan Olij
e2a8e93005 Fix small code layout issue in persistence scope initialisation 2025-10-06 13:07:33 +11:00
Aaron Franke
5d492e1aed
GLTF: Allow parsing glTF files without nodes 2025-10-05 17:39:49 -07:00
Lukas Tenbrink
9d44b68867 Remove rw_lock.h and rb_map.h includes from object.h. 2025-10-05 23:29:04 +02:00
Kaleb Reid
ac8491ae72 Use resolved depth texture for DOF with MSAA in Mobile 2025-10-05 13:51:42 -07:00
HolonProduction
7f77565b66 Remove unused members from Viewport 2025-10-05 22:41:16 +02:00
Wesam
a9d361f88f editor: Fix 'More Info…' link in Export/Encryption (Fixes #111108) 2025-10-05 22:28:31 +03:00
Stuart Carnie
94c7c2b780 MacOS: Move includes inside #ifdef so OpenGL can be disabled 2025-10-06 06:20:44 +11:00
Stuart Carnie
47d757d3dc Unix: Don't print an error if bind fails 2025-10-06 06:12:13 +11:00
GlitchedCode
c5183d21db Project Manager: Prohibit duplicating a project into itself 2025-10-05 21:50:00 +03:00
Pāvels Nadtočajevs
1211cd827e
Add project setting and build option to disable override.cfg and related CLI arguments. 2025-10-05 21:47:57 +03:00
HolonProduction
abeb9c654e Move deprecated has_named_classes from ScriptLanguage to ScriptLanguageExtension 2025-10-05 16:55:06 +02:00
Mounir Tohami
5a8c3bb0de Fix column title tooltip crash. 2025-10-05 17:48:21 +03:00
HolonProduction
400c77f170 LSP: Fix repeated restart attempts 2025-10-05 16:09:21 +02:00
HolonProduction
db9a0d82d9 Store ThemeOwner owner directly as Node* 2025-10-05 13:41:17 +02:00
chocola-mint
ead282ff13 Remove file_access.h and script_backtrace.h includes from logger.h. 2025-10-05 17:49:23 +09:00
DexterFstone
7ddce8ab26 Add game speed controls to the embedded game window 2025-10-05 11:13:15 +05:30
chocola-mint
19c47c5d99 Remove #include "scene/main/timer.h" from control.h 2025-10-05 14:41:06 +09:00
Mounir Tohami
af404ff584 Fix 2D debug templates linking 2025-10-05 04:22:49 +03:00
Lukas Tenbrink
ad600125df Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +02:00
Kaleb Reid
79b1a6defc Implement DirectionalLight3D cull masks in Compatibility 2025-10-04 16:08:27 -07:00
Lukas Tenbrink
1db0a60dc0 Replace std::size usage with std_size to avoid <iterator> include. 2025-10-05 00:26:11 +02:00
HolonProduction
5c3eb8b227 Autocompletion: Filter ClassDB argument options 2025-10-04 23:44:07 +02:00
Kaleb Reid
a88c54a5c7 Clear intermediate buffers when not in use in Compatibility 2025-10-04 13:51:23 -07:00
devloglogan
39c449fc60 Add null check when getting motion vector fbo 2025-10-04 13:18:59 -05:00
Lukas Tenbrink
4211499248 Change Memory from a class into a namespace. 2025-10-04 17:22:07 +02:00
Shaderman
636763276e Add shortcuts to reset position, rotation and scale in Spatial and Canvas Item Editor 2025-10-04 16:50:35 +02:00
Kacper Gibas
0fc8aacc64
Make basisu_astc_hdr_6x6_enc.h non-executable 2025-10-04 15:48:35 +02:00
scgm0
8657d8a090 Fix RichTextLabel Focus 2025-10-04 20:52:03 +08:00
Kaleb Reid
91167c3c23 Use correct AABB for SpotLight3Ds when spot_angle > 90 2025-10-04 02:12:51 -07:00
Kaleb Reid
96ca7a205d Use correct ndc equation in Compatibility refraction 2025-10-04 02:03:31 -07:00
Jared
3d0daf15e1 Add visibility check in color_picker.cpp
Check that the Color Picker Popup is currently visible inside the tree before resetting the color and emitting popup_closed.
2025-10-04 21:30:49 +13:00
Kaleb Reid
e1f19d14dd Always use RenderSceneBuffers to manage backbuffer in Compatibility 3D 2025-10-04 01:06:09 -07:00
Kaleb Reid
c20ab940aa Apply sun scatter from lights with shadows in compatibility 2025-10-04 00:35:31 -07:00
Kaleb Reid
8ad335eae0 Divide screen texture by luminance multiplier in compatibility 2025-10-04 00:19:42 -07:00
rune-scape
d779c98ee1 allow inheriting EditorPlugin 2025-10-03 22:54:13 -07:00
vaner-org
79b45ac162 Make BlendSpace cursor default, and more like StateMachine 2025-10-04 09:35:44 +05:30
AdvanceControl
c24d6afd64
Docs: Fix example in Dictionary.set description 2025-10-04 11:11:54 +08:00
Kaleb Reid
d616da4498 Fix warning spam in Compatibility when using depth texture 2025-10-03 16:13:54 -07:00
GabCoolDude
f394656844 Fix color text's tooltip not being updated when the intensity is more than 0
Before, the tooltip would only change when pressing the "#" button in the editor, but it would never change at runtime or in the editor when changing the intensity
2025-10-03 23:33:47 +02:00
kobewi
4986e28bef Allow to rearrange translation list via drag and drop 2025-10-03 20:44:56 +02:00
Malcolm Anderson
36c7bbb47a Visualize MarginContainer margins when selected
This time as an EditorPlugin!

Improve rendering of inner area of MarginContainer

Decrease thickness and opacity of lines, and render margins as a rectangle rather than lines extending to the edges of the bounding box

Apply suggestions from code review

Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>

Use `get_margin_size`, change color of viz border, and trigger redraw on MarginContainer's draw signal
2025-10-03 11:42:05 -07:00
Thaddeus Crews
e1a7a18747
CI: Bump SCons version [4.9.0→4.10.0] 2025-10-03 13:06:56 -05:00
Thaddeus Crews
00129b2199
CI: Fix CODEOWNERS inconsistencies 2025-10-03 12:48:46 -05:00
Thaddeus Crews
06827c91c6
Merge pull request #107839 from Rudolph-B/Occlusion-Culling-Optimization
Minor Optimization to Occlusion Culling
2025-10-03 12:01:13 -05:00
Thaddeus Crews
f6aa5ba23c
Merge pull request #97210 from AleksLitynski/object-snapshot-debugger
Add an ObjectDB Profiling Tool
2025-10-03 12:01:11 -05:00
Thaddeus Crews
6dfe5de9a8
Merge pull request #111158 from WhalesState/trivial-itr
Refactor `Array` iterators to be trivially copyable.
2025-10-03 12:01:10 -05:00
Thaddeus Crews
d9ba9ba3da
Merge pull request #97151 from devloglogan/motion-vectors
Implement motion vectors in compatibility renderer
2025-10-03 12:01:10 -05:00
Thaddeus Crews
cf3c00056c
Merge pull request #109974 from rsanchezsaez/apple/swiftui-lifecycle
SwiftUI lifecycle for Apple embedded platforms
2025-10-03 12:01:09 -05:00
Thaddeus Crews
b35a75e429
Merge pull request #111194 from passivestar/secondary-lists
Add missing ItemListSecondary and TreeSecondary theme type variations
2025-10-03 12:01:08 -05:00
Thaddeus Crews
fb572aff53
Merge pull request #107666 from Sch1nken/add-physics-interpolation-multimesh2d
Add MultiMesh physics interpolation for 2D transforms (MultiMeshInstance2D)
2025-10-03 12:01:07 -05:00
Thaddeus Crews
554e16fac2
Merge pull request #95853 from bruvzg/win_no_id
[Windows] Simplify ANGLE fallback list and remove ID checks.
2025-10-03 12:01:06 -05:00
Thaddeus Crews
71a485a1af
Merge pull request #104715 from Andrewyuan34/add-auto-scroll
Add auto-scroll behavior when selecting text outside the visible area in RichTextLabel
2025-10-03 12:01:05 -05:00
Thaddeus Crews
1566eec9cf
Merge pull request #111191 from Nintorch/fix-joy-vibration
Fix weak and strong joypad vibration being swapped
2025-10-03 12:01:04 -05:00
Thaddeus Crews
00f8f62be7
Merge pull request #106084 from Kaleb-Reid/fix-geometry-3d
Fix ghost collisions in segment_intersects_convex()
2025-10-03 12:01:02 -05:00
Thaddeus Crews
38af23a654
Merge pull request #89409 from aaronfranke/server-folders
Move server files into their subfolders
2025-10-03 12:01:00 -05:00
Thaddeus Crews
c3caa263bf
Merge pull request #111106 from aaronfranke/group-2d-cam-override
Group together 2D camera override functions
2025-10-03 12:00:59 -05:00
Thaddeus Crews
eecb957610
Merge pull request #111169 from YeldhamDev/tab_icon_modulation
Add icon color theme items for `TabBar` and `TabContainer`
2025-10-03 12:00:58 -05:00
Pāvels Nadtočajevs
1c50f8660a
Add column boundary check in the autocompletion. 2025-10-03 19:17:58 +03:00
Seif El-Din Ahmed
2cb1c51038 Expose is_valid() 2025-10-03 18:37:00 +03:00
Michael Alexsander
8973c91293
Add icon color theme items for TabBar and TabContainer 2025-10-03 10:41:28 -03:00
Rémi Verschelde
6d33ad2917
Merge pull request #111201 from KoBeWi/datameta
Ensure correct metadata for enum items
2025-10-03 12:49:38 +02:00
Anish Mishra
4b519317cd Android Editor: Update suspend button icon in GameMenuBar 2025-10-03 15:59:37 +05:30
passivestar
3316609ddd Add missing ItemListSecondary and TreeSecondary theme type variations 2025-10-03 13:34:49 +04:00
kobewi
8d91f83244 Ensure correct metadata for enum items 2025-10-03 11:31:16 +02:00
Nintorch
4a3bf069a6 Fix invalid reported joypad presses 2025-10-03 11:35:09 +05:00
Nintorch
e5ecc392c9 Fix weak and strong joy vibration being swapped 2025-10-03 11:08:39 +05:00
bruvzg
ab287991cf
[Windows] Simplify ANGLE fallback list and remove ID checks. 2025-10-03 08:07:43 +03:00
Silc Lizard (Tokage) Renew
8df06279c6 Fix Reset on Save corrupt poses if scene has multiple Skeletons 2025-10-03 10:33:33 +09:00
Silc Lizard (Tokage) Renew
749d9b95b9 Fix backward root motion in AnimationTree 2025-10-03 10:30:57 +09:00
kobewi
9af58c1133 Unify FileDialog context menus 2025-10-02 23:10:27 +02:00
Aaron Franke
e2dd60b5f8
Group together 2D camera override functions 2025-10-02 13:21:44 -07:00
Thaddeus Crews
7fbc3a5307
Merge pull request #111133 from versjon/master
Fix typo "blocker" to "block" in AESContext
2025-10-02 15:12:02 -05:00
Thaddeus Crews
b67b765a10
Merge pull request #111159 from KoBeWi/soon
Remaining FileDialog changes before unification
2025-10-02 15:12:02 -05:00
Thaddeus Crews
7bdec67718
Merge pull request #111126 from HolonProduction/gotta-get-path
Optimize initial `Node::get_path` call by avoiding `Vector::reverse`
2025-10-02 15:12:01 -05:00
Thaddeus Crews
f44aa13a9f
Merge pull request #111090 from dsnopek/gdextension-compat-unexposed-classes-redo
GDExtension: Prevent breaking compatibility for unexposed classes that can only be created once
2025-10-02 15:12:00 -05:00
Thaddeus Crews
96c0d7c90d
Merge pull request #111149 from WhalesState/fix-2d-templates
Fix game `Camera2D` override from editor and 2D debug templates building.
2025-10-02 15:11:58 -05:00
Thaddeus Crews
c6a850634f
Merge pull request #111150 from WhalesState/remote-tree
Fix switching back to local SceneTree.
2025-10-02 15:11:57 -05:00
Thaddeus Crews
9281613e76
Merge pull request #98061 from dalexeev/gds-remove-unnecessary-bools
GDScript: Remove some unnecessary booleans
2025-10-02 15:11:56 -05:00
Thaddeus Crews
c82387b384
Merge pull request #110827 from YeldhamDev/not_quite_right
Fix regression with min size on nested inspectors
2025-10-02 15:11:55 -05:00
Thaddeus Crews
51ba8c1c12
Merge pull request #111146 from Kaleb-Reid/fix-sdl-no-dbus
Fix compiling SDL without DBus under Linux
2025-10-02 15:11:54 -05:00
Thaddeus Crews
1e3754c1d1
Merge pull request #111141 from stuartcarnie/shader_container_fix
Renderer: Fix missing shader_name; use forward declarations
2025-10-02 15:11:53 -05:00
kobewi
fdc79f5286 Remaining FileDialog changes before unification 2025-10-02 19:13:04 +02:00
Rémi Verschelde
0f3e975aac
Merge pull request #111134 from KoBeWi/remove_remove_char
Fix enum strings losing space
2025-10-02 14:05:42 +02:00
Mounir Tohami
9ff5325642 Refactor Array iterators to be trivially copyable. 2025-10-02 14:30:55 +03:00
Mounir Tohami
d9af8e0acc Fix Camera2D editor override and 2D debug templates. 2025-10-02 13:52:29 +03:00
Danil Alexeev
5f0ecf4c8c
GDScript: Remove some unnecessary booleans
Co-authored-by: HolonProduction <holonproduction@gmail.com>
2025-10-02 13:36:03 +03:00
Mounir Tohami
2182dedcc6 Fix switching back to local SceneTree. 2025-10-02 11:46:47 +03:00
Kaleb Reid
03eb42642c Fix compiling SDL without DBus under Linux 2025-10-02 00:56:32 -07:00
Stuart Carnie
3ffcae66a8 Renderer: Fix missing shader_name; use forward declarations
* Moving over to RenderingShaderContainer, missed setting shader_name
* Use forward declaration reduces compile time when modifying
  rendering_shader_container.h from over 950s to about 10-15
2025-10-02 10:02:18 +10:00
Thaddeus Crews
abbe792575
Merge pull request #111067 from HolonProduction/rm-multiplayer
Remove unused `multiplayer` member from `Node`
2025-10-01 17:54:20 -05:00
Thaddeus Crews
8f386fd9c4
Merge pull request #110775 from fstxz/preload-comma
Allow trailing comma in `preload`
2025-10-01 17:54:19 -05:00
Thaddeus Crews
33bfd1fac4
Merge pull request #111060 from Kaleb-Reid/fix-dof-enable
Always show settings to enable DOF near + far
2025-10-01 17:54:18 -05:00
Thaddeus Crews
c92430e84a
Merge pull request #110737 from DeeJayLSP/no-embolden-when-variable
Editor font: do not embolden the Main Font if it's variable
2025-10-01 17:54:17 -05:00
Thaddeus Crews
1a504af2ee
Merge pull request #111121 from syntaxerror247/fix-drag-issue
Fix bottom panel being unintentionally draggable
2025-10-01 17:54:15 -05:00
Thaddeus Crews
1c4760878b
Merge pull request #110843 from allenwp/fix-glow-intensity-editor-compatibility
Fix glow intensity not showing in compatibility renderer
2025-10-01 17:54:15 -05:00
Thaddeus Crews
be9f6b480c
Merge pull request #111087 from jrouwe/issue_109018
[JoltPhysics] Fix Generic6DOFJoint3D not respecting angular limits
2025-10-01 17:54:13 -05:00
Thaddeus Crews
ef496a4289
Merge pull request #111085 from KoBeWi/focus_tagger
Fix tag name focus
2025-10-01 17:54:12 -05:00
Thaddeus Crews
127c2a347e
Merge pull request #110793 from Calinou/editor-macos-export-tweak-messages
Tweak macOS notarization export message in the editor
2025-10-01 17:54:11 -05:00
Thaddeus Crews
bf926c2000
Merge pull request #106503 from KoBeWi/docker_exe
Rework editor docks
2025-10-01 17:54:10 -05:00
Thaddeus Crews
4594de69fd
Merge pull request #111013 from stuartcarnie/shader_container_ext
Renderer: Move `reflect_spirv` to `RenderingShaderContainer`
2025-10-01 17:54:09 -05:00
Thaddeus Crews
25de1a353a
Merge pull request #107587 from Ivorforce/static-assert-includes
Add `STATIC_ASSERT_INCOMPLETE_TYPE` to enforce include minimality.
2025-10-01 17:54:08 -05:00
Lukas Tenbrink
712bc99668 Add STATIC_ASSERT_INCOMPLETE_TYPE to enforce include minimality.
Add enforcements against `Dictionary` for `ustring.h` and two for `Dictionary` and `String` from `array.h`.
2025-10-01 23:46:35 +02:00
HolonProduction
b50ce590b4 Optimize initial Node::get_path call by avoiding Vector::reverse 2025-10-01 22:56:53 +02:00
kobewi
ea452f2de5 Set correct saved history after clearing 2025-10-01 22:27:36 +02:00
kobewi
60c45fb64c Fix enum strings losing space 2025-10-01 22:00:31 +02:00
Jon
54094b9073
Fixed typo "blocker" to "block" in AESContext
Changed 'AES cipher blocker chaining' to 'AES cipher block chaining' in two mode definitions in AESContext
2025-10-01 21:44:01 +02:00
Thaddeus Crews
caefb0f1c1
Merge pull request #110527 from WhalesState/text-edit-styles
Fix TextEdit `read_only` drawing.
2025-10-01 13:12:47 -05:00
Thaddeus Crews
817974ec53
Merge pull request #108766 from aaronfranke/move-mat-3d-conv
Move Material3D conversion editor plugins to their own folder
2025-10-01 13:12:46 -05:00
Thaddeus Crews
d9078d887f
Merge pull request #109049 from ryevdokimov/deprecate-script-add-root-node
Relocate `add_root_node` method to `EditorInterface` from `EditorScript` and deprecate old method
2025-10-01 13:12:45 -05:00
Thaddeus Crews
a0afcdd05a
Merge pull request #103416 from CreatedBySeb/animation-workflow-enhancements
Minor Animation Player workflow enhancements
2025-10-01 13:12:44 -05:00
Thaddeus Crews
6bfcfd1d33
Merge pull request #106039 from Ivorforce/cowdata-reserve-exact
Add `reserve_exact` to `CowData`, and change growth factor to 1.5x
2025-10-01 13:12:43 -05:00
Thaddeus Crews
45dfd4dd23
Merge pull request #108147 from KoBeWi/set_get_is_back
Expose FileDialog callbacks for getting custom icons
2025-10-01 13:12:42 -05:00
Thaddeus Crews
1df6a40aa0
Merge pull request #110066 from Giganzo/folder-color
Fix folder color in FileSystem Dock when using light theme
2025-10-01 13:12:41 -05:00
Thaddeus Crews
f9be832eca
Merge pull request #110257 from BlueCube3310/mip-gen-all-formats
Image: Support generating mipmaps for all uncompressed formats
2025-10-01 13:12:40 -05:00
Thaddeus Crews
486626413b
Merge pull request #110444 from bruvzg/rtl_bb_sp
[RTL] Fix `outline_size=0` and `font`/`otf` tags with invalid arguments breaking tag stack and spamming errors.
2025-10-01 13:12:39 -05:00
Thaddeus Crews
6f014135c4
Merge pull request #110317 from bruvzg/ts_zero_w
[TextServer] Do not add extra spacing to zero-width glyphs.
2025-10-01 13:12:38 -05:00
Thaddeus Crews
9712d6fb1f
Merge pull request #109549 from jroprohehe/unknown_error_getting_token_fix
Fix the text editor confusing resource files of class JSON with json files.
2025-10-01 13:12:37 -05:00
Thaddeus Crews
f745685f54
Merge pull request #110028 from zeux/simplify-prune
Enable component pruning during mesh simplification
2025-10-01 13:12:36 -05:00
Thaddeus Crews
eab59f8057
Merge pull request #111115 from mihe/jolt/drop-experimental
Drop the experimental label for the Jolt Physics integration
2025-10-01 13:12:35 -05:00
Thaddeus Crews
6b9acd7e9e
Merge pull request #110055 from dagarsar/tree-rtl
Add helper methods to convert right-to-left `Rect2i` and `Point2i` in `Tree`'s `draw_item`
2025-10-01 13:12:34 -05:00
Thaddeus Crews
7eaf1ee62d
Merge pull request #110278 from KoBeWi/controledraw
Redraw shape controls when ColorPicker theme changes
2025-10-01 13:12:33 -05:00
Thaddeus Crews
0a5f7125e4
Merge pull request #104740 from Jojo-1000/update-import-plugin-docs
Update EditorImportPlugin docs and clarify which methods are required
2025-10-01 13:12:32 -05:00
Thaddeus Crews
42263551b5
Merge pull request #110212 from Giganzo/spin-box-held-down
Fix SpinBox value change when held down on separation between buttons
2025-10-01 13:12:31 -05:00
BlueCube3310
24ed12d4a3 Fix LightmapGI not being correctly applied to objects 2025-10-01 19:18:09 +02:00
Lukas Tenbrink
ac85d24e64 Add GDType and Object::_gdtype_ptr for first-class Object typing.
The type is currently bare-bones, but will be expanded in future PRs.
2025-10-01 18:49:48 +02:00
Anish Mishra
f7e052a456 Fix bottom panel being unintentionally draggable 2025-10-01 21:44:26 +05:30
kobewi
ddcb3cfcf5 Store script states for built-in scripts 2025-10-01 17:57:46 +02:00
Mikael Hermansson
b5d0f7a5d2 Drop the experimental label for the Jolt Physics integration 2025-10-01 13:02:10 +02:00
Lukas Tenbrink
bac9a9be85 Add comments to String::size to lead people to length() and explain the difference.
# Conflicts:
#	core/string/ustring.h
2025-10-01 12:08:37 +02:00
kobewi
f88b51995b Expose FileDialog callbacks for getting custom icons 2025-10-01 12:08:34 +02:00
Lukas Tenbrink
c993db9688 Add reserve_exact to CowData and Vector.
Change growth factor to be an indeterministic 1.5x.
Use `reserve_exact` in `FileAccess` to reduce on binary file loading RAM usage.

# Conflicts:
#	core/templates/cowdata.h
2025-10-01 11:57:40 +02:00
Pāvels Nadtočajevs
61003f18ab
[Label] Add MSDF pixel range/outline configuration warning. 2025-10-01 12:31:08 +03:00
Aaron Franke
3d1c9fd5de
Move server files into their subfolders 2025-09-30 19:39:39 -07:00
Aaron Franke
06f0c3fef6
Move Material3D conversion editor plugins to their own folder 2025-09-30 19:15:32 -07:00
Haoyu Qiu
42b27932a8 Fix description about CharacterBody velocity and delta 2025-10-01 09:55:47 +08:00
Thaddeus Crews
d705613db3
Merge pull request #110964 from mihe/jolt/invalid-test-motion
Fix crash when calling `move_and_collide` with a null `jolt_body`
2025-09-30 20:10:49 -05:00
Thaddeus Crews
dd09d5b7dd
Merge pull request #110576 from Rindbee/fix-the-project-file-not-updated-when-some-file-removed
Fix the project file was not updated when some files were removed
2025-09-30 20:10:48 -05:00
Thaddeus Crews
ac65df58a5
Merge pull request #110946 from KoBeWi/regions_of_ruin
Fix region folding not loading properly
2025-09-30 20:10:47 -05:00
Thaddeus Crews
7288419939
Merge pull request #110936 from bruvzg/mac_ver_check
Change `macos.permission.RECORD_SCREEN` version check from 10.15 to 11.0.
2025-09-30 20:10:46 -05:00
Thaddeus Crews
44f4002bf2
Merge pull request #110661 from Calinou/dpitexture-fix-icon-name
Fix DPITexture editor icon name
2025-09-30 20:10:45 -05:00
Thaddeus Crews
09609c1320
Merge pull request #111043 from HolonProduction/rm-import-path
Remove unused `import_path` member from `Node`
2025-09-30 20:10:44 -05:00
Thaddeus Crews
45502d1f04
Merge pull request #104510 from fstxz/gridmap-preview-scale
GridMap: fix cell scale not applying to the cursor mesh
2025-09-30 20:10:43 -05:00
Thaddeus Crews
318e6c77b5
Merge pull request #108473 from mihe/clickable-diagnostics
Make file part of errors/warnings clickable in Output panel
2025-09-30 20:10:42 -05:00
Thaddeus Crews
a430bf6e8b
Merge pull request #110768 from Ir1ana/fix/110710
Fix nested TileMapLayers highlight rendering in editor
2025-09-30 20:10:41 -05:00
Thaddeus Crews
9d7663398a
Merge pull request #106415 from YeldhamDev/desobey_your_master
Ignore changes in "Master" bus while in the Audio Importer
2025-09-30 20:10:40 -05:00
Thaddeus Crews
131d6b14a2
Merge pull request #110894 from Giganzo/spinbox-focus-state
Fix SpinBox stepper grabbing focus state on mouse input
2025-09-30 20:10:39 -05:00
Thaddeus Crews
22467f3a5b
Merge pull request #111018 from Zylann/fix_double_build_get_downloads_availability
Fix unreachable code warning in double-precision builds
2025-09-30 20:10:38 -05:00
Thaddeus Crews
2b7f39ea28
Merge pull request #110505 from Calinou/tweak-draw-command-labels
Tweak draw command label names for consistency
2025-09-30 20:10:37 -05:00
Thaddeus Crews
7b5ee98474
Merge pull request #94118 from CrazyRoka/optimize-gdscript-notifications
Optimize `GDScriptInstance::notification` for better performance
2025-09-30 20:10:36 -05:00
Thaddeus Crews
1889f68007
Merge pull request #110886 from fstxz/fix-line-edit-double-click
Fix LineEdit's placeholder text being selected when double clicking
2025-09-30 20:10:35 -05:00
Thaddeus Crews
7aa229cc8a
Merge pull request #111014 from bruvzg/lbl_sp_x
[TextServer] Enforce zero width spaces and joiners to actually be zero width and not fallback to regular space.
2025-09-30 20:10:34 -05:00
Thaddeus Crews
b9730c0b2e
Merge pull request #110240 from westenral/add_int_division_warnings
Add checks for integer vectors for integer division warning
2025-09-30 20:10:33 -05:00
Thaddeus Crews
e22d442bf6
Merge pull request #110878 from Calinou/doc-node2d-move-local
Fix and improve `Node2D.move_local_{x,y}()` description
2025-09-30 20:10:32 -05:00
Thaddeus Crews
2839d8cee5
Merge pull request #111004 from Calinou/doc-image-compress
Document `compress()` not being supported in exported builds in Image
2025-09-30 20:10:31 -05:00
Thaddeus Crews
5f2593c9a2
Merge pull request #110987 from TokageItLab/smod-physics-interpolate
Make extended SkeletonModifiers retrieve interpolated global transform
2025-09-30 20:10:30 -05:00
Thaddeus Crews
4610e1e517
Merge pull request #107139 from aaronfranke/server-free
Rename server `free` functions to `free_rid` to match exposed API
2025-09-30 20:10:29 -05:00
Aaron Franke
9fbf5808a0
Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Thaddeus Crews
4d231b5bf8
Merge pull request #108146 from KoBeWi/singleton_favrec
Expose methods to access FileDialog's favorite/recent lists
2025-09-30 18:35:26 -05:00
Thaddeus Crews
5240f1c283
Merge pull request #108658 from bruvzg/ed_pl_init
[EditorExportPlatform] Move initialization to a dedicated method.
2025-09-30 18:35:25 -05:00
Thaddeus Crews
1f7bf131b0
Merge pull request #109298 from HolonProduction/autocompletion-cleanup
Autocompletion: Remove duplicate code
2025-09-30 18:35:24 -05:00
Thaddeus Crews
55ac91b887
Merge pull request #111084 from Ivorforce/cowdata-reserve-verbose
Make `CowData::reserve` warn message when new capacity < size verbose, like other `reserve` methods
2025-09-30 18:35:23 -05:00
Thaddeus Crews
5a1bc65e06
Merge pull request #110058 from Rinnegatamante/pc_upstream
Perform per-line or per-rect blits in blit_rect.
2025-09-30 18:35:22 -05:00
Thaddeus Crews
e5bf31b170
Merge pull request #107369 from Ivorforce/node-iter-children
Core: Add `Node::iterate_children` as a fast way to iterate a node's children
2025-09-30 18:35:21 -05:00
Thaddeus Crews
b9010edcfa
Merge pull request #110951 from aaronfranke/const-arr-ref-text-bidi
Use const Array ref in `set_structured_text_bidi_override_options`
2025-09-30 18:35:20 -05:00
Thaddeus Crews
c6189a83b9
Merge pull request #110691 from Ruw-Van/fix-windows-logfile-encoding
Fix windows logfile encoding
2025-09-30 18:35:19 -05:00
Thaddeus Crews
7ca521eda1
Merge pull request #109533 from dsnopek/openxr-api-prevent-updating-extension-lists
OpenXR: Prevent adding/removing extension wrappers after session start
2025-09-30 18:35:18 -05:00
Thaddeus Crews
4f66d53068
Merge pull request #109532 from dsnopek/openxr-api-environment-blend-mode-thread-safe
OpenXR: Safely set environment blend mode when rendering on a separate thread
2025-09-30 18:35:17 -05:00
Thaddeus Crews
a9d4900284
Merge pull request #109779 from dsnopek/thread-is-main-thread
Expose `Thread::is_main_thread()`
2025-09-30 18:35:16 -05:00
Thaddeus Crews
6dc4272a1e
Merge pull request #110156 from aaronfranke/editor-res-filesystem
Fix inconsistent internal name of `get_resource_filesystem`
2025-09-30 18:35:15 -05:00
Thaddeus Crews
af08ab49f7
Merge pull request #107468 from Calinou/editor-animationtree-warn-disabled
Display AnimationTree editor warnings when the node is disabled
2025-09-30 18:35:14 -05:00
Thaddeus Crews
b9513683d5
Merge pull request #109900 from Ryan-000/Make-Node-orphan_node_count-thread-safe
Make Node::orphan_node_count thread-safe
2025-09-30 18:35:13 -05:00
Thaddeus Crews
19165b0b11
Merge pull request #111050 from MBCX/fix-incorrect-color-usage
Fix incorrect usage of `Color::from_hsv()` exposed by newer compilers
2025-09-30 18:35:12 -05:00
Thaddeus Crews
d86123870b
Merge pull request #52285 from rxlecky/camera-override-cleanup
Clean up and simplify camera override API
2025-09-30 18:35:11 -05:00
Thaddeus Crews
93fd5c7ad0
Merge pull request #110907 from beicause/extension-deconstruct-before-object
Free script and extension instance before object deconstructing
2025-09-30 18:35:10 -05:00
Thaddeus Crews
76c039fb09
Merge pull request #108725 from dsnopek/gdextension-mem-alloc-pad-align
GDExtension: Add `mem_alloc2` (and friends) so padding can be requested
2025-09-30 18:35:09 -05:00
Thaddeus Crews
6b22951162
Merge pull request #107954 from stuartcarnie/unix_domain_socket_support
Add Core UNIX domain socket support
2025-09-30 18:35:08 -05:00
Thaddeus Crews
f9a6e51e21
Merge pull request #104488 from arkology/texture-editors-reuse-shader
TextureEditors: Compile shader/material only once
2025-09-30 18:35:07 -05:00
Thaddeus Crews
70b6fa1525
Merge pull request #108576 from ryevdokimov/gizmo-rotation-arc
Create a rotation arc showing accumulated rotation when using transform gizmo
2025-09-30 18:35:06 -05:00
Thaddeus Crews
8bc1dd63f4
Merge pull request #107936 from mihe/missing-await-warning
Add opt-in GDScript warning for when calling coroutine without `await`
2025-09-30 18:35:05 -05:00
Thaddeus Crews
4c3765d9ff
Merge pull request #108826 from BlueCube3310/bc1-rgb
Compatibility: Explicitly use BC1's RGB variant
2025-09-30 18:35:04 -05:00
Thaddeus Crews
6f3c5088ae
Merge pull request #110492 from KoBeWi/pro🍐_languages
Improve editor language selector
2025-09-30 18:35:03 -05:00
Thaddeus Crews
373ff727f0
Merge pull request #110875 from vmedea/2025-wayland-inhibit-idle
wayland: Inhibit idle in DisplayServerWayland::screen_set_keep_on
2025-09-30 18:35:02 -05:00
Thaddeus Crews
4d13966c08
Merge pull request #108698 from Brogolem35/hashset_clear_optimize
Optimize and clean up HashSet::clear
2025-09-30 18:35:01 -05:00
Thaddeus Crews
45d064c388
Merge pull request #109590 from bruvzg/focus_checks
`find_*_valid_focus`: Check all tested neighbors to prevent loops.
2025-09-30 18:35:00 -05:00
Thaddeus Crews
f9694033a5
Merge pull request #107923 from clayjohn/RD-mat3x4
Use Mat3x4 for model and view transforms to save bandwidth and ALUs
2025-09-30 18:34:59 -05:00
Thaddeus Crews
dba83ef669
Merge pull request #101521 from kitbdev/mesh3d_to_primitive_shape
Add MeshInstance3D primitive conversion options
2025-09-30 18:34:58 -05:00
Thaddeus Crews
c28b6c2ced
Merge pull request #109186 from clayjohn/reflection-probe-size-update
Prompt editor restart when reflection probe size is updated
2025-09-30 18:34:57 -05:00
Thaddeus Crews
bf940f0eab
Merge pull request #108672 from KoBeWi/too_much_code
Reduce code duplication in material conversion
2025-09-30 18:34:56 -05:00
Logan Detrick
c3fdc85d16 Hide TileMap overlay when too zoomed out 2025-09-30 16:03:16 -07:00
kobewi
3615b188d7 Expose methods to access FileDialog's favorite/recent lists 2025-09-30 22:46:09 +02:00
David Snopek
2c707a911f GDExtension: Prevent breaking compatibility for unexposed classes that can only be created once 2025-09-30 14:48:06 -05:00
Jorrit Rouwe
9bb8d12c1b Fix Generic6DOFJoint3D not respecting angular limits
A 6DOF constraint that constrains all rotation axis in combination with a body that has some of its rotation axis locked would not constrain the rotation in the unlocked axis.

Fixes #109018
2025-09-30 21:01:27 +02:00
CrazyRoka
bcc0922a20 Optimize GDScriptInstance::notification for better performance 2025-09-30 19:57:35 +01:00
kobewi
56e62869fb Fix tag name focus 2025-09-30 20:25:47 +02:00
Lukas Tenbrink
8f533897d8 Make CowData::reserve warn message when new capacity < size verbose, like other reserve methods. 2025-09-30 20:21:02 +02:00
BlueCube3310
d07a72e067 Compatibility: Explicitly use BC1's RGB variant 2025-09-30 20:17:22 +02:00
Thaddeus Crews
4a1c1c483b
Merge pull request #110873 from stuartcarnie/fix_metal_baker
Metal: Fix Metal compiler version inspection
2025-09-30 11:19:21 -05:00
Thaddeus Crews
31b25d5971
Merge pull request #111032 from Joonnas/bugfix-stencil-issue-d3d12
Fix d3d12 stencil buffer not clearing
2025-09-30 11:19:20 -05:00
Thaddeus Crews
726c4e9fba
Merge pull request #84658 from detomon/initialize-quaternion-variant-with-identity
Initialize `Quaternion` variant with identity
2025-09-30 11:19:19 -05:00
Thaddeus Crews
0b2805f400
Merge pull request #110897 from Repiteo/windows/migrate-manifest
Windows: Migrate `godot.manifest` to `platform/windows`, include as dependency
2025-09-30 11:19:18 -05:00
Thaddeus Crews
3997e77393
Merge pull request #111054 from Kaleb-Reid/fix-render-list
Sort render list correctly in RD renderers
2025-09-30 11:19:18 -05:00
Thaddeus Crews
21fd4faf1b
Merge pull request #107469 from Ivorforce/vector-localvector-explicit-span-conversions
Remove implicit conversions between `LocalVector` and `Vector`
2025-09-30 11:19:17 -05:00
Thaddeus Crews
79d0eea742
Merge pull request #110616 from aaronfranke/fix-rtos-fix-32bit
Apply rtos_fix hack for handling 32-bit floats on all calls to rtos_fix
2025-09-30 11:19:16 -05:00
Thaddeus Crews
7974cf00e7
Merge pull request #110952 from aaronfranke/skip-cons-then-copy
Skip copying values constructed immediately before returning
2025-09-30 11:19:15 -05:00
Thaddeus Crews
5089e9aef0
Merge pull request #105737 from Calinou/editor-project-settings-init-jolt
Use Jolt Physics by default in newly created projects
2025-09-30 11:19:14 -05:00
Thaddeus Crews
62933b683e
Merge pull request #105928 from Ivorforce/cowdata-reserve-capacity
Core: Add `reserve` function to `Array`, `Vector`, and `String`
2025-09-30 11:19:13 -05:00
Thaddeus Crews
e256771e86
Merge pull request #108836 from aaronfranke/json-grisu
Use num_scientific (Grisu2) when stringifying JSON with full precision
2025-09-30 11:19:12 -05:00
Thaddeus Crews
54e8c8eecc
Merge pull request #110948 from aaronfranke/const-ref-param-openxr
Use const ref parameters in the OpenXR module
2025-09-30 11:19:11 -05:00
Thaddeus Crews
0e7bb92b1d
Merge pull request #110977 from aaronfranke/const-ref-param-webrtc
Use const ref parameters in the Web modules
2025-09-30 11:19:11 -05:00
Thaddeus Crews
fdf32d1b2a
Merge pull request #108577 from YYF233333/global_class_list
Simplify `ScriptServer::get_global_class_list`
2025-09-30 11:19:10 -05:00
kobewi
084783e92b Reduce code duplication in material conversion 2025-09-30 16:56:05 +02:00
devloglogan
8fef9a689e Implement motion vectors in compatibility renderer 2025-09-30 09:42:17 -05:00
kobewi
618afcffa6 Add pivot_offset_ratio property to Control 2025-09-30 15:27:52 +02:00
kobewi
be53dd3d04 Fix Quick Open history 2025-09-30 14:26:14 +02:00
HolonProduction
a9673e2bfc Remove unused multiplayer member from Node 2025-09-30 14:02:00 +02:00
Rémi Verschelde
6e33e3b7af
makerst: Skip generated header for translations
This reduces diff size on branch updates for godot-docs-l10n.

(cherry picked from commit eca3785100)
2025-09-30 13:32:46 +02:00
Rémi Verschelde
cf6da2a12e
i18n: Sync translations with Weblate
(cherry picked from commit d488e962df)
2025-09-30 13:32:35 +02:00
Kaleb Reid
c79fe58939 Always show settings to enable DOF near + far 2025-09-29 22:29:24 -07:00
Haoyu Qiu
d5738b5cdd Unix: Fix retrieval of PID exit code 2025-09-30 12:29:49 +08:00
clayjohn
aa8bc0b56d Prompt editor restart when reflection probe size is updated
Also formally deprecate the RS function for updating an individual probes size. The functionality was removed in 4.0, but the function itself was mistakenly left exposed.
2025-09-29 18:35:34 -07:00
Kaleb Reid
5021b3e6e5 Sort render list correctly in RD renderers 2025-09-29 17:22:26 -07:00
MBCX
f00df0ad1e Fix incorrect usage of Color::from_hsv() that was exposed by newer compiler warnings 2025-09-29 18:18:51 -04:00
Malcolm Anderson
9ad608691b Kill subtweens when their parent tween is killed
# Conflicts:
#	scene/animation/tween.h
2025-09-29 15:11:19 -07:00
Ryan
6ebef31b3c Make Node::orphan_node_count thread-safe 2025-09-29 17:54:41 -04:00
Stuart Carnie
65e8b0951b Renderer: Move reflect_spirv to RenderingShaderContainer
This change introduces a new protected type, `ReflectedShaderStage` to
`RenderingShaderContainer` that derived types use to access SPIR-V and
the reflected module, `SpvReflectShaderModule` allowing implementations
to use the reflection information to compile their platform-specific
module.

* Fixes memory leak in `reflect_spirv` that would not deallocate the
  `SpvReflectShaderModule` if an error occurred.
* Removes unnecessary allocation when creating `SpvReflectShaderModule`
  by passing `NO_COPY` flag to `spvReflectCreateShaderModule2`
  constructor function.
* Replaces `VectorView` with `Span` for consistency
* Fixes unnecessary allocations in D3D12 shader container in
  `_convert_spirv_to_nir` and `_convert_spirv_to_dxil` which implicitly
  converted the old `VectorView` to a `Vector`
2025-09-30 06:40:14 +10:00
HolonProduction
743e0edfd7 Remove unused import_path member from Node 2025-09-29 21:40:01 +02:00
Marc Gilleron
0534423c58 Fix unreachable code warning in double-precision builds 2025-09-29 18:36:00 +02:00
kobewi
97b398cba1 Rework editor docks 2025-09-29 17:30:41 +02:00
Jonas Seidl
d1246b099e Fix d3d12 stencil buffer not clearing 2025-09-29 13:16:29 +02:00
Pāvels Nadtočajevs
3f84820711
[TextServer] Enforce zero width spaces and joiners to actually be zero width and not fallback to regular space. 2025-09-29 00:52:34 +03:00
Hugo Locurcio
90a171d278 Document compress() not being supported in exported builds in Image
This also clarifies various parts of the Image class reference.
2025-09-28 23:02:15 +02:00
kobewi
65a00fc60a Delete "Activate now?" button 2025-09-28 22:46:30 +02:00
Pāvels Nadtočajevs
2914a870af
[TextServer] Do not add extra spacing to zero-width glyphs. 2025-09-28 21:39:44 +03:00
Aaron Franke
ac2e01684c
Use const ref parameters in the Web modules 2025-09-28 08:13:13 -07:00
Aaron Franke
c3e6002c6e
Use const ref parameters in the OpenXR module 2025-09-28 08:10:03 -07:00
Thaddeus Crews
8d8041bd4d
Merge pull request #107391 from BastiaanOlij/openxr_spatial_entities_ext
OpenXR: Add support for spatial entities extension
2025-09-28 10:07:49 -05:00
Thaddeus Crews
ef4863ab97
Merge pull request #109764 from ydeltastar/android-fragment-fix
Android: Ensure proper cleanup of the fragment
2025-09-28 10:07:48 -05:00
Thaddeus Crews
781a37420f
Merge pull request #110867 from Repiteo/core/deprecate-skip-cr
Core: Remove `skip_cr` argument from `String`
2025-09-28 10:07:47 -05:00
Thaddeus Crews
f6fc2f4a08
Core: Remove skip_cr argument from String 2025-09-28 10:07:24 -05:00
Pāvels Nadtočajevs
e59a55e645
Fix text servers build with disabled FreeType. 2025-09-28 17:08:51 +03:00
Silc Lizard (Tokage) Renew
f3db297fd1 Make extended SkeletonModifiers retrieve interpolated global transform 2025-09-28 13:35:10 +09:00
Haoyu Qiu
12f8c78231 X11: Fix minimization of maximized windows 2025-09-28 12:19:54 +08:00
Thaddeus Crews
b4472f4670
Merge pull request #110970 from Repiteo/gui/fix-nullptr-deref
GUI: Fix `nullptr` deref in TextServer
2025-09-27 13:42:32 -05:00
Pāvels Nadtočajevs
9a1fbff651
[RTL] Fix outline_size=0 and font/otf tags with invalid arguments breaking tag stack and spamming errors. 2025-09-27 20:42:05 +03:00
Thaddeus Crews
720dfdde7d
GUI: Fix nullptr deref in TextServer 2025-09-27 10:56:01 -05:00
Mikael Hermansson
a285ab6bcf Fix crash when calling move_and_collide with a null jolt_body 2025-09-27 13:30:04 +02:00
clayjohn
14b60f2264 Optimize vertex shader using mat3x4 to reduce bandwidth, load/store operations and ALUs 2025-09-26 23:20:08 -07:00
Bastiaan Olij
eeac57075c OpenXR: Implement spatial entities extension 2025-09-27 12:23:33 +10:00
Aaron Franke
754d49ac81
Skip copying values constructed immediately before returning 2025-09-26 19:13:58 -07:00
Aaron Franke
1a7be001d2
Use const Array ref in set_structured_text_bidi_override_options 2025-09-26 14:31:38 -07:00
kobewi
835383d46b Fix region folding not loading properly 2025-09-26 23:29:31 +02:00
Thaddeus Crews
9283328fe7
Merge pull request #109491 from syntaxerror247/window-color
Android: Add method to set root window color at runtime
2025-09-26 13:47:32 -05:00
Thaddeus Crews
3a16864c33
Merge pull request #107075 from m4gr3d/implement_javaclasswrapper_has_method
[Android] `JavaClassWrapper` bug fixes
2025-09-26 13:47:31 -05:00
Thaddeus Crews
e9cd9a9c35
Merge pull request #110914 from mihe/jolt/multiple-contact-callbacks
Fix CCD bodies adding multiple contact manifolds when using Jolt
2025-09-26 13:47:30 -05:00
Pāvels Nadtočajevs
1c59038555
Change macos.permission.RECORD_SCREEN version check from 10.15 to 11.0. 2025-09-26 19:25:49 +03:00
Hugo Locurcio
c4bbf27cb5 Use Jolt Physics by default in newly created projects
This also adds infrastructure to make specific settings the default, but only
in projects created after this point (so that existing projects
are not affected). This can be used for progressive upgrades in the future.

This applies to both the project creation dialog and creating projects
through the command line using `touch project.godot`.
2025-09-26 17:16:28 +02:00
ydeltastar
6a3d37ef1c
Android: Ensure proper cleanup of the fragment 2025-09-26 10:18:11 -03:00
Ricardo Buring
2f3eaa965c OBJ importer: Support bump multiplier (normal scale)
This improves compatibility with OBJ/MTL files found in the wild.
2025-09-26 12:46:31 +02:00
Luo Zhihao
727066fe1f Free script and extension instance before object deconstructing
Co-Authored-By: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-09-26 18:15:08 +08:00
Haoyu Qiu
4e80190a46 Move context and plural support to Translation
- `TranslationPO` is now an empty class. It exists for compatibility.
- `OptimizedTranslation` stays the same, no context or plural support.
2025-09-26 10:51:57 +08:00
Haoyu Qiu
e882e42e1b Add default plural rules
This makes the PO loader correctly handle the situation where the optional
`Plural-Forms` header field does not exist.

The `Translation` class and its subclasses always have access to valid plural
rules via `_get_plural_rules()`. Plural rules are prioritized:

1. `Translation.plural_rules_override`
2. `TranslationServer.get_plural_rules(locale)`
3. The English plural rules: `nplurals=2; plurals=(n != 1)`

Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com>
2025-09-26 10:51:57 +08:00
Haoyu Qiu
ebb96e2303 Move plural rules logic into a separate class
- Extracts plural rules logic in `TranslationPO` into a new `PluralRules` class.
- Changes caching the last used plural index in `TranslationPO` into an LRU cache in `PluralRules`.
- Adds tests for `PluralRules`.
2025-09-26 10:51:55 +08:00
Mikael Hermansson
0590c974c1 Fix CCD bodies adding multiple contact manifolds when using Jolt 2025-09-26 01:17:11 +02:00
Lukas Tenbrink
1bf821c1e1 Store current capacity in CowData buffers, and rewrite most of it.
Add `reserve` to `CowData`, `Vector` and `Array`.

# Conflicts:
#	core/os/memory.h
#	core/templates/cowdata.h
2025-09-25 22:00:17 +02:00
Thaddeus Crews
1f7630f1bf
Merge pull request #110841 from smix8/raster_casual
Make navmesh rasterization errors more lenient
2025-09-25 14:57:11 -05:00
Thaddeus Crews
e49e73e160
Merge pull request #110868 from brycehutchings/openxr_late_destruction_crash_fix
Fix late destruction access violation with OpenXRAPIExtension object
2025-09-25 14:57:11 -05:00
Thaddeus Crews
121b1b7d58
Merge pull request #110420 from fstxz/fix-folder-nullptr
Fix crash due to null pointer dereference when moving/renaming folders in `FileSystemDock`
2025-09-25 14:57:10 -05:00
Thaddeus Crews
5fda92451d
Merge pull request #100145 from Ivorforce/memory-offset-func
Add `mem_aligned_address` to simplify data offset constants.
2025-09-25 14:57:09 -05:00
Thaddeus Crews
5088a93024
Merge pull request #110415 from fstxz/fix_favorites
Fix favorite folders that are outside of the project being displayed in `FileSystemDock`'s file list
2025-09-25 14:57:08 -05:00
Stuart Carnie
7227fdd805 Core: Add UNIX domain socket support
> [!NOTE]
>
> Later versions of Windows has support for `AF_UNIX`, so it could be
> added.
2025-09-26 05:46:19 +10:00
Lukas Tenbrink
3ac159094f Add memory_get_offset to simplify data offset constants. 2025-09-25 20:55:33 +02:00
smix8
19df15f1dc Make navmesh rasterization errors more lenient
Make navmesh rasterization on the navigation regions and map more lenient by starting out with a lower internal cell scale by default and changing the merge error to just warning that can be toggled.
2025-09-25 20:18:18 +02:00
Thaddeus Crews
a078895ad2
Merge pull request #109243 from precup/tile-map-optimizations
Avoid unnecessary updates in `TileMapLayer`
2025-09-25 12:13:57 -05:00
Thaddeus Crews
c32c2606f4
Merge pull request #110837 from wheatear-dev/add-gdsoftclass-deeper
Add `GDSOFTCLASS` to deeper inheritors of `Object`
2025-09-25 12:13:56 -05:00
Thaddeus Crews
5aa220efee
Merge pull request #110865 from brycehutchings/openxr_d3d12_near_far_fix
Fix OpenXR with D3D12 using the wrong clip space projection matrix
2025-09-25 12:13:55 -05:00
Thaddeus Crews
6af2341894
Merge pull request #108743 from Nodragem/fix-jump-when-cutting
Fix jump when cutting a selection in Gridmap
2025-09-25 12:13:54 -05:00
Thaddeus Crews
d5848e2232
Merge pull request #110882 from nikitalita/patch-4
Fix HashMap/HashSet in natvis after member renames
2025-09-25 12:13:53 -05:00
Bryce Hutchings
cd198f7517 Remove static lifetime object to avoid late destruction 2025-09-25 10:11:08 -07:00
Hugo Locurcio
f277add285 Fix and improve Node2D.move_local_{x,y}() description
The `delta` parameter name refers to a generic distance parameter here,
rather than the process or physics process time.
2025-09-25 18:52:11 +02:00
Jojo-1000
71723f74b7 Mark necessary EditorImportPlugin functions as required 2025-09-25 17:15:32 +02:00
Thaddeus Crews
d48f255074
Windows: Migrate godot.manifest to platform/windows
• Ensure file is included as proper dependency
2025-09-25 09:15:00 -05:00
danielgsilva
bc9c14da7a Add helper methods and simplify logic 2025-09-25 13:41:15 +01:00
Thaddeus Crews
ecfe34f56c
Merge pull request #110892 from AThousandShips/fix_build_2d
Revert "Replace many uses of `is_class` with `derives_from`."
2025-09-25 07:11:02 -05:00
A Thousand Ships
bd65cfa876
Revert "Replace many uses of is_class with derives_from."
This reverts commit 78b743cf4a.
2025-09-25 13:48:53 +02:00
Paeniche
0b7b52a1f1 Fix /tutorial added twice
Some links in the offlince documentation for lights and shadows had /tutorials/tutorials in their links leading to 'page not found' error
2025-09-25 01:32:44 -07:00
Artemy Fedotov
40d56c98bc
Fix LineEdit's placeholder text being selected when double clicking 2025-09-25 12:05:48 +04:00
Arseny Kapoulkine
ccbece58d8 Enable component pruning during simplification
In addition to the regular edge collapse, we now allow the simplifier to
remove small isolated components. Components that are removed are below
the error threshold in size and as such should not noticeably contribute
to the overall rendering of the object.

This helps simplify topologically complex but small parts of larger
meshes and more comfortably reach the LOD targets.

In some cases, pruning can cause the last LOD to shrink to 0 triangles
which may prevent a slightly larger LOD from being used at the maximum
distance; in this case we retry simplification without pruning once.
2025-09-24 22:23:55 -07:00
Nikita
a75e6be6fb
Fix HashMap/HashSet in natvis after member renames 2025-09-24 21:51:03 -07:00
Clay John
6e4e8072e1
Merge pull request #110027 from zeux/lod-iter
Switch LOD generation to use iterative simplification
2025-09-24 20:57:41 -07:00
Aaron Franke
da9a77ce42
GLTF: Preserve mesh name on export 2025-09-24 20:28:52 -07:00
Stuart Carnie
d93fe9038d Metal: Fix Metal compiler version inspection 2025-09-25 06:35:31 +10:00
Mara Huldra
c64ff4b069 wayland: Inhibit idle in DisplayServerWayland::screen_set_keep_on
Without this, the screen does go into idle after a few minutes on a RPi5 with default install (wayland w/ labwc), even
though `screen_keep_on` is set. DBUS is enabled but apparently, the screensaver call is not enough.
2025-09-24 22:17:38 +02:00
Edward Moulsdale
e366471fdc Add GDSOFTCLASS to deeper inheritors of Object 2025-09-24 19:15:56 +01:00
Mounir Tohami
c07966583f Fix editor theme margins and TextEdit normal/read_only styles draw. 2025-09-24 20:42:22 +03:00
BlueCube3310
f64ccadceb Image: Support generating mipmaps for all formats 2025-09-24 18:48:28 +02:00
Hugo Locurcio
020cdd0f73 Tweak macOS notarization export message in the editor
One message had a typo and was missing `--team-id` for one of the
`xcrun notarytool` commands.
2025-09-24 17:43:43 +02:00
Aaron Franke
a238af4d20
Use num_scientific (Grisu2) when stringifying JSON with full precision 2025-09-24 08:21:37 -07:00
Thaddeus Crews
1ce3101fbc
Merge pull request #110814 from Jordyfel/2d-editor-get
Cache editor setting queried in hot path in 2D editor
2025-09-24 09:59:16 -05:00
Thaddeus Crews
de27f3a435
Merge pull request #110108 from PiCode9560/suspend-button
Differentiate the suspend button in the Game tab with the Pause button in the editor run bar
2025-09-24 09:59:15 -05:00
Thaddeus Crews
daa1fc97dd
Merge pull request #107547 from beicause/shader-compiler-print-content-verbose
ShaderCompiler: Optimize compilation error printing
2025-09-24 09:59:14 -05:00
Thaddeus Crews
7e5c6890b2
Merge pull request #110298 from 0xcafeb33f/fix-skeleton-mirror
Fix Skeleton2D TwoBoneIK and LookAt mirroring
2025-09-24 09:59:13 -05:00
Thaddeus Crews
6f57447710
Merge pull request #109943 from kevinlam508/proper-tree-size-without-scrollbars
Fix tree to update size with scrollbars disabled
2025-09-24 09:59:13 -05:00
Thaddeus Crews
5db618a2db
Merge pull request #109078 from WhalesState/text-edit-clipping
Fix TextEdit clips children and focus style.
2025-09-24 09:59:12 -05:00
Thaddeus Crews
7b8073d122
Merge pull request #107763 from Ivorforce/missing-vpv
Add missing `vpv.push_back(pv);` in `render_target_get_sdf_texture`.
2025-09-24 09:59:11 -05:00
Thaddeus Crews
cf82b71c7a
Merge pull request #109915 from arkology/audio-editor
Fix Audio bottom panel going under the taskbar on small displays
2025-09-24 09:59:10 -05:00
Thaddeus Crews
78b743cf4a
Merge pull request #110832 from Ivorforce/is-class-to-derives-from
Replace many uses of `is_class` with `derives_from`.
2025-09-24 09:59:09 -05:00
Thaddeus Crews
a7b2cd66ad
Merge pull request #105773 from dugramen/fix-inspector-spacing
Fix inspector spacing issues
2025-09-24 09:59:08 -05:00
Thaddeus Crews
22355f2114
Merge pull request #110251 from KoBeWi/semote_relect
Properly inspect old remote selection
2025-09-24 09:59:07 -05:00
Thaddeus Crews
f987cf8a8a
Merge pull request #110231 from fstxz/fix_shader_path
Fix invalid suggested file name when saving resource from a scene that hasn't been saved yet
2025-09-24 09:59:06 -05:00
Thaddeus Crews
6547174ccf
Merge pull request #110024 from dagarsar/tree-rl
Fix child relationship lines not being drawn when selecting cells other than first
2025-09-24 09:59:05 -05:00
Thaddeus Crews
3d1d4bf934
Merge pull request #110247 from BlueCube3310/image-fill-mips
Image: Make `fill` method also fill the mipmaps
2025-09-24 09:59:04 -05:00
Thaddeus Crews
8c956babeb
Merge pull request #107013 from Rindbee/fix-wrong-node-path-in-connection-dialog
Fix the extra arguments of type `NodePath` in the connection dialog do not work
2025-09-24 09:59:03 -05:00
Thaddeus Crews
54e74142af
Merge pull request #110656 from KoBeWi/LocalTweener
Change list of Tweeners from Vector to LocalVector
2025-09-24 09:59:03 -05:00
Thaddeus Crews
89fea8ec34
Merge pull request #109339 from AThousandShips/fix_copyright
[Copyright] Fix spelling of license
2025-09-24 09:58:57 -05:00
Giganzo
e90a337fa3 Fix SpinBox stepper grabbing focus state on mouse input 2025-09-24 16:51:59 +02:00
danielgsilva
1a77567029 Add method to check if any cell is selected and fix relationship line conditional 2025-09-24 13:44:57 +01:00
Bryce Hutchings
58ecb8ade5 Fix D3D12 using the wrong clip space projection matrix. Remove error-prone/unnecessary graphicsApi parameter. 2025-09-23 16:58:39 -07:00
Allen Pestaluky
3101d75634 Fix glow intensity not showing in compatibility renderer when blend mode is set to mix. 2025-09-23 17:45:35 -04:00
dugramen
5fa4e3dee1 Fix inspector spacing issues 2025-09-23 16:38:01 -04:00
Arseny Kapoulkine
e40436d527 Switch LOD generation to use iterative simplification
Instead of simplifying every LOD from the original down to an
increasing number of triangles, we simplify each LOD from the previous
LOD and stop when the simplification can't proceed further.

This has a few benefits:

- It's significantly faster; using sparse flag helps ensure that
  subsequent simplifications after the first one are increasingly
  cheaper.

- It results in higher quality attributes on generated LODs; attribute
  quadrics reduce the quality of attribute preservation the more they
  are accumulated, so recomputing them from intermediate geometry helps.

- It results in monotonic appearance: if a feature is reduced in a
  higher LOD, it will stay reduced or get reduced more significantly in
  lower LODs. This is not a significant problem right now, but can be
  helpful to ensure if the number of LODs increases or some newer
  features get enabled.
2025-09-23 13:28:45 -07:00
Thaddeus Crews
b7c5fcaf1e
Merge pull request #110815 from AThousandShips/fix_nav_2d
[Navigation 2D] Fix sign of cross product
2025-09-23 14:51:54 -05:00
Thaddeus Crews
0ef1c07838
Merge pull request #110491 from bruvzg/emb_j_init_msg
[macOS] Remove old embedded window joystick init code.
2025-09-23 14:51:53 -05:00
Thaddeus Crews
13dcb1f8b3
Merge pull request #110810 from KoBeWi/mail_(MAin_faIL)
Ignore main scene UID error in editor
2025-09-23 14:51:52 -05:00
Thaddeus Crews
2b79cb613b
Merge pull request #110223 from rburing/physicsserver3d_shape_doc
Document `PhysicsServer3D` shapes
2025-09-23 14:51:51 -05:00
Thaddeus Crews
2569d4088f
Merge pull request #109166 from Calinou/editor-expression-use-fixed-width-font
Use a fixed-width font for the expression evaluator
2025-09-23 14:51:50 -05:00
Thaddeus Crews
8d27c00038
Merge pull request #107692 from timothyqiu/editor-overrides-doc
Show description for editor setting overrides
2025-09-23 14:51:49 -05:00
Thaddeus Crews
329acc038d
Merge pull request #110826 from Ivorforce/reserve-smaller-than-size-verbose
Change "reserve called with a capacity smaller than the current size" error message to a verbose message.
2025-09-23 14:51:48 -05:00
Thaddeus Crews
96d9303b76
Merge pull request #109992 from zeux/simplify-regularize
Use regularization flag for LODs of deformable objects to improve appearance post deformation
2025-09-23 14:51:48 -05:00
Thaddeus Crews
b1b9a42517
Merge pull request #108551 from KoBeWi/paste_as_unique_norecursive
Improve Paste as Unique option
2025-09-23 14:51:47 -05:00
Thaddeus Crews
e6d25c0f73
Merge pull request #110819 from KoBeWi/overrun_with_dupes
Remove overrun code duplication
2025-09-23 14:51:45 -05:00
Thaddeus Crews
44c847c1a5
Merge pull request #108162 from KoBeWi/preview_simplication
Change preview methods to take Callable
2025-09-23 14:51:44 -05:00
Thaddeus Crews
c21e977e66
Merge pull request #107649 from timothyqiu/no-translations-configured
Show "No Translations Configured" message for empty translation preview menu
2025-09-23 14:51:44 -05:00
kobewi
eae9ef2292 Change preview methods to take Callable 2025-09-23 20:13:00 +02:00
Lukas Tenbrink
c6f57c7a55 Change "reserve called with a capacity smaller than the current size" error message to a verbose message. 2025-09-23 20:02:40 +02:00
Lukas Tenbrink
8ef4a43ada Replace many uses of is_class with derives_from. 2025-09-23 19:59:00 +02:00
Michael Alexsander
d283e4cb2a
Ignore changes in "Master" bus while in the Audio Importer 2025-09-23 14:58:09 -03:00
Thaddeus Crews
aa2c4fe654
Merge pull request #110717 from Shadows-of-Fire/elide-copy-typed-collection
GDScript: Elide unnecessary copies in `CONSTRUCT_TYPED_*` opcodes
2025-09-23 12:08:53 -05:00
Thaddeus Crews
6010f0f2b0
Merge pull request #110777 from BastiaanOlij/openxr_1_1_52
OpenXR: Update to OpenXR 1.1.52
2025-09-23 12:08:52 -05:00
Thaddeus Crews
c62356fcaa
Merge pull request #85080 from Cykyrios/draw-ellipse
Add methods to draw ellipses
2025-09-23 12:08:51 -05:00
Thaddeus Crews
75f0f3dc55
Merge pull request #110550 from WesleyClements/master
Fix `TileMapLayer` tiles displaying incorrectly with y_sort based on visibility layer
2025-09-23 12:08:50 -05:00
Thaddeus Crews
1f5d8a39cb
Merge pull request #110520 from m4rr5/fix_vrs_modes_list
Fix Viewport VRS Mode property listing unimplemented Depth buffer option
2025-09-23 12:08:49 -05:00
Thaddeus Crews
685c7e92e5
Merge pull request #100437 from KoBeWi/ruaninstancequestionmark
Add `is_instance()` helper method to Node
2025-09-23 12:08:48 -05:00
Thaddeus Crews
4b8cd07408
Merge pull request #110770 from arkology/find-in-files-count
`FindInFiles`: Show the number of matches for each file
2025-09-23 12:08:47 -05:00
Thaddeus Crews
cd3a6c88fd
Merge pull request #106200 from BlueCube3310/image-16-u16
Image: Implement 16-bit unorm and uint formats
2025-09-23 12:08:46 -05:00
Thaddeus Crews
5a8a3ed8e2
Merge pull request #110703 from dsnopek/xr-tracker-change
Fix XR tracker name changing at runtime
2025-09-23 12:08:45 -05:00
Thaddeus Crews
2cc0f68c56
Merge pull request #110602 from Calinou/editor-sort-scripts-by-tweak-setting-order
Tweak the enum visual order for Sort Scripts By editor setting
2025-09-23 12:08:44 -05:00
Thaddeus Crews
9708b088f9
Merge pull request #110249 from beicause/fix-compositor-effects-init-callback
Fix `CompositorEffect` not setting post-transparent callback on init
2025-09-23 12:08:43 -05:00
Thaddeus Crews
fc9a775f56
Merge pull request #104420 from pafuent/pause_audio_when_game_is_paused
Pause audio when game is paused
2025-09-23 12:08:34 -05:00
Fredia Huya-Kouadio
35fda7f857 Fix JNI local reference table overflow when wrapping Java class with large method counts 2025-09-23 12:23:26 -04:00
Michael Alexsander
8b68b55d16
Fix regression with min size on nested inspectors 2025-09-23 13:04:56 -03:00
AR-DEV-1
1036bfd7ad Update .NET version to 8.0 & lang version to 12 2025-09-23 21:04:05 +05:00
Hugo Locurcio
0dcf28104d
Allow all gamepad devices for built-in ui_* input actions
This allows all controllers to navigate the UI, which enhances
compatibility with PC handhelds when external controllers are connected.

Previously, only the first device was allowed to use `ui_*` actions
out of the box, which means that on a PC handheld, external controllers
couldn't navigate the UI (since the first ID is always the built-in controller).
2025-09-23 17:12:56 +02:00
kobewi
a57fef9558 Remove overrun code duplication 2025-09-23 16:08:46 +02:00
t0mj3dus0r
f5432271b9 use self_modulate instead of modulate for TileMapLayer highlight rendering 2025-09-23 15:10:53 +02:00
A Thousand Ships
f8d72ba783
[Navigation 2D] Fix sign of cross product
Regression from splitting the servers. Also replaces the method for
getting the triangle area.
2025-09-23 14:55:17 +02:00
BlueCube3310
666ed1b51c Image: Make fill method also fill the mipmaps 2025-09-23 14:55:04 +02:00
Jordyfel
7595a9061d Cache editor setting queried in hot path in 2D editor 2025-09-23 15:37:55 +03:00
kobewi
34be83851e Ignore main scene UID error in editor 2025-09-23 12:58:15 +02:00
Rémi Verschelde
3d91a48298
Merge pull request #110805 from lawnjelly/fix_ancestry_construct
Fix ancestry constructors
2025-09-23 10:01:40 +02:00
lawnjelly
cbbc2eae0e Fix ancestry constructors
Some object constructors in 4.x were not initializing ancestry correctly for some types, this was producing casting failures.
2025-09-23 08:23:55 +01:00
Thaddeus Crews
7521044465
Merge pull request #110750 from timothyqiu/color-picker-add
ColorPicker: Fix preset button order after calling `add_preset()`
2025-09-22 21:01:01 -05:00
Thaddeus Crews
491ecff31e
Merge pull request #99195 from shitake2333/csharp_translation_parser_support
Add c# translation parser support
2025-09-22 21:01:01 -05:00
Thaddeus Crews
cede7c8aa7
Merge pull request #109401 from DarioSamo/ubershader-for-sdf-and-material
Add ubershader support to material and SDF variants in Forward+.
2025-09-22 21:01:00 -05:00
Thaddeus Crews
71f61d959d
Merge pull request #108468 from syntaxerror247/Android-CI
CI: Generate debug build for Android
2025-09-22 21:00:59 -05:00
Thaddeus Crews
6dddb6e6d6
Merge pull request #110194 from bruvzg/emoji_run
[TextServer] Shape emojis as separate runs.
2025-09-22 21:00:58 -05:00
Thaddeus Crews
3d63c6b602
Merge pull request #110137 from fstxz/fix_edit_script
Fix `ScriptEditor::edit()` not jumping to the first line
2025-09-22 21:00:57 -05:00
Thaddeus Crews
2455635238
Merge pull request #100876 from ryevdokimov/no-restart-prompt-custom-theme
Remove prompt to restart editor after changing custom theme
2025-09-22 21:00:56 -05:00
Thaddeus Crews
709226ad1c
Merge pull request #109515 from precup/speedy-selections
Speed up large selections in the editor
2025-09-22 21:00:54 -05:00
Thaddeus Crews
800bce8a7e
Merge pull request #107975 from BlueCube3310/cube-preview-improved
Improve the cubemap preview
2025-09-22 21:00:53 -05:00
Thaddeus Crews
cee30225e9
Merge pull request #110566 from lumiscosity/optimize-pngs
Optimize PNG assets
2025-09-22 21:00:52 -05:00
Thaddeus Crews
38188881ce
Merge pull request #108549 from ryevdokimov/transform-gizmo-opacity-no-restart
Do not require editor restart when changing manipulator gizmo opacity setting
2025-09-22 21:00:52 -05:00
Thaddeus Crews
c178b063c6
Merge pull request #109632 from timothyqiu/truncate
Clarify truncation behavior in file open modes
2025-09-22 21:00:50 -05:00
Ricardo Sanchez-Saez
038f5934e7
[Apple embedded] Adopt SwiftUI lifecycle for Apple embedded platforms
- Introduces a SCons builder for Swift files
- Increases the minimum deployment targets to iOS 14.0, and visionOS 26.0.
- Replaces manually UIWindow management by a SwiftUI instantiated app.
2025-09-22 18:20:04 -07:00
lumiscosity
72a9d2128f Replace Android icons with lossless WebP files
See https://developer.android.com/develop/ui/views/graphics/reduce-image-sizes#webp. From a precursory glance the minimum API level for Godot is 24, which should support this.
2025-09-22 20:33:16 +02:00
lumiscosity
91befbbc52 Optimize PNG assets
Losslessly optimizes the PNG assets with oxipng, defluff and DeflOpt.

Tests and third party imports are omitted.
2025-09-22 20:33:16 +02:00
Thaddeus Crews
3bf0f771ee
Merge pull request #110781 from Ivorforce/rasterizer-render-uv2-allocation
Use an array instead of `TightLocalVector` in `RasterizerSceneGLES3::_render_uv2`, to avoid allocation.
2025-09-22 13:28:53 -05:00
Thaddeus Crews
a20ca7bbfe
Merge pull request #110459 from YeldhamDev/let_the_poor_ints_slide
Allow to use sliders for integers in `EditorSpinSlider`
2025-09-22 13:28:52 -05:00
Thaddeus Crews
228808142b
Merge pull request #110614 from mihe/logger-thread-safety
Rephrase `Logger` documentation to be more explicit about thread-safety
2025-09-22 13:28:51 -05:00
Thaddeus Crews
2db6704576
Merge pull request #110259 from ktxyz/add-name-to-invalid-name-error-output
Add name info to EditorAutoloadSettings invalid name message
2025-09-22 13:28:50 -05:00
Thaddeus Crews
f553875728
Merge pull request #110387 from timothyqiu/project-zip-utf8
Set language encoding flag when using Pack Project as ZIP
2025-09-22 13:28:49 -05:00
Thaddeus Crews
7ec4bd74ff
Merge pull request #110320 from WhalesState/cie-lock
Fix redundant calls of `CanvasItemEditor::_update_lock_and_group_button` on `SceneTreeEditor` node selection
2025-09-22 13:28:48 -05:00
Thaddeus Crews
2d94ad1f3a
Merge pull request #93389 from KoBeWi/MASSIVE_copy_paste
Remove code duplication in Button
2025-09-22 13:28:47 -05:00
Thaddeus Crews
89c51cb183
Merge pull request #110571 from WhalesState/get-children
Improve `Node::get_children` performance.
2025-09-22 13:28:46 -05:00
Thaddeus Crews
035f5d3055
Merge pull request #110763 from Ivorforce/object-derives-from
Use `AncestralClass` to speed up `Object::cast_to` when possible.
2025-09-22 13:28:45 -05:00
Thaddeus Crews
be421bcdd4
Merge pull request #110250 from YeldhamDev/i_just_cant_keep_focused
Hide `Control` focus when given via mouse input
2025-09-22 13:28:44 -05:00
Thaddeus Crews
50ba0149e4
Merge pull request #110241 from Calinou/compatibility-shader-fix-depth-buffer
Fix shader compilation errors in Compatibility when using `depth_texture`
2025-09-22 13:28:43 -05:00
Thaddeus Crews
d069699940
Merge pull request #110752 from wheatear-dev/expand-110693
Add `GDSOFTCLASS` to six inheritors of `Object`
2025-09-22 13:28:41 -05:00
Michael Alexsander
f16ff829f0
Allow to use sliders for integers in EditorSpinSlider 2025-09-22 11:23:15 -03:00
Lukas Tenbrink
bc7c05bfbd Use an array instead of TightLocalVector in RasterizerSceneGLES3::_render_uv2, to avoid allocation. 2025-09-22 16:16:28 +02:00
Thaddeus Crews
ba0da90ba6
Merge pull request #108254 from KoBeWi/ENABLE_HINT_GROUP_PROPERTY_HINT
Add more `PROPERTY_HINT_GROUP_ENABLE` uses
2025-09-22 08:50:12 -05:00
Thaddeus Crews
d7565ffbe5
Merge pull request #104666 from allenwp/color-encoding-docs
Update color encoding documentation
2025-09-22 08:50:11 -05:00
Thaddeus Crews
ce157a446f
Merge pull request #107096 from ArchercatNEO/xdg-toplevel-icon
Wayland: Implement the xdg-toplevel-icon-v1 protocol
2025-09-22 08:50:10 -05:00
Thaddeus Crews
b56e83a041
Merge pull request #110135 from Flynsarmy/scene_changed
Emit scene_changed event when opening a scene from an empty tab list
2025-09-22 08:50:09 -05:00
Thaddeus Crews
999b94cc39
Merge pull request #109012 from Lielay9/fix_gradient_color
Round gradient colors
2025-09-22 08:50:08 -05:00
Thaddeus Crews
b4a99e775d
Merge pull request #109843 from Muller-Castro/fix-fileaccess-create-temp
Fix `FileAccess::create_temp()` default args error
2025-09-22 08:50:07 -05:00
Thaddeus Crews
d8b057d06d
Merge pull request #108974 from Joy-less/Improve-IsNormalized()
Improve `IsNormalized()` in C#
2025-09-22 08:50:06 -05:00
Thaddeus Crews
b059849bf8
Merge pull request #108075 from KoBeWi/main_without_main_is_just_
Improve error message when UID main scene is not found
2025-09-22 08:50:05 -05:00
Thaddeus Crews
9b7a723aac
Merge pull request #107721 from YYF233333/ps_include
Remove dependency of `variant.h` in `print_string.h`
2025-09-22 08:50:04 -05:00
Thaddeus Crews
5e8c2f9a0e
Merge pull request #108872 from Giganzo/text-contrast-stack-var
Fix bad text contrast on readonly EditorPropertyArray/Dict/Res
2025-09-22 08:50:04 -05:00
Thaddeus Crews
3ce6402d25
Merge pull request #109413 from WhalesState/ProfilerAutostartWarning-icon-cleanup
ProfilerAutostartWarning svg icon cleanup
2025-09-22 08:50:03 -05:00
Thaddeus Crews
c852872cb2
Merge pull request #108804 from bruvzg/mac_bundle_icon
[macOS] Use "file" icon for bundles in the file dialogs.
2025-09-22 08:50:02 -05:00
Thaddeus Crews
94dbc42a56
Merge pull request #62083 from KoBeWi/string_slice'n_dice
Improve usage of `String.split()` vs `get_slice()`
2025-09-22 08:50:01 -05:00
Thaddeus Crews
3ef19961cc
Merge pull request #110242 from ktxyz/fix-crash-theme-and-another-project
Fix editor crash caused by EditorFileSystem::get_singleton access in theme initialization path
2025-09-22 08:50:00 -05:00
Thaddeus Crews
60c33a222c
Merge pull request #108929 from Giganzo/spin-slider-suffix
Add suffix to EditorSpinSlider tooltips
2025-09-22 08:49:59 -05:00
Thaddeus Crews
0e2b54e1da
Merge pull request #109216 from Ryan-000/improve_rpc_error_messages
Improve RPC Error messages
2025-09-22 08:49:58 -05:00
DeeJayLSP
d719fc74f5 Editor font: do not embolden the Main Font if it's variable 2025-09-22 10:35:22 -03:00
Bastiaan Olij
d9c0183bd7 OpenXR: Update to OpenXR 1.1.52 2025-09-22 21:25:45 +10:00
Lukas Tenbrink
96619d46a1 Use AncestralClass to speed up Object::cast_to when possible. 2025-09-22 13:21:51 +02:00
Artemy Fedotov
a3e0f8dee2
Allow trailing comma in preload 2025-09-22 14:15:12 +04:00
Fredia Huya-Kouadio
0622cee189 Implement has_java_method(...) for JavaClassWrapper and JNISingleton 2025-09-22 00:01:50 -04:00
Haoyu Qiu
172c80df67 Make text-related nodes translation domain aware
- Makes `is_layout_rtl()` translation domain aware
- Makes various text-drawing controls translation domain aware
- Makes translation preview use the project's fallback locale when disabled
2025-09-22 09:39:14 +08:00
Wesley Clements
89503e387a fixed tile map tiles displaying incorrectly based on visibility layer 2025-09-21 19:03:21 -04:00
BlueCube3310
cd61d6f748 Improve the cubemap preview 2025-09-21 21:18:30 +02:00
Edward Moulsdale
12e97610a8 Add GDSOFTCLASS to six inheritors of Object 2025-09-21 16:22:29 +01:00
arkology
7fcc8c0831 FindInFiles: Show the number of matches for each file 2025-09-21 18:11:47 +03:00
Haoyu Qiu
52df1aeb59 ColorPicker: Fix preset button order after calling add_preset 2025-09-21 22:17:38 +08:00
Ricardo Buring
6e6a9cf26b Document PhysicsServer3D shapes 2025-09-21 11:38:28 +02:00
Brogolem35
7685cb6f48 Optimize clear 2025-09-21 10:19:12 +03:00
Mounir Tohami
b25e35cf58 Fix TextEdit styles and disable clipping.
Co-Authored-By: kit <kitbdev@gmail.com>
2025-09-21 07:32:30 +03:00
Michael Alexsander
53231879b3
Fix selection of remote tree using the keyboard 2025-09-20 20:11:59 -03:00
kobewi
98a4b46b6a Add more PROPERTY_HINT_GROUP_ENABLE uses 2025-09-20 21:11:12 +02:00
Thaddeus Crews
149a4b4ca1
Merge pull request #107868 from lawnjelly/quick_ancestry4
Provide quick access to `Object` ancestry
2025-09-20 13:41:39 -05:00
Thaddeus Crews
326b22124a
Merge pull request #108794 from bruvzg/macos_actool_export
[macOS] Add support for exporting macOS 26 Liquid Glass icons.
2025-09-20 13:41:38 -05:00
Thaddeus Crews
4588542dfc
Merge pull request #107065 from timothyqiu/scene-close-all
Allow closing all scene tabs via shortcut
2025-09-20 13:41:37 -05:00
Thaddeus Crews
7738626d25
Merge pull request #107800 from Joy-less/add-ROS-overload-for-Callable.Call
Add `ReadOnlySpan<Variant>` overload for `Callable.Call`
2025-09-20 13:41:36 -05:00
Thaddeus Crews
25981beebd
Merge pull request #107511 from shadow-foss/insert-at-timeline-cursor-button
Add toggle for inserting keys/markers at current time vs mouse cursor's position
2025-09-20 13:41:35 -05:00
Thaddeus Crews
40bd86819b
Merge pull request #104332 from ColinSORourke/FindSeq
Add 'Find Sequence' to `Span`s, and consolidate negative indexing behavior
2025-09-20 13:41:34 -05:00
Thaddeus Crews
ebbd5a7ff5
Merge pull request #110694 from wheatear-dev/bugfix-110693
Add `GDSOFTCLASS` to `NetSocket`
2025-09-20 13:41:33 -05:00
Thaddeus Crews
00574d4ba5
Merge pull request #81701 from Repiteo/c#-attribute-interface-doc
C#: Add documentation for Interfaces and Attributes
2025-09-20 13:41:32 -05:00
Thaddeus Crews
96185c7d8c
Merge pull request #106341 from fkeyzuwu/backup-drag-n-drop-export
Add drag and drop export variables
2025-09-20 13:41:31 -05:00
Thaddeus Crews
8159c45834
Merge pull request #109027 from timothyqiu/editor-node-variables
Remove unused member variables in EditorNode
2025-09-20 13:41:30 -05:00
Thaddeus Crews
ab01179d6c
Merge pull request #106849 from KoBeWi/soft_coding
Don't hard-code hsplit count
2025-09-20 13:41:28 -05:00
风青山
fc0cbb3171
Fix the extra arguments of type NodePath in the connection dialog do not work
Make the node path relative to the target node instead of the source node.

Currently, a proxy object is used in the connection dialog to edit bound arguments.

In this case, the `EditorPropertyNodePath` will get the node path relative to the
source object in the connection (i.e. the object the InspectorDock is editing).

This path is not available in scripts (i.e. the target object in the connection).
2025-09-20 22:10:55 +08:00
Shadows_of_Fire
b18beb2cc2 Elide unnecessary copies in CONSTRUCT_TYPED_* opcodes 2025-09-20 00:00:18 -07:00
Thaddeus Crews
d7382aa058
Merge pull request #109502 from WhalesState/bottom-panel-fix
Fix scrolling to bottom panel selected button.
2025-09-19 20:54:34 -05:00
Thaddeus Crews
74e869c777
Merge pull request #109981 from bruvzg/clamp_menui_h
Clamp menus at the bottom of the screen.
2025-09-19 20:54:33 -05:00
Thaddeus Crews
e15210b466
Merge pull request #98268 from Calinou/import-export-bake-fps-add-range-hint
Add a property range hint to `bake_fps` in the scene glTF export dialog
2025-09-19 20:54:32 -05:00
Thaddeus Crews
72785c54ed
Merge pull request #110012 from dagarsar/tree-const-arg
Reinstate `const` parameter in `Tree`'s `draw_item_rect`
2025-09-19 20:54:31 -05:00
Thaddeus Crews
b33e988aef
Merge pull request #109977 from timothyqiu/tooltip-atr-extract
Make POT generation use `tooltip_auto_translate_mode`
2025-09-19 20:54:30 -05:00
Thaddeus Crews
1e5b4a1aae
Merge pull request #109944 from DanielKinsman/headless-blender-import-hang
Fix hang when importing blender files in headless mode
2025-09-19 20:54:29 -05:00
Thaddeus Crews
34609db10b
Merge pull request #109969 from dsnopek/openxr-validation-errors
OpenXR: Fix errors reported by `XrApiLayer_core_validation`
2025-09-19 20:54:28 -05:00
Thaddeus Crews
647546bcac
Merge pull request #110089 from dagarsar/tree-margin-1
Fix `Tree` relationship lines do not apply `h_separation` and `item_margin` correctly
2025-09-19 20:54:27 -05:00
Thaddeus Crews
8eeef165d4
Merge pull request #104781 from Ivorforce/string-encode-complete
Expose missing `String` encoding conversion functions
2025-09-19 20:54:26 -05:00
Thaddeus Crews
597c5d413f
Merge pull request #109611 from devloglogan/hand-tracking-microgestures
Add XR_META_hand_tracking_microgestures action paths
2025-09-19 20:54:25 -05:00
Thaddeus Crews
daa89d5292
Merge pull request #109513 from precup/small-editor-optimizations
Miscellaneous editor optimizations for large scenes
2025-09-19 20:54:24 -05:00
Thaddeus Crews
075d99fc11
Merge pull request #109897 from WhalesState/geo2d-opt
Geometry2D minor optimization
2025-09-19 20:54:23 -05:00
Thaddeus Crews
90b771ce3a
Merge pull request #109512 from precup/speedy-big-trees
Speed up very large `Trees`
2025-09-19 20:54:14 -05:00
kobewi
0108e2f82f Change list of Tweeners from Vector to LocalVector 2025-09-19 22:36:07 +02:00
Rinnegatamante
ad09677532 Perform per-line or per-rect blits in blit_rect. 2025-09-19 22:01:43 +02:00
David Snopek
bb06ffd944 Fix XR tracker name changing at runtime 2025-09-19 14:36:36 -05:00
kobewi
e3ce74dc7e Remove code duplication in Button 2025-09-19 20:34:41 +02:00
Artemy Fedotov
0668944255
Fix ScriptEditor::edit() not jumping to the first line 2025-09-19 22:08:54 +04:00
Thaddeus Crews
3c9d03b875
Merge pull request #110269 from clayjohn/delay-RD-check
Defer checking for rendering device support until the new project dialog is opened
2025-09-19 13:07:20 -05:00
Thaddeus Crews
d8a909d99c
Merge pull request #110203 from DarioSamo/d3d12-clamp-mipmap
Clamp minimum size of 3D texture view in D3D12.
2025-09-19 13:07:19 -05:00
Thaddeus Crews
9ef1ec5870
Merge pull request #103608 from gr8alpaca/expose_node_3d_snapping
Expose 3D editor snap settings to EditorInterface
2025-09-19 13:07:18 -05:00
Thaddeus Crews
9cb6411740
Merge pull request #110164 from bruvzg/prop_pass
Use placeholder instead of value for tooltips of `PROPERTY_HINT_PASSWORD` properties.
2025-09-19 13:07:16 -05:00
Thaddeus Crews
191efe2e91
Merge pull request #109778 from BlueCube3310/gles3-astc-detect
Compatibility: Improve ASTC extension detecting
2025-09-19 13:07:15 -05:00
Thaddeus Crews
8265bb8b6a
Merge pull request #110097 from aaronp64/array_tests
Add more `Array` tests
2025-09-19 13:07:13 -05:00
Thaddeus Crews
8900a5e045
Merge pull request #110318 from bruvzg/ed_loc_cmd
Use `language` command line argument to override editor locale.
2025-09-19 13:07:11 -05:00
Thaddeus Crews
14bdf39806
Merge pull request #107789 from rsanchezsaez/apple/apple-embedded-export-template
Replace iOS/visionOS Xcode templates by new Apple embedded template
2025-09-19 13:07:09 -05:00
Thaddeus Crews
2a7e01e4fc
Merge pull request #80427 from MewPurPur/rework-noise-texture-icons
Rework icons of noise-related classes
2025-09-19 13:07:07 -05:00
Thaddeus Crews
4fa2409c78
Merge pull request #82121 from MewPurPur/more-icons
Add icons to some editor classes
2025-09-19 13:07:04 -05:00
Sébastien Dunne Fulmer
cf65c18817 Auto-select sole AnimationPlayer on panel open 2025-09-19 18:53:37 +01:00
Sébastien Dunne Fulmer
8a741f10f8 Add button to add animation player in track editor 2025-09-19 18:53:37 +01:00
Thaddeus Crews
9a76f55518
[C#] Add documentation for Interfaces/Attributes 2025-09-19 11:57:42 -05:00
Michael Alexsander
aeb3a45c97
Hide Control focus when given via mouse input 2025-09-19 13:43:29 -03:00
jroprohehe
e4763e6329 Fix the text editor confusing resource files of class JSON with json files. 2025-09-19 19:24:42 +03:00
Arseny Kapoulkine
92596e3f17 Regularize deformable objects to fix excessive errors post deformation
This significantly improves LOD quality for skinned objects, especially
if the skinned object geometry is very simple (e.g. planar or
cylindrical) in bind pose.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-09-19 08:45:57 -07:00
Edward Moulsdale
c652119812 Add GDSOFTCLASS to NetSocket 2025-09-19 16:01:01 +01:00
Mounir Tohami
b9837e4ada Fix scrolling to bottom panel selected button.
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
2025-09-19 17:43:06 +03:00
kobewi
d61a337a70 Improve usage of String.split() vs get_slice() 2025-09-19 16:31:55 +02:00
Thaddeus Crews
2753d333f6
Merge pull request #109375 from ColinSORourke/VisualShaderEmbedHandling
Fix VisualShader Conversion failing with subresources
2025-09-19 09:17:10 -05:00
Thaddeus Crews
3632e6f463
Merge pull request #110424 from Dark-Horizons/patch-1
Fix Basis.determinant() doc: uniform scale determinant is scale^3
2025-09-19 09:17:08 -05:00
Thaddeus Crews
747722d639
Merge pull request #109299 from BlueCube3310/compat-cube-fix
Compatibility: Fix cubemap faces order when setting texture data
2025-09-19 09:17:07 -05:00
Thaddeus Crews
9b96eaaf80
Merge pull request #107989 from Jojo-1000/docs-add-required-qualifier
Documentation: Add missing required qualifier for various classes
2025-09-19 09:17:06 -05:00
Thaddeus Crews
78d1539709
Merge pull request #110452 from limbonaut/prevent-jni-variant-conv-stack-overflow
Prevent JNI Variant conversion stack overflow
2025-09-19 09:17:05 -05:00
Thaddeus Crews
f27f917d32
Merge pull request #107955 from lodetrick/mouse-signals
Fix `mouse_entered` and `mouse_exited` Signals being emitted too early
2025-09-19 09:17:04 -05:00
Thaddeus Crews
5365372b3d
Merge pull request #110189 from bjornmp/Fix-for-issue-#110178
Fix Clear option not visible when a Resource's @export-ed property is a Script
2025-09-19 09:17:03 -05:00
Thaddeus Crews
dd8ae6cc66
Merge pull request #110413 from timothyqiu/sc-paths
Fix Open Editor Data/Settings Folder menu in self-contained mode
2025-09-19 09:17:02 -05:00
Thaddeus Crews
b2e75e5322
Merge pull request #110188 from vaner-org/converter-animation-suffix
Trim -loop & -cycle from animations during Godot 3 to 4 conversion
2025-09-19 09:17:01 -05:00
Thaddeus Crews
335fe5c5dc
Merge pull request #110664 from Repiteo/ci/ruff-bump
CI: Bump Ruff version (0.12.0 → 0.13.1)
2025-09-19 09:17:01 -05:00
Thaddeus Crews
2c1ad5b07a
Merge pull request #109031 from bruvzg/tab_spacing
Include `SPACING_SPACE` in tab stops calculation.
2025-09-19 09:17:00 -05:00
Thaddeus Crews
988721cda3
Merge pull request #106146 from gtibo/show-encryption-key
Add "Show Encryption Key" toggle
2025-09-19 09:16:59 -05:00
kobewi
a4b5b0ec68 Keep shortcut selected when clearing filter 2025-09-19 16:15:37 +02:00
kobewi
2fd881c40f Don't hard-code hsplit count 2025-09-19 16:05:26 +02:00
Thaddeus Crews
cc22932fc9
CI: Bump Ruff version (0.12.0 → 0.13.1) 2025-09-19 08:40:51 -05:00
Cykyrios
9f7c3d00dd Add methods to draw ellipses 2025-09-19 10:45:16 +02:00
Yufeng Ying
05dae23f18 Remove dependency of variant.h in print_string.h
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-09-19 14:57:36 +08:00
molingyu
da8f647fa1 feat: Add c# translation parser support
Use semantic model to analyze the method to be selected

Support translation comment

Make C# multi-line comments also ignore translation

Add  preprocessor symbols support
2025-09-19 13:46:01 +08:00
Thaddeus Crews
9dde5688a5
Merge pull request #110619 from timothyqiu/imported-animation
Fix imported animation warning labeled as Imported Scene
2025-09-18 21:02:34 -05:00
Thaddeus Crews
835a709303
Merge pull request #110291 from StarryWorm/for-merge
Enable objects stored as dictionary keys to be selected in inspector.
2025-09-18 21:02:33 -05:00
Thaddeus Crews
f84123d20e
Merge pull request #110611 from m4gr3d/fix_show_keyboard_crash
Fix the bug causing `java.lang.StringIndexOutOfBoundsException` crashes when showing the virtual keyboard
2025-09-18 21:02:33 -05:00
Thaddeus Crews
42fbaba8ad
Merge pull request #110225 from fstxz/edit_script_column
Fix `ScriptEditor::edit()` ignoring column parameter
2025-09-18 21:02:32 -05:00
Thaddeus Crews
be11bf1d6b
Merge pull request #110540 from akien-mga/linux-system-libturbojpeg
Linux: Allow unbundling libjpeg-turbo to use system package
2025-09-18 21:02:31 -05:00
Thaddeus Crews
f30859d7f3
Merge pull request #110635 from WhalesState/x11-input
X11 input: prevent non-printable keys from producing empty strings
2025-09-18 21:02:30 -05:00
Thaddeus Crews
3315dd3c60
Merge pull request #110276 from Cykyrios/annotations-descriptions-group
make_rst.py: Add missing rst-class to annotation descriptions
2025-09-18 21:02:29 -05:00
Thaddeus Crews
f8dedf68e2
Merge pull request #105254 from Ivorforce/no-get-internal-ptr
Delete `VariantGetInternalPtr` and `VariantImplicitConvert`, replace with `VariantInternalAccessor`
2025-09-18 21:02:28 -05:00
Thaddeus Crews
3dbb193ece
Merge pull request #109990 from zeux/meshopt-0.25
Update meshoptimizer to v0.25
2025-09-18 21:02:27 -05:00
Thaddeus Crews
01c4038559
Merge pull request #109925 from RolandMarchand/update-characterbody-doc
Clarify that velocity doesn't need delta multiplication in CharacterBody documentation
2025-09-18 21:02:26 -05:00
Thaddeus Crews
7a82648b2b
Merge pull request #110404 from bruvzg/empty_shader_file
Shader Editor: Show "File" menu when no shaders are opened.
2025-09-18 21:02:25 -05:00
Thaddeus Crews
62273fa10b
Merge pull request #110627 from clayjohn/RD-intel-mac-sky-check
Move check for sky cubemap array back into the SkyRD initializer
2025-09-18 21:02:24 -05:00
Michael Alexsander
0f614cd63f
Show marker lines/sections in the animation bezier editor 2025-09-18 21:50:04 -03:00
Lukas Tenbrink
406b22d2d5 Delete VariantGetInternalPtr and VariantImplicitConvert.
Replace uses with `VariantInternalAccessor`.
2025-09-19 00:20:07 +02:00
Lukas Tenbrink
f81287d765 Introduce VariantImplicitConvert<> template for types that can be implicitly converted to and from Variant.
De-duplicate a lot of `VariantGetInternalPtr`, `VariantInternalAccessor`, `VariantInitializer` and `VariantDefaultInitializer`.
2025-09-19 00:20:07 +02:00
Colin O'Rourke
c4559c02de VisualShader Conversion fails with Embeds
Potentially resolves https://github.com/godotengine/godot/issues/101375

VisualShader now has a has_node_embeds function that runs through it's child nodes to find embedded resources via object properties. Conversion plugin uses this function to catch the error.
2025-09-18 14:35:30 -07:00
Pablo Andres Fuente
b0080500bd Pause audio when game is paused
Fixes #68880

Implementation based on #99555
2025-09-18 18:01:49 -03:00
Kaleb Reid
e5cd234ef7 Use correct scaling type when falling back to bilinear 2025-09-18 13:58:02 -07:00
kobewi
f320274ca3 Improve Paste as Unique option 2025-09-18 22:34:48 +02:00
Lukas Tenbrink
0be2a77156 Fix Dictionary::operator[] from C++ accidentally modifying const dictionaries.
Fix `AudioStreamWav` inserting keys into the input dictionary.
2025-09-18 21:17:42 +02:00
Thaddeus Crews
4fcd85551c
Merge pull request #107071 from Calinou/doc-typed-dictionary-array
Document typed dictionaries and arrays in the class reference
2025-09-18 12:42:30 -05:00
Thaddeus Crews
369ed5113e
Merge pull request #110652 from akien-mga/vorbis-comment-warning
Vorbis: Add details to warning about invalid comment header
2025-09-18 12:42:29 -05:00
Thaddeus Crews
1c056c7c86
Merge pull request #107481 from lawnjelly/localvector_children
Use `LocalVector` for `Node3D` and `CanvasItem` children
2025-09-18 12:42:28 -05:00
Thaddeus Crews
3fa7c65914
Merge pull request #108504 from precup/optimize-duplicate
Avoid unnecessary copy in ClassDB::get_property_list
2025-09-18 12:42:27 -05:00
Thaddeus Crews
d5512dfe71
Merge pull request #110423 from Calinou/doc-light3d-cull-mask-gi
Document the interaction between Light3D cull mask and GI/volumetric fog
2025-09-18 12:42:26 -05:00
Thaddeus Crews
d90d8afa5a
Merge pull request #108118 from YYF233333/varray_and_vformat
Simplify `varray`
2025-09-18 12:42:25 -05:00
Thaddeus Crews
ff111e395d
Merge pull request #103917 from Ivorforce/sprintf-span
Optimize `vformat` by using `Span` in `sprintf`
2025-09-18 12:42:24 -05:00
Thaddeus Crews
6e75c28a5e
Merge pull request #107693 from deralmas/wayland-protocols-1.45
wayland-protocols: Update to 1.45
2025-09-18 12:42:23 -05:00
Thaddeus Crews
468ad87a37
Merge pull request #107596 from DeeJayLSP/safe-wav-load
Use 64-bit offset/loop points in `AudioStreamWAV`
2025-09-18 12:42:22 -05:00
Thaddeus Crews
3ad1642b2e
Merge pull request #110410 from BastiaanOlij/fix_stereo_label3d_fixed_size
Fix fixed size flag on StandardMaterial3D when rendering in stereo
2025-09-18 12:42:21 -05:00
Thaddeus Crews
aad046edba
Merge pull request #107045 from Ivorforce/rename-hashing-variables
Rename internal fields and variables in `AHashMap`, `HashMap` and `HashSet`
2025-09-18 12:42:20 -05:00
Thaddeus Crews
1e84bc4d9c
Merge pull request #108260 from Silver1063/master
Fix modifier order in keycode string generation
2025-09-18 12:42:20 -05:00
Lukas Tenbrink
a916325e6a Use Span for String.sprintf, to accelerate vformat not needing to allocate an Array. 2025-09-18 19:29:04 +02:00
Lukas Tenbrink
d1fd42bf3c Expose copy_from_unchecked as append_utf32_unchecked and String::utf32_unchecked in String for high performance string copies. Expose append_wstring and String::wstring for platform strings. 2025-09-18 19:26:57 +02:00
Mounir Tohami
3335708ce0 Refine children cache invalidation to skip more special cases. 2025-09-18 18:28:59 +03:00
Hugo Locurcio
d824e79fc0 Fix DPITexture editor icon name
It was still using its previous name from 4.5 development.
2025-09-18 17:21:02 +02:00
Haoyu Qiu
3f03260a21 Cleanup editor translation related methods
- Unify logic for loading editor/property/doc/extractable translations.
- Replace legacy `TranslationServer` methods with translation domains for internal translations.
- Only pre-create editor/property/doc translation domains in editor builds.
- Prevent adding `null` translation.
- Fixes potential loading of duplicated editor translations.
- Add internal `has_translation_for_locale()` instead of calling `get_loaded_translations().has()`.
2025-09-18 20:27:09 +08:00
Ruw
b23b0dde9a
Update detect.py
Fix UnicodeEncodeError on cp932 environments by adding errors="replace" to log file open
2025-09-18 19:32:03 +09:00
Rémi Verschelde
b9cdc74b2b
Vorbis: Add details to warning about invalid comment header 2025-09-18 12:19:25 +02:00
Roland Marchand
bee392fcd2
Specified delta interaction in CharacterBody docs 2025-09-18 03:27:13 -04:00
Mounir Tohami
1b697aff38 X11 input: prevent non-printable keys from producing empty Strings 2025-09-18 06:56:22 +03:00
DeeJayLSP
7b5c53d996 Use 64-bit offset/loop points in AudioStreamWAV 2025-09-17 20:39:21 -03:00
kit
3892fa4a0b Add MeshInstance3D primitive conversion options 2025-09-17 18:56:25 -04:00
clayjohn
fc951855ed Move check for sky cubemap array back into the SkyRD initializer so it is set before being used.
Previously it was moved out of this function becuase we relied on RenderingServer::get_video_adapter_name which wasn't available yet.

However, that was unnecessary since it is just a wrapper around RenderingDevice::get_device_name() which is available.
2025-09-17 11:41:56 -07:00
Lukas Tenbrink
46b88dcbda Rename internal fields and variables in AHashMap, HashMap and HashSet for consistency. 2025-09-17 19:10:02 +02:00
Thaddeus Crews
8b4b93a82e
Merge pull request #105950 from Joy-less/Fix-array-span-constructors
Fix array span constructors in C#
2025-09-17 11:34:19 -05:00
Thaddeus Crews
cc7397ceb7
Merge pull request #110556 from Ivorforce/safe-nul-parse
Check for `NUL` characters in string parsing functions.
2025-09-17 11:34:18 -05:00
Thaddeus Crews
e5f9f4d1cb
Merge pull request #110618 from timothyqiu/editor-translations-h-cpp-split
Editor: Generate translation data in separate cpp files
2025-09-17 11:34:17 -05:00
Thaddeus Crews
38d80598f5
Merge pull request #108121 from Repiteo/core/disabled-class-rework
Core: Handle disabled class detection in `ClassDB`
2025-09-17 11:34:16 -05:00
Thaddeus Crews
aa294bb3c8
Merge pull request #110360 from zorbathut/pr/memorybarrierrename
Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers.
2025-09-17 11:34:15 -05:00
Thaddeus Crews
b73ba6c58d
Merge pull request #110198 from zeux/sdl-linux-stdlib
Configure SDL assuming we, in fact, have a libc
2025-09-17 11:34:14 -05:00
Thaddeus Crews
8c7c96e2c4
Merge pull request #108636 from clayjohn/MSAA-depth-mobile
Add depth resolve to the mobile renderer
2025-09-17 11:34:13 -05:00
Thaddeus Crews
e721af5775
Merge pull request #110330 from DarioSamo/reflection-probe-size-leak
Fix reflection probes not recreating downsampled textures when mode changes.
2025-09-17 11:34:12 -05:00
Thaddeus Crews
e504943212
Merge pull request #110184 from Namey5/vertex-lighting-issue
Fix rounding error in clustered vertex light culling
2025-09-17 11:34:11 -05:00
Thaddeus Crews
4676d73a1a
Merge pull request #110268 from bruvzg/devid_reg
[Windows] Try reading GPU IDs directly from registry.
2025-09-17 11:34:10 -05:00
Thaddeus Crews
4eaa0ef1e7
Merge pull request #110434 from YeldhamDev/inspector_button_tidyup
Improve look of some buttons inside the inspector
2025-09-17 11:34:09 -05:00
Thaddeus Crews
2ee5a18917
Merge pull request #110465 from m4gr3d/add_quest3s_supported_device
Add `quest3s` to the list of supported devices
2025-09-17 11:34:08 -05:00
Haoyu Qiu
d66cbe0114 Fix imported animation warning labeled as Imported Scene 2025-09-17 23:49:34 +08:00
Haoyu Qiu
c93f55533d Editor: Generate translation data in separate cpp files 2025-09-17 23:10:51 +08:00
Aaron Franke
6bc6110a90
Apply rtos_fix hack for handling 32-bit floats on all calls to rtos_fix 2025-09-17 07:05:33 -07:00
Mikael Hermansson
09b8ac41bb Rephrase Logger documentation to be more explicit about thread-safety 2025-09-17 14:21:53 +02:00
Mounir Tohami
7dc6df3051 Optimize Node::get_children.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-09-17 13:31:23 +03:00
Fredia Huya-Kouadio
ff3eee7df6 Fix the bug causing java.lang.StringIndexOutOfBoundsException crashes when showing the virtual keyboard 2025-09-16 23:03:18 -07:00
Thaddeus Crews
adb2ec043e
Merge pull request #110303 from Unbansheee/master
Fix vertical alignment of Inspector category titles
2025-09-16 20:29:02 -05:00
Thaddeus Crews
1a89648c61
Merge pull request #110206 from aaronp64/remove_unused_enum_bitfield_param
Remove unused parameter in `__constant_get_enum_name`/`__constant_get_bitfield_name`
2025-09-16 20:29:01 -05:00
Thaddeus Crews
d51c13fdd4
Merge pull request #110397 from mooflu/syntaxhi-110390
Don't reset color if the previous token is a number ending with a dot.
2025-09-16 20:29:00 -05:00
Thaddeus Crews
153bd70c8a
Merge pull request #109562 from YYF233333/style-vector
Replace "local" `Vector` with `LocalVector`
2025-09-16 20:28:59 -05:00
Thaddeus Crews
138e21e6ff
Merge pull request #110169 from BlueCube3310/file-access-flush-opti
Optimize data flushing for `FileAccessCompressed` and `FileAccessEncrypted`
2025-09-16 20:28:58 -05:00
Thaddeus Crews
00699ec29e
Merge pull request #110329 from beicause/jolt-orphan-string-name
JoltPhysics: Fix orphan StringName
2025-09-16 20:28:57 -05:00
Thaddeus Crews
31f0eda63b
Merge pull request #110448 from CookieBadger/embed-subwindows-doc
Fix documentation for `embed_subwindows` project setting
2025-09-16 20:28:56 -05:00
Thaddeus Crews
f279257883
Merge pull request #110537 from dsnopek/gdextension-do-not-update-gdextension-special-compat-hashes
GDExtension: Update warning about `gdextension_special_compat_hashes.cpp` to prevent confusion
2025-09-16 20:28:55 -05:00
Thaddeus Crews
da212c74c2
Merge pull request #110504 from AidanCooper2003/control-make-tooltip-typo-fix
Fix typo in control node _make_custom_tooltip description.
2025-09-16 20:28:54 -05:00
Thaddeus Crews
5f82f131d4
Merge pull request #110213 from BlueCube3310/image-alpha-doc
Image: Improve `AlphaMode` documentation
2025-09-16 20:28:53 -05:00
Thaddeus Crews
2557b0da9f
Merge pull request #101285 from Nazarwadim/use_LocalVector_in_animation
Use `LocalVector` in `Animation`
2025-09-16 20:28:52 -05:00
Thaddeus Crews
6f4be6c1f9
Merge pull request #110370 from Susmaster64/patch-1
Fix minor grammar error in CollisionPolygon2D, CollisionPolygon3D, CollisionShape2D, and CollisionShape3D docs
2025-09-16 20:28:51 -05:00
Hugo Locurcio
a97dbc3ad2
Tweak the enum visual order for Sort Scripts By editor setting
None is now displayed first to match the typical pattern where the
"simplest"/least advanced option is first (even if it's not the default).

This is a purely visual change and doesn't affect the underlying enum
or existing settings.
2025-09-17 02:09:15 +02:00
Susmaster64
606284e14b Fix minor grammar error in CollisionPolygon2D, CollisionPolygon3D, CollisionShape2D, and CollisionShape3D docs 2025-09-17 11:43:20 +12:00
fkeyz
02d8cf84b0 Add drag n drop export variables 2025-09-16 23:54:16 +03:00
Lukas Tenbrink
abe3b481ae Make conversions from LocalVector to Vector explicit. 2025-09-16 21:41:28 +02:00
Colin O'Rourke
03d32c68a9 Added Find Sequence to Spans
Added FindSequence to Span.h

Refactored String find to use Span::Find_Seq in Ustring.cpp
2025-09-16 12:37:07 -07:00
Mounir Tohami
081cebb2f7 Geometry2D minor optimization 2025-09-16 21:33:53 +03:00
Thaddeus Crews
6efa557e9b
Merge pull request #109567 from Flarkk/fix_spotlight_fog
Fix spotlight's shadow peter-panning with volumetric fog
2025-09-16 11:44:55 -05:00
Thaddeus Crews
fb23f7d175
Merge pull request #110557 from Splizard/fix-dump-extension-api-with-docs-indentation
Fix `--dump-extension-api-with-docs` indentation
2025-09-16 11:44:54 -05:00
Thaddeus Crews
7ce05be884
Merge pull request #109847 from vaner-org/blendspace-accessibility-name-typos
Fix typos in BlendSpace2D editor's axis labels' accessibility names
2025-09-16 11:44:53 -05:00
Thaddeus Crews
490af72c99
Merge pull request #109815 from Muller-Castro/export-script-file
Fix `EditorExportPlugin::_export_file()` ignoring GDScripts
2025-09-16 11:44:52 -05:00
Thaddeus Crews
853884ba05
Merge pull request #109143 from sievaxx/more_sampler_default_texs
Add and enable default textures for other samplers
2025-09-16 11:44:51 -05:00
Thaddeus Crews
f73d3db412
Merge pull request #108527 from raulsntos/dotnet/enum-variant-conversion
[.NET] Fix enum from/to Variant conversion
2025-09-16 11:44:50 -05:00
Thaddeus Crews
c39edeca6d
Merge pull request #109744 from Repiteo/core/math-constants-semantic
Core: Integrate semantic constants in math structs
2025-09-16 11:44:49 -05:00
Thaddeus Crews
27a3f0eb8d
Merge pull request #108206 from Calinou/transparent-viewport-no-ssr-sss-dof
Disable unsupported SSR, SSS, DoF on transparent viewports
2025-09-16 11:44:48 -05:00
Thaddeus Crews
fe327c217e
Merge pull request #109582 from spoxii/109581-palette_min_width
Remove unused editor setting `editors/grid_map/palette_min_width`
2025-09-16 11:44:47 -05:00
Thaddeus Crews
f69fe1e453
Merge pull request #110380 from TokageItLab/fix-validation-retarget-prop
Fix `_validate_property()` in `RetargetModifier3D`
2025-09-16 11:44:46 -05:00
Thaddeus Crews
4dec6af2c8
Merge pull request #108613 from Repiteo/scons/fix-defines
SCons: Ensure `CPPDEFINES` is properly utilized
2025-09-16 11:44:45 -05:00
Thaddeus Crews
697474baad
Merge pull request #109793 from joaopedroxavier/double-sided-shadows-no-culling
Compatibility: Fix backface culling gets ignored when double-sided shadows are used
2025-09-16 11:44:44 -05:00
Thaddeus Crews
155c594f02
Merge pull request #109568 from syntaxerror247/export-keystore-check
Android: Only validate keystore relevant to current export mode
2025-09-16 11:44:43 -05:00
风青山
54dff9228c
Fix the project file was not updated when some files were removed 2025-09-16 23:21:08 +08:00
Thaddeus Crews
570577a4d6
Merge pull request #109214 from archhabra/godotengine_109204
Correct the order of Diagonal Mode in Add Property
2025-09-16 09:49:02 -05:00
Thaddeus Crews
aedc706b34
Merge pull request #110363 from clayjohn/RD-mobile-half-spot
Increase precision of SpotLight attenuation calculation to avoid driver bug on Intel devices
2025-09-16 09:49:01 -05:00
Thaddeus Crews
5f5b21481d
Merge pull request #106809 from lrahmann/d3d12_cpu_descriptor_heap
DirectX DescriptorsHeap pooling on CPU
2025-09-16 09:49:00 -05:00
Thaddeus Crews
de572675e0
Merge pull request #109369 from ColinSORourke/MaterialConversionErrorFix
Material Conversion Error Handling
2025-09-16 09:48:59 -05:00
Thaddeus Crews
ebb51d1f7d
Merge pull request #109363 from Giganzo/line_edit_rtl_icon
Fix LineEdit icon positon in right-to-left layout
2025-09-16 09:48:58 -05:00
Thaddeus Crews
fe5b8fc3f6
Merge pull request #110515 from DeeJayLSP/qoa-oob
Add one padding frame to QOA buffer for short streams
2025-09-16 09:48:57 -05:00
Thaddeus Crews
1a6d3c2192
Merge pull request #110002 from BastiaanOlij/fix_openxr_viewport_texture_compatibility
OpenXR: Fix ViewportTextures not displaying correct texture (OpenGL)
2025-09-16 09:48:56 -05:00
Thaddeus Crews
94b5658cd2
Merge pull request #106798 from gelvinp/avoid_xcb_crash
Workaround X11 crash issue
2025-09-16 09:48:55 -05:00
Thaddeus Crews
58e056894d
Merge pull request #110507 from jrouwe/issue_110479
Fix bug in ManifoldBetweenTwoFaces
2025-09-16 09:48:54 -05:00
Thaddeus Crews
a298979866
Merge pull request #110535 from aaronp64/array_resize_ptrw
Avoid repeated `_copy_on_write()` calls in `Array::resize()`
2025-09-16 09:48:53 -05:00
Thaddeus Crews
5316d12588
Merge pull request #109346 from bruvzg/win_drv_chk
[Windows] Try reading GPU driver information directly from registry.
2025-09-16 09:48:52 -05:00
Silc Lizard (Tokage) Renew
ee404c657e Fix _validate_property() in RetargetModifier3D 2025-09-16 19:32:22 +09:00
Quentin Quaadgras
e9131550b1 add codeblock indentation back to --dump-extension-api-with-docs
xml codeblock indentation was changed from spaces to tabs but the tabs
were being replaced with empty strings when exported with
--dump-extension-api-with-docs, this is small change so that tab
characters are no longer replaced.
2025-09-16 22:04:32 +12:00
Lukas Tenbrink
0d700e53f3 Check for NUL characters in string parsing functions. 2025-09-16 10:55:44 +02:00
Yufeng Ying
5d66b0b41a Replace unneeded Vector. 2025-09-16 15:04:13 +08:00
Yufeng Ying
8f36c97a49 Optimize varray. 2025-09-16 15:01:26 +08:00
Yufeng Ying
a50fc5acd8 Change ClassDB::get_class_list and related stuff. 2025-09-16 15:00:33 +08:00
kobewi
a3cb0bd2a3 Improve editor language selector 2025-09-16 01:11:42 +02:00
BlueCube3310
ebdf57fbf1 Optimize data flushing for FileAccessCompressed and FileAccessEncrypted 2025-09-16 00:19:19 +02:00
Allen Pestaluky
46e40969a2 Replace the term "color space" with "color encoding". Add additional detail to Color class description. State clearly that Color is expected to use the nonlinear sRGB transfer function. 2025-09-15 18:11:53 -04:00
Rémi Verschelde
6d8aa8582f
Linux: Allow unbundling libjpeg-turbo to use system package 2025-09-15 23:52:48 +02:00
Thaddeus Crews
99a39ce6ea
Merge pull request #110539 from dsnopek/godot-cpp-branch-45
Update `GODOT_CPP_BRANCH` after Godot v4.5-stable release
2025-09-15 16:48:20 -05:00
David Snopek
2967267fba Update GODOT_CPP_BRANCH after Godot v4.5-stable release 2025-09-15 16:41:57 -05:00
Thaddeus Crews
76dfc53dee
Ensure docs point to "latest" 2025-09-15 15:55:06 -05:00
Thaddeus Crews
c2141e0aa5
Bump version to 4.6-dev 2025-09-15 15:50:22 -05:00
David Snopek
d0a0d8b798 GDExtension: Update warning about gdextension_special_compat_hashes.cpp to prevent confusion 2025-09-15 14:02:56 -05:00
aaronp64
4c3f2be16d Avoid repeated _copy_on_write() calls in Array::resize()
Updated Array::resize() to call ptrw() once before looping to initialize typed array elements, instead of accessing each through .write[].
2025-09-15 14:03:21 -04:00
DeeJayLSP
af5a81faf8 Add one padding frame to QOA buffer for short streams 2025-09-15 10:27:36 -03:00
Marcel Offermans
7d09e4a428 Fixes #110519 by removing the 'Depth buffer' option that is not present in the back-end. 2025-09-14 21:04:05 +02:00
Michael Alexsander
06b155a18c
Improve look of some buttons inside the inspector 2025-09-14 12:29:55 -03:00
Serhii Snitsaruk
476b901247
Prevent JNI Variant conversion stack overflow 2025-09-14 12:51:59 +02:00
Jorrit Rouwe
1daf9893ec Fixed bug in ManifoldBetweenTwoFaces
Fixed bug in ManifoldBetweenTwoFaces which would not find the correct manifold in case face 1 had 3 or more vertices and face 2 only 2. E.g. for a box resting the long edge of a cylinder this would mean that only a single contact point was found instead of 2 (the other way around would work fine).

Fixes godotengine/godot#110479
2025-09-14 11:01:00 +02:00
Hugo Locurcio
204e310914
Tweak draw command label names for consistency
- Use Title Case for all labels, and add hyphens where relevant.
- Mention Roughness in SSR Filter's label name, as it's only enabled
  when the SSR roughness quality is not set to Disabled.
2025-09-14 01:23:47 +02:00
aidcoope
e3a6abd871 Fix typo in control node _make_custom_tooltip description. 2025-09-13 16:58:49 -04:00
Pāvels Nadtočajevs
77dd83efbf
[macOS] Remove old embedded window joystick init code. 2025-09-13 17:56:16 +03:00
Pāvels Nadtočajevs
906aff5331
Fix iOS/visionOS export plugin crash on exit. 2025-09-13 11:22:40 +03:00
Fredia Huya-Kouadio
35c87ae0ca Add quest3s to the list of supported devices 2025-09-12 11:38:02 -07:00
emild
13c2b28cd6 remove incorrect single window mode inverted hint 2025-09-12 10:25:47 +02:00
Frank Becker
aa8acd1a04 Don't reset color if the previous token is a number ending with a dot. 2025-09-11 11:40:15 -07:00
Roman Goldman
6379874180
Fix Basis.determinant() doc: uniform scale determinant is scale^3, not scale^2
Corrected a documentation mistake in Basis.determinant(). For a uniform scale basis, the determinant is scale^3, not scale^2.
2025-09-11 18:45:02 +03:00
Hugo Locurcio
9317c8eb23 Document the interaction between Light3D cull mask and GI/volumetric fog 2025-09-11 17:05:44 +02:00
Hugo Locurcio
1c62ba40b7 Disable unsupported SSR, SSS, DoF on transparent viewports
For technical reasons, transparent viewports cannot support
screen-space reflections, subsurface scattering and depth of field.
Previously, enabling any of these would turn transparent viewports
invisible.
2025-09-11 14:59:07 +02:00
Artemy Fedotov
8d137bcd29
Fix favorite folders that are outside of the project being displayed in FileSystemDock's file list 2025-09-11 16:44:40 +04:00
Haoyu Qiu
d61d70e8b9 Fix Open Editor Data/Settings Folder menu in self-contained mode 2025-09-11 19:39:58 +08:00
Artemy Fedotov
4e3a39a2e8
Fix crash due to null pointer dereference when moving/renaming folders in FileSystemDock 2025-09-11 15:31:32 +04:00
Bastiaan Olij
748f35ccb8 Fix fixed size flag on StandardMaterial3D when rendering in stereo 2025-09-11 20:53:19 +10:00
Haoyu Qiu
cadd08da9e Set language encoding flag when using Pack Project as ZIP 2025-09-11 16:44:09 +08:00
Pāvels Nadtočajevs
75bbe3a0bc
Shader Editor: Show "File" menu when no shaders are opened. 2025-09-11 09:47:16 +03:00
Vinnie Gray
47756c9689 Fix vertical alignment of Inspector category titles 2025-09-11 08:35:22 +12:00
Ben Rog-Wilhelm
e5ab5acd95 Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers. 2025-09-10 05:19:36 -05:00
clayjohn
0576b12699 Increase precision of SpotLight attenuation calculation to avoid driver bug on Intel devices 2025-09-09 13:18:55 -07:00
Mounir Tohami
320ff6bc75 Fix Redundant calls of CIE _update_lock_and_group_button on SceneTree selection. 2025-09-09 01:33:51 +03:00
Pāvels Nadtočajevs
d8cdc53ec0
Use language command line argument to override editor locale. 2025-09-08 23:45:54 +03:00
Dario
7b923609c2 Fix reflection probes not recreating downsampled textures when mode changes. 2025-09-08 15:54:37 -03:00
Luo Zhihao
793228f171
JoltPhysics: Fix orphan StringName 2025-09-08 22:18:46 +08:00
cafebeef
bc0eba5296 Fixed Skeleton2D TwoBoneIK and LookAt mirroring
Co-authored-by: thiagola92 <thiagola92@gmail.com>
2025-09-06 16:20:24 -05:00
StarryWorm
45f089a143 Enable objects stored as dictionary keys to be selected in inspector.
Currently, when using the stack trace or the remote scene tree and selecting an
object containing a dictionary, secondary objects that are stored as values in
the dictionary can be opened in inspector by clicking on them. However,
attempting to open the same secondary object if it is stored as a key in the
dictionary will result in nothing happening.

This is fixed by connecting keys to the "object_id_selected" signal the same
way values are connected.
2025-09-06 10:04:33 -04:00
kobewi
139c406558 Properly inspect old remote selection 2025-09-05 18:16:34 +02:00
kobewi
502f49d7f9 Redraw shape controls when ColorPicker theme changes 2025-09-05 18:04:38 +02:00
Cyril B.
c7d0cb8072 Add missing descriptions-group to annotation descriptions 2025-09-05 17:34:39 +02:00
bruvzg
252329ce40
[Windows] Try reading GPU IDs directly from registry. 2025-09-05 11:09:31 +03:00
clayjohn
a86cd83593 Defer checking for rendering device support until the new project dialog is opened
This can save a lot of time opening the project manager and the information is only ever needed when creating a new project anyway
2025-09-05 00:41:34 -07:00
Kamil Tokarski
d3fadcb5fb
Add name info to EditorAutoloadSettings invalid name message 2025-09-05 01:39:32 +02:00
Kamil Tokarski
6aae7d7345
Fix editor crash cause by EditorFileSystem::get_singleton access in theme initialization path 2025-09-04 18:11:55 +02:00
westenral
565e1aaeb9 Add checks for integer vectors for integer division warning
Remove warnings for invalid Vectori combinations

Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2025-09-04 10:13:05 -04:00
Lukas Rahmann
f7fd65923a Add descriptor heap pooling to D3D12. 2025-09-04 09:17:40 -03:00
Luo Zhihao
d9d796618d
Fix CompositorEffect not setting post-transparent callback on init 2025-09-04 19:16:00 +08:00
Luo Zhihao
5f737952fd
ShaderCompiler: Optimize compilation error printing 2025-09-04 16:51:17 +08:00
Artemy Fedotov
7b850260bf
Fix invalid suggested file name when saving resource from a scene that hasn't been saved yet 2025-09-04 09:49:09 +04:00
Hugo Locurcio
dd8bab9f89
Fix shader compilation errors in Compatibility when using depth_texture
Globals were defined too early, which means some uniforms were not available
at the point they were defined in.
2025-09-04 00:33:45 +02:00
Muller-Castro
9504b0ff7a Fix EditorExportPlugin::_export_file() ignoring GDScripts 2025-09-03 16:50:28 -03:00
Björn
8798387770 Improve identification of edits on property Object->script
Narrows down the criteria to determine if the property being edited with the `EditorResourcePicker` is actually the `Object->script` property.
2025-09-03 17:38:56 +02:00
Artemy Fedotov
fb7d2829f3
Fix ScriptEditor::edit() ignoring column parameter 2025-09-03 16:57:03 +04:00
BlueCube3310
feb3e904cb Image: Improve AlphaMode documentation 2025-09-02 23:44:09 +02:00
Giganzo
c6be28af7a Fix SpinBox value change when held down on separation between buttons 2025-09-02 23:15:56 +02:00
Dario
1ce55b946c Clamp minimum size of 3D texture view in D3D12. 2025-09-02 15:13:27 -03:00
aaronp64
cfde73ac17 Remove unused parameter in __constant_get_enum_name/__constant_get_bitfield_name
Removed unused String parameter in __constant_get_enum_name() and __constant_get_bitfield_name() to avoid creating/destroying extra Strings.
2025-09-02 13:13:12 -04:00
Pāvels Nadtočajevs
ddde1c07a6
[TextServer] Shape emojis as separate runs. 2025-09-02 13:03:50 +03:00
Arseny Kapoulkine
dcefe95ae4 Configure SDL assuming we, in fact, have a libc.
Without this, on Linux and Linux alone, and only if SDL is builtin, the
definitions for some functions - notably, memset/memcpy - are taken from
SDL source.

This leaves them at the mercy of the compiler and may lead to the
optimal implementations of these functions not being selected. But the
main motivation for this is that it's action at a distance that is
incredibly surprising - linking in a gamepad support library should not
change the implementation of memset/memcpy!
2025-09-01 23:19:35 -07:00
Alex Threlfo
60a7bed19c Fix rounding error in clustered vertex light culling 2025-09-02 11:33:38 +10:00
vaner-org
bac7253fcf Trim -loop & -cycle from animations during Godot 3 to 4 conversion 2025-09-02 06:27:39 +05:30
Pāvels Nadtočajevs
be443e41bb
Use placeholder instead of value for tooltips of PROPERTY_HINT_PASSWORD properties. 2025-09-01 16:46:00 +03:00
PiCode
dd11265c4c Improve suspend button 2025-09-01 14:38:45 +03:00
Aaron Franke
d80b9887dd
Fix inconsistent internal name of get_resource_filesystem 2025-08-31 18:16:37 -07:00
Mike Precup
1c8e3f9037 Speed up large selections in the editor 2025-08-31 14:25:44 -07:00
Mike Precup
e73e978d65 Misc editor speedups for large scenes 2025-08-31 13:46:33 -07:00
Mike Precup
67723a9572 Speed up very large Trees 2025-08-31 13:38:43 -07:00
rxlecky
02e1919514 Cleanup and simplify camera override API
- Harmonise the camera override 2D and 3D APIs
- Switch to using Camera2D/3D nodes to provide override functionality. This makes for simpler code, gets rid of much of copy-pasted camera code and makes code that relies on current viewport camera such as VisibleOnScreenNotifiers and object picking work out of the box.
- Make camera override code only accesible within DEBUG_ENABLED builds
2025-08-31 15:34:46 +02:00
Flyn San
7fc11f8999 Emit EditorPlugin.scene_changed event when opening a scene from an empty tab list 2025-08-31 21:45:50 +10:00
aaronp64
2b855d831d Add more Array tests
Added more tests for Array, focusing on methods exposed to gdscript that didn't have tests.
2025-08-30 13:12:16 -04:00
arkology
ea17bf712a Fix Audio bottom panel going under the taskbar on small displays 2025-08-30 15:59:56 +03:00
danielgsilva
bf7422e2c7 Take into account parent and child folding status when drawing relatioship lines 2025-08-29 14:03:39 +01:00
Giganzo
12d74872a5 Fix folder color in FileSystem Dock when using light theme 2025-08-28 22:38:00 +02:00
Pāvels Nadtočajevs
90370a08ec
Clamp menus at the bottom of the screen. 2025-08-27 15:29:50 +03:00
danielgsilva
611fc62fe4 Reinstate const parameter in draw_item_rect 2025-08-27 10:27:15 +01:00
Bastiaan Olij
a38256c19e OpenXR: Fix ViewportTextures not displaying correct texture (Compatibility) 2025-08-27 13:02:39 +10:00
Arseny Kapoulkine
90ff46c292 Update meshoptimizer to v0.25
Also expose new flags as SurfaceTool enums for future use
2025-08-26 10:19:48 -07:00
Thaddeus Crews
555e7ad073
Core: Handle disabled class detection in ClassDB 2025-08-26 09:31:14 -05:00
Haoyu Qiu
1b087104e5 Make POT generation use tooltip_auto_translate_mode 2025-08-26 13:08:03 +08:00
David Snopek
f9c76d026d OpenXR: Fix errors reported by XrApiLayer_core_validation 2025-08-25 15:54:54 -05:00
Ricardo Sanchez-Saez
6d9983e958
[apple embedded] Replace individual iOS/visionOS Xcode templates by Apple embedded template 2025-08-25 12:42:34 -07:00
Daniel Kinsman
a001026dbb
Update modules/gltf/editor/editor_scene_importer_blend.cpp
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-08-25 22:00:13 +10:00
Daniel Kinsman
0cace15d72
better error message 2025-08-25 21:23:44 +10:00
Daniel Kinsman
c75a33aa5d Fix hang when importing blender files in headless mode 2025-08-25 11:30:56 +10:00
Kevin Lam
4c9bd858c7 Fix tree to update size with scrollbars disabled
When scrollbars are disabled, tree size is dependant on item sizes, so this adds missing checks for when to resize. The side effect of the bug was that scrollbars could incorrectly appear when items change at runtime.
2025-08-24 20:00:48 -05:00
Aaron Franke
e90cea9250
Handle NaN and Infinity in JSON stringify function 2025-08-24 10:09:43 -07:00
arkology
977ffe200e TextureEditors: Compile shader/material only once 2025-08-23 13:48:07 +03:00
Kaleb Reid
a2b9fc08e3 Fix ghost collisions in segment_intersects_convex() 2025-08-22 22:49:56 -07:00
vaner-org
464bd50ae9 Double-click BlendSpace points to open their editor 2025-08-22 22:33:13 +05:30
David Snopek
13a643d78a OpenXR: Safely set environment blend mode when rendering on a separate thread 2025-08-22 08:11:04 -05:00
David Snopek
4a24de208f OpenXR: Prevent adding/removing extension wrappers after session start 2025-08-22 08:04:03 -05:00
ArchercatNEO
188b47a29b Wayland: Implement the xdg-toplevel-icon-v1 protocol
Closes #87747
Requires a compositor which supports xdg-toplevel-icon-v1.
As of this commit only KWin supports this protocol.
2025-08-22 09:45:28 +01:00
vaner-org
22e67735f1 Fix accessibility name errors in BlendSpace2D editor 2025-08-22 07:12:42 +05:30
Muller-Castro
be68ff8cea Fix FileAccess::create_temp() default args error 2025-08-21 20:00:55 -03:00
Pāvels Nadtočajevs
6e76a9467f
[macOS] Always use "Regular" activation policy for GUI, and headless main loop for command line only tools. 2025-08-20 10:07:33 +03:00
João Pedro Xavier
d6aca93c1a Fix bug where material with double-sided shadows ignores backface culling on compatibility renderer 2025-08-19 20:21:10 -07:00
David Snopek
b9bff1fba5 Expose Thread::is_main_thread() 2025-08-19 10:35:45 -05:00
Thaddeus Crews
84c0ec04f3
Core: Integrate semantic constants in math structs
- Excludes self-explanatory constants (ZERO, ONE, etc)
2025-08-19 10:15:08 -05:00
BlueCube3310
d481a23c5a Compatibility: Improve ASTC extension detecting 2025-08-19 17:12:55 +02:00
A Thousand Ships
0c4a00bf2a
[Copyright] Fix spelling of license
When using automated checks for listing licenses this fails to look up
without fixing the spelling as only `BSD-3-clause` is stored in the
`Engine` entries.
2025-08-18 18:02:06 +02:00
Haoyu Qiu
4c4d8b39f1 Clarify truncation behavior in file open modes 2025-08-15 23:53:45 +08:00
devloglogan
1a864595cf Add XR_META_hand_tracking_microgestures actions 2025-08-15 10:37:29 -05:00
Rudolph Bester
56e04635a7 Minor Optimization to Occlusion Culling 2025-08-14 20:00:58 +02:00
vaner-org
bc55744121 Correctly resets StateMachine opacity when a node is played or renamed 2025-08-14 14:39:56 +05:30
Pāvels Nadtočajevs
f260c5db8a
find_*_valid_focus: Check all tested neighbors to prevent loops. 2025-08-13 23:59:01 +03:00
SPOXY
e0bf7ff072
Remove unused editor setting editors/grid_map/palette_min_width
This option is no longer used after the rework in #96922

Reported-by: Nodragem <geoffrey.megardon@gmail.com>
2025-08-13 18:19:37 +02:00
Anish Mishra
097ccbc5cd Android: Only validate keystore relevant to current export mode
- Debug builds skip release keystore validation.
- Release builds skip debug keystore validation.
2025-08-13 13:35:50 +05:30
Florent Guiocheau
199161f023 Fix spotlight's shadow with volumetric fog 2025-08-13 09:28:06 +02:00
Anish Mishra
459cb33abc Android Editor: Set the window color to match background color 2025-08-11 22:25:54 +05:30
Anish Mishra
0ad232423d Android: Add method to set root window color at runtime 2025-08-11 22:25:53 +05:30
Mounir Tohami
8937c6880f ProfilerAutostartWarning.svg cleanup 2025-08-08 02:56:21 +03:00
Dario
517b42e7dd Add ubershader support to material and SDF variants in Forward+. 2025-08-07 14:40:14 -03:00
Ryan
0f870fd286 Improve RPC Error messages
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-08-06 17:14:18 -04:00
Colin O'Rourke
05fd79af7c Material Conversion Error Handling
Material Conversion Plugins now ERR_FAIL if called on an unitialized material.

FileSystemDock no longer crashes if Conversion Plugin fails and returns a null ref.
2025-08-06 14:03:11 -07:00
Giganzo
fbf27dbfc6 Fix LineEdit icon positon in right-to-left layout 2025-08-06 21:55:37 +02:00
Pāvels Nadtočajevs
9f8626ccaa
[Windows] Try reading GPU driver information directly from registry. 2025-08-06 08:01:05 +03:00
robert yevdokimov
11a4961081 Relocate add_root_node method to EditorInterface from EditorScript and deprecate old method 2025-08-05 17:23:57 +04:00
Mike Precup
adfb0d8c1d Optimize TileMapLayer 2025-08-04 11:05:57 -07:00
BlueCube3310
356b1ab2a6 Compatibility: Fix cubemap faces order when setting texture data 2025-08-04 13:27:28 +02:00
HolonProduction
8ec31b7b3d Autocompletion: Remove duplicate code 2025-08-04 12:59:22 +02:00
Arti Chhabra
6a288c9275 Corrected the order of DiagonalMode in Add Property 2025-08-01 14:59:59 -07:00
Mikael Hermansson
7f5933c0f3 Make file part of errors/warnings clickable in Output panel 2025-08-01 13:44:07 +02:00
Tibo
e09cb44a94 Add Show Encryption Key toggle 2025-08-01 09:01:59 +02:00
Hugo Locurcio
b625b40d92
Use a fixed-width font for the expression evaluator 2025-07-31 16:48:53 +02:00
Riley Willows
fbe2710843
Add and enable default textures for other samplers 2025-07-31 00:08:43 +01:00
Jojo-1000
ab178719d9 Mark methods for various classes as required 2025-07-30 19:24:56 +02:00
Hei
f6602d40bd Round gradient colors. 2025-07-29 12:22:34 +03:00
timmno12
ecfb96239c Add swapchain create flags support to OpenXR layers
- Introduced SwapchainCreateFlags enum to control swapchain creation (NORMAL, STATIC, PROTECTED) in OpenXR composition layers.
- Allows creation of static layers (never change after creation) and protected layers (for DRM-protected content).
- Changed internal logic from enum to bool for simplicity; users now select "protected" or not.
- Added support for protected content in viewport-based layers.
- Refactored naming, documentation, and improved reusability.
- Minor cleanup: removed unused variable and added missing space.
2025-07-28 16:48:33 +02:00
Pāvels Nadtočajevs
838cb0eefc
[macOS] Add support for exporting macOS 26 Liquid Glass icons. 2025-07-28 14:35:48 +03:00
Pāvels Nadtočajevs
2409956297
Include SPACING_SPACE into tab stops calculation. 2025-07-27 21:26:36 +03:00
Haoyu Qiu
b56b776ab2 Remove unused member variables in EditorNode 2025-07-27 23:38:05 +08:00
kobewi
31b5375a1c Don't save code property of VisualShader 2025-07-27 14:25:02 +02:00
Joyless
cbc7dac0d5 Improve IsNormalized() 2025-07-25 17:53:38 +01:00
Giganzo
3d6b4f9038 Add suffix to EditorSpinSlider tooltips 2025-07-24 21:51:45 +02:00
Nodragem
0f1e8809f7 fix jump when cutting a selection 2025-07-24 12:21:22 +01:00
Hugo Locurcio
269ee1204d
Display AnimationTree editor warnings when the node is disabled
AnimationTree's Active property isn't the only way to control whether
an AnimationTree can play animations. Node's Process Mode property
also affects it.
2025-07-24 00:08:31 +02:00
Giganzo
02da380903 Fix bad text contrast on readonly EditorPropertyArray/Dict/Res 2025-07-22 14:27:10 +02:00
Pāvels Nadtočajevs
37ae7d4420
[macOS] Use "file" icon for bundles in the file dialogs. 2025-07-20 20:44:33 +03:00
robert yevdokimov
6daaea4780 Create a rotation arc showing accumulated rotation when using transform gizmo 2025-07-18 20:43:13 +04:00
David Snopek
91a4a28aab GDExtension: Add mem_alloc2 (and friends) so padding can be requested 2025-07-17 16:16:05 -05:00
clayjohn
a8efa55bed Add depth resolve to the mobile renderer 2025-07-16 20:37:39 -07:00
Haoyu Qiu
819c80428d Allow closing all scene tabs via shortcut 2025-07-16 20:33:41 +08:00
Pāvels Nadtočajevs
f20e5152ad
[EditorExportPlatform] Move initialization to a dedicated method. 2025-07-16 08:55:23 +03:00
Thaddeus Crews
61956f2e06
SCons: Ensure CPPDEFINES is properly utilized 2025-07-14 13:07:53 -05:00
shadow-foss
c5490f7284 Add toggle to insert keys/markers at current time or mouse position
Adds a new editor setting editors/animation/insert_at_current_time and a toggle button in the Animation Track Editor to let users choose whether to insert keys and markers at the current timeline cursor (when enabled) or at the mouse position (default behavior).

- Key insertion
- Paste and duplicate operations
- Editor setting persistence
- Icon by @TokageItLab

Fixes #103272
2025-07-13 09:57:27 +05:30
robert yevdokimov
728934f43e Do not require editor restart when changing manipulator gizmo opacity setting 2025-07-12 19:05:24 +04:00
Raul Santos
8950744921
[.NET] Fix enum from/to Variant conversion
- `typeof(T).IsEnum` and `typeof(T).GetEnumUnderlyingType()` are intrinsified in .NET 8+ so we can simplify the code in VariantUtils a bit.
- Consider whether enum `T` is signed in VariantUtils to preserve it.
2025-07-11 20:14:23 +02:00
Mike Precup
047edb8933 Avoid unnecessary copy in get_property_list 2025-07-10 17:06:13 -07:00
Anish Mishra
a8f8f84af6
CI: Generate debug build for Android 2025-07-10 13:10:10 +05:30
Mikael Hermansson
3528e83ff3 Various fixes and style nitpicks 2025-07-09 14:27:48 +02:00
Robert Yevdokimov
fc7b7571a0 Remove prompt to restart editor after changing custom theme 2025-07-08 23:00:31 +04:00
kobewi
11adf408ab Add is_instance() helper method to Node 2025-07-08 20:42:52 +02:00
Rémi Verschelde
0adf0898eb Various style nitpicks 2025-07-08 16:39:24 +02:00
Aleksander Litynski
78f1543e35 Add an ObjectDB Profiling Tool
A new tab is added to the debugger that can help profile a game's memory usage.

Specifically, this lets you save a snapshot of all the objects in a running
game's ObjectDB to disk. It then lets you view the snapshot and diff two
snapshots against each other. This is meant to work similarly to Chrome's
heap snapshot tool or Unity's memory profiler.
2025-07-08 16:39:24 +02:00
Logan Detrick
78045df591 Fix TabBar corner radius and generalize Debugger hack 2025-07-07 16:50:12 -07:00
Silver1063
00f5b230be Fix modifier order in keycode string generation
Fix the order in which modifier keys are appended in as_text() and keycode_get_string() to ensure consistent and logical ordering (Ctrl, Alt, Shift, Meta). Refactored keycode_get_string() to use a vector for building the key string, improving readability and maintainability.
2025-07-06 14:23:50 -07:00
Haoyu Qiu
a760a7656c Show "No Translations Configured" message for empty translation preview menu 2025-07-05 14:45:11 +08:00
Haoyu Qiu
a805b0c658 Show description for editor settings overrides
Also marked the "Editor Overrides" section name for translation.
2025-07-05 14:44:17 +08:00
kobewi
f1c941d460 Improve error message when UID main scene is not found 2025-06-28 13:55:08 +02:00
BlueCube3310
16b9ee6f50 Image: Implement 16-bit unorm and uint formats 2025-06-28 00:30:52 +02:00
Mikael Hermansson
a3e58a385f Add opt-in GDScript warning for when calling coroutine without await 2025-06-27 20:24:41 +02:00
Logan Detrick
c03a7b7893 Delay Mouse signals until after internal processing 2025-06-24 14:29:17 -07:00
lawnjelly
14a814586a Provide quick access to Object ancestry 2025-06-23 07:11:11 +01:00
Joyless
d956bcf749 Add ROS overload for Callable.Call 2025-06-21 13:43:52 +01:00
Lukas Tenbrink
28fd557c58 Add missing vpv.push_back(pv); in render_target_get_sdf_texture. 2025-06-20 14:46:03 +02:00
Riteo
ae74c0c9a4 wayland-protocols: Update to 1.45 2025-06-19 03:59:20 +02:00
Nazarii
1964918e46 Use LocalVector in Animation 2025-06-18 18:37:55 +03:00
Sch1nken
a9ac00f8f7 Added multimesh physics interpolation for 2D transforms (MultiMeshInstance2D)
Replicated MultimeshInstance3D behaviour to MultiMeshInstance2D and added mesh_storage for 2D transform

Also call VisualInstance::_physics_interpolated_changed()

Use Node instead of VisualInstance. Addded comment

Fixed typo :)

Using CanvasItem instead of Node now. Made CanvasItem::_physics_interpolated_changed() protected
2025-06-18 16:04:51 +02:00
lawnjelly
af2b9be356 Node3D and CanvasItem children change to LocalVector 2025-06-18 13:32:30 +01:00
Lukas Tenbrink
175c38d0dc Core: Add Node::iterate_children as a fast way to iterate a node's children, without needing allocations or get_child.
Adds `Iterable` class to templates.
2025-06-13 17:01:51 +02:00
Hugo Locurcio
b6dcb111d2
Document typed dictionaries and arrays in the class reference 2025-06-13 01:53:17 +02:00
AndrewYuan34
4774b57e4d Add auto-scroll behavior when selecting text outside the visible area in RichTextLabel 2025-06-07 11:28:54 -04:00
Lukas Tenbrink
c3476b8205 Fix FixedVector move semantics. 2025-05-31 18:22:16 +02:00
Patrick Gelvin
6842a5861b Workaround X11 crash issue 2025-05-25 08:07:24 -07:00
Joyless
14783cd8b8 Fix array span constructors 2025-05-13 13:28:00 +01:00
Riteo
2e41412ee4 Wayland: Emulate frame event for old wl_seat versions
Multiwindow support simplified input handling by processing all data
only during a `wl_seat::frame` event, which got introduced in wl_seat
version 5. If the compositor reports an older version, we manually call
the frame event handler.
2025-04-20 17:11:08 +02:00
MewPurPur
857f47e238 Rework icons of noise-related classes 2025-04-05 18:45:49 +03:00
MewPurPur
ae980c6bfb Add icons to some editor classes 2025-04-05 17:25:42 +03:00
Artemy Fedotov
d1f11b2b28
GridMap: fix cell scale not applying to the cursor mesh 2025-03-23 13:42:10 +04:00
gr8alpaca
4d80777ce7 Expose 3D editor snap settings to EditorInterface 2025-03-12 10:02:40 -04:00
Hugo Locurcio
54995d9850
Add a property range hint to bake_fps in the scene glTF export dialog
This clamps the value to a value greater than `0` (exclusive).
2024-10-17 17:00:20 +02:00
detomon
c0e36dc493 Initialize Quaternion variant with identity 2024-10-05 10:46:52 +02:00
2086 changed files with 114460 additions and 32252 deletions

24
.github/CODEOWNERS vendored
View file

@ -45,8 +45,6 @@
# Editor # Editor
/editor/ @godotengine/docks /editor/ @godotengine/docks
/editor/script/ @godotengine/script-editor
/editor/shader/ @godotengine/script-editor @godotengine/shaders
/editor/animation/ @godotengine/animation /editor/animation/ @godotengine/animation
/editor/audio/ @godotengine/audio /editor/audio/ @godotengine/audio
/editor/debugger/ @godotengine/debugger /editor/debugger/ @godotengine/debugger
@ -57,10 +55,12 @@
/editor/import/ @godotengine/import /editor/import/ @godotengine/import
/editor/inspector/ @godotengine/docks /editor/inspector/ @godotengine/docks
/editor/scene/2d/ @godotengine/2d-editor /editor/scene/2d/ @godotengine/2d-editor
/editor/scene/2d/physics @godotengine/2d-editor @godotengine/physics /editor/scene/2d/physics/ @godotengine/2d-editor @godotengine/physics
/editor/scene/3d/ @godotengine/3d-editor /editor/scene/3d/ @godotengine/3d-editor
/editor/scene/3d/physics @godotengine/3d-editor @godotengine/physics /editor/scene/3d/physics/ @godotengine/3d-editor @godotengine/physics
/editor/scene/gui/ @godotengine/gui-nodes /editor/scene/gui/ @godotengine/gui-nodes
/editor/script/ @godotengine/script-editor
/editor/shader/ @godotengine/script-editor @godotengine/shaders
/editor/themes/ @godotengine/usability @godotengine/gui-nodes /editor/themes/ @godotengine/usability @godotengine/gui-nodes
/editor/translations/ @godotengine/usability /editor/translations/ @godotengine/usability
@ -205,9 +205,12 @@
# Scene # Scene
/scene/2d/ @godotengine/2d-nodes /scene/2d/ @godotengine/2d-nodes
/scene/2d/navigation/ @godotengine/2d-nodes @godotengine/navigation
/scene/2d/physics/ @godotengine/2d-nodes @godotengine/physics /scene/2d/physics/ @godotengine/2d-nodes @godotengine/physics
/scene/3d/ @godotengine/3d-nodes /scene/3d/ @godotengine/3d-nodes
/scene/3d/navigation/ @godotengine/3d-nodes @godotengine/navigation
/scene/3d/physics/ @godotengine/3d-nodes @godotengine/physics /scene/3d/physics/ @godotengine/3d-nodes @godotengine/physics
/scene/3d/xr/ @godotengine/3d-nodes @godotengine/xr
/scene/animation/ @godotengine/animation /scene/animation/ @godotengine/animation
/scene/audio/ @godotengine/audio /scene/audio/ @godotengine/audio
/scene/debugger/ @godotengine/debugger /scene/debugger/ @godotengine/debugger
@ -227,18 +230,13 @@
# Servers # Servers
/servers/**/audio_* @godotengine/audio
/servers/**/camera_* @godotengine/xr
/servers/**/debugger_* @godotengine/debugger
/servers/**/navigation_* @godotengine/navigation
/servers/**/physics_* @godotengine/physics
/servers/**/rendering_* @godotengine/rendering
/servers/**/text_* @godotengine/gui-nodes
/servers/**/xr_* @godotengine/xr
/servers/audio/ @godotengine/audio /servers/audio/ @godotengine/audio
/servers/camera/ @godotengine/xr /servers/camera/ @godotengine/xr
/servers/debugger/ @godotengine/debugger /servers/debugger/ @godotengine/debugger
/servers/navigation/ @godotengine/navigation /servers/navigation_2d/ @godotengine/navigation
/servers/navigation_3d/ @godotengine/navigation
/servers/physics_2d/ @godotengine/physics
/servers/physics_3d/ @godotengine/physics
/servers/rendering/ @godotengine/rendering /servers/rendering/ @godotengine/rendering
/servers/text/ @godotengine/gui-nodes /servers/text/ @godotengine/gui-nodes
/servers/xr/ @godotengine/xr /servers/xr/ @godotengine/xr

View file

@ -10,7 +10,7 @@ inputs:
default: x64 default: x64
scons-version: scons-version:
description: The SCons version to use. description: The SCons version to use.
default: 4.9.0 default: 4.10.0
runs: runs:
using: composite using: composite

View file

@ -26,14 +26,14 @@ jobs:
arch=arm64 arch=arm64
production=yes production=yes
- name: Template arm32 (target=template_release, arch=arm32) - name: Template arm32 (target=template_debug, arch=arm32)
cache-name: android-template-arm32 cache-name: android-template-arm32
target: template_release target: template_debug
scons-flags: arch=arm32 scons-flags: arch=arm32
- name: Template arm64 (target=template_release, arch=arm64) - name: Template arm64 (target=template_debug, arch=arm64)
cache-name: android-template-arm64 cache-name: android-template-arm64
target: template_release target: template_debug
scons-flags: arch=arm64 scons-flags: arch=arm64
steps: steps:
@ -82,7 +82,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Generate Godot templates - name: Generate Godot templates
if: matrix.target == 'template_release' if: matrix.target == 'template_debug'
run: | run: |
cd platform/android/java cd platform/android/java
./gradlew generateGodotTemplates ./gradlew generateGodotTemplates

View file

@ -8,7 +8,7 @@ env:
dev_mode=yes dev_mode=yes
module_text_server_fb_enabled=yes module_text_server_fb_enabled=yes
"accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.17.0/" "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.17.0/"
GODOT_CPP_BRANCH: 4.4 GODOT_CPP_BRANCH: 4.5
DOTNET_NOLOGO: true DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_CLI_TELEMETRY_OPTOUT: true
ASAN_OPTIONS: color=always:print_suppressions=1:suppressions=${{ github.workspace }}/misc/error_suppressions/asan.txt ASAN_OPTIONS: color=always:print_suppressions=1:suppressions=${{ github.workspace }}/misc/error_suppressions/asan.txt

2
.gitignore vendored
View file

@ -217,7 +217,7 @@ xcuserdata/
*.xcscmblueprint *.xcscmblueprint
*.xccheckout *.xccheckout
*.xcodeproj/* *.xcodeproj/*
!misc/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj !misc/misc/dist/apple_embedded_xcode/godot.xcodeproj/project.pbxproj
# Zed # Zed
.zed/ .zed/

View file

@ -34,9 +34,9 @@ repos:
stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy` stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy`
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0 rev: v0.13.1
hooks: hooks:
- id: ruff - id: ruff-check
args: [--fix] args: [--fix]
files: (\.py|SConstruct|SCsub)$ files: (\.py|SConstruct|SCsub)$
types_or: [text] types_or: [text]

View file

@ -214,7 +214,7 @@ License: Apache-2.0
Files: thirdparty/basis_universal/* Files: thirdparty/basis_universal/*
Comment: Basis Universal Comment: Basis Universal
Copyright: 2019-2024, Binomial LLC. Copyright: 2019-2025, Binomial LLC.
License: Apache-2.0 License: Apache-2.0
Files: thirdparty/brotli/* Files: thirdparty/brotli/*
@ -555,7 +555,7 @@ License: Zlib
Files: thirdparty/sdl/hidapi/* Files: thirdparty/sdl/hidapi/*
Comment: hidapi Comment: hidapi
Copyright: 2010, Alan Ott, Signal 11 Software Copyright: 2010, Alan Ott, Signal 11 Software
License: BSD-3-Clause License: BSD-3-clause
Files: thirdparty/spirv-cross/* Files: thirdparty/spirv-cross/*
Comment: SPIRV-Cross Comment: SPIRV-Cross

View file

@ -210,7 +210,7 @@ opts.Add(
) )
) )
opts.Add(BoolVariable("tests", "Build the unit tests", False)) opts.Add(BoolVariable("tests", "Build the unit tests", False))
opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster rebuilds", False)) opts.Add(BoolVariable("fast_unsafe", "Enable unsafe options for faster incremental builds", False))
opts.Add(BoolVariable("ninja", "Use the ninja backend for faster rebuilds", False)) opts.Add(BoolVariable("ninja", "Use the ninja backend for faster rebuilds", False))
opts.Add(BoolVariable("ninja_auto_run", "Run ninja automatically after generating the ninja file", True)) opts.Add(BoolVariable("ninja_auto_run", "Run ninja automatically after generating the ninja file", True))
opts.Add("ninja_file", "Path to the generated ninja file", "build.ninja") opts.Add("ninja_file", "Path to the generated ninja file", "build.ninja")
@ -239,6 +239,7 @@ opts.Add(BoolVariable("disable_physics_3d", "Disable 3D physics nodes and server
opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False)) opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False))
opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False)) opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False))
opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False)) opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False))
opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides and related CLI arguments", False))
opts.Add("build_profile", "Path to a file containing a feature build profile", "") opts.Add("build_profile", "Path to a file containing a feature build profile", "")
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "") opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True)) opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
@ -264,6 +265,14 @@ opts.Add(
True, True,
) )
) )
opts.Add(
EnumVariable(
"library_type",
"Build library type",
"executable",
("executable", "static_library", "shared_library"),
)
)
# Thirdparty libraries # Thirdparty libraries
opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True)) opts.Add(BoolVariable("builtin_brotli", "Use the built-in Brotli library", True))
@ -469,16 +478,6 @@ for tool in custom_tools:
# Add default include paths. # Add default include paths.
env.Prepend(CPPPATH=["#"]) env.Prepend(CPPPATH=["#"])
# Allow marking includes as external/system to avoid raising warnings.
env["_CCCOMCOM"] += " $_CPPEXTINCFLAGS"
env["CPPEXTPATH"] = []
if env.scons_version < (4, 2):
env["_CPPEXTINCFLAGS"] = "${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}"
else:
env["_CPPEXTINCFLAGS"] = (
"${_concat(EXTINCPREFIX, CPPEXTPATH, EXTINCSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}"
)
# configure ENV for platform # configure ENV for platform
env.platform_exporters = platform_exporters env.platform_exporters = platform_exporters
env.platform_apis = platform_apis env.platform_apis = platform_apis
@ -530,10 +529,10 @@ env.Decider("MD5-timestamp")
# SCons speed optimization controlled by the `fast_unsafe` option, which provide # SCons speed optimization controlled by the `fast_unsafe` option, which provide
# more than 10 s speed up for incremental rebuilds. # more than 10 s speed up for incremental rebuilds.
# Unsafe as they reduce the certainty of rebuilding all changed files, so it's # Unsafe as they reduce the certainty of rebuilding all changed files.
# enabled by default for `debug` builds, and can be overridden from command line. # If you use it and run into corrupted incremental builds, try to turn it off.
# Ref: https://github.com/SCons/scons/wiki/GoFastButton # Ref: https://github.com/SCons/scons/wiki/GoFastButton
if methods.get_cmdline_bool("fast_unsafe", env.dev_build): if env["fast_unsafe"]:
env.SetOption("implicit_cache", 1) env.SetOption("implicit_cache", 1)
env.SetOption("max_drift", 60) env.SetOption("max_drift", 60)
@ -556,6 +555,13 @@ if not env["deprecated"]:
if env["precision"] == "double": if env["precision"] == "double":
env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"]) env.Append(CPPDEFINES=["REAL_T_IS_DOUBLE"])
# Library Support
if env["library_type"] != "executable":
if "library" not in env.get("supported", []):
print_error(f"Library builds unsupported for {env['platform']}")
Exit(255)
env.Append(CPPDEFINES=["LIBGODOT_ENABLED"])
# Default num_jobs to local cpu count if not user specified. # Default num_jobs to local cpu count if not user specified.
# SCons has a peculiarity where user-specified options won't be overridden # SCons has a peculiarity where user-specified options won't be overridden
# by SetOption, so we can rely on this to know if we should use our default. # by SetOption, so we can rely on this to know if we should use our default.
@ -634,6 +640,7 @@ if env["strict_checks"]:
# Run SCU file generation script if in a SCU build. # Run SCU file generation script if in a SCU build.
if env["scu_build"]: if env["scu_build"]:
env.Append(CPPDEFINES=["SCU_BUILD_ENABLED"])
max_includes_per_scu = 8 max_includes_per_scu = 8
if env.dev_build: if env.dev_build:
max_includes_per_scu = 1024 max_includes_per_scu = 1024
@ -965,19 +972,6 @@ else: # GCC, Clang
if env["werror"]: if env["werror"]:
env.AppendUnique(CCFLAGS=["-Werror"]) env.AppendUnique(CCFLAGS=["-Werror"])
# Configure external includes.
if env.msvc:
if not methods.using_clang(env):
if cc_version_major < 16 or (cc_version_major == 16 and cc_version_minor < 10):
env.AppendUnique(CCFLAGS=["/experimental:external"])
env.AppendUnique(CCFLAGS=["/external:anglebrackets"])
env.AppendUnique(CCFLAGS=["/external:W0"])
env["EXTINCPREFIX"] = "/external:I"
env["EXTINCSUFFIX"] = ""
else:
env["EXTINCPREFIX"] = "-isystem "
env["EXTINCSUFFIX"] = ""
if hasattr(detect, "get_program_suffix"): if hasattr(detect, "get_program_suffix"):
suffix = "." + detect.get_program_suffix() suffix = "." + detect.get_program_suffix()
else: else:
@ -1042,6 +1036,9 @@ if env["minizip"]:
if env["brotli"]: if env["brotli"]:
env.Append(CPPDEFINES=["BROTLI_ENABLED"]) env.Append(CPPDEFINES=["BROTLI_ENABLED"])
if not env["disable_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_ENABLED"])
if not env["verbose"]: if not env["verbose"]:
methods.no_verbose(env) methods.no_verbose(env)

View file

@ -51,8 +51,8 @@ if env["brotli"] and env["builtin_brotli"]:
] ]
thirdparty_brotli_sources = [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources] thirdparty_brotli_sources = [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
env_thirdparty.Prepend(CPPEXTPATH=[thirdparty_brotli_dir + "include"]) env_thirdparty.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
env.Prepend(CPPEXTPATH=[thirdparty_brotli_dir + "include"]) env.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
if env.get("use_ubsan") or env.get("use_asan") or env.get("use_tsan") or env.get("use_lsan") or env.get("use_msan"): if env.get("use_ubsan") or env.get("use_asan") or env.get("use_tsan") or env.get("use_lsan") or env.get("use_msan"):
env_thirdparty.Append(CPPDEFINES=["BROTLI_BUILD_PORTABLE"]) env_thirdparty.Append(CPPDEFINES=["BROTLI_BUILD_PORTABLE"])
@ -69,8 +69,8 @@ if env["builtin_clipper2"]:
] ]
thirdparty_clipper_sources = [thirdparty_clipper_dir + file for file in thirdparty_clipper_sources] thirdparty_clipper_sources = [thirdparty_clipper_dir + file for file in thirdparty_clipper_sources]
env_thirdparty.Prepend(CPPEXTPATH=[thirdparty_clipper_dir + "include"]) env_thirdparty.Prepend(CPPPATH=[thirdparty_clipper_dir + "include"])
env.Prepend(CPPEXTPATH=[thirdparty_clipper_dir + "include"]) env.Prepend(CPPPATH=[thirdparty_clipper_dir + "include"])
env_thirdparty.Append(CPPDEFINES=["CLIPPER2_ENABLED"]) env_thirdparty.Append(CPPDEFINES=["CLIPPER2_ENABLED"])
env.Append(CPPDEFINES=["CLIPPER2_ENABLED"]) env.Append(CPPDEFINES=["CLIPPER2_ENABLED"])
@ -94,9 +94,9 @@ if env["builtin_zlib"]:
] ]
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources] thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
env_thirdparty.Prepend(CPPEXTPATH=[thirdparty_zlib_dir]) env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
# Needs to be available in main env too # Needs to be available in main env too
env.Prepend(CPPEXTPATH=[thirdparty_zlib_dir]) env.Prepend(CPPPATH=[thirdparty_zlib_dir])
if env.dev_build: if env.dev_build:
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"]) env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
# Affects headers so it should also be defined for Godot code # Affects headers so it should also be defined for Godot code
@ -151,9 +151,9 @@ if env["builtin_zstd"]:
thirdparty_zstd_sources.append("decompress/huf_decompress_amd64.S") thirdparty_zstd_sources.append("decompress/huf_decompress_amd64.S")
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources] thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]
env_thirdparty.Prepend(CPPEXTPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"]) env_thirdparty.Prepend(CPPPATH=[thirdparty_zstd_dir, thirdparty_zstd_dir + "common"])
env_thirdparty.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"]) env_thirdparty.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])
env.Prepend(CPPEXTPATH=thirdparty_zstd_dir) env.Prepend(CPPPATH=thirdparty_zstd_dir)
# Also needed in main env includes will trigger warnings # Also needed in main env includes will trigger warnings
env.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"]) env.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])

View file

@ -38,24 +38,40 @@
#include "core/version.h" #include "core/version.h"
#include "servers/rendering/rendering_device.h" #include "servers/rendering/rendering_device.h"
void Engine::_update_time_scale() {
_time_scale = _user_time_scale * _game_time_scale;
user_ips = MAX(1, ips * _user_time_scale);
max_user_physics_steps_per_frame = MAX(max_physics_steps_per_frame, max_physics_steps_per_frame * _user_time_scale);
}
void Engine::set_physics_ticks_per_second(int p_ips) { void Engine::set_physics_ticks_per_second(int p_ips) {
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0."); ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
ips = p_ips; ips = p_ips;
_update_time_scale();
} }
int Engine::get_physics_ticks_per_second() const { int Engine::get_physics_ticks_per_second() const {
return ips; return ips;
} }
int Engine::get_user_physics_ticks_per_second() const {
return user_ips;
}
void Engine::set_max_physics_steps_per_frame(int p_max_physics_steps) { void Engine::set_max_physics_steps_per_frame(int p_max_physics_steps) {
ERR_FAIL_COND_MSG(p_max_physics_steps <= 0, "Maximum number of physics steps per frame must be greater than 0."); ERR_FAIL_COND_MSG(p_max_physics_steps <= 0, "Maximum number of physics steps per frame must be greater than 0.");
max_physics_steps_per_frame = p_max_physics_steps; max_physics_steps_per_frame = p_max_physics_steps;
_update_time_scale();
} }
int Engine::get_max_physics_steps_per_frame() const { int Engine::get_max_physics_steps_per_frame() const {
return max_physics_steps_per_frame; return max_physics_steps_per_frame;
} }
int Engine::get_user_max_physics_steps_per_frame() const {
return max_user_physics_steps_per_frame;
}
void Engine::set_physics_jitter_fix(double p_threshold) { void Engine::set_physics_jitter_fix(double p_threshold) {
if (p_threshold < 0) { if (p_threshold < 0) {
p_threshold = 0; p_threshold = 0;
@ -112,11 +128,21 @@ uint32_t Engine::get_frame_delay() const {
} }
void Engine::set_time_scale(double p_scale) { void Engine::set_time_scale(double p_scale) {
_time_scale = p_scale; _game_time_scale = p_scale;
_update_time_scale();
} }
double Engine::get_time_scale() const { double Engine::get_time_scale() const {
return freeze_time_scale ? 0 : _time_scale; return freeze_time_scale ? 0.0 : _game_time_scale;
}
void Engine::set_user_time_scale(double p_scale) {
_user_time_scale = p_scale;
_update_time_scale();
}
double Engine::get_effective_time_scale() const {
return freeze_time_scale ? 0.0 : _time_scale;
} }
double Engine::get_unfrozen_time_scale() const { double Engine::get_unfrozen_time_scale() const {

View file

@ -30,10 +30,13 @@
#pragma once #pragma once
#include "core/os/main_loop.h" #include "core/string/string_name.h"
#include "core/string/ustring.h" #include "core/templates/hash_map.h"
#include "core/templates/list.h" #include "core/templates/list.h"
class Object;
class Dictionary;
template <typename T> template <typename T>
class TypedArray; class TypedArray;
@ -59,13 +62,17 @@ private:
double _process_step = 0; double _process_step = 0;
int ips = 60; int ips = 60;
int user_ips = 60;
double physics_jitter_fix = 0.5; double physics_jitter_fix = 0.5;
double _fps = 1; double _fps = 1;
int _max_fps = 0; int _max_fps = 0;
int _audio_output_latency = 0; int _audio_output_latency = 0;
double _time_scale = 1.0; double _time_scale = 1.0;
double _game_time_scale = 1.0;
double _user_time_scale = 1.0;
uint64_t _physics_frames = 0; uint64_t _physics_frames = 0;
int max_physics_steps_per_frame = 8; int max_physics_steps_per_frame = 8;
int max_user_physics_steps_per_frame = 8;
double _physics_interpolation_fraction = 0.0f; double _physics_interpolation_fraction = 0.0f;
bool abort_on_gpu_errors = false; bool abort_on_gpu_errors = false;
bool use_validation_layers = false; bool use_validation_layers = false;
@ -101,14 +108,19 @@ private:
bool freeze_time_scale = false; bool freeze_time_scale = false;
protected:
void _update_time_scale();
public: public:
static Engine *get_singleton(); static Engine *get_singleton();
virtual void set_physics_ticks_per_second(int p_ips); virtual void set_physics_ticks_per_second(int p_ips);
virtual int get_physics_ticks_per_second() const; virtual int get_physics_ticks_per_second() const;
virtual int get_user_physics_ticks_per_second() const;
virtual void set_max_physics_steps_per_frame(int p_max_physics_steps); virtual void set_max_physics_steps_per_frame(int p_max_physics_steps);
virtual int get_max_physics_steps_per_frame() const; virtual int get_max_physics_steps_per_frame() const;
virtual int get_user_max_physics_steps_per_frame() const;
void set_physics_jitter_fix(double p_threshold); void set_physics_jitter_fix(double p_threshold);
double get_physics_jitter_fix() const; double get_physics_jitter_fix() const;
@ -132,6 +144,8 @@ public:
void set_time_scale(double p_scale); void set_time_scale(double p_scale);
double get_time_scale() const; double get_time_scale() const;
void set_user_time_scale(double p_scale);
double get_effective_time_scale() const;
double get_unfrozen_time_scale() const; double get_unfrozen_time_scale() const;
void set_print_to_stdout(bool p_enabled); void set_print_to_stdout(bool p_enabled);

View file

@ -83,6 +83,11 @@ const PackedStringArray ProjectSettings::get_required_features() {
// Returns the features supported by this build of Godot. Includes all required features. // Returns the features supported by this build of Godot. Includes all required features.
const PackedStringArray ProjectSettings::_get_supported_features() { const PackedStringArray ProjectSettings::_get_supported_features() {
PackedStringArray features = get_required_features(); PackedStringArray features = get_required_features();
#ifdef LIBGODOT_ENABLED
features.append("LibGodot");
#endif
#ifdef MODULE_MONO_ENABLED #ifdef MODULE_MONO_ENABLED
features.append("C#"); features.append("C#");
#endif #endif
@ -280,7 +285,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
if (p_value.get_type() == Variant::NIL) { if (p_value.get_type() == Variant::NIL) {
props.erase(p_name); props.erase(p_name);
if (p_name.operator String().begins_with("autoload/")) { if (p_name.operator String().begins_with("autoload/")) {
String node_name = p_name.operator String().split("/")[1]; String node_name = p_name.operator String().get_slicec('/', 1);
if (autoloads.has(node_name)) { if (autoloads.has(node_name)) {
remove_autoload(node_name); remove_autoload(node_name);
} }
@ -326,7 +331,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
props[p_name] = VariantContainer(p_value, last_order++); props[p_name] = VariantContainer(p_value, last_order++);
} }
if (p_name.operator String().begins_with("autoload/")) { if (p_name.operator String().begins_with("autoload/")) {
String node_name = p_name.operator String().split("/")[1]; String node_name = p_name.operator String().get_slicec('/', 1);
AutoloadInfo autoload; AutoloadInfo autoload;
autoload.name = node_name; autoload.name = node_name;
String path = p_value; String path = p_value;
@ -643,11 +648,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, vformat("Cannot open resource pack '%s'.", p_main_pack)); ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, vformat("Cannot open resource pack '%s'.", p_main_pack));
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary"); Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
// Load override from location of the main pack // Load override from location of the main pack
// Optional, we don't mind if it fails // Optional, we don't mind if it fails
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg")); _load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
} }
}
#endif // OVERRIDE_ENABLED
return err; return err;
} }
@ -693,12 +703,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
// If we opened our package, try and load our project. // If we opened our package, try and load our project.
if (found) { if (found) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary"); Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
// Load overrides from the PCK and the executable location. // Load overrides from the PCK and the executable location.
// Optional, we don't mind if either fails. // Optional, we don't mind if either fails.
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text("res://override.cfg"); _load_settings_text("res://override.cfg");
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg")); _load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
} }
}
#endif // OVERRIDE_ENABLED
return err; return err;
} }
} }
@ -713,10 +728,15 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
if (!OS::get_singleton()->get_resource_dir().is_empty()) { if (!OS::get_singleton()->get_resource_dir().is_empty()) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary"); Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails. // Optional, we don't mind if it fails.
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text("res://override.cfg"); _load_settings_text("res://override.cfg");
} }
}
#endif // OVERRIDE_ENABLED
return err; return err;
} }
@ -736,11 +756,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
err = _load_settings_text_or_binary(resource_path.path_join("project.godot"), resource_path.path_join("project.binary")); err = _load_settings_text_or_binary(resource_path.path_join("project.godot"), resource_path.path_join("project.binary"));
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails. // Optional, we don't mind if it fails.
#ifdef OVERRIDE_ENABLED
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(resource_path.path_join("override.cfg")); _load_settings_text(resource_path.path_join("override.cfg"));
}
#endif // OVERRIDE_ENABLED
return err; return err;
} }
} }
#endif #endif // MACOS_ENABLED
// Nothing was found, try to find a project file in provided path (`p_path`) // Nothing was found, try to find a project file in provided path (`p_path`)
// or, if requested (`p_upwards`) in parent directories. // or, if requested (`p_upwards`) in parent directories.
@ -760,7 +785,12 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary")); err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary"));
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
// Optional, we don't mind if it fails. // Optional, we don't mind if it fails.
#ifdef OVERRIDE_ENABLED
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
_load_settings_text(current_dir.path_join("override.cfg")); _load_settings_text(current_dir.path_join("override.cfg"));
}
#endif // OVERRIDE_ENABLED
found = true; found = true;
break; break;
} }
@ -1569,6 +1599,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("application/config/use_custom_user_dir", false); GLOBAL_DEF("application/config/use_custom_user_dir", false);
GLOBAL_DEF("application/config/custom_user_dir_name", ""); GLOBAL_DEF("application/config/custom_user_dir_name", "");
GLOBAL_DEF("application/config/project_settings_override", ""); GLOBAL_DEF("application/config/project_settings_override", "");
GLOBAL_DEF("application/config/disable_project_settings_override", false);
GLOBAL_DEF("application/run/main_loop_type", "SceneTree"); GLOBAL_DEF("application/run/main_loop_type", "SceneTree");
GLOBAL_DEF("application/config/auto_accept_quit", true); GLOBAL_DEF("application/config/auto_accept_quit", true);
@ -1675,6 +1706,7 @@ ProjectSettings::ProjectSettings() {
#endif #endif
GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true); GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
GLOBAL_DEF("gui/common/always_show_focus_state", false);
GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true); GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2); GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/vsync/frame_queue_size", PROPERTY_HINT_RANGE, "2,3,1"), 2);
@ -1698,7 +1730,7 @@ ProjectSettings::ProjectSettings() {
// installed by the scripts provided in the repository // installed by the scripts provided in the repository
// (check `misc/scripts/install_d3d12_sdk_windows.py`). // (check `misc/scripts/install_d3d12_sdk_windows.py`).
// For example, if the script installs 1.613.3, the default value must be 613. // For example, if the script installs 1.613.3, the default value must be 613.
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/agility_sdk_version", PROPERTY_HINT_RANGE, "0,10000,1,or_greater,hide_slider"), 613); GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/agility_sdk_version", PROPERTY_HINT_RANGE, "0,10000,1,or_greater,hide_control"), 613);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
@ -1732,6 +1764,14 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("navigation/baking/thread_model/baking_use_multiple_threads", true); GLOBAL_DEF("navigation/baking/thread_model/baking_use_multiple_threads", true);
GLOBAL_DEF("navigation/baking/thread_model/baking_use_high_priority_threads", true); GLOBAL_DEF("navigation/baking/thread_model/baking_use_high_priority_threads", true);
#endif // !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED) #endif // !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED)
#ifndef NAVIGATION_2D_DISABLED
GLOBAL_DEF("navigation/2d/warnings/navmesh_edge_merge_errors", true);
GLOBAL_DEF("navigation/2d/warnings/navmesh_cell_size_mismatch", true);
#endif // NAVIGATION_2D_DISABLED
#ifndef NAVIGATION_3D_DISABLED
GLOBAL_DEF("navigation/3d/warnings/navmesh_edge_merge_errors", true);
GLOBAL_DEF("navigation/3d/warnings/navmesh_cell_size_mismatch", true);
#endif // NAVIGATION_3D_DISABLED
ProjectSettings::get_singleton()->add_hidden_prefix("input/"); ProjectSettings::get_singleton()->add_hidden_prefix("input/");
} }

View file

@ -30,7 +30,8 @@
#pragma once #pragma once
#include "core/object/class_db.h" #include "core/object/object.h"
#include "core/templates/rb_map.h"
template <typename T> template <typename T>
class TypedArray; class TypedArray;
@ -49,7 +50,7 @@ class ProjectSettings : public Object {
public: public:
typedef HashMap<String, Variant> CustomMap; typedef HashMap<String, Variant> CustomMap;
static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot"; static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = "editor_overrides/"; static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = PNAME("editor_overrides") + String("/");
// Properties that are not for built in values begin from this value, so builtin ones are displayed first. // Properties that are not for built in values begin from this value, so builtin ones are displayed first.
constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16; constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16;

View file

@ -35,10 +35,12 @@
#include "core/crypto/crypto_core.h" #include "core/crypto/crypto_core.h"
#include "core/debugger/engine_debugger.h" #include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h" #include "core/debugger/script_debugger.h"
#include "core/io/file_access.h"
#include "core/io/marshalls.h" #include "core/io/marshalls.h"
#include "core/math/geometry_2d.h" #include "core/math/geometry_2d.h"
#include "core/math/geometry_3d.h" #include "core/math/geometry_3d.h"
#include "core/os/keyboard.h" #include "core/os/keyboard.h"
#include "core/os/main_loop.h"
#include "core/os/thread_safe.h" #include "core/os/thread_safe.h"
#include "core/variant/typed_array.h" #include "core/variant/typed_array.h"
@ -1526,6 +1528,10 @@ void Thread::set_thread_safety_checks_enabled(bool p_enabled) {
set_current_thread_safe_for_nodes(!p_enabled); set_current_thread_safe_for_nodes(!p_enabled);
} }
bool Thread::is_main_thread() {
return ::Thread::is_main_thread();
}
void Thread::_bind_methods() { void Thread::_bind_methods() {
ClassDB::bind_method(D_METHOD("start", "callable", "priority"), &Thread::start, DEFVAL(PRIORITY_NORMAL)); ClassDB::bind_method(D_METHOD("start", "callable", "priority"), &Thread::start, DEFVAL(PRIORITY_NORMAL));
ClassDB::bind_method(D_METHOD("get_id"), &Thread::get_id); ClassDB::bind_method(D_METHOD("get_id"), &Thread::get_id);
@ -1534,6 +1540,7 @@ void Thread::_bind_methods() {
ClassDB::bind_method(D_METHOD("wait_to_finish"), &Thread::wait_to_finish); ClassDB::bind_method(D_METHOD("wait_to_finish"), &Thread::wait_to_finish);
ClassDB::bind_static_method("Thread", D_METHOD("set_thread_safety_checks_enabled", "enabled"), &Thread::set_thread_safety_checks_enabled); ClassDB::bind_static_method("Thread", D_METHOD("set_thread_safety_checks_enabled", "enabled"), &Thread::set_thread_safety_checks_enabled);
ClassDB::bind_static_method("Thread", D_METHOD("is_main_thread"), &Thread::is_main_thread);
BIND_ENUM_CONSTANT(PRIORITY_LOW); BIND_ENUM_CONSTANT(PRIORITY_LOW);
BIND_ENUM_CONSTANT(PRIORITY_NORMAL); BIND_ENUM_CONSTANT(PRIORITY_NORMAL);
@ -1545,14 +1552,16 @@ namespace Special {
////// ClassDB ////// ////// ClassDB //////
PackedStringArray ClassDB::get_class_list() const { PackedStringArray ClassDB::get_class_list() const {
List<StringName> classes; LocalVector<StringName> classes;
::ClassDB::get_class_list(&classes); ::ClassDB::get_class_list(classes);
PackedStringArray ret; PackedStringArray ret;
ret.resize(classes.size()); ret.resize(classes.size());
String *ptrw = ret.ptrw();
int idx = 0; int idx = 0;
for (const StringName &E : classes) { for (const StringName &cls : classes) {
ret.set(idx++, E); ptrw[idx] = cls;
idx++;
} }
return ret; return ret;
@ -1806,8 +1815,12 @@ void ClassDB::get_argument_options(const StringName &p_function, int p_idx, List
pf == "is_class_enabled" || pf == "is_class_enum_bitfield" || pf == "class_get_api_type"); pf == "is_class_enabled" || pf == "is_class_enum_bitfield" || pf == "class_get_api_type");
} }
if (first_argument_is_class || pf == "is_parent_class") { if (first_argument_is_class || pf == "is_parent_class") {
for (const String &E : get_class_list()) { LocalVector<StringName> classes;
r_options->push_back(E.quote()); ::ClassDB::get_class_list(classes);
for (const StringName &E : classes) {
if (::ClassDB::is_class_exposed(E)) {
r_options->push_back(E.operator String().quote());
}
} }
} }

View file

@ -495,6 +495,7 @@ public:
Variant wait_to_finish(); Variant wait_to_finish();
static void set_thread_safety_checks_enabled(bool p_enabled); static void set_thread_safety_checks_enabled(bool p_enabled);
static bool is_main_thread();
}; };
namespace Special { namespace Special {

View file

@ -11,7 +11,7 @@ def disabled_class_builder(target, source, env):
with methods.generated_wrapper(str(target[0])) as file: with methods.generated_wrapper(str(target[0])) as file:
for c in source[0].read(): for c in source[0].read():
if cs := c.strip(): if cs := c.strip():
file.write(f"#define ClassDB_Disable_{cs} 1\n") file.write(f"class {cs}; template <> struct is_class_enabled<{cs}> : std::false_type {{}};\n")
# Generate version info # Generate version info

View file

@ -75,7 +75,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT(m_constant) \ #define BIND_CORE_ENUM_CONSTANT(m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -83,7 +83,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_FLAG(m_constant) \ #define BIND_CORE_BITFIELD_FLAG(m_constant) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_bitfield_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, false, true)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, false, true)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -92,7 +92,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
// This just binds enum classes as if they were regular enum constants. // This just binds enum classes as if they were regular enum constants.
#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -100,7 +100,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ #define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, false, true)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, false, true)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -108,7 +108,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_constants_map[#m_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -116,7 +116,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ #define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \ StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member, false, true)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member, false, true)); \
_global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_constants_map[#m_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -124,7 +124,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, true)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, true)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -132,7 +132,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ #define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -144,7 +144,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ #define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -152,7 +152,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ #define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \ _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -166,7 +166,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT(m_constant) \ #define BIND_CORE_ENUM_CONSTANT(m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -174,7 +174,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_FLAG(m_constant) \ #define BIND_CORE_BITFIELD_FLAG(m_constant) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_bitfield_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -183,7 +183,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
// This just binds enum classes as if they were regular enum constants. // This just binds enum classes as if they were regular enum constants.
#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -191,7 +191,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \ #define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -199,7 +199,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_constants_map[#m_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -207,7 +207,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \ #define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
{ \ { \
StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \ StringName enum_name = __constant_get_bitfield_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_name] = _global_constants.size() - 1; \ _global_constants_map[#m_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -215,7 +215,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \ #define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \ StringName enum_name = __constant_get_enum_name(m_enum::m_member); \
_global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
_global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \ _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -223,7 +223,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \ #define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -235,7 +235,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \ #define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
_global_constants_map[#m_constant] = _global_constants.size() - 1; \ _global_constants_map[#m_constant] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
@ -243,7 +243,7 @@ static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \ #define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
{ \ { \
StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \ StringName enum_name = __constant_get_enum_name(m_constant); \
_global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \ _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
_global_constants_map[m_custom_name] = _global_constants.size() - 1; \ _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
_global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \ _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \

View file

@ -13,7 +13,7 @@ if is_builtin or not has_module:
# Use our headers for builtin or if the module is not going to be compiled. # Use our headers for builtin or if the module is not going to be compiled.
# We decided not to depend on system mbedtls just for these few files that can # We decided not to depend on system mbedtls just for these few files that can
# be easily extracted. # be easily extracted.
env_crypto.Prepend(CPPEXTPATH=["#thirdparty/mbedtls/include"]) env_crypto.Prepend(CPPPATH=["#thirdparty/mbedtls/include"])
# MbedTLS core functions (for CryptoCore). # MbedTLS core functions (for CryptoCore).
# If the mbedtls module is compiled we don't need to add the .c files with our # If the mbedtls module is compiled we don't need to add the .c files with our

View file

@ -149,6 +149,8 @@ public:
}; };
class ResourceFormatLoaderCrypto : public ResourceFormatLoader { class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
GDSOFTCLASS(ResourceFormatLoaderCrypto, ResourceFormatLoader);
public: public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override; virtual void get_recognized_extensions(List<String> *p_extensions) const override;
@ -161,6 +163,8 @@ public:
}; };
class ResourceFormatSaverCrypto : public ResourceFormatSaver { class ResourceFormatSaverCrypto : public ResourceFormatSaver {
GDSOFTCLASS(ResourceFormatSaverCrypto, ResourceFormatSaver);
public: public:
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override; virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;

View file

@ -121,7 +121,10 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_process_ticks,
} }
void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bool p_ignore_error_breaks, const Vector<String> &p_breakpoints, void (*p_allow_focus_steal_fn)()) { void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bool p_ignore_error_breaks, const Vector<String> &p_breakpoints, void (*p_allow_focus_steal_fn)()) {
register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create); // TCP is the default protocol. Platforms/modules can add more. register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create_tcp); // TCP is the default protocol. Platforms/modules can add more.
#ifdef UNIX_ENABLED
register_uri_handler("unix://", RemoteDebuggerPeerTCP::create_unix);
#endif
if (p_uri.is_empty()) { if (p_uri.is_empty()) {
return; return;
} }
@ -132,10 +135,10 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, bo
OS::get_singleton()->initialize_debugging(); OS::get_singleton()->initialize_debugging();
} else if (p_uri.contains("://")) { } else if (p_uri.contains("://")) {
const String proto = p_uri.substr(0, p_uri.find("://") + 3); const String proto = p_uri.substr(0, p_uri.find("://") + 3);
if (!protocols.has(proto)) { CreatePeerFunc *create_fn = protocols.getptr(proto);
return; ERR_FAIL_NULL_MSG(create_fn, vformat("Invalid protocol: %s.", proto));
}
RemoteDebuggerPeer *peer = protocols[proto](p_uri); RemoteDebuggerPeer *peer = (*create_fn)(p_uri);
if (!peer) { if (!peer) {
return; return;
} }

View file

@ -31,6 +31,7 @@
#include "local_debugger.h" #include "local_debugger.h"
#include "core/debugger/script_debugger.h" #include "core/debugger/script_debugger.h"
#include "core/os/main_loop.h"
#include "core/os/os.h" #include "core/os/os.h"
struct LocalDebugger::ScriptsProfiler { struct LocalDebugger::ScriptsProfiler {

View file

@ -40,7 +40,7 @@
#include "core/math/expression.h" #include "core/math/expression.h"
#include "core/object/script_language.h" #include "core/object/script_language.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "servers/display_server.h" #include "servers/display/display_server.h"
class RemoteDebugger::PerformanceProfiler : public EngineProfiler { class RemoteDebugger::PerformanceProfiler : public EngineProfiler {
Object *performance = nullptr; Object *performance = nullptr;
@ -48,9 +48,9 @@ class RemoteDebugger::PerformanceProfiler : public EngineProfiler {
uint64_t last_monitor_modification_time = 0; uint64_t last_monitor_modification_time = 0;
public: public:
void toggle(bool p_enable, const Array &p_opts) {} void toggle(bool p_enable, const Array &p_opts) override {}
void add(const Array &p_data) {} void add(const Array &p_data) override {}
void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) { void tick(double p_frame_time, double p_process_time, double p_physics_time, double p_physics_frame_time) override {
if (!performance) { if (!performance) {
return; return;
} }
@ -566,25 +566,25 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
input_vals.append(V); input_vals.append(V);
} }
List<StringName> native_types; LocalVector<StringName> native_types;
ClassDB::get_class_list(&native_types); ClassDB::get_class_list(native_types);
for (const StringName &E : native_types) { for (const StringName &class_name : native_types) {
if (!ClassDB::is_class_exposed(E) || !Engine::get_singleton()->has_singleton(E) || Engine::get_singleton()->is_singleton_editor_only(E)) { if (!ClassDB::is_class_exposed(class_name) || !Engine::get_singleton()->has_singleton(class_name) || Engine::get_singleton()->is_singleton_editor_only(class_name)) {
continue; continue;
} }
input_names.append(E); input_names.append(class_name);
input_vals.append(Engine::get_singleton()->get_singleton_object(E)); input_vals.append(Engine::get_singleton()->get_singleton_object(class_name));
} }
List<StringName> user_types; LocalVector<StringName> user_types;
ScriptServer::get_global_class_list(&user_types); ScriptServer::get_global_class_list(user_types);
for (const StringName &S : user_types) { for (const StringName &class_name : user_types) {
String scr_path = ScriptServer::get_global_class_path(S); String scr_path = ScriptServer::get_global_class_path(class_name);
Ref<Script> scr = ResourceLoader::load(scr_path, "Script"); Ref<Script> scr = ResourceLoader::load(scr_path, "Script");
ERR_CONTINUE_MSG(scr.is_null(), vformat(R"(Could not load the global class %s from resource path: "%s".)", S, scr_path)); ERR_CONTINUE_MSG(scr.is_null(), vformat(R"(Could not load the global class %s from resource path: "%s".)", class_name, scr_path));
input_names.append(S); input_names.append(class_name);
input_vals.append(scr); input_vals.append(scr);
} }

View file

@ -76,18 +76,19 @@ void RemoteDebuggerPeerTCP::close() {
in_buf.clear(); in_buf.clear();
} }
RemoteDebuggerPeerTCP::RemoteDebuggerPeerTCP(Ref<StreamPeerTCP> p_tcp) { RemoteDebuggerPeerTCP::RemoteDebuggerPeerTCP() {
// This means remote debugger takes 16 MiB just because it exists... // This means remote debugger takes 16 MiB just because it exists...
in_buf.resize((8 << 20) + 4); // 8 MiB should be way more than enough (need 4 extra bytes for encoding packet size). in_buf.resize((8 << 20) + 4); // 8 MiB should be way more than enough (need 4 extra bytes for encoding packet size).
out_buf.resize(8 << 20); // 8 MiB should be way more than enough out_buf.resize(8 << 20); // 8 MiB should be way more than enough
tcp_client = p_tcp; }
if (tcp_client.is_valid()) { // Attaching to an already connected stream.
RemoteDebuggerPeerTCP::RemoteDebuggerPeerTCP(Ref<StreamPeerSocket> p_stream) :
RemoteDebuggerPeerTCP() {
DEV_ASSERT(p_stream.is_valid());
tcp_client = p_stream;
connected = true; connected = true;
running = true; running = true;
thread.start(_thread_func, this); thread.start(_thread_func, this);
} else {
tcp_client.instantiate();
}
} }
RemoteDebuggerPeerTCP::~RemoteDebuggerPeerTCP() { RemoteDebuggerPeerTCP::~RemoteDebuggerPeerTCP() {
@ -154,22 +155,10 @@ void RemoteDebuggerPeerTCP::_read_in() {
} }
} }
Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_port) { Error RemoteDebuggerPeerTCP::_try_connect(Ref<StreamPeerSocket> tcp_client) {
IPAddress ip;
if (p_host.is_valid_ip_address()) {
ip = p_host;
} else {
ip = IP::get_singleton()->resolve_hostname(p_host);
}
int port = p_port;
const int tries = 6; const int tries = 6;
const int waits[tries] = { 1, 10, 100, 1000, 1000, 1000 }; const int waits[tries] = { 1, 10, 100, 1000, 1000, 1000 };
Error err = tcp_client->connect_to_host(ip, port);
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Remote Debugger: Unable to connect to host '%s:%d'.", p_host, port));
for (int i = 0; i < tries; i++) { for (int i = 0; i < tries; i++) {
tcp_client->poll(); tcp_client->poll();
if (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) { if (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
@ -186,9 +175,6 @@ Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_po
ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num_int64(tcp_client->get_status()))); ERR_PRINT(vformat("Remote Debugger: Unable to connect. Status: %s.", String::num_int64(tcp_client->get_status())));
return FAILED; return FAILED;
} }
connected = true;
running = true;
thread.start(_thread_func, this);
return OK; return OK;
} }
@ -222,7 +208,7 @@ void RemoteDebuggerPeerTCP::_poll() {
} }
} }
RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) { RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_tcp(const String &p_uri) {
ERR_FAIL_COND_V(!p_uri.begins_with("tcp://"), nullptr); ERR_FAIL_COND_V(!p_uri.begins_with("tcp://"), nullptr);
String debug_host = p_uri.replace("tcp://", ""); String debug_host = p_uri.replace("tcp://", "");
@ -234,13 +220,30 @@ RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create(const String &p_uri) {
debug_host = debug_host.substr(0, sep_pos); debug_host = debug_host.substr(0, sep_pos);
} }
RemoteDebuggerPeerTCP *peer = memnew(RemoteDebuggerPeerTCP); IPAddress ip;
Error err = peer->connect_to_host(debug_host, debug_port); if (debug_host.is_valid_ip_address()) {
if (err != OK) { ip = debug_host;
memdelete(peer); } else {
return nullptr; ip = IP::get_singleton()->resolve_hostname(debug_host);
} }
return peer;
Ref<StreamPeerTCP> stream;
stream.instantiate();
ERR_FAIL_COND_V_MSG(stream->connect_to_host(ip, debug_port) != OK, nullptr, vformat("Remote Debugger: Unable to connect to host '%s:%d'.", debug_host, debug_port));
ERR_FAIL_COND_V(_try_connect(stream), nullptr);
return memnew(RemoteDebuggerPeerTCP(stream));
}
RemoteDebuggerPeer *RemoteDebuggerPeerTCP::create_unix(const String &p_uri) {
ERR_FAIL_COND_V(!p_uri.begins_with("unix://"), nullptr);
String debug_path = p_uri.replace("unix://", "");
Ref<StreamPeerUDS> stream;
stream.instantiate();
Error err = stream->connect_to_host(debug_path);
ERR_FAIL_COND_V_MSG(err != OK && err != ERR_BUSY, nullptr, vformat("Remote Debugger: Unable to connect to socket path '%s'.", debug_path));
ERR_FAIL_COND_V(_try_connect(stream), nullptr);
return memnew(RemoteDebuggerPeerTCP(stream));
} }
RemoteDebuggerPeer::RemoteDebuggerPeer() { RemoteDebuggerPeer::RemoteDebuggerPeer() {

View file

@ -31,12 +31,15 @@
#pragma once #pragma once
#include "core/io/stream_peer_tcp.h" #include "core/io/stream_peer_tcp.h"
#include "core/io/stream_peer_uds.h"
#include "core/object/ref_counted.h" #include "core/object/ref_counted.h"
#include "core/os/mutex.h" #include "core/os/mutex.h"
#include "core/os/thread.h" #include "core/os/thread.h"
#include "core/string/ustring.h" #include "core/string/ustring.h"
class RemoteDebuggerPeer : public RefCounted { class RemoteDebuggerPeer : public RefCounted {
GDSOFTCLASS(RemoteDebuggerPeer, RefCounted);
protected: protected:
int max_queued_messages = 4096; int max_queued_messages = 4096;
@ -54,8 +57,10 @@ public:
}; };
class RemoteDebuggerPeerTCP : public RemoteDebuggerPeer { class RemoteDebuggerPeerTCP : public RemoteDebuggerPeer {
GDSOFTCLASS(RemoteDebuggerPeerTCP, RemoteDebuggerPeer);
private: private:
Ref<StreamPeerTCP> tcp_client; Ref<StreamPeerSocket> tcp_client;
Mutex mutex; Mutex mutex;
Thread thread; Thread thread;
List<Array> in_queue; List<Array> in_queue;
@ -74,11 +79,11 @@ private:
void _poll(); void _poll();
void _write_out(); void _write_out();
void _read_in(); void _read_in();
static Error _try_connect(Ref<StreamPeerSocket> p_stream);
public: public:
static RemoteDebuggerPeer *create(const String &p_uri); static RemoteDebuggerPeer *create_tcp(const String &p_uri);
static RemoteDebuggerPeer *create_unix(const String &p_uri);
Error connect_to_host(const String &p_host, uint16_t p_port);
bool is_peer_connected() override; bool is_peer_connected() override;
int get_max_message_size() const override; int get_max_message_size() const override;
@ -88,6 +93,7 @@ public:
void poll() override; void poll() override;
void close() override; void close() override;
RemoteDebuggerPeerTCP(Ref<StreamPeerTCP> p_stream = Ref<StreamPeerTCP>()); RemoteDebuggerPeerTCP(Ref<StreamPeerSocket> p_stream);
RemoteDebuggerPeerTCP();
~RemoteDebuggerPeerTCP(); ~RemoteDebuggerPeerTCP();
}; };

View file

@ -30,7 +30,7 @@
#include "error_list.h" #include "error_list.h"
#include <iterator> #include "core/typedefs.h"
const char *error_names[] = { const char *error_names[] = {
"OK", // OK "OK", // OK
@ -84,4 +84,4 @@ const char *error_names[] = {
"Printer on fire", // ERR_PRINTER_ON_FIRE "Printer on fire", // ERR_PRINTER_ON_FIRE
}; };
static_assert(std::size(error_names) == ERR_MAX); static_assert(std_size(error_names) == ERR_MAX);

View file

@ -96,7 +96,7 @@ static String fix_doc_description(const String &p_bbcode) {
// Based on what EditorHelp does. // Based on what EditorHelp does.
return p_bbcode.dedent() return p_bbcode.dedent()
.remove_chars("\t\r") .remove_chars("\r")
.strip_edges(); .strip_edges();
} }
@ -900,11 +900,9 @@ Dictionary GDExtensionAPIDump::generate_extension_api(bool p_include_docs) {
// classes // classes
Array classes; Array classes;
List<StringName> class_list; LocalVector<StringName> class_list;
ClassDB::get_class_list(&class_list); ClassDB::get_class_list(class_list);
class_list.sort_custom<StringName::AlphCompare>();
for (const StringName &class_name : class_list) { for (const StringName &class_name : class_list) {
if (!ClassDB::is_class_exposed(class_name)) { if (!ClassDB::is_class_exposed(class_name)) {

View file

@ -267,6 +267,7 @@ void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library
}; };
const ClassCreationDeprecatedInfo legacy = { const ClassCreationDeprecatedInfo legacy = {
false,
p_extension_funcs->notification_func, // GDExtensionClassNotification notification_func; p_extension_funcs->notification_func, // GDExtensionClassNotification notification_func;
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func; p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func; p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func;
@ -281,7 +282,7 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
const GDExtensionClassCreationInfo5 class_info5 = { const GDExtensionClassCreationInfo5 class_info5 = {
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual; p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract; p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
true, // GDExtensionBool is_exposed; p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
false, // GDExtensionBool is_runtime; false, // GDExtensionBool is_runtime;
nullptr, // GDExtensionConstStringPtr icon_path; nullptr, // GDExtensionConstStringPtr icon_path;
p_extension_funcs->set_func, // GDExtensionClassSet set_func; p_extension_funcs->set_func, // GDExtensionClassSet set_func;
@ -305,6 +306,7 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
}; };
const ClassCreationDeprecatedInfo legacy = { const ClassCreationDeprecatedInfo legacy = {
!p_extension_funcs->is_exposed, // bool legacy_unexposed_class;
nullptr, // GDExtensionClassNotification notification_func; nullptr, // GDExtensionClassNotification notification_func;
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func; p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func; p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance create_instance_func;
@ -319,7 +321,7 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
const GDExtensionClassCreationInfo5 class_info5 = { const GDExtensionClassCreationInfo5 class_info5 = {
p_extension_funcs->is_virtual, // GDExtensionBool is_virtual; p_extension_funcs->is_virtual, // GDExtensionBool is_virtual;
p_extension_funcs->is_abstract, // GDExtensionBool is_abstract; p_extension_funcs->is_abstract, // GDExtensionBool is_abstract;
true, // GDExtensionBool is_exposed; p_extension_funcs->is_exposed, // GDExtensionBool is_exposed;
p_extension_funcs->is_runtime, // GDExtensionBool is_runtime; p_extension_funcs->is_runtime, // GDExtensionBool is_runtime;
nullptr, // GDExtensionConstStringPtr icon_path; nullptr, // GDExtensionConstStringPtr icon_path;
p_extension_funcs->set_func, // GDExtensionClassSet set_func; p_extension_funcs->set_func, // GDExtensionClassSet set_func;
@ -343,6 +345,7 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
}; };
const ClassCreationDeprecatedInfo legacy = { const ClassCreationDeprecatedInfo legacy = {
!p_extension_funcs->is_exposed, // bool legacy_unexposed_class;
nullptr, // GDExtensionClassNotification notification_func; nullptr, // GDExtensionClassNotification notification_func;
nullptr, // GDExtensionClassFreePropertyList free_property_list_func; nullptr, // GDExtensionClassFreePropertyList free_property_list_func;
p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance2 create_instance_func; p_extension_funcs->create_instance_func, // GDExtensionClassCreateInstance2 create_instance_func;
@ -355,9 +358,16 @@ void GDExtension::_register_extension_class3(GDExtensionClassLibraryPtr p_librar
void GDExtension::_register_extension_class4(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs) { void GDExtension::_register_extension_class4(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo4 *p_extension_funcs) {
GDExtensionClassCreationInfo5 class_info5 = *p_extension_funcs; GDExtensionClassCreationInfo5 class_info5 = *p_extension_funcs;
// Force classes to be exposed, because the behavior of unexposed classes changed in an incompatible (albeit, minor) way. const ClassCreationDeprecatedInfo legacy = {
class_info5.is_exposed = true; !p_extension_funcs->is_exposed, // bool legacy_unexposed_class;
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5); nullptr, // GDExtensionClassNotification notification_func;
nullptr, // GDExtensionClassFreePropertyList free_property_list_func;
nullptr, // GDExtensionClassCreateInstance2 create_instance_func;
nullptr, // GDExtensionClassGetRID get_rid;
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
nullptr, // GDExtensionClassGetVirtual get_virtual_func;
};
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info5, &legacy);
} }
#endif // DISABLE_DEPRECATED #endif // DISABLE_DEPRECATED
@ -447,6 +457,7 @@ void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr
extension->gdextension.validate_property = p_extension_funcs->validate_property_func; extension->gdextension.validate_property = p_extension_funcs->validate_property_func;
#ifndef DISABLE_DEPRECATED #ifndef DISABLE_DEPRECATED
if (p_deprecated_funcs) { if (p_deprecated_funcs) {
extension->gdextension.legacy_unexposed_class = p_deprecated_funcs->legacy_unexposed_class;
extension->gdextension.notification = p_deprecated_funcs->notification_func; extension->gdextension.notification = p_deprecated_funcs->notification_func;
extension->gdextension.free_property_list = p_deprecated_funcs->free_property_list_func; extension->gdextension.free_property_list = p_deprecated_funcs->free_property_list_func;
extension->gdextension.create_instance = p_deprecated_funcs->create_instance_func; extension->gdextension.create_instance = p_deprecated_funcs->create_instance_func;

View file

@ -67,6 +67,7 @@ class GDExtension : public Resource {
struct ClassCreationDeprecatedInfo { struct ClassCreationDeprecatedInfo {
#ifndef DISABLE_DEPRECATED #ifndef DISABLE_DEPRECATED
bool legacy_unexposed_class = false;
GDExtensionClassNotification notification_func = nullptr; GDExtensionClassNotification notification_func = nullptr;
GDExtensionClassFreePropertyList free_property_list_func = nullptr; GDExtensionClassFreePropertyList free_property_list_func = nullptr;
GDExtensionClassCreateInstance create_instance_func = nullptr; GDExtensionClassCreateInstance create_instance_func = nullptr;
@ -183,6 +184,8 @@ public:
VARIANT_ENUM_CAST(GDExtension::InitializationLevel) VARIANT_ENUM_CAST(GDExtension::InitializationLevel)
class GDExtensionResourceLoader : public ResourceFormatLoader { class GDExtensionResourceLoader : public ResourceFormatLoader {
GDSOFTCLASS(GDExtensionResourceLoader, ResourceFormatLoader);
public: public:
static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension); static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension);

View file

@ -0,0 +1,74 @@
/**************************************************************************/
/* gdextension_function_loader.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "gdextension_function_loader.h"
#include "gdextension.h"
Error GDExtensionFunctionLoader::open_library(const String &p_path) {
ERR_FAIL_COND_V_MSG(!p_path.begins_with("libgodot://"), ERR_FILE_NOT_FOUND, "Function based GDExtensions should have a path starting with libgodot://");
ERR_FAIL_COND_V_MSG(!initialization_function, ERR_DOES_NOT_EXIST, "Initialization function is required for function based GDExtensions.");
library_path = p_path;
return OK;
}
Error GDExtensionFunctionLoader::initialize(GDExtensionInterfaceGetProcAddress p_get_proc_address, const Ref<GDExtension> &p_extension, GDExtensionInitialization *r_initialization) {
ERR_FAIL_COND_V_MSG(!initialization_function, ERR_DOES_NOT_EXIST, "Initialization function is required for function based GDExtensions.");
GDExtensionBool ret = initialization_function(p_get_proc_address, p_extension.ptr(), r_initialization);
if (ret) {
return OK;
} else {
ERR_FAIL_V_MSG(FAILED, "GDExtension initialization function for '" + library_path + "' returned an error.");
}
}
void GDExtensionFunctionLoader::close_library() {
initialization_function = nullptr;
library_path.clear();
}
bool GDExtensionFunctionLoader::is_library_open() const {
return !library_path.is_empty();
}
bool GDExtensionFunctionLoader::has_library_changed() const {
return false;
}
bool GDExtensionFunctionLoader::library_exists() const {
return true;
}
void GDExtensionFunctionLoader::set_initialization_function(GDExtensionInitializationFunction p_initialization_function) {
initialization_function = p_initialization_function;
}

View file

@ -0,0 +1,54 @@
/**************************************************************************/
/* gdextension_function_loader.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/extension/gdextension_loader.h"
#include "core/os/shared_object.h"
class GDExtension;
class GDExtensionFunctionLoader : public GDExtensionLoader {
friend class GDExtensionManager;
friend class GDExtension;
String library_path;
GDExtensionInitializationFunction initialization_function = nullptr;
public:
virtual Error open_library(const String &p_path) override;
virtual Error initialize(GDExtensionInterfaceGetProcAddress p_get_proc_address, const Ref<GDExtension> &p_extension, GDExtensionInitialization *r_initialization) override;
virtual void close_library() override;
virtual bool is_library_open() const override;
virtual bool has_library_changed() const override;
virtual bool library_exists() const override;
void set_initialization_function(GDExtensionInitializationFunction p_initialization_function);
};

View file

@ -261,6 +261,7 @@ static void gdextension_get_godot_version2(GDExtensionGodotVersion2 *r_godot_ver
} }
// Memory Functions // Memory Functions
#ifndef DISABLE_DEPRECATED
static void *gdextension_mem_alloc(size_t p_size) { static void *gdextension_mem_alloc(size_t p_size) {
return memalloc(p_size); return memalloc(p_size);
} }
@ -272,6 +273,19 @@ static void *gdextension_mem_realloc(void *p_mem, size_t p_size) {
static void gdextension_mem_free(void *p_mem) { static void gdextension_mem_free(void *p_mem) {
memfree(p_mem); memfree(p_mem);
} }
#endif
static void *gdextension_mem_alloc2(size_t p_size, GDExtensionBool p_prepad_align) {
return Memory::alloc_static(p_size, p_prepad_align);
}
static void *gdextension_mem_realloc2(void *p_mem, size_t p_size, GDExtensionBool p_prepad_align) {
return Memory::realloc_static(p_mem, p_size, p_prepad_align);
}
static void gdextension_mem_free2(void *p_mem, GDExtensionBool p_prepad_align) {
Memory::free_static(p_mem, p_prepad_align);
}
// Helper print functions. // Helper print functions.
static void gdextension_print_error(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify) { static void gdextension_print_error(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify) {
@ -1687,9 +1701,14 @@ void gdextension_setup_interface() {
REGISTER_INTERFACE_FUNC(get_godot_version); REGISTER_INTERFACE_FUNC(get_godot_version);
#endif // DISABLE_DEPRECATED #endif // DISABLE_DEPRECATED
REGISTER_INTERFACE_FUNC(get_godot_version2); REGISTER_INTERFACE_FUNC(get_godot_version2);
#ifndef DISABLE_DEPRECATED
REGISTER_INTERFACE_FUNC(mem_alloc); REGISTER_INTERFACE_FUNC(mem_alloc);
REGISTER_INTERFACE_FUNC(mem_realloc); REGISTER_INTERFACE_FUNC(mem_realloc);
REGISTER_INTERFACE_FUNC(mem_free); REGISTER_INTERFACE_FUNC(mem_free);
#endif // DISABLE_DEPRECATED
REGISTER_INTERFACE_FUNC(mem_alloc2);
REGISTER_INTERFACE_FUNC(mem_realloc2);
REGISTER_INTERFACE_FUNC(mem_free2);
REGISTER_INTERFACE_FUNC(print_error); REGISTER_INTERFACE_FUNC(print_error);
REGISTER_INTERFACE_FUNC(print_error_with_message); REGISTER_INTERFACE_FUNC(print_error_with_message);
REGISTER_INTERFACE_FUNC(print_warning); REGISTER_INTERFACE_FUNC(print_warning);

View file

@ -858,6 +858,7 @@ typedef void (*GDExtensionInterfaceGetGodotVersion2)(GDExtensionGodotVersion2 *r
/** /**
* @name mem_alloc * @name mem_alloc
* @since 4.1 * @since 4.1
* @deprecated in Godot 4.6. Use `mem_alloc2` instead.
* *
* Allocates memory. * Allocates memory.
* *
@ -870,6 +871,7 @@ typedef void *(*GDExtensionInterfaceMemAlloc)(size_t p_bytes);
/** /**
* @name mem_realloc * @name mem_realloc
* @since 4.1 * @since 4.1
* @deprecated in Godot 4.6. Use `mem_realloc2` instead.
* *
* Reallocates memory. * Reallocates memory.
* *
@ -883,6 +885,7 @@ typedef void *(*GDExtensionInterfaceMemRealloc)(void *p_ptr, size_t p_bytes);
/** /**
* @name mem_free * @name mem_free
* @since 4.1 * @since 4.1
* @deprecated in Godot 4.6. Use `mem_free2` instead.
* *
* Frees memory. * Frees memory.
* *
@ -890,7 +893,45 @@ typedef void *(*GDExtensionInterfaceMemRealloc)(void *p_ptr, size_t p_bytes);
*/ */
typedef void (*GDExtensionInterfaceMemFree)(void *p_ptr); typedef void (*GDExtensionInterfaceMemFree)(void *p_ptr);
/* INTERFACE: Godot Core */ /**
* @name mem_alloc2
* @since 4.6
*
* Allocates memory.
*
* @param p_bytes The amount of memory to allocate in bytes.
* @param p_pad_align If true, the returned memory will have prepadding of at least 8 bytes.
*
* @return A pointer to the allocated memory, or NULL if unsuccessful.
*/
typedef void *(*GDExtensionInterfaceMemAlloc2)(size_t p_bytes, GDExtensionBool p_pad_align);
/**
* @name mem_realloc2
* @since 4.6
*
* Reallocates memory.
*
* @param p_ptr A pointer to the previously allocated memory.
* @param p_bytes The number of bytes to resize the memory block to.
* @param p_pad_align If true, the returned memory will have prepadding of at least 8 bytes.
*
* @return A pointer to the allocated memory, or NULL if unsuccessful.
*/
typedef void *(*GDExtensionInterfaceMemRealloc2)(void *p_ptr, size_t p_bytes, GDExtensionBool p_pad_align);
/**
* @name mem_free2
* @since 4.6
*
* Frees memory.
*
* @param p_ptr A pointer to the previously allocated memory.
* @param p_pad_align If true, the given memory was allocated with prepadding.
*/
typedef void (*GDExtensionInterfaceMemFree2)(void *p_ptr, GDExtensionBool p_pad_align);
//* INTERFACE: Godot Core */
/** /**
* @name print_error * @name print_error

View file

@ -30,6 +30,7 @@
#include "gdextension_manager.h" #include "gdextension_manager.h"
#include "core/extension/gdextension_function_loader.h"
#include "core/extension/gdextension_library_loader.h" #include "core/extension/gdextension_library_loader.h"
#include "core/extension/gdextension_special_compat_hashes.h" #include "core/extension/gdextension_special_compat_hashes.h"
#include "core/io/dir_access.h" #include "core/io/dir_access.h"
@ -114,7 +115,14 @@ GDExtensionManager::LoadStatus GDExtensionManager::load_extension(const String &
Ref<GDExtensionLibraryLoader> loader; Ref<GDExtensionLibraryLoader> loader;
loader.instantiate(); loader.instantiate();
return GDExtensionManager::get_singleton()->load_extension_with_loader(p_path, loader); return load_extension_with_loader(p_path, loader);
}
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_from_function(const String &p_path, GDExtensionConstPtr<const GDExtensionInitializationFunction> p_init_func) {
Ref<GDExtensionFunctionLoader> func_loader;
func_loader.instantiate();
func_loader->set_initialization_function((GDExtensionInitializationFunction)*p_init_func.data);
return load_extension_with_loader(p_path, func_loader);
} }
GDExtensionManager::LoadStatus GDExtensionManager::load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader) { GDExtensionManager::LoadStatus GDExtensionManager::load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader) {
@ -454,6 +462,7 @@ GDExtensionManager *GDExtensionManager::get_singleton() {
void GDExtensionManager::_bind_methods() { void GDExtensionManager::_bind_methods() {
ClassDB::bind_method(D_METHOD("load_extension", "path"), &GDExtensionManager::load_extension); ClassDB::bind_method(D_METHOD("load_extension", "path"), &GDExtensionManager::load_extension);
ClassDB::bind_method(D_METHOD("load_extension_from_function", "path", "init_func"), &GDExtensionManager::load_extension_from_function);
ClassDB::bind_method(D_METHOD("reload_extension", "path"), &GDExtensionManager::reload_extension); ClassDB::bind_method(D_METHOD("reload_extension", "path"), &GDExtensionManager::reload_extension);
ClassDB::bind_method(D_METHOD("unload_extension", "path"), &GDExtensionManager::unload_extension); ClassDB::bind_method(D_METHOD("unload_extension", "path"), &GDExtensionManager::unload_extension);
ClassDB::bind_method(D_METHOD("is_extension_loaded", "path"), &GDExtensionManager::is_extension_loaded); ClassDB::bind_method(D_METHOD("is_extension_loaded", "path"), &GDExtensionManager::is_extension_loaded);

View file

@ -31,6 +31,9 @@
#pragma once #pragma once
#include "core/extension/gdextension.h" #include "core/extension/gdextension.h"
#include "core/variant/native_ptr.h"
GDVIRTUAL_NATIVE_PTR(GDExtensionInitializationFunction)
class GDExtensionManager : public Object { class GDExtensionManager : public Object {
GDCLASS(GDExtensionManager, Object); GDCLASS(GDExtensionManager, Object);
@ -66,6 +69,7 @@ private:
public: public:
LoadStatus load_extension(const String &p_path); LoadStatus load_extension(const String &p_path);
LoadStatus load_extension_from_function(const String &p_path, GDExtensionConstPtr<const GDExtensionInitializationFunction> p_init_func);
LoadStatus load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader); LoadStatus load_extension_with_loader(const String &p_path, const Ref<GDExtensionLoader> &p_loader);
LoadStatus reload_extension(const String &p_path); LoadStatus reload_extension(const String &p_path);
LoadStatus unload_extension(const String &p_path); LoadStatus unload_extension(const String &p_path);

View file

@ -63,7 +63,7 @@ bool GDExtensionSpecialCompatHashes::get_legacy_hashes(const StringName &p_class
if (p_check_valid) { if (p_check_valid) {
MethodBind *mb = ClassDB::get_method_with_compatibility(p_class, p_method, mapping.current_hash); MethodBind *mb = ClassDB::get_method_with_compatibility(p_class, p_method, mapping.current_hash);
if (!mb) { if (!mb) {
WARN_PRINT(vformat("Compatibility hash %d for %s::%s() mapped to non-existent hash %d. Please update gdextension_special_compat_hashes.cpp.", mapping.legacy_hash, p_class, p_method, mapping.current_hash)); WARN_PRINT(vformat("Compatibility hash %d for %s::%s() mapped to non-existent hash %d in gdextension_special_compat_hashes.cpp.", mapping.legacy_hash, p_class, p_method, mapping.current_hash));
continue; continue;
} }
} }

View file

@ -36,6 +36,8 @@
#include "core/templates/hash_map.h" #include "core/templates/hash_map.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"
class Array;
// Note: In most situations, compatibility methods should be registered via ClassDB::bind_compatibility_method(). // Note: In most situations, compatibility methods should be registered via ClassDB::bind_compatibility_method().
// This class is only meant to be used in exceptional circumstances, for example, when Godot's hashing // This class is only meant to be used in exceptional circumstances, for example, when Godot's hashing
// algorithm changes and registering compatibility methods for all affect methods would be onerous. // algorithm changes and registering compatibility methods for all affect methods would be onerous.

View file

@ -0,0 +1,126 @@
/**************************************************************************/
/* godot_instance.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "godot_instance.h"
#include "core/extension/gdextension_manager.h"
#include "core/os/main_loop.h"
#include "main/main.h"
#include "servers/display/display_server.h"
void GodotInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("start"), &GodotInstance::start);
ClassDB::bind_method(D_METHOD("is_started"), &GodotInstance::is_started);
ClassDB::bind_method(D_METHOD("iteration"), &GodotInstance::iteration);
ClassDB::bind_method(D_METHOD("focus_in"), &GodotInstance::focus_in);
ClassDB::bind_method(D_METHOD("focus_out"), &GodotInstance::focus_out);
ClassDB::bind_method(D_METHOD("pause"), &GodotInstance::pause);
ClassDB::bind_method(D_METHOD("resume"), &GodotInstance::resume);
}
GodotInstance::GodotInstance() {
}
GodotInstance::~GodotInstance() {
}
bool GodotInstance::initialize(GDExtensionInitializationFunction p_init_func) {
print_verbose("Godot Instance initialization");
GDExtensionManager *gdextension_manager = GDExtensionManager::get_singleton();
GDExtensionConstPtr<const GDExtensionInitializationFunction> ptr((const GDExtensionInitializationFunction *)&p_init_func);
GDExtensionManager::LoadStatus status = gdextension_manager->load_extension_from_function("libgodot://main", ptr);
return status == GDExtensionManager::LoadStatus::LOAD_STATUS_OK;
}
bool GodotInstance::start() {
print_verbose("GodotInstance::start()");
Error err = Main::setup2();
if (err != OK) {
return false;
}
started = Main::start() == EXIT_SUCCESS;
if (started) {
OS::get_singleton()->get_main_loop()->initialize();
}
return started;
}
bool GodotInstance::is_started() {
return started;
}
bool GodotInstance::iteration() {
DisplayServer::get_singleton()->process_events();
return Main::iteration();
}
void GodotInstance::stop() {
print_verbose("GodotInstance::stop()");
if (started) {
OS::get_singleton()->get_main_loop()->finalize();
}
started = false;
}
void GodotInstance::focus_out() {
print_verbose("GodotInstance::focus_out()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT);
}
}
}
void GodotInstance::focus_in() {
print_verbose("GodotInstance::focus_in()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN);
}
}
}
void GodotInstance::pause() {
print_verbose("GodotInstance::pause()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_PAUSED);
}
}
}
void GodotInstance::resume() {
print_verbose("GodotInstance::resume()");
if (started) {
if (OS::get_singleton()->get_main_loop()) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_RESUMED);
}
}
}

View file

@ -0,0 +1,59 @@
/**************************************************************************/
/* godot_instance.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/extension/gdextension_interface.h"
#include "core/object/class_db.h"
class GodotInstance : public Object {
GDCLASS(GodotInstance, Object);
bool started = false;
protected:
static void _bind_methods();
public:
GodotInstance();
~GodotInstance();
bool initialize(GDExtensionInitializationFunction p_init_func);
bool start();
bool is_started();
bool iteration();
void stop();
void focus_out();
void focus_in();
void pause();
void resume();
};

73
core/extension/libgodot.h Normal file
View file

@ -0,0 +1,73 @@
/**************************************************************************/
/* libgodot.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "gdextension_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
// Export macros for DLL visibility
#if defined(_MSC_VER) || defined(__MINGW32__)
#define LIBGODOT_API __declspec(dllexport)
#elif defined(__GNUC__) || defined(__clang__)
#define LIBGODOT_API __attribute__((visibility("default")))
#endif // if defined(_MSC_VER)
/**
* @name libgodot_create_godot_instance
* @since 4.6
*
* Creates a new Godot instance.
*
* @param p_argc The number of command line arguments.
* @param p_argv The C-style array of command line arguments.
* @param p_init_func GDExtension initialization function of the host application.
*
* @return A pointer to created \ref GodotInstance GDExtension object or nullptr if there was an error.
*/
LIBGODOT_API GDExtensionObjectPtr libgodot_create_godot_instance(int p_argc, char *p_argv[], GDExtensionInitializationFunction p_init_func);
/**
* @name libgodot_destroy_godot_instance
* @since 4.6
*
* Destroys an existing Godot instance.
*
* @param p_godot_instance The reference to the GodotInstance object to destroy.
*
*/
LIBGODOT_API void libgodot_destroy_godot_instance(GDExtensionObjectPtr p_godot_instance);
#ifdef __cplusplus
}
#endif

View file

@ -1756,8 +1756,7 @@ void Input::parse_mapping(const String &p_mapping) {
void Input::add_joy_mapping(const String &p_mapping, bool p_update_existing) { void Input::add_joy_mapping(const String &p_mapping, bool p_update_existing) {
parse_mapping(p_mapping); parse_mapping(p_mapping);
if (p_update_existing) { if (p_update_existing) {
Vector<String> entry = p_mapping.split(","); const String uid = p_mapping.get_slicec(',', 0);
const String &uid = entry[0];
for (KeyValue<int, Joypad> &E : joy_names) { for (KeyValue<int, Joypad> &E : joy_names) {
Joypad &joy = E.value; Joypad &joy = E.value;
if (joy.uid == uid) { if (joy.uid == uid) {

View file

@ -34,6 +34,7 @@
#include "core/object/object.h" #include "core/object/object.h"
#include "core/os/keyboard.h" #include "core/os/keyboard.h"
#include "core/os/thread_safe.h" #include "core/os/thread_safe.h"
#include "core/templates/rb_map.h"
#include "core/templates/rb_set.h" #include "core/templates/rb_set.h"
#include "core/variant/typed_array.h" #include "core/variant/typed_array.h"

View file

@ -260,12 +260,12 @@ String InputEventWithModifiers::as_text() const {
if (is_ctrl_pressed()) { if (is_ctrl_pressed()) {
mod_names.push_back(find_keycode_name(Key::CTRL)); mod_names.push_back(find_keycode_name(Key::CTRL));
} }
if (is_shift_pressed()) {
mod_names.push_back(find_keycode_name(Key::SHIFT));
}
if (is_alt_pressed()) { if (is_alt_pressed()) {
mod_names.push_back(find_keycode_name(Key::ALT)); mod_names.push_back(find_keycode_name(Key::ALT));
} }
if (is_shift_pressed()) {
mod_names.push_back(find_keycode_name(Key::SHIFT));
}
if (is_meta_pressed()) { if (is_meta_pressed()) {
mod_names.push_back(find_keycode_name(Key::META)); mod_names.push_back(find_keycode_name(Key::META));
} }
@ -277,7 +277,7 @@ String InputEventWithModifiers::as_text() const {
} }
} }
String InputEventWithModifiers::to_string() { String InputEventWithModifiers::_to_string() {
return as_text(); return as_text();
} }
@ -488,7 +488,7 @@ String InputEventKey::as_text() const {
return mods_text.is_empty() ? kc : mods_text + "+" + kc; return mods_text.is_empty() ? kc : mods_text + "+" + kc;
} }
String InputEventKey::to_string() { String InputEventKey::_to_string() {
String p = is_pressed() ? "true" : "false"; String p = is_pressed() ? "true" : "false";
String e = is_echo() ? "true" : "false"; String e = is_echo() ? "true" : "false";
@ -848,7 +848,7 @@ String InputEventMouseButton::as_text() const {
return full_string; return full_string;
} }
String InputEventMouseButton::to_string() { String InputEventMouseButton::_to_string() {
String p = is_pressed() ? "true" : "false"; String p = is_pressed() ? "true" : "false";
String canceled_state = is_canceled() ? "true" : "false"; String canceled_state = is_canceled() ? "true" : "false";
String d = double_click ? "true" : "false"; String d = double_click ? "true" : "false";
@ -988,7 +988,7 @@ String InputEventMouseMotion::as_text() const {
return vformat(RTR("Mouse motion at position (%s) with velocity (%s)"), String(get_position()), String(get_velocity())); return vformat(RTR("Mouse motion at position (%s) with velocity (%s)"), String(get_position()), String(get_velocity()));
} }
String InputEventMouseMotion::to_string() { String InputEventMouseMotion::_to_string() {
BitField<MouseButtonMask> mouse_button_mask = get_button_mask(); BitField<MouseButtonMask> mouse_button_mask = get_button_mask();
String button_mask_string = itos((int64_t)mouse_button_mask); String button_mask_string = itos((int64_t)mouse_button_mask);
@ -1184,15 +1184,16 @@ String InputEventJoypadMotion::as_text() const {
return vformat(RTR("Joypad Motion on Axis %d (%s) with Value %.2f"), axis, desc, axis_value); return vformat(RTR("Joypad Motion on Axis %d (%s) with Value %.2f"), axis, desc, axis_value);
} }
String InputEventJoypadMotion::to_string() { String InputEventJoypadMotion::_to_string() {
return vformat("InputEventJoypadMotion: axis=%d, axis_value=%.2f", axis, axis_value); return vformat("InputEventJoypadMotion: axis=%d, axis_value=%.2f", axis, axis_value);
} }
Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value) { Ref<InputEventJoypadMotion> InputEventJoypadMotion::create_reference(JoyAxis p_axis, float p_value, int p_device) {
Ref<InputEventJoypadMotion> ie; Ref<InputEventJoypadMotion> ie;
ie.instantiate(); ie.instantiate();
ie->set_axis(p_axis); ie->set_axis(p_axis);
ie->set_axis_value(p_value); ie->set_axis_value(p_value);
ie->set_device(p_device);
return ie; return ie;
} }
@ -1302,15 +1303,16 @@ String InputEventJoypadButton::as_text() const {
return text; return text;
} }
String InputEventJoypadButton::to_string() { String InputEventJoypadButton::_to_string() {
String p = is_pressed() ? "true" : "false"; String p = is_pressed() ? "true" : "false";
return vformat("InputEventJoypadButton: button_index=%d, pressed=%s, pressure=%.2f", button_index, p, pressure); return vformat("InputEventJoypadButton: button_index=%d, pressed=%s, pressure=%.2f", button_index, p, pressure);
} }
Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index) { Ref<InputEventJoypadButton> InputEventJoypadButton::create_reference(JoyButton p_btn_index, int p_device) {
Ref<InputEventJoypadButton> ie; Ref<InputEventJoypadButton> ie;
ie.instantiate(); ie.instantiate();
ie->set_button_index(p_btn_index); ie->set_button_index(p_btn_index);
ie->set_device(p_device);
return ie; return ie;
} }
@ -1384,7 +1386,7 @@ String InputEventScreenTouch::as_text() const {
return vformat(RTR("Screen %s at (%s) with %s touch points"), status, String(get_position()), itos(index)); return vformat(RTR("Screen %s at (%s) with %s touch points"), status, String(get_position()), itos(index));
} }
String InputEventScreenTouch::to_string() { String InputEventScreenTouch::_to_string() {
String p = pressed ? "true" : "false"; String p = pressed ? "true" : "false";
String canceled_state = canceled ? "true" : "false"; String canceled_state = canceled ? "true" : "false";
String double_tap_string = double_tap ? "true" : "false"; String double_tap_string = double_tap ? "true" : "false";
@ -1512,7 +1514,7 @@ String InputEventScreenDrag::as_text() const {
return vformat(RTR("Screen dragged with %s touch points at position (%s) with velocity of (%s)"), itos(index), String(get_position()), String(get_velocity())); return vformat(RTR("Screen dragged with %s touch points at position (%s) with velocity of (%s)"), itos(index), String(get_position()), String(get_velocity()));
} }
String InputEventScreenDrag::to_string() { String InputEventScreenDrag::_to_string() {
return vformat("InputEventScreenDrag: index=%d, position=(%s), relative=(%s), velocity=(%s), pressure=%.2f, tilt=(%s), pen_inverted=(%s)", index, String(get_position()), String(get_relative()), String(get_velocity()), get_pressure(), String(get_tilt()), get_pen_inverted()); return vformat("InputEventScreenDrag: index=%d, position=(%s), relative=(%s), velocity=(%s), pressure=%.2f, tilt=(%s), pen_inverted=(%s)", index, String(get_position()), String(get_relative()), String(get_velocity()), get_pressure(), String(get_tilt()), get_pen_inverted());
} }
@ -1654,7 +1656,7 @@ String InputEventAction::as_text() const {
return String(); return String();
} }
String InputEventAction::to_string() { String InputEventAction::_to_string() {
String p = is_pressed() ? "true" : "false"; String p = is_pressed() ? "true" : "false";
return vformat("InputEventAction: action=\"%s\", pressed=%s", action, p); return vformat("InputEventAction: action=\"%s\", pressed=%s", action, p);
} }
@ -1725,7 +1727,7 @@ String InputEventMagnifyGesture::as_text() const {
return vformat(RTR("Magnify Gesture at (%s) with factor %s"), String(get_position()), rtos(get_factor())); return vformat(RTR("Magnify Gesture at (%s) with factor %s"), String(get_position()), rtos(get_factor()));
} }
String InputEventMagnifyGesture::to_string() { String InputEventMagnifyGesture::_to_string() {
return vformat("InputEventMagnifyGesture: factor=%.2f, position=(%s)", factor, String(get_position())); return vformat("InputEventMagnifyGesture: factor=%.2f, position=(%s)", factor, String(get_position()));
} }
@ -1767,7 +1769,7 @@ String InputEventPanGesture::as_text() const {
return vformat(RTR("Pan Gesture at (%s) with delta (%s)"), String(get_position()), String(get_delta())); return vformat(RTR("Pan Gesture at (%s) with delta (%s)"), String(get_position()), String(get_delta()));
} }
String InputEventPanGesture::to_string() { String InputEventPanGesture::_to_string() {
return vformat("InputEventPanGesture: delta=(%s), position=(%s)", String(get_delta()), String(get_position())); return vformat("InputEventPanGesture: delta=(%s), position=(%s)", String(get_delta()), String(get_position()));
} }
@ -1848,7 +1850,7 @@ String InputEventMIDI::as_text() const {
return vformat(RTR("MIDI Input on Channel=%s Message=%s"), itos(channel), itos((int64_t)message)); return vformat(RTR("MIDI Input on Channel=%s Message=%s"), itos(channel), itos((int64_t)message));
} }
String InputEventMIDI::to_string() { String InputEventMIDI::_to_string() {
String ret; String ret;
switch (message) { switch (message) {
case MIDIMessage::NOTE_ON: case MIDIMessage::NOTE_ON:
@ -1924,7 +1926,7 @@ String InputEventShortcut::as_text() const {
return vformat(RTR("Input Event with Shortcut=%s"), shortcut->get_as_text()); return vformat(RTR("Input Event with Shortcut=%s"), shortcut->get_as_text());
} }
String InputEventShortcut::to_string() { String InputEventShortcut::_to_string() {
ERR_FAIL_COND_V(shortcut.is_null(), "None"); ERR_FAIL_COND_V(shortcut.is_null(), "None");
return vformat("InputEventShortcut: shortcut=%s", shortcut->get_as_text()); return vformat("InputEventShortcut: shortcut=%s", shortcut->get_as_text());

View file

@ -146,7 +146,7 @@ public:
BitField<KeyModifierMask> get_modifiers_mask() const; BitField<KeyModifierMask> get_modifiers_mask() const;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventWithModifiers() {} InputEventWithModifiers() {}
}; };
@ -200,7 +200,7 @@ public:
virtual String as_text_key_label() const; virtual String as_text_key_label() const;
virtual String as_text_location() const; virtual String as_text_location() const;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
static Ref<InputEventKey> create_reference(Key p_keycode_with_modifier_masks, bool p_physical = false); static Ref<InputEventKey> create_reference(Key p_keycode_with_modifier_masks, bool p_physical = false);
@ -263,7 +263,7 @@ public:
virtual bool is_action_type() const override { return true; } virtual bool is_action_type() const override { return true; }
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::MOUSE_BUTTON; } InputEventType get_type() const final override { return InputEventType::MOUSE_BUTTON; }
@ -308,7 +308,7 @@ public:
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
virtual bool accumulate(const Ref<InputEvent> &p_event) override; virtual bool accumulate(const Ref<InputEvent> &p_event) override;
@ -337,9 +337,10 @@ public:
virtual bool is_action_type() const override { return true; } virtual bool is_action_type() const override { return true; }
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value); // The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadMotion> create_reference(JoyAxis p_axis, float p_value, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_MOTION; } InputEventType get_type() const final override { return InputEventType::JOY_MOTION; }
@ -369,9 +370,10 @@ public:
virtual bool is_action_type() const override { return true; } virtual bool is_action_type() const override { return true; }
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index); // The default device ID is `InputMap::ALL_DEVICES`.
static Ref<InputEventJoypadButton> create_reference(JoyButton p_btn_index, int p_device = -1);
InputEventType get_type() const final override { return InputEventType::JOY_BUTTON; } InputEventType get_type() const final override { return InputEventType::JOY_BUTTON; }
@ -402,7 +404,7 @@ public:
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::SCREEN_TOUCH; } InputEventType get_type() const final override { return InputEventType::SCREEN_TOUCH; }
@ -454,7 +456,7 @@ public:
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
virtual bool accumulate(const Ref<InputEvent> &p_event) override; virtual bool accumulate(const Ref<InputEvent> &p_event) override;
@ -493,7 +495,7 @@ public:
virtual bool is_action_type() const override { return true; } virtual bool is_action_type() const override { return true; }
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::ACTION; } InputEventType get_type() const final override { return InputEventType::ACTION; }
@ -526,7 +528,7 @@ public:
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::MAGNIFY_GESTURE; } InputEventType get_type() const final override { return InputEventType::MAGNIFY_GESTURE; }
@ -546,7 +548,7 @@ public:
virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::PAN_GESTURE; } InputEventType get_type() const final override { return InputEventType::PAN_GESTURE; }
@ -594,7 +596,7 @@ public:
int get_controller_value() const; int get_controller_value() const;
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::MIDI; } InputEventType get_type() const final override { return InputEventType::MIDI; }
@ -614,7 +616,7 @@ public:
Ref<Shortcut> get_shortcut(); Ref<Shortcut> get_shortcut();
virtual String as_text() const override; virtual String as_text() const override;
virtual String to_string() override; virtual String _to_string() override;
InputEventType get_type() const final override { return InputEventType::SHORTCUT; } InputEventType get_type() const final override { return InputEventType::SHORTCUT; }

View file

@ -403,9 +403,12 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
{ "ui_graph_delete", TTRC("Delete Nodes") }, { "ui_graph_delete", TTRC("Delete Nodes") },
{ "ui_graph_follow_left", TTRC("Follow Input Port Connection") }, { "ui_graph_follow_left", TTRC("Follow Input Port Connection") },
{ "ui_graph_follow_right", TTRC("Follow Output Port Connection") }, { "ui_graph_follow_right", TTRC("Follow Output Port Connection") },
{ "ui_filedialog_delete", TTRC("Delete") },
{ "ui_filedialog_up_one_level", TTRC("Go Up One Level") }, { "ui_filedialog_up_one_level", TTRC("Go Up One Level") },
{ "ui_filedialog_refresh", TTRC("Refresh") }, { "ui_filedialog_refresh", TTRC("Refresh") },
{ "ui_filedialog_show_hidden", TTRC("Show Hidden") }, { "ui_filedialog_show_hidden", TTRC("Show Hidden") },
{ "ui_filedialog_find", TTRC("Find") },
{ "ui_filedialog_focus_path", TTRC("Focus Path") },
{ "ui_swap_input_direction ", TTRC("Swap Input Direction") }, { "ui_swap_input_direction ", TTRC("Swap Input Direction") },
{ "ui_unicode_start", TTRC("Start Unicode Character Input") }, { "ui_unicode_start", TTRC("Start Unicode Character Input") },
{ "ui_colorpicker_delete_preset", TTRC("ColorPicker: Delete Preset") }, { "ui_colorpicker_delete_preset", TTRC("ColorPicker: Delete Preset") },
@ -415,7 +418,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
}; };
String InputMap::get_builtin_display_name(const String &p_name) const { String InputMap::get_builtin_display_name(const String &p_name) const {
constexpr int len = std::size(_builtin_action_display_names); constexpr int len = std_size(_builtin_action_display_names);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (_builtin_action_display_names[i].name == p_name) { if (_builtin_action_display_names[i].name == p_name) {
@ -804,6 +807,10 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
default_builtin_cache.insert("ui_graph_follow_right.macos", inputs); default_builtin_cache.insert("ui_graph_follow_right.macos", inputs);
// ///// UI File Dialog Shortcuts ///// // ///// UI File Dialog Shortcuts /////
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
default_builtin_cache.insert("ui_filedialog_delete", inputs);
inputs = List<Ref<InputEvent>>(); inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE)); inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE));
default_builtin_cache.insert("ui_filedialog_up_one_level", inputs); default_builtin_cache.insert("ui_filedialog_up_one_level", inputs);
@ -816,6 +823,22 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs.push_back(InputEventKey::create_reference(Key::H)); inputs.push_back(InputEventKey::create_reference(Key::H));
default_builtin_cache.insert("ui_filedialog_show_hidden", inputs); default_builtin_cache.insert("ui_filedialog_show_hidden", inputs);
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::F | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_filedialog_find", inputs);
inputs = List<Ref<InputEvent>>();
// Ctrl + L (matches most Windows/Linux file managers' "focus on path bar" shortcut,
// plus macOS Safari's "focus on address bar" shortcut).
inputs.push_back(InputEventKey::create_reference(Key::L | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_filedialog_focus_path", inputs);
inputs = List<Ref<InputEvent>>();
// Cmd + Shift + G (matches Finder's "Go To" shortcut).
inputs.push_back(InputEventKey::create_reference(Key::G | KeyModifierMask::CMD_OR_CTRL));
inputs.push_back(InputEventKey::create_reference(Key::L | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_filedialog_focus_path.macos", inputs);
inputs = List<Ref<InputEvent>>(); inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::QUOTELEFT | KeyModifierMask::CMD_OR_CTRL)); inputs.push_back(InputEventKey::create_reference(Key::QUOTELEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_swap_input_direction", inputs); default_builtin_cache.insert("ui_swap_input_direction", inputs);
@ -843,9 +866,8 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with_featur
for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) { for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
String fullname = E.key; String fullname = E.key;
Vector<String> split = fullname.split("."); const String &name = fullname.get_slicec('.', 0);
const String &name = split[0]; String override_for = fullname.get_slice_count(".") > 1 ? fullname.get_slicec('.', 1) : String();
String override_for = split.size() > 1 ? split[1] : String();
if (!override_for.is_empty() && OS::get_singleton()->has_feature(override_for)) { if (!override_for.is_empty() && OS::get_singleton()->has_feature(override_for)) {
builtins_with_overrides[name].push_back(override_for); builtins_with_overrides[name].push_back(override_for);
@ -855,9 +877,8 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins_with_featur
for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) { for (const KeyValue<String, List<Ref<InputEvent>>> &E : builtins) {
String fullname = E.key; String fullname = E.key;
Vector<String> split = fullname.split("."); const String &name = fullname.get_slicec('.', 0);
const String &name = split[0]; String override_for = fullname.get_slice_count(".") > 1 ? fullname.get_slicec('.', 1) : String();
String override_for = split.size() > 1 ? split[1] : String();
if (builtins_with_overrides.has(name) && override_for.is_empty()) { if (builtins_with_overrides.has(name) && override_for.is_empty()) {
// Builtin has an override but this particular one is not an override, so skip. // Builtin has an override but this particular one is not an override, so skip.

View file

@ -85,6 +85,17 @@ String Shortcut::get_as_text() const {
return "None"; return "None";
} }
Ref<Shortcut> Shortcut::make_from_action(const StringName &p_action) {
Ref<InputEventAction> event;
event.instantiate();
event->set_action(p_action);
Ref<Shortcut> shortcut;
shortcut.instantiate();
shortcut->set_events({ event });
return shortcut;
}
bool Shortcut::has_valid_event() const { bool Shortcut::has_valid_event() const {
// Tests if there is ANY input event which is valid. // Tests if there is ANY input event which is valid.
for (int i = 0; i < events.size(); i++) { for (int i = 0; i < events.size(); i++) {

View file

@ -52,5 +52,7 @@ public:
String get_as_text() const; String get_as_text() const;
static Ref<Shortcut> make_from_action(const StringName &p_action);
static bool is_event_array_equal(const Array &p_event_array1, const Array &p_event_array2); static bool is_event_array_equal(const Array &p_event_array1, const Array &p_event_array2);
}; };

View file

@ -90,6 +90,14 @@ void FileAccess::store_pascal_string_bind_compat_78289(const String &p_string) {
store_pascal_string(p_string); store_pascal_string(p_string);
} }
String FileAccess::get_as_text_bind_compat_110867(bool p_skip_cr) const {
String text = get_as_text();
if (unlikely(p_skip_cr)) {
text = text.remove_char('\r');
}
return text;
}
void FileAccess::_bind_compatibility_methods() { void FileAccess::_bind_compatibility_methods() {
ClassDB::bind_compatibility_static_method("FileAccess", D_METHOD("open_encrypted", "path", "mode_flags", "key"), &FileAccess::_open_encrypted_bind_compat_98918); ClassDB::bind_compatibility_static_method("FileAccess", D_METHOD("open_encrypted", "path", "mode_flags", "key"), &FileAccess::_open_encrypted_bind_compat_98918);
@ -107,6 +115,7 @@ void FileAccess::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("store_string", "string"), &FileAccess::store_string_bind_compat_78289); ClassDB::bind_compatibility_method(D_METHOD("store_string", "string"), &FileAccess::store_string_bind_compat_78289);
ClassDB::bind_compatibility_method(D_METHOD("store_var", "value", "full_objects"), &FileAccess::store_var_bind_compat_78289, DEFVAL(false)); ClassDB::bind_compatibility_method(D_METHOD("store_var", "value", "full_objects"), &FileAccess::store_var_bind_compat_78289, DEFVAL(false));
ClassDB::bind_compatibility_method(D_METHOD("store_pascal_string", "string"), &FileAccess::store_pascal_string_bind_compat_78289); ClassDB::bind_compatibility_method(D_METHOD("store_pascal_string", "string"), &FileAccess::store_pascal_string_bind_compat_78289);
ClassDB::bind_compatibility_method(D_METHOD("get_as_text", "skip_cr"), &FileAccess::get_as_text_bind_compat_110867, DEFVAL(false));
} }
#endif #endif

View file

@ -37,6 +37,7 @@
#include "core/io/file_access_encrypted.h" #include "core/io/file_access_encrypted.h"
#include "core/io/file_access_pack.h" #include "core/io/file_access_pack.h"
#include "core/io/marshalls.h" #include "core/io/marshalls.h"
#include "core/io/resource_uid.h"
#include "core/os/os.h" #include "core/os/os.h"
#include "core/os/time.h" #include "core/os/time.h"
@ -81,12 +82,12 @@ Ref<FileAccess> FileAccess::create_for_path(const String &p_path) {
Ref<FileAccess> FileAccess::create_temp(int p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep, Error *r_error) { Ref<FileAccess> FileAccess::create_temp(int p_mode_flags, const String &p_prefix, const String &p_extension, bool p_keep, Error *r_error) {
const String ERROR_COMMON_PREFIX = "Error while creating temporary file"; const String ERROR_COMMON_PREFIX = "Error while creating temporary file";
if (!p_prefix.is_valid_filename()) { if (!p_prefix.is_empty() && !p_prefix.is_valid_filename()) {
*r_error = ERR_FILE_BAD_PATH; *r_error = ERR_FILE_BAD_PATH;
ERR_FAIL_V_MSG(Ref<FileAccess>(), vformat(R"(%s: "%s" is not a valid prefix.)", ERROR_COMMON_PREFIX, p_prefix)); ERR_FAIL_V_MSG(Ref<FileAccess>(), vformat(R"(%s: "%s" is not a valid prefix.)", ERROR_COMMON_PREFIX, p_prefix));
} }
if (!p_extension.is_valid_filename()) { if (!p_extension.is_empty() && !p_extension.is_valid_filename()) {
*r_error = ERR_FILE_BAD_PATH; *r_error = ERR_FILE_BAD_PATH;
ERR_FAIL_V_MSG(Ref<FileAccess>(), vformat(R"(%s: "%s" is not a valid extension.)", ERROR_COMMON_PREFIX, p_extension)); ERR_FAIL_V_MSG(Ref<FileAccess>(), vformat(R"(%s: "%s" is not a valid extension.)", ERROR_COMMON_PREFIX, p_extension));
} }
@ -445,7 +446,7 @@ class CharBuffer {
public: public:
_FORCE_INLINE_ CharBuffer() : _FORCE_INLINE_ CharBuffer() :
buffer(stack_buffer), buffer(stack_buffer),
capacity(std::size(stack_buffer)) { capacity(std_size(stack_buffer)) {
} }
_FORCE_INLINE_ void push_back(char c) { _FORCE_INLINE_ void push_back(char c) {
@ -467,10 +468,22 @@ String FileAccess::get_line() const {
uint8_t c = get_8(); uint8_t c = get_8();
while (!eof_reached()) { while (!eof_reached()) {
if (c == '\n' || c == '\0' || get_error() != OK) { if (c == '\r' || c == '\n' || c == '\0' || get_error() != OK) {
if (c == '\r') {
// Check for Windows-style EOL.
const uint64_t prev_pos = get_position() - 1;
if (unlikely(get_8() != '\n')) {
// HACK: We can't simply check the next value in a vacuum, so we risk triggering
// an EOL false-positive in the unlikely event that this `\r` was the final
// value of the file. Unilaterally work around by re-reading the *previous*
// byte (the starting `\r`) to ensure `get_error()` returns `OK`.
const_cast<FileAccess *>(this)->seek(prev_pos);
get_8();
}
}
line.push_back(0); line.push_back(0);
return String::utf8(line.get_data()); return String::utf8(line.get_data());
} else if (c != '\r') { } else {
line.push_back(char(c)); line.push_back(char(c));
} }
@ -538,11 +551,11 @@ Vector<String> FileAccess::get_csv_line(const String &p_delim) const {
return strings; return strings;
} }
String FileAccess::get_as_text(bool p_skip_cr) const { String FileAccess::get_as_text() const {
uint64_t original_pos = get_position(); uint64_t original_pos = get_position();
const_cast<FileAccess *>(this)->seek(0); const_cast<FileAccess *>(this)->seek(0);
String text = get_as_utf8_string(p_skip_cr); String text = get_as_utf8_string();
const_cast<FileAccess *>(this)->seek(original_pos); const_cast<FileAccess *>(this)->seek(original_pos);
@ -557,6 +570,7 @@ Vector<uint8_t> FileAccess::get_buffer(int64_t p_length) const {
return data; return data;
} }
data.reserve_exact(p_length);
Error err = data.resize(p_length); Error err = data.resize(p_length);
ERR_FAIL_COND_V_MSG(err != OK, data, vformat("Can't resize data to %d elements.", p_length)); ERR_FAIL_COND_V_MSG(err != OK, data, vformat("Can't resize data to %d elements.", p_length));
@ -570,7 +584,7 @@ Vector<uint8_t> FileAccess::get_buffer(int64_t p_length) const {
return data; return data;
} }
String FileAccess::get_as_utf8_string(bool p_skip_cr) const { String FileAccess::get_as_utf8_string() const {
Vector<uint8_t> sourcef; Vector<uint8_t> sourcef;
uint64_t len = get_length(); uint64_t len = get_length();
sourcef.resize(len + 1); sourcef.resize(len + 1);
@ -581,7 +595,7 @@ String FileAccess::get_as_utf8_string(bool p_skip_cr) const {
w[len] = 0; w[len] = 0;
String s; String s;
s.append_utf8((const char *)w, len, p_skip_cr); s.append_utf8((const char *)w, len);
return s; return s;
} }
@ -851,6 +865,7 @@ Vector<uint8_t> FileAccess::get_file_as_bytes(const String &p_path, Error *r_err
ERR_FAIL_V_MSG(Vector<uint8_t>(), vformat("Can't open file from path '%s'.", String(p_path))); ERR_FAIL_V_MSG(Vector<uint8_t>(), vformat("Can't open file from path '%s'.", String(p_path)));
} }
Vector<uint8_t> data; Vector<uint8_t> data;
data.reserve_exact(f->get_length());
data.resize(f->get_length()); data.resize(f->get_length());
f->get_buffer(data.ptrw(), data.size()); f->get_buffer(data.ptrw(), data.size());
return data; return data;
@ -987,7 +1002,7 @@ void FileAccess::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_buffer", "length"), (Vector<uint8_t> (FileAccess::*)(int64_t) const) & FileAccess::get_buffer); ClassDB::bind_method(D_METHOD("get_buffer", "length"), (Vector<uint8_t> (FileAccess::*)(int64_t) const) & FileAccess::get_buffer);
ClassDB::bind_method(D_METHOD("get_line"), &FileAccess::get_line); ClassDB::bind_method(D_METHOD("get_line"), &FileAccess::get_line);
ClassDB::bind_method(D_METHOD("get_csv_line", "delim"), &FileAccess::get_csv_line, DEFVAL(",")); ClassDB::bind_method(D_METHOD("get_csv_line", "delim"), &FileAccess::get_csv_line, DEFVAL(","));
ClassDB::bind_method(D_METHOD("get_as_text", "skip_cr"), &FileAccess::get_as_text, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_as_text"), &FileAccess::get_as_text);
ClassDB::bind_static_method("FileAccess", D_METHOD("get_md5", "path"), &FileAccess::get_md5); ClassDB::bind_static_method("FileAccess", D_METHOD("get_md5", "path"), &FileAccess::get_md5);
ClassDB::bind_static_method("FileAccess", D_METHOD("get_sha256", "path"), &FileAccess::get_sha256); ClassDB::bind_static_method("FileAccess", D_METHOD("get_sha256", "path"), &FileAccess::get_sha256);
ClassDB::bind_method(D_METHOD("is_big_endian"), &FileAccess::is_big_endian); ClassDB::bind_method(D_METHOD("is_big_endian"), &FileAccess::is_big_endian);

View file

@ -132,6 +132,7 @@ protected:
void store_line_bind_compat_78289(const String &p_line); void store_line_bind_compat_78289(const String &p_line);
void store_csv_line_bind_compat_78289(const Vector<String> &p_values, const String &p_delim = ","); void store_csv_line_bind_compat_78289(const Vector<String> &p_values, const String &p_delim = ",");
void store_pascal_string_bind_compat_78289(const String &p_string); void store_pascal_string_bind_compat_78289(const String &p_string);
String get_as_text_bind_compat_110867(bool p_skip_cr) const;
static void _bind_compatibility_methods(); static void _bind_compatibility_methods();
#endif #endif
@ -188,8 +189,8 @@ public:
virtual String get_line() const; virtual String get_line() const;
virtual String get_token() const; virtual String get_token() const;
virtual Vector<String> get_csv_line(const String &p_delim = ",") const; virtual Vector<String> get_csv_line(const String &p_delim = ",") const;
String get_as_text(bool p_skip_cr = false) const; String get_as_text() const;
virtual String get_as_utf8_string(bool p_skip_cr = false) const; virtual String get_as_utf8_string() const;
/** /**

View file

@ -130,34 +130,37 @@ void FileAccessCompressed::_close() {
f->store_32(0); //compressed sizes, will update later f->store_32(0); //compressed sizes, will update later
} }
Vector<int> block_sizes; uint32_t last_block_size = write_max % block_size;
// Temporary buffer for compressed data blocks.
LocalVector<uint8_t> temp_cblock;
temp_cblock.resize(Compression::get_max_compressed_buffer_size(bc == 1 ? last_block_size : block_size, cmode));
uint8_t *temp_cblock_ptr = temp_cblock.ptr();
// Compress and store the blocks.
LocalVector<uint32_t> block_sizes;
for (uint32_t i = 0; i < bc; i++) { for (uint32_t i = 0; i < bc; i++) {
uint32_t bl = i == (bc - 1) ? write_max % block_size : block_size; uint32_t bl = i == (bc - 1) ? last_block_size : block_size;
uint8_t *bp = &write_ptr[i * block_size]; uint8_t *bp = &write_ptr[i * block_size];
Vector<uint8_t> cblock; const int64_t compressed_size = Compression::compress(temp_cblock_ptr, bp, bl, cmode);
cblock.resize(Compression::get_max_compressed_buffer_size(bl, cmode));
const int64_t compressed_size = Compression::compress(cblock.ptrw(), bp, bl, cmode);
ERR_FAIL_COND_MSG(compressed_size < 0, "FileAccessCompressed: Error compressing data."); ERR_FAIL_COND_MSG(compressed_size < 0, "FileAccessCompressed: Error compressing data.");
f->store_buffer(cblock.ptr(), (uint64_t)compressed_size); f->store_buffer(temp_cblock_ptr, (uint64_t)compressed_size);
block_sizes.push_back(compressed_size); block_sizes.push_back(compressed_size);
} }
f->seek(16); //ok write block sizes f->seek(16); //ok write block sizes
for (uint32_t i = 0; i < bc; i++) { for (uint32_t i = 0; i < bc; i++) {
f->store_32(uint32_t(block_sizes[i])); f->store_32(block_sizes[i]);
} }
f->seek_end(); f->seek_end();
f->store_buffer((const uint8_t *)mgc.get_data(), mgc.length()); //magic at the end too f->store_buffer((const uint8_t *)mgc.get_data(), mgc.length()); //magic at the end too
buffer.clear();
} else { } else {
comp_buffer.clear(); comp_buffer.clear();
buffer.clear();
read_blocks.clear(); read_blocks.clear();
} }
buffer.clear();
f.unref(); f.unref();
} }

View file

@ -140,7 +140,7 @@ void FileAccessEncrypted::_close() {
} }
if (writing) { if (writing) {
Vector<uint8_t> compressed; LocalVector<uint8_t> compressed;
uint64_t len = data.size(); uint64_t len = data.size();
if (len % 16) { if (len % 16) {
len += 16 - (len % 16); len += 16 - (len % 16);
@ -150,10 +150,8 @@ void FileAccessEncrypted::_close() {
ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug? ERR_FAIL_COND(CryptoCore::md5(data.ptr(), data.size(), hash) != OK); // Bug?
compressed.resize(len); compressed.resize(len);
memset(compressed.ptrw(), 0, len); memcpy(compressed.ptr(), data.ptr(), data.size());
for (int i = 0; i < data.size(); i++) { memset(compressed.ptr() + data.size(), 0, len - data.size());
compressed.write[i] = data[i];
}
CryptoCore::AESContext ctx; CryptoCore::AESContext ctx;
ctx.set_encode_key(key.ptrw(), 256); ctx.set_encode_key(key.ptrw(), 256);
@ -166,7 +164,7 @@ void FileAccessEncrypted::_close() {
file->store_64(data.size()); file->store_64(data.size());
file->store_buffer(iv.ptr(), 16); file->store_buffer(iv.ptr(), 16);
ctx.encrypt_cfb(len, iv.ptrw(), compressed.ptrw(), compressed.ptrw()); ctx.encrypt_cfb(len, iv.ptrw(), compressed.ptr(), compressed.ptr());
file->store_buffer(compressed.ptr(), compressed.size()); file->store_buffer(compressed.ptr(), compressed.size());
data.clear(); data.clear();

View file

@ -35,6 +35,8 @@
#include "core/crypto/crypto.h" #include "core/crypto/crypto.h"
class HTTPClientTCP : public HTTPClient { class HTTPClientTCP : public HTTPClient {
GDSOFTCLASS(HTTPClientTCP, HTTPClient);
private: private:
Status status = STATUS_DISCONNECTED; Status status = STATUS_DISCONNECTED;
IP::ResolverID resolving = IP::RESOLVER_INVALID_ID; IP::ResolverID resolving = IP::RESOLVER_INVALID_ID;

View file

@ -78,6 +78,14 @@ const char *Image::format_names[Image::FORMAT_MAX] = {
"ASTC_4x4_HDR", "ASTC_4x4_HDR",
"ASTC_8x8", "ASTC_8x8",
"ASTC_8x8_HDR", "ASTC_8x8_HDR",
"R16",
"RG16",
"RGB16",
"RGBA16",
"R16Int",
"RG16Int",
"RGB16Int",
"RGBA16Int",
}; };
// External VRAM compression function pointers. // External VRAM compression function pointers.
@ -201,6 +209,22 @@ int Image::get_format_pixel_size(Format p_format) {
return 1; return 1;
case FORMAT_ASTC_8x8_HDR: case FORMAT_ASTC_8x8_HDR:
return 1; return 1;
case FORMAT_R16:
return 2;
case FORMAT_RG16:
return 4;
case FORMAT_RGB16:
return 6;
case FORMAT_RGBA16:
return 8;
case FORMAT_R16I:
return 2;
case FORMAT_RG16I:
return 4;
case FORMAT_RGB16I:
return 6;
case FORMAT_RGBA16I:
return 8;
case FORMAT_MAX: { case FORMAT_MAX: {
} }
} }
@ -759,6 +783,78 @@ void Image::convert(Format p_new_format) {
case FORMAT_RGBAF | (FORMAT_RGBF << 8): case FORMAT_RGBAF | (FORMAT_RGBF << 8):
_convert_fast<uint32_t, 4, 3, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr); _convert_fast<uint32_t, 4, 3, 0x00000000, 0x3F800000>(mip_width, mip_height, (const uint32_t *)rptr, (uint32_t *)wptr);
break; break;
case FORMAT_R16 | (FORMAT_RG16 << 8):
_convert_fast<uint16_t, 1, 2, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_R16 | (FORMAT_RGB16 << 8):
_convert_fast<uint16_t, 1, 3, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_R16 | (FORMAT_RGBA16 << 8):
_convert_fast<uint16_t, 1, 4, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16 | (FORMAT_R16 << 8):
_convert_fast<uint16_t, 2, 1, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16 | (FORMAT_RGB16 << 8):
_convert_fast<uint16_t, 2, 3, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16 | (FORMAT_RGBA16 << 8):
_convert_fast<uint16_t, 2, 4, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16 | (FORMAT_R16 << 8):
_convert_fast<uint16_t, 3, 1, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16 | (FORMAT_RG16 << 8):
_convert_fast<uint16_t, 3, 2, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16 | (FORMAT_RGBA16 << 8):
_convert_fast<uint16_t, 3, 4, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16 | (FORMAT_R16 << 8):
_convert_fast<uint16_t, 4, 1, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16 | (FORMAT_RG16 << 8):
_convert_fast<uint16_t, 4, 2, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16 | (FORMAT_RGB16 << 8):
_convert_fast<uint16_t, 4, 3, 0x0000, 0xFFFF>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_R16I | (FORMAT_RG16I << 8):
_convert_fast<uint16_t, 1, 2, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_R16I | (FORMAT_RGB16I << 8):
_convert_fast<uint16_t, 1, 3, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_R16I | (FORMAT_RGBA16I << 8):
_convert_fast<uint16_t, 1, 4, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16I | (FORMAT_R16I << 8):
_convert_fast<uint16_t, 2, 1, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16I | (FORMAT_RGB16I << 8):
_convert_fast<uint16_t, 2, 3, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RG16I | (FORMAT_RGBA16I << 8):
_convert_fast<uint16_t, 2, 4, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16I | (FORMAT_R16I << 8):
_convert_fast<uint16_t, 3, 1, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16I | (FORMAT_RG16I << 8):
_convert_fast<uint16_t, 3, 2, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGB16I | (FORMAT_RGBA16I << 8):
_convert_fast<uint16_t, 3, 4, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16I | (FORMAT_R16I << 8):
_convert_fast<uint16_t, 4, 1, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16I | (FORMAT_RG16I << 8):
_convert_fast<uint16_t, 4, 2, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
case FORMAT_RGBA16I | (FORMAT_RGB16I << 8):
_convert_fast<uint16_t, 4, 3, 0x0000, 0x0001>(mip_width, mip_height, (const uint16_t *)rptr, (uint16_t *)wptr);
break;
} }
} }
@ -769,6 +865,11 @@ Image::Format Image::get_format() const {
return format; return format;
} }
enum ImageScaleType {
IMAGE_SCALING_INT,
IMAGE_SCALING_FLOAT,
};
static double _bicubic_interp_kernel(double x) { static double _bicubic_interp_kernel(double x) {
x = Math::abs(x); x = Math::abs(x);
@ -783,7 +884,7 @@ static double _bicubic_interp_kernel(double x) {
return bc; return bc;
} }
template <int CC, typename T> template <int CC, typename T, ImageScaleType TYPE>
static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) { static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) {
// get source image size // get source image size
int width = p_src_width; int width = p_src_width;
@ -845,7 +946,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
const T *__restrict p = ((T *)p_src) + (oy2 * p_src_width + ox2) * CC; const T *__restrict p = ((T *)p_src) + (oy2 * p_src_width + ox2) * CC;
for (int i = 0; i < CC; i++) { for (int i = 0; i < CC; i++) {
if constexpr (sizeof(T) == 2) { //half float if constexpr (sizeof(T) == 2 && TYPE == IMAGE_SCALING_FLOAT) { //half float
color[i] = Math::half_to_float(p[i]); color[i] = Math::half_to_float(p[i]);
} else { } else {
color[i] += p[i] * k2; color[i] += p[i] * k2;
@ -857,8 +958,12 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
for (int i = 0; i < CC; i++) { for (int i = 0; i < CC; i++) {
if constexpr (sizeof(T) == 1) { //byte if constexpr (sizeof(T) == 1) { //byte
dst[i] = CLAMP(Math::fast_ftoi(color[i]), 0, 255); dst[i] = CLAMP(Math::fast_ftoi(color[i]), 0, 255);
} else if constexpr (sizeof(T) == 2) { //half float } else if constexpr (sizeof(T) == 2) {
dst[i] = Math::make_half_float(color[i]); if constexpr (TYPE == IMAGE_SCALING_FLOAT) {
dst[i] = Math::make_half_float(color[i]); //half float
} else {
dst[i] = CLAMP(Math::fast_ftoi(color[i]), 0, 65535); // uint16
}
} else { } else {
dst[i] = color[i]; dst[i] = color[i];
} }
@ -867,7 +972,7 @@ static void _scale_cubic(const uint8_t *__restrict p_src, uint8_t *__restrict p_
} }
} }
template <int CC, typename T> template <int CC, typename T, ImageScaleType TYPE>
static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) { static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) {
constexpr uint32_t FRAC_BITS = 8; constexpr uint32_t FRAC_BITS = 8;
constexpr uint32_t FRAC_LEN = (1 << FRAC_BITS); constexpr uint32_t FRAC_LEN = (1 << FRAC_BITS);
@ -915,8 +1020,8 @@ static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict
uint32_t interp = interp_up + (((interp_down - interp_up) * src_yofs_frac) >> FRAC_BITS); uint32_t interp = interp_up + (((interp_down - interp_up) * src_yofs_frac) >> FRAC_BITS);
interp >>= FRAC_BITS; interp >>= FRAC_BITS;
p_dst[i * p_dst_width * CC + j * CC + l] = uint8_t(interp); p_dst[i * p_dst_width * CC + j * CC + l] = uint8_t(interp);
} else if constexpr (sizeof(T) == 2) { //half float } else if constexpr (sizeof(T) == 2) {
if constexpr (TYPE == IMAGE_SCALING_FLOAT) { //half float
float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS); float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS);
float yofs_frac = float(src_yofs_frac) / (1 << FRAC_BITS); float yofs_frac = float(src_yofs_frac) / (1 << FRAC_BITS);
const T *src = ((const T *)p_src); const T *src = ((const T *)p_src);
@ -932,6 +1037,23 @@ static void _scale_bilinear(const uint8_t *__restrict p_src, uint8_t *__restrict
float interp = interp_up + ((interp_down - interp_up) * yofs_frac); float interp = interp_up + ((interp_down - interp_up) * yofs_frac);
dst[i * p_dst_width * CC + j * CC + l] = Math::make_half_float(interp); dst[i * p_dst_width * CC + j * CC + l] = Math::make_half_float(interp);
} else { //uint16
float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS);
float yofs_frac = float(src_yofs_frac) / (1 << FRAC_BITS);
const T *src = ((const T *)p_src);
T *dst = ((T *)p_dst);
float p00 = src[y_ofs_up + src_xofs_left + l];
float p10 = src[y_ofs_up + src_xofs_right + l];
float p01 = src[y_ofs_down + src_xofs_left + l];
float p11 = src[y_ofs_down + src_xofs_right + l];
float interp_up = p00 + (p10 - p00) * xofs_frac;
float interp_down = p01 + (p11 - p01) * xofs_frac;
float interp = interp_up + ((interp_down - interp_up) * yofs_frac);
dst[i * p_dst_width * CC + j * CC + l] = uint16_t(interp);
}
} else if constexpr (sizeof(T) == 4) { //float } else if constexpr (sizeof(T) == 4) { //float
float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS); float xofs_frac = float(src_xofs_frac) / (1 << FRAC_BITS);
@ -982,7 +1104,7 @@ static float _lanczos(float p_x) {
return Math::abs(p_x) >= LANCZOS_TYPE ? 0 : Math::sincn(p_x) * Math::sincn(p_x / LANCZOS_TYPE); return Math::abs(p_x) >= LANCZOS_TYPE ? 0 : Math::sincn(p_x) * Math::sincn(p_x / LANCZOS_TYPE);
} }
template <int CC, typename T> template <int CC, typename T, ImageScaleType TYPE>
static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) { static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst, uint32_t p_src_width, uint32_t p_src_height, uint32_t p_dst_width, uint32_t p_dst_height) {
int32_t src_width = p_src_width; int32_t src_width = p_src_width;
int32_t src_height = p_src_height; int32_t src_height = p_src_height;
@ -1023,7 +1145,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
const T *__restrict src_data = ((const T *)p_src) + (buffer_y * src_width + target_x) * CC; const T *__restrict src_data = ((const T *)p_src) + (buffer_y * src_width + target_x) * CC;
for (uint32_t i = 0; i < CC; i++) { for (uint32_t i = 0; i < CC; i++) {
if constexpr (sizeof(T) == 2) { //half float if constexpr (sizeof(T) == 2 && TYPE == IMAGE_SCALING_FLOAT) { //half float
pixel[i] += Math::half_to_float(src_data[i]) * lanczos_val; pixel[i] += Math::half_to_float(src_data[i]) * lanczos_val;
} else { } else {
pixel[i] += src_data[i] * lanczos_val; pixel[i] += src_data[i] * lanczos_val;
@ -1082,8 +1204,13 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
if constexpr (sizeof(T) == 1) { //byte if constexpr (sizeof(T) == 1) { //byte
dst_data[i] = CLAMP(Math::fast_ftoi(pixel[i]), 0, 255); dst_data[i] = CLAMP(Math::fast_ftoi(pixel[i]), 0, 255);
} else if constexpr (sizeof(T) == 2) { //half float } else if constexpr (sizeof(T) == 2) {
if constexpr (TYPE == IMAGE_SCALING_FLOAT) { //half float
dst_data[i] = Math::make_half_float(pixel[i]); dst_data[i] = Math::make_half_float(pixel[i]);
} else { //uint16
dst_data[i] = CLAMP(Math::fast_ftoi(pixel[i]), 0, 65535);
}
} else { // float } else { // float
dst_data[i] = pixel[i]; dst_data[i] = pixel[i];
} }
@ -1226,6 +1353,21 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
_scale_nearest<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_nearest<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_R16 && format <= FORMAT_RGBA16I) {
switch (get_format_pixel_size(format)) {
case 2:
_scale_nearest<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_nearest<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_nearest<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_nearest<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} }
} break; } break;
@ -1270,46 +1412,61 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) { if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 1: case 1:
_scale_bilinear<1, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<1, uint8_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 2: case 2:
_scale_bilinear<2, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<2, uint8_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 3: case 3:
_scale_bilinear<3, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<3, uint8_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 4: case 4:
_scale_bilinear<4, uint8_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<4, uint8_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) { } else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 4: case 4:
_scale_bilinear<1, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<1, float, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 8: case 8:
_scale_bilinear<2, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<2, float, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 12: case 12:
_scale_bilinear<3, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<3, float, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 16: case 16:
_scale_bilinear<4, float>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<4, float, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) { } else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 2: case 2:
_scale_bilinear<1, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<1, uint16_t, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 4: case 4:
_scale_bilinear<2, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<2, uint16_t, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 6: case 6:
_scale_bilinear<3, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<3, uint16_t, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
case 8: case 8:
_scale_bilinear<4, uint16_t>(src_ptr, w_ptr, src_width, src_height, p_width, p_height); _scale_bilinear<4, uint16_t, IMAGE_SCALING_FLOAT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
}
} else if (format >= FORMAT_R16 && format <= FORMAT_RGBA16I) {
switch (get_format_pixel_size(format)) {
case 2:
_scale_bilinear<1, uint16_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 4:
_scale_bilinear<2, uint16_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 6:
_scale_bilinear<3, uint16_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break;
case 8:
_scale_bilinear<4, uint16_t, IMAGE_SCALING_INT>(src_ptr, w_ptr, src_width, src_height, p_width, p_height);
break; break;
} }
} }
@ -1326,46 +1483,61 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) { if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 1: case 1:
_scale_cubic<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<1, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 2: case 2:
_scale_cubic<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<2, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 3: case 3:
_scale_cubic<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<3, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 4: case 4:
_scale_cubic<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<4, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) { } else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 4: case 4:
_scale_cubic<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<1, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 8: case 8:
_scale_cubic<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<2, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 12: case 12:
_scale_cubic<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<3, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 16: case 16:
_scale_cubic<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<4, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) { } else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 2: case 2:
_scale_cubic<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<1, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 4: case 4:
_scale_cubic<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<2, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 6: case 6:
_scale_cubic<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<3, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 8: case 8:
_scale_cubic<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_cubic<4, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_R16 && format <= FORMAT_RGBA16I) {
switch (get_format_pixel_size(format)) {
case 2:
_scale_cubic<1, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_cubic<2, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_cubic<3, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_cubic<4, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} }
@ -1374,46 +1546,61 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) { if (format >= FORMAT_L8 && format <= FORMAT_RGBA8) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 1: case 1:
_scale_lanczos<1, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<1, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 2: case 2:
_scale_lanczos<2, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<2, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 3: case 3:
_scale_lanczos<3, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<3, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 4: case 4:
_scale_lanczos<4, uint8_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<4, uint8_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) { } else if (format >= FORMAT_RF && format <= FORMAT_RGBAF) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 4: case 4:
_scale_lanczos<1, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<1, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 8: case 8:
_scale_lanczos<2, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<2, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 12: case 12:
_scale_lanczos<3, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<3, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 16: case 16:
_scale_lanczos<4, float>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<4, float, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) { } else if (format >= FORMAT_RH && format <= FORMAT_RGBAH) {
switch (get_format_pixel_size(format)) { switch (get_format_pixel_size(format)) {
case 2: case 2:
_scale_lanczos<1, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<1, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 4: case 4:
_scale_lanczos<2, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<2, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 6: case 6:
_scale_lanczos<3, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<3, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
case 8: case 8:
_scale_lanczos<4, uint16_t>(r_ptr, w_ptr, width, height, p_width, p_height); _scale_lanczos<4, uint16_t, IMAGE_SCALING_FLOAT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
}
} else if (format >= FORMAT_R16 && format <= FORMAT_RGBA16I) {
switch (get_format_pixel_size(format)) {
case 2:
_scale_lanczos<1, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 4:
_scale_lanczos<2, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 6:
_scale_lanczos<3, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break;
case 8:
_scale_lanczos<4, uint16_t, IMAGE_SCALING_INT>(r_ptr, w_ptr, width, height, p_width, p_height);
break; break;
} }
} }
@ -1782,7 +1969,7 @@ static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint3
average_func(dst_ptr[j], rup_ptr[j], rup_ptr[j + right_step], rdown_ptr[j], rdown_ptr[j + right_step]); average_func(dst_ptr[j], rup_ptr[j], rup_ptr[j + right_step], rdown_ptr[j], rdown_ptr[j + right_step]);
} }
if (renormalize) { if constexpr (renormalize) {
renormalize_func(dst_ptr); renormalize_func(dst_ptr);
} }
@ -1828,6 +2015,12 @@ void Image::_generate_mipmap_from_format(Image::Format p_format, const uint8_t *
_generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(p_src, p_dst, p_width, p_height); _generate_po2_mipmap<uint8_t, 4, false, Image::average_4_uint8, Image::renormalize_uint8>(p_src, p_dst, p_width, p_height);
} }
} break; } break;
case Image::FORMAT_RGBA4444: {
_generate_po2_mipmap<uint16_t, 1, false, Image::average_4_rgba4444, nullptr>(src_u16, dst_u16, p_width, p_height);
} break;
case Image::FORMAT_RGB565: {
_generate_po2_mipmap<uint16_t, 1, false, Image::average_4_rgb565, nullptr>(src_u16, dst_u16, p_width, p_height);
} break;
case Image::FORMAT_RF: case Image::FORMAT_RF:
_generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(src_float, dst_float, p_width, p_height); _generate_po2_mipmap<float, 1, false, Image::average_4_float, Image::renormalize_float>(src_float, dst_float, p_width, p_height);
break; break;
@ -1869,8 +2062,32 @@ void Image::_generate_mipmap_from_format(Image::Format p_format, const uint8_t *
} }
} break; } break;
case Image::FORMAT_RGBE9995: case Image::FORMAT_RGBE9995:
_generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(src_u32, dst_u32, p_width, p_height); _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, nullptr>(src_u32, dst_u32, p_width, p_height);
break; break;
case Image::FORMAT_R16:
case Image::FORMAT_R16I:
_generate_po2_mipmap<uint16_t, 1, false, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
break;
case Image::FORMAT_RG16:
case Image::FORMAT_RG16I:
_generate_po2_mipmap<uint16_t, 2, false, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
break;
case Image::FORMAT_RGB16:
case Image::FORMAT_RGB16I: {
if (p_renormalize) {
_generate_po2_mipmap<uint16_t, 3, true, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
} else {
_generate_po2_mipmap<uint16_t, 3, false, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
}
} break;
case Image::FORMAT_RGBA16:
case Image::FORMAT_RGBA16I: {
if (p_renormalize) {
_generate_po2_mipmap<uint16_t, 4, true, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
} else {
_generate_po2_mipmap<uint16_t, 4, false, Image::average_4_uint16, Image::renormalize_uint16>(src_u16, dst_u16, p_width, p_height);
}
} break;
default: default:
return; return;
@ -1930,7 +2147,6 @@ void Image::normalize() {
Error Image::generate_mipmaps(bool p_renormalize) { Error Image::generate_mipmaps(bool p_renormalize) {
ERR_FAIL_COND_V_MSG(is_compressed(), ERR_UNAVAILABLE, "Cannot generate mipmaps from compressed image formats."); ERR_FAIL_COND_V_MSG(is_compressed(), ERR_UNAVAILABLE, "Cannot generate mipmaps from compressed image formats.");
ERR_FAIL_COND_V_MSG(format == FORMAT_RGBA4444, ERR_UNAVAILABLE, "Cannot generate mipmaps from RGBA4444 format.");
ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0."); ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0.");
int gen_mipmap_count; int gen_mipmap_count;
@ -2468,6 +2684,17 @@ bool Image::is_invisible() const {
} }
} }
} break; } break;
case FORMAT_RGBA16:
case FORMAT_RGBA16I: {
const int pixel_count = len / 8;
const uint16_t *pixeldata = reinterpret_cast<const uint16_t *>(data.ptr());
for (int i = 0; i < pixel_count; i++) {
if (pixeldata[i * 4 + 3] != 0) {
return false;
}
}
} break;
default: { default: {
// Formats that are compressed or don't support alpha channels are presumed to be visible. // Formats that are compressed or don't support alpha channels are presumed to be visible.
return false; return false;
@ -2671,7 +2898,7 @@ bool Image::is_compressed() const {
} }
bool Image::is_format_compressed(Format p_format) { bool Image::is_format_compressed(Format p_format) {
return p_format > FORMAT_RGBE9995; return p_format > FORMAT_RGBE9995 && p_format < FORMAT_R16;
} }
Error Image::decompress() { Error Image::decompress() {
@ -2902,20 +3129,17 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const P
int pixel_size = get_format_pixel_size(format); int pixel_size = get_format_pixel_size(format);
// If the rect width is equivalent for both src and dst and the x offset is 0, we can blit in a single memcpy.
// Else, we do a per-line copy.
if ((dest_rect.size.x == p_src->width) && (p_src->width == width) && (dest_rect.position.x == 0) && (src_rect.position.x == 0)) {
const uint8_t *src = &src_data_ptr[(src_rect.position.y * p_src->width) * pixel_size];
uint8_t *dst = &dst_data_ptr[(dest_rect.position.y * width) * pixel_size];
memcpy(dst, src, width * dest_rect.size.y * pixel_size);
} else {
for (int i = 0; i < dest_rect.size.y; i++) { for (int i = 0; i < dest_rect.size.y; i++) {
for (int j = 0; j < dest_rect.size.x; j++) { const uint8_t *src = &src_data_ptr[((src_rect.position.y + i) * p_src->width + src_rect.position.x) * pixel_size];
int src_x = src_rect.position.x + j; uint8_t *dst = &dst_data_ptr[((dest_rect.position.y + i) * width + dest_rect.position.x) * pixel_size];
int src_y = src_rect.position.y + i; memcpy(dst, src, pixel_size * dest_rect.size.x);
int dst_x = dest_rect.position.x + j;
int dst_y = dest_rect.position.y + i;
const uint8_t *src = &src_data_ptr[(src_y * p_src->width + src_x) * pixel_size];
uint8_t *dst = &dst_data_ptr[(dst_y * width + dst_x) * pixel_size];
for (int k = 0; k < pixel_size; k++) {
dst[k] = src[k];
}
} }
} }
} }
@ -3071,13 +3295,13 @@ void Image::fill(const Color &p_color) {
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill in compressed image formats."); ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill in compressed image formats.");
uint8_t *dst_data_ptr = data.ptrw(); uint8_t *dst_data_ptr = data.ptrw();
int pixel_size = get_format_pixel_size(format); int pixel_size = get_format_pixel_size(format);
int64_t pixel_count = data.size() / pixel_size;
// Put first pixel with the format-aware API. // Put first pixel with the format-aware API.
_set_color_at_ofs(dst_data_ptr, 0, p_color); _set_color_at_ofs(dst_data_ptr, 0, p_color);
_repeat_pixel_over_subsequent_memory(dst_data_ptr, pixel_size, width * height); _repeat_pixel_over_subsequent_memory(dst_data_ptr, pixel_size, pixel_count);
} }
void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) { void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) {
@ -3157,6 +3381,42 @@ void Image::_copy_internals_from(const Image &p_image) {
data = p_image.data; data = p_image.data;
} }
_FORCE_INLINE_ Color color_from_rgba4444(uint16_t p_col) {
float r = ((p_col >> 12) & 0xF) / 15.0;
float g = ((p_col >> 8) & 0xF) / 15.0;
float b = ((p_col >> 4) & 0xF) / 15.0;
float a = (p_col & 0xF) / 15.0;
return Color(r, g, b, a);
}
_FORCE_INLINE_ uint16_t color_to_rgba4444(Color p_col) {
uint16_t rgba = 0;
rgba = uint16_t(CLAMP(p_col.r * 15.0, 0, 15)) << 12;
rgba |= uint16_t(CLAMP(p_col.g * 15.0, 0, 15)) << 8;
rgba |= uint16_t(CLAMP(p_col.b * 15.0, 0, 15)) << 4;
rgba |= uint16_t(CLAMP(p_col.a * 15.0, 0, 15));
return rgba;
}
_FORCE_INLINE_ Color color_from_rgb565(uint16_t p_col) {
float r = ((p_col >> 11) & 0x1F) / 31.0;
float g = ((p_col >> 5) & 0x3F) / 63.0;
float b = (p_col & 0x1F) / 31.0;
return Color(r, g, b, 1.0);
}
_FORCE_INLINE_ uint16_t color_to_rgb565(Color p_col) {
uint16_t rgba = 0;
rgba = uint16_t(CLAMP(p_col.r * 31.0, 0, 31)) << 11;
rgba |= uint16_t(CLAMP(p_col.g * 63.0, 0, 63)) << 5;
rgba |= uint16_t(CLAMP(p_col.b * 31.0, 0, 31));
return rgba;
}
Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const { Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
switch (format) { switch (format) {
case FORMAT_L8: { case FORMAT_L8: {
@ -3191,19 +3451,10 @@ Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
return Color(r, g, b, a); return Color(r, g, b, a);
} }
case FORMAT_RGBA4444: { case FORMAT_RGBA4444: {
uint16_t u = ((uint16_t *)ptr)[ofs]; return color_from_rgba4444(((uint16_t *)ptr)[ofs]);
float r = ((u >> 12) & 0xF) / 15.0;
float g = ((u >> 8) & 0xF) / 15.0;
float b = ((u >> 4) & 0xF) / 15.0;
float a = (u & 0xF) / 15.0;
return Color(r, g, b, a);
} }
case FORMAT_RGB565: { case FORMAT_RGB565: {
uint16_t u = ((uint16_t *)ptr)[ofs]; return color_from_rgb565(((uint16_t *)ptr)[ofs]);
float r = ((u >> 11) & 0x1F) / 31.0;
float g = ((u >> 5) & 0x3F) / 63.0;
float b = (u & 0x1F) / 31.0;
return Color(r, g, b, 1.0);
} }
case FORMAT_RF: { case FORMAT_RF: {
float r = ((float *)ptr)[ofs]; float r = ((float *)ptr)[ofs];
@ -3252,6 +3503,50 @@ Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
case FORMAT_RGBE9995: { case FORMAT_RGBE9995: {
return Color::from_rgbe9995(((uint32_t *)ptr)[ofs]); return Color::from_rgbe9995(((uint32_t *)ptr)[ofs]);
} }
case FORMAT_R16: {
float r = ((uint16_t *)ptr)[ofs] / 65535.0f;
return Color(r, 0, 0, 1);
}
case FORMAT_RG16: {
float r = ((uint16_t *)ptr)[ofs * 2 + 0] / 65535.0f;
float g = ((uint16_t *)ptr)[ofs * 2 + 1] / 65535.0f;
return Color(r, g, 0, 1);
}
case FORMAT_RGB16: {
float r = ((uint16_t *)ptr)[ofs * 3 + 0] / 65535.0f;
float g = ((uint16_t *)ptr)[ofs * 3 + 1] / 65535.0f;
float b = ((uint16_t *)ptr)[ofs * 3 + 2] / 65535.0f;
return Color(r, g, b, 1);
}
case FORMAT_RGBA16: {
float r = ((uint16_t *)ptr)[ofs * 4 + 0] / 65535.0f;
float g = ((uint16_t *)ptr)[ofs * 4 + 1] / 65535.0f;
float b = ((uint16_t *)ptr)[ofs * 4 + 2] / 65535.0f;
float a = ((uint16_t *)ptr)[ofs * 4 + 3] / 65535.0f;
return Color(r, g, b, a);
}
case FORMAT_R16I: {
uint16_t r = ((uint16_t *)ptr)[ofs];
return Color(r, 0, 0, 1);
}
case FORMAT_RG16I: {
uint16_t r = ((uint16_t *)ptr)[ofs * 2 + 0];
uint16_t g = ((uint16_t *)ptr)[ofs * 2 + 1];
return Color(r, g, 0, 1);
}
case FORMAT_RGB16I: {
uint16_t r = ((uint16_t *)ptr)[ofs * 3 + 0];
uint16_t g = ((uint16_t *)ptr)[ofs * 3 + 1];
uint16_t b = ((uint16_t *)ptr)[ofs * 3 + 2];
return Color(r, g, b, 1);
}
case FORMAT_RGBA16I: {
uint16_t r = ((uint16_t *)ptr)[ofs * 4 + 0];
uint16_t g = ((uint16_t *)ptr)[ofs * 4 + 1];
uint16_t b = ((uint16_t *)ptr)[ofs * 4 + 2];
uint16_t a = ((uint16_t *)ptr)[ofs * 4 + 3];
return Color(r, g, b, a);
}
default: { default: {
ERR_FAIL_V_MSG(Color(), "Can't get_pixel() on compressed image, sorry."); ERR_FAIL_V_MSG(Color(), "Can't get_pixel() on compressed image, sorry.");
@ -3287,23 +3582,10 @@ void Image::_set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color)
ptr[ofs * 4 + 3] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255)); ptr[ofs * 4 + 3] = uint8_t(CLAMP(p_color.a * 255.0, 0, 255));
} break; } break;
case FORMAT_RGBA4444: { case FORMAT_RGBA4444: {
uint16_t rgba = 0; ((uint16_t *)ptr)[ofs] = color_to_rgba4444(p_color);
rgba = uint16_t(CLAMP(p_color.r * 15.0, 0, 15)) << 12;
rgba |= uint16_t(CLAMP(p_color.g * 15.0, 0, 15)) << 8;
rgba |= uint16_t(CLAMP(p_color.b * 15.0, 0, 15)) << 4;
rgba |= uint16_t(CLAMP(p_color.a * 15.0, 0, 15));
((uint16_t *)ptr)[ofs] = rgba;
} break; } break;
case FORMAT_RGB565: { case FORMAT_RGB565: {
uint16_t rgba = 0; ((uint16_t *)ptr)[ofs] = color_to_rgb565(p_color);
rgba = uint16_t(CLAMP(p_color.r * 31.0, 0, 31)) << 11;
rgba |= uint16_t(CLAMP(p_color.g * 63.0, 0, 63)) << 5;
rgba |= uint16_t(CLAMP(p_color.b * 31.0, 0, 31));
((uint16_t *)ptr)[ofs] = rgba;
} break; } break;
case FORMAT_RF: { case FORMAT_RF: {
((float *)ptr)[ofs] = p_color.r; ((float *)ptr)[ofs] = p_color.r;
@ -3344,6 +3626,42 @@ void Image::_set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color)
case FORMAT_RGBE9995: { case FORMAT_RGBE9995: {
((uint32_t *)ptr)[ofs] = p_color.to_rgbe9995(); ((uint32_t *)ptr)[ofs] = p_color.to_rgbe9995();
} break; } break;
case FORMAT_R16: {
((uint16_t *)ptr)[ofs] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
} break;
case FORMAT_RG16: {
((uint16_t *)ptr)[ofs * 2 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 2 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
} break;
case FORMAT_RGB16: {
((uint16_t *)ptr)[ofs * 3 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 3 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 3 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
} break;
case FORMAT_RGBA16: {
((uint16_t *)ptr)[ofs * 4 + 0] = uint16_t(CLAMP(p_color.r * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 1] = uint16_t(CLAMP(p_color.g * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 2] = uint16_t(CLAMP(p_color.b * 65535.0, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 3] = uint16_t(CLAMP(p_color.a * 65535.0, 0, 65535));
} break;
case FORMAT_R16I: {
((uint16_t *)ptr)[ofs] = uint16_t(CLAMP(p_color.r, 0, 65535));
} break;
case FORMAT_RG16I: {
((uint16_t *)ptr)[ofs * 2 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
((uint16_t *)ptr)[ofs * 2 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
} break;
case FORMAT_RGB16I: {
((uint16_t *)ptr)[ofs * 3 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
((uint16_t *)ptr)[ofs * 3 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
((uint16_t *)ptr)[ofs * 3 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
} break;
case FORMAT_RGBA16I: {
((uint16_t *)ptr)[ofs * 4 + 0] = uint16_t(CLAMP(p_color.r, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 1] = uint16_t(CLAMP(p_color.g, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 2] = uint16_t(CLAMP(p_color.b, 0, 65535));
((uint16_t *)ptr)[ofs * 4 + 3] = uint16_t(CLAMP(p_color.a, 0, 65535));
} break;
default: { default: {
ERR_FAIL_MSG("Can't set_pixel() on compressed image, sorry."); ERR_FAIL_MSG("Can't set_pixel() on compressed image, sorry.");
@ -3419,11 +3737,11 @@ Image::UsedChannels Image::detect_used_channels(CompressSource p_source) const {
if (format == FORMAT_L8) { if (format == FORMAT_L8) {
return USED_CHANNELS_L; // Grayscale only cannot have any channel less. return USED_CHANNELS_L; // Grayscale only cannot have any channel less.
} else if (format == FORMAT_R8 || format == FORMAT_RH || format == FORMAT_RF) { } else if (format == FORMAT_R8 || format == FORMAT_RH || format == FORMAT_RF || format == FORMAT_R16 || format == FORMAT_R16I) {
return USED_CHANNELS_R; // Red only cannot have any channel less. return USED_CHANNELS_R; // Red only cannot have any channel less.
} }
const bool supports_alpha = format == FORMAT_RGBA8 || format == FORMAT_RGBA4444 || format == FORMAT_RGBAH || format == FORMAT_RGBAF; const bool supports_alpha = format == FORMAT_RGBA8 || format == FORMAT_RGBA4444 || format == FORMAT_RGBAH || format == FORMAT_RGBAF || format == FORMAT_RGBA16 || format == FORMAT_RGBA16I;
bool r = false, g = false, b = false, a = false, c = false; bool r = false, g = false, b = false, a = false, c = false;
const uint8_t *data_ptr = data.ptr(); const uint8_t *data_ptr = data.ptr();
@ -3657,6 +3975,14 @@ void Image::_bind_methods() {
BIND_ENUM_CONSTANT(FORMAT_ASTC_4x4_HDR); BIND_ENUM_CONSTANT(FORMAT_ASTC_4x4_HDR);
BIND_ENUM_CONSTANT(FORMAT_ASTC_8x8); BIND_ENUM_CONSTANT(FORMAT_ASTC_8x8);
BIND_ENUM_CONSTANT(FORMAT_ASTC_8x8_HDR); BIND_ENUM_CONSTANT(FORMAT_ASTC_8x8_HDR);
BIND_ENUM_CONSTANT(FORMAT_R16);
BIND_ENUM_CONSTANT(FORMAT_RG16);
BIND_ENUM_CONSTANT(FORMAT_RGB16);
BIND_ENUM_CONSTANT(FORMAT_RGBA16);
BIND_ENUM_CONSTANT(FORMAT_R16I);
BIND_ENUM_CONSTANT(FORMAT_RG16I);
BIND_ENUM_CONSTANT(FORMAT_RGB16I);
BIND_ENUM_CONSTANT(FORMAT_RGBA16I);
BIND_ENUM_CONSTANT(FORMAT_MAX); BIND_ENUM_CONSTANT(FORMAT_MAX);
BIND_ENUM_CONSTANT(INTERPOLATE_NEAREST); BIND_ENUM_CONSTANT(INTERPOLATE_NEAREST);
@ -4070,6 +4396,22 @@ uint32_t Image::get_format_component_mask(Format p_format) {
return rgba; return rgba;
case FORMAT_ASTC_8x8_HDR: case FORMAT_ASTC_8x8_HDR:
return rgba; return rgba;
case FORMAT_R16:
return r;
case FORMAT_RG16:
return rg;
case FORMAT_RGB16:
return rgb;
case FORMAT_RGBA16:
return rgba;
case FORMAT_R16I:
return r;
case FORMAT_RG16I:
return rg;
case FORMAT_RGB16I:
return rgb;
case FORMAT_RGBA16I:
return rgba;
default: default:
ERR_PRINT("Unhandled format."); ERR_PRINT("Unhandled format.");
return rgba; return rgba;
@ -4213,6 +4555,18 @@ void Image::average_4_rgbe9995(uint32_t &p_out, const uint32_t &p_a, const uint3
p_out = ((Color::from_rgbe9995(p_a) + Color::from_rgbe9995(p_b) + Color::from_rgbe9995(p_c) + Color::from_rgbe9995(p_d)) * 0.25f).to_rgbe9995(); p_out = ((Color::from_rgbe9995(p_a) + Color::from_rgbe9995(p_b) + Color::from_rgbe9995(p_c) + Color::from_rgbe9995(p_d)) * 0.25f).to_rgbe9995();
} }
void Image::average_4_uint16(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d) {
p_out = static_cast<uint16_t>((p_a + p_b + p_c + p_d + 2) >> 2);
}
void Image::average_4_rgba4444(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d) {
p_out = color_to_rgba4444((color_from_rgba4444(p_a) + color_from_rgba4444(p_b) + color_from_rgba4444(p_c) + color_from_rgba4444(p_d)) * 0.25f);
}
void Image::average_4_rgb565(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d) {
p_out = color_to_rgb565((color_from_rgb565(p_a) + color_from_rgb565(p_b) + color_from_rgb565(p_c) + color_from_rgb565(p_d)) * 0.25f);
}
void Image::renormalize_uint8(uint8_t *p_rgb) { void Image::renormalize_uint8(uint8_t *p_rgb) {
Vector3 n(p_rgb[0] / 255.0, p_rgb[1] / 255.0, p_rgb[2] / 255.0); Vector3 n(p_rgb[0] / 255.0, p_rgb[1] / 255.0, p_rgb[2] / 255.0);
n *= 2.0; n *= 2.0;
@ -4242,8 +4596,17 @@ void Image::renormalize_half(uint16_t *p_rgb) {
p_rgb[2] = Math::make_half_float(n.z); p_rgb[2] = Math::make_half_float(n.z);
} }
void Image::renormalize_rgbe9995(uint32_t *p_rgb) { void Image::renormalize_uint16(uint16_t *p_rgb) {
// Never used. Vector3 n(p_rgb[0] / 65535.0, p_rgb[1] / 65535.0, p_rgb[2] / 65535.0);
n *= 2.0;
n -= Vector3(1, 1, 1);
n.normalize();
n += Vector3(1, 1, 1);
n *= 0.5;
n *= 65535;
p_rgb[0] = CLAMP(int(n.x), 0, 65535);
p_rgb[1] = CLAMP(int(n.y), 0, 65535);
p_rgb[2] = CLAMP(int(n.z), 0, 65535);
} }
Image::Image(const uint8_t *p_mem_png_jpg, int p_len) { Image::Image(const uint8_t *p_mem_png_jpg, int p_len) {

View file

@ -111,6 +111,14 @@ public:
FORMAT_ASTC_4x4_HDR, FORMAT_ASTC_4x4_HDR,
FORMAT_ASTC_8x8, FORMAT_ASTC_8x8,
FORMAT_ASTC_8x8_HDR, FORMAT_ASTC_8x8_HDR,
FORMAT_R16,
FORMAT_RG16,
FORMAT_RGB16,
FORMAT_RGBA16,
FORMAT_R16I,
FORMAT_RG16I,
FORMAT_RGB16I,
FORMAT_RGBA16I,
FORMAT_MAX FORMAT_MAX
}; };
@ -282,10 +290,14 @@ private:
static void average_4_float(float &p_out, const float &p_a, const float &p_b, const float &p_c, const float &p_d); static void average_4_float(float &p_out, const float &p_a, const float &p_b, const float &p_c, const float &p_d);
static void average_4_half(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d); static void average_4_half(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
static void average_4_rgbe9995(uint32_t &p_out, const uint32_t &p_a, const uint32_t &p_b, const uint32_t &p_c, const uint32_t &p_d); static void average_4_rgbe9995(uint32_t &p_out, const uint32_t &p_a, const uint32_t &p_b, const uint32_t &p_c, const uint32_t &p_d);
static void average_4_uint16(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
static void average_4_rgba4444(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
static void average_4_rgb565(uint16_t &p_out, const uint16_t &p_a, const uint16_t &p_b, const uint16_t &p_c, const uint16_t &p_d);
static void renormalize_uint8(uint8_t *p_rgb); static void renormalize_uint8(uint8_t *p_rgb);
static void renormalize_float(float *p_rgb); static void renormalize_float(float *p_rgb);
static void renormalize_half(uint16_t *p_rgb); static void renormalize_half(uint16_t *p_rgb);
static void renormalize_rgbe9995(uint32_t *p_rgb); static void renormalize_uint16(uint16_t *p_rgb);
public: public:
int get_width() const; int get_width() const;

View file

@ -101,6 +101,8 @@ public:
}; };
class ResourceFormatLoaderImage : public ResourceFormatLoader { class ResourceFormatLoaderImage : public ResourceFormatLoader {
GDSOFTCLASS(ResourceFormatLoaderImage, ResourceFormatLoader);
public: public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override; virtual void get_recognized_extensions(List<String> *p_extensions) const override;

View file

@ -31,6 +31,7 @@
#include "json.h" #include "json.h"
#include "core/config/engine.h" #include "core/config/engine.h"
#include "core/io/file_access.h"
#include "core/object/script_language.h" #include "core/object/script_language.h"
#include "core/variant/container_type_validate.h" #include "core/variant/container_type_validate.h"
@ -82,11 +83,18 @@ void JSON::_stringify(String &r_result, const Variant &p_var, const String &p_in
return; return;
} }
if (p_full_precision) {
const String num_sci = String::num_scientific(num);
if (num_sci.contains_char('.') || num_sci.contains_char('e')) {
r_result += num_sci;
} else {
r_result += num_sci + ".0";
}
} else {
const double magnitude = std::log10(Math::abs(num)); const double magnitude = std::log10(Math::abs(num));
const int total_digits = p_full_precision ? 17 : 14; const int precision = MAX(1, 14 - (int)Math::floor(magnitude));
const int precision = MAX(1, total_digits - (int)Math::floor(magnitude));
r_result += String::num(num, precision); r_result += String::num(num, precision);
}
return; return;
} }
case Variant::PACKED_INT32_ARRAY: case Variant::PACKED_INT32_ARRAY:

View file

@ -107,6 +107,8 @@ public:
}; };
class ResourceFormatLoaderJSON : public ResourceFormatLoader { class ResourceFormatLoaderJSON : public ResourceFormatLoader {
GDSOFTCLASS(ResourceFormatLoaderJSON, ResourceFormatLoader);
public: public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override; virtual void get_recognized_extensions(List<String> *p_extensions) const override;
@ -119,6 +121,8 @@ public:
}; };
class ResourceFormatSaverJSON : public ResourceFormatSaver { class ResourceFormatSaverJSON : public ResourceFormatSaver {
GDSOFTCLASS(ResourceFormatSaverJSON, ResourceFormatSaver);
public: public:
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override; virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;

View file

@ -32,6 +32,8 @@
#include "core/core_globals.h" #include "core/core_globals.h"
#include "core/io/dir_access.h" #include "core/io/dir_access.h"
#include "core/io/file_access.h"
#include "core/object/script_backtrace.h"
#include "core/os/time.h" #include "core/os/time.h"
#include "core/templates/rb_set.h" #include "core/templates/rb_set.h"

View file

@ -30,14 +30,15 @@
#pragma once #pragma once
#include "core/io/file_access.h" #include "core/object/ref_counted.h"
#include "core/object/script_backtrace.h"
#include "core/string/ustring.h" #include "core/string/ustring.h"
#include "core/templates/vector.h" #include "core/templates/vector.h"
#include <cstdarg> #include <cstdarg>
class FileAccess;
class RegEx; class RegEx;
class ScriptBacktrace;
class Logger { class Logger {
protected: protected:

View file

@ -34,6 +34,8 @@
#include "core/object/ref_counted.h" #include "core/object/ref_counted.h"
class NetSocket : public RefCounted { class NetSocket : public RefCounted {
GDSOFTCLASS(NetSocket, RefCounted);
protected: protected:
static NetSocket *(*_create)(); static NetSocket *(*_create)();
@ -52,21 +54,61 @@ public:
TYPE_UDP, TYPE_UDP,
}; };
virtual Error open(Type p_type, IP::Type &ip_type) = 0; enum class Family {
NONE,
INET,
UNIX,
};
class Address {
Family _family = Family::NONE;
CharString _path;
IPAddress _ip;
uint16_t _port = 0;
public:
_FORCE_INLINE_ Family get_family() const { return _family; }
_FORCE_INLINE_ bool is_inet() const { return _family == Family::INET; }
_FORCE_INLINE_ bool is_unix() const { return _family == Family::UNIX; }
_FORCE_INLINE_ bool is_valid() const { return is_inet() || is_unix(); }
_FORCE_INLINE_ const IPAddress &ip() const { return _ip; }
_FORCE_INLINE_ const uint16_t &port() const { return _port; }
_FORCE_INLINE_ const CharString &get_path() const { return _path; }
Address() {}
Address(const IPAddress &p_addr, uint16_t p_port) :
_family(Family::INET) {
_ip = p_addr;
_port = p_port;
}
Address(const String &p_path) :
_family(Family::UNIX), _path(p_path.utf8()) {
}
Address(const CharString &p_path) :
_family(Family::UNIX), _path(p_path) {
}
};
virtual Error open(Family p_family, Type p_type, IP::Type &r_ip_type) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual Error bind(IPAddress p_addr, uint16_t p_port) = 0; virtual Error bind(Address p_addr) = 0;
virtual Error listen(int p_max_pending) = 0; virtual Error listen(int p_max_pending) = 0;
virtual Error connect_to_host(IPAddress p_addr, uint16_t p_port) = 0; virtual Error connect_to_host(Address p_addr) = 0;
virtual Error poll(PollType p_type, int timeout) const = 0; virtual Error poll(PollType p_type, int timeout) const = 0;
virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read) = 0; virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read) = 0;
virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IPAddress &r_ip, uint16_t &r_port, bool p_peek = false) = 0; virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IPAddress &r_ip, uint16_t &r_port, bool p_peek = false) = 0;
virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent) = 0; virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent) = 0;
virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IPAddress p_ip, uint16_t p_port) = 0; virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IPAddress p_ip, uint16_t p_port) = 0;
virtual Ref<NetSocket> accept(IPAddress &r_ip, uint16_t &r_port) = 0; virtual Ref<NetSocket> accept(Address &r_addr) = 0;
virtual bool is_open() const = 0; virtual bool is_open() const = 0;
virtual int get_available_bytes() const = 0; virtual int get_available_bytes() const = 0;
virtual Error get_socket_address(IPAddress *r_ip, uint16_t *r_port) const = 0; virtual Error get_socket_address(Address *r_addr) const = 0;
virtual Error set_broadcasting_enabled(bool p_enabled) = 0; // Returns OK if the socket option has been set successfully. virtual Error set_broadcasting_enabled(bool p_enabled) = 0; // Returns OK if the socket option has been set successfully.
virtual void set_blocking_enabled(bool p_enabled) = 0; virtual void set_blocking_enabled(bool p_enabled) = 0;

View file

@ -52,7 +52,7 @@ Error PacketPeerUDP::join_multicast_group(IPAddress p_multi_address, const Strin
if (!_sock->is_open()) { if (!_sock->is_open()) {
IP::Type ip_type = p_multi_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; IP::Type ip_type = p_multi_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
Error err = _sock->open(NetSocket::TYPE_UDP, ip_type); Error err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_UDP, ip_type);
ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(err != OK, err);
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
_sock->set_broadcasting_enabled(broadcast); _sock->set_broadcasting_enabled(broadcast);
@ -141,7 +141,7 @@ Error PacketPeerUDP::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
if (!_sock->is_open()) { if (!_sock->is_open()) {
IP::Type ip_type = peer_addr.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; IP::Type ip_type = peer_addr.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
err = _sock->open(NetSocket::TYPE_UDP, ip_type); err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_UDP, ip_type);
ERR_FAIL_COND_V(err != OK, err); ERR_FAIL_COND_V(err != OK, err);
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
_sock->set_broadcasting_enabled(broadcast); _sock->set_broadcasting_enabled(broadcast);
@ -186,7 +186,7 @@ Error PacketPeerUDP::bind(int p_port, const IPAddress &p_bind_address, int p_rec
ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
} }
err = _sock->open(NetSocket::TYPE_UDP, ip_type); err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_UDP, ip_type);
if (err != OK) { if (err != OK) {
return ERR_CANT_CREATE; return ERR_CANT_CREATE;
@ -194,7 +194,8 @@ Error PacketPeerUDP::bind(int p_port, const IPAddress &p_bind_address, int p_rec
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
_sock->set_broadcasting_enabled(broadcast); _sock->set_broadcasting_enabled(broadcast);
err = _sock->bind(p_bind_address, p_port); NetSocket::Address addr(p_bind_address, p_port);
err = _sock->bind(addr);
if (err != OK) { if (err != OK) {
_sock->close(); _sock->close();
@ -231,12 +232,13 @@ Error PacketPeerUDP::connect_to_host(const IPAddress &p_host, int p_port) {
if (!_sock->is_open()) { if (!_sock->is_open()) {
IP::Type ip_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; IP::Type ip_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
err = _sock->open(NetSocket::TYPE_UDP, ip_type); err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_UDP, ip_type);
ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN); ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN);
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
} }
err = _sock->connect_to_host(p_host, p_port); NetSocket::Address addr(p_host, p_port);
err = _sock->connect_to_host(addr);
// I see no reason why we should get ERR_BUSY (wouldblock/eagain) here. // I see no reason why we should get ERR_BUSY (wouldblock/eagain) here.
// This is UDP, so connect is only used to tell the OS to which socket // This is UDP, so connect is only used to tell the OS to which socket
@ -345,9 +347,9 @@ int PacketPeerUDP::get_packet_port() const {
} }
int PacketPeerUDP::get_local_port() const { int PacketPeerUDP::get_local_port() const {
uint16_t local_port; NetSocket::Address addr;
_sock->get_socket_address(nullptr, &local_port); _sock->get_socket_address(&addr);
return local_port; return addr.port();
} }
void PacketPeerUDP::set_dest_address(const IPAddress &p_address, int p_port) { void PacketPeerUDP::set_dest_address(const IPAddress &p_address, int p_port) {

View file

@ -37,6 +37,8 @@
class PListNode; class PListNode;
class PList : public RefCounted { class PList : public RefCounted {
GDSOFTCLASS(PList, RefCounted);
friend class PListNode; friend class PListNode;
public: public:

View file

@ -660,6 +660,10 @@ void Resource::reset_local_to_scene() {
// Restores the state as if setup_local_to_scene() hadn't been called. // Restores the state as if setup_local_to_scene() hadn't been called.
} }
String Resource::_to_string() {
return (name.is_empty() ? "" : String(name) + " ") + "(" + path_cache + "):" + Object::_to_string();
}
Node *(*Resource::_get_local_scene_func)() = nullptr; Node *(*Resource::_get_local_scene_func)() = nullptr;
void (*Resource::_update_configuration_warning)() = nullptr; void (*Resource::_update_configuration_warning)() = nullptr;
@ -758,7 +762,9 @@ void Resource::_bind_methods() {
} }
Resource::Resource() : Resource::Resource() :
remapped_list(this) {} remapped_list(this) {
_define_ancestry(AncestralClass::RESOURCE);
}
Resource::~Resource() { Resource::~Resource() {
if (unlikely(path_cache.is_empty())) { if (unlikely(path_cache.is_empty())) {

View file

@ -54,6 +54,8 @@ class Resource : public RefCounted {
GDCLASS(Resource, RefCounted); GDCLASS(Resource, RefCounted);
public: public:
static constexpr AncestralClass static_ancestral_class = AncestralClass::RESOURCE;
static void register_custom_data_to_otdb() { ClassDB::add_resource_base_extension("res", get_class_static()); } static void register_custom_data_to_otdb() { ClassDB::add_resource_base_extension("res", get_class_static()); }
virtual String get_base_extension() const { return "res"; } virtual String get_base_extension() const { return "res"; }
@ -120,6 +122,7 @@ protected:
GDVIRTUAL0(_reset_state); GDVIRTUAL0(_reset_state);
virtual Ref<Resource> _duplicate(const DuplicateParams &p_params) const; virtual Ref<Resource> _duplicate(const DuplicateParams &p_params) const;
virtual String _to_string() override;
public: public:
static Node *(*_get_local_scene_func)(); // Used by the editor. static Node *(*_get_local_scene_func)(); // Used by the editor.

View file

@ -33,6 +33,7 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/io/resource_loader.h" #include "core/io/resource_loader.h"
#include "core/io/resource_saver.h" #include "core/io/resource_saver.h"
#include "core/templates/rb_map.h"
class ResourceLoaderBinary { class ResourceLoaderBinary {
bool translation_remapped = false; bool translation_remapped = false;
@ -108,6 +109,8 @@ public:
}; };
class ResourceFormatLoaderBinary : public ResourceFormatLoader { class ResourceFormatLoaderBinary : public ResourceFormatLoader {
GDSOFTCLASS(ResourceFormatLoaderBinary, ResourceFormatLoader);
public: public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override; virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
@ -179,6 +182,8 @@ public:
}; };
class ResourceFormatSaverBinary : public ResourceFormatSaver { class ResourceFormatSaverBinary : public ResourceFormatSaver {
GDSOFTCLASS(ResourceFormatSaverBinary, ResourceFormatSaver);
public: public:
static inline ResourceFormatSaverBinary *singleton = nullptr; static inline ResourceFormatSaverBinary *singleton = nullptr;
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override; virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;

View file

@ -39,6 +39,8 @@ class ResourceFormatImporter;
typedef Ref<Resource> (*ResourceFormatImporterLoadOnStartup)(ResourceFormatImporter *p_importer, const String &p_path, Error *r_error, bool p_use_sub_threads, float *r_progress, ResourceFormatLoader::CacheMode p_cache_mode); typedef Ref<Resource> (*ResourceFormatImporterLoadOnStartup)(ResourceFormatImporter *p_importer, const String &p_path, Error *r_error, bool p_use_sub_threads, float *r_progress, ResourceFormatLoader::CacheMode p_cache_mode);
class ResourceFormatImporter : public ResourceFormatLoader { class ResourceFormatImporter : public ResourceFormatLoader {
GDSOFTCLASS(ResourceFormatImporter, ResourceFormatLoader);
struct PathAndType { struct PathAndType {
String path; String path;
String type; String type;

View file

@ -43,7 +43,7 @@
#include "core/string/translation_server.h" #include "core/string/translation_server.h"
#include "core/templates/rb_set.h" #include "core/templates/rb_set.h"
#include "core/variant/variant_parser.h" #include "core/variant/variant_parser.h"
#include "servers/rendering_server.h" #include "servers/rendering/rendering_server.h"
#ifdef DEBUG_LOAD_THREADED #ifdef DEBUG_LOAD_THREADED
#define print_lt(m_text) print_line(m_text) #define print_lt(m_text) print_line(m_text)
@ -174,7 +174,7 @@ Ref<Resource> ResourceFormatLoader::load(const String &p_path, const String &p_o
} }
} }
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Failed to load resource '%s'. ResourceFormatLoader::load was not implemented for this resource type.", p_path)); return Ref<Resource>();
} }
void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) { void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
@ -1465,8 +1465,8 @@ void ResourceLoader::add_custom_loaders() {
String custom_loader_base_class = ResourceFormatLoader::get_class_static(); String custom_loader_base_class = ResourceFormatLoader::get_class_static();
List<StringName> global_classes; LocalVector<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes); ScriptServer::get_global_class_list(global_classes);
for (const StringName &class_name : global_classes) { for (const StringName &class_name : global_classes) {
StringName base_class = ScriptServer::get_global_class_native_base(class_name); StringName base_class = ScriptServer::get_global_class_native_base(class_name);

View file

@ -70,7 +70,7 @@ protected:
GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary) GDVIRTUAL2RC(Error, _rename_dependencies, String, Dictionary)
GDVIRTUAL1RC(bool, _exists, String) GDVIRTUAL1RC(bool, _exists, String)
GDVIRTUAL4RC(Variant, _load, String, String, bool, int) GDVIRTUAL4RC_REQUIRED(Variant, _load, String, String, bool, int)
public: public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);

View file

@ -255,8 +255,8 @@ void ResourceSaver::add_custom_savers() {
String custom_saver_base_class = ResourceFormatSaver::get_class_static(); String custom_saver_base_class = ResourceFormatSaver::get_class_static();
List<StringName> global_classes; LocalVector<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes); ScriptServer::get_global_class_list(global_classes);
for (const StringName &class_name : global_classes) { for (const StringName &class_name : global_classes) {
StringName base_class = ScriptServer::get_global_class_native_base(class_name); StringName base_class = ScriptServer::get_global_class_native_base(class_name);

View file

@ -47,7 +47,7 @@ String ResourceUID::get_cache_file() {
} }
static constexpr uint8_t uuid_characters[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '0', '1', '2', '3', '4', '5', '6', '7', '8' }; static constexpr uint8_t uuid_characters[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '0', '1', '2', '3', '4', '5', '6', '7', '8' };
static constexpr uint32_t uuid_characters_element_count = std::size(uuid_characters); static constexpr uint32_t uuid_characters_element_count = std_size(uuid_characters);
static constexpr uint8_t max_uuid_number_length = 13; // Max 0x7FFFFFFFFFFFFFFF (uid://d4n4ub6itg400) size is 13 characters. static constexpr uint8_t max_uuid_number_length = 13; // Max 0x7FFFFFFFFFFFFFFF (uid://d4n4ub6itg400) size is 13 characters.
String ResourceUID::id_to_text(ID p_id) const { String ResourceUID::id_to_text(ID p_id) const {
@ -351,6 +351,7 @@ void ResourceUID::clear() {
unique_ids.clear(); unique_ids.clear();
changed = false; changed = false;
} }
void ResourceUID::_bind_methods() { void ResourceUID::_bind_methods() {
ClassDB::bind_method(D_METHOD("id_to_text", "id"), &ResourceUID::id_to_text); ClassDB::bind_method(D_METHOD("id_to_text", "id"), &ResourceUID::id_to_text);
ClassDB::bind_method(D_METHOD("text_to_id", "text_id"), &ResourceUID::text_to_id); ClassDB::bind_method(D_METHOD("text_to_id", "text_id"), &ResourceUID::text_to_id);

90
core/io/socket_server.cpp Normal file
View file

@ -0,0 +1,90 @@
/**************************************************************************/
/* socket_server.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "socket_server.h"
void SocketServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_connection_available"), &SocketServer::is_connection_available);
ClassDB::bind_method(D_METHOD("is_listening"), &SocketServer::is_listening);
ClassDB::bind_method(D_METHOD("stop"), &SocketServer::stop);
ClassDB::bind_method(D_METHOD("take_socket_connection"), &SocketServer::take_socket_connection);
}
Error SocketServer::_listen(const NetSocket::Address &p_addr) {
DEV_ASSERT(_sock.is_valid());
DEV_ASSERT(_sock->is_open());
_sock->set_blocking_enabled(false);
Error err = _sock->bind(p_addr);
if (err != OK) {
_sock->close();
return ERR_ALREADY_IN_USE;
}
err = _sock->listen(MAX_PENDING_CONNECTIONS);
if (err != OK) {
_sock->close();
return FAILED;
}
return OK;
}
bool SocketServer::is_listening() const {
ERR_FAIL_COND_V(_sock.is_null(), false);
return _sock->is_open();
}
bool SocketServer::is_connection_available() const {
ERR_FAIL_COND_V(_sock.is_null(), false);
if (!_sock->is_open()) {
return false;
}
Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
return (err == OK);
}
void SocketServer::stop() {
if (_sock.is_valid()) {
_sock->close();
}
}
SocketServer::SocketServer() :
_sock(NetSocket::create()) {
}
SocketServer::~SocketServer() {
stop();
}

77
core/io/socket_server.h Normal file
View file

@ -0,0 +1,77 @@
/**************************************************************************/
/* socket_server.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/io/net_socket.h"
#include "core/io/stream_peer_socket.h"
class SocketServer : public RefCounted {
GDCLASS(SocketServer, RefCounted);
protected:
enum {
MAX_PENDING_CONNECTIONS = 8,
};
Ref<NetSocket> _sock;
static void _bind_methods();
Error _listen(const NetSocket::Address &p_addr);
template <typename T>
Ref<T> _take_connection() {
Ref<T> conn;
if (!is_connection_available()) {
return conn;
}
Ref<NetSocket> ns;
NetSocket::Address addr;
ns = _sock->accept(addr);
if (ns.is_null()) {
return conn;
}
conn.instantiate();
conn->accept_socket(ns, addr);
return conn;
}
public:
bool is_listening() const;
bool is_connection_available() const;
virtual Ref<StreamPeerSocket> take_socket_connection() = 0;
void stop(); // Stop listening
SocketServer();
~SocketServer();
};

View file

@ -0,0 +1,52 @@
/**************************************************************************/
/* stream_peer_socket.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef DISABLE_DEPRECATED
namespace compat::StreamPeerTCP {
enum class Status {
STATUS_NONE = StreamPeerSocket::STATUS_NONE,
STATUS_CONNECTING = StreamPeerSocket::STATUS_CONNECTING,
STATUS_CONNECTED = StreamPeerSocket::STATUS_CONNECTED,
STATUS_ERROR = StreamPeerSocket::STATUS_ERROR,
};
}
VARIANT_ENUM_CAST(compat::StreamPeerTCP::Status);
compat::StreamPeerTCP::Status StreamPeerSocket::_get_status_compat_107954() const {
return (compat::StreamPeerTCP::Status)get_status();
}
void StreamPeerSocket::_bind_compatibility_methods() {
ClassDB::bind_compatibility_method(D_METHOD("get_status"), &StreamPeerSocket::_get_status_compat_107954);
}
#endif

View file

@ -0,0 +1,236 @@
/**************************************************************************/
/* stream_peer_socket.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "stream_peer_socket.h"
#include "stream_peer_socket.compat.inc"
Error StreamPeerSocket::poll() {
if (status == STATUS_CONNECTED) {
Error err;
err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
if (err == OK) {
// FIN received
if (_sock->get_available_bytes() == 0) {
disconnect_from_host();
return OK;
}
}
// Also poll write
err = _sock->poll(NetSocket::POLL_TYPE_IN_OUT, 0);
if (err != OK && err != ERR_BUSY) {
// Got an error
disconnect_from_host();
status = STATUS_ERROR;
return err;
}
return OK;
} else if (status != STATUS_CONNECTING) {
return OK;
}
Error err = _sock->connect_to_host(peer_address);
if (err == OK) {
status = STATUS_CONNECTED;
return OK;
} else if (err == ERR_BUSY) {
// Check for connect timeout
if (OS::get_singleton()->get_ticks_msec() > timeout) {
disconnect_from_host();
status = STATUS_ERROR;
return ERR_CONNECTION_ERROR;
}
// Still trying to connect
return OK;
}
disconnect_from_host();
status = STATUS_ERROR;
return ERR_CONNECTION_ERROR;
}
Error StreamPeerSocket::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
if (status != STATUS_CONNECTED) {
return FAILED;
}
Error err;
int data_to_send = p_bytes;
const uint8_t *offset = p_data;
int total_sent = 0;
while (data_to_send) {
int sent_amount = 0;
err = _sock->send(offset, data_to_send, sent_amount);
if (err != OK) {
if (err != ERR_BUSY) {
disconnect_from_host();
return FAILED;
}
if (!p_block) {
r_sent = total_sent;
return OK;
}
// Block and wait for the socket to accept more data
err = _sock->poll(NetSocket::POLL_TYPE_OUT, -1);
if (err != OK) {
disconnect_from_host();
return FAILED;
}
} else {
data_to_send -= sent_amount;
offset += sent_amount;
total_sent += sent_amount;
}
}
r_sent = total_sent;
return OK;
}
Error StreamPeerSocket::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
if (status != STATUS_CONNECTED) {
return FAILED;
}
Error err;
int to_read = p_bytes;
int total_read = 0;
r_received = 0;
while (to_read) {
int read = 0;
err = _sock->recv(p_buffer + total_read, to_read, read);
if (err != OK) {
if (err != ERR_BUSY) {
disconnect_from_host();
return FAILED;
}
if (!p_block) {
r_received = total_read;
return OK;
}
err = _sock->poll(NetSocket::POLL_TYPE_IN, -1);
if (err != OK) {
disconnect_from_host();
return FAILED;
}
} else if (read == 0) {
disconnect_from_host();
r_received = total_read;
return ERR_FILE_EOF;
} else {
to_read -= read;
total_read += read;
if (!p_block) {
r_received = total_read;
return OK;
}
}
}
r_received = total_read;
return OK;
}
StreamPeerSocket::Status StreamPeerSocket::get_status() const {
return status;
}
void StreamPeerSocket::disconnect_from_host() {
if (_sock.is_valid() && _sock->is_open()) {
_sock->close();
}
timeout = 0;
status = STATUS_NONE;
peer_address = NetSocket::Address();
}
Error StreamPeerSocket::wait(NetSocket::PollType p_type, int p_timeout) {
ERR_FAIL_COND_V(_sock.is_null() || !_sock->is_open(), ERR_UNAVAILABLE);
return _sock->poll(p_type, p_timeout);
}
Error StreamPeerSocket::put_data(const uint8_t *p_data, int p_bytes) {
int total;
return write(p_data, p_bytes, total, true);
}
Error StreamPeerSocket::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
return write(p_data, p_bytes, r_sent, false);
}
Error StreamPeerSocket::get_data(uint8_t *p_buffer, int p_bytes) {
int total;
return read(p_buffer, p_bytes, total, true);
}
Error StreamPeerSocket::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
return read(p_buffer, p_bytes, r_received, false);
}
int StreamPeerSocket::get_available_bytes() const {
ERR_FAIL_COND_V(_sock.is_null(), -1);
return _sock->get_available_bytes();
}
void StreamPeerSocket::_bind_methods() {
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerSocket::poll);
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerSocket::get_status);
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &StreamPeerSocket::disconnect_from_host);
BIND_ENUM_CONSTANT(STATUS_NONE);
BIND_ENUM_CONSTANT(STATUS_CONNECTING);
BIND_ENUM_CONSTANT(STATUS_CONNECTED);
BIND_ENUM_CONSTANT(STATUS_ERROR);
}
StreamPeerSocket::StreamPeerSocket() :
_sock(NetSocket::create()) {
}
StreamPeerSocket::~StreamPeerSocket() {
disconnect_from_host();
}

View file

@ -0,0 +1,93 @@
/**************************************************************************/
/* stream_peer_socket.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/io/net_socket.h"
#include "core/io/stream_peer.h"
#ifndef DISABLE_DEPRECATED
namespace compat::StreamPeerTCP {
enum class Status;
} //namespace compat::StreamPeerTCP
#endif
class StreamPeerSocket : public StreamPeer {
GDCLASS(StreamPeerSocket, StreamPeer);
public:
enum Status {
STATUS_NONE,
STATUS_CONNECTING,
STATUS_CONNECTED,
STATUS_ERROR,
};
protected:
#ifndef DISABLE_DEPRECATED
compat::StreamPeerTCP::Status _get_status_compat_107954() const;
static void _bind_compatibility_methods();
#endif
Ref<NetSocket> _sock;
uint64_t timeout = 0;
Status status = STATUS_NONE;
NetSocket::Address peer_address;
Error write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block);
Error read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block);
static void _bind_methods();
public:
virtual void accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) = 0;
void disconnect_from_host();
int get_available_bytes() const override;
Status get_status() const;
// Poll socket updating its state.
Error poll();
// Wait or check for writable, readable.
Error wait(NetSocket::PollType p_type, int p_timeout = 0);
// Read/Write from StreamPeer
Error put_data(const uint8_t *p_data, int p_bytes) override;
Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) override;
Error get_data(uint8_t *p_buffer, int p_bytes) override;
Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) override;
StreamPeerSocket();
virtual ~StreamPeerSocket();
};
VARIANT_ENUM_CAST(StreamPeerSocket::Status);

View file

@ -32,60 +32,14 @@
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
Error StreamPeerTCP::poll() { void StreamPeerTCP::accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) {
if (status == STATUS_CONNECTED) {
Error err;
err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
if (err == OK) {
// FIN received
if (_sock->get_available_bytes() == 0) {
disconnect_from_host();
return OK;
}
}
// Also poll write
err = _sock->poll(NetSocket::POLL_TYPE_IN_OUT, 0);
if (err != OK && err != ERR_BUSY) {
// Got an error
disconnect_from_host();
status = STATUS_ERROR;
return err;
}
return OK;
} else if (status != STATUS_CONNECTING) {
return OK;
}
Error err = _sock->connect_to_host(peer_host, peer_port);
if (err == OK) {
status = STATUS_CONNECTED;
return OK;
} else if (err == ERR_BUSY) {
// Check for connect timeout
if (OS::get_singleton()->get_ticks_msec() > timeout) {
disconnect_from_host();
status = STATUS_ERROR;
return ERR_CONNECTION_ERROR;
}
// Still trying to connect
return OK;
}
disconnect_from_host();
status = STATUS_ERROR;
return ERR_CONNECTION_ERROR;
}
void StreamPeerTCP::accept_socket(Ref<NetSocket> p_sock, IPAddress p_host, uint16_t p_port) {
_sock = p_sock; _sock = p_sock;
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000);
status = STATUS_CONNECTED; status = STATUS_CONNECTED;
peer_host = p_host; peer_address = p_addr;
peer_port = p_port;
} }
Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) { Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) {
@ -97,12 +51,13 @@ Error StreamPeerTCP::bind(int p_port, const IPAddress &p_host) {
if (p_host.is_wildcard()) { if (p_host.is_wildcard()) {
ip_type = IP::TYPE_ANY; ip_type = IP::TYPE_ANY;
} }
Error err = _sock->open(NetSocket::TYPE_TCP, ip_type); Error err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_TCP, ip_type);
if (err != OK) { if (err != OK) {
return err; return err;
} }
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
return _sock->bind(p_host, p_port); NetSocket::Address addr(p_host, p_port);
return _sock->bind(addr);
} }
Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) { Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) {
@ -113,7 +68,7 @@ Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) {
if (!_sock->is_open()) { if (!_sock->is_open()) {
IP::Type ip_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; IP::Type ip_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
Error err = _sock->open(NetSocket::TYPE_TCP, ip_type); Error err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_TCP, ip_type);
if (err != OK) { if (err != OK) {
return err; return err;
} }
@ -121,7 +76,9 @@ Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) {
} }
timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000); timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/tcp/connect_timeout_seconds")) * 1000);
Error err = _sock->connect_to_host(p_host, p_port);
NetSocket::Address addr(p_host, p_port);
Error err = _sock->connect_to_host(addr);
if (err == OK) { if (err == OK) {
status = STATUS_CONNECTED; status = STATUS_CONNECTED;
@ -133,106 +90,7 @@ Error StreamPeerTCP::connect_to_host(const IPAddress &p_host, int p_port) {
return FAILED; return FAILED;
} }
peer_host = p_host; peer_address = addr;
peer_port = p_port;
return OK;
}
Error StreamPeerTCP::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
if (status != STATUS_CONNECTED) {
return FAILED;
}
Error err;
int data_to_send = p_bytes;
const uint8_t *offset = p_data;
int total_sent = 0;
while (data_to_send) {
int sent_amount = 0;
err = _sock->send(offset, data_to_send, sent_amount);
if (err != OK) {
if (err != ERR_BUSY) {
disconnect_from_host();
return FAILED;
}
if (!p_block) {
r_sent = total_sent;
return OK;
}
// Block and wait for the socket to accept more data
err = _sock->poll(NetSocket::POLL_TYPE_OUT, -1);
if (err != OK) {
disconnect_from_host();
return FAILED;
}
} else {
data_to_send -= sent_amount;
offset += sent_amount;
total_sent += sent_amount;
}
}
r_sent = total_sent;
return OK;
}
Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
if (status != STATUS_CONNECTED) {
return FAILED;
}
Error err;
int to_read = p_bytes;
int total_read = 0;
r_received = 0;
while (to_read) {
int read = 0;
err = _sock->recv(p_buffer + total_read, to_read, read);
if (err != OK) {
if (err != ERR_BUSY) {
disconnect_from_host();
return FAILED;
}
if (!p_block) {
r_received = total_read;
return OK;
}
err = _sock->poll(NetSocket::POLL_TYPE_IN, -1);
if (err != OK) {
disconnect_from_host();
return FAILED;
}
} else if (read == 0) {
disconnect_from_host();
r_received = total_read;
return ERR_FILE_EOF;
} else {
to_read -= read;
total_read += read;
if (!p_block) {
r_received = total_read;
return OK;
}
}
}
r_received = total_read;
return OK; return OK;
} }
@ -242,61 +100,18 @@ void StreamPeerTCP::set_no_delay(bool p_enabled) {
_sock->set_tcp_no_delay_enabled(p_enabled); _sock->set_tcp_no_delay_enabled(p_enabled);
} }
StreamPeerTCP::Status StreamPeerTCP::get_status() const {
return status;
}
void StreamPeerTCP::disconnect_from_host() {
if (_sock.is_valid() && _sock->is_open()) {
_sock->close();
}
timeout = 0;
status = STATUS_NONE;
peer_host = IPAddress();
peer_port = 0;
}
Error StreamPeerTCP::wait(NetSocket::PollType p_type, int p_timeout) {
ERR_FAIL_COND_V(_sock.is_null() || !_sock->is_open(), ERR_UNAVAILABLE);
return _sock->poll(p_type, p_timeout);
}
Error StreamPeerTCP::put_data(const uint8_t *p_data, int p_bytes) {
int total;
return write(p_data, p_bytes, total, true);
}
Error StreamPeerTCP::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
return write(p_data, p_bytes, r_sent, false);
}
Error StreamPeerTCP::get_data(uint8_t *p_buffer, int p_bytes) {
int total;
return read(p_buffer, p_bytes, total, true);
}
Error StreamPeerTCP::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
return read(p_buffer, p_bytes, r_received, false);
}
int StreamPeerTCP::get_available_bytes() const {
ERR_FAIL_COND_V(_sock.is_null(), -1);
return _sock->get_available_bytes();
}
IPAddress StreamPeerTCP::get_connected_host() const { IPAddress StreamPeerTCP::get_connected_host() const {
return peer_host; return peer_address.ip();
} }
int StreamPeerTCP::get_connected_port() const { int StreamPeerTCP::get_connected_port() const {
return peer_port; return peer_address.port();
} }
int StreamPeerTCP::get_local_port() const { int StreamPeerTCP::get_local_port() const {
uint16_t local_port; NetSocket::Address addr;
_sock->get_socket_address(nullptr, &local_port); _sock->get_socket_address(&addr);
return local_port; return addr.port();
} }
Error StreamPeerTCP::_connect(const String &p_address, int p_port) { Error StreamPeerTCP::_connect(const String &p_address, int p_port) {
@ -316,24 +131,8 @@ Error StreamPeerTCP::_connect(const String &p_address, int p_port) {
void StreamPeerTCP::_bind_methods() { void StreamPeerTCP::_bind_methods() {
ClassDB::bind_method(D_METHOD("bind", "port", "host"), &StreamPeerTCP::bind, DEFVAL("*")); ClassDB::bind_method(D_METHOD("bind", "port", "host"), &StreamPeerTCP::bind, DEFVAL("*"));
ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port"), &StreamPeerTCP::_connect); ClassDB::bind_method(D_METHOD("connect_to_host", "host", "port"), &StreamPeerTCP::_connect);
ClassDB::bind_method(D_METHOD("poll"), &StreamPeerTCP::poll);
ClassDB::bind_method(D_METHOD("get_status"), &StreamPeerTCP::get_status);
ClassDB::bind_method(D_METHOD("get_connected_host"), &StreamPeerTCP::get_connected_host); ClassDB::bind_method(D_METHOD("get_connected_host"), &StreamPeerTCP::get_connected_host);
ClassDB::bind_method(D_METHOD("get_connected_port"), &StreamPeerTCP::get_connected_port); ClassDB::bind_method(D_METHOD("get_connected_port"), &StreamPeerTCP::get_connected_port);
ClassDB::bind_method(D_METHOD("get_local_port"), &StreamPeerTCP::get_local_port); ClassDB::bind_method(D_METHOD("get_local_port"), &StreamPeerTCP::get_local_port);
ClassDB::bind_method(D_METHOD("disconnect_from_host"), &StreamPeerTCP::disconnect_from_host);
ClassDB::bind_method(D_METHOD("set_no_delay", "enabled"), &StreamPeerTCP::set_no_delay); ClassDB::bind_method(D_METHOD("set_no_delay", "enabled"), &StreamPeerTCP::set_no_delay);
BIND_ENUM_CONSTANT(STATUS_NONE);
BIND_ENUM_CONSTANT(STATUS_CONNECTING);
BIND_ENUM_CONSTANT(STATUS_CONNECTED);
BIND_ENUM_CONSTANT(STATUS_ERROR);
}
StreamPeerTCP::StreamPeerTCP() :
_sock(Ref<NetSocket>(NetSocket::create())) {
}
StreamPeerTCP::~StreamPeerTCP() {
disconnect_from_host();
} }

View file

@ -32,62 +32,24 @@
#include "core/io/ip.h" #include "core/io/ip.h"
#include "core/io/ip_address.h" #include "core/io/ip_address.h"
#include "core/io/net_socket.h" #include "core/io/stream_peer_socket.h"
#include "core/io/stream_peer.h"
class StreamPeerTCP : public StreamPeer { class StreamPeerTCP : public StreamPeerSocket {
GDCLASS(StreamPeerTCP, StreamPeer); GDCLASS(StreamPeerTCP, StreamPeerSocket);
public:
enum Status {
STATUS_NONE,
STATUS_CONNECTING,
STATUS_CONNECTED,
STATUS_ERROR,
};
protected: protected:
Ref<NetSocket> _sock;
uint64_t timeout = 0;
Status status = STATUS_NONE;
IPAddress peer_host;
uint16_t peer_port = 0;
Error _connect(const String &p_address, int p_port); Error _connect(const String &p_address, int p_port);
Error write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block);
Error read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block);
static void _bind_methods(); static void _bind_methods();
public: public:
void accept_socket(Ref<NetSocket> p_sock, IPAddress p_host, uint16_t p_port); void accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) override;
Error bind(int p_port, const IPAddress &p_host); Error bind(int p_port, const IPAddress &p_host);
Error connect_to_host(const IPAddress &p_host, int p_port); Error connect_to_host(const IPAddress &p_host, int p_port);
IPAddress get_connected_host() const; IPAddress get_connected_host() const;
int get_connected_port() const; int get_connected_port() const;
int get_local_port() const; int get_local_port() const;
void disconnect_from_host();
int get_available_bytes() const override;
Status get_status() const;
void set_no_delay(bool p_enabled); void set_no_delay(bool p_enabled);
// Poll socket updating its state.
Error poll();
// Wait or check for writable, readable.
Error wait(NetSocket::PollType p_type, int p_timeout = 0);
// Read/Write from StreamPeer
Error put_data(const uint8_t *p_data, int p_bytes) override;
Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) override;
Error get_data(uint8_t *p_buffer, int p_bytes) override;
Error get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) override;
StreamPeerTCP();
~StreamPeerTCP();
}; };
VARIANT_ENUM_CAST(StreamPeerTCP::Status);

View file

@ -0,0 +1,99 @@
/**************************************************************************/
/* stream_peer_uds.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "stream_peer_uds.h"
#include "core/config/project_settings.h"
void StreamPeerUDS::_bind_methods() {
ClassDB::bind_method(D_METHOD("bind", "path"), &StreamPeerUDS::bind);
ClassDB::bind_method(D_METHOD("connect_to_host", "path"), &StreamPeerUDS::connect_to_host);
ClassDB::bind_method(D_METHOD("get_connected_path"), &StreamPeerUDS::get_connected_path);
}
void StreamPeerUDS::accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) {
_sock = p_sock;
_sock->set_blocking_enabled(false);
timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/unix/connect_timeout_seconds")) * 1000);
status = STATUS_CONNECTED;
}
Error StreamPeerUDS::bind(const String &p_path) {
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
IP::Type ip_type = IP::TYPE_NONE;
Error err = _sock->open(NetSocket::Family::UNIX, NetSocket::TYPE_NONE, ip_type);
if (err != OK) {
return err;
}
_sock->set_blocking_enabled(false);
NetSocket::Address addr(p_path);
return _sock->bind(addr);
}
Error StreamPeerUDS::connect_to_host(const String &p_path) {
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_path.is_empty(), ERR_INVALID_PARAMETER);
if (!_sock->is_open()) {
IP::Type ip_type = IP::TYPE_NONE;
Error err = _sock->open(NetSocket::Family::UNIX, NetSocket::TYPE_NONE, ip_type);
if (err != OK) {
return err;
}
_sock->set_blocking_enabled(false);
}
timeout = OS::get_singleton()->get_ticks_msec() + (((uint64_t)GLOBAL_GET("network/limits/unix/connect_timeout_seconds")) * 1000);
NetSocket::Address addr(p_path);
Error err = _sock->connect_to_host(addr);
if (err == OK) {
status = STATUS_CONNECTED;
} else if (err == ERR_BUSY) {
status = STATUS_CONNECTING;
} else {
ERR_PRINT("Connection to remote host failed!");
disconnect_from_host();
return FAILED;
}
peer_address = addr;
peer_path = p_path;
return OK;
}
const String StreamPeerUDS::get_connected_path() const {
return String(peer_address.get_path().get_data());
}

48
core/io/stream_peer_uds.h Normal file
View file

@ -0,0 +1,48 @@
/**************************************************************************/
/* stream_peer_uds.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/io/stream_peer_socket.h"
class StreamPeerUDS : public StreamPeerSocket {
GDCLASS(StreamPeerUDS, StreamPeerSocket);
protected:
String peer_path;
static void _bind_methods();
public:
void accept_socket(Ref<NetSocket> p_sock, const NetSocket::Address &p_addr) override;
Error bind(const String &p_path);
Error connect_to_host(const String &p_path);
const String get_connected_path() const;
};

View file

@ -32,11 +32,8 @@
void TCPServer::_bind_methods() { void TCPServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCPServer::listen, DEFVAL("*")); ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCPServer::listen, DEFVAL("*"));
ClassDB::bind_method(D_METHOD("is_connection_available"), &TCPServer::is_connection_available);
ClassDB::bind_method(D_METHOD("is_listening"), &TCPServer::is_listening);
ClassDB::bind_method(D_METHOD("get_local_port"), &TCPServer::get_local_port); ClassDB::bind_method(D_METHOD("get_local_port"), &TCPServer::get_local_port);
ClassDB::bind_method(D_METHOD("take_connection"), &TCPServer::take_connection); ClassDB::bind_method(D_METHOD("take_connection"), &TCPServer::take_connection);
ClassDB::bind_method(D_METHOD("stop"), &TCPServer::stop);
} }
Error TCPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) { Error TCPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
@ -52,81 +49,21 @@ Error TCPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
} }
err = _sock->open(NetSocket::TYPE_TCP, ip_type); err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_TCP, ip_type);
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
_sock->set_blocking_enabled(false);
_sock->set_reuse_address_enabled(true); _sock->set_reuse_address_enabled(true);
err = _sock->bind(p_bind_address, p_port); return _listen(NetSocket::Address(p_bind_address, p_port));
if (err != OK) {
_sock->close();
return ERR_ALREADY_IN_USE;
}
err = _sock->listen(MAX_PENDING_CONNECTIONS);
if (err != OK) {
_sock->close();
return FAILED;
}
return OK;
} }
int TCPServer::get_local_port() const { int TCPServer::get_local_port() const {
uint16_t local_port; NetSocket::Address addr;
_sock->get_socket_address(nullptr, &local_port); _sock->get_socket_address(&addr);
return local_port; return addr.port();
}
bool TCPServer::is_listening() const {
ERR_FAIL_COND_V(_sock.is_null(), false);
return _sock->is_open();
}
bool TCPServer::is_connection_available() const {
ERR_FAIL_COND_V(_sock.is_null(), false);
if (!_sock->is_open()) {
return false;
}
Error err = _sock->poll(NetSocket::POLL_TYPE_IN, 0);
return (err == OK);
} }
Ref<StreamPeerTCP> TCPServer::take_connection() { Ref<StreamPeerTCP> TCPServer::take_connection() {
Ref<StreamPeerTCP> conn; return _take_connection<StreamPeerTCP>();
if (!is_connection_available()) {
return conn;
}
Ref<NetSocket> ns;
IPAddress ip;
uint16_t port = 0;
ns = _sock->accept(ip, port);
if (ns.is_null()) {
return conn;
}
conn.instantiate();
conn->accept_socket(ns, ip, port);
return conn;
}
void TCPServer::stop() {
if (_sock.is_valid()) {
_sock->close();
}
}
TCPServer::TCPServer() :
_sock(Ref<NetSocket>(NetSocket::create())) {
}
TCPServer::~TCPServer() {
stop();
} }

View file

@ -31,30 +31,18 @@
#pragma once #pragma once
#include "core/io/ip.h" #include "core/io/ip.h"
#include "core/io/net_socket.h" #include "core/io/socket_server.h"
#include "core/io/stream_peer.h"
#include "core/io/stream_peer_tcp.h" #include "core/io/stream_peer_tcp.h"
class TCPServer : public RefCounted { class TCPServer : public SocketServer {
GDCLASS(TCPServer, RefCounted); GDCLASS(TCPServer, SocketServer);
protected: protected:
enum {
MAX_PENDING_CONNECTIONS = 8
};
Ref<NetSocket> _sock;
static void _bind_methods(); static void _bind_methods();
public: public:
Error listen(uint16_t p_port, const IPAddress &p_bind_address = IPAddress("*")); Error listen(uint16_t p_port, const IPAddress &p_bind_address = IPAddress("*"));
int get_local_port() const; int get_local_port() const;
bool is_listening() const;
bool is_connection_available() const;
Ref<StreamPeerTCP> take_connection(); Ref<StreamPeerTCP> take_connection();
Ref<StreamPeerSocket> take_socket_connection() override { return take_connection(); }
void stop(); // Stop listening
TCPServer();
~TCPServer();
}; };

View file

@ -31,7 +31,7 @@
#include "translation_loader_po.h" #include "translation_loader_po.h"
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/string/translation_po.h" #include "core/string/translation.h"
Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_error) { Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_error) {
if (r_error) { if (r_error) {
@ -39,7 +39,8 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
} }
const String path = f->get_path(); const String path = f->get_path();
Ref<TranslationPO> translation = Ref<TranslationPO>(memnew(TranslationPO)); Ref<Translation> translation;
translation.instantiate();
String config; String config;
uint32_t magic = f->get_32(); uint32_t magic = f->get_32();
@ -112,7 +113,7 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
int p_start = config.find("Plural-Forms"); int p_start = config.find("Plural-Forms");
if (p_start != -1) { if (p_start != -1) {
int p_end = config.find_char('\n', p_start); int p_end = config.find_char('\n', p_start);
translation->set_plural_rule(config.substr(p_start, p_end - p_start)); translation->set_plural_rules_override(config.substr(p_start, p_end - p_start));
} }
} else { } else {
uint32_t str_start = 0; uint32_t str_start = 0;
@ -228,8 +229,8 @@ Ref<Resource> TranslationLoaderPO::load_translation(Ref<FileAccess> f, Error *r_
int p_start = config.find("Plural-Forms"); int p_start = config.find("Plural-Forms");
if (p_start != -1) { if (p_start != -1) {
int p_end = config.find_char('\n', p_start); int p_end = config.find_char('\n', p_start);
translation->set_plural_rule(config.substr(p_start, p_end - p_start)); translation->set_plural_rules_override(config.substr(p_start, p_end - p_start));
plural_forms = translation->get_plural_forms(); plural_forms = translation->get_nplurals();
} }
} }

View file

@ -32,9 +32,10 @@
#include "core/io/file_access.h" #include "core/io/file_access.h"
#include "core/io/resource_loader.h" #include "core/io/resource_loader.h"
#include "core/string/translation.h"
class TranslationLoaderPO : public ResourceFormatLoader { class TranslationLoaderPO : public ResourceFormatLoader {
GDSOFTCLASS(TranslationLoaderPO, ResourceFormatLoader);
public: public:
static Ref<Resource> load_translation(Ref<FileAccess> f, Error *r_error = nullptr); static Ref<Resource> load_translation(Ref<FileAccess> f, Error *r_error = nullptr);
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override; virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;

View file

@ -99,7 +99,7 @@ Error UDPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; ip_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
} }
err = _sock->open(NetSocket::TYPE_UDP, ip_type); err = _sock->open(NetSocket::Family::INET, NetSocket::TYPE_UDP, ip_type);
if (err != OK) { if (err != OK) {
return ERR_CANT_CREATE; return ERR_CANT_CREATE;
@ -107,7 +107,8 @@ Error UDPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
_sock->set_blocking_enabled(false); _sock->set_blocking_enabled(false);
_sock->set_reuse_address_enabled(true); _sock->set_reuse_address_enabled(true);
err = _sock->bind(p_bind_address, p_port); NetSocket::Address addr(p_bind_address, p_port);
err = _sock->bind(addr);
if (err != OK) { if (err != OK) {
stop(); stop();
@ -117,9 +118,9 @@ Error UDPServer::listen(uint16_t p_port, const IPAddress &p_bind_address) {
} }
int UDPServer::get_local_port() const { int UDPServer::get_local_port() const {
uint16_t local_port; NetSocket::Address addr;
_sock->get_socket_address(nullptr, &local_port); _sock->get_socket_address(&addr);
return local_port; return addr.port();
} }
bool UDPServer::is_listening() const { bool UDPServer::is_listening() const {

52
core/io/uds_server.cpp Normal file
View file

@ -0,0 +1,52 @@
/**************************************************************************/
/* uds_server.cpp */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "uds_server.h"
void UDSServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("listen", "path"), &UDSServer::listen);
ClassDB::bind_method(D_METHOD("take_connection"), &UDSServer::take_connection);
}
Error UDSServer::listen(const String &p_path) {
ERR_FAIL_COND_V(_sock.is_null(), ERR_UNAVAILABLE);
ERR_FAIL_COND_V(_sock->is_open(), ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_path.is_empty(), ERR_INVALID_PARAMETER);
IP::Type ip_type = IP::TYPE_NONE;
Error err = _sock->open(NetSocket::Family::UNIX, NetSocket::TYPE_NONE, ip_type);
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
return _listen(p_path);
}
Ref<StreamPeerUDS> UDSServer::take_connection() {
return _take_connection<StreamPeerUDS>();
}

46
core/io/uds_server.h Normal file
View file

@ -0,0 +1,46 @@
/**************************************************************************/
/* uds_server.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#pragma once
#include "core/io/socket_server.h"
#include "core/io/stream_peer_uds.h"
class UDSServer : public SocketServer {
GDCLASS(UDSServer, SocketServer);
protected:
static void _bind_methods();
public:
Error listen(const String &p_path);
Ref<StreamPeerUDS> take_connection();
Ref<StreamPeerSocket> take_socket_connection() override { return take_connection(); }
};

View file

@ -783,7 +783,7 @@ void AStarGrid2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "jumping_enabled"), "set_jumping_enabled", "is_jumping_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "jumping_enabled"), "set_jumping_enabled", "is_jumping_enabled");
ADD_PROPERTY(PropertyInfo(Variant::INT, "default_compute_heuristic", PROPERTY_HINT_ENUM, "Euclidean,Manhattan,Octile,Chebyshev"), "set_default_compute_heuristic", "get_default_compute_heuristic"); ADD_PROPERTY(PropertyInfo(Variant::INT, "default_compute_heuristic", PROPERTY_HINT_ENUM, "Euclidean,Manhattan,Octile,Chebyshev"), "set_default_compute_heuristic", "get_default_compute_heuristic");
ADD_PROPERTY(PropertyInfo(Variant::INT, "default_estimate_heuristic", PROPERTY_HINT_ENUM, "Euclidean,Manhattan,Octile,Chebyshev"), "set_default_estimate_heuristic", "get_default_estimate_heuristic"); ADD_PROPERTY(PropertyInfo(Variant::INT, "default_estimate_heuristic", PROPERTY_HINT_ENUM, "Euclidean,Manhattan,Octile,Chebyshev"), "set_default_estimate_heuristic", "get_default_estimate_heuristic");
ADD_PROPERTY(PropertyInfo(Variant::INT, "diagonal_mode", PROPERTY_HINT_ENUM, "Never,Always,At Least One Walkable,Only If No Obstacles"), "set_diagonal_mode", "get_diagonal_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "diagonal_mode", PROPERTY_HINT_ENUM, "Always,Never,At Least One Walkable,Only If No Obstacles"), "set_diagonal_mode", "get_diagonal_mode");
BIND_ENUM_CONSTANT(HEURISTIC_EUCLIDEAN); BIND_ENUM_CONSTANT(HEURISTIC_EUCLIDEAN);
BIND_ENUM_CONSTANT(HEURISTIC_MANHATTAN); BIND_ENUM_CONSTANT(HEURISTIC_MANHATTAN);

View file

@ -32,6 +32,7 @@
#include "core/math/plane.h" #include "core/math/plane.h"
#include "core/math/vector3.h" #include "core/math/vector3.h"
#include "core/templates/hashfuncs.h"
/** /**
* AABB (Axis Aligned Bounding Box) * AABB (Axis Aligned Bounding Box)
@ -131,6 +132,16 @@ struct [[nodiscard]] AABB {
return position + (size * 0.5f); return position + (size * 0.5f);
} }
uint32_t hash() const {
uint32_t h = hash_murmur3_one_real(position.x);
h = hash_murmur3_one_real(position.y, h);
h = hash_murmur3_one_real(position.z, h);
h = hash_murmur3_one_real(size.x, h);
h = hash_murmur3_one_real(size.y, h);
h = hash_murmur3_one_real(size.z, h);
return hash_fmix32(h);
}
explicit operator String() const; explicit operator String() const;
AABB() = default; AABB() = default;

View file

@ -34,6 +34,10 @@
#include "core/math/vector3.h" #include "core/math/vector3.h"
struct [[nodiscard]] Basis { struct [[nodiscard]] Basis {
static const Basis FLIP_X;
static const Basis FLIP_Y;
static const Basis FLIP_Z;
Vector3 rows[3] = { Vector3 rows[3] = {
Vector3(1, 0, 0), Vector3(1, 0, 0),
Vector3(0, 1, 0), Vector3(0, 1, 0),
@ -224,7 +228,7 @@ struct [[nodiscard]] Basis {
operator Quaternion() const { return get_quaternion(); } operator Quaternion() const { return get_quaternion(); }
static Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false); static Basis looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3::UP, bool p_use_model_front = false);
Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); } Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); }
Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); } Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); }
@ -247,6 +251,10 @@ private:
void _set_diagonal(const Vector3 &p_diag); void _set_diagonal(const Vector3 &p_diag);
}; };
inline constexpr Basis Basis::FLIP_X = { { -1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
inline constexpr Basis Basis::FLIP_Y = { { 1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 1 } };
inline constexpr Basis Basis::FLIP_Z = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, -1 } };
constexpr bool Basis::operator==(const Basis &p_matrix) const { constexpr bool Basis::operator==(const Basis &p_matrix) const {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) { for (int j = 0; j < 3; j++) {

View file

@ -432,7 +432,7 @@ int Color::find_named_color(const String &p_name) {
} }
int Color::get_named_color_count() { int Color::get_named_color_count() {
return std::size(named_colors); return std_size(named_colors);
} }
String Color::get_named_color_name(int p_idx) { String Color::get_named_color_name(int p_idx) {

View file

@ -31,6 +31,7 @@
#pragma once #pragma once
#include "core/math/math_funcs.h" #include "core/math/math_funcs.h"
#include "core/templates/hashfuncs.h"
class String; class String;
@ -239,6 +240,14 @@ struct [[nodiscard]] Color {
_FORCE_INLINE_ void set_ok_hsl_s(float p_s) { set_ok_hsl(get_ok_hsl_h(), p_s, get_ok_hsl_l(), a); } _FORCE_INLINE_ void set_ok_hsl_s(float p_s) { set_ok_hsl(get_ok_hsl_h(), p_s, get_ok_hsl_l(), a); }
_FORCE_INLINE_ void set_ok_hsl_l(float p_l) { set_ok_hsl(get_ok_hsl_h(), get_ok_hsl_s(), p_l, a); } _FORCE_INLINE_ void set_ok_hsl_l(float p_l) { set_ok_hsl(get_ok_hsl_h(), get_ok_hsl_s(), p_l, a); }
uint32_t hash() const {
uint32_t h = hash_murmur3_one_float(r);
h = hash_murmur3_one_float(r, h);
h = hash_murmur3_one_float(b, h);
h = hash_murmur3_one_float(a, h);
return hash_fmix32(h);
}
constexpr Color() : constexpr Color() :
r(0), g(0), b(0), a(1) {} r(0), g(0), b(0), a(1) {}

View file

@ -33,6 +33,7 @@
#include "core/math/aabb.h" #include "core/math/aabb.h"
#include "core/math/projection.h" #include "core/math/projection.h"
#include "core/math/vector3.h" #include "core/math/vector3.h"
#include "core/math/vector3i.h"
#include "core/templates/a_hash_map.h" #include "core/templates/a_hash_map.h"
#include "core/templates/list.h" #include "core/templates/list.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"

View file

@ -30,7 +30,9 @@
#include "geometry_2d.h" #include "geometry_2d.h"
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Walloc-zero")
#include "thirdparty/clipper2/include/clipper2/clipper.h" #include "thirdparty/clipper2/include/clipper2/clipper.h"
GODOT_GCC_WARNING_POP
#include "thirdparty/misc/polypartition.h" #include "thirdparty/misc/polypartition.h"
#define STB_RECT_PACK_IMPLEMENTATION #define STB_RECT_PACK_IMPLEMENTATION
#include "thirdparty/misc/stb_rect_pack.h" #include "thirdparty/misc/stb_rect_pack.h"
@ -292,14 +294,16 @@ Vector<Vector<Point2>> Geometry2D::_polypaths_do_operation(PolyBooleanOperation
} }
Vector<Vector<Point2>> polypaths; Vector<Vector<Point2>> polypaths;
for (PathsD::size_type i = 0; i < paths.size(); ++i) { polypaths.resize(paths.size());
for (PathsD::size_type i = 0; i < paths.size(); i++) {
const PathD &path = paths[i]; const PathD &path = paths[i];
Vector<Vector2> polypath; Vector<Vector2> polypath;
polypath.resize(path.size());
for (PathsD::size_type j = 0; j < path.size(); ++j) { for (PathsD::size_type j = 0; j < path.size(); ++j) {
polypath.push_back(Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y))); polypath.set(j, Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
} }
polypaths.push_back(polypath); polypaths.set(i, polypath);
} }
return polypaths; return polypaths;
} }
@ -353,14 +357,16 @@ Vector<Vector<Point2>> Geometry2D::_polypath_offset(const Vector<Point2> &p_poly
// to attain the desired precision. // to attain the desired precision.
Vector<Vector<Point2>> polypaths; Vector<Vector<Point2>> polypaths;
polypaths.resize(paths.size());
for (PathsD::size_type i = 0; i < paths.size(); ++i) { for (PathsD::size_type i = 0; i < paths.size(); ++i) {
const PathD &path = paths[i]; const PathD &path = paths[i];
Vector<Vector2> polypath2; Vector<Vector2> polypath2;
polypath2.resize(path.size());
for (PathsD::size_type j = 0; j < path.size(); ++j) { for (PathsD::size_type j = 0; j < path.size(); ++j) {
polypath2.push_back(Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y))); polypath2.set(j, Point2(static_cast<real_t>(path[j].x), static_cast<real_t>(path[j].y)));
} }
polypaths.push_back(polypath2); polypaths.set(i, polypath2);
} }
return polypaths; return polypaths;
} }

View file

@ -30,8 +30,10 @@
#pragma once #pragma once
#include "core/math/color.h"
#include "core/math/delaunay_3d.h" #include "core/math/delaunay_3d.h"
#include "core/math/face3.h" #include "core/math/face3.h"
#include "core/math/vector2.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"
#include "core/templates/vector.h" #include "core/templates/vector.h"
@ -292,6 +294,10 @@ public:
real_t den = p.normal.dot(dir); real_t den = p.normal.dot(dir);
if (Math::abs(den) <= (real_t)CMP_EPSILON) { if (Math::abs(den) <= (real_t)CMP_EPSILON) {
if (p.is_point_over(p_from)) {
// Separating plane.
return false;
}
continue; // Ignore parallel plane. continue; // Ignore parallel plane.
} }

View file

@ -35,6 +35,10 @@
class Variant; class Variant;
struct [[nodiscard]] Plane { struct [[nodiscard]] Plane {
static const Plane PLANE_YZ;
static const Plane PLANE_XZ;
static const Plane PLANE_XY;
Vector3 normal; Vector3 normal;
real_t d = 0; real_t d = 0;
@ -90,6 +94,10 @@ struct [[nodiscard]] Plane {
_FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE); _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE);
}; };
inline constexpr Plane Plane::PLANE_YZ = { 1, 0, 0, 0 };
inline constexpr Plane Plane::PLANE_XZ = { 0, 1, 0, 0 };
inline constexpr Plane Plane::PLANE_XY = { 0, 0, 1, 0 };
bool Plane::is_point_over(const Vector3 &p_point) const { bool Plane::is_point_over(const Vector3 &p_point) const {
return (normal.dot(p_point) > d); return (normal.dot(p_point) > d);
} }

View file

@ -32,6 +32,7 @@
#include "core/error/error_macros.h" #include "core/error/error_macros.h"
#include "core/math/vector2.h" #include "core/math/vector2.h"
#include "core/templates/hashfuncs.h"
class String; class String;
struct Rect2i; struct Rect2i;
@ -361,6 +362,14 @@ struct [[nodiscard]] Rect2 {
explicit operator String() const; explicit operator String() const;
operator Rect2i() const; operator Rect2i() const;
uint32_t hash() const {
uint32_t h = hash_murmur3_one_real(position.x);
h = hash_murmur3_one_real(position.y, h);
h = hash_murmur3_one_real(size.x, h);
h = hash_murmur3_one_real(size.y, h);
return hash_fmix32(h);
}
Rect2() = default; Rect2() = default;
constexpr Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) : constexpr Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) :
position(Point2(p_x, p_y)), position(Point2(p_x, p_y)),

View file

@ -32,6 +32,7 @@
#include "core/error/error_macros.h" #include "core/error/error_macros.h"
#include "core/math/vector2i.h" #include "core/math/vector2i.h"
#include "core/templates/hashfuncs.h"
class String; class String;
struct Rect2; struct Rect2;
@ -226,6 +227,14 @@ struct [[nodiscard]] Rect2i {
explicit operator String() const; explicit operator String() const;
operator Rect2() const; operator Rect2() const;
uint32_t hash() const {
uint32_t h = hash_murmur3_one_32(uint32_t(position.x));
h = hash_murmur3_one_32(uint32_t(position.y), h);
h = hash_murmur3_one_32(uint32_t(size.x), h);
h = hash_murmur3_one_32(uint32_t(size.y), h);
return hash_fmix32(h);
}
Rect2i() = default; Rect2i() = default;
constexpr Rect2i(int p_x, int p_y, int p_width, int p_height) : constexpr Rect2i(int p_x, int p_y, int p_width, int p_height) :
position(Point2i(p_x, p_y)), position(Point2i(p_x, p_y)),

View file

@ -52,6 +52,9 @@ struct [[nodiscard]] Transform2D {
// WARNING: Be aware that unlike 3D code, 2D code uses a left-handed coordinate system: // WARNING: Be aware that unlike 3D code, 2D code uses a left-handed coordinate system:
// Y-axis points down, and angle is measure from +X to +Y in a clockwise-fashion. // Y-axis points down, and angle is measure from +X to +Y in a clockwise-fashion.
static const Transform2D FLIP_X;
static const Transform2D FLIP_Y;
Vector2 columns[3] = { Vector2 columns[3] = {
{ 1, 0 }, { 1, 0 },
{ 0, 1 }, { 0, 1 },
@ -149,6 +152,9 @@ struct [[nodiscard]] Transform2D {
Transform2D() = default; Transform2D() = default;
}; };
inline constexpr Transform2D Transform2D::FLIP_X = { { -1, 0 }, { 0, 1 }, { 0, 0 } };
inline constexpr Transform2D Transform2D::FLIP_Y = { { 1, 0 }, { 0, -1 }, { 0, 0 } };
constexpr bool Transform2D::operator==(const Transform2D &p_transform) const { constexpr bool Transform2D::operator==(const Transform2D &p_transform) const {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (columns[i] != p_transform.columns[i]) { if (columns[i] != p_transform.columns[i]) {

View file

@ -36,6 +36,10 @@
#include "core/templates/vector.h" #include "core/templates/vector.h"
struct [[nodiscard]] Transform3D { struct [[nodiscard]] Transform3D {
static const Transform3D FLIP_X;
static const Transform3D FLIP_Y;
static const Transform3D FLIP_Z;
Basis basis; Basis basis;
Vector3 origin; Vector3 origin;
@ -51,8 +55,8 @@ struct [[nodiscard]] Transform3D {
void rotate(const Vector3 &p_axis, real_t p_angle); void rotate(const Vector3 &p_axis, real_t p_angle);
void rotate_basis(const Vector3 &p_axis, real_t p_angle); void rotate_basis(const Vector3 &p_axis, real_t p_angle);
void set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false); void set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up = Vector3::UP, bool p_use_model_front = false);
Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0), bool p_use_model_front = false) const; Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3::UP, bool p_use_model_front = false) const;
void scale(const Vector3 &p_scale); void scale(const Vector3 &p_scale);
Transform3D scaled(const Vector3 &p_scale) const; Transform3D scaled(const Vector3 &p_scale) const;
@ -136,6 +140,10 @@ struct [[nodiscard]] Transform3D {
origin(p_ox, p_oy, p_oz) {} origin(p_ox, p_oy, p_oz) {}
}; };
inline constexpr Transform3D Transform3D::FLIP_X = { Basis::FLIP_X };
inline constexpr Transform3D Transform3D::FLIP_Y = { Basis::FLIP_Y };
inline constexpr Transform3D Transform3D::FLIP_Z = { Basis::FLIP_Z };
constexpr bool Transform3D::operator==(const Transform3D &p_transform) const { constexpr bool Transform3D::operator==(const Transform3D &p_transform) const {
return (basis == p_transform.basis && origin == p_transform.origin); return (basis == p_transform.basis && origin == p_transform.origin);
} }

View file

@ -32,12 +32,18 @@
#include "core/error/error_macros.h" #include "core/error/error_macros.h"
#include "core/math/math_funcs.h" #include "core/math/math_funcs.h"
#include "core/templates/hashfuncs.h"
class String; class String;
struct Vector2i; struct Vector2i;
struct [[nodiscard]] Vector2 { struct [[nodiscard]] Vector2 {
static const int AXIS_COUNT = 2; static const Vector2 LEFT;
static const Vector2 RIGHT;
static const Vector2 UP;
static const Vector2 DOWN;
static constexpr int AXIS_COUNT = 2;
enum Axis { enum Axis {
AXIS_X, AXIS_X,
@ -185,6 +191,12 @@ struct [[nodiscard]] Vector2 {
explicit operator String() const; explicit operator String() const;
operator Vector2i() const; operator Vector2i() const;
uint32_t hash() const {
uint32_t h = hash_murmur3_one_real(x);
h = hash_murmur3_one_real(y, h);
return hash_fmix32(h);
}
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init) // NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
constexpr Vector2() : constexpr Vector2() :
x(0), y(0) {} x(0), y(0) {}
@ -193,6 +205,11 @@ struct [[nodiscard]] Vector2 {
// NOLINTEND(cppcoreguidelines-pro-type-member-init) // NOLINTEND(cppcoreguidelines-pro-type-member-init)
}; };
inline constexpr Vector2 Vector2::LEFT = { -1, 0 };
inline constexpr Vector2 Vector2::RIGHT = { 1, 0 };
inline constexpr Vector2 Vector2::UP = { 0, -1 };
inline constexpr Vector2 Vector2::DOWN = { 0, 1 };
_FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const { _FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const {
return p_vec - *this * (dot(p_vec) - p_d); return p_vec - *this * (dot(p_vec) - p_d);
} }

Some files were not shown because too many files have changed in this diff Show more