diff options
45 files changed, 189 insertions, 199 deletions
diff --git a/core/image.cpp b/core/image.cpp index 2f2d7efd7c..11429b8782 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -47,7 +47,6 @@ const char *Image::format_names[Image::FORMAT_MAX] = { "RGBA8", "RGBA4444", "RGBA5551", - "RGB10A2", "RFloat", //float "RGFloat", "RGBFloat", @@ -113,7 +112,6 @@ int Image::get_format_pixel_size(Format p_format) { case FORMAT_RGBA8: return 4; case FORMAT_RGBA4444: return 2; case FORMAT_RGBA5551: return 2; - case FORMAT_RGB10A2: return 4; case FORMAT_RF: return 4; //float case FORMAT_RGF: return 8; @@ -1980,15 +1978,6 @@ Color Image::get_pixel(int p_x, int p_y) const { float a = ((u >> 15) & 0x1) / 1.0; return Color(r, g, b, a); } break; - case FORMAT_RGB10A2: { - - uint32_t u = ((uint32_t *)ptr)[ofs]; - float r = (u & 0x3FF) / 1023.0; - float g = ((u >> 10) & 0x3FF) / 1023.0; - float b = ((u >> 20) & 0x3FF) / 1023.0; - float a = ((u >> 30) & 0x3) / 3.0; - return Color(r, g, b, a); - } break; case FORMAT_RF: { float r = ((float *)ptr)[ofs]; @@ -2134,18 +2123,6 @@ void Image::set_pixel(int p_x, int p_y, const Color &p_color) { ((uint16_t *)ptr)[ofs] = rgba; } break; - case FORMAT_RGB10A2: { - - uint32_t rgba = 0; - - rgba = uint32_t(CLAMP(p_color.r * 1023.0, 0, 1023)); - rgba |= uint32_t(CLAMP(p_color.g * 1023.0, 0, 1023)) << 10; - rgba |= uint32_t(CLAMP(p_color.b * 1023.0, 0, 1023)) << 20; - rgba |= uint32_t(CLAMP(p_color.a * 3.0, 0, 3)) << 30; - - ((uint32_t *)ptr)[ofs] = rgba; - - } break; case FORMAT_RF: { ((float *)ptr)[ofs] = p_color.r; @@ -2323,7 +2300,6 @@ void Image::_bind_methods() { BIND_ENUM_CONSTANT(FORMAT_RGBA8); BIND_ENUM_CONSTANT(FORMAT_RGBA4444); BIND_ENUM_CONSTANT(FORMAT_RGBA5551); - BIND_ENUM_CONSTANT(FORMAT_RGB10A2); BIND_ENUM_CONSTANT(FORMAT_RF); //float BIND_ENUM_CONSTANT(FORMAT_RGF); BIND_ENUM_CONSTANT(FORMAT_RGBF); diff --git a/core/image.h b/core/image.h index efb62a6a29..767f3c6ac5 100644 --- a/core/image.h +++ b/core/image.h @@ -68,7 +68,6 @@ public: FORMAT_RGBA8, FORMAT_RGBA4444, FORMAT_RGBA5551, - FORMAT_RGB10A2, FORMAT_RF, //float FORMAT_RGF, FORMAT_RGBF, diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index c906fa7333..eadb8e8546 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -293,7 +293,7 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) { return full; } -Error DirAccess::copy(String p_from, String p_to, int chmod_flags) { +Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) { //printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data()); Error err; @@ -330,9 +330,9 @@ Error DirAccess::copy(String p_from, String p_to, int chmod_flags) { fdst->store_8(fsrc->get_8()); } - if (err == OK && chmod_flags != -1) { + if (err == OK && p_chmod_flags != -1) { fdst->close(); - err = fdst->_chmod(p_to, chmod_flags); + err = fdst->_chmod(p_to, p_chmod_flags); // If running on a platform with no chmod support (i.e., Windows), don't fail if (err == ERR_UNAVAILABLE) err = OK; diff --git a/core/os/dir_access.h b/core/os/dir_access.h index f29f61e838..c94ced657b 100644 --- a/core/os/dir_access.h +++ b/core/os/dir_access.h @@ -92,8 +92,8 @@ public: static bool exists(String p_dir); virtual size_t get_space_left() = 0; - Error copy_dir(String p_from, String p_to, int chmod_flags = -1); - virtual Error copy(String p_from, String p_to, int chmod_flags = -1); + Error copy_dir(String p_from, String p_to, int p_chmod_flags = -1); + virtual Error copy(String p_from, String p_to, int p_chmod_flags = -1); virtual Error rename(String p_from, String p_to) = 0; virtual Error remove(String p_name) = 0; diff --git a/core/ring_buffer.h b/core/ring_buffer.h index 4b4a7fe9cf..c8562a0570 100644 --- a/core/ring_buffer.h +++ b/core/ring_buffer.h @@ -40,7 +40,7 @@ class RingBuffer { int write_pos; int size_mask; - inline int inc(int &p_var, int p_size) { + inline int inc(int &p_var, int p_size) const { int ret = p_var; p_var += p_size; p_var = p_var & size_mask; @@ -50,7 +50,7 @@ class RingBuffer { public: T read() { ERR_FAIL_COND_V(space_left() < 1, T()); - return data[inc(read_pos, 1)]; + return data.ptr()[inc(read_pos, 1)]; }; int read(T *p_buf, int p_size, bool p_advance = true) { @@ -63,8 +63,9 @@ public: int end = pos + to_read; end = MIN(end, size()); int total = end - pos; + const T *read = data.ptr(); for (int i = 0; i < total; i++) { - p_buf[dst++] = data[pos + i]; + p_buf[dst++] = read[pos + i]; }; to_read -= total; pos = 0; @@ -75,7 +76,7 @@ public: return p_size; }; - int copy(T *p_buf, int p_offset, int p_size) { + int copy(T *p_buf, int p_offset, int p_size) const { int left = data_left(); if ((p_offset + p_size) > left) { @@ -101,7 +102,7 @@ public: return p_size; }; - int find(const T &t, int p_offset, int p_max_size) { + int find(const T &t, int p_offset, int p_max_size) const { int left = data_left(); if ((p_offset + p_max_size) > left) { @@ -164,7 +165,7 @@ public: return p_size; }; - inline int space_left() { + inline int space_left() const { int left = read_pos - write_pos; if (left < 0) { return size() + left - 1; @@ -174,11 +175,11 @@ public: }; return left - 1; }; - inline int data_left() { + inline int data_left() const { return size() - space_left() - 1; }; - inline int size() { + inline int size() const { return data.size(); }; diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 230978950b..a01ffc99be 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -446,67 +446,65 @@ </constant> <constant name="FORMAT_RGBA5551" value="7" enum="Format"> </constant> - <constant name="FORMAT_RGB10A2" value="8" enum="Format"> + <constant name="FORMAT_RF" value="8" enum="Format"> </constant> - <constant name="FORMAT_RF" value="9" enum="Format"> + <constant name="FORMAT_RGF" value="9" enum="Format"> </constant> - <constant name="FORMAT_RGF" value="10" enum="Format"> + <constant name="FORMAT_RGBF" value="10" enum="Format"> </constant> - <constant name="FORMAT_RGBF" value="11" enum="Format"> + <constant name="FORMAT_RGBAF" value="11" enum="Format"> </constant> - <constant name="FORMAT_RGBAF" value="12" enum="Format"> + <constant name="FORMAT_RH" value="12" enum="Format"> </constant> - <constant name="FORMAT_RH" value="13" enum="Format"> + <constant name="FORMAT_RGH" value="13" enum="Format"> </constant> - <constant name="FORMAT_RGH" value="14" enum="Format"> + <constant name="FORMAT_RGBH" value="14" enum="Format"> </constant> - <constant name="FORMAT_RGBH" value="15" enum="Format"> + <constant name="FORMAT_RGBAH" value="15" enum="Format"> </constant> - <constant name="FORMAT_RGBAH" value="16" enum="Format"> + <constant name="FORMAT_RGBE9995" value="16" enum="Format"> </constant> - <constant name="FORMAT_RGBE9995" value="17" enum="Format"> + <constant name="FORMAT_DXT1" value="17" enum="Format"> </constant> - <constant name="FORMAT_DXT1" value="18" enum="Format"> + <constant name="FORMAT_DXT3" value="18" enum="Format"> </constant> - <constant name="FORMAT_DXT3" value="19" enum="Format"> + <constant name="FORMAT_DXT5" value="19" enum="Format"> </constant> - <constant name="FORMAT_DXT5" value="20" enum="Format"> + <constant name="FORMAT_RGTC_R" value="20" enum="Format"> </constant> - <constant name="FORMAT_RGTC_R" value="21" enum="Format"> + <constant name="FORMAT_RGTC_RG" value="21" enum="Format"> </constant> - <constant name="FORMAT_RGTC_RG" value="22" enum="Format"> + <constant name="FORMAT_BPTC_RGBA" value="22" enum="Format"> </constant> - <constant name="FORMAT_BPTC_RGBA" value="23" enum="Format"> + <constant name="FORMAT_BPTC_RGBF" value="23" enum="Format"> </constant> - <constant name="FORMAT_BPTC_RGBF" value="24" enum="Format"> + <constant name="FORMAT_BPTC_RGBFU" value="24" enum="Format"> </constant> - <constant name="FORMAT_BPTC_RGBFU" value="25" enum="Format"> + <constant name="FORMAT_PVRTC2" value="25" enum="Format"> </constant> - <constant name="FORMAT_PVRTC2" value="26" enum="Format"> + <constant name="FORMAT_PVRTC2A" value="26" enum="Format"> </constant> - <constant name="FORMAT_PVRTC2A" value="27" enum="Format"> + <constant name="FORMAT_PVRTC4" value="27" enum="Format"> </constant> - <constant name="FORMAT_PVRTC4" value="28" enum="Format"> + <constant name="FORMAT_PVRTC4A" value="28" enum="Format"> </constant> - <constant name="FORMAT_PVRTC4A" value="29" enum="Format"> + <constant name="FORMAT_ETC" value="29" enum="Format"> </constant> - <constant name="FORMAT_ETC" value="30" enum="Format"> + <constant name="FORMAT_ETC2_R11" value="30" enum="Format"> </constant> - <constant name="FORMAT_ETC2_R11" value="31" enum="Format"> + <constant name="FORMAT_ETC2_R11S" value="31" enum="Format"> </constant> - <constant name="FORMAT_ETC2_R11S" value="32" enum="Format"> + <constant name="FORMAT_ETC2_RG11" value="32" enum="Format"> </constant> - <constant name="FORMAT_ETC2_RG11" value="33" enum="Format"> + <constant name="FORMAT_ETC2_RG11S" value="33" enum="Format"> </constant> - <constant name="FORMAT_ETC2_RG11S" value="34" enum="Format"> + <constant name="FORMAT_ETC2_RGB8" value="34" enum="Format"> </constant> - <constant name="FORMAT_ETC2_RGB8" value="35" enum="Format"> + <constant name="FORMAT_ETC2_RGBA8" value="35" enum="Format"> </constant> - <constant name="FORMAT_ETC2_RGBA8" value="36" enum="Format"> + <constant name="FORMAT_ETC2_RGB8A1" value="36" enum="Format"> </constant> - <constant name="FORMAT_ETC2_RGB8A1" value="37" enum="Format"> - </constant> - <constant name="FORMAT_MAX" value="38" enum="Format"> + <constant name="FORMAT_MAX" value="37" enum="Format"> </constant> <constant name="INTERPOLATE_NEAREST" value="0" enum="Interpolation"> </constant> diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index 81978809d7..5b7def99dc 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -157,12 +157,12 @@ <member name="transform" type="Transform2D" setter="set_transform" getter="get_transform"> Local [Transform2D]. </member> - <member name="z" type="int" setter="set_z" getter="get_z"> - Z-index. Controls the order in which the nodes render. A node with a higher Z-index will display in front of others. - </member> <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative"> If [code]true[/code] the node's Z-index is relative to its parent's Z-index. If this node's Z-index is 2 and its parent's effective Z-index is 3, then this node's effective Z-index will be 2 + 3 = 5. </member> + <member name="z_index" type="int" setter="set_z_index" getter="get_z_index"> + Z-index. Controls the order in which the nodes render. A node with a higher Z-index will display in front of others. + </member> </members> <constants> </constants> diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml index 0cba132de8..28fb83d572 100644 --- a/doc/classes/VisualServer.xml +++ b/doc/classes/VisualServer.xml @@ -504,26 +504,26 @@ Sets if the canvas item (including its children) is visible. </description> </method> - <method name="canvas_item_set_z"> + <method name="canvas_item_set_z_as_relative_to_parent"> <return type="void"> </return> <argument index="0" name="item" type="RID"> </argument> - <argument index="1" name="z" type="int"> + <argument index="1" name="enabled" type="bool"> </argument> <description> - Sets the [CanvasItem]'s z order position. + If this is enabled, the z-index of the parent will be added to the children's z-index. </description> </method> - <method name="canvas_item_set_z_as_relative_to_parent"> + <method name="canvas_item_set_z_index"> <return type="void"> </return> <argument index="0" name="item" type="RID"> </argument> - <argument index="1" name="enabled" type="bool"> + <argument index="1" name="z_index" type="int"> </argument> <description> - If this is enabled, the z-position of the parent will be added to the childrens z-position. + Sets the [CanvasItem]'s z-index, i.e. its draw order (lower indexes are drawn first). </description> </method> <method name="canvas_light_attach_to_canvas"> diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 365840b2d8..d35d624589 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -193,13 +193,6 @@ Ref<Image> RasterizerStorageGLES3::_get_gl_image_and_format(const Ref<Image> &p_ r_gl_type = GL_UNSIGNED_SHORT_5_5_5_1; } break; - case Image::FORMAT_RGB10A2: { - - r_gl_internal_format = GL_RGB10_A2; - r_gl_format = GL_RGBA; - r_gl_type = GL_UNSIGNED_INT_2_10_10_10_REV; - - } break; case Image::FORMAT_RF: { r_gl_internal_format = GL_R32F; @@ -6097,7 +6090,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) { color_internal_format = GL_RGB10_A2; color_format = GL_RGBA; color_type = GL_UNSIGNED_INT_2_10_10_10_REV; - image_format = Image::FORMAT_RGB10A2; + image_format = Image::FORMAT_RGBA8; } else { color_internal_format = GL_RGBA8; @@ -6950,6 +6943,10 @@ bool RasterizerStorageGLES3::free(RID p_rid) { glDeleteTextures(1, &cls->distance); canvas_light_shadow_owner.free(p_rid); memdelete(cls); + } else if (particles_owner.owns(p_rid)) { + Particles *particles = particles_owner.get(p_rid); + particles_owner.free(p_rid); + memdelete(particles); } else { return false; } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 4ef4926a1a..74bd0a3cc1 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -1180,7 +1180,7 @@ public: clear = true; inactive = true; - inactive_time = false; + inactive_time = 0.0; glGenBuffers(2, particle_buffers); glGenVertexArrays(2, particle_vaos); diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index cc4d060c02..fa8094f31a 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -298,7 +298,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo args.push_back(0); #ifdef __FreeBSD__ - if (p_path.find("/")) { + if (p_path.find("/") != -1) { // exec name contains path so use it execv(p_path.utf8().get_data(), &args[0]); } else { diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index a601c8cd2b..96c3a27ea7 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -37,7 +37,7 @@ #include "print_string.h" #include "scene/gui/box_container.h" -void CreateDialog::popup_create(bool p_dontclear) { +void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) { recent->clear(); @@ -89,11 +89,12 @@ void CreateDialog::popup_create(bool p_dontclear) { popup_centered_ratio(); } - if (p_dontclear) + if (p_dont_clear) { search_box->select_all(); - else { + } else { search_box->clear(); } + search_box->grab_focus(); _update_search(); @@ -104,8 +105,19 @@ void CreateDialog::popup_create(bool p_dontclear) { if (enable_rl) { search_options->add_constant_override("draw_relationship_lines", 1); search_options->add_color_override("relationship_line_color", rl_color); - } else + } else { search_options->add_constant_override("draw_relationship_lines", 0); + } + + is_replace_mode = p_replace_mode; + + if (p_replace_mode) { + set_title(vformat(TTR("Change %s Type"), base_type)); + get_ok()->set_text(TTR("Change")); + } else { + set_title(vformat(TTR("Create New %s"), base_type)); + get_ok()->set_text(TTR("Create")); + } } void CreateDialog::_text_changed(const String &p_newtext) { @@ -369,7 +381,11 @@ void CreateDialog::_notification(int p_what) { void CreateDialog::set_base_type(const String &p_base) { base_type = p_base; - set_title(vformat(TTR("Create New %s"), p_base)); + if (is_replace_mode) + set_title(vformat(TTR("Change %s Type"), p_base)); + else + set_title(vformat(TTR("Create New %s"), p_base)); + _update_search(); } @@ -624,6 +640,8 @@ void CreateDialog::_bind_methods() { CreateDialog::CreateDialog() { + is_replace_mode = false; + ClassDB::get_class_list(&type_list); type_list.sort_custom<StringName::AlphCompare>(); @@ -678,7 +696,6 @@ CreateDialog::CreateDialog() { search_box->connect("gui_input", this, "_sbox_input"); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); - get_ok()->set_text(TTR("Create")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); diff --git a/editor/create_dialog.h b/editor/create_dialog.h index 56ba7f8a3e..ed23fb4ae8 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -52,6 +52,7 @@ class CreateDialog : public ConfirmationDialog { Button *favorite; LineEdit *search_box; Tree *search_options; + bool is_replace_mode; String base_type; String preferred_search_result_type; EditorHelpBit *help_bit; @@ -97,7 +98,7 @@ public: void set_preferred_search_result_type(const String &p_preferred_type); String get_preferred_search_result_type(); - void popup_create(bool p_dontclear); + void popup_create(bool p_dont_clear, bool p_replace_mode = false); CreateDialog(); }; diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 1d6d933924..7fa4776141 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -131,7 +131,8 @@ EditorAbout::EditorAbout() { Label *about_text = memnew(Label); about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER); - about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2017 ") + + about_text->set_text(VERSION_FULL_NAME + hash + + String::utf8("\n\xc2\xa9 2007-2018 Juan Linietsky, Ariel Manzur.\n\xc2\xa9 2014-2018 ") + TTR("Godot Engine contributors") + "\n"); hbc->add_child(about_text); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b308d28dba..b52161813d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4423,7 +4423,7 @@ void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) { for (int i = 0; i < p_files.size(); i++) { String from = p_files[i]; - if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) < 0)) { + if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) != -1)) { continue; } String to = to_path.plus_file(from.get_file()); diff --git a/editor/plugins/baked_lightmap_editor_plugin.cpp b/editor/plugins/baked_lightmap_editor_plugin.cpp index 08f4d06ef7..6849563ae2 100644 --- a/editor/plugins/baked_lightmap_editor_plugin.cpp +++ b/editor/plugins/baked_lightmap_editor_plugin.cpp @@ -20,7 +20,6 @@ void BakedLightmapEditorPlugin::_bake() { case BakedLightmap::BAKE_ERROR_CANT_CREATE_IMAGE: EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images, make sure path is writable.")); break; - defaut : {} } } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 052817f40a..a52c914096 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -641,7 +641,7 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no _SelectResult res; res.item = c; - res.z = node ? node->get_z() : 0; + res.z_index = node ? node->get_z_index() : 0; res.has_z = node; r_items.push_back(res); } diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index f14f1a92a6..0866fe77aa 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -252,10 +252,10 @@ class CanvasItemEditor : public VBoxContainer { struct _SelectResult { CanvasItem *item; - float z; + float z_index; bool has_z; _FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const { - return has_z && p_rr.has_z ? p_rr.z < z : p_rr.has_z; + return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z; } }; diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index c865ddd4b0..3be68f21af 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -347,7 +347,8 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->set_item_checked(_context_menu->get_item_index(CONTEXT_LINEAR), is_linear); } else { - _context_menu->add_separator(); + if (_selected_point > 0 || _selected_point + 1 < _curve_ref->get_point_count()) + _context_menu->add_separator(); if (_selected_point > 0) { _context_menu->add_check_item(TTR("Left linear"), CONTEXT_LEFT_LINEAR); @@ -367,6 +368,7 @@ void CurveEditor::open_context_menu(Vector2 pos) { _context_menu->add_submenu_item(TTR("Load preset"), _presets_menu->get_name()); + _context_menu->set_size(Size2(0, 0)); _context_menu->popup(); } @@ -566,7 +568,6 @@ static void plot_curve_accurate(const Curve &curve, float step, T plot_func) { Vector2 prev_pos = a; float len = b.x - a.x; - //float step = 4.f / view_size.x; for (float x = step; x < len; x += step) { pos.x = a.x + x; @@ -694,24 +695,6 @@ void CurveEditor::_draw() { CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color); plot_curve_accurate(curve, 4.f / view_size.x, plot_func); - /*// TEST draw baked curve - { - Vector2 pos = Vector2(0, curve.interpolate_baked(0)); - Vector2 prev_pos = pos; - - float len = 1.0; - float step = 4.f / view_size.x; - - for(float x = step; x < len; x += step) { - pos.x = x; - pos.y = curve.interpolate_baked(x); - draw_line(get_point_view_pos(prev_pos), get_point_view_pos(pos), Color(0,1,0)); - prev_pos = pos; - } - - draw_line(get_point_view_pos(prev_pos), get_point_view_pos(Vector2(1, curve.interpolate_baked(1))), Color(0,1,0)); - }//*/ - // Draw points draw_set_transform_matrix(Transform2D()); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index eccb11ba12..632684abc3 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -238,11 +238,8 @@ void TileSetEditor::_bind_methods() { TileSetEditor::TileSetEditor(EditorNode *p_editor) { - Panel *panel = memnew(Panel); - panel->set_anchors_and_margins_preset(Control::PRESET_WIDE); - add_child(panel); MenuButton *options = memnew(MenuButton); - panel->add_child(options); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options); options->set_position(Point2(1, 1)); options->set_text(TTR("Tile Set")); options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); @@ -345,7 +342,7 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { helper = memnew(AutotileEditorHelper(this)); property_editor->edit(helper); - // Editor + //Editor dragging_point = -1; creating_shape = false; @@ -420,8 +417,6 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { p.push_back((int)SHAPE_DELETE); tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", p); tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_DELETE]); - //tools[SHAPE_CREATE_FROM_NOT_BITMASKED] = memnew(ToolButton); - //tool_containers[TOOLBAR_SHAPE]->add_child(tools[SHAPE_CREATE_FROM_NOT_BITMASKED]); tool_containers[TOOLBAR_SHAPE]->add_change_receptor(memnew(VSeparator)); tools[SHAPE_KEEP_INSIDE_TILE] = memnew(ToolButton); tools[SHAPE_KEEP_INSIDE_TILE]->set_toggle_mode(true); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 7e8a6fcb6d..e7da78a35c 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -307,7 +307,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } break; case TOOL_REPLACE: { - create_dialog->popup_create(false); + create_dialog->popup_create(false, true); } break; case TOOL_ATTACH_SCRIPT: { @@ -417,7 +417,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (editor_selection->is_selected(edited_scene)) { current_option = -1; - //accept->get_cancel()->hide(); accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("This operation can't be done on the tree root.")); accept->popup_centered_minsize(); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index ad6ea2180f..96863a59d2 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -232,7 +232,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String path = file_path->get_text(); String extension = ""; if (path != "") { - if (path.find(".") >= 0) { + if (path.find(".") != -1) { extension = path.get_extension(); } @@ -359,16 +359,14 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { return; } - if (p.find("/") || p.find("\\")) { - DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); - if (d->change_dir(p.get_base_dir()) != OK) { - _msg_path_valid(false, TTR("Invalid base path")); - memdelete(d); - _update_dialog(); - return; - } + DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); + if (d->change_dir(p.get_base_dir()) != OK) { + _msg_path_valid(false, TTR("Invalid base path")); memdelete(d); + _update_dialog(); + return; } + memdelete(d); /* Does file already exist */ diff --git a/misc/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist index 2a4914ec75..895eda14db 100755 --- a/misc/dist/osx_tools.app/Contents/Info.plist +++ b/misc/dist/osx_tools.app/Contents/Info.plist @@ -9,7 +9,7 @@ <key>CFBundleName</key> <string>Godot</string> <key>CFBundleGetInfoString</key> - <string>(c) 2007-2018 Juan Linietsky, Ariel Manzur./string> + <string>(c) 2007-2018 Juan Linietsky, Ariel Manzur.</string> <key>CFBundleIconFile</key> <string>Godot.icns</string> <key>CFBundleIdentifier</key> @@ -25,7 +25,7 @@ <key>CFBundleVersion</key> <string>3.0-dev</string> <key>NSHumanReadableCopyright</key> - <string>© 2007-2018 Juan Linietsky, Ariel Manzur./string> + <string>© 2007-2018 Juan Linietsky, Ariel Manzur.</string> <key>LSMinimumSystemVersion</key> <string>10.9.0</string> <key>LSMinimumSystemVersionByArchitecture</key> diff --git a/platform/android/SCsub b/platform/android/SCsub index 0cd91276ef..d2285a82dd 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -104,7 +104,7 @@ gradle_asset_dirs_text = "" gradle_default_config_text = "" minSdk = 18 -targetSdk = 23 +targetSdk = 27 for x in env.android_default_config: if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk: diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 4a44d1c5f9..13b4d3b6c7 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -31,8 +31,8 @@ android { disable 'MissingTranslation' } - compileSdkVersion 26 - buildToolsVersion "26.0.1" + compileSdkVersion 27 + buildToolsVersion "27.0.3" useLibrary 'org.apache.http.legacy' packagingOptions { diff --git a/platform/android/java/gradle/wrapper/gradle-wrapper.properties b/platform/android/java/gradle/wrapper/gradle-wrapper.properties index ee6901c9d7..fe37fa74a9 100644 --- a/platform/android/java/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/java/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index e46bf3c77d..8c6b25f296 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -131,7 +131,7 @@ void CollisionPolygon2D::_notification(int p_what) { /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); - set_z(VS::CANVAS_ITEM_Z_MAX - 1); + set_z_index(VS::CANVAS_ITEM_Z_MAX - 1); }*/ } break; diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 135ede829d..1956e23421 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -64,7 +64,7 @@ void CollisionShape2D::_notification(int p_what) { /*if (Engine::get_singleton()->is_editor_hint()) { //display above all else set_z_as_relative(false); - set_z(VS::CANVAS_ITEM_Z_MAX - 1); + set_z_index(VS::CANVAS_ITEM_Z_MAX - 1); }*/ } break; diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 2a305512af..e133f86ef7 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -329,13 +329,13 @@ void Node2D::set_global_transform(const Transform2D &p_transform) { set_transform(p_transform); } -void Node2D::set_z(int p_z) { +void Node2D::set_z_index(int p_z) { ERR_FAIL_COND(p_z < VS::CANVAS_ITEM_Z_MIN); ERR_FAIL_COND(p_z > VS::CANVAS_ITEM_Z_MAX); - z = p_z; - VS::get_singleton()->canvas_item_set_z(get_canvas_item(), z); - _change_notify("z"); + z_index = p_z; + VS::get_singleton()->canvas_item_set_z_index(get_canvas_item(), z_index); + _change_notify("z_index"); } void Node2D::set_z_as_relative(bool p_enabled) { @@ -351,9 +351,9 @@ bool Node2D::is_z_relative() const { return z_relative; } -int Node2D::get_z() const { +int Node2D::get_z_index() const { - return z; + return z_index; } Transform2D Node2D::get_relative_transform_to_parent(const Node *p_parent) const { @@ -427,8 +427,8 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("to_local", "global_point"), &Node2D::to_local); ClassDB::bind_method(D_METHOD("to_global", "local_point"), &Node2D::to_global); - ClassDB::bind_method(D_METHOD("set_z", "z"), &Node2D::set_z); - ClassDB::bind_method(D_METHOD("get_z"), &Node2D::get_z); + ClassDB::bind_method(D_METHOD("set_z_index", "z_index"), &Node2D::set_z_index); + ClassDB::bind_method(D_METHOD("get_z_index"), &Node2D::get_z_index); ClassDB::bind_method(D_METHOD("set_z_as_relative", "enable"), &Node2D::set_z_as_relative); ClassDB::bind_method(D_METHOD("is_z_relative"), &Node2D::is_z_relative); @@ -448,8 +448,8 @@ void Node2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "global_scale", PROPERTY_HINT_NONE, "", 0), "set_global_scale", "get_global_scale"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform"); - ADD_GROUP("Z", ""); - ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "z", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z", "get_z"); + ADD_GROUP("Z Index", ""); + ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "z_index", PROPERTY_HINT_RANGE, itos(VS::CANVAS_ITEM_Z_MIN) + "," + itos(VS::CANVAS_ITEM_Z_MAX) + ",1"), "set_z_index", "get_z_index"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "z_as_relative"), "set_z_as_relative", "is_z_relative"); } @@ -458,6 +458,6 @@ Node2D::Node2D() { angle = 0; _scale = Vector2(1, 1); _xform_dirty = false; - z = 0; + z_index = 0; z_relative = true; } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 7d2e5aa00c..321021a748 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -39,7 +39,7 @@ class Node2D : public CanvasItem { Point2 pos; float angle; Size2 _scale; - int z; + int z_index; bool z_relative; Transform2D _mat; @@ -96,8 +96,8 @@ public: void set_global_rotation_degrees(float p_degrees); void set_global_scale(const Size2 &p_scale); - void set_z(int p_z); - int get_z() const; + void set_z_index(int p_z); + int get_z_index() const; void look_at(const Vector2 &p_pos); float get_angle_to(const Vector2 &p_pos) const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 73fce4be75..8bd5676bc7 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -336,7 +336,7 @@ void TileMap::_update_dirty_quadrants() { debug_canvas_item = vs->canvas_item_create(); vs->canvas_item_set_parent(debug_canvas_item, canvas_item); vs->canvas_item_set_z_as_relative_to_parent(debug_canvas_item, false); - vs->canvas_item_set_z(debug_canvas_item, VS::CANVAS_ITEM_Z_MAX - 1); + vs->canvas_item_set_z_index(debug_canvas_item, VS::CANVAS_ITEM_Z_MAX - 1); q.canvas_items.push_back(debug_canvas_item); prev_debug_canvas_item = debug_canvas_item; } diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index ef60a2151d..aaa378bb68 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -160,14 +160,14 @@ void Skeleton::_notification(int p_what) { //if moved, just update transforms VisualServer *vs = VisualServer::get_singleton(); - Bone *bonesptr = &bones[0]; + const Bone *bonesptr = bones.ptr(); int len = bones.size(); Transform global_transform = get_global_transform(); Transform global_transform_inverse = global_transform.affine_inverse(); for (int i = 0; i < len; i++) { - Bone &b = bonesptr[i]; + const Bone &b = bonesptr[i]; vs->skeleton_bone_set_transform(skeleton, i, global_transform * (b.transform_final * global_transform_inverse)); } } break; diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 95298f5a18..63478886c6 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -209,6 +209,7 @@ Color ColorPicker::get_pick_color() const { } void ColorPicker::add_preset(const Color &p_color) { + if (presets.find(p_color)) { presets.move_to_back(presets.find(p_color)); } else { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 86138f8332..bf048ea1b6 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -452,6 +452,8 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & table->columns[i].width = 0; } //compute minimum width for each cell + const int available_width = p_width - hseparation * (table->columns.size() - 1) - wofs; + for (List<Item *>::Element *E = table->subitems.front(); E; E = E->next()) { ERR_CONTINUE(E->get()->type != ITEM_FRAME); //children should all be frames ItemFrame *frame = static_cast<ItemFrame *>(E->get()); @@ -462,7 +464,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & for (int i = 0; i < frame->lines.size(); i++) { - _process_line(frame, Point2(), ly, p_width, i, PROCESS_CACHE, cfont, Color()); + _process_line(frame, Point2(), ly, available_width, i, PROCESS_CACHE, cfont, Color()); table->columns[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].minimum_width); } idx++; @@ -471,11 +473,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & //compute available width and total ratio (for expanders) int total_ratio = 0; - int available_width = p_width - hseparation * (table->columns.size() - 1); + int remaining_width = available_width; table->total_width = hseparation; for (int i = 0; i < table->columns.size(); i++) { - available_width -= table->columns[i].min_width; + remaining_width -= table->columns[i].min_width; if (table->columns[i].expand) total_ratio += table->columns[i].expand_ratio; } @@ -485,7 +487,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & for (int i = 0; i < table->columns.size(); i++) { table->columns[i].width = table->columns[i].min_width; if (table->columns[i].expand) - table->columns[i].width += table->columns[i].expand_ratio * available_width / total_ratio; + table->columns[i].width += table->columns[i].expand_ratio * remaining_width / total_ratio; table->total_width += table->columns[i].width + hseparation; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5fbc0c9064..87043c65eb 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1498,7 +1498,7 @@ void TextEdit::_notification(int p_what) { if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->show_virtual_keyboard(get_text(), get_global_rect()); if (raised_from_completion) { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1); } } break; @@ -1512,7 +1512,7 @@ void TextEdit::_notification(int p_what) { if (OS::get_singleton()->has_virtual_keyboard()) OS::get_singleton()->hide_virtual_keyboard(); if (raised_from_completion) { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0); } } break; } @@ -1822,10 +1822,18 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->is_pressed()) { if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { - _scroll_up(3 * mb->get_factor()); + if (mb->get_shift()) { + h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); + } else { + _scroll_up(3 * mb->get_factor()); + } } if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { - _scroll_down(3 * mb->get_factor()); + if (mb->get_shift()) { + h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); + } else { + _scroll_down(3 * mb->get_factor()); + } } if (mb->get_button_index() == BUTTON_WHEEL_LEFT) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); @@ -5054,7 +5062,7 @@ void TextEdit::_confirm_completion() { void TextEdit::_cancel_code_hint() { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0); raised_from_completion = false; completion_hint = ""; update(); @@ -5062,7 +5070,7 @@ void TextEdit::_cancel_code_hint() { void TextEdit::_cancel_completion() { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 0); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 0); raised_from_completion = false; if (!completion_active) return; @@ -5237,7 +5245,7 @@ void TextEdit::query_code_comple() { void TextEdit::set_code_hint(const String &p_hint) { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1); raised_from_completion = true; completion_hint = p_hint; completion_hint_offset = -0xFFFF; @@ -5246,7 +5254,7 @@ void TextEdit::set_code_hint(const String &p_hint) { void TextEdit::code_complete(const Vector<String> &p_strings, bool p_forced) { - VisualServer::get_singleton()->canvas_item_set_z(get_canvas_item(), 1); + VisualServer::get_singleton()->canvas_item_set_z_index(get_canvas_item(), 1); raised_from_completion = true; completion_strings = p_strings; completion_active = true; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 08f1bdff3d..b1a421c24f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1423,17 +1423,33 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 #endif Point2i parent_pos = Point2i(parent_ofs - cache.arrow->get_width() / 2, p_pos.y + label_h / 2 + cache.arrow->get_height() / 2) - cache.offset + p_draw_ofs; - VisualServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x - Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width); - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), parent_pos, cache.relationship_line_color, line_width); + + if (root_pos.y + line_width >= 0) { + VisualServer::get_singleton()->canvas_item_add_line(ci, root_pos, Point2i(parent_pos.x - Math::floor(line_width / 2), root_pos.y), cache.relationship_line_color, line_width); + VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(parent_pos.x, root_pos.y), parent_pos, cache.relationship_line_color, line_width); + } + + if (htotal < 0) { + return -1; + } } - int child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c); + if (htotal >= 0) { + int child_h = draw_item(children_pos, p_draw_ofs, p_draw_size, c); - if (child_h < 0 && cache.draw_relationship_lines == 0) - return -1; // break, stop drawing, no need to anymore + if (child_h < 0) { + if (cache.draw_relationship_lines == 0) { + return -1; // break, stop drawing, no need to anymore + } else { + htotal = -1; + children_pos.y = cache.offset.y + p_draw_size.height; + } + } else { + htotal += child_h; + children_pos.y += child_h; + } + } - htotal += child_h; - children_pos.y += child_h; c = c->next; } } @@ -2352,8 +2368,6 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { last_keypress = 0; } } break; - - last_keypress = 0; } } diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 6216893667..b2c91f90eb 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1218,7 +1218,7 @@ Environment::Environment() { ssao_radius2 = 0; ssao_intensity2 = 1; ssao_bias = 0.01; - ssao_direct_light_affect = false; + ssao_direct_light_affect = 0.0; ssao_blur = SSAO_BLUR_3x3; set_ssao_edge_sharpness(4); set_ssao_quality(SSAO_QUALITY_LOW); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 0317fe45ae..f2198bdf2f 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -122,7 +122,6 @@ int AudioDriverManager::get_driver_count() { } void AudioDriverManager::initialize(int p_driver) { - AudioDriver *driver; int failed_driver = -1; // Check if there is a selected driver diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index 60530e48e2..b163402a07 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -102,9 +102,9 @@ void VisualServerCanvas::_render_canvas_item(Item *p_canvas_item, const Transfor } if (ci->z_relative) - p_z = CLAMP(p_z + ci->z, VS::CANVAS_ITEM_Z_MIN, VS::CANVAS_ITEM_Z_MAX); + p_z = CLAMP(p_z + ci->z_index, VS::CANVAS_ITEM_Z_MIN, VS::CANVAS_ITEM_Z_MAX); else - p_z = ci->z; + p_z = ci->z_index; for (int i = 0; i < child_item_count; i++) { @@ -805,14 +805,14 @@ void VisualServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_e canvas_item->sort_y = p_enable; } -void VisualServerCanvas::canvas_item_set_z(RID p_item, int p_z) { +void VisualServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) { ERR_FAIL_COND(p_z < VS::CANVAS_ITEM_Z_MIN || p_z > VS::CANVAS_ITEM_Z_MAX); Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); - canvas_item->z = p_z; + canvas_item->z_index = p_z; } void VisualServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) { diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index b86dd0316c..320fc2fb0b 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -39,7 +39,7 @@ public: RID parent; // canvas it belongs to List<Item *>::Element *E; - int z; + int z_index; bool z_relative; bool sort_y; Color modulate; @@ -53,7 +53,7 @@ public: Item() { children_order_dirty = true; E = NULL; - z = 0; + z_index = 0; modulate = Color(1, 1, 1, 1); self_modulate = Color(1, 1, 1, 1); sort_y = false; @@ -187,7 +187,7 @@ public: void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform); void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable); - void canvas_item_set_z(RID p_item, int p_z); + void canvas_item_set_z_index(RID p_item, int p_z); void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 95d7269d7a..864ae81140 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -586,7 +586,7 @@ public: BIND2(canvas_item_add_set_transform, RID, const Transform2D &) BIND2(canvas_item_add_clip_ignore, RID, bool) BIND2(canvas_item_set_sort_children_by_y, RID, bool) - BIND2(canvas_item_set_z, RID, int) + BIND2(canvas_item_set_z_index, RID, int) BIND2(canvas_item_set_z_as_relative_to_parent, RID, bool) BIND3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &) diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp index a8422b805e..67b83b7618 100644 --- a/servers/visual/visual_server_wrap_mt.cpp +++ b/servers/visual/visual_server_wrap_mt.cpp @@ -6,6 +6,7 @@ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 4062f91438..276e445f4d 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -6,6 +6,7 @@ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -503,7 +504,7 @@ public: FUNC2(canvas_item_add_set_transform, RID, const Transform2D &) FUNC2(canvas_item_add_clip_ignore, RID, bool) FUNC2(canvas_item_set_sort_children_by_y, RID, bool) - FUNC2(canvas_item_set_z, RID, int) + FUNC2(canvas_item_set_z_index, RID, int) FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool) FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index b4949b6093..bf6d425fb9 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -1611,7 +1611,7 @@ void VisualServer::_bind_methods() { ClassDB::bind_method(D_METHOD("canvas_item_add_set_transform", "item", "transform"), &VisualServer::canvas_item_add_set_transform); ClassDB::bind_method(D_METHOD("canvas_item_add_clip_ignore", "item", "ignore"), &VisualServer::canvas_item_add_clip_ignore); ClassDB::bind_method(D_METHOD("canvas_item_set_sort_children_by_y", "item", "enabled"), &VisualServer::canvas_item_set_sort_children_by_y); - ClassDB::bind_method(D_METHOD("canvas_item_set_z", "item", "z"), &VisualServer::canvas_item_set_z); + ClassDB::bind_method(D_METHOD("canvas_item_set_z_index", "item", "z_index"), &VisualServer::canvas_item_set_z_index); ClassDB::bind_method(D_METHOD("canvas_item_set_z_as_relative_to_parent", "item", "enabled"), &VisualServer::canvas_item_set_z_as_relative_to_parent); ClassDB::bind_method(D_METHOD("canvas_item_set_copy_to_backbuffer", "item", "enabled", "rect"), &VisualServer::canvas_item_set_copy_to_backbuffer); ClassDB::bind_method(D_METHOD("canvas_item_clear", "item"), &VisualServer::canvas_item_clear); diff --git a/servers/visual_server.h b/servers/visual_server.h index e1def0b713..eb2c56cd3a 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -847,7 +847,7 @@ public: virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0; virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0; virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0; - virtual void canvas_item_set_z(RID p_item, int p_z) = 0; + virtual void canvas_item_set_z_index(RID p_item, int p_z) = 0; virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) = 0; virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) = 0; |