1
1

Compare commits

...

7 Commits

Author SHA1 Message Date
Daniel Griffin
cec4fc3bd3 Enabled Multi-Object-Mode for CURVE_OT_select_less 2018-05-29 23:59:07 -07:00
Daniel Griffin
ee80a79945 Enabled Multi-Object-Mode for CURVE_OT_select_more 2018-05-29 23:52:11 -07:00
Daniel Griffin
25fcc24470 Enabled Multi-Object-Mode for CURVE_OT_de_select_last 2018-05-29 23:30:32 -07:00
Daniel Griffin
d4a4751d98 Enabled Multi-Object-Mode for CURVE_OT_de_select_first 2018-05-29 23:22:53 -07:00
Daniel Griffin
c3dfe47dfc Enabled Multi-Object-Mode for CURVE_OT_select_next and CURVE_OT_select_previous. 2018-05-29 22:42:56 -07:00
Daniel Griffin
4962103391 Merge branch 'blender2.8' into Multi_Object_Curve_Tools 2018-05-29 20:57:59 -07:00
Daniel Griffin
9f59448083 Enabled Multi-Object-Mode for CURVE_OT_select_nth, CURVE_OT_hide, and CURVE_OT_reveal. 2018-05-28 23:01:17 -07:00
5 changed files with 380 additions and 272 deletions

View File

@@ -2848,14 +2848,20 @@ void CURVE_OT_smooth_tilt(wmOperatorType *ot)
static int hide_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
const bool invert = RNA_boolean_get(op->ptr, "unselected");
int a, sel;
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
int a, sel;
const bool invert = RNA_boolean_get(op->ptr, "unselected");
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
@@ -2899,7 +2905,9 @@ static int hide_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -2925,13 +2933,19 @@ void CURVE_OT_hide(wmOperatorType *ot)
static int reveal_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
const bool select = RNA_boolean_get(op->ptr, "select");
int a;
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);
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;
const bool select = RNA_boolean_get(op->ptr, "select");
for (nu = editnurb->first; nu; nu = nu->next) {
nu->hide = 0;
@@ -2961,7 +2975,9 @@ static int reveal_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}

View File

@@ -401,12 +401,19 @@ static void selectend_nurb(Object *obedit, eEndPoint_Types selfirst, bool doswap
static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
selectend_nurb(obedit, FIRST, true, DESELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -427,12 +434,19 @@ void CURVE_OT_de_select_first(wmOperatorType *ot)
static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
selectend_nurb(obedit, LAST, true, DESELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -694,12 +708,25 @@ void CURVE_OT_select_row(wmOperatorType *ot)
static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
if (!ED_curve_select_check(cu, cu->editnurb)) {
continue;
}
ListBase *editnurb = object_editcurve_get(obedit);
select_adjacent_cp(editnurb, 1, 0, SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -722,12 +749,25 @@ void CURVE_OT_select_next(wmOperatorType *ot)
static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
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);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
if (!ED_curve_select_check(cu, cu->editnurb)) {
continue;
}
ListBase *editnurb = object_editcurve_get(obedit);
select_adjacent_cp(editnurb, -1, 0, SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -750,13 +790,24 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
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);
Nurb *nu;
BPoint *bp, *tempbp;
int a;
short sel = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
if (!ED_curve_select_check(cu, cu->editnurb)) {
continue;
}
ListBase *editnurb = object_editcurve_get(obedit);
/* note that NURBS surface is a special case because we mimic */
/* the behavior of "select more" of mesh tools. */
/* The algorithm is designed to work in planar cases so it */
@@ -815,7 +866,9 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -839,8 +892,9 @@ void CURVE_OT_select_more(wmOperatorType *ot)
/* basic method: deselect if control point doesn't have all neighbors selected */
static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *obedit = CTX_data_edit_object(C);
ListBase *editnurb = object_editcurve_get(obedit);
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);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -848,6 +902,16 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
int sel = 0;
bool lastsel = false;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
if (!ED_curve_select_check(cu, cu->editnurb)) {
continue;
}
ListBase *editnurb = object_editcurve_get(obedit);
if (obedit->type == OB_SURF) {
for (nu = editnurb->first; nu; nu = nu->next) {
BLI_bitmap *selbpoints;
@@ -1003,7 +1067,9 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
}
MEM_freeN(objects);
return OPERATOR_FINISHED;
}
@@ -1181,24 +1247,50 @@ static bool ed_curve_select_nth(Curve *cu, const struct CheckerIntervalParams *p
static int select_nth_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
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 found_active_elt = false;
short ob_type;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
Curve *cu = obedit->data;
ob_type = obedit->type;
if (!ED_curve_select_check(cu, cu->editnurb)) {
continue;
}
struct CheckerIntervalParams op_params;
WM_operator_properties_checker_interval_from_op(op, &op_params);
if (!ed_curve_select_nth(obedit->data, &op_params)) {
if (obedit->type == OB_SURF) {
BKE_report(op->reports, RPT_ERROR, "Surface has not got active point");
if (ed_curve_select_nth(obedit->data, &op_params) == true) {
found_active_elt = true;
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
}
MEM_freeN(objects);
if (!found_active_elt) {
if (ob_type == OB_SURF) {
BKE_report(op->reports, RPT_ERROR,
(objects_len == 1 ?
"Surface has no active point" :
"Surfaces have no active point"));
}
else {
BKE_report(op->reports, RPT_ERROR, "Curve has not got active point");
BKE_report(op->reports, RPT_ERROR,
(objects_len == 1 ?
"Curve has no active point" :
"Curves have no active point"));
}
return OPERATOR_CANCELLED;
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}