Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 3.2 #7

Open
wants to merge 41 commits into
base: official-3.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1ff8c81
[funexpected] Respect res://.import/* resource dependencies on export
jkb0o Apr 5, 2018
4245d2b
[funexpecetd] Extend iphone exporter:
jkb0o Jun 29, 2018
8e830cf
[funexpected] bypass debug/release feature tags when exporting
jkb0o Mar 13, 2019
10b42f5
[funexpected] Expose Viewport.find_control to gdscript
jkb0o Sep 4, 2018
99db141
[funexpected] Do not reset controls's scale inside containers
jkb0o Sep 4, 2018
e95fd46
[funexpected] Add parallax_visibility_notifier
jkb0o Sep 4, 2018
d53f058
[funexpected] steering_behaviours module
jkb0o Sep 4, 2018
a77cdda
[funexpected] spine module
jkb0o Feb 25, 2020
c138d08
[funexpected] Increase threads stack size.
jkb0o Sep 7, 2018
dd101b4
[funexpected] Add ios template build/install script
jkb0o Sep 7, 2018
646ec8a
[funexpected] add test point in polygon
truenoldor Oct 1, 2018
f69e187
[funexpected] Node.set_parent/kill
jkb0o Oct 4, 2018
d0dfe28
[funexpected] ios payload and reciept verification
jkb0o Nov 21, 2018
909812c
[funexpected] Optional `store_compressed` flag for vram textures to r…
jkb0o Dec 21, 2018
2aaf47a
[funexpected] expose nsobject_to/from_variant to app_delegate
jkb0o Jan 31, 2019
6f11f38
[funexpected] expose Object.call_multilevel/call_multilevel_reversed
jkb0o Feb 9, 2019
070e278
[funexpected] scene pausing by branches also
jkb0o Feb 9, 2019
621e9da
[funexpected] translate link button
jkb0o Feb 22, 2019
ac30020
[funexpected] expose resource cached resource pathes for leak detection
jkb0o Mar 1, 2019
162c7cb
[funexpected] keep gdscript stack for crash reports
jkb0o Mar 18, 2019
f1141b1
[funexpected] ImageTexture::get_data returns same images in editor ea…
jkb0o Sep 11, 2018
285cf29
[funexpected] fix string capitalization & to_lower
AndreevAndrei Apr 2, 2019
06e0538
[funexpected] Object._as_string() for string representatiopn
jkb0o Apr 8, 2019
1b445de
[funexpected] gdnative loads dependenent dynamic libraries
jkb0o May 13, 2019
fed0b8d
[funexpected] add traditional and simplified chinese translations
jkb0o Jul 5, 2019
1c343db
[funexpected] expandable RichTextLabel
jkb0o Jul 12, 2019
8da1f87
[funexpected] better translatoin selection
jkb0o Jul 31, 2019
77d8ade
[funexpected] add instance_id check to is_instance_valid()
jkb0o Jul 31, 2019
4e30440
[funexpected] send messages to NotificationCenter to allow init nativ…
sdshorin Aug 13, 2019
16709e6
[funexpected] expose ios AppStore request review
sdshorin Aug 13, 2019
f5e94e8
[funexpected] expose ios sharing
sdshorin Aug 13, 2019
27be6a3
[funexpected] fix wrong import
jkb0o Aug 15, 2019
97d3c8e
[funexpected] now `is` in GDScript can handle NativeScript as well
jkb0o Aug 29, 2019
28a162b
[funexpected] prevent crash on ios13 when entering background mode
jkb0o Oct 1, 2019
1f17743
[funexpected] implemented system font rendering for osx & ios
jkb0o Oct 8, 2019
e222cda
[funexpected] support for orientation change
jkb0o Oct 30, 2019
b12db7d
[funexpected] add iOS::get_app_version
sdshorin Dec 2, 2019
d7a51cf
[funexpected] do not warn about instance is gone after yield
jkb0o Feb 27, 2020
87213f8
[funexpected] Revert "Make VarArg methods return types show up as Var…
jkb0o Mar 2, 2020
b364f06
[funexpected] No silenced by the ring/silent switch
sdshorin Feb 26, 2020
cb6def7
[funexpected] use system fonts only for ios/osx
jkb0o Mar 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "modules/spine"]
path = modules/spine
url = git@github.com:funexpected/godot-spine-module.git
17 changes: 17 additions & 0 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ PoolStringArray _ResourceLoader::get_dependencies(const String &p_path) {
return ret;
};

PoolStringArray _ResourceLoader::get_cached_resource_pathes() {
return ResourceLoader::get_cached_resource_pathes();
}

#ifndef DISABLE_DEPRECATED
bool _ResourceLoader::has(const String &p_path) {
WARN_PRINTS("ResourceLoader.has() is deprecated, please replace it with the equivalent has_cached() or the new exists().");
Expand All @@ -132,6 +136,7 @@ void _ResourceLoader::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_recognized_extensions_for_type", "type"), &_ResourceLoader::get_recognized_extensions_for_type);
ClassDB::bind_method(D_METHOD("set_abort_on_missing_resources", "abort"), &_ResourceLoader::set_abort_on_missing_resources);
ClassDB::bind_method(D_METHOD("get_dependencies", "path"), &_ResourceLoader::get_dependencies);
ClassDB::bind_method(D_METHOD("get_cached_resource_pathes"), &_ResourceLoader::get_cached_resource_pathes);
ClassDB::bind_method(D_METHOD("has_cached", "path"), &_ResourceLoader::has_cached);
ClassDB::bind_method(D_METHOD("exists", "path", "type_hint"), &_ResourceLoader::exists, DEFVAL(""));
#ifndef DISABLE_DEPRECATED
Expand Down Expand Up @@ -1579,6 +1584,11 @@ bool _Geometry::point_is_inside_triangle(const Vector2 &s, const Vector2 &a, con
return Geometry::is_point_in_triangle(s, a, b, c);
}

bool _Geometry::point_is_inside_polygon(const Vector2 &point, const Vector<Vector2> &polygon) const{

return Geometry::is_point_in_polygon(point, polygon);
}

PoolVector<Vector3> _Geometry::segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius) {

PoolVector<Vector3> r;
Expand Down Expand Up @@ -1802,6 +1812,7 @@ void _Geometry::_bind_methods() {
ClassDB::bind_method(D_METHOD("segment_intersects_cylinder", "from", "to", "height", "radius"), &_Geometry::segment_intersects_cylinder);
ClassDB::bind_method(D_METHOD("segment_intersects_convex", "from", "to", "planes"), &_Geometry::segment_intersects_convex);
ClassDB::bind_method(D_METHOD("point_is_inside_triangle", "point", "a", "b", "c"), &_Geometry::point_is_inside_triangle);
ClassDB::bind_method(D_METHOD("point_is_inside_polygon", "point", "polygon"), &_Geometry::point_is_inside_polygon);

ClassDB::bind_method(D_METHOD("is_polygon_clockwise", "polygon"), &_Geometry::is_polygon_clockwise);
ClassDB::bind_method(D_METHOD("is_point_in_polygon", "point", "polygon"), &_Geometry::is_point_in_polygon);
Expand Down Expand Up @@ -3104,6 +3115,10 @@ bool _Engine::is_editor_hint() const {
return Engine::get_singleton()->is_editor_hint();
}

String _Engine::get_stack() const {
return Engine::get_singleton()->get_stack();
}

void _Engine::_bind_methods() {

ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
Expand Down Expand Up @@ -3139,6 +3154,8 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);

ClassDB::bind_method(D_METHOD("get_stack"), &_Engine::get_stack);

ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_hint"), "set_editor_hint", "is_editor_hint");
ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
Expand Down
4 changes: 4 additions & 0 deletions core/bind/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class _ResourceLoader : public Object {
PoolVector<String> get_recognized_extensions_for_type(const String &p_type);
void set_abort_on_missing_resources(bool p_abort);
PoolStringArray get_dependencies(const String &p_path);
PoolStringArray get_cached_resource_pathes();
#ifndef DISABLE_DEPRECATED
bool has(const String &p_path);
#endif // DISABLE_DEPRECATED
Expand Down Expand Up @@ -396,6 +397,7 @@ class _Geometry : public Object {
Variant ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const;
bool point_is_inside_polygon(const Vector2 &point, const Vector<Vector2> &polygon) const;

PoolVector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius);
PoolVector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius);
Expand Down Expand Up @@ -772,6 +774,8 @@ class _Engine : public Object {
void set_editor_hint(bool p_enabled);
bool is_editor_hint() const;

String get_stack() const;

_Engine();
};

Expand Down
17 changes: 17 additions & 0 deletions core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/authors.gen.h"
#include "core/donors.gen.h"
#include "core/license.gen.h"
#include "core/script_language.h"
#include "core/version.h"
#include "core/version_hash.gen.h"

Expand Down Expand Up @@ -208,6 +209,22 @@ void Engine::get_singletons(List<Singleton> *p_singletons) {
p_singletons->push_back(E->get());
}

String Engine::get_stack() const {
String stack = "";
for (int i = 0; i < ScriptServer::get_language_count(); i++){
ScriptLanguage *script = ScriptServer::get_language(i);
if (script->get_name() != "GDScript") continue;
// stack += script->get_name() + " stack ( " + itos(script->debug_get_stack_level_count()) + " frames )\n";
// for (int j = 0; j < script->debug_get_stack_level_count(); j++) {
// stack += " [" + itos(j) + "] " + script->debug_get_stack_level_source(j) + ":" + itos(script->debug_get_stack_level_line(j)) + " in function '" + script->debug_get_stack_level_function(j) + "'\n";
for (int j = 0; j < script->debug_get_stack_level_count(); j++) {
stack += script->debug_get_stack_level_source(j) + "\t - Line " + itos(script->debug_get_stack_level_line(j)) + "\t - " + script->debug_get_stack_level_function(j) + "|";
}
}
return stack;

}

Engine *Engine::singleton = NULL;

Engine *Engine::get_singleton() {
Expand Down
2 changes: 2 additions & 0 deletions core/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class Engine {
Dictionary get_license_info() const;
String get_license_text() const;

String get_stack() const;

Engine();
virtual ~Engine() {}
};
Expand Down
10 changes: 10 additions & 0 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,16 @@ void ResourceLoader::clear_path_remaps() {
path_remaps.clear();
}

PoolStringArray ResourceLoader::get_cached_resource_pathes() {
PoolStringArray result;
List<String> keys;
ResourceCache::resources.get_key_list(&keys);
for (List<String>::Element *E = keys.front(); E; E = E->next()) {
result.push_back(E->get());
}
return result;
}

void ResourceLoader::set_load_callback(ResourceLoadedCallback p_callback) {
_loaded_callback = p_callback;
}
Expand Down
2 changes: 2 additions & 0 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class ResourceLoader {
static void load_translation_remaps();
static void clear_translation_remaps();

static PoolStringArray get_cached_resource_pathes();

static void set_load_callback(ResourceLoadedCallback p_callback);
static ResourceLoaderImport import;

Expand Down
57 changes: 57 additions & 0 deletions core/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,46 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Vari
return Variant();
}

Variant Object::_call_multilevel_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
if (p_argcount < 1) {
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = 0;
return Variant();
}

if (p_args[0]->get_type() != Variant::STRING) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING;
return Variant();
}
r_error.error = Variant::CallError::CALL_OK;

StringName method = *p_args[0];
call_multilevel(method, &p_args[1], p_argcount - 1);
return Variant();
}

Variant Object::_call_multilevel_reversed_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
if (p_argcount < 1) {
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
r_error.argument = 0;
return Variant();
}

if (p_args[0]->get_type() != Variant::STRING) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING;
return Variant();
}
r_error.error = Variant::CallError::CALL_OK;

StringName method = *p_args[0];
call_multilevel_reversed(method, &p_args[1], p_argcount - 1);
return Variant();
}

#ifdef DEBUG_ENABLED
static void _test_call_error(const StringName &p_func, const Variant::CallError &error) {

Expand Down Expand Up @@ -1701,9 +1741,26 @@ void Object::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_deferred", &Object::_call_deferred_bind, mi, varray(), false);
}

{
MethodInfo mi;
mi.name = "call_multilevel";
mi.arguments.push_back(PropertyInfo(Variant::STRING, "method"));

ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_multilevel", &Object::_call_multilevel_bind, mi);
}

{
MethodInfo mi;
mi.name = "call_multilevel_reversed";
mi.arguments.push_back(PropertyInfo(Variant::STRING, "method"));

ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "call_multilevel_reversed", &Object::_call_multilevel_reversed_bind, mi);
}

ClassDB::bind_method(D_METHOD("set_deferred", "property", "value"), &Object::set_deferred);

ClassDB::bind_method(D_METHOD("callv", "method", "arg_array"), &Object::callv);
//ClassDB::bind_method(D_METHOD)

ClassDB::bind_method(D_METHOD("has_method", "method"), &Object::has_method);

Expand Down
2 changes: 2 additions & 0 deletions core/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ class Object {

Variant _call_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
Variant _call_deferred_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
Variant _call_multilevel_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
Variant _call_multilevel_reversed_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);

virtual const StringName *_get_class_namev() const {
if (!_class_name)
Expand Down
4 changes: 4 additions & 0 deletions core/script_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ void Script::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "source_code", PROPERTY_HINT_NONE, "", 0), "set_source_code", "get_source_code");
}

bool Script::is_equals(const Script *p_other) {
return p_other == this;
}

void ScriptServer::set_scripting_enabled(bool p_enabled) {

scripting_enabled = p_enabled;
Expand Down
1 change: 1 addition & 0 deletions core/script_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class Script : public Resource {
public:
virtual bool can_instance() const = 0;

virtual bool is_equals(const Script *p_other);
virtual Ref<Script> get_base_script() const = 0; //for script inheritance

virtual StringName get_instance_base_type() const = 0; // this may not work in all scripts, will return empty if so
Expand Down
11 changes: 11 additions & 0 deletions core/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ static const char *locale_list[] = {
"zh_HK", // Chinese (Hong Kong)
"zh_SG", // Chinese (Singapore)
"zh_TW", // Chinese (Taiwan)
"zh_Hant", // Chinese (Traditional)
"zh_Hans", // Chinese (Simplified)
"zu_ZA", // Zulu (South Africa)
0
};
Expand Down Expand Up @@ -774,6 +776,8 @@ static const char *locale_names[] = {
"Chinese (Hong Kong)",
"Chinese (Singapore)",
"Chinese (Taiwan)",
"Chinese (Traditional)",
"Chinese (Simplified)",
"Zulu (South Africa)",
0
};
Expand Down Expand Up @@ -1076,6 +1080,12 @@ StringName TranslationServer::translate(const StringName &p_message) const {
const Ref<Translation> &t = E->get();
ERR_FAIL_COND_V(t.is_null(), p_message);
String l = t->get_locale();
if (l == locale) {
res = t->get_message(p_message);
}
/*
if (lptr[0] != l[0] || lptr[1] != l[1])
continue; // locale not match

bool exact_match = (l == locale);
if (!exact_match) {
Expand All @@ -1098,6 +1108,7 @@ StringName TranslationServer::translate(const StringName &p_message) const {
} else {
near_match = true;
}
*/
}

if (!res && fallback.length() >= 2) {
Expand Down
4 changes: 2 additions & 2 deletions core/ucaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ static const int reverse_caps_table[CAPS_LEN - 1][2] = {
{ 0x0047, 0x0067 },
{ 0x0048, 0x0068 },
{ 0x0049, 0x0069 },
// { 0x0049, 0x0131 }, // dotless I
//{ 0x0049, 0x0131 },
{ 0x004A, 0x006A },
{ 0x004B, 0x006B },
{ 0x004C, 0x006C },
Expand Down Expand Up @@ -1369,7 +1369,7 @@ static const int reverse_caps_table[CAPS_LEN - 1][2] = {
{ 0xFF37, 0xFF57 },
{ 0xFF38, 0xFF58 },
{ 0xFF39, 0xFF59 },
{ 0xFF3A, 0xFF5A },
{ 0xFF3A, 0xFF5A }
};

static int _find_upper(int ch) {
Expand Down
14 changes: 12 additions & 2 deletions core/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ bool Variant::is_zero() const {
} break;
case OBJECT: {

return _get_obj().obj == NULL;
return _get_obj().obj == NULL || _get_obj().obj_id != 0 && _get_obj().obj->get_instance_id() != _get_obj().obj_id;
} break;
case NODE_PATH: {

Expand Down Expand Up @@ -1114,6 +1114,7 @@ void Variant::clear() {
} break;
case OBJECT: {

_get_obj().obj_id = 0;
_get_obj().obj = NULL;
_get_obj().ref.unref();
} break;
Expand Down Expand Up @@ -1589,7 +1590,11 @@ String Variant::stringify(List<const void *> &stack) const {
};
};
#endif
return _get_obj().obj->to_string();
if (_get_obj().obj->get_script_instance() && _get_obj().obj->get_script_instance()->has_method("_as_string")){
return _get_obj().obj->get_script_instance()->call("_as_string");
} else {
return _get_obj().obj->to_string();
}
} else
return "[Object:null]";

Expand Down Expand Up @@ -2282,7 +2287,9 @@ Variant::Variant(const RefPtr &p_resource) {
memnew_placement(_data._mem, ObjData);
REF *ref = reinterpret_cast<REF *>(p_resource.get_data());
_get_obj().obj = ref->ptr();
_get_obj().obj_id = 0;
_get_obj().ref = p_resource;

}

Variant::Variant(const RID &p_rid) {
Expand All @@ -2297,6 +2304,9 @@ Variant::Variant(const Object *p_object) {

memnew_placement(_data._mem, ObjData);
_get_obj().obj = const_cast<Object *>(p_object);
if (_get_obj().obj) {
_get_obj().obj_id = _get_obj().obj->get_instance_id();
}
}

Variant::Variant(const Dictionary &p_dictionary) {
Expand Down
2 changes: 1 addition & 1 deletion core/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ class Variant {
Type type;

struct ObjData {

Object *obj;
RefPtr ref;
uint64_t obj_id;
};

_FORCE_INLINE_ ObjData &_get_obj();
Expand Down
11 changes: 11 additions & 0 deletions doc/classes/Geometry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,17 @@
<description>
Returns if [code]point[/code] is inside the triangle specified by [code]a[/code], [code]b[/code] and [code]c[/code].
</description>
</method>
<method name="point_is_inside_polygon" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="point" type="Vector2">
</argument>
<argument index="1" name="polygon" type="PoolVector2Array">
</argument>
<description>
Returns if [code]point[/code] is inside the polygon specified by [code]a[/code], [code]b[/code] and [code]c[/code].
</description>
</method>
<method name="ray_intersects_triangle">
<return type="Variant">
Expand Down
Loading