summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp2
-rw-r--r--scene/2d/joints_2d.cpp39
-rw-r--r--scene/2d/particles_2d.cpp10
-rw-r--r--scene/2d/particles_2d.h1
-rw-r--r--scene/2d/path_2d.cpp6
5 files changed, 44 insertions, 14 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 7df6864a65..b1ad50a1b1 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -773,7 +773,7 @@ void CanvasItem::draw_set_transform(const Point2& p_offset, float p_rot, const S
Matrix32 xform(p_rot,p_offset);
xform.scale_basis(p_scale);
- VisualServer::get_singleton()->canvas_item_set_transform(canvas_item,xform);
+ VisualServer::get_singleton()->canvas_item_add_set_transform(canvas_item,xform);
}
void CanvasItem::draw_polygon(const Vector<Point2>& p_points, const Vector<Color>& p_colors,const Vector<Point2>& p_uvs, Ref<Texture> p_texture) {
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index adb2904a0a..cb2209071a 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -164,11 +164,17 @@ void PinJoint2D::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_DRAW: {
- if (is_inside_tree() && get_tree()->is_editor_hint()) {
- draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(0,-10),Point2(0,+10),Color(0.7,0.6,0.0,0.5),3);
+ if (!is_inside_tree())
+ break;
+
+ if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ break;
}
+
+
+ draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(0,-10),Point2(0,+10),Color(0.7,0.6,0.0,0.5),3);
} break;
}
@@ -241,13 +247,17 @@ void GrooveJoint2D::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_DRAW: {
- if (is_inside_tree() && get_tree()->is_editor_hint()) {
+ if (!is_inside_tree())
+ break;
- draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(-10,initial_offset),Point2(+10,initial_offset),Color(0.8,0.8,0.9,0.5),5);
+ if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ break;
}
+
+ draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(-10,initial_offset),Point2(+10,initial_offset),Color(0.8,0.8,0.9,0.5),5);
} break;
}
}
@@ -339,12 +349,17 @@ void DampedSpringJoint2D::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_DRAW: {
- if (is_inside_tree() && get_tree()->is_editor_hint()) {
- draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3);
- draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3);
+ if (!is_inside_tree())
+ break;
+
+ if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
+ break;
}
+
+ draw_line(Point2(-10,0),Point2(+10,0),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(-10,length),Point2(+10,length),Color(0.7,0.6,0.0,0.5),3);
+ draw_line(Point2(0,0),Point2(0,length),Color(0.7,0.6,0.0,0.5),3);
} break;
}
}
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 8f805ceba2..2373af9d0c 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -994,6 +994,15 @@ DVector<Vector2> Particles2D::get_emission_points() const{
return emission_points;
}
+void Particles2D::reset() {
+
+ for(int i=0;i<particles.size();i++) {
+ particles[i].active=false;
+ }
+ time=0;
+ active_count=0;
+}
+
void Particles2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_emitting","active"),&Particles2D::set_emitting);
@@ -1057,6 +1066,7 @@ void Particles2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_color_phase_pos","phase"),&Particles2D::get_color_phase_pos);
ObjectTypeDB::bind_method(_MD("pre_process","time"),&Particles2D::pre_process);
+ ObjectTypeDB::bind_method(_MD("reset"),&Particles2D::reset);
ObjectTypeDB::bind_method(_MD("set_use_local_space","enable"),&Particles2D::set_use_local_space);
ObjectTypeDB::bind_method(_MD("is_using_local_space"),&Particles2D::is_using_local_space);
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index 4ee0fcf8da..77543a9125 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -248,6 +248,7 @@ public:
DVector<Vector2> get_emission_points() const;
void pre_process(float p_delta);
+ void reset();
Particles2D();
};
diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp
index 8f110b3931..c14f5ec63e 100644
--- a/scene/2d/path_2d.cpp
+++ b/scene/2d/path_2d.cpp
@@ -31,9 +31,13 @@
void Path2D::_notification(int p_what) {
- if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_tree() && get_tree()->is_editor_hint()) {
+ if (p_what==NOTIFICATION_DRAW && curve.is_valid()) {
//draw the curve!!
+ if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
+ return;
+ }
+
for(int i=0;i<curve->get_point_count();i++) {
Vector2 prev_p=curve->get_point_pos(i);