[Bf-blender-cvs] [714a3739da9] blender-v3.3-release: Fix T100599: dont reset parent inverse setting parent type the same

Philipp Oeser noreply at git.blender.org
Thu Aug 25 09:25:06 CEST 2022


Commit: 714a3739da95f867a85c83abe9185d3a0964190a
Author: Philipp Oeser
Date:   Wed Aug 24 13:39:22 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB714a3739da95f867a85c83abe9185d3a0964190a

Fix T100599: dont reset parent inverse setting parent type the same

Since rBb100bdca25b1 the parent inverse was always reset in
ED_object_parent (also for just changing the parent type).

This does make sense (since there is no point keeping it when e.g
changing from "Bone" to "Object" or "Vertex" to "Object", for this to
really make sense it would have to be properly recalculated anyways
which does not happen afaict).

The reported issue was that setting the prop to the same value as it was
before (e.g. from "Object" to "Object") would still reset the parent
inverse which was really unexpected since from a user standpoint,
nothing has changed here.

So in case the value does not really change, we now just early out and
skip `ED_object_parent`.

Maniphest Tasks: T100599

Differential Revision: https://developer.blender.org/D15771

===================================================================

M	source/blender/makesrna/intern/rna_object.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 103c77fa808..f15ca63268b 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -687,6 +687,11 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
 {
   Object *ob = (Object *)ptr->data;
 
+  /* Skip if type did not change (otherwise we loose parent inverse in ED_object_parent). */
+  if (ob->partype == value) {
+    return;
+  }
+
   ED_object_parent(ob, ob->parent, value, ob->parsubstr);
 }



More information about the Bf-blender-cvs mailing list