diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h index ae7df75345d..a769b6653d7 100644 --- a/source/blender/blenkernel/BKE_lightprobe.h +++ b/source/blender/blenkernel/BKE_lightprobe.h @@ -38,7 +38,8 @@ struct LightProbe; void BKE_lightprobe_init(struct LightProbe *probe); void *BKE_lightprobe_add(struct Main *bmain, const char *name); -struct LightProbe *BKE_lightprobe_copy(struct Main *bmain, struct LightProbe *probe); +void BKE_lightprobe_copy_data(struct Main *bmain, struct LightProbe *probe_dst, const struct LightProbe *probe_src, const int flag); +struct LightProbe *BKE_lightprobe_copy(struct Main *bmain, const struct LightProbe *probe); void BKE_lightprobe_make_local(struct Main *bmain, struct LightProbe *probe, const bool lib_local); void BKE_lightprobe_free(struct LightProbe *probe); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 92ddbe99f00..4721955af43 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1333,7 +1333,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int fla id_copy_animdata(bmain, new_id, (flag & LIB_ID_COPY_ACTIONS) != 0 && (flag & LIB_ID_CREATE_NO_MAIN) == 0); if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0 && (flag & LIB_ID_CREATE_NO_MAIN) == 0) { - DAG_id_type_tag(bmain, GS(new_id->name)); + DEG_id_type_tag(bmain, GS(new_id->name)); } *r_newid = new_id; diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index a3dc6e37ea0..23bd2a7bb16 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -913,7 +913,7 @@ void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_i const short type = GS(id->name); if (bmain && (flag & LIB_ID_FREE_NO_DEG_TAG) == 0) { - DAG_id_type_tag(bmain, type); + DEG_id_type_tag(bmain, type); } #ifdef WITH_PYTHON diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c index a1fa266512b..5601fa5ad42 100644 --- a/source/blender/blenkernel/intern/lightprobe.c +++ b/source/blender/blenkernel/intern/lightprobe.c @@ -59,22 +59,32 @@ void *BKE_lightprobe_add(Main *bmain, const char *name) { LightProbe *probe; - probe = BKE_libblock_alloc(bmain, ID_LP, name); + probe = BKE_libblock_alloc(bmain, ID_LP, name, 0); BKE_lightprobe_init(probe); return probe; } -LightProbe *BKE_lightprobe_copy(Main *bmain, LightProbe *probe) +/** + * Only copy internal data of LightProbe 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_lightprobe_copy_data( + Main *UNUSED(bmain), LightProbe *UNUSED(probe_dst), const LightProbe *UNUSED(probe_src), const int UNUSED(flag)) { - LightProbe *probe_new; + /* Nothing to do here. */ +} - probe_new = BKE_libblock_copy(bmain, &probe->id); - - BKE_id_copy_ensure_local(bmain, &probe->id, &probe_new->id); - - return probe_new; +LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe) +{ + LightProbe *probe_copy; + BKE_id_copy_ex(bmain, &probe->id, (ID **)&probe_copy, 0, false); + return probe_copy; } void BKE_lightprobe_make_local(Main *bmain, LightProbe *probe, const bool lib_local) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index d7b97ef672d..e250459ba2c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1186,7 +1186,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ BKE_pose_rebuild(ob_dst, ob_dst->data); } defgroup_copy_list(&ob_dst->defbase, &ob_src->defbase); - BKE_object_facemap_copy_list(&obn->fmaps, &ob->fmaps); + BKE_object_facemap_copy_list(&ob_dst->fmaps, &ob_src->fmaps); BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true); ob_dst->mode = OB_MODE_OBJECT; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 937b5ccffd6..6ab9d78bc01 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -228,9 +228,7 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons sce_dst->ed = NULL; sce_dst->theDag = NULL; - sce_dst->depsgraph = NULL; sce_dst->obedit = NULL; - sce_dst->stats = NULL; sce_dst->fps_info = NULL; BLI_duplicatelist(&(sce_dst->base), &(sce_src->base)); diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 82fface7d06..65eb08aba27 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -137,7 +137,7 @@ static bool UNUSED_FUNCTION(workspaces_is_screen_used)( WorkSpace *BKE_workspace_add(Main *bmain, const char *name) { - WorkSpace *new_workspace = BKE_libblock_alloc(bmain, ID_WS, name); + WorkSpace *new_workspace = BKE_libblock_alloc(bmain, ID_WS, name, 0); return new_workspace; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 3ed93ea5677..294e5e9651e 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -918,7 +918,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow) return; } } - BKE_libblock_free_datablock(id_cow); + BKE_libblock_free_datablock(id_cow, 0); BKE_libblock_free_data(id_cow, false); /* Signal datablock as not being expanded. */ id_cow->name[0] = '\0';