forked from bartvdbraak/blender
Cleanup: update comments, remove ifdef'd code
This commit is contained in:
parent
c23da7a5c9
commit
042f06ef3c
@ -170,8 +170,14 @@ enum {
|
|||||||
|
|
||||||
/* Bits 11 to 22 (inclusive) are deprecated & need to be cleared */
|
/* Bits 11 to 22 (inclusive) are deprecated & need to be cleared */
|
||||||
|
|
||||||
/** On read, use #FileGlobal.filename instead of the real location on-disk,
|
/**
|
||||||
* needed for recovering temp files so relative paths resolve */
|
* On read, use #FileGlobal.filename instead of the real location on-disk,
|
||||||
|
* needed for recovering temp files so relative paths resolve.
|
||||||
|
*
|
||||||
|
* \note In some ways it would be nicer to make this an argument passed to file loading.
|
||||||
|
* In practice this means recover needs to be passed around to too many low level functions,
|
||||||
|
* so keep this as a flag.
|
||||||
|
*/
|
||||||
G_FILE_RECOVER = (1 << 23),
|
G_FILE_RECOVER = (1 << 23),
|
||||||
/** BMesh option to save as older mesh format */
|
/** BMesh option to save as older mesh format */
|
||||||
/* #define G_FILE_MESH_COMPAT (1 << 26) */
|
/* #define G_FILE_MESH_COMPAT (1 << 26) */
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
/** \file
|
/** \file
|
||||||
* \ingroup pythonintern
|
* \ingroup pythonintern
|
||||||
*
|
*
|
||||||
* This file defines '_bpy.ops', an internal python module which gives python
|
* This file defines `_bpy.ops`, an internal python module which gives Python
|
||||||
* the ability to inspect and call both C and Python defined operators.
|
* the ability to inspect and call operators (defined by C or Python).
|
||||||
*
|
*
|
||||||
* \note
|
* \note
|
||||||
* This module is exposed to the user via 'release/scripts/modules/bpy/ops.py'
|
* This C module is private, it should only be used by `release/scripts/modules/bpy/ops.py` which
|
||||||
* which fakes exposing operators as modules/functions using its own classes.
|
* exposes operators as dynamically defined modules & callable objects to access all operators.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#include "bpy_capi_utils.h"
|
#include "bpy_capi_utils.h"
|
||||||
#include "bpy_operator.h"
|
#include "bpy_operator.h"
|
||||||
#include "bpy_operator_wrap.h"
|
#include "bpy_operator_wrap.h"
|
||||||
#include "bpy_rna.h" /* for setting arg props only - pyrna_py_to_prop() */
|
#include "bpy_rna.h" /* for setting argument properties & type method `get_rna_type`. */
|
||||||
|
|
||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
#include "RNA_enum_types.h"
|
#include "RNA_enum_types.h"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
/** \file
|
/** \file
|
||||||
* \ingroup pythonintern
|
* \ingroup pythonintern
|
||||||
*
|
*
|
||||||
* This file is so python can define operators that C can call into.
|
* This file exposes functionality for defining to define operators that C can call into.
|
||||||
* The generic callback functions for python operators are defines in
|
* The generic callback functions for python operators are defines in
|
||||||
* 'rna_wm.c', some calling into functions here to do python specific
|
* 'rna_wm.c', some calling into functions here to do python specific
|
||||||
* functionality.
|
* functionality.
|
||||||
@ -115,6 +115,10 @@ static void operator_properties_init(wmOperatorType *ot)
|
|||||||
/* end 'ot->prop' assignment */
|
/* end 'ot->prop' assignment */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic function used by all Python defined operators
|
||||||
|
* it's passed as an argument to #WM_operatortype_append_ptr in for operator registration.
|
||||||
|
*/
|
||||||
void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata)
|
void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata)
|
||||||
{
|
{
|
||||||
/* take care not to overwrite anything set in
|
/* take care not to overwrite anything set in
|
||||||
@ -131,6 +135,10 @@ void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata)
|
|||||||
operator_properties_init(ot);
|
operator_properties_init(ot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic function used by all Python defined macro-operators
|
||||||
|
* it's passed as an argument to #WM_operatortype_append_ptr in for operator registration.
|
||||||
|
*/
|
||||||
void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata)
|
void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata)
|
||||||
{
|
{
|
||||||
wmOperatorType *data = (wmOperatorType *)userdata;
|
wmOperatorType *data = (wmOperatorType *)userdata;
|
||||||
|
@ -1653,36 +1653,8 @@ int WM_operator_call_py(bContext *C,
|
|||||||
const bool is_undo)
|
const bool is_undo)
|
||||||
{
|
{
|
||||||
int retval = OPERATOR_CANCELLED;
|
int retval = OPERATOR_CANCELLED;
|
||||||
|
|
||||||
#if 0
|
|
||||||
wmOperator *op;
|
|
||||||
op = wm_operator_create(wm, ot, properties, reports);
|
|
||||||
|
|
||||||
if (op->type->exec) {
|
|
||||||
if (is_undo && op->type->flag & OPTYPE_UNDO) {
|
|
||||||
wm->op_undo_depth++;
|
|
||||||
}
|
|
||||||
|
|
||||||
retval = op->type->exec(C, op);
|
|
||||||
OPERATOR_RETVAL_CHECK(retval);
|
|
||||||
|
|
||||||
if (is_undo && op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
|
|
||||||
wm->op_undo_depth--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CLOG_WARN(WM_LOG_OPERATORS,
|
|
||||||
"\"%s\" operator has no exec function, Python cannot call it",
|
|
||||||
op->type->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Not especially nice using undo depth here. It's used so Python never
|
/* Not especially nice using undo depth here. It's used so Python never
|
||||||
* triggers undo or stores an operator's last used state.
|
* triggers undo or stores an operator's last used state. */
|
||||||
*
|
|
||||||
* We could have some more obvious way of doing this like passing a flag.
|
|
||||||
*/
|
|
||||||
wmWindowManager *wm = CTX_wm_manager(C);
|
wmWindowManager *wm = CTX_wm_manager(C);
|
||||||
if (!is_undo && wm) {
|
if (!is_undo && wm) {
|
||||||
wm->op_undo_depth++;
|
wm->op_undo_depth++;
|
||||||
|
@ -193,7 +193,7 @@ def main() -> None:
|
|||||||
|
|
||||||
argv = (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
|
argv = (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
|
||||||
|
|
||||||
# If we want full arg parsing.
|
# Use `argparse` for full arg parsing, for now this is enough.
|
||||||
relaxed = "--relaxed" not in argv
|
relaxed = "--relaxed" not in argv
|
||||||
|
|
||||||
has_error = False
|
has_error = False
|
||||||
|
Loading…
Reference in New Issue
Block a user