|
Blender V5.0
|
Go to the source code of this file.
Classes | |
| struct | BPy_RunErrInfo |
Functions | |
Run File/Text as a Script | |
| |
| bool | BPY_run_filepath (bContext *C, const char *filepath, ReportList *reports) ATTR_NONNULL(1 |
| bool bool | BPY_run_text (bContext *C, Text *text, ReportList *reports, bool do_jump) ATTR_NONNULL(1 |
Run a String as a Script | |
| |
| bool | BPY_run_string_exec (bContext *C, const char *imports[], const char *expr) |
| bool | BPY_run_string_eval (bContext *C, const char *imports[], const char *expr) |
Run a String as a Script & Return the Result | |
Convenience functions for executing a script and returning the result as an expected type. | |
| bool | BPY_run_string_as_number (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, double *r_value) ATTR_NONNULL(1 |
| bool bool | BPY_run_string_as_intptr (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, intptr_t *r_value) ATTR_NONNULL(1 |
| bool bool bool | BPY_run_string_as_string_and_len (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value, size_t *r_value_len) ATTR_NONNULL(1 |
| bool bool bool bool | BPY_run_string_as_string (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value) ATTR_NONNULL(1 |
| bool bool bool bool bool | BPY_run_string_as_string_and_len_or_none (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value, size_t *r_value_len) ATTR_NONNULL(1 |
| bool bool bool bool bool bool | BPY_run_string_as_string_or_none (bContext *C, const char *imports[], const char *expr, BPy_RunErrInfo *err_info, char **r_value) ATTR_NONNULL(1 |
imports: This is simply supported for convenience since imports can make constructing strings more cumbersome as otherwise small expressions become multi-line code-blocks. Optional (ignored when NULL), otherwise this is a NULL terminated array of module names.
Failure to import any modules prevents any further execution.
Definition in file BPY_extern_run.hh.
| bool BPY_run_filepath | ( | bContext * | C, |
| const char * | filepath, | ||
| ReportList * | reports ) |
Execute filepath as a Python script.
Wrapper for PyRun_File (similar to calling python with a script argument). Used for the --Python command line argument.
| C | The context (never NULL). |
| filepath | The file path to execute. |
| reports | Failure to execute the script will report the exception here (may be NULL). |
References C.
Referenced by arg_handle_python_file_run(), Freestyle::PythonInterpreter::interpretFile(), and run_pyfile_exec().
|
nodiscard |
Evaluate expr as an integer or pointer.
| C | See Common Arguments. |
| imports | See Common Arguments. |
| expr | The expression to evaluate. |
| err_info | See Common Arguments. |
| r_value | The resulting value. |
References C.
Referenced by ui_tooltip_data_from_tool().
|
nodiscard |
Evaluate expr as a number (double).
| C | See Common Arguments. |
| imports | See Common Arguments. |
| expr | The expression to evaluate. |
| err_info | See Common Arguments. |
| r_value | The resulting value. |
References C.
Referenced by ui_number_from_string(), and user_string_to_number().
|
nodiscard |
See BPY_run_string_as_string_and_len
References C.
Referenced by text_jump_to_file_at_point_external(), ui_but_user_menu_add(), and ui_tooltip_data_from_tool().
|
nodiscard |
Evaluate expr as a string.
| C | See Common Arguments. |
| imports | See Common Arguments. |
| expr | The expression to evaluate. |
| err_info | See Common Arguments. |
| r_value | The resulting value. |
References C.
Referenced by ui_tooltip_data_from_tool().
|
nodiscard |
Evaluate expr as a string or None. Where a success return value with *r_value == nullptr indicates a value of None.
| C | See Common Arguments. |
| imports | See Common Arguments. |
| expr | The expression to evaluate. |
| err_info | See Common Arguments. |
| r_value | The resulting value. |
References C.
|
nodiscard |
| bool BPY_run_string_eval | ( | bContext * | C, |
| const char * | imports[], | ||
| const char * | expr ) |
Run an expression, matches: exec(compile(..., "eval")).
| C | Optional context (may be null), used for bpy.context and reporting errors to CTX_wm_reports(C). |
Definition at line 294 of file bpy_interface_run.cc.
References bpy_run_string_impl(), and C.
Referenced by arg_handle_python_console_run(), BPY_python_start(), Freestyle::PythonInterpreter::interpretString(), script_reload_exec(), WM_exit_ex(), wm_file_read_post(), wm_homefile_read_ex(), wm_init_scripts_extensions_once(), and WM_keyconfig_reload().
| bool BPY_run_string_exec | ( | bContext * | C, |
| const char * | imports[], | ||
| const char * | expr ) |
Run an entire script, matches: exec(compile(..., "exec"))
| C | Optional context (may be null), used for bpy.context and reporting errors to CTX_wm_reports(C). |
Definition at line 299 of file bpy_interface_run.cc.
References bpy_run_string_impl(), and C.
Referenced by arg_handle_addons_set(), arg_handle_python_expr_run(), script_reload_exec(), and wm_file_read_post().
| bool bool BPY_run_text | ( | bContext * | C, |
| Text * | text, | ||
| ReportList * | reports, | ||
| bool | do_jump ) |
Execute a Blender text block as a Python script.
Wrapper for Py_CompileStringObject & PyEval_EvalCode. Used for the --python-text command line argument.
| C | The context (never NULL). |
| text | The text-block to execute. |
| reports | Failure to execute the script will report the exception here (may be NULL). |
| do_jump | When true, any error moves the cursor to the location of that error. Useful for executing scripts interactively from the text editor. |
References C.
Referenced by arg_handle_python_text_run(), BPY_modules_load_user(), Freestyle::PythonInterpreter::interpretFile(), Freestyle::PythonInterpreter::interpretText(), and text_run_script().