mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-10 21:09:38 +01:00
Added get_paint_project helper method to PaintNode.
This commit is contained in:
parent
4851144a55
commit
4a93e21660
@ -1,5 +1,7 @@
|
||||
#include "paint_node.h"
|
||||
|
||||
#include "paint_project.h"
|
||||
|
||||
Vector2i PaintNode::get_size() {
|
||||
return _size;
|
||||
}
|
||||
@ -7,6 +9,22 @@ void PaintNode::set_size(const Vector2i &size) {
|
||||
_size = size;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
PaintNode::PaintNode() {
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
|
||||
class PaintProject;
|
||||
|
||||
class PaintNode : public Node2D {
|
||||
GDCLASS(PaintNode, Node2D);
|
||||
|
||||
@ -12,6 +14,8 @@ public:
|
||||
Vector2i get_size();
|
||||
void set_size(const Vector2i &size);
|
||||
|
||||
PaintProject *get_paint_project();
|
||||
|
||||
PaintNode();
|
||||
~PaintNode();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user