Cleanup: replace BLI_findptr with BKE_collection_has_object
Also swap the order of checks in collection_object_add to perform the comparison before calling collection_find_child_recursive.
This commit is contained in:
parent
b380d25053
commit
1c470dbd72
|
@ -1064,8 +1064,8 @@ static bool collection_object_add(
|
|||
{
|
||||
if (ob->instance_collection) {
|
||||
/* Cyclic dependency check. */
|
||||
if (collection_find_child_recursive(ob->instance_collection, collection) ||
|
||||
ob->instance_collection == collection) {
|
||||
if ((ob->instance_collection == collection) ||
|
||||
collection_find_child_recursive(ob->instance_collection, collection)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1876,8 +1876,7 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
|
|||
Object *single_object = BLI_listbase_is_single(&objects) ? ((LinkData *)objects.first)->data :
|
||||
NULL;
|
||||
|
||||
if ((single_object != NULL) && is_link &&
|
||||
BLI_findptr(&collection->gobject, single_object, offsetof(CollectionObject, ob))) {
|
||||
if ((single_object != NULL) && is_link && BKE_collection_has_object(collection, single_object)) {
|
||||
BKE_reportf(op->reports,
|
||||
RPT_ERROR,
|
||||
"%s already in %s",
|
||||
|
|
Loading…
Reference in New Issue