2016-05-23 20:10:26 +00:00
|
|
|
#ifndef MESH_INSTANCE_EDITOR_PLUGIN_H
|
|
|
|
#define MESH_INSTANCE_EDITOR_PLUGIN_H
|
|
|
|
|
2017-03-18 22:45:45 +00:00
|
|
|
#include "editor/editor_node.h"
|
2017-03-18 23:36:26 +00:00
|
|
|
#include "editor/editor_plugin.h"
|
2016-05-23 20:10:26 +00:00
|
|
|
#include "scene/3d/mesh_instance.h"
|
|
|
|
#include "scene/gui/spin_box.h"
|
|
|
|
|
|
|
|
class MeshInstanceEditor : public Node {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
OBJ_TYPE(MeshInstanceEditor, Node);
|
2016-05-23 20:10:26 +00:00
|
|
|
|
|
|
|
enum Menu {
|
|
|
|
|
|
|
|
MENU_OPTION_CREATE_STATIC_TRIMESH_BODY,
|
|
|
|
MENU_OPTION_CREATE_STATIC_CONVEX_BODY,
|
|
|
|
MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE,
|
|
|
|
MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE,
|
|
|
|
MENU_OPTION_CREATE_NAVMESH,
|
|
|
|
MENU_OPTION_CREATE_OUTLINE_MESH,
|
|
|
|
};
|
|
|
|
|
|
|
|
MeshInstance *node;
|
|
|
|
|
|
|
|
MenuButton *options;
|
|
|
|
|
|
|
|
ConfirmationDialog *outline_dialog;
|
|
|
|
SpinBox *outline_size;
|
|
|
|
|
|
|
|
AcceptDialog *err_dialog;
|
|
|
|
|
|
|
|
void _menu_option(int p_option);
|
|
|
|
void _create_outline_mesh();
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
friend class MeshInstanceEditorPlugin;
|
2016-05-23 20:10:26 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void _node_removed(Node *p_node);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
public:
|
2016-05-23 20:10:26 +00:00
|
|
|
void edit(MeshInstance *p_mesh);
|
|
|
|
MeshInstanceEditor();
|
|
|
|
};
|
|
|
|
|
|
|
|
class MeshInstanceEditorPlugin : public EditorPlugin {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
OBJ_TYPE(MeshInstanceEditorPlugin, EditorPlugin);
|
2016-05-23 20:10:26 +00:00
|
|
|
|
|
|
|
MeshInstanceEditor *mesh_editor;
|
|
|
|
EditorNode *editor;
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual String get_name() const { return "MeshInstance"; }
|
|
|
|
bool has_main_screen() const { return false; }
|
|
|
|
virtual void edit(Object *p_node);
|
|
|
|
virtual bool handles(Object *p_node) const;
|
|
|
|
virtual void make_visible(bool p_visible);
|
|
|
|
|
|
|
|
MeshInstanceEditorPlugin(EditorNode *p_node);
|
|
|
|
~MeshInstanceEditorPlugin();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MESH_EDITOR_PLUGIN_H
|