From 14c503a41b07b35826a7bbd47cbbd5e0a5f849c9 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 15 Nov 2022 16:53:37 +0100 Subject: [PATCH] Added a new paint editor plugin, and renamed the old temporarily. --- modules/paint/SCsub | 1 + modules/paint/paint_editor_plugin.cpp | 15 ------ modules/paint/paint_editor_plugin.h | 6 --- modules/paint/paint_editor_plugin_old.cpp | 57 +++++++++++++++++++++++ modules/paint/paint_editor_plugin_old.h | 54 +++++++++++++++++++++ modules/paint/register_types.cpp | 2 + 6 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 modules/paint/paint_editor_plugin_old.cpp create mode 100644 modules/paint/paint_editor_plugin_old.h diff --git a/modules/paint/SCsub b/modules/paint/SCsub index 384256764..b781d55ca 100644 --- a/modules/paint/SCsub +++ b/modules/paint/SCsub @@ -46,3 +46,4 @@ module_env.add_source_files(env.modules_sources,"deprecated/paint_settings.cpp") if 'TOOLS_ENABLED' in env["CPPDEFINES"]: module_env.add_source_files(env.modules_sources,"paint_editor_plugin.cpp") + module_env.add_source_files(env.modules_sources,"paint_editor_plugin_old.cpp") diff --git a/modules/paint/paint_editor_plugin.cpp b/modules/paint/paint_editor_plugin.cpp index 0b3197418..ab3ad1212 100644 --- a/modules/paint/paint_editor_plugin.cpp +++ b/modules/paint/paint_editor_plugin.cpp @@ -22,32 +22,17 @@ SOFTWARE. #include "paint_editor_plugin.h" -#include "deprecated/paint_window.h" - void PaintEditorPlugin::make_visible(const bool visible) { - window->set_visible(visible); } String PaintEditorPlugin::get_name() const { return "Paint"; } -const Ref PaintEditorPlugin::get_icon() const { - return _icon; -} -bool PaintEditorPlugin::has_main_screen() const { - return true; -} - PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) { editor = p_node; - window = memnew(PaintWindow); - - get_editor_interface()->get_editor_viewport()->add_child(window); - window->set_owner(get_editor_interface()->get_editor_viewport()); make_visible(false); - _icon = get_editor_interface()->get_base_control()->get_theme_icon("CanvasModulate", "EditorIcons"); } PaintEditorPlugin::~PaintEditorPlugin() { diff --git a/modules/paint/paint_editor_plugin.h b/modules/paint/paint_editor_plugin.h index 4730ea065..7114373be 100644 --- a/modules/paint/paint_editor_plugin.h +++ b/modules/paint/paint_editor_plugin.h @@ -34,8 +34,6 @@ class PaintEditorPlugin : public EditorPlugin { public: void make_visible(const bool visible); - const Ref get_icon() const; - bool has_main_screen() const; String get_name() const; PaintEditorPlugin(EditorNode *p_node); @@ -43,12 +41,8 @@ public: EditorNode *editor; - PaintWindow *window; - protected: static void _bind_methods(); - - Ref _icon; }; #endif diff --git a/modules/paint/paint_editor_plugin_old.cpp b/modules/paint/paint_editor_plugin_old.cpp new file mode 100644 index 000000000..f68e82b76 --- /dev/null +++ b/modules/paint/paint_editor_plugin_old.cpp @@ -0,0 +1,57 @@ +/* +Copyright (c) 2019-2022 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 "paint_editor_plugin_old.h" + +#include "deprecated/paint_window.h" + +void PaintEditorPluginOld::make_visible(const bool visible) { + window->set_visible(visible); +} + +String PaintEditorPluginOld::get_name() const { + return "Paint"; +} + +const Ref PaintEditorPluginOld::get_icon() const { + return _icon; +} +bool PaintEditorPluginOld::has_main_screen() const { + return true; +} + +PaintEditorPluginOld::PaintEditorPluginOld(EditorNode *p_node) { + editor = p_node; + + window = memnew(PaintWindow); + + get_editor_interface()->get_editor_viewport()->add_child(window); + window->set_owner(get_editor_interface()->get_editor_viewport()); + make_visible(false); + _icon = get_editor_interface()->get_base_control()->get_theme_icon("CanvasModulate", "EditorIcons"); +} + +PaintEditorPluginOld::~PaintEditorPluginOld() { +} + +void PaintEditorPluginOld::_bind_methods() { +} diff --git a/modules/paint/paint_editor_plugin_old.h b/modules/paint/paint_editor_plugin_old.h new file mode 100644 index 000000000..da7ae0c99 --- /dev/null +++ b/modules/paint/paint_editor_plugin_old.h @@ -0,0 +1,54 @@ +#ifndef PAINT_EDITOR_PLUGIN_OLD_H +#define PAINT_EDITOR_PLUGIN_OLD_H + +/* +Copyright (c) 2019-2022 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 "editor/editor_plugin.h" +#include "core/object/reference.h" + +class PaintWindow; +class Texture; + +class PaintEditorPluginOld : public EditorPlugin { + GDCLASS(PaintEditorPluginOld, EditorPlugin); + +public: + void make_visible(const bool visible); + const Ref get_icon() const; + bool has_main_screen() const; + String get_name() const; + + PaintEditorPluginOld(EditorNode *p_node); + ~PaintEditorPluginOld(); + + EditorNode *editor; + + PaintWindow *window; + +protected: + static void _bind_methods(); + + Ref _icon; +}; + +#endif diff --git a/modules/paint/register_types.cpp b/modules/paint/register_types.cpp index 8b89e68e7..887c9b1d0 100644 --- a/modules/paint/register_types.cpp +++ b/modules/paint/register_types.cpp @@ -50,6 +50,7 @@ SOFTWARE. #ifdef TOOLS_ENABLED #include "paint_editor_plugin.h" +#include "paint_editor_plugin_old.h" #endif void register_paint_types() { @@ -81,6 +82,7 @@ void register_paint_types() { #ifdef TOOLS_ENABLED EditorPlugins::add_by_type(); + EditorPlugins::add_by_type(); #endif }