2017-01-16 07:04:19 +00:00
|
|
|
/*************************************************************************/
|
2020-03-27 07:44:44 +00:00
|
|
|
/* mesh_instance_3d_editor_plugin.h */
|
2017-01-16 07:04:19 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2017-01-16 07:04:19 +00:00
|
|
|
/*************************************************************************/
|
2020-01-01 10:16:22 +00:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2017-01-16 07:04:19 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
#ifndef MESH_INSTANCE_EDITOR_PLUGIN_H
|
|
|
|
#define MESH_INSTANCE_EDITOR_PLUGIN_H
|
|
|
|
|
2017-03-05 13:21:25 +00:00
|
|
|
#include "editor/editor_node.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "editor/editor_plugin.h"
|
2020-03-26 21:49:16 +00:00
|
|
|
#include "scene/3d/mesh_instance_3d.h"
|
2016-05-23 20:10:26 +00:00
|
|
|
#include "scene/gui/spin_box.h"
|
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
class MeshInstance3DEditor : public Control {
|
2016-05-23 20:10:26 +00:00
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
GDCLASS(MeshInstance3DEditor, Control);
|
2016-05-23 20:10:26 +00:00
|
|
|
|
|
|
|
enum Menu {
|
|
|
|
|
|
|
|
MENU_OPTION_CREATE_STATIC_TRIMESH_BODY,
|
|
|
|
MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE,
|
2020-01-31 15:30:27 +00:00
|
|
|
MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE,
|
|
|
|
MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES,
|
2016-05-23 20:10:26 +00:00
|
|
|
MENU_OPTION_CREATE_NAVMESH,
|
|
|
|
MENU_OPTION_CREATE_OUTLINE_MESH,
|
2017-12-09 17:11:26 +00:00
|
|
|
MENU_OPTION_CREATE_UV2,
|
|
|
|
MENU_OPTION_DEBUG_UV1,
|
|
|
|
MENU_OPTION_DEBUG_UV2,
|
2016-05-23 20:10:26 +00:00
|
|
|
};
|
|
|
|
|
2020-03-26 21:49:16 +00:00
|
|
|
MeshInstance3D *node;
|
2016-05-23 20:10:26 +00:00
|
|
|
|
|
|
|
MenuButton *options;
|
|
|
|
|
|
|
|
ConfirmationDialog *outline_dialog;
|
|
|
|
SpinBox *outline_size;
|
|
|
|
|
|
|
|
AcceptDialog *err_dialog;
|
|
|
|
|
2017-12-09 17:11:26 +00:00
|
|
|
AcceptDialog *debug_uv_dialog;
|
|
|
|
Control *debug_uv;
|
|
|
|
Vector<Vector2> uv_lines;
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
void _menu_option(int p_option);
|
|
|
|
void _create_outline_mesh();
|
|
|
|
|
2017-12-09 17:11:26 +00:00
|
|
|
void _create_uv_lines(int p_layer);
|
2020-03-27 07:44:44 +00:00
|
|
|
friend class MeshInstance3DEditorPlugin;
|
2016-05-23 20:10:26 +00:00
|
|
|
|
2017-12-09 17:11:26 +00:00
|
|
|
void _debug_uv_draw();
|
|
|
|
|
2016-05-23 20:10:26 +00:00
|
|
|
protected:
|
|
|
|
void _node_removed(Node *p_node);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
2020-03-26 21:49:16 +00:00
|
|
|
void edit(MeshInstance3D *p_mesh);
|
2020-03-27 07:44:44 +00:00
|
|
|
MeshInstance3DEditor();
|
2016-05-23 20:10:26 +00:00
|
|
|
};
|
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
class MeshInstance3DEditorPlugin : public EditorPlugin {
|
2016-05-23 20:10:26 +00:00
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
GDCLASS(MeshInstance3DEditorPlugin, EditorPlugin);
|
2016-05-23 20:10:26 +00:00
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
MeshInstance3DEditor *mesh_editor;
|
2016-05-23 20:10:26 +00:00
|
|
|
EditorNode *editor;
|
|
|
|
|
|
|
|
public:
|
2020-03-26 21:49:16 +00:00
|
|
|
virtual String get_name() const { return "MeshInstance3D"; }
|
2016-05-23 20:10:26 +00:00
|
|
|
bool has_main_screen() const { return false; }
|
2017-08-12 16:52:50 +00:00
|
|
|
virtual void edit(Object *p_object);
|
|
|
|
virtual bool handles(Object *p_object) const;
|
2016-05-23 20:10:26 +00:00
|
|
|
virtual void make_visible(bool p_visible);
|
|
|
|
|
2020-03-27 07:44:44 +00:00
|
|
|
MeshInstance3DEditorPlugin(EditorNode *p_node);
|
|
|
|
~MeshInstance3DEditorPlugin();
|
2016-05-23 20:10:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MESH_EDITOR_PLUGIN_H
|