Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/classes/Tree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<return type="void" />
<description>
Clears the tree. This removes all items.
Prints an error and does not allow clearing the tree if called during mouse selection.
</description>
</method>
<method name="create_item">
Expand All @@ -50,6 +51,7 @@
Creates an item in the tree and adds it as a child of [param parent], which can be either a valid [TreeItem] or [code]null[/code].
If [param parent] is [code]null[/code], the root item will be the parent, or the new item will be the root itself if the tree is empty.
The new item will be the [param index]-th child of parent, or it will be the last child if there are not enough siblings.
Prints an error and returns [code]null[/code] if called during mouse selection, or if the [param parent] does not belong to this tree.
</description>
</method>
<method name="deselect_all">
Expand Down Expand Up @@ -350,6 +352,7 @@
</member>
<member name="columns" type="int" setter="set_columns" getter="get_columns" default="1">
The number of columns.
Prints an error and does not allow setting the columns during mouse selection.
</member>
<member name="drop_mode_flags" type="int" setter="set_drop_mode_flags" getter="get_drop_mode_flags" default="0">
The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended.
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5136,7 +5136,7 @@ Size2 Tree::get_minimum_size() const {
}

TreeItem *Tree::create_item(TreeItem *p_parent, int p_index) {
ERR_FAIL_COND_V(blocked > 0, nullptr);
ERR_FAIL_COND_V_MSG(blocked > 0, nullptr, "The tree cannot create items during mouse selection events.");

TreeItem *ti = nullptr;

Expand Down Expand Up @@ -5291,7 +5291,7 @@ bool Tree::is_anything_selected() {
}

void Tree::clear() {
ERR_FAIL_COND(blocked > 0);
ERR_FAIL_COND_MSG(blocked > 0, "The tree cannot be cleared during mouse selection events.");

if (pressing_for_editor) {
if (range_drag_enabled) {
Expand Down Expand Up @@ -5568,7 +5568,7 @@ void Tree::propagate_set_columns(TreeItem *p_item) {

void Tree::set_columns(int p_columns) {
ERR_FAIL_COND(p_columns < 1);
ERR_FAIL_COND(blocked > 0);
ERR_FAIL_COND_MSG(blocked > 0, "The number of columns cannot be changed during mouse selection events.");

if (columns.size() > p_columns) {
for (int i = p_columns; i < columns.size(); i++) {
Expand Down
Loading