* Moved the code to retrieve an object by name to a seperate function in

gen_utils.c (GetObjectByName).
* Blender.link, Blender.bylink and Blender.event should work. Somehow the
  only event coming through now is only REDRAW.
* Added include path to /intern/guardedalloc

Michel
This commit is contained in:
2003-03-18 20:21:26 +00:00
parent 465229e4d6
commit 3a0725d4aa
7 changed files with 176 additions and 134 deletions

View File

@@ -131,7 +131,7 @@ PyObject *Object_Get(PyObject *self, PyObject *args)
{
char * name;
PyObject * arg;
struct Object * obj_iter;
struct Object * object;
BlenObject * blen_object;
printf ("In Object_Get()\n");
@@ -148,31 +148,18 @@ PyObject *Object_Get(PyObject *self, PyObject *args)
return (PythonReturnErrorObject (PyExc_AttributeError,
"expected string argument"));
}
name = PyString_AsString (arg);
object = GetObjectByName (name);
/* Use the name to search for the object requested. */
/* Should this lookup be a new function in blenkernel/intern/object.c? */
blen_object = NULL;
obj_iter = G.main->object.first;
while ((obj_iter) && (blen_object == NULL))
{
if (StringEqual (name, GetIdName (&(obj_iter->id))))
{
blen_object = (BlenObject*)PyObject_NEW
(BlenObject,
&object_type);
blen_object->object = obj_iter;
}
obj_iter = obj_iter->id.next;
}
if (blen_object == NULL)
if (object == NULL)
{
/* No object exists with the name specified in the argument name. */
return (PythonReturnErrorObject (PyExc_AttributeError,
"expected string argument"));
"Unknown object specified."));
}
blen_object = (BlenObject*)PyObject_NEW (BlenObject, &object_type);
blen_object->object = object;
return ((PyObject*)blen_object);
}