summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-12 20:35:46 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-12 20:35:46 -0300
commita2903fc51d1d20eba4dc451bdacbe477d6670163 (patch)
treebbcac01f2c30ca1e104b11321e5c7a6930f51e59
parentda477b76a98ee7ca4ac16773d3baf1299e053da7 (diff)
Must now register with set_transform_notify() to get NOTIFICATION_TRANSFORM_CHANGED
-rw-r--r--modules/gridmap/grid_map.cpp1
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/2d/canvas_item.cpp20
-rw-r--r--scene/2d/canvas_item.h4
-rw-r--r--scene/2d/collision_object_2d.cpp1
-rw-r--r--scene/2d/light_2d.cpp1
-rw-r--r--scene/2d/light_occluder_2d.cpp1
-rw-r--r--scene/2d/navigation_polygon.cpp1
-rw-r--r--scene/2d/remote_transform_2d.cpp2
-rw-r--r--scene/2d/sound_player_2d.cpp2
-rw-r--r--scene/2d/tile_map.cpp1
-rw-r--r--scene/2d/visibility_notifier_2d.cpp1
-rw-r--r--scene/3d/camera.cpp1
-rw-r--r--scene/3d/collision_object.cpp2
-rw-r--r--scene/3d/listener.cpp1
-rw-r--r--scene/3d/navigation_mesh.cpp1
-rw-r--r--scene/3d/physics_joint.cpp1
-rw-r--r--scene/3d/proximity_group.cpp1
-rw-r--r--scene/3d/remote_transform.cpp1
-rw-r--r--scene/3d/room_instance.cpp1
-rw-r--r--scene/3d/spatial.cpp17
-rw-r--r--scene/3d/spatial.h4
-rw-r--r--scene/3d/spatial_player.cpp1
-rw-r--r--scene/3d/visibility_notifier.cpp1
-rw-r--r--scene/3d/visual_instance.cpp1
-rw-r--r--scene/main/node.cpp3
26 files changed, 65 insertions, 7 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index b5fa55846c..8bd346d7bb 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -1831,6 +1831,7 @@ GridMap::GridMap() {
use_baked_light=false;
navigation = NULL;
+ set_notify_transform(true);
}
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);
}
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 6298e629a4..50ddafc3e4 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -678,6 +678,7 @@ Camera::Camera() {
h_offset=0;
VisualServer::get_singleton()->camera_set_cull_mask(camera,layers);
//active=false;
+ set_notify_transform(true);
}
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index 0660d0bdad..dab8ad1ea1 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -360,7 +360,7 @@ CollisionObject::CollisionObject() {
capture_input_on_drag=false;
ray_pickable=true;
-
+ set_notify_transform(true);
//owner=
//set_transform_notify(true);
diff --git a/scene/3d/listener.cpp b/scene/3d/listener.cpp
index a227f5cd70..0aa1128bdb 100644
--- a/scene/3d/listener.cpp
+++ b/scene/3d/listener.cpp
@@ -156,6 +156,7 @@ Listener::Listener() {
current=false;
force_change=false;
+ set_notify_transform(true);
//active=false;
}
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 434b400e01..69c18da429 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -410,5 +410,6 @@ NavigationMeshInstance::NavigationMeshInstance() {
navigation=NULL;
nav_id=-1;
enabled=true;
+ set_notify_transform(true);
}
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index a27e558e45..f2668480f5 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -195,6 +195,7 @@ Joint::Joint() {
exclude_from_collision=true;
solver_priority=1;
+ set_notify_transform(true);
}
diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp
index c3cb20bfdd..5ef0d3f176 100644
--- a/scene/3d/proximity_group.cpp
+++ b/scene/3d/proximity_group.cpp
@@ -190,6 +190,7 @@ ProximityGroup::ProximityGroup() {
dispatch_mode = MODE_PROXY;
grid_radius = Vector3(1, 1, 1);
+ set_notify_transform(true);
};
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index 931f075a84..b91d90ae8e 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -127,6 +127,7 @@ void RemoteTransform::_bind_methods() {
RemoteTransform::RemoteTransform() {
cache=0;
+ set_notify_transform(true);
}
diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp
index 0b19aaf151..cdca54cd84 100644
--- a/scene/3d/room_instance.cpp
+++ b/scene/3d/room_instance.cpp
@@ -216,6 +216,7 @@ Room::Room() {
level=0;
+
}
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 60580911da..3cd29a1342 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -74,7 +74,7 @@ SpatialGizmo::SpatialGizmo() {
void Spatial::_notify_dirty() {
- if (!data.ignore_notification && !xform_change.in_list()) {
+ if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) {
get_tree()->xform_change_list.add(&xform_change);
}
@@ -108,7 +108,7 @@ void Spatial::_propagate_transform_changed(Spatial *p_origin) {
}
- if (!data.ignore_notification && !xform_change.in_list()) {
+ if (data.notify_transform && !data.ignore_notification && !xform_change.in_list()) {
get_tree()->xform_change_list.add(&xform_change);
@@ -736,6 +736,14 @@ void Spatial::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, con
}
+void Spatial::set_notify_transform(bool p_enable) {
+ data.notify_transform=p_enable;
+}
+
+bool Spatial::is_transform_notification_enabled() const {
+ return data.notify_transform;
+}
+
void Spatial::set_notify_local_transform(bool p_enable) {
data.notify_local_transform=p_enable;
}
@@ -791,6 +799,9 @@ void Spatial::_bind_methods() {
ClassDB::bind_method(_MD("set_notify_local_transform","enable"), &Spatial::set_notify_local_transform);
ClassDB::bind_method(_MD("is_local_transform_notification_enabled"), &Spatial::is_local_transform_notification_enabled);
+ ClassDB::bind_method(_MD("set_notify_transform","enable"), &Spatial::set_notify_transform);
+ ClassDB::bind_method(_MD("is_transform_notification_enabled"), &Spatial::is_transform_notification_enabled);
+
void rotate(const Vector3& p_normal,float p_radians);
void rotate_x(float p_radians);
void rotate_y(float p_radians);
@@ -848,11 +859,13 @@ Spatial::Spatial() : xform_change(this)
data.viewport=NULL;
data.inside_world=false;
data.visible=true;
+
#ifdef TOOLS_ENABLED
data.gizmo_disabled=false;
data.gizmo_dirty=false;
#endif
data.notify_local_transform=false;
+ data.notify_transform=false;
data.parent=NULL;
data.C=NULL;
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 8121eaa8c2..d3cab0539c 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -92,6 +92,7 @@ class Spatial : public Node {
bool ignore_notification;
bool notify_local_transform;
+ bool notify_transform;
bool visible;
@@ -184,6 +185,9 @@ public:
void look_at(const Vector3& p_target, const Vector3& p_up_normal);
void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
+ void set_notify_transform(bool p_enable);
+ bool is_transform_notification_enabled() const;
+
void set_notify_local_transform(bool p_enable);
bool is_local_transform_notification_enabled() const;
diff --git a/scene/3d/spatial_player.cpp b/scene/3d/spatial_player.cpp
index 0a8b9053c1..6a368d771a 100644
--- a/scene/3d/spatial_player.cpp
+++ b/scene/3d/spatial_player.cpp
@@ -125,6 +125,7 @@ SpatialPlayer::SpatialPlayer() {
params[PARAM_ATTENUATION_DISTANCE_EXP]=1.0; //linear (and not really good)
params[PARAM_EMISSION_CONE_DEGREES]=180.0; //cone disabled
params[PARAM_EMISSION_CONE_ATTENUATION_DB]=-6.0; //minus 6 db attenuation
+ set_notify_transform(true);
}
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index 206421f939..c7c083732e 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -125,6 +125,7 @@ void VisibilityNotifier::_bind_methods(){
VisibilityNotifier::VisibilityNotifier() {
aabb=Rect3(Vector3(-1,-1,-1),Vector3(2,2,2));
+ set_notify_transform(true);
}
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 466c273154..e708c83545 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -162,6 +162,7 @@ VisualInstance::VisualInstance()
instance = VisualServer::get_singleton()->instance_create();
VisualServer::get_singleton()->instance_attach_object_instance_ID( instance, get_instance_ID() );
layers=1;
+ set_notify_transform(true);
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index d24edea991..3a533d24b3 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1384,6 +1384,8 @@ String Node::_generate_serial_child_name(Node *p_child) {
if (name=="") {
name = p_child->get_class();
+ /* this is probably too slow to use here, should check alternatives
+ *
// Adjust casing according to project setting. The current type name is expected to be in PascalCase.
switch (Globals::get_singleton()->get("node/name_casing").operator int()) {
case NAME_CASING_PASCAL_CASE:
@@ -1395,6 +1397,7 @@ String Node::_generate_serial_child_name(Node *p_child) {
name = name.camelcase_to_underscore(true);
break;
}
+ */
}
// Extract trailing number