Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve.c
| Show First 20 Lines • Show All 2,951 Lines • ▼ Show 20 Lines | void CURVE_OT_hide(wmOperatorType *ot) | ||||
| /* props */ | /* props */ | ||||
| RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected"); | RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected"); | ||||
| } | } | ||||
| /********************** reveal operator *********************/ | /********************** reveal operator *********************/ | ||||
| static int reveal_exec(bContext *C, wmOperator *op) | static int reveal_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | const bool select = RNA_boolean_get(op->ptr, "select"); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | |||||
| uint objects_len = 0; | |||||
| Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); | |||||
| bool changed_multi = false; | |||||
| for (uint ob_index = 0; ob_index < objects_len; ob_index++) { | |||||
| Object *obedit = objects[ob_index]; | |||||
| ListBase *editnurb = object_editcurve_get(obedit); | ListBase *editnurb = object_editcurve_get(obedit); | ||||
| Nurb *nu; | Nurb *nu; | ||||
| BPoint *bp; | BPoint *bp; | ||||
| BezTriple *bezt; | BezTriple *bezt; | ||||
| int a; | int a; | ||||
| const bool select = RNA_boolean_get(op->ptr, "select"); | bool changed = false; | ||||
| for (nu = editnurb->first; nu; nu = nu->next) { | for (nu = editnurb->first; nu; nu = nu->next) { | ||||
| nu->hide = 0; | nu->hide = 0; | ||||
| if (nu->type == CU_BEZIER) { | if (nu->type == CU_BEZIER) { | ||||
| bezt = nu->bezt; | bezt = nu->bezt; | ||||
| a = nu->pntsu; | a = nu->pntsu; | ||||
| while (a--) { | while (a--) { | ||||
| if (bezt->hide) { | if (bezt->hide) { | ||||
| select_beztriple(bezt, select, SELECT, HIDDEN); | select_beztriple(bezt, select, SELECT, HIDDEN); | ||||
| bezt->hide = 0; | bezt->hide = 0; | ||||
| changed = true; | |||||
| } | } | ||||
| bezt++; | bezt++; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| bp = nu->bp; | bp = nu->bp; | ||||
| a = nu->pntsu * nu->pntsv; | a = nu->pntsu * nu->pntsv; | ||||
| while (a--) { | while (a--) { | ||||
| if (bp->hide) { | if (bp->hide) { | ||||
| select_bpoint(bp, select, SELECT, HIDDEN); | select_bpoint(bp, select, SELECT, HIDDEN); | ||||
| bp->hide = 0; | bp->hide = 0; | ||||
| changed = true; | |||||
| } | } | ||||
| bp++; | bp++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (changed) { | |||||
| changed_multi = true; | |||||
| DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE); | 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); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | ||||
| } | |||||
| return OPERATOR_FINISHED; | } | ||||
| return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED; | |||||
| } | } | ||||
| void CURVE_OT_reveal(wmOperatorType *ot) | void CURVE_OT_reveal(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Reveal Hidden"; | ot->name = "Reveal Hidden"; | ||||
| ot->idname = "CURVE_OT_reveal"; | ot->idname = "CURVE_OT_reveal"; | ||||
| ot->description = "Reveal hidden control points"; | ot->description = "Reveal hidden control points"; | ||||
| ▲ Show 20 Lines • Show All 3,463 Lines • Show Last 20 Lines | |||||