From 1018943b3d14e4bd30f0ea7416bdeeb4fc7cea83 Mon Sep 17 00:00:00 2001 From: Joseph Gilbert Date: Tue, 11 Nov 2003 05:37:28 +0000 Subject: [PATCH] Fixed some problems with makeParent() --- source/blender/python/api2_2x/Object.c | 32 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index b3ea03e0fc1..5500abadf38 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -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;