Added an editor plugin to be able to add a few tools into the tools menu. Disabled for now/.

This commit is contained in:
Relintai 2020-04-13 19:15:07 +02:00
parent cc4c5edc91
commit 12b47f822d
4 changed files with 99 additions and 0 deletions

2
SCsub
View File

@ -117,6 +117,8 @@ sources = [
"singletons/profile_manager.cpp",
"singletons/entity_data_manager.cpp",
"editor/ess_editor_plugin.cpp",
]
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':

View File

@ -0,0 +1,40 @@
/*
Copyright (c) 2020 Péter Magyar
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.
*/
#include "ess_editor_plugin.h"
void ESSEditorPlugin::fix_ids(Variant param) {
}
ESSEditorPlugin::ESSEditorPlugin(EditorNode *p_node) {
editor = p_node;
editor->add_tool_menu_item("ESS: make ids unique", this, "fix_ids");
}
ESSEditorPlugin::~ESSEditorPlugin() {
}
void ESSEditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("fix_ids"), &ESSEditorPlugin::fix_ids);
}

View File

@ -0,0 +1,51 @@
/*
Copyright (c) 2020 Péter Magyar
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.
*/
#ifndef ESS_EDITOR_PLUGIN_H
#define ESS_EDITOR_PLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "core/version.h"
class ESSEditorPlugin : public EditorPlugin {
GDCLASS(ESSEditorPlugin, EditorPlugin);
EditorNode *editor;
protected:
static void _bind_methods();
public:
virtual String get_name() const { return "ESSEditorPlugin"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object) {}
virtual bool handles(Object *p_object) const { return false; }
virtual void make_visible(bool p_visible) {}
void fix_ids(Variant param);
ESSEditorPlugin(EditorNode *p_node);
~ESSEditorPlugin();
};
#endif

View File

@ -133,6 +133,8 @@ SOFTWARE.
#include "singletons/profile_manager.h"
#include "editor/ess_editor_plugin.h"
static EntityDataManager *entity_data_manager = NULL;
static ProfileManager *profile_manager = NULL;
@ -267,6 +269,10 @@ void register_entity_spell_system_types() {
profile_manager = memnew(ProfileManager);
ClassDB::register_class<ProfileManager>();
Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_instance()));
#ifdef TOOLS_ENABLED
//EditorPlugins::add_by_type<ESSEditorPlugin>();
#endif
}
void unregister_entity_spell_system_types() {