Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Hnidek <jiri.hnidek@tul.cz>2009-08-03 18:40:10 +0400
committerJiri Hnidek <jiri.hnidek@tul.cz>2009-08-03 18:40:10 +0400
commite9c15504324f7daad19b0910b99385ac5e8c9a8e (patch)
tree95a568e9350fad5e4f0ccebdcf50a61d498147ce /source/blender/blenkernel/intern/mball.c
parentadbae1d174dab99dee91312361cdd762e32e1ddb (diff)
2.5 MetaBalls and UI
* Added callback function for some metaball properties: When some properties (wiresize, threshold, update flags) of metaball are changed, then these properties are copied to all metaballs in the group (all metaballs with same base name). This is important to "share" some properties between metaballs, because polygonisation of metaball is influenced only by properties of base metaball and base metaball can be changed. * Improved drawing of selected Metaball objects
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r--source/blender/blenkernel/intern/mball.c49
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