added what needed to link a curve to an object (modification of Object_link

added 2 functions Curve_CheckPyObject and Curve_FromPyObject
that I had forgotten
This commit is contained in:
2003-07-09 12:25:27 +00:00
parent da913434db
commit 6fe633aef3
2 changed files with 17 additions and 0 deletions

View File

@@ -143,6 +143,14 @@ PyObject *Curve_Init (void)
return (submodule); return (submodule);
} }
int Curve_CheckPyObject (PyObject *pyobj)
{
return (pyobj->ob_type == &Curve_Type);
}
Curve *Curve_FromPyObject (PyObject *pyobj)
{
return ((BPy_Curve *)pyobj)->curve;
}
/*****************************************************************************/ /*****************************************************************************/
/* Python BPy_Curve methods: */ /* Python BPy_Curve methods: */
/* gives access to */ /* gives access to */

View File

@@ -828,6 +828,8 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args)
data = (void *)Camera_FromPyObject (py_data); data = (void *)Camera_FromPyObject (py_data);
if (Lamp_CheckPyObject (py_data)) if (Lamp_CheckPyObject (py_data))
data = (void *)Lamp_FromPyObject (py_data); data = (void *)Lamp_FromPyObject (py_data);
if (Curve_CheckPyObject (py_data))
data = (void *)Curve_FromPyObject (py_data);
/* TODO: add the (N)Mesh check and from functions here when finished. */ /* TODO: add the (N)Mesh check and from functions here when finished. */
oldid = (ID*) self->object->data; oldid = (ID*) self->object->data;
@@ -857,6 +859,13 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args)
"The 'link' object is incompatible with the base object")); "The 'link' object is incompatible with the base object"));
} }
break; break;
case ID_CU:
if (self->object->type != OB_CURVE)
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"The 'link' object is incompatible with the base object"));
}
break;
default: default:
return (PythonReturnErrorObject (PyExc_AttributeError, return (PythonReturnErrorObject (PyExc_AttributeError,
"Linking this object type is not supported")); "Linking this object type is not supported"));