Blender V4.5
py_capi_rna.cc File Reference
#include <Python.h>
#include "py_capi_rna.hh"
#include "BLI_bitmap.h"
#include "BLI_dynstr.h"
#include "RNA_access.hh"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Macros

#define PY_SSIZE_T_CLEAN

Functions

Enum Utilities
char * pyrna_enum_repr (const EnumPropertyItem *item)
Enum Conversion Utilities
int pyrna_enum_value_from_id (const EnumPropertyItem *item, const char *identifier, int *r_value, const char *error_prefix)
BLI_bitmappyrna_enum_bitmap_from_set (const EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix)
int pyrna_enum_bitfield_from_set (const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix)
PyObject * pyrna_enum_bitfield_as_set (const EnumPropertyItem *items, int value)
Argument Parsing Helpers
int pyrna_enum_value_parse_string (PyObject *o, void *p)
int pyrna_enum_bitfield_parse_set (PyObject *o, void *p)

Detailed Description

Python/RNA utilities.

RNA functions that aren't part of the bpy_rna.cc API.

Definition in file py_capi_rna.cc.

Macro Definition Documentation

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 14 of file py_capi_rna.cc.

Function Documentation

◆ pyrna_enum_bitfield_as_set()

PyObject * pyrna_enum_bitfield_as_set ( const EnumPropertyItem * items,
int value )

◆ pyrna_enum_bitfield_from_set()

int pyrna_enum_bitfield_from_set ( const EnumPropertyItem * items,
PyObject * value,
int * r_value,
const char * error_prefix )

◆ pyrna_enum_bitfield_parse_set()

◆ pyrna_enum_bitmap_from_set()

BLI_bitmap * pyrna_enum_bitmap_from_set ( const EnumPropertyItem * items,
PyObject * value,
int type_size,
bool type_convert_sign,
int bitmap_size,
const char * error_prefix )

Takes a set of strings and map it to and array of booleans.

Useful when the values aren't flags.

Parameters
type_convert_signMaps signed to unsigned range, needed when we want to use the full range of a signed short/char.

Definition at line 71 of file py_capi_rna.cc.

References BLI_assert, BLI_assert_unreachable, BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, MEM_freeN(), pyrna_enum_bitmap_from_set(), pyrna_enum_value_from_id(), and ret.

Referenced by bpy_file_path_map(), bpy_user_map(), and pyrna_enum_bitmap_from_set().

◆ pyrna_enum_repr()

char * pyrna_enum_repr ( const EnumPropertyItem * item)

Convert all items into a single comma separated string. Use for creating useful error messages.

Definition at line 31 of file py_capi_rna.cc.

References BLI_dynstr_appendf(), BLI_dynstr_free(), BLI_dynstr_get_cstring(), BLI_dynstr_new(), EnumPropertyItem::identifier, and pyrna_enum_repr().

Referenced by pyop_call(), pyop_poll(), pyrna_enum_as_string(), pyrna_enum_repr(), and pyrna_enum_value_from_id().

◆ pyrna_enum_value_from_id()

int pyrna_enum_value_from_id ( const EnumPropertyItem * item,
const char * identifier,
int * r_value,
const char * error_prefix )

◆ pyrna_enum_value_parse_string()