diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-03-16 18:54:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-03-16 18:54:43 +0300 |
commit | 16fe92f86828d6ccec90ad4d8a1995afaf616964 (patch) | |
tree | 698094db706cd352a484ada3280f18771f9ef0fe /source/blender/windowmanager/intern | |
parent | 133e8827b7e9b76e61e405c6eeac88126a106b09 (diff) |
2.5 PyAPI
Support for subclassing blenders operator, to be registered as a new operator.
Still need to...
* add constants like Operator.FINISHED
* wrap context (with rna?)
* poll() cant work right now because there is no way to access the operatorType that holds the python class.
* Only float, int and bool properties can be added so far.
working example operator.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/WinterCamp/TechnicalDesign#Operator_Example_Code
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 2b08f5a8943..772b308fb62 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -469,7 +469,12 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, PointerRNA *properties, { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *op= wm_operator_create(wm, ot, properties, reports); - int retval= op->type->exec(C, op); + int retval= OPERATOR_CANCELLED; + + if (op->type->exec) + retval= op->type->exec(C, op); + else + printf("error \"%s\" operator has no exec function, python cannot call it\n", op->type->name); if (reports) op->reports= NULL; /* dont let the operator free reports passed to this function */ |