Path: blob/master/editor/debugger/editor_debugger_tree.h
9896 views
/**************************************************************************/1/* editor_debugger_tree.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "scene/gui/tree.h"3334class AcceptDialog;35class SceneDebuggerTree;36class EditorFileDialog;3738class EditorDebuggerTree : public Tree {39GDCLASS(EditorDebuggerTree, Tree);4041private:42struct ParentItem {43TreeItem *tree_item;44int child_count;45bool matches_filter;4647ParentItem(TreeItem *p_tree_item = nullptr, int p_child_count = 0, bool p_matches_filter = false) {48tree_item = p_tree_item;49child_count = p_child_count;50matches_filter = p_matches_filter;51}52};5354enum ItemMenu {55ITEM_MENU_SAVE_REMOTE_NODE,56ITEM_MENU_COPY_NODE_PATH,57ITEM_MENU_EXPAND_COLLAPSE,58};5960TypedArray<uint64_t> inspected_object_ids;61int debugger_id = 0;62bool updating_scene_tree = false;63bool scrolling_to_item = false;64bool notify_selection_queued = false;65bool selection_surpassed_limit = false;66bool selection_uncollapse_all = false;67HashSet<ObjectID> unfold_cache;68PopupMenu *item_menu = nullptr;69EditorFileDialog *file_dialog = nullptr;70AcceptDialog *accept = nullptr;71String last_filter;7273void _scene_tree_folded(Object *p_obj);74void _scene_tree_selection_changed(TreeItem *p_item, int p_column, bool p_selected);75void _scene_tree_nothing_selected();76void _notify_selection_changed();77void _scene_tree_rmb_selected(const Vector2 &p_position, MouseButton p_button);78void _item_menu_id_pressed(int p_option);79void _file_selected(const String &p_file);8081protected:82static void _bind_methods();83void _notification(int p_what);8485public:86enum Button {87BUTTON_SUBSCENE = 0,88BUTTON_VISIBILITY = 1,89};9091virtual Variant get_drag_data(const Point2 &p_point) override;9293void update_icon_max_width();94String get_selected_path();95ObjectID get_selected_object();96int get_current_debugger(); // Would love to have one tree for every debugger.97inline TypedArray<uint64_t> get_selection() const { return inspected_object_ids.duplicate(); }98void update_scene_tree(const SceneDebuggerTree *p_tree, int p_debugger);99void select_nodes(const TypedArray<int64_t> &p_ids);100void clear_selection();101102EditorDebuggerTree();103};104105106