Blender  V2.93
Enumerations | Functions | Variables
BKE_mball.h File Reference

Go to the source code of this file.

Enumerations

enum  { BKE_MBALL_BATCH_DIRTY_ALL = 0 }
 

Functions

struct MetaBallBKE_mball_add (struct Main *bmain, const char *name)
 
bool BKE_mball_is_any_selected (const struct MetaBall *mb)
 
bool BKE_mball_is_any_selected_multi (struct Base **bases, int bases_len)
 
bool BKE_mball_is_any_unselected (const struct MetaBall *mb)
 
bool BKE_mball_is_basis_for (struct Object *ob1, struct Object *ob2)
 
bool BKE_mball_is_basis (struct Object *ob)
 Test, if ob is a basis meta-ball. More...
 
struct ObjectBKE_mball_basis_find (struct Scene *scene, struct Object *ob)
 This function finds the basis MetaBall. More...
 
void BKE_mball_texspace_calc (struct Object *ob)
 
struct BoundBoxBKE_mball_boundbox_get (struct Object *ob)
 
floatBKE_mball_make_orco (struct Object *ob, struct ListBase *dispbase)
 
void BKE_mball_properties_copy (struct Scene *scene, struct Object *active_object)
 copy some properties from object to other meta-ball object with same base name More...
 
bool BKE_mball_minmax_ex (const struct MetaBall *mb, float min[3], float max[3], const float obmat[4][4], const short flag)
 
bool BKE_mball_minmax (const struct MetaBall *mb, float min[3], float max[3])
 
bool BKE_mball_center_median (const struct MetaBall *mb, float r_cent[3])
 
bool BKE_mball_center_bounds (const struct MetaBall *mb, float r_cent[3])
 
void BKE_mball_transform (struct MetaBall *mb, const float mat[4][4], const bool do_props)
 
void BKE_mball_translate (struct MetaBall *mb, const float offset[3])
 
struct MetaElemBKE_mball_element_add (struct MetaBall *mb, const int type)
 
int BKE_mball_select_count (const struct MetaBall *mb)
 
int BKE_mball_select_count_multi (struct Base **bases, int bases_len)
 
bool BKE_mball_select_all (struct MetaBall *mb)
 
bool BKE_mball_select_all_multi_ex (struct Base **bases, int bases_len)
 
bool BKE_mball_deselect_all (struct MetaBall *mb)
 
bool BKE_mball_deselect_all_multi_ex (struct Base **bases, int bases_len)
 
bool BKE_mball_select_swap (struct MetaBall *mb)
 
bool BKE_mball_select_swap_multi_ex (struct Base **bases, int bases_len)
 
void BKE_mball_batch_cache_dirty_tag (struct MetaBall *mb, int mode)
 
void BKE_mball_batch_cache_free (struct MetaBall *mb)
 

Variables

void(* BKE_mball_batch_cache_dirty_tag_cb )(struct MetaBall *mb, int mode)
 
void(* BKE_mball_batch_cache_free_cb )(struct MetaBall *mb)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BKE_MBALL_BATCH_DIRTY_ALL 

Definition at line 81 of file BKE_mball.h.

Function Documentation

◆ BKE_mball_add()

struct MetaBall* BKE_mball_add ( struct Main bmain,
const char *  name 
)

Definition at line 214 of file mball.c.

References BKE_id_new(), and ID_MB.

Referenced by BKE_object_obdata_add_from_type().

◆ BKE_mball_basis_find()

struct Object* BKE_mball_basis_find ( Scene scene,
Object object 
)

This function finds the basis MetaBall.

Basis meta-ball doesn't include any number at the end of its name. All meta-balls with same base of name can be blended. meta-balls with different basic name can't be blended.

Warning
BKE_mball_is_basis() can fail on returned object, see function docs for details.

Definition at line 511 of file mball.c.

References BASE_FROM_DUPLI, BLI_split_name_num(), Object::id, LISTBASE_FOREACH, MAX_ID_NAME, ID::name, OB_MBALL, scene, STREQ, Object::type, and Scene::view_layers.

Referenced by BKE_displist_make_mball(), blender::deg::DepsgraphRelationBuilder::build_object_data_geometry(), and object_convert_exec().

◆ BKE_mball_batch_cache_dirty_tag()

void BKE_mball_batch_cache_dirty_tag ( struct MetaBall mb,
int  mode 
)

Definition at line 748 of file mball.c.

References MetaBall::batch_cache, and BKE_mball_batch_cache_dirty_tag_cb.

Referenced by BKE_object_batch_cache_dirty_tag().

◆ BKE_mball_batch_cache_free()

void BKE_mball_batch_cache_free ( struct MetaBall mb)

Definition at line 754 of file mball.c.

References MetaBall::batch_cache, and BKE_mball_batch_cache_free_cb.

Referenced by metaball_free_data().

◆ BKE_mball_boundbox_get()

struct BoundBox* BKE_mball_boundbox_get ( Object ob)

Return or compute bbox for given metaball object.

Definition at line 322 of file mball.c.

References Object_Runtime::bb, BKE_mball_texspace_calc(), BLI_assert, BOUNDBOX_DIRTY, Object_Runtime::curve_cache, BoundBox::flag, NULL, OB_MBALL, Object::runtime, and Object::type.

Referenced by BKE_object_boundbox_get().

◆ BKE_mball_center_bounds()

bool BKE_mball_center_bounds ( const struct MetaBall mb,
float  r_cent[3] 
)

Referenced by object_origin_set_exec().

◆ BKE_mball_center_median()

bool BKE_mball_center_median ( const struct MetaBall mb,
float  r_cent[3] 
)

Referenced by object_origin_set_exec().

◆ BKE_mball_deselect_all()

bool BKE_mball_deselect_all ( struct MetaBall mb)

◆ BKE_mball_deselect_all_multi_ex()

bool BKE_mball_deselect_all_multi_ex ( struct Base **  bases,
int  bases_len 
)

◆ BKE_mball_element_add()

struct MetaElem* BKE_mball_element_add ( struct MetaBall mb,
const int  type 
)

◆ BKE_mball_is_any_selected()

bool BKE_mball_is_any_selected ( const struct MetaBall mb)

◆ BKE_mball_is_any_selected_multi()

bool BKE_mball_is_any_selected_multi ( struct Base **  bases,
int  bases_len 
)

Definition at line 436 of file mball.c.

References BKE_mball_is_any_selected(), Object::data, if(), and Base::object.

Referenced by mball_select_all_exec().

◆ BKE_mball_is_any_unselected()

bool BKE_mball_is_any_unselected ( const struct MetaBall mb)

◆ BKE_mball_is_basis()

bool BKE_mball_is_basis ( Object ob)

Test, if ob is a basis meta-ball.

It test last character of Object ID name. If last character is digit it return 0, else it return 1.

Meta-Ball Basis Notes from Blender-2.5x

This is a can of worms.

This really needs a rewrite/refactor its totally broken in anything other than basic cases Multiple Scenes + Set Scenes & mixing meta-ball basis should work but fails to update the depsgraph on rename and linking into scenes or removal of basis meta-ball. So take care when changing this code.

Main idiot thing here is that the system returns BKE_mball_basis_find() objects which fail a BKE_mball_is_basis() test.

Not only that but the depsgraph and their areas depend on this behavior, so making small fixes here isn't worth it.

  • Campbell

Definition at line 398 of file mball.c.

References Object::id, len, and ID::name.

Referenced by BKE_mball_is_basis_for(), DRW_mball_batch_cache_pos_vertbuf_get(), DRW_metaball_batch_cache_get_edge_detection(), DRW_metaball_batch_cache_get_surface_shaded(), DRW_metaball_batch_cache_get_triangles_with_normals(), DRW_metaball_batch_cache_get_wireframes_face(), libblock_remap_data_postprocess_object_update(), object_convert_exec(), and OVERLAY_bounds().

◆ BKE_mball_is_basis_for()

bool BKE_mball_is_basis_for ( struct Object ob1,
struct Object ob2 
)

◆ BKE_mball_make_orco()

float* BKE_mball_make_orco ( struct Object ob,
struct ListBase dispbase 
)

◆ BKE_mball_minmax()

bool BKE_mball_minmax ( const struct MetaBall mb,
float  min[3],
float  max[3] 
)

◆ BKE_mball_minmax_ex()

bool BKE_mball_minmax_ex ( const struct MetaBall mb,
float  min[3],
float  max[3],
const float  obmat[4][4],
const short  flag 
)

◆ BKE_mball_properties_copy()

void BKE_mball_properties_copy ( Scene scene,
Object active_object 
)

copy some properties from object to other meta-ball object with same base name

When some properties (wire-size, threshold, update flags) of meta-ball are changed, then this properties are copied to all meta-balls in same "group" (meta-balls with same base name: MBall, MBall.001, MBall.002, etc). The most important is to copy properties to the base meta-ball, because this meta-ball influence polygonization of meta-balls.

Definition at line 465 of file mball.c.

References BKE_scene_base_iter_next(), BLI_split_name_num(), Object::data, DEG_id_tag_update(), MetaBall::flag, MetaBall::id, Object::id, MAX_ID_NAME, ID::name, NULL, OB_MBALL, MetaBall::rendersize, scene, STREQ, MetaBall::thresh, Object::type, and MetaBall::wiresize.

◆ BKE_mball_select_all()

bool BKE_mball_select_all ( struct MetaBall mb)

Definition at line 673 of file mball.c.

References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.

Referenced by BKE_mball_select_all_multi_ex().

◆ BKE_mball_select_all_multi_ex()

bool BKE_mball_select_all_multi_ex ( struct Base **  bases,
int  bases_len 
)

Definition at line 685 of file mball.c.

References BKE_mball_select_all(), Object::data, and Base::object.

Referenced by mball_select_all_exec().

◆ BKE_mball_select_count()

int BKE_mball_select_count ( const struct MetaBall mb)

◆ BKE_mball_select_count_multi()

int BKE_mball_select_count_multi ( struct Base **  bases,
int  bases_len 
)

Definition at line 662 of file mball.c.

References BKE_mball_select_count(), Object::data, and Base::object.

Referenced by mball_select_similar_exec().

◆ BKE_mball_select_swap()

bool BKE_mball_select_swap ( struct MetaBall mb)

Definition at line 720 of file mball.c.

References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.

Referenced by BKE_mball_select_swap_multi_ex().

◆ BKE_mball_select_swap_multi_ex()

bool BKE_mball_select_swap_multi_ex ( struct Base **  bases,
int  bases_len 
)

Definition at line 730 of file mball.c.

References BKE_mball_select_swap(), Object::data, and Base::object.

Referenced by mball_select_all_exec().

◆ BKE_mball_texspace_calc()

void BKE_mball_texspace_calc ( Object ob)

Compute bounding box of all MetaElem / MetaBall

Bounding box is computed from polygonized surface. ob is basic meta-balls (with name Meta for example). All other meta-ball objects (with names Meta.001, Meta.002, etc) are included in this bounding-box.

Definition at line 278 of file mball.c.

References Object_Runtime::bb, BKE_boundbox_init_from_minmax(), BOUNDBOX_DIRTY, Object_Runtime::curve_cache, data, CurveCache::disp, ListBase::first, BoundBox::flag, max, MEM_callocN, min, minmax_v3v3_v3(), DispList::next, DispList::nr, NULL, Object::runtime, and DispList::verts.

Referenced by BKE_displist_make_mball(), BKE_displist_make_mball_forRender(), and BKE_mball_boundbox_get().

◆ BKE_mball_transform()

void BKE_mball_transform ( struct MetaBall mb,
const float  mat[4][4],
const bool  do_props 
)

◆ BKE_mball_translate()

void BKE_mball_translate ( struct MetaBall mb,
const float  offset[3] 
)

Definition at line 643 of file mball.c.

References add_v3_v3(), MetaBall::elems, and LISTBASE_FOREACH.

Referenced by object_origin_set_exec().

Variable Documentation

◆ BKE_mball_batch_cache_dirty_tag_cb

void(* BKE_mball_batch_cache_dirty_tag_cb) (struct MetaBall *mb, int mode) ( struct MetaBall mb,
int  mode 
)
extern

Definition at line 745 of file mball.c.

Referenced by BKE_mball_batch_cache_dirty_tag(), and DRW_engines_register().

◆ BKE_mball_batch_cache_free_cb

void(* BKE_mball_batch_cache_free_cb) (struct MetaBall *mb) ( struct MetaBall mb)
extern

Definition at line 746 of file mball.c.

Referenced by BKE_mball_batch_cache_free(), and DRW_engines_register().