diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-02 18:58:57 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-02 20:12:20 +0300 |
commit | b5a18c1aacd333046479809a6cd66adfb1410d7e (patch) | |
tree | 7640ae0cb5e9421cc592535a84e3d4bdf16cb18c /source/blender/editors/curve/editcurve.c | |
parent | 597d0ce93c40c5be8871842c40821e7811c3a13a (diff) |
Multi-Objects: CURVE_OT_reveal
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 73 |
1 files changed, 43 insertions, 30 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index bcf7f944ad1..7068882d295 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3036,44 +3036,57 @@ void CURVE_OT_hide(wmOperatorType *ot) static int reveal_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); - ListBase *editnurb = object_editcurve_get(obedit); - Nurb *nu; - BPoint *bp; - BezTriple *bezt; - int a; + ViewLayer *view_layer = CTX_data_view_layer(C); const bool select = RNA_boolean_get(op->ptr, "select"); + bool changed_multi = false; - for (nu = editnurb->first; nu; nu = nu->next) { - nu->hide = 0; - if (nu->type == CU_BEZIER) { - bezt = nu->bezt; - a = nu->pntsu; - while (a--) { - if (bezt->hide) { - select_beztriple(bezt, select, SELECT, HIDDEN); - bezt->hide = 0; + uint objects_len; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + ListBase *editnurb = object_editcurve_get(obedit); + Nurb *nu; + BPoint *bp; + BezTriple *bezt; + int a; + bool changed = false; + + for (nu = editnurb->first; nu; nu = nu->next) { + nu->hide = 0; + if (nu->type == CU_BEZIER) { + bezt = nu->bezt; + a = nu->pntsu; + while (a--) { + if (bezt->hide) { + select_beztriple(bezt, select, SELECT, HIDDEN); + bezt->hide = 0; + changed = true; + } + bezt++; } - bezt++; } - } - else { - bp = nu->bp; - a = nu->pntsu * nu->pntsv; - while (a--) { - if (bp->hide) { - select_bpoint(bp, select, SELECT, HIDDEN); - bp->hide = 0; + else { + bp = nu->bp; + a = nu->pntsu * nu->pntsv; + while (a--) { + if (bp->hide) { + select_bpoint(bp, select, SELECT, HIDDEN); + bp->hide = 0; + changed = true; + } + bp++; } - bp++; } } - } - - DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE); - WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); - return OPERATOR_FINISHED; + if (changed) { + DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + changed_multi = true; + } + } + MEM_freeN(objects); + return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } void CURVE_OT_reveal(wmOperatorType *ot) |