diff options
Diffstat (limited to 'source/blender')
63 files changed, 152 insertions, 161 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 60d988ab21e..f74285b5313 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -57,7 +57,7 @@ struct bAction *BKE_action_copy(struct Main *bmain, const struct bAction *act_sr /* Deallocate all of the Action's data, but not the Action itself */ void BKE_action_free(struct bAction *act); -void BKE_action_make_local(struct Main *bmain, struct bAction *act, const bool lib_local); +void BKE_action_make_local(struct Main *bmain, struct bAction *act, const int flags); /* Action API ----------------- */ diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 583d8539c03..86d8362f5e6 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -68,7 +68,7 @@ struct bArmature *BKE_armature_from_object(struct Object *ob); int BKE_armature_bonelist_count(struct ListBase *lb); void BKE_armature_bonelist_free(struct ListBase *lb); void BKE_armature_free(struct bArmature *arm); -void BKE_armature_make_local(struct Main *bmain, struct bArmature *arm, const bool lib_local); +void BKE_armature_make_local(struct Main *bmain, struct bArmature *arm, const int flags); void BKE_armature_copy_data(struct Main *bmain, struct bArmature *arm_dst, const struct bArmature *arm_src, diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index b6575094202..fd08ff9e219 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -55,7 +55,7 @@ void BKE_brush_copy_data(struct Main *bmain, const struct Brush *brush_src, const int flag); struct Brush *BKE_brush_copy(struct Main *bmain, const struct Brush *brush); -void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const bool lib_local); +void BKE_brush_make_local(struct Main *bmain, struct Brush *brush, const int flags); void BKE_brush_free(struct Brush *brush); void BKE_brush_sculpt_reset(struct Brush *brush); diff --git a/source/blender/blenkernel/BKE_cachefile.h b/source/blender/blenkernel/BKE_cachefile.h index c8393fd3666..4f59356429f 100644 --- a/source/blender/blenkernel/BKE_cachefile.h +++ b/source/blender/blenkernel/BKE_cachefile.h @@ -51,7 +51,7 @@ struct CacheFile *BKE_cachefile_copy(struct Main *bmain, const struct CacheFile void BKE_cachefile_make_local(struct Main *bmain, struct CacheFile *cache_file, - const bool lib_local); + const int flags); void BKE_cachefile_reload(struct Depsgraph *depsgraph, struct CacheFile *cache_file); diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index d1c133c79b5..558ffd9e7c7 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -47,7 +47,7 @@ void BKE_camera_copy_data(struct Main *bmain, const struct Camera *cam_src, const int flag); struct Camera *BKE_camera_copy(struct Main *bmain, const struct Camera *cam); -void BKE_camera_make_local(struct Main *bmain, struct Camera *cam, const bool lib_local); +void BKE_camera_make_local(struct Main *bmain, struct Camera *cam, const int flags); void BKE_camera_free(struct Camera *ca); /* Camera Usage */ diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 47ed42cade9..f0ec0c6765b 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -62,7 +62,7 @@ void BKE_collection_copy_data(struct Main *bmain, const int flag); void BKE_collection_make_local(struct Main *bmain, struct Collection *collection, - const bool lib_local); + const int flags); struct Collection *BKE_collection_duplicate(struct Main *bmain, struct Collection *parent, diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 1eff97bef2f..dd92ac181f9 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -85,7 +85,7 @@ void BKE_curve_copy_data(struct Main *bmain, const struct Curve *cu_src, const int flag); struct Curve *BKE_curve_copy(struct Main *bmain, const struct Curve *cu); -void BKE_curve_make_local(struct Main *bmain, struct Curve *cu, const bool lib_local); +void BKE_curve_make_local(struct Main *bmain, struct Curve *cu, const int flags); short BKE_curve_type_get(struct Curve *cu); void BKE_curve_type_test(struct Object *ob); void BKE_curve_curve_dimension_update(struct Curve *cu); diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 1780ac9fc3e..31938c48529 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -82,7 +82,7 @@ struct VFont *BKE_vfont_load(struct Main *bmain, const char *filepath); struct VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists); struct VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath); -void BKE_vfont_make_local(struct Main *bmain, struct VFont *vfont, const bool lib_local); +void BKE_vfont_make_local(struct Main *bmain, struct VFont *vfont, const int flags); bool BKE_vfont_to_curve_ex(struct Object *ob, struct Curve *cu, diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 6e68c2a4593..1a186d2d682 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -99,7 +99,7 @@ struct bGPdata *BKE_gpencil_data_duplicate(struct Main *bmain, const struct bGPdata *gpd, bool internal_copy); -void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const bool lib_local); +void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const int flags); void BKE_gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index e2bb1f988ca..81d8e20bf5e 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -142,7 +142,7 @@ struct anim *openanim_noload(const char *name, int streamindex, char colorspace[IMA_MAX_SPACE]); -void BKE_image_make_local(struct Main *bmain, struct Image *ima, const bool lib_local); +void BKE_image_make_local(struct Main *bmain, struct Image *ima, const int flags); void BKE_image_tag_time(struct Image *ima); diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index 50f39dbd423..d2a5cc77cc6 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -49,7 +49,7 @@ void BKE_lattice_copy_data(struct Main *bmain, const int flag); struct Lattice *BKE_lattice_copy(struct Main *bmain, const struct Lattice *lt); void BKE_lattice_free(struct Lattice *lt); -void BKE_lattice_make_local(struct Main *bmain, struct Lattice *lt, const bool lib_local); +void BKE_lattice_make_local(struct Main *bmain, struct Lattice *lt, const int flags); void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du); struct LatticeDeformData *init_latt_deform(struct Object *oblatt, diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index fc4612554e9..cb86d54009b 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -190,11 +190,18 @@ void id_fake_user_set(struct ID *id); void id_fake_user_clear(struct ID *id); void BKE_id_clear_newpoin(struct ID *id); -void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, const bool lib_local); -bool BKE_lib_id_make_local(struct Main *bmain, - struct ID *id, - const bool test, - const bool force_local); +/** Flags to control make local code behaviour. */ +enum { + /** Making that ID local is part of making local a whole library. */ + LIB_ID_MAKELOCAL_FULL_LIBRARY = 1 << 0, + + /* Special type-specific options. */ + /** For Objects, do not clear the proxy pointers while making the data-block local. */ + LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING = 1 << 16, +}; + +void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, const int flags); +bool BKE_lib_id_make_local(struct Main *bmain, struct ID *id, const bool test, const int flags); bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, diff --git a/source/blender/blenkernel/BKE_light.h b/source/blender/blenkernel/BKE_light.h index e060f587afe..932881ce4ad 100644 --- a/source/blender/blenkernel/BKE_light.h +++ b/source/blender/blenkernel/BKE_light.h @@ -41,7 +41,7 @@ void BKE_light_copy_data(struct Main *bmain, const int flag); struct Light *BKE_light_copy(struct Main *bmain, const struct Light *la) ATTR_WARN_UNUSED_RESULT; struct Light *BKE_light_localize(struct Light *la) ATTR_WARN_UNUSED_RESULT; -void BKE_light_make_local(struct Main *bmain, struct Light *la, const bool lib_local); +void BKE_light_make_local(struct Main *bmain, struct Light *la, const int flags); void BKE_light_free(struct Light *la); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h index dc9369ee56f..a294750fa9e 100644 --- a/source/blender/blenkernel/BKE_lightprobe.h +++ b/source/blender/blenkernel/BKE_lightprobe.h @@ -40,7 +40,7 @@ void BKE_lightprobe_copy_data(struct Main *bmain, 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_make_local(struct Main *bmain, struct LightProbe *probe, const int flags); void BKE_lightprobe_free(struct LightProbe *probe); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index b8950e5df88..420f4b79e56 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -52,7 +52,7 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineSt void BKE_linestyle_make_local(struct Main *bmain, struct FreestyleLineStyle *linestyle, - const bool lib_local); + const int flags); FreestyleLineStyle *BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer); diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 99ce547df2d..cdfc406c0a6 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -149,7 +149,7 @@ void BKE_mask_copy_data(struct Main *bmain, struct Mask *BKE_mask_copy_nolib(struct Mask *mask); struct Mask *BKE_mask_copy(struct Main *bmain, const struct Mask *mask); -void BKE_mask_make_local(struct Main *bmain, struct Mask *mask, const bool lib_local); +void BKE_mask_make_local(struct Main *bmain, struct Mask *mask, const int flags); void BKE_mask_free(struct Mask *mask); diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 4bec0b1983e..6eba59ffe8c 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -62,7 +62,7 @@ void BKE_material_copy_data(struct Main *bmain, const int flag); struct Material *BKE_material_copy(struct Main *bmain, const struct Material *ma); struct Material *BKE_material_localize(struct Material *ma); -void BKE_material_make_local(struct Main *bmain, struct Material *ma, const bool lib_local); +void BKE_material_make_local(struct Main *bmain, struct Material *ma, const int flags); void BKE_gpencil_material_attr_init(struct Material *ma); /* UNUSED */ diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 8150f066c9a..799ede4af9f 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -45,7 +45,7 @@ void BKE_mball_copy_data(struct Main *bmain, const int flag); struct MetaBall *BKE_mball_copy(struct Main *bmain, const struct MetaBall *mb); -void BKE_mball_make_local(struct Main *bmain, struct MetaBall *mb, const bool lib_local); +void BKE_mball_make_local(struct Main *bmain, struct MetaBall *mb, const int flags); bool BKE_mball_is_any_selected(const struct MetaBall *mb); bool BKE_mball_is_any_selected_multi(struct Base **bases, int bases_len); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 1bc70101803..b62de1bff51 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -145,7 +145,7 @@ struct Mesh *BKE_mesh_new_nomain_from_curve_displist(struct Object *ob, struct L bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me); bool BKE_mesh_clear_facemap_customdata(struct Mesh *me); -void BKE_mesh_make_local(struct Main *bmain, struct Mesh *me, const bool lib_local); +void BKE_mesh_make_local(struct Main *bmain, struct Mesh *me, const int flags); float (*BKE_mesh_orco_verts_get(struct Object *ob))[3]; void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert); int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr); diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index f214d10eed0..d49fab78afa 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -43,7 +43,7 @@ void BKE_movieclip_copy_data(struct Main *bmain, const struct MovieClip *clip_src, const int flag); struct MovieClip *BKE_movieclip_copy(struct Main *bmain, const struct MovieClip *clip); -void BKE_movieclip_make_local(struct Main *bmain, struct MovieClip *clip, const bool lib_local); +void BKE_movieclip_make_local(struct Main *bmain, struct MovieClip *clip, const int flags); struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name); struct MovieClip *BKE_movieclip_file_add_exists_ex(struct Main *bmain, diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index fcf0cd6f165..9b184ef0e8c 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -399,7 +399,7 @@ struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id); struct bNodeTree *ntreeFromID(struct ID *id); struct ID *BKE_node_tree_find_owner_ID(struct Main *bmain, struct bNodeTree *ntree); -void ntreeMakeLocal(struct Main *bmain, struct bNodeTree *ntree, const bool lib_local); +void ntreeMakeLocal(struct Main *bmain, struct bNodeTree *ntree, const int flags); void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node); void ntreeFreeLocalTree(struct bNodeTree *ntree); struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 8963f241ca8..3f004b453ca 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -140,11 +140,7 @@ void BKE_object_copy_data(struct Main *bmain, const struct Object *ob_src, const int flag); struct Object *BKE_object_copy(struct Main *bmain, const struct Object *ob); -void BKE_object_make_local(struct Main *bmain, struct Object *ob, const bool lib_local); -void BKE_object_make_local_ex(struct Main *bmain, - struct Object *ob, - const bool lib_local, - const bool clear_proxy); +void BKE_object_make_local(struct Main *bmain, struct Object *ob, const int flags); bool BKE_object_is_libdata(const struct Object *ob); bool BKE_object_obdata_is_libdata(const struct Object *ob); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 9cc59557a4c..016012d7288 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -136,7 +136,7 @@ void BKE_palette_copy_data(struct Main *bmain, const struct Palette *palette_src, const int flag); struct Palette *BKE_palette_copy(struct Main *bmain, const struct Palette *palette); -void BKE_palette_make_local(struct Main *bmain, struct Palette *palette, const bool lib_local); +void BKE_palette_make_local(struct Main *bmain, struct Palette *palette, const int flags); struct PaletteColor *BKE_palette_color_add(struct Palette *palette); bool BKE_palette_is_empty(const struct Palette *palette); void BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *color); @@ -150,7 +150,7 @@ void BKE_paint_curve_copy_data(struct Main *bmain, const struct PaintCurve *pc_src, const int flag); struct PaintCurve *BKE_paint_curve_copy(struct Main *bmain, const struct PaintCurve *pc); -void BKE_paint_curve_make_local(struct Main *bmain, struct PaintCurve *pc, const bool lib_local); +void BKE_paint_curve_make_local(struct Main *bmain, struct PaintCurve *pc, const int flags); bool BKE_paint_ensure(struct ToolSettings *ts, struct Paint **r_paint); void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const char col[3]); diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index b39fe65c03d..a7569951616 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -377,7 +377,7 @@ struct ParticleSettings *BKE_particlesettings_copy(struct Main *bmain, const struct ParticleSettings *part); void BKE_particlesettings_make_local(struct Main *bmain, struct ParticleSettings *part, - const bool lib_local); + const int flags); void psys_reset(struct ParticleSystem *psys, int mode); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 40b4883349d..703c45f5c77 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -117,7 +117,7 @@ void BKE_scene_copy_data(struct Main *bmain, struct Scene *BKE_scene_copy(struct Main *bmain, struct Scene *sce, int type); void BKE_scene_groups_relink(struct Scene *sce); -void BKE_scene_make_local(struct Main *bmain, struct Scene *sce, const bool lib_local); +void BKE_scene_make_local(struct Main *bmain, struct Scene *sce, const int flags); struct Scene *BKE_scene_find_from_collection(const struct Main *bmain, const struct Collection *collection); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 6807d81daa3..e2866728bba 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -111,7 +111,7 @@ void BKE_sound_copy_data(struct Main *bmain, const struct bSound *sound_src, const int flag); -void BKE_sound_make_local(struct Main *bmain, struct bSound *sound, const bool lib_local); +void BKE_sound_make_local(struct Main *bmain, struct bSound *sound, const int flags); #if defined(WITH_AUDASPACE) AUD_Device *BKE_sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume); diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h index 6160f831158..a80a8062d39 100644 --- a/source/blender/blenkernel/BKE_speaker.h +++ b/source/blender/blenkernel/BKE_speaker.h @@ -36,7 +36,7 @@ void BKE_speaker_copy_data(struct Main *bmain, const struct Speaker *spk_src, const int flag); struct Speaker *BKE_speaker_copy(struct Main *bmain, const struct Speaker *spk); -void BKE_speaker_make_local(struct Main *bmain, struct Speaker *spk, const bool lib_local); +void BKE_speaker_make_local(struct Main *bmain, struct Speaker *spk, const int flags); void BKE_speaker_free(struct Speaker *spk); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 98a94c5f689..c999a50c48b 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -47,7 +47,7 @@ void BKE_text_copy_data(struct Main *bmain, const struct Text *ta_src, const int flag); struct Text *BKE_text_copy(struct Main *bmain, const struct Text *ta); -void BKE_text_make_local(struct Main *bmain, struct Text *text, const bool lib_local); +void BKE_text_make_local(struct Main *bmain, struct Text *text, const int flags); void BKE_text_clear(struct Text *text); void BKE_text_write(struct Text *text, const char *str); int BKE_text_file_modified_check(struct Text *text); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 39216e98e82..1d8b0b41c83 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -51,7 +51,7 @@ void BKE_texture_copy_data(struct Main *bmain, struct Tex *BKE_texture_copy(struct Main *bmain, const struct Tex *tex); struct Tex *BKE_texture_add(struct Main *bmain, const char *name); struct Tex *BKE_texture_localize(struct Tex *tex); -void BKE_texture_make_local(struct Main *bmain, struct Tex *tex, const bool lib_local); +void BKE_texture_make_local(struct Main *bmain, struct Tex *tex, const int flags); void BKE_texture_type_set(struct Tex *tex, int type); void BKE_texture_mtex_default(struct MTex *mtex); diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 9cbe80cc107..070ae2c045e 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -40,7 +40,7 @@ void BKE_world_copy_data(struct Main *bmain, const int flag); struct World *BKE_world_copy(struct Main *bmain, const struct World *wrld); struct World *BKE_world_localize(struct World *wrld); -void BKE_world_make_local(struct Main *bmain, struct World *wrld, const bool lib_local); +void BKE_world_make_local(struct Main *bmain, struct World *wrld, const int flags); void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world); #ifdef __cplusplus diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index d9a3ec65a3e..bcacbccfb28 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -91,9 +91,9 @@ bAction *BKE_action_add(Main *bmain, const char name[]) /* .................................. */ // does copy_fcurve... -void BKE_action_make_local(Main *bmain, bAction *act, const bool lib_local) +void BKE_action_make_local(Main *bmain, bAction *act, const int flags) { - BKE_lib_id_make_local_generic(bmain, &act->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &act->id, flags); } /* .................................. */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 1d4778e6720..476756d0580 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -136,9 +136,9 @@ void BKE_armature_free(bArmature *arm) } } -void BKE_armature_make_local(Main *bmain, bArmature *arm, const bool lib_local) +void BKE_armature_make_local(Main *bmain, bArmature *arm, const int flags) { - BKE_lib_id_make_local_generic(bmain, &arm->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &arm->id, flags); } static void copy_bonechildren(Bone *bone_dst, diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index aba7df0a936..8abad2d541d 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -766,8 +766,9 @@ void BKE_brush_free(Brush *brush) BKE_previewimg_free(&(brush->preview)); } -void BKE_brush_make_local(Main *bmain, Brush *brush, const bool lib_local) +void BKE_brush_make_local(Main *bmain, Brush *brush, const int flags) { + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; bool is_local = false, is_lib = false; /* - only lib users: do nothing (unless force_local is set) @@ -781,7 +782,7 @@ void BKE_brush_make_local(Main *bmain, Brush *brush, const bool lib_local) if (brush->clone.image) { /* Special case: ima always local immediately. Clone image should only have one user anyway. */ - BKE_lib_id_make_local(bmain, &brush->clone.image->id, false, false); + BKE_lib_id_make_local(bmain, &brush->clone.image->id, false, 0); } BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib); diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index db3202a6bf3..df15031b7bc 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -211,9 +211,9 @@ CacheFile *BKE_cachefile_copy(Main *bmain, const CacheFile *cache_file) return cache_file_copy; } -void BKE_cachefile_make_local(Main *bmain, CacheFile *cache_file, const bool lib_local) +void BKE_cachefile_make_local(Main *bmain, CacheFile *cache_file, const int flags) { - BKE_lib_id_make_local_generic(bmain, &cache_file->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &cache_file->id, flags); } 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 b27133ab93f..e21e093517e 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -96,9 +96,9 @@ Camera *BKE_camera_copy(Main *bmain, const Camera *cam) return cam_copy; } -void BKE_camera_make_local(Main *bmain, Camera *cam, const bool lib_local) +void BKE_camera_make_local(Main *bmain, Camera *cam, const int flags) { - BKE_lib_id_make_local_generic(bmain, &cam->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &cam->id, flags); } /** Free (or release) any data used by this camera (does not free the camera itself). */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 89e1d431cfb..2699121b63e 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -369,9 +369,9 @@ Collection *BKE_collection_duplicate(Main *bmain, return collection_new; } -void BKE_collection_make_local(Main *bmain, Collection *collection, const bool lib_local) +void BKE_collection_make_local(Main *bmain, Collection *collection, const int flags) { - BKE_lib_id_make_local_generic(bmain, &collection->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &collection->id, flags); } /********************************* Naming *******************************/ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index e8688cedd9f..81939dbaafc 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -220,9 +220,9 @@ Curve *BKE_curve_copy(Main *bmain, const Curve *cu) return cu_copy; } -void BKE_curve_make_local(Main *bmain, Curve *cu, const bool lib_local) +void BKE_curve_make_local(Main *bmain, Curve *cu, const int flags) { - BKE_lib_id_make_local_generic(bmain, &cu->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &cu->id, flags); } /* Get list of nurbs from editnurbs structure */ diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 8d3606525d6..44c59bcb00c 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -325,9 +325,9 @@ VFont *BKE_vfont_load_exists(struct Main *bmain, const char *filepath) return BKE_vfont_load_exists_ex(bmain, filepath, NULL); } -void BKE_vfont_make_local(Main *bmain, VFont *vfont, const bool lib_local) +void BKE_vfont_make_local(Main *bmain, VFont *vfont, const int flags) { - BKE_lib_id_make_local_generic(bmain, &vfont->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &vfont->id, flags); } static VFont *which_vfont(Curve *cu, CharInfo *info) diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 5cd5724f07d..5713a93d740 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -707,9 +707,9 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in return gpd_dst; } -void BKE_gpencil_make_local(Main *bmain, bGPdata *gpd, const bool lib_local) +void BKE_gpencil_make_local(Main *bmain, bGPdata *gpd, const int flags) { - BKE_lib_id_make_local_generic(bmain, &gpd->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &gpd->id, flags); } /* ************************************************** */ diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index bf59cfb4216..d54d9a03524 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -462,9 +462,9 @@ Image *BKE_image_copy(Main *bmain, const Image *ima) return ima_copy; } -void BKE_image_make_local(Main *bmain, Image *ima, const bool lib_local) +void BKE_image_make_local(Main *bmain, Image *ima, const int flags) { - BKE_lib_id_make_local_generic(bmain, &ima->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &ima->id, flags); } void BKE_image_merge(Main *bmain, Image *dest, Image *source) diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 20d16df8e63..a7033946b2e 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -329,9 +329,9 @@ void BKE_lattice_free(Lattice *lt) } } -void BKE_lattice_make_local(Main *bmain, Lattice *lt, const bool lib_local) +void BKE_lattice_make_local(Main *bmain, Lattice *lt, const int flags) { - BKE_lib_id_make_local_generic(bmain, <->id, lib_local); + BKE_lib_id_make_local_generic(bmain, <->id, flags); } typedef struct LatticeDeformData { diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index fd1b70c18e3..73a03294c51 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -377,8 +377,9 @@ static void lib_id_copy_ensure_local(Main *bmain, const ID *old_id, ID *new_id) /** * Generic 'make local' function, works for most of data-block types... */ -void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const bool lib_local) +void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags) { + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; bool is_local = false, is_lib = false; /* - only lib users: do nothing (unless force_local is set) @@ -436,8 +437,10 @@ void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const bool lib_local) * * \return true if the block can be made local. */ -bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local) +bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const int flags) { + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; + /* We don't care whether ID is directly or indirectly linked * in case we are making a whole lib local... */ if (!lib_local && (id->tag & LIB_TAG_INDIRECT)) { @@ -447,152 +450,152 @@ bool BKE_lib_id_make_local(Main *bmain, ID *id, const bool test, const bool lib_ switch ((ID_Type)GS(id->name)) { case ID_SCE: if (!test) { - BKE_scene_make_local(bmain, (Scene *)id, lib_local); + BKE_scene_make_local(bmain, (Scene *)id, flags); } return true; case ID_OB: if (!test) { - BKE_object_make_local(bmain, (Object *)id, lib_local); + BKE_object_make_local(bmain, (Object *)id, flags); } return true; case ID_ME: if (!test) { - BKE_mesh_make_local(bmain, (Mesh *)id, lib_local); + BKE_mesh_make_local(bmain, (Mesh *)id, flags); } return true; case ID_CU: if (!test) { - BKE_curve_make_local(bmain, (Curve *)id, lib_local); + BKE_curve_make_local(bmain, (Curve *)id, flags); } return true; case ID_MB: if (!test) { - BKE_mball_make_local(bmain, (MetaBall *)id, lib_local); + BKE_mball_make_local(bmain, (MetaBall *)id, flags); } return true; case ID_MA: if (!test) { - BKE_material_make_local(bmain, (Material *)id, lib_local); + BKE_material_make_local(bmain, (Material *)id, flags); } return true; case ID_TE: if (!test) { - BKE_texture_make_local(bmain, (Tex *)id, lib_local); + BKE_texture_make_local(bmain, (Tex *)id, flags); } return true; case ID_IM: if (!test) { - BKE_image_make_local(bmain, (Image *)id, lib_local); + BKE_image_make_local(bmain, (Image *)id, flags); } return true; case ID_LT: if (!test) { - BKE_lattice_make_local(bmain, (Lattice *)id, lib_local); + BKE_lattice_make_local(bmain, (Lattice *)id, flags); } return true; case ID_LA: if (!test) { - BKE_light_make_local(bmain, (Light *)id, lib_local); + BKE_light_make_local(bmain, (Light *)id, flags); } return true; case ID_CA: if (!test) { - BKE_camera_make_local(bmain, (Camera *)id, lib_local); + BKE_camera_make_local(bmain, (Camera *)id, flags); } return true; case ID_SPK: if (!test) { - BKE_speaker_make_local(bmain, (Speaker *)id, lib_local); + BKE_speaker_make_local(bmain, (Speaker *)id, flags); } return true; case ID_LP: if (!test) { - BKE_lightprobe_make_local(bmain, (LightProbe *)id, lib_local); + BKE_lightprobe_make_local(bmain, (LightProbe *)id, flags); } return true; case ID_WO: if (!test) { - BKE_world_make_local(bmain, (World *)id, lib_local); + BKE_world_make_local(bmain, (World *)id, flags); } return true; case ID_VF: if (!test) { - BKE_vfont_make_local(bmain, (VFont *)id, lib_local); + BKE_vfont_make_local(bmain, (VFont *)id, flags); } return true; case ID_TXT: if (!test) { - BKE_text_make_local(bmain, (Text *)id, lib_local); + BKE_text_make_local(bmain, (Text *)id, flags); } return true; case ID_SO: if (!test) { - BKE_sound_make_local(bmain, (bSound *)id, lib_local); + BKE_sound_make_local(bmain, (bSound *)id, flags); } return true; case ID_GR: if (!test) { - BKE_collection_make_local(bmain, (Collection *)id, lib_local); + BKE_collection_make_local(bmain, (Collection *)id, flags); } return true; case ID_AR: if (!test) { - BKE_armature_make_local(bmain, (bArmature *)id, lib_local); + BKE_armature_make_local(bmain, (bArmature *)id, flags); } return true; case ID_AC: if (!test) { - BKE_action_make_local(bmain, (bAction *)id, lib_local); + BKE_action_make_local(bmain, (bAction *)id, flags); } return true; case ID_NT: if (!test) { - ntreeMakeLocal(bmain, (bNodeTree *)id, lib_local); + ntreeMakeLocal(bmain, (bNodeTree *)id, flags); } return true; case ID_BR: if (!test) { - BKE_brush_make_local(bmain, (Brush *)id, lib_local); + BKE_brush_make_local(bmain, (Brush *)id, flags); } return true; case ID_PA: if (!test) { - BKE_particlesettings_make_local(bmain, (ParticleSettings *)id, lib_local); + BKE_particlesettings_make_local(bmain, (ParticleSettings *)id, flags); } return true; case ID_GD: if (!test) { - BKE_gpencil_make_local(bmain, (bGPdata *)id, lib_local); + BKE_gpencil_make_local(bmain, (bGPdata *)id, flags); } return true; case ID_MC: if (!test) { - BKE_movieclip_make_local(bmain, (MovieClip *)id, lib_local); + BKE_movieclip_make_local(bmain, (MovieClip *)id, flags); } return true; case ID_MSK: if (!test) { - BKE_mask_make_local(bmain, (Mask *)id, lib_local); + BKE_mask_make_local(bmain, (Mask *)id, flags); } return true; case ID_LS: if (!test) { - BKE_linestyle_make_local(bmain, (FreestyleLineStyle *)id, lib_local); + BKE_linestyle_make_local(bmain, (FreestyleLineStyle *)id, flags); } return true; case ID_PAL: if (!test) { - BKE_palette_make_local(bmain, (Palette *)id, lib_local); + BKE_palette_make_local(bmain, (Palette *)id, flags); } return true; case ID_PC: if (!test) { - BKE_paint_curve_make_local(bmain, (PaintCurve *)id, lib_local); + BKE_paint_curve_make_local(bmain, (PaintCurve *)id, flags); } return true; case ID_CF: if (!test) { - BKE_cachefile_make_local(bmain, (CacheFile *)id, lib_local); + BKE_cachefile_make_local(bmain, (CacheFile *)id, flags); } return true; case ID_WS: @@ -2232,16 +2235,14 @@ void BKE_library_make_local(Main *bmain, } else { /* In this specific case, we do want to make ID local even if it has no local usage yet... + * Note that for objects, we don't want proxy pointers to be cleared yet. This will happen + * down the road in this function. */ - if (GS(id->name) == ID_OB) { - /* Special case for objects because we don't want proxy pointers to be - * cleared yet. This will happen down the road in this function. - */ - BKE_object_make_local_ex(bmain, (Object *)id, true, false); - } - else { - BKE_lib_id_make_local(bmain, id, false, true); - } + BKE_lib_id_make_local(bmain, + id, + false, + LIB_ID_MAKELOCAL_FULL_LIBRARY | + LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING); if (id->newid) { if (GS(id->newid->name) == ID_OB) { @@ -2344,7 +2345,7 @@ void BKE_library_make_local(Main *bmain, else { /* we can switch the proxy'ing from the linked-in to the made-local proxy. * BKE_object_make_proxy() shouldn't be used here, as it allocates memory that - * was already allocated by BKE_object_make_local_ex() (which called BKE_object_copy). */ + * was already allocated by BKE_object_make_local() (which called BKE_object_copy). */ ob_new->proxy = ob->proxy; ob_new->proxy_group = ob->proxy_group; ob_new->proxy_from = ob->proxy_from; diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index 7f89c6f899f..7f8626df409 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -129,9 +129,9 @@ Light *BKE_light_localize(Light *la) return lan; } -void BKE_light_make_local(Main *bmain, Light *la, const bool lib_local) +void BKE_light_make_local(Main *bmain, Light *la, const int flags) { - BKE_lib_id_make_local_generic(bmain, &la->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &la->id, flags); } void BKE_light_free(Light *la) diff --git a/source/blender/blenkernel/intern/lightprobe.c b/source/blender/blenkernel/intern/lightprobe.c index 30fbcd4f540..55e7b90d8cf 100644 --- a/source/blender/blenkernel/intern/lightprobe.c +++ b/source/blender/blenkernel/intern/lightprobe.c @@ -101,9 +101,9 @@ LightProbe *BKE_lightprobe_copy(Main *bmain, const LightProbe *probe) return probe_copy; } -void BKE_lightprobe_make_local(Main *bmain, LightProbe *probe, const bool lib_local) +void BKE_lightprobe_make_local(Main *bmain, LightProbe *probe, const int flags) { - BKE_lib_id_make_local_generic(bmain, &probe->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &probe->id, flags); } void BKE_lightprobe_free(LightProbe *probe) diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 0d7dc7e07e0..c8f21c3f959 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -186,11 +186,9 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, const FreestyleLineSt return linestyle_copy; } -void BKE_linestyle_make_local(struct Main *bmain, - FreestyleLineStyle *linestyle, - const bool lib_local) +void BKE_linestyle_make_local(struct Main *bmain, FreestyleLineStyle *linestyle, const int flags) { - BKE_lib_id_make_local_generic(bmain, &linestyle->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &linestyle->id, flags); } 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 170d870ec8a..28ed7606cbf 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -906,9 +906,9 @@ Mask *BKE_mask_copy(Main *bmain, const Mask *mask) return mask_copy; } -void BKE_mask_make_local(Main *bmain, Mask *mask, const bool lib_local) +void BKE_mask_make_local(Main *bmain, Mask *mask, const int flags) { - BKE_lib_id_make_local_generic(bmain, &mask->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &mask->id, flags); } void BKE_mask_point_free(MaskSplinePoint *point) diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index a60953f0ed1..af09b4a2db8 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -230,9 +230,9 @@ Material *BKE_material_localize(Material *ma) return man; } -void BKE_material_make_local(Main *bmain, Material *ma, const bool lib_local) +void BKE_material_make_local(Main *bmain, Material *ma, const int flags) { - BKE_lib_id_make_local_generic(bmain, &ma->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &ma->id, flags); } Material ***BKE_object_material_array(Object *ob) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index c82928a4094..15a3229aaa7 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -125,9 +125,9 @@ MetaBall *BKE_mball_copy(Main *bmain, const MetaBall *mb) return mb_copy; } -void BKE_mball_make_local(Main *bmain, MetaBall *mb, const bool lib_local) +void BKE_mball_make_local(Main *bmain, MetaBall *mb, const int flags) { - BKE_lib_id_make_local_generic(bmain, &mb->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &mb->id, flags); } /* most simple meta-element adding function diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a483a354254..51f37254d8f 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -836,9 +836,9 @@ Mesh *BKE_mesh_from_editmesh_with_coords_thin_wrap(BMEditMesh *em, return me; } -void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool lib_local) +void BKE_mesh_make_local(Main *bmain, Mesh *me, const int flags) { - BKE_lib_id_make_local_generic(bmain, &me->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &me->id, flags); } BoundBox *BKE_mesh_boundbox_get(Object *ob) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 2afdb679518..8e64c02fbb3 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1666,9 +1666,9 @@ MovieClip *BKE_movieclip_copy(Main *bmain, const MovieClip *clip) return clip_copy; } -void BKE_movieclip_make_local(Main *bmain, MovieClip *clip, const bool lib_local) +void BKE_movieclip_make_local(Main *bmain, MovieClip *clip, const int flags) { - BKE_lib_id_make_local_generic(bmain, &clip->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &clip->id, flags); } float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 5850e1265f9..4793ca93a3b 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2296,9 +2296,9 @@ ID *BKE_node_tree_find_owner_ID(Main *bmain, struct bNodeTree *ntree) return NULL; } -void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, const bool lib_local) +void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, const int flags) { - BKE_lib_id_make_local_generic(bmain, &ntree->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &ntree->id, flags); } int ntreeNodeExists(bNodeTree *ntree, bNode *testnode) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index e9aec7201e2..8d9bffa1637 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1741,11 +1741,10 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag) return obn; } -void BKE_object_make_local_ex(Main *bmain, - Object *ob, - const bool lib_local, - const bool clear_proxy) +void BKE_object_make_local(Main *bmain, Object *ob, const int flags) { + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; + const bool clear_proxy = (flags & LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING) == 0; bool is_local = false, is_lib = false; /* - only lib users: do nothing (unless force_local is set) @@ -1789,11 +1788,6 @@ void BKE_object_make_local_ex(Main *bmain, } } -void BKE_object_make_local(Main *bmain, Object *ob, const bool lib_local) -{ - BKE_object_make_local_ex(bmain, ob, lib_local, true); -} - /* Returns true if the Object is from an external blend file (libdata) */ bool BKE_object_is_libdata(const Object *ob) { diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 8466f67730f..9f05b1656cd 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -517,9 +517,9 @@ PaintCurve *BKE_paint_curve_copy(Main *bmain, const PaintCurve *pc) return pc_copy; } -void BKE_paint_curve_make_local(Main *bmain, PaintCurve *pc, const bool lib_local) +void BKE_paint_curve_make_local(Main *bmain, PaintCurve *pc, const int flags) { - BKE_lib_id_make_local_generic(bmain, &pc->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &pc->id, flags); } Palette *BKE_paint_palette(Paint *p) @@ -604,9 +604,9 @@ Palette *BKE_palette_copy(Main *bmain, const Palette *palette) return palette_copy; } -void BKE_palette_make_local(Main *bmain, Palette *palette, const bool lib_local) +void BKE_palette_make_local(Main *bmain, Palette *palette, const int flags) { - BKE_lib_id_make_local_generic(bmain, &palette->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &palette->id, flags); } void BKE_palette_init(Palette *palette) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index dce7d643713..a8e43df15a3 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3837,9 +3837,9 @@ ParticleSettings *BKE_particlesettings_copy(Main *bmain, const ParticleSettings return part_copy; } -void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part, const bool lib_local) +void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part, const int flags) { - BKE_lib_id_make_local_generic(bmain, &part->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &part->id, flags); } /************************************************/ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 59242d5159c..272ce404c35 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -488,11 +488,11 @@ void BKE_scene_groups_relink(Scene *sce) } } -void BKE_scene_make_local(Main *bmain, Scene *sce, const bool lib_local) +void BKE_scene_make_local(Main *bmain, Scene *sce, const int flags) { /* For now should work, may need more work though to support all possible corner cases * (also scene_copy probably needs some love). */ - BKE_lib_id_make_local_generic(bmain, &sce->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &sce->id, flags); } /** Free (or release) any data used by this scene (does not free the scene itself). */ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index ffaec89f579..cd38030faf4 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -217,9 +217,9 @@ void BKE_sound_copy_data(Main *UNUSED(bmain), BKE_sound_reset_runtime(sound_dst); } -void BKE_sound_make_local(Main *bmain, bSound *sound, const bool lib_local) +void BKE_sound_make_local(Main *bmain, bSound *sound, const int flags) { - BKE_lib_id_make_local_generic(bmain, &sound->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &sound->id, flags); } #ifdef WITH_AUDASPACE diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index e4c85fda03c..fb16cea093e 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -74,9 +74,9 @@ Speaker *BKE_speaker_copy(Main *bmain, const Speaker *spk) return spk_copy; } -void BKE_speaker_make_local(Main *bmain, Speaker *spk, const bool lib_local) +void BKE_speaker_make_local(Main *bmain, Speaker *spk, const int flags) { - BKE_lib_id_make_local_generic(bmain, &spk->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &spk->id, flags); } void BKE_speaker_free(Speaker *spk) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 09e01723543..c20ef21f486 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -441,9 +441,9 @@ Text *BKE_text_copy(Main *bmain, const Text *ta) return ta_copy; } -void BKE_text_make_local(Main *bmain, Text *text, const bool lib_local) +void BKE_text_make_local(Main *bmain, Text *text, const int flags) { - BKE_lib_id_make_local_generic(bmain, &text->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &text->id, flags); } 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 61c48ebbe58..565426e2960 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -386,9 +386,9 @@ Tex *BKE_texture_localize(Tex *tex) /* ------------------------------------------------------------------------- */ -void BKE_texture_make_local(Main *bmain, Tex *tex, const bool lib_local) +void BKE_texture_make_local(Main *bmain, Tex *tex, const int flags) { - BKE_lib_id_make_local_generic(bmain, &tex->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &tex->id, flags); } Tex *give_current_linestyle_texture(FreestyleLineStyle *linestyle) diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index d6e28932a36..f8ba4e3085e 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -154,9 +154,9 @@ World *BKE_world_localize(World *wrld) return wrldn; } -void BKE_world_make_local(Main *bmain, World *wrld, const bool lib_local) +void BKE_world_make_local(Main *bmain, World *wrld, const int flags) { - BKE_lib_id_make_local_generic(bmain, &wrld->id, lib_local); + BKE_lib_id_make_local_generic(bmain, &wrld->id, flags); } void BKE_world_eval(struct Depsgraph *depsgraph, World *world) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 7a80baf1b80..1566c9c4e88 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -557,7 +557,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } } else { - if (BKE_lib_id_make_local(bmain, id, false, false)) { + if (BKE_lib_id_make_local(bmain, id, false, 0)) { BKE_main_id_clear_newpoins(bmain); /* reassign to get get proper updates/notifiers */ @@ -879,8 +879,7 @@ static void template_ID(bContext *C, UI_but_flag_enable(but, UI_BUT_DISABLED); } else { - const bool disabled = (!BKE_lib_id_make_local( - CTX_data_main(C), id, true /* test */, false) || + const bool disabled = (!BKE_lib_id_make_local(CTX_data_main(C), id, true /* test */, 0) || (idfrom && idfrom->lib)); but = uiDefIconBut(block, UI_BTYPE_BUT, diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 5a3663a12b9..2cf106ea07d 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -698,7 +698,7 @@ static void id_local_cb(bContext *C, Main *bmain = CTX_data_main(C); /* if the ID type has no special local function, * just clear the lib */ - if (BKE_lib_id_make_local(bmain, tselem->id, false, false) == false) { + if (BKE_lib_id_make_local(bmain, tselem->id, false, 0) == false) { BKE_lib_id_clear_library_data(bmain, tselem->id); } else { diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b1c20bcd8f2..bf2c162a179 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -582,13 +582,8 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id) static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy) { - /* Special case, as we can't rely on BKE_lib_id_make_local(); it clears proxies. */ - if (!clear_proxy && GS(self->name) == ID_OB) { - BKE_object_make_local_ex(bmain, (Object *)self, false, clear_proxy); - } - else { - BKE_lib_id_make_local(bmain, self, false, false); - } + BKE_lib_id_make_local( + bmain, self, false, clear_proxy ? 0 : LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING); ID *ret_id = self->newid ? self->newid : self; BKE_id_clear_newpoin(self); |