* Add some missing docu for Blender.Types
* Fix potential crash in CSizeof()
This commit is contained in:
parent
8977ccafbb
commit
27b90f2c66
@ -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);
|
||||
|
@ -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
|
||||
"""
|
||||
|
@ -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.
|
||||
"""
|
Loading…
Reference in New Issue
Block a user