[Bf-blender-cvs] [5d04dde] alembic_pointcache: Disable the bake operator if cache reading is enabled.

Lukas Tönne noreply at git.blender.org
Thu Mar 19 10:47:46 CET 2015


Commit: 5d04ddea642f0fcd0bfdc102b916890601aa78f5
Author: Lukas Tönne
Date:   Thu Mar 19 10:30:18 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB5d04ddea642f0fcd0bfdc102b916890601aa78f5

Disable the bake operator if cache reading is enabled.

Re-baking cache results is not technically prohibited, but not useful
and allowing only read or write selectively gives a nicer workflow.

===================================================================

M	source/blender/editors/io/io_cache_library.c

===================================================================

diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index b42f70c..b946a4d 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -228,6 +228,11 @@ static int cache_library_bake_poll(bContext *C)
 	
 	if (!ob || !(ob->transflag & OB_DUPLIGROUP) || !ob->dup_group || !ob->cache_library)
 		return false;
+	/* re-baking cached results doesn't make much sense,
+	 * clarify workflow by enabling either reading or writing, but not both
+	 */
+	if (ob->transflag & OB_DUPLI_USE_CACHE)
+		return false;
 	
 	return true;
 }
@@ -277,9 +282,6 @@ static void cache_library_bake_startjob(void *customdata, short *stop, short *do
 	else {
 		data->eval_ctx.mode = DAG_EVAL_RENDER;
 	}
-	// TODO
-	/* disable reading for the duration of the bake process */
-//	data->cachelib->flag |= CACHE_LIBRARY_BAKING;
 	
 	BKE_cache_archive_path(data->cachelib->filepath, (ID *)data->cachelib, data->cachelib->id.lib, filename, sizeof(filename));
 	data->archive = PTC_open_writer_archive(scene, filename);
@@ -313,10 +315,6 @@ static void cache_library_bake_endjob(void *customdata)
 	if (data->archive)
 		PTC_close_writer_archive(data->archive);
 	
-	// TODO
-	/* enable reading */
-//	data->cachelib->flag &= ~CACHE_LIBRARY_BAKING;
-	
 	/* reset scene frame */
 	scene->r.cfra = data->origfra;
 	scene->r.framelen = data->origframelen;




More information about the Bf-blender-cvs mailing list