diff options
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index c7058d7d8db..3ca7dac4bc9 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -69,10 +69,10 @@ /* Global variables */ -float thresh= 0.6f; -int totelem=0; -MetaElem **mainb; -octal_tree *metaball_tree = NULL; +static float thresh= 0.6f; +static int totelem=0; +static MetaElem **mainb; +static octal_tree *metaball_tree = NULL; /* Functions */ void unlink_mball(MetaBall *mb) @@ -280,6 +280,47 @@ int is_basis_mball(Object *ob) return 1; } +/* \brief copy some properties from object to other metaball object with same base name + * + * When some properties (wiresize, threshold, update flags) of metaball are changed, then this properties + * are copied to all metaballs in same "group" (metaballs with same base name: MBall, + * MBall.001, MBall.002, etc). The most important is to copy properties to the base metaball, + * because this metaball influence polygonisation of metaballs. */ +void copy_mball_properties(Scene *scene, Object *active_object) +{ + Base *base; + Object *ob; + MetaBall *active_mball = (MetaBall*)active_object->data; + int basisnr, obnr; + char basisname[32], obname[32]; + + splitIDname(active_object->id.name+2, basisname, &basisnr); + + /* XXX recursion check, see scene.c, just too simple code this next_object() */ + if(F_ERROR==next_object(scene, 0, 0, 0)) + return; + + while(next_object(scene, 1, &base, &ob)) { + if (ob->type==OB_MBALL) { + if(ob!=active_object){ + splitIDname(ob->id.name+2, obname, &obnr); + + /* Object ob has to be in same "group" ... it means, that it has to have + * same base of its name */ + if(strcmp(obname, basisname)==0){ + MetaBall *mb= ob->data; + + /* Copy properties from selected/edited metaball */ + mb->wiresize= active_mball->wiresize; + mb->rendersize= active_mball->rendersize; + mb->thresh= active_mball->thresh; + mb->flag= active_mball->flag; + } + } + } + } +} + /** \brief This function finds basic MetaBall. * * Basic MetaBall doesn't include any number at the end of |