/*************************************************************************/ /* editor_data.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* 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 */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifndef EDITOR_DATA_H #define EDITOR_DATA_H #include "core/object/undo_redo.h" #include "core/templates/list.h" #include "core/templates/pair.h" #include "editor/editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "scene/resources/texture.h" class EditorHistory { enum { HISTORY_MAX = 64 }; struct Obj { REF ref; ObjectID object; String property; bool inspector_only = false; }; struct History { Vector path; int level = 0; }; friend class EditorData; Vector history; int current; //Vector editor_plugins; struct PropertyData { String name; Variant value; }; void _add_object(ObjectID p_object, const String &p_property, int p_level_change, bool p_inspector_only = false); public: void cleanup_history(); bool is_at_beginning() const; bool is_at_end() const; void add_object_inspector_only(ObjectID p_object); void add_object(ObjectID p_object); void add_object(ObjectID p_object, const String &p_subprop); void add_object(ObjectID p_object, int p_relevel); int get_history_len(); int get_history_pos(); ObjectID get_history_obj(int p_obj) const; bool is_history_obj_inspector_only(int p_obj) const; bool next(); bool previous(); ObjectID get_current(); bool is_current_inspector_only() const; int get_path_size() const; ObjectID get_path_object(int p_index) const; String get_path_property(int p_index) const; void clear(); EditorHistory(); }; class EditorSelection; class EditorData { public: struct CustomType { String name; Ref