From cbe82cd9904bfdd596f6d2647524eb2f61b32193 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Fri, 3 May 2024 11:54:39 +0200 Subject: [PATCH] Do not migrate gravity if it has the default value --- .../io_hubs_addon/components/definitions/rigid_body.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/io_hubs_addon/components/definitions/rigid_body.py b/addons/io_hubs_addon/components/definitions/rigid_body.py index 668ef207..56d3a65b 100644 --- a/addons/io_hubs_addon/components/definitions/rigid_body.py +++ b/addons/io_hubs_addon/components/definitions/rigid_body.py @@ -158,8 +158,11 @@ def migrate(self, migration_type, panel_type, instance_version, host, migration_ angularFactor = Vector((angularFactor.x, angularFactor.z, angularFactor.y)) self.angularFactor = angularFactor - gravity = self.gravity.copy() - gravity = Vector((gravity.x, gravity.z, gravity.y)) - self.gravity = gravity + # If the gravity property has not changed, it will take the default value so we don't swizzle + # in that case. Is there any way of checking if the property has been modified? + if self.gravity != Vector((0.0, 0.0, -9.8)): + gravity = self.gravity.copy() + gravity = Vector((gravity.x, gravity.z, gravity.y)) + self.gravity = gravity return migration_occurred