diff options
-rw-r--r-- | core/command_queue_mt.h | 4 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 1 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 5 | ||||
-rw-r--r-- | core/print_string.cpp | 2 | ||||
-rw-r--r-- | core/project_settings.cpp | 9 | ||||
-rw-r--r-- | doc/classes/GeometryInstance.xml | 9 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.cpp | 3 | ||||
-rw-r--r-- | editor/editor_autoload_settings.cpp | 38 | ||||
-rw-r--r-- | editor/editor_autoload_settings.h | 3 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 48 | ||||
-rw-r--r-- | editor/find_in_files.h | 5 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 11 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_builds.cpp | 8 | ||||
-rw-r--r-- | scene/2d/navigation_polygon.cpp | 2 | ||||
-rw-r--r-- | scene/3d/visual_instance.cpp | 7 | ||||
-rw-r--r-- | scene/3d/visual_instance.h | 2 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 14 |
18 files changed, 126 insertions, 47 deletions
diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h index 59eabd8786..798fa4394d 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -406,8 +406,10 @@ class CommandQueueMT { tryagain: // tried to read an empty queue - if (read_ptr == write_ptr) + if (read_ptr == write_ptr) { + if (p_lock) unlock(); return false; + } uint32_t size_ptr = read_ptr; uint32_t size = *(uint32_t *)&command_mem[read_ptr] >> 1; diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index 3cf6908961..3ff9fa569c 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -100,6 +100,7 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8 MD5Update(&md5, (uint8_t *)data.ptr(), data.size()); MD5Final(&md5); + ERR_EXPLAIN("The MD5 sum of the decrypted file does not match the expected value. It could be that the file is corrupt, or that the provided decryption key is invalid."); ERR_FAIL_COND_V(String::md5(md5.digest) != String::md5(md5d), ERR_FILE_CORRUPT); file = p_base; diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 722e62c54e..2572602e16 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -118,7 +118,10 @@ void FileAccessNetworkClient::_thread_func() { FileAccessNetwork *fa = NULL; if (response != FileAccessNetwork::RESPONSE_DATA) { - ERR_FAIL_COND(!accesses.has(id)); + if (!accesses.has(id)) { + unlock_mutex(); + ERR_FAIL_COND(!accesses.has(id)); + } } if (accesses.has(id)) diff --git a/core/print_string.cpp b/core/print_string.cpp index d91d49f53b..3271744af3 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -68,8 +68,8 @@ void remove_print_handler(PrintHandlerList *p_handler) { } //OS::get_singleton()->print("print handler list is %p\n",print_handler_list); - ERR_FAIL_COND(l == NULL); _global_unlock(); + ERR_FAIL_COND(l == NULL); } void print_line(String p_string) { diff --git a/core/project_settings.cpp b/core/project_settings.cpp index c86d1567dd..2fd22d4789 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1007,6 +1007,15 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("audio/default_bus_layout", "res://default_bus_layout.tres"); custom_prop_info["audio/default_bus_layout"] = PropertyInfo(Variant::STRING, "audio/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"); + PoolStringArray extensions = PoolStringArray(); + extensions.push_back("gd"); + if (Engine::get_singleton()->has_singleton("GodotSharp")) + extensions.push_back("cs"); + extensions.push_back("shader"); + + GLOBAL_DEF("editor/search_in_file_extensions", extensions); + custom_prop_info["editor/search_in_file_extensions"] = PropertyInfo(Variant::POOL_STRING_ARRAY, "editor/search_in_file_extensions"); + action = Dictionary(); action["deadzone"] = Variant(0.5f); events = Array(); diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml index 6a89d81aa0..674f786149 100644 --- a/doc/classes/GeometryInstance.xml +++ b/doc/classes/GeometryInstance.xml @@ -9,6 +9,15 @@ <tutorials> </tutorials> <methods> + <method name="set_custom_aabb"> + <return type="void"> + </return> + <argument index="0" name="aabb" type="AABB"> + </argument> + <description> + Overrides the bounding box of this node with a custom one. To remove it, set an AABB with all fields set to zero. + </description> + </method> </methods> <members> <member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting"> diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 268b0f1c90..83e1196979 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -2695,7 +2695,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const Environment *env = NULL; int viewport_width, viewport_height; - int viewport_x, viewport_y; + int viewport_x = 0; + int viewport_y = 0; bool probe_interior = false; bool reverse_cull = false; diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index e0c90808a0..a7975c86c5 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -73,7 +73,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin if (ClassDB::class_exists(p_name)) { if (r_error) - *r_error = TTR("Invalid name. Must not collide with an existing engine class name."); + *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing engine class name."); return false; } @@ -81,7 +81,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (int i = 0; i < Variant::VARIANT_MAX; i++) { if (Variant::get_type_name(Variant::Type(i)) == p_name) { if (r_error) - *r_error = TTR("Invalid name. Must not collide with an existing buit-in type name."); + *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing buit-in type name."); return false; } @@ -90,20 +90,33 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) { if (GlobalConstants::get_global_constant_name(i) == p_name) { if (r_error) - *r_error = TTR("Invalid name. Must not collide with an existing global constant name."); + *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing global constant name."); return false; } } + for (int i = 0; i < ScriptServer::get_language_count(); i++) { + List<String> keywords; + ScriptServer::get_language(i)->get_reserved_words(&keywords); + for (List<String>::Element *E = keywords.front(); E; E = E->next()) { + if (E->get() == p_name) { + if (r_error) + *r_error = TTR("Invalid name.") + "\n" + TTR("Keyword cannot be used as an autoload name."); + + return false; + } + } + } + return true; } void EditorAutoloadSettings::_autoload_add() { - autoload_add(autoload_add_name->get_text(), autoload_add_path->get_line_edit()->get_text()); + if (autoload_add(autoload_add_name->get_text(), autoload_add_path->get_line_edit()->get_text())) + autoload_add_path->get_line_edit()->set_text(""); - autoload_add_path->get_line_edit()->set_text(""); autoload_add_name->set_text(""); } @@ -294,6 +307,7 @@ void EditorAutoloadSettings::_autoload_open(const String &fpath) { } ProjectSettingsEditor::get_singleton()->hide(); } + void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) { autoload_add_name->set_text(p_path.get_file().get_basename()); @@ -626,25 +640,25 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & undo_redo->commit_action(); } -void EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_path) { +bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_path) { String name = p_name; String error; if (!_autoload_name_is_valid(name, &error)) { EditorNode::get_singleton()->show_warning(error); - return; + return false; } String path = p_path; if (!FileAccess::exists(path)) { EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist.")); - return; + return false; } if (!path.begins_with("res://")) { EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("Not in resource path.")); - return; + return false; } name = "autoload/" + name; @@ -668,6 +682,8 @@ void EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_ undo_redo->add_undo_method(this, "emit_signal", autoload_changed); undo_redo->commit_action(); + + return true; } void EditorAutoloadSettings::autoload_remove(const String &p_name) { @@ -701,9 +717,10 @@ void EditorAutoloadSettings::_bind_methods() { ClassDB::bind_method("_autoload_selected", &EditorAutoloadSettings::_autoload_selected); ClassDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited); ClassDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed); - ClassDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback); ClassDB::bind_method("_autoload_activated", &EditorAutoloadSettings::_autoload_activated); + ClassDB::bind_method("_autoload_text_entered", &EditorAutoloadSettings::_autoload_text_entered); ClassDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open); + ClassDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback); ClassDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw); ClassDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw); @@ -802,6 +819,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { autoload_add_name = memnew(LineEdit); autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); + autoload_add_name->connect("text_entered", this, "_autoload_text_entered"); hbc->add_child(autoload_add_name); Button *add_autoload = memnew(Button); diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index 45added56b..76ce020d8a 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -84,6 +84,7 @@ class EditorAutoloadSettings : public VBoxContainer { void _autoload_edited(); void _autoload_button_pressed(Object *p_item, int p_column, int p_button); void _autoload_activated(); + void _autoload_text_entered(String) { _autoload_add(); } void _autoload_open(const String &fpath); void _autoload_file_callback(const String &p_path); Node *_create_autoload(const String &p_path); @@ -98,7 +99,7 @@ protected: public: void update_autoload(); - void autoload_add(const String &p_name, const String &p_path); + bool autoload_add(const String &p_name, const String &p_path); void autoload_remove(const String &p_name); EditorAutoloadSettings(); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 11af9fc2eb..e1ab5c62a7 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -367,28 +367,11 @@ FindInFilesDialog::FindInFilesDialog() { Label *filter_label = memnew(Label); filter_label->set_text(TTR("Filters:")); + filter_label->set_tooltip(TTR("Include the files with the following extensions. Add or remove them in ProjectSettings.")); gc->add_child(filter_label); - { - HBoxContainer *hbc = memnew(HBoxContainer); - - // TODO: Unhardcode this. - Vector<String> exts; - exts.push_back("gd"); - if (Engine::get_singleton()->has_singleton("GodotSharp")) - exts.push_back("cs"); - exts.push_back("shader"); - - for (int i = 0; i < exts.size(); ++i) { - CheckBox *cb = memnew(CheckBox); - cb->set_text(exts[i]); - cb->set_pressed(true); - hbc->add_child(cb); - _filters.push_back(cb); - } - - gc->add_child(hbc); - } + _filters_container = memnew(HBoxContainer); + gc->add_child(_filters_container); _find_button = add_button(TTR("Find..."), false, "find"); _find_button->set_disabled(true); @@ -424,11 +407,12 @@ String FindInFilesDialog::get_folder() const { } Set<String> FindInFilesDialog::get_filter() const { + // could check the _filters_preferences but it might not have been generated yet. Set<String> filters; - for (int i = 0; i < _filters.size(); ++i) { - CheckBox *cb = _filters[i]; + for (int i = 0; i < _filters_container->get_child_count(); ++i) { + CheckBox *cb = (CheckBox *)_filters_container->get_child(i); if (cb->is_pressed()) { - filters.insert(_filters[i]->get_text()); + filters.insert(cb->get_text()); } } return filters; @@ -440,6 +424,20 @@ void FindInFilesDialog::_notification(int p_what) { // Doesn't work more than once if not deferred... _search_text_line_edit->call_deferred("grab_focus"); _search_text_line_edit->select_all(); + // Extensions might have changed in the meantime, we clean them and instance them again. + for (int i = 0; i < _filters_container->get_child_count(); i++) { + _filters_container->get_child(i)->queue_delete(); + } + Array exts = ProjectSettings::get_singleton()->get("editor/search_in_file_extensions"); + for (int i = 0; i < exts.size(); ++i) { + CheckBox *cb = memnew(CheckBox); + cb->set_text(exts[i]); + if (!_filters_preferences.has(exts[i])) { + _filters_preferences[exts[i]] = true; + } + cb->set_pressed(_filters_preferences[exts[i]]); + _filters_container->add_child(cb); + } } } } @@ -449,6 +447,10 @@ void FindInFilesDialog::_on_folder_button_pressed() { } void FindInFilesDialog::custom_action(const String &p_action) { + for (int i = 0; i < _filters_container->get_child_count(); ++i) { + CheckBox *cb = (CheckBox *)_filters_container->get_child(i); + _filters_preferences[cb->get_text()] = cb->is_pressed(); + } if (p_action == "find") { emit_signal(SIGNAL_FIND_REQUESTED); hide(); diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 220f8cc136..5f728a104b 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -31,6 +31,7 @@ #ifndef FIND_IN_FILES_H #define FIND_IN_FILES_H +#include "core/hash_map.h" #include "scene/gui/dialogs.h" // Performs the actual search @@ -88,6 +89,7 @@ private: class LineEdit; class CheckBox; class FileDialog; +class HBoxContainer; // Prompts search parameters class FindInFilesDialog : public AcceptDialog { @@ -120,12 +122,13 @@ private: LineEdit *_search_text_line_edit; LineEdit *_folder_line_edit; - Vector<CheckBox *> _filters; CheckBox *_match_case_checkbox; CheckBox *_whole_words_checkbox; Button *_find_button; Button *_replace_button; FileDialog *_folder_dialog; + HBoxContainer *_filters_container; + HashMap<String, bool> _filters_preferences; }; class Button; diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 5ac7bc3bc8..5da731b0a0 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1291,6 +1291,13 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } String root_type = p_options["nodes/root_type"]; + root_type = root_type.split(" ")[0]; // full root_type is "ClassName (filename.gd)" for a script global class. + + Ref<Script> root_script = NULL; + if (ScriptServer::is_global_class(root_type)) { + root_script = ResourceLoader::load(ScriptServer::get_global_class_path(root_type)); + root_type = ScriptServer::get_global_class_base(root_type); + } if (root_type != "Spatial") { Node *base_node = Object::cast_to<Node>(ClassDB::instance(root_type)); @@ -1303,6 +1310,10 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } } + if (root_script.is_valid()) { + scene->set_script(Variant(root_script)); + } + if (Object::cast_to<Spatial>(scene)) { float root_scale = p_options["nodes/root_scale"]; Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale)); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index a661c2cfc3..621ab039f4 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -262,7 +262,7 @@ void ScriptEditorDebugger::_scene_tree_folded(Object *obj) { return; ObjectID id = item->get_metadata(0); - if (item->is_collapsed()) { + if (unfold_cache.has(id)) { unfold_cache.erase(id); } else { unfold_cache.insert(id); diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index 9f132825fb..a962d6df27 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -369,7 +369,11 @@ bool GodotSharpBuilds::build_project_blocking(const String &p_config, const Vect MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), p_config); // Add Godot defines +#ifdef WINDOWS_ENABLED String constants = "GodotDefineConstants=\""; +#else + String constants = "GodotDefineConstants=\\\""; +#endif for (int i = 0; i < p_godot_defines.size(); i++) { constants += "GODOT_" + p_godot_defines[i].to_upper().replace("-", "_").replace(" ", "_").replace(";", "_") + ";"; @@ -379,7 +383,11 @@ bool GodotSharpBuilds::build_project_blocking(const String &p_config, const Vect constants += "GODOT_REAL_T_IS_DOUBLE;"; #endif +#ifdef WINDOWS_ENABLED constants += "\""; +#else + constants += "\\\""; +#endif build_info.custom_props.push_back(constants); if (!GodotSharpBuilds::get_singleton()->build(build_info)) { diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 0f6af358bd..e389d5f98f 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -312,7 +312,7 @@ void NavigationPolygon::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_outlines", "outlines"), &NavigationPolygon::_set_outlines); ClassDB::bind_method(D_METHOD("_get_outlines"), &NavigationPolygon::_get_outlines); - ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR3_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); + ADD_PROPERTY(PropertyInfo(Variant::POOL_VECTOR2_ARRAY, "vertices", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_vertices", "get_vertices"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "polygons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_polygons", "_get_polygons"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "outlines", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_outlines", "_get_outlines"); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 1aded826c0..99c86f0406 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -271,6 +271,11 @@ float GeometryInstance::get_extra_cull_margin() const { return extra_cull_margin; } +void GeometryInstance::set_custom_aabb(AABB aabb) { + + VS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb); +} + void GeometryInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance::set_material_override); @@ -297,6 +302,8 @@ void GeometryInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin); ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); + ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &GeometryInstance::set_custom_aabb); + ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance::get_aabb); ADD_GROUP("Geometry", ""); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index f5b7479bb1..0e7d9be505 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -139,6 +139,8 @@ public: void set_extra_cull_margin(float p_margin); float get_extra_cull_margin() const; + void set_custom_aabb(AABB aabb); + GeometryInstance(); }; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index ebfcd51247..6ab78326b2 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -819,15 +819,17 @@ int Animation::_insert(float p_time, T &p_keys, const V &p_value) { while (true) { - if (idx == 0 || p_keys[idx - 1].time < p_time) { - //condition for insertion. - p_keys.insert(idx, p_value); - return idx; - } else if (p_keys[idx - 1].time == p_time) { + // Condition for replacement. + if (idx > 0 && Math::is_equal_approx(p_keys[idx - 1].time, p_time)) { - // condition for replacing. p_keys.write[idx - 1] = p_value; return idx - 1; + + // Condition for insert. + } else if (idx == 0 || p_keys[idx - 1].time < p_time) { + + p_keys.insert(idx, p_value); + return idx; } idx--; |