Added PaintNode.

This commit is contained in:
Relintai 2022-11-14 23:27:26 +01:00
parent b574d44dd7
commit 1c0c3c4393
4 changed files with 50 additions and 0 deletions

View File

@ -33,6 +33,8 @@ module_env.add_source_files(env.modules_sources,"ui/paint_visual_grid.cpp")
module_env.add_source_files(env.modules_sources,"paint_utilities.cpp")
module_env.add_source_files(env.modules_sources,"bush_prefabs.cpp")
module_env.add_source_files(env.modules_sources,"nodes/paint_node.cpp")
module_env.add_source_files(env.modules_sources,"deprecated/paint_canvas_layer.cpp")
module_env.add_source_files(env.modules_sources,"deprecated/paint_canvas.cpp")
module_env.add_source_files(env.modules_sources,"deprecated/paint_layer_button.cpp")

View File

@ -0,0 +1,20 @@
#include "paint_node.h"
Vector2i PaintNode::get_size() {
return _size;
}
void PaintNode::set_size(const Vector2i &size) {
_size = size;
}
PaintNode::PaintNode() {
}
PaintNode::~PaintNode() {
}
void PaintNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_size"), &PaintNode::get_size);
ClassDB::bind_method(D_METHOD("set_size", "size"), &PaintNode::set_size);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size"), "set_size", "get_size");
}

View File

@ -0,0 +1,24 @@
#ifndef PAINT_NODE_H
#define PAINT_NODE_H
#include "core/math/vector2i.h"
#include "scene/2d/node_2d.h"
class PaintNode : public Node2D {
GDCLASS(PaintNode, Node2D);
public:
Vector2i get_size();
void set_size(const Vector2i &size);
PaintNode();
~PaintNode();
protected:
static void _bind_methods();
Vector2i _size;
};
#endif

View File

@ -44,6 +44,8 @@ SOFTWARE.
#include "ui/paint_selection_box.h"
#include "ui/paint_visual_grid.h"
#include "nodes/paint_node.h"
#ifdef TOOLS_ENABLED
#include "paint_editor_plugin.h"
#endif
@ -71,6 +73,8 @@ void register_paint_types() {
ClassDB::register_class<PaintSelectionBox>();
ClassDB::register_class<PaintVisualGrid>();
ClassDB::register_class<PaintNode>();
#ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<PaintEditorPlugin>();
#endif