Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h8
-rw-r--r--source/blender/windowmanager/WM_keymap.h4
-rw-r--r--source/blender/windowmanager/WM_types.h18
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_api.h192
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_types.h6
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo.c352
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c424
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c82
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h38
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c647
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c216
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c80
-rw-r--r--source/blender/windowmanager/gizmo/wm_gizmo_fn.h2
-rw-r--r--source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h20
-rw-r--r--source/blender/windowmanager/intern/wm.c59
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c86
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c128
-rw-r--r--source/blender/windowmanager/intern/wm_files.c18
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c18
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c19
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c19
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c53
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c39
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c24
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c8
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c58
-rw-r--r--source/blender/windowmanager/intern/wm_window.c40
-rw-r--r--source/blender/windowmanager/wm_window.h1
29 files changed, 1391 insertions, 1272 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 67ca5f8a08a..b15ce2d11ad 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -485,10 +485,16 @@ void WM_drag_free(struct wmDrag *drag);
void WM_drag_free_list(struct ListBase *lb);
struct wmDropBox *WM_dropbox_add(
- ListBase *lb, const char *idname, bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event),
+ ListBase *lb, const char *idname,
+ bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event, const char **),
void (*copy)(struct wmDrag *, struct wmDropBox *));
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid);
+ /* ID drag and drop */
+void WM_drag_add_ID(struct wmDrag *drag, struct ID *id, struct ID *from_parent);
+struct ID *WM_drag_ID(const struct wmDrag *drag, short idcode);
+struct ID *WM_drag_ID_from_event(const struct wmEvent *event, short idcode);
+
/* Set OpenGL viewport and scissor */
void wmViewport(const struct rcti *rect);
void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 547028c88f9..2e84140707d 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -70,6 +70,10 @@ wmKeyMapItem *WM_keymap_add_panel(struct wmKeyMap *keymap, const char *idname, i
wmKeyMapItem *WM_keymap_add_tool(struct wmKeyMap *keymap, const char *idname, int type,
int val, int modifier, int keymodifier);
+void WM_keymap_add_context_enum_set_items(
+ wmKeyMap *keymap, const struct EnumPropertyItem *items, const char *data_path,
+ int type_start, int val, int modifier, int keymodifier);
+
bool WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, char *result, const int result_len);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index fc62ba51342..ad728244359 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -111,6 +111,7 @@ struct wmEvent;
struct wmWindowManager;
struct wmMsgBus;
struct wmOperator;
+struct ID;
struct ImBuf;
#include "RNA_types.h"
@@ -145,6 +146,7 @@ enum {
OPTYPE_LOCK_BYPASS = (1 << 7), /* Allow operator to run when interface is locked */
OPTYPE_UNDO_GROUPED = (1 << 8), /* Special type of undo which doesn't store itself multiple times */
+ OPTYPE_USE_EVAL_DATA = (1 << 9), /* Need evaluated data (i.e. a valid, up-to-date depsgraph for current context) */
};
/* context to call operator in for WM_operator_name_call */
@@ -587,6 +589,12 @@ typedef struct wmOperatorType {
* that the operator might still fail to execute even if this return true */
bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
+ /* Use to check of properties should be displayed in auto-generated UI.
+ * Use 'check' callback to enforce refreshing. */
+ bool (*poll_property)(
+ const struct bContext *C, struct wmOperator *op,
+ const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT;
+
/* optional panel for redo and repeat, autogenerated if not set */
void (*ui)(struct bContext *, struct wmOperator *);
@@ -655,6 +663,12 @@ typedef enum wmDragFlags {
/* note: structs need not exported? */
+typedef struct wmDragID {
+ struct wmDragID *next, *prev;
+ struct ID *id;
+ struct ID *from_parent;
+} wmDragID;
+
typedef struct wmDrag {
struct wmDrag *next, *prev;
@@ -669,6 +683,8 @@ typedef struct wmDrag {
char opname[200]; /* if set, draws operator name*/
unsigned int flags;
+
+ ListBase ids; /* List of wmDragIDs, all are guaranteed to have the same ID type. */
} wmDrag;
/* dropboxes are like keymaps, part of the screen/area/region definition */
@@ -677,7 +693,7 @@ typedef struct wmDropBox {
struct wmDropBox *next, *prev;
/* test if the dropbox is active, then can print optype name */
- bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
+ bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *, const char **);
/* before exec, this copies drag info to wmDrop properties */
void (*copy)(struct wmDrag *, struct wmDropBox *);
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index a93597d4f64..dd39cc96d6f 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -60,57 +60,57 @@ struct wmMsgSubscribeValue;
/* wmGizmo */
struct wmGizmo *WM_gizmo_new_ptr(
- const struct wmGizmoType *wt, struct wmGizmoGroup *mgroup,
+ const struct wmGizmoType *gzt, struct wmGizmoGroup *gzgroup,
struct PointerRNA *properties);
struct wmGizmo *WM_gizmo_new(
- const char *idname, struct wmGizmoGroup *mgroup,
+ const char *idname, struct wmGizmoGroup *gzgroup,
struct PointerRNA *properties);
-void WM_gizmo_free(struct wmGizmo *mpr);
+void WM_gizmo_free(struct wmGizmo *gz);
void WM_gizmo_unlink(
- ListBase *gizmolist, struct wmGizmoMap *mmap, struct wmGizmo *mpr,
+ ListBase *gizmolist, struct wmGizmoMap *gzmap, struct wmGizmo *gz,
struct bContext *C);
-void WM_gizmo_name_set(struct wmGizmoGroup *mgroup, struct wmGizmo *mpr, const char *name);
+void WM_gizmo_name_set(struct wmGizmoGroup *gzgroup, struct wmGizmo *gz, const char *name);
-bool WM_gizmo_select_unlink(struct wmGizmoMap *mmap, struct wmGizmo *mpr);
-bool WM_gizmo_select_set(struct wmGizmoMap *mmap, struct wmGizmo *mpr, bool select);
-void WM_gizmo_highlight_set(struct wmGizmoMap *mmap, struct wmGizmo *mpr);
+bool WM_gizmo_select_unlink(struct wmGizmoMap *gzmap, struct wmGizmo *gz);
+bool WM_gizmo_select_set(struct wmGizmoMap *gzmap, struct wmGizmo *gz, bool select);
+void WM_gizmo_highlight_set(struct wmGizmoMap *gzmap, struct wmGizmo *gz);
void WM_gizmo_modal_set_from_setup(
- struct wmGizmoMap *mmap, struct bContext *C,
- struct wmGizmo *mpr, int part_index, const struct wmEvent *event);
+ struct wmGizmoMap *gzmap, struct bContext *C,
+ struct wmGizmo *gz, int part_index, const struct wmEvent *event);
struct wmGizmoOpElem *WM_gizmo_operator_get(
- struct wmGizmo *mpr, int part_index);
+ struct wmGizmo *gz, int part_index);
struct PointerRNA *WM_gizmo_operator_set(
- struct wmGizmo *mpr, int part_index,
+ struct wmGizmo *gz, int part_index,
struct wmOperatorType *ot, struct IDProperty *properties);
/* callbacks */
-void WM_gizmo_set_fn_custom_modal(struct wmGizmo *mpr, wmGizmoFnModal fn);
+void WM_gizmo_set_fn_custom_modal(struct wmGizmo *gz, wmGizmoFnModal fn);
void WM_gizmo_set_matrix_location(
- struct wmGizmo *mpr, const float origin[3]);
+ struct wmGizmo *gz, const float origin[3]);
void WM_gizmo_set_matrix_rotation_from_z_axis(
- struct wmGizmo *mpr, const float z_axis[3]);
+ struct wmGizmo *gz, const float z_axis[3]);
void WM_gizmo_set_matrix_rotation_from_yz_axis(
- struct wmGizmo *mpr, const float y_axis[3], const float z_axis[3]);
+ struct wmGizmo *gz, const float y_axis[3], const float z_axis[3]);
void WM_gizmo_set_matrix_offset_location(
- struct wmGizmo *mpr, const float origin[3]);
+ struct wmGizmo *gz, const float origin[3]);
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(
- struct wmGizmo *mpr, const float z_axis[3]);
+ struct wmGizmo *gz, const float z_axis[3]);
void WM_gizmo_set_matrix_offset_rotation_from_yz_axis(
- struct wmGizmo *mpr, const float y_axis[3], const float z_axis[3]);
+ struct wmGizmo *gz, const float y_axis[3], const float z_axis[3]);
-void WM_gizmo_set_flag(struct wmGizmo *mpr, const int flag, const bool enable);
-void WM_gizmo_set_scale(struct wmGizmo *mpr, float scale);
-void WM_gizmo_set_line_width(struct wmGizmo *mpr, const float line_width);
+void WM_gizmo_set_flag(struct wmGizmo *gz, const int flag, const bool enable);
+void WM_gizmo_set_scale(struct wmGizmo *gz, const float scale);
+void WM_gizmo_set_line_width(struct wmGizmo *gz, const float line_width);
-void WM_gizmo_get_color(const struct wmGizmo *mpr, float color[4]);
-void WM_gizmo_set_color(struct wmGizmo *mpr, const float color[4]);
-void WM_gizmo_get_color_highlight(const struct wmGizmo *mpr, float color_hi[4]);
-void WM_gizmo_set_color_highlight(struct wmGizmo *mpr, const float color[4]);
+void WM_gizmo_get_color(const struct wmGizmo *gz, float color[4]);
+void WM_gizmo_set_color(struct wmGizmo *gz, const float color[4]);
+void WM_gizmo_get_color_highlight(const struct wmGizmo *gz, float color_hi[4]);
+void WM_gizmo_set_color_highlight(struct wmGizmo *gz, const float color[4]);
/**
* Leaving values NULL use values from #wmGizmo.
@@ -123,16 +123,16 @@ struct WM_GizmoMatrixParams {
};
void WM_gizmo_calc_matrix_final_params(
- const struct wmGizmo *mpr, const struct WM_GizmoMatrixParams *params,
+ const struct wmGizmo *gz, const struct WM_GizmoMatrixParams *params,
float r_mat[4][4]);
void WM_gizmo_calc_matrix_final_no_offset(
- const struct wmGizmo *mpr, float r_mat[4][4]);
+ const struct wmGizmo *gz, float r_mat[4][4]);
void WM_gizmo_calc_matrix_final(
- const struct wmGizmo *mpr, float r_mat[4][4]);
+ const struct wmGizmo *gz, float r_mat[4][4]);
/* properties */
-void WM_gizmo_properties_create_ptr(struct PointerRNA *ptr, struct wmGizmoType *wt);
+void WM_gizmo_properties_create_ptr(struct PointerRNA *ptr, struct wmGizmoType *gzt);
void WM_gizmo_properties_create(struct PointerRNA *ptr, const char *opstring);
void WM_gizmo_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *wtstring);
void WM_gizmo_properties_sanitize(struct PointerRNA *ptr, const bool no_context);
@@ -147,7 +147,7 @@ const struct wmGizmoType *WM_gizmotype_find(const char *idname, bool quiet);
void WM_gizmotype_append(void (*wtfunc)(struct wmGizmoType *));
void WM_gizmotype_append_ptr(void (*mnpfunc)(struct wmGizmoType *, void *), void *userdata);
bool WM_gizmotype_remove(struct bContext *C, struct Main *bmain, const char *idname);
-void WM_gizmotype_remove_ptr(struct bContext *C, struct Main *bmain, struct wmGizmoType *wt);
+void WM_gizmotype_remove_ptr(struct bContext *C, struct Main *bmain, struct wmGizmoType *gzt);
void WM_gizmotype_iter(struct GHashIterator *ghi);
/* wm_gizmo_group_type.c */
@@ -159,111 +159,111 @@ void WM_gizmogrouptype_free_ptr(struct wmGizmoGroupType *wt);
void WM_gizmogrouptype_iter(struct GHashIterator *ghi);
struct wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link(
- struct wmGizmoMapType *mmap_type,
+ struct wmGizmoMapType *gzmap_type,
void (*wtfunc)(struct wmGizmoGroupType *));
/* wm_gizmo_map.c */
/* Dynamic Updates (for RNA runtime registration) */
-void WM_gizmoconfig_update_tag_init(struct wmGizmoMapType *mmap_type, struct wmGizmoGroupType *wgt);
-void WM_gizmoconfig_update_tag_remove(struct wmGizmoMapType *mmap_type, struct wmGizmoGroupType *wgt);
+void WM_gizmoconfig_update_tag_init(struct wmGizmoMapType *gzmap_type, struct wmGizmoGroupType *gzgt);
+void WM_gizmoconfig_update_tag_remove(struct wmGizmoMapType *gzmap_type, struct wmGizmoGroupType *gzgt);
void WM_gizmoconfig_update(struct Main *bmain);
/* wm_maniulator_target_props.c */
-struct wmGizmoProperty *WM_gizmo_target_property_array(struct wmGizmo *mpr);
+struct wmGizmoProperty *WM_gizmo_target_property_array(struct wmGizmo *gz);
struct wmGizmoProperty *WM_gizmo_target_property_at_index(
- struct wmGizmo *mpr, int index);
+ struct wmGizmo *gz, int index);
struct wmGizmoProperty *WM_gizmo_target_property_find(
- struct wmGizmo *mpr, const char *idname);
+ struct wmGizmo *gz, const char *idname);
void WM_gizmo_target_property_def_rna_ptr(
- struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type,
+ struct wmGizmo *gz, const struct wmGizmoPropertyType *gz_prop_type,
struct PointerRNA *ptr, struct PropertyRNA *prop, int index);
void WM_gizmo_target_property_def_rna(
- struct wmGizmo *mpr, const char *idname,
+ struct wmGizmo *gz, const char *idname,
struct PointerRNA *ptr, const char *propname, int index);
void WM_gizmo_target_property_def_func_ptr(
- struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type,
+ struct wmGizmo *gz, const struct wmGizmoPropertyType *gz_prop_type,
const struct wmGizmoPropertyFnParams *params);
void WM_gizmo_target_property_def_func(
- struct wmGizmo *mpr, const char *idname,
+ struct wmGizmo *gz, const char *idname,
const struct wmGizmoPropertyFnParams *params);
void WM_gizmo_target_property_clear_rna_ptr(
- struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type);
+ struct wmGizmo *gz, const struct wmGizmoPropertyType *gz_prop_type);
void WM_gizmo_target_property_clear_rna(
- struct wmGizmo *mpr, const char *idname);
+ struct wmGizmo *gz, const char *idname);
-bool WM_gizmo_target_property_is_valid_any(struct wmGizmo *mpr);
+bool WM_gizmo_target_property_is_valid_any(struct wmGizmo *gz);
bool WM_gizmo_target_property_is_valid(
- const struct wmGizmoProperty *mpr_prop);
+ const struct wmGizmoProperty *gz_prop);
float WM_gizmo_target_property_value_get(
- const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop);
+ const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop);
void WM_gizmo_target_property_value_set(
- struct bContext *C, const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop,
+ struct bContext *C, const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop,
const float value);
void WM_gizmo_target_property_value_get_array(
- const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop,
+ const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop,
float *value);
void WM_gizmo_target_property_value_set_array(
- struct bContext *C, const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop,
+ struct bContext *C, const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop,
const float *value);
bool WM_gizmo_target_property_range_get(
- const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop,
+ const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop,
float range[2]);
int WM_gizmo_target_property_array_length(
- const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop);
+ const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop);
/* definitions */
const struct wmGizmoPropertyType *WM_gizmotype_target_property_find(
- const struct wmGizmoType *wt, const char *idname);
+ const struct wmGizmoType *gzt, const char *idname);
void WM_gizmotype_target_property_def(
- struct wmGizmoType *wt, const char *idname, int data_type, int array_length);
+ struct wmGizmoType *gzt, const char *idname, int data_type, int array_length);
/* utilities */
void WM_gizmo_do_msg_notify_tag_refresh(
struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val);
void WM_gizmo_target_property_subscribe_all(
- struct wmGizmo *mpr, struct wmMsgBus *mbus, struct ARegion *ar);
+ struct wmGizmo *gz, struct wmMsgBus *mbus, struct ARegion *ar);
/* -------------------------------------------------------------------- */
/* wmGizmoGroup */
/* Callbacks for 'wmGizmoGroupType.setup_keymap' */
struct wmKeyMap *WM_gizmogroup_keymap_common(
- const struct wmGizmoGroupType *wgt, struct wmKeyConfig *config);
+ const struct wmGizmoGroupType *gzgt, struct wmKeyConfig *config);
struct wmKeyMap *WM_gizmogroup_keymap_common_select(
- const struct wmGizmoGroupType *wgt, struct wmKeyConfig *config);
+ const struct wmGizmoGroupType *gzgt, struct wmKeyConfig *config);
/* -------------------------------------------------------------------- */
/* wmGizmoMap */
struct wmGizmoMap *WM_gizmomap_new_from_type(
- const struct wmGizmoMapType_Params *mmap_params);
-const struct ListBase *WM_gizmomap_group_list(struct wmGizmoMap *mmap);
+ const struct wmGizmoMapType_Params *gzmap_params);
+const struct ListBase *WM_gizmomap_group_list(struct wmGizmoMap *gzmap);
struct wmGizmoGroup *WM_gizmomap_group_find(
- struct wmGizmoMap *mmap,
+ struct wmGizmoMap *gzmap,
const char *idname);
struct wmGizmoGroup *WM_gizmomap_group_find_ptr(
- struct wmGizmoMap *mmap,
- const struct wmGizmoGroupType *wgt);
-void WM_gizmomap_tag_refresh(struct wmGizmoMap *mmap);
+ struct wmGizmoMap *gzmap,
+ const struct wmGizmoGroupType *gzgt);
+void WM_gizmomap_tag_refresh(struct wmGizmoMap *gzmap);
void WM_gizmomap_draw(
- struct wmGizmoMap *mmap, const struct bContext *C, const eWM_GizmoFlagMapDrawStep drawstep);
-void WM_gizmomap_add_handlers(struct ARegion *ar, struct wmGizmoMap *mmap);
-bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *mmap, const int action);
-bool WM_gizmomap_cursor_set(const struct wmGizmoMap *mmap, struct wmWindow *win);
+ struct wmGizmoMap *gzmap, const struct bContext *C, const eWM_GizmoFlagMapDrawStep drawstep);
+void WM_gizmomap_add_handlers(struct ARegion *ar, struct wmGizmoMap *gzmap);
+bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *gzmap, const int action);
+bool WM_gizmomap_cursor_set(const struct wmGizmoMap *gzmap, struct wmWindow *win);
void WM_gizmomap_message_subscribe(
- struct bContext *C, struct wmGizmoMap *mmap, struct ARegion *ar, struct wmMsgBus *mbus);
-bool WM_gizmomap_is_any_selected(const struct wmGizmoMap *mmap);
+ struct bContext *C, struct wmGizmoMap *gzmap, struct ARegion *ar, struct wmMsgBus *mbus);
+bool WM_gizmomap_is_any_selected(const struct wmGizmoMap *gzmap);
bool WM_gizmomap_minmax(
- const struct wmGizmoMap *mmap, bool use_hidden, bool use_select,
+ const struct wmGizmoMap *gzmap, bool use_hidden, bool use_select,
float r_min[3], float r_max[3]);
struct ARegion *WM_gizmomap_tooltip_init(
@@ -273,34 +273,34 @@ struct ARegion *WM_gizmomap_tooltip_init(
/* wmGizmoMapType */
struct wmGizmoMapType *WM_gizmomaptype_find(
- const struct wmGizmoMapType_Params *mmap_params);
+ const struct wmGizmoMapType_Params *gzmap_params);
struct wmGizmoMapType *WM_gizmomaptype_ensure(
- const struct wmGizmoMapType_Params *mmap_params);
+ const struct wmGizmoMapType_Params *gzmap_params);
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find(
- struct wmGizmoMapType *mmap_type,
+ struct wmGizmoMapType *gzmap_type,
const char *idname);
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find_ptr(
- struct wmGizmoMapType *mmap_type,
- const struct wmGizmoGroupType *wgt);
+ struct wmGizmoMapType *gzmap_type,
+ const struct wmGizmoGroupType *gzgt);
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_link(
- struct wmGizmoMapType *mmap_type,
+ struct wmGizmoMapType *gzmap_type,
const char *idname);
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_link_ptr(
- struct wmGizmoMapType *mmap_type,
- struct wmGizmoGroupType *wgt);
+ struct wmGizmoMapType *gzmap_type,
+ struct wmGizmoGroupType *gzgt);
void WM_gizmomaptype_group_init_runtime_keymap(
const struct Main *bmain,
- struct wmGizmoGroupType *wgt);
+ struct wmGizmoGroupType *gzgt);
void WM_gizmomaptype_group_init_runtime(
- const struct Main *bmain, struct wmGizmoMapType *mmap_type,
- struct wmGizmoGroupType *wgt);
+ const struct Main *bmain, struct wmGizmoMapType *gzmap_type,
+ struct wmGizmoGroupType *gzgt);
void WM_gizmomaptype_group_unlink(
- struct bContext *C, struct Main *bmain, struct wmGizmoMapType *mmap_type,
- const struct wmGizmoGroupType *wgt);
+ struct bContext *C, struct Main *bmain, struct wmGizmoMapType *gzmap_type,
+ const struct wmGizmoGroupType *gzgt);
-void WM_gizmomaptype_group_free(struct wmGizmoGroupTypeRef *wgt);
+void WM_gizmomaptype_group_free(struct wmGizmoGroupTypeRef *gzgt);
/* -------------------------------------------------------------------- */
/* GizmoGroup */
@@ -308,36 +308,36 @@ void WM_gizmomaptype_group_free(struct wmGizmoGroupTypeRef *wgt);
/* Add/Ensure/Remove (High level API) */
void WM_gizmo_group_type_add_ptr_ex(
- struct wmGizmoGroupType *wgt,
- struct wmGizmoMapType *mmap_type);
+ struct wmGizmoGroupType *gzgt,
+ struct wmGizmoMapType *gzmap_type);
void WM_gizmo_group_type_add_ptr(
- struct wmGizmoGroupType *wgt);
+ struct wmGizmoGroupType *gzgt);
void WM_gizmo_group_type_add(const char *idname);
void WM_gizmo_group_type_ensure_ptr_ex(
- struct wmGizmoGroupType *wgt,
- struct wmGizmoMapType *mmap_type);
+ struct wmGizmoGroupType *gzgt,
+ struct wmGizmoMapType *gzmap_type);
void WM_gizmo_group_type_ensure_ptr(
- struct wmGizmoGroupType *wgt);
+ struct wmGizmoGroupType *gzgt);
void WM_gizmo_group_type_ensure(const char *idname);
void WM_gizmo_group_type_remove_ptr_ex(
- struct Main *bmain, struct wmGizmoGroupType *wgt,
- struct wmGizmoMapType *mmap_type);
+ struct Main *bmain, struct wmGizmoGroupType *gzgt,
+ struct wmGizmoMapType *gzmap_type);
void WM_gizmo_group_type_remove_ptr(
- struct Main *bmain, struct wmGizmoGroupType *wgt);
+ struct Main *bmain, struct wmGizmoGroupType *gzgt);
void WM_gizmo_group_type_remove(struct Main *bmain, const char *idname);
void WM_gizmo_group_type_unlink_delayed_ptr_ex(
- struct wmGizmoGroupType *wgt,
- struct wmGizmoMapType *mmap_type);
+ struct wmGizmoGroupType *gzgt,
+ struct wmGizmoMapType *gzmap_type);
void WM_gizmo_group_type_unlink_delayed_ptr(
- struct wmGizmoGroupType *wgt);
+ struct wmGizmoGroupType *gzgt);
void WM_gizmo_group_type_unlink_delayed(const char *idname);
/* Utilities */
bool WM_gizmo_context_check_drawstep(const struct bContext *C, eWM_GizmoFlagMapDrawStep step);
-bool WM_gizmo_group_type_poll(const struct bContext *C, const struct wmGizmoGroupType *wgt);
+bool WM_gizmo_group_type_poll(const struct bContext *C, const struct wmGizmoGroupType *gzgt);
#endif /* __WM_GIZMO_API_H__ */
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
index ecdda256306..2339523db5e 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h
@@ -171,7 +171,7 @@ struct wmGizmo {
wmGizmoFnModal custom_modal;
/* pointer back to group this gizmo is in (just for quick access) */
- struct wmGizmoGroup *parent_mgroup;
+ struct wmGizmoGroup *parent_gzgroup;
void *py_instance;
@@ -385,7 +385,7 @@ typedef struct wmGizmoGroupType {
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag;
/* same as gizmo-maps, so registering/unregistering goes to the correct region */
- struct wmGizmoMapType_Params mmap_params;
+ struct wmGizmoMapType_Params gzmap_params;
} wmGizmoGroupType;
@@ -395,7 +395,7 @@ typedef struct wmGizmoGroup {
struct wmGizmoGroupType *type;
ListBase gizmos;
- struct wmGizmoMap *parent_mmap;
+ struct wmGizmoMap *parent_gzmap;
void *py_instance; /* python stores the class instance here */
struct ReportList *reports; /* errors and warnings storage */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
index da8b301b536..14deb0be725 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c
@@ -67,98 +67,98 @@
#include "wm_gizmo_intern.h"
static void wm_gizmo_register(
- wmGizmoGroup *mgroup, wmGizmo *mpr);
+ wmGizmoGroup *gzgroup, wmGizmo *gz);
/**
* \note Follow #wm_operator_create convention.
*/
static wmGizmo *wm_gizmo_create(
- const wmGizmoType *wt,
+ const wmGizmoType *gzt,
PointerRNA *properties)
{
- BLI_assert(wt != NULL);
- BLI_assert(wt->struct_size >= sizeof(wmGizmo));
+ BLI_assert(gzt != NULL);
+ BLI_assert(gzt->struct_size >= sizeof(wmGizmo));
- wmGizmo *mpr = MEM_callocN(
- wt->struct_size + (sizeof(wmGizmoProperty) * wt->target_property_defs_len), __func__);
- mpr->type = wt;
+ wmGizmo *gz = MEM_callocN(
+ gzt->struct_size + (sizeof(wmGizmoProperty) * gzt->target_property_defs_len), __func__);
+ gz->type = gzt;
/* initialize properties, either copy or create */
- mpr->ptr = MEM_callocN(sizeof(PointerRNA), "wmGizmoPtrRNA");
+ gz->ptr = MEM_callocN(sizeof(PointerRNA), "wmGizmoPtrRNA");
if (properties && properties->data) {
- mpr->properties = IDP_CopyProperty(properties->data);
+ gz->properties = IDP_CopyProperty(properties->data);
}
else {
IDPropertyTemplate val = {0};
- mpr->properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
+ gz->properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
}
- RNA_pointer_create(G_MAIN->wm.first, wt->srna, mpr->properties, mpr->ptr);
+ RNA_pointer_create(G_MAIN->wm.first, gzt->srna, gz->properties, gz->ptr);
- WM_gizmo_properties_sanitize(mpr->ptr, 0);
+ WM_gizmo_properties_sanitize(gz->ptr, 0);
- unit_m4(mpr->matrix_space);
- unit_m4(mpr->matrix_basis);
- unit_m4(mpr->matrix_offset);
+ unit_m4(gz->matrix_space);
+ unit_m4(gz->matrix_basis);
+ unit_m4(gz->matrix_offset);
- mpr->drag_part = -1;
+ gz->drag_part = -1;
- return mpr;
+ return gz;
}
wmGizmo *WM_gizmo_new_ptr(
- const wmGizmoType *wt, wmGizmoGroup *mgroup,
+ const wmGizmoType *gzt, wmGizmoGroup *gzgroup,
PointerRNA *properties)
{
- wmGizmo *mpr = wm_gizmo_create(wt, properties);
+ wmGizmo *gz = wm_gizmo_create(gzt, properties);
- wm_gizmo_register(mgroup, mpr);
+ wm_gizmo_register(gzgroup, gz);
- if (mpr->type->setup != NULL) {
- mpr->type->setup(mpr);
+ if (gz->type->setup != NULL) {
+ gz->type->setup(gz);
}
- return mpr;
+ return gz;
}
/**
- * \param wt: Must be valid,
+ * \param gt: Must be valid,
* if you need to check it exists use #WM_gizmo_new_ptr
* because callers of this function don't NULL check the return value.
*/
wmGizmo *WM_gizmo_new(
- const char *idname, wmGizmoGroup *mgroup,
+ const char *idname, wmGizmoGroup *gzgroup,
PointerRNA *properties)
{
- const wmGizmoType *wt = WM_gizmotype_find(idname, false);
- return WM_gizmo_new_ptr(wt, mgroup, properties);
+ const wmGizmoType *gzt = WM_gizmotype_find(idname, false);
+ return WM_gizmo_new_ptr(gzt, gzgroup, properties);
}
/**
* Initialize default values and allocate needed memory for members.
*/
-static void gizmo_init(wmGizmo *mpr)
+static void gizmo_init(wmGizmo *gz)
{
const float color_default[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- mpr->scale_basis = 1.0f;
- mpr->line_width = 1.0f;
+ gz->scale_basis = 1.0f;
+ gz->line_width = 1.0f;
/* defaults */
- copy_v4_v4(mpr->color, color_default);
- copy_v4_v4(mpr->color_hi, color_default);
+ copy_v4_v4(gz->color, color_default);
+ copy_v4_v4(gz->color_hi, color_default);
}
/**
* Register \a gizmo.
*
- * \param name: name used to create a unique idname for \a gizmo in \a mgroup
+ * \param name: name used to create a unique idname for \a gizmo in \a gzgroup
*
* \note Not to be confused with type registration from RNA.
*/
-static void wm_gizmo_register(wmGizmoGroup *mgroup, wmGizmo *mpr)
+static void wm_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
{
- gizmo_init(mpr);
- wm_gizmogroup_gizmo_register(mgroup, mpr);
+ gizmo_init(gz);
+ wm_gizmogroup_gizmo_register(gzgroup, gz);
}
/**
@@ -166,70 +166,70 @@ static void wm_gizmo_register(wmGizmoGroup *mgroup, wmGizmo *mpr)
* Typical use is when freeing the windowing data,
* where caller can manage clearing selection, highlight... etc.
*/
-void WM_gizmo_free(wmGizmo *mpr)
+void WM_gizmo_free(wmGizmo *gz)
{
- if (mpr->type->free != NULL) {
- mpr->type->free(mpr);
+ if (gz->type->free != NULL) {
+ gz->type->free(gz);
}
#ifdef WITH_PYTHON
- if (mpr->py_instance) {
+ if (gz->py_instance) {
/* do this first in case there are any __del__ functions or
* similar that use properties */
- BPY_DECREF_RNA_INVALIDATE(mpr->py_instance);
+ BPY_DECREF_RNA_INVALIDATE(gz->py_instance);
}
#endif
- if (mpr->op_data) {
- for (int i = 0; i < mpr->op_data_len; i++) {
- WM_operator_properties_free(&mpr->op_data[i].ptr);
+ if (gz->op_data) {
+ for (int i = 0; i < gz->op_data_len; i++) {
+ WM_operator_properties_free(&gz->op_data[i].ptr);
}
- MEM_freeN(mpr->op_data);
+ MEM_freeN(gz->op_data);
}
- if (mpr->ptr != NULL) {
- WM_gizmo_properties_free(mpr->ptr);
- MEM_freeN(mpr->ptr);
+ if (gz->ptr != NULL) {
+ WM_gizmo_properties_free(gz->ptr);
+ MEM_freeN(gz->ptr);
}
- if (mpr->type->target_property_defs_len != 0) {
- wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr);
- for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
- wmGizmoProperty *mpr_prop = &mpr_prop_array[i];
- if (mpr_prop->custom_func.free_fn) {
- mpr_prop->custom_func.free_fn(mpr, mpr_prop);
+ if (gz->type->target_property_defs_len != 0) {
+ wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz);
+ for (int i = 0; i < gz->type->target_property_defs_len; i++) {
+ wmGizmoProperty *gz_prop = &gz_prop_array[i];
+ if (gz_prop->custom_func.free_fn) {
+ gz_prop->custom_func.free_fn(gz, gz_prop);
}
}
}
- MEM_freeN(mpr);
+ MEM_freeN(gz);
}
/**
* Free \a gizmo and unlink from \a gizmolist.
* \a gizmolist is allowed to be NULL.
*/
-void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *mmap, wmGizmo *mpr, bContext *C)
+void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *gzmap, wmGizmo *gz, bContext *C)
{
- if (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) {
- wm_gizmomap_highlight_set(mmap, C, NULL, 0);
+ if (gz->state & WM_GIZMO_STATE_HIGHLIGHT) {
+ wm_gizmomap_highlight_set(gzmap, C, NULL, 0);
}
- if (mpr->state & WM_GIZMO_STATE_MODAL) {
- wm_gizmomap_modal_set(mmap, C, mpr, NULL, false);
+ if (gz->state & WM_GIZMO_STATE_MODAL) {
+ wm_gizmomap_modal_set(gzmap, C, gz, NULL, false);
}
/* Unlink instead of setting so we don't run callbacks. */
- if (mpr->state & WM_GIZMO_STATE_SELECT) {
- WM_gizmo_select_unlink(mmap, mpr);
+ if (gz->state & WM_GIZMO_STATE_SELECT) {
+ WM_gizmo_select_unlink(gzmap, gz);
}
if (gizmolist) {
- BLI_remlink(gizmolist, mpr);
+ BLI_remlink(gizmolist, gz);
}
- BLI_assert(mmap->mmap_context.highlight != mpr);
- BLI_assert(mmap->mmap_context.modal != mpr);
+ BLI_assert(gzmap->gzmap_context.highlight != gz);
+ BLI_assert(gzmap->gzmap_context.modal != gz);
- WM_gizmo_free(mpr);
+ WM_gizmo_free(gz);
}
/* -------------------------------------------------------------------- */
@@ -240,25 +240,25 @@ void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *mmap, wmGizmo *mpr, bConte
* \{ */
struct wmGizmoOpElem *WM_gizmo_operator_get(
- wmGizmo *mpr, int part_index)
+ wmGizmo *gz, int part_index)
{
- if (mpr->op_data && ((part_index >= 0) && (part_index < mpr->op_data_len))) {
- return &mpr->op_data[part_index];
+ if (gz->op_data && ((part_index >= 0) && (part_index < gz->op_data_len))) {
+ return &gz->op_data[part_index];
}
return NULL;
}
PointerRNA *WM_gizmo_operator_set(
- wmGizmo *mpr, int part_index,
+ wmGizmo *gz, int part_index,
wmOperatorType *ot, IDProperty *properties)
{
BLI_assert(part_index < 255);
/* We could pre-allocate these but using multiple is such a rare thing. */
- if (part_index >= mpr->op_data_len) {
- mpr->op_data_len = part_index + 1;
- mpr->op_data = MEM_recallocN(mpr->op_data, sizeof(*mpr->op_data) * mpr->op_data_len);
+ if (part_index >= gz->op_data_len) {
+ gz->op_data_len = part_index + 1;
+ gz->op_data = MEM_recallocN(gz->op_data, sizeof(*gz->op_data) * gz->op_data_len);
}
- wmGizmoOpElem *mpop = &mpr->op_data[part_index];
+ wmGizmoOpElem *mpop = &gz->op_data[part_index];
mpop->type = ot;
if (mpop->ptr.data) {
@@ -305,56 +305,56 @@ static void wm_gizmo_set_matrix_rotation_from_yz_axis__internal(
* wmGizmo.matrix utils.
*/
void WM_gizmo_set_matrix_rotation_from_z_axis(
- wmGizmo *mpr, const float z_axis[3])
+ wmGizmo *gz, const float z_axis[3])
{
- wm_gizmo_set_matrix_rotation_from_z_axis__internal(mpr->matrix_basis, z_axis);
+ wm_gizmo_set_matrix_rotation_from_z_axis__internal(gz->matrix_basis, z_axis);
}
void WM_gizmo_set_matrix_rotation_from_yz_axis(
- wmGizmo *mpr, const float y_axis[3], const float z_axis[3])
+ wmGizmo *gz, const float y_axis[3], const float z_axis[3])
{
- wm_gizmo_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_basis, y_axis, z_axis);
+ wm_gizmo_set_matrix_rotation_from_yz_axis__internal(gz->matrix_basis, y_axis, z_axis);
}
-void WM_gizmo_set_matrix_location(wmGizmo *mpr, const float origin[3])
+void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
{
- copy_v3_v3(mpr->matrix_basis[3], origin);
+ copy_v3_v3(gz->matrix_basis[3], origin);
}
/**
* wmGizmo.matrix_offset utils.
*/
void WM_gizmo_set_matrix_offset_rotation_from_z_axis(
- wmGizmo *mpr, const float z_axis[3])
+ wmGizmo *gz, const float z_axis[3])
{
- wm_gizmo_set_matrix_rotation_from_z_axis__internal(mpr->matrix_offset, z_axis);
+ wm_gizmo_set_matrix_rotation_from_z_axis__internal(gz->matrix_offset, z_axis);
}
void WM_gizmo_set_matrix_offset_rotation_from_yz_axis(
- wmGizmo *mpr, const float y_axis[3], const float z_axis[3])
+ wmGizmo *gz, const float y_axis[3], const float z_axis[3])
{
- wm_gizmo_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_offset, y_axis, z_axis);
+ wm_gizmo_set_matrix_rotation_from_yz_axis__internal(gz->matrix_offset, y_axis, z_axis);
}
-void WM_gizmo_set_matrix_offset_location(wmGizmo *mpr, const float offset[3])
+void WM_gizmo_set_matrix_offset_location(wmGizmo *gz, const float offset[3])
{
- copy_v3_v3(mpr->matrix_offset[3], offset);
+ copy_v3_v3(gz->matrix_offset[3], offset);
}
-void WM_gizmo_set_flag(wmGizmo *mpr, const int flag, const bool enable)
+void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
{
if (enable) {
- mpr->flag |= flag;
+ gz->flag |= flag;
}
else {
- mpr->flag &= ~flag;
+ gz->flag &= ~flag;
}
}
-void WM_gizmo_set_scale(wmGizmo *mpr, const float scale)
+void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
{
- mpr->scale_basis = scale;
+ gz->scale_basis = scale;
}
-void WM_gizmo_set_line_width(wmGizmo *mpr, const float line_width)
+void WM_gizmo_set_line_width(wmGizmo *gz, const float line_width)
{
- mpr->line_width = line_width;
+ gz->line_width = line_width;
}
/**
@@ -363,22 +363,22 @@ void WM_gizmo_set_line_width(wmGizmo *mpr, const float line_width)
* \param col Normal state color.
* \param col_hi Highlighted state color.
*/
-void WM_gizmo_get_color(const wmGizmo *mpr, float color[4])
+void WM_gizmo_get_color(const wmGizmo *gz, float color[4])
{
- copy_v4_v4(color, mpr->color);
+ copy_v4_v4(color, gz->color);
}
-void WM_gizmo_set_color(wmGizmo *mpr, const float color[4])
+void WM_gizmo_set_color(wmGizmo *gz, const float color[4])
{
- copy_v4_v4(mpr->color, color);
+ copy_v4_v4(gz->color, color);
}
-void WM_gizmo_get_color_highlight(const wmGizmo *mpr, float color_hi[4])
+void WM_gizmo_get_color_highlight(const wmGizmo *gz, float color_hi[4])
{
- copy_v4_v4(color_hi, mpr->color_hi);
+ copy_v4_v4(color_hi, gz->color_hi);
}
-void WM_gizmo_set_color_highlight(wmGizmo *mpr, const float color_hi[4])
+void WM_gizmo_set_color_highlight(wmGizmo *gz, const float color_hi[4])
{
- copy_v4_v4(mpr->color_hi, color_hi);
+ copy_v4_v4(gz->color_hi, color_hi);
}
@@ -390,9 +390,9 @@ void WM_gizmo_set_color_highlight(wmGizmo *mpr, const float color_hi[4])
*
* \{ */
-void WM_gizmo_set_fn_custom_modal(struct wmGizmo *mpr, wmGizmoFnModal fn)
+void WM_gizmo_set_fn_custom_modal(struct wmGizmo *gz, wmGizmoFnModal fn)
{
- mpr->custom_modal = fn;
+ gz->custom_modal = fn;
}
/** \} */
@@ -407,26 +407,26 @@ void WM_gizmo_set_fn_custom_modal(struct wmGizmo *mpr, wmGizmoFnModal fn)
* \return if the selection has changed.
*/
bool wm_gizmo_select_set_ex(
- wmGizmoMap *mmap, wmGizmo *mpr, bool select,
+ wmGizmoMap *gzmap, wmGizmo *gz, bool select,
bool use_array, bool use_callback)
{
bool changed = false;
if (select) {
- if ((mpr->state & WM_GIZMO_STATE_SELECT) == 0) {
+ if ((gz->state & WM_GIZMO_STATE_SELECT) == 0) {
if (use_array) {
- wm_gizmomap_select_array_push_back(mmap, mpr);
+ wm_gizmomap_select_array_push_back(gzmap, gz);
}
- mpr->state |= WM_GIZMO_STATE_SELECT;
+ gz->state |= WM_GIZMO_STATE_SELECT;
changed = true;
}
}
else {
- if (mpr->state & WM_GIZMO_STATE_SELECT) {
+ if (gz->state & WM_GIZMO_STATE_SELECT) {
if (use_array) {
- wm_gizmomap_select_array_remove(mmap, mpr);
+ wm_gizmomap_select_array_remove(gzmap, gz);
}
- mpr->state &= ~WM_GIZMO_STATE_SELECT;
+ gz->state &= ~WM_GIZMO_STATE_SELECT;
changed = true;
}
}
@@ -434,8 +434,8 @@ bool wm_gizmo_select_set_ex(
/* In the case of unlinking we only want to remove from the array
* and not write to the external state */
if (use_callback && changed) {
- if (mpr->type->select_refresh) {
- mpr->type->select_refresh(mpr);
+ if (gz->type->select_refresh) {
+ gz->type->select_refresh(gz);
}
}
@@ -443,25 +443,25 @@ bool wm_gizmo_select_set_ex(
}
/* Remove from selection array without running callbacks. */
-bool WM_gizmo_select_unlink(wmGizmoMap *mmap, wmGizmo *mpr)
+bool WM_gizmo_select_unlink(wmGizmoMap *gzmap, wmGizmo *gz)
{
- return wm_gizmo_select_set_ex(mmap, mpr, false, true, false);
+ return wm_gizmo_select_set_ex(gzmap, gz, false, true, false);
}
-bool WM_gizmo_select_set(wmGizmoMap *mmap, wmGizmo *mpr, bool select)
+bool WM_gizmo_select_set(wmGizmoMap *gzmap, wmGizmo *gz, bool select)
{
- return wm_gizmo_select_set_ex(mmap, mpr, select, true, true);
+ return wm_gizmo_select_set_ex(gzmap, gz, select, true, true);
}
-void WM_gizmo_highlight_set(wmGizmoMap *mmap, wmGizmo *mpr)
+void WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
{
- wm_gizmomap_highlight_set(mmap, NULL, mpr, mpr ? mpr->highlight_part : 0);
+ wm_gizmomap_highlight_set(gzmap, NULL, gz, gz ? gz->highlight_part : 0);
}
-bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *mmap, wmGizmo *mpr)
+bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *gzmap, wmGizmo *gz)
{
- if (WM_gizmo_select_set(mmap, mpr, true)) {
- wm_gizmomap_highlight_set(mmap, C, mpr, mpr->highlight_part);
+ if (WM_gizmo_select_set(gzmap, gz, true)) {
+ wm_gizmomap_highlight_set(gzmap, C, gz, gz->highlight_part);
return true;
}
else {
@@ -475,13 +475,13 @@ bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *mmap, wmGizmo *mpr)
* We could do this when linking them, but this complicates things since the window update code needs to run first.
*/
void WM_gizmo_modal_set_from_setup(
- struct wmGizmoMap *mmap, struct bContext *C,
- struct wmGizmo *mpr, int part_index, const wmEvent *event)
+ struct wmGizmoMap *gzmap, struct bContext *C,
+ struct wmGizmo *gz, int part_index, const wmEvent *event)
{
- mpr->highlight_part = part_index;
- WM_gizmo_highlight_set(mmap, mpr);
+ gz->highlight_part = part_index;
+ WM_gizmo_highlight_set(gzmap, gz);
if (false) {
- wm_gizmomap_modal_set(mmap, C, mpr, event, true);
+ wm_gizmomap_modal_set(gzmap, C, gz, event, true);
}
else {
/* WEAK: but it works. */
@@ -489,23 +489,23 @@ void WM_gizmo_modal_set_from_setup(
}
}
-void wm_gizmo_calculate_scale(wmGizmo *mpr, const bContext *C)
+void wm_gizmo_calculate_scale(wmGizmo *gz, const bContext *C)
{
const RegionView3D *rv3d = CTX_wm_region_view3d(C);
float scale = UI_DPI_FAC;
- if ((mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
+ if ((gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) {
scale *= U.gizmo_size;
if (rv3d) {
/* 'ED_view3d_pixel_size' includes 'U.pixelsize', remove it. */
float matrix_world[4][4];
- if (mpr->type->matrix_basis_get) {
+ if (gz->type->matrix_basis_get) {
float matrix_basis[4][4];
- mpr->type->matrix_basis_get(mpr, matrix_basis);
- mul_m4_m4m4(matrix_world, mpr->matrix_space, matrix_basis);
+ gz->type->matrix_basis_get(gz, matrix_basis);
+ mul_m4_m4m4(matrix_world, gz->matrix_space, matrix_basis);
}
else {
- mul_m4_m4m4(matrix_world, mpr->matrix_space, mpr->matrix_basis);
+ mul_m4_m4m4(matrix_world, gz->matrix_space, gz->matrix_basis);
}
/* Exclude matrix_offset from scale. */
@@ -516,45 +516,45 @@ void wm_gizmo_calculate_scale(wmGizmo *mpr, const bContext *C)
}
}
- mpr->scale_final = mpr->scale_basis * scale;
+ gz->scale_final = gz->scale_basis * scale;
}
-static void gizmo_update_prop_data(wmGizmo *mpr)
+static void gizmo_update_prop_data(wmGizmo *gz)
{
/* gizmo property might have been changed, so update gizmo */
- if (mpr->type->property_update) {
- wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr);
- for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
- wmGizmoProperty *mpr_prop = &mpr_prop_array[i];
- if (WM_gizmo_target_property_is_valid(mpr_prop)) {
- mpr->type->property_update(mpr, mpr_prop);
+ if (gz->type->property_update) {
+ wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz);
+ for (int i = 0; i < gz->type->target_property_defs_len; i++) {
+ wmGizmoProperty *gz_prop = &gz_prop_array[i];
+ if (WM_gizmo_target_property_is_valid(gz_prop)) {
+ gz->type->property_update(gz, gz_prop);
}
}
}
}
-void wm_gizmo_update(wmGizmo *mpr, const bContext *C, const bool refresh_map)
+void wm_gizmo_update(wmGizmo *gz, const bContext *C, const bool refresh_map)
{
if (refresh_map) {
- gizmo_update_prop_data(mpr);
+ gizmo_update_prop_data(gz);
}
- wm_gizmo_calculate_scale(mpr, C);
+ wm_gizmo_calculate_scale(gz, C);
}
-int wm_gizmo_is_visible(wmGizmo *mpr)
+int wm_gizmo_is_visible(wmGizmo *gz)
{
- if (mpr->flag & WM_GIZMO_HIDDEN) {
+ if (gz->flag & WM_GIZMO_HIDDEN) {
return 0;
}
- if ((mpr->state & WM_GIZMO_STATE_MODAL) &&
- !(mpr->flag & (WM_GIZMO_DRAW_MODAL | WM_GIZMO_DRAW_VALUE)))
+ if ((gz->state & WM_GIZMO_STATE_MODAL) &&
+ !(gz->flag & (WM_GIZMO_DRAW_MODAL | WM_GIZMO_DRAW_VALUE)))
{
/* don't draw while modal (dragging) */
return 0;
}
- if ((mpr->flag & WM_GIZMO_DRAW_HOVER) &&
- !(mpr->state & WM_GIZMO_STATE_HIGHLIGHT) &&
- !(mpr->state & WM_GIZMO_STATE_SELECT)) /* still draw selected gizmos */
+ if ((gz->flag & WM_GIZMO_DRAW_HOVER) &&
+ !(gz->state & WM_GIZMO_STATE_HIGHLIGHT) &&
+ !(gz->state & WM_GIZMO_STATE_SELECT)) /* still draw selected gizmos */
{
/* update but don't draw */
return WM_GIZMO_IS_VISIBLE_UPDATE;
@@ -564,28 +564,28 @@ int wm_gizmo_is_visible(wmGizmo *mpr)
}
void WM_gizmo_calc_matrix_final_params(
- const wmGizmo *mpr,
+ const wmGizmo *gz,
const struct WM_GizmoMatrixParams *params,
float r_mat[4][4])
{
- const float (* const matrix_space)[4] = params->matrix_space ? params->matrix_space : mpr->matrix_space;
- const float (* const matrix_basis)[4] = params->matrix_basis ? params->matrix_basis : mpr->matrix_basis;
- const float (* const matrix_offset)[4] = params->matrix_offset ? params->matrix_offset : mpr->matrix_offset;
- const float *scale_final = params->scale_final ? params->scale_final : &mpr->scale_final;
+ const float (* const matrix_space)[4] = params->matrix_space ? params->matrix_space : gz->matrix_space;
+ const float (* const matrix_basis)[4] = params->matrix_basis ? params->matrix_basis : gz->matrix_basis;
+ const float (* const matrix_offset)[4] = params->matrix_offset ? params->matrix_offset : gz->matrix_offset;
+ const float *scale_final = params->scale_final ? params->scale_final : &gz->scale_final;
float final_matrix[4][4];
- if (params->matrix_basis == NULL && mpr->type->matrix_basis_get) {
- mpr->type->matrix_basis_get(mpr, final_matrix);
+ if (params->matrix_basis == NULL && gz->type->matrix_basis_get) {
+ gz->type->matrix_basis_get(gz, final_matrix);
}
else {
copy_m4_m4(final_matrix, matrix_basis);
}
- if (mpr->flag & WM_GIZMO_DRAW_NO_SCALE) {
+ if (gz->flag & WM_GIZMO_DRAW_NO_SCALE) {
mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
}
else {
- if (mpr->flag & WM_GIZMO_DRAW_OFFSET_SCALE) {
+ if (gz->flag & WM_GIZMO_DRAW_OFFSET_SCALE) {
mul_mat3_m4_fl(final_matrix, *scale_final);
mul_m4_m4m4(final_matrix, final_matrix, matrix_offset);
}
@@ -598,13 +598,13 @@ void WM_gizmo_calc_matrix_final_params(
mul_m4_m4m4(r_mat, matrix_space, final_matrix);
}
-void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *mpr, float r_mat[4][4])
+void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *gz, float r_mat[4][4])
{
float mat_identity[4][4];
unit_m4(mat_identity);
WM_gizmo_calc_matrix_final_params(
- mpr,
+ gz,
&((struct WM_GizmoMatrixParams) {
.matrix_space = NULL,
.matrix_basis = NULL,
@@ -614,10 +614,10 @@ void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *mpr, float r_mat[4][4])
);
}
-void WM_gizmo_calc_matrix_final(const wmGizmo *mpr, float r_mat[4][4])
+void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
{
WM_gizmo_calc_matrix_final_params(
- mpr,
+ gz,
&((struct WM_GizmoMatrixParams) {
.matrix_space = NULL,
.matrix_basis = NULL,
@@ -634,24 +634,24 @@ void WM_gizmo_calc_matrix_final(const wmGizmo *mpr, float r_mat[4][4])
* \{ */
-void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *wt)
+void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *gzt)
{
- RNA_pointer_create(NULL, wt->srna, NULL, ptr);
+ RNA_pointer_create(NULL, gzt->srna, NULL, ptr);
}
-void WM_gizmo_properties_create(PointerRNA *ptr, const char *wtstring)
+void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
{
- const wmGizmoType *wt = WM_gizmotype_find(wtstring, false);
+ const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
- if (wt)
- WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)wt);
+ if (gzt)
+ WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)gzt);
else
RNA_pointer_create(NULL, &RNA_GizmoProperties, NULL, ptr);
}
/* similar to the function above except its uses ID properties
* used for keymaps and macros */
-void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *wtstring)
+void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *gtstring)
{
if (*properties == NULL) {
IDPropertyTemplate val = {0};
@@ -660,7 +660,7 @@ void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const
if (*ptr == NULL) {
*ptr = MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
- WM_gizmo_properties_create(*ptr, wtstring);
+ WM_gizmo_properties_create(*ptr, gtstring);
}
(*ptr)->data = *properties;
@@ -733,19 +733,19 @@ bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update)
}
/* remove all props without PROP_SKIP_SAVE */
-void WM_gizmo_properties_reset(wmGizmo *mpr)
+void WM_gizmo_properties_reset(wmGizmo *gz)
{
- if (mpr->ptr->data) {
+ if (gz->ptr->data) {
PropertyRNA *iterprop;
- iterprop = RNA_struct_iterator_property(mpr->type->srna);
+ iterprop = RNA_struct_iterator_property(gz->type->srna);
- RNA_PROP_BEGIN (mpr->ptr, itemptr, iterprop)
+ RNA_PROP_BEGIN (gz->ptr, itemptr, iterprop)
{
PropertyRNA *prop = itemptr.data;
if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
const char *identifier = RNA_property_identifier(prop);
- RNA_struct_idprops_unset(mpr->ptr, identifier);
+ RNA_struct_idprops_unset(gz->ptr, identifier);
}
}
RNA_PROP_END;
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index f30744859aa..3ba9fa71601 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -74,87 +74,87 @@
* \{ */
/**
- * Create a new gizmo-group from \a wgt.
+ * Create a new gizmo-group from \a gzgt.
*/
wmGizmoGroup *wm_gizmogroup_new_from_type(
- wmGizmoMap *mmap, wmGizmoGroupType *wgt)
+ wmGizmoMap *gzmap, wmGizmoGroupType *gzgt)
{
- wmGizmoGroup *mgroup = MEM_callocN(sizeof(*mgroup), "gizmo-group");
- mgroup->type = wgt;
+ wmGizmoGroup *gzgroup = MEM_callocN(sizeof(*gzgroup), "gizmo-group");
+ gzgroup->type = gzgt;
/* keep back-link */
- mgroup->parent_mmap = mmap;
+ gzgroup->parent_gzmap = gzmap;
- BLI_addtail(&mmap->groups, mgroup);
+ BLI_addtail(&gzmap->groups, gzgroup);
- return mgroup;
+ return gzgroup;
}
-void wm_gizmogroup_free(bContext *C, wmGizmoGroup *mgroup)
+void wm_gizmogroup_free(bContext *C, wmGizmoGroup *gzgroup)
{
- wmGizmoMap *mmap = mgroup->parent_mmap;
+ wmGizmoMap *gzmap = gzgroup->parent_gzmap;
- /* Similar to WM_gizmo_unlink, but only to keep mmap state correct,
+ /* Similar to WM_gizmo_unlink, but only to keep gzmap state correct,
* we don't want to run callbacks. */
- if (mmap->mmap_context.highlight && mmap->mmap_context.highlight->parent_mgroup == mgroup) {
- wm_gizmomap_highlight_set(mmap, C, NULL, 0);
+ if (gzmap->gzmap_context.highlight && gzmap->gzmap_context.highlight->parent_gzgroup == gzgroup) {
+ wm_gizmomap_highlight_set(gzmap, C, NULL, 0);
}
- if (mmap->mmap_context.modal && mmap->mmap_context.modal->parent_mgroup == mgroup) {
- wm_gizmomap_modal_set(mmap, C, mmap->mmap_context.modal, NULL, false);
+ if (gzmap->gzmap_context.modal && gzmap->gzmap_context.modal->parent_gzgroup == gzgroup) {
+ wm_gizmomap_modal_set(gzmap, C, gzmap->gzmap_context.modal, NULL, false);
}
- for (wmGizmo *mpr = mgroup->gizmos.first, *mpr_next; mpr; mpr = mpr_next) {
- mpr_next = mpr->next;
- if (mmap->mmap_context.select.len) {
- WM_gizmo_select_unlink(mmap, mpr);
+ for (wmGizmo *gz = gzgroup->gizmos.first, *gz_next; gz; gz = gz_next) {
+ gz_next = gz->next;
+ if (gzmap->gzmap_context.select.len) {
+ WM_gizmo_select_unlink(gzmap, gz);
}
- WM_gizmo_free(mpr);
+ WM_gizmo_free(gz);
}
- BLI_listbase_clear(&mgroup->gizmos);
+ BLI_listbase_clear(&gzgroup->gizmos);
#ifdef WITH_PYTHON
- if (mgroup->py_instance) {
+ if (gzgroup->py_instance) {
/* do this first in case there are any __del__ functions or
* similar that use properties */
- BPY_DECREF_RNA_INVALIDATE(mgroup->py_instance);
+ BPY_DECREF_RNA_INVALIDATE(gzgroup->py_instance);
}
#endif
- if (mgroup->reports && (mgroup->reports->flag & RPT_FREE)) {
- BKE_reports_clear(mgroup->reports);
- MEM_freeN(mgroup->reports);
+ if (gzgroup->reports && (gzgroup->reports->flag & RPT_FREE)) {
+ BKE_reports_clear(gzgroup->reports);
+ MEM_freeN(gzgroup->reports);
}
- if (mgroup->customdata_free) {
- mgroup->customdata_free(mgroup->customdata);
+ if (gzgroup->customdata_free) {
+ gzgroup->customdata_free(gzgroup->customdata);
}
else {
- MEM_SAFE_FREE(mgroup->customdata);
+ MEM_SAFE_FREE(gzgroup->customdata);
}
- BLI_remlink(&mmap->groups, mgroup);
+ BLI_remlink(&gzmap->groups, gzgroup);
- MEM_freeN(mgroup);
+ MEM_freeN(gzgroup);
}
/**
- * Add \a gizmo to \a mgroup and make sure its name is unique within the group.
+ * Add \a gizmo to \a gzgroup and make sure its name is unique within the group.
*/
-void wm_gizmogroup_gizmo_register(wmGizmoGroup *mgroup, wmGizmo *mpr)
+void wm_gizmogroup_gizmo_register(wmGizmoGroup *gzgroup, wmGizmo *gz)
{
- BLI_assert(BLI_findindex(&mgroup->gizmos, mpr) == -1);
- BLI_addtail(&mgroup->gizmos, mpr);
- mpr->parent_mgroup = mgroup;
+ BLI_assert(BLI_findindex(&gzgroup->gizmos, gz) == -1);
+ BLI_addtail(&gzgroup->gizmos, gz);
+ gz->parent_gzgroup = gzgroup;
}
wmGizmo *wm_gizmogroup_find_intersected_gizmo(
- const wmGizmoGroup *mgroup, bContext *C, const wmEvent *event,
+ const wmGizmoGroup *gzgroup, bContext *C, const wmEvent *event,
int *r_part)
{
- for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- if (mpr->type->test_select && (mpr->flag & WM_GIZMO_HIDDEN) == 0) {
- if ((*r_part = mpr->type->test_select(C, mpr, event)) != -1) {
- return mpr;
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if (gz->type->test_select && (gz->flag & WM_GIZMO_HIDDEN) == 0) {
+ if ((*r_part = gz->type->test_select(C, gz, event->mval)) != -1) {
+ return gz;
}
}
}
@@ -163,78 +163,78 @@ wmGizmo *wm_gizmogroup_find_intersected_gizmo(
}
/**
- * Adds all gizmos of \a mgroup that can be selected to the head of \a listbase. Added items need freeing!
+ * Adds all gizmos of \a gzgroup that can be selected to the head of \a listbase. Added items need freeing!
*/
-void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *mgroup, ListBase *listbase)
+void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *gzgroup, ListBase *listbase)
{
- for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- if ((mpr->flag & WM_GIZMO_HIDDEN) == 0) {
- if (((mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) && mpr->type->draw_select) ||
- ((mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0 && mpr->type->test_select))
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if ((gz->flag & WM_GIZMO_HIDDEN) == 0) {
+ if (((gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) && (gz->type->draw_select || gz->type->test_select)) ||
+ ((gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0 && gz->type->test_select))
{
- BLI_addhead(listbase, BLI_genericNodeN(mpr));
+ BLI_addhead(listbase, BLI_genericNodeN(gz));
}
}
}
}
-void wm_gizmogroup_ensure_initialized(wmGizmoGroup *mgroup, const bContext *C)
+void wm_gizmogroup_ensure_initialized(wmGizmoGroup *gzgroup, const bContext *C)
{
/* prepare for first draw */
- if (UNLIKELY((mgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0)) {
- mgroup->type->setup(C, mgroup);
+ if (UNLIKELY((gzgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0)) {
+ gzgroup->type->setup(C, gzgroup);
/* Not ideal, initialize keymap here, needed for RNA runtime generated gizmos. */
- wmGizmoGroupType *wgt = mgroup->type;
- if (wgt->keymap == NULL) {
+ wmGizmoGroupType *gzgt = gzgroup->type;
+ if (gzgt->keymap == NULL) {
wmWindowManager *wm = CTX_wm_manager(C);
- wm_gizmogrouptype_setup_keymap(wgt, wm->defaultconf);
- BLI_assert(wgt->keymap != NULL);
+ wm_gizmogrouptype_setup_keymap(gzgt, wm->defaultconf);
+ BLI_assert(gzgt->keymap != NULL);
}
- mgroup->init_flag |= WM_GIZMOGROUP_INIT_SETUP;
+ gzgroup->init_flag |= WM_GIZMOGROUP_INIT_SETUP;
}
/* refresh may be called multiple times, this just ensures its called at least once before we draw. */
- if (UNLIKELY((mgroup->init_flag & WM_GIZMOGROUP_INIT_REFRESH) == 0)) {
- if (mgroup->type->refresh) {
- mgroup->type->refresh(C, mgroup);
+ if (UNLIKELY((gzgroup->init_flag & WM_GIZMOGROUP_INIT_REFRESH) == 0)) {
+ if (gzgroup->type->refresh) {
+ gzgroup->type->refresh(C, gzgroup);
}
- mgroup->init_flag |= WM_GIZMOGROUP_INIT_REFRESH;
+ gzgroup->init_flag |= WM_GIZMOGROUP_INIT_REFRESH;
}
}
-bool WM_gizmo_group_type_poll(const bContext *C, const struct wmGizmoGroupType *wgt)
+bool WM_gizmo_group_type_poll(const bContext *C, const struct wmGizmoGroupType *gzgt)
{
/* If we're tagged, only use compatible. */
- if (wgt->owner_id[0] != '\0') {
+ if (gzgt->owner_id[0] != '\0') {
const WorkSpace *workspace = CTX_wm_workspace(C);
- if (BKE_workspace_owner_id_check(workspace, wgt->owner_id) == false) {
+ if (BKE_workspace_owner_id_check(workspace, gzgt->owner_id) == false) {
return false;
}
}
/* Check for poll function, if gizmo-group belongs to an operator, also check if the operator is running. */
- return (!wgt->poll || wgt->poll(C, (wmGizmoGroupType *)wgt));
+ return (!gzgt->poll || gzgt->poll(C, (wmGizmoGroupType *)gzgt));
}
bool wm_gizmogroup_is_visible_in_drawstep(
- const wmGizmoGroup *mgroup, const eWM_GizmoFlagMapDrawStep drawstep)
+ const wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep)
{
switch (drawstep) {
case WM_GIZMOMAP_DRAWSTEP_2D:
- return (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0;
+ return (gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0;
case WM_GIZMOMAP_DRAWSTEP_3D:
- return (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D);
+ return (gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D);
default:
BLI_assert(0);
return false;
}
}
-bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *mgroup)
+bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *gzgroup)
{
- if (mgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT) {
- for (const wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- if (mpr->state & WM_GIZMO_STATE_SELECT) {
+ if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT) {
+ for (const wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if (gz->state & WM_GIZMO_STATE_SELECT) {
return true;
}
}
@@ -253,9 +253,9 @@ bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *mgroup)
static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *mmap = ar->gizmo_map;
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
- wmGizmo *highlight = mmap->mmap_context.highlight;
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
+ wmGizmo *highlight = gzmap->gzmap_context.highlight;
bool extend = RNA_boolean_get(op->ptr, "extend");
bool deselect = RNA_boolean_get(op->ptr, "deselect");
@@ -263,7 +263,7 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
/* deselect all first */
if (extend == false && deselect == false && toggle == false) {
- wm_gizmomap_deselect_all(mmap);
+ wm_gizmomap_deselect_all(gzmap);
BLI_assert(msel->items == NULL && msel->len == 0);
UNUSED_VARS_NDEBUG(msel);
}
@@ -278,11 +278,11 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
}
if (deselect) {
- if (is_selected && WM_gizmo_select_set(mmap, highlight, false)) {
+ if (is_selected && WM_gizmo_select_set(gzmap, highlight, false)) {
redraw = true;
}
}
- else if (wm_gizmo_select_and_highlight(C, mmap, highlight)) {
+ else if (wm_gizmo_select_and_highlight(C, gzmap, highlight)) {
redraw = true;
}
@@ -296,8 +296,6 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
BLI_assert(0);
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
-
- return OPERATOR_PASS_THROUGH;
}
void GIZMOGROUP_OT_gizmo_select(wmOperatorType *ot)
@@ -316,9 +314,9 @@ void GIZMOGROUP_OT_gizmo_select(wmOperatorType *ot)
}
typedef struct GizmoTweakData {
- wmGizmoMap *mmap;
- wmGizmoGroup *mgroup;
- wmGizmo *mpr_modal;
+ wmGizmoMap *gzmap;
+ wmGizmoGroup *gzgroup;
+ wmGizmo *gz_modal;
int init_event; /* initial event type */
int flag; /* tweak flags */
@@ -342,18 +340,18 @@ typedef struct GizmoTweakData {
} GizmoTweakData;
static bool gizmo_tweak_start(
- bContext *C, wmGizmoMap *mmap, wmGizmo *mpr, const wmEvent *event)
+ bContext *C, wmGizmoMap *gzmap, wmGizmo *gz, const wmEvent *event)
{
/* activate highlighted gizmo */
- wm_gizmomap_modal_set(mmap, C, mpr, event, true);
+ wm_gizmomap_modal_set(gzmap, C, gz, event, true);
- return (mpr->state & WM_GIZMO_STATE_MODAL);
+ return (gz->state & WM_GIZMO_STATE_MODAL);
}
static bool gizmo_tweak_start_and_finish(
- bContext *C, wmGizmoMap *mmap, wmGizmo *mpr, const wmEvent *event, bool *r_is_modal)
+ bContext *C, wmGizmoMap *gzmap, wmGizmo *gz, const wmEvent *event, bool *r_is_modal)
{
- wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part);
+ wmGizmoOpElem *mpop = WM_gizmo_operator_get(gz, gz->highlight_part);
if (r_is_modal) {
*r_is_modal = false;
}
@@ -377,7 +375,7 @@ static bool gizmo_tweak_start_and_finish(
* conflicting with modal operator attached to gizmo */
if (mpop->type->modal) {
/* activate highlighted gizmo */
- wm_gizmomap_modal_set(mmap, C, mpr, event, true);
+ wm_gizmomap_modal_set(gzmap, C, gz, event, true);
if (r_is_modal) {
*r_is_modal = true;
}
@@ -396,15 +394,15 @@ static bool gizmo_tweak_start_and_finish(
static void gizmo_tweak_finish(bContext *C, wmOperator *op, const bool cancel, bool clear_modal)
{
GizmoTweakData *mtweak = op->customdata;
- if (mtweak->mpr_modal->type->exit) {
- mtweak->mpr_modal->type->exit(C, mtweak->mpr_modal, cancel);
+ if (mtweak->gz_modal->type->exit) {
+ mtweak->gz_modal->type->exit(C, mtweak->gz_modal, cancel);
}
if (clear_modal) {
/* The gizmo may have been removed. */
- if ((BLI_findindex(&mtweak->mmap->groups, mtweak->mgroup) != -1) &&
- (BLI_findindex(&mtweak->mgroup->gizmos, mtweak->mpr_modal) != -1))
+ if ((BLI_findindex(&mtweak->gzmap->groups, mtweak->gzgroup) != -1) &&
+ (BLI_findindex(&mtweak->gzgroup->gizmos, mtweak->gz_modal) != -1))
{
- wm_gizmomap_modal_set(mtweak->mmap, C, mtweak->mpr_modal, NULL, false);
+ wm_gizmomap_modal_set(mtweak->gzmap, C, mtweak->gz_modal, NULL, false);
}
}
MEM_freeN(mtweak);
@@ -413,22 +411,22 @@ static void gizmo_tweak_finish(bContext *C, wmOperator *op, const bool cancel, b
static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
GizmoTweakData *mtweak = op->customdata;
- wmGizmo *mpr = mtweak->mpr_modal;
+ wmGizmo *gz = mtweak->gz_modal;
int retval = OPERATOR_PASS_THROUGH;
bool clear_modal = true;
- if (mpr == NULL) {
+ if (gz == NULL) {
BLI_assert(0);
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
#ifdef USE_DRAG_DETECT
- wmGizmoMap *mmap = mtweak->mmap;
+ wmGizmoMap *gzmap = mtweak->gzmap;
if (mtweak->drag_state == DRAG_DETECT) {
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
- if (len_manhattan_v2v2_int(&event->x, mmap->mmap_context.event_xy) > 2) {
+ if (len_manhattan_v2v2_int(&event->x, gzmap->gzmap_context.event_xy) > 2) {
mtweak->drag_state = DRAG_IDLE;
- mpr->highlight_part = mpr->drag_part;
+ gz->highlight_part = gz->drag_part;
}
}
else if (event->type == mtweak->init_event && event->val == KM_RELEASE) {
@@ -439,20 +437,20 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (mtweak->drag_state != DRAG_DETECT) {
/* Follow logic in 'gizmo_tweak_invoke' */
bool is_modal = false;
- if (gizmo_tweak_start_and_finish(C, mmap, mpr, event, &is_modal)) {
+ if (gizmo_tweak_start_and_finish(C, gzmap, gz, event, &is_modal)) {
if (is_modal) {
clear_modal = false;
}
}
else {
- if (!gizmo_tweak_start(C, mmap, mpr, event)) {
+ if (!gizmo_tweak_start(C, gzmap, gz, event)) {
retval = OPERATOR_FINISHED;
}
}
}
}
if (mtweak->drag_state == DRAG_IDLE) {
- if (mmap->mmap_context.modal != NULL) {
+ if (gzmap->gzmap_context.modal != NULL) {
return OPERATOR_PASS_THROUGH;
}
else {
@@ -498,9 +496,9 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* handle gizmo */
- wmGizmoFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal;
+ wmGizmoFnModal modal_fn = gz->custom_modal ? gz->custom_modal : gz->type->modal;
if (modal_fn) {
- int modal_retval = modal_fn(C, mpr, event, mtweak->flag);
+ int modal_retval = modal_fn(C, gz, event, mtweak->flag);
if ((modal_retval & OPERATOR_RUNNING_MODAL) == 0) {
gizmo_tweak_finish(C, op, (modal_retval & OPERATOR_CANCELLED) != 0, true);
@@ -520,13 +518,13 @@ static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *mmap = ar->gizmo_map;
- wmGizmo *mpr = mmap->mmap_context.highlight;
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmo *gz = gzmap->gzmap_context.highlight;
/* Needed for single click actions which don't enter modal state. */
WM_tooltip_clear(C, CTX_wm_window(C));
- if (!mpr) {
+ if (!gz) {
/* wm_handlers_do_intern shouldn't let this happen */
BLI_assert(0);
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
@@ -535,11 +533,11 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool use_drag_fallback = false;
#ifdef USE_DRAG_DETECT
- use_drag_fallback = !ELEM(mpr->drag_part, -1, mpr->highlight_part);
+ use_drag_fallback = !ELEM(gz->drag_part, -1, gz->highlight_part);
#endif
if (use_drag_fallback == false) {
- if (gizmo_tweak_start_and_finish(C, mmap, mpr, event, NULL)) {
+ if (gizmo_tweak_start_and_finish(C, gzmap, gz, event, NULL)) {
return OPERATOR_FINISHED;
}
}
@@ -547,7 +545,7 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool use_drag_detect = false;
#ifdef USE_DRAG_DETECT
if (use_drag_fallback) {
- wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part);
+ wmGizmoOpElem *mpop = WM_gizmo_operator_get(gz, gz->highlight_part);
if (mpop && mpop->type) {
if (mpop->type->modal == NULL) {
use_drag_detect = true;
@@ -557,7 +555,7 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
#endif
if (use_drag_detect == false) {
- if (!gizmo_tweak_start(C, mmap, mpr, event)) {
+ if (!gizmo_tweak_start(C, gzmap, gz, event)) {
/* failed to start */
return OPERATOR_PASS_THROUGH;
}
@@ -566,9 +564,9 @@ static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event)
GizmoTweakData *mtweak = MEM_mallocN(sizeof(GizmoTweakData), __func__);
mtweak->init_event = WM_userdef_event_type_from_keymap_type(event->type);
- mtweak->mpr_modal = mmap->mmap_context.highlight;
- mtweak->mgroup = mtweak->mpr_modal->parent_mgroup;
- mtweak->mmap = mmap;
+ mtweak->gz_modal = gzmap->gzmap_context.highlight;
+ mtweak->gzgroup = mtweak->gz_modal->parent_gzgroup;
+ mtweak->gzmap = gzmap;
mtweak->flag = 0;
#ifdef USE_DRAG_DETECT
@@ -603,7 +601,7 @@ void GIZMOGROUP_OT_gizmo_tweak(wmOperatorType *ot)
/** \} */
-static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char *mgroupname)
+static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char *gzgroupname)
{
wmKeyMap *keymap;
char name[KMAP_MAX_NAME];
@@ -619,7 +617,7 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
};
- BLI_snprintf(name, sizeof(name), "%s Tweak Modal Map", mgroupname);
+ BLI_snprintf(name, sizeof(name), "%s Tweak Modal Map", gzgroupname);
keymap = WM_modalkeymap_get(keyconf, name);
/* this function is called for each spacetype, only needs to add map once */
@@ -655,13 +653,13 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
* Common default keymap for gizmo groups
*/
wmKeyMap *WM_gizmogroup_keymap_common(
- const wmGizmoGroupType *wgt, wmKeyConfig *config)
+ const wmGizmoGroupType *gzgt, wmKeyConfig *config)
{
/* Use area and region id since we might have multiple gizmos with the same name in different areas/regions */
- wmKeyMap *km = WM_keymap_find(config, wgt->name, wgt->mmap_params.spaceid, wgt->mmap_params.regionid);
+ wmKeyMap *km = WM_keymap_find(config, gzgt->name, gzgt->gzmap_params.spaceid, gzgt->gzmap_params.regionid);
WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
- gizmogroup_tweak_modal_keymap(config, wgt->name);
+ gizmogroup_tweak_modal_keymap(config, gzgt->name);
return km;
}
@@ -670,14 +668,14 @@ wmKeyMap *WM_gizmogroup_keymap_common(
* Variation of #WM_gizmogroup_keymap_common but with keymap items for selection
*/
wmKeyMap *WM_gizmogroup_keymap_common_select(
- const wmGizmoGroupType *wgt, wmKeyConfig *config)
+ const wmGizmoGroupType *gzgt, wmKeyConfig *config)
{
/* Use area and region id since we might have multiple gizmos with the same name in different areas/regions */
- wmKeyMap *km = WM_keymap_find(config, wgt->name, wgt->mmap_params.spaceid, wgt->mmap_params.regionid);
+ wmKeyMap *km = WM_keymap_find(config, gzgt->name, gzgt->gzmap_params.spaceid, gzgt->gzmap_params.regionid);
WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", ACTIONMOUSE, KM_PRESS, KM_ANY, 0);
WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", EVT_TWEAK_S, KM_ANY, 0, 0);
- gizmogroup_tweak_modal_keymap(config, wgt->name);
+ gizmogroup_tweak_modal_keymap(config, gzgt->name);
wmKeyMapItem *kmi = WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", false);
@@ -699,32 +697,32 @@ wmKeyMap *WM_gizmogroup_keymap_common_select(
* \{ */
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find_ptr(
- struct wmGizmoMapType *mmap_type,
- const wmGizmoGroupType *wgt)
+ struct wmGizmoMapType *gzmap_type,
+ const wmGizmoGroupType *gzgt)
{
/* could use hash lookups as operator types do, for now simple search. */
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first;
- wgt_ref;
- wgt_ref = wgt_ref->next)
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first;
+ gzgt_ref;
+ gzgt_ref = gzgt_ref->next)
{
- if (wgt_ref->type == wgt) {
- return wgt_ref;
+ if (gzgt_ref->type == gzgt) {
+ return gzgt_ref;
}
}
return NULL;
}
struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find(
- struct wmGizmoMapType *mmap_type,
+ struct wmGizmoMapType *gzmap_type,
const char *idname)
{
/* could use hash lookups as operator types do, for now simple search. */
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first;
- wgt_ref;
- wgt_ref = wgt_ref->next)
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first;
+ gzgt_ref;
+ gzgt_ref = gzgt_ref->next)
{
- if (STREQ(idname, wgt_ref->type->idname)) {
- return wgt_ref;
+ if (STREQ(idname, gzgt_ref->type->idname)) {
+ return gzgt_ref;
}
}
return NULL;
@@ -734,33 +732,33 @@ struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find(
* Use this for registering gizmos on startup. For runtime, use #WM_gizmomaptype_group_link_runtime.
*/
wmGizmoGroupTypeRef *WM_gizmomaptype_group_link(
- wmGizmoMapType *mmap_type, const char *idname)
+ wmGizmoMapType *gzmap_type, const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- BLI_assert(wgt != NULL);
- return WM_gizmomaptype_group_link_ptr(mmap_type, wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ BLI_assert(gzgt != NULL);
+ return WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt);
}
wmGizmoGroupTypeRef *WM_gizmomaptype_group_link_ptr(
- wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt)
+ wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
{
- wmGizmoGroupTypeRef *wgt_ref = MEM_callocN(sizeof(wmGizmoGroupTypeRef), "gizmo-group-ref");
- wgt_ref->type = wgt;
- BLI_addtail(&mmap_type->grouptype_refs, wgt_ref);
- return wgt_ref;
+ wmGizmoGroupTypeRef *gzgt_ref = MEM_callocN(sizeof(wmGizmoGroupTypeRef), "gizmo-group-ref");
+ gzgt_ref->type = gzgt;
+ BLI_addtail(&gzmap_type->grouptype_refs, gzgt_ref);
+ return gzgt_ref;
}
void WM_gizmomaptype_group_init_runtime_keymap(
const Main *bmain,
- wmGizmoGroupType *wgt)
+ wmGizmoGroupType *gzgt)
{
/* init keymap - on startup there's an extra call to init keymaps for 'permanent' gizmo-groups */
- wm_gizmogrouptype_setup_keymap(wgt, ((wmWindowManager *)bmain->wm.first)->defaultconf);
+ wm_gizmogrouptype_setup_keymap(gzgt, ((wmWindowManager *)bmain->wm.first)->defaultconf);
}
void WM_gizmomaptype_group_init_runtime(
- const Main *bmain, wmGizmoMapType *mmap_type,
- wmGizmoGroupType *wgt)
+ const Main *bmain, wmGizmoMapType *gzmap_type,
+ wmGizmoGroupType *gzgt)
{
/* now create a gizmo for all existing areas */
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
@@ -768,12 +766,12 @@ void WM_gizmomaptype_group_init_runtime(
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = lb->first; ar; ar = ar->next) {
- wmGizmoMap *mmap = ar->gizmo_map;
- if (mmap && mmap->type == mmap_type) {
- wm_gizmogroup_new_from_type(mmap, wgt);
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if (gzmap && gzmap->type == gzmap_type) {
+ wm_gizmogroup_new_from_type(gzmap, gzgt);
/* just add here, drawing will occur on next update */
- wm_gizmomap_highlight_set(mmap, NULL, NULL, 0);
+ wm_gizmomap_highlight_set(gzmap, NULL, NULL, 0);
ED_region_tag_redraw(ar);
}
}
@@ -786,14 +784,14 @@ void WM_gizmomaptype_group_init_runtime(
/**
* Unlike #WM_gizmomaptype_group_unlink this doesn't maintain correct state, simply free.
*/
-void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *wgt_ref)
+void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *gzgt_ref)
{
- MEM_freeN(wgt_ref);
+ MEM_freeN(gzgt_ref);
}
void WM_gizmomaptype_group_unlink(
- bContext *C, Main *bmain, wmGizmoMapType *mmap_type,
- const wmGizmoGroupType *wgt)
+ bContext *C, Main *bmain, wmGizmoMapType *gzmap_type,
+ const wmGizmoGroupType *gzgt)
{
/* Free instances. */
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
@@ -801,14 +799,14 @@ void WM_gizmomaptype_group_unlink(
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = lb->first; ar; ar = ar->next) {
- wmGizmoMap *mmap = ar->gizmo_map;
- if (mmap && mmap->type == mmap_type) {
- wmGizmoGroup *mgroup, *mgroup_next;
- for (mgroup = mmap->groups.first; mgroup; mgroup = mgroup_next) {
- mgroup_next = mgroup->next;
- if (mgroup->type == wgt) {
- BLI_assert(mgroup->parent_mmap == mmap);
- wm_gizmogroup_free(C, mgroup);
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if (gzmap && gzmap->type == gzmap_type) {
+ wmGizmoGroup *gzgroup, *gzgroup_next;
+ for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) {
+ gzgroup_next = gzgroup->next;
+ if (gzgroup->type == gzgt) {
+ BLI_assert(gzgroup->parent_gzmap == gzmap);
+ wm_gizmogroup_free(C, gzgroup);
ED_region_tag_redraw(ar);
}
}
@@ -819,27 +817,27 @@ void WM_gizmomaptype_group_unlink(
}
/* Free types. */
- wmGizmoGroupTypeRef *wgt_ref = WM_gizmomaptype_group_find_ptr(mmap_type, wgt);
- if (wgt_ref) {
- BLI_remlink(&mmap_type->grouptype_refs, wgt_ref);
- WM_gizmomaptype_group_free(wgt_ref);
+ wmGizmoGroupTypeRef *gzgt_ref = WM_gizmomaptype_group_find_ptr(gzmap_type, gzgt);
+ if (gzgt_ref) {
+ BLI_remlink(&gzmap_type->grouptype_refs, gzgt_ref);
+ WM_gizmomaptype_group_free(gzgt_ref);
}
/* Note, we may want to keep this keymap for editing */
- WM_keymap_remove(wgt->keyconf, wgt->keymap);
+ WM_keymap_remove(gzgt->keyconf, gzgt->keymap);
- BLI_assert(WM_gizmomaptype_group_find_ptr(mmap_type, wgt) == NULL);
+ BLI_assert(WM_gizmomaptype_group_find_ptr(gzmap_type, gzgt) == NULL);
}
void wm_gizmogrouptype_setup_keymap(
- wmGizmoGroupType *wgt, wmKeyConfig *keyconf)
+ wmGizmoGroupType *gzgt, wmKeyConfig *keyconf)
{
/* Use flag since setup_keymap may return NULL,
* in that case we better not keep calling it. */
- if (wgt->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
- wgt->keymap = wgt->setup_keymap(wgt, keyconf);
- wgt->keyconf = keyconf;
- wgt->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
+ if (gzgt->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
+ gzgt->keymap = gzgt->setup_keymap(gzgt, keyconf);
+ gzgt->keyconf = keyconf;
+ gzgt->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
}
}
@@ -861,89 +859,89 @@ void wm_gizmogrouptype_setup_keymap(
* \{ */
void WM_gizmo_group_type_add_ptr_ex(
- wmGizmoGroupType *wgt,
- wmGizmoMapType *mmap_type)
+ wmGizmoGroupType *gzgt,
+ wmGizmoMapType *gzmap_type)
{
- WM_gizmomaptype_group_link_ptr(mmap_type, wgt);
+ WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt);
- WM_gizmoconfig_update_tag_init(mmap_type, wgt);
+ WM_gizmoconfig_update_tag_init(gzmap_type, gzgt);
}
void WM_gizmo_group_type_add_ptr(
- wmGizmoGroupType *wgt)
+ wmGizmoGroupType *gzgt)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params);
- WM_gizmo_group_type_add_ptr_ex(wgt, mmap_type);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmo_group_type_add_ptr_ex(gzgt, gzmap_type);
}
void WM_gizmo_group_type_add(const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- BLI_assert(wgt != NULL);
- WM_gizmo_group_type_add_ptr(wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ BLI_assert(gzgt != NULL);
+ WM_gizmo_group_type_add_ptr(gzgt);
}
void WM_gizmo_group_type_ensure_ptr_ex(
- wmGizmoGroupType *wgt,
- wmGizmoMapType *mmap_type)
+ wmGizmoGroupType *gzgt,
+ wmGizmoMapType *gzmap_type)
{
- wmGizmoGroupTypeRef *wgt_ref = WM_gizmomaptype_group_find_ptr(mmap_type, wgt);
- if (wgt_ref == NULL) {
- WM_gizmo_group_type_add_ptr_ex(wgt, mmap_type);
+ wmGizmoGroupTypeRef *gzgt_ref = WM_gizmomaptype_group_find_ptr(gzmap_type, gzgt);
+ if (gzgt_ref == NULL) {
+ WM_gizmo_group_type_add_ptr_ex(gzgt, gzmap_type);
}
}
void WM_gizmo_group_type_ensure_ptr(
- wmGizmoGroupType *wgt)
+ wmGizmoGroupType *gzgt)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params);
- WM_gizmo_group_type_ensure_ptr_ex(wgt, mmap_type);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmo_group_type_ensure_ptr_ex(gzgt, gzmap_type);
}
void WM_gizmo_group_type_ensure(const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- BLI_assert(wgt != NULL);
- WM_gizmo_group_type_ensure_ptr(wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ BLI_assert(gzgt != NULL);
+ WM_gizmo_group_type_ensure_ptr(gzgt);
}
void WM_gizmo_group_type_remove_ptr_ex(
- struct Main *bmain, wmGizmoGroupType *wgt,
- wmGizmoMapType *mmap_type)
+ struct Main *bmain, wmGizmoGroupType *gzgt,
+ wmGizmoMapType *gzmap_type)
{
- WM_gizmomaptype_group_unlink(NULL, bmain, mmap_type, wgt);
- WM_gizmogrouptype_free_ptr(wgt);
+ WM_gizmomaptype_group_unlink(NULL, bmain, gzmap_type, gzgt);
+ WM_gizmogrouptype_free_ptr(gzgt);
}
void WM_gizmo_group_type_remove_ptr(
- struct Main *bmain, wmGizmoGroupType *wgt)
+ struct Main *bmain, wmGizmoGroupType *gzgt)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params);
- WM_gizmo_group_type_remove_ptr_ex(bmain, wgt, mmap_type);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmo_group_type_remove_ptr_ex(bmain, gzgt, gzmap_type);
}
void WM_gizmo_group_type_remove(struct Main *bmain, const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- BLI_assert(wgt != NULL);
- WM_gizmo_group_type_remove_ptr(bmain, wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ BLI_assert(gzgt != NULL);
+ WM_gizmo_group_type_remove_ptr(bmain, gzgt);
}
/* delayed versions */
void WM_gizmo_group_type_unlink_delayed_ptr_ex(
- wmGizmoGroupType *wgt,
- wmGizmoMapType *mmap_type)
+ wmGizmoGroupType *gzgt,
+ wmGizmoMapType *gzmap_type)
{
- WM_gizmoconfig_update_tag_remove(mmap_type, wgt);
+ WM_gizmoconfig_update_tag_remove(gzmap_type, gzgt);
}
void WM_gizmo_group_type_unlink_delayed_ptr(
- wmGizmoGroupType *wgt)
+ wmGizmoGroupType *gzgt)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params);
- WM_gizmo_group_type_unlink_delayed_ptr_ex(wgt, mmap_type);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmo_group_type_unlink_delayed_ptr_ex(gzgt, gzmap_type);
}
void WM_gizmo_group_type_unlink_delayed(const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- BLI_assert(wgt != NULL);
- WM_gizmo_group_type_unlink_delayed_ptr(wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ BLI_assert(gzgt != NULL);
+ WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
}
/** \} */
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
index 44f5fac4cd4..a44005a7d28 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c
@@ -54,11 +54,11 @@ static GHash *global_gizmogrouptype_hash = NULL;
wmGizmoGroupType *WM_gizmogrouptype_find(const char *idname, bool quiet)
{
if (idname[0]) {
- wmGizmoGroupType *wgt;
+ wmGizmoGroupType *gzgt;
- wgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname);
- if (wgt) {
- return wgt;
+ gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname);
+ if (gzgt) {
+ return gzgt;
}
if (!quiet) {
@@ -82,46 +82,46 @@ void WM_gizmogrouptype_iter(GHashIterator *ghi)
static wmGizmoGroupType *wm_gizmogrouptype_append__begin(void)
{
- wmGizmoGroupType *wgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype");
+ wmGizmoGroupType *gzgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype");
- return wgt;
+ return gzgt;
}
-static void wm_gizmogrouptype_append__end(wmGizmoGroupType *wgt)
+static void wm_gizmogrouptype_append__end(wmGizmoGroupType *gzgt)
{
- BLI_assert(wgt->name != NULL);
- BLI_assert(wgt->idname != NULL);
+ BLI_assert(gzgt->name != NULL);
+ BLI_assert(gzgt->idname != NULL);
- wgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT;
+ gzgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT;
/* if not set, use default */
- if (wgt->setup_keymap == NULL) {
- if (wgt->flag & WM_GIZMOGROUPTYPE_SELECT) {
- wgt->setup_keymap = WM_gizmogroup_keymap_common_select;
+ if (gzgt->setup_keymap == NULL) {
+ if (gzgt->flag & WM_GIZMOGROUPTYPE_SELECT) {
+ gzgt->setup_keymap = WM_gizmogroup_keymap_common_select;
}
else {
- wgt->setup_keymap = WM_gizmogroup_keymap_common;
+ gzgt->setup_keymap = WM_gizmogroup_keymap_common;
}
}
- BLI_ghash_insert(global_gizmogrouptype_hash, (void *)wgt->idname, wgt);
+ BLI_ghash_insert(global_gizmogrouptype_hash, (void *)gzgt->idname, gzgt);
}
wmGizmoGroupType *WM_gizmogrouptype_append(
void (*wtfunc)(struct wmGizmoGroupType *))
{
- wmGizmoGroupType *wgt = wm_gizmogrouptype_append__begin();
- wtfunc(wgt);
- wm_gizmogrouptype_append__end(wgt);
- return wgt;
+ wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin();
+ wtfunc(gzgt);
+ wm_gizmogrouptype_append__end(gzgt);
+ return gzgt;
}
wmGizmoGroupType *WM_gizmogrouptype_append_ptr(
void (*wtfunc)(struct wmGizmoGroupType *, void *), void *userdata)
{
- wmGizmoGroupType *wgt = wm_gizmogrouptype_append__begin();
- wtfunc(wgt, userdata);
- wm_gizmogrouptype_append__end(wgt);
- return wgt;
+ wmGizmoGroupType *gzgt = wm_gizmogrouptype_append__begin();
+ wtfunc(gzgt, userdata);
+ wm_gizmogrouptype_append__end(gzgt);
+ return gzgt;
}
/**
@@ -129,56 +129,56 @@ wmGizmoGroupType *WM_gizmogrouptype_append_ptr(
* This is most common for C gizmos which are enabled by default.
*/
wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link(
- wmGizmoMapType *mmap_type,
+ wmGizmoMapType *gzmap_type,
void (*wtfunc)(struct wmGizmoGroupType *))
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_append(wtfunc);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_append(wtfunc);
- wgt->mmap_params.spaceid = mmap_type->spaceid;
- wgt->mmap_params.regionid = mmap_type->regionid;
+ gzgt->gzmap_params.spaceid = gzmap_type->spaceid;
+ gzgt->gzmap_params.regionid = gzmap_type->regionid;
- return WM_gizmomaptype_group_link_ptr(mmap_type, wgt);
+ return WM_gizmomaptype_group_link_ptr(gzmap_type, gzgt);
}
/**
* Free but don't remove from ghash.
*/
-static void gizmogrouptype_free(wmGizmoGroupType *wgt)
+static void gizmogrouptype_free(wmGizmoGroupType *gzgt)
{
- if (wgt->ext.srna) { /* python gizmo group, allocs own string */
- MEM_freeN((void *)wgt->idname);
+ if (gzgt->ext.srna) { /* python gizmo group, allocs own string */
+ MEM_freeN((void *)gzgt->idname);
}
- MEM_freeN(wgt);
+ MEM_freeN(gzgt);
}
-void WM_gizmogrouptype_free_ptr(wmGizmoGroupType *wgt)
+void WM_gizmogrouptype_free_ptr(wmGizmoGroupType *gzgt)
{
- BLI_assert(wgt == WM_gizmogrouptype_find(wgt->idname, false));
+ BLI_assert(gzgt == WM_gizmogrouptype_find(gzgt->idname, false));
- BLI_ghash_remove(global_gizmogrouptype_hash, wgt->idname, NULL, NULL);
+ BLI_ghash_remove(global_gizmogrouptype_hash, gzgt->idname, NULL, NULL);
- gizmogrouptype_free(wgt);
+ gizmogrouptype_free(gzgt);
/* XXX, TODO, update the world! */
}
bool WM_gizmogrouptype_free(const char *idname)
{
- wmGizmoGroupType *wgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname);
+ wmGizmoGroupType *gzgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname);
- if (wgt == NULL) {
+ if (gzgt == NULL) {
return false;
}
- WM_gizmogrouptype_free_ptr(wgt);
+ WM_gizmogrouptype_free_ptr(gzgt);
return true;
}
-static void wm_gizmogrouptype_ghash_free_cb(wmGizmoGroupType *wgt)
+static void wm_gizmogrouptype_ghash_free_cb(wmGizmoGroupType *gzgt)
{
- gizmogrouptype_free(wgt);
+ gizmogrouptype_free(gzgt);
}
void wm_gizmogrouptype_free(void)
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
index 5eed4f2bda2..d4a9dc4f54c 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h
@@ -40,14 +40,14 @@ struct GHashIterator;
bool wm_gizmo_select_set_ex(
- struct wmGizmoMap *mmap, struct wmGizmo *mpr, bool select,
+ struct wmGizmoMap *gzmap, struct wmGizmo *gz, bool select,
bool use_array, bool use_callback);
-bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *mmap, struct wmGizmo *mpr);
+bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *gzmap, struct wmGizmo *gz);
-void wm_gizmo_calculate_scale(struct wmGizmo *mpr, const bContext *C);
-void wm_gizmo_update(struct wmGizmo *mpr, const bContext *C, const bool refresh_map);
+void wm_gizmo_calculate_scale(struct wmGizmo *gz, const bContext *C);
+void wm_gizmo_update(struct wmGizmo *gz, const bContext *C, const bool refresh_map);
-int wm_gizmo_is_visible(struct wmGizmo *mpr);
+int wm_gizmo_is_visible(struct wmGizmo *gz);
enum {
WM_GIZMO_IS_VISIBLE_UPDATE = (1 << 0),
WM_GIZMO_IS_VISIBLE_DRAW = (1 << 1),
@@ -66,20 +66,20 @@ enum {
};
struct wmGizmoGroup *wm_gizmogroup_new_from_type(
- struct wmGizmoMap *mmap, struct wmGizmoGroupType *wgt);
-void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *mgroup);
-void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *mgroup, struct wmGizmo *mpr);
+ struct wmGizmoMap *gzmap, struct wmGizmoGroupType *gzgt);
+void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *gzgroup);
+void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *gzgroup, struct wmGizmo *gz);
struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(
- const struct wmGizmoGroup *mgroup, struct bContext *C, const struct wmEvent *event,
+ const struct wmGizmoGroup *gzgroup, struct bContext *C, const struct wmEvent *event,
int *r_part);
void wm_gizmogroup_intersectable_gizmos_to_list(
- const struct wmGizmoGroup *mgroup, struct ListBase *listbase);
-void wm_gizmogroup_ensure_initialized(struct wmGizmoGroup *mgroup, const struct bContext *C);
+ const struct wmGizmoGroup *gzgroup, struct ListBase *listbase);
+void wm_gizmogroup_ensure_initialized(struct wmGizmoGroup *gzgroup, const struct bContext *C);
bool wm_gizmogroup_is_visible_in_drawstep(
- const struct wmGizmoGroup *mgroup, const eWM_GizmoFlagMapDrawStep drawstep);
+ const struct wmGizmoGroup *gzgroup, const eWM_GizmoFlagMapDrawStep drawstep);
void wm_gizmogrouptype_setup_keymap(
- struct wmGizmoGroupType *wgt, struct wmKeyConfig *keyconf);
+ struct wmGizmoGroupType *gzgt, struct wmKeyConfig *keyconf);
/* -------------------------------------------------------------------- */
@@ -116,7 +116,7 @@ struct wmGizmoMap {
short event_grabcursor;
/* until we have nice cursor push/pop API. */
int last_cursor;
- } mmap_context;
+ } gzmap_context;
};
/**
@@ -135,10 +135,10 @@ struct wmGizmoMapType {
eWM_GizmoFlagMapTypeUpdateFlag type_update_flag;
};
-void wm_gizmomap_select_array_clear(struct wmGizmoMap *mmap);
-bool wm_gizmomap_deselect_all(struct wmGizmoMap *mmap);
-void wm_gizmomap_select_array_shrink(struct wmGizmoMap *mmap, int len_subtract);
-void wm_gizmomap_select_array_push_back(struct wmGizmoMap *mmap, wmGizmo *mpr);
-void wm_gizmomap_select_array_remove(struct wmGizmoMap *mmap, wmGizmo *mpr);
+void wm_gizmomap_select_array_clear(struct wmGizmoMap *gzmap);
+bool wm_gizmomap_deselect_all(struct wmGizmoMap *gzmap);
+void wm_gizmomap_select_array_shrink(struct wmGizmoMap *gzmap, int len_subtract);
+void wm_gizmomap_select_array_push_back(struct wmGizmoMap *gzmap, wmGizmo *gz);
+void wm_gizmomap_select_array_remove(struct wmGizmoMap *gzmap, wmGizmo *gz);
#endif
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 9da1591d535..0b54f0cbec1 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -75,7 +75,7 @@ typedef enum eWM_GizmoFlagGroupTypeGlobalFlag {
WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE = (1 << 1),
} eWM_GizmoFlagGroupTypeGlobalFlag;
-static eWM_GizmoFlagGroupTypeGlobalFlag wm_mmap_type_update_flag = 0;
+static eWM_GizmoFlagGroupTypeGlobalFlag wm_gzmap_type_update_flag = 0;
/**
* Gizmo-map update tagging.
@@ -94,9 +94,9 @@ enum {
*
* \{ */
-static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *mmap, int len)
+static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *gzmap, int len)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
if (len <= msel->len_alloc) {
return;
}
@@ -104,20 +104,20 @@ static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *mmap, int len)
msel->len_alloc = len;
}
-void wm_gizmomap_select_array_clear(wmGizmoMap *mmap)
+void wm_gizmomap_select_array_clear(wmGizmoMap *gzmap)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
MEM_SAFE_FREE(msel->items);
msel->len = 0;
msel->len_alloc = 0;
}
-void wm_gizmomap_select_array_shrink(wmGizmoMap *mmap, int len_subtract)
+void wm_gizmomap_select_array_shrink(wmGizmoMap *gzmap, int len_subtract)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
msel->len -= len_subtract;
if (msel->len <= 0) {
- wm_gizmomap_select_array_clear(mmap);
+ wm_gizmomap_select_array_clear(gzmap);
}
else {
if (msel->len < msel->len_alloc / 2) {
@@ -127,27 +127,27 @@ void wm_gizmomap_select_array_shrink(wmGizmoMap *mmap, int len_subtract)
}
}
-void wm_gizmomap_select_array_push_back(wmGizmoMap *mmap, wmGizmo *mpr)
+void wm_gizmomap_select_array_push_back(wmGizmoMap *gzmap, wmGizmo *gz)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
BLI_assert(msel->len <= msel->len_alloc);
if (msel->len == msel->len_alloc) {
msel->len_alloc = (msel->len + 1) * 2;
msel->items = MEM_reallocN(msel->items, sizeof(*msel->items) * msel->len_alloc);
}
- msel->items[msel->len++] = mpr;
+ msel->items[msel->len++] = gz;
}
-void wm_gizmomap_select_array_remove(wmGizmoMap *mmap, wmGizmo *mpr)
+void wm_gizmomap_select_array_remove(wmGizmoMap *gzmap, wmGizmo *gz)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
/* remove gizmo from selected_gizmos array */
for (int i = 0; i < msel->len; i++) {
- if (msel->items[i] == mpr) {
+ if (msel->items[i] == gz) {
for (int j = i; j < (msel->len - 1); j++) {
msel->items[j] = msel->items[j + 1];
}
- wm_gizmomap_select_array_shrink(mmap, 1);
+ wm_gizmomap_select_array_shrink(gzmap, 1);
break;
}
}
@@ -166,84 +166,84 @@ void wm_gizmomap_select_array_remove(wmGizmoMap *mmap, wmGizmo *mpr)
* Creates a gizmo-map with all registered gizmos for that type
*/
wmGizmoMap *WM_gizmomap_new_from_type(
- const struct wmGizmoMapType_Params *mmap_params)
+ const struct wmGizmoMapType_Params *gzmap_params)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(mmap_params);
- wmGizmoMap *mmap;
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(gzmap_params);
+ wmGizmoMap *gzmap;
- mmap = MEM_callocN(sizeof(wmGizmoMap), "GizmoMap");
- mmap->type = mmap_type;
- WM_gizmomap_tag_refresh(mmap);
+ gzmap = MEM_callocN(sizeof(wmGizmoMap), "GizmoMap");
+ gzmap->type = gzmap_type;
+ WM_gizmomap_tag_refresh(gzmap);
/* create all gizmo-groups for this gizmo-map. We may create an empty one
* too in anticipation of gizmos from operators etc */
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) {
- wm_gizmogroup_new_from_type(mmap, wgt_ref->type);
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref; gzgt_ref = gzgt_ref->next) {
+ wm_gizmogroup_new_from_type(gzmap, gzgt_ref->type);
}
- return mmap;
+ return gzmap;
}
-void wm_gizmomap_remove(wmGizmoMap *mmap)
+void wm_gizmomap_remove(wmGizmoMap *gzmap)
{
/* Clear first so further calls don't waste time trying to maintain correct array state. */
- wm_gizmomap_select_array_clear(mmap);
+ wm_gizmomap_select_array_clear(gzmap);
- for (wmGizmoGroup *mgroup = mmap->groups.first, *mgroup_next; mgroup; mgroup = mgroup_next) {
- mgroup_next = mgroup->next;
- BLI_assert(mgroup->parent_mmap == mmap);
- wm_gizmogroup_free(NULL, mgroup);
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first, *gzgroup_next; gzgroup; gzgroup = gzgroup_next) {
+ gzgroup_next = gzgroup->next;
+ BLI_assert(gzgroup->parent_gzmap == gzmap);
+ wm_gizmogroup_free(NULL, gzgroup);
}
- BLI_assert(BLI_listbase_is_empty(&mmap->groups));
+ BLI_assert(BLI_listbase_is_empty(&gzmap->groups));
- MEM_freeN(mmap);
+ MEM_freeN(gzmap);
}
wmGizmoGroup *WM_gizmomap_group_find(
- struct wmGizmoMap *mmap,
+ struct wmGizmoMap *gzmap,
const char *idname)
{
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- if (wgt) {
- return WM_gizmomap_group_find_ptr(mmap, wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ if (gzgt) {
+ return WM_gizmomap_group_find_ptr(gzmap, gzgt);
}
return NULL;
}
wmGizmoGroup *WM_gizmomap_group_find_ptr(
- struct wmGizmoMap *mmap,
- const struct wmGizmoGroupType *wgt)
+ struct wmGizmoMap *gzmap,
+ const struct wmGizmoGroupType *gzgt)
{
- for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
- if (mgroup->type == wgt) {
- return mgroup;
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
+ if (gzgroup->type == gzgt) {
+ return gzgroup;
}
}
return NULL;
}
-const ListBase *WM_gizmomap_group_list(wmGizmoMap *mmap)
+const ListBase *WM_gizmomap_group_list(wmGizmoMap *gzmap)
{
- return &mmap->groups;
+ return &gzmap->groups;
}
-bool WM_gizmomap_is_any_selected(const wmGizmoMap *mmap)
+bool WM_gizmomap_is_any_selected(const wmGizmoMap *gzmap)
{
- return mmap->mmap_context.select.len != 0;
+ return gzmap->gzmap_context.select.len != 0;
}
/**
* \note We could use a callback to define bounds, for now just use matrix location.
*/
bool WM_gizmomap_minmax(
- const wmGizmoMap *mmap, bool UNUSED(use_hidden), bool use_select,
+ const wmGizmoMap *gzmap, bool UNUSED(use_hidden), bool use_select,
float r_min[3], float r_max[3])
{
if (use_select) {
int i;
- for (i = 0; i < mmap->mmap_context.select.len; i++) {
- minmax_v3v3_v3(r_min, r_max, mmap->mmap_context.select.items[i]->matrix_basis[3]);
+ for (i = 0; i < gzmap->gzmap_context.select.len; i++) {
+ minmax_v3v3_v3(r_min, r_max, gzmap->gzmap_context.select.items[i]->matrix_basis[3]);
}
return i != 0;
}
@@ -255,7 +255,7 @@ bool WM_gizmomap_minmax(
}
/**
- * Creates and returns idname hash table for (visible) gizmos in \a mmap
+ * Creates and returns idname hash table for (visible) gizmos in \a gzmap
*
* \param poll Polling function for excluding gizmos.
* \param data Custom data passed to \a poll
@@ -264,20 +264,20 @@ bool WM_gizmomap_minmax(
* best we use an iterator function instead of a hash.
*/
static GHash *WM_gizmomap_gizmo_hash_new(
- const bContext *C, wmGizmoMap *mmap,
+ const bContext *C, wmGizmoMap *gzmap,
bool (*poll)(const wmGizmo *, void *),
void *data, const bool include_hidden)
{
GHash *hash = BLI_ghash_ptr_new(__func__);
/* collect gizmos */
- for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
- if (WM_gizmo_group_type_poll(C, mgroup->type)) {
- for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- if ((include_hidden || (mpr->flag & WM_GIZMO_HIDDEN) == 0) &&
- (!poll || poll(mpr, data)))
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
+ if (WM_gizmo_group_type_poll(C, gzgroup->type)) {
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if ((include_hidden || (gz->flag & WM_GIZMO_HIDDEN) == 0) &&
+ (!poll || poll(gz, data)))
{
- BLI_ghash_insert(hash, mpr, mpr);
+ BLI_ghash_insert(hash, gz, gz);
}
}
}
@@ -286,12 +286,12 @@ static GHash *WM_gizmomap_gizmo_hash_new(
return hash;
}
-void WM_gizmomap_tag_refresh(wmGizmoMap *mmap)
+void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
{
- if (mmap) {
+ if (gzmap) {
/* We might want only to refresh some, for tag all steps. */
for (int i = 0; i < WM_GIZMOMAP_DRAWSTEP_MAX; i++) {
- mmap->update_flag[i] |= (
+ gzmap->update_flag[i] |= (
GIZMOMAP_IS_PREPARE_DRAW |
GIZMOMAP_IS_REFRESH_CALLBACK);
}
@@ -299,11 +299,11 @@ void WM_gizmomap_tag_refresh(wmGizmoMap *mmap)
}
static bool gizmo_prepare_drawing(
- wmGizmoMap *mmap, wmGizmo *mpr,
+ wmGizmoMap *gzmap, wmGizmo *gz,
const bContext *C, ListBase *draw_gizmos,
const eWM_GizmoFlagMapDrawStep drawstep)
{
- int do_draw = wm_gizmo_is_visible(mpr);
+ int do_draw = wm_gizmo_is_visible(gz);
if (do_draw == 0) {
/* skip */
}
@@ -311,10 +311,10 @@ static bool gizmo_prepare_drawing(
/* Ensure we get RNA updates */
if (do_draw & WM_GIZMO_IS_VISIBLE_UPDATE) {
/* hover gizmos need updating, even if we don't draw them */
- wm_gizmo_update(mpr, C, (mmap->update_flag[drawstep] & GIZMOMAP_IS_PREPARE_DRAW) != 0);
+ wm_gizmo_update(gz, C, (gzmap->update_flag[drawstep] & GIZMOMAP_IS_PREPARE_DRAW) != 0);
}
if (do_draw & WM_GIZMO_IS_VISIBLE_DRAW) {
- BLI_addhead(draw_gizmos, BLI_genericNodeN(mpr));
+ BLI_addhead(draw_gizmos, BLI_genericNodeN(gz));
}
return true;
}
@@ -323,23 +323,23 @@ static bool gizmo_prepare_drawing(
}
/**
- * Update gizmos of \a mmap to prepare for drawing. Adds all gizmos that
+ * Update gizmos of \a gzmap to prepare for drawing. Adds all gizmos that
* should be drawn to list \a draw_gizmos, note that added items need freeing.
*/
static void gizmomap_prepare_drawing(
- wmGizmoMap *mmap, const bContext *C, ListBase *draw_gizmos,
+ wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos,
const eWM_GizmoFlagMapDrawStep drawstep)
{
- if (!mmap || BLI_listbase_is_empty(&mmap->groups))
+ if (!gzmap || BLI_listbase_is_empty(&gzmap->groups))
return;
- wmGizmo *mpr_modal = mmap->mmap_context.modal;
+ wmGizmo *gz_modal = gzmap->gzmap_context.modal;
/* only active gizmo needs updating */
- if (mpr_modal) {
- if ((mpr_modal->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
- if (wm_gizmogroup_is_visible_in_drawstep(mpr_modal->parent_mgroup, drawstep)) {
- if (gizmo_prepare_drawing(mmap, mpr_modal, C, draw_gizmos, drawstep)) {
- mmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
+ if (gz_modal) {
+ if ((gz_modal->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) {
+ if (wm_gizmogroup_is_visible_in_drawstep(gz_modal->parent_gzgroup, drawstep)) {
+ if (gizmo_prepare_drawing(gzmap, gz_modal, C, draw_gizmos, drawstep)) {
+ gzmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW;
}
}
/* don't draw any other gizmos */
@@ -347,46 +347,46 @@ static void gizmomap_prepare_drawing(
}
}
- for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
/* check group visibility - drawstep first to avoid unnecessary call of group poll callback */
- if (!wm_gizmogroup_is_visible_in_drawstep(mgroup, drawstep) ||
- !WM_gizmo_group_type_poll(C, mgroup->type))
+ if (!wm_gizmogroup_is_visible_in_drawstep(gzgroup, drawstep) ||
+ !WM_gizmo_group_type_poll(C, gzgroup->type))
{
continue;
}
/* needs to be initialized on first draw */
/* XXX weak: Gizmo-group may skip refreshing if it's invisible (map gets untagged nevertheless) */
- if (mmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK) {
+ if (gzmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK) {
/* force refresh again. */
- mgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
+ gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
}
/* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */
- wm_gizmogroup_ensure_initialized(mgroup, C);
+ wm_gizmogroup_ensure_initialized(gzgroup, C);
/* prepare drawing */
- if (mgroup->type->draw_prepare) {
- mgroup->type->draw_prepare(C, mgroup);
+ if (gzgroup->type->draw_prepare) {
+ gzgroup->type->draw_prepare(C, gzgroup);
}
- for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- gizmo_prepare_drawing(mmap, mpr, C, draw_gizmos, drawstep);
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ gizmo_prepare_drawing(gzmap, gz, C, draw_gizmos, drawstep);
}
}
- mmap->update_flag[drawstep] &=
+ gzmap->update_flag[drawstep] &=
~(GIZMOMAP_IS_REFRESH_CALLBACK |
GIZMOMAP_IS_PREPARE_DRAW);
}
/**
- * Draw all visible gizmos in \a mmap.
+ * Draw all visible gizmos in \a gzmap.
* Uses global draw_gizmos listbase.
*/
-static void gizmos_draw_list(const wmGizmoMap *mmap, const bContext *C, ListBase *draw_gizmos)
+static void gizmos_draw_list(const wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos)
{
/* Can be empty if we're dynamically added and removed. */
- if ((mmap == NULL) || BLI_listbase_is_empty(&mmap->groups)) {
+ if ((gzmap == NULL) || BLI_listbase_is_empty(&gzmap->groups)) {
return;
}
@@ -397,13 +397,13 @@ static void gizmos_draw_list(const wmGizmoMap *mmap, const bContext *C, ListBase
/* draw_gizmos contains all visible gizmos - draw them */
for (LinkData *link = draw_gizmos->first, *link_next; link; link = link_next) {
- wmGizmo *mpr = link->data;
+ wmGizmo *gz = link->data;
link_next = link->next;
- bool is_depth = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
+ bool is_depth = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
/* Weak! since we don't 100% support depth yet (select ignores depth) always show highlighted */
- if (is_depth && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT)) {
+ if (is_depth && (gz->state & WM_GIZMO_STATE_HIGHLIGHT)) {
is_depth = false;
}
@@ -424,7 +424,7 @@ static void gizmos_draw_list(const wmGizmoMap *mmap, const bContext *C, ListBase
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
- mpr->type->draw(C, mpr);
+ gz->type->draw(C, gz);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POLYGON_SMOOTH);
@@ -439,7 +439,7 @@ static void gizmos_draw_list(const wmGizmoMap *mmap, const bContext *C, ListBase
}
void WM_gizmomap_draw(
- wmGizmoMap *mmap, const bContext *C,
+ wmGizmoMap *gzmap, const bContext *C,
const eWM_GizmoFlagMapDrawStep drawstep)
{
if (!WM_gizmo_context_check_drawstep(C, drawstep)) {
@@ -448,24 +448,32 @@ void WM_gizmomap_draw(
ListBase draw_gizmos = {NULL};
- gizmomap_prepare_drawing(mmap, C, &draw_gizmos, drawstep);
- gizmos_draw_list(mmap, C, &draw_gizmos);
+ gizmomap_prepare_drawing(gzmap, C, &draw_gizmos, drawstep);
+ gizmos_draw_list(gzmap, C, &draw_gizmos);
BLI_assert(BLI_listbase_is_empty(&draw_gizmos));
}
-static void gizmo_draw_select_3D_loop(const bContext *C, ListBase *visible_gizmos)
+static void gizmo_draw_select_3D_loop(
+ const bContext *C, ListBase *visible_gizmos,
+ const wmGizmo *gz_stop)
{
int select_id = 0;
- wmGizmo *mpr;
+ wmGizmo *gz;
/* TODO(campbell): this depends on depth buffer being written to, currently broken for the 3D view. */
bool is_depth_prev = false;
bool is_depth_skip_prev = false;
- for (LinkData *link = visible_gizmos->first; link; link = link->next) {
- mpr = link->data;
+ for (LinkData *link = visible_gizmos->first; link; link = link->next, select_id++) {
+ gz = link->data;
+ if (gz == gz_stop) {
+ break;
+ }
+ if (gz->type->draw_select == NULL) {
+ continue;
+ }
- bool is_depth = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
+ bool is_depth = (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0;
if (is_depth == is_depth_prev) {
/* pass */
}
@@ -478,7 +486,7 @@ static void gizmo_draw_select_3D_loop(const bContext *C, ListBase *visible_gizmo
}
is_depth_prev = is_depth;
}
- bool is_depth_skip = (mpr->flag & WM_GIZMO_SELECT_BACKGROUND) != 0;
+ bool is_depth_skip = (gz->flag & WM_GIZMO_SELECT_BACKGROUND) != 0;
if (is_depth_skip == is_depth_skip_prev) {
/* pass */
}
@@ -489,10 +497,7 @@ static void gizmo_draw_select_3D_loop(const bContext *C, ListBase *visible_gizmo
/* pass the selection id shifted by 8 bits. Last 8 bits are used for selected gizmo part id */
- mpr->type->draw_select(C, mpr, select_id << 8);
-
-
- select_id++;
+ gz->type->draw_select(C, gz, select_id << 8);
}
if (is_depth_prev) {
@@ -505,7 +510,7 @@ static void gizmo_draw_select_3D_loop(const bContext *C, ListBase *visible_gizmo
static int gizmo_find_intersected_3d_intern(
ListBase *visible_gizmos, const bContext *C, const int co[2],
- const int hotspot)
+ const int hotspot, const wmGizmo *gz_stop)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -525,13 +530,13 @@ static int gizmo_find_intersected_3d_intern(
else
GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_ALL, 0);
/* do the drawing */
- gizmo_draw_select_3D_loop(C, visible_gizmos);
+ gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
hits = GPU_select_end();
if (do_passes && (hits > 0)) {
GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
- gizmo_draw_select_3D_loop(C, visible_gizmos);
+ gizmo_draw_select_3D_loop(C, visible_gizmos, gz_stop);
GPU_select_end();
}
@@ -552,36 +557,56 @@ static wmGizmo *gizmo_find_intersected_3d(
wmGizmo *result = NULL;
int hit = -1;
- int hotspot_radii[] = {
- 3 * U.pixelsize,
- /* This runs on mouse move, careful doing too many tests! */
- 10 * U.pixelsize,
- };
-
*r_part = 0;
/* set up view matrices */
view3d_operator_needs_opengl(C);
- hit = -1;
-
- for (int i = 0; i < ARRAY_SIZE(hotspot_radii); i++) {
- hit = gizmo_find_intersected_3d_intern(visible_gizmos, C, co, hotspot_radii[i]);
- if (hit != -1) {
- break;
+ /* Search for 3D gizmo's that use the 2D callback for checking intersections. */
+ bool has_3d = false;
+ {
+ int select_id = 0;
+ for (LinkData *link = visible_gizmos->first; link; link = link->next, select_id++) {
+ wmGizmo *gz = link->data;
+ if (gz->type->test_select) {
+ if ((*r_part = gz->type->test_select(C, gz, co)) != -1) {
+ hit = select_id;
+ result = gz;
+ break;
+ }
+ }
+ else {
+ has_3d = true;
+ }
}
}
- if (hit != -1) {
- LinkData *link = BLI_findlink(visible_gizmos, hit >> 8);
- if (link != NULL) {
- *r_part = hit & 255;
- result = link->data;
+ /* Search for 3D intersections if they're before 2D that have been found (if any).
+ * This way we always use the first hit. */
+ if (has_3d) {
+ const int hotspot_radii[] = {
+ 3 * U.pixelsize,
+ /* This runs on mouse move, careful doing too many tests! */
+ 10 * U.pixelsize,
+ };
+ for (int i = 0; i < ARRAY_SIZE(hotspot_radii); i++) {
+ hit = gizmo_find_intersected_3d_intern(visible_gizmos, C, co, hotspot_radii[i], result);
+ if (hit != -1) {
+ break;
+ }
}
- else {
- /* All gizmos should use selection ID they're given as part of the callback,
- * if they don't it will attempt tp lookup non-existing index. */
- BLI_assert(0);
+
+ if (hit != -1) {
+ LinkData *link = BLI_findlink(visible_gizmos, hit >> 8);
+ if (link != NULL) {
+ *r_part = hit & 255;
+ result = link->data;
+ }
+ else {
+ /* All gizmos should use selection ID they're given as part of the callback,
+ * if they don't it will attempt tp lookup non-existing index. */
+ BLI_assert(0);
+ }
}
}
@@ -593,10 +618,10 @@ static wmGizmo *gizmo_find_intersected_3d(
* 3D ones (could check for smallest screen-space distance but not needed right now).
*/
wmGizmo *wm_gizmomap_highlight_find(
- wmGizmoMap *mmap, bContext *C, const wmEvent *event,
+ wmGizmoMap *gzmap, bContext *C, const wmEvent *event,
int *r_part)
{
- wmGizmo *mpr = NULL;
+ wmGizmo *gz = NULL;
ListBase visible_3d_gizmos = {NULL};
bool do_step[WM_GIZMOMAP_DRAWSTEP_MAX];
@@ -604,18 +629,18 @@ wmGizmo *wm_gizmomap_highlight_find(
do_step[i] = WM_gizmo_context_check_drawstep(C, i);
}
- for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
/* If it were important we could initialize here,
* but this only happens when events are handled before drawing,
* just skip to keep code-path for initializing gizmos simple. */
- if ((mgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0) {
+ if ((gzgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0) {
continue;
}
- if (WM_gizmo_group_type_poll(C, mgroup->type)) {
+ if (WM_gizmo_group_type_poll(C, gzgroup->type)) {
eWM_GizmoFlagMapDrawStep step;
- if (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
+ if (gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
step = WM_GIZMOMAP_DRAWSTEP_3D;
}
else {
@@ -623,17 +648,17 @@ wmGizmo *wm_gizmomap_highlight_find(
}
if (do_step[step]) {
- if ((mmap->update_flag[step] & GIZMOMAP_IS_REFRESH_CALLBACK) &&
- (mgroup->type->refresh != NULL))
+ if ((gzmap->update_flag[step] & GIZMOMAP_IS_REFRESH_CALLBACK) &&
+ (gzgroup->type->refresh != NULL))
{
- mgroup->type->refresh(C, mgroup);
+ gzgroup->type->refresh(C, gzgroup);
/* cleared below */
}
if (step == WM_GIZMOMAP_DRAWSTEP_3D) {
- wm_gizmogroup_intersectable_gizmos_to_list(mgroup, &visible_3d_gizmos);
+ wm_gizmogroup_intersectable_gizmos_to_list(gzgroup, &visible_3d_gizmos);
}
else if (step == WM_GIZMOMAP_DRAWSTEP_2D) {
- if ((mpr = wm_gizmogroup_find_intersected_gizmo(mgroup, C, event, r_part))) {
+ if ((gz = wm_gizmogroup_find_intersected_gizmo(gzgroup, C, event, r_part))) {
break;
}
}
@@ -643,32 +668,32 @@ wmGizmo *wm_gizmomap_highlight_find(
if (!BLI_listbase_is_empty(&visible_3d_gizmos)) {
/* 2D gizmos get priority. */
- if (mpr == NULL) {
- mpr = gizmo_find_intersected_3d(C, event->mval, &visible_3d_gizmos, r_part);
+ if (gz == NULL) {
+ gz = gizmo_find_intersected_3d(C, event->mval, &visible_3d_gizmos, r_part);
}
BLI_freelistN(&visible_3d_gizmos);
}
- mmap->update_flag[WM_GIZMOMAP_DRAWSTEP_3D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
- mmap->update_flag[WM_GIZMOMAP_DRAWSTEP_2D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
+ gzmap->update_flag[WM_GIZMOMAP_DRAWSTEP_3D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
+ gzmap->update_flag[WM_GIZMOMAP_DRAWSTEP_2D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK;
- return mpr;
+ return gz;
}
-void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *mmap)
+void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap)
{
wmEventHandler *handler;
for (handler = ar->handlers.first; handler; handler = handler->next) {
- if (handler->gizmo_map == mmap) {
+ if (handler->gizmo_map == gzmap) {
return;
}
}
handler = MEM_callocN(sizeof(wmEventHandler), "gizmo handler");
- BLI_assert(mmap == ar->gizmo_map);
- handler->gizmo_map = mmap;
+ BLI_assert(gzmap == ar->gizmo_map);
+ handler->gizmo_map = gzmap;
BLI_addtail(&ar->handlers, handler);
}
@@ -682,8 +707,8 @@ void wm_gizmomaps_handled_modal_update(
return;
}
- wmGizmoMap *mmap = handler->op_region->gizmo_map;
- wmGizmo *mpr = wm_gizmomap_modal_get(mmap);
+ wmGizmoMap *gzmap = handler->op_region->gizmo_map;
+ wmGizmo *gz = wm_gizmomap_modal_get(gzmap);
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
@@ -691,11 +716,11 @@ void wm_gizmomaps_handled_modal_update(
/* regular update for running operator */
if (modal_running) {
- wmGizmoOpElem *mpop = mpr ? WM_gizmo_operator_get(mpr, mpr->highlight_part) : NULL;
- if (mpr && mpop && (mpop->type != NULL) && (mpop->type == handler->op->type)) {
- wmGizmoFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal;
+ wmGizmoOpElem *mpop = gz ? WM_gizmo_operator_get(gz, gz->highlight_part) : NULL;
+ if (gz && mpop && (mpop->type != NULL) && (mpop->type == handler->op->type)) {
+ wmGizmoFnModal modal_fn = gz->custom_modal ? gz->custom_modal : gz->type->modal;
if (modal_fn != NULL) {
- int retval = modal_fn(C, mpr, event, 0);
+ int retval = modal_fn(C, gz, event, 0);
/* The gizmo is tried to the operator, we can't choose when to exit. */
BLI_assert(retval & OPERATOR_RUNNING_MODAL);
UNUSED_VARS_NDEBUG(retval);
@@ -704,14 +729,14 @@ void wm_gizmomaps_handled_modal_update(
}
/* operator not running anymore */
else {
- wm_gizmomap_highlight_set(mmap, C, NULL, 0);
- if (mpr) {
+ wm_gizmomap_highlight_set(gzmap, C, NULL, 0);
+ if (gz) {
/* This isn't defined if it ends because of success of cancel, we may want to change. */
bool cancel = true;
- if (mpr->type->exit) {
- mpr->type->exit(C, mpr, cancel);
+ if (gz->type->exit) {
+ gz->type->exit(C, gz, cancel);
}
- wm_gizmomap_modal_set(mmap, C, mpr, NULL, false);
+ wm_gizmomap_modal_set(gzmap, C, gz, NULL, false);
}
}
@@ -721,58 +746,58 @@ void wm_gizmomaps_handled_modal_update(
}
/**
- * Deselect all selected gizmos in \a mmap.
+ * Deselect all selected gizmos in \a gzmap.
* \return if selection has changed.
*/
-bool wm_gizmomap_deselect_all(wmGizmoMap *mmap)
+bool wm_gizmomap_deselect_all(wmGizmoMap *gzmap)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
if (msel->items == NULL || msel->len == 0) {
return false;
}
for (int i = 0; i < msel->len; i++) {
- wm_gizmo_select_set_ex(mmap, msel->items[i], false, false, true);
+ wm_gizmo_select_set_ex(gzmap, msel->items[i], false, false, true);
}
- wm_gizmomap_select_array_clear(mmap);
+ wm_gizmomap_select_array_clear(gzmap);
/* always return true, we already checked
* if there's anything to deselect */
return true;
}
-BLI_INLINE bool gizmo_selectable_poll(const wmGizmo *mpr, void *UNUSED(data))
+BLI_INLINE bool gizmo_selectable_poll(const wmGizmo *gz, void *UNUSED(data))
{
- return (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT);
+ return (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT);
}
/**
- * Select all selectable gizmos in \a mmap.
+ * Select all selectable gizmos in \a gzmap.
* \return if selection has changed.
*/
static bool wm_gizmomap_select_all_intern(
- bContext *C, wmGizmoMap *mmap)
+ bContext *C, wmGizmoMap *gzmap)
{
- wmGizmoMapSelectState *msel = &mmap->mmap_context.select;
+ wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
/* GHash is used here to avoid having to loop over all gizmos twice (once to
* get tot_sel for allocating, once for actually selecting). Instead we collect
* selectable gizmos in hash table and use this to get tot_sel and do selection */
- GHash *hash = WM_gizmomap_gizmo_hash_new(C, mmap, gizmo_selectable_poll, NULL, true);
+ GHash *hash = WM_gizmomap_gizmo_hash_new(C, gzmap, gizmo_selectable_poll, NULL, true);
GHashIterator gh_iter;
int i;
bool changed = false;
- wm_gizmomap_select_array_ensure_len_alloc(mmap, BLI_ghash_len(hash));
+ wm_gizmomap_select_array_ensure_len_alloc(gzmap, BLI_ghash_len(hash));
GHASH_ITER_INDEX (gh_iter, hash, i) {
- wmGizmo *mpr_iter = BLI_ghashIterator_getValue(&gh_iter);
- WM_gizmo_select_set(mmap, mpr_iter, true);
+ wmGizmo *gz_iter = BLI_ghashIterator_getValue(&gh_iter);
+ WM_gizmo_select_set(gzmap, gz_iter, true);
}
/* highlight first gizmo */
- wm_gizmomap_highlight_set(mmap, C, msel->items[0], msel->items[0]->highlight_part);
+ wm_gizmomap_highlight_set(gzmap, C, msel->items[0], msel->items[0]->highlight_part);
BLI_assert(BLI_ghash_len(hash) == msel->len);
@@ -781,21 +806,21 @@ static bool wm_gizmomap_select_all_intern(
}
/**
- * Select/Deselect all selectable gizmos in \a mmap.
+ * Select/Deselect all selectable gizmos in \a gzmap.
* \return if selection has changed.
*
* TODO select all by type
*/
-bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *mmap, const int action)
+bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
{
bool changed = false;
switch (action) {
case SEL_SELECT:
- changed = wm_gizmomap_select_all_intern(C, mmap);
+ changed = wm_gizmomap_select_all_intern(C, gzmap);
break;
case SEL_DESELECT:
- changed = wm_gizmomap_deselect_all(mmap);
+ changed = wm_gizmomap_deselect_all(gzmap);
break;
default:
BLI_assert(0);
@@ -846,11 +871,11 @@ void wm_gizmomap_handler_context(bContext *C, wmEventHandler *handler)
}
}
-bool WM_gizmomap_cursor_set(const wmGizmoMap *mmap, wmWindow *win)
+bool WM_gizmomap_cursor_set(const wmGizmoMap *gzmap, wmWindow *win)
{
- wmGizmo *mpr = mmap->mmap_context.highlight;
- if (mpr && mpr->type->cursor_get) {
- WM_cursor_set(win, mpr->type->cursor_get(mpr));
+ wmGizmo *gz = gzmap->gzmap_context.highlight;
+ if (gz && gz->type->cursor_get) {
+ WM_cursor_set(win, gz->type->cursor_get(gz));
return true;
}
@@ -858,33 +883,33 @@ bool WM_gizmomap_cursor_set(const wmGizmoMap *mmap, wmWindow *win)
}
bool wm_gizmomap_highlight_set(
- wmGizmoMap *mmap, const bContext *C, wmGizmo *mpr, int part)
+ wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz, int part)
{
- if ((mpr != mmap->mmap_context.highlight) ||
- (mpr && part != mpr->highlight_part))
+ if ((gz != gzmap->gzmap_context.highlight) ||
+ (gz && part != gz->highlight_part))
{
- if (mmap->mmap_context.highlight) {
- mmap->mmap_context.highlight->state &= ~WM_GIZMO_STATE_HIGHLIGHT;
- mmap->mmap_context.highlight->highlight_part = -1;
+ if (gzmap->gzmap_context.highlight) {
+ gzmap->gzmap_context.highlight->state &= ~WM_GIZMO_STATE_HIGHLIGHT;
+ gzmap->gzmap_context.highlight->highlight_part = -1;
}
- mmap->mmap_context.highlight = mpr;
+ gzmap->gzmap_context.highlight = gz;
- if (mpr) {
- mpr->state |= WM_GIZMO_STATE_HIGHLIGHT;
- mpr->highlight_part = part;
- mmap->mmap_context.last_cursor = -1;
+ if (gz) {
+ gz->state |= WM_GIZMO_STATE_HIGHLIGHT;
+ gz->highlight_part = part;
+ gzmap->gzmap_context.last_cursor = -1;
- if (C && mpr->type->cursor_get) {
+ if (C && gz->type->cursor_get) {
wmWindow *win = CTX_wm_window(C);
- mmap->mmap_context.last_cursor = win->cursor;
- WM_cursor_set(win, mpr->type->cursor_get(mpr));
+ gzmap->gzmap_context.last_cursor = win->cursor;
+ WM_cursor_set(win, gz->type->cursor_get(gz));
}
}
else {
- if (C && mmap->mmap_context.last_cursor != -1) {
+ if (C && gzmap->gzmap_context.last_cursor != -1) {
wmWindow *win = CTX_wm_window(C);
- WM_cursor_set(win, mmap->mmap_context.last_cursor);
+ WM_cursor_set(win, gzmap->gzmap_context.last_cursor);
}
}
@@ -900,123 +925,123 @@ bool wm_gizmomap_highlight_set(
return false;
}
-wmGizmo *wm_gizmomap_highlight_get(wmGizmoMap *mmap)
+wmGizmo *wm_gizmomap_highlight_get(wmGizmoMap *gzmap)
{
- return mmap->mmap_context.highlight;
+ return gzmap->gzmap_context.highlight;
}
/**
* Caller should call exit when (enable == False).
*/
void wm_gizmomap_modal_set(
- wmGizmoMap *mmap, bContext *C, wmGizmo *mpr, const wmEvent *event, bool enable)
+ wmGizmoMap *gzmap, bContext *C, wmGizmo *gz, const wmEvent *event, bool enable)
{
if (enable) {
- BLI_assert(mmap->mmap_context.modal == NULL);
+ BLI_assert(gzmap->gzmap_context.modal == NULL);
wmWindow *win = CTX_wm_window(C);
WM_tooltip_clear(C, win);
- if (mpr->type->invoke &&
- (mpr->type->modal || mpr->custom_modal))
+ if (gz->type->invoke &&
+ (gz->type->modal || gz->custom_modal))
{
- const int retval = mpr->type->invoke(C, mpr, event);
+ const int retval = gz->type->invoke(C, gz, event);
if ((retval & OPERATOR_RUNNING_MODAL) == 0) {
return;
}
}
- mpr->state |= WM_GIZMO_STATE_MODAL;
- mmap->mmap_context.modal = mpr;
+ gz->state |= WM_GIZMO_STATE_MODAL;
+ gzmap->gzmap_context.modal = gz;
- if ((mpr->flag & WM_GIZMO_GRAB_CURSOR) &&
+ if ((gz->flag & WM_GIZMO_GRAB_CURSOR) &&
(event->is_motion_absolute == false))
{
WM_cursor_grab_enable(win, true, true, NULL);
- copy_v2_v2_int(mmap->mmap_context.event_xy, &event->x);
- mmap->mmap_context.event_grabcursor = win->grabcursor;
+ copy_v2_v2_int(gzmap->gzmap_context.event_xy, &event->x);
+ gzmap->gzmap_context.event_grabcursor = win->grabcursor;
}
else {
- mmap->mmap_context.event_xy[0] = INT_MAX;
+ gzmap->gzmap_context.event_xy[0] = INT_MAX;
}
- struct wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part);
+ struct wmGizmoOpElem *mpop = WM_gizmo_operator_get(gz, gz->highlight_part);
if (mpop && mpop->type) {
const int retval = WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr);
if ((retval & OPERATOR_RUNNING_MODAL) == 0) {
- wm_gizmomap_modal_set(mmap, C, mpr, event, false);
+ wm_gizmomap_modal_set(gzmap, C, gz, event, false);
}
/* we failed to hook the gizmo to the operator handler or operator was cancelled, return */
- if (!mmap->mmap_context.modal) {
- mpr->state &= ~WM_GIZMO_STATE_MODAL;
- MEM_SAFE_FREE(mpr->interaction_data);
+ if (!gzmap->gzmap_context.modal) {
+ gz->state &= ~WM_GIZMO_STATE_MODAL;
+ MEM_SAFE_FREE(gz->interaction_data);
}
return;
}
}
else {
- BLI_assert(ELEM(mmap->mmap_context.modal, NULL, mpr));
+ BLI_assert(ELEM(gzmap->gzmap_context.modal, NULL, gz));
/* deactivate, gizmo but first take care of some stuff */
- if (mpr) {
- mpr->state &= ~WM_GIZMO_STATE_MODAL;
- MEM_SAFE_FREE(mpr->interaction_data);
+ if (gz) {
+ gz->state &= ~WM_GIZMO_STATE_MODAL;
+ MEM_SAFE_FREE(gz->interaction_data);
}
- mmap->mmap_context.modal = NULL;
+ gzmap->gzmap_context.modal = NULL;
if (C) {
wmWindow *win = CTX_wm_window(C);
- if (mmap->mmap_context.event_xy[0] != INT_MAX) {
+ if (gzmap->gzmap_context.event_xy[0] != INT_MAX) {
/* Check if some other part of Blender (typically operators)
* have adjusted the grab mode since it was set.
* If so: warp, so we have a predictable outcome. */
- if (mmap->mmap_context.event_grabcursor == win->grabcursor) {
- WM_cursor_grab_disable(win, mmap->mmap_context.event_xy);
+ if (gzmap->gzmap_context.event_grabcursor == win->grabcursor) {
+ WM_cursor_grab_disable(win, gzmap->gzmap_context.event_xy);
}
else {
- WM_cursor_warp(win, UNPACK2(mmap->mmap_context.event_xy));
+ WM_cursor_warp(win, UNPACK2(gzmap->gzmap_context.event_xy));
}
}
ED_region_tag_redraw(CTX_wm_region(C));
WM_event_add_mousemove(C);
}
- mmap->mmap_context.event_xy[0] = INT_MAX;
+ gzmap->gzmap_context.event_xy[0] = INT_MAX;
}
}
-wmGizmo *wm_gizmomap_modal_get(wmGizmoMap *mmap)
+wmGizmo *wm_gizmomap_modal_get(wmGizmoMap *gzmap)
{
- return mmap->mmap_context.modal;
+ return gzmap->gzmap_context.modal;
}
-wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *mmap, int *r_selected_len)
+wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len)
{
- *r_selected_len = mmap->mmap_context.select.len;
- return mmap->mmap_context.select.items;
+ *r_selected_len = gzmap->gzmap_context.select.len;
+ return gzmap->gzmap_context.select.items;
}
-ListBase *wm_gizmomap_groups_get(wmGizmoMap *mmap)
+ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap)
{
- return &mmap->groups;
+ return &gzmap->groups;
}
void WM_gizmomap_message_subscribe(
- bContext *C, wmGizmoMap *mmap, ARegion *ar, struct wmMsgBus *mbus)
+ bContext *C, wmGizmoMap *gzmap, ARegion *ar, struct wmMsgBus *mbus)
{
- for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
- if (!WM_gizmo_group_type_poll(C, mgroup->type)) {
+ for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
+ if (!WM_gizmo_group_type_poll(C, gzgroup->type)) {
continue;
}
- for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) {
- if (mpr->flag & WM_GIZMO_HIDDEN) {
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if (gz->flag & WM_GIZMO_HIDDEN) {
continue;
}
- WM_gizmo_target_property_subscribe_all(mpr, mbus, ar);
+ WM_gizmo_target_property_subscribe_all(gz, mbus, ar);
}
- if (mgroup->type->message_subscribe != NULL) {
- mgroup->type->message_subscribe(C, mgroup, mbus);
+ if (gzgroup->type->message_subscribe != NULL) {
+ gzgroup->type->message_subscribe(C, gzgroup, mbus);
}
}
}
@@ -1032,12 +1057,12 @@ void WM_gizmomap_message_subscribe(
struct ARegion *WM_gizmomap_tooltip_init(
struct bContext *C, struct ARegion *ar, bool *r_exit_on_event)
{
- wmGizmoMap *mmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = ar->gizmo_map;
*r_exit_on_event = true;
- if (mmap) {
- wmGizmo *mpr = mmap->mmap_context.highlight;
- if (mpr) {
- return UI_tooltip_create_from_gizmo(C, mpr);
+ if (gzmap) {
+ wmGizmo *gz = gzmap->gzmap_context.highlight;
+ if (gz) {
+ return UI_tooltip_create_from_gizmo(C, gz);
}
}
return NULL;
@@ -1051,13 +1076,13 @@ struct ARegion *WM_gizmomap_tooltip_init(
* \{ */
wmGizmoMapType *WM_gizmomaptype_find(
- const struct wmGizmoMapType_Params *mmap_params)
+ const struct wmGizmoMapType_Params *gzmap_params)
{
- for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) {
- if (mmap_type->spaceid == mmap_params->spaceid &&
- mmap_type->regionid == mmap_params->regionid)
+ for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type; gzmap_type = gzmap_type->next) {
+ if (gzmap_type->spaceid == gzmap_params->spaceid &&
+ gzmap_type->regionid == gzmap_params->regionid)
{
- return mmap_type;
+ return gzmap_type;
}
}
@@ -1065,37 +1090,37 @@ wmGizmoMapType *WM_gizmomaptype_find(
}
wmGizmoMapType *WM_gizmomaptype_ensure(
- const struct wmGizmoMapType_Params *mmap_params)
+ const struct wmGizmoMapType_Params *gzmap_params)
{
- wmGizmoMapType *mmap_type = WM_gizmomaptype_find(mmap_params);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_find(gzmap_params);
- if (mmap_type) {
- return mmap_type;
+ if (gzmap_type) {
+ return gzmap_type;
}
- mmap_type = MEM_callocN(sizeof(wmGizmoMapType), "gizmotype list");
- mmap_type->spaceid = mmap_params->spaceid;
- mmap_type->regionid = mmap_params->regionid;
- BLI_addhead(&gizmomaptypes, mmap_type);
+ gzmap_type = MEM_callocN(sizeof(wmGizmoMapType), "gizmotype list");
+ gzmap_type->spaceid = gzmap_params->spaceid;
+ gzmap_type->regionid = gzmap_params->regionid;
+ BLI_addhead(&gizmomaptypes, gzmap_type);
- return mmap_type;
+ return gzmap_type;
}
void wm_gizmomaptypes_free(void)
{
- for (wmGizmoMapType *mmap_type = gizmomaptypes.first, *mmap_type_next;
- mmap_type;
- mmap_type = mmap_type_next)
+ for (wmGizmoMapType *gzmap_type = gizmomaptypes.first, *gzmap_type_next;
+ gzmap_type;
+ gzmap_type = gzmap_type_next)
{
- mmap_type_next = mmap_type->next;
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_next;
- wgt_ref;
- wgt_ref = wgt_next)
+ gzmap_type_next = gzmap_type->next;
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first, *gzgt_next;
+ gzgt_ref;
+ gzgt_ref = gzgt_next)
{
- wgt_next = wgt_ref->next;
- WM_gizmomaptype_group_free(wgt_ref);
+ gzgt_next = gzgt_ref->next;
+ WM_gizmomaptype_group_free(gzgt_ref);
}
- MEM_freeN(mmap_type);
+ MEM_freeN(gzmap_type);
}
}
@@ -1107,9 +1132,9 @@ void wm_gizmos_keymap(wmKeyConfig *keyconf)
/* we add this item-less keymap once and use it to group gizmo-group keymaps into it */
WM_keymap_find(keyconf, "Gizmos", 0, 0);
- for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) {
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) {
- wm_gizmogrouptype_setup_keymap(wgt_ref->type, keyconf);
+ for (wmGizmoMapType *gzmap_type = gizmomaptypes.first; gzmap_type; gzmap_type = gzmap_type->next) {
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first; gzgt_ref; gzgt_ref = gzgt_ref->next) {
+ wm_gizmogrouptype_setup_keymap(gzgt_ref->type, keyconf);
}
}
}
@@ -1123,23 +1148,23 @@ void wm_gizmos_keymap(wmKeyConfig *keyconf)
void WM_gizmoconfig_update_tag_init(
- wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt)
+ wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
{
/* tag for update on next use */
- mmap_type->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT);
- wgt->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT);
+ gzmap_type->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT);
+ gzgt->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT);
- wm_mmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
+ wm_gzmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
}
void WM_gizmoconfig_update_tag_remove(
- wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt)
+ wmGizmoMapType *gzmap_type, wmGizmoGroupType *gzgt)
{
/* tag for update on next use */
- mmap_type->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE;
- wgt->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE;
+ gzmap_type->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE;
+ gzgt->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE;
- wm_mmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
+ wm_gzmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
}
/**
@@ -1151,58 +1176,58 @@ void WM_gizmoconfig_update(struct Main *bmain)
if (G.background)
return;
- if (wm_mmap_type_update_flag == 0)
+ if (wm_gzmap_type_update_flag == 0)
return;
- if (wm_mmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
- for (wmGizmoMapType *mmap_type = gizmomaptypes.first;
- mmap_type;
- mmap_type = mmap_type->next)
+ if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
+ for (wmGizmoMapType *gzmap_type = gizmomaptypes.first;
+ gzmap_type;
+ gzmap_type = gzmap_type->next)
{
- if (mmap_type->type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
- mmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_ref_next;
- wgt_ref;
- wgt_ref = wgt_ref_next)
+ if (gzmap_type->type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
+ gzmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first, *gzgt_ref_next;
+ gzgt_ref;
+ gzgt_ref = gzgt_ref_next)
{
- wgt_ref_next = wgt_ref->next;
- if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_REMOVE) {
- wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
- WM_gizmomaptype_group_unlink(NULL, bmain, mmap_type, wgt_ref->type);
+ gzgt_ref_next = gzgt_ref->next;
+ if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_REMOVE) {
+ gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE;
+ WM_gizmomaptype_group_unlink(NULL, bmain, gzmap_type, gzgt_ref->type);
}
}
}
}
- wm_mmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
+ wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE;
}
- if (wm_mmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT) {
- for (wmGizmoMapType *mmap_type = gizmomaptypes.first;
- mmap_type;
- mmap_type = mmap_type->next)
+ if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT) {
+ for (wmGizmoMapType *gzmap_type = gizmomaptypes.first;
+ gzmap_type;
+ gzmap_type = gzmap_type->next)
{
const uchar type_update_all = WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT;
- if (mmap_type->type_update_flag & type_update_all) {
- mmap_type->type_update_flag &= ~type_update_all;
- for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first;
- wgt_ref;
- wgt_ref = wgt_ref->next)
+ if (gzmap_type->type_update_flag & type_update_all) {
+ gzmap_type->type_update_flag &= ~type_update_all;
+ for (wmGizmoGroupTypeRef *gzgt_ref = gzmap_type->grouptype_refs.first;
+ gzgt_ref;
+ gzgt_ref = gzgt_ref->next)
{
- if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
- WM_gizmomaptype_group_init_runtime_keymap(bmain, wgt_ref->type);
- wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
+ if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) {
+ WM_gizmomaptype_group_init_runtime_keymap(bmain, gzgt_ref->type);
+ gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT;
}
- if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_INIT) {
- WM_gizmomaptype_group_init_runtime(bmain, mmap_type, wgt_ref->type);
- wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT;
+ if (gzgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_INIT) {
+ WM_gizmomaptype_group_init_runtime(bmain, gzmap_type, gzgt_ref->type);
+ gzgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT;
}
}
}
}
- wm_mmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
+ wm_gzmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT;
}
}
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
index f3df001af55..601c54b8be5 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
@@ -51,30 +51,30 @@
/** \name Property Definition
* \{ */
-BLI_INLINE wmGizmoProperty *wm_gizmo_target_property_array(wmGizmo *mpr)
+BLI_INLINE wmGizmoProperty *wm_gizmo_target_property_array(wmGizmo *gz)
{
- return (wmGizmoProperty *)(POINTER_OFFSET(mpr, mpr->type->struct_size));
+ return (wmGizmoProperty *)(POINTER_OFFSET(gz, gz->type->struct_size));
}
-wmGizmoProperty *WM_gizmo_target_property_array(wmGizmo *mpr)
+wmGizmoProperty *WM_gizmo_target_property_array(wmGizmo *gz)
{
- return wm_gizmo_target_property_array(mpr);
+ return wm_gizmo_target_property_array(gz);
}
-wmGizmoProperty *WM_gizmo_target_property_at_index(wmGizmo *mpr, int index)
+wmGizmoProperty *WM_gizmo_target_property_at_index(wmGizmo *gz, int index)
{
- BLI_assert(index < mpr->type->target_property_defs_len);
+ BLI_assert(index < gz->type->target_property_defs_len);
BLI_assert(index != -1);
- wmGizmoProperty *mpr_prop_array = wm_gizmo_target_property_array(mpr);
- return &mpr_prop_array[index];
+ wmGizmoProperty *gz_prop_array = wm_gizmo_target_property_array(gz);
+ return &gz_prop_array[index];
}
-wmGizmoProperty *WM_gizmo_target_property_find(wmGizmo *mpr, const char *idname)
+wmGizmoProperty *WM_gizmo_target_property_find(wmGizmo *gz, const char *idname)
{
int index = BLI_findstringindex(
- &mpr->type->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname));
+ &gz->type->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname));
if (index != -1) {
- return WM_gizmo_target_property_at_index(mpr, index);
+ return WM_gizmo_target_property_at_index(gz, index);
}
else {
return NULL;
@@ -82,84 +82,84 @@ wmGizmoProperty *WM_gizmo_target_property_find(wmGizmo *mpr, const char *idname)
}
void WM_gizmo_target_property_def_rna_ptr(
- wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type,
+ wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type,
PointerRNA *ptr, PropertyRNA *prop, int index)
{
- wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type);
+ wmGizmoProperty *gz_prop = WM_gizmo_target_property_at_index(gz, gz_prop_type->index_in_type);
/* if gizmo evokes an operator we cannot use it for property manipulation */
- BLI_assert(mpr->op_data == NULL);
+ BLI_assert(gz->op_data == NULL);
- mpr_prop->type = mpr_prop_type;
+ gz_prop->type = gz_prop_type;
- mpr_prop->ptr = *ptr;
- mpr_prop->prop = prop;
- mpr_prop->index = index;
+ gz_prop->ptr = *ptr;
+ gz_prop->prop = prop;
+ gz_prop->index = index;
- if (mpr->type->property_update) {
- mpr->type->property_update(mpr, mpr_prop);
+ if (gz->type->property_update) {
+ gz->type->property_update(gz, gz_prop);
}
}
void WM_gizmo_target_property_def_rna(
- wmGizmo *mpr, const char *idname,
+ wmGizmo *gz, const char *idname,
PointerRNA *ptr, const char *propname, int index)
{
- const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname);
+ const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(gz->type, idname);
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- WM_gizmo_target_property_def_rna_ptr(mpr, mpr_prop_type, ptr, prop, index);
+ WM_gizmo_target_property_def_rna_ptr(gz, gz_prop_type, ptr, prop, index);
}
void WM_gizmo_target_property_def_func_ptr(
- wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type,
+ wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type,
const wmGizmoPropertyFnParams *params)
{
- wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type);
+ wmGizmoProperty *gz_prop = WM_gizmo_target_property_at_index(gz, gz_prop_type->index_in_type);
/* if gizmo evokes an operator we cannot use it for property manipulation */
- BLI_assert(mpr->op_data == NULL);
+ BLI_assert(gz->op_data == NULL);
- mpr_prop->type = mpr_prop_type;
+ gz_prop->type = gz_prop_type;
- mpr_prop->custom_func.value_get_fn = params->value_get_fn;
- mpr_prop->custom_func.value_set_fn = params->value_set_fn;
- mpr_prop->custom_func.range_get_fn = params->range_get_fn;
- mpr_prop->custom_func.free_fn = params->free_fn;
- mpr_prop->custom_func.user_data = params->user_data;
+ gz_prop->custom_func.value_get_fn = params->value_get_fn;
+ gz_prop->custom_func.value_set_fn = params->value_set_fn;
+ gz_prop->custom_func.range_get_fn = params->range_get_fn;
+ gz_prop->custom_func.free_fn = params->free_fn;
+ gz_prop->custom_func.user_data = params->user_data;
- if (mpr->type->property_update) {
- mpr->type->property_update(mpr, mpr_prop);
+ if (gz->type->property_update) {
+ gz->type->property_update(gz, gz_prop);
}
}
void WM_gizmo_target_property_def_func(
- wmGizmo *mpr, const char *idname,
+ wmGizmo *gz, const char *idname,
const wmGizmoPropertyFnParams *params)
{
- const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname);
- WM_gizmo_target_property_def_func_ptr(mpr, mpr_prop_type, params);
+ const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(gz->type, idname);
+ WM_gizmo_target_property_def_func_ptr(gz, gz_prop_type, params);
}
void WM_gizmo_target_property_clear_rna_ptr(
- wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type)
+ wmGizmo *gz, const wmGizmoPropertyType *gz_prop_type)
{
- wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type);
+ wmGizmoProperty *gz_prop = WM_gizmo_target_property_at_index(gz, gz_prop_type->index_in_type);
/* if gizmo evokes an operator we cannot use it for property manipulation */
- BLI_assert(mpr->op_data == NULL);
+ BLI_assert(gz->op_data == NULL);
- mpr_prop->type = NULL;
+ gz_prop->type = NULL;
- mpr_prop->ptr = PointerRNA_NULL;
- mpr_prop->prop = NULL;
- mpr_prop->index = -1;
+ gz_prop->ptr = PointerRNA_NULL;
+ gz_prop->prop = NULL;
+ gz_prop->index = -1;
}
void WM_gizmo_target_property_clear_rna(
- wmGizmo *mpr, const char *idname)
+ wmGizmo *gz, const char *idname)
{
- const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname);
- WM_gizmo_target_property_clear_rna_ptr(mpr, mpr_prop_type);
+ const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(gz->type, idname);
+ WM_gizmo_target_property_clear_rna_ptr(gz, gz_prop_type);
}
@@ -171,93 +171,93 @@ void WM_gizmo_target_property_clear_rna(
/** \name Property Access
* \{ */
-bool WM_gizmo_target_property_is_valid_any(wmGizmo *mpr)
+bool WM_gizmo_target_property_is_valid_any(wmGizmo *gz)
{
- wmGizmoProperty *mpr_prop_array = wm_gizmo_target_property_array(mpr);
- for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
- wmGizmoProperty *mpr_prop = &mpr_prop_array[i];
- if (WM_gizmo_target_property_is_valid(mpr_prop)) {
+ wmGizmoProperty *gz_prop_array = wm_gizmo_target_property_array(gz);
+ for (int i = 0; i < gz->type->target_property_defs_len; i++) {
+ wmGizmoProperty *gz_prop = &gz_prop_array[i];
+ if (WM_gizmo_target_property_is_valid(gz_prop)) {
return true;
}
}
return false;
}
-bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *mpr_prop)
+bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
{
- return ((mpr_prop->prop != NULL) ||
- (mpr_prop->custom_func.value_get_fn && mpr_prop->custom_func.value_set_fn));
+ return ((gz_prop->prop != NULL) ||
+ (gz_prop->custom_func.value_get_fn && gz_prop->custom_func.value_set_fn));
}
float WM_gizmo_target_property_value_get(
- const wmGizmo *mpr, wmGizmoProperty *mpr_prop)
+ const wmGizmo *gz, wmGizmoProperty *gz_prop)
{
- if (mpr_prop->custom_func.value_get_fn) {
+ if (gz_prop->custom_func.value_get_fn) {
float value = 0.0f;
- BLI_assert(mpr_prop->type->array_length == 1);
- mpr_prop->custom_func.value_get_fn(mpr, mpr_prop, &value);
+ BLI_assert(gz_prop->type->array_length == 1);
+ gz_prop->custom_func.value_get_fn(gz, gz_prop, &value);
return value;
}
- if (mpr_prop->index == -1) {
- return RNA_property_float_get(&mpr_prop->ptr, mpr_prop->prop);
+ if (gz_prop->index == -1) {
+ return RNA_property_float_get(&gz_prop->ptr, gz_prop->prop);
}
else {
- return RNA_property_float_get_index(&mpr_prop->ptr, mpr_prop->prop, mpr_prop->index);
+ return RNA_property_float_get_index(&gz_prop->ptr, gz_prop->prop, gz_prop->index);
}
}
void WM_gizmo_target_property_value_set(
- bContext *C, const wmGizmo *mpr,
- wmGizmoProperty *mpr_prop, const float value)
+ bContext *C, const wmGizmo *gz,
+ wmGizmoProperty *gz_prop, const float value)
{
- if (mpr_prop->custom_func.value_set_fn) {
- BLI_assert(mpr_prop->type->array_length == 1);
- mpr_prop->custom_func.value_set_fn(mpr, mpr_prop, &value);
+ if (gz_prop->custom_func.value_set_fn) {
+ BLI_assert(gz_prop->type->array_length == 1);
+ gz_prop->custom_func.value_set_fn(gz, gz_prop, &value);
return;
}
/* reset property */
- if (mpr_prop->index == -1) {
- RNA_property_float_set(&mpr_prop->ptr, mpr_prop->prop, value);
+ if (gz_prop->index == -1) {
+ RNA_property_float_set(&gz_prop->ptr, gz_prop->prop, value);
}
else {
- RNA_property_float_set_index(&mpr_prop->ptr, mpr_prop->prop, mpr_prop->index, value);
+ RNA_property_float_set_index(&gz_prop->ptr, gz_prop->prop, gz_prop->index, value);
}
- RNA_property_update(C, &mpr_prop->ptr, mpr_prop->prop);
+ RNA_property_update(C, &gz_prop->ptr, gz_prop->prop);
}
void WM_gizmo_target_property_value_get_array(
- const wmGizmo *mpr, wmGizmoProperty *mpr_prop,
+ const wmGizmo *gz, wmGizmoProperty *gz_prop,
float *value)
{
- if (mpr_prop->custom_func.value_get_fn) {
- mpr_prop->custom_func.value_get_fn(mpr, mpr_prop, value);
+ if (gz_prop->custom_func.value_get_fn) {
+ gz_prop->custom_func.value_get_fn(gz, gz_prop, value);
return;
}
- RNA_property_float_get_array(&mpr_prop->ptr, mpr_prop->prop, value);
+ RNA_property_float_get_array(&gz_prop->ptr, gz_prop->prop, value);
}
void WM_gizmo_target_property_value_set_array(
- bContext *C, const wmGizmo *mpr, wmGizmoProperty *mpr_prop,
+ bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop,
const float *value)
{
- if (mpr_prop->custom_func.value_set_fn) {
- mpr_prop->custom_func.value_set_fn(mpr, mpr_prop, value);
+ if (gz_prop->custom_func.value_set_fn) {
+ gz_prop->custom_func.value_set_fn(gz, gz_prop, value);
return;
}
- RNA_property_float_set_array(&mpr_prop->ptr, mpr_prop->prop, value);
+ RNA_property_float_set_array(&gz_prop->ptr, gz_prop->prop, value);
- RNA_property_update(C, &mpr_prop->ptr, mpr_prop->prop);
+ RNA_property_update(C, &gz_prop->ptr, gz_prop->prop);
}
bool WM_gizmo_target_property_range_get(
- const wmGizmo *mpr, wmGizmoProperty *mpr_prop,
+ const wmGizmo *gz, wmGizmoProperty *gz_prop,
float range[2])
{
- if (mpr_prop->custom_func.value_get_fn) {
- if (mpr_prop->custom_func.range_get_fn) {
- mpr_prop->custom_func.range_get_fn(mpr, mpr_prop, range);
+ if (gz_prop->custom_func.value_get_fn) {
+ if (gz_prop->custom_func.range_get_fn) {
+ gz_prop->custom_func.range_get_fn(gz, gz_prop, range);
return true;
}
else {
@@ -267,17 +267,17 @@ bool WM_gizmo_target_property_range_get(
}
float step, precision;
- RNA_property_float_ui_range(&mpr_prop->ptr, mpr_prop->prop, &range[0], &range[1], &step, &precision);
+ RNA_property_float_ui_range(&gz_prop->ptr, gz_prop->prop, &range[0], &range[1], &step, &precision);
return true;
}
int WM_gizmo_target_property_array_length(
- const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop)
+ const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop)
{
- if (mpr_prop->custom_func.value_get_fn) {
- return mpr_prop->type->array_length;
+ if (gz_prop->custom_func.value_get_fn) {
+ return gz_prop->type->array_length;
}
- return RNA_property_array_length(&mpr_prop->ptr, mpr_prop->prop);
+ return RNA_property_array_length(&gz_prop->ptr, gz_prop->prop);
}
/** \} */
@@ -289,26 +289,26 @@ int WM_gizmo_target_property_array_length(
* \{ */
const wmGizmoPropertyType *WM_gizmotype_target_property_find(
- const wmGizmoType *wt, const char *idname)
+ const wmGizmoType *gzt, const char *idname)
{
- return BLI_findstring(&wt->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname));
+ return BLI_findstring(&gzt->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname));
}
void WM_gizmotype_target_property_def(
- wmGizmoType *wt, const char *idname, int data_type, int array_length)
+ wmGizmoType *gzt, const char *idname, int data_type, int array_length)
{
wmGizmoPropertyType *mpt;
- BLI_assert(WM_gizmotype_target_property_find(wt, idname) == NULL);
+ BLI_assert(WM_gizmotype_target_property_find(gzt, idname) == NULL);
const uint idname_size = strlen(idname) + 1;
mpt = MEM_callocN(sizeof(wmGizmoPropertyType) + idname_size, __func__);
memcpy(mpt->idname, idname, idname_size);
mpt->data_type = data_type;
mpt->array_length = array_length;
- mpt->index_in_type = wt->target_property_defs_len;
- wt->target_property_defs_len += 1;
- BLI_addtail(&wt->target_property_defs, mpt);
+ mpt->index_in_type = gzt->target_property_defs_len;
+ gzt->target_property_defs_len += 1;
+ BLI_addtail(&gzt->target_property_defs, mpt);
}
/** \} */
@@ -322,10 +322,10 @@ void WM_gizmo_do_msg_notify_tag_refresh(
bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val)
{
ARegion *ar = msg_val->owner;
- wmGizmoMap *mmap = msg_val->user_data;
+ wmGizmoMap *gzmap = msg_val->user_data;
ED_region_tag_redraw(ar);
- WM_gizmomap_tag_refresh(mmap);
+ WM_gizmomap_tag_refresh(gzmap);
}
/**
@@ -333,26 +333,26 @@ void WM_gizmo_do_msg_notify_tag_refresh(
* drawing the region clears.
*/
void WM_gizmo_target_property_subscribe_all(
- wmGizmo *mpr, struct wmMsgBus *mbus, ARegion *ar)
+ wmGizmo *gz, struct wmMsgBus *mbus, ARegion *ar)
{
- if (mpr->type->target_property_defs_len) {
- wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr);
- for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
- wmGizmoProperty *mpr_prop = &mpr_prop_array[i];
- if (WM_gizmo_target_property_is_valid(mpr_prop)) {
- if (mpr_prop->prop) {
+ if (gz->type->target_property_defs_len) {
+ wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz);
+ for (int i = 0; i < gz->type->target_property_defs_len; i++) {
+ wmGizmoProperty *gz_prop = &gz_prop_array[i];
+ if (WM_gizmo_target_property_is_valid(gz_prop)) {
+ if (gz_prop->prop) {
WM_msg_subscribe_rna(
- mbus, &mpr_prop->ptr, mpr_prop->prop,
+ mbus, &gz_prop->ptr, gz_prop->prop,
&(const wmMsgSubscribeValue){
.owner = ar,
.user_data = ar,
.notify = ED_region_do_msg_notify_tag_redraw,
}, __func__);
WM_msg_subscribe_rna(
- mbus, &mpr_prop->ptr, mpr_prop->prop,
+ mbus, &gz_prop->ptr, gz_prop->prop,
&(const wmMsgSubscribeValue){
.owner = ar,
- .user_data = mpr->parent_mgroup->parent_mmap,
+ .user_data = gz->parent_gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
}, __func__);
}
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
index ba145af9582..2ff0148044c 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
@@ -62,11 +62,11 @@ static GHash *global_gizmotype_hash = NULL;
const wmGizmoType *WM_gizmotype_find(const char *idname, bool quiet)
{
if (idname[0]) {
- wmGizmoType *wt;
+ wmGizmoType *gzt;
- wt = BLI_ghash_lookup(global_gizmotype_hash, idname);
- if (wt) {
- return wt;
+ gzt = BLI_ghash_lookup(global_gizmotype_hash, idname);
+ if (gzt) {
+ return gzt;
}
if (!quiet) {
@@ -90,56 +90,56 @@ void WM_gizmotype_iter(GHashIterator *ghi)
static wmGizmoType *wm_gizmotype_append__begin(void)
{
- wmGizmoType *wt = MEM_callocN(sizeof(wmGizmoType), "gizmotype");
- wt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoProperties);
+ wmGizmoType *gzt = MEM_callocN(sizeof(wmGizmoType), "gizmotype");
+ gzt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoProperties);
#if 0
/* Set the default i18n context now, so that opfunc can redefine it if needed! */
RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT;
#endif
- return wt;
+ return gzt;
}
-static void wm_gizmotype_append__end(wmGizmoType *wt)
+static void wm_gizmotype_append__end(wmGizmoType *gzt)
{
- BLI_assert(wt->struct_size >= sizeof(wmGizmo));
+ BLI_assert(gzt->struct_size >= sizeof(wmGizmo));
- RNA_def_struct_identifier(&BLENDER_RNA, wt->srna, wt->idname);
+ RNA_def_struct_identifier(&BLENDER_RNA, gzt->srna, gzt->idname);
- BLI_ghash_insert(global_gizmotype_hash, (void *)wt->idname, wt);
+ BLI_ghash_insert(global_gizmotype_hash, (void *)gzt->idname, gzt);
}
-void WM_gizmotype_append(void (*wtfunc)(struct wmGizmoType *))
+void WM_gizmotype_append(void (*gtfunc)(struct wmGizmoType *))
{
- wmGizmoType *wt = wm_gizmotype_append__begin();
- wtfunc(wt);
- wm_gizmotype_append__end(wt);
+ wmGizmoType *gzt = wm_gizmotype_append__begin();
+ gtfunc(gzt);
+ wm_gizmotype_append__end(gzt);
}
-void WM_gizmotype_append_ptr(void (*wtfunc)(struct wmGizmoType *, void *), void *userdata)
+void WM_gizmotype_append_ptr(void (*gtfunc)(struct wmGizmoType *, void *), void *userdata)
{
wmGizmoType *mt = wm_gizmotype_append__begin();
- wtfunc(mt, userdata);
+ gtfunc(mt, userdata);
wm_gizmotype_append__end(mt);
}
/**
* Free but don't remove from ghash.
*/
-static void gizmotype_free(wmGizmoType *wt)
+static void gizmotype_free(wmGizmoType *gzt)
{
- if (wt->ext.srna) { /* python gizmo, allocs own string */
- MEM_freeN((void *)wt->idname);
+ if (gzt->ext.srna) { /* python gizmo, allocs own string */
+ MEM_freeN((void *)gzt->idname);
}
- BLI_freelistN(&wt->target_property_defs);
- MEM_freeN(wt);
+ BLI_freelistN(&gzt->target_property_defs);
+ MEM_freeN(gzt);
}
/**
* \param C: May be NULL.
*/
static void gizmotype_unlink(
- bContext *C, Main *bmain, wmGizmoType *wt)
+ bContext *C, Main *bmain, wmGizmoType *gzt)
{
/* Free instances. */
for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) {
@@ -147,15 +147,15 @@ static void gizmotype_unlink(
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
for (ARegion *ar = lb->first; ar; ar = ar->next) {
- wmGizmoMap *mmap = ar->gizmo_map;
- if (mmap) {
- wmGizmoGroup *mgroup;
- for (mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
- for (wmGizmo *mpr = mgroup->gizmos.first, *mpr_next; mpr; mpr = mpr_next) {
- mpr_next = mpr->next;
- BLI_assert(mgroup->parent_mmap == mmap);
- if (mpr->type == wt) {
- WM_gizmo_unlink(&mgroup->gizmos, mgroup->parent_mmap, mpr, C);
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ if (gzmap) {
+ wmGizmoGroup *gzgroup;
+ for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
+ for (wmGizmo *gz = gzgroup->gizmos.first, *gz_next; gz; gz = gz_next) {
+ gz_next = gz->next;
+ BLI_assert(gzgroup->parent_gzmap == gzmap);
+ if (gz->type == gzt) {
+ WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gz, C);
ED_region_tag_redraw(ar);
}
}
@@ -167,26 +167,26 @@ static void gizmotype_unlink(
}
}
-void WM_gizmotype_remove_ptr(bContext *C, Main *bmain, wmGizmoType *wt)
+void WM_gizmotype_remove_ptr(bContext *C, Main *bmain, wmGizmoType *gzt)
{
- BLI_assert(wt == WM_gizmotype_find(wt->idname, false));
+ BLI_assert(gzt == WM_gizmotype_find(gzt->idname, false));
- BLI_ghash_remove(global_gizmotype_hash, wt->idname, NULL, NULL);
+ BLI_ghash_remove(global_gizmotype_hash, gzt->idname, NULL, NULL);
- gizmotype_unlink(C, bmain, wt);
+ gizmotype_unlink(C, bmain, gzt);
- gizmotype_free(wt);
+ gizmotype_free(gzt);
}
bool WM_gizmotype_remove(bContext *C, Main *bmain, const char *idname)
{
- wmGizmoType *wt = BLI_ghash_lookup(global_gizmotype_hash, idname);
+ wmGizmoType *gzt = BLI_ghash_lookup(global_gizmotype_hash, idname);
- if (wt == NULL) {
+ if (gzt == NULL) {
return false;
}
- WM_gizmotype_remove_ptr(C, bmain, wt);
+ WM_gizmotype_remove_ptr(C, bmain, gzt);
return true;
}
diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
index a94f1e994e9..88065a0fcd5 100644
--- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
+++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h
@@ -51,7 +51,7 @@ typedef void (*wmGizmoGroupFnMsgBusSubscribe)(
typedef void (*wmGizmoFnSetup)(struct wmGizmo *);
typedef void (*wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *);
typedef void (*wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int);
-typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const struct wmEvent *);
+typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const int mval[2]);
typedef int (*wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak);
typedef void (*wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *);
typedef void (*wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4]);
diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
index 5b1085db4a1..414109e89e5 100644
--- a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
+++ b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h
@@ -61,12 +61,12 @@ void wm_gizmogrouptype_init(void);
void GIZMOGROUP_OT_gizmo_select(struct wmOperatorType *ot);
void GIZMOGROUP_OT_gizmo_tweak(struct wmOperatorType *ot);
-bool wm_gizmogroup_is_any_selected(const struct wmGizmoGroup *mgroup);
+bool wm_gizmogroup_is_any_selected(const struct wmGizmoGroup *gzgroup);
/* -------------------------------------------------------------------- */
/* wmGizmoMap */
-void wm_gizmomap_remove(struct wmGizmoMap *mmap);
+void wm_gizmomap_remove(struct wmGizmoMap *gzmap);
void wm_gizmos_keymap(struct wmKeyConfig *keyconf);
@@ -75,19 +75,19 @@ void wm_gizmomaps_handled_modal_update(
void wm_gizmomap_handler_context(bContext *C, struct wmEventHandler *handler);
struct wmGizmo *wm_gizmomap_highlight_find(
- struct wmGizmoMap *mmap, bContext *C, const struct wmEvent *event,
+ struct wmGizmoMap *gzmap, bContext *C, const struct wmEvent *event,
int *r_part);
bool wm_gizmomap_highlight_set(
- struct wmGizmoMap *mmap, const bContext *C,
- struct wmGizmo *mpr, int part);
-struct wmGizmo *wm_gizmomap_highlight_get(struct wmGizmoMap *mmap);
+ struct wmGizmoMap *gzmap, const bContext *C,
+ struct wmGizmo *gz, int part);
+struct wmGizmo *wm_gizmomap_highlight_get(struct wmGizmoMap *gzmap);
void wm_gizmomap_modal_set(
- struct wmGizmoMap *mmap, bContext *C, struct wmGizmo *mpr,
+ struct wmGizmoMap *gzmap, bContext *C, struct wmGizmo *gz,
const struct wmEvent *event, bool enable);
-struct wmGizmo *wm_gizmomap_modal_get(struct wmGizmoMap *mmap);
-struct wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *mmap, int *r_selected_len);
-struct ListBase *wm_gizmomap_groups_get(wmGizmoMap *mmap);
+struct wmGizmo *wm_gizmomap_modal_get(struct wmGizmoMap *gzmap);
+struct wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *gzmap, int *r_selected_len);
+struct ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap);
/* -------------------------------------------------------------------- */
/* wmGizmoMapType */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index f92cc511449..7247529d02d 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -223,65 +223,6 @@ void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot)
}
}
-/* ************ uiListType handling ************** */
-
-static GHash *uilisttypes_hash = NULL;
-
-uiListType *WM_uilisttype_find(const char *idname, bool quiet)
-{
- uiListType *ult;
-
- if (idname[0]) {
- ult = BLI_ghash_lookup(uilisttypes_hash, idname);
- if (ult) {
- return ult;
- }
- }
-
- if (!quiet) {
- printf("search for unknown uilisttype %s\n", idname);
- }
-
- return NULL;
-}
-
-bool WM_uilisttype_add(uiListType *ult)
-{
- BLI_ghash_insert(uilisttypes_hash, ult->idname, ult);
- return 1;
-}
-
-void WM_uilisttype_freelink(uiListType *ult)
-{
- bool ok;
-
- ok = BLI_ghash_remove(uilisttypes_hash, ult->idname, NULL, MEM_freeN);
-
- BLI_assert(ok);
- (void)ok;
-}
-
-/* called on initialize WM_init() */
-void WM_uilisttype_init(void)
-{
- uilisttypes_hash = BLI_ghash_str_new_ex("uilisttypes_hash gh", 16);
-}
-
-void WM_uilisttype_free(void)
-{
- GHashIterator gh_iter;
-
- GHASH_ITER (gh_iter, uilisttypes_hash) {
- uiListType *ult = BLI_ghashIterator_getValue(&gh_iter);
- if (ult->ext.free) {
- ult->ext.free(ult->ext.data);
- }
- }
-
- BLI_ghash_free(uilisttypes_hash, NULL, MEM_freeN);
- uilisttypes_hash = NULL;
-}
-
/* ****************************************** */
void WM_keymap_init(bContext *C)
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index eca3a838c0f..73748ba6322 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -45,6 +45,7 @@
#include "BIF_glutil.h"
#include "BKE_context.h"
+#include "BKE_idcode.h"
#include "GPU_shader.h"
@@ -98,7 +99,8 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
wmDropBox *WM_dropbox_add(
- ListBase *lb, const char *idname, bool (*poll)(bContext *, wmDrag *, const wmEvent *),
+ ListBase *lb, const char *idname,
+ bool (*poll)(bContext *, wmDrag *, const wmEvent *, const char **),
void (*copy)(wmDrag *, wmDropBox *))
{
wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
@@ -154,10 +156,17 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
drag->flags = flags;
drag->icon = icon;
drag->type = type;
- if (type == WM_DRAG_PATH)
+ if (type == WM_DRAG_PATH) {
BLI_strncpy(drag->path, poin, FILE_MAX);
- else
+ }
+ else if (type == WM_DRAG_ID) {
+ if (poin) {
+ WM_drag_add_ID(drag, poin, NULL);
+ }
+ }
+ else {
drag->poin = poin;
+ }
drag->value = value;
return drag;
@@ -177,6 +186,7 @@ void WM_drag_free(wmDrag *drag)
MEM_freeN(drag->poin);
}
+ BLI_freelistN(&drag->ids);
MEM_freeN(drag);
}
@@ -188,6 +198,7 @@ void WM_drag_free_list(struct ListBase *lb)
}
}
+
static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, const wmEvent *event)
{
wmEventHandler *handler = handlers->first;
@@ -195,10 +206,12 @@ static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag,
if (handler->dropboxes) {
wmDropBox *drop = handler->dropboxes->first;
for (; drop; drop = drop->next) {
- if (drop->poll(C, drag, event))
+ const char *tooltip = NULL;
+ if (drop->poll(C, drag, event, &tooltip)) {
/* XXX Doing translation here might not be ideal, but later we have no more
* access to ot (and hence op context)... */
- return RNA_struct_ui_name(drop->ot->srna);
+ return (tooltip) ? tooltip : RNA_struct_ui_name(drop->ot->srna);
+ }
}
}
}
@@ -266,6 +279,57 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
}
}
+/* ************** IDs ***************** */
+
+void WM_drag_add_ID(wmDrag *drag, ID *id, ID *from_parent)
+{
+ /* Don't drag the same ID twice. */
+ for (wmDragID *drag_id = drag->ids.first; drag_id; drag_id = drag_id->next) {
+ if (drag_id->id == id) {
+ if (drag_id->from_parent == NULL) {
+ drag_id->from_parent = from_parent;
+ }
+ return;
+ }
+ else if (GS(drag_id->id->name) != GS(id->name)) {
+ BLI_assert(!"All dragged IDs must have the same type");
+ return;
+ }
+ }
+
+ /* Add to list. */
+ wmDragID *drag_id = MEM_callocN(sizeof(wmDragID), __func__);
+ drag_id->id = id;
+ drag_id->from_parent = from_parent;
+ BLI_addtail(&drag->ids, drag_id);
+}
+
+ID *WM_drag_ID(const wmDrag *drag, short idcode)
+{
+ if (drag->type != WM_DRAG_ID) {
+ return NULL;
+ }
+
+ wmDragID *drag_id = drag->ids.first;
+ if (!drag_id) {
+ return NULL;
+ }
+
+ ID *id = drag_id->id;
+ return (idcode == 0 || GS(id->name) == idcode) ? id : NULL;
+
+}
+
+ID *WM_drag_ID_from_event(const wmEvent *event, short idcode)
+{
+ if (event->custom != EVT_DATA_DRAGDROP) {
+ return NULL;
+ }
+
+ ListBase *lb = event->customdata;
+ return WM_drag_ID(lb->first, idcode);
+}
+
/* ************** draw ***************** */
static void wm_drop_operator_draw(const char *name, int x, int y)
@@ -282,8 +346,16 @@ static const char *wm_drag_name(wmDrag *drag)
switch (drag->type) {
case WM_DRAG_ID:
{
- ID *id = drag->poin;
- return id->name + 2;
+ ID *id = WM_drag_ID(drag, 0);
+ bool single = (BLI_listbase_count_at_most(&drag->ids, 2) == 1);
+
+ if (single) {
+ return id->name + 2;
+ }
+ else if (id) {
+ return BKE_idcode_to_name_plural(GS(id->name));
+ }
+ break;
}
case WM_DRAG_PATH:
case WM_DRAG_NAME:
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 5314c434c4c..160aeb6671b 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -456,9 +456,9 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
glUniform1i(GPU_shader_get_uniform(shader, "image"), 0);
glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), halfx, halfy, 1.0f + halfx, 1.0f + halfy);
glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax + 1, ar->winrct.ymax + 1);
- glUniform4f(GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
+ glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
- GWN_draw_primitive(GWN_PRIM_TRI_STRIP, 4);
+ GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4);
glBindTexture(GL_TEXTURE_2D, 0);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index bc24b7698e2..0581d41ea04 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -98,7 +98,7 @@ static void wm_notifier_clear(wmNotifier *note);
static void update_tablet_data(wmWindow *win, wmEvent *event);
static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
- const short context, const bool poll_only);
+ const short context, const bool poll_only, wmEvent *event);
/* ************ event management ************** */
@@ -638,7 +638,7 @@ bool WM_operator_poll(bContext *C, wmOperatorType *ot)
/* sets up the new context and calls 'wm_operator_invoke()' with poll_only */
bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
{
- return wm_operator_call_internal(C, ot, NULL, NULL, context, true);
+ return wm_operator_call_internal(C, ot, NULL, NULL, context, true, NULL);
}
bool WM_operator_check_ui_empty(wmOperatorType *ot)
@@ -1431,10 +1431,8 @@ static int wm_operator_invoke(
*/
static int wm_operator_call_internal(
bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
- const short context, const bool poll_only)
+ const short context, const bool poll_only, wmEvent *event)
{
- wmEvent *event;
-
int retval;
CTX_wm_operator_poll_msg_set(C, NULL);
@@ -1443,27 +1441,29 @@ static int wm_operator_call_internal(
if (ot) {
wmWindow *window = CTX_wm_window(C);
- switch (context) {
- case WM_OP_INVOKE_DEFAULT:
- case WM_OP_INVOKE_REGION_WIN:
- case WM_OP_INVOKE_REGION_PREVIEW:
- case WM_OP_INVOKE_REGION_CHANNELS:
- case WM_OP_INVOKE_AREA:
- case WM_OP_INVOKE_SCREEN:
- /* window is needed for invoke, cancel operator */
- if (window == NULL) {
- if (poll_only) {
- CTX_wm_operator_poll_msg_set(C, "Missing 'window' in context");
+ if (event == NULL) {
+ switch (context) {
+ case WM_OP_INVOKE_DEFAULT:
+ case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_INVOKE_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_CHANNELS:
+ case WM_OP_INVOKE_AREA:
+ case WM_OP_INVOKE_SCREEN:
+ /* window is needed for invoke, cancel operator */
+ if (window == NULL) {
+ if (poll_only) {
+ CTX_wm_operator_poll_msg_set(C, "Missing 'window' in context");
+ }
+ return 0;
}
- return 0;
- }
- else {
- event = window->eventstate;
- }
- break;
- default:
- event = NULL;
- break;
+ else {
+ event = window->eventstate;
+ }
+ break;
+ default:
+ event = NULL;
+ break;
+ }
}
switch (context) {
@@ -1561,7 +1561,7 @@ static int wm_operator_call_internal(
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, short context, PointerRNA *properties)
{
BLI_assert(ot == WM_operatortype_find(ot->idname, true));
- return wm_operator_call_internal(C, ot, properties, NULL, context, false);
+ return wm_operator_call_internal(C, ot, properties, NULL, context, false, NULL);
}
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
{
@@ -1627,7 +1627,7 @@ int WM_operator_call_py(
wmWindowManager *wm = CTX_wm_manager(C);
if (!is_undo && wm) wm->op_undo_depth++;
- retval = wm_operator_call_internal(C, ot, properties, reports, context, false);
+ retval = wm_operator_call_internal(C, ot, properties, reports, context, false, NULL);
if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
@@ -2368,18 +2368,28 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
wmDrag *drag;
for (drag = lb->first; drag; drag = drag->next) {
- if (drop->poll(C, drag, event)) {
- drop->copy(drag, drop);
+ const char *tooltip = NULL;
+ if (drop->poll(C, drag, event, &tooltip)) {
+ /* Optionally copy drag information to operator properties. */
+ if (drop->copy) {
+ drop->copy(drag, drop);
+ }
- /* free the drags before calling operator */
+ /* Pass single matched wmDrag onto the operator. */
+ BLI_remlink(lb, drag);
+ ListBase single_lb = {drag, drag};
+ event->customdata = &single_lb;
+
+ wm_operator_call_internal(C, drop->ot, drop->ptr, NULL, drop->opcontext, false, event);
+ action |= WM_HANDLER_BREAK;
+
+ /* free the drags */
WM_drag_free_list(lb);
+ WM_drag_free_list(&single_lb);
event->customdata = NULL;
event->custom = 0;
- WM_operator_name_call_ptr(C, drop->ot, drop->opcontext, drop->ptr);
- action |= WM_HANDLER_BREAK;
-
/* XXX fileread case */
if (CTX_wm_window(C) == NULL)
return action;
@@ -2395,8 +2405,8 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
else if (handler->gizmo_map) {
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
- wmGizmoMap *mmap = handler->gizmo_map;
- wmGizmo *mpr = wm_gizmomap_highlight_get(mmap);
+ wmGizmoMap *gzmap = handler->gizmo_map;
+ wmGizmo *gz = wm_gizmomap_highlight_get(gzmap);
if (region->gizmo_map != handler->gizmo_map) {
WM_gizmomap_tag_refresh(handler->gizmo_map);
@@ -2406,10 +2416,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
wm_region_mouse_co(C, event);
/* handle gizmo highlighting */
- if (event->type == MOUSEMOVE && !wm_gizmomap_modal_get(mmap)) {
+ if (event->type == MOUSEMOVE && !wm_gizmomap_modal_get(gzmap)) {
int part;
- mpr = wm_gizmomap_highlight_find(mmap, C, event, &part);
- if (wm_gizmomap_highlight_set(mmap, C, mpr, part) && mpr != NULL) {
+ gz = wm_gizmomap_highlight_find(gzmap, C, event, &part);
+ if (wm_gizmomap_highlight_set(gzmap, C, gz, part) && gz != NULL) {
WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_gizmomap_tooltip_init);
}
}
@@ -2417,45 +2427,45 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
/* Either we operate on a single highlighted item
* or groups attached to the selected gizmos.
* To simplify things both cases loop over an array of items. */
- wmGizmoGroup *mgroup_first;
- bool is_mgroup_single;
+ wmGizmoGroup *gzgroup_first;
+ bool is_gzgroup_single;
if (ISMOUSE(event->type)) {
- /* Keep mpr set as-is, just fake single selection. */
- if (mpr) {
- mgroup_first = mpr->parent_mgroup;
+ /* Keep gz set as-is, just fake single selection. */
+ if (gz) {
+ gzgroup_first = gz->parent_gzgroup;
}
else {
- mgroup_first = NULL;
+ gzgroup_first = NULL;
}
- is_mgroup_single = true;
+ is_gzgroup_single = true;
}
else {
- if (WM_gizmomap_is_any_selected(mmap)) {
- const ListBase *groups = WM_gizmomap_group_list(mmap);
- mgroup_first = groups->first;
+ if (WM_gizmomap_is_any_selected(gzmap)) {
+ const ListBase *groups = WM_gizmomap_group_list(gzmap);
+ gzgroup_first = groups->first;
}
else {
- mgroup_first = NULL;
+ gzgroup_first = NULL;
}
- is_mgroup_single = false;
+ is_gzgroup_single = false;
}
/* Don't use from now on. */
- mpr = NULL;
+ gz = NULL;
- for (wmGizmoGroup *mgroup = mgroup_first; mgroup; mgroup = mgroup->next) {
+ for (wmGizmoGroup *gzgroup = gzgroup_first; gzgroup; gzgroup = gzgroup->next) {
/* get user customized keymap from default one */
- if ((is_mgroup_single == false) &&
+ if ((is_gzgroup_single == false) &&
/* We might want to change the logic here and use some kind of gizmo edit-mode.
* For now just use keymap when a selection exists. */
- wm_gizmogroup_is_any_selected(mgroup) == false)
+ wm_gizmogroup_is_any_selected(gzgroup) == false)
{
continue;
}
- wmKeyMap *keymap = WM_keymap_active(wm, mgroup->type->keymap);
+ wmKeyMap *keymap = WM_keymap_active(wm, gzgroup->type->keymap);
wmKeyMapItem *kmi;
PRINT("%s: checking '%s' ...", __func__, keymap->idname);
@@ -2472,7 +2482,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
/* weak, but allows interactive callback to not use rawkey */
event->keymap_idname = kmi->idname;
- CTX_wm_gizmo_group_set(C, mgroup);
+ CTX_wm_gizmo_group_set(C, gzgroup);
/* handler->op is called later, we want keymap op to be triggered here */
handler->op = NULL;
@@ -2515,7 +2525,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
break;
}
- if (is_mgroup_single) {
+ if (is_gzgroup_single) {
break;
}
}
@@ -4569,7 +4579,11 @@ bool WM_window_modal_keymap_status_draw(
continue;
}
int icon_mod[4];
+#ifdef WITH_HEADLESS
+ int icon = 0;
+#else
int icon = UI_icon_from_keymap_item(kmi, icon_mod);
+#endif
if (icon != 0) {
for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) {
uiItemL(row, "", icon_mod[j]);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 84dcf30e63c..e44081bef54 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -188,7 +188,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
{
win->ghostwin = oldwin->ghostwin;
- win->gwnctx = oldwin->gwnctx;
+ win->gpuctx = oldwin->gpuctx;
win->active = oldwin->active;
if (win->active) {
wm->winactive = win;
@@ -202,7 +202,7 @@ static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
oldwin->ghostwin = NULL;
- oldwin->gwnctx = NULL;
+ oldwin->gpuctx = NULL;
win->eventstate = oldwin->eventstate;
oldwin->eventstate = NULL;
@@ -279,6 +279,10 @@ static void wm_window_match_replace_by_file_wm(
wm->initialized = 0;
wm->winactive = NULL;
+ /* Clearing drawable of before deleting any context
+ * to avoid clearing the wrong wm. */
+ wm_window_clear_drawable(oldwm);
+
/* only first wm in list has ghostwins */
for (wmWindow *win = wm->windows.first; win; win = win->next) {
for (wmWindow *oldwin = oldwm->windows.first; oldwin; oldwin = oldwin->next) {
@@ -365,8 +369,6 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
/* update tempdir from user preferences */
BKE_tempdir_init(U.tempdir);
-
- BLF_antialias_set((U.text_render & USER_TEXT_DISABLE_AA) == 0);
}
@@ -488,13 +490,7 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo
Main *bmain = CTX_data_main(C);
DEG_on_visible_update(bmain, true);
-
- if (!is_startup_file) {
- /* When starting up, the UI hasn't been fully initialised yet, and
- * this call can trigger icon updates, causing a segfault due to a
- * not-yet-initialised ghash for the icons. */
- wm_event_do_depsgraph(C);
- }
+ wm_event_do_depsgraph(C);
ED_editors_init(C);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 4366013084c..06a7f3528c5 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -166,7 +166,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
- uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@@ -181,7 +181,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
float xmin = (float)rect->xmin;
float ymin = (float)rect->ymin;
- immBegin(GWN_PRIM_LINES, 2);
+ immBegin(GPU_PRIM_LINES, 2);
immVertex2f(shdr_pos, xmin, ymin);
immVertex2f(shdr_pos, (float)rect->xmax, (float)rect->ymax);
immEnd();
@@ -193,7 +193,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
- uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
+ uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
glEnable(GL_BLEND);
@@ -206,7 +206,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
glDisable(GL_BLEND);
- shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@@ -231,7 +231,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
glEnable(GL_BLEND);
- const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -346,7 +346,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
return;
}
- const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@@ -358,7 +358,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
- immBegin((gt->type == WM_GESTURE_LASSO) ? GWN_PRIM_LINE_LOOP : GWN_PRIM_LINE_STRIP, numverts);
+ immBegin((gt->type == WM_GESTURE_LASSO) ? GPU_PRIM_LINE_LOOP : GPU_PRIM_LINE_STRIP, numverts);
for (i = 0; i < gt->points; i++, lasso += 2) {
immVertex2f(shdr_pos, (float)lasso[0], (float)lasso[1]);
@@ -377,7 +377,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
float x1, x2, y1, y2;
- const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
@@ -389,7 +389,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
- immBegin(GWN_PRIM_LINES, 4);
+ immBegin(GPU_PRIM_LINES, 4);
x1 = (float)(rect->xmin - winsize_x);
y1 = (float)rect->ymin;
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 0c7c85e0d94..4b0d751a7ce 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -35,6 +35,7 @@
#include <string.h>
#ifdef _WIN32
+# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
@@ -114,11 +115,13 @@
#include "ED_undo.h"
#include "UI_interface.h"
+#include "UI_resources.h"
#include "BLF_api.h"
#include "BLT_lang.h"
#include "GPU_material.h"
#include "GPU_draw.h"
+#include "GPU_immediate.h"
#include "GPU_init_exit.h"
#include "BKE_sound.h"
@@ -235,6 +238,11 @@ void WM_init(bContext *C, int argc, const char **argv)
BLF_init();
BLT_lang_init();
+ /* Init icons before reading .blend files for preview icons, which can
+ * get triggered by the depsgraph. This is also done in background mode
+ * for scripts that do background processing with preview icons. */
+ BKE_icons_init(BIFICONID_LAST);
+
/* reports cant be initialized before the wm,
* but keep before file reading, since that may report errors */
wm_init_reports(C);
@@ -257,13 +265,6 @@ void WM_init(bContext *C, int argc, const char **argv)
UI_init();
BKE_studiolight_init();
}
- else {
- /* Note: Currently only inits icons, which we now want in background mode too
- * (scripts could use those in background processing...).
- * In case we do more later, we may need to pass a 'background' flag.
- * Called from 'UI_init' above */
- BKE_icons_init(1);
- }
ED_spacemacros_init();
@@ -515,9 +516,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
BLF_exit();
if (opengl_is_init) {
+ DRW_opengl_context_enable_ex(false);
GPU_pass_cache_free();
- DRW_opengl_context_destroy();
GPU_exit();
+ DRW_opengl_context_disable_ex(false);
+ DRW_opengl_context_destroy();
}
#ifdef WITH_INTERNATIONAL
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 658d0f91ae7..19f36779085 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -526,6 +526,25 @@ wmKeyMapItem *WM_keymap_add_tool(wmKeyMap *keymap, const char *idname, int type,
return kmi;
}
+/** Useful for mapping numbers to an enum. */
+void WM_keymap_add_context_enum_set_items(
+ wmKeyMap *keymap, const EnumPropertyItem *items, const char *data_path,
+ int type_start, int val, int modifier, int keymodifier)
+{
+ for (int i = 0, type_offset = 0; items[i].identifier; i++) {
+ if (items[i].identifier[0] == '\0') {
+ continue;
+ }
+ wmKeyMapItem *kmi = WM_keymap_add_item(
+ keymap, "WM_OT_context_set_enum",
+ type_start + type_offset, val, modifier, keymodifier);
+ RNA_string_set(kmi->ptr, "data_path", data_path);
+ RNA_string_set(kmi->ptr, "value", items[i].identifier);
+ type_offset += 1;
+ }
+}
+
+
bool WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
{
if (BLI_findindex(&keymap->items, kmi) != -1) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 5cf9ac625c3..76a1482ac7c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -440,7 +440,7 @@ static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr
switch (GS(((ID *)ptr->id.data)->name)) {
case ID_SCE:
{
- CTX_TEST_PTR_DATA_TYPE(C, "active_gpencil_brush", RNA_GPencilBrush, ptr, CTX_data_active_gpencil_brush(C));
+ CTX_TEST_PTR_DATA_TYPE(C, "active_gpencil_brush", RNA_Brush, ptr, CTX_data_active_gpencil_brush(C));
CTX_TEST_PTR_ID(C, "scene", ptr->id.data);
break;
}
@@ -1043,15 +1043,17 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
if (op->type->flag & OPTYPE_MACRO) {
for (op = op->macro.first; op; op = op->next) {
- uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
- UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
+ uiTemplateOperatorPropertyButs(
+ C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
+ UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
if (op->next)
uiItemS(layout);
}
}
else {
- uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
- UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
+ uiTemplateOperatorPropertyButs(
+ C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
+ UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
}
UI_block_bounds_set_popup(block, 4, 0, 0);
@@ -1120,8 +1122,9 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
- uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
- UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
+ uiTemplateOperatorPropertyButs(
+ C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
+ UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
/* clear so the OK button is left alone */
UI_block_func_set(block, NULL, NULL, NULL);
@@ -1160,7 +1163,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
/* since ui is defined the auto-layout args are not used */
- uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_COLUMN, 0);
+ uiTemplateOperatorPropertyButs(C, layout, op, UI_BUT_LABEL_ALIGN_COLUMN, 0);
UI_block_func_set(block, NULL, NULL, NULL);
@@ -2094,12 +2097,12 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
RNA_property_float_get_array(fill_ptr, fill_prop, col);
}
- Gwn_VertFormat *format = immVertexFormat();
- uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = immVertexFormat();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
if (rc->gltex) {
- uint texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, rc->gltex);
@@ -2118,12 +2121,12 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* set up rotation if available */
if (rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
- gpuPushMatrix();
- gpuRotate2D(RAD2DEGF(rot));
+ GPU_matrix_push();
+ GPU_matrix_rotate_2d(RAD2DEGF(rot));
}
/* draw textured quad */
- immBegin(GWN_PRIM_TRI_FAN, 4);
+ immBegin(GPU_PRIM_TRI_FAN, 4);
immAttrib2f(texCoord, 0, 0);
immVertex2f(pos, -radius, -radius);
@@ -2141,7 +2144,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* undo rotation */
if (rc->rot_prop)
- gpuPopMatrix();
+ GPU_matrix_pop();
}
else {
/* flat color if no texture available */
@@ -2208,7 +2211,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
/* Keep cursor in the original place */
x = rc->initial_mouse[0];
y = rc->initial_mouse[1];
- gpuTranslate2f((float)x, (float)y);
+ GPU_matrix_translate_2f((float)x, (float)y);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -2216,7 +2219,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
/* apply zoom if available */
if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
- gpuScale2fv(zoom);
+ GPU_matrix_scale_2fv(zoom);
}
/* draw rotated texture */
@@ -2226,30 +2229,30 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
if (rc->col_prop)
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
- Gwn_VertFormat *format = immVertexFormat();
- uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = immVertexFormat();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fvAlpha(col, 0.5f);
if (rc->subtype == PROP_ANGLE) {
- gpuPushMatrix();
+ GPU_matrix_push();
/* draw original angle line */
- gpuRotate2D(RAD2DEGF(rc->initial_value));
- immBegin(GWN_PRIM_LINES, 2);
+ GPU_matrix_rotate_2d(RAD2DEGF(rc->initial_value));
+ immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
/* draw new angle line */
- gpuRotate2D(RAD2DEGF(rc->current_value - rc->initial_value));
- immBegin(GWN_PRIM_LINES, 2);
+ GPU_matrix_rotate_2d(RAD2DEGF(rc->current_value - rc->initial_value));
+ immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
- gpuPopMatrix();
+ GPU_matrix_pop();
}
/* draw circles on top */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 003932930ed..6317cca8094 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -28,8 +28,11 @@
/** \file blender/windowmanager/intern/wm_playanim.c
* \ingroup wm
*
+ * Animation player for image sequences & video's with sound support.
+ * Launched in a separate process from Blender's #RENDER_OT_play_rendered_anim
+ *
* \note This file uses ghost directly and none of the WM definitions.
- * this could be made into its own module, alongside creator/
+ * this could be made into its own module, alongside creator.
*/
#include <sys/types.h>
@@ -66,7 +69,7 @@
#include "GPU_matrix.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
-#include "GPU_batch.h"
+#include "GPU_context.h"
#include "GPU_init_exit.h"
#include "DNA_scene_types.h"
@@ -184,7 +187,7 @@ typedef enum eWS_Qual {
static struct WindowStateGlobal {
GHOST_SystemHandle ghost_system;
void *ghost_window;
- Gwn_Context *gwn_context;
+ GPUContext *gpu_context;
/* events */
eWS_Qual qual;
@@ -201,8 +204,8 @@ static void playanim_window_get_size(int *r_width, int *r_height)
static void playanim_gl_matrix(void)
{
/* unified matrix, note it affects offset for drawing */
- /* note! cannot use gpuOrtho2D here because shader ignores. */
- gpuOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0, 1.0f);
+ /* note! cannot use GPU_matrix_ortho_2d_set here because shader ignores. */
+ GPU_matrix_ortho_set(0.0f, 1.0f, 0.0f, 1.0f, -1.0, 1.0f);
}
/* implementation */
@@ -366,25 +369,25 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
float fac = ps->picture->frame / (double)(((PlayAnimPict *)picsbase.last)->frame - ((PlayAnimPict *)picsbase.first)->frame);
fac = 2.0f * fac - 1.0f;
- gpuPushProjectionMatrix();
- gpuLoadIdentityProjectionMatrix();
- gpuPushMatrix();
- gpuLoadIdentity();
+ GPU_matrix_push_projection();
+ GPU_matrix_identity_projection_set();
+ GPU_matrix_push();
+ GPU_matrix_identity_set();
- uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ub(0, 255, 0);
- immBegin(GWN_PRIM_LINES, 2);
+ immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, fac, -1.0f);
immVertex2f(pos, fac, 1.0f);
immEnd();
immUnbindProgram();
- gpuPopMatrix();
- gpuPopProjectionMatrix();
+ GPU_matrix_pop();
+ GPU_matrix_pop_projection();
}
GHOST_SwapWindowBuffers(g_WS.ghost_window);
@@ -1281,7 +1284,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
//GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
/* initialize OpenGL immediate mode */
- g_WS.gwn_context = GWN_context_create();
+ g_WS.gpu_context = GPU_context_create();
GPU_init();
immActivate();
@@ -1552,10 +1555,10 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
GPU_shader_free_builtin_shaders();
- if (g_WS.gwn_context) {
- GWN_context_active_set(g_WS.gwn_context);
- GWN_context_discard(g_WS.gwn_context);
- g_WS.gwn_context = NULL;
+ if (g_WS.gpu_context) {
+ GPU_context_active_set(g_WS.gpu_context);
+ GPU_context_discard(g_WS.gpu_context);
+ g_WS.gpu_context = NULL;
}
BLF_exit();
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 1e9f6d6231b..577145aff95 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -87,9 +87,9 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
float halfx = GLA_PIXEL_OFS / ar->winx;
float halfy = GLA_PIXEL_OFS / ar->winy;
- Gwn_VertFormat *format = immVertexFormat();
- uint texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = immVertexFormat();
+ uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
/* leave GL_TEXTURE0 as the latest active texture */
for (int view = 1; view >= 0; view--) {
@@ -104,7 +104,7 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
immUniform1i("interlace_id", interlace_gpu_id_from_type(interlace_type));
- immBegin(GWN_PRIM_TRI_FAN, 4);
+ immBegin(GPU_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, ar->winrct.xmin, ar->winrct.ymin);
@@ -163,9 +163,9 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
{
bool cross_eyed = (win->stereo3d_format->flag & S3D_SIDEBYSIDE_CROSSEYED) != 0;
- Gwn_VertFormat *format = immVertexFormat();
- uint texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = immVertexFormat();
+ uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE);
@@ -188,7 +188,7 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
immUniform1i("image", 0); /* texture is already bound to GL_TEXTURE0 unit */
- immBegin(GWN_PRIM_TRI_FAN, 4);
+ immBegin(GPU_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, soffx, 0.0f);
@@ -209,9 +209,9 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
{
- Gwn_VertFormat *format = immVertexFormat();
- uint texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = immVertexFormat();
+ uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE);
@@ -232,7 +232,7 @@ void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
immUniform1i("image", 0); /* texture is already bound to GL_TEXTURE0 unit */
- immBegin(GWN_PRIM_TRI_FAN, 4);
+ immBegin(GPU_PRIM_TRI_FAN, 4);
immAttrib2f(texcoord, halfx, halfy);
immVertex2f(pos, 0.0f, soffy);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index f55eee69f71..ff3c712dae0 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -50,7 +50,7 @@ void wmViewport(const rcti *winrct)
glScissor(winrct->xmin, winrct->ymin, width, height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct)
@@ -89,7 +89,7 @@ void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct
glScissor(x, y, scissor_width, scissor_height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmWindowViewport(wmWindow *win)
@@ -101,7 +101,7 @@ void wmWindowViewport(wmWindow *win)
glScissor(0, 0, width, height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmOrtho2(float x1, float x2, float y1, float y2)
@@ -110,7 +110,7 @@ void wmOrtho2(float x1, float x2, float y1, float y2)
if (x1 == x2) x2 += 1.0f;
if (y1 == y2) y2 += 1.0f;
- gpuOrtho(x1, x2, y1, y2, -100, 100);
+ GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
}
static void wmOrtho2_offset(const float x, const float y, const float ofs)
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 350327e8590..0aa5e16a519 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -49,6 +49,7 @@
#include "BKE_workspace.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -132,8 +133,8 @@ static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *t
bToolRef_Runtime *tref_rt = tref->runtime;
if (tref_rt->gizmo_group[0]) {
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, false);
- if (wgt != NULL) {
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, false);
+ if (gzgt != NULL) {
bool found = false;
/* TODO(campbell) */
@@ -154,8 +155,8 @@ static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *t
UNUSED_VARS(workspace);
#endif
if (!found) {
- wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params);
- WM_gizmomaptype_group_unlink(C, bmain, mmap_type, wgt);
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
+ WM_gizmomaptype_group_unlink(C, bmain, gzmap_type, gzgt);
}
}
}
@@ -173,9 +174,9 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
bToolRef_Runtime *tref_rt = tref->runtime;
if (tref_rt->gizmo_group[0]) {
const char *idname = tref_rt->gizmo_group;
- wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false);
- if (wgt != NULL) {
- WM_gizmo_group_type_ensure_ptr(wgt);
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ if (gzgt != NULL) {
+ WM_gizmo_group_type_ensure_ptr(gzgt);
}
else {
CLOG_WARN(WM_LOG_TOOLS, "'%s' widget not found", idname);
@@ -184,20 +185,37 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
if (tref_rt->data_block[0]) {
Main *bmain = CTX_data_main(C);
+ if ((tref->space_type == SPACE_VIEW3D) &&
+ (tref->mode == CTX_MODE_PARTICLE))
- /* Currently only brush data-blocks supported. */
- struct Brush *brush = (struct Brush *)BKE_libblock_find_name(bmain, ID_BR, tref_rt->data_block);
-
- if (brush) {
- wmWindowManager *wm = bmain->wm.first;
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- if (workspace == WM_window_get_active_workspace(win)) {
- Scene *scene = WM_window_get_active_scene(win);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Paint *paint = BKE_paint_get_active(scene, view_layer);
- if (paint) {
- if (brush) {
- BKE_paint_brush_set(paint, brush);
+ {
+ const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items;
+ const int i = RNA_enum_from_identifier(items, tref_rt->data_block);
+ if (i != -1) {
+ const int value = items[i].value;
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ if (workspace == WM_window_get_active_workspace(win)) {
+ Scene *scene = WM_window_get_active_scene(win);
+ ToolSettings *ts = scene->toolsettings;
+ ts->particle.brushtype = value;
+ }
+ }
+ }
+ }
+ else {
+ struct Brush *brush = (struct Brush *)BKE_libblock_find_name(bmain, ID_BR, tref_rt->data_block);
+ if (brush) {
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ if (workspace == WM_window_get_active_workspace(win)) {
+ Scene *scene = WM_window_get_active_scene(win);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
+ if (paint) {
+ if (brush) {
+ BKE_paint_brush_set(paint, brush);
+ }
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index f55fc5703f4..f391c92b4ca 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -90,12 +90,11 @@
#include "GPU_immediate.h"
#include "GPU_material.h"
#include "GPU_texture.h"
+#include "GPU_context.h"
#include "BLF_api.h"
#include "UI_resources.h"
-#include "../../../intern/gawain/gawain/gwn_context.h"
-
/* for assert */
#ifndef NDEBUG
# include "BLI_threads.h"
@@ -124,7 +123,6 @@ static struct WMInitStruct {
/* ******** win open & close ************ */
static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool activate);
-static void wm_window_clear_drawable(wmWindowManager *wm);
/* XXX this one should correctly check for apple top header...
* done for Cocoa : returns window contents (and not frame) max size*/
@@ -195,15 +193,14 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
/* We need this window's opengl context active to discard it. */
GHOST_ActivateWindowDrawingContext(win->ghostwin);
- GWN_context_active_set(win->gwnctx);
+ GPU_context_active_set(win->gpuctx);
- /* Delete local gawain objects. */
- GWN_context_discard(win->gwnctx);
+ /* Delete local gpu context. */
+ GPU_context_discard(win->gpuctx);
GHOST_DisposeWindow(g_system, win->ghostwin);
win->ghostwin = NULL;
- win->gwnctx = NULL;
-
+ win->gpuctx = NULL;
}
}
@@ -646,7 +643,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
/* Clear drawable so we can set the new window. */
wm_window_clear_drawable(wm);
- win->gwnctx = GWN_context_create();
+ win->gpuctx = GPU_context_create();
/* needed so we can detect the graphics card below */
GPU_init();
@@ -1100,11 +1097,11 @@ static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool acti
if (activate) {
GHOST_ActivateWindowDrawingContext(win->ghostwin);
}
- GWN_context_active_set(win->gwnctx);
+ GPU_context_active_set(win->gpuctx);
immActivate();
}
-static void wm_window_clear_drawable(wmWindowManager *wm)
+void wm_window_clear_drawable(wmWindowManager *wm)
{
if (wm->windrawable) {
BLF_batch_reset();
@@ -1116,7 +1113,7 @@ static void wm_window_clear_drawable(wmWindowManager *wm)
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
{
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
if (win != wm->windrawable && win->ghostwin) {
// win->lmbut = 0; /* keeps hanging when mousepressed while other window opened */
@@ -1137,7 +1134,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
void wm_window_reset_drawable(void)
{
BLI_assert(BLI_thread_is_main());
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
wmWindowManager *wm = G_MAIN->wm.first;
if (wm == NULL)
@@ -1922,8 +1919,6 @@ void wm_window_raise(wmWindow *win)
void wm_window_swap_buffers(wmWindow *win)
{
- GPU_texture_orphans_delete(); /* XXX should be done elsewhere. */
- GPU_material_orphans_delete(); /* XXX Amen to that. */
GHOST_SwapWindowBuffers(win->ghostwin);
}
@@ -2172,7 +2167,12 @@ ViewLayer *WM_window_get_active_view_layer(const wmWindow *win)
return view_layer;
}
- return BKE_view_layer_default_view(scene);
+ view_layer = BKE_view_layer_default_view(scene);
+ if (view_layer) {
+ WM_window_set_active_view_layer((wmWindow *)win, view_layer);
+ }
+
+ return view_layer;
}
void WM_window_set_active_view_layer(wmWindow *win, ViewLayer *view_layer)
@@ -2280,24 +2280,24 @@ void *WM_opengl_context_create(void)
* So we should call this function only on the main thread.
*/
BLI_assert(BLI_thread_is_main());
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
return GHOST_CreateOpenGLContext(g_system);
}
void WM_opengl_context_dispose(void *context)
{
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
GHOST_DisposeOpenGLContext(g_system, (GHOST_ContextHandle)context);
}
void WM_opengl_context_activate(void *context)
{
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
GHOST_ActivateOpenGLContext((GHOST_ContextHandle)context);
}
void WM_opengl_context_release(void *context)
{
- BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_active_get() == NULL);
GHOST_ReleaseOpenGLContext((GHOST_ContextHandle)context);
}
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index 385d61217ad..4fd5d66fb43 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -57,6 +57,7 @@ void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm);
void wm_window_process_events (const bContext *C);
void wm_window_process_events_nosleep(void);
+void wm_window_clear_drawable(wmWindowManager *wm);
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win);
void wm_window_reset_drawable(void);