diff options
Diffstat (limited to 'editor/scene_tree_editor.h')
-rw-r--r-- | editor/scene_tree_editor.h | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index b4c40ab17a..5d4230059c 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 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 */ @@ -32,8 +32,8 @@ #define SCENE_TREE_EDITOR_H #include "core/object/undo_redo.h" -#include "editor_data.h" -#include "editor_settings.h" +#include "editor/editor_data.h" +#include "editor/editor_settings.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/tree.h" @@ -41,7 +41,7 @@ class SceneTreeEditor : public Control { GDCLASS(SceneTreeEditor, Control); - EditorSelection *editor_selection; + EditorSelection *editor_selection = nullptr; enum SceneTreeEditorButton { BUTTON_SUBSCENE = 0, @@ -53,28 +53,30 @@ class SceneTreeEditor : public Control { BUTTON_SIGNALS = 6, BUTTON_GROUPS = 7, BUTTON_PIN = 8, + BUTTON_UNIQUE = 9, }; - Tree *tree; - Node *selected; + Tree *tree = nullptr; + Node *selected = nullptr; ObjectID instance_node; String filter; - AcceptDialog *error; - AcceptDialog *warning; + AcceptDialog *error = nullptr; + AcceptDialog *warning = nullptr; bool auto_expand_selected = true; - bool connect_to_script_mode; - bool connecting_signal; + bool connect_to_script_mode = false; + bool connecting_signal = false; int blocked; void _compute_hash(Node *p_node, uint64_t &hash); - bool _add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll_to_selected = false); + void _add_nodes(Node *p_node, TreeItem *p_parent); void _test_update_tree(); void _update_tree(bool p_scroll_to_selected = false); + bool _update_filter(TreeItem *p_parent = nullptr, bool p_scroll_to_selected = false); void _tree_changed(); void _tree_process_mode_changed(); void _node_removed(Node *p_node); @@ -92,21 +94,21 @@ class SceneTreeEditor : public Control { bool can_rename; bool can_open_instance; - bool updating_tree; - bool show_enabled_subscene; + bool updating_tree = false; + bool show_enabled_subscene = false; void _renamed(); - UndoRedo *undo_redo; - - Set<Node *> marked; - bool marked_selectable; - bool marked_children_selectable; - bool display_foreign; - bool tree_dirty; - bool pending_test_update; + UndoRedo *undo_redo = nullptr; + + HashSet<Node *> marked; + bool marked_selectable = false; + bool marked_children_selectable = false; + bool display_foreign = false; + bool tree_dirty = true; + bool pending_test_update = false; static void _bind_methods(); - void _cell_button_pressed(Object *p_item, int p_column, int p_id); + void _cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button); void _toggle_visible(Node *p_node); void _cell_multi_selected(Object *p_object, int p_cell, bool p_selected); void _update_selection(TreeItem *item); @@ -121,11 +123,12 @@ class SceneTreeEditor : public Control { bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); - void _rmb_select(const Vector2 &p_pos); + void _empty_clicked(const Vector2 &p_pos, MouseButton p_button); + void _rmb_select(const Vector2 &p_pos, MouseButton p_button = MouseButton::RIGHT); void _warning_changed(Node *p_for_node); - Timer *update_timer; + Timer *update_timer = nullptr; List<StringName> *script_types; bool _is_script_type(const StringName &p_type) const; @@ -139,7 +142,7 @@ public: void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }; void set_display_foreign_nodes(bool p_display); - void set_marked(const Set<Node *> &p_marked, bool p_selectable = false, bool p_children_selectable = true); + void set_marked(const HashSet<Node *> &p_marked, bool p_selectable = false, bool p_children_selectable = true); void set_marked(Node *p_marked, bool p_selectable = false, bool p_children_selectable = true); void set_selected(Node *p_node, bool p_emit_selected = true); Node *get_selected(); @@ -166,14 +169,15 @@ public: class SceneTreeDialog : public ConfirmationDialog { GDCLASS(SceneTreeDialog, ConfirmationDialog); - SceneTreeEditor *tree; + SceneTreeEditor *tree = nullptr; //Button *select; //Button *cancel; - LineEdit *filter; + LineEdit *filter = nullptr; void _select(); void _cancel(); void _filter_changed(const String &p_filter); + void _update_theme(); protected: void _notification(int p_what); |