diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-31 08:43:10 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-05-31 08:43:10 +0400 |
commit | 302479603b6ae471e0079617cfe3a2e98e74c249 (patch) | |
tree | dda4ea3284e85cea514f02fdac331c65e8618b12 /source/blender/python/api2_2x/Image.h | |
parent | 721fa5479c84466f2b0c15a1781cae874875f622 (diff) |
* Updated NMesh port to exppython:
Added material and image handling/hooks and the constant dictionaries.
Changed Image.h and Material.h to only have public declarations, so
NMesh could include them.
Diffstat (limited to 'source/blender/python/api2_2x/Image.h')
-rw-r--r-- | source/blender/python/api2_2x/Image.h | 125 |
1 files changed, 8 insertions, 117 deletions
diff --git a/source/blender/python/api2_2x/Image.h b/source/blender/python/api2_2x/Image.h index 2c725c9bc81..729efa7cff1 100644 --- a/source/blender/python/api2_2x/Image.h +++ b/source/blender/python/api2_2x/Image.h @@ -33,136 +33,27 @@ #define EXPP_IMAGE_H #include <Python.h> -#include <stdio.h> - -#include <BKE_main.h> -#include <BKE_global.h> -#include <BKE_library.h> -#include <BKE_image.h> -#include <BLI_blenlib.h> #include <DNA_image_types.h> -#include "gen_utils.h" -#include "modules.h" - -/*****************************************************************************/ -/* Python C_Image defaults: */ -/*****************************************************************************/ -#define EXPP_IMAGE_REP 1 -#define EXPP_IMAGE_REP_MIN 1 -#define EXPP_IMAGE_REP_MAX 16 - -/*****************************************************************************/ -/* Python API function prototypes for the Image module. */ -/*****************************************************************************/ -static PyObject *M_Image_New (PyObject *self, PyObject *args, - PyObject *keywords); -static PyObject *M_Image_Get (PyObject *self, PyObject *args); -static PyObject *M_Image_Load (PyObject *self, PyObject *args); - -/*****************************************************************************/ -/* The following string definitions are used for documentation strings. */ -/* In Python these will be written to the console when doing a */ -/* Blender.Image.__doc__ */ -/*****************************************************************************/ -char M_Image_doc[] = -"The Blender Image module\n\n"; - -char M_Image_New_doc[] = -"() - return a new Image object -- unimplemented"; - -char M_Image_Get_doc[] = -"(name) - return the image with the name 'name', \ -returns None if not found.\n If 'name' is not specified, \ -it returns a list of all images in the\ncurrent scene."; - -char M_Image_Load_doc[] = -"(filename) - return image from file filename as Image Object, \ -returns None if not found.\n"; - -/*****************************************************************************/ -/* Python method structure definition for Blender.Image module: */ -/*****************************************************************************/ -struct PyMethodDef M_Image_methods[] = { - {"New",(PyCFunction)M_Image_New, METH_VARARGS|METH_KEYWORDS, - M_Image_New_doc}, - {"Get", M_Image_Get, METH_VARARGS, M_Image_Get_doc}, - {"get", M_Image_Get, METH_VARARGS, M_Image_Get_doc}, - {"Load", M_Image_Load, METH_VARARGS, M_Image_Load_doc}, - {NULL, NULL, 0, NULL} -}; /*****************************************************************************/ -/* Python C_Image structure definition: */ +/* Python C_Image structure definition */ /*****************************************************************************/ typedef struct { PyObject_HEAD Image *image; -} C_Image; -/*****************************************************************************/ -/* Python C_Image methods declarations: */ -/*****************************************************************************/ -static PyObject *Image_getName(C_Image *self); -static PyObject *Image_getFilename(C_Image *self); -static PyObject *Image_setName(C_Image *self, PyObject *args); -static PyObject *Image_setXRep(C_Image *self, PyObject *args); -static PyObject *Image_setYRep(C_Image *self, PyObject *args); +} C_Image; -/*****************************************************************************/ -/* Python C_Image methods table: */ -/*****************************************************************************/ -static PyMethodDef C_Image_methods[] = { - /* name, method, flags, doc */ - {"getName", (PyCFunction)Image_getName, METH_NOARGS, - "() - Return Image Data name"}, - {"getFilename", (PyCFunction)Image_getFilename, METH_VARARGS, - "() - Return Image Data filename"}, - {"setName", (PyCFunction)Image_setName, METH_VARARGS, - "(str) - Change Image Data name"}, - {"setXRep", (PyCFunction)Image_setXRep, METH_VARARGS, - "(int) - Change Image Data x repetition value"}, - {"setYRep", (PyCFunction)Image_setYRep, METH_VARARGS, - "(int) - Change Image Data y repetition value"}, - {0} -}; +PyTypeObject Image_Type; /* The Image PyType Object */ -/*****************************************************************************/ -/* Python Image_Type callback function prototypes: */ -/*****************************************************************************/ -static void ImageDeAlloc (C_Image *self); -static int ImagePrint (C_Image *self, FILE *fp, int flags); -static int ImageSetAttr (C_Image *self, char *name, PyObject *v); -static PyObject *ImageGetAttr (C_Image *self, char *name); -static int ImageCompare (C_Image *a, C_Image *b); -static PyObject *ImageRepr (C_Image *self); +#define C_Image_Check(v) ((v)->ob_type == &Image_Type) /* for type checking */ /*****************************************************************************/ -/* Python Image_Type structure definition: */ +/* Module Blender.Image - public functions */ /*****************************************************************************/ -PyTypeObject Image_Type = -{ - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ - "Image", /* tp_name */ - sizeof (C_Image), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)ImageDeAlloc, /* tp_dealloc */ - (printfunc)ImagePrint, /* tp_print */ - (getattrfunc)ImageGetAttr, /* tp_getattr */ - (setattrfunc)ImageSetAttr, /* tp_setattr */ - (cmpfunc)ImageCompare, /* tp_compare */ - (reprfunc)ImageRepr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_as_hash */ - 0,0,0,0,0,0, - 0, /* tp_doc */ - 0,0,0,0,0,0, - C_Image_methods, /* tp_methods */ - 0, /* tp_members */ -}; +PyObject *M_Image_Init (void); +PyObject *Image_CreatePyObject (Image *image); +int Image_CheckPyObject (PyObject *pyobj); #endif /* EXPP_IMAGE_H */ |