[Bf-blender-cvs] [039a1e7] alembic_pointcache: Set the G.is_rendering flag and lock editor drawing during export. This is a terribly hack which is necessary to prevent draw methods accessing the same data that is written by the export job.

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:53:06 CEST 2014


Commit: 039a1e76eea6020b732fbf80fd93fcbef36d4770
Author: Lukas Tönne
Date:   Mon Nov 25 15:42:52 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB039a1e76eea6020b732fbf80fd93fcbef36d4770

Set the G.is_rendering flag and lock editor drawing during export.
This is a terribly hack which is necessary to prevent draw methods
accessing the same data that is written by the export job.

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

M	source/blender/editors/physics/physics_pointcache.c

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

diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 4553cf1..e454973 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -47,6 +47,7 @@
 #include "BKE_pointcache.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_screen.h"
 
 /**** NEW POINT CACHE ****/
 #include "PTC_api.h"
@@ -457,6 +458,9 @@ static void ptcache_export_endjob(void *customdata)
 	PTCacheExportJob *data = (PTCacheExportJob *)customdata;
 	Scene *scene = data->scene;
 	
+	G.is_rendering = FALSE;
+	BKE_spacedata_draw_locks(false);
+	
 	/* free the cache writer (closes output file) */
 	PTC_writer_free(data->writer);
 	
@@ -483,8 +487,17 @@ static int ptcache_export_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	
+	/* XXX annoying hack: needed to prevent data corruption when changing
+	 * scene frame in separate threads
+	 */
+	G.is_rendering = TRUE;
+	BKE_spacedata_draw_locks(true);
+	
+	/* XXX set WM_JOB_EXCL_RENDER to prevent conflicts with render jobs,
+	 * since we need to set G.is_rendering
+	 */
 	wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Point Cache Export",
-	                     WM_JOB_PROGRESS, WM_JOB_TYPE_PTCACHE_EXPORT);
+	                     WM_JOB_PROGRESS | WM_JOB_EXCL_RENDER, WM_JOB_TYPE_PTCACHE_EXPORT);
 	
 	/* setup job */
 	data = MEM_callocN(sizeof(PTCacheExportJob), "Point Cache Export Job");




More information about the Bf-blender-cvs mailing list