diff options
Diffstat (limited to 'source/blender/python/api2_2x/Types.c')
-rw-r--r-- | source/blender/python/api2_2x/Types.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index 7aa5c64ed14..2a22c59c014 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -40,35 +40,50 @@ PyObject *M_Types_Init (void) { PyObject *submodule, *dict; - submodule = Py_InitModule3("Blender.Types", Null_methods, M_Types_doc); + /* These are only set when some object initializes them. But unless we + * do it now, we get two easy ways to crash Blender. Maybe we'd better + * have an Init function for all these internal types that more than one + * module can use. We could call it after setting the Blender dictionary */ + vector_Type.ob_type = &PyType_Type; + rgbTuple_Type.ob_type = &PyType_Type; + constant_Type.ob_type = &PyType_Type; - dict = PyModule_GetDict(submodule); + submodule = Py_InitModule3 ("Blender.Types", Null_methods, M_Types_doc); + + dict = PyModule_GetDict(submodule); /* The Blender Object Type */ - PyDict_SetItemString(dict, "ObjectType", (PyObject *)&Object_Type); + PyDict_SetItemString(dict, "ObjectType", (PyObject *)&Object_Type); /* Blender Object Data Types */ - PyDict_SetItemString(dict, "NMeshType", (PyObject *)&NMesh_Type); - PyDict_SetItemString(dict, "NMFaceType", (PyObject *)&NMFace_Type); - PyDict_SetItemString(dict, "NMVertType", (PyObject *)&NMVert_Type); - PyDict_SetItemString(dict, "NMColType", (PyObject *)&NMCol_Type); + PyDict_SetItemString(dict, "NMeshType", (PyObject *)&NMesh_Type); + PyDict_SetItemString(dict, "NMFaceType", (PyObject *)&NMFace_Type); + PyDict_SetItemString(dict, "NMVertType", (PyObject *)&NMVert_Type); + PyDict_SetItemString(dict, "NMColType", (PyObject *)&NMCol_Type); + + PyDict_SetItemString(dict, "ArmatureType", (PyObject *)&Armature_Type); + PyDict_SetItemString(dict, "BoneType", (PyObject *)&Bone_Type); + + PyDict_SetItemString(dict, "CurveType", (PyObject *)&Curve_Type); + PyDict_SetItemString(dict, "IpoType", (PyObject *)&Ipo_Type); + PyDict_SetItemString(dict, "MetaballType", (PyObject *)&Metaball_Type); - PyDict_SetItemString(dict, "CameraType", (PyObject *)&Camera_Type); - PyDict_SetItemString(dict, "ImageType", (PyObject *)&Image_Type); - PyDict_SetItemString(dict, "LampType", (PyObject *)&Lamp_Type); - PyDict_SetItemString(dict, "TextType", (PyObject *)&Text_Type); + PyDict_SetItemString(dict, "CameraType", (PyObject *)&Camera_Type); + PyDict_SetItemString(dict, "ImageType", (PyObject *)&Image_Type); + PyDict_SetItemString(dict, "LampType", (PyObject *)&Lamp_Type); + PyDict_SetItemString(dict, "TextType", (PyObject *)&Text_Type); + PyDict_SetItemString(dict, "MaterialType", (PyObject *)&Material_Type); - PyDict_SetItemString(dict, "ButtonType", (PyObject *)&Button_Type); - PyDict_SetItemString(dict, "MaterialType",(PyObject *)&Material_Type); + PyDict_SetItemString(dict, "ButtonType", (PyObject *)&Button_Type); /* External helper Types available to the main ones above */ - PyDict_SetItemString(dict, "vectorType", (PyObject *)&vector_Type); - PyDict_SetItemString(dict, "bufferType", (PyObject *)&buffer_Type); - PyDict_SetItemString(dict, "constantType", (PyObject *)&constant_Type); - PyDict_SetItemString(dict, "rgbTupleType", (PyObject *)&rgbTuple_Type); + PyDict_SetItemString(dict, "vectorType", (PyObject *)&vector_Type); + PyDict_SetItemString(dict, "bufferType", (PyObject *)&buffer_Type); + PyDict_SetItemString(dict, "constantType", (PyObject *)&constant_Type); + PyDict_SetItemString(dict, "rgbTupleType", (PyObject *)&rgbTuple_Type); - return (submodule); + return submodule; } |