Blender  V3.3
Functions
bpy_capi_utils.c File Reference
#include <Python.h>
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "bpy_capi_utils.h"
#include "MEM_guardedalloc.h"
#include "BKE_context.h"
#include "BKE_report.h"
#include "BLT_translation.h"
#include "../generic/py_capi_utils.h"

Go to the source code of this file.

Functions

short BPy_reports_to_error (ReportList *reports, PyObject *exception, const bool clear)
 
void BPy_reports_write_stdout (const ReportList *reports, const char *header)
 
bool BPy_errors_to_report_ex (ReportList *reports, const char *err_prefix, const bool use_full, const bool use_location)
 
bool BPy_errors_to_report (ReportList *reports)
 

Detailed Description

This file contains Blender/Python utility functions to help implementing API's. This is not related to a particular module.

Definition in file bpy_capi_utils.c.

Function Documentation

◆ BPy_errors_to_report()

bool BPy_errors_to_report ( struct ReportList reports)
Parameters
reportsWhen set, an error will be added to this report, when NULL, print the error.
Note
Unless the caller handles printing the reports (or reports is NULL) it's best to ensure the output is printed to the stdout/stderr:
if (!BKE_reports_print_test(reports)) {
}
bool BKE_reports_print_test(const ReportList *reports, eReportType type)
Definition: report.c:259
void BKE_reports_print(ReportList *reports, eReportType level)
Definition: report.c:267
bool BPy_errors_to_report(ReportList *reports)
The caller is responsible for clearing the error (see #PyErr_Clear).

Definition at line 113 of file bpy_capi_utils.c.

References BPy_errors_to_report_ex(), and NULL.

Referenced by bpy_class_call(), bpy_run_string_impl(), Freestyle::PythonInterpreter::interpretString(), and python_script_exec().

◆ BPy_errors_to_report_ex()

bool BPy_errors_to_report_ex ( ReportList reports,
const char *  err_prefix,
const bool  use_full,
const bool  use_location 
)

◆ BPy_reports_to_error()

short BPy_reports_to_error ( ReportList reports,
PyObject *  exception,
const bool  clear 
)

◆ BPy_reports_write_stdout()

void BPy_reports_write_stdout ( const ReportList reports,
const char *  header 
)

Definition at line 45 of file bpy_capi_utils.c.

References ReportList::list, and LISTBASE_FOREACH.

Referenced by pyop_call(), and pyrna_register_class().