From 714a3739da95f867a85c83abe9185d3a0964190a Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Wed, 24 Aug 2022 13:39:22 +0200 Subject: 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 --- source/blender/makesrna/intern/rna_object.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/makesrna') 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); } -- cgit v1.2.3