Compare commits
7 Commits
tmp-Collec
...
temp-multi
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cec4fc3bd3 | ||
![]() |
ee80a79945 | ||
![]() |
25fcc24470 | ||
![]() |
d4a4751d98 | ||
![]() |
c3dfe47dfc | ||
![]() |
4962103391 | ||
![]() |
9f59448083 |
Submodule release/scripts/addons updated: 4b91309b12...f6e3238de3
Submodule release/scripts/addons_contrib updated: cd57934bd0...4747021578
@@ -2848,58 +2848,66 @@ void CURVE_OT_smooth_tilt(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int hide_exec(bContext *C, wmOperator *op)
|
static int hide_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
|
||||||
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");
|
const bool invert = RNA_boolean_get(op->ptr, "unselected");
|
||||||
|
int a, sel;
|
||||||
|
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
if (nu->type == CU_BEZIER) {
|
uint objects_len = 0;
|
||||||
bezt = nu->bezt;
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
a = nu->pntsu;
|
|
||||||
sel = 0;
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
while (a--) {
|
Object *obedit = objects[ob_index];
|
||||||
if (invert == 0 && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
Curve *cu = obedit->data;
|
||||||
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
ListBase *editnurb = object_editcurve_get(obedit);
|
||||||
bezt->hide = 1;
|
Nurb *nu;
|
||||||
|
BPoint *bp;
|
||||||
|
BezTriple *bezt;
|
||||||
|
|
||||||
|
for (nu = editnurb->first; nu; nu = nu->next) {
|
||||||
|
if (nu->type == CU_BEZIER) {
|
||||||
|
bezt = nu->bezt;
|
||||||
|
a = nu->pntsu;
|
||||||
|
sel = 0;
|
||||||
|
while (a--) {
|
||||||
|
if (invert == 0 && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||||
|
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
||||||
|
bezt->hide = 1;
|
||||||
|
}
|
||||||
|
else if (invert && !BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||||
|
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
||||||
|
bezt->hide = 1;
|
||||||
|
}
|
||||||
|
if (bezt->hide) sel++;
|
||||||
|
bezt++;
|
||||||
}
|
}
|
||||||
else if (invert && !BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
if (sel == nu->pntsu) nu->hide = 1;
|
||||||
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
|
||||||
bezt->hide = 1;
|
|
||||||
}
|
|
||||||
if (bezt->hide) sel++;
|
|
||||||
bezt++;
|
|
||||||
}
|
}
|
||||||
if (sel == nu->pntsu) nu->hide = 1;
|
else {
|
||||||
}
|
bp = nu->bp;
|
||||||
else {
|
a = nu->pntsu * nu->pntsv;
|
||||||
bp = nu->bp;
|
sel = 0;
|
||||||
a = nu->pntsu * nu->pntsv;
|
while (a--) {
|
||||||
sel = 0;
|
if (invert == 0 && (bp->f1 & SELECT)) {
|
||||||
while (a--) {
|
select_bpoint(bp, DESELECT, SELECT, HIDDEN);
|
||||||
if (invert == 0 && (bp->f1 & SELECT)) {
|
bp->hide = 1;
|
||||||
select_bpoint(bp, DESELECT, SELECT, HIDDEN);
|
}
|
||||||
bp->hide = 1;
|
else if (invert && (bp->f1 & SELECT) == 0) {
|
||||||
|
select_bpoint(bp, DESELECT, SELECT, HIDDEN);
|
||||||
|
bp->hide = 1;
|
||||||
|
}
|
||||||
|
if (bp->hide) sel++;
|
||||||
|
bp++;
|
||||||
}
|
}
|
||||||
else if (invert && (bp->f1 & SELECT) == 0) {
|
if (sel == nu->pntsu * nu->pntsv) nu->hide = 1;
|
||||||
select_bpoint(bp, DESELECT, SELECT, HIDDEN);
|
|
||||||
bp->hide = 1;
|
|
||||||
}
|
|
||||||
if (bp->hide) sel++;
|
|
||||||
bp++;
|
|
||||||
}
|
}
|
||||||
if (sel == nu->pntsu * nu->pntsv) nu->hide = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEG_id_tag_update(obedit->data, 0);
|
MEM_freeN(objects);
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
|
||||||
BKE_curve_nurb_vert_active_validate(obedit->data);
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2925,43 +2933,51 @@ void CURVE_OT_hide(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int reveal_exec(bContext *C, wmOperator *op)
|
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;
|
|
||||||
const bool select = RNA_boolean_get(op->ptr, "select");
|
const bool select = RNA_boolean_get(op->ptr, "select");
|
||||||
|
int a;
|
||||||
|
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
nu->hide = 0;
|
uint objects_len = 0;
|
||||||
if (nu->type == CU_BEZIER) {
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
bezt = nu->bezt;
|
|
||||||
a = nu->pntsu;
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
while (a--) {
|
Object *obedit = objects[ob_index];
|
||||||
if (bezt->hide) {
|
ListBase *editnurb = object_editcurve_get(obedit);
|
||||||
select_beztriple(bezt, select, SELECT, HIDDEN);
|
Nurb *nu;
|
||||||
bezt->hide = 0;
|
BPoint *bp;
|
||||||
|
BezTriple *bezt;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
bezt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp = nu->bp;
|
||||||
|
a = nu->pntsu * nu->pntsv;
|
||||||
|
while (a--) {
|
||||||
|
if (bp->hide) {
|
||||||
|
select_bpoint(bp, select, SELECT, HIDDEN);
|
||||||
|
bp->hide = 0;
|
||||||
|
}
|
||||||
|
bp++;
|
||||||
}
|
}
|
||||||
bezt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp = nu->bp;
|
|
||||||
a = nu->pntsu * nu->pntsv;
|
|
||||||
while (a--) {
|
|
||||||
if (bp->hide) {
|
|
||||||
select_bpoint(bp, select, SELECT, HIDDEN);
|
|
||||||
bp->hide = 0;
|
|
||||||
}
|
|
||||||
bp++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEG_id_tag_update(obedit->data, 0);
|
||||||
|
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEG_id_tag_update(obedit->data, 0);
|
MEM_freeN(objects);
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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))
|
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);
|
||||||
|
|
||||||
selectend_nurb(obedit, FIRST, true, DESELECT);
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
Object *obedit = objects[ob_index];
|
||||||
BKE_curve_nurb_vert_active_validate(obedit->data);
|
|
||||||
|
|
||||||
|
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;
|
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))
|
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);
|
||||||
|
|
||||||
selectend_nurb(obedit, LAST, true, DESELECT);
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
Object *obedit = objects[ob_index];
|
||||||
BKE_curve_nurb_vert_active_validate(obedit->data);
|
|
||||||
|
|
||||||
|
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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,12 +708,25 @@ void CURVE_OT_select_row(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
|
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);
|
||||||
ListBase *editnurb = object_editcurve_get(obedit);
|
uint objects_len = 0;
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
|
|
||||||
select_adjacent_cp(editnurb, 1, 0, SELECT);
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,12 +749,25 @@ void CURVE_OT_select_next(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
|
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);
|
||||||
ListBase *editnurb = object_editcurve_get(obedit);
|
uint objects_len = 0;
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
|
|
||||||
select_adjacent_cp(editnurb, -1, 0, SELECT);
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,72 +790,85 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
|
static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
ListBase *editnurb = object_editcurve_get(obedit);
|
uint objects_len = 0;
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
BPoint *bp, *tempbp;
|
BPoint *bp, *tempbp;
|
||||||
int a;
|
int a;
|
||||||
short sel = 0;
|
short sel = 0;
|
||||||
|
|
||||||
/* note that NURBS surface is a special case because we mimic */
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
/* the behavior of "select more" of mesh tools. */
|
Object *obedit = objects[ob_index];
|
||||||
/* The algorithm is designed to work in planar cases so it */
|
Curve *cu = obedit->data;
|
||||||
/* may not be optimal always (example: end of NURBS sphere) */
|
|
||||||
if (obedit->type == OB_SURF) {
|
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
|
||||||
BLI_bitmap *selbpoints;
|
|
||||||
a = nu->pntsu * nu->pntsv;
|
|
||||||
bp = nu->bp;
|
|
||||||
selbpoints = BLI_BITMAP_NEW(a, "selectlist");
|
|
||||||
while (a > 0) {
|
|
||||||
if ((!BLI_BITMAP_TEST(selbpoints, a)) && (bp->hide == 0) && (bp->f1 & SELECT)) {
|
|
||||||
/* upper control point */
|
|
||||||
if (a % nu->pntsu != 0) {
|
|
||||||
tempbp = bp - 1;
|
|
||||||
if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* left control point. select only if it is not selected already */
|
if (!ED_curve_select_check(cu, cu->editnurb)) {
|
||||||
if (a - nu->pntsu > 0) {
|
continue;
|
||||||
sel = 0;
|
}
|
||||||
tempbp = bp + nu->pntsu;
|
|
||||||
if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
|
||||||
/* make sure selected bpoint is discarded */
|
|
||||||
if (sel == 1) BLI_BITMAP_ENABLE(selbpoints, a - nu->pntsu);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* right control point */
|
ListBase *editnurb = object_editcurve_get(obedit);
|
||||||
if (a + nu->pntsu < nu->pntsu * nu->pntsv) {
|
|
||||||
tempbp = bp - nu->pntsu;
|
|
||||||
if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* lower control point. skip next bp in case selection was made */
|
/* note that NURBS surface is a special case because we mimic */
|
||||||
if (a % nu->pntsu != 1) {
|
/* the behavior of "select more" of mesh tools. */
|
||||||
sel = 0;
|
/* The algorithm is designed to work in planar cases so it */
|
||||||
tempbp = bp + 1;
|
/* may not be optimal always (example: end of NURBS sphere) */
|
||||||
if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
if (obedit->type == OB_SURF) {
|
||||||
if (sel) {
|
for (nu = editnurb->first; nu; nu = nu->next) {
|
||||||
bp++;
|
BLI_bitmap *selbpoints;
|
||||||
a--;
|
a = nu->pntsu * nu->pntsv;
|
||||||
|
bp = nu->bp;
|
||||||
|
selbpoints = BLI_BITMAP_NEW(a, "selectlist");
|
||||||
|
while (a > 0) {
|
||||||
|
if ((!BLI_BITMAP_TEST(selbpoints, a)) && (bp->hide == 0) && (bp->f1 & SELECT)) {
|
||||||
|
/* upper control point */
|
||||||
|
if (a % nu->pntsu != 0) {
|
||||||
|
tempbp = bp - 1;
|
||||||
|
if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* left control point. select only if it is not selected already */
|
||||||
|
if (a - nu->pntsu > 0) {
|
||||||
|
sel = 0;
|
||||||
|
tempbp = bp + nu->pntsu;
|
||||||
|
if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
||||||
|
/* make sure selected bpoint is discarded */
|
||||||
|
if (sel == 1) BLI_BITMAP_ENABLE(selbpoints, a - nu->pntsu);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* right control point */
|
||||||
|
if (a + nu->pntsu < nu->pntsu * nu->pntsv) {
|
||||||
|
tempbp = bp - nu->pntsu;
|
||||||
|
if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lower control point. skip next bp in case selection was made */
|
||||||
|
if (a % nu->pntsu != 1) {
|
||||||
|
sel = 0;
|
||||||
|
tempbp = bp + 1;
|
||||||
|
if (!(tempbp->f1 & SELECT)) sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
|
||||||
|
if (sel) {
|
||||||
|
bp++;
|
||||||
|
a--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bp++;
|
||||||
|
a--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bp++;
|
MEM_freeN(selbpoints);
|
||||||
a--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MEM_freeN(selbpoints);
|
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
select_adjacent_cp(editnurb, 1, 0, SELECT);
|
||||||
select_adjacent_cp(editnurb, 1, 0, SELECT);
|
select_adjacent_cp(editnurb, -1, 0, SELECT);
|
||||||
select_adjacent_cp(editnurb, -1, 0, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,8 +892,9 @@ void CURVE_OT_select_more(wmOperatorType *ot)
|
|||||||
/* basic method: deselect if control point doesn't have all neighbors selected */
|
/* basic method: deselect if control point doesn't have all neighbors selected */
|
||||||
static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
ListBase *editnurb = object_editcurve_get(obedit);
|
uint objects_len = 0;
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
Nurb *nu;
|
Nurb *nu;
|
||||||
BPoint *bp;
|
BPoint *bp;
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
@@ -848,133 +902,38 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
int sel = 0;
|
int sel = 0;
|
||||||
bool lastsel = false;
|
bool lastsel = false;
|
||||||
|
|
||||||
if (obedit->type == OB_SURF) {
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
Object *obedit = objects[ob_index];
|
||||||
BLI_bitmap *selbpoints;
|
Curve *cu = obedit->data;
|
||||||
a = nu->pntsu * nu->pntsv;
|
|
||||||
bp = nu->bp;
|
|
||||||
selbpoints = BLI_BITMAP_NEW(a, "selectlist");
|
|
||||||
while (a--) {
|
|
||||||
if ((bp->hide == 0) && (bp->f1 & SELECT)) {
|
|
||||||
sel = 0;
|
|
||||||
|
|
||||||
/* check if neighbors have been selected */
|
if (!ED_curve_select_check(cu, cu->editnurb)) {
|
||||||
/* edges of surface are an exception */
|
continue;
|
||||||
if ((a + 1) % nu->pntsu == 0) {
|
|
||||||
sel++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp--;
|
|
||||||
if (BLI_BITMAP_TEST(selbpoints, a + 1) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++;
|
|
||||||
bp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((a + 1) % nu->pntsu == 1) {
|
|
||||||
sel++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp++;
|
|
||||||
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
|
||||||
bp--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a + 1 > nu->pntsu * nu->pntsv - nu->pntsu) {
|
|
||||||
sel++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp -= nu->pntsu;
|
|
||||||
if (BLI_BITMAP_TEST(selbpoints, a + nu->pntsu) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++;
|
|
||||||
bp += nu->pntsu;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a < nu->pntsu) {
|
|
||||||
sel++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp += nu->pntsu;
|
|
||||||
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
|
||||||
bp -= nu->pntsu;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sel != 4) {
|
|
||||||
select_bpoint(bp, DESELECT, SELECT, VISIBLE);
|
|
||||||
BLI_BITMAP_ENABLE(selbpoints, a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastsel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
MEM_freeN(selbpoints);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
|
||||||
lastsel = false;
|
|
||||||
/* check what type of curve/nurb it is */
|
|
||||||
if (nu->type == CU_BEZIER) {
|
|
||||||
a = nu->pntsu;
|
|
||||||
bezt = nu->bezt;
|
|
||||||
while (a--) {
|
|
||||||
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) {
|
|
||||||
sel = (lastsel == 1);
|
|
||||||
|
|
||||||
/* check if neighbors have been selected */
|
ListBase *editnurb = object_editcurve_get(obedit);
|
||||||
/* first and last are exceptions */
|
|
||||||
if (a == nu->pntsu - 1) {
|
|
||||||
sel++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bezt--;
|
|
||||||
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++;
|
|
||||||
bezt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a == 0) {
|
if (obedit->type == OB_SURF) {
|
||||||
sel++;
|
for (nu = editnurb->first; nu; nu = nu->next) {
|
||||||
}
|
BLI_bitmap *selbpoints;
|
||||||
else {
|
|
||||||
bezt++;
|
|
||||||
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++;
|
|
||||||
bezt--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sel != 2) {
|
|
||||||
select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
|
|
||||||
lastsel = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastsel = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastsel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bezt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
a = nu->pntsu * nu->pntsv;
|
a = nu->pntsu * nu->pntsv;
|
||||||
bp = nu->bp;
|
bp = nu->bp;
|
||||||
|
selbpoints = BLI_BITMAP_NEW(a, "selectlist");
|
||||||
while (a--) {
|
while (a--) {
|
||||||
if ((lastsel == false) && (bp->hide == 0) && (bp->f1 & SELECT)) {
|
if ((bp->hide == 0) && (bp->f1 & SELECT)) {
|
||||||
sel = 0;
|
sel = 0;
|
||||||
|
|
||||||
/* first and last are exceptions */
|
/* check if neighbors have been selected */
|
||||||
if (a == nu->pntsu * nu->pntsv - 1) {
|
/* edges of surface are an exception */
|
||||||
|
if ((a + 1) % nu->pntsu == 0) {
|
||||||
sel++;
|
sel++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bp--;
|
bp--;
|
||||||
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
if (BLI_BITMAP_TEST(selbpoints, a + 1) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++;
|
||||||
bp++;
|
bp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a == 0) {
|
if ((a + 1) % nu->pntsu == 1) {
|
||||||
sel++;
|
sel++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -983,12 +942,27 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
bp--;
|
bp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel != 2) {
|
if (a + 1 > nu->pntsu * nu->pntsv - nu->pntsu) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp -= nu->pntsu;
|
||||||
|
if (BLI_BITMAP_TEST(selbpoints, a + nu->pntsu) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++;
|
||||||
|
bp += nu->pntsu;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a < nu->pntsu) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp += nu->pntsu;
|
||||||
|
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
||||||
|
bp -= nu->pntsu;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel != 4) {
|
||||||
select_bpoint(bp, DESELECT, SELECT, VISIBLE);
|
select_bpoint(bp, DESELECT, SELECT, VISIBLE);
|
||||||
lastsel = true;
|
BLI_BITMAP_ENABLE(selbpoints, a);
|
||||||
}
|
|
||||||
else {
|
|
||||||
lastsel = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -997,13 +971,105 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
bp++;
|
bp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MEM_freeN(selbpoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for (nu = editnurb->first; nu; nu = nu->next) {
|
||||||
|
lastsel = false;
|
||||||
|
/* check what type of curve/nurb it is */
|
||||||
|
if (nu->type == CU_BEZIER) {
|
||||||
|
a = nu->pntsu;
|
||||||
|
bezt = nu->bezt;
|
||||||
|
while (a--) {
|
||||||
|
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) {
|
||||||
|
sel = (lastsel == 1);
|
||||||
|
|
||||||
|
/* check if neighbors have been selected */
|
||||||
|
/* first and last are exceptions */
|
||||||
|
if (a == nu->pntsu - 1) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bezt--;
|
||||||
|
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++;
|
||||||
|
bezt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a == 0) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bezt++;
|
||||||
|
if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++;
|
||||||
|
bezt--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel != 2) {
|
||||||
|
select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
|
||||||
|
lastsel = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lastsel = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lastsel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bezt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
a = nu->pntsu * nu->pntsv;
|
||||||
|
bp = nu->bp;
|
||||||
|
while (a--) {
|
||||||
|
if ((lastsel == false) && (bp->hide == 0) && (bp->f1 & SELECT)) {
|
||||||
|
sel = 0;
|
||||||
|
|
||||||
|
/* first and last are exceptions */
|
||||||
|
if (a == nu->pntsu * nu->pntsv - 1) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp--;
|
||||||
|
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
||||||
|
bp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a == 0) {
|
||||||
|
sel++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bp++;
|
||||||
|
if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++;
|
||||||
|
bp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel != 2) {
|
||||||
|
select_bpoint(bp, DESELECT, SELECT, VISIBLE);
|
||||||
|
lastsel = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lastsel = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lastsel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
||||||
|
BKE_curve_nurb_vert_active_validate(obedit->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
MEM_freeN(objects);
|
||||||
BKE_curve_nurb_vert_active_validate(obedit->data);
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
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)
|
static int select_nth_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
struct CheckerIntervalParams op_params;
|
uint objects_len = 0;
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
|
|
||||||
WM_operator_properties_checker_interval_from_op(op, &op_params);
|
bool found_active_elt = false;
|
||||||
|
short ob_type;
|
||||||
|
|
||||||
if (!ed_curve_select_nth(obedit->data, &op_params)) {
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
if (obedit->type == OB_SURF) {
|
Object *obedit = objects[ob_index];
|
||||||
BKE_report(op->reports, RPT_ERROR, "Surface has not got active point");
|
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) == 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 {
|
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;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
|
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Submodule source/tools updated: 6bcd05cf6a...116ae2c6e6
Reference in New Issue
Block a user