Path: blob/master/modules/objectdb_profiler/editor/data_viewers/node_view.h
11325 views
/**************************************************************************/1/* node_view.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 "../snapshot_data.h"33#include "shared_controls.h"34#include "snapshot_view.h"3536class Tree;3738// When diffing in split view, we have two trees/filters39// so this struct is used to group their properties together.40struct NodeTreeElements {41NodeTreeElements() {42tree = nullptr;43filter_bar = nullptr;44root = nullptr;45}46Tree *tree = nullptr;47TreeSortAndFilterBar *filter_bar = nullptr;48VBoxContainer *root = nullptr;49};5051class SnapshotNodeView : public SnapshotView {52GDCLASS(SnapshotNodeView, SnapshotView);5354enum DiffGroup {55DIFF_GROUP_NONE,56DIFF_GROUP_ADDED,57DIFF_GROUP_REMOVED58};5960NodeTreeElements main_tree;61NodeTreeElements diff_tree;62Tree *active_tree = nullptr;63PopupMenu *choose_object_menu = nullptr;64bool combined_diff_view = true;65HashMap<TreeItem *, LocalVector<SnapshotDataObject *>> tree_item_data;6667void _node_selected(Tree *p_tree_selected_from);68void _notification(int p_what);69NodeTreeElements _make_node_tree(const String &p_tree_name);70void _apply_filters();71void _refresh_icons();72void _toggle_diff_mode(bool p_state);73void _choose_object_pressed(int p_object_idx, bool p_confirm_override);74void _show_choose_object_menu();7576void _add_snapshot_to_tree(Tree *p_tree, GameStateSnapshot *p_snapshot, DiffGroup p_diff_group = DIFF_GROUP_NONE);77void _add_children_to_tree(TreeItem *p_parent_item, SnapshotDataObject *p_data, DiffGroup p_diff_group = DIFF_GROUP_NONE);78TreeItem *_add_item_to_tree(Tree *p_tree, TreeItem *p_parent, const String &p_item_name, DiffGroup p_diff_group = DIFF_GROUP_NONE);79TreeItem *_add_item_to_tree(Tree *p_tree, TreeItem *p_parent, SnapshotDataObject *p_data, DiffGroup p_diff_group = DIFF_GROUP_NONE);8081public:82SnapshotNodeView();83virtual void show_snapshot(GameStateSnapshot *p_data, GameStateSnapshot *p_diff_data) override;84virtual void clear_snapshot() override;85};868788