Commit graph

4456 commits

Author SHA1 Message Date
Thaddeus Crews
568d6286e0
Merge pull request #102132 from Ivorforce/optimize-font-internal-cow
Optimize `Font` calculations by avoiding unnecessary copy-on-write.
2025-02-07 14:50:41 -06:00
Pāvels Nadtočajevs
7da0767f35 [TextEdit] Update syntax highlighting when IME composition string is updated. 2025-02-07 11:54:56 +02:00
Thaddeus Crews
0d14ae58b0
Merge pull request #101109 from clayjohn/multimesh-err-msg
Add explicit error messages to Multimesh functions
2025-02-05 18:22:21 -06:00
clayjohn
e1af7b65b2 Add explicit error messages to Multimesh error functions to make errors easier to understand.
Previously the RenderingServer errors filtered up to end users, but they are unclear and not helpful
2025-02-05 23:48:01 +01:00
Pāvels Nadtočajevs
b50d9742c2 Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
bruvzg
3be46a69c4 Fix uppercase B and X parsing in the integer literals. 2025-02-05 16:02:06 +02:00
Lukas Tenbrink
f52c9e342c Optimize Font calculations by avoiding unnecessary copy-on-write. 2025-01-28 18:15:59 +01:00
Thaddeus Crews
e62be79947
Merge pull request #100350 from Namey5/visualshader-worldposfromdepth-fix
Fix space transformations in WorldPositionFromDepth visual shader node generation
2025-01-22 16:32:26 -06:00
Thaddeus Crews
bacf8d198d
Merge pull request #101014 from BattyBovine/cs3d-separation-ray-fix-2
Prevent errors when drawing debug meshes with no mesh data.
2025-01-20 16:25:48 -06:00
Thaddeus Crews
cabd792995
Merge pull request #101796 from Chaosus/vs_fix_fresnel_preview_bug
Fix visual shader error when opening a Fresnel node preview
2025-01-20 16:25:47 -06:00
Thaddeus Crews
0cbcfb3cd6
Merge pull request #101648 from aaronp64/varyingsetter_global_per_node
Generate global code for `VisualShader` nodes that connect to `VaryingSetters`
2025-01-20 16:25:43 -06:00
Chaosus
8a7c9aa452 Fix visual shader error when opening a Fresnel node preview 2025-01-19 14:47:22 +03:00
Mika Viskari
dedae63617 Add property guards to shape 2D's 2025-01-18 13:37:46 +02:00
aaronp64
c4db6687f9 Generate global code for VisualShader nodes that connect to VaryingSetters
Updated visual shader code to call generate_global_per_node() for nodes connected to VaryingSetter nodes, even if they don't connect directly to Output.
2025-01-16 15:14:12 -05:00
Rémi Verschelde
1e1f54e954 Merge pull request #100050 from YeldhamDev/sub_emitter_at_start
Add "At Start" mode for sub-emitter particles
2025-01-14 18:29:20 +01:00
chocola-mint
f434c75dbf Add has_custom_data() to TileData 2025-01-13 21:25:49 +09:00
Rémi Verschelde
5be039761f Merge pull request #101273 from Nazarwadim/use_AHashMap_in_SurfaceTool
Use `AHashMap` for `SurfaceTool`
2025-01-10 23:06:12 +01:00
Rémi Verschelde
765c6ab5f8 Merge pull request #101282 from Nazarwadim/use_LocalVector_for_Curve_and_Gradient
Use `LocalVector` for `Curve` and `Gradient`
2025-01-09 20:51:30 +01:00
Rémi Verschelde
0257995616 Merge pull request #101354 from Ivorforce/animation-clear-template
Replace `Animation::_clear()` with explicit `.clear()` calls.
2025-01-09 17:07:27 +01:00
Lukas Tenbrink
dcb4e5b22a Replace Animation::_clear() with explicit .clear() calls. 2025-01-09 16:43:57 +01:00
Rémi Verschelde
4396f8fbd3 Add AudioStreamMP3 load_from_file/load_from_buffer and harmonize other audio streams
Move OggVorbis and MP3 loading code to their AudioStream class, matching how it's done for WAV.

The duplicate functions in ResourceImporterOggVorbis are now deprecated.

Co-authored-by: MaxIsJoe <34368774+MaxIsJoe@users.noreply.github.com>
2025-01-09 15:46:04 +01:00
Nazarii
8bfb5d74b3 Use LocalVector for Curve and Gradient 2025-01-09 14:25:21 +02:00
Rémi Verschelde
21721ae344 Merge pull request #87260 from Calinou/tonemap-add-agx
Add AgX tonemapper option to Environment
2025-01-08 18:20:03 +01:00
Hugo Locurcio
084e84be78
Add AgX tonemapper option to Environment
Technical implementation notes:

- Moved linearization step to before the outset matrix is applied and
  changed polynomial contrast curve approximation.
  - This does *not* implement Blender's chroma rotation to address hue shift.
    This hue rotation was found to have a significant performance impact.
- Improved performance by combining the AgX outset matrix with the Rec 2020 matrix.

Co-authored-by: Allen Pestaluky <allenpestaluky@gmail.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2025-01-08 17:01:16 +01:00
Aarni Koskela
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
Nazarii
4f1c956f25 Use AHashMap for SurfaceTool 2025-01-08 02:17:13 +02:00
danielgsilva
94a7dfeae1 Add additional methods for has_theme_item to check for font and font size 2025-01-07 16:56:14 +00:00
Rémi Verschelde
33c0fc5508
Merge pull request #101162 from timoschwarzer/fix/gpu-particles-2d-emission-textures
Fix ParticleProcessMaterial not using same offsets for emission textures
2025-01-07 10:14:50 +01:00
BattyBovine
6dc6ad2b86 Prevent errors when drawing debug meshes when surface count is zero.
Adds a few checks to ensure a debug collision mesh contains mesh data before
attempting to add it to the gizmo draw list. This prevents errors when using
SeparationRayShape3D, which is only intended to draw a single line, and
contains no mesh data.

Closes #100665
2025-01-06 21:35:52 -05:00
Rémi Verschelde
f18bb5ba1a
Merge pull request #100999 from KoBeWi/theme_wariat
Fix ProjectTag button variation
2025-01-06 22:48:16 +01:00
Timo Schwarzer
87767f7c34
Fix ParticleProcessMaterial not using same offsets for emission textures 2025-01-05 23:32:22 +01:00
Rémi Verschelde
c049d07121
VariantParser: Ensure all parse errors have an explanation
Likewise in ResourceFormatText and JSON.
2025-01-03 17:17:37 +01:00
kobewi
c1cdcad96a Fix ProjectTag button variation 2025-01-03 11:41:00 +01:00
Rémi Verschelde
6c6e74408c
Merge pull request #94616 from Chaosus/vs_fix_vec4_constant
Change `VisualShaderNodeVec4Constant` type to vec4
2025-01-03 02:01:09 +01:00
Rémi Verschelde
d484e23bce
Merge pull request #100113 from paddy-exe/particle-emission-shape-visual-separate-pr
Add visualization of 3D particle emission shapes
2025-01-03 00:48:22 +01:00
Thaddeus Crews
df2b117ec2
Merge pull request #100317 from TCROC/fix-collision-shape-debug-color-breaks-gdextension
Fix collision shape debug color breaking GDExtension
2024-12-30 08:58:41 -06:00
Thaddeus Crews
a9b6b3d932
Merge pull request #100776 from AThousandShips/improve_null_checks
Improve use of `Ref.is_null/valid`
2024-12-29 09:35:04 -06:00
Patrick Exner
e689c122a6 Add visualization of 3D particle emission shapes
Co-authored-by: Kasper Arnklit Frandsen <kasper.arnklit@gmail.com>
2024-12-28 19:56:50 +01:00
Rémi Verschelde
ff83fdcdd7
Pre-commit: Fix applying ruff to SCsub files
Also ignore iOS template dummy.h file for header guards check.

Update ruff to 0.8.4 while at it.
2024-12-28 10:19:46 +01:00
A Thousand Ships
a1846b27ea
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
Travis Lange
f0c077deb8 fix collision shape debug color breaking gdextension 2024-12-23 15:02:54 -05:00
Yufeng Ying
73d85f46c9 Remove unused headers in scene.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-12-24 00:40:09 +08:00
Rémi Verschelde
9f42d1c3cb
Merge pull request #100678 from clayjohn/label3d-msdf
Fix shader compilation errors when using MSDF fonts with Label3D nodes
2024-12-22 00:10:16 +01:00
clayjohn
ed83e5ee4b Fix shader compilation errors when using MSDF fonts with Label3D nodes 2024-12-20 17:30:55 -07:00
Yufeng Ying
e88e30c273 Remove unused headers in servers.
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2024-12-20 18:51:01 +08:00
Thaddeus Crews
b715fabd70
Merge pull request #76371 from ze2j/array_mesh_surface_remove
Add `ArrayMesh::surface_remove`
2024-12-19 19:59:56 -06:00
Thaddeus Crews
3d523ee86d
Merge pull request #92997 from Calinou/styleboxflat-antialiasing-adjust-for-stretch-scale
Adjust StyleBoxFlat antialiasing to account for 2D stretch scale
2024-12-19 19:59:48 -06:00
Rémi Verschelde
46c8f8c5c5
Merge pull request #100093 from dalexeev/fix-collision-shape-2d-3d-debug-color
Fix `CollisionShape{2D,3D}.debug_color` inconsistencies
2024-12-18 18:23:54 +01:00
HP van Braam
eb948bc5a8 Fix a crash trying to save an empty AudioStream
My friends, gather around as I learned something about the C standard
that is horrifying and may keep you, dear reader, up at night.

My journey began trying to fix something entirely unrelated and not
wanting to wait for ubsan builds when changing a testcase. So me, in my
infinite naivete just built the engine with tests=yes, but
optimizations turned on.

This resulted in a segfault on "[Audio][AudioStreamWAV] Save empty file".

Well, then, I thought. Lets built with asan then and find out where this
happens! Would it surprise you, my fellow traveler, that the results
were that no such crash occurred?

Thus, to the debugger I go! Fearless, with great optimism. Where I find
that through many an indirection the crash came because, somehow,
CowData::_unref() was getting called with a _ptr set to 0x1.

This can of course only end in tears. Or segmentation faults as we try
to read an atomic variable at the somewhat inconveniently situated
address at 0xfffffffffffffff0.

So I went and looked at the likely culprit, blaming many an innocent
recent change along the way. I shall spare you the falsly accused. But
if for some reason you slept poorly last night, I can assure you that
the voodoo dolls have been put away and will not be harmed further.

So in AudioStreamWAV::get_data() we go, where we find a perfectly
reasonable function! It checks to see whether or not its data is empty,
and if it is not it will resize a temporary Vector to have data_bytes of
space, after which it will do a perfectly pedestrian memcpy() and all is
well in the world.

Or so it seems! After many an hour of despair and disassembly I, at
last, decided to look at where the data gets set! A breakthrough!
Because of the padding data is never empty! So the code always runs!

Eureka! One would think. But then, foolishly, I looked into the
get_data() function one more. My mortal enemy was staring me in the
face, laughing. Because it did not care about this. Sure, the check was
worthless but still... What are we left with.

At this point I could feel the method mocking me.

"I resize the vector to 0, I then memcpy zero bytes into it." It said,
DARING me to object to this state of affairs.

And yet, if I changed the function to check for "data_bytes" rather
than data.is_empty() no crashes.

Was this a compiler bug? Am I losing my mind? But then... I remembered
the mantra of the wise compiler druids... "It Is Not A Compiler Bug".

But what then! The bug does not happen when memory is being watched!
Valgrind agreed that while accessing the SafeRefCount at
0xfffffffffffffff0 was incredibly rude, it did not inform me of anything
else untoward happening. So I read the memcpy() manpage... nothing... I
read the the memcpy() posix spec... nothing.

Finally, in despair and because I had nothing left to lose... The ISO C
language specification. As I was reading, I could hear
AudioStreamWAV::get_data() cackling, knowing that its time was up, but
proud of the madness it caused in my soul. Knowing I would never be the
same.

The behavior is undefined if either dest or src is an invalid or null pointer.

So... Here I stand before you, a broken person. But one richer in
knowledge.

I write you this from the depths of madness in the hopes that you, dear
reader, can be spared this ordeal.

May god have mercy on our souls.

We trigger the following sequence of events:

* memcpy(null, null, 0) is UB, thus dest and src cannot be null
* we inline the calls to the ctor and dtor
* now we have a function that does something that "proves"
  dest cannot be null
* we inline cowdata::_unref() which does a null check, on something
  that the compiler just convinced itself cannot be null
* the compiler removes the dead code branch where _ptr == nullptr
* we start to do pointer arithmetic on a nullptr and get send to
  uninitialized memory.

Co-Authored-By: Jason Beckmann <jasonabeckmann@gmail.com>
2024-12-17 23:14:39 +01:00
Rémi Verschelde
08508d2e01
Merge pull request #99700 from hpvb/scene_tree_editor_performance
Improve Scene Tree editor performance
2024-12-16 17:16:00 +01:00