mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-05-09 22:41:39 +02:00
Added an editor plugin to be able to add a few tools into the tools menu. Disabled for now/.
This commit is contained in:
parent
cc4c5edc91
commit
12b47f822d
2
SCsub
2
SCsub
@ -117,6 +117,8 @@ sources = [
|
|||||||
|
|
||||||
"singletons/profile_manager.cpp",
|
"singletons/profile_manager.cpp",
|
||||||
"singletons/entity_data_manager.cpp",
|
"singletons/entity_data_manager.cpp",
|
||||||
|
|
||||||
|
"editor/ess_editor_plugin.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||||
|
40
editor/ess_editor_plugin.cpp
Normal file
40
editor/ess_editor_plugin.cpp
Normal 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);
|
||||||
|
}
|
51
editor/ess_editor_plugin.h
Normal file
51
editor/ess_editor_plugin.h
Normal 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
|
@ -133,6 +133,8 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "singletons/profile_manager.h"
|
#include "singletons/profile_manager.h"
|
||||||
|
|
||||||
|
#include "editor/ess_editor_plugin.h"
|
||||||
|
|
||||||
static EntityDataManager *entity_data_manager = NULL;
|
static EntityDataManager *entity_data_manager = NULL;
|
||||||
static ProfileManager *profile_manager = NULL;
|
static ProfileManager *profile_manager = NULL;
|
||||||
|
|
||||||
@ -267,6 +269,10 @@ void register_entity_spell_system_types() {
|
|||||||
profile_manager = memnew(ProfileManager);
|
profile_manager = memnew(ProfileManager);
|
||||||
ClassDB::register_class<ProfileManager>();
|
ClassDB::register_class<ProfileManager>();
|
||||||
Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_instance()));
|
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() {
|
void unregister_entity_spell_system_types() {
|
||||||
|
Loading…
Reference in New Issue
Block a user