2022-11-14 23:27:26 +01:00
|
|
|
#include "paint_node.h"
|
|
|
|
|
2022-11-15 23:11:55 +01:00
|
|
|
#include "paint_project.h"
|
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
Vector2i PaintNode::get_size() {
|
|
|
|
return _size;
|
|
|
|
}
|
|
|
|
void PaintNode::set_size(const Vector2i &size) {
|
|
|
|
_size = size;
|
|
|
|
}
|
|
|
|
|
2022-11-15 23:11:55 +01:00
|
|
|
PaintProject *PaintNode::get_paint_project() {
|
|
|
|
PaintNode *p = this;
|
|
|
|
|
|
|
|
while (p) {
|
|
|
|
PaintProject *pp = Object::cast_to<PaintProject>(p);
|
|
|
|
|
|
|
|
if (pp) {
|
|
|
|
return pp;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = Object::cast_to<PaintNode>(p->get_parent());
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-11-15 23:57:44 +01:00
|
|
|
String PaintNode::get_configuration_warning() const {
|
|
|
|
const PaintNode *p = this;
|
|
|
|
|
|
|
|
while (p) {
|
|
|
|
const PaintProject *pp = Object::cast_to<PaintProject>(p);
|
|
|
|
|
|
|
|
if (pp) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
p = Object::cast_to<PaintNode>(p->get_parent());
|
|
|
|
}
|
|
|
|
|
|
|
|
return "This Node should be a child of a PaintProject!";
|
|
|
|
}
|
|
|
|
|
2022-11-14 23:27:26 +01:00
|
|
|
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");
|
2022-11-15 23:58:43 +01:00
|
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_paint_project"), &PaintNode::get_paint_project);
|
2022-11-14 23:27:26 +01:00
|
|
|
}
|