3 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. The Blender
9 * Foundation also sells licenses for use in proprietary software under
10 * the Blender License. See http://www.blender.org/BL/ for information
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * This is a new part of Blender.
27 * Contributor(s): Michel Selten
29 * ***** END GPL/BL DUAL LICENSE BLOCK *****
34 #include <BKE_global.h>
37 #include <DNA_camera_types.h>
38 #include <DNA_lamp_types.h>
39 #include <DNA_material_types.h>
40 #include <DNA_object_types.h>
41 #include <DNA_scene_types.h>
42 #include <DNA_world_types.h>
44 #include "datablock.h"
45 #include "gen_utils.h"
48 void initBlenderApi2_2x (void)
50 printf ("initBlenderApi2_2x\n");
54 void setScriptLinks(ID *id, short event)
59 printf ("In setScriptLinks (id=?, event=%d)\n", event);
62 /* Not initialized yet. This can happen at first file load. */
66 obj_id = MAKE_ID2 (id->name[0], id->name[1]);
78 /* Create a new datablock of type: Object */
80 link = ObjectCreatePyObject (G.main->object);
84 /* Create a new datablock of type: Mesh */
87 /* Create a new datablock of type: Lamp */
90 /* Create a new datablock of type: Camera */
93 /* Create a new datablock of type: Material */
96 /* Create a new datablock of type: World */
99 /* Create a new datablock of type: Ipo */
102 /* Create a new datablock of type: Image */
105 /* Create a new datablock of type: Text */
108 PythonReturnErrorObject (PyExc_SystemError,
109 "Unable to create block for data");
112 /* link = DataBlockFromID(id); */
117 printf ("Internal error, unable to create PyBlock for script link\n");
118 printf ("This is a bug; please report to bugs@blender.nl");
120 PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
124 PyDict_SetItemString(g_blenderdict, "bylink", Py_True);
127 PyDict_SetItemString(g_blenderdict, "link", link);
128 PyDict_SetItemString(g_blenderdict, "event",
129 Py_BuildValue("s", event_to_name(event)));