diff options
Diffstat (limited to 'source/blender/windowmanager/WM_api.h')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 105 |
1 files changed, 100 insertions, 5 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9e27190de02..298940a7b94 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -39,6 +39,7 @@ /* dna-savable wmStructs here */ #include "DNA_windowmanager_types.h" +#include "DNA_listBase.h" #include "WM_keymap.h" #include "BLI_compiler_attrs.h" @@ -55,6 +56,11 @@ struct wmGesture; struct wmJob; struct wmOperatorType; struct wmOperator; +struct wmWidget; +struct wmWidgetGroup; +struct wmWidgetMap; +struct wmWidgetGroupType; +struct wmWidgetMapType; struct rcti; struct PointerRNA; struct PropertyRNA; @@ -65,6 +71,8 @@ struct ImBuf; struct ImageFormatData; struct ARegion; struct wmNDOFMotionData; +struct Main; +struct Object; typedef struct wmJob wmJob; @@ -304,11 +312,11 @@ bool WM_operator_last_properties_store(struct wmOperator *op); /* flags for WM_operator_properties_filesel */ #define WM_FILESEL_RELPATH (1 << 0) -#define WM_FILESEL_DIRECTORY (1 << 1) -#define WM_FILESEL_FILENAME (1 << 2) -#define WM_FILESEL_FILEPATH (1 << 3) -#define WM_FILESEL_FILES (1 << 4) - +#define WM_FILESEL_DIRECTORY (1 << 1) +#define WM_FILESEL_FILENAME (1 << 2) +#define WM_FILESEL_FILEPATH (1 << 3) +#define WM_FILESEL_FILES (1 << 4) +#define WM_FILESEL_IMAGE_COLLAPSE (1 << 5) /* operator as a python command (resultuing string must be freed) */ char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, @@ -413,6 +421,8 @@ enum { WM_JOB_TYPE_OBJECT_SIM_FLUID, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE, WM_JOB_TYPE_OBJECT_BAKE, + WM_JOB_TYPE_PTCACHE_EXPORT, + WM_JOB_TYPE_CACHELIBRARY_BAKE, WM_JOB_TYPE_FILESEL_THUMBNAIL, WM_JOB_TYPE_CLIP_BUILD_PROXY, WM_JOB_TYPE_CLIP_TRACK_MARKERS, @@ -420,6 +430,7 @@ enum { WM_JOB_TYPE_CLIP_PREFETCH, WM_JOB_TYPE_SEQ_BUILD_PROXY, WM_JOB_TYPE_SEQ_BUILD_PREVIEW, + WM_JOB_TYPE_SMOKE_EXPORT, /* add as needed, screencast, seq proxy build * if having hard coded values is a problem */ }; @@ -483,6 +494,90 @@ void WM_event_ndof_to_quat(const struct wmNDOFMotionData *ndof, float q[4 float WM_event_tablet_data(const struct wmEvent *event, int *pen_flip, float tilt[2]); bool WM_event_is_tablet(const struct wmEvent *event); +/* widget API */ +struct wmWidget *WM_widget_new(void (*draw)(struct wmWidget *, const struct bContext *), + void (*render_3d_intersection)(const struct bContext *, struct wmWidget *, int), + int (*intersect)(struct bContext *C, const struct wmEvent *event, struct wmWidget *customdata), + int (*handler)(struct bContext *, const struct wmEvent *, struct wmWidget *)); + +void WM_widget_property(struct wmWidget *, int slot, struct PointerRNA *ptr, const char *propname); +struct PointerRNA *WM_widget_operator(struct wmWidget *, const char *opname); +void WM_widgets_update(const struct bContext *C, struct wmWidgetMap *wmap); +void WM_widgets_draw(const struct bContext *C, struct wmWidgetMap *wmap, bool in_scene); +void WM_event_add_area_widgetmap_handlers(struct ARegion *ar); +void WM_modal_handler_attach_widgetgroup(struct bContext *C, struct wmEventHandler *handler, struct wmWidgetGroupType *wgrouptype, struct wmOperator *op); + +void WM_widget_set_origin(struct wmWidget *widget, float origin[3]); +void WM_widget_set_3d_scale(struct wmWidget *widget, bool scale); +void WM_widget_set_draw_on_hover_only(struct wmWidget *widget, bool draw); +void WM_widget_set_scene_depth(struct wmWidget *widget, bool scene); +void WM_widget_set_scale(struct wmWidget *widget, float scale); + +struct wmWidgetMapType *WM_widgetmaptype_find(const char *idname, int spaceid, int regionid, bool is_3d, bool create); +struct wmWidgetGroupType *WM_widgetgrouptype_new(int (*poll)(const struct bContext *, struct wmWidgetGroupType *), + void (*draw)(const struct bContext *, struct wmWidgetGroup *), + struct Main *bmain, const char *mapidname, short spaceid, short regionid, bool is_3d); +void WM_widgetgrouptype_unregister(struct bContext *C, struct Main *bmain, struct wmWidgetGroupType *wgroup); + +/* creates a widgetmap with all registered widgets for that type */ +struct wmWidgetMap *WM_widgetmap_from_type(const char *idname, int spaceid, int regionid, bool is_3d); +void WM_widgetmap_delete(struct wmWidgetMap *wmap); +bool WM_widgetmap_cursor_set(struct wmWidgetMap *wmap, struct wmWindow *win); + +void WM_widgetmaptypes_free(void); + +/* wm_generic_widgets.c */ + +enum { + WIDGET_ARROW_STYLE_NORMAL = 1, + WIDGET_ARROW_STYLE_NO_AXIS = (1 << 1), + WIDGET_ARROW_STYLE_CROSS = (1 << 2), + WIDGET_ARROW_STYLE_INVERTED = (1 << 3), /* inverted offset during interaction - if set it also sets constrained below */ + WIDGET_ARROW_STYLE_CONSTRAINED = (1 << 4), /* clamp arrow interaction to property width */ +}; + +enum { + WIDGET_DIAL_STYLE_RING = 0, + WIDGET_DIAL_STYLE_RING_CLIPPED = 1, +}; + +enum { + WIDGET_RECT_TRANSFORM_STYLE_TRANSLATE = 1, /* widget translates */ + WIDGET_RECT_TRANSFORM_STYLE_ROTATE = (1 << 1), /* widget rotates */ + WIDGET_RECT_TRANSFORM_STYLE_SCALE = (1 << 2), /* widget scales */ + WIDGET_RECT_TRANSFORM_STYLE_SCALE_UNIFORM = (1 << 3), /* widget scales uniformly */ +}; + +/* slots for properties */ +enum { + ARROW_SLOT_OFFSET_WORLD_SPACE = 0 +}; + +enum { + RECT_TRANSFORM_SLOT_OFFSET = 0, + RECT_TRANSFORM_SLOT_SCALE = 1 +}; + +enum { + FACEMAP_SLOT_FACEMAP = 0, +}; + +struct wmWidget *WIDGET_arrow_new(struct wmWidgetGroup *wgroup, int style); +void WIDGET_arrow_set_color(struct wmWidget *widget, float color[4]); +void WIDGET_arrow_set_direction(struct wmWidget *widget, float direction[3]); +void WIDGET_arrow_set_up_vector(struct wmWidget *widget, float direction[3]); +void WIDGET_arrow_set_scale(struct wmWidget *widget, float scale); + +struct wmWidget *WIDGET_dial_new(int style); +void WIDGET_dial_set_color(struct wmWidget *widget, float color[4]); +void WIDGET_dial_set_direction(struct wmWidget *widget, float direction[3]); + +struct wmWidget *WIDGET_rect_transform_new(struct wmWidgetGroup *wgroup, int style, float width, float height); +void WIDGET_rect_transform_set_offset(struct wmWidget *widget, float offset[2]); + +struct wmWidget *WIDGET_facemap_new(struct wmWidgetGroup *wgroup, int style, struct Object *ob, int facemap); +void WIDGET_facemap_set_color(struct wmWidget *widget, float color[4]); + #ifdef WITH_INPUT_IME bool WM_event_is_ime_switch(const struct wmEvent *event); #endif |