Fixed some problems with makeParent()

This commit is contained in:
2003-11-11 05:37:28 +00:00
parent 516766d089
commit 1018943b3d

View File

@@ -268,7 +268,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args)
/* else if (strcmp (str_type, "Text") == 0) type = OB_FONT; */
/* else if (strcmp (str_type, "Ika") == 0) type = OB_IKA; */
else if (strcmp (str_type, "Lamp") == 0) type = OB_LAMP;
/* else if (strcmp (str_type, "Lattice") == 0) type = OB_LATTICE; */
// else if (strcmp (str_type, "Lattice") == 0) type = OB_LATTICE;
/* else if (strcmp (str_type, "Mball") == 0) type = OB_MBALL; */
else if (strcmp (str_type, "Mesh") == 0) type = OB_MESH;
/* else if (strcmp (str_type, "Surf") == 0) type = OB_SURF; */
@@ -288,8 +288,10 @@ PyObject *M_Object_New(PyObject *self, PyObject *args)
}
object = alloc_libblock (&(G.main->object), ID_OB, name);
object->id.us = 0;
object->flag = 0;
object->type = type;
/* transforms */
QuatOne(object->quat);
@@ -584,6 +586,10 @@ int EXPP_add_obdata(struct Object *object)
object->data = add_mesh();
G.totmesh++;
break;
/* case OB_LATTICE:
object->data = (void *)add_lattice();
object->dt = OB_WIRE;
break;*/
/* TODO the following types will be supported later
case OB_SURF:
@@ -600,10 +606,6 @@ int EXPP_add_obdata(struct Object *object)
object->data = add_ika();
object->dt = OB_WIRE;
break;
case OB_LATTICE:
object->data = (void *)add_lattice();
object->dt = OB_WIRE;
break;
case OB_WAVE:
object->data = add_wave();
break;
@@ -654,6 +656,9 @@ static PyObject *Object_getData (BPy_Object *self)
case OB_LAMP:
data_object = Lamp_CreatePyObject (object->data);
break;
case OB_LATTICE:
// data_object = Lattice_CreatePyObject (object->data);
break;
case ID_MA:
break;
case OB_MESH:
@@ -930,6 +935,8 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args)
data = (void *)Curve_FromPyObject (py_data);
if (NMesh_CheckPyObject (py_data))
data = (void *)Mesh_FromPyObject (py_data, self->object);
//if (Lattice_CheckPyObject (py_data))
// data = (void *)Lattice_FromPyObject (py_data);
/* have we set data to something good? */
if( !data )
@@ -972,6 +979,13 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args)
"The 'link' object is incompatible with the base object"));
}
break;
/*case ID_LT:
if (self->object->type != OB_LATTICE)
{
return (PythonReturnErrorObject (PyExc_AttributeError,
"The 'link' object is incompatible with the base object"));
}
break;*/
default:
return (PythonReturnErrorObject (PyExc_AttributeError,
"Linking this object type is not supported"));
@@ -1037,7 +1051,8 @@ static PyObject *Object_makeParent (BPy_Object *self, PyObject *args)
"parenting loop detected - parenting failed"));
}
child->partype = PAROBJECT;
py_obj_child = (BPy_Object *) py_child;
child->parent = parent;
//py_obj_child = (BPy_Object *) py_child;
if (noninverse == 1)
{
/* Parent inverse = unity */
@@ -1056,8 +1071,8 @@ static PyObject *Object_makeParent (BPy_Object *self, PyObject *args)
sort_baselist (G.scene);
}
/* We don't need the child object anymore. */
Py_DECREF ((PyObject *) child);
// We don't need the child object anymore.
//Py_DECREF ((PyObject *) child);
}
return EXPP_incr_ret (Py_None);
}
@@ -1310,6 +1325,7 @@ static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args)
case OB_CAMERA: /* we can probably add the other types, too */
case OB_ARMATURE:
case OB_CURVE:
//case OB_LATTICE:
oldid = (ID*) self->object->data;
id = (ID*) object->object->data;
self->object->data = object->object->data;