1 | /**************************************************************************/ |
2 | /* mesh_instance_3d_editor_plugin.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef MESH_INSTANCE_3D_EDITOR_PLUGIN_H |
32 | #define MESH_INSTANCE_3D_EDITOR_PLUGIN_H |
33 | |
34 | #include "editor/editor_plugin.h" |
35 | #include "scene/3d/mesh_instance_3d.h" |
36 | |
37 | class AcceptDialog; |
38 | class ConfirmationDialog; |
39 | class ; |
40 | class SpinBox; |
41 | |
42 | class MeshInstance3DEditor : public Control { |
43 | GDCLASS(MeshInstance3DEditor, Control); |
44 | |
45 | enum { |
46 | MENU_OPTION_CREATE_STATIC_TRIMESH_BODY, |
47 | , |
48 | , |
49 | , |
50 | , |
51 | , |
52 | , |
53 | , |
54 | , |
55 | , |
56 | , |
57 | }; |
58 | |
59 | MeshInstance3D *node = nullptr; |
60 | |
61 | MenuButton *options = nullptr; |
62 | |
63 | ConfirmationDialog *outline_dialog = nullptr; |
64 | SpinBox *outline_size = nullptr; |
65 | |
66 | AcceptDialog *err_dialog = nullptr; |
67 | |
68 | AcceptDialog *debug_uv_dialog = nullptr; |
69 | Control *debug_uv = nullptr; |
70 | Vector<Vector2> uv_lines; |
71 | |
72 | void (int p_option); |
73 | void _create_outline_mesh(); |
74 | |
75 | void _create_uv_lines(int p_layer); |
76 | friend class MeshInstance3DEditorPlugin; |
77 | |
78 | void _debug_uv_draw(); |
79 | |
80 | protected: |
81 | void _node_removed(Node *p_node); |
82 | |
83 | void _notification(int p_what); |
84 | |
85 | public: |
86 | void edit(MeshInstance3D *p_mesh); |
87 | MeshInstance3DEditor(); |
88 | }; |
89 | |
90 | class MeshInstance3DEditorPlugin : public EditorPlugin { |
91 | GDCLASS(MeshInstance3DEditorPlugin, EditorPlugin); |
92 | |
93 | MeshInstance3DEditor *mesh_editor = nullptr; |
94 | |
95 | public: |
96 | virtual String get_name() const override { return "MeshInstance3D" ; } |
97 | bool has_main_screen() const override { return false; } |
98 | virtual void edit(Object *p_object) override; |
99 | virtual bool handles(Object *p_object) const override; |
100 | virtual void make_visible(bool p_visible) override; |
101 | |
102 | MeshInstance3DEditorPlugin(); |
103 | ~MeshInstance3DEditorPlugin(); |
104 | }; |
105 | |
106 | #endif // MESH_INSTANCE_3D_EDITOR_PLUGIN_H |
107 | |