This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
This is to prevent crashes for code like:
...
void Material::set_next_pass(const Ref<Material> &p_pass) {
ERR_FAIL_COND(p_pass == this);
...
that's been fixed in 031f763d4f
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
Previously godot_variant_new_object constructed Variant without
accounting for the fact that the Object can be a Reference, so refcount
was not increased and References were destructed prematurely.
Also, Reference::init_ref did not propagate refcount increment to the
script instance, which led to desync of refcount info on the script
side and Godot side.
Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.
This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.
It is explained in this article: https://www.viva64.com/en/b/0226/
There was no constructor for Ref from const pointer, so compiler decided
to construct Variant from pointer and then construct Ref from Variant
which turned it into NULL, because the Variant had null ref field.
Some methods require a const Ref<T> argument,
the ptrcall method wrappers cast `void *` to the
apropriate types. The problem is that there is no `Ref(const T *)`
constructor, but since Ref modifies the refcount of a Reference
anyway there's no point in a const version.
The problem is that with a `const T *` constructor call, the
argument gets converted to Variant first and loses all the
reference information, resulting in a null reference as the
argument to the constructor.
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
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).
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!