disabled Object.Duplicate() in background mode bacause it needs the 3d view, added a note in the docs.

This commit is contained in:
Campbell Barton 2007-03-14 02:11:42 +00:00
parent 4badc5da7a
commit d3ae4b9944
2 changed files with 8 additions and 0 deletions

@ -987,6 +987,12 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
static char *kwlist[] = {"mesh", "surface", "curve",
"text", "metaball", "armature", "lamp", "material", "texture", "ipo", NULL};
/* duplicating in background causes segfaults */
if( G.background == 1 )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"cannot duplicate objects in background mode" );
if (!PyArg_ParseTupleAndKeywords(args, kwd, "|iiiiiiiiii", kwlist,
&mesh_dupe, &surface_dupe, &curve_dupe, &text_dupe, &metaball_dupe,
&armature_dupe, &lamp_dupe, &material_dupe, &texture_dupe, &ipo_dupe))

@ -193,6 +193,8 @@ def Duplicate (mesh=0, surface=0, curve=0, text=0, metaball=0, armature=0, lamp=
By default no data linked to the object is duplicated; use the keyword arguments to change this.
L{Object.GetSelected()<GetSelected>} will return the list of objects resulting from duplication.
B{Note}: This command will raise an error if used from the command line (background mode) because it uses the 3D view context.
@type mesh: bool
@param mesh: When non-zero, mesh object data will be duplicated with the objects.
@type surface: bool