diff options
-rw-r--r-- | .appveyor.yml | 7 | ||||
-rw-r--r-- | core/io/stream_peer_ssl.cpp | 4 | ||||
-rw-r--r-- | doc/classes/TileMap.xml | 9 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 14 | ||||
-rw-r--r-- | editor/connections_dialog.cpp | 66 | ||||
-rw-r--r-- | editor/connections_dialog.h | 11 | ||||
-rw-r--r-- | editor/editor_node.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 89 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 5 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 65 | ||||
-rw-r--r-- | modules/gdnative/gdnative.cpp | 18 | ||||
-rw-r--r-- | modules/gdnative/gdnative.h | 2 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 12 | ||||
-rw-r--r-- | platform/android/java/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | platform/x11/context_gl_x11.cpp | 2 | ||||
-rw-r--r-- | scene/2d/particles_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 147 | ||||
-rw-r--r-- | scene/2d/tile_map.h | 8 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 1 | ||||
-rw-r--r-- | scene/3d/particles.cpp | 1 | ||||
-rw-r--r-- | scene/3d/soft_body.cpp | 1 | ||||
-rw-r--r-- | scene/animation/skeleton_ik.cpp | 3 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 5 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 2 |
24 files changed, 407 insertions, 80 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index bd4a7b0ca8..b04e7d9ce8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,6 +12,9 @@ environment: TARGET: release_debug ARCH: amd64 +init: + - ps: if ($env:APPVEYOR_REPO_BRANCH -ne "master") { $env:APPVEYOR_CACHE_SKIP_SAVE = "true" } + cache: - "%SCONS_CACHE_ROOT%" @@ -26,7 +29,7 @@ before_build: - python --version - scons --version - cl.exe - - SET "SCONS_CACHE=%SCONS_CACHE_ROOT%\master" + - set "SCONS_CACHE=%SCONS_CACHE_ROOT%\%APPVEYOR_REPO_BRANCH%" build_script: -- scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% debug_symbols=no verbose=yes progress=no gdnative_wrapper=yes + - scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% debug_symbols=no verbose=yes progress=no gdnative_wrapper=yes diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index 254ae84bf5..ccce48ccd7 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -39,7 +39,9 @@ StreamPeerSSL *(*StreamPeerSSL::_create)() = NULL; StreamPeerSSL *StreamPeerSSL::create() { - return _create(); + if (_create) + return _create(); + return NULL; } StreamPeerSSL::LoadCertsFromMemory StreamPeerSSL::load_certs_func = NULL; diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 55666b94b5..a0111d3262 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -274,6 +274,15 @@ <member name="cell_y_sort" type="bool" setter="set_y_sort_mode" getter="is_y_sort_mode_enabled" default="false"> If [code]true[/code], the TileMap's children will be drawn in order of their Y coordinate. </member> + <member name="compatibility_mode" type="bool" setter="set_compatibility_mode" getter="is_compatibility_mode_enabled"> + If [code]true[/code], the compatibility with the tilemaps made in Godot 3.1 or earlier is maintained (textures move when the tile origin changes and rotate if the texture size is not homogeneous). This mode presents problems when doing [code]flip_h[/code], [code]flip_v[/code] and [code]transpose[/code] tile operations on non-homogeneous isometric tiles (e.g. 2:1), in which the texture could not coincide with the collision, thus it is not recommended for isometric or non-square tiles. + If [code]false[/code], the textures do not move when doing [code]flip_h[/code], [code]flip_v[/code] operations if no offset is used, nor when changing the tile origin. + The compatibility mode doesn't work with the [member centered_textures] option, because displacing textures with the [member cell_tile_origin] option or in irregular tiles is not relevant when centering those textures. + </member> + <member name="centered_textures" type="bool" setter="set_centered_textures" getter="is_centered_textures_enabled"> + If [code]true[/code], the textures will be centered in the middle of each tile. This is useful for certain isometric or top-down modes when textures are made larger or smaller than the tiles (e.g. to avoid flickering on tile edges). The offset is still applied, but from the center of the tile. If used, [member compatibility_mode] is ignored. + If [code]false[/code], the texture position start in the top-left corner unless [member compatibility_mode] is enabled. + </member> <member name="collision_bounce" type="float" setter="set_collision_bounce" getter="get_collision_bounce" default="0.0"> Bounce value for static body collisions (see [code]collision_use_kinematic[/code]). </member> diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 91c0693538..c2fde148e2 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4990,6 +4990,20 @@ bool RasterizerSceneGLES3::free(RID p_rid) { reflection_probe_instance_owner.free(p_rid); memdelete(reflection_instance); + } else if (environment_owner.owns(p_rid)) { + + Environment *environment = environment_owner.get(p_rid); + + environment_owner.free(p_rid); + memdelete(environment); + + } else if (gi_probe_instance_owner.owns(p_rid)) { + + GIProbeInstance *gi_probe_instance = gi_probe_instance_owner.get(p_rid); + + gi_probe_instance_owner.free(p_rid); + memdelete(gi_probe_instance); + } else { return false; } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index d04392dabf..48bc409b73 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -459,6 +459,21 @@ ConnectDialog::~ConnectDialog() { ////////////////////////////////////////// +// Originally copied and adapted from EditorProperty, try to keep style in sync. +Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const { + + EditorHelpBit *help_bit = memnew(EditorHelpBit); + help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE); + + String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]"; + text += p_text.get_slice("::", 1).strip_edges() + "\n"; + text += p_text.get_slice("::", 2).strip_edges(); + help_bit->set_text(text); + help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene + return help_bit; +} + struct _ConnectionsDockMethodInfoSort { _FORCE_INLINE_ bool operator()(const MethodInfo &a, const MethodInfo &b) const { @@ -892,8 +907,8 @@ void ConnectionsDock::update_tree() { MethodInfo &mi = E->get(); - String signaldesc; - signaldesc = mi.name + "("; + StringName signal_name = mi.name; + String signaldesc = "("; PoolStringArray argnames; if (mi.arguments.size()) { signaldesc += " "; @@ -914,19 +929,56 @@ void ConnectionsDock::update_tree() { } signaldesc += " "; } - signaldesc += ")"; TreeItem *item = tree->create_item(pitem); - item->set_text(0, signaldesc); + item->set_text(0, String(signal_name) + signaldesc); Dictionary sinfo; - sinfo["name"] = mi.name; + sinfo["name"] = signal_name; sinfo["args"] = argnames; item->set_metadata(0, sinfo); item->set_icon(0, get_icon("Signal", "EditorIcons")); + // Set tooltip with the signal's documentation + { + String descr; + bool found = false; + + Map<StringName, Map<StringName, String> >::Element *G = descr_cache.find(base); + if (G) { + Map<StringName, String>::Element *F = G->get().find(signal_name); + if (F) { + found = true; + descr = F->get(); + } + } + + if (!found) { + DocData *dd = EditorHelp::get_doc_data(); + Map<String, DocData::ClassDoc>::Element *F = dd->class_list.find(base); + while (F && descr == String()) { + for (int i = 0; i < F->get().signals.size(); i++) { + if (F->get().signals[i].name == signal_name.operator String()) { + descr = F->get().signals[i].description.strip_edges(); + break; + } + } + if (!F->get().inherits.empty()) { + F = dd->class_list.find(F->get().inherits); + } else { + break; + } + } + descr_cache[base][signal_name] = descr; + } + + // "::" separators used in make_custom_tooltip for formatting. + item->set_tooltip(0, String(signal_name) + "::" + signaldesc + "::" + descr); + } + + // List existing connections List<Object::Connection> connections; - selectedNode->get_signal_connection_list(mi.name, &connections); + selectedNode->get_signal_connection_list(signal_name, &connections); for (List<Object::Connection>::Element *F = connections.front(); F; F = F->next()) { @@ -980,7 +1032,7 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) { VBoxContainer *vbc = this; - tree = memnew(Tree); + tree = memnew(ConnectionsDockTree); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 195c9e1e7d..3846fa4d9f 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -106,6 +106,13 @@ public: ////////////////////////////////////////// +// Custom Tree needed to use a RichTextLabel as tooltip control +// when display signal documentation. +class ConnectionsDockTree : public Tree { + + virtual Control *make_custom_tooltip(const String &p_text) const; +}; + class ConnectionsDock : public VBoxContainer { GDCLASS(ConnectionsDock, VBoxContainer); @@ -123,7 +130,7 @@ class ConnectionsDock : public VBoxContainer { }; Node *selectedNode; - Tree *tree; + ConnectionsDockTree *tree; EditorNode *editor; ConfirmationDialog *disconnect_all_dialog; @@ -133,6 +140,8 @@ class ConnectionsDock : public VBoxContainer { PopupMenu *slot_menu; UndoRedo *undo_redo; + Map<StringName, Map<StringName, String> > descr_cache; + void _make_or_edit_connection(); void _connect(Connection cToMake); void _disconnect(TreeItem &item); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 213327d8fd..d9600172d7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -222,7 +222,7 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) { _editor_select(EDITOR_SCRIPT); } else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) { emit_signal("request_help_search", ""); - } else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event)) { + } else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && StreamPeerSSL::is_available()) { _editor_select(EDITOR_ASSETLIB); } else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) { _editor_select_next(); @@ -5090,10 +5090,11 @@ void EditorNode::_feature_profile_changed() { main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); - main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)); + if (StreamPeerSSL::is_available()) + main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)); if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) || (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) || - (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) { + (StreamPeerSSL::is_available() && profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) { _editor_select(EDITOR_2D); } } else { @@ -5106,7 +5107,8 @@ void EditorNode::_feature_profile_changed() { filesystem_dock->set_visible(true); main_editor_buttons[EDITOR_3D]->set_visible(true); main_editor_buttons[EDITOR_SCRIPT]->set_visible(true); - main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true); + if (StreamPeerSSL::is_available()) + main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true); } _update_dock_slots_visibility(); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f705970d79..2cfa759e3b 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -646,19 +646,20 @@ void ScriptTextEditor::_validate_script() { void ScriptTextEditor::_update_bookmark_list() { - bookmarks_menu->get_popup()->clear(); + bookmarks_menu->clear(); + bookmarks_menu->set_size(Size2(1, 1)); - bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE); - bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL); - bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT); - bookmarks_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV); + bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_bookmark"), BOOKMARK_TOGGLE); + bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_bookmarks"), BOOKMARK_REMOVE_ALL); + bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_bookmark"), BOOKMARK_GOTO_NEXT); + bookmarks_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_bookmark"), BOOKMARK_GOTO_PREV); Array bookmark_list = code_editor->get_text_edit()->get_bookmarks_array(); if (bookmark_list.size() == 0) { return; } - bookmarks_menu->get_popup()->add_separator(); + bookmarks_menu->add_separator(); for (int i = 0; i < bookmark_list.size(); i++) { String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).strip_edges(); @@ -667,17 +668,17 @@ void ScriptTextEditor::_update_bookmark_list() { line = line.substr(0, 50); } - bookmarks_menu->get_popup()->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\""); - bookmarks_menu->get_popup()->set_item_metadata(bookmarks_menu->get_popup()->get_item_count() - 1, bookmark_list[i]); + bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\""); + bookmarks_menu->set_item_metadata(bookmarks_menu->get_item_count() - 1, bookmark_list[i]); } } void ScriptTextEditor::_bookmark_item_pressed(int p_idx) { if (p_idx < 4) { // Any item before the separator. - _edit_option(bookmarks_menu->get_popup()->get_item_id(p_idx)); + _edit_option(bookmarks_menu->get_item_id(p_idx)); } else { - code_editor->goto_line(bookmarks_menu->get_popup()->get_item_metadata(p_idx)); + code_editor->goto_line(bookmarks_menu->get_item_metadata(p_idx)); } } @@ -792,6 +793,44 @@ void ScriptTextEditor::_code_complete_script(const String &p_code, List<String> } } +void ScriptTextEditor::_update_breakpoint_list() { + + breakpoints_menu->clear(); + breakpoints_menu->set_size(Size2(1, 1)); + + breakpoints_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_breakpoint"), DEBUG_TOGGLE_BREAKPOINT); + breakpoints_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS); + breakpoints_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT); + breakpoints_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT); + + Array breakpoint_list = code_editor->get_text_edit()->get_breakpoints_array(); + if (breakpoint_list.size() == 0) { + return; + } + + breakpoints_menu->add_separator(); + + for (int i = 0; i < breakpoint_list.size(); i++) { + String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).strip_edges(); + // Limit the size of the line if too big. + if (line.length() > 50) { + line = line.substr(0, 50); + } + + breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - \"" + line + "\""); + breakpoints_menu->set_item_metadata(breakpoints_menu->get_item_count() - 1, breakpoint_list[i]); + } +} + +void ScriptTextEditor::_breakpoint_item_pressed(int p_idx) { + + if (p_idx < 4) { // Any item before the separator. + _edit_option(breakpoints_menu->get_item_id(p_idx)); + } else { + code_editor->goto_line(breakpoints_menu->get_item_metadata(p_idx)); + } +} + void ScriptTextEditor::_breakpoint_toggled(int p_row) { ScriptEditor::get_singleton()->get_debugger()->set_breakpoint(script->get_path(), p_row + 1, code_editor->get_text_edit()->is_line_set_as_breakpoint(p_row)); @@ -1298,6 +1337,8 @@ void ScriptTextEditor::_bind_methods() { ClassDB::bind_method("_update_bookmark_list", &ScriptTextEditor::_update_bookmark_list); ClassDB::bind_method("_bookmark_item_pressed", &ScriptTextEditor::_bookmark_item_pressed); ClassDB::bind_method("_load_theme_settings", &ScriptTextEditor::_load_theme_settings); + ClassDB::bind_method("_update_breakpoint_list", &ScriptTextEditor::_update_breakpoint_list); + ClassDB::bind_method("_breakpoint_item_pressed", &ScriptTextEditor::_breakpoint_item_pressed); ClassDB::bind_method("_breakpoint_toggled", &ScriptTextEditor::_breakpoint_toggled); ClassDB::bind_method("_lookup_connections", &ScriptTextEditor::_lookup_connections); ClassDB::bind_method("_update_connected_methods", &ScriptTextEditor::_update_connected_methods); @@ -1705,11 +1746,6 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT); edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); edit_menu->get_popup()->add_separator(); - edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_breakpoint"), DEBUG_TOGGLE_BREAKPOINT); - edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/remove_all_breakpoints"), DEBUG_REMOVE_ALL_BREAKPOINTS); - edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_next_breakpoint"), DEBUG_GOTO_NEXT_BREAKPOINT); - edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_previous_breakpoint"), DEBUG_GOTO_PREV_BREAKPOINT); - edit_menu->get_popup()->add_separator(); PopupMenu *convert_case = memnew(PopupMenu); convert_case->set_name("convert_case"); @@ -1749,13 +1785,26 @@ ScriptTextEditor::ScriptTextEditor() { edit_hb->add_child(edit_menu); - bookmarks_menu = memnew(MenuButton); - edit_hb->add_child(bookmarks_menu); - bookmarks_menu->set_text(TTR("Bookmarks")); - bookmarks_menu->set_switch_on_hover(true); + MenuButton *goto_menu = memnew(MenuButton); + edit_hb->add_child(goto_menu); + goto_menu->set_text(TTR("Go To")); + goto_menu->set_switch_on_hover(true); + + bookmarks_menu = memnew(PopupMenu); + bookmarks_menu->set_name("Bookmarks"); + goto_menu->get_popup()->add_child(bookmarks_menu); + goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks"); _update_bookmark_list(); bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); - bookmarks_menu->get_popup()->connect("index_pressed", this, "_bookmark_item_pressed"); + bookmarks_menu->connect("index_pressed", this, "_bookmark_item_pressed"); + + breakpoints_menu = memnew(PopupMenu); + breakpoints_menu->set_name("Breakpoints"); + goto_menu->get_popup()->add_child(breakpoints_menu); + goto_menu->get_popup()->add_submenu_item(TTR("Breakpoints"), "Breakpoints"); + _update_breakpoint_list(); + breakpoints_menu->connect("about_to_show", this, "_update_breakpoint_list"); + breakpoints_menu->connect("index_pressed", this, "_breakpoint_item_pressed"); quick_open = memnew(ScriptEditorQuickOpen); add_child(quick_open); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index f83f1ea759..b53383b117 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -70,7 +70,8 @@ class ScriptTextEditor : public ScriptEditorBase { MenuButton *edit_menu; MenuButton *search_menu; - MenuButton *bookmarks_menu; + PopupMenu *bookmarks_menu; + PopupMenu *breakpoints_menu; PopupMenu *highlighter_menu; PopupMenu *context_menu; @@ -143,6 +144,8 @@ class ScriptTextEditor : public ScriptEditorBase { protected: static void _code_complete_scripts(void *p_ud, const String &p_code, List<String> *r_options, bool &r_force); + void _update_breakpoint_list(); + void _breakpoint_item_pressed(int p_idx); void _breakpoint_toggled(int p_row); void _validate_script(); // No longer virtual. diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 6e47d82847..3735cceb15 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -782,8 +782,9 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p r.position += (r.size + Vector2(spacing, spacing)) * offset; } Size2 sc = p_xform.get_scale(); - /* For a future CheckBox to Center Texture: - Size2 cell_size = node->get_cell_size(); */ + Size2 cell_size = node->get_cell_size(); + bool centered_texture = node->is_centered_textures_enabled(); + bool compatibility_mode_enabled = node->is_compatibility_mode_enabled(); Rect2 rect = Rect2(); rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset(); @@ -793,13 +794,24 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p rect.size = r.size; } + if (compatibility_mode_enabled && !centered_texture) { + if (rect.size.y > rect.size.x) { + if ((p_flip_h && (p_flip_v || p_transpose)) || (p_flip_v && !p_transpose)) + tile_ofs.y += rect.size.y - rect.size.x; + } else if (rect.size.y < rect.size.x) { + if ((p_flip_v && (p_flip_h || p_transpose)) || (p_flip_h && !p_transpose)) + tile_ofs.x += rect.size.x - rect.size.y; + } + } + if (p_transpose) { SWAP(tile_ofs.x, tile_ofs.y); - /* For a future CheckBox to Center Texture: - rect.position.x += cell_size.x / 2 - rect.size.y / 2; - rect.position.y += cell_size.y / 2 - rect.size.x / 2; - } else { - rect.position += cell_size / 2 - rect.size / 2; */ + if (centered_texture) { + rect.position.x += cell_size.x / 2 - rect.size.y / 2; + rect.position.y += cell_size.y / 2 - rect.size.x / 2; + } + } else if (centered_texture) { + rect.position += cell_size / 2 - rect.size / 2; } if (p_flip_h) { @@ -812,7 +824,44 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p tile_ofs.y *= -1.0; } - rect.position += tile_ofs; + if (compatibility_mode_enabled && !centered_texture) { + if (node->get_tile_origin() == TileMap::TILE_ORIGIN_TOP_LEFT) { + + rect.position += tile_ofs; + } else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_BOTTOM_LEFT) { + + rect.position += tile_ofs; + + if (p_transpose) { + if (p_flip_h) + rect.position.x -= cell_size.x; + else + rect.position.x += cell_size.x; + } else { + if (p_flip_v) + rect.position.y -= cell_size.y; + else + rect.position.y += cell_size.y; + } + + } else if (node->get_tile_origin() == TileMap::TILE_ORIGIN_CENTER) { + + rect.position += tile_ofs; + + if (p_flip_h) + rect.position.x -= cell_size.x / 2; + else + rect.position.x += cell_size.x / 2; + + if (p_flip_v) + rect.position.y -= cell_size.y / 2; + else + rect.position.y += cell_size.y / 2; + } + } else { + rect.position += tile_ofs; + } + rect.position = p_xform.xform(rect.position); rect.size *= sc; diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index a27935bfe2..4eb9a2a0a3 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -48,7 +48,7 @@ static const bool default_reloadable = true; // Defined in gdnative_api_struct.gen.cpp extern const godot_gdnative_core_api_struct api_struct; -Map<String, Vector<Ref<GDNative> > > *GDNativeLibrary::loaded_libraries = NULL; +Map<String, Vector<Ref<GDNative> > > GDNativeLibrary::loaded_libraries; GDNativeLibrary::GDNativeLibrary() { config_file.instance(); @@ -57,10 +57,6 @@ GDNativeLibrary::GDNativeLibrary() { load_once = default_load_once; singleton = default_singleton; reloadable = default_reloadable; - - if (GDNativeLibrary::loaded_libraries == NULL) { - GDNativeLibrary::loaded_libraries = memnew((Map<String, Vector<Ref<GDNative> > >)); - } } GDNativeLibrary::~GDNativeLibrary() { @@ -318,10 +314,10 @@ bool GDNative::initialize() { #endif if (library->should_load_once()) { - if (GDNativeLibrary::loaded_libraries->has(lib_path)) { + if (GDNativeLibrary::loaded_libraries.has(lib_path)) { // already loaded. Don't load again. // copy some of the stuff instead - this->native_handle = (*GDNativeLibrary::loaded_libraries)[lib_path][0]->native_handle; + this->native_handle = GDNativeLibrary::loaded_libraries[lib_path][0]->native_handle; initialized = true; return true; } @@ -377,11 +373,11 @@ bool GDNative::initialize() { initialized = true; - if (library->should_load_once() && !GDNativeLibrary::loaded_libraries->has(lib_path)) { + if (library->should_load_once() && !GDNativeLibrary::loaded_libraries.has(lib_path)) { Vector<Ref<GDNative> > gdnatives; gdnatives.resize(1); gdnatives.write[0] = Ref<GDNative>(this); - GDNativeLibrary::loaded_libraries->insert(lib_path, gdnatives); + GDNativeLibrary::loaded_libraries.insert(lib_path, gdnatives); } return true; @@ -395,7 +391,7 @@ bool GDNative::terminate() { } if (library->should_load_once()) { - Vector<Ref<GDNative> > *gdnatives = &(*GDNativeLibrary::loaded_libraries)[library->get_current_library_path()]; + Vector<Ref<GDNative> > *gdnatives = &GDNativeLibrary::loaded_libraries[library->get_current_library_path()]; if (gdnatives->size() > 1) { // there are other GDNative's still using this library, so we actually don't terminate gdnatives->erase(Ref<GDNative>(this)); @@ -405,7 +401,7 @@ bool GDNative::terminate() { // we're the last one, terminate! gdnatives->clear(); // whew this looks scary, but all it does is remove the entry completely - GDNativeLibrary::loaded_libraries->erase(GDNativeLibrary::loaded_libraries->find(library->get_current_library_path())); + GDNativeLibrary::loaded_libraries.erase(GDNativeLibrary::loaded_libraries.find(library->get_current_library_path())); } } diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index 005d1d2bff..408af26753 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -47,7 +47,7 @@ class GDNative; class GDNativeLibrary : public Resource { GDCLASS(GDNativeLibrary, Resource); - static Map<String, Vector<Ref<GDNative> > > *loaded_libraries; + static Map<String, Vector<Ref<GDNative> > > loaded_libraries; friend class GDNativeLibraryResourceLoader; friend class GDNative; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 08cbb176fe..1b9d31d752 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -824,11 +824,17 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { encode_uint32(min_gles3 ? 0x00030000 : 0x00020000, &p_manifest.write[iofs + 16]); } - if (tname == "meta-data" && attrname == "value") { + if (tname == "meta-data" && attrname == "name" && string_table[attr_value] == "xr_mode_metadata_name") { + // Update the meta-data 'android:name' attribute based on the selected XR mode. + if (xr_mode_index == 1 /* XRMode.OVR */) { + string_table.write[attr_value] = "com.samsung.android.vr.application.mode"; + } + } + + if (tname == "meta-data" && attrname == "value" && string_table[attr_value] == "xr_mode_metadata_value") { + // Update the meta-data 'android:value' attribute based on the selected XR mode. if (xr_mode_index == 1 /* XRMode.OVR */) { string_table.write[attr_value] = "vr_only"; - } else { - string_table.write[attr_value] = ""; } } diff --git a/platform/android/java/AndroidManifest.xml b/platform/android/java/AndroidManifest.xml index a7e6db4059..3152ef12cd 100644 --- a/platform/android/java/AndroidManifest.xml +++ b/platform/android/java/AndroidManifest.xml @@ -25,8 +25,8 @@ <!--The following values are replaced when Godot exports, modifying them here has no effect. Do these changes in the--> <!--export preset. Adding new ones is fine.--> -<!-- Metadata for VR app detection on Oculus devices. This is modified by the exporter based on the selected xr mode. Changing this value here has no effect. --> - <meta-data android:name="com.samsung.android.vr.application.mode" android:value=""/> +<!-- XR mode metadata. This is modified by the exporter based on the selected xr mode. DO NOT CHANGE the values here. --> + <meta-data android:name="xr_mode_metadata_name" android:value="xr_mode_metadata_value"/> <activity android:name="org.godotengine.godot.Godot" android:label="@string/godot_project_name_string" diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index 9718b03164..d70b947fcc 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -145,6 +145,7 @@ Error ContextGL_X11::initialize() { break; } } + XFree(fbc); ERR_FAIL_COND_V(!fbconfig, ERR_UNCONFIGURED); swa.background_pixmap = None; @@ -159,6 +160,7 @@ Error ContextGL_X11::initialize() { vi = glXGetVisualFromFBConfig(x11_display, fbc[0]); fbconfig = fbc[0]; + XFree(fbc); } int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&ctxErrorHandler); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 7759897420..93c12f0103 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -410,6 +410,7 @@ Particles2D::Particles2D() { particles = VS::get_singleton()->particles_create(); + one_shot = false; // Needed so that set_emitting doesn't access uninitialized values set_emitting(true); set_one_shot(false); set_amount(8); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index fc53c9e4ac..22bc0e44e6 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -234,6 +234,25 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Size2 s = p_sc; Vector2 offset = p_offset; + if (compatibility_mode && !centered_textures) { + + if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT) { + offset.y += cell_size.y; + } else if (tile_origin == TILE_ORIGIN_CENTER) { + offset += cell_size / 2; + } + + if (s.y > s.x) { + if ((p_cell.flip_h && (p_cell.flip_v || p_cell.transpose)) || (p_cell.flip_v && !p_cell.transpose)) { + offset.y += s.y - s.x; + } + } else if (s.y < s.x) { + if ((p_cell.flip_v && (p_cell.flip_h || p_cell.transpose)) || (p_cell.flip_h && !p_cell.transpose)) { + offset.x += s.x - s.y; + } + } + } + if (p_cell.transpose) { SWAP(xform.elements[0].x, xform.elements[0].y); SWAP(xform.elements[1].x, xform.elements[1].y); @@ -244,16 +263,36 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const if (p_cell.flip_h) { xform.elements[0].x = -xform.elements[0].x; xform.elements[1].x = -xform.elements[1].x; - offset.x = s.x - offset.x; + if (compatibility_mode && !centered_textures) { + if (tile_origin == TILE_ORIGIN_TOP_LEFT || tile_origin == TILE_ORIGIN_BOTTOM_LEFT) { + offset.x = s.x - offset.x; + } else if (tile_origin == TILE_ORIGIN_CENTER) { + offset.x = s.x - offset.x / 2; + } + } else { + offset.x = s.x - offset.x; + } } if (p_cell.flip_v) { xform.elements[0].y = -xform.elements[0].y; xform.elements[1].y = -xform.elements[1].y; - offset.y = s.y - offset.y; + if (compatibility_mode && !centered_textures) { + if (tile_origin == TILE_ORIGIN_TOP_LEFT) { + offset.y = s.y - offset.y; + } else if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT) { + offset.y += s.y; + } else if (tile_origin == TILE_ORIGIN_CENTER) { + offset.y += s.y; + } + } else { + offset.y = s.y - offset.y; + } + } + + if (centered_textures) { + offset += cell_size / 2 - s / 2; } - /* For a future CheckBox to Center Texture: - offset += cell_size / 2 - s / 2; */ xform.elements[2] += offset; } @@ -434,13 +473,24 @@ void TileMap::update_dirty_quadrants() { rect.size.x += fp_adjust; rect.size.y += fp_adjust; + if (compatibility_mode && !centered_textures) { + if (rect.size.y > rect.size.x) { + if ((c.flip_h && (c.flip_v || c.transpose)) || (c.flip_v && !c.transpose)) + tile_ofs.y += rect.size.y - rect.size.x; + } else if (rect.size.y < rect.size.x) { + if ((c.flip_v && (c.flip_h || c.transpose)) || (c.flip_h && !c.transpose)) + tile_ofs.x += rect.size.x - rect.size.y; + } + } + if (c.transpose) { SWAP(tile_ofs.x, tile_ofs.y); - /* For a future CheckBox to Center Texture: - rect.position.x += cell_size.x / 2 - rect.size.y / 2; - rect.position.y += cell_size.y / 2 - rect.size.x / 2; - } else { - rect.position += cell_size / 2 - rect.size / 2; */ + if (centered_textures) { + rect.position.x += cell_size.x / 2 - rect.size.y / 2; + rect.position.y += cell_size.y / 2 - rect.size.x / 2; + } + } else if (centered_textures) { + rect.position += cell_size / 2 - rect.size / 2; } if (c.flip_h) { @@ -453,7 +503,43 @@ void TileMap::update_dirty_quadrants() { tile_ofs.y = -tile_ofs.y; } - rect.position += tile_ofs; + if (compatibility_mode && !centered_textures) { + if (tile_origin == TILE_ORIGIN_TOP_LEFT) { + rect.position += tile_ofs; + + } else if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT) { + + rect.position += tile_ofs; + + if (c.transpose) { + if (c.flip_h) + rect.position.x -= cell_size.x; + else + rect.position.x += cell_size.x; + } else { + if (c.flip_v) + rect.position.y -= cell_size.y; + else + rect.position.y += cell_size.y; + } + + } else if (tile_origin == TILE_ORIGIN_CENTER) { + + rect.position += tile_ofs; + + if (c.flip_h) + rect.position.x -= cell_size.x / 2; + else + rect.position.x += cell_size.x / 2; + + if (c.flip_v) + rect.position.y -= cell_size.y / 2; + else + rect.position.y += cell_size.y / 2; + } + } else { + rect.position += tile_ofs; + } Ref<Texture> normal_map = tile_set->tile_get_normal_map(c.id); Color modulate = tile_set->tile_get_modulate(c.id); @@ -1156,10 +1242,7 @@ void TileMap::_set_tile_data(const PoolVector<int> &p_data) { coord_x = decode_uint16(&local[8]); coord_y = decode_uint16(&local[10]); } - /* - if (x<-20 || y <-20 || x>4000 || y>4000) - continue; - */ + set_cell(x, y, v, flip_h, flip_v, transpose, Vector2(coord_x, coord_y)); } @@ -1570,6 +1653,32 @@ bool TileMap::is_y_sort_mode_enabled() const { return y_sort_mode; } +void TileMap::set_compatibility_mode(bool p_enable) { + + _clear_quadrants(); + compatibility_mode = p_enable; + _recreate_quadrants(); + emit_signal("settings_changed"); +} + +bool TileMap::is_compatibility_mode_enabled() const { + + return compatibility_mode; +} + +void TileMap::set_centered_textures(bool p_enable) { + + _clear_quadrants(); + centered_textures = p_enable; + _recreate_quadrants(); + emit_signal("settings_changed"); +} + +bool TileMap::is_centered_textures_enabled() const { + + return centered_textures; +} + Array TileMap::get_used_cells() const { Array a; @@ -1707,6 +1816,12 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_y_sort_mode", "enable"), &TileMap::set_y_sort_mode); ClassDB::bind_method(D_METHOD("is_y_sort_mode_enabled"), &TileMap::is_y_sort_mode_enabled); + ClassDB::bind_method(D_METHOD("set_compatibility_mode", "enable"), &TileMap::set_compatibility_mode); + ClassDB::bind_method(D_METHOD("is_compatibility_mode_enabled"), &TileMap::is_compatibility_mode_enabled); + + ClassDB::bind_method(D_METHOD("set_centered_textures", "enable"), &TileMap::set_centered_textures); + ClassDB::bind_method(D_METHOD("is_centered_textures_enabled"), &TileMap::is_centered_textures_enabled); + ClassDB::bind_method(D_METHOD("set_collision_use_kinematic", "use_kinematic"), &TileMap::set_collision_use_kinematic); ClassDB::bind_method(D_METHOD("get_collision_use_kinematic"), &TileMap::get_collision_use_kinematic); @@ -1775,6 +1890,8 @@ void TileMap::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_half_offset", PROPERTY_HINT_ENUM, "Offset X,Offset Y,Disabled,Offset Negative X,Offset Negative Y"), "set_half_offset", "get_half_offset"); ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_tile_origin", PROPERTY_HINT_ENUM, "Top Left,Center,Bottom Left"), "set_tile_origin", "get_tile_origin"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_y_sort"), "set_y_sort_mode", "is_y_sort_mode_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compatibility_mode"), "set_compatibility_mode", "is_compatibility_mode_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "centered_textures"), "set_centered_textures", "is_centered_textures_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_clip_uv"), "set_clip_uv", "get_clip_uv"); ADD_GROUP("Collision", "collision_"); @@ -1832,6 +1949,8 @@ TileMap::TileMap() { use_kinematic = false; navigation = NULL; y_sort_mode = false; + compatibility_mode = false; + centered_textures = false; occluder_light_mask = 1; clip_uv = false; format = FORMAT_1; //Always initialize with the lowest format diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 1caaefa213..6c9648ff32 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -181,6 +181,8 @@ private: bool used_size_cache_dirty; bool quadrant_order_dirty; bool y_sort_mode; + bool compatibility_mode; + bool centered_textures; bool clip_uv; float fp_adjust; float friction; @@ -311,6 +313,12 @@ public: void set_y_sort_mode(bool p_enable); bool is_y_sort_mode_enabled() const; + void set_compatibility_mode(bool p_enable); + bool is_compatibility_mode_enabled() const; + + void set_centered_textures(bool p_enable); + bool is_centered_textures_enabled() const; + Array get_used_cells() const; Array get_used_cells_by_id(int p_id) const; Rect2 get_used_rect(); // Not const because of cache diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 414e932f61..a04f156d80 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -571,4 +571,5 @@ GIProbe::GIProbe() { } GIProbe::~GIProbe() { + VS::get_singleton()->free(gi_probe); } diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 2bcd0eaa46..00a168fc39 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -411,6 +411,7 @@ Particles::Particles() { particles = VS::get_singleton()->particles_create(); set_base(particles); + one_shot = false; // Needed so that set_emitting doesn't access uninitialized values set_emitting(true); set_one_shot(false); set_amount(8); diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index a9d96292a1..b9f6865298 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -712,6 +712,7 @@ SoftBody::SoftBody() : } SoftBody::~SoftBody() { + PhysicsServer::get_singleton()->free(physics_rid); } void SoftBody::reset_softbody_pin() { diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp index 43c4b2aa51..7a1b10792b 100644 --- a/scene/animation/skeleton_ik.cpp +++ b/scene/animation/skeleton_ik.cpp @@ -406,6 +406,7 @@ void SkeletonIK::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { skeleton = Object::cast_to<Skeleton>(get_parent()); + set_process_priority(1); reload_chain(); } break; case NOTIFICATION_INTERNAL_PROCESS: { @@ -431,8 +432,6 @@ SkeletonIK::SkeletonIK() : skeleton(NULL), target_node_override(NULL), task(NULL) { - - set_process_priority(1); } SkeletonIK::~SkeletonIK() { diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 0e7cec57a4..0940a59a82 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -453,9 +453,6 @@ void SceneTree::init() { //_quit=false; initialized = true; - input_handled = false; - - pause = false; root->_set_tree(this); MainLoop::init(); @@ -1986,6 +1983,8 @@ SceneTree::SceneTree() { idle_process_time = 1; root = NULL; + input_handled = false; + pause = false; current_frame = 0; current_event = 0; tree_changed_name = "tree_changed"; diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index d45bda72b7..7aded4e816 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -77,6 +77,8 @@ void VisualServerRaster::free(RID p_rid) { return; if (VSG::scene->free(p_rid)) return; + if (VSG::scene_render->free(p_rid)) + return; } /* EVENT QUEUING */ |