|
Blender V5.0
|
#include <cctype>#include <cfloat>#include <cmath>#include <cstdlib>#include <cstring>#include <optional>#include "MEM_guardedalloc.h"#include "DNA_defaults.h"#include "DNA_material_types.h"#include "DNA_mesh_types.h"#include "DNA_meta_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_listbase.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_string_utils.hh"#include "BLI_utildefines.h"#include "BLT_translation.hh"#include "BKE_main.hh"#include "BKE_geometry_set.hh"#include "BKE_idtype.hh"#include "BKE_lattice.hh"#include "BKE_layer.hh"#include "BKE_lib_id.hh"#include "BKE_lib_query.hh"#include "BKE_library.hh"#include "BKE_mball.hh"#include "BKE_mball_tessellate.hh"#include "BKE_object.hh"#include "BKE_object_types.hh"#include "DEG_depsgraph.hh"#include "BLO_read_write.hh"Go to the source code of this file.
Macros | |
| #define | DNA_DEPRECATED_ALLOW |
Variables | |
| IDTypeInfo | IDType_ID_MB |
MetaBalls are created from a single Object (with a name without number in it). All objects with the same name (but with a number in it) are added to this.
Definition in file mball.cc.
Definition at line 173 of file mball.cc.
References BKE_id_new(), and name.
Referenced by BKE_object_obdata_add_from_type().
This function finds the basis meta-ball.
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.
Definition at line 419 of file mball.cc.
References BASE_FROM_DUPLI, BKE_view_layer_object_bases_get(), BKE_view_layer_synced_ensure(), BLI_string_split_name_number(), Object::id, LISTBASE_FOREACH, MAX_ID_NAME, ID::name, OB_MBALL, STREQ, Object::type, and Scene::view_layers.
Referenced by BKE_mball_data_update(), blender::deg::DepsgraphRelationBuilder::build_object_data_geometry(), blender::ed::object::convert_mball_to_mesh(), and blender::ed::object::object_convert_exec().
Definition at line 513 of file mball.cc.
References BKE_mball_minmax(), max, mid_v3_v3v3(), and min.
Referenced by blender::ed::object::object_origin_set_exec().
Definition at line 495 of file mball.cc.
References add_v3_v3(), MetaBall::elems, LISTBASE_FOREACH, mul_v3_fl(), and zero_v3().
Referenced by blender::ed::object::object_origin_set_exec().
Definition at line 650 of file mball.cc.
References BKE_lattice_deform_coords(), BKE_mball_basis_find(), BKE_mball_polygonize(), BKE_object_free_derived_caches(), BLI_assert, Object::data, depsgraph, GeometrySet::from_mesh(), MetaBall::mat, MEM_dupallocN(), OB_LATTICE, OB_MBALL, Object::parent, PARSKEL, Object::partype, Object::runtime, MetaBall::totcol, and Object::type.
Referenced by BKE_object_handle_data_update(), and blender::ed::object::object_force_modifier_update_for_bind().
| bool BKE_mball_deselect_all | ( | MetaBall * | mb | ) |
Definition at line 603 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by BKE_mball_deselect_all_multi_ex(), do_lasso_select_meta(), do_meta_box_select(), and mball_circle_select().
Definition at line 615 of file mball.cc.
References BKE_mball_deselect_all(), Object::data, DEG_id_tag_update(), MetaBall::id, and ID_RECALC_SELECT.
Most simple meta-element adding function.
Definition at line 179 of file mball.cc.
References BLI_addtail(), MetaBall::elems, MetaElem::expx, MetaElem::expy, MetaElem::expz, MetaElem::flag, MB_BALL, MB_CUBE, MB_ELIPSOID, MB_PLANE, MB_SCALE_RAD, MB_TUBE, MEM_callocN(), MetaElem::quat, MetaElem::rad, MetaElem::s, MetaElem::type, and unit_qt().
Referenced by ED_mball_add_primitive().
Calculate & return the display radius.
Definition at line 245 of file mball.cc.
References MetaElem::expx, MetaElem::expy, MetaElem::expz, M_SQRT2, MB_CUBE, min_fff(), MetaElem::rad, and MetaElem::type.
Referenced by blender::draw::overlay::Metaballs::object_sync().
| blender::float2 BKE_mball_element_display_radius_calc_with_stiffness | ( | const MetaElem * | ml | ) |
Calculate & return the display radius & stiffness.
Definition at line 226 of file mball.cc.
References atanf, MetaElem::expx, MetaElem::expy, MetaElem::expz, float, M_SQRT2, MB_CUBE, min_fff(), blender::math::numbers::pi, MetaElem::rad, MetaElem::s, and MetaElem::type.
Referenced by blender::draw::overlay::Metaballs::edit_object_sync().
| bool BKE_mball_is_any_selected | ( | const MetaBall * | mb | ) |
Definition at line 299 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by BKE_mball_is_any_selected_multi(), delete_metaelems_exec(), and duplicate_metaelems_exec().
Definition at line 309 of file mball.cc.
References BKE_mball_is_any_selected(), and Object::data.
| bool BKE_mball_is_any_unselected | ( | const MetaBall * | mb | ) |
Definition at line 321 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by select_random_metaelems_exec().
| bool BKE_mball_is_basis | ( | const 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.
Definition at line 255 of file mball.cc.
References Object::id, len, and ID::name.
Referenced by BKE_mball_is_basis_for(), libblock_remap_data_postprocess_object_update(), blender::ed::object::object_convert_exec(), and blender::draw::overlay::Bounds::object_sync().
Return true if ob1 and ob2 are part of the same metaBall group, and ob1 is its basis.
Definition at line 294 of file mball.cc.
References BKE_mball_is_basis(), and BKE_mball_is_same_group().
Referenced by libblock_remap_data_postprocess_object_update().
Return true if ob1 and ob2 are part of the same metaBall group.
Definition at line 278 of file mball.cc.
References BLI_string_split_name_number(), Object::id, MAX_ID_NAME, ID::name, and STREQ.
Referenced by BKE_mball_is_basis_for().
Definition at line 484 of file mball.cc.
References BLI_listbase_is_empty(), MetaBall::elems, INIT_MINMAX, LISTBASE_FOREACH, max, min, and minmax_v3v3_v3().
Referenced by BKE_mball_center_bounds().
| bool BKE_mball_minmax_ex | ( | const MetaBall * | mb, |
| float | min[3], | ||
| float | max[3], | ||
| const float | obmat[4][4], | ||
| const short | flag ) |
Definition at line 451 of file mball.cc.
References add_v3_fl(), copy_v3_v3(), MetaBall::elems, flag, i, INIT_MINMAX, LISTBASE_FOREACH, mat4_to_scale(), max, min, minmax_v3v3_v3(), and mul_v3_m4v3().
Referenced by ED_view3d_minmax_verts().
Copy some properties from a meta-ball obdata to all other meta-ball obdata belonging to the same family (i.e. object sharing the same name basis).
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 influences polygonization of meta-balls.
WARNING: This code does not cover all potential corner-cases. E.g. if:
| Object | ObData | | ---------- | ---------- | | Meta_A | Meta_A | | Meta_A.001 | Meta_A.001 | | Meta_B | Meta_A | | Meta_B.001 | Meta_B.001 |
Calling this function with metaball_src being Meta_A.001 will update Meta_A, but NOT Meta_B.001. So in the 'Meta_B' family, the two metaballs will have unmatching settings now.
Solving this case would drastically increase the complexity of this code though, so don't think it would be worth it.
Definition at line 340 of file mball.cc.
References BLI_string_split_name_number(), Object::data, ListBase::first, Object::id, ID_IS_EDITABLE, MAX_ID_NAME, mball_data_properties_copy(), ID::name, ID::next, OB_MBALL, Main::objects, ID::prev, STREQ, and Object::type.
| bool BKE_mball_select_all | ( | MetaBall * | mb | ) |
Definition at line 580 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by BKE_mball_select_all_multi_ex().
Definition at line 592 of file mball.cc.
References BKE_mball_select_all(), and Object::data.
| int BKE_mball_select_count | ( | const MetaBall * | mb | ) |
Definition at line 558 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by BKE_mball_select_count_multi().
Definition at line 569 of file mball.cc.
References BKE_mball_select_count(), and Object::data.
| bool BKE_mball_select_swap | ( | MetaBall * | mb | ) |
Definition at line 627 of file mball.cc.
References MetaBall::editelems, LISTBASE_FOREACH, and SELECT.
Referenced by BKE_mball_select_swap_multi_ex().
Definition at line 637 of file mball.cc.
References BKE_mball_select_swap(), and Object::data.
Definition at line 525 of file mball.cc.
References MetaBall::elems, LISTBASE_FOREACH, mat4_to_quat(), mat4_to_scale(), MB_TYPE_SIZE_SQUARED, mul_m4_v3(), mul_qt_qtqt(), mul_v3_fl(), and sqrtf.
Referenced by blender::ed::object::apply_objects_internal(), and blender::ed::object::metaball_coords_and_quats_apply_with_mat4().
Definition at line 551 of file mball.cc.
References add_v3_v3(), MetaBall::elems, and LISTBASE_FOREACH.
Referenced by blender::ed::object::object_origin_set_exec().
Definition at line 331 of file mball.cc.
References DEG_id_tag_update(), MetaBall::flag, MetaBall::id, MetaBall::rendersize, MetaBall::thresh, and MetaBall::wiresize.
Referenced by BKE_mball_properties_copy().
|
static |
Definition at line 125 of file mball.cc.
References BLO_read_pointer_array(), BLO_read_struct_list, MetaBall::editelems, MetaBall::elems, MetaBall::lastelem, MetaBall::mat, MetaBall::needs_flush_to_id, and MetaBall::totcol.
|
static |
Definition at line 103 of file mball.cc.
References BKE_id_blend_write(), BLO_write_id_struct, BLO_write_pointer_array(), BLO_write_struct, MetaBall::editelems, MetaBall::elems, MetaBall::id, MetaBall::lastelem, LISTBASE_FOREACH, MetaBall::mat, MetaBall::needs_flush_to_id, and MetaBall::totcol.
|
static |
Definition at line 69 of file mball.cc.
References BLI_duplicatelist(), MetaBall::editelems, MetaBall::elems, MetaBall::lastelem, MetaBall::mat, and MEM_dupallocN().
|
static |
Definition at line 95 of file mball.cc.
References BKE_LIB_FOREACHID_PROCESS_IDSUPER, data, i, IDWALK_CB_USER, and metaball().
|
static |
Definition at line 86 of file mball.cc.
References BLI_freelistN(), MEM_SAFE_FREE, and metaball().
|
static |
Definition at line 60 of file mball.cc.
References BLI_assert, DNA_struct_default_get, MEMCMP_STRUCT_AFTER_IS_ZERO, MEMCPY_STRUCT_AFTER, and metaball().
| IDTypeInfo IDType_ID_MB |