diff options
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | doc/tools/doc_status.py | 28 | ||||
-rw-r--r-- | editor/SCsub | 8 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 2 | ||||
-rw-r--r-- | methods.py | 4 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/Basis.cs | 77 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/Quat.cs | 4 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/Transform.cs | 8 | ||||
-rw-r--r-- | platform/android/SCsub | 12 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 16 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 8 |
12 files changed, 129 insertions, 46 deletions
diff --git a/SConstruct b/SConstruct index 6045be54c7..c05a4332ab 100644 --- a/SConstruct +++ b/SConstruct @@ -72,6 +72,7 @@ env_base.AppendENVPath('PATH', os.getenv('PATH')) env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults = global_defaults env_base.android_maven_repos = [] +env_base.android_flat_dirs = [] env_base.android_dependencies = [] env_base.android_gradle_plugins = [] env_base.android_gradle_classpath = [] @@ -96,6 +97,7 @@ env_base.SetOption('implicit_cache', 1) env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository +env_base.__class__.android_add_flat_dir = methods.android_add_flat_dir env_base.__class__.android_add_dependency = methods.android_add_dependency env_base.__class__.android_add_java_dir = methods.android_add_java_dir env_base.__class__.android_add_res_dir = methods.android_add_res_dir diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 6b936899d8..e89b49eb4d 100644 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import fnmatch import os @@ -297,17 +297,21 @@ input_class_list = [] merged_file = "" for arg in sys.argv[1:]: - if arg.startswith('--'): - flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]] - elif arg.startswith('-'): - for f in arg[1:]: - flags[f] = not flags[f] - elif os.path.isdir(arg): - for f in os.listdir(arg): - if f.endswith('.xml'): - input_file_list.append(os.path.join(arg, f)); - else: - input_class_list.append(arg) + try: + if arg.startswith('--'): + flags[long_flags[arg[2:]]] = not flags[long_flags[arg[2:]]] + elif arg.startswith('-'): + for f in arg[1:]: + flags[f] = not flags[f] + elif os.path.isdir(arg): + for f in os.listdir(arg): + if f.endswith('.xml'): + input_file_list.append(os.path.join(arg, f)); + else: + input_class_list.append(arg) + except KeyError: + print("Unknown command line flag: " + arg) + sys.exit(1) if flags['i']: for r in ['methods', 'constants', 'members', 'signals']: diff --git a/editor/SCsub b/editor/SCsub index e44b4e4bb2..772feca5f8 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -237,7 +237,7 @@ def make_license_header(target, source, env): g.write("static const char *about_license =") for line in f: - escaped_string = escape_string(line.strip().replace("\"", "\\\"")) + escaped_string = escape_string(line.strip()) g.write("\n\t\"" + escaped_string + "\\n\"") g.write(";\n") @@ -323,12 +323,12 @@ def make_license_header(target, source, env): for k in j[0].split("\n"): if file_body != "": file_body += "\\n\"\n" - escaped_string = escape_string(k.strip().replace("\"", "\\\"")) + 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().replace("\"", "\\\"")) + escaped_string = escape_string(k.strip()) copyright_body += "\t\"" + escaped_string about_tp_file += "\t" + file_body + "\",\n" @@ -343,7 +343,7 @@ def make_license_header(target, source, env): for j in i[1].split("\n"): if body != "": body += "\\n\"\n" - escaped_string = escape_string(j.strip().replace("\"", "\\\"")) + escaped_string = escape_string(j.strip()) body += "\t\"" + escaped_string about_license_name += "\t\"" + i[0] + "\",\n" diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 5e66488afb..477d440f28 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1278,7 +1278,11 @@ void ScriptEditor::_members_overview_selected(int p_idx) { if (!se) { return; } - se->goto_line(members_overview->get_item_metadata(p_idx)); + Dictionary state; + state["scroll_position"] = members_overview->get_item_metadata(p_idx); + state["column"] = 0; + state["row"] = members_overview->get_item_metadata(p_idx); + se->set_edit_state(state); se->ensure_focus(); } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index a24856dad7..adf65c11e1 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -529,9 +529,9 @@ void ScriptTextEditor::ensure_focus() { void ScriptTextEditor::set_edit_state(const Variant &p_state) { Dictionary state = p_state; - code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->cursor_set_column(state["column"]); code_editor->get_text_edit()->cursor_set_line(state["row"]); + code_editor->get_text_edit()->set_v_scroll(state["scroll_position"]); code_editor->get_text_edit()->grab_focus(); //int scroll_pos; diff --git a/methods.py b/methods.py index f1ef95f6fe..b56a0364b5 100644 --- a/methods.py +++ b/methods.py @@ -1360,6 +1360,10 @@ def win32_spawn(sh, escape, cmd, args, spawnenv): return exit_code """ +def android_add_flat_dir(self, dir): + if (dir not in self.android_flat_dirs): + self.android_flat_dirs.append(dir) + def android_add_maven_repository(self, url): if (url not in self.android_maven_repos): self.android_maven_repos.append(url) diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs index 6a73ebd554..c50e783349 100644 --- a/modules/mono/glue/cs_files/Basis.cs +++ b/modules/mono/glue/cs_files/Basis.cs @@ -160,26 +160,29 @@ namespace Godot Basis m = this.orthonormalized(); Vector3 euler; + euler.z = 0.0f; - euler.y = Mathf.asin(m.x[2]); + float mxy = m.y[2]; - if (euler.y < Mathf.PI * 0.5f) + + if (mxy < 1.0f) { - if (euler.y > -Mathf.PI * 0.5f) + if (mxy > -1.0f) { - euler.x = Mathf.atan2(-m.y[2], m.z[2]); - euler.z = Mathf.atan2(-m.x[1], m.x[0]); + euler.x = Mathf.asin(-mxy); + euler.y = Mathf.atan2(m.x[2], m.z[2]); + euler.z = Mathf.atan2(m.y[0], m.y[1]); } else { - euler.z = 0.0f; - euler.x = euler.z - Mathf.atan2(m.y[0], m.y[1]); + euler.x = Mathf.PI * 0.5f; + euler.y = -Mathf.atan2(-m.x[1], m.x[0]); } } else { - euler.z = 0f; - euler.x = Mathf.atan2(m.x[1], m.y[1]) - euler.z; + euler.x = -Mathf.PI * 0.5f; + euler.y = -Mathf.atan2(m.x[1], m.x[0]); } return euler; @@ -273,7 +276,7 @@ namespace Godot public Basis rotated(Vector3 axis, float phi) { - return this * new Basis(axis, phi); + return new Basis(axis, phi) * this; } public Basis scaled(Vector3 scale) @@ -281,13 +284,13 @@ namespace Godot Basis m = this; m[0, 0] *= scale.x; - m[1, 0] *= scale.x; - m[2, 0] *= scale.x; - m[0, 1] *= scale.y; + m[0, 1] *= scale.x; + m[0, 2] *= scale.x; + m[1, 0] *= scale.y; m[1, 1] *= scale.y; - m[2, 1] *= scale.y; - m[0, 2] *= scale.z; - m[1, 2] *= scale.z; + m[1, 2] *= scale.y; + m[2, 0] *= scale.z; + m[2, 1] *= scale.z; m[2, 2] *= scale.z; return m; @@ -347,6 +350,48 @@ namespace Godot ); } + public Quat Quat() { + float trace = x[0] + y[1] + z[2]; + + if (trace > 0.0f) { + float s = Mathf.sqrt(trace + 1.0f) * 2f; + float inv_s = 1f / s; + return new Quat( + (z[1] - y[2]) * inv_s, + (x[2] - z[0]) * inv_s, + (y[0] - x[1]) * inv_s, + s * 0.25f + ); + } else if (x[0] > y[1] && x[0] > z[2]) { + float s = Mathf.sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f; + float inv_s = 1f / s; + return new Quat( + s * 0.25f, + (x[1] + y[0]) * inv_s, + (x[2] + z[0]) * inv_s, + (z[1] - y[2]) * inv_s + ); + } else if (y[1] > z[2]) { + float s = Mathf.sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f; + float inv_s = 1f / s; + return new Quat( + (x[1] + y[0]) * inv_s, + s * 0.25f, + (y[2] + z[1]) * inv_s, + (x[2] - z[0]) * inv_s + ); + } else { + float s = Mathf.sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f; + float inv_s = 1f / s; + return new Quat( + (x[2] + z[0]) * inv_s, + (y[2] + z[1]) * inv_s, + s * 0.25f, + (y[0] - x[1]) * inv_s + ); + } + } + public Basis(Quat quat) { float s = 2.0f / quat.length_squared(); diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs index 6345239f47..9b4b7fb297 100644 --- a/modules/mono/glue/cs_files/Quat.cs +++ b/modules/mono/glue/cs_files/Quat.cs @@ -201,12 +201,12 @@ namespace Godot } else { - float s = Mathf.sin(-angle * 0.5f) / d; + float s = Mathf.sin(angle * 0.5f) / d; x = axis.x * s; y = axis.y * s; z = axis.z * s; - w = Mathf.cos(-angle * 0.5f); + w = Mathf.cos(angle * 0.5f); } } diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs index 2010f0b3af..74271e758b 100644 --- a/modules/mono/glue/cs_files/Transform.cs +++ b/modules/mono/glue/cs_files/Transform.cs @@ -35,7 +35,7 @@ namespace Godot public Transform rotated(Vector3 axis, float phi) { - return this * new Transform(new Basis(axis, phi), new Vector3()); + return new Transform(new Basis(axis, phi), new Vector3()) * this; } public Transform scaled(Vector3 scale) @@ -104,6 +104,12 @@ namespace Godot this.origin = origin; } + public Transform(Quat quat, Vector3 origin) + { + this.basis = new Basis(quat); + this.origin = origin; + } + public Transform(Basis basis, Vector3 origin) { this.basis = basis; diff --git a/platform/android/SCsub b/platform/android/SCsub index e9a370869f..7fa0262359 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -46,8 +46,18 @@ gradle_baseout = open_utf8(abspath + "/java/build.gradle", "w") gradle_text = gradle_basein.read() - +gradle_maven_flat_text = "" +if len(env.android_flat_dirs) > 0: + gradle_maven_flat_text += "flatDir {\n" + gradle_maven_flat_text += "\tdirs " + for x in env.android_flat_dirs: + gradle_maven_flat_text += "'" + x + "'," + + gradle_maven_flat_text = gradle_maven_flat_text[:-1] + gradle_maven_flat_text += "\n\t}\n" + gradle_maven_repos_text = "" +gradle_maven_repos_text += gradle_maven_flat_text if len(env.android_maven_repos) > 0: gradle_maven_repos_text += "" diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index a38bee1b43..05963acf56 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -434,7 +434,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float pa->object->set(pa->prop, value, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid"); + ERR_PRINTS("Failed setting track value '" + String(pa->owner->path) + "'. Check if property exists or the type of key is valid. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -442,7 +442,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2(). Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif static_cast<Node2D *>(pa->object)->set_position(value); @@ -450,7 +450,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (value.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not numerical. Animation '" + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -459,7 +459,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (value.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(p_time) + " in Animation Track '" + String(pa->owner->path) + "' not of type Vector2()." + a->get_name() + "' at node '" + get_path() + "'."); } #endif @@ -615,7 +615,7 @@ void AnimationPlayer::_animation_update_transforms() { pa->object->set(pa->prop, pa->value_accum, &valid); //you are not speshul #ifdef DEBUG_ENABLED if (!valid) { - ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); + ERR_PRINTS("Failed setting key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "'. Check if property exists or the type of key is right for the property"); } #endif @@ -623,7 +623,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_POS: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Position key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif static_cast<Node2D *>(pa->object)->set_position(pa->value_accum); @@ -631,7 +631,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_ROT: { #ifdef DEBUG_ENABLED if (pa->value_accum.is_num()) { - ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not numerical"); + ERR_PRINTS("Rotation key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not numerical"); } #endif @@ -640,7 +640,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NODE2D_SCALE: { #ifdef DEBUG_ENABLED if (pa->value_accum.get_type() != Variant::VECTOR2) { - ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); + ERR_PRINTS("Scale key at time " + rtos(playback.current.pos) + " in Animation '" + get_current_animation() + "' at Node '" + get_path() + "', Track '" + String(pa->owner->path) + "' not of type Vector2()"); } #endif diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d14d3ef947..33c29547be 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4287,6 +4287,14 @@ int TextEdit::get_v_scroll() const { } void TextEdit::set_v_scroll(int p_scroll) { + if (p_scroll < 0) { + p_scroll = 0; + } + if (!scroll_past_end_of_file_enabled) { + if (p_scroll + get_visible_rows() > get_line_count()) { + p_scroll = get_line_count() - get_visible_rows(); + } + } v_scroll->set_value(p_scroll); cursor.line_ofs = p_scroll; } |