diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-24 19:10:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-24 19:10:26 +0300 |
commit | 4dd3e6c36070e64d8b1d784a34d9881ae2c3eed8 (patch) | |
tree | b5797cbc48a2cffad1a50d07945c8e5b31b68e6c /source/blender/windowmanager/WM_types.h | |
parent | 1d224ad692c8794500f4d6fd5257887db150a635 (diff) |
support for registering operators using the same internal rna api as panels, menus, headers & render engines since there was a fair bit of duplicate functionality.
will remove the old system and update scripts next.
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 318945918e7..f0ccbed06c3 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -31,9 +31,13 @@ struct bContext; struct wmEvent; struct wmWindowManager; +struct uiLayout; +struct wmOperator; -/* exported types for WM */ +#include "RNA_types.h" +#include "DNA_listBase.h" +/* exported types for WM */ #include "wm_cursors.h" #include "wm_event_types.h" @@ -353,6 +357,54 @@ typedef struct wmTimer { } wmTimer; +typedef struct wmOperatorType { + struct wmOperatorType *next, *prev; + + char *name; /* text for ui, undo */ + char *idname; /* unique identifier */ + char *description; /* tooltips and python docs */ + + /* this callback executes the operator without any interactive input, + * parameters may be provided through operator properties. cannot use + * any interface code or input device state. + * - see defines below for return values */ + int (*exec)(struct bContext *, struct wmOperator *); + + /* for modal temporary operators, initially invoke is called. then + * any further events are handled in modal. if the operation is + * cancelled due to some external reason, cancel is called + * - see defines below for return values */ + int (*invoke)(struct bContext *, struct wmOperator *, struct wmEvent *); + int (*cancel)(struct bContext *, struct wmOperator *); + int (*modal)(struct bContext *, struct wmOperator *, struct wmEvent *); + + /* verify if the operator can be executed in the current context, note + * that the operator might still fail to execute even if this return true */ + int (*poll)(struct bContext *); + + /* optional panel for redo and repeat, autogenerated if not set */ + void (*ui)(struct bContext *, struct wmOperator *, struct uiLayout *); + + /* rna for properties */ + struct StructRNA *srna; + + /* struct wmOperatorTypeMacro */ + ListBase macro; + + short flag; + + /* pointer to modal keymap, do not free! */ + struct wmKeyMap *modalkeymap; + + /* only used for operators defined with python + * use to store pointers to python functions */ + void *pyop_data; + int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot); + + /* RNA integration */ + ExtensionRNA ext; +} wmOperatorType; + /* **************** Paint Cursor ******************* */ typedef void (*wmPaintCursorDraw)(struct bContext *C, int, int, void *customdata); |