[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32794] trunk/blender: own recent commit broke this python import:

Campbell Barton ideasman42 at gmail.com
Sun Oct 31 14:17:40 CET 2010


Revision: 32794
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32794
Author:   campbellbarton
Date:     2010-10-31 14:17:39 +0100 (Sun, 31 Oct 2010)

Log Message:
-----------
own recent commit broke this python import:
 from mathutils.geometry import PolyFill

I couldn't find a way for python's inittab to do this so just inserting mathutils.geometry into sys.modules manually.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/source/blender/blenkernel/BKE_utildefines.h
    trunk/blender/source/blender/python/generic/mathutils.c
    trunk/blender/source/blender/python/intern/bpy_interface.c

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2010-10-31 12:43:42 UTC (rev 32793)
+++ trunk/blender/CMakeLists.txt	2010-10-31 13:17:39 UTC (rev 32794)
@@ -543,25 +543,28 @@
 
 		SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
 
-	ELSE(MSVC) # MINGW
-		SET(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
-		SET(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
+	ELSE(MSVC)
+		# keep GCC spesific stuff here
+		IF(CMAKE_COMPILER_IS_GNUCC)
+			SET(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
+			SET(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
 
-		# Better warnings
-		SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
-		SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+			# Better warnings
+			SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
+			SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+			
+			IF(WITH_OPENMP)
+				SET(LLIBS "${LLIBS} -lgomp")
+				SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+				SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
+			ENDIF(WITH_OPENMP)
+		ENDIF(CMAKE_COMPILER_IS_GNUCC)
 
 		ADD_DEFINITIONS(-DFREE_WINDOWS)
 
 		SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
 		SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
 
-		IF(WITH_OPENMP)
-			SET(LLIBS "${LLIBS} -lgomp")
-			SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
-			SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
-		ENDIF(WITH_OPENMP)
-
 		IF(WITH_INTERNATIONAL)
 			SET(GETTEXT ${LIBDIR}/gcc/gettext)
 			SET(GETTEXT_INC ${GETTEXT}/include)

Modified: trunk/blender/source/blender/blenkernel/BKE_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_utildefines.h	2010-10-31 12:43:42 UTC (rev 32793)
+++ trunk/blender/source/blender/blenkernel/BKE_utildefines.h	2010-10-31 13:17:39 UTC (rev 32794)
@@ -282,7 +282,7 @@
 #elif defined(__GNUC__)
 #define BM_INLINE static inline __attribute((always_inline))
 #else
-#warning "MSC/GNUC defines not found, inline non-functional"
+/* #warning "MSC/GNUC defines not found, inline non-functional" */
 #define BM_INLINE static 
 #endif
 

Modified: trunk/blender/source/blender/python/generic/mathutils.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils.c	2010-10-31 12:43:42 UTC (rev 32793)
+++ trunk/blender/source/blender/python/generic/mathutils.c	2010-10-31 13:17:39 UTC (rev 32794)
@@ -248,6 +248,7 @@
 PyMODINIT_FUNC BPyInit_mathutils(void)
 {
 	PyObject *submodule;
+	PyObject *item;
 
 	if( PyType_Ready( &vector_Type ) < 0 )
 		return NULL;
@@ -270,8 +271,13 @@
 	PyModule_AddObject( submodule, "Color",			(PyObject *)&color_Type );
 	
 	/* submodule */
-	PyModule_AddObject( submodule, "geometry",		BPyInit_mathutils_geometry());
-	
+	PyModule_AddObject( submodule, "geometry",		(item=BPyInit_mathutils_geometry()));
+	/* XXX, python doesnt do imports with this usefully yet
+	 * 'from mathutils.geometry import PolyFill'
+	 * ...fails without this. */
+	PyDict_SetItemString(PyThreadState_GET()->interp->modules, "mathutils.geometry", item);
+	Py_INCREF(item);
+
 	mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
 
 	return submodule;

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c	2010-10-31 12:43:42 UTC (rev 32793)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c	2010-10-31 13:17:39 UTC (rev 32794)
@@ -199,6 +199,7 @@
 /* init-tab */
 extern PyObject *BPyInit_noise(void);
 extern PyObject *BPyInit_mathutils(void);
+// extern PyObject *BPyInit_mathutils_geometry(void); // BPyInit_mathutils calls, py doesnt work with thos :S
 extern PyObject *BPyInit_bgl(void);
 extern PyObject *BPyInit_blf(void);
 extern PyObject *AUD_initPython(void);
@@ -206,6 +207,7 @@
 static struct _inittab bpy_internal_modules[]= {
 	{"noise", BPyInit_noise},
 	{"mathutils", BPyInit_mathutils},
+//	{"mathutils.geometry", BPyInit_mathutils_geometry},
 	{"bgl", BPyInit_bgl},
 	{"blf", BPyInit_blf},
 	{"aud", AUD_initPython},





More information about the Bf-blender-cvs mailing list