1 #ifndef MESH_INSTANCE_EDITOR_PLUGIN_H
2 #define MESH_INSTANCE_EDITOR_PLUGIN_H
3 
4 #include "editor/editor_node.h"
5 #include "editor/editor_plugin.h"
6 #include "scene/3d/mesh_instance.h"
7 #include "scene/gui/spin_box.h"
8 
9 class MeshInstanceEditor : public Node {
10 
11 	OBJ_TYPE(MeshInstanceEditor, Node);
12 
13 	enum Menu {
14 
15 		MENU_OPTION_CREATE_STATIC_TRIMESH_BODY,
16 		MENU_OPTION_CREATE_STATIC_CONVEX_BODY,
17 		MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE,
18 		MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE,
19 		MENU_OPTION_CREATE_NAVMESH,
20 		MENU_OPTION_CREATE_OUTLINE_MESH,
21 	};
22 
23 	MeshInstance *node;
24 
25 	MenuButton *options;
26 
27 	ConfirmationDialog *outline_dialog;
28 	SpinBox *outline_size;
29 
30 	AcceptDialog *err_dialog;
31 
32 	void _menu_option(int p_option);
33 	void _create_outline_mesh();
34 
35 	friend class MeshInstanceEditorPlugin;
36 
37 protected:
38 	void _node_removed(Node *p_node);
39 	static void _bind_methods();
40 
41 public:
42 	void edit(MeshInstance *p_mesh);
43 	MeshInstanceEditor();
44 };
45 
46 class MeshInstanceEditorPlugin : public EditorPlugin {
47 
48 	OBJ_TYPE(MeshInstanceEditorPlugin, EditorPlugin);
49 
50 	MeshInstanceEditor *mesh_editor;
51 	EditorNode *editor;
52 
53 public:
get_name()54 	virtual String get_name() const { return "MeshInstance"; }
has_main_screen()55 	bool has_main_screen() const { return false; }
56 	virtual void edit(Object *p_node);
57 	virtual bool handles(Object *p_node) const;
58 	virtual void make_visible(bool p_visible);
59 
60 	MeshInstanceEditorPlugin(EditorNode *p_node);
61 	~MeshInstanceEditorPlugin();
62 };
63 
64 #endif // MESH_EDITOR_PLUGIN_H
65