new(name)
fixme: need description for parameters. This function returns a new
datablock containing no data or loaded from a file.
Most datatypes accept a name for their argument except for sounds , fonts ,
ipos
and curves that need an additional
argument.
The name argument is optional if not given a default name will be
assigned.
The name given may be modified by blender to make it unique.
Loading From File
For images , texts , sounds , fonts
types you can use the filename keyword to make a new datablock from a
file.
New sounds , fonts
can only be made with the a filename given.
The filename can a keyword or the second argument, use the keyword
only for the datablocks new name to be set by the filename.
>>> sound = bpy.data.sounds.new('newsound', '~/mysound.wav')
>>> sound = bpy.data.sounds.new(filename = '~/mysound.wav')
Images
Images optionally accept extra 2 arguments for width and height,
values between 4 and 5000 if no args are given they will be 256.
>>> img = bpy.data.images.new(name, 512, 512)
Curves
Curves need 2 arguments: bpy.data.curves.new(name, type) type must
be one of the following...
>>> text3d = bpy.data.curves.new('MyCurve', 'Text3d')
Ipos
Ipos need 2 arguments: bpy.data.ipos.new(name, type) type must be
one of the following...
-
'Camera'
-
'World'
-
'Material'
-
'Texture'
-
'Lamp'
-
'Action'
-
'Constraint'
-
'Sequence'
-
'Curve'
-
'Key'
Objects cannot be created from bpy.data.objects; objects must be
created from the scene. Here are some examples.
>>> ob = bpy.data.scenes.active.objects.new('Empty')
>>> scn = bpy.data.scenes.active
... ob = sce.objects.new(bpy.data.meshes.new('mymesh'))
-
- Returns:
-
datablock
|