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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-04-23 17:11:48 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2004-04-23 17:11:48 +0400
commitabe8191d7091b12604a1f427dc1e1bce15d7053e (patch)
tree3767e375f88fc32ac87d0628ac916525217a5921 /source/blender/python/api2_2x/Types.c
parentda7b4711a425aca00da78520d021acef57bae59f (diff)
BPython:
- fixed two warnings, unused var in Object.c and undeclared function in script.c - updated Blender.Draw doc, it was missing info about Button object - refactored pytype initialization to try to fix for once platform (and distro!) specific crashes on startup. This asked for tiny updates in Effect.[ch] (removed static from declaration, moved definitions to the .c file) and modules.h - fixed error I made trying to fix scripts w/ no [eol] char in menus. Thanks Michael Velikanje for reporting the problem!
Diffstat (limited to 'source/blender/python/api2_2x/Types.c')
-rw-r--r--source/blender/python/api2_2x/Types.c142
1 files changed, 83 insertions, 59 deletions
diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c
index 3a1b95f8b59..8acc3b6abbe 100644
--- a/source/blender/python/api2_2x/Types.c
+++ b/source/blender/python/api2_2x/Types.c
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
@@ -37,82 +37,106 @@ This module is a dictionary of all Blender Python types";
struct PyMethodDef Null_methods[] = {{NULL, NULL}};
-/*****************************************************************************/
-/* Function: Types_Init */
-/*****************************************************************************/
-PyObject *Types_Init (void)
+void types_InitAll(void)
{
- PyObject *submodule, *dict;
-
- /* These are only set when some object initializes them. But unless we
- * do it now, we get an easy way 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 */
- Action_Type.ob_type = &PyType_Type;
- matrix_Type.ob_type = &PyType_Type;
- vector_Type.ob_type = &PyType_Type;
- euler_Type.ob_type = &PyType_Type;
- quaternion_Type.ob_type = &PyType_Type;
- rgbTuple_Type.ob_type = &PyType_Type;
- constant_Type.ob_type = &PyType_Type;
- buffer_Type.ob_type = &PyType_Type;
- Button_Type.ob_type = &PyType_Type;
+ /* The internal types (lowercase first letter, like constant_Type) are only
+ * set when some object initializes them. But unless we do it early, we get
+ * some easy and unpredictable (varies with platform, even distro) ways to
+ * crash Blender. Some modules also need this early up, so let's generalize
+ * and init all our pytypes here. */
+
+ Action_Type.ob_type = &PyType_Type;
+ Armature_Type.ob_type = &PyType_Type;
BezTriple_Type.ob_type = &PyType_Type;
-
- /* Another one that needs to be here: */
+ Bone_Type.ob_type = &PyType_Type;
+ Build_Type.ob_type = &PyType_Type;
+ Button_Type.ob_type = &PyType_Type;
+ Camera_Type.ob_type = &PyType_Type;
+ Curve_Type.ob_type = &PyType_Type;
+ Effect_Type.ob_type = &PyType_Type;
+ Image_Type.ob_type = &PyType_Type;
+ Ipo_Type.ob_type = &PyType_Type;
+ IpoCurve_Type.ob_type = &PyType_Type;
+ Lamp_Type.ob_type = &PyType_Type;
+ Lattice_Type.ob_type = &PyType_Type;
+ Material_Type.ob_type = &PyType_Type;
+ Metaball_Type.ob_type = &PyType_Type;
+ MTex_Type.ob_type = &PyType_Type;
+ NMCol_Type.ob_type = &PyType_Type;
+ NMFace_Type.ob_type = &PyType_Type;
+ NMVert_Type.ob_type = &PyType_Type;
+ NMesh_Type.ob_type = &PyType_Type;
+ Object_Type.ob_type = &PyType_Type;
+ Particle_Type.ob_type = &PyType_Type;
+ Scene_Type.ob_type = &PyType_Type;
Text_Type.ob_type = &PyType_Type;
+ Texture_Type.ob_type = &PyType_Type;
+ Wave_Type.ob_type = &PyType_Type;
+ World_Type.ob_type = &PyType_Type;
+ buffer_Type.ob_type = &PyType_Type;
+ constant_Type.ob_type = &PyType_Type;
+ euler_Type.ob_type = &PyType_Type;
+ matrix_Type.ob_type = &PyType_Type;
+ quaternion_Type.ob_type = &PyType_Type;
+ rgbTuple_Type.ob_type = &PyType_Type;
+ vector_Type.ob_type = &PyType_Type;
+}
- Texture_Type.ob_type = &PyType_Type;
- MTex_Type.ob_type = &PyType_Type;
+/*****************************************************************************/
+/* Function: Types_Init */
+/*****************************************************************************/
+PyObject *Types_Init (void)
+{
+ PyObject *submodule, *dict;
- submodule = Py_InitModule3 ("Blender.Types", Null_methods, M_Types_doc);
+ submodule = Py_InitModule3 ("Blender.Types", Null_methods, M_Types_doc);
- dict = PyModule_GetDict(submodule);
+ dict = PyModule_GetDict(submodule);
- /* The Blender Object Type */
+ /* The Blender Object Type */
- PyDict_SetItemString(dict, "ObjectType", (PyObject *)&Object_Type);
+ PyDict_SetItemString(dict, "ObjectType", (PyObject *)&Object_Type);
- /* Blender Object Data Types */
+ /* Blender Object Data Types */
- PyDict_SetItemString(dict, "SceneType", (PyObject *)&Scene_Type);
+ PyDict_SetItemString(dict, "SceneType", (PyObject *)&Scene_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, "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, "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, "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, "MaterialType", (PyObject *)&Material_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, "ButtonType", (PyObject *)&Button_Type);
- PyDict_SetItemString(dict, "LatticeType", (PyObject *)&Lattice_Type);
+ PyDict_SetItemString(dict, "LatticeType", (PyObject *)&Lattice_Type);
- PyDict_SetItemString(dict, "TextureType", (PyObject *)&Texture_Type);
- PyDict_SetItemString(dict, "MTexType", (PyObject *)&MTex_Type);
+ PyDict_SetItemString(dict, "TextureType", (PyObject *)&Texture_Type);
+ PyDict_SetItemString(dict, "MTexType", (PyObject *)&MTex_Type);
- /* External helper Types available to the main ones above */
+ /* 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, "matrix_Type", (PyObject *)&matrix_Type);
- PyDict_SetItemString(dict, "eulerType", (PyObject *)&euler_Type);
- PyDict_SetItemString(dict, "quaternionType", (PyObject *)&quaternion_Type);
- PyDict_SetItemString(dict, "BezTripleType", (PyObject *)&BezTriple_Type);
- PyDict_SetItemString(dict, "ActionType", (PyObject *)&Action_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);
+ PyDict_SetItemString(dict, "matrix_Type", (PyObject *)&matrix_Type);
+ PyDict_SetItemString(dict, "eulerType", (PyObject *)&euler_Type);
+ PyDict_SetItemString(dict, "quaternionType", (PyObject *)&quaternion_Type);
+ PyDict_SetItemString(dict, "BezTripleType", (PyObject *)&BezTriple_Type);
+ PyDict_SetItemString(dict, "ActionType", (PyObject *)&Action_Type);
- return submodule;
+ return submodule;
}