diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2015-04-04 09:31:21 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2015-04-04 09:31:21 +0300 |
commit | 16746f157f83d666079ba3266acec13d35b84c3f (patch) | |
tree | 8c872d18ccdef90a15e72622cd0139e0e64801a6 /scene/2d/collision_polygon_2d.cpp | |
parent | 43713810deaadfec6a1656767cf5520073e58a06 (diff) | |
parent | 5d99e15e43d5a446b35d48e8a3b08a478f1998a9 (diff) |
Merge branch 'master' of github.com:okamstudio/godot
Diffstat (limited to 'scene/2d/collision_polygon_2d.cpp')
-rw-r--r-- | scene/2d/collision_polygon_2d.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 1c0be60764..049017c0a5 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -33,6 +33,9 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { + if (unparenting) + return; + CollisionObject2D *co = p_obj->cast_to<CollisionObject2D>(); ERR_FAIL_COND(!co); @@ -96,6 +99,9 @@ void CollisionPolygon2D::_notification(int p_what) { switch(p_what) { + case NOTIFICATION_ENTER_TREE: { + unparenting=false; + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (!is_inside_tree()) @@ -123,6 +129,11 @@ void CollisionPolygon2D::_notification(int p_what) { } #endif } break; + case NOTIFICATION_UNPARENTED: { + unparenting = true; + _update_parent(); + } break; + } } @@ -203,6 +214,7 @@ CollisionPolygon2D::CollisionPolygon2D() { aabb=Rect2(-10,-10,20,20); build_mode=BUILD_SOLIDS; trigger=false; + unparenting=false; } |