Blender  V3.3
Classes | Macros | Typedefs | Functions
bpy_rna_array.c File Reference
#include <Python.h>
#include "CLG_log.h"
#include "BLI_utildefines.h"
#include "RNA_types.h"
#include "bpy_rna.h"
#include "MEM_guardedalloc.h"
#include "RNA_access.h"
#include "BPY_extern_clog.h"
#include "../generic/py_capi_utils.h"
#include "../mathutils/mathutils.h"

Go to the source code of this file.

Classes

struct  ItemConvertArgData
 
struct  ItemConvert_FuncArg
 

Macros

#define USE_MATHUTILS
 
#define MAX_ARRAY_DIMENSION   10
 

Typedefs

typedef void(* ItemConvertFunc) (const struct ItemConvertArgData *arg, PyObject *, char *)
 
typedef int(* ItemTypeCheckFunc) (PyObject *)
 
typedef void(* RNA_SetArrayFunc) (PointerRNA *, PropertyRNA *, const char *)
 
typedef void(* RNA_SetIndexFunc) (PointerRNA *, PropertyRNA *, int index, void *)
 
typedef struct ItemConvert_FuncArg ItemConvert_FuncArg
 

Functions

static int validate_array_type (PyObject *seq, int dim, int totdim, int dimsize[], const bool is_dynamic, ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
 
static int count_items (PyObject *seq, int dim)
 
static int validate_array_length (PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int *r_totitem, const char *error_prefix)
 
static int validate_array (PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, ItemTypeCheckFunc check_item_type, const char *item_type_str, int *r_totitem, const char *error_prefix)
 
static char * copy_value_single (PyObject *item, PointerRNA *ptr, PropertyRNA *prop, char *data, uint item_size, int *index, const ItemConvert_FuncArg *convert_item, RNA_SetIndexFunc rna_set_index)
 
static char * copy_values (PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int dim, char *data, uint item_size, int *index, const ItemConvert_FuncArg *convert_item, RNA_SetIndexFunc rna_set_index)
 
static int py_to_array (PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, const ItemConvert_FuncArg *convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix)
 
static int py_to_array_index (PyObject *py, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int arrayoffset, int index, ItemTypeCheckFunc check_item_type, const char *item_type_str, const ItemConvert_FuncArg *convert_item, RNA_SetIndexFunc rna_set_index, const char *error_prefix)
 
static void py_to_float (const struct ItemConvertArgData *arg, PyObject *py, char *data)
 
static void py_to_int (const struct ItemConvertArgData *arg, PyObject *py, char *data)
 
static void py_to_bool (const struct ItemConvertArgData *UNUSED(arg), PyObject *py, char *data)
 
static int py_float_check (PyObject *py)
 
static int py_int_check (PyObject *py)
 
static int py_bool_check (PyObject *py)
 
static void float_set_index (PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
 
static void int_set_index (PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
 
static void bool_set_index (PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
 
static void convert_item_init_float (PointerRNA *ptr, PropertyRNA *prop, ItemConvert_FuncArg *convert_item)
 
static void convert_item_init_int (PointerRNA *ptr, PropertyRNA *prop, ItemConvert_FuncArg *convert_item)
 
static void convert_item_init_bool (PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), ItemConvert_FuncArg *convert_item)
 
int pyrna_py_to_array (PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix)
 
int pyrna_py_to_array_index (PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix)
 
PyObject * pyrna_array_index (PointerRNA *ptr, PropertyRNA *prop, int index)
 
PyObject * pyrna_py_from_array_index (BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
 
PyObject * pyrna_py_from_array (PointerRNA *ptr, PropertyRNA *prop)
 
int pyrna_array_contains_py (PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
 

Detailed Description

This file deals with array access for 'BPy_PropertyArrayRNA' from bpy_rna.c

Definition in file bpy_rna_array.c.

Macro Definition Documentation

◆ MAX_ARRAY_DIMENSION

#define MAX_ARRAY_DIMENSION   10

Definition at line 33 of file bpy_rna_array.c.

◆ USE_MATHUTILS

#define USE_MATHUTILS

Definition at line 27 of file bpy_rna_array.c.

Typedef Documentation

◆ ItemConvert_FuncArg

Callback and args needed to apply the value (clamp range for now)

◆ ItemConvertFunc

typedef void(* ItemConvertFunc) (const struct ItemConvertArgData *arg, PyObject *, char *)

Definition at line 37 of file bpy_rna_array.c.

◆ ItemTypeCheckFunc

typedef int(* ItemTypeCheckFunc) (PyObject *)

Definition at line 38 of file bpy_rna_array.c.

◆ RNA_SetArrayFunc

typedef void(* RNA_SetArrayFunc) (PointerRNA *, PropertyRNA *, const char *)

Definition at line 39 of file bpy_rna_array.c.

◆ RNA_SetIndexFunc

typedef void(* RNA_SetIndexFunc) (PointerRNA *, PropertyRNA *, int index, void *)

Definition at line 40 of file bpy_rna_array.c.

Function Documentation

◆ bool_set_index()

static void bool_set_index ( PointerRNA ptr,
PropertyRNA prop,
int  index,
void value 
)
static

Definition at line 690 of file bpy_rna_array.c.

References ptr, and RNA_property_boolean_set_index().

Referenced by pyrna_py_to_array_index().

◆ convert_item_init_bool()

static void convert_item_init_bool ( PointerRNA UNUSEDptr,
PropertyRNA UNUSEDprop,
ItemConvert_FuncArg convert_item 
)
static

Definition at line 713 of file bpy_rna_array.c.

References ItemConvert_FuncArg::func, and py_to_bool().

Referenced by pyrna_py_to_array(), and pyrna_py_to_array_index().

◆ convert_item_init_float()

static void convert_item_init_float ( PointerRNA ptr,
PropertyRNA prop,
ItemConvert_FuncArg convert_item 
)
static

◆ convert_item_init_int()

static void convert_item_init_int ( PointerRNA ptr,
PropertyRNA prop,
ItemConvert_FuncArg convert_item 
)
static

◆ copy_value_single()

static char* copy_value_single ( PyObject *  item,
PointerRNA ptr,
PropertyRNA prop,
char *  data,
uint  item_size,
int *  index,
const ItemConvert_FuncArg convert_item,
RNA_SetIndexFunc  rna_set_index 
)
static

Definition at line 417 of file bpy_rna_array.c.

References ItemConvert_FuncArg::arg, data, ItemConvert_FuncArg::func, and ptr.

Referenced by copy_values(), and py_to_array_index().

◆ copy_values()

static char* copy_values ( PyObject *  seq,
PointerRNA ptr,
PropertyRNA prop,
int  dim,
char *  data,
uint  item_size,
int *  index,
const ItemConvert_FuncArg convert_item,
RNA_SetIndexFunc  rna_set_index 
)
static

◆ count_items()

static int count_items ( PyObject *  seq,
int  dim 
)
static

Definition at line 213 of file bpy_rna_array.c.

Referenced by validate_array_length().

◆ float_set_index()

static void float_set_index ( PointerRNA ptr,
PropertyRNA prop,
int  index,
void value 
)
static

Definition at line 680 of file bpy_rna_array.c.

References ptr, and RNA_property_float_set_index().

Referenced by pyrna_py_to_array_index().

◆ int_set_index()

static void int_set_index ( PointerRNA ptr,
PropertyRNA prop,
int  index,
void value 
)
static

Definition at line 685 of file bpy_rna_array.c.

References ptr, and RNA_property_int_set_index().

Referenced by pyrna_py_to_array_index().

◆ py_bool_check()

static int py_bool_check ( PyObject *  py)
static

Definition at line 675 of file bpy_rna_array.c.

Referenced by pyrna_py_to_array(), and pyrna_py_to_array_index().

◆ py_float_check()

static int py_float_check ( PyObject *  py)
static

Definition at line 663 of file bpy_rna_array.c.

Referenced by pyrna_py_to_array(), and pyrna_py_to_array_index().

◆ py_int_check()

static int py_int_check ( PyObject *  py)
static

Definition at line 669 of file bpy_rna_array.c.

Referenced by pyrna_py_to_array(), and pyrna_py_to_array_index().

◆ py_to_array()

static int py_to_array ( PyObject *  seq,
PointerRNA ptr,
PropertyRNA prop,
char *  param_data,
ItemTypeCheckFunc  check_item_type,
const char *  item_type_str,
int  item_size,
const ItemConvert_FuncArg convert_item,
RNA_SetArrayFunc  rna_set_array,
const char *  error_prefix 
)
static

◆ py_to_array_index()

static int py_to_array_index ( PyObject *  py,
PointerRNA ptr,
PropertyRNA prop,
int  lvalue_dim,
int  arrayoffset,
int  index,
ItemTypeCheckFunc  check_item_type,
const char *  item_type_str,
const ItemConvert_FuncArg convert_item,
RNA_SetIndexFunc  rna_set_index,
const char *  error_prefix 
)
static

◆ py_to_bool()

static void py_to_bool ( const struct ItemConvertArgData UNUSEDarg,
PyObject *  py,
char *  data 
)
static

Definition at line 658 of file bpy_rna_array.c.

References data.

Referenced by convert_item_init_bool().

◆ py_to_float()

static void py_to_float ( const struct ItemConvertArgData arg,
PyObject *  py,
char *  data 
)
static

Definition at line 642 of file bpy_rna_array.c.

References CLAMP, data, float(), and ItemConvertArgData::float_data.

Referenced by convert_item_init_float().

◆ py_to_int()

static void py_to_int ( const struct ItemConvertArgData arg,
PyObject *  py,
char *  data 
)
static

Definition at line 650 of file bpy_rna_array.c.

References CLAMP, data, and ItemConvertArgData::int_data.

Referenced by convert_item_init_int().

◆ pyrna_array_contains_py()

int pyrna_array_contains_py ( PointerRNA ptr,
PropertyRNA prop,
PyObject *  value 
)

◆ pyrna_array_index()

PyObject* pyrna_array_index ( PointerRNA ptr,
PropertyRNA prop,
int  index 
)

◆ pyrna_py_from_array()

PyObject* pyrna_py_from_array ( PointerRNA ptr,
PropertyRNA prop 
)

Definition at line 965 of file bpy_rna_array.c.

References ptr, pyrna_math_object_from_array(), pyrna_prop_CreatePyObject(), and ret.

Referenced by pyrna_prop_to_py().

◆ pyrna_py_from_array_index()

PyObject* pyrna_py_from_array_index ( BPy_PropertyArrayRNA self,
PointerRNA ptr,
PropertyRNA prop,
int  index 
)

◆ pyrna_py_to_array()

int pyrna_py_to_array ( PointerRNA ptr,
PropertyRNA prop,
char *  param_data,
PyObject *  py,
const char *  error_prefix 
)

◆ pyrna_py_to_array_index()

int pyrna_py_to_array_index ( PointerRNA ptr,
PropertyRNA prop,
int  arraydim,
int  arrayoffset,
int  index,
PyObject *  py,
const char *  error_prefix 
)

◆ validate_array()

static int validate_array ( PyObject *  rvalue,
PointerRNA ptr,
PropertyRNA prop,
int  lvalue_dim,
ItemTypeCheckFunc  check_item_type,
const char *  item_type_str,
int *  r_totitem,
const char *  error_prefix 
)
static

◆ validate_array_length()

static int validate_array_length ( PyObject *  rvalue,
PointerRNA ptr,
PropertyRNA prop,
int  lvalue_dim,
int *  r_totitem,
const char *  error_prefix 
)
static

◆ validate_array_type()

static int validate_array_type ( PyObject *  seq,
int  dim,
int  totdim,
int  dimsize[],
const bool  is_dynamic,
ItemTypeCheckFunc  check_item_type,
const char *  item_type_str,
const char *  error_prefix 
)
static

Definition at line 77 of file bpy_rna_array.c.

References BLI_snprintf(), and NULL.

Referenced by validate_array().