2022-04-11 13:42:49 +02:00
|
|
|
#ifndef MDI_ED_H
|
|
|
|
#define MDI_ED_H
|
|
|
|
|
|
|
|
/*
|
2022-12-31 21:07:05 +01:00
|
|
|
Copyright (c) 2019-2023 Péter Magyar
|
2022-04-11 13:42:49 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2022-04-13 20:39:17 +02:00
|
|
|
#include "scene/gui/panel_container.h"
|
2022-04-11 13:42:49 +02:00
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
class MDIEdPlugin;
|
2022-04-13 02:08:30 +02:00
|
|
|
class MeshDataResource;
|
|
|
|
class MeshDataInstance;
|
|
|
|
class MDIEdPlugin;
|
2022-04-13 20:39:17 +02:00
|
|
|
class MDREdUVPreviewer;
|
|
|
|
class MDRUVRectEditorPopup;
|
2022-04-13 22:22:40 +02:00
|
|
|
class VBoxContainer;
|
|
|
|
class Button;
|
2022-04-13 02:08:30 +02:00
|
|
|
|
2022-04-13 20:39:17 +02:00
|
|
|
class MDIEd : public PanelContainer {
|
|
|
|
GDCLASS(MDIEd, PanelContainer);
|
2022-04-11 13:42:49 +02:00
|
|
|
|
|
|
|
public:
|
2022-08-20 01:33:02 +02:00
|
|
|
bool is_editing();
|
|
|
|
void make_visible(const bool visible);
|
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
void set_plugin(MDIEdPlugin *plugin);
|
2022-04-14 17:13:07 +02:00
|
|
|
void set_mesh_data_resource(const Ref<MeshDataResource> &a);
|
2022-04-11 13:42:49 +02:00
|
|
|
void set_mesh_data_instance(MeshDataInstance *a);
|
2022-04-14 17:13:07 +02:00
|
|
|
void _unhandled_key_input(const Ref<InputEventKey> &event);
|
2022-04-11 13:42:49 +02:00
|
|
|
|
|
|
|
//Edit modes
|
|
|
|
void set_edit_mode_translate();
|
|
|
|
void set_edit_mode_rotate();
|
|
|
|
void set_edit_mode_scale();
|
|
|
|
|
|
|
|
void on_edit_mode_translate_toggled(bool on);
|
|
|
|
void on_edit_mode_rotate_toggled(bool on);
|
|
|
|
void on_edit_mode_scale_toggled(bool on);
|
|
|
|
|
|
|
|
//axis locks
|
|
|
|
bool get_axis_x();
|
|
|
|
bool get_axis_y();
|
|
|
|
bool get_axis_z();
|
|
|
|
void set_axis_x(bool on);
|
|
|
|
void set_axis_y(bool on);
|
|
|
|
void set_axis_z(bool on);
|
|
|
|
|
|
|
|
void on_axis_x_toggled(bool on);
|
|
|
|
void on_axis_y_toggled(bool on);
|
|
|
|
void on_axis_z_toggled(bool on);
|
|
|
|
|
|
|
|
//selection modes
|
|
|
|
void on_selection_mode_vertex_toggled(bool on);
|
|
|
|
void on_selection_mode_edge_toggled(bool on);
|
|
|
|
void on_selection_mode_face_toggled(bool on);
|
|
|
|
|
|
|
|
void set_selection_mode_vertex();
|
|
|
|
void set_selection_mode_edge();
|
|
|
|
void set_selection_mode_face();
|
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
void on_handle_selection_type_front_toggled(bool on);
|
|
|
|
void on_handle_selection_type_back_toggled(bool on);
|
|
|
|
void on_handle_selection_type_all_toggled(bool on);
|
|
|
|
|
|
|
|
void on_select_all_pressed();
|
|
|
|
|
|
|
|
//Vertex ops
|
|
|
|
void on_create_face_pressed();
|
|
|
|
void on_split_pressed();
|
|
|
|
void on_connect_to_first_selected_pressed();
|
|
|
|
void on_connect_to_avg_pressed();
|
|
|
|
void on_connect_to_last_selected_pressed();
|
|
|
|
|
|
|
|
//Edge ops
|
|
|
|
void on_extrude_pressed();
|
|
|
|
void on_add_triangle_at_pressed();
|
|
|
|
void on_add_quad_at_pressed();
|
|
|
|
void on_mark_seam_pressed();
|
|
|
|
void on_unmark_seam_pressed();
|
|
|
|
|
|
|
|
//Face ops
|
|
|
|
void on_delete_pressed();
|
|
|
|
void on_flip_face_pressed();
|
2022-04-11 13:42:49 +02:00
|
|
|
|
|
|
|
void on_pivot_average_toggled(bool on);
|
|
|
|
void on_pivot_mdi_origin_toggled(bool on);
|
|
|
|
void on_pivot_world_origin_toggled(bool on);
|
2022-04-13 22:22:40 +02:00
|
|
|
|
2022-04-11 13:42:49 +02:00
|
|
|
void on_visual_indicator_outline_toggled(bool on);
|
|
|
|
void on_visual_indicator_seam_toggled(bool on);
|
|
|
|
void on_visual_indicator_handle_toggled(bool on);
|
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
//Ops
|
|
|
|
void on_generate_normals_pressed();
|
|
|
|
void on_generate_tangents_pressed();
|
|
|
|
|
|
|
|
void on_remove_doubles_pressed();
|
|
|
|
void on_merge_optimize_pressed();
|
|
|
|
void on_clean_mesh_pressed();
|
2022-04-11 13:42:49 +02:00
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
void on_uv_edit_pressed();
|
|
|
|
void on_apply_seams_pressed();
|
|
|
|
void on_unwrap_button_pressed();
|
|
|
|
|
|
|
|
void on_add_box_pressed();
|
|
|
|
void on_add_triangle_pressed();
|
|
|
|
void on_add_quad_pressed();
|
|
|
|
|
|
|
|
void _on_disconnect_pressed();
|
2022-04-11 13:42:49 +02:00
|
|
|
|
|
|
|
MDIEd();
|
|
|
|
~MDIEd();
|
|
|
|
|
2022-04-13 02:08:30 +02:00
|
|
|
MDIEdPlugin *_plugin;
|
2022-04-11 13:42:49 +02:00
|
|
|
|
2022-04-13 20:39:17 +02:00
|
|
|
MDREdUVPreviewer *uv_preview;
|
|
|
|
MDRUVRectEditorPopup *uv_editor;
|
2022-04-11 13:42:49 +02:00
|
|
|
|
2022-04-13 22:22:40 +02:00
|
|
|
VBoxContainer *vertex_operations_container;
|
|
|
|
VBoxContainer *edge_operations_container;
|
|
|
|
VBoxContainer *face_operations_container;
|
|
|
|
|
|
|
|
Button *_edit_mode_translate_button;
|
|
|
|
Button *_edit_mode_rotate_button;
|
|
|
|
Button *_edit_mode_scale_button;
|
|
|
|
|
|
|
|
Button *_axis_lock_x_button;
|
|
|
|
Button *_axis_lock_y_button;
|
|
|
|
Button *_axis_lock_z_button;
|
|
|
|
|
|
|
|
Button *_selection_mode_vertex_button;
|
|
|
|
Button *_selection_mode_edge_button;
|
|
|
|
Button *_selection_mode_face_button;
|
|
|
|
|
2022-08-20 01:33:02 +02:00
|
|
|
Button *_edit_mode_button;
|
|
|
|
|
2022-04-11 13:42:49 +02:00
|
|
|
protected:
|
2022-08-20 01:33:02 +02:00
|
|
|
void _notification(int p_what);
|
2022-04-11 13:42:49 +02:00
|
|
|
static void _bind_methods();
|
2022-08-20 01:33:02 +02:00
|
|
|
|
|
|
|
void _edit_mode_toggled(const bool pressed);
|
|
|
|
|
|
|
|
bool _editing;
|
2022-04-11 13:42:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|