Added a new paint editor plugin, and renamed the old temporarily.

This commit is contained in:
Relintai 2022-11-15 16:53:37 +01:00
parent 94b5ac9267
commit 14c503a41b
6 changed files with 114 additions and 21 deletions

View File

@ -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")

View File

@ -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<Texture> 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() {

View File

@ -34,8 +34,6 @@ class PaintEditorPlugin : public EditorPlugin {
public:
void make_visible(const bool visible);
const Ref<Texture> 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<Texture> _icon;
};
#endif

View File

@ -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<Texture> 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() {
}

View File

@ -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<Texture> 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<Texture> _icon;
};
#endif

View File

@ -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<PaintEditorPlugin>();
EditorPlugins::add_by_type<PaintEditorPluginOld>();
#endif
}