summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp7
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/cpu_particles_2d.cpp3
3 files changed, 13 insertions, 1 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
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index a02e792cf2..bf7cfa8e75 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -222,6 +222,8 @@ private:
void _set_on_top(bool p_on_top) { set_draw_behind_parent(!p_on_top); }
bool _is_on_top() const { return !is_draw_behind_parent_enabled(); }
+ static CanvasItem *current_item_drawn;
+
protected:
_FORCE_INLINE_ void _notify_transform() {
if (!is_inside_tree()) return;
@@ -324,6 +326,8 @@ public:
void draw_set_transform(const Point2 &p_offset, float p_rot, const Size2 &p_scale);
void draw_set_transform_matrix(const Transform2D &p_matrix);
+ static CanvasItem *get_current_item_drawn();
+
/* RECT / TRANSFORM */
void set_as_toplevel(bool p_toplevel);
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 36b900bf82..21feb6e226 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -840,7 +840,7 @@ void CPUParticles2D::_particles_process(float p_delta) {
if (flags[FLAG_ALIGN_Y_TO_VELOCITY]) {
if (p.velocity.length() > 0.0) {
- p.transform.elements[0] = p.velocity.normalized();
+ p.transform.elements[1] = p.velocity.normalized();
p.transform.elements[0] = p.transform.elements[1].tangent();
}
@@ -1378,6 +1378,7 @@ CPUParticles2D::CPUParticles2D() {
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
//set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
+ set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
set_param(PARAM_TANGENTIAL_ACCEL, 0);
set_param(PARAM_DAMPING, 0);