diff options
Diffstat (limited to 'scene/2d/remote_transform_2d.cpp')
-rw-r--r-- | scene/2d/remote_transform_2d.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index e1f360c0c1..210f64ae23 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -31,20 +31,19 @@ void RemoteTransform2D::_update_cache() { - cache=0; + cache = 0; if (has_node(remote_node)) { Node *node = get_node(remote_node); - if (!node || this==node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) { + if (!node || this == node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) { return; } - cache=node->get_instance_ID(); + cache = node->get_instance_ID(); } } void RemoteTransform2D::_update_remote() { - if (!is_inside_tree()) return; @@ -62,14 +61,13 @@ void RemoteTransform2D::_update_remote() { if (!n->is_inside_tree()) return; - //todo make faster + //todo make faster n->set_global_transform(get_global_transform()); - } void RemoteTransform2D::_notification(int p_what) { - switch(p_what) { + switch (p_what) { case NOTIFICATION_READY: { @@ -83,30 +81,26 @@ void RemoteTransform2D::_notification(int p_what) { if (cache) { _update_remote(); - } } break; - } } +void RemoteTransform2D::set_remote_node(const NodePath &p_remote_node) { -void RemoteTransform2D::set_remote_node(const NodePath& p_remote_node) { - - remote_node=p_remote_node; + remote_node = p_remote_node; if (is_inside_tree()) _update_cache(); update_configuration_warning(); } -NodePath RemoteTransform2D::get_remote_node() const{ +NodePath RemoteTransform2D::get_remote_node() const { return remote_node; } - String RemoteTransform2D::get_configuration_warning() const { if (!has_node(remote_node) || !get_node(remote_node) || !get_node(remote_node)->cast_to<Node2D>()) { @@ -118,16 +112,14 @@ String RemoteTransform2D::get_configuration_warning() const { 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("set_remote_node", "path"), &RemoteTransform2D::set_remote_node); + ClassDB::bind_method(D_METHOD("get_remote_node"), &RemoteTransform2D::get_remote_node); - ADD_PROPERTY( PropertyInfo(Variant::NODE_PATH,"remote_path"),"set_remote_node","get_remote_node"); + ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "remote_path"), "set_remote_node", "get_remote_node"); } RemoteTransform2D::RemoteTransform2D() { - cache=0; + cache = 0; set_notify_transform(true); } - - |