Add BKE_key_copy_ex() that takes a Main as parameter.
This commit is contained in:
parent
429394078b
commit
ae2033aca2
Notes:
blender-bot
2023-02-14 07:45:41 +01:00
Referenced by issue #48822, Crash when I try to use "Join" (Ctrl Key + J) with two meshes Referenced by issue #48824, Cycles: Crash with glass+volume(?)
|
@ -52,6 +52,7 @@ void BKE_key_free(struct Key *sc);
|
|||
void BKE_key_free_nolib(struct Key *key);
|
||||
struct Key *BKE_key_add(struct ID *id);
|
||||
struct Key *BKE_key_copy(struct Key *key);
|
||||
struct Key *BKE_key_copy_ex(struct Main *bmain, struct Key *key);
|
||||
struct Key *BKE_key_copy_nolib(struct Key *key);
|
||||
void BKE_key_make_local(struct Main *bmain, struct Key *key);
|
||||
void BKE_key_sort(struct Key *key);
|
||||
|
|
|
@ -195,7 +195,7 @@ Curve *BKE_curve_copy_ex(Main *bmain, Curve *cu)
|
|||
cun->bb = MEM_dupallocN(cu->bb);
|
||||
|
||||
if (cu->key) {
|
||||
cun->key = BKE_key_copy(cu->key);
|
||||
cun->key = BKE_key_copy_ex(bmain, cu->key);
|
||||
cun->key->from = (ID *)cun;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,12 +150,12 @@ Key *BKE_key_add(ID *id) /* common function */
|
|||
return key;
|
||||
}
|
||||
|
||||
Key *BKE_key_copy(Key *key)
|
||||
Key *BKE_key_copy_ex(Main *bmain, Key *key)
|
||||
{
|
||||
Key *keyn;
|
||||
KeyBlock *kbn, *kb;
|
||||
|
||||
keyn = BKE_libblock_copy(&key->id);
|
||||
keyn = BKE_libblock_copy_ex(bmain, &key->id);
|
||||
|
||||
BLI_duplicatelist(&keyn->block, &key->block);
|
||||
|
||||
|
@ -171,12 +171,16 @@ Key *BKE_key_copy(Key *key)
|
|||
}
|
||||
|
||||
if (ID_IS_LINKED_DATABLOCK(key)) {
|
||||
BKE_id_lib_local_paths(G.main, key->id.lib, &keyn->id);
|
||||
BKE_id_lib_local_paths(bmain, key->id.lib, &keyn->id);
|
||||
}
|
||||
|
||||
return keyn;
|
||||
}
|
||||
|
||||
Key *BKE_key_copy(Key *key)
|
||||
{
|
||||
return BKE_key_copy_ex(G.main, key);
|
||||
}
|
||||
|
||||
Key *BKE_key_copy_nolib(Key *key)
|
||||
{
|
||||
|
|
|
@ -285,7 +285,7 @@ Lattice *BKE_lattice_copy_ex(Main *bmain, Lattice *lt)
|
|||
ltn->def = MEM_dupallocN(lt->def);
|
||||
|
||||
if (lt->key) {
|
||||
ltn->key = BKE_key_copy(ltn->key);
|
||||
ltn->key = BKE_key_copy_ex(bmain, ltn->key);
|
||||
ltn->key->from = (ID *)ltn;
|
||||
}
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
|
|||
men->bb = MEM_dupallocN(men->bb);
|
||||
|
||||
if (me->key) {
|
||||
men->key = BKE_key_copy(me->key);
|
||||
men->key = BKE_key_copy_ex(bmain, me->key);
|
||||
men->key->from = (ID *)men;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
|||
*/
|
||||
if (key) {
|
||||
/* make a duplicate copy that will only be used here... (must remember to free it!) */
|
||||
nkey = BKE_key_copy(key);
|
||||
nkey = BKE_key_copy_ex(bmain, key);
|
||||
|
||||
/* for all keys in old block, clear data-arrays */
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
|
|
Loading…
Reference in New Issue