diff options
author | Ton Roosendaal <ton@blender.org> | 2009-05-14 13:32:47 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-05-14 13:32:47 +0400 |
commit | a74d2574ee5322dc29754fe2ac93e100fcf73633 (patch) | |
tree | 29024cbbd75da2a153cdfdf3fabbf72b382f952b | |
parent | d257586fe6d59f9a7c622b460fbe38a168fb5428 (diff) |
Bugfix #18725
Particles using group-duplication, with Metaballs in group, enter eternal
loop in our code now. This is a non-supported case... metaball code doesn't
support recursions. Added a provision in code to catch this case, and print
an error in console to denote this.
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 16 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 79205814ae7..97226b5ec42 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -297,7 +297,10 @@ Object *find_basis_mball(Object *basis) splitIDname(basis->id.name+2, basisname, &basisnr); totelem= 0; - next_object(0, 0, 0); + /* XXX recursion check, see scene.c, just too simple code this next_object() */ + if(F_ERROR==next_object(0, 0, 0)) + return NULL; + while(next_object(1, &base, &ob)) { if (ob->type==OB_MBALL) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 5def3577218..ed1a77d645e 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -402,16 +402,25 @@ int next_object(int val, Base **base, Object **ob) { static ListBase *duplilist= NULL; static DupliObject *dupob; - static int fase; + static int fase= F_START, in_next_object= 0; int run_again=1; /* init */ if(val==0) { fase= F_START; dupob= NULL; + + /* XXX particle systems with metas+dupligroups call this recursively */ + /* see bug #18725 */ + if(in_next_object) { + printf("ERROR: MetaBall generation called recursively, not supported\n"); + + return F_ERROR; + } } else { - + in_next_object= 1; + /* run_again is set when a duplilist has been ended */ while(run_again) { run_again= 0; @@ -493,6 +502,9 @@ int next_object(int val, Base **base, Object **ob) } } + /* reset recursion test */ + in_next_object= 0; + return fase; } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d26bdd469f6..ac73ccc498c 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -788,6 +788,7 @@ typedef struct Scene { #define PROP_RANDOM 6 /* return flag next_object function */ +#define F_ERROR -1 #define F_START 0 #define F_SCENE 1 #define F_SET 2 |