mirror of https://github.com/godotengine/godot
Compare commits
2 Commits
21a720db51
...
31ed4264ff
| Author | SHA1 | Date |
|---|---|---|
|
|
31ed4264ff | |
|
|
b75e82f81b |
|
|
@ -60,64 +60,44 @@ void RemoteTransform2D::_update_remote() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(update_remote_position || update_remote_rotation || update_remote_scale)) {
|
||||
int count = update_remote_position + update_remote_rotation + update_remote_scale;
|
||||
|
||||
if (count == 0) {
|
||||
return; // The transform data of the RemoteTransform2D is not used at all.
|
||||
}
|
||||
|
||||
//todo make faster
|
||||
if (use_global_coordinates) {
|
||||
Transform2D n_trans = n->get_global_transform();
|
||||
Transform2D our_trans = get_global_transform();
|
||||
|
||||
if (update_remote_position && update_remote_rotation && update_remote_scale) {
|
||||
our_trans.set_skew(n_trans.get_skew()); // Skew needs to be preserved.
|
||||
n->set_global_transform(our_trans);
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_remote_rotation && update_remote_scale) {
|
||||
n_trans.set_rotation_and_scale(our_trans.get_rotation(), our_trans.get_scale());
|
||||
n->set_global_transform(n_trans);
|
||||
return;
|
||||
}
|
||||
Transform2D n_trans = use_global_coordinates ? n->get_global_transform() : n->get_transform();
|
||||
Transform2D our_trans = use_global_coordinates ? get_global_transform() : get_transform();
|
||||
|
||||
if (count == 1) {
|
||||
if (update_remote_position) {
|
||||
n_trans.set_origin(our_trans.get_origin());
|
||||
}
|
||||
if (update_remote_rotation) {
|
||||
} else if (update_remote_rotation) {
|
||||
n_trans.set_rotation(our_trans.get_rotation());
|
||||
}
|
||||
if (update_remote_scale) {
|
||||
} else if (update_remote_scale) {
|
||||
n_trans.set_scale(our_trans.get_scale());
|
||||
}
|
||||
} else if (count == 2) {
|
||||
if (update_remote_position) {
|
||||
n_trans.set_origin(our_trans.get_origin());
|
||||
if (update_remote_rotation) {
|
||||
n_trans.set_rotation(our_trans.get_rotation());
|
||||
} else if (update_remote_scale) {
|
||||
n_trans.set_scale(our_trans.get_scale());
|
||||
}
|
||||
} else {
|
||||
n_trans.set_rotation_and_scale(our_trans.get_rotation(), our_trans.get_scale());
|
||||
}
|
||||
} else if (count == 3) {
|
||||
n_trans.set_origin(our_trans.get_origin());
|
||||
n_trans.set_rotation_and_scale(our_trans.get_rotation(), our_trans.get_scale());
|
||||
}
|
||||
|
||||
if (use_global_coordinates) {
|
||||
n->set_global_transform(n_trans);
|
||||
} else {
|
||||
Transform2D n_trans = n->get_transform();
|
||||
Transform2D our_trans = get_transform();
|
||||
|
||||
if (update_remote_position && update_remote_rotation && update_remote_scale) {
|
||||
our_trans.set_skew(n_trans.get_skew()); // Skew needs to be preserved.
|
||||
n->set_transform(our_trans);
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_remote_rotation && update_remote_scale) {
|
||||
n_trans.set_rotation_and_scale(our_trans.get_rotation(), our_trans.get_scale());
|
||||
n->set_transform(n_trans);
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_remote_position) {
|
||||
n_trans.set_origin(our_trans.get_origin());
|
||||
}
|
||||
if (update_remote_rotation) {
|
||||
n_trans.set_rotation(our_trans.get_rotation());
|
||||
}
|
||||
if (update_remote_scale) {
|
||||
n_trans.set_scale(our_trans.get_scale());
|
||||
}
|
||||
|
||||
n->set_transform(n_trans);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue