diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2008-10-21 12:27:38 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2008-10-21 12:27:38 +0400 |
commit | 27b90f2c66addf846a7eb0c89356b0a30965fbfb (patch) | |
tree | 16830de209fc2fb53972b0d746c25f8b49033ae4 /source/blender | |
parent | 8977ccafbb750dd5ad26c01ec98169d2a31f5f16 (diff) |
* Add some missing docu for Blender.Types
* Fix potential crash in CSizeof()
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/api2_2x/Types.c | 10 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Blender.py | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Types.py | 25 |
3 files changed, 32 insertions, 9 deletions
diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index 10db016ab68..a466bbd615a 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -112,7 +112,7 @@ static PyObject *Types_CSizeof(PyObject * self, PyObject *o) char type[32]; if(o) { - sprintf(type, "%s", PyString_AsString(PyObject_Str(o))); + BLI_snprintf(type, 32, "%s", PyString_AsString(PyObject_Str(o))); if(BLI_streq(type, "<type 'Blender Action'>")==1) { ret = sizeof(struct bAction); @@ -309,9 +309,9 @@ PyObject *Types_Init( void ) ( PyObject * ) &Armature_Type ); PyDict_SetItemString( dict, "BoneType", ( PyObject * ) &Bone_Type ); - PyDict_SetItemString( dict, "CurNurb_Type", + PyDict_SetItemString( dict, "CurNurbType", ( PyObject * ) &CurNurb_Type ); - PyDict_SetItemString( dict, "SurfNurb_Type", + PyDict_SetItemString( dict, "SurfNurbType", ( PyObject * ) &SurfNurb_Type ); PyDict_SetItemString( dict, "CurveType", ( PyObject * ) &Curve_Type ); @@ -349,7 +349,7 @@ PyObject *Types_Init( void ) ( PyObject * ) &constant_Type ); PyDict_SetItemString( dict, "rgbTupleType", ( PyObject * ) &rgbTuple_Type ); - PyDict_SetItemString( dict, "matrix_Type", + PyDict_SetItemString( dict, "matrixType", ( PyObject * ) &matrix_Type ); PyDict_SetItemString( dict, "eulerType", ( PyObject * ) &euler_Type ); PyDict_SetItemString( dict, "quaternionType", @@ -372,7 +372,7 @@ PyObject *Types_Init( void ) ( PyObject * ) &EditBone_Type); PyDict_SetItemString( dict, "ThemeSpaceType", ( PyObject * ) &ThemeSpace_Type); - PyDict_SetItemString( dict, "ThemeUI_Type", + PyDict_SetItemString( dict, "ThemeUIType", ( PyObject * ) &ThemeUI_Type); PyDict_SetItemString( dict, "IDGroupType", ( PyObject * ) &IDGroup_Type); diff --git a/source/blender/python/api2_2x/doc/Blender.py b/source/blender/python/api2_2x/doc/Blender.py index 9d89cae7137..8767df43ee1 100644 --- a/source/blender/python/api2_2x/doc/Blender.py +++ b/source/blender/python/api2_2x/doc/Blender.py @@ -73,7 +73,7 @@ def Set (request, data): - 'renderdir': default render output dir - 'soundsdir': sound dir - 'tempdir': temp file storage dir - - 'mipmap' : Use mipmapping in the 3d view (Use a boolean value True/False). + - 'mipmap' : Use mipmapping in the 3d view (Use a boolean value True/False). @type data: int or string @param data: The new value. """ @@ -111,7 +111,7 @@ def Get (request): - 'soundsdir': the path to the user defined dir for sound files. (*) - 'tempdir': the path to the user defined dir for storage of Blender temporary files. (*) - - 'mipmap' : Use mipmapping in the 3d view. (*) + - 'mipmap' : Use mipmapping in the 3d view. (*) - 'version' : the Blender version number. @note: (*) these can be set in Blender at the User Preferences window -> File Paths tab. @@ -255,6 +255,6 @@ def Quit (): def SaveUndoState (message): """ Sets an undo at the current state. - @param message: Message that appiers in the undo menu + @param message: Message that appears in the undo menu @type message: string """ diff --git a/source/blender/python/api2_2x/doc/Types.py b/source/blender/python/api2_2x/doc/Types.py index a08226e46ee..d9cd70a1f5b 100644 --- a/source/blender/python/api2_2x/doc/Types.py +++ b/source/blender/python/api2_2x/doc/Types.py @@ -25,6 +25,17 @@ Example:: elif type(data) == Types.LampType: print "Let there be light!" +Since Blender 2.48a you can get the size of the underlying DNA structs for a collection of Blender Python types. + +Example:: + # loop over Types dictionary and print the struct sizes + # -1 where the type is not supported byt the CSizeof function + import Blender.Types as bt + x = dir(bt) + for t in x: + s = 'bt.CSizeof(bt.' + t + ')' + print t,"=", eval(s) + @var ObjectType: Blender Object. The base object, linked to its specific data at its .data member variable. @var GroupType: Blender Group. A Group that references a list of objects that are a part of this group. @@ -45,8 +56,12 @@ Example:: @var ArmatureType: Blender Armature. The "skeleton", for animating and deforming objects. @var BoneType: Blender Bone. Bones are, obviously, the "pieces" of an Armature. +@var EditBoneType: Blender Editbone. Bones in editmode. @var CurveType: Blender Curve. @var IpoType: Blender Ipo. +@var CurNurbType: Blender CurNurb. +@var SurfNurbType: Blender SurfNurb. +@var IpoCurveType: Blender IpoCurve. @var MetaballType: Blender Metaball. @var CameraType: Blender Camera. @var ImageType: Blender Image. @@ -57,7 +72,7 @@ objects. @var SceneType: A Blender Scene. Container of all other objects. @var ButtonType: Blender Button. One of the Draw widgets. @var vectorType: Blender vector. Used in NMesh, Mesh and elsewhere. -@var matrix_Type: Blender matrix. +@var matrixType: Blender matrix. @var quaternionType: Blender quaternion. Used in armatures. @var eulerType: Blender euler. @var bufferType: Blender buffer. A contiguous piece of storage, used in BGL. @@ -68,3 +83,11 @@ objects. @var IDGroupType: Blender IDProperty Group type. @var IDArrayType: Blender IDProperty Array type. """ + +def CSizeof (type): + """ + Get the size in bytes of the underlying DNA struct for the given type. + @param type: A Blender Python type. + @type type: type + @return: size in bytes or -1 if not supported type. + """
\ No newline at end of file |