[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27188] trunk/blender: make BGL and BLF modile names lowercase
Campbell Barton
ideasman42 at gmail.com
Sun Feb 28 15:57:26 CET 2010
Revision: 27188
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27188
Author: campbellbarton
Date: 2010-02-28 15:57:26 +0100 (Sun, 28 Feb 2010)
Log Message:
-----------
make BGL and BLF modile names lowercase
Modified Paths:
--------------
trunk/blender/release/scripts/op/console_python.py
trunk/blender/release/scripts/templates/operator_modal_draw.py
trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
Added Paths:
-----------
trunk/blender/source/blender/python/generic/bgl.c
trunk/blender/source/blender/python/generic/bgl.h
trunk/blender/source/blender/python/generic/blf.c
trunk/blender/source/blender/python/generic/blf.h
Removed Paths:
-------------
trunk/blender/source/blender/python/generic/BGL.c
trunk/blender/source/blender/python/generic/BGL.h
trunk/blender/source/blender/python/generic/BLF.c
trunk/blender/source/blender/python/generic/BLF.h
Modified: trunk/blender/release/scripts/op/console_python.py
===================================================================
--- trunk/blender/release/scripts/op/console_python.py 2010-02-28 13:45:08 UTC (rev 27187)
+++ trunk/blender/release/scripts/op/console_python.py 2010-02-28 14:57:26 UTC (rev 27188)
@@ -190,7 +190,7 @@
add_scrollback("Execute: Enter", 'OUTPUT')
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
- add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, Mathutils, Geometry, BGL", 'OUTPUT')
+ add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, Mathutils, Geometry", 'OUTPUT')
add_scrollback("", 'OUTPUT')
add_scrollback("", 'OUTPUT')
sc.prompt = PROMPT
Modified: trunk/blender/release/scripts/templates/operator_modal_draw.py
===================================================================
--- trunk/blender/release/scripts/templates/operator_modal_draw.py 2010-02-28 13:45:08 UTC (rev 27187)
+++ trunk/blender/release/scripts/templates/operator_modal_draw.py 2010-02-28 14:57:26 UTC (rev 27188)
@@ -1,29 +1,29 @@
-import BGL
-import BLF
+import bgl
+import blf
def draw_callback_px(self, context):
print("mouse points", len(self.mouse_path))
# draw some text
- BLF.position(15, 30, 0)
- BLF.size(20, 72)
- BLF.draw("Hello Word " + str(len(self.mouse_path)))
+ blf.position(15, 30, 0)
+ blf.size(20, 72)
+ blf.draw("Hello Word " + str(len(self.mouse_path)))
# 50% alpha, 2 pixel width line
- BGL.glEnable(BGL.GL_BLEND)
- BGL.glColor4f(0.0, 0.0, 0.0, 0.5)
- BGL.glLineWidth(2)
+ bgl.glEnable(bgl.GL_BLEND)
+ bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
+ bgl.glLineWidth(2)
- BGL.glBegin(BGL.GL_LINE_STRIP)
+ bgl.glBegin(bgl.GL_LINE_STRIP)
for x, y in self.mouse_path:
- BGL.glVertex2i(x, y)
+ bgl.glVertex2i(x, y)
- BGL.glEnd()
+ bgl.glEnd()
# restore opengl defaults
- BGL.glLineWidth(1)
- BGL.glDisable(BGL.GL_BLEND)
- BGL.glColor4f(0.0, 0.0, 0.0, 1.0)
+ bgl.glLineWidth(1)
+ bgl.glDisable(bgl.GL_BLEND)
+ bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
class ModalDrawOperator(bpy.types.Operator):
Modified: trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
===================================================================
--- trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-02-28 13:45:08 UTC (rev 27187)
+++ trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-02-28 14:57:26 UTC (rev 27188)
@@ -333,7 +333,7 @@
del module
import BLF as module
- pymodule2sphinx(BASEPATH, "BLF", module, "Blender Font Drawing (BLF)")
+ pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)")
del module
if 0:
Deleted: trunk/blender/source/blender/python/generic/BGL.c
===================================================================
--- trunk/blender/source/blender/python/generic/BGL.c 2010-02-28 13:45:08 UTC (rev 27187)
+++ trunk/blender/source/blender/python/generic/BGL.c 2010-02-28 14:57:26 UTC (rev 27188)
@@ -1,1608 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * This is a new part of Blender.
- *
- * Contributor(s): Willian P. Germano
- *
- * ***** END GPL LICENSE BLOCK *****
-*/
-
-/* This file is the Blender.BGL part of opy_draw.c, from the old
- * bpython/intern dir, with minor changes to adapt it to the new Python
- * implementation. The BGL submodule "wraps" OpenGL functions and constants,
- * allowing script writers to make OpenGL calls in their Python scripts. */
-
-#include "BGL.h" /*This must come first */
-#include <GL/glew.h>
-#include "MEM_guardedalloc.h"
-
-static char Method_Buffer_doc[] =
- "(type, dimensions, [template]) - Create a new Buffer object\n\n\
-(type) - The format to store data in\n\
-(dimensions) - An int or sequence specifying the dimensions of the buffer\n\
-[template] - A sequence of matching dimensions to the buffer to be created\n\
- which will be used to initialize the Buffer.\n\n\
-If a template is not passed in all fields will be initialized to 0.\n\n\
-The type should be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, or GL_DOUBLE.\n\
-If the dimensions are specified as an int a linear buffer will be\n\
-created. If a sequence is passed for the dimensions the buffer\n\
-will have len(sequence) dimensions, where the size for each dimension\n\
-is determined by the value in the sequence at that index.\n\n\
-For example, passing [100, 100] will create a 2 dimensional\n\
-square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\
-buffer which is twice as deep as it is wide or high.";
-
-static PyObject *Method_Buffer( PyObject * self, PyObject * args );
-
-/* Buffer sequence methods */
-
-static int Buffer_len( PyObject * self );
-static PyObject *Buffer_item( PyObject * self, int i );
-static PyObject *Buffer_slice( PyObject * self, int begin, int end );
-static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
-static int Buffer_ass_slice( PyObject * self, int begin, int end,
- PyObject * seq );
-
-static PySequenceMethods Buffer_SeqMethods = {
- ( lenfunc ) Buffer_len, /*sq_length */
- ( binaryfunc ) 0, /*sq_concat */
- ( ssizeargfunc ) 0, /*sq_repeat */
- ( ssizeargfunc ) Buffer_item, /*sq_item */
- ( ssizessizeargfunc ) Buffer_slice, /*sq_slice */
- ( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */
- ( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice */
-};
-
-static void Buffer_dealloc( PyObject * self );
-static PyObject *Buffer_tolist( PyObject * self );
-static PyObject *Buffer_dimensions( PyObject * self );
-static PyObject *Buffer_getattr( PyObject * self, char *name );
-static PyObject *Buffer_repr( PyObject * self );
-
-PyTypeObject BGL_bufferType = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "buffer", /*tp_name */
- sizeof( Buffer ), /*tp_basicsize */
- 0, /*tp_itemsize */
- ( destructor ) Buffer_dealloc, /*tp_dealloc */
- ( printfunc ) 0, /*tp_print */
- ( getattrfunc ) Buffer_getattr, /*tp_getattr */
- ( setattrfunc ) 0, /*tp_setattr */
- 0, /*tp_compare */
- ( reprfunc ) Buffer_repr, /*tp_repr */
- 0, /*tp_as_number */
- &Buffer_SeqMethods, /*tp_as_sequence */
-};
-
-/* #ifndef __APPLE__ */
-
-#define BGL_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
- arg_def##nargs arg_list; \
- ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
- ret_set_##ret gl##funcname (arg_var##nargs arg_list);\
- ret_ret_##ret; \
-}
-
-#define BGLU_Wrap(nargs, funcname, ret, arg_list) \
-static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\
- arg_def##nargs arg_list; \
- ret_def_##ret; \
- if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\
- ret_set_##ret glu##funcname (arg_var##nargs arg_list);\
- ret_ret_##ret; \
-}
-
-/* #endif */
-
-/********/
-int BGL_typeSize(int type)
-{
- switch (type) {
- case GL_BYTE:
- return sizeof(char);
- case GL_SHORT:
- return sizeof(short);
- case GL_INT:
- return sizeof(int);
- case GL_FLOAT:
- return sizeof(float);
- case GL_DOUBLE:
- return sizeof(double);
- }
- return -1;
-}
-
-Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer)
-{
- Buffer *buffer;
- void *buf= NULL;
- int i, size, length;
-
- length= 1;
- for (i=0; i<ndimensions; i++)
- length*= dimensions[i];
-
- size= BGL_typeSize(type);
-
- buf= MEM_mallocN(length*size, "Buffer buffer");
-
- buffer= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
- buffer->parent= NULL;
- buffer->ndimensions= ndimensions;
- buffer->dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
- memcpy(buffer->dimensions, dimensions, ndimensions*sizeof(int));
- buffer->type= type;
- buffer->buf.asvoid= buf;
-
- if (initbuffer) {
- memcpy(buffer->buf.asvoid, initbuffer, length*size);
- } else {
- memset(buffer->buf.asvoid, 0, length*size);
- /*
- for (i= 0; i<length; i++) {
- if (type==GL_BYTE)
- buffer->buf.asbyte[i]= 0;
- else if (type==GL_SHORT)
- buffer->buf.asshort[i]= 0;
- else if (type==GL_INT)
- buffer->buf.asint[i]= 0;
- else if (type==GL_FLOAT)
- buffer->buf.asfloat[i]= 0.0f;
- else if (type==GL_DOUBLE)
- buffer->buf.asdouble[i]= 0.0;
- }
- */
- }
- return buffer;
-}
-
-#define MAX_DIMENSIONS 256
-static PyObject *Method_Buffer (PyObject *self, PyObject *args)
-{
- PyObject *length_ob= NULL, *template= NULL;
- Buffer *buffer;
- int dimensions[MAX_DIMENSIONS];
-
- int i, type;
- int ndimensions = 0;
-
- if (!PyArg_ParseTuple(args, "iO|O", &type, &length_ob, &template)) {
- PyErr_SetString(PyExc_AttributeError, "expected an int and one or two PyObjects");
- return NULL;
- }
- if (type!=GL_BYTE && type!=GL_SHORT && type!=GL_INT && type!=GL_FLOAT && type!=GL_DOUBLE) {
- PyErr_SetString(PyExc_AttributeError, "invalid first argument type, should be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE");
- return NULL;
- }
-
- if (PyNumber_Check(length_ob)) {
- ndimensions= 1;
- dimensions[0]= PyLong_AsLong(length_ob);
- } else if (PySequence_Check(length_ob)) {
- ndimensions= PySequence_Length(length_ob);
- if (ndimensions > MAX_DIMENSIONS) {
- PyErr_SetString(PyExc_AttributeError, "too many dimensions, max is 256");
- return NULL;
- }
- for (i=0; i<ndimensions; i++) {
- PyObject *ob= PySequence_GetItem(length_ob, i);
-
- if (!PyNumber_Check(ob)) dimensions[i]= 1;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list