Slimmed down variant from the reverted #8375.
The rationale behind the name change is to give Godot's project file a unique
extension (".godot") that can be registered on the OS to be associated with
the Godot binary (OS registration not implemented here).
This PR also adds the possibility to start the game or editor if launched
with the project.godot passed as argument, which paves the way for allowing
a similar behaviour on a double-click in the OS file manager (code originally
by @Hinsbart).
Closes#6915.
"ALL IS GOOD" was a lie.
In particular, removes verbose "path not recognized" false positive.
The actual logic is to (somewhat naively) check all ResourceFormatLoaders
and to pick the first good match, so no need to warn about the formats
that do not match the type hint.
Fixes a bug where the VERSION_PATCH define is not yet in scope if
typedefs.h is included before version.h at compilation time.
(cherry picked from commit 3b687c5474)
PCG32 doesn't like small seeds, which leads to zero random values (prior to #7532, zero values were handled as special cases).
Use a large default seed, and also add a shift in Math::randomize.
Fixes#8423.
Notable changes:
- Now ScriptLanguages have the option to override the global external editor setting.
If `ScriptLanguage::open_in_external_editor()` returns `ERR_UNAVAILABLE` (which it does by default), then the global external editor option will be used.
- Added formatting to the external editor execution arguments. Now it's possible to write something like this: `{project} -g {file}:{line}:{col}`.
- `VisualScript::get_member_line()` now can return the line of functions (well, it returns the id of the _Function_ node of the function). I guess there is nothing else we can get a "line" from.
Fixes:
- Fixes a bug where `ScriptEditor::script_goto_method()` would not work if the script is not already open in the built-in editor.
- Fixes wrong DEFVAL for `cursor_set_column` and `cursor_set_line` in TextEdit.
- `Script::get_member_line()` now returns -1 ("found nothing") by default.
Now project files don't have to be named "godot.cfg" anymore, they can have any name so as long as it ends with *.godot.
Also godot will automatically start the editor now if launched with a project file as an argument.
This allows for double-clicking of projects to open them :)
Code-wise this should be complete, but there's still work to do:
- Make a nice icon for godot projects.
- Work on installers/packaging -> register the extension and icon with godot.
- Update the 2.1 to 3.0 exporter.
Tested on linux and windows so far.
There was a logic error in #7815 which made
Variant.hash_compare() == Variant.hash_compare() always true.
In an attempt to short-circuit the NaN check I made an (in hindsight) obvious
error: 10 == 12 || is_nan(10) == is_nan(12)
This will be true for all inputs, except for the NaN, not-NaN case. The macro
has been updated to now generate:
(10 == 12) || (is_nan(10) && is_nan(10))
so:
(10 == 12) || (is_nan(10) && is_nan(12)) = false
False or (False and False) is False
(10 == 10) || (is_nan(10) && is_nan(10)) = true
True or (False and False) is True
(Nan == 10) || (is_nan(NaN) && is_nan(10)) = false
False or (True and False) is False
(Nan == Nan) || (is_nan(NaN) && is_nan(NaN)) = true
False or (True and True) is True
Which is correct for all cases.
This bug was triggered because the hash function for floating point numbers
can very easily generate collisions for the tested Vector3(). I've also added
an extra hashing step to the float hash function to make this less likely to
occur.
This fixes#8081 and probably many more random weirdness.
Added set_scale, set_rotation_euler, set_rotation_axis_angle. Addresses #2565 directly.
Added an euler angle constructor for Basis in GDScript and also exposed is_normalized for vectors and quaternions.
Various other changes mostly cosmetic in nature.
This module was written by bojidar-bg and me, with the help of ClikCode and touilleMan.
This adds a module to Godot that enables the use of dynamic libraries as a source for scripts.
That also allows third party libraries to be linked to Godot more easily and without creating modules.
For a readme see https://github.com/GodotNativeTools/godot_headers/blob/master/README.md
This is in alignment with other functions in vector classes.
Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs.
Fixes#8201.
When performing polar decomposition in 2D as B = R.S, where R is rotation (with determinant +1) and S is scaling, use the convention that reflections are absorbed into S through a reflection around y axis.
In 3D, this is done by using a reflection along all three axes, but since the dimensionality is even in 2D, one axis needs to be chosen.
Fixes Matrix32::get_rotation and Matrix32::get_scale (which weren't properly fixed in #7445).
**Breaking change**
Removed the `JOY_SNES_*` and `JOY_SEGA_*` constants. Imho there's no reason for a modern game engine to provide button aliases for decades-old hardware.
Also renamed `JOY_ANALOG_{0,1}_{X,Y}` to `JOY_ANALOG_{L,R}{X,Y}` and removed `JOY_ANALOG_2_*`.
Enabled by default as in Blender, but can be disabled separately for 2D & 3D;
the core functionality is in Input so this could be reused or even exposed to scripts in the future
When using get_tree().input_event(ev), the engine will JUST send the event down the SceneTree.
However, you won't get any of the benefits of the Input singleton:
- No InputMap actions will be emitted
- The internal input state won't be modified, so methods like `Input.get_mouse_pos()` or `Input.is_joy_button_pressed` won't return the expected output after sending the event.
This is fixed by using `Input.parse_input_event(ev)` instead.
I guess we'll also have to update the docs to reflect that this is the preferred method of sending custom InputEvents.
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Done:
- X11, server (tested)
- Windows (developed, would be nice to retest)
- OSX (not tested)
Prepared (not developed):
- Android (code is here, but may not compile)
- iphone
- winrt
- bb10
- haiku
- javascript
- Add FIXME tags comments to some unfixed potential bugs
- Remove some checks (always false: unsigned never < 0)
- Fix some if statements based on reviews.
- Bunch of missing `else` statements
This fixes HashMap where a key or part of a key is a floating point
number. To fix this the following has been done:
* HashMap now takes an extra template argument Comparator. This class
gets used to compare keys. The default Comperator now works correctly
for common types and floating point numbets.
* Variant implements ::hash_compare() now. This function implements
nan-safe comparison for all types with components that contain floating
point numbers.
* Variant now has a VariantComparator which uses Variant::hash_compare()
safely compare floating point components of variant's types.
* The hash functions for floating point numbers will now normalize NaN
values so that all floating point numbers that are NaN hash to the same
value.
C++ module writers that want to use HashMap internally in their modules
can now also safeguard against this crash by defining their on
Comperator class that safely compares their types.
GDScript users, or writers of modules that don't use HashMap internally
in their modules don't need to do anything.
This fixes#7354 and fixes#6947.
After discussing this with Reduz this seemed like the best way to
fix#7354. This will make composite values that contain NaN in the same
places as well as the same other values compare as the same.
Additionally non-composite values now also compare equal if they are
both NaN. This breaks IEEE specifications but this is probably what most
users expect. There is a GDScript function check for NaN if the user
needs this information.
This fixes#7354 and probably also fixes#6947
This means, if you press "F" while holding "shift" and there is and
action registered for "F" that action should be pressed.
This commit restore this behaviour, lost when implementing
is_action_just_pressed.
If you want "blocking modifiers" you should code it via script.
Fixes 6826
- TCP:
- `listen` bind to wildcard "*" -> dual stack socket
- `listen` bind to address -> socket from address type
- `connect` -> resolve using best protocol (UNSPEC), socket from address type
- UDP:
- `listen` bind to wildcard "*" -> dual stack socket
- `listen` bind to address -> socket from address type
- `put_packet`/`put_var` -> resolve using TYPE_ANY (UNSPEC), socket from address type
(to change socket type you must first call `close` it)
Serialize dictionaries adding newlines between key-value pairs
Serialize group lists also with newlines in between
Serialize string properties escaping only " and \ (needed for a good diff experience with built-in scripts and shaders)
Bonus:
Make AnimationPlayer serialize its blend times always sorted so their order is predictable in the .tscn file.
This PR is back-compat; won't break the load of existing files.
clang-format does not handle that well *at all*.
For the reference, found the relevant pieces of code with:
`ag "=[ "$'\t'"]?"$'\n'"[ "$'\t'"]?{" --ignore=thirdparty`
Made sure files in core/ and tools/ have a proper Godot license header
when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h}
to rect3.{cpp,h} and class_db.{cpp,h} respectively.
Also added a proper header to core/io/base64.{c,h} after clarifying
the licensing with the original author (public domain).
When clang-format sorts includes alphabetically, MethodBind breaks.
Trying to move the object.h include upward in method_bind.h does
not seem to fix the problem, this needs investigation.