Renamed the plugin. Also removed stray print.

This commit is contained in:
Relintai 2021-09-11 20:29:34 +02:00
parent 1ab0676815
commit 96e7615e01
4 changed files with 19 additions and 28 deletions

2
SCsub
View File

@ -3,4 +3,4 @@ Import('env')
env.add_source_files(env.modules_sources,"register_types.cpp")
if env["tools"]:
env.add_source_files(env.modules_sources, "bskeleton_editor.cpp")
env.add_source_files(env.modules_sources, "skeleton_editor_plugin_remover.cpp")

View File

@ -23,12 +23,12 @@ SOFTWARE.
#include "register_types.h"
#ifdef TOOLS_ENABLED
#include "bskeleton_editor.h"
#include "skeleton_editor_plugin_remover.h"
#endif
void register_skeleton_editor_types() {
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<BSkeletonEditorPlugin>();
EditorPlugins::add_by_type<SkeletonEditorPluginRemover>();
#endif
}

View File

@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "bskeleton_editor.h"
#include "skeleton_editor_plugin_remover.h"
#include "editor/editor_data.h"
#include "editor/editor_node.h"
@ -28,18 +28,17 @@ SOFTWARE.
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
void BSkeletonEditorPlugin::edit(Object *p_object) {
void SkeletonEditorPluginRemover::edit(Object *p_object) {
}
bool BSkeletonEditorPlugin::handles(Object *p_object) const {
bool SkeletonEditorPluginRemover::handles(Object *p_object) const {
return false;
}
void BSkeletonEditorPlugin::make_visible(bool p_visible) {
void SkeletonEditorPluginRemover::make_visible(bool p_visible) {
}
void BSkeletonEditorPlugin::remove_built_in_editor_plugin() {
void SkeletonEditorPluginRemover::remove_built_in_editor_plugin() {
EditorData &data = EditorNode::get_editor_data();
for (int i = 0; i < data.get_editor_plugin_count(); ++i) {
@ -48,8 +47,6 @@ void BSkeletonEditorPlugin::remove_built_in_editor_plugin() {
if (p->is_class("SkeletonEditorPlugin")) {
EditorNode::get_singleton()->remove_editor_plugin(p);
print_error("remed");
break;
}
}
@ -62,24 +59,20 @@ void BSkeletonEditorPlugin::remove_built_in_editor_plugin() {
if (n->is_class("SkeletonEditor")) {
n->queue_delete();
print_error("quedel");
break;
}
}
}
BSkeletonEditorPlugin::BSkeletonEditorPlugin(EditorNode *p_node) {
editor = p_node;
SkeletonEditorPluginRemover::SkeletonEditorPluginRemover(EditorNode *p_node) {
//note calling remove_built_int_editor_plugin here, or in code before this will cause a crash because
//not all classes that are used in EditorNode::get_singleton()->remove_editor_plugin() initialized yet!
call_deferred("remove_built_in_editor_plugin");
}
BSkeletonEditorPlugin::~BSkeletonEditorPlugin() {
SkeletonEditorPluginRemover::~SkeletonEditorPluginRemover() {
}
void BSkeletonEditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_built_in_editor_plugin"), &BSkeletonEditorPlugin::remove_built_in_editor_plugin);
void SkeletonEditorPluginRemover::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_built_in_editor_plugin"), &SkeletonEditorPluginRemover::remove_built_in_editor_plugin);
}

View File

@ -20,23 +20,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef B_SKELETON_EDITOR_H
#define B_SKELETON_EDITOR_H
#ifndef SKELETON_EDITOR_PLUGIN_REMOVER_H
#define SKELETON_EDITOR_PLUGIN_REMOVER_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
class BSkeletonEditorPlugin : public EditorPlugin {
GDCLASS(BSkeletonEditorPlugin, EditorPlugin);
EditorNode *editor;
class SkeletonEditorPluginRemover : public EditorPlugin {
GDCLASS(SkeletonEditorPluginRemover, EditorPlugin);
protected:
static void _bind_methods();
public:
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event) { return false; }
virtual String get_name() const { return "BSkeletonEditorPlugin"; }
virtual String get_name() const { return "SkeletonEditorPluginRemover"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
@ -44,8 +42,8 @@ public:
void remove_built_in_editor_plugin();
BSkeletonEditorPlugin(EditorNode *p_node);
~BSkeletonEditorPlugin();
SkeletonEditorPluginRemover(EditorNode *p_node);
~SkeletonEditorPluginRemover();
};
#endif