Commit: 924f31e54f59e13007b75f9388ef4bd089f847b2 Author: Campbell Barton Date: Mon May 18 13:42:47 2015 +1000 Branches: master https://developer.blender.org/rB924f31e54f59e13007b75f9388ef4bd089f847b2
Fix T44543: painted texture lost after first save Fix for T36639 caused all path changes to reload (which could loose user content). Change behavior: - Only reload data when a flag is explicitly passed (currently only used by Find Files operator) - Don't reload images which have been painted onto and not saved (dirty flag set). =================================================================== M source/blender/blenkernel/BKE_bpath.h M source/blender/blenkernel/intern/bpath.c =================================================================== diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index 990b414..10ee504 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -48,13 +48,21 @@ void *BKE_bpath_list_backup(struct Main *bmain, const int flag); void BKE_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle); void BKE_bpath_list_free(void *ls_handle); -#define BKE_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */ -#define BKE_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */ -#define BKE_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */ -#define BKE_BPATH_TRAVERSE_SKIP_MULTIFILE (1 << 4) /* skip paths where a single dir is used with an array of files, eg. - * sequence strip images and pointcache. in this case only use the first - * file, this is needed for directory manipulation functions which might - * otherwise modify the same directory multiple times */ +enum { + /* convert paths to absolute */ + BKE_BPATH_TRAVERSE_ABS = (1 << 0), + /* skip library paths */ + BKE_BPATH_TRAVERSE_SKIP_LIBRARY = (1 << 1), + /* skip packed data */ + BKE_BPATH_TRAVERSE_SKIP_PACKED = (1 << 2), + /* skip paths where a single dir is used with an array of files, eg. + * sequence strip images and pointcache. in this case only use the first + * file, this is needed for directory manipulation functions which might + * otherwise modify the same directory multiple times */ + BKE_BPATH_TRAVERSE_SKIP_MULTIFILE = (1 << 3), + /* reload data (when the path is edited) */ + BKE_BPATH_TRAVERSE_RELOAD_EDITED = (1 << 4), +}; /* high level funcs */ diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 265cb0a..76544e5 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -322,13 +322,14 @@ void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportLis const bool find_all) { struct BPathFind_Data data = {NULL}; + const int flag = BKE_BPATH_TRAVERSE_ABS | BKE_BPATH_TRAVERSE_RELOAD_EDITED; data.basedir = bmain->name; data.reports = reports; data.searchdir = searchpath; data.find_all = find_all; - BKE_bpath_traverse_main(bmain, missing_files_find__visit_cb, BKE_BPATH_TRAVERSE_ABS, (void *)&data); + BKE_bpath_traverse_main(bmain, missing_files_find__visit_cb, flag, (void *)&data); } /* Run a visitor on a string, replacing the contents of the string as needed. */ @@ -435,9 +436,14 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int if (BKE_image_has_packedfile(ima) == false || (flag & BKE_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { if (rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data)) { - if (!BKE_image_has_packedfile(ima)) { - BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); - BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb); + if (flag & BKE_BPATH_TRAVERSE_RELOAD_EDITED) { + if (!BKE_image_has_packedfile(ima) && + /* image may have been painted onto (and not saved, T44543) */ + !BKE_image_is_dirty(ima)) + { + BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); + BKE_image_walk_all_users(bmain, ima, bpath_traverse_image_user_cb); + } } } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs