summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sichma <sichmada@gmail.com>2019-07-04 00:17:05 +0200
committerDavid Sichma <sichmada@gmail.com>2019-07-09 14:50:03 +0200
commit5a631bf4f438a779e9e4ab1837844129c4d587a1 (patch)
tree9492a0002233bc48111cc8e094d5a86eb00fbf1b
parent2293c612e6c0913b6999080c9f2fa77227348818 (diff)
Added force_update_cache() to RemoteTransform and RemoteTransform2D
-rw-r--r--doc/classes/RemoteTransform.xml7
-rw-r--r--doc/classes/RemoteTransform2D.xml7
-rw-r--r--scene/2d/remote_transform_2d.cpp7
-rw-r--r--scene/2d/remote_transform_2d.h2
-rw-r--r--scene/3d/remote_transform.cpp7
-rw-r--r--scene/3d/remote_transform.h2
6 files changed, 30 insertions, 2 deletions
diff --git a/doc/classes/RemoteTransform.xml b/doc/classes/RemoteTransform.xml
index 4628ef8519..377f9cc34b 100644
--- a/doc/classes/RemoteTransform.xml
+++ b/doc/classes/RemoteTransform.xml
@@ -10,6 +10,13 @@
<tutorials>
</tutorials>
<methods>
+ <method name="force_update_cache">
+ <return type="void">
+ </return>
+ <description>
+ [RemoteTransform] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again.
+ </description>
+ </method>
</methods>
<members>
<member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node" default="NodePath(&quot;&quot;)">
diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml
index 6a317724a0..f5d509782f 100644
--- a/doc/classes/RemoteTransform2D.xml
+++ b/doc/classes/RemoteTransform2D.xml
@@ -10,6 +10,13 @@
<tutorials>
</tutorials>
<methods>
+ <method name="force_update_cache">
+ <return type="void">
+ </return>
+ <description>
+ [RemoteTransform2D] caches the remote node. It may not notice if the remote node disappears; [method force_update_cache] forces it to update the cache again.
+ </description>
+ </method>
</methods>
<members>
<member name="remote_path" type="NodePath" setter="set_remote_node" getter="get_remote_node" default="NodePath(&quot;&quot;)">
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp
index 1c38a91877..fe8cc5a5fc 100644
--- a/scene/2d/remote_transform_2d.cpp
+++ b/scene/2d/remote_transform_2d.cpp
@@ -110,7 +110,7 @@ void RemoteTransform2D::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_READY: {
+ case NOTIFICATION_ENTER_TREE: {
_update_cache();
@@ -180,6 +180,10 @@ bool RemoteTransform2D::get_update_scale() const {
return update_remote_scale;
}
+void RemoteTransform2D::force_update_cache() {
+ _update_cache();
+}
+
String RemoteTransform2D::get_configuration_warning() const {
if (!has_node(remote_node) || !Object::cast_to<Node2D>(get_node(remote_node))) {
@@ -193,6 +197,7 @@ void RemoteTransform2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform2D::set_remote_node);
ClassDB::bind_method(D_METHOD("get_remote_node"), &RemoteTransform2D::get_remote_node);
+ ClassDB::bind_method(D_METHOD("force_update_cache"), &RemoteTransform2D::force_update_cache);
ClassDB::bind_method(D_METHOD("set_use_global_coordinates", "use_global_coordinates"), &RemoteTransform2D::set_use_global_coordinates);
ClassDB::bind_method(D_METHOD("get_use_global_coordinates"), &RemoteTransform2D::get_use_global_coordinates);
diff --git a/scene/2d/remote_transform_2d.h b/scene/2d/remote_transform_2d.h
index 16a5417592..e85fe33fc6 100644
--- a/scene/2d/remote_transform_2d.h
+++ b/scene/2d/remote_transform_2d.h
@@ -69,6 +69,8 @@ public:
void set_update_scale(const bool p_update);
bool get_update_scale() const;
+ void force_update_cache();
+
virtual String get_configuration_warning() const;
RemoteTransform2D();
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp
index add77e0272..9137075bc4 100644
--- a/scene/3d/remote_transform.cpp
+++ b/scene/3d/remote_transform.cpp
@@ -105,7 +105,7 @@ void RemoteTransform::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_READY: {
+ case NOTIFICATION_ENTER_TREE: {
_update_cache();
@@ -174,6 +174,10 @@ bool RemoteTransform::get_update_scale() const {
return update_remote_scale;
}
+void RemoteTransform::force_update_cache() {
+ _update_cache();
+}
+
String RemoteTransform::get_configuration_warning() const {
if (!has_node(remote_node) || !Object::cast_to<Spatial>(get_node(remote_node))) {
@@ -187,6 +191,7 @@ void RemoteTransform::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_remote_node", "path"), &RemoteTransform::set_remote_node);
ClassDB::bind_method(D_METHOD("get_remote_node"), &RemoteTransform::get_remote_node);
+ ClassDB::bind_method(D_METHOD("force_update_cache"), &RemoteTransform::force_update_cache);
ClassDB::bind_method(D_METHOD("set_use_global_coordinates", "use_global_coordinates"), &RemoteTransform::set_use_global_coordinates);
ClassDB::bind_method(D_METHOD("get_use_global_coordinates"), &RemoteTransform::get_use_global_coordinates);
diff --git a/scene/3d/remote_transform.h b/scene/3d/remote_transform.h
index b737a4f858..07e01284e5 100644
--- a/scene/3d/remote_transform.h
+++ b/scene/3d/remote_transform.h
@@ -68,6 +68,8 @@ public:
void set_update_scale(const bool p_update);
bool get_update_scale() const;
+ void force_update_cache();
+
virtual String get_configuration_warning() const;
RemoteTransform();