diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-03-08 09:42:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-03-08 09:47:02 +0300 |
commit | 222a941a2bbd71dcaa1012cdea959954ca065c6a (patch) | |
tree | 798c5a245de42556afabc91d8a7c45eb61337b04 /source/blender/editors | |
parent | 872df463f62d55911a2a732775a8de434c281b2d (diff) | |
parent | 28f86bf117e9d9d10089ef758a5ec4ade65084c6 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_bevel.c | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_inset.c | 7 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_data.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 19 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 |
11 files changed, 63 insertions, 59 deletions
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index d4d7d92d5ad..c8d33a9cc60 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -139,6 +139,10 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) return false; } + if (is_modal) { + RNA_float_set(op->ptr, "offset", 0.0f); + } + op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator"); opdata->em = em; @@ -622,7 +626,6 @@ void MESH_OT_bevel(wmOperatorType *ot) RNA_def_enum(ot->srna, "offset_type", offset_type_items, 0, "Amount Type", "What distance Amount measures"); prop = RNA_def_float(ot->srna, "offset", 0.0f, -1e6f, 1e6f, "Amount", "", 0.0f, 1.0f); RNA_def_property_float_array_funcs_runtime(prop, NULL, NULL, mesh_ot_bevel_offset_range_func); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_int(ot->srna, "segments", 1, 1, SEGMENTS_HARD_MAX, "Segments", "Segments for curved edge", 1, 8); RNA_def_float(ot->srna, "profile", 0.5f, PROFILE_HARD_MIN, 1.0f, "Profile", "Controls profile shape (0.5 = round)", PROFILE_HARD_MIN, 1.0f); diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 6fd4203e085..3833b84b5d2 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -122,6 +122,11 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) return false; } + if (is_modal) { + RNA_float_set(op->ptr, "thickness", 0.01f); + RNA_float_set(op->ptr, "depth", 0.0f); + } + op->customdata = opdata = MEM_mallocN(sizeof(InsetData), "inset_operator_data"); opdata->old_thickness = 0.01; @@ -527,11 +532,9 @@ void MESH_OT_inset(wmOperatorType *ot) prop = RNA_def_float_distance(ot->srna, "thickness", 0.01f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f); /* use 1 rather then 10 for max else dragging the button moves too far */ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_float_distance(ot->srna, "depth", 0.0f, -1e12f, 1e12f, "Depth", "", -10.0f, 10.0f); RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_select_inset", false, "Select Outer", "Select the new inset faces"); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index cec79c8e4e8..eba1b2e4fde 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1157,8 +1157,8 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) { /* create new data for NLA hierarchy */ AnimData *adt = BKE_animdata_add_id(&ob->id); - NlaTrack *nlt = add_nlatrack(adt, NULL); - NlaStrip *strip = add_nla_soundstrip(scene, ob->data); + NlaTrack *nlt = BKE_nlatrack_add(adt, NULL); + NlaStrip *strip = BKE_nla_add_soundstrip(scene, ob->data); strip->start = CFRA; strip->end += strip->start; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index cbfad27f8a2..9d8bd4a8718 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -912,7 +912,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev } else if (event == 26) { #if 0 // XXX old animation system - copy_nlastrips(&base->object->nlastrips, &ob->nlastrips); + BKE_nlastrip_copy(s(&base->object->nlastrips, &ob->nlastrips); #endif // XXX old animation system } else if (event == 27) { /* autosmooth */ diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 29b3c6f2f6c..fbef14c07c4 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -568,11 +568,11 @@ void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act, if (strip->act == act) { /* Remove this strip, and the track too if it doesn't have anything else */ - free_nlastrip(&nlt->strips, strip); + BKE_nlastrip_free(&nlt->strips, strip); if (nlt->strips.first == NULL) { BLI_assert(nstrip == NULL); - free_nlatrack(&adt->nla_tracks, nlt); + BKE_nlatrack_free(&adt->nla_tracks, nlt); } } } diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 89bf57fdb6c..1cc3d5142f5 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -594,12 +594,12 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel) */ if (above_sel) { /* just add a new one above this one */ - add_nlatrack(adt, nlt); + BKE_nlatrack_add(adt, nlt); added = true; } else if ((lastAdt == NULL) || (adt != lastAdt)) { /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */ - add_nlatrack(adt, NULL); + BKE_nlatrack_add(adt, NULL); lastAdt = adt; added = true; } @@ -634,7 +634,7 @@ bool nlaedit_add_tracks_empty(bAnimContext *ac) /* ensure it is empty */ if (BLI_listbase_is_empty(&adt->nla_tracks)) { /* add new track to this AnimData block then */ - add_nlatrack(adt, NULL); + BKE_nlatrack_add(adt, NULL); added = true; } } @@ -729,7 +729,7 @@ static int nlaedit_delete_tracks_exec(bContext *C, wmOperator *UNUSED(op)) adt->flag &= ~ADT_NLA_SOLO_TRACK; /* call delete on this track - deletes all strips too */ - free_nlatrack(&adt->nla_tracks, nlt); + BKE_nlatrack_free(&adt->nla_tracks, nlt); } } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a18a692c0a3..a7773aaaed5 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -316,18 +316,20 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns float cfra; /* plot the curve (over the strip's main region) */ - immBegin(GWN_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); + if (fcu) { + immBegin(GWN_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); - /* sample at 1 frame intervals, and draw - * - min y-val is yminc, max is y-maxc, so clamp in those regions - */ - for (cfra = strip->start; cfra <= strip->end; cfra += 1.0f) { - float y = evaluate_fcurve(fcu, cfra); /* assume this to be in 0-1 range */ - CLAMP(y, 0.0f, 1.0f); - immVertex2f(pos, cfra, ((y * yheight) + yminc)); - } + /* sample at 1 frame intervals, and draw + * - min y-val is yminc, max is y-maxc, so clamp in those regions + */ + for (cfra = strip->start; cfra <= strip->end; cfra += 1.0f) { + float y = evaluate_fcurve(fcu, cfra); /* assume this to be in 0-1 range */ + CLAMP(y, 0.0f, 1.0f); + immVertex2f(pos, cfra, ((y * yheight) + yminc)); + } - immEnd(); + immEnd(); + } } else { /* use blend in/out values only if both aren't zero */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 31524f8450a..87b7599ec66 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -645,7 +645,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) } /* create a new strip, and offset it to start on the current frame */ - strip = add_nlastrip(act); + strip = BKE_nlastrip_new(act); strip->end += (cfra - strip->start); strip->start = cfra; @@ -655,7 +655,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) /* trying to add to the current failed (no space), * so add a new track to the stack, and add to that... */ - nlt = add_nlatrack(adt, NULL); + nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } @@ -858,7 +858,7 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op)) continue; /* create a new strip, and offset it to start on the current frame */ - strip = add_nla_soundstrip(ac.scene, ob->data); + strip = BKE_nla_add_soundstrip(ac.scene, ob->data); strip->start += cfra; strip->end += cfra; @@ -868,7 +868,7 @@ static int nlaedit_add_sound_exec(bContext *C, wmOperator *UNUSED(op)) /* trying to add to the current failed (no space), * so add a new track to the stack, and add to that... */ - nlt = add_nlatrack(adt, NULL); + nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } @@ -1057,7 +1057,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) /* if selected, split the strip at its midpoint */ if (strip->flag & NLASTRIP_FLAG_SELECT) { /* make a copy (assume that this is possible) */ - nstrip = copy_nlastrip(strip, linked); + nstrip = BKE_nlastrip_copy(strip, linked); /* in case there's no space in the track above, or we haven't got a reference to it yet, try adding */ if (BKE_nlatrack_add_strip(nlt->next, nstrip) == 0) { @@ -1065,7 +1065,7 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) * - if the current one is the last one, nlt->next will be NULL, which defaults to adding * at the top of the stack anyway... */ - track = add_nlatrack(adt, nlt->next); + track = BKE_nlatrack_add(adt, nlt->next); BKE_nlatrack_add_strip(track, nstrip); } @@ -1160,14 +1160,14 @@ static int nlaedit_delete_exec(bContext *C, wmOperator *UNUSED(op)) if (strip->flag & NLASTRIP_FLAG_SELECT) { /* if a strip either side of this was a transition, delete those too */ if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION)) - free_nlastrip(&nlt->strips, strip->prev); + BKE_nlastrip_free(&nlt->strips, strip->prev); if ((nstrip) && (nstrip->type == NLASTRIP_TYPE_TRANSITION)) { nstrip = nstrip->next; - free_nlastrip(&nlt->strips, strip->next); + BKE_nlastrip_free(&nlt->strips, strip->next); } /* finally, delete this strip */ - free_nlastrip(&nlt->strips, strip); + BKE_nlastrip_free(&nlt->strips, strip); } } } @@ -1242,7 +1242,7 @@ static void nlaedit_split_strip_actclip(AnimData *adt, NlaTrack *nlt, NlaStrip * /* make a copy (assume that this is possible) and append * it immediately after the current strip */ - nstrip = copy_nlastrip(strip, true); + nstrip = BKE_nlastrip_copy(strip, true); BLI_insertlinkafter(&nlt->strips, strip, nstrip); /* set the endpoint of the first strip and the start of the new strip @@ -2186,7 +2186,7 @@ static int nlaedit_snap_exec(bContext *C, wmOperator *op) /* in case there's no space in the current track, try adding */ if (BKE_nlatrack_add_strip(nlt, strip) == 0) { /* need to add a new track above the current one */ - track = add_nlatrack(adt, nlt); + track = BKE_nlatrack_add(adt, nlt); BKE_nlatrack_add_strip(track, strip); /* clear temp meta-strips on this new track, as we may not be able to get back to it */ diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 6a746ffe27c..775169e0b45 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -212,31 +212,31 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect) /* *********************** backdraw for selection *************** */ static void backdrawview3d( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, - ARegion *ar, View3D *v3d) + const struct EvaluationContext *eval_ctx, Scene *scene, + ARegion *ar, View3D *v3d, + Object *obact, Object *obedit) { RegionView3D *rv3d = ar->regiondata; - struct Base *base = view_layer->basact; BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); - if (base && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || - BKE_paint_select_face_test(base->object, eval_ctx->object_mode))) + if (obact && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || + BKE_paint_select_face_test(obact, eval_ctx->object_mode))) { /* do nothing */ } /* texture paint mode sampling */ - else if (base && (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) && + else if (obact && (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) && (v3d->drawtype > OB_WIRE)) { /* do nothing */ } - else if ((base && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) && + else if ((obact && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) && V3D_IS_ZBUF(v3d)) { /* do nothing */ } - else if ((eval_ctx->object_mode & OB_MODE_EDIT) && + else if ((eval_ctx->object_mode & OB_MODE_EDIT) && (obedit != NULL) && V3D_IS_ZBUF(v3d)) { /* do nothing */ @@ -310,10 +310,11 @@ static void backdrawview3d( ED_view3d_clipping_set(rv3d); G.f |= G_BACKBUFSEL; - - if (base && ((base->flag & BASE_VISIBLED) != 0)) - draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, base->object); - + + if (obact && ((obact->base_flag & BASE_VISIBLED) != 0)) { + draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, obact); + } + if (rv3d->gpuoffscreen) GPU_offscreen_unbind(rv3d->gpuoffscreen, true); else @@ -354,7 +355,7 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, ViewContext *vc) { if (vc->v3d->flag & V3D_INVALID_BACKBUF) { - backdrawview3d(eval_ctx, vc->scene, vc->view_layer, vc->ar, vc->v3d); + backdrawview3d(eval_ctx, vc->scene, vc->ar, vc->v3d, vc->obact, vc->obedit); } } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index d1644a11adc..8c3ee6da012 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2812,24 +2812,22 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m /* not a real operator, only for circle test */ static int view3d_circle_select_exec(bContext *C, wmOperator *op) { + ViewContext vc; + view3d_set_viewcontext(C, &vc); + Object *obact = vc.obact; + Object *obedit = vc.obedit; EvaluationContext eval_ctx; CTX_data_eval_ctx(C, &eval_ctx); - Scene *scene = CTX_data_scene(C); - Object *obact = CTX_data_active_object(C); const int radius = RNA_int_get(op->ptr, "radius"); const bool select = !RNA_boolean_get(op->ptr, "deselect"); const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")}; - if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) || + if (obedit || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) || (obact && (eval_ctx.object_mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) ) { - ViewContext vc; - view3d_operator_needs_opengl(C); - view3d_set_viewcontext(C, &vc); - if (CTX_data_edit_object(C)) { obedit_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); @@ -2851,14 +2849,11 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } else { - ViewContext vc; - view3d_set_viewcontext(C, &vc); - if (object_circle_select(&vc, select, mval, (float)radius)) { - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene); } } - + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index fdf5665b6d4..fbe9c2ef240 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -280,7 +280,7 @@ static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) /* only push down if action is more than 1-2 frames long */ calc_action_range(adt->action, &astart, &aend, 1); if (aend > astart + 2.0f) { - NlaStrip *strip = add_nlastrip_to_stack(adt, adt->action); + NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action); /* clear reference to action now that we've pushed it onto the stack */ id_us_min(&adt->action->id); |