Cycles: svn merge -r41225:41232 ^/trunk/blender
[blender.git] / source / blender / blenkernel / intern / texture.c
index b7fc283..4241524 100644 (file)
@@ -814,10 +814,6 @@ Tex *localize_texture(Tex *tex)
 
 /* ------------------------------------------------------------------------- */
 
-static void extern_local_texture(Tex *tex) {
-       id_lib_extern((ID *)tex->ima);
-}
-
 void make_local_texture(Tex *tex)
 {
        Main *bmain= G.main;
@@ -836,9 +832,18 @@ void make_local_texture(Tex *tex)
        
        if(tex->id.lib==NULL) return;
 
+       /* special case: ima always local immediately */
+       if(tex->ima) {
+               tex->ima->id.lib= NULL;
+               tex->ima->id.flag= LIB_LOCAL;
+               new_id(&bmain->image, (ID *)tex->ima, NULL);
+       }
+
        if(tex->id.us==1) {
-               id_clear_lib_data(&bmain->tex, (ID *)tex);
-               extern_local_texture(tex);
+               tex->id.lib= NULL;
+               tex->id.flag= LIB_LOCAL;
+               new_id(&bmain->tex, (ID *)tex, NULL);
+
                return;
        }
        
@@ -892,8 +897,9 @@ void make_local_texture(Tex *tex)
        }
        
        if(local && lib==0) {
-               id_clear_lib_data(&bmain->tex, (ID *)tex);
-               extern_local_texture(tex);
+               tex->id.lib= NULL;
+               tex->id.flag= LIB_LOCAL;
+               new_id(&bmain->tex, (ID *)tex, NULL);
        }
        else if(local && lib) {
                texn= copy_texture(tex);