diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-12 20:35:46 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-12 20:35:46 -0300 |
commit | a2903fc51d1d20eba4dc451bdacbe477d6670163 (patch) | |
tree | bbcac01f2c30ca1e104b11321e5c7a6930f51e59 /scene/2d | |
parent | da477b76a98ee7ca4ac16773d3baf1299e053da7 (diff) |
Must now register with set_transform_notify() to get NOTIFICATION_TRANSFORM_CHANGED
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/camera_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/canvas_item.cpp | 20 | ||||
-rw-r--r-- | scene/2d/canvas_item.h | 4 | ||||
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/light_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/light_occluder_2d.cpp | 1 | ||||
-rw-r--r-- | scene/2d/navigation_polygon.cpp | 1 | ||||
-rw-r--r-- | scene/2d/remote_transform_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/sound_player_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 1 | ||||
-rw-r--r-- | scene/2d/visibility_notifier_2d.cpp | 1 |
11 files changed, 31 insertions, 4 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 6c387c610f..b921db239d 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -713,5 +713,6 @@ Camera2D::Camera2D() { v_drag_enabled=true; h_ofs=0; v_ofs=0; + set_notify_transform(true); } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index b7d9ba7860..d48cfb1b15 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -769,7 +769,7 @@ void CanvasItem::_notify_transform(CanvasItem *p_node) { p_node->global_invalid=true; - if (!p_node->xform_change.in_list()) { + if (notify_transform && !p_node->xform_change.in_list()) { if (!p_node->block_transform_notify) { if (p_node->is_inside_tree()) get_tree()->xform_change_list.add(&p_node->xform_change); @@ -997,6 +997,12 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(_MD("set_use_parent_material","enable"),&CanvasItem::set_use_parent_material); ClassDB::bind_method(_MD("get_use_parent_material"),&CanvasItem::get_use_parent_material); + ClassDB::bind_method(_MD("set_notify_local_transform","enable"),&CanvasItem::set_notify_local_transform); + ClassDB::bind_method(_MD("is_local_transform_notification_enabled"),&CanvasItem::is_local_transform_notification_enabled); + + ClassDB::bind_method(_MD("set_notify_transform","enable"),&CanvasItem::set_notify_transform); + ClassDB::bind_method(_MD("is_transform_notification_enabled"),&CanvasItem::is_transform_notification_enabled); + ClassDB::bind_method(_MD("make_canvas_pos_local","screen_point"), &CanvasItem::make_canvas_pos_local); ClassDB::bind_method(_MD("make_input_local","event"),&CanvasItem::make_input_local); @@ -1081,6 +1087,15 @@ bool CanvasItem::is_local_transform_notification_enabled() const { return notify_local_transform; } + +void CanvasItem::set_notify_transform(bool p_enable) { + notify_transform=p_enable; +} + +bool CanvasItem::is_transform_notification_enabled() const { + return notify_transform; +} + int CanvasItem::get_canvas_layer() const { if (canvas_layer) @@ -1118,12 +1133,13 @@ CanvasItem::CanvasItem() : xform_change(this) { first_draw=false; drawing=false; behind=false; - block_transform_notify=false; + block_transform_notify=false; // viewport=NULL; canvas_layer=NULL; use_parent_material=false; global_invalid=true; notify_local_transform=false; + notify_transform=false; light_mask=1; C=NULL; diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index fded547275..9865ad04a0 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -117,6 +117,7 @@ private: bool behind; bool use_parent_material; bool notify_local_transform; + bool notify_transform; Ref<CanvasItemMaterial> material; @@ -256,6 +257,9 @@ public: void set_notify_local_transform(bool p_enable); bool is_local_transform_notification_enabled() const; + void set_notify_transform(bool p_enable); + bool is_transform_notification_enabled() const; + int get_canvas_layer() const; CanvasItem(); diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 3d90346209..af070dc825 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -363,6 +363,7 @@ CollisionObject2D::CollisionObject2D() { //owner= + set_notify_transform(true); } diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index b9dc8fe130..07fce58fc0 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -482,6 +482,7 @@ Light2D::Light2D() { shadow_color=Color(0,0,0,0); shadow_filter=SHADOW_FILTER_NONE; + set_notify_transform(true); } Light2D::~Light2D() { diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 8d447c3e8b..a9e654e699 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -242,6 +242,7 @@ LightOccluder2D::LightOccluder2D() { occluder=VS::get_singleton()->canvas_light_occluder_create(); mask=1; + set_notify_transform(true); } LightOccluder2D::~LightOccluder2D() { diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index 5c1837ad65..26047a7426 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -497,5 +497,6 @@ NavigationPolygonInstance::NavigationPolygonInstance() { navigation=NULL; nav_id=-1; enabled=true; + set_notify_transform(true); } diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index c7ec84a8d7..77f1a9d500 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -127,7 +127,7 @@ void RemoteTransform2D::_bind_methods() { RemoteTransform2D::RemoteTransform2D() { cache=0; - + set_notify_transform(true); } diff --git a/scene/2d/sound_player_2d.cpp b/scene/2d/sound_player_2d.cpp index 96382caa25..7861fb5855 100644 --- a/scene/2d/sound_player_2d.cpp +++ b/scene/2d/sound_player_2d.cpp @@ -116,7 +116,7 @@ SoundPlayer2D::SoundPlayer2D() { params[PARAM_ATTENUATION_MAX_DISTANCE]=2048; params[PARAM_ATTENUATION_DISTANCE_EXP]=1.0; //linear (and not really good) - + set_notify_transform(true); } SoundPlayer2D::~SoundPlayer2D() { diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 7bd3a5d932..26f9f7b879 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1321,6 +1321,7 @@ TileMap::TileMap() { fp_adjust=0.00001; tile_origin=TILE_ORIGIN_TOP_LEFT; + set_notify_transform(true); } TileMap::~TileMap() { diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index 61d57b0e8c..f1c70a8f60 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -145,6 +145,7 @@ void VisibilityNotifier2D::_bind_methods(){ VisibilityNotifier2D::VisibilityNotifier2D() { rect=Rect2(-10,-10,20,20); + set_notify_transform(true); } |