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
This commit is contained in:
Philipp Oeser 2022-08-24 13:39:22 +02:00
parent 3a1ea04d46
commit 714a3739da
Notes: blender-bot 2023-02-14 09:17:57 +01:00
Referenced by issue #100599, Reselect the same parent type'object' from Object properties->Relations, make the child object transform unexpectedly.
1 changed files with 5 additions and 0 deletions

View File

@ -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);
}