diff options
author | Anton Yabchinskiy <arn@bestmx.ru> | 2014-12-09 17:51:14 +0300 |
---|---|---|
committer | Anton Yabchinskiy <arn@bestmx.ru> | 2014-12-09 17:51:14 +0300 |
commit | ff755f93eb86e3f7f6801918457ca77a3001671b (patch) | |
tree | 58d6def002b427db665a504f08d25eae335bd9d9 /scene/2d | |
parent | d45be7d9f43046365fcfbf97420f9eca636c51e7 (diff) | |
parent | be4e40e90a5a322f6a7cec4893854ef5b15db600 (diff) |
Merge branch 'master' of http://github.com/okamstudio/godot
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/animated_sprite.cpp | 7 | ||||
-rw-r--r-- | scene/2d/area_2d.cpp | 15 | ||||
-rw-r--r-- | scene/2d/area_2d.h | 1 | ||||
-rw-r--r-- | scene/2d/polygon_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/sprite.cpp | 6 |
5 files changed, 28 insertions, 2 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 316dffb3f9..2fcfc18429 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "animated_sprite.h" - +#include "scene/scene_string_names.h" void AnimatedSprite::edit_set_pivot(const Point2& p_pivot) { set_offset(p_pivot); @@ -207,7 +207,7 @@ void AnimatedSprite::set_frame(int p_frame) { frame=p_frame; update(); _change_notify("frame"); - + emit_signal(SceneStringNames::get_singleton()->frame_changed); } int AnimatedSprite::get_frame() const { @@ -233,6 +233,7 @@ void AnimatedSprite::set_offset(const Point2& p_offset) { offset=p_offset; update(); item_rect_changed(); + _change_notify("offset"); } Point2 AnimatedSprite::get_offset() const { @@ -325,6 +326,8 @@ void AnimatedSprite::_bind_methods() { ObjectTypeDB::bind_method(_MD("_res_changed"),&AnimatedSprite::_res_changed); + ADD_SIGNAL(MethodInfo("frame_changed")); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame"), _SCS("set_frame"),_SCS("get_frame")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 3114106235..ca2a42026d 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -142,6 +142,8 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b ERR_FAIL_COND(!body_in && !E); + locked=true; + if (body_in) { if (!E) { @@ -197,11 +199,18 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b } + locked=false; + + } void Area2D::_clear_monitoring() { + if (locked) { + ERR_EXPLAIN("This function can't be used during the in/out signal."); + } + ERR_FAIL_COND(locked); Map<ObjectID,BodyState> bmcopy = body_map; body_map.clear(); @@ -243,6 +252,11 @@ void Area2D::_notification(int p_what) { void Area2D::set_enable_monitoring(bool p_enable) { + if (locked) { + ERR_EXPLAIN("This function can't be used during the in/out signal."); + } + ERR_FAIL_COND(locked); + if (p_enable==monitoring) return; @@ -336,6 +350,7 @@ Area2D::Area2D() : CollisionObject2D(Physics2DServer::get_singleton()->area_crea set_gravity_vector(Vector2(0,1)); gravity_is_point=false; density=0.1; + locked=false; priority=0; monitoring=false; set_enable_monitoring(true); diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index c6210e7c9a..2044cc7db0 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -52,6 +52,7 @@ private: real_t density; int priority; bool monitoring; + bool locked; void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 2b4be734af..217a98aaea 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -359,5 +359,6 @@ Polygon2D::Polygon2D() { tex_rot=0; tex_tile=true; tex_scale=Vector2(1,1); + color=Color(1,1,1); rect_cache_dirty=true; } diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 9f789a7a1f..82f5a6972a 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -34,6 +34,7 @@ void Sprite::edit_set_pivot(const Point2& p_pivot) { set_offset(p_pivot); + } Point2 Sprite::edit_get_pivot() const { @@ -136,6 +137,7 @@ void Sprite::set_offset(const Point2& p_offset) { offset=p_offset; update(); item_rect_changed(); + _change_notify("offset"); } Point2 Sprite::get_offset() const { @@ -199,6 +201,8 @@ void Sprite::set_frame(int p_frame) { item_rect_changed(); frame=p_frame; + + emit_signal(SceneStringNames::get_singleton()->frame_changed); } int Sprite::get_frame() const { @@ -307,6 +311,8 @@ void Sprite::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_modulate","modulate"),&Sprite::set_modulate); ObjectTypeDB::bind_method(_MD("get_modulate"),&Sprite::get_modulate); + ADD_SIGNAL(MethodInfo("frame_changed")); + ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); ADD_PROPERTY( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); |