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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_mball.h2
-rw-r--r--source/blender/blenkernel/intern/mball.c17
-rw-r--r--source/blender/blenkernel/intern/object.c2
3 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index e6874cd064b..2eee5f72c0f 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -32,6 +32,7 @@
* \since March 2001
* \author nzc
*/
+struct BoundBox;
struct Depsgraph;
struct Main;
struct MetaBall;
@@ -54,6 +55,7 @@ bool BKE_mball_is_basis(struct Object *ob);
struct Object *BKE_mball_basis_find(struct Scene *scene, struct Object *ob);
void BKE_mball_texspace_calc(struct Object *ob);
+struct BoundBox *BKE_mball_boundbox_get(struct Object *ob);
float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase);
void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object);
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index bc2d7ed79d5..5e4f5614370 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -238,6 +238,23 @@ void BKE_mball_texspace_calc(Object *ob)
bb->flag &= ~BOUNDBOX_DIRTY;
}
+/** Return or compute bbox for given metaball object. */
+BoundBox *BKE_mball_boundbox_get(Object *ob)
+{
+ BLI_assert(ob->type == OB_MBALL);
+
+ if (ob->bb != NULL && (ob->bb->flag & BOUNDBOX_DIRTY) == 0) {
+ return ob->bb;
+ }
+
+ /* This should always only be called with evaluated objects, but currently RNA is a problem here... */
+ if (ob->runtime.curve_cache != NULL) {
+ BKE_mball_texspace_calc(ob);
+ }
+
+ return ob->bb;
+}
+
float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)
{
BoundBox *bb;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index b4060d6e60a..aa5c006482a 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2442,7 +2442,7 @@ BoundBox *BKE_object_boundbox_get(Object *ob)
bb = BKE_curve_boundbox_get(ob);
}
else if (ob->type == OB_MBALL) {
- bb = ob->bb;
+ bb = BKE_mball_boundbox_get(ob);
}
else if (ob->type == OB_LATTICE) {
bb = BKE_lattice_boundbox_get(ob);