Fix the mesh library editor plugin, and cleanups.

This commit is contained in:
Relintai 2022-10-08 20:57:38 +02:00
parent be5795add2
commit d8f00dc1b4
9 changed files with 44 additions and 22 deletions

View File

@ -5,5 +5,10 @@ Import("env_modules")
env_gridmap = env_modules.Clone()
# Godot source files
env_gridmap.add_source_files(env.modules_sources, "*.cpp")
env_gridmap.add_source_files(env.modules_sources, "grid_map.cpp")
env_gridmap.add_source_files(env.modules_sources, "mesh_library.cpp")
env_gridmap.add_source_files(env.modules_sources, "register_types.cpp")
if env["tools"]:
env_gridmap.add_source_files(env.modules_sources, "grid_map_editor_plugin.cpp")
env_gridmap.add_source_files(env.modules_sources, "mesh_library_editor_plugin.cpp")

View File

@ -1,5 +1,5 @@
def can_build(env, platform):
return False
return True
def configure(env):

View File

@ -1,3 +1,6 @@
#ifndef GRID_MAP_H
#define GRID_MAP_H
/*************************************************************************/
/* grid_map.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GRID_MAP_H
#define GRID_MAP_H
#include "scene/3d/navigation.h"
#include "scene/3d/spatial.h"
#include "mesh_library.h"

View File

@ -1,3 +1,6 @@
#ifndef GRID_MAP_EDITOR_PLUGIN_H
#define GRID_MAP_EDITOR_PLUGIN_H
/*************************************************************************/
/* grid_map_editor_plugin.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GRID_MAP_EDITOR_PLUGIN_H
#define GRID_MAP_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/box_container.h"

View File

@ -1,3 +1,6 @@
#ifndef MESH_LIBRARY_H
#define MESH_LIBRARY_H
/*************************************************************************/
/* mesh_library.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef MESH_LIBRARY_H
#define MESH_LIBRARY_H
#include "core/containers/map.h"
#include "core/object/resource.h"
#include "scene/resources/mesh.h"

View File

@ -38,7 +38,17 @@
#include "scene/3d/physics_body.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
#include "spatial_editor_plugin.h"
#include "editor/plugins/spatial_editor_plugin.h"
#include "scene/gui/popup_menu.h"
#include "scene/gui/menu_button.h"
#include "editor/editor_inspector.h"
#include "editor/editor_file_dialog.h"
#include "mesh_library.h"
#include "scene/resources/navigation_mesh.h"
void MeshLibraryEditor::edit(const Ref<MeshLibrary> &p_mesh_library) {
mesh_library = p_mesh_library;
@ -275,7 +285,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
SpatialEditor::get_singleton()->add_control_to_menu_panel(menu);
menu->set_position(Point2(1, 1));
menu->set_text(TTR("MeshLibrary"));
menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshLibrary", "EditorIcons"));
menu->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("MeshLibrary", "EditorIcons"));
menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM);
menu->get_popup()->add_item(TTR("Remove Selected Item"), MENU_OPTION_REMOVE_ITEM);
menu->get_popup()->add_separator();

View File

@ -1,3 +1,6 @@
#ifndef MESH_LIBRARY_EDITOR_PLUGIN_H
#define MESH_LIBRARY_EDITOR_PLUGIN_H
/*************************************************************************/
/* mesh_library_editor_plugin.h */
/*************************************************************************/
@ -28,11 +31,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef MESH_LIBRARY_EDITOR_PLUGIN_H
#define MESH_LIBRARY_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "scene/resources/mesh_library.h"
#include "editor/editor_plugin.h"
class MeshLibrary;
class MeshLibraryEditor : public Control {
GDCLASS(MeshLibraryEditor, Control);

View File

@ -32,8 +32,12 @@
#ifndef _3D_DISABLED
#include "core/object/class_db.h"
#include "grid_map.h"
#include "grid_map_editor_plugin.h"
#include "mesh_library.h"
#ifdef TOOLS_ENABLED
#include "mesh_library_editor_plugin.h"
#include "grid_map_editor_plugin.h"
#endif
#endif
void register_gridmap_types() {
@ -42,6 +46,7 @@ void register_gridmap_types() {
ClassDB::register_class<MeshLibrary>();
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<GridMapEditorPlugin>();
EditorPlugins::add_by_type<MeshLibraryEditorPlugin>();
#endif
#endif
}

View File

@ -1,3 +1,6 @@
#ifndef GRIDMAP_REGISTER_TYPES_H
#define GRIDMAP_REGISTER_TYPES_H
/*************************************************************************/
/* register_types.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef GRIDMAP_REGISTER_TYPES_H
#define GRIDMAP_REGISTER_TYPES_H
void register_gridmap_types();
void unregister_gridmap_types();