Blender V2.61 - r43446
|
#include <Python.h>
#include "MEM_guardedalloc.h"
#include "RNA_types.h"
#include "bpy.h"
#include "gpu.h"
#include "bpy_rna.h"
#include "bpy_util.h"
#include "bpy_traceback.h"
#include "bpy_intern_string.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "BLI_path_util.h"
#include "BLI_math_base.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "CCL_api.h"
#include "BPY_extern.h"
#include "../generic/bpy_internal_import.h"
#include "../generic/py_capi_utils.h"
#include "../generic/bgl.h"
#include "../generic/blf_py_api.h"
#include "../mathutils/mathutils.h"
Go to the source code of this file.
Classes | |
struct | PyModuleObject |
Defines | |
#define | PYMODULE_CLEAR_WORKAROUND |
Functions | |
void | bpy_context_update (bContext *C) |
void | bpy_context_set (bContext *C, PyGILState_STATE *gilstate) |
void | bpy_context_clear (bContext *UNUSED(C), PyGILState_STATE *gilstate) |
void | BPY_text_free_code (Text *text) |
void | BPY_modules_update (bContext *C) |
void | BPY_context_set (bContext *C) |
PyObject * | AUD_initPython (void) |
void | BPY_python_start (int argc, const char **argv) |
void | BPY_python_end (void) |
static void | python_script_error_jump_text (struct Text *text) |
static int | python_script_exec (bContext *C, const char *fn, struct Text *text, struct ReportList *reports, const short do_jump) |
int | BPY_filepath_exec (bContext *C, const char *filepath, struct ReportList *reports) |
int | BPY_text_exec (bContext *C, struct Text *text, struct ReportList *reports, const short do_jump) |
void | BPY_DECREF (void *pyob_ptr) |
int | BPY_button_exec (bContext *C, const char *expr, double *value, const short verbose) |
int | BPY_string_exec (bContext *C, const char *expr) |
void | BPY_modules_load_user (bContext *C) |
int | BPY_context_member_get (bContext *C, const char *member, bContextDataResult *result) |
Variables | |
static int | py_call_level = 0 |
BPy_StructRNA * | bpy_context_module = NULL |
static struct _inittab | bpy_internal_modules [] |
This file deals with embedding the python interpreter within blender, starting and stopping python and exposing blender/python modules so they can be accesses from scripts.
Definition in file bpy_interface.c.
#define PYMODULE_CLEAR_WORKAROUND |
Definition at line 329 of file bpy_interface.c.
PyObject* AUD_initPython | ( | void | ) |
int BPY_button_exec | ( | bContext * | C, |
const char * | expr, | ||
double * | value, | ||
const short | verbose | ||
) |
Definition at line 471 of file bpy_interface.c.
References bpy_context_clear(), bpy_context_set(), BPy_errors_to_report(), CTX_wm_reports(), i, mod(), NULL, PyC_DefaultNameSpace(), PyC_MainModule_Backup(), and simple_enum_gen::val.
void bpy_context_clear | ( | bContext * | UNUSEDC, |
PyGILState_STATE * | gilstate | ||
) |
Definition at line 126 of file bpy_interface.c.
References bpy_import_main_set(), BPy_SetContext(), NULL, PIL_check_seconds_timer(), and py_call_level.
Referenced by BPY_button_exec(), bpy_class_call(), BPY_modules_load_user(), bpy_prop_update_cb(), bpy_props_enum_itemf(), BPY_string_exec(), cb_region_draw(), and python_script_exec().
int BPY_context_member_get | ( | bContext * | C, |
const char * | member, | ||
bContextDataResult * | result | ||
) |
Definition at line 634 of file bpy_interface.c.
References BPy_StructRNA_Check, CTX_data_list_add(), CTX_data_pointer_set(), CTX_py_dict_get(), PointerRNA::data, G, G_DEBUG, i, PointerRNA::id, len(), NULL, and PointerRNA::type.
Referenced by ctx_data_get().
void BPY_context_set | ( | bContext * | C | ) |
Definition at line 173 of file bpy_interface.c.
References BPy_SetContext().
Referenced by WM_init().
void bpy_context_set | ( | bContext * | C, |
PyGILState_STATE * | gilstate | ||
) |
Definition at line 101 of file bpy_interface.c.
References bpy_context_update(), PIL_check_seconds_timer(), and py_call_level.
Referenced by BPY_button_exec(), bpy_class_call(), BPY_modules_load_user(), bpy_prop_update_cb(), bpy_props_enum_itemf(), BPY_string_exec(), cb_region_draw(), and python_script_exec().
void bpy_context_update | ( | bContext * | C | ) |
Definition at line 94 of file bpy_interface.c.
References bpy_import_main_set(), BPY_modules_update(), BPy_SetContext(), and CTX_data_main().
Referenced by bpy_context_set(), and BPY_modules_load_user().
void BPY_DECREF | ( | void * | pyob_ptr | ) |
Definition at line 463 of file bpy_interface.c.
Referenced by fcurve_free_driver(), RE_engine_free(), and WM_operator_free().
int BPY_filepath_exec | ( | bContext * | C, |
const char * | filepath, | ||
struct ReportList * | reports | ||
) |
Definition at line 452 of file bpy_interface.c.
References FALSE, NULL, and python_script_exec().
Referenced by run_pyfile_exec(), and run_python().
void BPY_modules_load_user | ( | bContext * | C | ) |
Definition at line 595 of file bpy_interface.c.
References BLI_testextensie(), bpy_context_clear(), bpy_context_set(), bpy_context_update(), bpy_text_import(), CTX_data_main(), Text::flags, G, G_SCRIPT_AUTOEXEC, Text::id, module, Main::name, ID::name, ID::next, NULL, py_call_level, and TXT_ISSCRIPT.
Referenced by load_file(), WM_init(), WM_read_file(), and WM_read_homefile().
void BPY_modules_update | ( | bContext * | C | ) |
Definition at line 160 of file bpy_interface.c.
References BPY_rna_module(), BPY_rna_types(), BPY_update_rna_module(), PointerRNA::data, mod(), NULL, and BPy_StructRNA::ptr.
Referenced by bpy_context_update(), and pyop_call().
void BPY_python_end | ( | void | ) |
Definition at line 278 of file bpy_interface.c.
References BPY_atexit_unregister(), bpy_intern_string_exit(), PIL_check_seconds_timer(), and pyrna_free_types().
Referenced by WM_exit_ext().
void BPY_python_start | ( | int | argc, |
const char ** | argv | ||
) |
Definition at line 206 of file bpy_interface.c.
References BLENDER_SYSTEM_PYTHON, BLI_get_folder(), BLI_program_path(), BLI_setenv(), BLI_strncpy_wchar_from_utf8(), BPY_atexit_register(), bpy_import_init(), BPy_init_modules(), bpy_intern_string_init(), FILE_MAX, i, NULL, PyC_SetHomePath(), PyC_UnicodeFromByte(), and pyrna_alloc_types().
Referenced by WM_init().
int BPY_string_exec | ( | bContext * | C, |
const char * | expr | ||
) |
Definition at line 551 of file bpy_interface.c.
References bpy_context_clear(), bpy_context_set(), BPy_errors_to_report(), bpy_import_main_get(), bpy_import_main_set(), CTX_data_main(), CTX_wm_reports(), NULL, PyC_DefaultNameSpace(), PyC_MainModule_Backup(), and PyC_MainModule_Restore().
Referenced by run_python_console(), script_reload_exec(), set_addons(), and WM_read_homefile().
int BPY_text_exec | ( | bContext * | C, |
struct Text * | text, | ||
struct ReportList * | reports, | ||
const short | do_jump | ||
) |
Definition at line 458 of file bpy_interface.c.
References NULL, and python_script_exec().
Referenced by text_run_script().
void BPY_text_free_code | ( | Text * | text | ) |
Definition at line 152 of file bpy_interface.c.
References Text::compiled, and NULL.
Referenced by free_text(), python_script_exec(), text_reload_exec(), and txt_make_dirty().
static void python_script_error_jump_text | ( | struct Text * | text | ) | [static] |
Definition at line 316 of file bpy_interface.c.
References FALSE, Text::id, ID::name, python_script_error_jump(), TRUE, and txt_move_to().
Referenced by python_script_exec().
static int python_script_exec | ( | bContext * | C, |
const char * | fn, | ||
struct Text * | text, | ||
struct ReportList * | reports, | ||
const short | do_jump | ||
) | [static] |
Definition at line 341 of file bpy_interface.c.
References BLI_assert, bpy_context_clear(), bpy_context_set(), BPy_errors_to_report(), bpy_text_filename_get(), BPY_text_free_code(), Text::compiled, FILE_MAXDIR, PyModuleObject::md_dict, MEM_freeN(), MEM_mallocN(), NULL, PyC_DefaultNameSpace(), PyC_MainModule_Backup(), PyC_MainModule_Restore(), python_script_error_jump_text(), strlen(), and txt_to_buf().
Referenced by BPY_filepath_exec(), and BPY_text_exec().
BPy_StructRNA* bpy_context_module = NULL |
Definition at line 81 of file bpy_interface.c.
Referenced by BPy_init_modules().
struct _inittab bpy_internal_modules[] [static] |
{ {(char *)"mathutils", PyInit_mathutils}, {(char *)"bgl", BPyInit_bgl}, {(char *)"blf", BPyInit_blf}, {(char *)"gpu", GPU_initPython}, {NULL, NULL} }
Definition at line 189 of file bpy_interface.c.
int py_call_level = 0 [static] |
Definition at line 80 of file bpy_interface.c.
Referenced by bpy_context_clear(), bpy_context_set(), and BPY_modules_load_user().