Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve_select.c
| Context not available. | |||||
| static int curve_select_similar_exec(bContext *C, wmOperator *op) | static int curve_select_similar_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | |||||
| Curve *cu = obedit->data; | |||||
| ListBase *editnurb = object_editcurve_get(obedit); | |||||
| bool changed = false; | |||||
| /* Get props */ | /* Get props */ | ||||
| const int type = RNA_enum_get(op->ptr, "type"); | const int type = RNA_enum_get(op->ptr, "type"); | ||||
| const float thresh = RNA_float_get(op->ptr, "threshold"); | const float thresh = RNA_float_get(op->ptr, "threshold"); | ||||
| const int compare = RNA_enum_get(op->ptr, "compare"); | const int compare = RNA_enum_get(op->ptr, "compare"); | ||||
| switch (type) { | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| case SIMCURHAND_TYPE: | uint objects_len = 0; | ||||
| changed = curve_select_similar_type(editnurb, cu); | Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); | ||||
| break; | for (uint ob_index = 0; ob_index < objects_len; ob_index++) | ||||
| case SIMCURHAND_RADIUS: | { | ||||
| changed = curve_select_similar_radius(editnurb, cu, compare, thresh); | Object *obedit = objects[ob_index]; | ||||
| break; | Curve *cu = obedit->data; | ||||
| case SIMCURHAND_WEIGHT: | ListBase *editnurb = object_editcurve_get(obedit); | ||||
| changed = curve_select_similar_weight(editnurb, cu, compare, thresh); | |||||
| break; | |||||
| case SIMCURHAND_DIRECTION: | |||||
| changed = curve_select_similar_direction(editnurb, cu, thresh); | |||||
| break; | |||||
| } | |||||
| if (changed) { | if (!ED_curve_select_check(cu, cu->editnurb)) { | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | printf("None selected."); | ||||
| return OPERATOR_FINISHED; | continue; | ||||
| } | } | ||||
| else { | |||||
| return OPERATOR_CANCELLED; | bool changed = false; | ||||
| switch (type) { | |||||
| case SIMCURHAND_TYPE: | |||||
| changed = curve_select_similar_type(editnurb, cu); | |||||
| break; | |||||
| case SIMCURHAND_RADIUS: | |||||
| changed = curve_select_similar_radius(editnurb, cu, compare, thresh); | |||||
| break; | |||||
| case SIMCURHAND_WEIGHT: | |||||
| changed = curve_select_similar_weight(editnurb, cu, compare, thresh); | |||||
| break; | |||||
| case SIMCURHAND_DIRECTION: | |||||
| changed = curve_select_similar_direction(editnurb, cu, thresh); | |||||
| break; | |||||
| } | |||||
| if (changed) { | |||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); | |||||
| } | |||||
| } | } | ||||
| MEM_freeN(objects); | |||||
| return OPERATOR_FINISHED; | |||||
| } | } | ||||
| void CURVE_OT_select_similar(wmOperatorType *ot) | void CURVE_OT_select_similar(wmOperatorType *ot) | ||||
| Context not available. | |||||