/**************************************************************************/ /* tile_map_layer_editor.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* 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 TILE_MAP_LAYER_EDITOR_H #define TILE_MAP_LAYER_EDITOR_H #include "tile_atlas_view.h" #include "core/os/thread.h" #include "core/typedefs.h" #include "scene/2d/tile_map.h" #include "scene/gui/box_container.h" #include "scene/gui/check_box.h" #include "scene/gui/flow_container.h" #include "scene/gui/item_list.h" #include "scene/gui/menu_button.h" #include "scene/gui/option_button.h" #include "scene/gui/separator.h" #include "scene/gui/spin_box.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_bar.h" #include "scene/gui/tree.h" class TileMapLayerEditor; class TileMapLayerSubEditorPlugin : public Object { protected: ObjectID edited_tile_map_layer_id; TileMapLayer *_get_edited_layer() const; public: struct TabData { Control *toolbar = nullptr; Control *panel = nullptr; }; virtual Vector get_tabs() const { return Vector(); }; virtual bool forward_canvas_gui_input(const Ref &p_event) { return false; }; virtual void forward_canvas_draw_over_viewport(Control *p_overlay) {} virtual void tile_set_changed() {} virtual void edit(ObjectID p_tile_map_layer_id) {} }; class TileMapLayerEditorTilesPlugin : public TileMapLayerSubEditorPlugin { GDCLASS(TileMapLayerEditorTilesPlugin, TileMapLayerSubEditorPlugin); public: enum { TRANSFORM_ROTATE_LEFT, TRANSFORM_ROTATE_RIGHT, TRANSFORM_FLIP_H, TRANSFORM_FLIP_V, }; private: ///// Toolbar ///// HBoxContainer *toolbar = nullptr; Ref tool_buttons_group; Button *select_tool_button = nullptr; Button *paint_tool_button = nullptr; Button *line_tool_button = nullptr; Button *rect_tool_button = nullptr; Button *bucket_tool_button = nullptr; HBoxContainer *tools_settings = nullptr; VSeparator *tools_settings_vsep = nullptr; Button *picker_button = nullptr; Button *erase_button = nullptr; HBoxContainer *transform_toolbar = nullptr; Button *transform_button_rotate_left = nullptr; Button *transform_button_rotate_right = nullptr; Button *transform_button_flip_h = nullptr; Button *transform_button_flip_v = nullptr; VSeparator *tools_settings_vsep_2 = nullptr; CheckBox *bucket_contiguous_checkbox = nullptr; Button *random_tile_toggle = nullptr; HBoxContainer *scatter_controls_container = nullptr; float scattering = 0.0; Label *scatter_label = nullptr; SpinBox *scatter_spinbox = nullptr; void _on_random_tile_checkbox_toggled(bool p_pressed); void _on_scattering_spinbox_changed(double p_value); void _update_toolbar(); void _update_transform_buttons(); void _set_transform_buttons_state(const Vector