Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/lattice/editlattice_select.c
| Context not available. | |||||
| static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op) | static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; | uint objects_len = 0; | ||||
| MDeformVert *dv; | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode(view_layer, &objects_len); | ||||
campbellbarton: Should use: `BKE_view_layer_array_from_objects_in_edit_mode_unique_data` | |||||
| BPoint *bp; | |||||
| int a, tot; | |||||
| if (BLI_listbase_is_empty(&obedit->defbase) || lt->dvert == NULL) { | for (uint ob_index = 0; ob_index < objects_len; ob_index++) | ||||
| BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object"); | { | ||||
| return OPERATOR_CANCELLED; | Object *obedit = objects[ob_index]; | ||||
| } | Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; | ||||
| MDeformVert *dv; | |||||
| BPoint *bp; | |||||
| int a, tot; | |||||
| if (!RNA_boolean_get(op->ptr, "extend")) { | if (BLI_listbase_is_empty(&obedit->defbase) || lt->dvert == NULL) { | ||||
| ED_lattice_flags_set(obedit, 0); | BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object"); | ||||
campbellbartonUnsubmitted Not Done Inline ActionsMessage should be changed to run at the end of none of the objects have vertex groups. campbellbarton: Message should be changed to run at the end of none of the objects have vertex groups. | |||||
| } | return OPERATOR_CANCELLED; | ||||
campbellbartonUnsubmitted Not Done Inline ActionsThis leaks memory, continue instead. campbellbarton: This leaks memory, continue instead. | |||||
| } | |||||
| if (!RNA_boolean_get(op->ptr, "extend")) { | |||||
| ED_lattice_flags_set(obedit, 0); | |||||
| } | |||||
| dv = lt->dvert; | dv = lt->dvert; | ||||
| tot = lt->pntsu * lt->pntsv * lt->pntsw; | tot = lt->pntsu * lt->pntsv * lt->pntsw; | ||||
| for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) { | for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) { | ||||
| if (bp->hide == 0) { | if (bp->hide == 0) { | ||||
| if (dv->dw == NULL) { | if (dv->dw == NULL) { | ||||
| bp->f1 |= SELECT; | bp->f1 |= SELECT; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | ||||
| } | |||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||
Should use: BKE_view_layer_array_from_objects_in_edit_mode_unique_data