[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21793] branches/blender2.5/blender/source /blender: removing all functions from bpy.ui module, keeping the module incase its useful later.

Campbell Barton ideasman42 at gmail.com
Wed Jul 22 12:09:59 CEST 2009


Revision: 21793
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21793
Author:   campbellbarton
Date:     2009-07-22 12:09:59 +0200 (Wed, 22 Jul 2009)

Log Message:
-----------
removing all functions from bpy.ui module, keeping the module incase its useful later.
removed a check in exotic.c that should be added back later.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c
    branches/blender2.5/blender/source/blender/python/intern/bpy_ui.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c	2009-07-22 09:41:41 UTC (rev 21792)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/exotic.c	2009-07-22 10:09:59 UTC (rev 21793)
@@ -1900,6 +1900,11 @@
 	if(BLI_testextensie(str,".ble")) str[ strlen(str)-4]= 0;
 	if(BLI_testextensie(str,".stl")==0) strcat(str, ".stl");
 
+	if (BLI_exists(str)) {
+		; //XXX if(saveover(str)==0)
+		//XXX   return;
+	}
+
 	fpSTL= fopen(str, "wb");
 	
 	if(fpSTL==NULL) {

Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_ui.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_ui.c	2009-07-22 09:41:41 UTC (rev 21792)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_ui.c	2009-07-22 10:09:59 UTC (rev 21793)
@@ -41,332 +41,9 @@
 #include "UI_interface.h"
 #include "WM_api.h"
 
-static PyObject *Method_pupMenuBegin( PyObject * self, PyObject * args )
-{
-	PyObject *py_context;
-	char *title; int icon;
-	
-	if( !PyArg_ParseTuple( args, "O!si:pupMenuBegin", &PyCObject_Type, &py_context, &title, &icon))
-		return NULL;
-	
-	return PyCObject_FromVoidPtr( uiPupMenuBegin(PyCObject_AsVoidPtr(py_context), title, icon), NULL );
-}
+/* Dummy Module, may want to include non RNA UI functions here, else it can be removed */
 
-static PyObject *Method_pupMenuEnd( PyObject * self, PyObject * args )
-{
-	PyObject *py_context, *py_head;
-	
-	if( !PyArg_ParseTuple( args, "O!O!:pupMenuEnd", &PyCObject_Type, &py_context, &PyCObject_Type, &py_head))
-		return NULL;
-	
-	uiPupMenuEnd(PyCObject_AsVoidPtr(py_context), PyCObject_AsVoidPtr(py_head));
-	
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_defButO( PyObject * self, PyObject * args )
-{
-	uiBut *but;
-	PyObject *py_block, *py_keywords= NULL;
-	char *opname, *butname, *tip;
-	int exec, xco, yco, width, height;
-	
-	if( !PyArg_ParseTuple( args, "O!sisiiiis|O!:defButO", &PyCObject_Type, &py_block, &opname, &exec, &butname, &xco, &yco, &width, &height, &tip, &PyDict_Type, &py_keywords))
-		return NULL;
-	
-	but= uiDefButO(PyCObject_AsVoidPtr(py_block), BUT, opname, exec, butname, xco, yco, width, height, tip);
-	
-	/* Optional python doctionary used to set python properties, just like how keyword args are used */
-	if (py_keywords && PyDict_Size(py_keywords)) {
-		if (pyrna_pydict_to_props(uiButGetOperatorPtrRNA(but), py_keywords, "") == -1)
-			return NULL;
-	}
-	
-	return PyCObject_FromVoidPtr(but, NULL);
-}
-
-static PyObject *Method_defAutoButR( PyObject * self, PyObject * args )
-{
-	PyObject *py_block;
-	BPy_StructRNA *py_rna;
-	char *propname, *butname;
-	int index, xco, yco, width, height;
-	PropertyRNA *prop;
-	
-	if( !PyArg_ParseTuple( args, "O!O!sisiiii:defAutoButR", &PyCObject_Type, &py_block, &pyrna_struct_Type, &py_rna, &propname, &index, &butname, &xco, &yco, &width, &height))
-		return NULL;
-	
-	// XXX This isnt that nice api, but we dont always have the rna property from python since its converted immediately into a PyObject
-	prop = RNA_struct_find_property(&py_rna->ptr, propname);
-	if (prop==NULL) {
-		PyErr_SetString(PyExc_ValueError, "rna property not found");
-		return NULL;
-	}
-	
-	return PyCObject_FromVoidPtr(   uiDefAutoButR(PyCObject_AsVoidPtr(py_block), &py_rna->ptr, prop, index, butname, 0, xco, yco, width, height), NULL);
-}
-
-
-
-static uiBlock *py_internal_uiBlockCreateFunc(struct bContext *C, struct ARegion *ar, void *arg1)
-{
-	PyObject *ret, *args;
-	
-	args = Py_BuildValue("(NN)", PyCObject_FromVoidPtr(C, NULL), PyCObject_FromVoidPtr(ar, NULL));
-	ret = PyObject_CallObject( (PyObject *)arg1, args );
-	Py_DECREF(args);
-	
-	if (ret==NULL) {
-		PyErr_Print();
-		return NULL;
-	}
-	if (!PyCObject_Check(ret)) {
-		printf("invalid return value, not a PyCObject block\n");
-		return NULL;
-	}
-	
-	return (uiBlock *)PyCObject_AsVoidPtr(ret);
-}
-
-static PyObject *Method_pupBlock( PyObject * self, PyObject * args )
-{
-	PyObject *py_context, *py_func;
-	
-	if( !PyArg_ParseTuple( args, "O!O:pupBlock", &PyCObject_Type, &py_context, &py_func) )
-		return NULL;
-	
-	if (!PyCallable_Check(py_func)) {
-		PyErr_SetString(PyExc_ValueError, "arg not callable");
-		return NULL;
-	}
-	
-	uiPupBlock(PyCObject_AsVoidPtr(py_context), py_internal_uiBlockCreateFunc, (void *)py_func);
-	Py_RETURN_NONE;
-}
-
-// XXX missing arg - UI_EMBOSS, do we care?
-// XXX well, right now this only is to distinguish whether we have regular buttons or for pulldowns (ton)
-static PyObject *Method_beginBlock( PyObject * self, PyObject * args ) 
-{
-	PyObject *py_context, *py_ar;
-	char *name;
-	
-	if( !PyArg_ParseTuple( args, "O!O!s:beginBlock", &PyCObject_Type, &py_context, &PyCObject_Type, &py_ar, &name) )
-		return NULL;
-	
-	return PyCObject_FromVoidPtr(uiBeginBlock(PyCObject_AsVoidPtr(py_context), PyCObject_AsVoidPtr(py_ar), name, UI_EMBOSS), NULL);
-}
-
-static PyObject *Method_endBlock( PyObject * self, PyObject * args )
-{
-	PyObject *py_context, *py_block;
-	
-	if( !PyArg_ParseTuple( args, "O!O!:endBlock", &PyCObject_Type, &py_context, &PyCObject_Type, &py_block) )
-		return NULL;
-	
-	uiEndBlock(PyCObject_AsVoidPtr(py_context), PyCObject_AsVoidPtr(py_block));
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_drawBlock( PyObject * self, PyObject * args )
-{
-	PyObject *py_context, *py_block;
-	
-	if( !PyArg_ParseTuple( args, "O!O!:drawBlock", &PyCObject_Type, &py_context, &PyCObject_Type, &py_block) )
-		return NULL;
-	
-	uiDrawBlock(PyCObject_AsVoidPtr(py_context), PyCObject_AsVoidPtr(py_block));
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_popupBoundsBlock( PyObject * self, PyObject * args )
-{
-	PyObject *py_block;
-	int addval, mx, my;
-	
-	if( !PyArg_ParseTuple( args, "O!iii:popupBoundsBlock", &PyCObject_Type, &py_block, &addval, &mx, &my) )
-		return NULL;
-	
-	uiPopupBoundsBlock(PyCObject_AsVoidPtr(py_block), addval, mx, my);
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_blockBeginAlign( PyObject * self, PyObject * args )
-{
-	PyObject *py_block;
-	
-	if( !PyArg_ParseTuple( args, "O!:blockBeginAlign", &PyCObject_Type, &py_block) )
-		return NULL;
-	
-	uiBlockBeginAlign(PyCObject_AsVoidPtr(py_block));
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_blockEndAlign( PyObject * self, PyObject * args )
-{
-	PyObject *py_block;
-	
-	if( !PyArg_ParseTuple( args, "O!:blockEndAlign", &PyCObject_Type, &py_block))
-		return NULL;
-	
-	uiBlockEndAlign(PyCObject_AsVoidPtr(py_block));
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_blockSetFlag( PyObject * self, PyObject * args )
-{
-	PyObject *py_block;
-	int flag; /* Note new py api should not use flags, but for this low level UI api its ok. */
-	
-	if( !PyArg_ParseTuple( args, "O!i:blockSetFlag", &PyCObject_Type, &py_block, &flag))
-		return NULL;
-	
-	uiBlockSetFlag(PyCObject_AsVoidPtr(py_block), flag);
-	Py_RETURN_NONE;
-}
-
-/* similar to Draw.c */
-static PyObject *Method_register( PyObject * self, PyObject * args )
-{
-	PyObject *py_sl, *py_draw_func;
-	SpaceLink *sl;
-	if( !PyArg_ParseTuple( args, "O!O:register", &PyCObject_Type, &py_sl, &py_draw_func) )
-		return NULL;
-	
-	sl = PyCObject_AsVoidPtr(py_sl);
-	
-	if(sl->spacetype!=SPACE_SCRIPT) { // XXX todo - add a script space when needed
-		PyErr_SetString(PyExc_ValueError, "can only register in a script space");
-		return NULL;
-	}
-	else {
-		SpaceScript *scpt= (SpaceScript *)sl;
-		char *filename = NULL;
-		
-		if (scpt->script==NULL) {
-			scpt->script = MEM_callocN(sizeof(Script), "ScriptRegister");
-		}
-		
-		BPY_getFileAndNum(&filename, NULL);
-		
-		if (filename) {
-			strncpy(scpt->script->scriptname, filename, sizeof(scpt->script->scriptname));
-#if 0
-			char *dot;
-			dot = strchr(scpt->script->scriptname, '.'); /* remove extension */
-			if (dot)
-				*dot= '\0';
-#endif
-			Py_XINCREF( py_draw_func );
-			scpt->script->py_draw= (void *)py_draw_func;
-		}
-		else {
-			return NULL; /* BPY_getFileAndNum sets the error */
-		}
-
-		if (filename==NULL) {
-			return NULL;
-		}
-	}
-
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_registerKey( PyObject * self, PyObject * args )
-{
-	PyObject *py_context;
-	PyObject *py_keywords= NULL;
-	char *keymap_name, *operator_name;
-	int spaceid, regionid;
-	int keyval, evtval, q1, q2;
-	
-	wmWindowManager *wm;
-	ListBase *keymap;
-	wmKeymapItem *km;
-	
-	if( !PyArg_ParseTuple( args, "O!iissiiii|O!:registerKey", &PyCObject_Type, &py_context, &spaceid, &regionid, &keymap_name, &operator_name, &keyval, &evtval, &q1, &q2, &PyDict_Type, &py_keywords) )
-		return NULL;
-
-	wm= CTX_wm_manager(PyCObject_AsVoidPtr(py_context));
-	
-	/* keymap= WM_keymap_listbase(wm, "Image Generic", SPACE_IMAGE, 0); */
-	keymap= WM_keymap_listbase(wm, keymap_name, spaceid, regionid);
-	
-	km= WM_keymap_add_item(keymap, operator_name, keyval, evtval, q1, q2);
-	
-	/* Optional python doctionary used to set python properties, just like how keyword args are used */
-	if (py_keywords && PyDict_Size(py_keywords)) {
-		if (pyrna_pydict_to_props(km->ptr, py_keywords, "Registering keybinding") == -1)
-			return NULL;
-	}
-	
-	Py_RETURN_NONE;
-}
-
-static PyObject *Method_getRegonPtr( PyObject * self )
-{
-	bContext *C= BPy_GetContext();
-	
-	ARegion *ar = CTX_wm_region(C);
-	return PyCObject_FromVoidPtr(ar, NULL);
-}
-
-static PyObject *Method_getAreaPtr( PyObject * self )
-{
-	bContext *C= BPy_GetContext();
-	
-	ScrArea *area = CTX_wm_area(C);
-	return PyCObject_FromVoidPtr(area, NULL);
-}
-
-static PyObject *Method_getScreenPtr( PyObject * self )
-{
-	bContext *C= BPy_GetContext();
-	
-	bScreen *screen= CTX_wm_screen(C);
-	return PyCObject_FromVoidPtr(screen, NULL);
-}
-
-static PyObject *Method_getSpacePtr( PyObject * self )
-{
-	bContext *C= BPy_GetContext();
-	
-	SpaceLink *sl= CTX_wm_space_data(C);
-	return PyCObject_FromVoidPtr(sl, NULL);
-}
-
-static PyObject *Method_getWindowPtr( PyObject * self )
-{
-	bContext *C= BPy_GetContext();
-	
-	wmWindow *window= CTX_wm_window(C);
-	return PyCObject_FromVoidPtr(window, NULL);
-}
-
 static struct PyMethodDef ui_methods[] = {
-	{"pupMenuBegin", (PyCFunction)Method_pupMenuBegin, METH_VARARGS, ""},
-	{"pupMenuEnd", (PyCFunction)Method_pupMenuEnd, METH_VARARGS, ""},
-	{"defButO", (PyCFunction)Method_defButO, METH_VARARGS, ""},
-	{"defAutoButR", (PyCFunction)Method_defAutoButR, METH_VARARGS, ""},
-	{"pupBlock", (PyCFunction)Method_pupBlock, METH_VARARGS, ""},

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list