Fix missing datablocks types in id_make_local.
Adding make_local for vfont/gpencil/group/freestyle linestyle/mask/scene/sound/text. Note that there are still some lose ends here, since some type are not handled by id_copy (Scene, Sound and VFont), which means in case a datablock of that type is used both directly and indirectly, localization will fail. Scene copying might be doable though (maybe with a simple new 'full shalow' mode to existing BKE_scene_copy?), not sure about sounds and vfonts... Situations where this becomes an issue should be very rare corner cases anyway.
This commit is contained in:
parent
5dc7dc70ea
commit
b156674251
|
@ -82,6 +82,8 @@ 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);
|
||||
|
||||
bool BKE_vfont_to_curve_ex(struct Main *bmain, struct Object *ob, int mode,
|
||||
struct ListBase *r_nubase,
|
||||
const wchar_t **r_text, int *r_text_len, bool *r_text_free,
|
||||
|
|
|
@ -56,6 +56,8 @@ struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
|
|||
struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
|
||||
struct bGPdata *gpencil_data_duplicate(struct Main *bmain, struct bGPdata *gpd, bool internal_copy);
|
||||
|
||||
void BKE_gpencil_make_local(struct Main *bmain, struct bGPdata *gpd, const bool lib_local);
|
||||
|
||||
void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ struct Scene;
|
|||
void BKE_group_free(struct Group *group);
|
||||
struct Group *BKE_group_add(struct Main *bmain, const char *name);
|
||||
struct Group *BKE_group_copy(struct Main *bmain, struct Group *group);
|
||||
void BKE_group_make_local(struct Main *bmain, struct Group *group, const bool lib_local);
|
||||
bool BKE_group_object_add(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
bool BKE_group_object_unlink(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base);
|
||||
struct Group *BKE_group_object_find(struct Group *group, struct Object *ob);
|
||||
|
|
|
@ -54,6 +54,8 @@ FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name);
|
|||
void BKE_linestyle_free(FreestyleLineStyle *linestyle);
|
||||
FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *linestyle);
|
||||
|
||||
void BKE_linestyle_make_local(struct Main *bmain, struct FreestyleLineStyle *linestyle, const bool lib_local);
|
||||
|
||||
FreestyleLineStyle *BKE_linestyle_active_from_scene(struct Scene *scene);
|
||||
|
||||
LineStyleModifier *BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type);
|
||||
|
|
|
@ -125,6 +125,8 @@ struct Mask *BKE_mask_new(struct Main *bmain, const char *name);
|
|||
struct Mask *BKE_mask_copy_nolib(struct Mask *mask);
|
||||
struct Mask *BKE_mask_copy(struct Main *bmain, struct Mask *mask);
|
||||
|
||||
void BKE_mask_make_local(struct Main *bmain, struct Mask *mask, const bool lib_local);
|
||||
|
||||
void BKE_mask_free(struct Mask *mask);
|
||||
|
||||
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2]);
|
||||
|
|
|
@ -101,6 +101,8 @@ struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name);
|
|||
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);
|
||||
|
||||
struct Object *BKE_scene_camera_find(struct Scene *sc);
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
struct Object *BKE_scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH
|
||||
|
|
|
@ -80,6 +80,8 @@ void BKE_sound_load(struct Main *main, struct bSound *sound);
|
|||
|
||||
void BKE_sound_free(struct bSound *sound);
|
||||
|
||||
void BKE_sound_make_local(struct Main *bmain, struct bSound *sound, const bool lib_local);
|
||||
|
||||
#if defined(__AUD_C_API_H__) || defined(WITH_SYSTEM_AUDASPACE)
|
||||
AUD_Device *BKE_sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,7 @@ struct Text *BKE_text_load_ex(struct Main *bmain, const char *file, const cha
|
|||
const bool is_internal);
|
||||
struct Text *BKE_text_load (struct Main *bmain, const char *file, const char *relpath);
|
||||
struct Text *BKE_text_copy (struct Main *bmain, struct Text *ta);
|
||||
void BKE_text_make_local (struct Main *bmain, struct Text *text, const bool lib_local);
|
||||
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);
|
||||
|
|
|
@ -309,6 +309,11 @@ 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)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &vfont->id, true, lib_local);
|
||||
}
|
||||
|
||||
static VFont *which_vfont(Curve *cu, CharInfo *info)
|
||||
{
|
||||
switch (info->flag & (CU_CHINFO_BOLD | CU_CHINFO_ITALIC)) {
|
||||
|
|
|
@ -390,6 +390,11 @@ bGPdata *gpencil_data_duplicate(Main *bmain, bGPdata *src, bool internal_copy)
|
|||
return dst;
|
||||
}
|
||||
|
||||
void BKE_gpencil_make_local(Main *bmain, bGPdata *gpd, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &gpd->id, true, lib_local);
|
||||
}
|
||||
|
||||
/* -------- GP-Stroke API --------- */
|
||||
|
||||
/* ensure selection status of stroke is in sync with its points */
|
||||
|
|
|
@ -105,6 +105,11 @@ Group *BKE_group_copy(Main *bmain, Group *group)
|
|||
return groupn;
|
||||
}
|
||||
|
||||
void BKE_group_make_local(Main *bmain, Group *group, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, group, true, lib_local);
|
||||
}
|
||||
|
||||
/* external */
|
||||
static bool group_object_add_internal(Group *group, Object *ob)
|
||||
{
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_speaker.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_text.h"
|
||||
|
@ -324,7 +325,9 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
|
|||
|
||||
switch (GS(id->name)) {
|
||||
case ID_SCE:
|
||||
return false; /* not implemented */
|
||||
/* Partially implemented (has no copy...). */
|
||||
if (!test) BKE_scene_make_local(bmain, (Scene *)id, lib_local);
|
||||
return true;
|
||||
case ID_LI:
|
||||
return false; /* can't be linked */
|
||||
case ID_OB:
|
||||
|
@ -370,13 +373,19 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
|
|||
case ID_SCR:
|
||||
return false; /* can't be linked */
|
||||
case ID_VF:
|
||||
return false; /* not implemented */
|
||||
/* Partially implemented (has no copy...). */
|
||||
if (!test) BKE_vfont_make_local(bmain, (VFont *)id, lib_local);
|
||||
return true;
|
||||
case ID_TXT:
|
||||
return false; /* not implemented */
|
||||
if (!test) BKE_text_make_local(bmain, (Text *)id, lib_local);
|
||||
return true;
|
||||
case ID_SO:
|
||||
return false; /* not implemented */
|
||||
/* Partially implemented (has no copy...). */
|
||||
if (!test) BKE_sound_make_local(bmain, (bSound *)id, lib_local);
|
||||
return true;
|
||||
case ID_GR:
|
||||
return false; /* not implemented */
|
||||
if (!test) BKE_group_make_local(bmain, (Group *)id, lib_local);
|
||||
return true;
|
||||
case ID_AR:
|
||||
if (!test) BKE_armature_make_local(bmain, (bArmature *)id, lib_local);
|
||||
return true;
|
||||
|
@ -395,9 +404,14 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
|
|||
case ID_WM:
|
||||
return false; /* can't be linked */
|
||||
case ID_GD:
|
||||
return false; /* not implemented */
|
||||
if (!test) BKE_gpencil_make_local(bmain, (bGPdata *)id, lib_local);
|
||||
return true;
|
||||
case ID_MSK:
|
||||
if (!test) BKE_mask_make_local(bmain, (Mask *)id, lib_local);
|
||||
return true;
|
||||
case ID_LS:
|
||||
return false; /* not implemented */
|
||||
if (!test) BKE_linestyle_make_local(bmain, (FreestyleLineStyle *)id, lib_local);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -226,6 +226,11 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *l
|
|||
return new_linestyle;
|
||||
}
|
||||
|
||||
void BKE_linestyle_make_local(struct Main *bmain, FreestyleLineStyle *linestyle, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &linestyle->id, true, lib_local);
|
||||
}
|
||||
|
||||
FreestyleLineStyle *BKE_linestyle_active_from_scene(Scene *scene)
|
||||
{
|
||||
SceneRenderLayer *actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
|
||||
|
|
|
@ -861,6 +861,11 @@ Mask *BKE_mask_copy(Main *bmain, Mask *mask)
|
|||
return mask_new;
|
||||
}
|
||||
|
||||
void BKE_mask_make_local(Main *bmain, Mask *mask, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &mask->id, true, lib_local);
|
||||
}
|
||||
|
||||
void BKE_mask_point_free(MaskSplinePoint *point)
|
||||
{
|
||||
if (point->uw)
|
||||
|
|
|
@ -355,6 +355,13 @@ void BKE_scene_groups_relink(Scene *sce)
|
|||
BKE_rigidbody_world_groups_relink(sce->rigidbody_world);
|
||||
}
|
||||
|
||||
void BKE_scene_make_local(Main *bmain, Scene *sce, const bool lib_local)
|
||||
{
|
||||
/* For now should work, may need more work though to support all possible corner cases
|
||||
* (also scene_copy probably needs some love). */
|
||||
BKE_id_make_local_generic(bmain, &sce->id, true, lib_local);
|
||||
}
|
||||
|
||||
/** Free (or release) any data used by this scene (does not free the scene itself). */
|
||||
void BKE_scene_free(Scene *sce)
|
||||
{
|
||||
|
|
|
@ -155,6 +155,11 @@ void BKE_sound_free(bSound *sound)
|
|||
#endif /* WITH_AUDASPACE */
|
||||
}
|
||||
|
||||
void BKE_sound_make_local(Main *bmain, bSound *sound, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &sound->id, true, lib_local);
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
|
||||
static const char *force_device = NULL;
|
||||
|
|
|
@ -499,6 +499,11 @@ Text *BKE_text_copy(Main *bmain, Text *ta)
|
|||
return tan;
|
||||
}
|
||||
|
||||
void BKE_text_make_local(Main *bmain, Text *text, const bool lib_local)
|
||||
{
|
||||
BKE_id_make_local_generic(bmain, &text->id, true, lib_local);
|
||||
}
|
||||
|
||||
void BKE_text_clear(Text *text) /* called directly from rna */
|
||||
{
|
||||
int oldstate;
|
||||
|
|
Loading…
Reference in New Issue