diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-16 14:39:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-16 14:39:43 +0400 |
commit | ce8f64d9f92e81629facea34b7f9e18e1f6b3d0c (patch) | |
tree | cdf7e806132bca62e915621fbc8e2632de7bdff6 /source/blender/editors/object/object_relations.c | |
parent | 68dd3980638b6a1f0c766a1e023b393c0f36cacd (diff) |
de-duplicate parent loop checking function
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 6b517b6eeb0..1ba0157e8d3 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -512,19 +512,9 @@ static EnumPropertyItem prop_make_parent_types[] = { {0, NULL, 0, NULL, NULL} }; -static int test_parent_loop(Object *par, Object *ob) -{ - /* test if 'ob' is a parent somewhere in par's parents */ - - if(par == NULL) return 0; - if(ob == par) return 1; - - return test_parent_loop(par->parent, ob); -} - void ED_object_parent(Object *ob, Object *par, int type, const char *substr) { - if(!par || test_parent_loop(par, ob)) { + if (!par || BKE_object_parent_loop_check(par, ob)) { ob->parent= NULL; ob->partype= PAROBJECT; ob->parsubstr[0]= 0; @@ -593,7 +583,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) if(ob!=par) { - if( test_parent_loop(par, ob) ) { + if (BKE_object_parent_loop_check(par, ob)) { BKE_report(op->reports, RPT_ERROR, "Loop in parents"); } else { @@ -766,7 +756,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) /* context iterator */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if (ob != par) { - if (test_parent_loop(par, ob)) { + if (BKE_object_parent_loop_check(par, ob)) { BKE_report(op->reports, RPT_ERROR, "Loop in parents"); } else { |