[Bf-blender-cvs] [3122ee6] soc-2014-fluid: back to single-threaded method to debug manta re-run errors

Roman Pogribnyi noreply at git.blender.org
Wed Jul 30 17:29:58 CEST 2014


Commit: 3122ee62d137fee1c154f4290d3c265e114aea38
Author: Roman Pogribnyi
Date:   Wed Jul 30 17:29:24 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rB3122ee62d137fee1c154f4290d3c265e114aea38

back to single-threaded method to debug manta re-run errors

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

M	intern/smoke/intern/MANTA.cpp
M	source/blender/python/manta_pp/pwrapper/pymain.cpp
M	source/creator/CMakeLists.txt

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

diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index 5aef064..835d71b 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -195,11 +195,17 @@ void *run_manta_scene_thread(void *arguments)
 
 void run_manta_scene(char *filepath)
 {
-	pthread_t manta_thread;
-	struct manta_arg_struct args;
-	args.filepath = filepath;
-	int rc = pthread_create(&manta_thread, NULL, run_manta_scene_thread, (void *)&args);
-	pthread_detach(manta_thread);
+	vector<string> a;
+	a.push_back(filepath);
+	//PyGILState_STATE gilstate = PyGILState_Ensure();
+	runMantaScript(a);
+	//PyGILState_Release(gilstate);
+
+//	pthread_t manta_thread;
+//	struct manta_arg_struct args;
+//	args.filepath = filepath;
+//	int rc = pthread_create(&manta_thread, NULL, run_manta_scene_thread, (void *)&args);
+//	pthread_detach(manta_thread);
 }
 
 void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
diff --git a/source/blender/python/manta_pp/pwrapper/pymain.cpp b/source/blender/python/manta_pp/pwrapper/pymain.cpp
index 97e559f..6f3a69a 100644
--- a/source/blender/python/manta_pp/pwrapper/pymain.cpp
+++ b/source/blender/python/manta_pp/pwrapper/pymain.cpp
@@ -37,16 +37,21 @@ typedef string pyString;
 
 //*****************************************************************************
 // main...
-
+static bool manta_initialized = false;
 void runMantaScript(vector<string>& args) {
 	string filename = args[0];
 	
 	// Initialize extension classes and wrappers
 	srand(0);
 	PyGILState_STATE gilstate = PyGILState_Ensure();
-
-	Pb::setup(filename, args);
-		
+	debMsg("running manta init?", 0);
+	
+	if (! manta_initialized)
+	{	
+		debMsg("yes", 0);
+		Pb::setup(filename, args);
+		manta_initialized = true;
+	}	
 	// Pass through the command line arguments
 	// for Py3k compatability, convert to wstring
 	vector<pyString> pyArgs(args.size());
@@ -81,16 +86,22 @@ void runMantaScript(vector<string>& args) {
 #else
 	// for linux, use this as it produces nicer error messages
 	PyRun_SimpleFileEx(fp, filename.c_str(), 1);    
+	fclose(fp);
+	Pb::finalize();
+	Pb::setup(filename, args);
+	fp = fopen(filename.c_str(),"rb");    
+	debMsg("one more time",0);
+	PyRun_SimpleFileEx(fp, filename.c_str(), 1);    
 	fclose(fp);    
 #endif
 	
 	debMsg("Script finished.", 0);
 #ifdef GUI
-	guiWaitFinish();
+//	guiWaitFinish();
 #endif
 
 	// finalize
-	Pb::finalize();
+//	Pb::finalize();
 	PyGILState_Release(gilstate);
 
 	delete [] cargs;
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index b089c9d..2fbe29b 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1148,7 +1148,11 @@ endif()
 
 	#linking manta library
 	#PR removed -Wl, -force_load 
-	SET(MANTA_LINK_LIBRARIES -force_load bf_python_manta ) 
+	if(APPLE)
+		SET(MANTA_LINK_LIBRARIES -force_load bf_python_manta ) 
+	else()
+		SET(MANTA_LINK_LIBRARIES -Wl, --whole-archive -lbf_python_manta -Wl,--no-whole-archive )
+	endif()
 	#-Wl,--whole-archive bf_python_manta -Wl,--no-whole-archive)
 	TARGET_LINK_LIBRARIES(blender ${MANTA_LINK_LIBRARIES})




More information about the Bf-blender-cvs mailing list