mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
Now PaintVisualGrid and PaintCanvasBackground inherits from PaintNode.
This commit is contained in:
parent
c0da82ab92
commit
b823759397
@ -24,8 +24,6 @@ SOFTWARE.
|
||||
|
||||
#include "paint_canvas_background.h"
|
||||
|
||||
#include "../nodes/paint_node.h"
|
||||
|
||||
int PaintCanvasBackground::get_grid_size() const {
|
||||
return _grid_size;
|
||||
}
|
||||
@ -53,22 +51,6 @@ void PaintCanvasBackground::set_grid_white(const Color &val) {
|
||||
update();
|
||||
}
|
||||
|
||||
PaintNode *PaintCanvasBackground::get_paint_node() {
|
||||
Node *p = this;
|
||||
|
||||
while (p) {
|
||||
PaintNode *pn = Object::cast_to<PaintNode>(p);
|
||||
|
||||
if (pn) {
|
||||
return pn;
|
||||
}
|
||||
|
||||
p = p->get_parent();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PaintCanvasBackground::PaintCanvasBackground() {
|
||||
_grid_size = 8;
|
||||
|
||||
@ -83,7 +65,7 @@ void PaintCanvasBackground::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case PaintNode::NOTIFICATION_PARENT_PAINT_NODE_RESIZED: {
|
||||
PaintNode *pn = get_paint_node();
|
||||
PaintNode *pn = get_parent_paint_node();
|
||||
|
||||
if (pn) {
|
||||
set_size(pn->get_size());
|
||||
|
@ -25,17 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "scene/gui/texture_rect.h"
|
||||
#include "../nodes/paint_node.h"
|
||||
|
||||
#include "core/object/reference.h"
|
||||
|
||||
class ShaderMaterial;
|
||||
class Shader;
|
||||
class Image;
|
||||
class PaintNode;
|
||||
|
||||
class PaintCanvasBackground : public TextureRect {
|
||||
GDCLASS(PaintCanvasBackground, TextureRect);
|
||||
class PaintCanvasBackground : public PaintNode {
|
||||
GDCLASS(PaintCanvasBackground, PaintNode);
|
||||
|
||||
public:
|
||||
int get_grid_size() const;
|
||||
@ -46,9 +39,7 @@ public:
|
||||
|
||||
Color get_grid_white() const;
|
||||
void set_grid_white(const Color &val);
|
||||
|
||||
PaintNode *get_paint_node();
|
||||
|
||||
|
||||
PaintCanvasBackground();
|
||||
~PaintCanvasBackground();
|
||||
|
||||
|
@ -24,8 +24,6 @@ SOFTWARE.
|
||||
|
||||
#include "paint_visual_grid.h"
|
||||
|
||||
#include "../nodes/paint_node.h"
|
||||
|
||||
int PaintVisualGrid::get_grid_size() {
|
||||
return _grid_size;
|
||||
}
|
||||
@ -42,27 +40,11 @@ void PaintVisualGrid::set_grid_color(const Color &val) {
|
||||
update();
|
||||
}
|
||||
|
||||
PaintNode *PaintVisualGrid::get_paint_node() {
|
||||
Node *p = this;
|
||||
|
||||
while (p) {
|
||||
PaintNode *pn = Object::cast_to<PaintNode>(p);
|
||||
|
||||
if (pn) {
|
||||
return pn;
|
||||
}
|
||||
|
||||
p = p->get_parent();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PaintVisualGrid::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case PaintNode::NOTIFICATION_PARENT_PAINT_NODE_RESIZED: {
|
||||
PaintNode *pn = get_paint_node();
|
||||
PaintNode *pn = get_parent_paint_node();
|
||||
|
||||
if (pn) {
|
||||
set_size(pn->get_size());
|
||||
|
@ -25,12 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
#include "../nodes/paint_node.h"
|
||||
|
||||
class PaintNode;
|
||||
|
||||
class PaintVisualGrid : public Control {
|
||||
GDCLASS(PaintVisualGrid, Control);
|
||||
class PaintVisualGrid : public PaintNode {
|
||||
GDCLASS(PaintVisualGrid, PaintNode);
|
||||
|
||||
public:
|
||||
int get_grid_size();
|
||||
@ -39,8 +37,6 @@ public:
|
||||
Color get_grid_color();
|
||||
void set_grid_color(const Color &val);
|
||||
|
||||
PaintNode *get_paint_node();
|
||||
|
||||
PaintVisualGrid();
|
||||
~PaintVisualGrid();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user