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:
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r--source/blender/blenkernel/intern/brush.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index b5cdbc58807..e78b89441c9 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -45,6 +45,7 @@
#include "RNA_access.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
@@ -181,6 +182,7 @@ void free_brush(Brush *brush)
static void extern_local_brush(Brush *brush)
{
id_lib_extern((ID *)brush->mtex.tex);
+ id_lib_extern((ID *)brush->clone.image);
}
void make_local_brush(Brush *brush)
@@ -193,29 +195,26 @@ void make_local_brush(Brush *brush)
Main *bmain= G.main;
Scene *scene;
- int local= 0, lib= 0;
+ int is_local= FALSE, is_lib= FALSE;
if(brush->id.lib==NULL) return;
if(brush->clone.image) {
- /* special case: ima always local immediately */
- brush->clone.image->id.lib= NULL;
- brush->clone.image->id.flag= LIB_LOCAL;
- new_id(&bmain->brush, (ID *)brush->clone.image, NULL);
+ /* special case: ima always local immediately. Clone image should only
+ have one user anyway. */
+ id_clear_lib_data(bmain, &brush->clone.image->id);
extern_local_brush(brush);
}
- for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) {
+ for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
- if(scene->id.lib) lib= 1;
- else local= 1;
+ if(scene->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- brush->id.lib= NULL;
- brush->id.flag= LIB_LOCAL;
- new_id(&bmain->brush, (ID *)brush, NULL);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &brush->id);
extern_local_brush(brush);
/* enable fake user by default */
@@ -224,10 +223,13 @@ void make_local_brush(Brush *brush)
brush->id.us++;
}
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
Brush *brushn= copy_brush(brush);
brushn->id.us= 1; /* only keep fake user */
brushn->id.flag |= LIB_FAKEUSER;
+
+ /* Remap paths of new ID using old library as base. */
+ BKE_id_lib_local_paths(bmain, &brush->id);
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {