Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-07-18 12:25:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-07-18 12:25:44 +0300
commit9186b9ae4806f4bbc1a14417c408e844f8e8cc1a (patch)
tree117bbd4ace75825e3a65f0ba2a447509bde0df85 /source/blender/blenkernel/intern
parentcfbd605567f48229a923df382baf6db98fbafc61 (diff)
parent9946cca14676bf07b3c7c103e99033fe1e4e423e (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf_util.c2
-rw-r--r--source/blender/blenkernel/intern/action.c6
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c10
-rw-r--r--source/blender/blenkernel/intern/armature.c6
-rw-r--r--source/blender/blenkernel/intern/armature_update.c2
-rw-r--r--source/blender/blenkernel/intern/brush.c8
-rw-r--r--source/blender/blenkernel/intern/camera.c6
-rw-r--r--source/blender/blenkernel/intern/curve.c9
-rw-r--r--source/blender/blenkernel/intern/icons.c57
-rw-r--r--source/blender/blenkernel/intern/image.c11
-rw-r--r--source/blender/blenkernel/intern/key.c12
-rw-r--r--source/blender/blenkernel/intern/lamp.c6
-rw-r--r--source/blender/blenkernel/intern/lattice.c9
-rw-r--r--source/blender/blenkernel/intern/library.c61
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/mball.c6
-rw-r--r--source/blender/blenkernel/intern/mesh.c14
-rw-r--r--source/blender/blenkernel/intern/node.c7
-rw-r--r--source/blender/blenkernel/intern/object.c6
-rw-r--r--source/blender/blenkernel/intern/object_update.c7
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c44
-rw-r--r--source/blender/blenkernel/intern/sequencer.c34
-rw-r--r--source/blender/blenkernel/intern/speaker.c6
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c6
-rw-r--r--source/blender/blenkernel/intern/world.c6
27 files changed, 178 insertions, 173 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_util.c b/source/blender/blenkernel/intern/CCGSubSurf_util.c
index 9af69115559..c7ef528c02f 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_util.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_util.c
@@ -184,7 +184,7 @@ int ccg_ehashIterator_isStopped(EHashIterator *ehi)
}
/**
- * Standard allocator implementarion.
+ * Standard allocator implementation.
*/
static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes)
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index f7ff1261c8a..fa49797126d 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -95,11 +95,11 @@ bAction *add_empty_action(Main *bmain, const char name[])
/* .................................. */
// does copy_fcurve...
-void BKE_action_make_local(Main *bmain, bAction *act)
+void BKE_action_make_local(Main *bmain, bAction *act, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -110,7 +110,7 @@ void BKE_action_make_local(Main *bmain, bAction *act)
BKE_library_ID_test_usages(bmain, act, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &act->id);
BKE_id_expand_local(&act->id);
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 7f10f6833db..fa156e95d46 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -399,8 +399,8 @@ static void make_local_strips(ListBase *strips)
NlaStrip *strip;
for (strip = strips->first; strip; strip = strip->next) {
- if (strip->act) BKE_action_make_local(G.main, strip->act);
- if (strip->remap && strip->remap->target) BKE_action_make_local(G.main, strip->remap->target);
+ if (strip->act) BKE_action_make_local(G.main, strip->act, false);
+ if (strip->remap && strip->remap->target) BKE_action_make_local(G.main, strip->remap->target, false);
make_local_strips(&strip->strips);
}
@@ -412,10 +412,10 @@ void BKE_animdata_make_local(AnimData *adt)
NlaTrack *nlt;
/* Actions - Active and Temp */
- if (adt->action) BKE_action_make_local(G.main, adt->action);
- if (adt->tmpact) BKE_action_make_local(G.main, adt->tmpact);
+ if (adt->action) BKE_action_make_local(G.main, adt->action, false);
+ if (adt->tmpact) BKE_action_make_local(G.main, adt->tmpact, false);
/* Remaps */
- if (adt->remap && adt->remap->target) BKE_action_make_local(G.main, adt->remap->target);
+ if (adt->remap && adt->remap->target) BKE_action_make_local(G.main, adt->remap->target, false);
/* Drivers */
/* TODO: need to remap the ID-targets too? */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 5f564e1c4d2..53e28177bdf 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -144,11 +144,11 @@ void BKE_armature_free(bArmature *arm)
}
}
-void BKE_armature_make_local(Main *bmain, bArmature *arm)
+void BKE_armature_make_local(Main *bmain, bArmature *arm, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -159,7 +159,7 @@ void BKE_armature_make_local(Main *bmain, bArmature *arm)
BKE_library_ID_test_usages(bmain, arm, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &arm->id);
BKE_id_expand_local(&arm->id);
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index ece17335fa0..aebd564ca58 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -224,7 +224,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
}
/* make a new Spline-IK chain, and store it in the IK chains */
- /* TODO: we should check if there is already an IK chain on this, since that would take presidence... */
+ /* TODO: we should check if there is already an IK chain on this, since that would take precedence... */
{
/* make new tree */
tSplineIK_Tree *tree = MEM_callocN(sizeof(tSplineIK_Tree), "SplineIK Tree");
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 20621feac6c..3d9cabdc15d 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -219,11 +219,11 @@ void BKE_brush_free(Brush *brush)
BKE_previewimg_free(&(brush->preview));
}
-void BKE_brush_make_local(Main *bmain, Brush *brush)
+void BKE_brush_make_local(Main *bmain, Brush *brush, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -234,12 +234,12 @@ void BKE_brush_make_local(Main *bmain, Brush *brush)
if (brush->clone.image) {
/* Special case: ima always local immediately. Clone image should only have one user anyway. */
- id_make_local(bmain, &brush->clone.image->id, false);
+ id_make_local(bmain, &brush->clone.image->id, false, false);
}
BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &brush->id);
BKE_id_expand_local(&brush->id);
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index ae7aac8b54f..cd085816b4d 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -107,11 +107,11 @@ Camera *BKE_camera_copy(Main *bmain, Camera *cam)
return camn;
}
-void BKE_camera_make_local(Main *bmain, Camera *cam)
+void BKE_camera_make_local(Main *bmain, Camera *cam, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -122,7 +122,7 @@ void BKE_camera_make_local(Main *bmain, Camera *cam)
BKE_library_ID_test_usages(bmain, cam, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &cam->id);
BKE_id_expand_local(&cam->id);
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 0e634e21ea3..693e7eb0c80 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -215,11 +215,11 @@ Curve *BKE_curve_copy(Main *bmain, Curve *cu)
return cun;
}
-void BKE_curve_make_local(Main *bmain, Curve *cu)
+void BKE_curve_make_local(Main *bmain, Curve *cu, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - when there are only lib users: don't do
+ /* - only lib users: do nothing (unless force_local is set)
* - when there are only local users: set flag
* - mixed: do a copy
*/
@@ -230,12 +230,9 @@ void BKE_curve_make_local(Main *bmain, Curve *cu)
BKE_library_ID_test_usages(bmain, cu, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &cu->id);
- if (cu->key) {
- BKE_key_make_local(bmain, cu->key);
- }
BKE_id_expand_local(&cu->id);
}
else {
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index f3e86b44459..63055dc0646 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -423,10 +423,26 @@ void BKE_icon_changed(int id)
}
}
-int BKE_icon_id_ensure(struct ID *id)
+static int icon_id_ensure_create_icon(struct ID *id)
{
Icon *new_icon = NULL;
+ new_icon = MEM_mallocN(sizeof(Icon), __func__);
+
+ new_icon->obj = id;
+ new_icon->type = GS(id->name);
+
+ /* next two lines make sure image gets created */
+ new_icon->drawinfo = NULL;
+ new_icon->drawinfo_free = NULL;
+
+ BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(id->icon_id), new_icon);
+
+ return id->icon_id;
+}
+
+int BKE_icon_id_ensure(struct ID *id)
+{
if (!id || G.background)
return 0;
@@ -440,32 +456,39 @@ int BKE_icon_id_ensure(struct ID *id)
return 0;
}
- new_icon = MEM_mallocN(sizeof(Icon), __func__);
-
- new_icon->obj = id;
- new_icon->type = GS(id->name);
-
- /* next two lines make sure image gets created */
- new_icon->drawinfo = NULL;
- new_icon->drawinfo_free = NULL;
+ /* Ensure we synchronize ID icon_id with its previewimage if it has one. */
+ PreviewImage **p_prv = BKE_previewimg_id_get_p(id);
+ if (p_prv && *p_prv) {
+ BLI_assert(ELEM((*p_prv)->icon_id, 0, id->icon_id));
+ (*p_prv)->icon_id = id->icon_id;
+ }
- BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(id->icon_id), new_icon);
-
- return id->icon_id;
+ return icon_id_ensure_create_icon(id);
}
/**
* Return icon id of given preview, or create new icon if not found.
*/
-int BKE_icon_preview_ensure(PreviewImage *preview)
+int BKE_icon_preview_ensure(ID *id, PreviewImage *preview)
{
Icon *new_icon = NULL;
if (!preview || G.background)
return 0;
- if (preview->icon_id)
+ if (id) {
+ BLI_assert(BKE_previewimg_id_ensure(id) == preview);
+ }
+
+ if (preview->icon_id) {
+ BLI_assert(!id || !id->icon_id || id->icon_id == preview->icon_id);
return preview->icon_id;
+ }
+
+ if (id && id->icon_id) {
+ preview->icon_id = id->icon_id;
+ return preview->icon_id;
+ }
preview->icon_id = get_next_free_id();
@@ -474,6 +497,12 @@ int BKE_icon_preview_ensure(PreviewImage *preview)
return 0;
}
+ /* Ensure we synchronize ID icon_id with its previewimage if available, and generate suitable 'ID' icon. */
+ if (id) {
+ id->icon_id = preview->icon_id;
+ return icon_id_ensure_create_icon(id);
+ }
+
new_icon = MEM_mallocN(sizeof(Icon), __func__);
new_icon->obj = preview;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index f6f38977402..ae3163d388e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -469,11 +469,11 @@ Image *BKE_image_copy(Main *bmain, Image *ima)
return nima;
}
-void BKE_image_make_local(Main *bmain, Image *ima)
+void BKE_image_make_local(Main *bmain, Image *ima, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -484,7 +484,7 @@ void BKE_image_make_local(Main *bmain, Image *ima)
BKE_library_ID_test_usages(bmain, ima, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &ima->id);
BKE_id_expand_local(&ima->id);
@@ -1118,8 +1118,11 @@ int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options)
return IMB_FTYPE_DPX;
#endif
#ifdef WITH_OPENJPEG
- else if (imtype == R_IMF_IMTYPE_JP2)
+ else if (imtype == R_IMF_IMTYPE_JP2) {
+ r_options->flag |= JP2_JP2;
+ r_options->quality = 90;
return IMB_FTYPE_JP2;
+ }
#endif
else {
r_options->quality = 90;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index e59facd3c39..a524f927cad 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -203,18 +203,6 @@ Key *BKE_key_copy_nolib(Key *key)
return keyn;
}
-void BKE_key_make_local(Main *bmain, Key *key)
-{
- /* Note that here for now we simply just make it local...
- * Sounds fishy behavior, but since skeys are not *real* IDs... */
-
- if (!ID_IS_LINKED_DATABLOCK(key)) {
- return;
- }
-
- id_clear_lib_data(bmain, &key->id);
-}
-
/* Sort shape keys and Ipo curves after a change. This assumes that at most
* one key was moved, which is a valid assumption for the places it's
* currently being called.
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 003b154a70b..c224b5ca0a7 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -172,11 +172,11 @@ Lamp *localize_lamp(Lamp *la)
return lan;
}
-void BKE_lamp_make_local(Main *bmain, Lamp *la)
+void BKE_lamp_make_local(Main *bmain, Lamp *la, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -187,7 +187,7 @@ void BKE_lamp_make_local(Main *bmain, Lamp *la)
BKE_library_ID_test_usages(bmain, la, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &la->id);
BKE_id_expand_local(&la->id);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 67f49266efc..c2675fabe3b 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -330,11 +330,11 @@ void BKE_lattice_free(Lattice *lt)
}
-void BKE_lattice_make_local(Main *bmain, Lattice *lt)
+void BKE_lattice_make_local(Main *bmain, Lattice *lt, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -345,12 +345,9 @@ void BKE_lattice_make_local(Main *bmain, Lattice *lt)
BKE_library_ID_test_usages(bmain, lt, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &lt->id);
- if (lt->key) {
- BKE_key_make_local(bmain, lt->key);
- }
BKE_id_expand_local(&lt->id);
}
else {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 978f1acefba..9b9b80a2ecc 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -270,7 +270,7 @@ void BKE_id_expand_local(ID *id)
/* calls the appropriate make_local method for the block, unless test. Returns true
* if the block can be made local. */
-bool id_make_local(Main *bmain, ID *id, bool test)
+bool id_make_local(Main *bmain, ID *id, const bool test, const bool force_local)
{
if (id->tag & LIB_TAG_INDIRECT)
return false;
@@ -281,45 +281,44 @@ bool id_make_local(Main *bmain, ID *id, bool test)
case ID_LI:
return false; /* can't be linked */
case ID_OB:
- if (!test) BKE_object_make_local(bmain, (Object *)id);
+ if (!test) BKE_object_make_local(bmain, (Object *)id, force_local);
return true;
case ID_ME:
- if (!test) BKE_mesh_make_local(bmain, (Mesh *)id);
+ if (!test) BKE_mesh_make_local(bmain, (Mesh *)id, force_local);
return true;
case ID_CU:
- if (!test) BKE_curve_make_local(bmain, (Curve *)id);
+ if (!test) BKE_curve_make_local(bmain, (Curve *)id, force_local);
return true;
case ID_MB:
- if (!test) BKE_mball_make_local(bmain, (MetaBall *)id);
+ if (!test) BKE_mball_make_local(bmain, (MetaBall *)id, force_local);
return true;
case ID_MA:
- if (!test) BKE_material_make_local(bmain, (Material *)id);
+ if (!test) BKE_material_make_local(bmain, (Material *)id, force_local);
return true;
case ID_TE:
- if (!test) BKE_texture_make_local(bmain, (Tex *)id);
+ if (!test) BKE_texture_make_local(bmain, (Tex *)id, force_local);
return true;
case ID_IM:
- if (!test) BKE_image_make_local(bmain, (Image *)id);
+ if (!test) BKE_image_make_local(bmain, (Image *)id, force_local);
return true;
case ID_LT:
- if (!test) BKE_lattice_make_local(bmain, (Lattice *)id);
+ if (!test) BKE_lattice_make_local(bmain, (Lattice *)id, force_local);
return true;
case ID_LA:
- if (!test) BKE_lamp_make_local(bmain, (Lamp *)id);
+ if (!test) BKE_lamp_make_local(bmain, (Lamp *)id, force_local);
return true;
case ID_CA:
- if (!test) BKE_camera_make_local(bmain, (Camera *)id);
+ if (!test) BKE_camera_make_local(bmain, (Camera *)id, force_local);
return true;
case ID_SPK:
- if (!test) BKE_speaker_make_local(bmain, (Speaker *)id);
+ if (!test) BKE_speaker_make_local(bmain, (Speaker *)id, force_local);
return true;
case ID_IP:
return false; /* deprecated */
case ID_KE:
- if (!test) BKE_key_make_local(bmain, (Key *)id);
- return true;
+ return false; /* can't be linked */
case ID_WO:
- if (!test) BKE_world_make_local(bmain, (World *)id);
+ if (!test) BKE_world_make_local(bmain, (World *)id, force_local);
return true;
case ID_SCR:
return false; /* can't be linked */
@@ -332,16 +331,16 @@ bool id_make_local(Main *bmain, ID *id, bool test)
case ID_GR:
return false; /* not implemented */
case ID_AR:
- if (!test) BKE_armature_make_local(bmain, (bArmature *)id);
+ if (!test) BKE_armature_make_local(bmain, (bArmature *)id, force_local);
return true;
case ID_AC:
- if (!test) BKE_action_make_local(bmain, (bAction *)id);
+ if (!test) BKE_action_make_local(bmain, (bAction *)id, force_local);
return true;
case ID_NT:
- if (!test) ntreeMakeLocal(bmain, (bNodeTree *)id, true);
+ if (!test) ntreeMakeLocal(bmain, (bNodeTree *)id, true, force_local);
return true;
case ID_BR:
- if (!test) BKE_brush_make_local(bmain, (Brush *)id);
+ if (!test) BKE_brush_make_local(bmain, (Brush *)id, force_local);
return true;
case ID_WM:
return false; /* can't be linked */
@@ -1455,6 +1454,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
void id_clear_lib_data_ex(Main *bmain, ID *id, bool id_in_mainlist)
{
bNodeTree *ntree = NULL;
+ Key *key = NULL;
BKE_id_lib_local_paths(bmain, id->lib, id);
@@ -1465,13 +1465,14 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, bool id_in_mainlist)
if (id_in_mainlist)
new_id(which_libbase(bmain, GS(id->name)), id, NULL);
- /* internal bNodeTree blocks inside ID types below
- * also stores id->lib, make sure this stays in sync.
- */
- ntree = ntreeFromID(id);
+ /* Internal bNodeTree blocks inside datablocks also stores id->lib, make sure this stays in sync. */
+ if ((ntree = ntreeFromID(id))) {
+ id_clear_lib_data_ex(bmain, &ntree->id, false); /* Datablocks' nodetree is never in Main. */
+ }
- if (ntree) {
- ntreeMakeLocal(bmain, ntree, false);
+ /* Same goes for shapekeys. */
+ if ((key = BKE_key_from_id(id))) {
+ id_clear_lib_data_ex(bmain, &key->id, id_in_mainlist); /* sigh, why are keys in Main? */
}
if (GS(id->name) == ID_OB) {
@@ -1585,14 +1586,8 @@ void BKE_library_make_local(Main *bmain, const Library *lib, const bool untagged
{
if (lib == NULL || id->lib == lib) {
if (id->lib) {
- /* for Make Local > All we should be calling id_make_local,
- * but doing that breaks append (see #36003 and #36006), we
- * we should make it work with all datablocks and id.us==0 */
- id_clear_lib_data(bmain, id); /* sets 'id->tag' */
-
- /* why sort alphabetically here but not in
- * id_clear_lib_data() ? - campbell */
- id_sort_by_name(lbarray[a], id);
+ /* In this specific case, we do want to make ID local even if it has no local usage yet... */
+ id_make_local(bmain, id, false, true);
}
else {
id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 17811893c03..2ae369fdd1b 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -285,11 +285,11 @@ Material *localize_material(Material *ma)
return man;
}
-void BKE_material_make_local(Main *bmain, Material *ma)
+void BKE_material_make_local(Main *bmain, Material *ma, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -300,7 +300,7 @@ void BKE_material_make_local(Main *bmain, Material *ma)
BKE_library_ID_test_usages(bmain, ma, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &ma->id);
BKE_id_expand_local(&ma->id);
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 9a0a6e3540c..aeb38b3bd1d 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -127,11 +127,11 @@ MetaBall *BKE_mball_copy(Main *bmain, MetaBall *mb)
return mbn;
}
-void BKE_mball_make_local(Main *bmain, MetaBall *mb)
+void BKE_mball_make_local(Main *bmain, MetaBall *mb, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -142,7 +142,7 @@ void BKE_mball_make_local(Main *bmain, MetaBall *mb)
BKE_library_ID_test_usages(bmain, mb, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &mb->id);
BKE_id_expand_local(&mb->id);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 787b9905734..b2f57328df3 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -555,11 +555,11 @@ BMesh *BKE_mesh_to_bmesh(
return bm;
}
-void BKE_mesh_make_local(Main *bmain, Mesh *me)
+void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -570,12 +570,9 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me)
BKE_library_ID_test_usages(bmain, me, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &me->id);
- if (me->key) {
- BKE_key_make_local(bmain, me->key);
- }
BKE_id_expand_local(&me->id);
}
else {
@@ -2227,7 +2224,6 @@ Mesh *BKE_mesh_new_from_object(
{
Mesh *tmpmesh;
Curve *tmpcu = NULL, *copycu;
- Object *tmpobj = NULL;
int render = settings == eModifierMode_Render, i;
int cage = !apply_modifiers;
@@ -2242,7 +2238,7 @@ Mesh *BKE_mesh_new_from_object(
int uv_from_orco;
/* copies object and modifiers (but not the data) */
- tmpobj = BKE_object_copy_ex(bmain, ob, true);
+ Object *tmpobj = BKE_object_copy_ex(bmain, ob, true);
tmpcu = (Curve *)tmpobj->data;
id_us_min(&tmpcu->id);
@@ -2443,7 +2439,7 @@ Mesh *BKE_mesh_new_from_object(
}
/* make sure materials get updated in object */
- test_object_materials(tmpobj ? tmpobj : ob, &tmpmesh->id);
+ test_object_materials(ob, &tmpmesh->id);
return tmpmesh;
}
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 296a00388c4..eec09973a82 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1211,7 +1211,6 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool ski
}
else {
newtree = BKE_libblock_copy_nolib(&ntree->id, true);
- newtree->id.lib = NULL; /* same as owning datablock id.lib */
}
id_us_plus((ID *)newtree->gpd);
@@ -1951,11 +1950,11 @@ bNodeTree *ntreeFromID(ID *id)
}
}
-void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist)
+void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist, const bool force_local)
{
bool is_lib = false, is_local = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -1966,7 +1965,7 @@ void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist)
BKE_library_ID_test_usages(bmain, ntree, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data_ex(bmain, (ID *)ntree, id_in_mainlist);
BKE_id_expand_local(&ntree->id);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 00c25bed1f7..5d654515fc8 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1023,11 +1023,11 @@ Object *BKE_object_copy(Main *bmain, Object *ob)
return BKE_object_copy_ex(bmain, ob, false);
}
-void BKE_object_make_local(Main *bmain, Object *ob)
+void BKE_object_make_local(Main *bmain, Object *ob, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -1038,7 +1038,7 @@ void BKE_object_make_local(Main *bmain, Object *ob)
BKE_library_ID_test_usages(bmain, ob, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &ob->id);
BKE_id_expand_local(&ob->id);
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index b5cb59da7d2..b8cb8955672 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -300,10 +300,3 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME);
}
-
-void BKE_object_eval_proxy_backlink(EvaluationContext *UNUSED(eval_ctx), Object *ob)
-{
- if (ob->proxy) {
- ob->proxy->proxy_from = ob;
- }
-}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 572d23b39c7..d284548d6bc 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1103,7 +1103,7 @@ char *BKE_scene_find_last_marker_name(Scene *scene, int frame)
Base *BKE_scene_base_add(Scene *sce, Object *ob)
{
- Base *b = MEM_callocN(sizeof(*b), "BKE_scene_base_add");
+ Base *b = MEM_callocN(sizeof(*b), __func__);
BLI_addhead(&sce->base, b);
b->object = ob;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 3de4a426973..ce7c520438a 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -123,28 +123,34 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1,
out = IMB_allocImBuf(x, y, 32, IB_rect);
}
- if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
- BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true);
- }
- if (ibuf2 && !ibuf2->rect_float && out->rect_float) {
- BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf2, true);
- }
- if (ibuf3 && !ibuf3->rect_float && out->rect_float) {
- BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true);
- }
+ if (out->rect_float) {
+ if (ibuf1 && !ibuf1->rect_float) {
+ BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true);
+ }
+
+ if (ibuf2 && !ibuf2->rect_float) {
+ BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf2, true);
+ }
+
+ if (ibuf3 && !ibuf3->rect_float) {
+ BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true);
+ }
- if (ibuf1 && !ibuf1->rect && !out->rect_float) {
- IMB_rect_from_float(ibuf1);
- }
- if (ibuf2 && !ibuf2->rect && !out->rect_float) {
- IMB_rect_from_float(ibuf2);
- }
- if (ibuf3 && !ibuf3->rect && !out->rect_float) {
- IMB_rect_from_float(ibuf3);
+ IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
}
+ else {
+ if (ibuf1 && !ibuf1->rect) {
+ IMB_rect_from_float(ibuf1);
+ }
- if (out->rect_float)
- IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
+ if (ibuf2 && !ibuf2->rect) {
+ IMB_rect_from_float(ibuf2);
+ }
+
+ if (ibuf3 && !ibuf3->rect) {
+ IMB_rect_from_float(ibuf3);
+ }
+ }
/* If effect only affecting a single channel, forward input's metadata to the output. */
if (ibuf1 != NULL && ibuf1 == ibuf2 && ibuf2 == ibuf3) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 5ef502e0182..2f497d807e4 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1308,41 +1308,40 @@ StripElem *BKE_sequencer_give_stripelem(Sequence *seq, int cfra)
static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra, int chanshown)
{
- Sequence *seq;
- Sequence *effect_inputs[MAXSEQ + 1];
- int i, totseq = 0, num_effect_inputs = 0;
+ /* Use arbitrary sized linked list, the size could be over MAXSEQ. */
+ LinkNodePair effect_inputs = {NULL, NULL};
+ int totseq = 0;
memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1));
- seq = seqbase->first;
- while (seq) {
- if (seq->startdisp <= cfra && seq->enddisp > cfra) {
+ for (Sequence *seq = seqbase->first; seq; seq = seq->next) {
+ if ((seq->startdisp <= cfra) && (seq->enddisp > cfra)) {
if ((seq->type & SEQ_TYPE_EFFECT) && !(seq->flag & SEQ_MUTE)) {
+
if (seq->seq1) {
- effect_inputs[num_effect_inputs++] = seq->seq1;
+ BLI_linklist_append_alloca(&effect_inputs, seq->seq1);
}
if (seq->seq2) {
- effect_inputs[num_effect_inputs++] = seq->seq2;
+ BLI_linklist_append_alloca(&effect_inputs, seq->seq2);
}
if (seq->seq3) {
- effect_inputs[num_effect_inputs++] = seq->seq3;
+ BLI_linklist_append_alloca(&effect_inputs, seq->seq3);
}
}
seq_arr[seq->machine] = seq;
totseq++;
}
- seq = seq->next;
}
/* Drop strips which are used for effect inputs, we don't want
* them to blend into render stack in any other way than effect
* string rendering.
*/
- for (i = 0; i < num_effect_inputs; i++) {
- seq = effect_inputs[i];
+ for (LinkNode *seq_item = effect_inputs.list; seq_item; seq_item = seq_item->next) {
+ Sequence *seq = seq_item->link;
/* It's possible that effetc strip would be placed to the same
* 'machine' as it's inputs. We don't want to clear such strips
* from the stack.
@@ -1826,8 +1825,10 @@ static void seq_proxy_build_frame(
IMB_freeImBuf(ibuf);
}
-/* returns whether the file this context would read from even exist, if not, don't create the context
-*/
+/**
+ * Returns whether the file this context would read from even exist,
+ * if not, don't create the context
+ */
static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, const int view_id)
{
if ((scene->r.scemode & R_MULTIVIEW) == 0)
@@ -1862,8 +1863,9 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con
return false;
}
-/** This returns the maximum possible number of required contexts
-*/
+/**
+ * This returns the maximum possible number of required contexts
+ */
static int seq_proxy_context_count(Sequence *seq, Scene *scene)
{
int num_views = 1;
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index a91d8657179..c027f3b38ca 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -85,11 +85,11 @@ Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk)
return spkn;
}
-void BKE_speaker_make_local(Main *bmain, Speaker *spk)
+void BKE_speaker_make_local(Main *bmain, Speaker *spk, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -100,7 +100,7 @@ void BKE_speaker_make_local(Main *bmain, Speaker *spk)
BKE_library_ID_test_usages(bmain, spk, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &spk->id);
BKE_id_expand_local(&spk->id);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index b0d19320230..f73dbd8078f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -3472,7 +3472,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
if (!flush && compareDrawOptions) {
/* also compare draw options and flush buffer if they're different
- * need for face selection highlight in edit mode */
+ * need for face selection highlight in edit mode */
flush |= compareDrawOptions(userData, actualFace, next_actualFace) == 0;
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index dcd60aaa702..155c7f04e53 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -917,11 +917,11 @@ Tex *BKE_texture_localize(Tex *tex)
/* ------------------------------------------------------------------------- */
-void BKE_texture_make_local(Main *bmain, Tex *tex)
+void BKE_texture_make_local(Main *bmain, Tex *tex, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -932,7 +932,7 @@ void BKE_texture_make_local(Main *bmain, Tex *tex)
BKE_library_ID_test_usages(bmain, tex, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &tex->id);
BKE_id_expand_local(&tex->id);
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 9795a8174f8..277aeaa7e42 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -176,11 +176,11 @@ World *localize_world(World *wrld)
return wrldn;
}
-void BKE_world_make_local(Main *bmain, World *wrld)
+void BKE_world_make_local(Main *bmain, World *wrld, const bool force_local)
{
bool is_local = false, is_lib = false;
- /* - only lib users: do nothing
+ /* - only lib users: do nothing (unless force_local is set)
* - only local users: set flag
* - mixed: make copy
*/
@@ -191,7 +191,7 @@ void BKE_world_make_local(Main *bmain, World *wrld)
BKE_library_ID_test_usages(bmain, wrld, &is_local, &is_lib);
- if (is_local) {
+ if (force_local || is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &wrld->id);
BKE_id_expand_local(&wrld->id);