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