diff options
33 files changed, 46 insertions, 109 deletions
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 9b1e2c0d41b..e54e2fb4b87 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -237,7 +237,7 @@ bool id_single_user(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); bool BKE_id_copy_is_allowed(const struct ID *id); -bool BKE_id_copy(struct Main *bmain, const struct ID *id, struct ID **newid); +struct ID *BKE_id_copy(struct Main *bmain, const struct ID *id); struct ID *BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 3b02087e2d2..4d92390cdcb 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -312,9 +312,7 @@ bAction *BKE_action_add(Main *bmain, const char name[]) bAction *BKE_action_copy(Main *bmain, const bAction *act_src) { - bAction *act_copy; - BKE_id_copy(bmain, &act_src->id, (ID **)&act_copy); - return act_copy; + return (bAction *)BKE_id_copy(bmain, &act_src->id); } /* *************** Action Groups *************** */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 0a731f0a7f0..742f57f32a3 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -428,9 +428,7 @@ static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature *arm_dst) bArmature *BKE_armature_copy(Main *bmain, const bArmature *arm) { - bArmature *arm_copy; - BKE_id_copy(bmain, &arm->id, (ID **)&arm_copy); - return arm_copy; + return (bArmature *)BKE_id_copy(bmain, &arm->id); } /** \} */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f559689608f..e1524422c3b 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -1533,9 +1533,7 @@ struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mo Brush *BKE_brush_copy(Main *bmain, const Brush *brush) { - Brush *brush_copy; - BKE_id_copy(bmain, &brush->id, (ID **)&brush_copy); - return brush_copy; + return (Brush *)BKE_id_copy(bmain, &brush->id); } void BKE_brush_debug_print_state(Brush *br) diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index 9475ba7efcf..65dcf3673d6 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -256,9 +256,7 @@ void *BKE_cachefile_add(Main *bmain, const char *name) CacheFile *BKE_cachefile_copy(Main *bmain, const CacheFile *cache_file) { - CacheFile *cache_file_copy; - BKE_id_copy(bmain, &cache_file->id, (ID **)&cache_file_copy); - return cache_file_copy; + return (CacheFile *)BKE_id_copy(bmain, &cache_file->id); } void BKE_cachefile_reload(Depsgraph *depsgraph, CacheFile *cache_file) diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 4fe3ddc81a1..1183e359d93 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -222,9 +222,7 @@ void *BKE_camera_add(Main *bmain, const char *name) Camera *BKE_camera_copy(Main *bmain, const Camera *cam) { - Camera *cam_copy; - BKE_id_copy(bmain, &cam->id, (ID **)&cam_copy); - return cam_copy; + return (Camera *)BKE_id_copy(bmain, &cam->id); } /* get the camera's dof value, takes the dof object into account */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 64785248daf..eb469f5400f 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -427,9 +427,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type) Curve *BKE_curve_copy(Main *bmain, const Curve *cu) { - Curve *cu_copy; - BKE_id_copy(bmain, &cu->id, (ID **)&cu_copy); - return cu_copy; + return (Curve *)BKE_id_copy(bmain, &cu->id); } /* Get list of nurbs from editnurbs structure */ diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 980d608df77..f40cfba5077 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -980,9 +980,7 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src) */ bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd) { - bGPdata *gpd_copy; - BKE_id_copy(bmain, &gpd->id, (ID **)&gpd_copy); - return gpd_copy; + return (bGPdata *)BKE_id_copy(bmain, &gpd->id); } /** @@ -1009,7 +1007,7 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in } else { BLI_assert(bmain != NULL); - BKE_id_copy(bmain, &gpd_src->id, (ID **)&gpd_dst); + gpd_dst = (bGPdata *)BKE_id_copy(bmain, &gpd_src->id); } /* Copy internal data (layers, etc.) */ diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c index edbc13d8773..5d995cbbb4d 100644 --- a/source/blender/blenkernel/intern/hair.c +++ b/source/blender/blenkernel/intern/hair.c @@ -253,9 +253,7 @@ void *BKE_hair_add(Main *bmain, const char *name) Hair *BKE_hair_copy(Main *bmain, const Hair *hair) { - Hair *hair_copy; - BKE_id_copy(bmain, &hair->id, (ID **)&hair_copy); - return hair_copy; + return (Hair *)BKE_id_copy(bmain, &hair->id); } BoundBox *BKE_hair_boundbox_get(Object *ob) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index a02f2222503..d1f29c39f63 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -603,9 +603,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src) /* empty image block, of similar type and filename */ Image *BKE_image_copy(Main *bmain, const Image *ima) { - Image *ima_copy; - BKE_id_copy(bmain, &ima->id, (ID **)&ima_copy); - return ima_copy; + return (Image *)BKE_id_copy(bmain, &ima->id); } void BKE_image_merge(Main *bmain, Image *dest, Image *source) diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 1b63aa1a8af..a0c4405535a 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -298,9 +298,7 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */ Key *BKE_key_copy(Main *bmain, const Key *key) { - Key *key_copy; - BKE_id_copy(bmain, &key->id, (ID **)&key_copy); - return key_copy; + return (Key *)BKE_id_copy(bmain, &key->id); } /* XXX TODO get rid of this! */ diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index b9745c67c66..950c08bf770 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -403,9 +403,7 @@ Lattice *BKE_lattice_add(Main *bmain, const char *name) Lattice *BKE_lattice_copy(Main *bmain, const Lattice *lt) { - Lattice *lt_copy; - BKE_id_copy(bmain, <->id, (ID **)<_copy); - return lt_copy; + return (Lattice *)BKE_id_copy(bmain, <->id); } bool object_deform_mball(Object *ob, ListBase *dispbase) diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index f69bada0fe8..cfe81531204 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -414,11 +414,11 @@ void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags) BKE_lib_id_expand_local(bmain, id); } else { - ID *id_new; + ID *id_new = BKE_id_copy(bmain, id); /* Should not fail in expected use cases, * but a few ID types cannot be copied (LIB, WM, SCR...). */ - if (BKE_id_copy(bmain, id, &id_new)) { + if (id_new != NULL) { id_new->us = 0; /* setting newid is mandatory for complex make_lib_local logic... */ @@ -614,9 +614,9 @@ ID *BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag) * Invokes the appropriate copy method for the block and returns the result in * newid, unless test. Returns true if the block can be copied. */ -bool BKE_id_copy(Main *bmain, const ID *id, ID **newid) +ID *BKE_id_copy(Main *bmain, const ID *id) { - return (BKE_id_copy_ex(bmain, id, newid, LIB_ID_COPY_DEFAULT) != NULL); + return BKE_id_copy_ex(bmain, id, NULL, LIB_ID_COPY_DEFAULT); } /** @@ -634,8 +634,7 @@ ID *BKE_id_copy_for_duplicate(Main *bmain, ID *id, const eDupli_ID_Flags duplica return id; } - ID *id_new; - BKE_id_copy(bmain, id, &id_new); + ID *id_new = BKE_id_copy(bmain, id); /* Copying add one user by default, need to get rid of that one. */ id_us_min(id_new); ID_NEW_SET(id, id_new); diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 7fd8b05ec0a..a989a865994 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -189,9 +189,9 @@ void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bo static ID *lib_override_library_create_from(Main *bmain, ID *reference_id) { - ID *local_id; + ID *local_id = BKE_id_copy(bmain, reference_id); - if (!BKE_id_copy(bmain, reference_id, (ID **)&local_id)) { + if (local_id == NULL) { return NULL; } id_us_min(local_id); @@ -1699,8 +1699,7 @@ void BKE_lib_override_library_update(Main *bmain, ID *local) * Not impossible to do, but would rather see first if extra useless usual user handling * is actually a (performances) issue here. */ - ID *tmp_id; - BKE_id_copy(bmain, local->override_library->reference, &tmp_id); + ID *tmp_id = BKE_id_copy(bmain, local->override_library->reference); if (tmp_id == NULL) { return; @@ -1868,7 +1867,7 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain, * (and possibly all over Blender code). * Not impossible to do, but would rather see first is extra useless usual user handling is * actually a (performances) issue here, before doing it. */ - BKE_id_copy((Main *)override_storage, local, &storage_id); + storage_id = BKE_id_copy((Main *)override_storage, local); if (storage_id != NULL) { PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage; diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index 437e61a5fca..74226c92681 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -222,9 +222,7 @@ Light *BKE_light_add(Main *bmain, const char *name) Light *BKE_light_copy(Main *bmain, const Light *la) { - Light *la_copy; - BKE_id_copy(bmain, &la->id, (ID **)&la_copy); - return la_copy; + return (Light *)BKE_id_copy(bmain, &la->id); } void BKE_light_eval(struct Depsgraph *depsgraph, Light *la) diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c index cf680641a7b..2a355ede9d7 100644 --- a/source/blender/blenkernel/intern/lightprobe.c +++ b/source/blender/blenkernel/intern/lightprobe.c @@ -144,7 +144,5 @@ void *BKE_lightprobe_add(Main *bmain, const char *name) LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe) { - LightProbe *probe_copy; - BKE_id_copy(bmain, &probe->id, (ID **)&probe_copy); - return probe_copy; + return (LightProbe *)BKE_id_copy(bmain, &probe->id); } diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index f0f06b6402a..eae7f49cfac 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -812,9 +812,7 @@ FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name) FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineStyle *linestyle) { - FreestyleLineStyle *linestyle_copy; - BKE_id_copy(bmain, &linestyle->id, (ID **)&linestyle_copy); - return linestyle_copy; + return (FreestyleLineStyle *)BKE_id_copy(bmain, &linestyle->id); } FreestyleLineStyle *BKE_linestyle_active_from_view_layer(ViewLayer *view_layer) diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 8ef3d77d5e8..ab69adf2643 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1076,9 +1076,7 @@ Mask *BKE_mask_copy_nolib(Mask *mask) Mask *BKE_mask_copy(Main *bmain, const Mask *mask) { - Mask *mask_copy; - BKE_id_copy(bmain, &mask->id, (ID **)&mask_copy); - return mask_copy; + return (Mask *)BKE_id_copy(bmain, &mask->id); } void BKE_mask_point_free(MaskSplinePoint *point) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 8c09cb551a1..db9fccbc443 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -319,9 +319,7 @@ Material *BKE_gpencil_material_add(Main *bmain, const char *name) Material *BKE_material_copy(Main *bmain, const Material *ma) { - Material *ma_copy; - BKE_id_copy(bmain, &ma->id, (ID **)&ma_copy); - return ma_copy; + return (Material *)BKE_id_copy(bmain, &ma->id); } Material ***BKE_object_material_array_p(Object *ob) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index f8409760ddd..0829b1b5b57 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -219,9 +219,7 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name) MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb) { - MetaBall *mb_copy; - BKE_id_copy(bmain, &mb->id, (ID **)&mb_copy); - return mb_copy; + return (MetaBall *)BKE_id_copy(bmain, &mb->id); } /* most simple meta-element adding function diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index d0ee4d53eb1..16adc65c4f7 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1019,9 +1019,7 @@ Mesh *BKE_mesh_copy_for_eval(struct Mesh *source, bool reference) Mesh *BKE_mesh_copy(Main *bmain, const Mesh *me) { - Mesh *me_copy; - BKE_id_copy(bmain, &me->id, (ID **)&me_copy); - return me_copy; + return (Mesh *)BKE_id_copy(bmain, &me->id); } BMesh *BKE_mesh_to_bmesh_ex(const Mesh *me, diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 364e6c9bfe4..861ea26f7fb 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1920,9 +1920,7 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip, MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip) { - MovieClip *clip_copy; - BKE_id_copy(bmain, &clip->id, (ID **)&clip_copy); - return clip_copy; + return (MovieClip *)BKE_id_copy(bmain, &clip->id); } float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 16ac027fb34..676277dae8c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1790,8 +1790,7 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src) */ Object *BKE_object_copy(Main *bmain, const Object *ob) { - Object *ob_copy; - BKE_id_copy(bmain, &ob->id, (ID **)&ob_copy); + Object *ob_copy = (Object *)BKE_id_copy(bmain, &ob->id); /* We increase object user count when linking to Collections. */ id_us_min(&ob_copy->id); @@ -1829,8 +1828,7 @@ Object *BKE_object_duplicate(Main *bmain, Material ***matarar; - Object *obn; - BKE_id_copy(bmain, &ob->id, (ID **)&obn); + Object *obn = (Object *)BKE_id_copy(bmain, &ob->id); id_us_min(&obn->id); if (is_subprocess) { ID_NEW_SET(ob, obn); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index d363f5d0f5e..df4a78b8c5b 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -679,9 +679,7 @@ PaintCurve *BKE_paint_curve_add(Main *bmain, const char *name) PaintCurve *BKE_paint_curve_copy(Main *bmain, const PaintCurve *pc) { - PaintCurve *pc_copy; - BKE_id_copy(bmain, &pc->id, (ID **)&pc_copy); - return pc_copy; + return (PaintCurve *)BKE_id_copy(bmain, &pc->id); } Palette *BKE_paint_palette(Paint *p) @@ -743,9 +741,7 @@ Palette *BKE_palette_add(Main *bmain, const char *name) Palette *BKE_palette_copy(Main *bmain, const Palette *palette) { - Palette *palette_copy; - BKE_id_copy(bmain, &palette->id, (ID **)&palette_copy); - return palette_copy; + return (Palette *)BKE_id_copy(bmain, &palette->id); } PaletteColor *BKE_palette_color_add(Palette *palette) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index c20a7842097..e984308b873 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3909,9 +3909,7 @@ void BKE_particlesettings_twist_curve_init(ParticleSettings *part) ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings *part) { - ParticleSettings *part_copy; - BKE_id_copy(bmain, &part->id, (ID **)&part_copy); - return part_copy; + return (ParticleSettings *)BKE_id_copy(bmain, &part->id); } /************************************************/ diff --git a/source/blender/blenkernel/intern/pointcloud.c b/source/blender/blenkernel/intern/pointcloud.c index 32a09e0857f..9f2e9efa8cb 100644 --- a/source/blender/blenkernel/intern/pointcloud.c +++ b/source/blender/blenkernel/intern/pointcloud.c @@ -232,9 +232,7 @@ void *BKE_pointcloud_add_default(Main *bmain, const char *name) PointCloud *BKE_pointcloud_copy(Main *bmain, const PointCloud *pointcloud) { - PointCloud *pointcloud_copy; - BKE_id_copy(bmain, &pointcloud->id, (ID **)&pointcloud_copy); - return pointcloud_copy; + return (PointCloud *)BKE_id_copy(bmain, &pointcloud->id); } BoundBox *BKE_pointcloud_boundbox_get(Object *ob) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 39bb19c009a..e0cc2905074 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -873,7 +873,7 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type) eDupli_ID_Flags duplicate_flags = U.dupflag | USER_DUP_OBJECT; - BKE_id_copy(bmain, (ID *)sce, (ID **)&sce_copy); + sce_copy = (Scene *)BKE_id_copy(bmain, (ID *)sce); id_us_min(&sce_copy->id); id_us_ensure_real(&sce_copy->id); diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index 0a8b4baf826..8e1d0aae721 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -127,7 +127,5 @@ void *BKE_speaker_add(Main *bmain, const char *name) Speaker *BKE_speaker_copy(Main *bmain, const Speaker *spk) { - Speaker *spk_copy; - BKE_id_copy(bmain, &spk->id, (ID **)&spk_copy); - return spk_copy; + return (Speaker *)BKE_id_copy(bmain, &spk->id); } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 54999fd13f9..b8eabc29f39 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -518,9 +518,7 @@ Text *BKE_text_load(Main *bmain, const char *file, const char *relpath) Text *BKE_text_copy(Main *bmain, const Text *ta) { - Text *ta_copy; - BKE_id_copy(bmain, &ta->id, (ID **)&ta_copy); - return ta_copy; + return (Text *)BKE_id_copy(bmain, &ta->id); } void BKE_text_clear(Text *text) /* called directly from rna */ diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 4d113597745..8c46b192b0b 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -457,9 +457,7 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot) Tex *BKE_texture_copy(Main *bmain, const Tex *tex) { - Tex *tex_copy; - BKE_id_copy(bmain, &tex->id, (ID **)&tex_copy); - return tex_copy; + return (Tex *)BKE_id_copy(bmain, &tex->id); } /* ------------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index fbe6f3e075c..f7c7a2ec323 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -612,9 +612,7 @@ void *BKE_volume_add(Main *bmain, const char *name) Volume *BKE_volume_copy(Main *bmain, const Volume *volume) { - Volume *volume_copy; - BKE_id_copy(bmain, &volume->id, (ID **)&volume_copy); - return volume_copy; + return (Volume *)BKE_id_copy(bmain, &volume->id); } /* Sequence */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index e08a9148f15..1cc762dfb65 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1819,8 +1819,7 @@ static Collection *single_object_users_collection(Main *bmain, /* Generate new copies for objects in given collection and all its children, * and optionally also copy collections themselves. */ if (copy_collections && !is_master_collection) { - Collection *collection_new; - BKE_id_copy(bmain, &collection->id, (ID **)&collection_new); + Collection *collection_new = (Collection *)BKE_id_copy(bmain, &collection->id); id_us_min(&collection_new->id); collection = ID_NEW_SET(collection, collection_new); } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index f1c125fcbb9..320476c22b1 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -523,16 +523,12 @@ static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph) static ID *rna_ID_copy(ID *id, Main *bmain) { - ID *newid; + ID *newid = BKE_id_copy(bmain, id); - if (BKE_id_copy(bmain, id, &newid)) { - if (newid != NULL) { - id_us_min(newid); - } - return newid; + if (newid != NULL) { + id_us_min(newid); } - - return NULL; + return newid; } static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) |