diff options
33 files changed, 277 insertions, 260 deletions
diff --git a/SConstruct b/SConstruct index dbce94f296..88b29695cb 100644 --- a/SConstruct +++ b/SConstruct @@ -168,7 +168,6 @@ opts.Add(BoolVariable('vsproj', "Generate Visual Studio Project.", False)) opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no'))) opts.Add(BoolVariable('progress', "Show a progress indicator during build", True)) opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False)) -opts.Add(BoolVariable('openmp', "If yes, enable OpenMP", True)) opts.Add(EnumVariable('macports_clang', "Build using clang from MacPorts", 'no', ('no', '5.0', 'devel'))) # Thirdparty libraries diff --git a/core/os/threaded_array_processor.cpp b/core/os/threaded_array_processor.cpp new file mode 100644 index 0000000000..8e92508ea5 --- /dev/null +++ b/core/os/threaded_array_processor.cpp @@ -0,0 +1,2 @@ +#include "threaded_array_processor.h" + diff --git a/core/os/threaded_array_processor.h b/core/os/threaded_array_processor.h new file mode 100644 index 0000000000..e584fbb193 --- /dev/null +++ b/core/os/threaded_array_processor.h @@ -0,0 +1,80 @@ +#ifndef THREADED_ARRAY_PROCESSOR_H +#define THREADED_ARRAY_PROCESSOR_H + +#include "os/mutex.h" +#include "os/os.h" +#include "os/thread.h" +#include "safe_refcount.h" +#include "thread_safe.h" + +template <class C, class U> +struct ThreadArrayProcessData { + uint32_t elements; + uint32_t index; + C *instance; + U userdata; + void (C::*method)(uint32_t, U); + + void process(uint32_t p_index) { + (instance->*method)(p_index, userdata); + } +}; + +#ifndef NO_THREADS + +template <class T> +void process_array_thread(void *ud) { + + T &data = *(T *)ud; + while (true) { + uint32_t index = atomic_increment(&data.index); + if (index >= data.elements) + break; + data.process(index); + } +} + +template <class C, class M, class U> +void thread_process_array(uint32_t p_elements, C *p_instance, M p_method, U p_userdata) { + + ThreadArrayProcessData<C, U> data; + data.method = p_method; + data.instance = p_instance; + data.userdata = p_userdata; + data.index = 0; + data.elements = p_elements; + data.process(data.index); //process first, let threads increment for next + + Vector<Thread *> threads; + + threads.resize(OS::get_singleton()->get_processor_count()); + + for (int i = 0; i < threads.size(); i++) { + threads[i] = Thread::create(process_array_thread<ThreadArrayProcessData<C, U> >, &data); + } + + for (int i = 0; i < threads.size(); i++) { + Thread::wait_to_finish(threads[i]); + memdelete(threads[i]); + } +} + +#else + +template <class C, class M, class U> +void thread_process_array(uint32_t p_elements, C *p_instance, M p_method, U p_userdata) { + + ThreadArrayProcessData<C, U> data; + data.method = p_method; + data.instance = p_instance; + data.userdata = p_userdata; + data.index = 0; + data.elements = p_elements; + for (uint32_t i = 0; i < p_elements; i++) { + data.process(i); + } +} + +#endif + +#endif // THREADED_ARRAY_PROCESSOR_H diff --git a/doc/classes/PhysicsDirectSpaceState.xml b/doc/classes/PhysicsDirectSpaceState.xml index 21576646f9..56acd34f0a 100644 --- a/doc/classes/PhysicsDirectSpaceState.xml +++ b/doc/classes/PhysicsDirectSpaceState.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="PhysicsDirectSpaceState" inherits="Object" category="Core" version="3.0-beta"> <brief_description> + Direct access object to a space in the [PhysicsServer]. </brief_description> <description> + Direct access object to a space in the [PhysicsServer]. It's used mainly to do queries against objects and areas residing in a given space. </description> <tutorials> </tutorials> @@ -17,6 +19,8 @@ <argument index="1" name="motion" type="Vector3"> </argument> <description> + Check whether the shape can travel to a point. If it can, the method will return an array with two floats between 0 and 1: The first is how far the shape can move toward the point without colliding, and the second is the distance at which it will collide. If no collision is detected, the returned array will be [1, 1]. + If the shape can not move, the array will be empty (dir.empty()==true). </description> </method> <method name="collide_shape"> @@ -27,6 +31,7 @@ <argument index="1" name="max_results" type="int" default="32"> </argument> <description> + Check the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. </description> </method> <method name="get_rest_info"> @@ -35,6 +40,14 @@ <argument index="0" name="shape" type="PhysicsShapeQueryParameters"> </argument> <description> + Check the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. If it collides with more than a shape, the nearest one is selected. The returned object is a dictionary containing the following fields: + collider_id: ID of the object against which the shape intersected. + linear_velocity: The movement vector of the object the shape intersected, if it was a body. If it was an area, it is (0,0). + normal: Normal of the object at the point where the shapes intersect. + point: Place where the shapes intersect. + rid: [RID] of the object against which the shape intersected. + shape: Shape index within the object against which the shape intersected. + If the shape did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. </description> </method> <method name="intersect_ray"> @@ -49,6 +62,15 @@ <argument index="3" name="collision_layer" type="int" default="2147483647"> </argument> <description> + Intersect a ray in a given space. The returned object is a dictionary with the following fields: + collider: Object against which the ray was stopped. + collider_id: ID of the object against which the ray was stopped. + normal: Normal of the object at the point where the ray was stopped. + position: Place where ray is stopped. + rid: [RID] of the object against which the ray was stopped. + shape: Shape index within the object against which the ray was stopped. + If the ray did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. + Additionally, the method can take an array of objects or [RID]s that are to be excluded from collisions, or a bitmask representing the physics layers to check in. </description> </method> <method name="intersect_shape"> @@ -59,6 +81,12 @@ <argument index="1" name="max_results" type="int" default="32"> </argument> <description> + Check the intersections of a shape, given through a [PhysicsShapeQueryParameters] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields: + collider: Object the shape intersected. + collider_id: ID of the object the shape intersected. + rid: [RID] of the object the shape intersected. + shape: Shape index within the object the shape intersected. + The number of intersections can be limited with the second parameter, to reduce the processing time. </description> </method> </methods> diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 17576f33ed..f4717aa995 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -4,7 +4,7 @@ 2D Transformation. 3x2 matrix. </brief_description> <description> - Represents one or many transformations in 3D space such as translation, rotation, or scaling. It consists of a two [Vector2] x, y and [Vector2] "origin". It is similar to a 3x2 matrix. + Represents one or many transformations in 2D space such as translation, rotation, or scaling. It consists of a two [Vector2] x, y and [Vector2] "origin". It is similar to a 3x2 matrix. </description> <tutorials> </tutorials> @@ -17,7 +17,7 @@ <argument index="0" name="from" type="Transform"> </argument> <description> - Constructs the [code]Transform2D[/code] from a 3D [Transform]. + Constructs the transform from a 3D [Transform]. </description> </method> <method name="Transform2D"> @@ -30,7 +30,7 @@ <argument index="2" name="origin" type="Vector2"> </argument> <description> - Constructs the [code]Transform2D[/code] from 3 [Vector2] consisting of rows x, y and origin. + Constructs the transform from 3 [Vector2]s representing x, y, and origin. </description> </method> <method name="Transform2D"> @@ -41,7 +41,7 @@ <argument index="1" name="position" type="Vector2"> </argument> <description> - Constructs the [code]Transform2D[/code] from rotation angle in radians and position [Vector2]. + Constructs the transform from a given angle (in radians) and position. </description> </method> <method name="affine_inverse"> @@ -57,7 +57,7 @@ <argument index="0" name="v" type="var"> </argument> <description> - Transforms the given vector "v" by this transform basis (no translation). + Transforms the given vector by this transform's basis (no translation). </description> </method> <method name="basis_xform_inv"> @@ -66,21 +66,21 @@ <argument index="0" name="v" type="var"> </argument> <description> - Inverse-transforms the given vector "v" by this transform basis (no translation). + Inverse-transforms the given vector by this transform's basis (no translation). </description> </method> <method name="get_origin"> <return type="Vector2"> </return> <description> - Returns the origin [Vector2] (translation). + Returns the transform's origin (translation). </description> </method> <method name="get_rotation"> <return type="float"> </return> <description> - Returns the rotation (in radians). + Returns the transform's rotation (in radians). </description> </method> <method name="get_scale"> @@ -98,7 +98,7 @@ <argument index="1" name="weight" type="float"> </argument> <description> - Interpolates the transform to other Transform2D by weight amount (0-1). + Returns a transform interpolated between this transform and another by a given weight (0-1). </description> </method> <method name="inverse"> @@ -121,7 +121,7 @@ <argument index="0" name="phi" type="float"> </argument> <description> - Rotates the transform by phi. + Rotates the transform by the given angle (in radians). </description> </method> <method name="scaled"> @@ -130,7 +130,7 @@ <argument index="0" name="scale" type="Vector2"> </argument> <description> - Scales the transform by the specified 2D scaling factors. + Scales the transform by the given factor. </description> </method> <method name="translated"> @@ -139,7 +139,7 @@ <argument index="0" name="offset" type="Vector2"> </argument> <description> - Translates the transform by the specified offset. + Translates the transform by the given offset. </description> </method> <method name="xform"> @@ -163,13 +163,13 @@ </methods> <members> <member name="origin" type="Vector2" setter="" getter=""> - The translation offset of the transform. + The transform's translation offset. </member> <member name="x" type="Vector2" setter="" getter=""> - The X axis of 2x2 basis matrix containing 2 [Vector2] as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. + The X axis of 2x2 basis matrix containing 2 [Vector2]s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. </member> <member name="y" type="Vector2" setter="" getter=""> - The Y axis of 2x2 basis matrix containing 2 [Vector2] as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. + The Y axis of 2x2 basis matrix containing 2 [Vector2]s as its columns: X axis and Y axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. </member> </members> <constants> diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 2584d26fc4..2189830acb 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -267,7 +267,6 @@ void CreateDialog::_update_search() { if (EditorNode::get_editor_data().get_custom_types().has(type) && ClassDB::is_parent_class(type, base_type)) { //there are custom types based on this... cool. - //print_line("there are custom types"); const Vector<EditorData::CustomType> &ct = EditorNode::get_editor_data().get_custom_types()[type]; for (int i = 0; i < ct.size(); i++) { @@ -630,31 +629,44 @@ CreateDialog::CreateDialog() { set_resizable(true); - HSplitContainer *hbc = memnew(HSplitContainer); - - add_child(hbc); - - VBoxContainer *lvbc = memnew(VBoxContainer); - hbc->add_child(lvbc); - lvbc->set_custom_minimum_size(Size2(150, 0) * EDSCALE); - - favorites = memnew(Tree); - lvbc->add_margin_child(TTR("Favorites:"), favorites, true); - favorites->set_hide_root(true); - favorites->set_hide_folding(true); - favorites->connect("cell_selected", this, "_favorite_selected"); - favorites->connect("item_activated", this, "_favorite_activated"); - favorites->set_drag_forwarding(this); + HSplitContainer *hsc = memnew(HSplitContainer); + add_child(hsc); + + VSplitContainer *vsc = memnew(VSplitContainer); + hsc->add_child(vsc); + + { + VBoxContainer *lvbc = memnew(VBoxContainer); + vsc->add_child(lvbc); + lvbc->set_custom_minimum_size(Size2(150, 100) * EDSCALE); + lvbc->set_v_size_flags(SIZE_EXPAND_FILL); + + favorites = memnew(Tree); + lvbc->add_margin_child(TTR("Favorites:"), favorites, true); + favorites->set_hide_root(true); + favorites->set_hide_folding(true); + favorites->connect("cell_selected", this, "_favorite_selected"); + favorites->connect("item_activated", this, "_favorite_activated"); + favorites->set_drag_forwarding(this); + } - recent = memnew(Tree); - lvbc->add_margin_child(TTR("Recent:"), recent, true); - recent->set_hide_root(true); - recent->set_hide_folding(true); - recent->connect("cell_selected", this, "_history_selected"); - recent->connect("item_activated", this, "_history_activated"); + { + VBoxContainer *lvbc = memnew(VBoxContainer); + vsc->add_child(lvbc); + lvbc->set_custom_minimum_size(Size2(150, 100) * EDSCALE); + lvbc->set_v_size_flags(SIZE_EXPAND_FILL); + + recent = memnew(Tree); + lvbc->add_margin_child(TTR("Recent:"), recent, true); + recent->set_hide_root(true); + recent->set_hide_folding(true); + recent->connect("cell_selected", this, "_history_selected"); + recent->connect("item_activated", this, "_history_activated"); + } VBoxContainer *vbc = memnew(VBoxContainer); - hbc->add_child(vbc); + hsc->add_child(vbc); + vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); vbc->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *search_hb = memnew(HBoxContainer); search_box = memnew(LineEdit); @@ -676,7 +688,6 @@ CreateDialog::CreateDialog() { set_hide_on_ok(false); search_options->connect("item_activated", this, "_confirmed"); search_options->connect("cell_selected", this, "_item_selected"); - //search_options->set_hide_root(true); base_type = "Object"; preferred_search_result_type = ""; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 46badc8c86..814da4b5f4 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -324,23 +324,14 @@ EditorHelpSearch::EditorHelpSearch() { set_hide_on_ok(false); search_options->connect("item_activated", this, "_confirmed"); set_title(TTR("Search Help")); - - //search_options->set_hide_root(true); } ///////////////////////////////// -//////////////////////////////////// -/// ///////////////////////////////// - void EditorHelpIndex::add_type(const String &p_type, HashMap<String, TreeItem *> &p_types, TreeItem *p_root) { if (p_types.has(p_type)) return; - /* - if (!ClassDB::is_type(p_type,base) || p_type==base) - return; - */ String inherits = EditorHelp::get_doc_data()->class_list[p_type].inherits; @@ -379,8 +370,6 @@ void EditorHelpIndex::_tree_item_selected() { EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT); emit_signal("open_class", s->get_text(0)); hide(); - - //_goto_desc(s->get_text(0)); } void EditorHelpIndex::select_class(const String &p_class) { @@ -518,8 +507,6 @@ EditorHelpIndex::EditorHelpIndex() { ///////////////////////////////// -//////////////////////////////////// -/// ///////////////////////////////// DocData *EditorHelp::doc = NULL; void EditorHelp::_init_colors() { @@ -572,9 +559,7 @@ void EditorHelp::_class_list_select(const String &p_select) { void EditorHelp::_class_desc_select(const String &p_select) { - //print_line("LINK: "+p_select); if (p_select.begins_with("$")) { //enum - //_goto_desc(p_select.substr(1,p_select.length())); String select = p_select.substr(1, p_select.length()); String class_name; if (select.find(".") != -1) { @@ -585,7 +570,6 @@ void EditorHelp::_class_desc_select(const String &p_select) { emit_signal("go_to_help", "class_enum:" + class_name + ":" + select); return; } else if (p_select.begins_with("#")) { - //_goto_desc(p_select.substr(1,p_select.length())); emit_signal("go_to_help", "class_name:" + p_select.substr(1, p_select.length())); return; } else if (p_select.begins_with("@")) { @@ -612,7 +596,6 @@ void EditorHelp::_class_desc_select(const String &p_select) { } if (link.find(".") != -1) { - //must go somewhere else emit_signal("go_to_help", topic + ":" + link.get_slice(".", 0) + ":" + link.get_slice(".", 1)); } else { @@ -749,16 +732,13 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { - //ERR_FAIL_COND(!doc->class_list.has(p_class)); if (!doc->class_list.has(p_class)) return ERR_DOES_NOT_EXIST; - //if (tree_item_map.has(p_class)) { select_locked = true; - //} class_desc->show(); - //tabs->set_current_tab(PAGE_CLASS_DESC); + description_line = 0; if (p_class == edited_class) @@ -770,7 +750,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { method_line.clear(); section_line.clear(); edited_class = p_class; - //edited_class->show(); _init_colors(); @@ -866,7 +845,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->pop(); class_desc->pop(); - //class_desc->add_newline(); class_desc->add_newline(); class_desc->push_color(text_color); class_desc->push_font(doc_font); @@ -891,7 +869,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->add_text(TTR("Members:")); class_desc->pop(); class_desc->pop(); - //class_desc->add_newline(); class_desc->push_indent(1); class_desc->push_table(2); @@ -970,9 +947,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->pop(); class_desc->pop(); - //class_desc->add_newline(); - //class_desc->add_newline(); - class_desc->push_indent(1); class_desc->push_table(2); class_desc->set_table_column_expand(1, 1); @@ -1098,7 +1072,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->pop(); class_desc->add_newline(); - //class_desc->add_newline(); class_desc->push_indent(1); @@ -1106,8 +1079,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { signal_line[cd.signals[i].name] = class_desc->get_line_count() - 2; //gets overridden if description class_desc->push_font(doc_code_font); // monofont - //_add_type("void"); - //class_desc->add_text(" "); class_desc->push_color(headline_color); _add_text(cd.signals[i].name); class_desc->pop(); @@ -1141,7 +1112,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_font(doc_font); class_desc->push_color(comment_color); class_desc->push_indent(1); - // class_desc->add_text(" "); _add_text(cd.signals[i].description); class_desc->pop(); // indent class_desc->pop(); @@ -1185,7 +1155,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_indent(1); class_desc->add_newline(); - //class_desc->add_newline(); for (Map<String, Vector<DocData::ConstantDoc> >::Element *E = enums.front(); E; E = E->next()) { @@ -1260,7 +1229,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->push_indent(1); class_desc->add_newline(); - //class_desc->add_newline(); for (int i = 0; i < constants.size(); i++) { @@ -1279,7 +1247,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { if (constants[i].description != "") { class_desc->push_font(doc_font); class_desc->push_indent(1); - //class_desc->add_text(" "); class_desc->push_color(comment_color); _add_text(constants[i].description); class_desc->pop(); @@ -1353,8 +1320,6 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { class_desc->pop(); // font class_desc->pop(); // cell - //class_desc->add_text(" "); - if (cd.properties[i].setter != "") { class_desc->push_cell(); @@ -1538,7 +1503,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { } if (brk_pos == bbcode.length()) - break; //nothing else o add + break; //nothing else to add int brk_end = bbcode.find("]", brk_pos + 1); @@ -1734,10 +1699,6 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) { pos = brk_pos + 1; } } - - /*p_rt->pop(); - p_rt->pop(); - p_rt->pop();*/ } void EditorHelp::_add_text(const String &p_bbcode) { @@ -1762,8 +1723,7 @@ void EditorHelp::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { - //forward->set_icon(get_icon("Forward","EditorIcons")); - //back->set_icon(get_icon("Back","EditorIcons")); + _update_doc(); } break; @@ -1836,7 +1796,6 @@ void EditorHelp::_bind_methods() { ClassDB::bind_method("_class_list_select", &EditorHelp::_class_list_select); ClassDB::bind_method("_class_desc_select", &EditorHelp::_class_desc_select); ClassDB::bind_method("_class_desc_input", &EditorHelp::_class_desc_input); - //ClassDB::bind_method("_button_pressed",&EditorHelp::_button_pressed); ClassDB::bind_method("_request_help", &EditorHelp::_request_help); ClassDB::bind_method("_unhandled_key_input", &EditorHelp::_unhandled_key_input); ClassDB::bind_method("_search", &EditorHelp::_search); @@ -1848,21 +1807,16 @@ void EditorHelp::_bind_methods() { EditorHelp::EditorHelp() { - VBoxContainer *vbc = this; + set_custom_minimum_size(Size2(150 * EDSCALE, 0)); EDITOR_DEF("text_editor/help/sort_functions_alphabetically", true); - //class_list->connect("meta_clicked",this,"_class_list_select"); - //class_list->set_selection_enabled(true); - - { - class_desc = memnew(RichTextLabel); - vbc->add_child(class_desc); - class_desc->set_v_size_flags(SIZE_EXPAND_FILL); - class_desc->add_color_override("selection_color", get_color("text_editor/theme/selection_color", "Editor")); - class_desc->connect("meta_clicked", this, "_class_desc_select"); - class_desc->connect("gui_input", this, "_class_desc_input"); - } + class_desc = memnew(RichTextLabel); + add_child(class_desc); + class_desc->set_v_size_flags(SIZE_EXPAND_FILL); + class_desc->add_color_override("selection_color", get_color("text_editor/theme/selection_color", "Editor")); + class_desc->connect("meta_clicked", this, "_class_desc_select"); + class_desc->connect("gui_input", this, "_class_desc_input"); class_desc->set_selection_enabled(true); @@ -1882,12 +1836,6 @@ EditorHelp::EditorHelp() { search_dialog->get_ok()->set_text(TTR("Find")); search_dialog->connect("confirmed", this, "_search_cbk"); search_dialog->set_hide_on_ok(false); - - /*class_search = memnew( EditorHelpSearch(editor) ); - editor->get_gui_base()->add_child(class_search); - class_search->connect("go_to_help",this,"_help_callback");*/ - - //prev_search_page=-1; } EditorHelp::~EditorHelp() { @@ -1905,9 +1853,9 @@ void EditorHelpBit::_go_to_help(String p_what) { void EditorHelpBit::_meta_clicked(String p_select) { print_line("got meta " + p_select); - //print_line("LINK: "+p_select); + if (p_select.begins_with("$")) { //enum - //_goto_desc(p_select.substr(1,p_select.length())); + String select = p_select.substr(1, p_select.length()); String class_name; if (select.find(".") != -1) { @@ -1918,24 +1866,15 @@ void EditorHelpBit::_meta_clicked(String p_select) { _go_to_help("class_enum:" + class_name + ":" + select); return; } else if (p_select.begins_with("#")) { - //_goto_desc(p_select.substr(1,p_select.length())); + _go_to_help("class_name:" + p_select.substr(1, p_select.length())); return; } else if (p_select.begins_with("@")) { String m = p_select.substr(1, p_select.length()); - if (m.find(".") != -1) { - //must go somewhere else - - _go_to_help("class_method:" + m.get_slice(".", 0) + ":" + m.get_slice(".", 0)); - } else { - /* - if (!method_line.has(m)) - return; - class_desc->scroll_to_line(method_line[m]); - */ - } + if (m.find(".") != -1) + _go_to_help("class_method:" + m.get_slice(".", 0) + ":" + m.get_slice(".", 0)); //must go somewhere else } } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index cc0b292cc4..5610baa775 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -972,6 +972,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("commentfocus", "GraphNode", graphsbcommentselected); theme->set_stylebox("breakpoint", "GraphNode", graphsbbreakpoint); theme->set_stylebox("position", "GraphNode", graphsbposition); + + Color default_node_color = Color(mv2, mv2, mv2); + theme->set_color("title_color", "GraphNode", default_node_color); + default_node_color.a = 0.7; + theme->set_color("close_color", "GraphNode", default_node_color); + theme->set_constant("port_offset", "GraphNode", 14 * EDSCALE); theme->set_constant("title_h_offset", "GraphNode", -16 * EDSCALE); theme->set_constant("close_h_offset", "GraphNode", 20 * EDSCALE); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 8fe6538653..0c6c608d3d 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -1435,7 +1435,7 @@ AnimationTreeEditorPlugin::AnimationTreeEditorPlugin(EditorNode *p_node) { anim_tree_editor = memnew(AnimationTreeEditor); anim_tree_editor->set_custom_minimum_size(Size2(0, 300)); - button = editor->add_bottom_panel_item("AnimationTree", anim_tree_editor); + button = editor->add_bottom_panel_item(TTR("AnimationTree"), anim_tree_editor); button->hide(); } diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 3210af1433..88649ca267 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -444,7 +444,7 @@ ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin(EditorNode *p_node) preloader_editor = memnew(ResourcePreloaderEditor); preloader_editor->set_custom_minimum_size(Size2(0, 250)); - button = editor->add_bottom_panel_item("ResourcePreloader", preloader_editor); + button = editor->add_bottom_panel_item(TTR("ResourcePreloader"), preloader_editor); button->hide(); //preloader_editor->set_anchor( MARGIN_TOP, Control::ANCHOR_END); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 591e6dac56..c1c75656c5 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -132,7 +132,7 @@ public: I = I->next(); } - if (O != E) { //should never heppane.. + if (O != E) { //should never happen.. cached.erase(O); } } @@ -234,7 +234,6 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); - //set_child_rect(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); search_box->connect("text_changed", this, "_text_changed"); @@ -257,8 +256,6 @@ ScriptEditor *ScriptEditor::script_editor = NULL; String ScriptEditor::_get_debug_tooltip(const String &p_text, Node *_se) { - //ScriptEditorBase *se=Object::cast_to<ScriptEditorBase>(_se); - String val = debugger->get_var_value(p_text); if (val != String()) { return p_text + ": " + val; @@ -551,8 +548,6 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) { idx = history[history_pos].control->get_index(); } tab_container->set_current_tab(idx); - - //script_list->select(idx); } _update_history_arrows(); @@ -698,7 +693,6 @@ void ScriptEditor::_reload_scripts() { uint64_t last_date = script->get_last_modified_time(); uint64_t date = FileAccess::get_modified_time(script->get_path()); - //printf("last date: %lli vs date: %lli\n",last_date,date); if (last_date == date) { continue; } @@ -776,7 +770,6 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) { uint64_t last_date = script->get_last_modified_time(); uint64_t date = FileAccess::get_modified_time(script->get_path()); - //printf("last date: %lli vs date: %lli\n",last_date,date); if (last_date != date) { TreeItem *ti = disk_changed_list->create_item(r); @@ -786,7 +779,6 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) { need_ask = true; } need_reload = true; - //r->set_metadata(0,); } } } @@ -1205,9 +1197,6 @@ void ScriptEditor::_notification(int p_what) { _update_modified_scripts_for_external_editor(); } break; - case NOTIFICATION_PROCESS: { - } break; - case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { help_search->set_icon(get_icon("HelpSearch", "EditorIcons")); @@ -1367,18 +1356,9 @@ void ScriptEditor::ensure_select_current() { if (!grab_focus_block && is_visible_in_tree()) se->ensure_focus(); - - //edit_menu->show(); - //search_menu->show(); } EditorHelp *eh = Object::cast_to<EditorHelp>(current); - - if (eh) { - //edit_menu->hide(); - //search_menu->hide(); - //script_search_menu->show(); - } } _update_selected_editor_menu(); @@ -1823,12 +1803,8 @@ void ScriptEditor::save_all_scripts() { if (script.is_valid()) se->apply_code(); - if (script->get_path() != "" && script->get_path().find("local://") == -1 && script->get_path().find("::") == -1) { - //external script, save it - - editor->save_resource(script); - //ResourceSaver::save(script->get_path(),script); - } + if (script->get_path() != "" && script->get_path().find("local://") == -1 && script->get_path().find("::") == -1) + editor->save_resource(script); //external script, save it } _update_script_names(); @@ -1886,7 +1862,6 @@ void ScriptEditor::_editor_stop() { void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const PoolStringArray &p_args) { - //print_line("add callback! hohoho"); kinda sad to remove this ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); ERR_FAIL_COND(!script.is_valid()); @@ -1981,8 +1956,6 @@ void ScriptEditor::_script_split_dragged(float) { Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - // return Variant(); // return this if drag disabled - Node *cur_node = tab_container->get_child(tab_container->get_current_tab()); HBoxContainer *drag_preview = memnew(HBoxContainer); @@ -2202,9 +2175,6 @@ void ScriptEditor::_make_script_list_context_menu() { } EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(selected)); - if (eh) { - // nothing - } context_menu->add_separator(); context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/window_move_up"), WINDOW_MOVE_UP); @@ -2588,10 +2558,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list = memnew(ItemList); list_split->add_child(script_list); - script_list->set_custom_minimum_size(Size2(150 * EDSCALE, 100)); //need to give a bit of limit to avoid it from disappearing + script_list->set_custom_minimum_size(Size2(150 * EDSCALE, 90)); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(140); - //list_split->set_split_offset(500); _sort_list_on_update = true; script_list->connect("gui_input", this, "_script_list_gui_input"); script_list->set_allow_rmb_select(true); @@ -2603,18 +2572,18 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { members_overview = memnew(ItemList); list_split->add_child(members_overview); - members_overview->set_custom_minimum_size(Size2(0, 100)); //need to give a bit of limit to avoid it from disappearing + members_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing members_overview->set_v_size_flags(SIZE_EXPAND_FILL); help_overview = memnew(ItemList); list_split->add_child(help_overview); - help_overview->set_custom_minimum_size(Size2(0, 100)); //need to give a bit of limit to avoid it from disappearing + help_overview->set_custom_minimum_size(Size2(0, 90)); //need to give a bit of limit to avoid it from disappearing help_overview->set_v_size_flags(SIZE_EXPAND_FILL); tab_container = memnew(TabContainer); tab_container->set_tabs_visible(false); + tab_container->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); script_split->add_child(tab_container); - tab_container->set_h_size_flags(SIZE_EXPAND_FILL); ED_SHORTCUT("script_editor/window_sort", TTR("Sort")); @@ -2762,7 +2731,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { { VBoxContainer *vbc = memnew(VBoxContainer); disk_changed->add_child(vbc); - //disk_changed->set_child_rect(vbc); Label *dl = memnew(Label); dl->set_text(TTR("The following files are newer on disk.\nWhat action should be taken?:")); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 175655119f..71c81f7111 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -840,7 +840,7 @@ SpriteFramesEditorPlugin::SpriteFramesEditorPlugin(EditorNode *p_node) { editor = p_node; frames_editor = memnew(SpriteFramesEditor); frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); - button = editor->add_bottom_panel_item("SpriteFrames", frames_editor); + button = editor->add_bottom_panel_item(TTR("SpriteFrames"), frames_editor); button->hide(); } diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 5c965e4a05..9840d9021c 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -103,6 +103,6 @@ StyleBoxEditorPlugin::StyleBoxEditorPlugin(EditorNode *p_node) { stylebox_editor->set_custom_minimum_size(Size2(0, 250)); //p_node->get_viewport()->add_child(stylebox_editor); - button = p_node->add_bottom_panel_item("StyleBox", stylebox_editor); + button = p_node->add_bottom_panel_item(TTR("StyleBox"), stylebox_editor); button->hide(); } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 7f956b01ff..38a4bfbfc6 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -934,6 +934,6 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { theme_editor->set_custom_minimum_size(Size2(0, 200)); //p_node->get_viewport()->add_child(theme_editor); - button = editor->add_bottom_panel_item("Theme", theme_editor); + button = editor->add_bottom_panel_item(TTR("Theme"), theme_editor); button->hide(); } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 5eb3435e24..b56585f62c 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -314,7 +314,7 @@ TileSetEditorPlugin::TileSetEditorPlugin(EditorNode *p_node) { autotile_editor->side_panel->set_anchors_and_margins_preset(Control::PRESET_WIDE); autotile_editor->side_panel->set_custom_minimum_size(Size2(200, 0)); autotile_editor->side_panel->hide(); - autotile_button = p_node->add_bottom_panel_item("Autotiles", autotile_editor); + autotile_button = p_node->add_bottom_panel_item(TTR("Autotiles"), autotile_editor); autotile_button->hide(); } @@ -387,7 +387,7 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { tools[TOOL_SELECT] = memnew(ToolButton); tool_containers[TOOLBAR_DUMMY]->add_child(tools[TOOL_SELECT]); - tools[TOOL_SELECT]->set_tooltip("Select sub-tile to use as icon, this will be also used on invalid autotile bindings."); + tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to use as icon, this will be also used on invalid autotile bindings.")); tools[TOOL_SELECT]->set_toggle_mode(true); tools[TOOL_SELECT]->set_button_group(tg); tools[TOOL_SELECT]->set_pressed(true); @@ -533,7 +533,7 @@ void AutotileEditor::_on_edit_mode_changed(int p_edit_mode) { tool_containers[TOOLBAR_BITMASK]->show(); tool_containers[TOOLBAR_SHAPE]->hide(); tools[TOOL_SELECT]->set_pressed(true); - tools[TOOL_SELECT]->set_tooltip("LMB: set bit on.\nRMB: set bit off."); + tools[TOOL_SELECT]->set_tooltip(TTR("LMB: set bit on.\nRMB: set bit off.")); spin_priority->hide(); } break; case EDITMODE_COLLISION: @@ -542,7 +542,7 @@ void AutotileEditor::_on_edit_mode_changed(int p_edit_mode) { tool_containers[TOOLBAR_DUMMY]->show(); tool_containers[TOOLBAR_BITMASK]->hide(); tool_containers[TOOLBAR_SHAPE]->show(); - tools[TOOL_SELECT]->set_tooltip("Select current edited sub-tile."); + tools[TOOL_SELECT]->set_tooltip(TTR("Select current edited sub-tile.")); spin_priority->hide(); } break; default: { @@ -550,10 +550,10 @@ void AutotileEditor::_on_edit_mode_changed(int p_edit_mode) { tool_containers[TOOLBAR_BITMASK]->hide(); tool_containers[TOOLBAR_SHAPE]->hide(); if (edit_mode == EDITMODE_ICON) { - tools[TOOL_SELECT]->set_tooltip("Select sub-tile to use as icon, this will be also used on invalid autotile bindings."); + tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to use as icon, this will be also used on invalid autotile bindings.")); spin_priority->hide(); } else { - tools[TOOL_SELECT]->set_tooltip("Select sub-tile to change it's priority."); + tools[TOOL_SELECT]->set_tooltip(TTR("Select sub-tile to change it's priority.")); spin_priority->show(); } } break; diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 6f8573cd70..e69577489e 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1460,7 +1460,6 @@ void ProjectSettingsEditor::_update_translations() { t2->set_editable(1, true); t2->set_metadata(1, path); int idx = langs.find(locale); - //print_line("find " + locale + " at " + itos(idx)); if (idx < 0) idx = 0; @@ -1709,7 +1708,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { add = memnew(Button); hbc->add_child(add); - add->set_custom_minimum_size(Size2(150, 0) * EDSCALE); add->set_text(TTR("Add")); add->set_disabled(true); add->connect("pressed", this, "_action_add"); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 47feac9a12..64351dec4f 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -4591,6 +4591,8 @@ SectionedPropertyEditor::SectionedPropertyEditor() { search_box = NULL; + add_constant_override("autohide", 1); // Fixes the dragger always showing up + VBoxContainer *left_vb = memnew(VBoxContainer); left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE); add_child(left_vb); @@ -4602,6 +4604,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() { left_vb->add_child(sections, true); VBoxContainer *right_vb = memnew(VBoxContainer); + right_vb->set_custom_minimum_size(Size2(300, 0) * EDSCALE); right_vb->set_h_size_flags(SIZE_EXPAND_FILL); add_child(right_vb); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6fbca5c904..a107bea820 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1699,7 +1699,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) { icon = get_icon("Object", "EditorIcons"); if (menu->get_item_count() == 0) { - menu->add_submenu_item(TTR("Sub-Resources:"), "Sub-Resources"); + menu->add_submenu_item(TTR("Sub-Resources"), "Sub-Resources"); } int index = menu_subresources->get_item_count(); menu_subresources->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size()); @@ -1733,6 +1733,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { if (selection.size() == 1) { subresources.clear(); + menu_subresources->clear(); _add_children_to_popup(selection.front()->get(), 0); if (menu->get_item_count() > 0) menu->add_separator(); diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 26a4eeb065..5e736c1856 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -339,7 +339,7 @@ void RigidBodyBullet::set_space(SpaceBullet *p_space) { void RigidBodyBullet::dispatch_callbacks() { /// The check isTransformChanged is necessary in order to call integrated forces only when the first transform is sent - if (previousActiveState != btBody->isActive() && force_integration_callback && isTransformChanged) { + if ((btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) { BulletPhysicsDirectBodyState *bodyDirect = BulletPhysicsDirectBodyState::get_singleton(this); diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp index 9a1efb4423..d5819a4ca3 100644 --- a/modules/mono/editor/csharp_project.cpp +++ b/modules/mono/editor/csharp_project.cpp @@ -54,7 +54,7 @@ String generate_core_api_project(const String &p_dir, const Vector<String> &p_fi ERR_FAIL_V(String()); } - return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : ""; + return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : String(); } String generate_editor_api_project(const String &p_dir, const String &p_core_dll_path, const Vector<String> &p_files) { @@ -75,7 +75,7 @@ String generate_editor_api_project(const String &p_dir, const String &p_core_dll ERR_FAIL_V(String()); } - return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : ""; + return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : String(); } String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files) { @@ -96,7 +96,7 @@ String generate_game_project(const String &p_dir, const String &p_name, const Ve ERR_FAIL_V(String()); } - return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : ""; + return ret ? GDMonoMarshal::mono_string_to_godot((MonoString *)ret) : String(); } void add_item(const String &p_project_path, const String &p_item_type, const String &p_include) { diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp index 1bc1e8a515..1e61646769 100644 --- a/modules/mono/editor/godotsharp_editor.cpp +++ b/modules/mono/editor/godotsharp_editor.cpp @@ -50,9 +50,9 @@ GodotSharpEditor *GodotSharpEditor::singleton = NULL; bool GodotSharpEditor::_create_project_solution() { - EditorProgress pr("create_csharp_solution", "Generating solution...", 2); + EditorProgress pr("create_csharp_solution", TTR("Generating solution..."), 2); - pr.step("Generating C# project..."); + pr.step(TTR("Generating C# project...")); String path = OS::get_singleton()->get_resource_dir(); String name = ProjectSettings::get_singleton()->get("application/config/name"); @@ -67,7 +67,7 @@ bool GodotSharpEditor::_create_project_solution() { NETSolution solution(name); if (!solution.set_path(path)) { - show_error_dialog("Failed to create solution."); + show_error_dialog(TTR("Failed to create solution.")); return false; } @@ -79,7 +79,7 @@ bool GodotSharpEditor::_create_project_solution() { Error sln_error = solution.save(); if (sln_error != OK) { - show_error_dialog("Failed to save solution."); + show_error_dialog(TTR("Failed to save solution.")); return false; } @@ -89,13 +89,13 @@ bool GodotSharpEditor::_create_project_solution() { if (!GodotSharpBuilds::make_api_sln(GodotSharpBuilds::API_EDITOR)) return false; - pr.step("Done"); + pr.step(TTR("Done")); // Here, after all calls to progress_task_step call_deferred("_remove_create_sln_menu_option"); } else { - show_error_dialog("Failed to create C# project."); + show_error_dialog(TTR("Failed to create C# project.")); } return true; @@ -194,14 +194,14 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) { error_dialog = memnew(AcceptDialog); editor->get_gui_base()->add_child(error_dialog); - bottom_panel_btn = editor->add_bottom_panel_item("Mono", memnew(MonoBottomPanel(editor))); + bottom_panel_btn = editor->add_bottom_panel_item(TTR("Mono"), memnew(MonoBottomPanel(editor))); godotsharp_builds = memnew(GodotSharpBuilds); editor->add_child(memnew(MonoReloadNode)); menu_button = memnew(MenuButton); - menu_button->set_text("Mono"); + menu_button->set_text(TTR("Mono")); menu_popup = menu_button->get_popup(); String sln_path = GodotSharpDirs::get_project_sln_path(); @@ -209,7 +209,7 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) { if (!FileAccess::exists(sln_path) || !FileAccess::exists(csproj_path)) { bottom_panel_btn->hide(); - menu_popup->add_item("Create C# solution", MENU_CREATE_SLN); + menu_popup->add_item(TTR("Create C# solution"), MENU_CREATE_SLN); } menu_popup->connect("id_pressed", this, "_menu_option_pressed"); diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index 31dc09856a..be714026ad 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -197,7 +197,7 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) { panel_builds_tab->add_child(toolbar_hbc); ToolButton *build_project_btn = memnew(ToolButton); - build_project_btn->set_text("Build Project"); + build_project_btn->set_text(TTR("Build Project")); build_project_btn->set_focus_mode(FOCUS_NONE); build_project_btn->connect("pressed", this, "_build_project_pressed"); toolbar_hbc->add_child(build_project_btn); @@ -205,7 +205,7 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) { toolbar_hbc->add_spacer(); warnings_btn = memnew(ToolButton); - warnings_btn->set_text("Warnings"); + warnings_btn->set_text(TTR("Warnings")); warnings_btn->set_toggle_mode(true); warnings_btn->set_pressed(true); warnings_btn->set_visible(false); @@ -214,7 +214,7 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) { toolbar_hbc->add_child(warnings_btn); errors_btn = memnew(ToolButton); - errors_btn->set_text("Errors"); + errors_btn->set_text(TTR("Errors")); errors_btn->set_toggle_mode(true); errors_btn->set_pressed(true); errors_btn->set_visible(false); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index eb34f9dd3f..63b24f3ee6 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -290,7 +290,7 @@ int GDMonoField::get_int_value(MonoObject *p_object) { String GDMonoField::get_string_value(MonoObject *p_object) { MonoObject *val = get_value(p_object); - return val ? GDMonoMarshal::mono_string_to_godot((MonoString *)val) : String(); + return GDMonoMarshal::mono_string_to_godot((MonoString *)val); } bool GDMonoField::has_attribute(GDMonoClass *p_attr_class) { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 8bc2bb5096..d744d24f24 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -490,8 +490,9 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { return unbox<double>(p_obj); case MONO_TYPE_STRING: { - String str = mono_string_to_godot((MonoString *)p_obj); - return str; + if (p_obj == NULL) + return Variant(); // NIL + return mono_string_to_godot_not_null((MonoString *)p_obj); } break; case MONO_TYPE_VALUETYPE: { diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 443e947fb5..1be4be1a1c 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -62,13 +62,20 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type); String mono_to_utf8_string(MonoString *p_mono_string); String mono_to_utf16_string(MonoString *p_mono_string); -_FORCE_INLINE_ String mono_string_to_godot(MonoString *p_mono_string) { +_FORCE_INLINE_ String mono_string_to_godot_not_null(MonoString *p_mono_string) { if (sizeof(CharType) == 2) return mono_to_utf16_string(p_mono_string); return mono_to_utf8_string(p_mono_string); } +_FORCE_INLINE_ String mono_string_to_godot(MonoString *p_mono_string) { + if (p_mono_string == NULL) + return String(); + + return mono_string_to_godot_not_null(p_mono_string); +} + _FORCE_INLINE_ MonoString *mono_from_utf8_string(const String &p_string) { return mono_string_new(mono_domain_get(), p_string.utf8().get_data()); } diff --git a/modules/opus/register_types.cpp b/modules/opus/register_types.cpp index a69c8bf9f3..6d7a3575ed 100644 --- a/modules/opus/register_types.cpp +++ b/modules/opus/register_types.cpp @@ -34,13 +34,18 @@ static ResourceFormatLoaderAudioStreamOpus *opus_stream_loader = NULL; void register_opus_types() { - - opus_stream_loader = memnew(ResourceFormatLoaderAudioStreamOpus); - ResourceLoader::add_resource_format_loader(opus_stream_loader); - ClassDB::register_class<AudioStreamOpus>(); + // Sorry guys, do not enable this unless you can figure out a way + // to get Opus to not do any memory allocation or system calls + // in the audio thread. + // Currently the implementation even reads files from the audio thread, + // and this is not how audio programming works. + + //opus_stream_loader = memnew(ResourceFormatLoaderAudioStreamOpus); + //ResourceLoader::add_resource_format_loader(opus_stream_loader); + //ClassDB::register_class<AudioStreamOpus>(); } void unregister_opus_types() { - memdelete(opus_stream_loader); + //memdelete(opus_stream_loader); } diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 5b04ab8826..2e686fbee4 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -82,9 +82,6 @@ def configure(env): env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" env['AS'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as" env.Append(CCFLAGS=['-D__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define - if env['tools'] and env['openmp']: - env.Append(CPPFLAGS=['-fopenmp']) - env.Append(LINKFLAGS=['-fopenmp']) else: # osxcross build root = os.environ.get("OSXCROSS_ROOT", 0) diff --git a/platform/windows/detect.py b/platform/windows/detect.py index e216868bd8..3b8de2caf4 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -191,8 +191,6 @@ def configure(env): if (env["use_lto"]): env.Append(CCFLAGS=['/GL']) env.Append(LINKFLAGS=['/LTCG']) - if env['tools'] and env['openmp']: - env.Append(CPPFLAGS=['/openmp']) env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")]) env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")]) @@ -270,9 +268,6 @@ def configure(env): env.Append(CCFLAGS=['-flto']) env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))]) - if env['tools'] and env['openmp']: - env.Append(CPPFLAGS=['-fopenmp']) - env.Append(LINKFLAGS=['-fopenmp']) ## Compile flags diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 98ae9a8658..cb45fed1be 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -265,9 +265,5 @@ def configure(env): env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu']) - if env['tools'] and env['openmp']: - env.Append(CPPFLAGS=['-fopenmp']) - env.Append(LINKFLAGS=['-fopenmp']) - if env['use_static_cpp']: env.Append(LINKFLAGS=['-static-libstdc++']) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 6616e47317..f3f4b1f217 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1050,6 +1050,10 @@ void OS_X11::set_window_maximized(bool p_enabled) { XSendEvent(x11_display, DefaultRootWindow(x11_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); + while (p_enabled && !is_window_maximized()) { + // Wait for effective resizing (so the GLX context is too). + } + maximized = p_enabled; } diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index 9a77626296..8c282a31b8 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -772,8 +772,8 @@ void BakedLightmap::_bind_methods() { BakedLightmap::BakedLightmap() { extents = Vector3(10, 10, 10); - bake_cell_size = 0.1; - capture_cell_size = 0.25; + bake_cell_size = 0.25; + capture_cell_size = 0.5; bake_quality = BAKE_QUALITY_MEDIUM; bake_mode = BAKE_MODE_CONE_TRACE; diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index bf0f801e32..17aa649dff 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -30,11 +30,9 @@ #include "voxel_light_baker.h" #include "os/os.h" +#include "os/threaded_array_processor.h" #include <stdlib.h> -#ifdef _OPENMP -#include <omp.h> -#endif #define FINDMINMAX(x0, x1, x2, min, max) \ min = max = x0; \ @@ -1689,7 +1687,7 @@ _ALWAYS_INLINE_ uint32_t xorshift32(uint32_t *state) { return x; } -Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const Vector3 &p_normal, uint32_t *rng_state) { +Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const Vector3 &p_normal) { int samples_per_quality[3] = { 48, 128, 512 }; @@ -1711,8 +1709,7 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V const Light *light = bake_light.ptr(); const Cell *cells = bake_cells.ptr(); - // Prevent false sharing when running on OpenMP - uint32_t local_rng_state = *rng_state; + uint32_t local_rng_state = rand(); //needs to be fixed again for (int i = 0; i < samples; i++) { @@ -1796,10 +1793,30 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V } // Make sure we don't reset this thread's RNG state - *rng_state = local_rng_state; + return accum / samples; } +void VoxelLightBaker::_lightmap_bake_point(uint32_t p_x, LightMap *p_line) { + + + LightMap *pixel = &p_line[p_x]; + if (pixel->pos == Vector3()) + return; + //print_line("pos: " + pixel->pos + " normal " + pixel->normal); + switch (bake_mode) { + case BAKE_MODE_CONE_TRACE: { + pixel->light = _compute_pixel_light_at_pos(pixel->pos, pixel->normal) * energy; + } break; + case BAKE_MODE_RAY_TRACE: { + pixel->light = _compute_ray_trace_at_pos(pixel->pos, pixel->normal) * energy; + } break; + // pixel->light = Vector3(1, 1, 1); + //} + } + +} + Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh, LightMapData &r_lightmap, bool (*p_bake_time_func)(void *, float, float), void *p_bake_time_ud) { //transfer light information to a lightmap @@ -1862,53 +1879,10 @@ Error VoxelLightBaker::make_lightmap(const Transform &p_xform, Ref<Mesh> &p_mesh volatile int lines = 0; // make sure our OS-level rng is seeded - srand(OS::get_singleton()->get_ticks_usec()); - - // setup an RNG state for each OpenMP thread - uint32_t threadcount = 1; - uint32_t threadnum = 0; -#ifdef _OPENMP - threadcount = omp_get_max_threads(); -#endif - Vector<uint32_t> rng_states; - rng_states.resize(threadcount); - for (uint32_t i = 0; i < threadcount; i++) { - do { - rng_states[i] = rand(); - } while (rng_states[i] == 0); - } - uint32_t *rng_states_p = rng_states.ptrw(); for (int i = 0; i < height; i++) { - //print_line("bake line " + itos(i) + " / " + itos(height)); -#ifdef _OPENMP -#pragma omp parallel for schedule(dynamic, 1) private(threadnum) -#endif - for (int j = 0; j < width; j++) { - -#ifdef _OPENMP - threadnum = omp_get_thread_num(); -#endif - - //if (i == 125 && j == 280) { - - LightMap *pixel = &lightmap_ptr[i * width + j]; - if (pixel->pos == Vector3()) - continue; //unused, skipe - - //print_line("pos: " + pixel->pos + " normal " + pixel->normal); - switch (bake_mode) { - case BAKE_MODE_CONE_TRACE: { - pixel->light = _compute_pixel_light_at_pos(pixel->pos, pixel->normal) * energy; - } break; - case BAKE_MODE_RAY_TRACE: { - pixel->light = _compute_ray_trace_at_pos(pixel->pos, pixel->normal, &rng_states_p[threadnum]) * energy; - } break; - // pixel->light = Vector3(1, 1, 1); - //} - } - } + thread_process_array(width,this,&VoxelLightBaker::_lightmap_bake_point,&lightmap_ptr[i*width]); lines = MAX(lines, i); //for multithread if (p_bake_time_func) { diff --git a/scene/3d/voxel_light_baker.h b/scene/3d/voxel_light_baker.h index 7db31f8a67..68e11c356b 100644 --- a/scene/3d/voxel_light_baker.h +++ b/scene/3d/voxel_light_baker.h @@ -148,9 +148,12 @@ private: _FORCE_INLINE_ void _sample_baked_octree_filtered_and_anisotropic(const Vector3 &p_posf, const Vector3 &p_direction, float p_level, Vector3 &r_color, float &r_alpha); _FORCE_INLINE_ Vector3 _voxel_cone_trace(const Vector3 &p_pos, const Vector3 &p_normal, float p_aperture); _FORCE_INLINE_ Vector3 _compute_pixel_light_at_pos(const Vector3 &p_pos, const Vector3 &p_normal); - _FORCE_INLINE_ Vector3 _compute_ray_trace_at_pos(const Vector3 &p_pos, const Vector3 &p_normal, uint32_t *rng_state); + _FORCE_INLINE_ Vector3 _compute_ray_trace_at_pos(const Vector3 &p_pos, const Vector3 &p_normal); + + void _lightmap_bake_point(uint32_t p_x, LightMap *p_line); public: + void begin_bake(int p_subdiv, const AABB &p_bounds); void plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material); void begin_bake_light(BakeQuality p_quality = BAKE_QUALITY_MEDIUM, BakeMode p_bake_mode = BAKE_MODE_CONE_TRACE, float p_propagation = 0.85, float p_energy = 1); |