Cleanup: style, use braces for the window manager
This commit is contained in:
parent
45b810e1f8
commit
73c7aaba22
@ -644,10 +644,12 @@ void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
|
||||
{
|
||||
const wmGizmoType *gzt = WM_gizmotype_find(gtstring, false);
|
||||
|
||||
if (gzt)
|
||||
if (gzt) {
|
||||
WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)gzt);
|
||||
else
|
||||
}
|
||||
else {
|
||||
RNA_pointer_create(NULL, &RNA_GizmoProperties, NULL, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* similar to the function above except its uses ID properties
|
||||
@ -674,10 +676,12 @@ void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context)
|
||||
{
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_ENUM:
|
||||
if (no_context)
|
||||
if (no_context) {
|
||||
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
else
|
||||
}
|
||||
else {
|
||||
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
}
|
||||
break;
|
||||
case PROP_POINTER:
|
||||
{
|
||||
|
@ -145,18 +145,18 @@ int WM_gizmo_cmp_temp_fl(const void *gz_a_ptr, const void *gz_b_ptr)
|
||||
{
|
||||
const wmGizmo *gz_a = gz_a_ptr;
|
||||
const wmGizmo *gz_b = gz_b_ptr;
|
||||
if (gz_a->temp.f < gz_b->temp.f) return -1;
|
||||
else if (gz_a->temp.f > gz_b->temp.f) return 1;
|
||||
else return 0;
|
||||
if (gz_a->temp.f < gz_b->temp.f) { return -1; }
|
||||
else if (gz_a->temp.f > gz_b->temp.f) { return 1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
int WM_gizmo_cmp_temp_fl_reverse(const void *gz_a_ptr, const void *gz_b_ptr)
|
||||
{
|
||||
const wmGizmo *gz_a = gz_a_ptr;
|
||||
const wmGizmo *gz_b = gz_b_ptr;
|
||||
if (gz_a->temp.f < gz_b->temp.f) return 1;
|
||||
else if (gz_a->temp.f > gz_b->temp.f) return -1;
|
||||
else return 0;
|
||||
if (gz_a->temp.f < gz_b->temp.f) { return 1; }
|
||||
else if (gz_a->temp.f > gz_b->temp.f) { return -1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
wmGizmo *wm_gizmogroup_find_intersected_gizmo(
|
||||
@ -636,8 +636,9 @@ static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char
|
||||
keymap = WM_modalkeymap_get(keyconf, name);
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items)
|
||||
if (keymap && keymap->modal_items) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, name, modal_items);
|
||||
|
||||
|
@ -345,8 +345,9 @@ static void gizmomap_prepare_drawing(
|
||||
wmGizmoMap *gzmap, const bContext *C, ListBase *draw_gizmos,
|
||||
const eWM_GizmoFlagMapDrawStep drawstep)
|
||||
{
|
||||
if (!gzmap || BLI_listbase_is_empty(&gzmap->groups))
|
||||
if (!gzmap || BLI_listbase_is_empty(&gzmap->groups)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gzmap->is_init = false;
|
||||
|
||||
@ -844,8 +845,9 @@ bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *gzmap, const int action)
|
||||
break;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
if (changed) {
|
||||
WM_event_add_mousemove(C);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
@ -874,12 +876,15 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
|
||||
else {
|
||||
ARegion *ar;
|
||||
CTX_wm_area_set(C, sa);
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next)
|
||||
if (ar == handler->context.region)
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (ar == handler->context.region) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* XXX no warning print here, after full-area and back regions are remade */
|
||||
if (ar)
|
||||
if (ar) {
|
||||
CTX_wm_region_set(C, ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1198,11 +1203,13 @@ void WM_gizmoconfig_update_tag_remove(
|
||||
*/
|
||||
void WM_gizmoconfig_update(struct Main *bmain)
|
||||
{
|
||||
if (G.background)
|
||||
if (G.background) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wm_gzmap_type_update_flag == 0)
|
||||
if (wm_gzmap_type_update_flag == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wm_gzmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) {
|
||||
for (wmGizmoMapType *gzmap_type = gizmomaptypes.first;
|
||||
|
@ -354,8 +354,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
||||
wmOperator *op;
|
||||
wmKeyConfig *keyconf;
|
||||
|
||||
if (wm->autosavetimer)
|
||||
if (wm->autosavetimer) {
|
||||
wm_autosave_timer_ended(wm);
|
||||
}
|
||||
|
||||
while ((win = BLI_pophead(&wm->windows))) {
|
||||
/* prevent draw clear to use screen */
|
||||
@ -388,7 +389,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
||||
wm->undo_stack = NULL;
|
||||
}
|
||||
|
||||
if (C && CTX_wm_manager(C) == wm) CTX_wm_manager_set(C, NULL);
|
||||
if (C && CTX_wm_manager(C) == wm) {
|
||||
CTX_wm_manager_set(C, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void wm_close_and_free_all(bContext *C, ListBase *wmlist)
|
||||
|
@ -114,19 +114,22 @@ void WM_cursor_set(wmWindow *win, int curs)
|
||||
#ifdef _WIN32
|
||||
/* the default win32 cross cursor is barely visible,
|
||||
* only 1 pixel thick, use another one instead */
|
||||
if (curs == CURSOR_EDIT)
|
||||
if (curs == CURSOR_EDIT) {
|
||||
curs = BC_CROSSCURSOR;
|
||||
}
|
||||
#else
|
||||
/* in case of large cursor, also use custom cursor because
|
||||
* large cursors don't work for system cursors */
|
||||
if (U.curssize && curs == CURSOR_EDIT)
|
||||
if (U.curssize && curs == CURSOR_EDIT) {
|
||||
curs = BC_CROSSCURSOR;
|
||||
}
|
||||
#endif
|
||||
|
||||
GHOST_SetCursorVisibility(win->ghostwin, 1);
|
||||
|
||||
if (curs == CURSOR_STD && win->modalcursor)
|
||||
if (curs == CURSOR_STD && win->modalcursor) {
|
||||
curs = win->modalcursor;
|
||||
}
|
||||
|
||||
win->cursor = curs;
|
||||
|
||||
@ -135,7 +138,9 @@ void WM_cursor_set(wmWindow *win, int curs)
|
||||
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
|
||||
}
|
||||
else {
|
||||
if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) return;
|
||||
if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (curs == SYSCURSOR) { /* System default Cursor */
|
||||
GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
|
||||
@ -168,8 +173,9 @@ bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const AReg
|
||||
|
||||
void WM_cursor_modal_set(wmWindow *win, int val)
|
||||
{
|
||||
if (win->lastcursor == 0)
|
||||
if (win->lastcursor == 0) {
|
||||
win->lastcursor = win->cursor;
|
||||
}
|
||||
win->modalcursor = val;
|
||||
WM_cursor_set(win, val);
|
||||
}
|
||||
@ -177,8 +183,9 @@ void WM_cursor_modal_set(wmWindow *win, int val)
|
||||
void WM_cursor_modal_restore(wmWindow *win)
|
||||
{
|
||||
win->modalcursor = 0;
|
||||
if (win->lastcursor)
|
||||
if (win->lastcursor) {
|
||||
WM_cursor_set(win, win->lastcursor);
|
||||
}
|
||||
win->lastcursor = 0;
|
||||
}
|
||||
|
||||
@ -304,8 +311,9 @@ void WM_cursor_time(wmWindow *win, int nr)
|
||||
unsigned char bitmap[16][2] = {{0}};
|
||||
int i, idx;
|
||||
|
||||
if (win->lastcursor == 0)
|
||||
if (win->lastcursor == 0) {
|
||||
win->lastcursor = win->cursor;
|
||||
}
|
||||
|
||||
memset(&mask, 0xFF, sizeof(mask));
|
||||
|
||||
@ -315,8 +323,9 @@ void WM_cursor_time(wmWindow *win, int nr)
|
||||
int x = idx % 2;
|
||||
int y = idx / 2;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < 8; i++) {
|
||||
bitmap[i + y * 8][x] = digit[i];
|
||||
}
|
||||
nr /= 10;
|
||||
}
|
||||
|
||||
|
@ -76,10 +76,13 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
|
||||
{
|
||||
wmDropBoxMap *dm;
|
||||
|
||||
for (dm = dropboxes.first; dm; dm = dm->next)
|
||||
if (dm->spaceid == spaceid && dm->regionid == regionid)
|
||||
if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
|
||||
for (dm = dropboxes.first; dm; dm = dm->next) {
|
||||
if (dm->spaceid == spaceid && dm->regionid == regionid) {
|
||||
if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME)) {
|
||||
return &dm->dropboxes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
|
||||
BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
|
||||
@ -222,13 +225,19 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
|
||||
const char *name;
|
||||
|
||||
name = dropbox_active(C, &win->handlers, drag, event);
|
||||
if (name) return name;
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
name = dropbox_active(C, &sa->handlers, drag, event);
|
||||
if (name) return name;
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
name = dropbox_active(C, &ar->handlers, drag, event);
|
||||
if (name) return name;
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -241,8 +250,9 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e
|
||||
const int winsize_y = WM_window_pixels_y(win);
|
||||
|
||||
/* for multiwin drags, we only do this if mouse inside */
|
||||
if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y)
|
||||
if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y) {
|
||||
return;
|
||||
}
|
||||
|
||||
drag->opname[0] = 0;
|
||||
|
||||
@ -361,14 +371,18 @@ static const char *wm_drag_name(wmDrag *drag)
|
||||
|
||||
static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (rect->xmin > x1)
|
||||
if (rect->xmin > x1) {
|
||||
rect->xmin = x1;
|
||||
if (rect->xmax < x2)
|
||||
}
|
||||
if (rect->xmax < x2) {
|
||||
rect->xmax = x2;
|
||||
if (rect->ymin > y1)
|
||||
}
|
||||
if (rect->ymin > y1) {
|
||||
rect->ymin = y1;
|
||||
if (rect->ymax < y2)
|
||||
}
|
||||
if (rect->ymax < y2) {
|
||||
rect->ymax = y2;
|
||||
}
|
||||
}
|
||||
|
||||
/* called in wm_draw.c */
|
||||
@ -400,8 +414,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
||||
x = cursorx - drag->sx / 2;
|
||||
y = cursory - drag->sy / 2;
|
||||
|
||||
if (rect)
|
||||
if (rect) {
|
||||
drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
|
||||
}
|
||||
else {
|
||||
float col[4] = {1.0f, 1.0f, 1.0f, 0.65f}; /* this blends texture */
|
||||
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
@ -413,10 +428,12 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
||||
x = cursorx - 2 * padding;
|
||||
y = cursory - 2 * UI_DPI_FAC;
|
||||
|
||||
if (rect)
|
||||
if (rect) {
|
||||
drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
|
||||
else
|
||||
}
|
||||
else {
|
||||
UI_icon_draw_aspect(x, y, drag->icon, 1.0f / UI_DPI_FAC, 0.8, text_col);
|
||||
}
|
||||
}
|
||||
|
||||
/* item name */
|
||||
@ -442,10 +459,12 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
||||
if (drag->imb) {
|
||||
x = cursorx - drag->sx / 2;
|
||||
|
||||
if (cursory + drag->sy / 2 + padding + iconsize < winsize_y)
|
||||
if (cursory + drag->sy / 2 + padding + iconsize < winsize_y) {
|
||||
y = cursory + drag->sy / 2 + padding;
|
||||
else
|
||||
}
|
||||
else {
|
||||
y = cursory - drag->sy / 2 - padding - iconsize - padding - iconsize;
|
||||
}
|
||||
}
|
||||
else {
|
||||
x = cursorx - 2 * padding;
|
||||
@ -462,8 +481,9 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
||||
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
|
||||
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
|
||||
}
|
||||
else
|
||||
else {
|
||||
wm_drop_operator_draw(drag->opname, x, y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -189,8 +189,9 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt
|
||||
|
||||
static void wm_area_mark_invalid_backbuf(ScrArea *sa)
|
||||
{
|
||||
if (sa->spacetype == SPACE_VIEW3D)
|
||||
if (sa->spacetype == SPACE_VIEW3D) {
|
||||
((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
|
||||
}
|
||||
}
|
||||
|
||||
static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *depsgraph,
|
||||
@ -207,10 +208,12 @@ static void wm_region_test_render_do_draw(const Scene *scene, struct Depsgraph *
|
||||
rcti border_rect;
|
||||
|
||||
/* do partial redraw when possible */
|
||||
if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect))
|
||||
if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect)) {
|
||||
ED_region_tag_redraw_partial(ar, &border_rect);
|
||||
else
|
||||
}
|
||||
else {
|
||||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
|
||||
engine->flag &= ~RE_ENGINE_DO_DRAW;
|
||||
}
|
||||
@ -702,8 +705,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
|
||||
}
|
||||
|
||||
/* always draw, not only when screen tagged */
|
||||
if (win->gesture.first)
|
||||
if (win->gesture.first) {
|
||||
wm_gesture_draw(win);
|
||||
}
|
||||
|
||||
/* needs pixel coords in screen */
|
||||
if (wm->drags.first) {
|
||||
@ -798,32 +802,40 @@ static bool wm_draw_update_test_window(wmWindow *win)
|
||||
screen->do_draw_paintcursor = true;
|
||||
ar->do_draw_overlay = false;
|
||||
}
|
||||
if (ar->visible && ar->do_draw)
|
||||
if (ar->visible && ar->do_draw) {
|
||||
do_draw = true;
|
||||
}
|
||||
}
|
||||
|
||||
ED_screen_areas_iter(win, screen, sa) {
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
wm_region_test_render_do_draw(scene, depsgraph, sa, ar);
|
||||
|
||||
if (ar->visible && ar->do_draw)
|
||||
if (ar->visible && ar->do_draw) {
|
||||
do_draw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (do_draw)
|
||||
if (do_draw) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (screen->do_refresh)
|
||||
if (screen->do_refresh) {
|
||||
return true;
|
||||
if (screen->do_draw)
|
||||
}
|
||||
if (screen->do_draw) {
|
||||
return true;
|
||||
if (screen->do_draw_gesture)
|
||||
}
|
||||
if (screen->do_draw_gesture) {
|
||||
return true;
|
||||
if (screen->do_draw_paintcursor)
|
||||
}
|
||||
if (screen->do_draw_paintcursor) {
|
||||
return true;
|
||||
if (screen->do_draw_drag)
|
||||
}
|
||||
if (screen->do_draw_drag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -185,9 +185,11 @@ static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, v
|
||||
{
|
||||
wmNotifier *note;
|
||||
|
||||
for (note = wm->queue.first; note; note = note->next)
|
||||
if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference)
|
||||
for (note = wm->queue.first; note; note = note->next) {
|
||||
if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -198,8 +200,9 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmNotifier *note;
|
||||
|
||||
if (wm_test_duplicate_notifier(wm, type, reference))
|
||||
if (wm_test_duplicate_notifier(wm, type, reference)) {
|
||||
return;
|
||||
}
|
||||
|
||||
note = MEM_callocN(sizeof(wmNotifier), "notifier");
|
||||
|
||||
@ -222,8 +225,9 @@ void WM_main_add_notifier(unsigned int type, void *reference)
|
||||
wmWindowManager *wm = bmain->wm.first;
|
||||
wmNotifier *note;
|
||||
|
||||
if (!wm || wm_test_duplicate_notifier(wm, type, reference))
|
||||
if (!wm || wm_test_duplicate_notifier(wm, type, reference)) {
|
||||
return;
|
||||
}
|
||||
|
||||
note = MEM_callocN(sizeof(wmNotifier), "notifier");
|
||||
|
||||
@ -376,8 +380,9 @@ void wm_event_do_notifiers(bContext *C)
|
||||
wmNotifier *note, *next;
|
||||
wmWindow *win;
|
||||
|
||||
if (wm == NULL)
|
||||
if (wm == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_timer_execute();
|
||||
|
||||
@ -398,8 +403,9 @@ void wm_event_do_notifiers(bContext *C)
|
||||
wm->file_saved = 1;
|
||||
wm_window_title(wm, win);
|
||||
}
|
||||
else if (note->data == ND_DATACHANGED)
|
||||
else if (note->data == ND_DATACHANGED) {
|
||||
wm_window_title(wm, win);
|
||||
}
|
||||
}
|
||||
if (note->window == win) {
|
||||
if (note->category == NC_SCREEN) {
|
||||
@ -409,15 +415,17 @@ void wm_event_do_notifiers(bContext *C)
|
||||
UI_popup_handlers_remove_all(C, &win->modalhandlers);
|
||||
|
||||
WM_window_set_active_workspace(C, win, ref_ws);
|
||||
if (G.debug & G_DEBUG_EVENTS)
|
||||
if (G.debug & G_DEBUG_EVENTS) {
|
||||
printf("%s: Workspace set %p\n", __func__, note->reference);
|
||||
}
|
||||
}
|
||||
else if (note->data == ND_WORKSPACE_DELETE) {
|
||||
WorkSpace *workspace = note->reference;
|
||||
|
||||
ED_workspace_delete(workspace, CTX_data_main(C), C, wm); // XXX hrms, think this over!
|
||||
if (G.debug & G_DEBUG_EVENTS)
|
||||
if (G.debug & G_DEBUG_EVENTS) {
|
||||
printf("%s: Workspace delete %p\n", __func__, workspace);
|
||||
}
|
||||
}
|
||||
else if (note->data == ND_LAYOUTBROWSE) {
|
||||
bScreen *ref_screen = BKE_workspace_layout_screen_get(note->reference);
|
||||
@ -427,16 +435,18 @@ void wm_event_do_notifiers(bContext *C)
|
||||
|
||||
|
||||
ED_screen_change(C, ref_screen); /* XXX hrms, think this over! */
|
||||
if (G.debug & G_DEBUG_EVENTS)
|
||||
if (G.debug & G_DEBUG_EVENTS) {
|
||||
printf("%s: screen set %p\n", __func__, note->reference);
|
||||
}
|
||||
}
|
||||
else if (note->data == ND_LAYOUTDELETE) {
|
||||
WorkSpace *workspace = WM_window_get_active_workspace(win);
|
||||
WorkSpaceLayout *layout = note->reference;
|
||||
|
||||
ED_workspace_layout_delete(workspace, layout, C); // XXX hrms, think this over!
|
||||
if (G.debug & G_DEBUG_EVENTS)
|
||||
if (G.debug & G_DEBUG_EVENTS) {
|
||||
printf("%s: screen delete %p\n", __func__, note->reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,8 +455,9 @@ void wm_event_do_notifiers(bContext *C)
|
||||
(note->window == NULL && (note->reference == NULL || note->reference == scene)))
|
||||
{
|
||||
if (note->category == NC_SCENE) {
|
||||
if (note->data == ND_FRAME)
|
||||
if (note->data == ND_FRAME) {
|
||||
do_anim = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_WM)) {
|
||||
@ -565,10 +576,12 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler_UI *handler, const wmE
|
||||
/* UI is quite aggressive with swallowing events, like scrollwheel */
|
||||
/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
|
||||
if (do_wheel_ui == false) {
|
||||
if (is_wheel)
|
||||
if (is_wheel) {
|
||||
return WM_HANDLER_CONTINUE;
|
||||
else if (wm_event_always_pass(event) == 0)
|
||||
}
|
||||
else if (wm_event_always_pass(event) == 0) {
|
||||
do_wheel_ui = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* we set context to where ui handler came from */
|
||||
@ -597,12 +610,14 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler_UI *handler, const wmE
|
||||
CTX_wm_menu_set(C, NULL);
|
||||
}
|
||||
|
||||
if (retval == WM_UI_HANDLER_BREAK)
|
||||
if (retval == WM_UI_HANDLER_BREAK) {
|
||||
return WM_HANDLER_BREAK;
|
||||
}
|
||||
|
||||
/* event not handled in UI, if wheel then we temporarily disable it */
|
||||
if (is_wheel)
|
||||
if (is_wheel) {
|
||||
do_wheel_ui = false;
|
||||
}
|
||||
|
||||
return WM_HANDLER_CONTINUE;
|
||||
}
|
||||
@ -612,8 +627,9 @@ static void wm_handler_ui_cancel(bContext *C)
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
if (!ar)
|
||||
if (!ar) {
|
||||
return;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &ar->handlers) {
|
||||
if (handler_base->type == WM_HANDLER_TYPE_UI) {
|
||||
@ -636,15 +652,18 @@ bool WM_operator_poll(bContext *C, wmOperatorType *ot)
|
||||
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
|
||||
wmOperatorType *ot_macro = WM_operatortype_find(otmacro->idname, 0);
|
||||
|
||||
if (0 == WM_operator_poll(C, ot_macro))
|
||||
if (0 == WM_operator_poll(C, ot_macro)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* python needs operator type, so we added exception for it */
|
||||
if (ot->pyop_poll)
|
||||
if (ot->pyop_poll) {
|
||||
return ot->pyop_poll(C, ot);
|
||||
else if (ot->poll)
|
||||
}
|
||||
else if (ot->poll) {
|
||||
return ot->poll(C);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -836,8 +855,9 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca
|
||||
ScrArea *area_prev = CTX_wm_area(C);
|
||||
ARegion *ar_prev = CTX_wm_region(C);
|
||||
|
||||
if (win_prev == NULL)
|
||||
if (win_prev == NULL) {
|
||||
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
|
||||
}
|
||||
|
||||
UI_popup_menu_reports(C, op->reports);
|
||||
|
||||
@ -959,11 +979,13 @@ static int wm_operator_exec(
|
||||
|
||||
CTX_wm_operator_poll_msg_set(C, NULL);
|
||||
|
||||
if (op == NULL || op->type == NULL)
|
||||
if (op == NULL || op->type == NULL) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (0 == WM_operator_poll(C, op->type))
|
||||
if (0 == WM_operator_poll(C, op->type)) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (op->type->exec) {
|
||||
if (op->type->flag & OPTYPE_UNDO) {
|
||||
@ -987,8 +1009,9 @@ static int wm_operator_exec(
|
||||
/* XXX Disabled the repeat check to address part 2 of #31840.
|
||||
* Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason
|
||||
* why this was needed, but worth to note it in case something turns bad. (mont29) */
|
||||
if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */)
|
||||
if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */) {
|
||||
wm_operator_reports(C, op, retval, false);
|
||||
}
|
||||
|
||||
if (retval & OPERATOR_FINISHED) {
|
||||
wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0);
|
||||
@ -1009,8 +1032,9 @@ static int wm_operator_exec_notest(bContext *C, wmOperator *op)
|
||||
{
|
||||
int retval = OPERATOR_CANCELLED;
|
||||
|
||||
if (op == NULL || op->type == NULL || op->type->exec == NULL)
|
||||
if (op == NULL || op->type == NULL || op->type->exec == NULL) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
retval = op->type->exec(C, op);
|
||||
OPERATOR_RETVAL_CHECK(retval);
|
||||
@ -1146,8 +1170,9 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
|
||||
RNA_STRUCT_BEGIN (properties, prop)
|
||||
{
|
||||
|
||||
if (otmacro == NULL)
|
||||
if (otmacro == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* skip invalid properties */
|
||||
if (STREQ(RNA_property_identifier(prop), otmacro->idname)) {
|
||||
@ -1175,8 +1200,9 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
|
||||
}
|
||||
}
|
||||
|
||||
if (root)
|
||||
if (root) {
|
||||
motherop = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
WM_operator_properties_sanitize(op->ptr, 0);
|
||||
@ -1311,8 +1337,9 @@ static int wm_operator_invoke(
|
||||
int retval = OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* this is done because complicated setup is done to call this function that is better not duplicated */
|
||||
if (poll_only)
|
||||
if (poll_only) {
|
||||
return WM_operator_poll(C, ot);
|
||||
}
|
||||
|
||||
if (WM_operator_poll(C, ot)) {
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
@ -1337,24 +1364,28 @@ static int wm_operator_invoke(
|
||||
if (op->type->invoke && event) {
|
||||
wm_region_mouse_co(C, event);
|
||||
|
||||
if (op->type->flag & OPTYPE_UNDO)
|
||||
if (op->type->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
retval = op->type->invoke(C, op, event);
|
||||
OPERATOR_RETVAL_CHECK(retval);
|
||||
|
||||
if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
|
||||
if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
}
|
||||
else if (op->type->exec) {
|
||||
if (op->type->flag & OPTYPE_UNDO)
|
||||
if (op->type->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
retval = op->type->exec(C, op);
|
||||
OPERATOR_RETVAL_CHECK(retval);
|
||||
|
||||
if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
|
||||
if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* debug, important to leave a while, should never happen */
|
||||
@ -1543,8 +1574,9 @@ static int wm_operator_call_internal(
|
||||
ar1 = BKE_area_find_region_type(area, type);
|
||||
}
|
||||
|
||||
if (ar1)
|
||||
if (ar1) {
|
||||
CTX_wm_region_set(C, ar1);
|
||||
}
|
||||
}
|
||||
|
||||
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
|
||||
@ -1659,11 +1691,15 @@ int WM_operator_call_py(
|
||||
* we could have some more obvious way of doing this like passing a flag.
|
||||
*/
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
if (!is_undo && wm) wm->op_undo_depth++;
|
||||
if (!is_undo && wm) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
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--;
|
||||
if (!is_undo && wm && (wm == CTX_wm_manager(C))) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -1684,8 +1720,9 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
|
||||
if (screen && handler->op) {
|
||||
if (handler->context.area == NULL)
|
||||
if (handler->context.area == NULL) {
|
||||
CTX_wm_area_set(C, NULL);
|
||||
}
|
||||
else {
|
||||
ScrArea *sa = NULL;
|
||||
|
||||
@ -1727,8 +1764,9 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const
|
||||
}
|
||||
|
||||
/* XXX no warning print here, after full-area and back regions are remade */
|
||||
if (ar)
|
||||
if (ar) {
|
||||
CTX_wm_region_set(C, ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1948,8 +1986,9 @@ static wmKeyMapItem *wm_eventmatch_modal_keymap_items(const wmKeyMap *keymap, wm
|
||||
static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *event, bool *dbl_click_disabled)
|
||||
{
|
||||
/* support for modal keymap in macros */
|
||||
if (op->opm)
|
||||
if (op->opm) {
|
||||
op = op->opm;
|
||||
}
|
||||
|
||||
if (op->type->modalkeymap) {
|
||||
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
|
||||
@ -2014,8 +2053,9 @@ static void wm_event_modalmap_end(wmEvent *event, bool dbl_click_disabled)
|
||||
event->val = event->prevval;
|
||||
event->prevval = 0;
|
||||
}
|
||||
else if (dbl_click_disabled)
|
||||
else if (dbl_click_disabled) {
|
||||
event->val = KM_DBL_CLICK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2050,8 +2090,9 @@ static int wm_handler_operator_call(
|
||||
wm_region_mouse_co(C, event);
|
||||
wm_event_modalkeymap(C, op, event, &dbl_click_disabled);
|
||||
|
||||
if (ot->flag & OPTYPE_UNDO)
|
||||
if (ot->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
/* warning, after this call all context data and 'event' may be freed. see check below */
|
||||
retval = ot->modal(C, op, event);
|
||||
@ -2064,8 +2105,9 @@ static int wm_handler_operator_call(
|
||||
|
||||
wm_event_modalmap_end(event, dbl_click_disabled);
|
||||
|
||||
if (ot->flag & OPTYPE_UNDO)
|
||||
if (ot->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
|
||||
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
|
||||
wm_operator_reports(C, op, retval, false);
|
||||
@ -2176,15 +2218,18 @@ static int wm_handler_operator_call(
|
||||
/* Finished and pass through flag as handled */
|
||||
|
||||
/* Finished and pass through flag as handled */
|
||||
if (retval == (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH))
|
||||
if (retval == (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH)) {
|
||||
return WM_HANDLER_HANDLED;
|
||||
}
|
||||
|
||||
/* Modal unhandled, break */
|
||||
if (retval == (OPERATOR_PASS_THROUGH | OPERATOR_RUNNING_MODAL))
|
||||
if (retval == (OPERATOR_PASS_THROUGH | OPERATOR_RUNNING_MODAL)) {
|
||||
return (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
|
||||
}
|
||||
|
||||
if (retval & OPERATOR_PASS_THROUGH)
|
||||
if (retval & OPERATOR_PASS_THROUGH) {
|
||||
return WM_HANDLER_CONTINUE;
|
||||
}
|
||||
|
||||
return WM_HANDLER_BREAK;
|
||||
}
|
||||
@ -2269,21 +2314,25 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
|
||||
if (val == EVT_FILESELECT_EXEC) {
|
||||
int retval;
|
||||
|
||||
if (handler->op->type->flag & OPTYPE_UNDO)
|
||||
if (handler->op->type->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
retval = handler->op->type->exec(C, handler->op);
|
||||
|
||||
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
|
||||
if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
|
||||
if (handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
|
||||
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
|
||||
if (CTX_wm_manager(C) == wm && wm->op_undo_depth == 0) {
|
||||
if (handler->op->type->flag & OPTYPE_UNDO)
|
||||
if (handler->op->type->flag & OPTYPE_UNDO) {
|
||||
ED_undo_push_op(C, handler->op);
|
||||
else if (handler->op->type->flag & OPTYPE_UNDO_GROUPED)
|
||||
}
|
||||
else if (handler->op->type->flag & OPTYPE_UNDO_GROUPED) {
|
||||
ED_undo_grouped_push_op(C, handler->op);
|
||||
}
|
||||
}
|
||||
|
||||
if (handler->op->reports->list.first) {
|
||||
@ -2295,8 +2344,9 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
|
||||
ScrArea *area_prev = CTX_wm_area(C);
|
||||
ARegion *ar_prev = CTX_wm_region(C);
|
||||
|
||||
if (win_prev == NULL)
|
||||
if (win_prev == NULL) {
|
||||
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
|
||||
}
|
||||
|
||||
BKE_report_print_level_set(handler->op->reports, RPT_WARNING);
|
||||
UI_popup_menu_reports(C, handler->op->reports);
|
||||
@ -2326,13 +2376,15 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
|
||||
}
|
||||
else {
|
||||
if (handler->op->type->cancel) {
|
||||
if (handler->op->type->flag & OPTYPE_UNDO)
|
||||
if (handler->op->type->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth++;
|
||||
}
|
||||
|
||||
handler->op->type->cancel(C, handler->op);
|
||||
|
||||
if (handler->op->type->flag & OPTYPE_UNDO)
|
||||
if (handler->op->type->flag & OPTYPE_UNDO) {
|
||||
wm->op_undo_depth--;
|
||||
}
|
||||
}
|
||||
|
||||
WM_operator_free(handler->op);
|
||||
@ -2355,10 +2407,12 @@ static int wm_handler_fileselect_call(
|
||||
{
|
||||
int action = WM_HANDLER_CONTINUE;
|
||||
|
||||
if (event->type != EVT_FILESELECT)
|
||||
if (event->type != EVT_FILESELECT) {
|
||||
return action;
|
||||
if (handler->op != (wmOperator *)event->customdata)
|
||||
}
|
||||
if (handler->op != (wmOperator *)event->customdata) {
|
||||
return action;
|
||||
}
|
||||
|
||||
return wm_handler_fileselect_do(C, handlers, handler, event->val);
|
||||
}
|
||||
@ -2370,20 +2424,26 @@ static bool handler_boundbox_test(wmEventHandler *handler, const wmEvent *event)
|
||||
rcti rect = *handler->bblocal;
|
||||
BLI_rcti_translate(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
|
||||
|
||||
if (BLI_rcti_isect_pt_v(&rect, &event->x))
|
||||
if (BLI_rcti_isect_pt_v(&rect, &event->x)) {
|
||||
return 1;
|
||||
else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(&rect, &event->prevx))
|
||||
}
|
||||
else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(&rect, &event->prevx)) {
|
||||
return 1;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (BLI_rcti_isect_pt_v(handler->bbwin, &event->x))
|
||||
if (BLI_rcti_isect_pt_v(handler->bbwin, &event->x)) {
|
||||
return 1;
|
||||
else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(handler->bbwin, &event->prevx))
|
||||
}
|
||||
else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(handler->bbwin, &event->prevx)) {
|
||||
return 1;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -2525,8 +2585,9 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
||||
event->custom = 0;
|
||||
|
||||
/* XXX fileread case */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return action;
|
||||
}
|
||||
|
||||
/* escape from drag loop, got freed */
|
||||
break;
|
||||
@ -2682,10 +2743,12 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
||||
}
|
||||
|
||||
if (action & WM_HANDLER_BREAK) {
|
||||
if (always_pass)
|
||||
if (always_pass) {
|
||||
action &= ~WM_HANDLER_BREAK;
|
||||
else
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2706,8 +2769,9 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
||||
}
|
||||
}
|
||||
|
||||
if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL))
|
||||
if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL)) {
|
||||
wm_cursor_arrow_move(CTX_wm_window(C), event);
|
||||
}
|
||||
|
||||
#undef PRINT
|
||||
|
||||
@ -2720,8 +2784,9 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
|
||||
int action = wm_handlers_do_intern(C, event, handlers);
|
||||
|
||||
/* fileread case */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return action;
|
||||
}
|
||||
|
||||
if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
||||
|
||||
@ -2839,10 +2904,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
|
||||
|
||||
static int wm_event_inside_i(wmEvent *event, rcti *rect)
|
||||
{
|
||||
if (wm_event_always_pass(event))
|
||||
if (wm_event_always_pass(event)) {
|
||||
return 1;
|
||||
if (BLI_rcti_isect_pt_v(rect, &event->x))
|
||||
}
|
||||
if (BLI_rcti_isect_pt_v(rect, &event->x)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2853,8 +2920,9 @@ static ScrArea *area_event_inside(bContext *C, const int xy[2])
|
||||
|
||||
if (screen) {
|
||||
ED_screen_areas_iter(win, screen, sa) {
|
||||
if (BLI_rcti_isect_pt_v(&sa->totrct, xy))
|
||||
if (BLI_rcti_isect_pt_v(&sa->totrct, xy)) {
|
||||
return sa;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -2866,10 +2934,13 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
ARegion *ar;
|
||||
|
||||
if (screen && area)
|
||||
for (ar = area->regionbase.first; ar; ar = ar->next)
|
||||
if (BLI_rcti_isect_pt_v(&ar->winrct, xy))
|
||||
if (screen && area) {
|
||||
for (ar = area->regionbase.first; ar; ar = ar->next) {
|
||||
if (BLI_rcti_isect_pt_v(&ar->winrct, xy)) {
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2894,8 +2965,9 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event)
|
||||
if (wm->paintcursors.first) {
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
if (ar)
|
||||
if (ar) {
|
||||
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
|
||||
}
|
||||
|
||||
/* if previous position was not in current region, we have to set a temp new context */
|
||||
if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) {
|
||||
@ -2933,8 +3005,9 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
|
||||
|
||||
/* create customdata, first free existing */
|
||||
if (event->customdata) {
|
||||
if (event->customdatafree)
|
||||
if (event->customdatafree) {
|
||||
MEM_freeN(event->customdata);
|
||||
}
|
||||
}
|
||||
|
||||
event->custom = EVT_DATA_DRAGDROP;
|
||||
@ -2986,8 +3059,9 @@ void wm_event_do_handlers(bContext *C)
|
||||
BLI_assert(WM_window_get_active_screen(win));
|
||||
BLI_assert(WM_window_get_active_workspace(win));
|
||||
|
||||
if (screen == NULL)
|
||||
if (screen == NULL) {
|
||||
wm_event_free_all(win);
|
||||
}
|
||||
else {
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
|
||||
@ -3071,8 +3145,9 @@ void wm_event_do_handlers(bContext *C)
|
||||
action |= wm_handlers_do(C, event, &win->modalhandlers);
|
||||
|
||||
/* fileread case */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for a tooltip */
|
||||
if (screen == WM_window_get_active_screen(win)) {
|
||||
@ -3141,11 +3216,13 @@ void wm_event_do_handlers(bContext *C)
|
||||
action |= wm_handlers_do(C, event, &ar->handlers);
|
||||
|
||||
/* fileread case (python), [#29489] */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action & WM_HANDLER_BREAK)
|
||||
if (action & WM_HANDLER_BREAK) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3172,8 +3249,9 @@ void wm_event_do_handlers(bContext *C)
|
||||
action |= wm_handlers_do(C, event, &win->handlers);
|
||||
|
||||
/* fileread case */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -3652,8 +3730,9 @@ bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
|
||||
* some items (i.e. markers) being tweaked may end up getting
|
||||
* dropped all over
|
||||
*/
|
||||
if (event->val != KM_RELEASE)
|
||||
if (event->val != KM_RELEASE) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -3935,8 +4014,9 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
|
||||
{
|
||||
int mx = event->x, my = event->y;
|
||||
|
||||
if (wm->windows.first == wm->windows.last)
|
||||
if (wm->windows.first == wm->windows.last) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* in order to use window size and mouse position (pixels), we have to use a WM function */
|
||||
|
||||
@ -4004,8 +4084,9 @@ static wmEvent *wm_event_add_mousemove(wmWindow *win, const wmEvent *event)
|
||||
/* some painting operators want accurate mouse events, they can
|
||||
* handle in between mouse move moves, others can happily ignore
|
||||
* them for better performance */
|
||||
if (event_last && event_last->type == MOUSEMOVE)
|
||||
if (event_last && event_last->type == MOUSEMOVE) {
|
||||
event_last->type = INBETWEEN_MOUSEMOVE;
|
||||
}
|
||||
|
||||
wmEvent *event_new = wm_event_add(win, event);
|
||||
if (event_last == NULL) {
|
||||
@ -4110,20 +4191,27 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
/* get value and type from ghost */
|
||||
event.val = (type == GHOST_kEventButtonDown) ? KM_PRESS : KM_RELEASE;
|
||||
|
||||
if (bd->button == GHOST_kButtonMaskLeft)
|
||||
if (bd->button == GHOST_kButtonMaskLeft) {
|
||||
event.type = LEFTMOUSE;
|
||||
else if (bd->button == GHOST_kButtonMaskRight)
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskRight) {
|
||||
event.type = RIGHTMOUSE;
|
||||
else if (bd->button == GHOST_kButtonMaskButton4)
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskButton4) {
|
||||
event.type = BUTTON4MOUSE;
|
||||
else if (bd->button == GHOST_kButtonMaskButton5)
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskButton5) {
|
||||
event.type = BUTTON5MOUSE;
|
||||
else if (bd->button == GHOST_kButtonMaskButton6)
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskButton6) {
|
||||
event.type = BUTTON6MOUSE;
|
||||
else if (bd->button == GHOST_kButtonMaskButton7)
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskButton7) {
|
||||
event.type = BUTTON7MOUSE;
|
||||
else
|
||||
}
|
||||
else {
|
||||
event.type = MIDDLEMOUSE;
|
||||
}
|
||||
|
||||
wm_eventemulation(&event, false);
|
||||
|
||||
@ -4206,10 +4294,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
event.utf8_buf[0] = '\0';
|
||||
}
|
||||
else {
|
||||
if (event.ascii < 32 && event.ascii > 0)
|
||||
if (event.ascii < 32 && event.ascii > 0) {
|
||||
event.ascii = '\0';
|
||||
if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0)
|
||||
}
|
||||
if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0) {
|
||||
event.utf8_buf[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (event.utf8_buf[0]) {
|
||||
@ -4226,39 +4316,58 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
case LEFTSHIFTKEY:
|
||||
case RIGHTSHIFTKEY:
|
||||
if (event.val == KM_PRESS) {
|
||||
if (evt->ctrl || evt->alt || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
else keymodifier = KM_MOD_FIRST;
|
||||
if (evt->ctrl || evt->alt || evt->oskey) {
|
||||
keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
}
|
||||
else {
|
||||
keymodifier = KM_MOD_FIRST;
|
||||
}
|
||||
}
|
||||
event.shift = evt->shift = keymodifier;
|
||||
break;
|
||||
case LEFTCTRLKEY:
|
||||
case RIGHTCTRLKEY:
|
||||
if (event.val == KM_PRESS) {
|
||||
if (evt->shift || evt->alt || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
else keymodifier = KM_MOD_FIRST;
|
||||
if (evt->shift || evt->alt || evt->oskey) {
|
||||
keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
}
|
||||
else {
|
||||
keymodifier = KM_MOD_FIRST;
|
||||
}
|
||||
}
|
||||
event.ctrl = evt->ctrl = keymodifier;
|
||||
break;
|
||||
case LEFTALTKEY:
|
||||
case RIGHTALTKEY:
|
||||
if (event.val == KM_PRESS) {
|
||||
if (evt->ctrl || evt->shift || evt->oskey) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
else keymodifier = KM_MOD_FIRST;
|
||||
if (evt->ctrl || evt->shift || evt->oskey) {
|
||||
keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
}
|
||||
else {
|
||||
keymodifier = KM_MOD_FIRST;
|
||||
}
|
||||
}
|
||||
event.alt = evt->alt = keymodifier;
|
||||
break;
|
||||
case OSKEY:
|
||||
if (event.val == KM_PRESS) {
|
||||
if (evt->ctrl || evt->alt || evt->shift) keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
else keymodifier = KM_MOD_FIRST;
|
||||
if (evt->ctrl || evt->alt || evt->shift) {
|
||||
keymodifier = (KM_MOD_FIRST | KM_MOD_SECOND);
|
||||
}
|
||||
else {
|
||||
keymodifier = KM_MOD_FIRST;
|
||||
}
|
||||
}
|
||||
event.oskey = evt->oskey = keymodifier;
|
||||
break;
|
||||
default:
|
||||
if (event.val == KM_PRESS && event.keymodifier == 0)
|
||||
evt->keymodifier = event.type; /* only set in eventstate, for next event */
|
||||
else if (event.val == KM_RELEASE && event.keymodifier == event.type)
|
||||
if (event.val == KM_PRESS && event.keymodifier == 0) {
|
||||
/* Only set in eventstate, for next event. */
|
||||
evt->keymodifier = event.type;
|
||||
}
|
||||
else if (event.val == KM_RELEASE && event.keymodifier == event.type) {
|
||||
event.keymodifier = evt->keymodifier = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4271,8 +4380,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
|
||||
/* this case happens on holding a key pressed, it should not generate
|
||||
* press events events with the same key as modifier */
|
||||
if (event.keymodifier == event.type)
|
||||
if (event.keymodifier == event.type) {
|
||||
event.keymodifier = 0;
|
||||
}
|
||||
|
||||
/* this case happens with an external numpad, and also when using 'dead keys' (to compose complex latin
|
||||
* characters e.g.), it's not really clear why.
|
||||
@ -4308,10 +4418,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
{
|
||||
GHOST_TEventWheelData *wheelData = customdata;
|
||||
|
||||
if (wheelData->z > 0)
|
||||
if (wheelData->z > 0) {
|
||||
event.type = WHEELUPMOUSE;
|
||||
else
|
||||
}
|
||||
else {
|
||||
event.type = WHEELDOWNMOUSE;
|
||||
}
|
||||
|
||||
event.val = KM_PRESS;
|
||||
wm_event_add(win, &event);
|
||||
@ -4488,8 +4600,9 @@ float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
|
||||
int erasor = 0;
|
||||
float pressure = 1;
|
||||
|
||||
if (tilt)
|
||||
if (tilt) {
|
||||
zero_v2(tilt);
|
||||
}
|
||||
|
||||
if (event->tablet_data) {
|
||||
const wmTabletData *wmtab = event->tablet_data;
|
||||
@ -4504,8 +4617,9 @@ float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
|
||||
}
|
||||
}
|
||||
|
||||
if (pen_flip)
|
||||
if (pen_flip) {
|
||||
(*pen_flip) = erasor;
|
||||
}
|
||||
|
||||
return pressure;
|
||||
}
|
||||
|
@ -194,8 +194,11 @@ static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm
|
||||
wm->windrawable = win;
|
||||
}
|
||||
|
||||
if (!G.background) /* file loading in background mode still calls this */
|
||||
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
|
||||
/* File loading in background mode still calls this. */
|
||||
if (!G.background) {
|
||||
/* Pointer back. */
|
||||
GHOST_SetWindowUserData(win->ghostwin, win);
|
||||
}
|
||||
|
||||
oldwin->ghostwin = NULL;
|
||||
oldwin->gpuctx = NULL;
|
||||
@ -896,8 +899,9 @@ void wm_homefile_read(
|
||||
NULL) != BKE_BLENDFILE_READ_FAIL;
|
||||
}
|
||||
if (BLI_listbase_is_empty(&U.themes)) {
|
||||
if (G.debug & G_DEBUG)
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\nNote: No (valid) '%s' found, fall back to built-in default.\n\n", filepath_startup);
|
||||
}
|
||||
success = false;
|
||||
}
|
||||
if (success) {
|
||||
@ -1028,7 +1032,9 @@ void wm_history_file_read(void)
|
||||
int num;
|
||||
const char * const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
|
||||
|
||||
if (!cfgdir) return;
|
||||
if (!cfgdir) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
|
||||
|
||||
@ -1082,8 +1088,9 @@ static void wm_history_file_write(void)
|
||||
|
||||
/* will be NULL in background mode */
|
||||
user_config_dir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL);
|
||||
if (!user_config_dir)
|
||||
if (!user_config_dir) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE);
|
||||
|
||||
@ -1161,8 +1168,9 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
|
||||
}
|
||||
|
||||
/* scene can be NULL if running a script at startup and calling the save operator */
|
||||
if (G.background || scene == NULL)
|
||||
if (G.background || scene == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((scene->camera == NULL) && (screen != NULL)) {
|
||||
sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0);
|
||||
@ -1393,8 +1401,9 @@ void WM_autosave_init(wmWindowManager *wm)
|
||||
{
|
||||
wm_autosave_timer_ended(wm);
|
||||
|
||||
if (U.flag & USER_AUTOSAVE)
|
||||
if (U.flag & USER_AUTOSAVE) {
|
||||
wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
|
||||
}
|
||||
}
|
||||
|
||||
void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
|
||||
@ -1461,8 +1470,12 @@ void wm_autosave_delete(void)
|
||||
BLI_make_file_string("/", str, BKE_tempdir_base(), BLENDER_QUIT_FILE);
|
||||
|
||||
/* if global undo; remove tempsave, otherwise rename */
|
||||
if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, false, false);
|
||||
else BLI_rename(filename, str);
|
||||
if (U.uiflag & USER_GLOBALUNDO) {
|
||||
BLI_delete(filename, false, false);
|
||||
}
|
||||
else {
|
||||
BLI_rename(filename, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1547,8 +1560,9 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op)
|
||||
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
|
||||
|
||||
/* check current window and close it if temp */
|
||||
if (win && WM_window_is_temp_screen(win))
|
||||
if (win && WM_window_is_temp_screen(win)) {
|
||||
wm_window_close(C, wm, win);
|
||||
}
|
||||
|
||||
/* update keymaps in user preferences */
|
||||
WM_keyconfig_update(wm);
|
||||
@ -1917,15 +1931,19 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
|
||||
wm_open_init_load_ui(op, false);
|
||||
wm_open_init_use_scripts(op, false);
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "load_ui"))
|
||||
if (RNA_boolean_get(op->ptr, "load_ui")) {
|
||||
G.fileflags &= ~G_FILE_NO_UI;
|
||||
else
|
||||
}
|
||||
else {
|
||||
G.fileflags |= G_FILE_NO_UI;
|
||||
}
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "use_scripts"))
|
||||
if (RNA_boolean_get(op->ptr, "use_scripts")) {
|
||||
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
|
||||
else
|
||||
}
|
||||
else {
|
||||
G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
|
||||
}
|
||||
|
||||
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
|
||||
|
||||
@ -1952,7 +1970,9 @@ static bool wm_open_mainfile_check(bContext *UNUSED(C), wmOperator *op)
|
||||
|
||||
/* get the dir */
|
||||
lslash = (char *)BLI_last_slash(path);
|
||||
if (lslash) *(lslash + 1) = '\0';
|
||||
if (lslash) {
|
||||
*(lslash + 1) = '\0';
|
||||
}
|
||||
|
||||
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) {
|
||||
if (BKE_autoexec_match(path) == true) {
|
||||
@ -2025,10 +2045,12 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
|
||||
|
||||
wm_open_init_use_scripts(op, false);
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "use_scripts"))
|
||||
if (RNA_boolean_get(op->ptr, "use_scripts")) {
|
||||
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
|
||||
else
|
||||
}
|
||||
else {
|
||||
G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
|
||||
}
|
||||
|
||||
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
|
||||
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_FLAG_SCRIPT_AUTOEXEC));
|
||||
@ -2314,8 +2336,9 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
|
||||
int ret;
|
||||
|
||||
/* cancel if no active window */
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
save_set_compress(op);
|
||||
save_set_filepath(C, op);
|
||||
|
@ -85,8 +85,9 @@ static bool wm_link_append_poll(bContext *C)
|
||||
* but which totally confuses edit mode (i.e. it becoming not so obvious
|
||||
* to leave from edit mode and invalid tools in toolbar might be displayed)
|
||||
* so disable link/append when in edit mode (sergey) */
|
||||
if (CTX_data_edit_object(C))
|
||||
if (CTX_data_edit_object(C)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -117,16 +118,21 @@ static short wm_link_append_flag(wmOperator *op)
|
||||
PropertyRNA *prop;
|
||||
short flag = 0;
|
||||
|
||||
if (RNA_boolean_get(op->ptr, "autoselect"))
|
||||
if (RNA_boolean_get(op->ptr, "autoselect")) {
|
||||
flag |= FILE_AUTOSELECT;
|
||||
if (RNA_boolean_get(op->ptr, "active_collection"))
|
||||
}
|
||||
if (RNA_boolean_get(op->ptr, "active_collection")) {
|
||||
flag |= FILE_ACTIVE_COLLECTION;
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop))
|
||||
}
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop)) {
|
||||
flag |= FILE_RELPATH;
|
||||
if (RNA_boolean_get(op->ptr, "link"))
|
||||
}
|
||||
if (RNA_boolean_get(op->ptr, "link")) {
|
||||
flag |= FILE_LINK;
|
||||
if (RNA_boolean_get(op->ptr, "instance_collections"))
|
||||
}
|
||||
if (RNA_boolean_get(op->ptr, "instance_collections")) {
|
||||
flag |= FILE_GROUP_INSTANCE;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
@ -98,8 +98,9 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
if (win->tweak == gesture)
|
||||
if (win->tweak == gesture) {
|
||||
win->tweak = NULL;
|
||||
}
|
||||
BLI_remlink(&win->gesture, gesture);
|
||||
MEM_freeN(gesture->customdata);
|
||||
if (gesture->userdata && gesture->userdata_free) {
|
||||
@ -112,8 +113,9 @@ void WM_gestures_remove(bContext *C)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
while (win->gesture.first)
|
||||
while (win->gesture.first) {
|
||||
WM_gesture_end(C, win->gesture.first);
|
||||
}
|
||||
}
|
||||
|
||||
bool WM_gesture_is_modal_first(const wmGesture *gesture)
|
||||
@ -136,13 +138,27 @@ int wm_gesture_evaluate(wmGesture *gesture)
|
||||
int theta = round_fl_to_int(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI);
|
||||
int val = EVT_GESTURE_W;
|
||||
|
||||
if (theta == 0) val = EVT_GESTURE_E;
|
||||
else if (theta == 1) val = EVT_GESTURE_NE;
|
||||
else if (theta == 2) val = EVT_GESTURE_N;
|
||||
else if (theta == 3) val = EVT_GESTURE_NW;
|
||||
else if (theta == -1) val = EVT_GESTURE_SE;
|
||||
else if (theta == -2) val = EVT_GESTURE_S;
|
||||
else if (theta == -3) val = EVT_GESTURE_SW;
|
||||
if (theta == 0) {
|
||||
val = EVT_GESTURE_E;
|
||||
}
|
||||
else if (theta == 1) {
|
||||
val = EVT_GESTURE_NE;
|
||||
}
|
||||
else if (theta == 2) {
|
||||
val = EVT_GESTURE_N;
|
||||
}
|
||||
else if (theta == 3) {
|
||||
val = EVT_GESTURE_NW;
|
||||
}
|
||||
else if (theta == -1) {
|
||||
val = EVT_GESTURE_SE;
|
||||
}
|
||||
else if (theta == -2) {
|
||||
val = EVT_GESTURE_S;
|
||||
}
|
||||
else if (theta == -3) {
|
||||
val = EVT_GESTURE_SW;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* debug */
|
||||
@ -424,12 +440,14 @@ void wm_gesture_draw(wmWindow *win)
|
||||
/* all in subwindow space */
|
||||
wmViewport(>->winrct);
|
||||
|
||||
if (gt->type == WM_GESTURE_RECT)
|
||||
if (gt->type == WM_GESTURE_RECT) {
|
||||
wm_gesture_draw_rect(gt);
|
||||
}
|
||||
// else if (gt->type == WM_GESTURE_TWEAK)
|
||||
// wm_gesture_draw_line(gt);
|
||||
else if (gt->type == WM_GESTURE_CIRCLE)
|
||||
else if (gt->type == WM_GESTURE_CIRCLE) {
|
||||
wm_gesture_draw_circle(gt);
|
||||
}
|
||||
else if (gt->type == WM_GESTURE_CROSS_RECT) {
|
||||
if (gt->is_active) {
|
||||
wm_gesture_draw_rect(gt);
|
||||
@ -438,12 +456,15 @@ void wm_gesture_draw(wmWindow *win)
|
||||
wm_gesture_draw_cross(win, gt);
|
||||
}
|
||||
}
|
||||
else if (gt->type == WM_GESTURE_LINES)
|
||||
else if (gt->type == WM_GESTURE_LINES) {
|
||||
wm_gesture_draw_lasso(gt, false);
|
||||
else if (gt->type == WM_GESTURE_LASSO)
|
||||
}
|
||||
else if (gt->type == WM_GESTURE_LASSO) {
|
||||
wm_gesture_draw_lasso(gt, true);
|
||||
else if (gt->type == WM_GESTURE_STRAIGHTLINE)
|
||||
}
|
||||
else if (gt->type == WM_GESTURE_STRAIGHTLINE) {
|
||||
wm_gesture_draw_line(gt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -451,6 +472,7 @@ void wm_gesture_tag_redraw(bContext *C)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
|
||||
if (screen)
|
||||
if (screen) {
|
||||
screen->do_draw_gesture = true;
|
||||
}
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ static bool gesture_box_apply_rect(wmOperator *op)
|
||||
wmGesture *gesture = op->customdata;
|
||||
rcti *rect = gesture->customdata;
|
||||
|
||||
if (rect->xmin == rect->xmax || rect->ymin == rect->ymax)
|
||||
if (rect->xmin == rect->xmax || rect->ymin == rect->ymax) {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* operator arguments and storage. */
|
||||
RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax));
|
||||
@ -353,11 +353,15 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
switch (event->val) {
|
||||
case GESTURE_MODAL_CIRCLE_SIZE:
|
||||
fac = 0.3f * (event->y - event->prevy);
|
||||
if (fac > 0)
|
||||
if (fac > 0) {
|
||||
rect->xmax += ceil(fac);
|
||||
else
|
||||
}
|
||||
else {
|
||||
rect->xmax += floor(fac);
|
||||
if (rect->xmax < 1) rect->xmax = 1;
|
||||
}
|
||||
if (rect->xmax < 1) {
|
||||
rect->xmax = 1;
|
||||
}
|
||||
is_circle_size = true;
|
||||
break;
|
||||
case GESTURE_MODAL_CIRCLE_ADD:
|
||||
@ -366,7 +370,9 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
break;
|
||||
case GESTURE_MODAL_CIRCLE_SUB:
|
||||
rect->xmax -= 2 + rect->xmax / 10;
|
||||
if (rect->xmax < 1) rect->xmax = 1;
|
||||
if (rect->xmax < 1) {
|
||||
rect->xmax = 1;
|
||||
}
|
||||
is_circle_size = true;
|
||||
break;
|
||||
case GESTURE_MODAL_SELECT:
|
||||
@ -478,12 +484,15 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
|
||||
/* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */
|
||||
tevent.x = rect->xmin + gesture->winrct.xmin;
|
||||
tevent.y = rect->ymin + gesture->winrct.ymin;
|
||||
if (gesture->event_type == LEFTMOUSE)
|
||||
if (gesture->event_type == LEFTMOUSE) {
|
||||
tevent.type = EVT_TWEAK_L;
|
||||
else if (gesture->event_type == RIGHTMOUSE)
|
||||
}
|
||||
else if (gesture->event_type == RIGHTMOUSE) {
|
||||
tevent.type = EVT_TWEAK_R;
|
||||
else
|
||||
}
|
||||
else {
|
||||
tevent.type = EVT_TWEAK_M;
|
||||
}
|
||||
tevent.val = val;
|
||||
/* mouse coords! */
|
||||
|
||||
@ -535,8 +544,9 @@ void wm_tweakevent_test(bContext *C, const wmEvent *event, int action)
|
||||
if ((action & WM_HANDLER_BREAK)) {
|
||||
WM_gesture_end(C, win->tweak);
|
||||
}
|
||||
else
|
||||
else {
|
||||
gesture_tweak_modal(C, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,8 +774,9 @@ static bool gesture_straightline_apply(bContext *C, wmOperator *op)
|
||||
wmGesture *gesture = op->customdata;
|
||||
rcti *rect = gesture->customdata;
|
||||
|
||||
if (rect->xmin == rect->xmax && rect->ymin == rect->ymax)
|
||||
if (rect->xmin == rect->xmax && rect->ymin == rect->ymax) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* operator arguments and storage. */
|
||||
RNA_int_set(op->ptr, "xstart", rect->xmin);
|
||||
|
@ -292,8 +292,9 @@ void WM_init(bContext *C, int argc, const char **argv)
|
||||
(void)argv; /* unused */
|
||||
#endif
|
||||
|
||||
if (!G.background && !wm_start_with_console)
|
||||
if (!G.background && !wm_start_with_console) {
|
||||
GHOST_toggleConsole(3);
|
||||
}
|
||||
|
||||
clear_matcopybuf();
|
||||
ED_render_clear_mtex_copybuf();
|
||||
@ -362,8 +363,9 @@ static void free_openrecent(void)
|
||||
{
|
||||
struct RecentFile *recent;
|
||||
|
||||
for (recent = G.recent_files.first; recent; recent = recent->next)
|
||||
for (recent = G.recent_files.first; recent; recent = recent->next) {
|
||||
MEM_freeN(recent->filepath);
|
||||
}
|
||||
|
||||
BLI_freelistN(&(G.recent_files));
|
||||
}
|
||||
@ -490,8 +492,10 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
||||
|
||||
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
|
||||
|
||||
if (C && wm)
|
||||
wm_free_reports(C); /* before BKE_blender_free! - since the ListBases get freed there */
|
||||
if (C && wm) {
|
||||
/* Before BKE_blender_free! - since the ListBases get freed there. */
|
||||
wm_free_reports(C);
|
||||
}
|
||||
|
||||
BKE_sequencer_free_clipboard(); /* sequencer.c */
|
||||
BKE_tracking_clipboard_free();
|
||||
|
@ -146,19 +146,25 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
|
||||
wmJob *wm_job;
|
||||
|
||||
if (owner && job_type) {
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
|
||||
if (wm_job->owner == owner && wm_job->job_type == job_type)
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
|
||||
if (wm_job->owner == owner && wm_job->job_type == job_type) {
|
||||
return wm_job;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (owner) {
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
|
||||
if (wm_job->owner == owner)
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
|
||||
if (wm_job->owner == owner) {
|
||||
return wm_job;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (job_type) {
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
|
||||
if (wm_job->job_type == job_type)
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
|
||||
if (wm_job->job_type == job_type) {
|
||||
return wm_job;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -220,8 +226,9 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
|
||||
{
|
||||
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
|
||||
|
||||
if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
|
||||
if (wm_job && wm_job->flag & WM_JOB_PROGRESS) {
|
||||
return wm_job->progress;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
@ -246,14 +253,16 @@ static void wm_jobs_update_progress_bars(wmWindowManager *wm)
|
||||
wmWindow *win;
|
||||
float progress = total_progress / (float)jobs_progress;
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next)
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
WM_progress_set(win, progress);
|
||||
}
|
||||
}
|
||||
else {
|
||||
wmWindow *win;
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next)
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
WM_progress_clear(win);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -263,8 +272,9 @@ double WM_jobs_starttime(wmWindowManager *wm, void *owner)
|
||||
{
|
||||
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
|
||||
|
||||
if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
|
||||
if (wm_job && wm_job->flag & WM_JOB_PROGRESS) {
|
||||
return wm_job->start_time;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -273,8 +283,9 @@ char *WM_jobs_name(wmWindowManager *wm, void *owner)
|
||||
{
|
||||
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
|
||||
|
||||
if (wm_job)
|
||||
if (wm_job) {
|
||||
return wm_job->name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -283,8 +294,9 @@ void *WM_jobs_customdata(wmWindowManager *wm, void *owner)
|
||||
{
|
||||
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
|
||||
|
||||
if (wm_job)
|
||||
if (wm_job) {
|
||||
return WM_jobs_customdata_get(wm_job);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -293,8 +305,9 @@ void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type)
|
||||
{
|
||||
wmJob *wm_job = wm_job_find(wm, NULL, job_type);
|
||||
|
||||
if (wm_job)
|
||||
if (wm_job) {
|
||||
return WM_jobs_customdata_get(wm_job);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -323,8 +336,9 @@ void *WM_jobs_customdata_get(wmJob *wm_job)
|
||||
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void *))
|
||||
{
|
||||
/* pending job? just free */
|
||||
if (wm_job->customdata)
|
||||
if (wm_job->customdata) {
|
||||
wm_job->free(wm_job->customdata);
|
||||
}
|
||||
|
||||
wm_job->customdata = customdata;
|
||||
wm_job->free = free;
|
||||
@ -385,14 +399,18 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
|
||||
}
|
||||
|
||||
/* if new job is not render, then check for same startjob */
|
||||
if (0 == (test->flag & WM_JOB_EXCL_RENDER))
|
||||
if (wm_job->startjob != test->startjob)
|
||||
if (0 == (test->flag & WM_JOB_EXCL_RENDER)) {
|
||||
if (wm_job->startjob != test->startjob) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* if new job is render, any render job should be stopped */
|
||||
if (test->flag & WM_JOB_EXCL_RENDER)
|
||||
if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER))
|
||||
if (test->flag & WM_JOB_EXCL_RENDER) {
|
||||
if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
suspend = true;
|
||||
|
||||
@ -434,8 +452,9 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
|
||||
wm_job->customdata = NULL;
|
||||
wm_job->running = true;
|
||||
|
||||
if (wm_job->initjob)
|
||||
if (wm_job->initjob) {
|
||||
wm_job->initjob(wm_job->run_customdata);
|
||||
}
|
||||
|
||||
wm_job->stop = false;
|
||||
wm_job->ready = false;
|
||||
@ -448,8 +467,9 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
|
||||
}
|
||||
|
||||
/* restarted job has timer already */
|
||||
if (wm_job->wt == NULL)
|
||||
if (wm_job->wt == NULL) {
|
||||
wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
|
||||
}
|
||||
|
||||
wm_job->start_time = PIL_check_seconds_timer();
|
||||
}
|
||||
@ -480,16 +500,20 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
|
||||
BLI_threadpool_end(&wm_job->threads);
|
||||
WM_job_main_thread_lock_acquire(wm_job);
|
||||
|
||||
if (wm_job->endjob)
|
||||
if (wm_job->endjob) {
|
||||
wm_job->endjob(wm_job->run_customdata);
|
||||
}
|
||||
}
|
||||
|
||||
if (wm_job->wt)
|
||||
if (wm_job->wt) {
|
||||
WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
|
||||
if (wm_job->customdata)
|
||||
}
|
||||
if (wm_job->customdata) {
|
||||
wm_job->free(wm_job->customdata);
|
||||
if (wm_job->run_customdata)
|
||||
}
|
||||
if (wm_job->run_customdata) {
|
||||
wm_job->run_free(wm_job->run_customdata);
|
||||
}
|
||||
|
||||
/* remove wm_job */
|
||||
wm_job_free(wm, wm_job);
|
||||
@ -505,8 +529,9 @@ void WM_jobs_kill_all(wmWindowManager *wm)
|
||||
{
|
||||
wmJob *wm_job;
|
||||
|
||||
while ((wm_job = wm->jobs.first))
|
||||
while ((wm_job = wm->jobs.first)) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -518,8 +543,9 @@ void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
|
||||
next_job = wm_job->next;
|
||||
|
||||
if (wm_job->owner != owner)
|
||||
if (wm_job->owner != owner) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,9 +557,11 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
|
||||
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
|
||||
next_job = wm_job->next;
|
||||
|
||||
if (!owner || wm_job->owner == owner)
|
||||
if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type)
|
||||
if (!owner || wm_job->owner == owner) {
|
||||
if (job_type == WM_JOB_TYPE_ANY || wm_job->job_type == job_type) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,19 +629,23 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
|
||||
|
||||
/* always call note and update when ready */
|
||||
if (wm_job->do_update || wm_job->ready) {
|
||||
if (wm_job->update)
|
||||
if (wm_job->update) {
|
||||
wm_job->update(wm_job->run_customdata);
|
||||
if (wm_job->note)
|
||||
}
|
||||
if (wm_job->note) {
|
||||
WM_event_add_notifier(C, wm_job->note, NULL);
|
||||
}
|
||||
|
||||
if (wm_job->flag & WM_JOB_PROGRESS)
|
||||
if (wm_job->flag & WM_JOB_PROGRESS) {
|
||||
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
|
||||
}
|
||||
wm_job->do_update = false;
|
||||
}
|
||||
|
||||
if (wm_job->ready) {
|
||||
if (wm_job->endjob)
|
||||
if (wm_job->endjob) {
|
||||
wm_job->endjob(wm_job->run_customdata);
|
||||
}
|
||||
|
||||
/* free own data */
|
||||
wm_job->run_free(wm_job->run_customdata);
|
||||
@ -634,8 +666,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
|
||||
BLI_threadpool_end(&wm_job->threads);
|
||||
WM_job_main_thread_lock_acquire(wm_job);
|
||||
|
||||
if (wm_job->endnote)
|
||||
if (wm_job->endnote) {
|
||||
WM_event_add_notifier(C, wm_job->endnote, NULL);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
|
||||
|
||||
|
@ -152,10 +152,12 @@ static void wm_keyconfig_properties_update_ot(ListBase *km_lb)
|
||||
}
|
||||
|
||||
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
|
||||
if (kmdi->add_item)
|
||||
if (kmdi->add_item) {
|
||||
wm_keymap_item_properties_update_ot(kmdi->add_item);
|
||||
if (kmdi->remove_item)
|
||||
}
|
||||
if (kmdi->remove_item) {
|
||||
wm_keymap_item_properties_update_ot(kmdi->remove_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,10 +234,12 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
|
||||
wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
|
||||
|
||||
kmdin->next = kmdin->prev = NULL;
|
||||
if (kmdi->add_item)
|
||||
if (kmdi->add_item) {
|
||||
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
|
||||
if (kmdi->remove_item)
|
||||
}
|
||||
if (kmdi->remove_item) {
|
||||
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
|
||||
}
|
||||
|
||||
return kmdin;
|
||||
}
|
||||
@ -331,8 +335,9 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
|
||||
|
||||
/* first try from preset */
|
||||
keyconf = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
|
||||
if (keyconf)
|
||||
if (keyconf) {
|
||||
return keyconf;
|
||||
}
|
||||
|
||||
/* otherwise use default */
|
||||
return wm->defaultconf;
|
||||
@ -401,11 +406,13 @@ void WM_keymap_clear(wmKeyMap *keymap)
|
||||
wmKeyMapItem *kmi;
|
||||
wmKeyMapDiffItem *kmdi;
|
||||
|
||||
for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next)
|
||||
for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next) {
|
||||
wm_keymap_diff_item_free(kmdi);
|
||||
}
|
||||
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next)
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
|
||||
wm_keymap_item_free(kmi);
|
||||
}
|
||||
|
||||
BLI_freelistN(&keymap->diff_items);
|
||||
BLI_freelistN(&keymap->items);
|
||||
@ -476,9 +483,11 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next)
|
||||
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME))
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
|
||||
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (kmi == NULL) {
|
||||
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
|
||||
|
||||
@ -563,9 +572,11 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next)
|
||||
if (wm_keymap_item_equals(kmi, needle))
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
||||
if (wm_keymap_item_equals(kmi, needle)) {
|
||||
return kmi;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -574,9 +585,11 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next)
|
||||
if (wm_keymap_item_equals_result(kmi, needle))
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
||||
if (wm_keymap_item_equals_result(kmi, needle)) {
|
||||
return kmi;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -607,8 +620,9 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
|
||||
if (to_kmi) {
|
||||
orig_kmi = WM_keymap_item_find_id(orig_km, kmi->id);
|
||||
|
||||
if (!orig_kmi && addon_km)
|
||||
if (!orig_kmi && addon_km) {
|
||||
orig_kmi = wm_keymap_find_item_equals(addon_km, kmi);
|
||||
}
|
||||
|
||||
if (orig_kmi) {
|
||||
orig_kmi->flag &= ~KMI_EXPANDED;
|
||||
@ -637,8 +651,9 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
|
||||
kmi_remove = NULL;
|
||||
if (kmdi->remove_item) {
|
||||
kmi_remove = wm_keymap_find_item_equals(km, kmdi->remove_item);
|
||||
if (!kmi_remove)
|
||||
if (!kmi_remove) {
|
||||
kmi_remove = wm_keymap_find_item_equals_result(km, kmdi->remove_item);
|
||||
}
|
||||
}
|
||||
|
||||
/* add item */
|
||||
@ -711,32 +726,39 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
|
||||
/* try to find corresponding id's for items */
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
||||
orig_kmi = wm_keymap_find_item_equals(defaultmap, kmi);
|
||||
if (!orig_kmi)
|
||||
if (!orig_kmi) {
|
||||
orig_kmi = wm_keymap_find_item_equals_result(defaultmap, kmi);
|
||||
}
|
||||
|
||||
if (orig_kmi)
|
||||
if (orig_kmi) {
|
||||
kmi->id = orig_kmi->id;
|
||||
else
|
||||
}
|
||||
else {
|
||||
kmi->id = -(km->kmi_id++);
|
||||
}
|
||||
}
|
||||
|
||||
km->flag |= KEYMAP_UPDATE; /* update again to create diff */
|
||||
}
|
||||
else
|
||||
else {
|
||||
km = wm_keymap_copy(defaultmap);
|
||||
}
|
||||
|
||||
/* add addon keymap items */
|
||||
if (addonmap)
|
||||
if (addonmap) {
|
||||
wm_keymap_addon_add(km, addonmap);
|
||||
}
|
||||
|
||||
/* tag as being user edited */
|
||||
if (usermap)
|
||||
if (usermap) {
|
||||
km->flag |= KEYMAP_USER_MODIFIED;
|
||||
}
|
||||
km->flag |= KEYMAP_USER | expanded;
|
||||
|
||||
/* apply user changes of diff keymap */
|
||||
if (usermap && (usermap->flag & KEYMAP_DIFF))
|
||||
if (usermap && (usermap->flag & KEYMAP_DIFF)) {
|
||||
wm_keymap_patch(km, usermap);
|
||||
}
|
||||
|
||||
/* add to list */
|
||||
BLI_addtail(lb, km);
|
||||
@ -766,8 +788,9 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
|
||||
/* create diff keymap */
|
||||
diffmap = wm_keymap_new(km->idname, km->spaceid, km->regionid);
|
||||
diffmap->flag |= KEYMAP_DIFF;
|
||||
if (defaultmap->flag & KEYMAP_MODAL)
|
||||
if (defaultmap->flag & KEYMAP_MODAL) {
|
||||
diffmap->flag |= KEYMAP_MODAL;
|
||||
}
|
||||
wm_keymap_diff(diffmap, defaultmap, km, origmap, addonmap);
|
||||
|
||||
/* add to list if not empty */
|
||||
@ -796,10 +819,13 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
|
||||
{
|
||||
wmKeyMap *km;
|
||||
|
||||
for (km = lb->first; km; km = km->next)
|
||||
if (km->spaceid == spaceid && km->regionid == regionid)
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
|
||||
for (km = lb->first; km; km = km->next) {
|
||||
if (km->spaceid == spaceid && km->regionid == regionid) {
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
|
||||
return km;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -808,10 +834,13 @@ wmKeyMap *WM_keymap_list_find_spaceid_or_empty(ListBase *lb, const char *idname,
|
||||
{
|
||||
wmKeyMap *km;
|
||||
|
||||
for (km = lb->first; km; km = km->next)
|
||||
if (ELEM(km->spaceid, spaceid, SPACE_EMPTY) && km->regionid == regionid)
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
|
||||
for (km = lb->first; km; km = km->next) {
|
||||
if (ELEM(km->spaceid, spaceid, SPACE_EMPTY) && km->regionid == regionid) {
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
|
||||
return km;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -876,10 +905,13 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
|
||||
{
|
||||
wmKeyMap *km;
|
||||
|
||||
for (km = keyconf->keymaps.first; km; km = km->next)
|
||||
if (km->flag & KEYMAP_MODAL)
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
|
||||
for (km = keyconf->keymaps.first; km; km = km->next) {
|
||||
if (km->flag & KEYMAP_MODAL) {
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return km;
|
||||
}
|
||||
@ -966,8 +998,9 @@ static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km)
|
||||
|
||||
defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
|
||||
|
||||
if (!defaultkm)
|
||||
if (!defaultkm) {
|
||||
return;
|
||||
}
|
||||
|
||||
km->modal_items = defaultkm->modal_items;
|
||||
km->poll = defaultkm->poll;
|
||||
@ -976,8 +1009,9 @@ static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km)
|
||||
if (km->modal_items) {
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
||||
if (kmi->propvalue_str[0]) {
|
||||
if (RNA_enum_value_from_id(km->modal_items, kmi->propvalue_str, &propvalue))
|
||||
if (RNA_enum_value_from_id(km->modal_items, kmi->propvalue_str, &propvalue)) {
|
||||
kmi->propvalue = propvalue;
|
||||
}
|
||||
kmi->propvalue_str[0] = '\0';
|
||||
}
|
||||
}
|
||||
@ -1245,7 +1279,9 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
|
||||
}
|
||||
}
|
||||
/* ensure un-initialized keymap is never used */
|
||||
if (r_keymap) *r_keymap = NULL;
|
||||
if (r_keymap) {
|
||||
*r_keymap = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1270,36 +1306,44 @@ static wmKeyMapItem *wm_keymap_item_find_props(
|
||||
}
|
||||
}
|
||||
|
||||
if (sa && found == NULL)
|
||||
if (sa && found == NULL) {
|
||||
found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
|
||||
}
|
||||
|
||||
if (found == NULL) {
|
||||
if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
|
||||
if (sa) {
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
||||
}
|
||||
|
||||
if (ar)
|
||||
if (ar) {
|
||||
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS)) {
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
|
||||
}
|
||||
|
||||
if (ar)
|
||||
if (ar) {
|
||||
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
|
||||
}
|
||||
}
|
||||
else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW))
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) {
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
|
||||
}
|
||||
|
||||
if (ar)
|
||||
if (ar) {
|
||||
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ar)
|
||||
if (ar) {
|
||||
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1466,40 +1510,50 @@ bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
|
||||
{
|
||||
int k1type, k2type;
|
||||
|
||||
if (k1->flag & KMI_INACTIVE || k2->flag & KMI_INACTIVE)
|
||||
if (k1->flag & KMI_INACTIVE || k2->flag & KMI_INACTIVE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* take event mapping into account */
|
||||
k1type = WM_userdef_event_map(k1->type);
|
||||
k2type = WM_userdef_event_map(k2->type);
|
||||
|
||||
if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
|
||||
if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (k1->val != KM_ANY && k2->val != KM_ANY) {
|
||||
/* take click, press, release conflict into account */
|
||||
if (k1->val == KM_CLICK && ELEM(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
|
||||
if (k1->val == KM_CLICK && ELEM(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0) {
|
||||
return 0;
|
||||
if (k2->val == KM_CLICK && ELEM(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
|
||||
}
|
||||
if (k2->val == KM_CLICK && ELEM(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0) {
|
||||
return 0;
|
||||
if (k1->val != k2->val)
|
||||
}
|
||||
if (k1->val != k2->val) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
|
||||
if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
|
||||
if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
|
||||
if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
|
||||
if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (k1->keymodifier != k2->keymodifier)
|
||||
if (k1->keymodifier != k2->keymodifier) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1524,10 +1578,12 @@ void WM_keyconfig_update_tag(wmKeyMap *km, wmKeyMapItem *kmi)
|
||||
/* quick tag to do delayed keymap updates */
|
||||
wm_keymap_update_flag |= WM_KEYMAP_UPDATE_RECONFIGURE;
|
||||
|
||||
if (km)
|
||||
if (km) {
|
||||
km->flag |= KEYMAP_UPDATE;
|
||||
if (kmi)
|
||||
}
|
||||
if (kmi) {
|
||||
kmi->flag |= KMI_UPDATE;
|
||||
}
|
||||
}
|
||||
|
||||
void WM_keyconfig_update_operatortype(void)
|
||||
@ -1557,8 +1613,9 @@ static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
|
||||
wmKeyMap *keymap;
|
||||
|
||||
keymap = WM_keymap_list_find(&keyconf->keymaps, km->idname, km->spaceid, km->regionid);
|
||||
if (!keymap && wm->defaultconf)
|
||||
if (!keymap && wm->defaultconf) {
|
||||
keymap = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, km->spaceid, km->regionid);
|
||||
}
|
||||
|
||||
return keymap;
|
||||
}
|
||||
@ -1570,11 +1627,13 @@ void WM_keyconfig_update(wmWindowManager *wm)
|
||||
wmKeyMapDiffItem *kmdi;
|
||||
bool compat_update = false;
|
||||
|
||||
if (G.background)
|
||||
if (G.background) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wm_keymap_update_flag == 0)
|
||||
if (wm_keymap_update_flag == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wm_keymap_update_flag & WM_KEYMAP_UPDATE_OPERATORTYPE) {
|
||||
/* an operatortype has been removed, this wont happen often
|
||||
@ -1603,22 +1662,25 @@ void WM_keyconfig_update(wmWindowManager *wm)
|
||||
}
|
||||
|
||||
|
||||
if (wm_keymap_update_flag == 0)
|
||||
if (wm_keymap_update_flag == 0) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* update operator properties for non-modal user keymaps */
|
||||
for (km = U.user_keymaps.first; km; km = km->next) {
|
||||
if ((km->flag & KEYMAP_MODAL) == 0) {
|
||||
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
|
||||
if (kmdi->add_item)
|
||||
if (kmdi->add_item) {
|
||||
wm_keymap_item_properties_set(kmdi->add_item);
|
||||
if (kmdi->remove_item)
|
||||
}
|
||||
if (kmdi->remove_item) {
|
||||
wm_keymap_item_properties_set(kmdi->remove_item);
|
||||
}
|
||||
}
|
||||
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next)
|
||||
for (kmi = km->items.first; kmi; kmi = kmi->next) {
|
||||
wm_keymap_item_properties_set(kmi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1631,8 +1693,9 @@ void WM_keyconfig_update(wmWindowManager *wm)
|
||||
addonmap = WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
|
||||
|
||||
/* diff */
|
||||
if (defaultmap)
|
||||
if (defaultmap) {
|
||||
wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1678,14 +1741,16 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
|
||||
{
|
||||
wmKeyMap *km;
|
||||
|
||||
if (!keymap)
|
||||
if (!keymap) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* first user defined keymaps */
|
||||
km = WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
|
||||
|
||||
if (km)
|
||||
if (km) {
|
||||
return km;
|
||||
}
|
||||
|
||||
return keymap;
|
||||
}
|
||||
@ -1699,8 +1764,9 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
|
||||
wmKeyMap *defaultmap, *addonmap;
|
||||
wmKeyMapItem *orig;
|
||||
|
||||
if (!keymap)
|
||||
if (!keymap) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* construct default keymap from preset + addons */
|
||||
defaultmap = wm_keymap_preset(wm, keymap);
|
||||
|
@ -207,10 +207,12 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
||||
}
|
||||
else if (STRPREFIX(opname, "OBJECT_OT")) {
|
||||
/* exception, this needs to work outside object mode too */
|
||||
if (STRPREFIX(opname, "OBJECT_OT_mode_set"))
|
||||
if (STRPREFIX(opname, "OBJECT_OT_mode_set")) {
|
||||
km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
|
||||
else
|
||||
}
|
||||
else {
|
||||
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
|
||||
}
|
||||
}
|
||||
/* Object mode related */
|
||||
else if (STRPREFIX(opname, "GROUP_OT") ||
|
||||
|
@ -45,12 +45,14 @@ MenuType *WM_menutype_find(const char *idname, bool quiet)
|
||||
|
||||
if (idname[0]) {
|
||||
mt = BLI_ghash_lookup(menutypes_hash, idname);
|
||||
if (mt)
|
||||
if (mt) {
|
||||
return mt;
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet)
|
||||
if (!quiet) {
|
||||
printf("search for unknown menutype %s\n", idname);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -64,17 +64,21 @@ void WM_operator_properties_filesel(
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (flag & WM_FILESEL_FILEPATH)
|
||||
if (flag & WM_FILESEL_FILEPATH) {
|
||||
RNA_def_string_file_path(ot->srna, "filepath", NULL, FILE_MAX, "File Path", "Path to file");
|
||||
}
|
||||
|
||||
if (flag & WM_FILESEL_DIRECTORY)
|
||||
if (flag & WM_FILESEL_DIRECTORY) {
|
||||
RNA_def_string_dir_path(ot->srna, "directory", NULL, FILE_MAX, "Directory", "Directory of the file");
|
||||
}
|
||||
|
||||
if (flag & WM_FILESEL_FILENAME)
|
||||
if (flag & WM_FILESEL_FILENAME) {
|
||||
RNA_def_string_file_name(ot->srna, "filename", NULL, FILE_MAX, "File Name", "Name of the file");
|
||||
}
|
||||
|
||||
if (flag & WM_FILESEL_FILES)
|
||||
if (flag & WM_FILESEL_FILES) {
|
||||
RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
|
||||
}
|
||||
|
||||
if (action == FILE_SAVE) {
|
||||
/* note, this is only used to check if we should highlight the filename area red when the
|
||||
@ -116,8 +120,9 @@ void WM_operator_properties_filesel(
|
||||
FILE_LOADLIB, FILE_SPECIAL);
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
|
||||
|
||||
if (flag & WM_FILESEL_RELPATH)
|
||||
if (flag & WM_FILESEL_RELPATH) {
|
||||
RNA_def_boolean(ot->srna, "relative_path", true, "Relative Path", "Select the file relative to the blend file");
|
||||
}
|
||||
|
||||
if ((filter & FILE_TYPE_IMAGE) || (filter & FILE_TYPE_MOVIE)) {
|
||||
prop = RNA_def_boolean(ot->srna, "show_multiview", 0, "Enable Multi-View", "");
|
||||
|
@ -158,8 +158,9 @@ void WM_operatortype_remove_ptr(wmOperatorType *ot)
|
||||
MEM_freeN(ot->last_properties);
|
||||
}
|
||||
|
||||
if (ot->macro.first)
|
||||
if (ot->macro.first) {
|
||||
wm_operatortype_free_macro(ot);
|
||||
}
|
||||
|
||||
BLI_ghash_remove(global_ops_hash, ot->idname, NULL, NULL);
|
||||
|
||||
@ -172,8 +173,9 @@ bool WM_operatortype_remove(const char *idname)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find(idname, 0);
|
||||
|
||||
if (ot == NULL)
|
||||
if (ot == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WM_operatortype_remove_ptr(ot);
|
||||
|
||||
@ -194,11 +196,14 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot)
|
||||
MEM_freeN(ot->last_properties);
|
||||
}
|
||||
|
||||
if (ot->macro.first)
|
||||
if (ot->macro.first) {
|
||||
wm_operatortype_free_macro(ot);
|
||||
}
|
||||
|
||||
if (ot->ext.srna) /* python operator, allocs own string */
|
||||
if (ot->ext.srna) {
|
||||
/* python operator, allocs own string */
|
||||
MEM_freeN((void *)ot->idname);
|
||||
}
|
||||
|
||||
MEM_freeN(ot);
|
||||
}
|
||||
@ -354,10 +359,12 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, const wmEvent *
|
||||
|
||||
/* start from operator received as argument */
|
||||
for (; opm; opm = opm->next) {
|
||||
if (opm->type->invoke)
|
||||
if (opm->type->invoke) {
|
||||
retval = opm->type->invoke(C, opm, event);
|
||||
else if (opm->type->exec)
|
||||
}
|
||||
else if (opm->type->exec) {
|
||||
retval = opm->type->exec(C, opm);
|
||||
}
|
||||
|
||||
OPERATOR_RETVAL_CHECK(retval);
|
||||
|
||||
@ -480,8 +487,10 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
|
||||
ot->cancel = wm_macro_cancel;
|
||||
ot->poll = NULL;
|
||||
|
||||
if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
|
||||
if (!ot->description) {
|
||||
/* XXX All ops should have a description but for now allow them not to. */
|
||||
ot->description = UNDOCUMENTED_OPERATOR_TIP;
|
||||
}
|
||||
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
|
||||
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
|
||||
@ -509,8 +518,9 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *),
|
||||
ot->cancel = wm_macro_cancel;
|
||||
ot->poll = NULL;
|
||||
|
||||
if (!ot->description)
|
||||
if (!ot->description) {
|
||||
ot->description = UNDOCUMENTED_OPERATOR_TIP;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
@ -157,8 +157,9 @@ void WM_operator_bl_idname(char *to, const char *from)
|
||||
BLI_strncpy(to, from, OP_MAX_TYPENAME);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
to[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -550,10 +551,12 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find(opstring, false);
|
||||
|
||||
if (ot)
|
||||
if (ot) {
|
||||
WM_operator_properties_create_ptr(ptr, ot);
|
||||
else
|
||||
}
|
||||
else {
|
||||
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* similar to the function above except its uses ID properties
|
||||
@ -580,10 +583,12 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
|
||||
{
|
||||
switch (RNA_property_type(prop)) {
|
||||
case PROP_ENUM:
|
||||
if (no_context)
|
||||
if (no_context) {
|
||||
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
else
|
||||
}
|
||||
else {
|
||||
RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
|
||||
}
|
||||
break;
|
||||
case PROP_POINTER:
|
||||
{
|
||||
@ -834,10 +839,12 @@ int WM_operator_confirm_message_ex(bContext *C, wmOperator *op,
|
||||
uiLayout *layout;
|
||||
IDProperty *properties = op->ptr->data;
|
||||
|
||||
if (properties && properties->len)
|
||||
if (properties && properties->len) {
|
||||
properties = IDP_CopyProperty(op->ptr->data);
|
||||
else
|
||||
}
|
||||
else {
|
||||
properties = NULL;
|
||||
}
|
||||
|
||||
pup = UI_popup_menu_begin(C, title, icon);
|
||||
layout = UI_popup_menu_layout(pup);
|
||||
@ -900,7 +907,9 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor
|
||||
/* op->poll */
|
||||
bool WM_operator_winactive(bContext *C)
|
||||
{
|
||||
if (CTX_wm_window(C) == NULL) return 0;
|
||||
if (CTX_wm_window(C) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -919,9 +928,11 @@ wmOperator *WM_operator_last_redo(const bContext *C)
|
||||
wmOperator *op;
|
||||
|
||||
/* only for operators that are registered and did an undo push */
|
||||
for (op = wm->operators.last; op; op = op->prev)
|
||||
if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
|
||||
for (op = wm->operators.last; op; op = op->prev) {
|
||||
if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
@ -1020,8 +1031,9 @@ static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
|
||||
wmOperator *op = arg_op;
|
||||
|
||||
/* if operator never got executed, free it */
|
||||
if (op != WM_operator_last_redo(C))
|
||||
if (op != WM_operator_last_redo(C)) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
}
|
||||
|
||||
static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
|
||||
@ -1046,17 +1058,20 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
|
||||
UI_block_func_handle_set(block, wm_block_redo_cb, arg_op);
|
||||
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style);
|
||||
|
||||
if (op == WM_operator_last_redo(C))
|
||||
if (!WM_operator_check_ui_enabled(C, op->type->name))
|
||||
if (op == WM_operator_last_redo(C)) {
|
||||
if (!WM_operator_check_ui_enabled(C, op->type->name)) {
|
||||
uiLayoutSetEnabled(layout, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (op->type->flag & OPTYPE_MACRO) {
|
||||
for (op = op->macro.first; op; op = op->next) {
|
||||
uiTemplateOperatorPropertyButs(
|
||||
C, layout, op, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
|
||||
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
|
||||
if (op->next)
|
||||
if (op->next) {
|
||||
uiItemS(layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1211,8 +1226,9 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
|
||||
wmOpPopUp *data = arg;
|
||||
wmOperator *op = data->op;
|
||||
|
||||
if (op && retval > 0)
|
||||
if (op && retval > 0) {
|
||||
WM_operator_call_ex(C, op, true);
|
||||
}
|
||||
|
||||
MEM_freeN(data);
|
||||
}
|
||||
@ -1251,13 +1267,15 @@ static int wm_operator_props_popup_ex(bContext *C, wmOperator *op,
|
||||
|
||||
/* if we don't have global undo, we can't do undo push for automatic redo,
|
||||
* so we require manual OK clicking in this popup */
|
||||
if (!do_redo || !(U.uiflag & USER_GLOBALUNDO))
|
||||
if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) {
|
||||
return WM_operator_props_dialog_popup(C, op, 300, 20);
|
||||
}
|
||||
|
||||
UI_popup_block_ex(C, wm_block_create_redo, NULL, wm_block_redo_cancel_cb, op, op);
|
||||
|
||||
if (do_call)
|
||||
if (do_call) {
|
||||
wm_block_redo_cb(C, op, 0);
|
||||
}
|
||||
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
@ -1754,10 +1772,12 @@ static bool wm_operator_winactive_normal(bContext *C)
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
bScreen *screen;
|
||||
|
||||
if (win == NULL)
|
||||
if (win == NULL) {
|
||||
return 0;
|
||||
if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL)))
|
||||
}
|
||||
if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -2090,8 +2110,9 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
|
||||
immEnd();
|
||||
|
||||
/* undo rotation */
|
||||
if (rc->rot_prop)
|
||||
if (rc->rot_prop) {
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* flat color if no texture available */
|
||||
@ -2173,8 +2194,9 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
|
||||
radial_control_paint_tex(rc, tex_radius, alpha);
|
||||
|
||||
/* set line color */
|
||||
if (rc->col_prop)
|
||||
if (rc->col_prop) {
|
||||
RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
|
||||
}
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
@ -2205,8 +2227,9 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
|
||||
/* draw circles on top */
|
||||
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r1, 40);
|
||||
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r2, 40);
|
||||
if (rmin > 0.0f)
|
||||
if (rmin > 0.0f) {
|
||||
imm_draw_circle_wire_2d(pos, 0.0, 0.0f, rmin, 40);
|
||||
}
|
||||
immUnbindProgram();
|
||||
|
||||
BLF_size(fontid, 1.5 * fstyle_points * U.pixelsize, U.dpi);
|
||||
@ -2253,23 +2276,28 @@ static int radial_control_get_path(
|
||||
}
|
||||
|
||||
/* get an rna string path from the operator's properties */
|
||||
if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
|
||||
if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (str[0] == '\0') {
|
||||
if (r_prop) *r_prop = NULL;
|
||||
if (r_prop) {
|
||||
*r_prop = NULL;
|
||||
}
|
||||
MEM_freeN(str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!r_prop)
|
||||
if (!r_prop) {
|
||||
r_prop = &unused_prop;
|
||||
}
|
||||
|
||||
/* get rna from path */
|
||||
if (!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
|
||||
MEM_freeN(str);
|
||||
if (flags & RC_PROP_ALLOW_MISSING)
|
||||
if (flags & RC_PROP_ALLOW_MISSING) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "Could not resolve path '%s'", name);
|
||||
return 0;
|
||||
@ -2331,18 +2359,22 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
|
||||
if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* data path is required */
|
||||
if (!rc->prop)
|
||||
if (!rc->prop) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
|
||||
return 0;
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!radial_control_get_path(
|
||||
&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
|
||||
@ -2373,8 +2405,9 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0)) {
|
||||
return 0;
|
||||
}
|
||||
else if (rc->image_id_ptr.data) {
|
||||
/* extra check, pointer must be to an ID */
|
||||
if (!RNA_struct_is_ID(rc->image_id_ptr.type)) {
|
||||
@ -2394,8 +2427,9 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
RadialControl *rc;
|
||||
|
||||
|
||||
if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
|
||||
if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl"))) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (!radial_control_get_properties(C, op)) {
|
||||
MEM_freeN(rc);
|
||||
@ -2534,8 +2568,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
||||
if (rc->subtype == PROP_ANGLE) {
|
||||
numValue = DEG2RADF(numValue);
|
||||
numValue = fmod(numValue, 2.0f * (float)M_PI);
|
||||
if (numValue < 0.0f)
|
||||
if (numValue < 0.0f) {
|
||||
numValue += 2.0f * (float)M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
CLAMP(numValue, rc->min_value, rc->max_value);
|
||||
@ -2619,22 +2654,31 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
||||
case PROP_DISTANCE:
|
||||
case PROP_PIXEL:
|
||||
new_value = dist;
|
||||
if (snap) new_value = ((int)new_value + 5) / 10 * 10;
|
||||
if (snap) {
|
||||
new_value = ((int)new_value + 5) / 10 * 10;
|
||||
}
|
||||
break;
|
||||
case PROP_PERCENTAGE:
|
||||
new_value = ((dist - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE) / WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f;
|
||||
if (snap) new_value = ((int)(new_value + 2.5f)) / 5 * 5;
|
||||
if (snap) {
|
||||
new_value = ((int)(new_value + 2.5f)) / 5 * 5;
|
||||
}
|
||||
break;
|
||||
case PROP_FACTOR:
|
||||
new_value = (WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH;
|
||||
if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
|
||||
if (snap) {
|
||||
new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
|
||||
}
|
||||
break;
|
||||
case PROP_ANGLE:
|
||||
new_value = atan2f(delta[1], delta[0]) + (float)M_PI + angle_precision;
|
||||
new_value = fmod(new_value, 2.0f * (float)M_PI);
|
||||
if (new_value < 0.0f)
|
||||
if (new_value < 0.0f) {
|
||||
new_value += 2.0f * (float)M_PI;
|
||||
if (snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
|
||||
}
|
||||
if (snap) {
|
||||
new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
new_value = dist; /* dummy value, should this ever happen? - campbell */
|
||||
@ -2685,8 +2729,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
||||
if (rc->subtype == PROP_ANGLE) {
|
||||
numValue = DEG2RADF(numValue);
|
||||
numValue = fmod(numValue, 2.0f * (float)M_PI);
|
||||
if (numValue < 0.0f)
|
||||
if (numValue < 0.0f) {
|
||||
numValue += 2.0f * (float)M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
CLAMP(numValue, rc->min_value, rc->max_value);
|
||||
@ -2703,8 +2748,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
||||
ED_region_tag_redraw(CTX_wm_region(C));
|
||||
radial_control_update_header(op, C);
|
||||
|
||||
if (ret != OPERATOR_RUNNING_MODAL)
|
||||
if (ret != OPERATOR_RUNNING_MODAL) {
|
||||
radial_control_cancel(C, op);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -2766,8 +2812,9 @@ static void redraw_timer_window_swap(bContext *C)
|
||||
ScrArea *sa;
|
||||
CTX_wm_menu_set(C, NULL);
|
||||
|
||||
for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next)
|
||||
for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) {
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
wm_draw_update(C);
|
||||
|
||||
CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
|
||||
@ -2853,8 +2900,9 @@ static void redraw_timer_step(
|
||||
while (tot--) {
|
||||
/* todo, ability to escape! */
|
||||
scene->r.cfra++;
|
||||
if (scene->r.cfra > scene->r.efra)
|
||||
if (scene->r.cfra > scene->r.efra) {
|
||||
scene->r.cfra = scene->r.sfra;
|
||||
}
|
||||
|
||||
BKE_scene_graph_update_for_newframe(depsgraph, bmain);
|
||||
redraw_timer_window_swap(C);
|
||||
@ -3058,8 +3106,9 @@ static int previews_clear_exec(bContext *C, wmOperator *op)
|
||||
|
||||
for (i = 0; lb[i]; i++) {
|
||||
ID *id = lb[i]->first;
|
||||
|
||||
if (!id) continue;
|
||||
if (!id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// printf("%s: %d, %d, %d -> %d\n", id->name, GS(id->name), BKE_idcode_to_idfilter(GS(id->name)),
|
||||
// id_filters, BKE_idcode_to_idfilter(GS(id->name)) & id_filters);
|
||||
@ -3226,7 +3275,9 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
|
||||
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items) return;
|
||||
if (keymap && keymap->modal_items) {
|
||||
return;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, "View3D Gesture Circle", modal_items);
|
||||
|
||||
@ -3254,7 +3305,9 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
|
||||
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items) return;
|
||||
if (keymap && keymap->modal_items) {
|
||||
return;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
|
||||
|
||||
@ -3279,7 +3332,9 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
|
||||
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Box");
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items) return;
|
||||
if (keymap && keymap->modal_items) {
|
||||
return;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, "Gesture Box", modal_items);
|
||||
|
||||
@ -3327,7 +3382,9 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
|
||||
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items) return;
|
||||
if (keymap && keymap->modal_items) {
|
||||
return;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, "Gesture Zoom Border", modal_items);
|
||||
|
||||
|
@ -45,12 +45,14 @@ PanelType *WM_paneltype_find(const char *idname, bool quiet)
|
||||
|
||||
if (idname[0]) {
|
||||
pt = BLI_ghash_lookup(g_paneltypes_hash, idname);
|
||||
if (pt)
|
||||
if (pt) {
|
||||
return pt;
|
||||
}
|
||||
}
|
||||
|
||||
if (!quiet)
|
||||
if (!quiet) {
|
||||
printf("search for unknown paneltype %s\n", idname);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -291,8 +291,9 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
|
||||
IMB_rect_from_float(ibuf);
|
||||
imb_freerectfloatImBuf(ibuf);
|
||||
}
|
||||
if (ibuf->rect == NULL)
|
||||
if (ibuf->rect == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
|
||||
|
||||
@ -673,13 +674,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
key_data = (GHOST_TEventKeyData *)GHOST_GetEventData(evt);
|
||||
switch (key_data->key) {
|
||||
case GHOST_kKeyA:
|
||||
if (val) ps->noskip = !ps->noskip;
|
||||
if (val) {
|
||||
ps->noskip = !ps->noskip;
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyI:
|
||||
if (val) ps->indicator = !ps->indicator;
|
||||
if (val) {
|
||||
ps->indicator = !ps->indicator;
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyP:
|
||||
if (val) ps->pingpong = !ps->pingpong;
|
||||
if (val) {
|
||||
ps->pingpong = !ps->pingpong;
|
||||
}
|
||||
break;
|
||||
case GHOST_kKeyF:
|
||||
{
|
||||
@ -811,9 +818,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
case GHOST_kKeyNumpadSlash:
|
||||
if (val) {
|
||||
if (g_WS.qual & WS_QUAL_SHIFT) {
|
||||
if (ps->curframe_ibuf)
|
||||
if (ps->curframe_ibuf) {
|
||||
printf(" Name: %s | Speed: %.2f frames/s\n",
|
||||
ps->curframe_ibuf->name, ps->fstep / swaptime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
swaptime = ps->fstep / 5.0;
|
||||
@ -849,11 +857,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
i++;
|
||||
picture = picture->next;
|
||||
}
|
||||
if (playback_handle)
|
||||
if (playback_handle) {
|
||||
AUD_Handle_stop(playback_handle);
|
||||
}
|
||||
playback_handle = AUD_Device_play(audio_device, source, 1);
|
||||
if (playback_handle)
|
||||
if (playback_handle) {
|
||||
AUD_Handle_setPosition(playback_handle, i / fps_movie);
|
||||
}
|
||||
update_sound_fps();
|
||||
}
|
||||
#endif
|
||||
@ -883,11 +893,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
i++;
|
||||
picture = picture->next;
|
||||
}
|
||||
if (playback_handle)
|
||||
if (playback_handle) {
|
||||
AUD_Handle_stop(playback_handle);
|
||||
}
|
||||
playback_handle = AUD_Device_play(audio_device, source, 1);
|
||||
if (playback_handle)
|
||||
if (playback_handle) {
|
||||
AUD_Handle_setPosition(playback_handle, i / fps_movie);
|
||||
}
|
||||
update_sound_fps();
|
||||
}
|
||||
#endif
|
||||
@ -915,7 +927,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
case GHOST_kKeyPlus:
|
||||
case GHOST_kKeyNumpadPlus:
|
||||
{
|
||||
if (val == 0) break;
|
||||
if (val == 0) {
|
||||
break;
|
||||
}
|
||||
if (g_WS.qual & WS_QUAL_CTRL) {
|
||||
playanim_window_zoom(ps, 0.1f);
|
||||
}
|
||||
@ -930,7 +944,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
case GHOST_kKeyMinus:
|
||||
case GHOST_kKeyNumpadMinus:
|
||||
{
|
||||
if (val == 0) break;
|
||||
if (val == 0) {
|
||||
break;
|
||||
}
|
||||
if (g_WS.qual & WS_QUAL_CTRL) {
|
||||
playanim_window_zoom(ps, -0.1f);
|
||||
}
|
||||
@ -969,24 +985,29 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
||||
tag_change_frame(ps, cx);
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
g_WS.qual &= ~WS_QUAL_LMOUSE;
|
||||
}
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskMiddle) {
|
||||
if (type == GHOST_kEventButtonDown) {
|
||||
if (inside_window)
|
||||
if (inside_window) {
|
||||
g_WS.qual |= WS_QUAL_MMOUSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
g_WS.qual &= ~WS_QUAL_MMOUSE;
|
||||
}
|
||||
}
|
||||
else if (bd->button == GHOST_kButtonMaskRight) {
|
||||
if (type == GHOST_kEventButtonDown) {
|
||||
if (inside_window)
|
||||
if (inside_window) {
|
||||
g_WS.qual |= WS_QUAL_RMOUSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
g_WS.qual &= ~WS_QUAL_RMOUSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1099,7 +1120,9 @@ static void playanim_window_zoom(PlayState *ps, const float zoom_offset)
|
||||
int sizex, sizey;
|
||||
/* int ofsx, ofsy; */ /* UNUSED */
|
||||
|
||||
if (ps->zoom + zoom_offset > 0.0f) ps->zoom += zoom_offset;
|
||||
if (ps->zoom + zoom_offset > 0.0f) {
|
||||
ps->zoom += zoom_offset;
|
||||
}
|
||||
|
||||
// playanim_window_get_position(&ofsx, &ofsy);
|
||||
playanim_window_get_size(&sizex, &sizey);
|
||||
@ -1280,8 +1303,12 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
ps.win_x = ps.ibufx;
|
||||
ps.win_y = ps.ibufy;
|
||||
|
||||
if (maxwinx % ibuf->x) maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
|
||||
if (maxwiny % ibuf->y) maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
|
||||
if (maxwinx % ibuf->x) {
|
||||
maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
|
||||
}
|
||||
if (maxwiny % ibuf->y) {
|
||||
maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
|
||||
}
|
||||
|
||||
|
||||
glClearColor(0.1, 0.1, 0.1, 0.0);
|
||||
@ -1335,8 +1362,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
#define USE_IMB_CACHE
|
||||
|
||||
while (ps.go) {
|
||||
if (ps.pingpong)
|
||||
if (ps.pingpong) {
|
||||
ps.direction = -ps.direction;
|
||||
}
|
||||
|
||||
if (ps.direction == 1) {
|
||||
ps.picture = picsbase.first;
|
||||
@ -1357,11 +1385,14 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
ps.picture = ps.picture->prev;
|
||||
}
|
||||
}
|
||||
if (ptottime > 0.0) ptottime = 0.0;
|
||||
if (ptottime > 0.0) {
|
||||
ptottime = 0.0;
|
||||
}
|
||||
|
||||
#ifdef WITH_AUDASPACE
|
||||
if (playback_handle)
|
||||
if (playback_handle) {
|
||||
AUD_Handle_stop(playback_handle);
|
||||
}
|
||||
playback_handle = AUD_Device_play(audio_device, source, 1);
|
||||
update_sound_fps();
|
||||
#endif
|
||||
@ -1369,7 +1400,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
while (ps.picture) {
|
||||
int hasevent;
|
||||
#ifndef USE_IMB_CACHE
|
||||
if (ibuf != NULL && ibuf->ftype == 0) IMB_freeImBuf(ibuf);
|
||||
if (ibuf != NULL && ibuf->ftype == 0) {
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
#endif
|
||||
if (ps.picture->ibuf) {
|
||||
ibuf = ps.picture->ibuf;
|
||||
@ -1428,7 +1461,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
GHOST_SetTitle(g_WS.ghost_window, ps.picture->name);
|
||||
#endif
|
||||
|
||||
while (pupdate_time()) PIL_sleep_ms(1);
|
||||
while (pupdate_time()) {
|
||||
PIL_sleep_ms(1);
|
||||
}
|
||||
ptottime -= swaptime;
|
||||
playanim_toscreen(&ps, ps.picture, ibuf, ps.fontid, ps.fstep);
|
||||
} /* else delete */
|
||||
@ -1484,7 +1519,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.wait2 || ptottime < swaptime || ps.turbo || ps.noskip) break;
|
||||
if (ps.wait2 || ptottime < swaptime || ps.turbo || ps.noskip) {
|
||||
break;
|
||||
}
|
||||
ptottime -= swaptime;
|
||||
}
|
||||
if (ps.picture == NULL && ps.sstep) {
|
||||
@ -1518,7 +1555,9 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
||||
|
||||
/* cleanup */
|
||||
#ifndef USE_IMB_CACHE
|
||||
if (ibuf) IMB_freeImBuf(ibuf);
|
||||
if (ibuf) {
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
BLI_freelistN(&picsbase);
|
||||
|
@ -162,12 +162,14 @@ void wm_stereo3d_draw_sidebyside(wmWindow *win, int view)
|
||||
|
||||
int soffx = WM_window_pixels_x(win) * 0.5f;
|
||||
if (view == STEREO_LEFT_ID) {
|
||||
if (!cross_eyed)
|
||||
if (!cross_eyed) {
|
||||
soffx = 0;
|
||||
}
|
||||
}
|
||||
else { //RIGHT_LEFT_ID
|
||||
if (cross_eyed)
|
||||
if (cross_eyed) {
|
||||
soffx = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const int sizex = WM_window_pixels_x(win);
|
||||
@ -286,8 +288,9 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
|
||||
*/
|
||||
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int *r_mouse_xy)
|
||||
{
|
||||
if (!WM_stereo3d_enabled(win, false))
|
||||
if (!WM_stereo3d_enabled(win, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (win->stereo3d_format->display_mode == S3D_DISPLAY_SIDEBYSIDE) {
|
||||
const int half_x = win->sizex / 2;
|
||||
@ -339,19 +342,23 @@ static bool wm_stereo3d_set_properties(bContext *UNUSED(C), wmOperator *op)
|
||||
|
||||
prop = RNA_struct_find_property(op->ptr, "use_interlace_swap");
|
||||
if (RNA_property_is_set(op->ptr, prop)) {
|
||||
if (RNA_property_boolean_get(op->ptr, prop))
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
s3d->flag |= S3D_INTERLACE_SWAP;
|
||||
else
|
||||
}
|
||||
else {
|
||||
s3d->flag &= ~S3D_INTERLACE_SWAP;
|
||||
}
|
||||
is_set = true;
|
||||
}
|
||||
|
||||
prop = RNA_struct_find_property(op->ptr, "use_sidebyside_crosseyed");
|
||||
if (RNA_property_is_set(op->ptr, prop)) {
|
||||
if (RNA_property_boolean_get(op->ptr, prop))
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
s3d->flag |= S3D_SIDEBYSIDE_CROSSEYED;
|
||||
else
|
||||
}
|
||||
else {
|
||||
s3d->flag &= ~S3D_SIDEBYSIDE_CROSSEYED;
|
||||
}
|
||||
is_set = true;
|
||||
}
|
||||
|
||||
@ -379,8 +386,9 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
|
||||
Stereo3dData *s3dd;
|
||||
bool ok = true;
|
||||
|
||||
if (G.background)
|
||||
if (G.background) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
if (op->customdata == NULL) {
|
||||
/* no invoke means we need to set the operator properties here */
|
||||
@ -460,10 +468,12 @@ int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
|
||||
{
|
||||
wm_stereo3d_set_init(C, op);
|
||||
|
||||
if (wm_stereo3d_set_properties(C, op))
|
||||
if (wm_stereo3d_set_properties(C, op)) {
|
||||
return wm_stereo3d_set_exec(C, op);
|
||||
else
|
||||
}
|
||||
else {
|
||||
return WM_operator_props_dialog_popup(C, op, 250, 100);
|
||||
}
|
||||
}
|
||||
|
||||
void wm_stereo3d_set_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
|
@ -101,8 +101,12 @@ void wmWindowViewport(wmWindow *win)
|
||||
void wmOrtho2(float x1, float x2, float y1, float y2)
|
||||
{
|
||||
/* prevent opengl from generating errors */
|
||||
if (x1 == x2) x2 += 1.0f;
|
||||
if (y1 == y2) y2 += 1.0f;
|
||||
if (x2 == x1) {
|
||||
x2 += 1.0f;
|
||||
}
|
||||
if (y2 == y1) {
|
||||
y2 += 1.0f;
|
||||
}
|
||||
|
||||
GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
|
||||
}
|
||||
|
@ -179,8 +179,12 @@ static void wm_window_check_position(rcti *rect)
|
||||
rect->ymin -= d;
|
||||
}
|
||||
|
||||
if (rect->xmin < 0) rect->xmin = 0;
|
||||
if (rect->ymin < 0) rect->ymin = 0;
|
||||
if (rect->xmin < 0) {
|
||||
rect->xmin = 0;
|
||||
}
|
||||
if (rect->ymin < 0) {
|
||||
rect->ymin = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
|
||||
@ -220,8 +224,9 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
||||
WM_event_remove_handlers(C, &win->handlers);
|
||||
WM_event_remove_handlers(C, &win->modalhandlers);
|
||||
|
||||
if (CTX_wm_window(C) == win)
|
||||
if (CTX_wm_window(C) == win) {
|
||||
CTX_wm_window_set(C, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
BKE_screen_area_map_free(&win->global_areas);
|
||||
@ -229,18 +234,22 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
||||
/* end running jobs, a job end also removes its timer */
|
||||
for (wt = wm->timers.first; wt; wt = wtnext) {
|
||||
wtnext = wt->next;
|
||||
if (wt->win == win && wt->event_type == TIMERJOBS)
|
||||
if (wt->win == win && wt->event_type == TIMERJOBS) {
|
||||
wm_jobs_timer_ended(wm, wt);
|
||||
}
|
||||
}
|
||||
|
||||
/* timer removing, need to call this api function */
|
||||
for (wt = wm->timers.first; wt; wt = wtnext) {
|
||||
wtnext = wt->next;
|
||||
if (wt->win == win)
|
||||
if (wt->win == win) {
|
||||
WM_event_remove_timer(wm, win, wt);
|
||||
}
|
||||
}
|
||||
|
||||
if (win->eventstate) MEM_freeN(win->eventstate);
|
||||
if (win->eventstate) {
|
||||
MEM_freeN(win->eventstate);
|
||||
}
|
||||
|
||||
if (win->cursor_keymap_status) {
|
||||
MEM_freeN(win->cursor_keymap_status);
|
||||
@ -261,10 +270,11 @@ static int find_free_winid(wmWindowManager *wm)
|
||||
wmWindow *win;
|
||||
int id = 1;
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next)
|
||||
if (id <= win->winid)
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
if (id <= win->winid) {
|
||||
id = win->winid + 1;
|
||||
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -560,8 +570,9 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
|
||||
G_MAIN->recovered ? " (Recovered)" : "");
|
||||
GHOST_SetTitle(win->ghostwin, str);
|
||||
}
|
||||
else
|
||||
else {
|
||||
GHOST_SetTitle(win->ghostwin, "Blender");
|
||||
}
|
||||
|
||||
/* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X)
|
||||
* and to give hint of unsaved changes for a user warning mechanism
|
||||
@ -639,8 +650,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
||||
int scr_w, scr_h, posy;
|
||||
|
||||
/* a new window is created when pageflip mode is required for a window */
|
||||
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
|
||||
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
|
||||
glSettings.flags |= GHOST_glStereoVisual;
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
glSettings.flags |= GHOST_glDebugContext;
|
||||
@ -897,9 +909,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
||||
wm_window_check_position(&rect);
|
||||
|
||||
/* test if we have a temp screen already */
|
||||
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
|
||||
if (WM_window_is_temp_screen(win))
|
||||
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
|
||||
if (WM_window_is_temp_screen(win)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* add new window? */
|
||||
if (win == NULL) {
|
||||
@ -973,16 +987,21 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
||||
ED_drivers_editor_init(C, sa);
|
||||
}
|
||||
|
||||
if (sa->spacetype == SPACE_IMAGE)
|
||||
if (sa->spacetype == SPACE_IMAGE) {
|
||||
title = IFACE_("Blender Render");
|
||||
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
|
||||
}
|
||||
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) {
|
||||
title = IFACE_("Blender Preferences");
|
||||
else if (sa->spacetype == SPACE_FILE)
|
||||
}
|
||||
else if (sa->spacetype == SPACE_FILE) {
|
||||
title = IFACE_("Blender File View");
|
||||
else if (sa->spacetype == SPACE_GRAPH)
|
||||
}
|
||||
else if (sa->spacetype == SPACE_GRAPH) {
|
||||
title = IFACE_("Blender Drivers Editor");
|
||||
else
|
||||
}
|
||||
else {
|
||||
title = "Blender";
|
||||
}
|
||||
|
||||
if (win->ghostwin) {
|
||||
GHOST_SetTitle(win->ghostwin, title);
|
||||
@ -1034,14 +1053,17 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
GHOST_TWindowState state;
|
||||
|
||||
if (G.background)
|
||||
if (G.background) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
state = GHOST_GetWindowState(window->ghostwin);
|
||||
if (state != GHOST_kWindowStateFullScreen)
|
||||
if (state != GHOST_kWindowStateFullScreen) {
|
||||
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
|
||||
else
|
||||
}
|
||||
else {
|
||||
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@ -1116,8 +1138,9 @@ static int query_qual(modifierKeyType qual)
|
||||
}
|
||||
|
||||
GHOST_GetModifierKeyState(g_system, left, &val);
|
||||
if (!val)
|
||||
if (!val) {
|
||||
GHOST_GetModifierKeyState(g_system, right, &val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -1170,9 +1193,9 @@ void wm_window_reset_drawable(void)
|
||||
BLI_assert(GPU_framebuffer_active_get() == NULL);
|
||||
wmWindowManager *wm = G_MAIN->wm.first;
|
||||
|
||||
if (wm == NULL)
|
||||
if (wm == NULL) {
|
||||
return;
|
||||
|
||||
}
|
||||
wmWindow *win = wm->windrawable;
|
||||
|
||||
if (win && win->ghostwin) {
|
||||
@ -1616,12 +1639,15 @@ static int wm_window_timer(const bContext *C)
|
||||
wt->ltime = time;
|
||||
wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep);
|
||||
|
||||
if (wt->event_type == TIMERJOBS)
|
||||
if (wt->event_type == TIMERJOBS) {
|
||||
wm_jobs_timer(C, wm, wt);
|
||||
else if (wt->event_type == TIMERAUTOSAVE)
|
||||
}
|
||||
else if (wt->event_type == TIMERAUTOSAVE) {
|
||||
wm_autosave_timer(C, wm, wt);
|
||||
else if (wt->event_type == TIMERNOTIFIER)
|
||||
}
|
||||
else if (wt->event_type == TIMERNOTIFIER) {
|
||||
WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL);
|
||||
}
|
||||
else if (win) {
|
||||
wmEvent event;
|
||||
wm_event_init_from_window(win, &event);
|
||||
@ -1649,14 +1675,15 @@ void wm_window_process_events(const bContext *C)
|
||||
|
||||
hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
|
||||
|
||||
if (hasevent)
|
||||
if (hasevent) {
|
||||
GHOST_DispatchEvents(g_system);
|
||||
|
||||
}
|
||||
hasevent |= wm_window_timer(C);
|
||||
|
||||
/* no event, we sleep 5 milliseconds */
|
||||
if (hasevent == 0)
|
||||
if (hasevent == 0) {
|
||||
PIL_sleep_ms(5);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************** init ********************** */
|
||||
@ -1690,9 +1717,9 @@ void wm_ghost_init(bContext *C)
|
||||
|
||||
void wm_ghost_exit(void)
|
||||
{
|
||||
if (g_system)
|
||||
if (g_system) {
|
||||
GHOST_DisposeSystem(g_system);
|
||||
|
||||
}
|
||||
g_system = NULL;
|
||||
}
|
||||
|
||||
@ -1703,12 +1730,15 @@ void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *t
|
||||
{
|
||||
wmTimer *wt;
|
||||
|
||||
for (wt = wm->timers.first; wt; wt = wt->next)
|
||||
if (wt == timer)
|
||||
for (wt = wm->timers.first; wt; wt = wt->next) {
|
||||
if (wt == timer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wt)
|
||||
if (wt) {
|
||||
wt->sleep = do_sleep;
|
||||
}
|
||||
}
|
||||
|
||||
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
|
||||
@ -1750,14 +1780,17 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
|
||||
wmTimer *wt;
|
||||
|
||||
/* extra security check */
|
||||
for (wt = wm->timers.first; wt; wt = wt->next)
|
||||
if (wt == timer)
|
||||
for (wt = wm->timers.first; wt; wt = wt->next) {
|
||||
if (wt == timer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wt) {
|
||||
wmWindow *win;
|
||||
|
||||
if (wm->reports.reporttimer == wt)
|
||||
if (wm->reports.reporttimer == wt) {
|
||||
wm->reports.reporttimer = NULL;
|
||||
}
|
||||
|
||||
BLI_remlink(&wm->timers, wt);
|
||||
if (wt->customdata != NULL && (wt->flags & WM_TIMER_NO_FREE_CUSTOM_DATA) == 0) {
|
||||
@ -1861,10 +1894,12 @@ void WM_clipboard_text_set(const char *buf, bool selection)
|
||||
int newlen = 0;
|
||||
|
||||
for (p = buf; *p; p++) {
|
||||
if (*p == '\n')
|
||||
if (*p == '\n') {
|
||||
newlen += 2;
|
||||
else
|
||||
}
|
||||
else {
|
||||
newlen++;
|
||||
}
|
||||
}
|
||||
|
||||
newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");
|
||||
|
Loading…
Reference in New Issue
Block a user