diff options
Diffstat (limited to 'source/blender/editors')
26 files changed, 215 insertions, 94 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 0aff3b81ec9..1cd41bd110d 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -93,6 +93,8 @@ void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); +void ED_view3d_lastview_store(struct RegionView3D *rv3d); + /* Depth buffer */ void ED_view3d_depth_update(struct ARegion *ar); float ED_view3d_depth_read_cached(struct ViewContext *vc, int x, int y); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f1c0df23fc9..0768d556911 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2374,6 +2374,11 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) data->selextend = 0; data->selstartx = 0.0f; +#ifdef USE_DRAG_MULTINUM + /* this can happen from multi-drag */ + data->applied_interactive = false; +#endif + /* set cursor pos to the end of the text */ but->editstr = data->str; but->pos = len; @@ -3477,10 +3482,21 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } } else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { - if (data->dragchange) - button_activate_state(C, but, BUTTON_STATE_EXIT); - else + if (data->dragchange) { +#ifdef USE_DRAG_MULTINUM + /* if we started multibutton but didnt drag, then edit */ + if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { + click = 1; + } + else +#endif + { + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + } + else { click = 1; + } } else if (event->type == MOUSEMOVE) { const enum eSnapType snap = ui_event_to_snap(event); @@ -3763,10 +3779,21 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } } else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { - if (data->dragchange) - button_activate_state(C, but, BUTTON_STATE_EXIT); - else + if (data->dragchange) { +#ifdef USE_DRAG_MULTINUM + /* if we started multibutton but didnt drag, then edit */ + if (data->multi_data.init == BUTTON_MULTI_INIT_SETUP) { + click = 1; + } + else +#endif + { + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + } + else { click = 1; + } } else if (event->type == MOUSEMOVE) { #ifdef USE_DRAG_MULTINUM diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b5255eb0516..55f35a93692 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -888,7 +888,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname EnumPropertyItem *item, *item_array = NULL; bool free; uiLayout *split = uiLayoutSplit(layout, 0.0f, false); - uiLayout *column = uiLayoutColumn(split, false); + uiLayout *column = uiLayoutColumn(split, layout->align); RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item_array, NULL, &free); for (item = item_array; item->identifier; item++) { @@ -912,7 +912,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if (item->name) { uiBut *but; if (item != item_array) { - column = uiLayoutColumn(split, false); + column = uiLayoutColumn(split, layout->align); /* inconsistent, but menus with labels do not look good flipped */ block->flag |= UI_BLOCK_NO_FLIP; } diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 2ca5301c89c..aa3a2c83243 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -503,7 +503,7 @@ void MESH_OT_inset(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries"); RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness"); RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry"); - RNA_def_boolean(ot->srna, "use_edge_rail", true, "Edge Rail", "Inset the region along existing edges"); + RNA_def_boolean(ot->srna, "use_edge_rail", false, "Edge Rail", "Inset the region along existing edges"); prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f); /* use 1 rather then 10 for max else dragging the button moves too far */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index b29fafea90d..182a9f70968 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1478,8 +1478,13 @@ static void curvetomesh(Main *bmain, Scene *scene, Object *ob) convert_ensure_curve_cache(bmain, scene, ob); BKE_mesh_from_nurbs(ob); /* also does users */ - if (ob->type == OB_MESH) + if (ob->type == OB_MESH) { BKE_object_free_modifiers(ob); + + /* Game engine defaults for mesh objects */ + ob->body_type = OB_BODY_TYPE_STATIC; + ob->gameflag = OB_PROP | OB_COLLISION; + } } static int convert_poll(bContext *C) diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 66fa5787e5d..23ead971cd3 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1514,19 +1514,22 @@ void ED_screen_set(bContext *C, bScreen *sc) /* we put timer to sleep, so screen_exit has to think there's no timer */ oldscreen->animtimer = NULL; - if (wt) + if (wt) { WM_event_timer_sleep(wm, win, wt, true); - + } + ED_screen_exit(C, win, oldscreen); /* Same scene, "transfer" playback to new screen. */ - if (oldscene == sc->scene) { - sc->animtimer = wt; - } - /* Else, stop playback. */ - else { - oldscreen->animtimer = wt; - ED_screen_animation_play(C, 0, 0); + if (wt) { + if (oldscene == sc->scene) { + sc->animtimer = wt; + } + /* Else, stop playback. */ + else { + oldscreen->animtimer = wt; + ED_screen_animation_play(C, 0, 0); + } } win->screen = sc; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 2cb28ebba90..0d0ce259174 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2848,6 +2848,10 @@ static void region_quadview_init_rv3d(ScrArea *sa, ARegion *ar, { RegionView3D *rv3d = ar->regiondata; + if (persp == RV3D_CAMOB) { + ED_view3d_lastview_store(rv3d); + } + rv3d->viewlock = viewlock; rv3d->view = view; rv3d->persp = persp; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 1a5ccc8f8bd..a3e69a1024b 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -45,6 +45,7 @@ #include "BKE_brush.h" #include "BKE_context.h" #include "BKE_image.h" +#include "BKE_node.h" #include "BKE_paint.h" #include "BKE_colortools.h" @@ -60,6 +61,10 @@ * removed eventually (TODO) */ #include "sculpt_intern.h" +#ifdef _OPENMP +#include <omp.h> +#endif + /* TODOs: * * Some of the cursor drawing code is doing non-draw stuff @@ -197,6 +202,9 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima pool = BKE_image_pool_new(); + if (mtex->tex && mtex->tex->nodetree) + ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */ + #pragma omp parallel for schedule(static) for (j = 0; j < size; j++) { int i; @@ -241,7 +249,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima if (col) { float rgba[4]; - paint_get_tex_pixel_col(mtex, x, y, rgba, pool); + paint_get_tex_pixel_col(mtex, x, y, rgba, pool, omp_get_thread_num()); buffer[index * 4] = rgba[0] * 255; buffer[index * 4 + 1] = rgba[1] * 255; @@ -249,7 +257,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima buffer[index * 4 + 3] = rgba[3] * 255; } else { - float avg = paint_get_tex_pixel(mtex, x, y, pool); + float avg = paint_get_tex_pixel(mtex, x, y, pool, omp_get_thread_num()); avg += br->texture_sample_bias; @@ -272,6 +280,9 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima } } + if (mtex->tex && mtex->tex->nodetree) + ntreeTexEndExecTree(mtex->tex->nodetree->execdata); + if (pool) BKE_image_pool_free(pool); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 6dd42380a11..af9ac6dd89d 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -198,8 +198,8 @@ void paint_calc_redraw_planes(float planes[4][4], const struct rcti *screen_rect); float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius); -float paint_get_tex_pixel(struct MTex *mtex, float u, float v, struct ImagePool *pool); -void paint_get_tex_pixel_col(struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool); +float paint_get_tex_pixel(struct MTex *mtex, float u, float v, struct ImagePool *pool, int thread); +void paint_get_tex_pixel_col(struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread); int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface); void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]); void brush_drawcursor_texpaint_uvsculpt(struct bContext *C, int x, int y, void *customdata); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index e6efba4fa0c..de09709fcce 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -164,26 +164,25 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3], return len_v3(delta) / scale; } -float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool) +float paint_get_tex_pixel(MTex *mtex, float u, float v, struct ImagePool *pool, int thread) { float intensity, rgba[4]; float co[3] = {u, v, 0.0f}; externtex(mtex, co, &intensity, - rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool); + rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool); return intensity; } -void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool) +void paint_get_tex_pixel_col(MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread) { float co[3] = {u, v, 0.0f}; int hasrgb; float intensity; hasrgb = externtex(mtex, co, &intensity, - rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool); - + rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool); if (!hasrgb) { rgba[0] = intensity; rgba[1] = intensity; diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index a04e15d3729..ae729248f7e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -153,6 +153,10 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, int index, vp_handle->dists_sq[index] = dist_sq; } + else if (vp_handle->dists_sq[index] != FLT_MAX) { + /* already initialized & couldn't project this 'co' */ + return; + } } /* continue with regular functionality */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index d74e9c9e17b..35de6af2531 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -104,6 +104,19 @@ #include <omp.h> #endif +#if defined(__APPLE__) +#include <sys/sysctl.h> + +/* Query how many cores not counting HT aka physical cores we've got. */ +static int system_physical_thread_count(void) +{ + int pcount; + size_t pcount_len = sizeof(pcount); + sysctlbyname("hw.physicalcpu", &pcount, &pcount_len, NULL, 0); + return pcount; +} +#endif /* __APPLE__ */ + void ED_sculpt_get_average_stroke(Object *ob, float stroke[3]) { if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) { @@ -230,7 +243,7 @@ typedef struct StrokeCache { float initial_mouse[2]; /* Pre-allocated temporary storage used during smoothing */ - int num_threads; + int num_threads, max_threads; float (**tmpgrid_co)[3], (**tmprow_co)[3]; float **tmpgrid_mask, **tmprow_mask; @@ -924,6 +937,7 @@ static float tex_strength(SculptSession *ss, Brush *br, MTex *mtex = &br->mtex; float avg = 1; float rgba[4]; + int thread_num; if (!mtex->tex) { avg = 1; @@ -966,7 +980,12 @@ static float tex_strength(SculptSession *ss, Brush *br, x += br->mtex.ofs[0]; y += br->mtex.ofs[1]; - avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool); +#ifdef _OPENMP + thread_num = omp_get_thread_num(); +#else + thread_num = 0; +#endif + avg = paint_get_tex_pixel(&br->mtex, x, y, ss->tex_pool, thread_num); avg += br->texture_sample_bias; } @@ -3766,16 +3785,21 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss) * Justification: Empirically I've found that two threads per * processor gives higher throughput. */ if (sd->flags & SCULPT_USE_OPENMP) { - cache->num_threads = 2 * omp_get_num_procs(); - omp_set_num_threads(cache->num_threads); - } - else +#if defined(__APPLE__) + cache->num_threads = system_physical_thread_count(); +#else + cache->num_threads = omp_get_num_procs(); #endif - { - (void)sd; + } + else { cache->num_threads = 1; } - + cache->max_threads = omp_get_max_threads(); + omp_set_num_threads(cache->num_threads); +#else + (void)sd; + cache->num_threads = 1; +#endif if (ss->multires) { int i, gridsize, array_mem_size; BKE_pbvh_node_get_grids(ss->pbvh, NULL, NULL, NULL, NULL, @@ -3802,6 +3826,10 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss) static void sculpt_omp_done(SculptSession *ss) { +#ifdef _OPENMP + omp_set_num_threads(ss->cache->max_threads); +#endif + if (ss->multires) { int i; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 18652aabefe..d417776b1f2 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -974,6 +974,10 @@ static bool prefetch_check_early_out(const bContext *C) int first_uncached_frame, end_frame; int clip_len; + if (clip == NULL) { + return true; + } + clip_len = BKE_movieclip_get_duration(clip); /* check whether all the frames from prefetch range are cached */ diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index bb6c50d6224..0e152dbebcf 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -110,10 +110,21 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2]) } if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) { + float dx, dy; + ED_space_clip_get_size(sc, &width, &height); - sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; - sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; + dx = ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom; + dy= ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom; + + if (sc->flag & SC_LOCK_SELECTION) { + sc->xlockof += dx; + sc->ylockof += dy; + } + else { + sc->xof += dx; + sc->yof += dy; + } } } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 2f1d78b2ccd..c56bc33ef15 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -577,7 +577,10 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "sequence", TRUE); /* mode */ - WM_keymap_add_menu(keymap, "CLIP_MT_select_mode", TABKEY, KM_PRESS, 0, 0); + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", TABKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.mode"); + RNA_string_set(kmi->ptr, "value_1", "TRACKING"); + RNA_string_set(kmi->ptr, "value_2", "MASK"); WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 6f44b47ed61..2b7bb01cea1 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1309,10 +1309,13 @@ static void track_markers_updatejob(void *tmv) static void track_markers_endjob(void *tmv) { TrackMarkersJob *tmj = (TrackMarkersJob *)tmv; + wmWindowManager *wm = tmj->main->wm.first; tmj->clip->tracking_context = NULL; tmj->scene->r.cfra = BKE_movieclip_remap_clip_to_scene_frame(tmj->clip, tmj->lastfra); - ED_update_for_newframe(tmj->main, tmj->scene, 0); + if (wm != NULL) { + ED_update_for_newframe(tmj->main, tmj->scene, 0); + } BKE_tracking_context_sync(tmj->context); BKE_tracking_context_finish(tmj->context); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index effb8eb7de5..f51d6cc3660 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -37,6 +37,7 @@ #include "DNA_object_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" +#include "DNA_userdef_types.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -923,7 +924,7 @@ static void node_shader_buts_subsurface(uiLayout *layout, bContext *C, PointerRN PointerRNA scene = CTX_data_pointer_get(C, "scene"); if (scene.data) { PointerRNA cscene = RNA_pointer_get(&scene, "cycles"); - if (cscene.data && RNA_enum_get(&cscene, "device") == 1) + if (cscene.data && (RNA_enum_get(&cscene, "device") == 1 && U.compute_device_type != 0)) uiItemL(layout, IFACE_("SSS not supported on GPU"), ICON_ERROR); } @@ -933,12 +934,12 @@ static void node_shader_buts_subsurface(uiLayout *layout, bContext *C, PointerRN static void node_shader_buts_volume(uiLayout *layout, bContext *C, PointerRNA *UNUSED(ptr)) { - /* SSS does not work on GPU yet */ + /* Volume does not work on GPU yet */ PointerRNA scene = CTX_data_pointer_get(C, "scene"); if (scene.data) { PointerRNA cscene = RNA_pointer_get(&scene, "cycles"); - if (cscene.data && RNA_enum_get(&cscene, "device") == 1) + if (cscene.data && (RNA_enum_get(&cscene, "device") == 1 && U.compute_device_type != 0)) uiItemL(layout, IFACE_("Volumes not supported on GPU"), ICON_ERROR); } } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index d44a3e60a3f..4db63a462e7 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -481,7 +481,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) char newname[sizeof(bone->name)]; /* always make current object active */ - tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL); + tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true); ob = OBACT; /* restore bone name */ @@ -498,8 +498,10 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) char newname[sizeof(pchan->name)]; /* always make current pose-bone active */ - tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL); + tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true); ob = OBACT; + + BLI_assert(ob->type == OB_ARMATURE); /* restore bone name */ BLI_strncpy(newname, pchan->name, sizeof(pchan->name)); @@ -1154,7 +1156,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa active = OL_DRAWSEL_NORMAL; } else { - active = tree_element_active(C, scene, soops, te, OL_SETSEL_NONE); + active = tree_element_active(C, scene, soops, te, OL_SETSEL_NONE, false); } } else { @@ -1295,7 +1297,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene active = OL_DRAWSEL_ACTIVE; } else { - if (tree_element_active(C, scene, soops, te, OL_SETSEL_NONE)) { + if (tree_element_active(C, scene, soops, te, OL_SETSEL_NONE, false)) { glColor4ub(220, 220, 255, alpha); active = OL_DRAWSEL_ACTIVE; } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index b1278c7cc07..317d33dd3e2 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -180,9 +180,8 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag); eOLDrawState tree_element_type_active( struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive); -eOLDrawState tree_element_active( - struct bContext *C, struct Scene *scene, SpaceOops *soops, - TreeElement *te, const eOLSetState set); +eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, + TreeElement *te, const eOLSetState set, const bool handle_all_types); int outliner_item_do_activate(struct bContext *C, int x, int y, bool extend, bool recursive); /* outliner_edit.c ---------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 688695e3ded..51db965b791 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -801,14 +801,17 @@ static eOLDrawState tree_element_active_keymap_item( /* ---------------------------------------------- */ /* generic call for ID data check or make/check active in UI */ -eOLDrawState tree_element_active( - bContext *C, Scene *scene, SpaceOops *soops, - TreeElement *te, const eOLSetState set) +eOLDrawState tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, + const eOLSetState set, const bool handle_all_types) { - switch (te->idcode) { - /* Note: no ID_OB: objects are handled specially to allow multiple + /* Note: ID_OB only if handle_all_type is true, else objects are handled specially to allow multiple * selection. See do_outliner_item_activate. */ + case ID_OB: + if (handle_all_types) { + return tree_element_set_active_object(C, scene, soops, te, set, false); + } + break; case ID_MA: return tree_element_active_material(C, scene, soops, te, set); case ID_WO: @@ -952,7 +955,7 @@ static bool do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Sp WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); } else { // rest of types - tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL); + tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, false); } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 1464d39ff23..3a9d97001fb 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2296,7 +2296,7 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op) float facx = BLI_rcti_size_x(&v2d->mask) / winx; float facy = BLI_rcti_size_y(&v2d->mask) / winy; - BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1); + BLI_rctf_resize(&v2d->cur, floorf(winx * facx * ratio + 0.5f), floorf(winy * facy * ratio + 0.5f)); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index ea81bb2b857..57d6f053426 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3590,9 +3590,8 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) if (!rv3d->smooth_timer) { /* store settings of current view before allowing overwriting with camera view * only if we're not currently in a view transition */ - copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); - rv3d->lview = rv3d->view; - rv3d->lpersp = rv3d->persp; + + ED_view3d_lastview_store(rv3d); } #if 0 @@ -4733,6 +4732,18 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co BKE_object_apply_mat4(ob, mat, true, true); } +/** + * Use to store the last view, before entering camera view. + */ +void ED_view3d_lastview_store(RegionView3D *rv3d) +{ + copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); + rv3d->lview = rv3d->view; + if (rv3d->persp != RV3D_CAMOB) { + rv3d->lpersp = rv3d->persp; + } +} + BGpic *ED_view3D_background_image_new(View3D *v3d) { BGpic *bgpic = MEM_callocN(sizeof(BGpic), "Background Image"); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 83e4f112a8c..20ef59708a6 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -417,11 +417,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) ED_view3d_context_user_region(C, &v3d, &ar); rv3d = ar->regiondata; - copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); - rv3d->lview = rv3d->view; - if (rv3d->persp != RV3D_CAMOB) { - rv3d->lpersp = rv3d->persp; - } + ED_view3d_lastview_store(rv3d); BKE_object_tfm_protected_backup(v3d->camera, &obtfm); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 24f51635e07..5eca44c1ba5 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -137,7 +137,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) snapGridIncrement(t, vec); - if (t->num.flag & T_NULL_ONE) { + if (t->flag & T_NULL_ONE) { if (!(t->con.mode & CON_AXIS0)) vec[0] = 1.0f; @@ -970,13 +970,13 @@ static void setNearestAxis3d(TransInfo *t) sub_v2_v2v2(axis, axis_2d, t->center2d); axis[2] = 0.0f; - if (normalize_v3(axis) != 0.0f) { + if (normalize_v3(axis) > 1e-3f) { project_v3_v3v3(proj, mvec, axis); sub_v3_v3v3(axis, mvec, proj); len[i] = normalize_v3(axis); } else { - len[i] = 10000000000.0f; + len[i] = 1e10f; } } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index bb0a74f1e09..e49e5c941a6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3845,13 +3845,13 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) } /* special hack (must be done after initTransDataCurveHandles(), as that stores handle settings to restore...): - * - Check if we've got entire BezTriple selected and we're rotating that point, + * - Check if we've got entire BezTriple selected and we're scaling/rotating that point, * then check if we're using auto-handles. * - If so, change them auto-handles to aligned handles so that handles get affected too */ - if ((t->mode == TFM_ROTATION) && - ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && - ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && + ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && + ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) { if (hdata && (sel1) && (sel3)) { bezt->h1 = HD_ALIGN; diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index 1f3725a961a..4c097ca7da6 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -321,8 +321,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) n->val_org[idx] = n->val[idx]; n->val_flag[idx] &= ~(NUM_NEGATE | NUM_INVERSE); - idx += event->ctrl ? -1 : 1; - idx %= idx_max + 1; + idx = (idx + idx_max + (event->ctrl ? 0 : 2)) % (idx_max + 1); n->idx = idx; n->val[idx] = n->val_org[idx]; if (n->val_flag[idx] & NUM_EDITED) { @@ -334,42 +333,48 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) } return true; case PADPERIOD: + case PERIODKEY: /* Force numdot, some OSs/countries generate a comma char in this case, sic... (T37992) */ ascii[0] = '.'; utf8_buf = ascii; break; +#if 0 /* Those keys are not directly accessible in all layouts, preventing to generate matching events. + * So we use a hack (ascii value) instead, see below. + */ case EQUALKEY: - /* XXX Advanced mode toggle, hack around keyboards without direct access to '=' nor '*'... */ - ascii[0] = '='; - break; case PADASTERKEY: - /* XXX Advanced mode toggle, hack around keyboards without direct access to '=' nor '*'... */ - ascii[0] = '*'; + if (!(n->flag & NUM_EDIT_FULL)) { + n->flag |= NUM_EDIT_FULL; + n->val_flag[idx] |= NUM_EDITED; + return true; + } + else if (event->ctrl) { + n->flag &= ~NUM_EDIT_FULL; + return true; + } break; +#endif case PADMINUS: case MINUSKEY: if (event->ctrl || !(n->flag & NUM_EDIT_FULL)) { n->val_flag[idx] ^= NUM_NEGATE; updated = true; - break; } - /* fall-through */ + break; case PADSLASHKEY: case SLASHKEY: if (event->ctrl || !(n->flag & NUM_EDIT_FULL)) { n->val_flag[idx] ^= NUM_INVERSE; updated = true; - break; } - /* fall-through */ + break; case CKEY: if (event->ctrl) { /* Copy current str to the copypaste buffer. */ WM_clipboard_text_set(n->str, 0); updated = true; - break; } - /* fall-through */ + break; case VKEY: if (event->ctrl) { /* extract the first line from the clipboard */ @@ -377,9 +382,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) char *pbuf = WM_clipboard_text_get_firstline(false, &pbuf_len); if (pbuf) { - bool success; - - success = editstr_insert_at_cursor(n, pbuf, pbuf_len); + const bool success = editstr_insert_at_cursor(n, pbuf, pbuf_len); MEM_freeN(pbuf); if (!success) { @@ -389,15 +392,17 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) n->val_flag[idx] |= NUM_EDITED; } updated = true; - break; } - /* fall-through */ + break; default: - utf8_buf = event->utf8_buf; - ascii[0] = event->ascii; break; } + if (!updated && !utf8_buf && (event->utf8_buf[0] || event->ascii)) { + utf8_buf = event->utf8_buf; + ascii[0] = event->ascii; + } + /* XXX Hack around keyboards without direct access to '=' nor '*'... */ if (ELEM(ascii[0], '=', '*')) { if (!(n->flag & NUM_EDIT_FULL)) { @@ -411,7 +416,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event) } } - if (utf8_buf && !utf8_buf[0] && ascii[0]) { + if ((!utf8_buf || !utf8_buf[0]) && ascii[0]) { /* Fallback to ascii. */ utf8_buf = ascii; } |