From 9e1ead1940f084c24b3751a1a52e40f40c3c4df1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Mar 2013 03:34:01 +0000 Subject: expose obrel_is_recursive_child in BKE_object.h and rename to BKE_object_is_child_recursive() --- source/blender/blenkernel/intern/object.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c98c18b9cdc..0ace60b1fd4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3126,6 +3126,17 @@ KeyBlock *BKE_object_insert_shape_key(Scene *scene, Object *ob, const char *name } +bool BKE_object_is_child_recursive(Object *ob_parent, Object *ob_child) +{ + Object *ob_test; + for (ob_test = ob_child->parent; ob_test; ob_test = ob_test->parent) { + if (ob_test == ob_parent) { + return true; + } + } + return false; +} + /* most important if this is modified it should _always_ return True, in certain * cases false positives are hard to avoid (shape keys for example) */ int BKE_object_is_modified(Scene *scene, Object *ob) @@ -3275,18 +3286,6 @@ static Object *obrel_armature_find(Object *ob) return ob_arm; } -static int obrel_is_recursive_child(Object *ob, Object *child) -{ - Object *par; - for (par = child->parent; par; par = par->parent) { - if (par == ob) { - return TRUE; - } - } - return FALSE; -} - - static int obrel_list_test(Object *ob) { return ob && !(ob->id.flag & LIB_DOIT); @@ -3359,7 +3358,7 @@ LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectS Object *child = local_base->object; if (obrel_list_test(child)) { - if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && obrel_is_recursive_child(ob, child)) || + if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && BKE_object_is_child_recursive(ob, child)) || (includeFilter & OB_REL_CHILDREN && child->parent && child->parent == ob)) { obrel_list_add(&links, child); -- cgit v1.2.3