summaryrefslogtreecommitdiff
path: root/scene/2d/canvas_item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/canvas_item.cpp')
-rw-r--r--scene/2d/canvas_item.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 6ed008cf9c..41cee7335e 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -134,7 +134,7 @@ void CanvasItemMaterial::_update_shader() {
code += "\tint total_frames = particles_anim_h_frames * particles_anim_v_frames;\n";
code += "\tint frame = int(float(total_frames) * INSTANCE_CUSTOM.z);\n";
code += "\tif (particles_anim_loop) {\n";
- code += "\t\tframe = abs(frame) % total_frames;\n";
+ code += "\t\tframe = int(abs(frame) % total_frames);\n";
code += "\t} else {\n";
code += "\t\tframe = clamp(frame, 0, total_frames - 1);\n";
code += "\t}\n";
@@ -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