Blender V2.61 - r43446
Defines | Functions | Variables

idprop_py_api.c File Reference

#include <Python.h>
#include "idprop_py_api.h"
#include "MEM_guardedalloc.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_idprop.h"
#include "py_capi_utils.h"

Go to the source code of this file.

Defines

#define USE_STRING_COERCE

Functions

static PyObject * idprop_py_from_idp_string (IDProperty *prop)
static PyObject * idprop_py_from_idp_int (IDProperty *prop)
static PyObject * idprop_py_from_idp_float (IDProperty *prop)
static PyObject * idprop_py_from_idp_double (IDProperty *prop)
static PyObject * idprop_py_from_idp_group (ID *id, IDProperty *prop, IDProperty *parent)
static PyObject * idprop_py_from_idp_array (ID *id, IDProperty *prop)
static PyObject * idprop_py_from_idp_idparray (ID *id, IDProperty *prop)
static long BPy_IDGroup_hash (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_repr (BPy_IDProperty *self)
PyObject * BPy_IDGroup_WrapData (ID *id, IDProperty *prop, IDProperty *parent)
static PyObject * BPy_IDGroup_GetName (BPy_IDProperty *self, void *UNUSED(closure))
static int BPy_IDGroup_SetName (BPy_IDProperty *self, PyObject *value, void *UNUSED(closure))
static Py_ssize_t BPy_IDGroup_Map_Len (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_Map_GetItem (BPy_IDProperty *self, PyObject *item)
static int idp_sequence_type (PyObject *seq)
const char * BPy_IDProperty_Map_ValidateAndCreate (PyObject *name_obj, IDProperty *group, PyObject *ob)
int BPy_Wrap_SetMapItem (IDProperty *prop, PyObject *key, PyObject *val)
static int BPy_IDGroup_Map_SetItem (BPy_IDProperty *self, PyObject *key, PyObject *val)
static PyObject * BPy_IDGroup_iter (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_MapDataToPy (IDProperty *prop)
static PyObject * BPy_IDGroup_Pop (BPy_IDProperty *self, PyObject *value)
static PyObject * BPy_IDGroup_IterItems (BPy_IDProperty *self)
static void BPy_IDGroup_CorrectListLen (IDProperty *prop, PyObject *seq, int len, const char *func)
PyObject * BPy_Wrap_GetKeys (IDProperty *prop)
PyObject * BPy_Wrap_GetValues (ID *id, IDProperty *prop)
PyObject * BPy_Wrap_GetItems (ID *id, IDProperty *prop)
static PyObject * BPy_IDGroup_GetKeys (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_GetValues (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_GetItems (BPy_IDProperty *self)
static int BPy_IDGroup_Contains (BPy_IDProperty *self, PyObject *value)
static PyObject * BPy_IDGroup_Update (BPy_IDProperty *self, PyObject *value)
static PyObject * BPy_IDGroup_to_dict (BPy_IDProperty *self)
static PyObject * BPy_IDGroup_Get (BPy_IDProperty *self, PyObject *args)
static PyTypeObject * idp_array_py_type (BPy_IDArray *self, short *is_double)
static PyObject * BPy_IDArray_repr (BPy_IDArray *self)
static PyObject * BPy_IDArray_GetType (BPy_IDArray *self)
static PyObject * BPy_IDArray_to_list (BPy_IDArray *self)
static int BPy_IDArray_Len (BPy_IDArray *self)
static PyObject * BPy_IDArray_GetItem (BPy_IDArray *self, int index)
static int BPy_IDArray_SetItem (BPy_IDArray *self, int index, PyObject *value)
static PyObject * BPy_IDArray_slice (BPy_IDArray *self, int begin, int end)
static int BPy_IDArray_ass_slice (BPy_IDArray *self, int begin, int end, PyObject *seq)
static PyObject * BPy_IDArray_subscript (BPy_IDArray *self, PyObject *item)
static int BPy_IDArray_ass_subscript (BPy_IDArray *self, PyObject *item, PyObject *value)
static PyObject * IDGroup_Iter_iterself (PyObject *self)
static PyObject * IDGroup_Iter_repr (BPy_IDGroup_Iter *self)
static PyObject * BPy_Group_Iter_Next (BPy_IDGroup_Iter *self)
void IDProp_Init_Types (void)

Variables

PyTypeObject BPy_IDArray_Type
PyTypeObject BPy_IDGroup_Iter_Type
PyTypeObject BPy_IDGroup_Type
static PyGetSetDef BPy_IDGroup_getseters []
static struct PyMethodDef BPy_IDGroup_methods []
static PySequenceMethods BPy_IDGroup_Seq
static PyMappingMethods BPy_IDGroup_Mapping
static PyGetSetDef BPy_IDArray_getseters []
static PyMethodDef BPy_IDArray_methods []
static PySequenceMethods BPy_IDArray_Seq
static PyMappingMethods BPy_IDArray_AsMapping

Detailed Description

Definition in file idprop_py_api.c.


Define Documentation

#define USE_STRING_COERCE

Definition at line 40 of file idprop_py_api.c.


Function Documentation

static PyObject* BPy_Group_Iter_Next ( BPy_IDGroup_Iter self) [static]
static int BPy_IDArray_ass_slice ( BPy_IDArray self,
int  begin,
int  end,
PyObject *  seq 
) [static]
static int BPy_IDArray_ass_subscript ( BPy_IDArray self,
PyObject *  item,
PyObject *  value 
) [static]

Definition at line 1206 of file idprop_py_api.c.

References BPy_IDArray_ass_slice(), BPy_IDArray_SetItem(), i, and step().

static PyObject* BPy_IDArray_GetItem ( BPy_IDArray self,
int  index 
) [static]

Definition at line 1017 of file idprop_py_api.c.

References IDP_Array, IDP_DOUBLE, IDP_FLOAT, IDP_INT, and NULL.

Referenced by BPy_IDArray_subscript().

static PyObject* BPy_IDArray_GetType ( BPy_IDArray self) [static]

Definition at line 977 of file idprop_py_api.c.

References IDP_DOUBLE, IDP_FLOAT, IDP_INT, and NULL.

static int BPy_IDArray_Len ( BPy_IDArray self) [static]

Definition at line 1012 of file idprop_py_api.c.

static PyObject* BPy_IDArray_repr ( BPy_IDArray self) [static]

Definition at line 972 of file idprop_py_api.c.

static int BPy_IDArray_SetItem ( BPy_IDArray self,
int  index,
PyObject *  value 
) [static]

Definition at line 1040 of file idprop_py_api.c.

References simple_enum_gen::d, i, IDP_Array, IDP_DOUBLE, IDP_FLOAT, and IDP_INT.

Referenced by BPy_IDArray_ass_subscript().

static PyObject* BPy_IDArray_slice ( BPy_IDArray self,
int  begin,
int  end 
) [static]
static PyObject* BPy_IDArray_subscript ( BPy_IDArray self,
PyObject *  item 
) [static]

Definition at line 1170 of file idprop_py_api.c.

References BPy_IDArray_GetItem(), BPy_IDArray_slice(), i, NULL, and step().

static PyObject* BPy_IDArray_to_list ( BPy_IDArray self) [static]

Definition at line 1001 of file idprop_py_api.c.

References BPy_IDGroup_MapDataToPy().

static int BPy_IDGroup_Contains ( BPy_IDProperty self,
PyObject *  value 
) [static]

Definition at line 791 of file idprop_py_api.c.

References IDP_GetPropertyFromGroup().

static void BPy_IDGroup_CorrectListLen ( IDProperty prop,
PyObject *  seq,
int  len,
const char *  func 
) [static]

Definition at line 694 of file idprop_py_api.c.

References len(), and IDProperty::len.

Referenced by BPy_Wrap_GetItems(), BPy_Wrap_GetKeys(), and BPy_Wrap_GetValues().

static PyObject* BPy_IDGroup_Get ( BPy_IDProperty self,
PyObject *  args 
) [static]

Definition at line 832 of file idprop_py_api.c.

References BPy_IDGroup_WrapData(), IDP_GetPropertyFromGroup(), and NULL.

static PyObject* BPy_IDGroup_GetItems ( BPy_IDProperty self) [static]

Definition at line 786 of file idprop_py_api.c.

References BPy_Wrap_GetItems().

static PyObject* BPy_IDGroup_GetKeys ( BPy_IDProperty self) [static]

Definition at line 776 of file idprop_py_api.c.

References BPy_Wrap_GetKeys().

static PyObject* BPy_IDGroup_GetName ( BPy_IDProperty self,
void *  UNUSEDclosure 
) [static]

Definition at line 234 of file idprop_py_api.c.

static PyObject* BPy_IDGroup_GetValues ( BPy_IDProperty self) [static]

Definition at line 781 of file idprop_py_api.c.

References BPy_Wrap_GetValues().

static long BPy_IDGroup_hash ( BPy_IDProperty self) [static]

Definition at line 130 of file idprop_py_api.c.

static PyObject* BPy_IDGroup_iter ( BPy_IDProperty self) [static]
static PyObject* BPy_IDGroup_IterItems ( BPy_IDProperty self) [static]
static PyObject* BPy_IDGroup_Map_GetItem ( BPy_IDProperty self,
PyObject *  item 
) [static]

Definition at line 282 of file idprop_py_api.c.

References BPy_IDGroup_WrapData(), IDP_GetPropertyFromGroup(), IDP_GROUP, and NULL.

static Py_ssize_t BPy_IDGroup_Map_Len ( BPy_IDProperty self) [static]

Definition at line 272 of file idprop_py_api.c.

References IDP_GROUP.

static int BPy_IDGroup_Map_SetItem ( BPy_IDProperty self,
PyObject *  key,
PyObject *  val 
) [static]

Definition at line 529 of file idprop_py_api.c.

References BPy_Wrap_SetMapItem().

Referenced by BPy_IDGroup_Update().

static PyObject* BPy_IDGroup_MapDataToPy ( IDProperty prop) [static]
static PyObject* BPy_IDGroup_Pop ( BPy_IDProperty self,
PyObject *  value 
) [static]
static PyObject* BPy_IDGroup_repr ( BPy_IDProperty self) [static]

Definition at line 135 of file idprop_py_api.c.

static int BPy_IDGroup_SetName ( BPy_IDProperty self,
PyObject *  value,
void *  UNUSEDclosure 
) [static]

Definition at line 239 of file idprop_py_api.c.

References MAX_IDPROP_NAME.

static PyObject* BPy_IDGroup_to_dict ( BPy_IDProperty self) [static]

Definition at line 825 of file idprop_py_api.c.

References BPy_IDGroup_MapDataToPy().

static PyObject* BPy_IDGroup_Update ( BPy_IDProperty self,
PyObject *  value 
) [static]

Definition at line 805 of file idprop_py_api.c.

References BPy_IDGroup_Map_SetItem(), i, and NULL.

PyObject* BPy_IDGroup_WrapData ( ID id,
IDProperty prop,
IDProperty parent 
)
const char* BPy_IDProperty_Map_ValidateAndCreate ( PyObject *  name_obj,
IDProperty group,
PyObject *  ob 
)
PyObject* BPy_Wrap_GetItems ( ID id,
IDProperty prop 
)
PyObject* BPy_Wrap_GetKeys ( IDProperty prop)
PyObject* BPy_Wrap_GetValues ( ID id,
IDProperty prop 
)
int BPy_Wrap_SetMapItem ( IDProperty prop,
PyObject *  key,
PyObject *  val 
)
static PyObject* IDGroup_Iter_iterself ( PyObject *  self) [static]

Definition at line 1327 of file idprop_py_api.c.

static PyObject* IDGroup_Iter_repr ( BPy_IDGroup_Iter self) [static]

Definition at line 1333 of file idprop_py_api.c.

static PyTypeObject* idp_array_py_type ( BPy_IDArray self,
short *  is_double 
) [static]

Definition at line 954 of file idprop_py_api.c.

References IDP_DOUBLE, IDP_FLOAT, IDP_INT, and NULL.

Referenced by BPy_IDArray_ass_slice().

static int idp_sequence_type ( PyObject *  seq) [static]

Definition at line 310 of file idprop_py_api.c.

References i, IDP_DOUBLE, IDP_IDPARRAY, IDP_INT, and len().

Referenced by BPy_IDProperty_Map_ValidateAndCreate().

void IDProp_Init_Types ( void  )

Definition at line 1419 of file idprop_py_api.c.

Referenced by BPy_init_modules().

static PyObject* idprop_py_from_idp_array ( ID id,
IDProperty prop 
) [static]

Definition at line 94 of file idprop_py_api.c.

References BPy_IDArray_Type, BPy_IDProperty::id, and BPy_IDProperty::prop.

Referenced by BPy_IDGroup_WrapData().

static PyObject* idprop_py_from_idp_double ( IDProperty prop) [static]

Definition at line 80 of file idprop_py_api.c.

References IDProperty::data, and IDPropertyData::val.

Referenced by BPy_IDGroup_MapDataToPy(), and BPy_IDGroup_WrapData().

static PyObject* idprop_py_from_idp_float ( IDProperty prop) [static]

Definition at line 75 of file idprop_py_api.c.

References IDProperty::data, and IDPropertyData::val.

Referenced by BPy_IDGroup_MapDataToPy(), and BPy_IDGroup_WrapData().

static PyObject* idprop_py_from_idp_group ( ID id,
IDProperty prop,
IDProperty parent 
) [static]
static PyObject* idprop_py_from_idp_idparray ( ID id,
IDProperty prop 
) [static]

Definition at line 102 of file idprop_py_api.c.

References BPy_IDGroup_WrapData(), i, IDP_IDPArray, IDProperty::len, and NULL.

Referenced by BPy_IDGroup_WrapData().

static PyObject* idprop_py_from_idp_int ( IDProperty prop) [static]

Definition at line 70 of file idprop_py_api.c.

References IDProperty::data, and IDPropertyData::val.

Referenced by BPy_IDGroup_MapDataToPy(), and BPy_IDGroup_WrapData().

static PyObject* idprop_py_from_idp_string ( IDProperty prop) [static]

Variable Documentation

PyMappingMethods BPy_IDArray_AsMapping [static]
Initial value:
 {
    (lenfunc)BPy_IDArray_Len,
    (binaryfunc)BPy_IDArray_subscript,
    (objobjargproc)BPy_IDArray_ass_subscript
}

Definition at line 1237 of file idprop_py_api.c.

PyGetSetDef BPy_IDArray_getseters[] [static]
Initial value:
 {
    
    {(char *)"typecode", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an int.", NULL},
    {NULL, NULL, NULL, NULL, NULL},
}

Definition at line 995 of file idprop_py_api.c.

PyMethodDef BPy_IDArray_methods[] [static]
Initial value:
 {
    {"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS,
        "return the array as a list"},
    {NULL, NULL, 0, NULL}
}

Definition at line 1006 of file idprop_py_api.c.

PySequenceMethods BPy_IDArray_Seq [static]
Initial value:
 {
    (lenfunc) BPy_IDArray_Len,          
    NULL,                               
    NULL,                               
    (ssizeargfunc)BPy_IDArray_GetItem,  
    NULL,                               
    (ssizeobjargproc)BPy_IDArray_SetItem,
    NULL,                               
    NULL,                               
                
    NULL,                               
    NULL,                               
}

Definition at line 1081 of file idprop_py_api.c.

PyTypeObject BPy_IDArray_Type

Definition at line 1244 of file idprop_py_api.c.

Referenced by idprop_py_from_idp_array().

PyGetSetDef BPy_IDGroup_getseters[] [static]
Initial value:
 {
    {(char *)"name", (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName, (char *)"The name of this Group.", NULL},
     {NULL, NULL, NULL, NULL, NULL}
}

Definition at line 267 of file idprop_py_api.c.

PyTypeObject BPy_IDGroup_Iter_Type

Definition at line 1362 of file idprop_py_api.c.

Referenced by BPy_IDGroup_iter(), and BPy_IDGroup_IterItems().

PyMappingMethods BPy_IDGroup_Mapping [static]
Initial value:
 {
    (lenfunc)BPy_IDGroup_Map_Len,       
    (binaryfunc)BPy_IDGroup_Map_GetItem,
    (objobjargproc)BPy_IDGroup_Map_SetItem, 
}

Definition at line 885 of file idprop_py_api.c.

struct PyMethodDef BPy_IDGroup_methods[] [static]
Initial value:
 {
    {"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O,
        "pop an item from the group; raises KeyError if the item doesn't exist"},
    {"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS,
        "iterate through the items in the dict; behaves like dictionary method iteritems"},
    {"keys", (PyCFunction)BPy_IDGroup_GetKeys, METH_NOARGS,
        "get the keys associated with this group as a list of strings"},
    {"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS,
        "get the values associated with this group"},
    {"items", (PyCFunction)BPy_IDGroup_GetItems, METH_NOARGS,
        "get the items associated with this group"},
    {"update", (PyCFunction)BPy_IDGroup_Update, METH_O,
        "updates the values in the group with the values of another or a dict"},
    {"get", (PyCFunction)BPy_IDGroup_Get, METH_VARARGS,
        "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
    {"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
        "return a purely python version of the group"},
    {NULL, NULL, 0, NULL}
}

Definition at line 852 of file idprop_py_api.c.

PySequenceMethods BPy_IDGroup_Seq [static]
Initial value:
 {
    (lenfunc) BPy_IDGroup_Map_Len,      
    NULL,                               
    NULL,                               
    NULL,                                
    NULL,                               
    NULL,                               
    NULL,                               
    (objobjproc) BPy_IDGroup_Contains,  
    NULL,                               
    NULL,                               
}

Definition at line 872 of file idprop_py_api.c.

PyTypeObject BPy_IDGroup_Type

Definition at line 891 of file idprop_py_api.c.

Referenced by idprop_py_from_idp_group().