From 4dd3e6c36070e64d8b1d784a34d9881ae2c3eed8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Dec 2009 16:10:26 +0000 Subject: 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. --- source/blender/makesdna/DNA_windowmanager_types.h | 63 +++-------------------- 1 file changed, 7 insertions(+), 56 deletions(-) (limited to 'source/blender/makesdna/DNA_windowmanager_types.h') diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 2f640d3dfd4..66b50fbad04 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -180,64 +180,15 @@ typedef struct wmWindow { # typedef struct wmOperatorTypeMacro { struct wmOperatorTypeMacro *next, *prev; - + /* operator id */ char idname[MAX_ID_NAME]; /* rna pointer to access properties, like keymap */ struct IDProperty *properties; /* operator properties, assigned to ptr->data and can be written to a file */ - struct PointerRNA *ptr; + struct PointerRNA *ptr; } wmOperatorTypeMacro; -# -# -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); - -} wmOperatorType; - - /* partial copy of the event, for matching by eventhandler */ typedef struct wmKeyMapItem { struct wmKeyMapItem *next, *prev; @@ -318,18 +269,18 @@ typedef struct wmOperator { /* saved */ char idname[64]; /* used to retrieve type pointer */ IDProperty *properties; /* saved, user-settable properties */ - + /* runtime */ - wmOperatorType *type; /* operator type definition from idname */ + struct wmOperatorType *type; /* operator type definition from idname */ void *customdata; /* custom storage, only while operator runs */ - + struct PointerRNA *ptr; /* rna pointer to access properties */ struct ReportList *reports; /* errors and warnings storage */ - + ListBase macro; /* list of operators, can be a tree */ struct wmOperator *opm; /* current running macro, not saved */ short flag, pad[3]; - + } wmOperator; /* operator type exec(), invoke() modal(), return values */ -- cgit v1.2.3