Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/mball.c
| Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | MetaBall *BKE_mball_add(Main *bmain, const char *name) | ||||
| mb = BKE_libblock_alloc(bmain, ID_MB, name); | mb = BKE_libblock_alloc(bmain, ID_MB, name); | ||||
| BKE_mball_init(mb); | BKE_mball_init(mb); | ||||
| return mb; | return mb; | ||||
| } | } | ||||
| MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb) | /** | ||||
| * Only copy internal data of MetaBall ID from source to already allocated/initialized destination. | |||||
| * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs. | |||||
| * | |||||
| * WARNING! This function will not handle ID user count! | |||||
| * | |||||
| * \param flag Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). | |||||
| */ | |||||
| void BKE_mball_copy_data(Main *UNUSED(bmain), MetaBall *mb_dst, const MetaBall *mb_src, const int UNUSED(flag)) | |||||
| { | { | ||||
| MetaBall *mbn; | BLI_duplicatelist(&mb_dst->elems, &mb_src->elems); | ||||
| int a; | |||||
| mbn = BKE_libblock_copy(bmain, &mb->id); | mb_dst->mat = MEM_dupallocN(mb_src->mat); | ||||
| BLI_duplicatelist(&mbn->elems, &mb->elems); | mb_dst->editelems = NULL; | ||||
| mb_dst->lastelem = NULL; | |||||
| mbn->mat = MEM_dupallocN(mb->mat); | |||||
| for (a = 0; a < mbn->totcol; a++) { | |||||
| id_us_plus((ID *)mbn->mat[a]); | |||||
| } | } | ||||
| mbn->editelems = NULL; | MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb) | ||||
| mbn->lastelem = NULL; | { | ||||
| MetaBall *mb_copy; | |||||
| BKE_id_copy_ensure_local(bmain, &mb->id, &mbn->id); | BKE_id_copy_ex(bmain, &mb->id, (ID **)&mb_copy, 0, false); | ||||
| return mb_copy; | |||||
| return mbn; | |||||
| } | } | ||||
| void BKE_mball_make_local(Main *bmain, MetaBall *mb, const bool lib_local) | void BKE_mball_make_local(Main *bmain, MetaBall *mb, const bool lib_local) | ||||
| { | { | ||||
| BKE_id_make_local_generic(bmain, &mb->id, true, lib_local); | BKE_id_make_local_generic(bmain, &mb->id, true, lib_local); | ||||
| } | } | ||||
| /* most simple meta-element adding function | /* most simple meta-element adding function | ||||
| ▲ Show 20 Lines • Show All 406 Lines • Show Last 20 Lines | |||||