Explorar o código

Merge pull request #10543 from hpvb/fix-10524

Change order of Null check for ParallaxLayer
Rémi Verschelde %!s(int64=8) %!d(string=hai) anos
pai
achega
260e33178c
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      scene/2d/parallax_layer.cpp

+ 4 - 4
scene/2d/parallax_layer.cpp

@@ -34,11 +34,11 @@
 
 void ParallaxLayer::set_motion_scale(const Size2 &p_scale) {
 
+	motion_scale = p_scale;
+
 	if (!get_parent())
 		return;
 
-	motion_scale = p_scale;
-
 	ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>();
 	if (is_inside_tree() && pb) {
 		Vector2 ofs = pb->get_final_offset();
@@ -54,11 +54,11 @@ Size2 ParallaxLayer::get_motion_scale() const {
 
 void ParallaxLayer::set_motion_offset(const Size2 &p_offset) {
 
+	motion_offset = p_offset;
+
 	if (!get_parent())
 		return;
 
-	motion_offset = p_offset;
-
 	ParallaxBackground *pb = get_parent()->cast_to<ParallaxBackground>();
 	if (is_inside_tree() && pb) {
 		Vector2 ofs = pb->get_final_offset();