[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17144] trunk/blender/source/blender/ python/api2_2x: * Add some missing docu for Blender.Types
Nathan Letwory
jesterking at letwory.net
Tue Oct 21 10:27:38 CEST 2008
Revision: 17144
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17144
Author: jesterking
Date: 2008-10-21 10:27:38 +0200 (Tue, 21 Oct 2008)
Log Message:
-----------
* Add some missing docu for Blender.Types
* Fix potential crash in CSizeof()
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/Types.c
trunk/blender/source/blender/python/api2_2x/doc/Blender.py
trunk/blender/source/blender/python/api2_2x/doc/Types.py
Modified: trunk/blender/source/blender/python/api2_2x/Types.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Types.c 2008-10-21 08:21:36 UTC (rev 17143)
+++ trunk/blender/source/blender/python/api2_2x/Types.c 2008-10-21 08:27:38 UTC (rev 17144)
@@ -112,7 +112,7 @@
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 * ) &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 * ) &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 * ) &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);
Modified: trunk/blender/source/blender/python/api2_2x/doc/Blender.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Blender.py 2008-10-21 08:21:36 UTC (rev 17143)
+++ trunk/blender/source/blender/python/api2_2x/doc/Blender.py 2008-10-21 08:27:38 UTC (rev 17144)
@@ -73,7 +73,7 @@
- '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 @@
- '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 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
"""
Modified: trunk/blender/source/blender/python/api2_2x/doc/Types.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Types.py 2008-10-21 08:21:36 UTC (rev 17143)
+++ trunk/blender/source/blender/python/api2_2x/doc/Types.py 2008-10-21 08:27:38 UTC (rev 17144)
@@ -25,6 +25,17 @@
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 @@
@var ArmatureType: Blender Armature. The "skeleton", for animating and deforming
objects.
@var BoneType: Blender Bone. Bones are, obviously, the "pieces" of an Armature.
+ at var EditBoneType: Blender Editbone. Bones in editmode.
@var CurveType: Blender Curve.
@var IpoType: Blender Ipo.
+ at var CurNurbType: Blender CurNurb.
+ at var SurfNurbType: Blender SurfNurb.
+ at var IpoCurveType: Blender IpoCurve.
@var MetaballType: Blender Metaball.
@var CameraType: Blender Camera.
@var ImageType: Blender Image.
@@ -57,7 +72,7 @@
@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.
- at var matrix_Type: Blender matrix.
+ at 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 @@
@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
More information about the Bf-blender-cvs
mailing list