Module Types
[hide private]
[frames] | no frames]

Module Types

source code

The Blender.Types submodule

This module is a dictionary of Blender Python types, for type checking.

Example:

 import Blender
 from Blender import Types, Object, NMesh, Camera, Lamp
 #
 objs = Object.Get() # a list of all objects in the current scene
 for o in objs:
   print
   print o, type(o)
   data = o.getData()
   print type(data)
   if type(data) == Types.NMeshType:
     if len(data.verts):
       print "its vertices are obviously of type:", type(data.verts[0])
     print "and its faces:", Types.NMFaceType
   elif type(data) == Types.CameraType:
     print "It's a Camera."
   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)
Functions [hide private]
 
CSizeof(type)
Get the size in bytes of the underlying DNA struct for the given type.
source code
Variables [hide private]
  ArmatureType
Blender Armature.
  BoneType
Blender Bone.
  ButtonType
Blender Button.
  CameraType
Blender Camera.
  CurNurbType
Blender CurNurb.
  CurveType
Blender Curve.
  EditBoneType
Blender Editbone.
  GroupType
Blender Group.
  IDArrayType
Blender IDProperty Array type.
  IDGroupType
Blender IDProperty Group type.
  ImageType
Blender Image.
  IpoCurveType
Blender IpoCurve.
  IpoType
Blender Ipo.
  LampType
Blender Lamp.
  MColType
Blender MCol.
  MEdgeType
Blender MEdge.
  MFaceType
Blender MFace.
  MTexType
Blender MTex.
  MVertType
Blender MVert.
  MaterialType
Blender Material.
  MeshType
Blender Mesh.
  MetaballType
Blender Metaball.
  NMColType
Blender NMCol.
  NMFaceType
Blender NMFace.
  NMVertType
Blender NMVert.
  NMeshType
Blender NMesh.
  ObjectType
Blender Object.
  PVertType
Blender MVert.
  SceneType
A Blender Scene.
  SurfNurbType
Blender SurfNurb.
  Text3dType
Blender Text3d.
  TextType
Blender Text.
  TextureType
Blender Texture.
  __package__ = None
  bufferType
Blender buffer.
  constantType
Blender constant.
  eulerType
Blender euler.
  matrixType
Blender matrix.
  quaternionType
Blender quaternion.
  rgbTupleType
Blender rgbTuple.
  vectorType
Blender vector.
Function Details [hide private]

CSizeof(type)

source code 

Get the size in bytes of the underlying DNA struct for the given type.

Parameters:
  • type (type) - A Blender Python type.
Returns:
size in bytes or -1 if not supported type.

Variables Details [hide private]

ArmatureType

Blender Armature. The "skeleton", for animating and deforming objects.

BoneType

Blender Bone. Bones are, obviously, the "pieces" of an Armature.

ButtonType

Blender Button. One of the Draw widgets.

EditBoneType

Blender Editbone. Bones in editmode.

GroupType

Blender Group. A Group that references a list of objects that are a part of this group.

MColType

Blender MCol. A mesh rgba color.

MEdgeType

Blender MEdge. A mesh edge, with two vertices

MFaceType

Blender MFace. A mesh face, with three (a triangular face) or four (a quad face) vertices.

MTexType

Blender MTex. Links materials to a texture.

MVertType

Blender MVert. A mesh vertex which wraps a Blender mesh vertex (typically an object returned from the mesh.verts sequence).

MeshType

Blender Mesh. The mesh structure.

NMColType

Blender NMCol. A mesh rgba color.

NMFaceType

Blender NMFace. A mesh face, with one (a point), two (an edge), three (a triangular face) or four (a quad face) vertices.

NMVertType

Blender NMVert. A mesh vertex.

NMeshType

Blender NMesh. The mesh structure.

ObjectType

Blender Object. The base object, linked to its specific data at its .data member variable.

PVertType

Blender MVert. A mesh vertex which does not wrap a Blender mesh vertex (returned from Blender.Mesh.MVert()).

SceneType

A Blender Scene. Container of all other objects.

bufferType

Blender buffer. A contiguous piece of storage, used in BGL.

constantType

Blender constant. A constant dictionary.

quaternionType

Blender quaternion. Used in armatures.

rgbTupleType

Blender rgbTuple. A (red, green, blue) triplet.

vectorType

Blender vector. Used in NMesh, Mesh and elsewhere.