mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-05 18:39:35 +01:00
Implemented the paint editor plugin. Also reimplemented PaintWindow's ui.
This commit is contained in:
parent
79aa630959
commit
e540e4e414
@ -6,8 +6,6 @@ module_env = env.Clone()
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"register_types.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"paint_utilities.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"actions/paint_action.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"actions/brighten_action.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"actions/brush_action.cpp")
|
||||
@ -38,7 +36,6 @@ module_env.add_source_files(env.modules_sources,"paint_layer_button.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"paint_navbar.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"paint_selection_box.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"paint_settings.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"paint_text_info.cpp")
|
||||
module_env.add_source_files(env.modules_sources,"paint_utilities.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"paint_visual_grid.cpp")
|
||||
|
@ -32,6 +32,11 @@ void PaintColorGrid::change_color_to(const Color &color) {
|
||||
}
|
||||
void PaintColorGrid::add_color_prefab(const Color &color) {
|
||||
Button *button = memnew(Button);
|
||||
|
||||
button->set_custom_minimum_size(Size2(25, 25));
|
||||
button->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
button->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
add_child(button);
|
||||
move_child(button, 0);
|
||||
|
||||
|
@ -22,11 +22,10 @@ SOFTWARE.
|
||||
|
||||
#include "paint_editor_plugin.h"
|
||||
|
||||
#include "paint_window.h"
|
||||
|
||||
void PaintEditorPlugin::make_visible(const bool visible) {
|
||||
/*
|
||||
if editor_scene:
|
||||
editor_scene.visible = visible
|
||||
*/
|
||||
window->set_visible(visible);
|
||||
}
|
||||
|
||||
String PaintEditorPlugin::get_name() const {
|
||||
@ -34,10 +33,7 @@ String PaintEditorPlugin::get_name() const {
|
||||
}
|
||||
|
||||
const Ref<Texture> PaintEditorPlugin::get_icon() const {
|
||||
// Must return some kind of Texture for the icon.
|
||||
//return get_editor_interface().get_base_control().get_icon("CanvasModulate", "EditorIcons")
|
||||
|
||||
return Ref<Texture>();
|
||||
return _icon;
|
||||
}
|
||||
bool PaintEditorPlugin::has_main_screen() const {
|
||||
return true;
|
||||
@ -46,16 +42,12 @@ bool PaintEditorPlugin::has_main_screen() const {
|
||||
PaintEditorPlugin::PaintEditorPlugin(EditorNode *p_node) {
|
||||
editor = p_node;
|
||||
|
||||
/*
|
||||
editor_scene.name = "Editor"
|
||||
if get_editor_interface().get_editor_viewport().has_node("Editor"):
|
||||
var n = get_editor_interface().get_editor_viewport().get_node("Editor")
|
||||
n.name = "EditorDel"
|
||||
n.queue_free()
|
||||
get_editor_interface().get_editor_viewport().add_child(editor_scene, true)
|
||||
editor_scene.owner = get_editor_interface().get_editor_viewport()
|
||||
make_visible(false)
|
||||
*/
|
||||
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_icon("CanvasModulate", "EditorIcons");
|
||||
}
|
||||
|
||||
PaintEditorPlugin::~PaintEditorPlugin() {
|
||||
|
@ -24,6 +24,10 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "editor/editor_plugin.h"
|
||||
#include "core/reference.h"
|
||||
|
||||
class PaintWindow;
|
||||
class Texture;
|
||||
|
||||
class PaintEditorPlugin : public EditorPlugin {
|
||||
GDCLASS(PaintEditorPlugin, EditorPlugin);
|
||||
@ -39,10 +43,12 @@ public:
|
||||
|
||||
EditorNode *editor;
|
||||
|
||||
//var editor_scene = load("res://addons/Godoxel/Editor.tscn").instance()
|
||||
PaintWindow *window;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<Texture> _icon;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -24,29 +24,29 @@ SOFTWARE.
|
||||
|
||||
#include "paint_settings.h"
|
||||
|
||||
void PaintTextInfo::_enter_tree() {
|
||||
void PaintSettings::_enter_tree() {
|
||||
/*
|
||||
canvas_outline = get_parent().find_node("CanvasOutline")
|
||||
editor = get_parent()
|
||||
*/
|
||||
}
|
||||
void PaintTextInfo::_on_ColorPickerButton_color_changed(const Color &color) {
|
||||
void PaintSettings::_on_ColorPickerButton_color_changed(const Color &color) {
|
||||
/*
|
||||
canvas_outline.color = color
|
||||
*/
|
||||
}
|
||||
void PaintTextInfo::_on_CheckButton_toggled(const bool button_pressed) {
|
||||
void PaintSettings::_on_CheckButton_toggled(const bool button_pressed) {
|
||||
/*
|
||||
canvas_outline.visible = button_pressed
|
||||
*/
|
||||
}
|
||||
void PaintTextInfo::_on_Ok_pressed() {
|
||||
void PaintSettings::_on_Ok_pressed() {
|
||||
/*
|
||||
hide()
|
||||
*/
|
||||
}
|
||||
|
||||
PaintTextInfo::PaintTextInfo() {
|
||||
PaintSettings::PaintSettings() {
|
||||
/*
|
||||
|
||||
[gd_scene load_steps=2 format=2]
|
||||
@ -118,8 +118,8 @@ margin_bottom = 20.0
|
||||
*/
|
||||
}
|
||||
|
||||
PaintTextInfo::~PaintTextInfo() {
|
||||
PaintSettings::~PaintSettings() {
|
||||
}
|
||||
|
||||
void PaintTextInfo::_bind_methods() {
|
||||
void PaintSettings::_bind_methods() {
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ SOFTWARE.
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
|
||||
class PaintTextInfo : public Control {
|
||||
GDCLASS(PaintTextInfo, Control);
|
||||
class PaintSettings : public Control {
|
||||
GDCLASS(PaintSettings, Control);
|
||||
|
||||
public:
|
||||
void _enter_tree();
|
||||
@ -36,8 +36,8 @@ public:
|
||||
void _on_CheckButton_toggled(const bool button_pressed);
|
||||
void _on_Ok_pressed();
|
||||
|
||||
PaintTextInfo();
|
||||
~PaintTextInfo();
|
||||
PaintSettings();
|
||||
~PaintSettings();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019 Flairieve
|
||||
Copyright (c) 2020-2022 cobrapitz
|
||||
Copyright (c) 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_text_info.h"
|
||||
|
||||
//TODO: To make reading the text easier, the text info with the longest text should have it's length applied to all the
|
||||
//the other text infos
|
||||
|
||||
void PaintTextInfo::add_text_info(const String &text_name, Node *custom_node) {
|
||||
/*
|
||||
var last_text_info_child = null
|
||||
var child_count = get_child_count()
|
||||
if not child_count <= 0:
|
||||
last_text_info_child = get_children()[get_children().size() - 1]
|
||||
var label = Label.new()
|
||||
label.name = text_name
|
||||
label.rect_size = Vector2(size, 14)
|
||||
if not last_text_info_child == null:
|
||||
var x = last_text_info_child.rect_position.x
|
||||
var y = last_text_info_child.rect_position.y
|
||||
var temp_size = size
|
||||
if child_count == 4:
|
||||
x = 0
|
||||
y = 20
|
||||
temp_size = 0
|
||||
label.rect_position = Vector2(x + temp_size, y)
|
||||
if not custom_node == null:
|
||||
label.add_child(custom_node)
|
||||
add_child(label)
|
||||
*/
|
||||
}
|
||||
void PaintTextInfo::update_text_info(const String &text_name, Node *text_value, Node *node, Node *node_target_value, Node *node_value) {
|
||||
/*
|
||||
var text_label = self.get_node(text_name)
|
||||
if text_label == null:
|
||||
return
|
||||
if not node == null:
|
||||
get_node(text_name).get_node(node).set(node_target_value, node_value)
|
||||
if text_value == null:
|
||||
text_label.text = "%s: %s" % [text_name, null]
|
||||
else:
|
||||
text_label.text = "%s: %s" % [text_name, String(text_value)]
|
||||
*/
|
||||
}
|
||||
|
||||
PaintTextInfo::PaintTextInfo() {
|
||||
//var size = 240
|
||||
}
|
||||
|
||||
PaintTextInfo::~PaintTextInfo() {
|
||||
}
|
||||
|
||||
void PaintTextInfo::_bind_methods() {
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
#ifndef PAINT_TEXT_INFO_H
|
||||
#define PAINT_TEXT_INFO_H
|
||||
|
||||
/*
|
||||
Copyright (c) 2019 Flairieve
|
||||
Copyright (c) 2020-2022 cobrapitz
|
||||
Copyright (c) 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 "scene/gui/control.h"
|
||||
|
||||
class PaintTextInfo : public Control {
|
||||
GDCLASS(PaintTextInfo, Control);
|
||||
|
||||
public:
|
||||
void add_text_info(const String &text_name, Node *custom_node = nullptr);
|
||||
void update_text_info(const String &text_name, Node *text_value = nullptr, Node *node = nullptr, Node *node_target_value = nullptr, Node *node_value = nullptr);
|
||||
|
||||
PaintTextInfo();
|
||||
~PaintTextInfo();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//var size = 240
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because one or more lines are too long
@ -32,7 +32,23 @@ SOFTWARE.
|
||||
|
||||
class PaintAction;
|
||||
class PaintCanvasLayer;
|
||||
class PaintCanvas;
|
||||
class InputEvent;
|
||||
class PaintCanvasDialog;
|
||||
class PaintChangeGridSizeDialog;
|
||||
class PaintLoadFileDialog;
|
||||
class PaintSaveFileDialog;
|
||||
class PaintSettings;
|
||||
class RichTextLabel;
|
||||
class PaintNavbar;
|
||||
class PaintColorGrid;
|
||||
class CheckButton;
|
||||
class Label;
|
||||
class HSlider;
|
||||
class Control;
|
||||
class Button;
|
||||
class ColorPickerButton;
|
||||
class VBoxContainer;
|
||||
|
||||
class PaintWindow : public Control {
|
||||
GDCLASS(PaintWindow, Control);
|
||||
@ -149,6 +165,44 @@ public:
|
||||
PaintWindow();
|
||||
~PaintWindow();
|
||||
|
||||
PaintCanvasDialog *paint_canvas_dialog;
|
||||
PaintChangeGridSizeDialog *paint_change_grid_size_dialog;
|
||||
PaintLoadFileDialog *paint_load_file_dialog;
|
||||
PaintSaveFileDialog *paint_save_file_dialog;
|
||||
PaintSettings *paint_settings_dialog;
|
||||
|
||||
RichTextLabel *text_info;
|
||||
|
||||
PaintNavbar *navbar;
|
||||
PaintColorGrid *color_grid;
|
||||
|
||||
CheckButton *lock_alpha_button;
|
||||
|
||||
Label *brush_size_label;
|
||||
HSlider *brush_size_slider;
|
||||
|
||||
CheckButton *x_symmetry_button;
|
||||
CheckButton *y_symmetry_button;
|
||||
|
||||
Control *paint_canvas_container;
|
||||
PaintCanvas *paint_canvas;
|
||||
|
||||
Button *paint_tool_button;
|
||||
Button *brush_tool_button;
|
||||
Button *multi_tool_button;
|
||||
Button *bucket_tool_button;
|
||||
Button *rainbow_tool_button;
|
||||
Button *line_tool_button;
|
||||
Button *rect_tool_button;
|
||||
Button *darken_tool_button;
|
||||
Button *brighten_tool_button;
|
||||
Button *color_picker_tool_button;
|
||||
Button *cut_tool_button;
|
||||
ColorPickerButton *color_picker_button;
|
||||
|
||||
VBoxContainer *layers_box_container;
|
||||
Button *add_layer_button;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
/*
|
||||
|
@ -22,8 +22,8 @@ SOFTWARE.
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "paint_editor_plugin.h"
|
||||
#endif
|
||||
|
||||
void register_paint_types() {
|
||||
|
Loading…
Reference in New Issue
Block a user