From 7887e91d316567366e99fb0d066861cb89ae5816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 2 Nov 2020 10:56:45 +0100 Subject: Cleanup: Sanitise return value of `ED_object_parent_set()` Consistently return `false` from `ED_object_parent_set()` when parenting is not possible. Before, when parent and child were the same object, the function would return `true` even though the parent-child relation was not made. Just returning `false` in the `parent == child` case would break the parenting operator, as `false` stops its loop over all selected objects. This tight coupling caused T82312. The loop now has its own check for this, so that it properly continues, and the implementation of `ED_object_parent_set()` is decoupled from its surrounding code. No functional changes. --- source/blender/editors/include/ED_object.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/editors/include/ED_object.h') diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 6fdd65fdcc9..2e9b711c99a 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -160,6 +160,7 @@ extern struct EnumPropertyItem prop_clear_parent_types[]; extern struct EnumPropertyItem prop_make_parent_types[]; #endif +/* Set the object's parent, return true iff successful. */ bool ED_object_parent_set(struct ReportList *reports, const struct bContext *C, struct Scene *scene, -- cgit v1.2.3