diff options
56 files changed, 909 insertions, 627 deletions
diff --git a/core/SCsub b/core/SCsub index 383aaf0e12..c4f1cdbe97 100644 --- a/core/SCsub +++ b/core/SCsub @@ -2,6 +2,8 @@ Import('env') +import methods + env.core_sources = [] @@ -93,6 +95,17 @@ env.add_source_files(env.core_sources, "*.cpp") import make_binders env.Command(['method_bind.gen.inc', 'method_bind_ext.gen.inc'], 'make_binders.py', make_binders.run) +# Authors +env.Depends('#core/authors.gen.h', "../AUTHORS.md") +env.Command('#core/authors.gen.h', "../AUTHORS.md", methods.make_authors_header) + +# Donors +env.Depends('#core/donors.gen.h', "../DONORS.md") +env.Command('#core/donors.gen.h', "../DONORS.md", methods.make_donors_header) + +# License +env.Depends('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) +env.Command('#core/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], methods.make_license_header) # Chain load SCsubs SConscript('os/SCsub') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 3270b33f1c..14e3804840 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2710,6 +2710,26 @@ Dictionary _Engine::get_version_info() const { return Engine::get_singleton()->get_version_info(); } +Dictionary _Engine::get_author_info() const { + return Engine::get_singleton()->get_author_info(); +} + +Array _Engine::get_copyright_info() const { + return Engine::get_singleton()->get_copyright_info(); +} + +Dictionary _Engine::get_donor_info() const { + return Engine::get_singleton()->get_donor_info(); +} + +Dictionary _Engine::get_license_info() const { + return Engine::get_singleton()->get_license_info(); +} + +String _Engine::get_license_text() const { + return Engine::get_singleton()->get_license_text(); +} + bool _Engine::is_in_physics_frame() const { return Engine::get_singleton()->is_in_physics_frame(); } @@ -2752,6 +2772,11 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop); ClassDB::bind_method(D_METHOD("get_version_info"), &_Engine::get_version_info); + ClassDB::bind_method(D_METHOD("get_author_info"), &_Engine::get_author_info); + ClassDB::bind_method(D_METHOD("get_copyright_info"), &_Engine::get_copyright_info); + ClassDB::bind_method(D_METHOD("get_donor_info"), &_Engine::get_donor_info); + ClassDB::bind_method(D_METHOD("get_license_info"), &_Engine::get_license_info); + ClassDB::bind_method(D_METHOD("get_license_text"), &_Engine::get_license_text); ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &_Engine::is_in_physics_frame); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index a363f5970f..1de5e43b27 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -689,6 +689,11 @@ public: MainLoop *get_main_loop() const; Dictionary get_version_info() const; + Dictionary get_author_info() const; + Array get_copyright_info() const; + Dictionary get_donor_info() const; + Dictionary get_license_info() const; + String get_license_text() const; bool is_in_physics_frame() const; diff --git a/core/engine.cpp b/core/engine.cpp index b2c34a853c..7c8024b946 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -30,6 +30,9 @@ #include "engine.h" +#include "authors.gen.h" +#include "donors.gen.h" +#include "license.gen.h" #include "version.h" #include "version_hash.gen.h" @@ -111,6 +114,78 @@ Dictionary Engine::get_version_info() const { return dict; } +static Array array_from_info(const char *const *info_list) { + Array arr; + for (int i = 0; info_list[i] != NULL; i++) { + arr.push_back(info_list[i]); + } + return arr; +} + +static Array array_from_info_count(const char *const *info_list, int info_count) { + Array arr; + for (int i = 0; i < info_count; i++) { + arr.push_back(info_list[i]); + } + return arr; +} + +Dictionary Engine::get_author_info() const { + Dictionary dict; + + dict["lead_developers"] = array_from_info(AUTHORS_LEAD_DEVELOPERS); + dict["project_managers"] = array_from_info(AUTHORS_PROJECT_MANAGERS); + dict["founders"] = array_from_info(AUTHORS_FOUNDERS); + dict["developers"] = array_from_info(AUTHORS_DEVELOPERS); + + return dict; +} + +Array Engine::get_copyright_info() const { + Array components; + for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) { + const ComponentCopyright &cp_info = COPYRIGHT_INFO[component_index]; + Dictionary component_dict; + component_dict["name"] = cp_info.name; + Array parts; + for (int i = 0; i < cp_info.part_count; i++) { + const ComponentCopyrightPart &cp_part = cp_info.parts[i]; + Dictionary part_dict; + part_dict["files"] = array_from_info_count(cp_part.files, cp_part.file_count); + part_dict["copyright"] = array_from_info_count(cp_part.copyright_statements, cp_part.copyright_count); + part_dict["license"] = cp_part.license; + parts.push_back(part_dict); + } + component_dict["parts"] = parts; + + components.push_back(component_dict); + } + return components; +} + +Dictionary Engine::get_donor_info() const { + Dictionary donors; + donors["platinum_sponsors"] = array_from_info(DONORS_SPONSOR_PLAT); + donors["gold_sponsors"] = array_from_info(DONORS_SPONSOR_GOLD); + donors["mini_sponsors"] = array_from_info(DONORS_SPONSOR_MINI); + donors["gold_donors"] = array_from_info(DONORS_GOLD); + donors["silver_donors"] = array_from_info(DONORS_SILVER); + donors["bronze_donors"] = array_from_info(DONORS_BRONZE); + return donors; +} + +Dictionary Engine::get_license_info() const { + Dictionary licenses; + for (int i = 0; i < LICENSE_COUNT; i++) { + licenses[LICENSE_NAMES[i]] = LICENSE_BODIES[i]; + } + return licenses; +} + +String Engine::get_license_text() const { + return String(GODOT_LICENSE_TEXT); +} + void Engine::add_singleton(const Singleton &p_singleton) { singletons.push_back(p_singleton); diff --git a/core/engine.h b/core/engine.h index 665992699a..031ba29cd6 100644 --- a/core/engine.h +++ b/core/engine.h @@ -118,6 +118,11 @@ public: #endif Dictionary get_version_info() const; + Dictionary get_author_info() const; + Array get_copyright_info() const; + Dictionary get_donor_info() const; + Dictionary get_license_info() const; + String get_license_text() const; Engine(); }; diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 9e301ccac5..8d85e78226 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -248,6 +248,7 @@ void HTTPClient::close() { body_size = 0; body_left = 0; chunk_left = 0; + read_until_eof = false; response_num = 0; } @@ -352,10 +353,17 @@ Error HTTPClient::poll() { chunked = false; body_left = 0; chunk_left = 0; + read_until_eof = false; response_str.clear(); response_headers.clear(); response_num = RESPONSE_OK; + // Per the HTTP 1.1 spec, keep-alive is the default, but in practice + // it's safe to assume it only if the explicit header is found, allowing + // to handle body-up-to-EOF responses on naive servers; that's what Curl + // and browsers do + bool keep_alive = false; + for (int i = 0; i < responses.size(); i++) { String header = responses[i].strip_edges(); @@ -365,13 +373,14 @@ Error HTTPClient::poll() { if (s.begins_with("content-length:")) { body_size = s.substr(s.find(":") + 1, s.length()).strip_edges().to_int(); body_left = body_size; - } - if (s.begins_with("transfer-encoding:")) { + } else if (s.begins_with("transfer-encoding:")) { String encoding = header.substr(header.find(":") + 1, header.length()).strip_edges(); if (encoding == "chunked") { chunked = true; } + } else if (s.begins_with("connection: keep-alive")) { + keep_alive = true; } if (i == 0 && responses[i].begins_with("HTTP")) { @@ -384,11 +393,16 @@ Error HTTPClient::poll() { } } - if (body_size == 0 && !chunked) { + if (body_size || chunked) { - status = STATUS_CONNECTED; // Ready for new requests - } else { status = STATUS_BODY; + } else if (!keep_alive) { + + read_until_eof = true; + status = STATUS_BODY; + } else { + + status = STATUS_CONNECTED; } return OK; } @@ -515,34 +529,53 @@ PoolByteArray HTTPClient::read_response_body_chunk() { } else { - int to_read = MIN(body_left, read_chunk_size); + int to_read = !read_until_eof ? MIN(body_left, read_chunk_size) : read_chunk_size; PoolByteArray ret; ret.resize(to_read); int _offset = 0; - while (to_read > 0) { + while (read_until_eof || to_read > 0) { int rec = 0; { PoolByteArray::Write w = ret.write(); err = _get_http_data(w.ptr() + _offset, to_read, rec); } - if (rec > 0) { - body_left -= rec; - to_read -= rec; - _offset += rec; - } else { + if (rec < 0) { if (to_read > 0) // Ended up reading less ret.resize(_offset); break; + } else { + _offset += rec; + if (!read_until_eof) { + body_left -= rec; + to_read -= rec; + } else { + if (rec < to_read) { + ret.resize(_offset); + err = ERR_FILE_EOF; + break; + } + ret.resize(_offset + to_read); + } } } - if (body_left == 0) { - status = STATUS_CONNECTED; + if (!read_until_eof) { + if (body_left == 0) { + status = STATUS_CONNECTED; + } + return ret; + } else { + if (err == ERR_FILE_EOF) { + err = OK; // EOF is expected here + close(); + return ret; + } } - return ret; } if (err != OK) { + close(); + if (err == ERR_FILE_EOF) { status = STATUS_DISCONNECTED; // Server disconnected @@ -602,6 +635,7 @@ HTTPClient::HTTPClient() { body_size = 0; chunked = false; body_left = 0; + read_until_eof = false; chunk_left = 0; response_num = 0; ssl = false; diff --git a/core/io/http_client.h b/core/io/http_client.h index 839012e701..38ec82ce8c 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -173,6 +173,7 @@ private: int chunk_left; int body_size; int body_left; + bool read_until_eof; Ref<StreamPeerTCP> tcp_connection; Ref<StreamPeer> connection; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index ac4a4b7d15..ef485cb3b2 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1071,6 +1071,7 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_mode", 2); GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); + GLOBAL_DEF("debug/settings/performance/update_frequency_msec", 250); //assigning here, because using GLOBAL_GET on every block for compressing can be slow Compression::zstd_long_distance_matching = GLOBAL_DEF("compression/formats/zstd/long_distance_matching", false); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 75bcedbbc8..22e9fe31b5 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -567,22 +567,46 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) { if (ScriptInstance *si = obj->get_script_instance()) { if (!si->get_script().is_null()) { - Set<StringName> members; - si->get_script()->get_members(&members); - for (Set<StringName>::Element *E = members.front(); E; E = E->next()) { - - Variant m; - if (si->get(E->get(), m)) { - PropertyInfo pi(m.get_type(), String("Members/") + E->get()); - properties.push_back(PropertyDesc(pi, m)); + typedef Map<const Script *, Set<StringName> > ScriptMemberMap; + typedef Map<const Script *, Map<StringName, Variant> > ScriptConstantsMap; + + ScriptMemberMap members; + members[si->get_script().ptr()] = Set<StringName>(); + si->get_script()->get_members(&(members[si->get_script().ptr()])); + + ScriptConstantsMap constants; + constants[si->get_script().ptr()] = Map<StringName, Variant>(); + si->get_script()->get_constants(&(constants[si->get_script().ptr()])); + + Ref<Script> base = si->get_script()->get_base_script(); + while (base.is_valid()) { + + members[base.ptr()] = Set<StringName>(); + base->get_members(&(members[base.ptr()])); + + constants[base.ptr()] = Map<StringName, Variant>(); + base->get_constants(&(constants[base.ptr()])); + + base = base->get_base_script(); + } + + for (ScriptMemberMap::Element *sm = members.front(); sm; sm = sm->next()) { + for (Set<StringName>::Element *E = sm->get().front(); E; E = E->next()) { + Variant m; + if (si->get(E->get(), m)) { + String script_path = sm->key() == si->get_script().ptr() ? "" : sm->key()->get_path().get_file() + "/"; + PropertyInfo pi(m.get_type(), "Members/" + script_path + E->get()); + properties.push_back(PropertyDesc(pi, m)); + } } } - Map<StringName, Variant> constants; - si->get_script()->get_constants(&constants); - for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) { - PropertyInfo pi(E->value().get_type(), (String("Constants/") + E->key())); - properties.push_back(PropertyDesc(pi, E->value())); + for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) { + for (Map<StringName, Variant>::Element *E = sc->get().front(); E; E = E->next()) { + String script_path = sc->key() == si->get_script().ptr() ? "" : sc->key()->get_path().get_file() + "/"; + PropertyInfo pi(E->value().get_type(), "Constants/" + script_path + E->key()); + properties.push_back(PropertyDesc(pi, E->value())); + } } } } @@ -658,8 +682,10 @@ void ScriptDebuggerRemote::_set_object_property(ObjectID p_id, const String &p_p return; String prop_name = p_property; - if (p_property.begins_with("Members/")) - prop_name = p_property.substr(8, p_property.length()); + if (p_property.begins_with("Members/")) { + Vector<String> ss = p_property.split("/"); + prop_name = ss[ss.size() - 1]; + } obj->set(prop_name, p_value); } @@ -854,7 +880,7 @@ void ScriptDebuggerRemote::idle_poll() { if (performance) { uint64_t pt = OS::get_singleton()->get_ticks_msec(); - if (pt - last_perf_time > 1000) { + if (pt - last_perf_time > update_frequency) { last_perf_time = pt; int max = performance->get("MONITOR_MAX"); @@ -1081,7 +1107,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() : eh.userdata = this; add_error_handler(&eh); - profile_info.resize(CLAMP(int(ProjectSettings::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535)); + profile_info.resize(CLAMP(int(GLOBAL_GET("debug/settings/profiler/max_functions")), 128, 65535)); profile_info_ptrs.resize(profile_info.size()); } diff --git a/core/script_language.cpp b/core/script_language.cpp index 1dab58e29e..ce9b138bb2 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "script_language.h" +#include "project_settings.h" ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES]; int ScriptServer::_language_count = 0; @@ -283,6 +284,7 @@ ScriptDebugger::ScriptDebugger() { lines_left = -1; depth = -1; break_lang = NULL; + update_frequency = GLOBAL_GET("debug/settings/performance/update_frequency_msec"); } bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) { diff --git a/core/script_language.h b/core/script_language.h index b4c55cac9e..64c6f2eb81 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -352,6 +352,8 @@ class ScriptDebugger { public: typedef void (*RequestSceneTreeMessageFunc)(void *); + int update_frequency; + struct LiveEditFuncs { void *udata; diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml index 8b6651abe7..b6abda1a6f 100644 --- a/doc/classes/AudioStreamSample.xml +++ b/doc/classes/AudioStreamSample.xml @@ -13,6 +13,9 @@ <methods> </methods> <members> + <member name="data" type="PoolByteArray" setter="set_data" getter="get_data"> + Contains the audio data in bytes. + </member> <member name="format" type="int" setter="set_format" getter="get_format" enum="AudioStreamSample.Format"> Audio format. See FORMAT_* constants for values. </member> diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index cc2ae4e768..3273005395 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -11,6 +11,36 @@ <demos> </demos> <methods> + <method name="get_author_info" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + Returns engine author information in a Dictionary. + + "lead_developers" - Array of Strings, lead developer names + "founders" - Array of Strings, founder names + "project_managers" - Array of Strings, project manager names + "developers" - Array of Strings, developer names + </description> + </method> + <method name="get_copyright_info" qualifiers="const"> + <return type="Array"> + </return> + <description> + Returns an Array of copyright information Dictionaries. + + "name" - String, component name + "parts" - Array of Dictionaries {"files", "copyright", "license"} describing subsections of the component + </description> + </method> + <method name="get_donor_info" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + Returns a Dictionary of Arrays of donor names. + {"platinum_sponsors", "gold_sponsors", "mini_sponsors", "gold_donors", "silver_donors", "bronze_donors"} + </description> + </method> <method name="get_frames_drawn"> <return type="int"> </return> @@ -25,6 +55,20 @@ Returns the frames per second of the running game. </description> </method> + <method name="get_license_info" qualifiers="const"> + <return type="Dictionary"> + </return> + <description> + Returns Dictionary of licenses used by Godot and included third party components. + </description> + </method> + <method name="get_license_text" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns Godot license text. + </description> + </method> <method name="get_main_loop" qualifiers="const"> <return type="MainLoop"> </return> diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index 157bf42239..ca035ad383 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -24,7 +24,7 @@ <argument index="3" name="d" type="float"> </argument> <description> - Creates a plane from the three parameters "a", "b", "c" and "d". + Creates a plane from the four parameters "a", "b", "c" and "d". </description> </method> <method name="Plane"> diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 55063bbe24..b2cde861c8 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -34,7 +34,7 @@ <argument index="2" name="method" type="String"> </argument> <description> - Calls [code]method[/code] on each member of the given group, respecting the given [enum GROUP_CALL] flags. + Calls [code]method[/code] on each member of the given group, respecting the given [enum GroupCallFlags]. </description> </method> <method name="change_scene"> @@ -160,7 +160,7 @@ <argument index="2" name="notification" type="int"> </argument> <description> - Sends the given notification to all members of the [code]group[/code], respecting the given [enum GROUP_CALL] flags. + Sends the given notification to all members of the [code]group[/code], respecting the given [enum GroupCallFlags]. </description> </method> <method name="queue_delete"> @@ -220,7 +220,7 @@ <argument index="3" name="value" type="Variant"> </argument> <description> - Sets the given [code]property[/code] to [code]value[/code] on all members of the given group, respecting the given [enum GROUP_CALL] flags. + Sets the given [code]property[/code] to [code]value[/code] on all members of the given group, respecting the given [enum GroupCallFlags]. </description> </method> <method name="set_input_as_handled"> diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml index 732881c777..7c07778a05 100644 --- a/doc/classes/Shader.xml +++ b/doc/classes/Shader.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Shader" inherits="Resource" category="Core" version="3.1"> <brief_description> - To be changed, ignore. + A custom shader program. </brief_description> <description> - To be changed, ignore. + This class allows you to define a custom shader program that can be used for various materials to render objects. </description> <tutorials> http://docs.godotengine.org/en/3.0/tutorials/shading/index.html @@ -24,6 +24,7 @@ <return type="int" enum="Shader.Mode"> </return> <description> + Returns the shader mode for the shader, eiter [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code] </description> </method> <method name="has_param" qualifiers="const"> diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml index 4767686a8f..058e00e46c 100644 --- a/doc/classes/ShaderMaterial.xml +++ b/doc/classes/ShaderMaterial.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ShaderMaterial" inherits="Material" category="Core" version="3.1"> <brief_description> + A material that uses a custom [Shader] program </brief_description> <description> + A material that uses a custom [Shader] program to render either items to screen or process particles. You can create multiple materials for the same shader but configure different values for the uniforms defined in the shader. </description> <tutorials> </tutorials> @@ -15,6 +17,7 @@ <argument index="0" name="param" type="String"> </argument> <description> + Returns the current value set for this material of a uniform in the shader </description> </method> <method name="set_shader_param"> @@ -25,11 +28,13 @@ <argument index="1" name="value" type="Variant"> </argument> <description> + Changes the value set for this material of a uniform in the shader </description> </method> </methods> <members> <member name="shader" type="Shader" setter="set_shader" getter="get_shader"> + The [Shader] program used to render this material </member> </members> <constants> diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index ff423bf0d0..bb4c8ab4d7 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -193,11 +193,11 @@ void RasterizerCanvasGLES3::canvas_end() { state.using_ninepatch = false; } -RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map) { +RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force) { RasterizerStorageGLES3::Texture *tex_return = NULL; - if (p_texture == state.current_tex) { + if (p_texture == state.current_tex && !p_force) { tex_return = state.current_tex_ptr; } else if (p_texture.is_valid()) { @@ -232,7 +232,7 @@ RasterizerStorageGLES3::Texture *RasterizerCanvasGLES3::_bind_canvas_texture(con state.current_tex_ptr = NULL; } - if (p_normal_map == state.current_normal) { + if (p_normal_map == state.current_normal && !p_force) { //do none state.canvas_shader.set_uniform(CanvasShaderGLES3::USE_DEFAULT_NORMAL, state.current_normal.is_valid()); @@ -1086,7 +1086,7 @@ void RasterizerCanvasGLES3::_copy_texscreen(const Rect2 &p_rect) { state.using_texture_rect = true; _set_texture_rect_mode(false); - _bind_canvas_texture(state.current_tex, state.current_normal); + _bind_canvas_texture(state.current_tex, state.current_normal, true); glEnable(GL_BLEND); } diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index bfaf1fdb4b..c7f2e54efb 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -123,7 +123,7 @@ public: virtual void canvas_end(); _FORCE_INLINE_ void _set_texture_rect_mode(bool p_enable, bool p_ninepatch = false); - _FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map); + _FORCE_INLINE_ RasterizerStorageGLES3::Texture *_bind_canvas_texture(const RID &p_texture, const RID &p_normal_map, bool p_force = false); _FORCE_INLINE_ void _draw_gui_primitive(int p_points, const Vector2 *p_vertices, const Color *p_colors, const Vector2 *p_uvs); _FORCE_INLINE_ void _draw_polygon(const int *p_indices, int p_index_count, int p_vertex_count, const Vector2 *p_vertices, const Vector2 *p_uvs, const Color *p_colors, bool p_singlecolor, const int *p_bones, const float *p_weights); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 8da2c2f9c2..03ff84c093 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2363,10 +2363,9 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C ERR_FAIL_COND(!tex); glActiveTexture(GL_TEXTURE0); - if (tex->proxy && tex->proxy->tex_id) - glBindTexture(tex->target, tex->proxy->tex_id); - else - glBindTexture(tex->target, tex->tex_id); + tex = tex->get_ptr(); //resolve for proxies + + glBindTexture(tex->target, tex->tex_id); if (storage->config.srgb_decode_supported && tex->srgb && !tex->using_srgb) { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 85ae69f8b8..11ab957458 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1356,6 +1356,8 @@ void RasterizerStorageGLES3::sky_set_texture(RID p_sky, RID p_panorama, int p_ra ERR_FAIL_COND(!texture); } + texture = texture->get_ptr(); //resolve for proxies + glBindVertexArray(0); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); @@ -5895,12 +5897,9 @@ void RasterizerStorageGLES3::update_particles() { tex = resources.white_tex; } break; } - } else if (t->proxy && t->proxy->tex_id) { - - target = t->proxy->target; - tex = t->proxy->tex_id; } else { + t = t->get_ptr(); //resolve for proxies target = t->target; tex = t->tex_id; } diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index 6d798f32f9..44b9ef1d7c 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -297,6 +297,7 @@ Error StreamPeerTCPPosix::read(uint8_t *p_buffer, int p_bytes, int &r_received, status = STATUS_NONE; peer_port = 0; peer_host = IP_Address(); + r_received = total_read; return ERR_FILE_EOF; } else { diff --git a/drivers/windows/stream_peer_tcp_winsock.cpp b/drivers/windows/stream_peer_tcp_winsock.cpp index cb501ce35d..19c937170b 100644 --- a/drivers/windows/stream_peer_tcp_winsock.cpp +++ b/drivers/windows/stream_peer_tcp_winsock.cpp @@ -212,6 +212,7 @@ Error StreamPeerTCPWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received _block(sockfd, true, false); } else if (read == 0) { disconnect_from_host(); + r_received = total_read; return ERR_FILE_EOF; } else { diff --git a/editor/SCsub b/editor/SCsub index 4ca6b9e3fd..c29da8dd8a 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -7,7 +7,6 @@ import os import os.path from compat import encode_utf8, byte_to_str, open_utf8, escape_string - def make_certs_header(target, source, env): src = source[0].srcnode().abspath @@ -147,268 +146,6 @@ def make_translations_header(target, source, env): g.close() - -def make_authors_header(target, source, env): - - sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"] - sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"] - - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open_utf8(src, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_AUTHORS_H\n") - g.write("#define _EDITOR_AUTHORS_H\n") - - current_section = "" - reading = False - - def close_section(): - g.write("\t0\n") - g.write("};\n") - - for line in f: - if reading: - if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") - continue - if line.startswith("## "): - if reading: - close_section() - reading = False - for i in range(len(sections)): - if line.strip().endswith(sections[i]): - current_section = escape_string(sections_id[i]) - reading = True - g.write("static const char *" + current_section + "[] = {\n") - break - - if reading: - close_section() - - g.write("#endif\n") - - g.close() - f.close() - -def make_donors_header(target, source, env): - - sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", "Gold donors", "Silver donors", "Bronze donors"] - sections_id = ["donor_s_plat", "donor_s_gold", "donor_s_mini", "donor_gold", "donor_silver", "donor_bronze"] - - src = source[0].srcnode().abspath - dst = target[0].srcnode().abspath - f = open_utf8(src, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_DONORS_H\n") - g.write("#define _EDITOR_DONORS_H\n") - - current_section = "" - reading = False - - def close_section(): - g.write("\t0\n") - g.write("};\n") - - for line in f: - if reading >= 0: - if line.startswith(" "): - g.write("\t\"" + escape_string(line.strip()) + "\",\n") - continue - if line.startswith("## "): - if reading: - close_section() - reading = False - for i in range(len(sections)): - if line.strip().endswith(sections[i]): - current_section = escape_string(sections_id[i]) - reading = True - g.write("static const char *" + current_section + "[] = {\n") - break - - if reading: - close_section() - - g.write("#endif\n") - - g.close() - f.close() - - -def make_license_header(target, source, env): - - src_copyright = source[0].srcnode().abspath - src_license = source[1].srcnode().abspath - dst = target[0].srcnode().abspath - f = open_utf8(src_license, "r") - fc = open_utf8(src_copyright, "r") - g = open_utf8(dst, "w") - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_LICENSE_H\n") - g.write("#define _EDITOR_LICENSE_H\n") - g.write("static const char *about_license =") - - for line in f: - escaped_string = escape_string(line.strip()) - g.write("\n\t\"" + escaped_string + "\\n\"") - - g.write(";\n") - - tp_current = 0 - tp_file = "" - tp_comment = "" - tp_copyright = "" - tp_license = "" - - tp_licensename = "" - tp_licensebody = "" - - tp = [] - tp_licensetext = [] - for line in fc: - if line.startswith("#"): - continue - - if line.startswith("Files:"): - tp_file = line[6:].strip() - tp_current = 1 - elif line.startswith("Comment:"): - tp_comment = line[8:].strip() - tp_current = 2 - elif line.startswith("Copyright:"): - tp_copyright = line[10:].strip() - tp_current = 3 - elif line.startswith("License:"): - if tp_current != 0: - tp_license = line[8:].strip() - tp_current = 4 - else: - tp_licensename = line[8:].strip() - tp_current = 5 - elif line.startswith(" "): - if tp_current == 1: - tp_file += "\n" + line.strip() - elif tp_current == 3: - tp_copyright += "\n" + line.strip() - elif tp_current == 5: - if line.strip() == ".": - tp_licensebody += "\n" - else: - tp_licensebody += line[1:] - else: - if tp_current != 0: - if tp_current == 5: - tp_licensetext.append([tp_licensename, tp_licensebody]) - - tp_licensename = "" - tp_licensebody = "" - else: - added = False - for i in tp: - if i[0] == tp_comment: - i[1].append([tp_file, tp_copyright, tp_license]) - added = True - break - if not added: - tp.append([tp_comment,[[tp_file, tp_copyright, tp_license]]]) - - tp_file = [] - tp_comment = "" - tp_copyright = [] - tp_license = "" - tp_current = 0 - - tp_licensetext.append([tp_licensename, tp_licensebody]) - - about_thirdparty = "" - about_tp_copyright_count = "" - about_tp_license = "" - about_tp_copyright = "" - about_tp_file = "" - - for i in tp: - about_thirdparty += "\t\"" + i[0] + "\",\n" - about_tp_copyright_count += str(len(i[1])) + ", " - for j in i[1]: - file_body = "" - copyright_body = "" - for k in j[0].split("\n"): - if file_body != "": - file_body += "\\n\"\n" - escaped_string = escape_string(k.strip()) - file_body += "\t\"" + escaped_string - for k in j[1].split("\n"): - if copyright_body != "": - copyright_body += "\\n\"\n" - escaped_string = escape_string(k.strip()) - copyright_body += "\t\"" + escaped_string - - about_tp_file += "\t" + file_body + "\",\n" - about_tp_copyright += "\t" + copyright_body + "\",\n" - about_tp_license += "\t\"" + j[2] + "\",\n" - - about_license_name = "" - about_license_body = "" - - for i in tp_licensetext: - body = "" - for j in i[1].split("\n"): - if body != "": - body += "\\n\"\n" - escaped_string = escape_string(j.strip()) - body += "\t\"" + escaped_string - - about_license_name += "\t\"" + i[0] + "\",\n" - about_license_body += "\t" + body + "\",\n" - - g.write("static const char *about_thirdparty[] = {\n") - g.write(about_thirdparty) - g.write("\t0\n") - g.write("};\n") - g.write("#define THIRDPARTY_COUNT " + str(len(tp)) + "\n") - - g.write("static const int about_tp_copyright_count[] = {\n\t") - g.write(about_tp_copyright_count) - g.write("0\n};\n") - - g.write("static const char *about_tp_file[] = {\n") - g.write(about_tp_file) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_tp_copyright[] = {\n") - g.write(about_tp_copyright) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_tp_license[] = {\n") - g.write(about_tp_license) - g.write("\t0\n") - g.write("};\n") - - g.write("static const char *about_license_name[] = {\n") - g.write(about_license_name) - g.write("\t0\n") - g.write("};\n") - g.write("#define LICENSE_COUNT " + str(len(tp_licensetext)) + "\n") - - g.write("static const char *about_license_body[] = {\n") - g.write(about_license_body) - g.write("\t0\n") - g.write("};\n") - - g.write("#endif\n") - - g.close() - fc.close() - f.close() - - def _make_doc_data_class_path(to_path): g = open_utf8(os.path.join(to_path,"doc_data_class_path.gen.h"), "w") g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n") @@ -474,19 +211,6 @@ if env['tools']: env.Depends('#editor/builtin_fonts.gen.h', flist) env.Command('#editor/builtin_fonts.gen.h', flist, make_fonts_header) - # Authors - env.Depends('#editor/authors.gen.h', "../AUTHORS.md") - env.Command('#editor/authors.gen.h', "../AUTHORS.md", make_authors_header) - - # Donors - env.Depends('#editor/donors.gen.h', "../DONORS.md") - env.Command('#editor/donors.gen.h', "../DONORS.md", make_donors_header) - - # License - env.Depends('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"]) - env.Command('#editor/license.gen.h', ["../COPYRIGHT.txt", "../LICENSE.txt"], make_license_header) - - env.add_source_files(env.editor_sources, "*.cpp") env.add_source_files(env.editor_sources, ["#thirdparty/misc/clipper.cpp"]) diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 360ed620f6..11adcd4661 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -31,11 +31,11 @@ #include "editor_about.h" #include "editor_node.h" -#include "authors.gen.h" -#include "donors.gen.h" -#include "license.gen.h" -#include "version.h" -#include "version_hash.gen.h" +#include "core/authors.gen.h" +#include "core/donors.gen.h" +#include "core/license.gen.h" +#include "core/version.h" +#include "core/version_hash.gen.h" void EditorAbout::_notification(int p_what) { @@ -69,7 +69,7 @@ TextureRect *EditorAbout::get_logo() const { return _logo; } -ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[], const int p_flag_single_column) { +ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column) { ScrollContainer *sc = memnew(ScrollContainer); sc->set_name(p_name); @@ -82,7 +82,7 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St for (int i = 0; i < p_sections.size(); i++) { bool single_column = p_flag_single_column & 1 << i; - const char **names_ptr = p_src[i]; + const char *const *names_ptr = p_src[i]; if (*names_ptr) { Label *lbl = memnew(Label); @@ -151,7 +151,8 @@ EditorAbout::EditorAbout() { dev_sections.push_back(TTR("Lead Developer")); dev_sections.push_back(TTR("Project Manager ")); // " " appended to distinguish between 'project supervisor' and 'project list' dev_sections.push_back(TTR("Developers")); - const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names }; + const char *const *dev_src[] = { AUTHORS_FOUNDERS, AUTHORS_LEAD_DEVELOPERS, + AUTHORS_PROJECT_MANAGERS, AUTHORS_DEVELOPERS }; tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src, 1)); // Donors @@ -163,7 +164,8 @@ EditorAbout::EditorAbout() { donor_sections.push_back(TTR("Gold Donors")); donor_sections.push_back(TTR("Silver Donors")); donor_sections.push_back(TTR("Bronze Donors")); - const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze }; + const char *const *donor_src[] = { DONORS_SPONSOR_PLAT, DONORS_SPONSOR_GOLD, + DONORS_SPONSOR_MINI, DONORS_GOLD, DONORS_SILVER, DONORS_BRONZE }; tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src, 3)); // License @@ -172,7 +174,7 @@ EditorAbout::EditorAbout() { _license_text->set_name(TTR("License")); _license_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); _license_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); - _license_text->set_text(String::utf8(about_license)); + _license_text->set_text(String::utf8(GODOT_LICENSE_TEXT)); tc->add_child(_license_text); // Thirdparty License @@ -207,20 +209,27 @@ EditorAbout::EditorAbout() { tpl_ti_lc->set_selectable(0, false); int read_idx = 0; String long_text = ""; - for (int i = 0; i < THIRDPARTY_COUNT; i++) { + for (int component_index = 0; component_index < COPYRIGHT_INFO_COUNT; component_index++) { + const ComponentCopyright &component = COPYRIGHT_INFO[component_index]; TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp); - String thirdparty = String(about_thirdparty[i]); - ti->set_text(0, thirdparty); - String text = thirdparty + "\n"; - long_text += "- " + thirdparty + "\n\n"; - for (int j = 0; j < about_tp_copyright_count[i]; j++) { - - text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n"; - String copyright = String::utf8(" \xc2\xa9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \xc2\xa9 ")); + String component_name = component.name; + ti->set_text(0, component_name); + String text = component_name + "\n"; + long_text += "- " + component_name + "\n"; + for (int part_index = 0; part_index < component.part_count; part_index++) { + const ComponentCopyrightPart &part = component.parts[part_index]; + text += "\n Files:"; + for (int file_num = 0; file_num < part.file_count; file_num++) { + text += "\n " + String(part.files[file_num]); + } + String copyright; + for (int copyright_index = 0; copyright_index < part.copyright_count; copyright_index++) { + copyright += String::utf8("\n \xc2\xa9 ") + String::utf8(part.copyright_statements[copyright_index]); + } text += copyright; long_text += copyright; - String license = "\n License: " + String(about_tp_license[read_idx]) + "\n"; + String license = "\n License: " + String(part.license) + "\n"; text += license; long_text += license + "\n"; read_idx++; @@ -230,10 +239,10 @@ EditorAbout::EditorAbout() { for (int i = 0; i < LICENSE_COUNT; i++) { TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc); - String licensename = String(about_license_name[i]); + String licensename = String(LICENSE_NAMES[i]); ti->set_text(0, licensename); long_text += "- " + licensename + "\n\n"; - String licensebody = String(about_license_body[i]); + String licensebody = String(LICENSE_BODIES[i]); ti->set_metadata(0, licensebody); long_text += " " + licensebody.replace("\n", "\n ") + "\n\n"; } diff --git a/editor/editor_about.h b/editor/editor_about.h index b32fdf6567..71d1c95188 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -53,7 +53,7 @@ class EditorAbout : public AcceptDialog { private: void _license_tree_selected(); - ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char **p_src[], const int p_flag_single_column = 0); + ScrollContainer *_populate_list(const String &p_name, const List<String> &p_sections, const char *const *const p_src[], const int p_flag_single_column = 0); Tree *_tpl_tree; RichTextLabel *_license_text; diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4ac3e33cb9..d41d5c929a 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -420,6 +420,18 @@ void EditorData::paste_object_params(Object *p_object) { } } +bool EditorData::call_build() { + + bool result = true; + + for (int i = 0; i < editor_plugins.size() && result; i++) { + + result &= editor_plugins[i]->build(); + } + + return result; +} + UndoRedo &EditorData::get_undo_redo() { return undo_redo; diff --git a/editor/editor_data.h b/editor/editor_data.h index f020d07ea7..0452867bf4 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -197,6 +197,7 @@ public: NodePath get_edited_scene_live_edit_root(); bool check_and_update_scene(int p_idx); void move_edited_scene_to_index(int p_idx); + bool call_build(); void set_plugin_window_layout(Ref<ConfigFile> p_layout); void get_plugin_window_layout(Ref<ConfigFile> p_layout); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dd3b6c2c4c..4b068f1000 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4271,12 +4271,21 @@ EditorBuildCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS] bool EditorNode::call_build() { - for (int i = 0; i < build_callback_count; i++) { - if (!build_callbacks[i]()) - return false; + bool builds_successful = true; + + for (int i = 0; i < build_callback_count && builds_successful; i++) { + if (!build_callbacks[i]()) { + ERR_PRINT("A Godot Engine build callback failed."); + builds_successful = false; + } } - return true; + if (builds_successful && !editor_data.call_build()) { + ERR_PRINT("An EditorPlugin build callback failed."); + builds_successful = false; + } + + return builds_successful; } void EditorNode::_inherit_imported(const String &p_action) { @@ -5379,6 +5388,7 @@ EditorNode::EditorNode() { //resource_preview->add_preview_generator( Ref<EditorSamplePreviewPlugin>( memnew(EditorSamplePreviewPlugin ))); resource_preview->add_preview_generator(Ref<EditorMeshPreviewPlugin>(memnew(EditorMeshPreviewPlugin))); resource_preview->add_preview_generator(Ref<EditorBitmapPreviewPlugin>(memnew(EditorBitmapPreviewPlugin))); + resource_preview->add_preview_generator(Ref<EditorFontPreviewPlugin>(memnew(EditorFontPreviewPlugin))); { Ref<SpatialMaterialConversionPlugin> spatial_mat_convert; diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 24d0592ee7..cc44938c25 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -689,6 +689,15 @@ void EditorPlugin::get_window_layout(Ref<ConfigFile> p_layout) { } } +bool EditorPlugin::build() { + + if (get_script_instance() && get_script_instance()->has_method("build")) { + return get_script_instance()->call("build"); + } + + return true; +} + void EditorPlugin::queue_save_layout() const { EditorNode::get_singleton()->save_layout(); @@ -767,6 +776,7 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::POOL_STRING_ARRAY, "get_breakpoints")); ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "build")); ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath"))); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 8af7f83771..fcc74cb1e9 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -192,6 +192,7 @@ public: virtual void set_window_layout(Ref<ConfigFile> p_layout); virtual void get_window_layout(Ref<ConfigFile> p_layout); virtual void edited_scene_changed() {} // if changes are pending in editor, apply them + virtual bool build(); // builds with external tools. Returns true if safe to continue running scene. EditorInterface *get_editor_interface(); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index d0b842f231..8d29e0d40b 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1050,7 +1050,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color function_definition_color = Color::html(dark_theme ? "#01e1ff" : "#00a5ba"); const Color node_path_color = Color::html(dark_theme ? "64c15a" : "#518b4b"); - const Color te_background_color = Color(0, 0, 0, 0); + const Color te_background_color = dark_theme ? background_color : Color::html("#ffffff"); const Color completion_background_color = base_color; const Color completion_selected_color = alpha1; const Color completion_existing_color = alpha2; @@ -1084,7 +1084,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color, true); setting->set_initial_value("text_editor/highlighting/comment_color", comment_color, true); setting->set_initial_value("text_editor/highlighting/string_color", string_color, true); - setting->set_initial_value("text_editor/highlighting/background_color", background_color, true); + setting->set_initial_value("text_editor/highlighting/background_color", te_background_color, true); setting->set_initial_value("text_editor/highlighting/completion_background_color", completion_background_color, true); setting->set_initial_value("text_editor/highlighting/completion_selected_color", completion_selected_color, true); setting->set_initial_value("text_editor/highlighting/completion_existing_color", completion_existing_color, true); @@ -1118,7 +1118,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { setting->set_initial_value("text_editor/highlighting/engine_type_color", Color::html("83d3ff"), true); setting->set_initial_value("text_editor/highlighting/comment_color", Color::html("676767"), true); setting->set_initial_value("text_editor/highlighting/string_color", Color::html("ef6ebe"), true); - setting->set_initial_value("text_editor/highlighting/background_color", Color::html("3b000000"), true); + setting->set_initial_value("text_editor/highlighting/background_color", dark_theme ? Color::html("3b000000") : Color::html("#323b4f"), true); setting->set_initial_value("text_editor/highlighting/completion_background_color", Color::html("2C2A32"), true); setting->set_initial_value("text_editor/highlighting/completion_selected_color", Color::html("434244"), true); setting->set_initial_value("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"), true); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index d76c515c1f..ac4166bb98 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -37,6 +37,7 @@ #include "io/resource_loader.h" #include "os/os.h" #include "scene/resources/bit_mask.h" +#include "scene/resources/dynamic_font.h" #include "scene/resources/material.h" #include "scene/resources/mesh.h" @@ -933,3 +934,100 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { VS::get_singleton()->free(camera); VS::get_singleton()->free(scenario); } + +/////////////////////////////////////////////////////////////////////////// + +void EditorFontPreviewPlugin::_preview_done(const Variant &p_udata) { + + preview_done = true; +} + +void EditorFontPreviewPlugin::_bind_methods() { + + ClassDB::bind_method("_preview_done", &EditorFontPreviewPlugin::_preview_done); +} + +bool EditorFontPreviewPlugin::handles(const String &p_type) const { + + return ClassDB::is_parent_class(p_type, "DynamicFontData"); +} + +Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path) { + if (canvas.is_valid()) { + VS::get_singleton()->viewport_remove_canvas(viewport, canvas); + } + + canvas = VS::get_singleton()->canvas_create(); + canvas_item = VS::get_singleton()->canvas_item_create(); + + VS::get_singleton()->viewport_attach_canvas(viewport, canvas); + VS::get_singleton()->canvas_item_set_parent(canvas_item, canvas); + + Ref<DynamicFontData> SampledFont; + SampledFont.instance(); + SampledFont->set_font_path(p_path); + + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); + thumbnail_size *= EDSCALE; + + Ref<DynamicFont> sampled_font; + sampled_font.instance(); + sampled_font->set_size(50); + sampled_font->set_font_data(SampledFont); + + String sampled_text = "Abg"; + Vector2 size = sampled_font->get_string_size(sampled_text); + + Vector2 pos; + + pos.x = 64 - size.x / 2; + pos.y = 80; + + Ref<Font> font = sampled_font; + + font->draw(canvas_item, pos, sampled_text); + + VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture + + preview_done = false; + VS::get_singleton()->request_frame_drawn_callback(this, "_preview_done", Variant()); + + while (!preview_done) { + OS::get_singleton()->delay_usec(10); + } + + Ref<Image> img = VS::get_singleton()->VS::get_singleton()->texture_get_data(viewport_texture); + ERR_FAIL_COND_V(img.is_null(), Ref<ImageTexture>()); + + img->convert(Image::FORMAT_RGBA8); + img->resize(thumbnail_size, thumbnail_size); + + post_process_preview(img); + + Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); + ptex->create_from_image(img, 0); + + return ptex; +} + +Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from) { + + return generate_from_path(p_from->get_path()); +} + +EditorFontPreviewPlugin::EditorFontPreviewPlugin() { + + viewport = VS::get_singleton()->viewport_create(); + VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED); + VS::get_singleton()->viewport_set_vflip(viewport, true); + VS::get_singleton()->viewport_set_size(viewport, 128, 128); + VS::get_singleton()->viewport_set_active(viewport, true); + viewport_texture = VS::get_singleton()->viewport_get_texture(viewport); +} + +EditorFontPreviewPlugin::~EditorFontPreviewPlugin() { + + VS::get_singleton()->free(canvas_item); + VS::get_singleton()->free(canvas); + VS::get_singleton()->free(viewport); +} diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h index 35b5c3a5f0..332f991b49 100644 --- a/editor/plugins/editor_preview_plugins.h +++ b/editor/plugins/editor_preview_plugins.h @@ -140,4 +140,27 @@ public: ~EditorMeshPreviewPlugin(); }; +class EditorFontPreviewPlugin : public EditorResourcePreviewGenerator { + + GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator) + + RID viewport; + RID viewport_texture; + RID canvas; + RID canvas_item; + volatile bool preview_done; + + void _preview_done(const Variant &p_udata); + +protected: + static void _bind_methods(); + +public: + virtual bool handles(const String &p_type) const; + virtual Ref<Texture> generate(const RES &p_from); + virtual Ref<Texture> generate_from_path(const String &p_path); + + EditorFontPreviewPlugin(); + ~EditorFontPreviewPlugin(); +}; #endif // EDITORPREVIEWPLUGINS_H diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index b82a036130..32b4e7f962 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -113,7 +113,7 @@ void SceneTreeDock::instance(const String &p_file) { Node *parent = scene_tree->get_selected(); if (!parent) { - Node *parent = edited_scene; + parent = edited_scene; }; if (!edited_scene) { diff --git a/main/main.cpp b/main/main.cpp index 70713e2dd8..ad49e1f5bd 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1706,7 +1706,7 @@ bool Main::start() { uint64_t Main::last_ticks = 0; uint64_t Main::target_ticks = 0; -uint32_t Main::frames = 0; +Array Main::frame_times = Array(); uint32_t Main::frame = 0; bool Main::force_redraw_requested = false; @@ -1825,10 +1825,19 @@ bool Main::iteration() { script_debugger->idle_poll(); } - frames++; Engine::get_singleton()->_idle_frames++; - if (frame > 1000000) { + // FPS counter + frame_times.push_back(ticks); + int frames = frame_times.size(); + + while (frame_times.size() > 0 && (int)frame_times.get(0) <= ticks - 1000000) { + frame_times.pop_front(); + } + + int update_frequency = MAX(1, (int)GLOBAL_GET("debug/settings/performance/update_frequency_msec")); + + if (frame > update_frequency * 1000) { if (editor || project_manager) { if (print_fps) { @@ -1844,8 +1853,7 @@ bool Main::iteration() { idle_process_max = 0; physics_process_max = 0; - frame %= 1000000; - frames = 0; + frame %= update_frequency * 1000; } if (fixed_fps != -1) diff --git a/main/main.h b/main/main.h index c20592bf3b..8f264d7720 100644 --- a/main/main.h +++ b/main/main.h @@ -44,7 +44,7 @@ class Main { static void print_help(const char *p_binary); static uint64_t last_ticks; static uint64_t target_ticks; - static uint32_t frames; + static Array frame_times; static uint32_t frame; static bool force_redraw_requested; diff --git a/methods.py b/methods.py index 7cdc160075..b5aee9c22d 100644 --- a/methods.py +++ b/methods.py @@ -1,5 +1,5 @@ import os -from compat import iteritems +from compat import iteritems, open_utf8, escape_string def add_source_files(self, sources, filetype, lib_env=None, shared=False): @@ -515,6 +515,232 @@ def build_gles2_headers(target, source, env): for x in source: build_legacygl_header(str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True) +def make_authors_header(target, source, env): + + sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"] + sections_id = ["AUTHORS_FOUNDERS", "AUTHORS_LEAD_DEVELOPERS", "AUTHORS_PROJECT_MANAGERS", "AUTHORS_DEVELOPERS"] + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open_utf8(src, "r") + g = open_utf8(dst, "w") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_AUTHORS_H\n") + g.write("#define _EDITOR_AUTHORS_H\n") + + current_section = "" + reading = False + + def close_section(): + g.write("\t0\n") + g.write("};\n") + + for line in f: + if reading: + if line.startswith(" "): + g.write("\t\"" + escape_string(line.strip()) + "\",\n") + continue + if line.startswith("## "): + if reading: + close_section() + reading = False + for i in range(len(sections)): + if line.strip().endswith(sections[i]): + current_section = escape_string(sections_id[i]) + reading = True + g.write("const char *const " + current_section + "[] = {\n") + break + + if reading: + close_section() + + g.write("#endif\n") + + g.close() + f.close() + +def make_donors_header(target, source, env): + + sections = ["Platinum sponsors", "Gold sponsors", "Mini sponsors", + "Gold donors", "Silver donors", "Bronze donors"] + sections_id = ["DONORS_SPONSOR_PLAT", "DONORS_SPONSOR_GOLD", "DONORS_SPONSOR_MINI", + "DONORS_GOLD", "DONORS_SILVER", "DONORS_BRONZE"] + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open_utf8(src, "r") + g = open_utf8(dst, "w") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_DONORS_H\n") + g.write("#define _EDITOR_DONORS_H\n") + + current_section = "" + reading = False + + def close_section(): + g.write("\t0\n") + g.write("};\n") + + for line in f: + if reading >= 0: + if line.startswith(" "): + g.write("\t\"" + escape_string(line.strip()) + "\",\n") + continue + if line.startswith("## "): + if reading: + close_section() + reading = False + for i in range(len(sections)): + if line.strip().endswith(sections[i]): + current_section = escape_string(sections_id[i]) + reading = True + g.write("const char *const " + current_section + "[] = {\n") + break + + if reading: + close_section() + + g.write("#endif\n") + + g.close() + f.close() + + +def make_license_header(target, source, env): + src_copyright = source[0].srcnode().abspath + src_license = source[1].srcnode().abspath + dst = target[0].srcnode().abspath + + class LicenseReader: + def __init__(self, license_file): + self._license_file = license_file + self.line_num = 0 + self.current = self.next_line() + + def next_line(self): + line = self._license_file.readline() + self.line_num += 1 + while line.startswith("#"): + line = self._license_file.readline() + self.line_num += 1 + self.current = line + return line + + def next_tag(self): + if not ':' in self.current: + return ('',[]) + tag, line = self.current.split(":", 1) + lines = [line.strip()] + while self.next_line() and self.current.startswith(" "): + lines.append(self.current.strip()) + return (tag, lines) + + from collections import OrderedDict + projects = OrderedDict() + license_list = [] + + with open_utf8(src_copyright, "r") as copyright_file: + reader = LicenseReader(copyright_file) + part = {} + while reader.current: + tag, content = reader.next_tag() + if tag in ("Files", "Copyright", "License"): + part[tag] = content[:] + elif tag == "Comment": + # attach part to named project + projects[content[0]] = projects.get(content[0], []) + [part] + + if not tag or not reader.current: + # end of a paragraph start a new part + if "License" in part and not "Files" in part: + # no Files tag in this one, so assume standalone license + license_list.append(part["License"]) + part = {} + reader.next_line() + + data_list = [] + for project in projects.itervalues(): + for part in project: + part["file_index"] = len(data_list) + data_list += part["Files"] + part["copyright_index"] = len(data_list) + data_list += part["Copyright"] + + with open_utf8(dst, "w") as f: + + f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + f.write("#ifndef _EDITOR_LICENSE_H\n") + f.write("#define _EDITOR_LICENSE_H\n") + f.write("const char *const GODOT_LICENSE_TEXT =") + + with open_utf8(src_license, "r") as license_file: + for line in license_file: + escaped_string = escape_string(line.strip()) + f.write("\n\t\t\"" + escaped_string + "\\n\"") + f.write(";\n\n") + + f.write("struct ComponentCopyrightPart {\n" + "\tconst char *license;\n" + "\tconst char *const *files;\n" + "\tconst char *const *copyright_statements;\n" + "\tint file_count;\n" + "\tint copyright_count;\n" + "};\n\n") + + f.write("struct ComponentCopyright {\n" + "\tconst char *name;\n" + "\tconst ComponentCopyrightPart *parts;\n" + "\tint part_count;\n" + "};\n\n") + + f.write("const char *const COPYRIGHT_INFO_DATA[] = {\n") + for line in data_list: + f.write("\t\"" + escape_string(line) + "\",\n") + f.write("};\n\n") + + f.write("const ComponentCopyrightPart COPYRIGHT_PROJECT_PARTS[] = {\n") + part_index = 0 + part_indexes = {} + for project_name, project in projects.iteritems(): + part_indexes[project_name] = part_index + for part in project: + f.write("\t{ \"" + escape_string(part["License"][0]) + "\", " + + "©RIGHT_INFO_DATA[" + str(part["file_index"]) + "], " + + "©RIGHT_INFO_DATA[" + str(part["copyright_index"]) + "], " + + str(len(part["Files"])) + ", " + + str(len(part["Copyright"])) + " },\n") + part_index += 1 + f.write("};\n\n") + + f.write("const int COPYRIGHT_INFO_COUNT = " + str(len(projects)) + ";\n") + + f.write("const ComponentCopyright COPYRIGHT_INFO[] = {\n") + for project_name, project in projects.iteritems(): + f.write("\t{ \"" + escape_string(project_name) + "\", " + + "©RIGHT_PROJECT_PARTS[" + str(part_indexes[project_name]) + "], " + + str(len(project)) + " },\n") + f.write("};\n\n") + + f.write("const int LICENSE_COUNT = " + str(len(license_list)) + ";\n") + + f.write("const char *const LICENSE_NAMES[] = {\n") + for l in license_list: + f.write("\t\"" + escape_string(l[0]) + "\",\n") + f.write("};\n\n") + + f.write("const char *const LICENSE_BODIES[] = {\n\n") + for l in license_list: + for line in l[1:]: + if line == ".": + f.write("\t\"\\n\"\n") + else: + f.write("\t\"" + escape_string(line) + "\\n\"\n") + f.write("\t\"\",\n\n") + f.write("};\n\n") + + f.write("#endif\n") def add_module_version_string(self,s): self.module_version_string += "." + s diff --git a/modules/mono/mono_gd/gd_mono_assembly.cpp b/modules/mono/mono_gd/gd_mono_assembly.cpp index d062d56dcf..9d3bee2176 100644 --- a/modules/mono/mono_gd/gd_mono_assembly.cpp +++ b/modules/mono/mono_gd/gd_mono_assembly.cpp @@ -33,9 +33,10 @@ #include <mono/metadata/mono-debug.h> #include <mono/metadata/tokentype.h> -#include "list.h" -#include "os/file_access.h" -#include "os/os.h" +#include "core/list.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" #include "../godotsharp_dirs.h" #include "gd_mono_class.h" @@ -210,7 +211,7 @@ Error GDMonoAssembly::load(bool p_refonly) { Vector<uint8_t> data = FileAccess::get_file_as_array(path); ERR_FAIL_COND_V(data.empty(), ERR_FILE_CANT_READ); - String image_filename(path); + String image_filename = ProjectSettings::get_singleton()->globalize_path(path); MonoImageOpenStatus status = MONO_IMAGE_OK; diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 18ab616826..c95a8ac2dd 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -263,8 +263,8 @@ float AudioStreamOGGVorbis::get_length() const { void AudioStreamOGGVorbis::_bind_methods() { - ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamOGGVorbis::set_data); - ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamOGGVorbis::get_data); + ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamOGGVorbis::set_data); + ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamOGGVorbis::get_data); ClassDB::bind_method(D_METHOD("set_loop", "enable"), &AudioStreamOGGVorbis::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &AudioStreamOGGVorbis::has_loop); @@ -272,7 +272,7 @@ void AudioStreamOGGVorbis::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop_offset", "seconds"), &AudioStreamOGGVorbis::set_loop_offset); ClassDB::bind_method(D_METHOD("get_loop_offset"), &AudioStreamOGGVorbis::get_loop_offset); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop", "has_loop"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_loop_offset", "get_loop_offset"); } diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml index ac95a7197f..e2281babf7 100644 --- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml +++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml @@ -13,6 +13,9 @@ <methods> </methods> <members> + <member name="data" type="PoolByteArray" setter="set_data" getter="get_data"> + Contains the audio data in bytes. + </member> <member name="loop" type="bool" setter="set_loop" getter="has_loop"> </member> <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset"> diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 03bc4c114a..318fb7fb9c 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -121,6 +121,10 @@ Array VisualScriptNode::_get_default_input_values() const { return default_input_values; } +String VisualScriptNode::get_text() const { + return ""; +} + void VisualScriptNode::_bind_methods() { ClassDB::bind_method(D_METHOD("get_visual_script"), &VisualScriptNode::get_visual_script); diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index dad9c68312..a15360ad39 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -78,7 +78,7 @@ public: Variant get_default_input_value(int p_port) const; virtual String get_caption() const = 0; - virtual String get_text() const = 0; + virtual String get_text() const; virtual String get_category() const = 0; //used by editor, this is not really saved diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 7f0a42da82..73b6d702c1 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -666,12 +666,14 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons return PropertyInfo(t, ""); } +/* String VisualScriptBuiltinFunc::get_caption() const { return "BuiltinFunc"; } +*/ -String VisualScriptBuiltinFunc::get_text() const { +String VisualScriptBuiltinFunc::get_caption() const { return func_name[func]; } diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index f862d5c26f..3345762b9f 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -129,7 +129,7 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; + //virtual String get_text() const; virtual String get_category() const { return "functions"; } void set_func(BuiltinFunc p_which); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index dfaa873b13..0618064ea6 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -527,6 +527,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) { GraphNode *gnode = memnew(GraphNode); gnode->set_title(node->get_caption()); + gnode->set_offset(pos * EDSCALE); if (error_line == E->get()) { gnode->set_overlay(GraphNode::OVERLAY_POSITION); } else if (node->is_breakpoint()) { @@ -543,8 +544,10 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_show_close_button(true); } - if (Object::cast_to<VisualScriptExpression>(node.ptr())) { + bool has_gnode_text = false; + if (Object::cast_to<VisualScriptExpression>(node.ptr())) { + has_gnode_text = true; LineEdit *line_edit = memnew(LineEdit); line_edit->set_text(node->get_text()); line_edit->set_expand_to_text_length(true); @@ -552,9 +555,13 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->add_child(line_edit); line_edit->connect("text_changed", this, "_expression_text_changed", varray(E->get())); } else { - Label *text = memnew(Label); - text->set_text(node->get_text()); - gnode->add_child(text); + String text = node->get_text(); + if (!text.empty()) { + has_gnode_text = true; + Label *label = memnew(Label); + label->set_text(text); + gnode->add_child(label); + } } if (Object::cast_to<VisualScriptComment>(node.ptr())) { @@ -589,9 +596,21 @@ void VisualScriptEditor::_update_graph(int p_only_id) { int slot_idx = 0; bool single_seq_output = node->get_output_sequence_port_count() == 1 && node->get_output_sequence_port_text(0) == String(); - gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port); - gnode->set_offset(pos * EDSCALE); - slot_idx++; + if ((node->has_input_sequence_port() || single_seq_output) || has_gnode_text) { + // IF has_gnode_text is true BUT we have no sequence ports to draw (in here), + // we still draw the disabled default ones to shift up the slots by one, + // so the slots DON'T start with the content text. + + // IF has_gnode_text is false, but we DO want to draw default sequence ports, + // we draw a dummy text to take up the position of the sequence nodes, so all the other ports are still aligned correctly. + if (!has_gnode_text) { + Label *dummy = memnew(Label); + dummy->set_text(" "); + gnode->add_child(dummy); + } + gnode->set_slot(0, node->has_input_sequence_port(), TYPE_SEQUENCE, mono_color, single_seq_output, TYPE_SEQUENCE, mono_color, seq_port, seq_port); + slot_idx++; + } int mixed_seq_ports = 0; diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 5c097dfa76..ea23ab1b2a 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -772,7 +772,7 @@ PropertyInfo VisualScriptTypeCast::get_output_value_port_info(int p_idx) const { String VisualScriptTypeCast::get_caption() const { - return "TypeCast"; + return "Type Cast"; } String VisualScriptTypeCast::get_text() const { diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 187c9b0b9e..bdf5705ecd 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -262,26 +262,6 @@ PropertyInfo VisualScriptFunctionCall::get_output_value_port_info(int p_idx) con } String VisualScriptFunctionCall::get_caption() const { - - static const char *cname[5] = { - "CallSelf", - "CallNode", - "CallInstance", - "CallBasic", - "CallSingleton" - }; - - String caption = cname[call_mode]; - - if (rpc_call_mode) { - caption += " (RPC)"; - } - - return caption; -} - -String VisualScriptFunctionCall::get_text() const { - if (call_mode == CALL_MODE_SELF) return " " + String(function) + "()"; if (call_mode == CALL_MODE_SINGLETON) @@ -294,6 +274,14 @@ String VisualScriptFunctionCall::get_text() const { return " " + base_type + "." + String(function) + "()"; } +String VisualScriptFunctionCall::get_text() const { + + if (rpc_call_mode) { + return "RPC"; + } + return ""; +} + void VisualScriptFunctionCall::set_basic_type(Variant::Type p_type) { if (basic_type == p_type) @@ -1075,36 +1063,31 @@ PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) cons String VisualScriptPropertySet::get_caption() const { - static const char *cname[4] = { - "Self", - "Node", - "Instance", - "Basic" - }; - static const char *opname[ASSIGN_OP_MAX] = { - "Set", "Add", "Sub", "Mul", "Div", "Mod", "ShiftLeft", "ShiftRight", "BitAnd", "BitOr", "BitXor" + "Set", "Add", "Subtract", "Multiply", "Divide", "Mod", "ShiftLeft", "ShiftRight", "BitAnd", "BitOr", "BitXor" }; - return String(cname[call_mode]) + opname[assign_op]; + + String prop = String(opname[assign_op]) + " " + property; + if (index != StringName()) { + prop += "." + String(index); + } + + return prop; } String VisualScriptPropertySet::get_text() const { - String prop; + if (call_mode == CALL_MODE_BASIC_TYPE) { + return String("On ") + Variant::get_type_name(basic_type); + } - if (call_mode == CALL_MODE_BASIC_TYPE) - prop = Variant::get_type_name(basic_type) + "." + property; - else if (call_mode == CALL_MODE_NODE_PATH) - prop = String(base_path) + ":" + property; - else if (call_mode == CALL_MODE_SELF) - prop = property; - else if (call_mode == CALL_MODE_INSTANCE) - prop = String(base_type) + ":" + property; + static const char *cname[3] = { + "Self", + "Scene Node", + "Instance" + }; - if (index != StringName()) { - prop += "." + String(index); - } - return prop; + return String("On ") + cname[call_mode]; } void VisualScriptPropertySet::_update_base_type() { @@ -1838,30 +1821,22 @@ PropertyInfo VisualScriptPropertyGet::get_output_value_port_info(int p_idx) cons String VisualScriptPropertyGet::get_caption() const { - static const char *cname[4] = { - "SelfGet", - "NodeGet", - "InstanceGet", - "BasicGet" - }; - - return cname[call_mode]; + return String("Get ") + property; } String VisualScriptPropertyGet::get_text() const { - String prop; + if (call_mode == CALL_MODE_BASIC_TYPE) { + return String("On ") + Variant::get_type_name(basic_type); + } - if (call_mode == CALL_MODE_BASIC_TYPE) - prop = Variant::get_type_name(basic_type) + "." + property; - else if (call_mode == CALL_MODE_NODE_PATH) - prop = String(base_path) + ":" + property; - else if (call_mode == CALL_MODE_SELF) - prop = property; - else if (call_mode == CALL_MODE_INSTANCE) - prop = String(base_type) + ":" + property; + static const char *cname[3] = { + "Self", + "Scene Node", + "Instance" + }; - return prop; + return String("On ") + cname[call_mode]; } void VisualScriptPropertyGet::set_base_type(const StringName &p_type) { @@ -2399,12 +2374,7 @@ PropertyInfo VisualScriptEmitSignal::get_output_value_port_info(int p_idx) const String VisualScriptEmitSignal::get_caption() const { - return "EmitSignal"; -} - -String VisualScriptEmitSignal::get_text() const { - - return "emit " + String(name); + return "Emit " + String(name); } void VisualScriptEmitSignal::set_signal(const StringName &p_type) { diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h index 0b30eae65a..3b522564d4 100644 --- a/modules/visual_script/visual_script_func_nodes.h +++ b/modules/visual_script/visual_script_func_nodes.h @@ -346,7 +346,7 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; + //virtual String get_text() const; virtual String get_category() const { return "functions"; } void set_signal(const StringName &p_type); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index c5654a5a20..4803f29519 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -467,12 +467,12 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const { static const char *op_names[] = { //comparison - "Equal", //OP_EQUAL, - "NotEqual", //OP_NOT_EQUAL, - "Less", //OP_LESS, - "LessEqual", //OP_LESS_EQUAL, - "Greater", //OP_GREATER, - "GreaterEq", //OP_GREATER_EQUAL, + "Are Equal", //OP_EQUAL, + "Are Not Equal", //OP_NOT_EQUAL, + "Less Than", //OP_LESS, + "Less Than or Equal", //OP_LESS_EQUAL, + "Greater Than", //OP_GREATER, + "Greater Than or Equal", //OP_GREATER_EQUAL, //mathematic "Add", //OP_ADD, "Subtract", //OP_SUBTRACT, @@ -481,14 +481,14 @@ static const char *op_names[] = { "Negate", //OP_NEGATE, "Positive", //OP_POSITIVE, "Remainder", //OP_MODULE, - "Concat", //OP_STRING_CONCAT, + "Concatenate", //OP_STRING_CONCAT, //bitwise - "ShiftLeft", //OP_SHIFT_LEFT, - "ShiftRight", //OP_SHIFT_RIGHT, - "BitAnd", //OP_BIT_AND, - "BitOr", //OP_BIT_OR, - "BitXor", //OP_BIT_XOR, - "BitNeg", //OP_BIT_NEGATE, + "Bit Shift Left", //OP_SHIFT_LEFT, + "Bit Shift Right", //OP_SHIFT_RIGHT, + "Bit And", //OP_BIT_AND, + "Bit Or", //OP_BIT_OR, + "Bit Xor", //OP_BIT_XOR, + "Bit Negate", //OP_BIT_NEGATE, //logic "And", //OP_AND, "Or", //OP_OR, @@ -500,11 +500,6 @@ static const char *op_names[] = { String VisualScriptOperator::get_caption() const { - return op_names[op]; -} - -String VisualScriptOperator::get_text() const { - static const wchar_t *op_names[] = { //comparison L"A = B", //OP_EQUAL, @@ -803,14 +798,8 @@ PropertyInfo VisualScriptVariableGet::get_output_value_port_info(int p_idx) cons String VisualScriptVariableGet::get_caption() const { - return "Variable"; + return "Get " + variable; } - -String VisualScriptVariableGet::get_text() const { - - return variable; -} - void VisualScriptVariableGet::set_variable(StringName p_variable) { if (variable == p_variable) @@ -928,12 +917,7 @@ PropertyInfo VisualScriptVariableSet::get_output_value_port_info(int p_idx) cons String VisualScriptVariableSet::get_caption() const { - return "VariableSet"; -} - -String VisualScriptVariableSet::get_text() const { - - return variable; + return "Set " + variable; } void VisualScriptVariableSet::set_variable(StringName p_variable) { @@ -1044,7 +1028,7 @@ PropertyInfo VisualScriptConstant::get_input_value_port_info(int p_idx) const { PropertyInfo VisualScriptConstant::get_output_value_port_info(int p_idx) const { PropertyInfo pinfo; - pinfo.name = "get"; + pinfo.name = String(value); pinfo.type = type; return pinfo; } @@ -1054,11 +1038,6 @@ String VisualScriptConstant::get_caption() const { return "Constant"; } -String VisualScriptConstant::get_text() const { - - return String(value); -} - void VisualScriptConstant::set_constant_type(Variant::Type p_type) { if (type == p_type) @@ -1174,10 +1153,20 @@ PropertyInfo VisualScriptPreload::get_input_value_port_info(int p_idx) const { PropertyInfo VisualScriptPreload::get_output_value_port_info(int p_idx) const { - PropertyInfo pinfo = PropertyInfo(Variant::OBJECT, "res"); + PropertyInfo pinfo; + pinfo.type = Variant::OBJECT; if (preload.is_valid()) { pinfo.hint = PROPERTY_HINT_RESOURCE_TYPE; pinfo.hint_string = preload->get_class(); + if (preload->get_path().is_resource_file()) { + pinfo.name = preload->get_path(); + } else if (preload->get_name() != String()) { + pinfo.name = preload->get_name(); + } else { + pinfo.name = preload->get_class(); + } + } else { + pinfo.name = "<empty>"; } return pinfo; @@ -1188,21 +1177,6 @@ String VisualScriptPreload::get_caption() const { return "Preload"; } -String VisualScriptPreload::get_text() const { - - if (preload.is_valid()) { - if (preload->get_path().is_resource_file()) { - return preload->get_path(); - } else if (preload->get_name() != String()) { - return preload->get_name(); - } else { - return preload->get_class(); - } - } else { - return "<empty>"; - } -} - void VisualScriptPreload::set_preload(const Ref<Resource> &p_preload) { if (preload == p_preload) @@ -1291,12 +1265,7 @@ PropertyInfo VisualScriptIndexGet::get_output_value_port_info(int p_idx) const { String VisualScriptIndexGet::get_caption() const { - return "IndexGet"; -} - -String VisualScriptIndexGet::get_text() const { - - return String("get"); + return "Get Index"; } class VisualScriptNodeInstanceIndexGet : public VisualScriptNodeInstance { @@ -1371,12 +1340,7 @@ PropertyInfo VisualScriptIndexSet::get_output_value_port_info(int p_idx) const { String VisualScriptIndexSet::get_caption() const { - return "IndexSet"; -} - -String VisualScriptIndexSet::get_text() const { - - return String("set"); + return "Set Index"; } class VisualScriptNodeInstanceIndexSet : public VisualScriptNodeInstance { @@ -1439,18 +1403,13 @@ PropertyInfo VisualScriptGlobalConstant::get_input_value_port_info(int p_idx) co } PropertyInfo VisualScriptGlobalConstant::get_output_value_port_info(int p_idx) const { - - return PropertyInfo(Variant::REAL, "value"); + String name = GlobalConstants::get_global_constant_name(index); + return PropertyInfo(Variant::REAL, name); } String VisualScriptGlobalConstant::get_caption() const { - return "GlobalConst"; -} - -String VisualScriptGlobalConstant::get_text() const { - - return GlobalConstants::get_global_constant_name(index); + return "Global Constant"; } void VisualScriptGlobalConstant::set_global_constant(int p_which) { @@ -1539,17 +1498,12 @@ PropertyInfo VisualScriptClassConstant::get_input_value_port_info(int p_idx) con PropertyInfo VisualScriptClassConstant::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::INT, "value"); + return PropertyInfo(Variant::INT, String(base_type) + "." + String(name)); } String VisualScriptClassConstant::get_caption() const { - return "ClassConst"; -} - -String VisualScriptClassConstant::get_text() const { - - return String(base_type) + "." + String(name); + return "Class Constant"; } void VisualScriptClassConstant::set_class_constant(const StringName &p_which) { @@ -1673,7 +1627,7 @@ PropertyInfo VisualScriptBasicTypeConstant::get_output_value_port_info(int p_idx String VisualScriptBasicTypeConstant::get_caption() const { - return "BasicConst"; + return "Basic Constant"; } String VisualScriptBasicTypeConstant::get_text() const { @@ -1828,17 +1782,12 @@ PropertyInfo VisualScriptMathConstant::get_input_value_port_info(int p_idx) cons PropertyInfo VisualScriptMathConstant::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::REAL, "value"); + return PropertyInfo(Variant::REAL, const_name[constant]); } String VisualScriptMathConstant::get_caption() const { - return "MathConst"; -} - -String VisualScriptMathConstant::get_text() const { - - return const_name[constant]; + return "Math Constant"; } void VisualScriptMathConstant::set_math_constant(MathConstant p_which) { @@ -1903,7 +1852,7 @@ VisualScriptMathConstant::VisualScriptMathConstant() { } ////////////////////////////////////////// -////////////////GLOBALSINGLETON/////////// +////////////////ENGINESINGLETON/////////// ////////////////////////////////////////// int VisualScriptEngineSingleton::get_output_sequence_port_count() const { @@ -1937,17 +1886,12 @@ PropertyInfo VisualScriptEngineSingleton::get_input_value_port_info(int p_idx) c PropertyInfo VisualScriptEngineSingleton::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, "instance"); + return PropertyInfo(Variant::OBJECT, singleton); } String VisualScriptEngineSingleton::get_caption() const { - return "EngineSingleton"; -} - -String VisualScriptEngineSingleton::get_text() const { - - return singleton; + return "Get Engine Singleton"; } void VisualScriptEngineSingleton::set_singleton(const String &p_string) { @@ -2058,17 +2002,12 @@ PropertyInfo VisualScriptSceneNode::get_input_value_port_info(int p_idx) const { PropertyInfo VisualScriptSceneNode::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, "node"); + return PropertyInfo(Variant::OBJECT, path.simplified()); } String VisualScriptSceneNode::get_caption() const { - return "SceneNode"; -} - -String VisualScriptSceneNode::get_text() const { - - return path.simplified(); + return "Get Scene Node"; } void VisualScriptSceneNode::set_node_path(const NodePath &p_path) { @@ -2259,17 +2198,12 @@ PropertyInfo VisualScriptSceneTree::get_input_value_port_info(int p_idx) const { PropertyInfo VisualScriptSceneTree::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, "instance"); + return PropertyInfo(Variant::OBJECT, "Scene Tree"); } String VisualScriptSceneTree::get_caption() const { - return "SceneTree"; -} - -String VisualScriptSceneTree::get_text() const { - - return ""; + return "Get Scene Tree"; } class VisualScriptNodeInstanceSceneTree : public VisualScriptNodeInstance { @@ -2361,17 +2295,12 @@ PropertyInfo VisualScriptResourcePath::get_input_value_port_info(int p_idx) cons PropertyInfo VisualScriptResourcePath::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::STRING, "path"); + return PropertyInfo(Variant::STRING, path); } String VisualScriptResourcePath::get_caption() const { - return "ResourcePath"; -} - -String VisualScriptResourcePath::get_text() const { - - return path; + return "Resource Path"; } void VisualScriptResourcePath::set_resource_path(const String &p_path) { @@ -2453,20 +2382,18 @@ PropertyInfo VisualScriptSelf::get_input_value_port_info(int p_idx) const { PropertyInfo VisualScriptSelf::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::OBJECT, "instance"); -} - -String VisualScriptSelf::get_caption() const { + String type_name; + if (get_visual_script().is_valid()) + type_name = get_visual_script()->get_instance_base_type(); + else + type_name = "instance"; - return "Self"; + return PropertyInfo(Variant::OBJECT, type_name); } -String VisualScriptSelf::get_text() const { +String VisualScriptSelf::get_caption() const { - if (get_visual_script().is_valid()) - return get_visual_script()->get_instance_base_type(); - else - return ""; + return "Get Self"; } class VisualScriptNodeInstanceSelf : public VisualScriptNodeInstance { @@ -3032,12 +2959,7 @@ PropertyInfo VisualScriptConstructor::get_output_value_port_info(int p_idx) cons String VisualScriptConstructor::get_caption() const { - return "Construct"; -} - -String VisualScriptConstructor::get_text() const { - - return "new " + Variant::get_type_name(type) + "()"; + return "Construct " + Variant::get_type_name(type); } String VisualScriptConstructor::get_category() const { @@ -3163,17 +3085,12 @@ PropertyInfo VisualScriptLocalVar::get_input_value_port_info(int p_idx) const { } PropertyInfo VisualScriptLocalVar::get_output_value_port_info(int p_idx) const { - return PropertyInfo(type, "get"); + return PropertyInfo(type, name); } String VisualScriptLocalVar::get_caption() const { - return "LocalVarGet"; -} - -String VisualScriptLocalVar::get_text() const { - - return name; + return "Get Local Var"; } String VisualScriptLocalVar::get_category() const { @@ -3289,7 +3206,7 @@ PropertyInfo VisualScriptLocalVarSet::get_output_value_port_info(int p_idx) cons String VisualScriptLocalVarSet::get_caption() const { - return "LocalVarSet"; + return "Set Local Var"; } String VisualScriptLocalVarSet::get_text() const { @@ -3427,12 +3344,7 @@ PropertyInfo VisualScriptInputAction::get_output_value_port_info(int p_idx) cons String VisualScriptInputAction::get_caption() const { - return "Action"; -} - -String VisualScriptInputAction::get_text() const { - - return name; + return "Action " + name; } String VisualScriptInputAction::get_category() const { @@ -3600,12 +3512,7 @@ PropertyInfo VisualScriptDeconstruct::get_output_value_port_info(int p_idx) cons String VisualScriptDeconstruct::get_caption() const { - return "Deconstruct"; -} - -String VisualScriptDeconstruct::get_text() const { - - return "from " + Variant::get_type_name(type) + ":"; + return "Deconstruct " + Variant::get_type_name(type); } String VisualScriptDeconstruct::get_category() const { diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h index a581e81c8c..a0bc35dd92 100644 --- a/modules/visual_script/visual_script_nodes.h +++ b/modules/visual_script/visual_script_nodes.h @@ -124,7 +124,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "operators"; } void set_operator(Variant::Operator p_op); @@ -194,7 +193,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_variable(StringName p_variable); @@ -228,7 +226,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_variable(StringName p_variable); @@ -263,7 +260,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "constants"; } void set_constant_type(Variant::Type p_type); @@ -299,7 +295,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_preload(const Ref<Resource> &p_preload); @@ -327,7 +322,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "operators"; } virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -352,7 +346,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "operators"; } virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -381,7 +374,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "constants"; } void set_global_constant(int p_which); @@ -416,7 +408,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "constants"; } void set_class_constant(const StringName &p_which); @@ -505,7 +496,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "constants"; } void set_math_constant(MathConstant p_which); @@ -539,7 +529,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_singleton(const String &p_string); @@ -575,7 +564,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_node_path(const NodePath &p_path); @@ -609,7 +597,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -641,7 +628,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } void set_resource_path(const String &p_path); @@ -672,7 +658,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const { return "data"; } virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance); @@ -822,7 +807,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const; void set_constructor_type(Variant::Type p_type); @@ -859,7 +843,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const; void set_var_name(const StringName &p_name); @@ -942,7 +925,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const; void set_action_name(const StringName &p_name); @@ -993,7 +975,6 @@ public: virtual PropertyInfo get_output_value_port_info(int p_idx) const; virtual String get_caption() const; - virtual String get_text() const; virtual String get_category() const; void set_deconstruct_type(Variant::Type p_type); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 232855c978..d833e6a8bb 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -366,6 +366,16 @@ void Sprite3D::_draw() { final_rect.position * pixel_size, }; + + Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height()); + + // Properly setup UVs for impostor textures (AtlasTexture). + Ref<AtlasTexture> atlas_tex = texture; + if (atlas_tex != NULL) { + src_tsize[0] = atlas_tex->get_atlas()->get_width(); + src_tsize[1] = atlas_tex->get_atlas()->get_height(); + } + Vector2 uvs[4] = { final_src_rect.position / tsize, (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, @@ -656,6 +666,16 @@ void AnimatedSprite3D::_draw() { final_rect.position * pixel_size, }; + + Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height()); + + // Properly setup UVs for impostor textures (AtlasTexture). + Ref<AtlasTexture> atlas_tex = texture; + if (atlas_tex != NULL) { + src_tsize[0] = atlas_tex->get_atlas()->get_width(); + src_tsize[1] = atlas_tex->get_atlas()->get_height(); + } + Vector2 uvs[4] = { final_src_rect.position / tsize, (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index ce5b372d72..143684bdf9 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -1216,6 +1216,12 @@ String AnimationTreePlayer::animation_node_get_master_animation(const StringName return n->from; } +float AnimationTreePlayer::animation_node_get_position(const StringName &p_node) const { + + GET_NODE_V(NODE_ANIMATION, AnimationNode, 0); + return n->time; +} + bool AnimationTreePlayer::animation_node_is_path_filtered(const StringName &p_node, const NodePath &p_path) const { GET_NODE_V(NODE_ANIMATION, AnimationNode, 0); @@ -1724,6 +1730,7 @@ void AnimationTreePlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("animation_node_set_master_animation", "id", "source"), &AnimationTreePlayer::animation_node_set_master_animation); ClassDB::bind_method(D_METHOD("animation_node_get_master_animation", "id"), &AnimationTreePlayer::animation_node_get_master_animation); + ClassDB::bind_method(D_METHOD("animation_node_get_position", "id"), &AnimationTreePlayer::animation_node_get_position); ClassDB::bind_method(D_METHOD("animation_node_set_filter_path", "id", "path", "enable"), &AnimationTreePlayer::animation_node_set_filter_path); ClassDB::bind_method(D_METHOD("oneshot_node_set_fadein_time", "id", "time_sec"), &AnimationTreePlayer::oneshot_node_set_fadein_time); diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 09d6f6fcb4..d2d7b1c9ec 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -348,6 +348,7 @@ public: Ref<Animation> animation_node_get_animation(const StringName &p_node) const; void animation_node_set_master_animation(const StringName &p_node, const String &p_master_animation); String animation_node_get_master_animation(const StringName &p_node) const; + float animation_node_get_position(const StringName &p_node) const; void animation_node_set_filter_path(const StringName &p_node, const NodePath &p_track_path, bool p_filter); void animation_node_set_get_filtered_paths(const StringName &p_node, List<NodePath> *r_paths) const; diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp index b77143cd9d..02a9e4d69b 100644 --- a/scene/resources/audio_stream_sample.cpp +++ b/scene/resources/audio_stream_sample.cpp @@ -524,6 +524,9 @@ String AudioStreamSample::get_stream_name() const { void AudioStreamSample::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_data", "data"), &AudioStreamSample::set_data); + ClassDB::bind_method(D_METHOD("get_data"), &AudioStreamSample::get_data); + ClassDB::bind_method(D_METHOD("set_format", "format"), &AudioStreamSample::set_format); ClassDB::bind_method(D_METHOD("get_format"), &AudioStreamSample::get_format); @@ -542,16 +545,13 @@ void AudioStreamSample::_bind_methods() { ClassDB::bind_method(D_METHOD("set_stereo", "stereo"), &AudioStreamSample::set_stereo); ClassDB::bind_method(D_METHOD("is_stereo"), &AudioStreamSample::is_stereo); - ClassDB::bind_method(D_METHOD("_set_data", "data"), &AudioStreamSample::set_data); - ClassDB::bind_method(D_METHOD("_get_data"), &AudioStreamSample::get_data); - + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::INT, "format", PROPERTY_HINT_ENUM, "8-Bit,16-Bit,IMA-ADPCM"), "set_format", "get_format"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_mode", PROPERTY_HINT_ENUM, "Disabled,Forward,Ping-Pong"), "set_loop_mode", "get_loop_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_begin"), "set_loop_begin", "get_loop_begin"); ADD_PROPERTY(PropertyInfo(Variant::INT, "loop_end"), "set_loop_end", "get_loop_end"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mix_rate"), "set_mix_rate", "get_mix_rate"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stereo"), "set_stereo", "is_stereo"); - ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_data", "_get_data"); BIND_ENUM_CONSTANT(FORMAT_8_BITS); BIND_ENUM_CONSTANT(FORMAT_16_BITS); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 503ca0af4a..0e1f74d8d0 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -181,12 +181,15 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID &p_shape, const Trans Rect2 aabb = p_xform.xform(shape->get_aabb()); aabb = aabb.grow(p_margin); - int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, p_result_max, space->intersection_query_subindex_results); + int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results); int cc = 0; for (int i = 0; i < amount; i++) { + if (cc >= p_result_max) + break; + if (!_can_collide_with(space->intersection_query_results[i], p_collision_mask)) continue; |