Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Selten <michel@mselten.demon.nl>2003-07-27 19:56:32 +0400
committerMichel Selten <michel@mselten.demon.nl>2003-07-27 19:56:32 +0400
commit916f527253e737b5bd31a0358828b719d251653d (patch)
tree44d99be0f35a744e77450bf29ebfe3a1e6e9fbee /source/blender/python/api2_2x/EXPP_interface.c
parent2222fc716812cfd2a5fab4d1a8eb6f775fced1dc (diff)
* Fixed problems in with script linking.
I had to update many files to get this to work.
Diffstat (limited to 'source/blender/python/api2_2x/EXPP_interface.c')
-rw-r--r--source/blender/python/api2_2x/EXPP_interface.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c
index 3cf966ab5cd..b93b2f7f2e2 100644
--- a/source/blender/python/api2_2x/EXPP_interface.c
+++ b/source/blender/python/api2_2x/EXPP_interface.c
@@ -79,10 +79,14 @@ ScriptLink * setScriptLinks(ID *id, short event)
ScriptLink * scriptlink;
PyObject * link;
Object * object;
+ Lamp * lamp;
+ Camera * camera;
+ Material * material;
+ Scene * scene;
+ World * world;
int obj_id;
obj_id = MAKE_ID2 (id->name[0], id->name[1]);
- //printf ("In setScriptLinks (id=%s, event=%d)\n",id->name, event);
switch (obj_id)
{
@@ -96,29 +100,49 @@ ScriptLink * setScriptLinks(ID *id, short event)
scriptlink = &(object->scriptlink);
break;
case ID_LA:
- scriptlink = NULL;
- Py_INCREF(Py_None);
- link = Py_None;
+ lamp = GetLampByName (GetIdName (id));
+ if (lamp == NULL)
+ {
+ return NULL;
+ }
+ link = Lamp_CreatePyObject (lamp);
+ scriptlink = &(lamp->scriptlink);
break;
case ID_CA:
- scriptlink = NULL;
- Py_INCREF(Py_None);
- link = Py_None;
+ camera = GetCameraByName (GetIdName (id));
+ if (camera == NULL)
+ {
+ return NULL;
+ }
+ link = Camera_CreatePyObject (camera);
+ scriptlink = &(camera->scriptlink);
break;
case ID_MA:
- scriptlink = NULL;
- Py_INCREF(Py_None);
- link = Py_None;
+ material = GetMaterialByName (GetIdName (id));
+ if (material == NULL)
+ {
+ return NULL;
+ }
+ link = Material_CreatePyObject (material);
+ scriptlink = &(material->scriptlink);
break;
case ID_WO:
- scriptlink = NULL;
- Py_INCREF(Py_None);
- link = Py_None;
+ world = GetWorldByName (GetIdName (id));
+ if (world == NULL)
+ {
+ return NULL;
+ }
+ link = World_CreatePyObject (world);
+ scriptlink = &(world->scriptlink);
break;
case ID_SCE:
- scriptlink = NULL;
- Py_INCREF(Py_None);
- link = Py_None;
+ scene = GetSceneByName (GetIdName (id));
+ if (scene == NULL)
+ {
+ return NULL;
+ }
+ link = Scene_CreatePyObject (scene);
+ scriptlink = &(scene->scriptlink);
break;
default:
//Py_INCREF(Py_None);
@@ -131,9 +155,9 @@ ScriptLink * setScriptLinks(ID *id, short event)
if (scriptlink == NULL)
{
/* This is probably not an internal error anymore :)
-TODO: Check this
+TODO: Check this */
printf ("Internal error, unable to create PyBlock for script link\n");
- */
+
Py_INCREF(Py_False);
PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
return NULL;