summaryrefslogtreecommitdiff
path: root/scene/2d/canvas_item.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-01-24 10:21:56 -0300
committerJuan Linietsky <reduzio@gmail.com>2019-01-24 10:22:41 -0300
commitd0b736f7e54cb487db25ab39346ee0fc4b565aee (patch)
treebcf15f2e4829f9debd799668b51599663641b10d /scene/2d/canvas_item.cpp
parent95bd60f71c5ab0fcd2aed69a1aaa88b3235e93e4 (diff)
Ability to get the current canvas item being drawn from stylebox.
Diffstat (limited to 'scene/2d/canvas_item.cpp')
-rw-r--r--scene/2d/canvas_item.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 6ed008cf9c..dced688899 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -434,6 +434,11 @@ void CanvasItem::hide() {
_change_notify("visible");
}
+CanvasItem *CanvasItem::current_item_drawn = NULL;
+CanvasItem *CanvasItem::get_current_item_drawn() {
+ return current_item_drawn;
+}
+
void CanvasItem::_update_callback() {
if (!is_inside_tree()) {
@@ -449,11 +454,13 @@ void CanvasItem::_update_callback() {
first_draw = false;
}
drawing = true;
+ current_item_drawn = this;
notification(NOTIFICATION_DRAW);
emit_signal(SceneStringNames::get_singleton()->draw);
if (get_script_instance()) {
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw, NULL, 0);
}
+ current_item_drawn = NULL;
drawing = false;
}
//todo updating = false