Cleaned up the editor plugin.

This commit is contained in:
Relintai 2022-07-15 22:35:29 +02:00
parent 573011b373
commit 5444e99213
2 changed files with 20 additions and 21 deletions

View File

@ -20,38 +20,37 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "paint_editor_plugin.h" #include "text_editor_plugin.h"
#include "paint_window.h" #include "text_file_editor.h"
void PaintEditorPlugin::make_visible(const bool visible) { void TextEditorEditorPlugin::make_visible(const bool visible) {
window->set_visible(visible); window->set_visible(visible);
} }
String PaintEditorPlugin::get_name() const { String TextEditorEditorPlugin::get_name() const {
return "Paint"; return "Text";
} }
const Ref<Texture> PaintEditorPlugin::get_icon() const { const Ref<Texture> TextEditorEditorPlugin::get_icon() const {
return _icon; return _icon;
} }
bool PaintEditorPlugin::has_main_screen() const { bool TextEditorEditorPlugin::has_main_screen() const {
return true; return true;
} }
PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) { TextEditorEditorPlugin::TextEditorEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
window = memnew(PaintWindow); window = memnew(TextFileEditor);
get_editor_interface()->get_editor_viewport()->add_child(window); get_editor_interface()->get_editor_viewport()->add_child(window);
window->set_owner(get_editor_interface()->get_editor_viewport());
make_visible(false); make_visible(false);
_icon = get_editor_interface()->get_base_control()->get_icon("CanvasModulate", "EditorIcons"); _icon = get_editor_interface()->get_base_control()->get_icon("CanvasModulate", "EditorIcons");
} }
PaintEditorPlugin::~PaintEditorPlugin() { TextEditorEditorPlugin::~TextEditorEditorPlugin() {
} }
void PaintEditorPlugin::_bind_methods() { void TextEditorEditorPlugin::_bind_methods() {
} }

View File

@ -1,5 +1,5 @@
#ifndef PAINT_EDITOR__PLUGIN_H #ifndef TEXT_EDITOR_EDITOR_PLUGIN_H
#define PAINT_EDITOR__PLUGIN_H #define TEXT_EDITOR_EDITOR_PLUGIN_H
/* /*
Copyright (c) 2019-2022 Péter Magyar Copyright (c) 2019-2022 Péter Magyar
@ -23,14 +23,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "editor/editor_plugin.h"
#include "core/reference.h" #include "core/reference.h"
#include "editor/editor_plugin.h"
class PaintWindow; class TextFileEditor;
class Texture; class Texture;
class PaintEditorPlugin : public EditorPlugin { class TextEditorEditorPlugin : public EditorPlugin {
GDCLASS(PaintEditorPlugin, EditorPlugin); GDCLASS(TextEditorEditorPlugin, EditorPlugin);
public: public:
void make_visible(const bool visible); void make_visible(const bool visible);
@ -38,12 +38,12 @@ public:
bool has_main_screen() const; bool has_main_screen() const;
String get_name() const; String get_name() const;
PaintEditorPlugin(EditorNode *p_node); TextEditorEditorPlugin(EditorNode *p_node);
~PaintEditorPlugin(); ~TextEditorEditorPlugin();
EditorNode *editor; EditorNode *editor;
PaintWindow *window; TextFileEditor *window;
protected: protected:
static void _bind_methods(); static void _bind_methods();