summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp4
-rw-r--r--doc/classes/Control.xml4
-rw-r--r--doc/classes/OS.xml13
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp14
-rw-r--r--scene/gui/tree.cpp8
5 files changed, 31 insertions, 12 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 94da74cbda..2f8b11652b 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1690,7 +1690,7 @@ String _Directory::get_current_dir() {
}
Error _Directory::make_dir(String p_dir) {
- ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
+ ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir(p_dir);
@@ -1701,7 +1701,7 @@ Error _Directory::make_dir(String p_dir) {
}
Error _Directory::make_dir_recursive(String p_dir) {
- ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
+ ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir_recursive(p_dir);
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml
index 9dbb843902..1f495bf91a 100644
--- a/doc/classes/Control.xml
+++ b/doc/classes/Control.xml
@@ -856,7 +856,9 @@
The node's rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot's position.
</member>
<member name="rect_scale" type="Vector2" setter="set_scale" getter="get_scale" default="Vector2( 1, 1 )">
- The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset].
+ The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset]. The Control's [member hint_tooltip] will also scale according to this value.
+ [b]Note:[/b] This property is mainly intended to be used for animation purposes. Text inside the Control will look pixelated or blurry when the Control is scaled. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the [url=https://docs.godotengine.org/en/latest/tutorials/viewports/multiple_resolutions.html]documentation[/url] instead of scaling Controls individually.
+ [b]Note:[/b] If the Control node is a child of a [Container] node, the scale will be reset to [code]Vector2(1, 1)[/code] when the scene is instanced. To set the Control's scale when it's instanced, wait for one frame using [code]yield(get_tree(), "idle_frame")[/code] then set its [member rect_scale] property.
</member>
<member name="rect_size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2( 0, 0 )">
The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 105def21ca..238bc970ef 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -112,7 +112,18 @@
<return type="PackedStringArray">
</return>
<description>
- Returns the command line arguments passed to the engine.
+ Returns the command-line arguments passed to the engine.
+ Command-line arguments can be written in any form, including both [code]--key value[/code] and [code]--key=value[/code] forms so they can be properly parsed, as long as custom command-line arguments do not conflict with engine arguments.
+ You can also incorporate environment variables using the [method get_environment] method.
+ You can set [code]editor/main_run_args[/code] in the Project Settings to define command-line arguments to be passed by the editor when running the project.
+ Here's a minimal example on how to parse command-line arguments into a dictionary using the [code]--key=value[/code] form for arguments:
+ [codeblock]
+ var arguments = {}
+ for argument in OS.get_cmdline_args():
+ if argument.find("=") > -1:
+ var key_value = argument.split("=")
+ arguments[key_value[0].lstrip("--")] = key_value[1]
+ [/codeblock]
</description>
</method>
<method name="get_connected_midi_inputs">
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 44913abe8b..3c6556a310 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -2045,10 +2045,10 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) {
List<CanvasItem *> selection = _get_edited_canvas_items();
- // Remove not movable nodes
+ drag_selection.clear();
for (int i = 0; i < selection.size(); i++) {
- if (!_is_node_movable(selection[i], true)) {
- selection.erase(selection[i]);
+ if (_is_node_movable(selection[i], true)) {
+ drag_selection.push_back(selection[i]);
}
}
@@ -2073,7 +2073,6 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
drag_from = transform.affine_inverse().xform(b->get_position());
- drag_selection = selection;
_save_canvas_item_state(drag_selection);
}
return true;
@@ -2395,16 +2394,15 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Drag the node(s) if requested
List<CanvasItem *> selection2 = _get_edited_canvas_items();
- // Remove not movable nodes
+ drag_selection.clear();
for (int i = 0; i < selection2.size(); i++) {
- if (!_is_node_movable(selection2[i], true)) {
- selection2.erase(selection2[i]);
+ if (_is_node_movable(selection2[i], true)) {
+ drag_selection.push_back(selection2[i]);
}
}
if (selection2.size() > 0) {
drag_type = DRAG_MOVE;
- drag_selection = selection2;
drag_from = click;
_save_canvas_item_state(drag_selection);
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 47761d724e..eeb7f9430d 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3419,6 +3419,8 @@ void Tree::scroll_to_item(TreeItem *p_item) {
TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards) {
TreeItem *from = p_at;
+ TreeItem *loop = nullptr; // Safe-guard against infinite loop.
+
while (p_at) {
for (int i = 0; i < columns.size(); i++) {
if (p_at->get_text(i).findn(p_find) == 0 && (!p_selectable || p_at->is_selectable(i))) {
@@ -3438,6 +3440,12 @@ TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_c
if ((p_at) == from) {
break;
}
+
+ if (!loop) {
+ loop = p_at;
+ } else if (loop == p_at) {
+ break;
+ }
}
return nullptr;