2014-10-12 05:13:22 +00:00
|
|
|
#ifndef MESH_EDITOR_PLUGIN_H
|
|
|
|
#define MESH_EDITOR_PLUGIN_H
|
|
|
|
|
|
|
|
#include "tools/editor/editor_plugin.h"
|
|
|
|
#include "tools/editor/editor_node.h"
|
2016-05-23 20:10:26 +00:00
|
|
|
#include "scene/resources/material.h"
|
|
|
|
#include "scene/3d/light.h"
|
2014-10-12 05:13:22 +00:00
|
|
|
#include "scene/3d/mesh_instance.h"
|
2016-05-23 20:10:26 +00:00
|
|
|
#include "scene/3d/camera.h"
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
class MeshEditor : public Control {
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
OBJ_TYPE(MeshEditor, Control);
|
2014-10-12 05:13:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
float rot_x;
|
|
|
|
float rot_y;
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
Viewport *viewport;
|
|
|
|
MeshInstance *mesh_instance;
|
|
|
|
DirectionalLight *light1;
|
|
|
|
DirectionalLight *light2;
|
|
|
|
Camera *camera;
|
2015-11-22 23:08:50 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
Ref<Mesh> mesh;
|
2015-11-22 23:08:50 +00:00
|
|
|
|
2014-11-02 14:31:01 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
TextureButton *light_1_switch;
|
|
|
|
TextureButton *light_2_switch;
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
void _button_pressed(Node* p_button);
|
|
|
|
bool first_enter;
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
void _update_rotation();
|
2014-10-12 05:13:22 +00:00
|
|
|
protected:
|
2016-05-23 20:10:26 +00:00
|
|
|
void _notification(int p_what);
|
|
|
|
void _input_event(InputEvent p_event);
|
2014-10-12 05:13:22 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
void edit(Ref<Mesh> p_mesh);
|
|
|
|
MeshEditor();
|
2014-10-12 05:13:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
class MeshEditorPlugin : public EditorPlugin {
|
|
|
|
|
|
|
|
OBJ_TYPE( MeshEditorPlugin, EditorPlugin );
|
2014-10-12 05:13:22 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
MeshEditor *mesh_editor;
|
2014-10-12 05:13:22 +00:00
|
|
|
EditorNode *editor;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
virtual String get_name() const { return "Mesh"; }
|
2014-10-12 05:13:22 +00:00
|
|
|
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);
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
MeshEditorPlugin(EditorNode *p_node);
|
|
|
|
~MeshEditorPlugin();
|
2014-10-12 05:13:22 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MESH_EDITOR_PLUGIN_H
|