Curves: Move draw options to overlays
This commit add one regression: it is impossible to currently hide handles in the viewport. But this should be fixed in another commit.
This commit is contained in:
parent
05d0e5315b
commit
2cff9b4cb6
|
@ -4554,7 +4554,6 @@ class VIEW3D_PT_overlay_edit_curve(Panel):
|
|||
def draw(self, context):
|
||||
layout = self.layout
|
||||
view = context.space_data
|
||||
data = context.active_object.data
|
||||
overlay = view.overlay
|
||||
display_all = overlay.show_overlays
|
||||
|
||||
|
@ -4562,8 +4561,8 @@ class VIEW3D_PT_overlay_edit_curve(Panel):
|
|||
col.active = display_all
|
||||
|
||||
row = col.row()
|
||||
row.prop(data, "show_handles", text="Handles")
|
||||
row.prop(data, "show_normal_face", text="Normals")
|
||||
row.prop(overlay, "show_curve_handles", text="Handles")
|
||||
row.prop(overlay, "show_curve_normals", text="Normals")
|
||||
|
||||
|
||||
class VIEW3D_PT_overlay_sculpt(Panel):
|
||||
|
|
|
@ -2066,7 +2066,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
V3D_OVERLAY_EDIT_FREESTYLE_FACE |
|
||||
V3D_OVERLAY_EDIT_EDGES |
|
||||
V3D_OVERLAY_EDIT_CREASES |
|
||||
V3D_OVERLAY_EDIT_BWEIGHTS;
|
||||
V3D_OVERLAY_EDIT_BWEIGHTS |
|
||||
V3D_OVERLAY_EDIT_CU_HANDLES |
|
||||
V3D_OVERLAY_EDIT_CU_NORMALS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,8 +210,9 @@ static CurveRenderData *curve_render_data_create(Curve *cu, CurveCache *ob_curve
|
|||
rdata->types = types;
|
||||
ListBase *nurbs;
|
||||
|
||||
rdata->hide_handles = (cu->drawflag & CU_HIDE_HANDLES) != 0;
|
||||
rdata->hide_normals = (cu->drawflag & CU_HIDE_NORMALS) != 0;
|
||||
/* TODO(fclem): hide them in the shader/draw engine */
|
||||
rdata->hide_handles = false;
|
||||
rdata->hide_normals = false;
|
||||
|
||||
rdata->actnu = cu->actnu;
|
||||
rdata->actvert = cu->actvert;
|
||||
|
@ -364,10 +365,10 @@ static bool curve_batch_cache_valid(Curve *cu)
|
|||
|
||||
if (cache->is_editmode) {
|
||||
if (cu->editnurb) {
|
||||
if ((cache->hide_handles != ((cu->drawflag & CU_HIDE_HANDLES) != 0))) {
|
||||
if (cache->hide_handles != false) {
|
||||
return false;
|
||||
}
|
||||
else if ((cache->hide_normals != ((cu->drawflag & CU_HIDE_NORMALS) != 0))) {
|
||||
else if (cache->hide_normals != false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -390,8 +391,8 @@ static void curve_batch_cache_init(Curve *cu)
|
|||
memset(cache, 0, sizeof(*cache));
|
||||
}
|
||||
|
||||
cache->hide_handles = (cu->drawflag & CU_HIDE_HANDLES) != 0;
|
||||
cache->hide_normals = (cu->drawflag & CU_HIDE_NORMALS) != 0;
|
||||
cache->hide_handles = false;
|
||||
cache->hide_normals = false;
|
||||
|
||||
#if 0
|
||||
ListBase *nurbs;
|
||||
|
|
|
@ -249,7 +249,7 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob)
|
|||
geom = DRW_cache_curve_edge_wire_get(ob);
|
||||
DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat);
|
||||
|
||||
if ((cu->flag & CU_3D) && (cu->drawflag & CU_HIDE_NORMALS) == 0) {
|
||||
if ((cu->flag & CU_3D) && (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_NORMALS) != 0) {
|
||||
geom = DRW_cache_curve_edge_normal_get(ob, v3d->overlay.normals_length);
|
||||
DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
void selectend_nurb(Object *obedit, enum eEndPoint_Types selfirst, bool doswap, bool selstatus);
|
||||
static void adduplicateflagNurb(Object *obedit, ListBase *newnurb, const short flag, const bool split);
|
||||
static int curve_delete_segments(Object *obedit, const bool split);
|
||||
static int curve_delete_segments(Object *obedit, View3D *v3d, const bool split);
|
||||
|
||||
ListBase *object_editcurve_get(Object *ob)
|
||||
{
|
||||
|
@ -1292,6 +1292,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Object *oldob, *newob;
|
||||
Base *oldbase, *newbase;
|
||||
Curve *oldcu, *newcu;
|
||||
|
@ -1337,7 +1338,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
|||
/* 4. put old object out of editmode and delete separated geometry */
|
||||
ED_curve_editnurb_load(bmain, newob);
|
||||
ED_curve_editnurb_free(newob);
|
||||
curve_delete_segments(oldob, true);
|
||||
curve_delete_segments(oldob, v3d, true);
|
||||
|
||||
DEG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */
|
||||
DEG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */
|
||||
|
@ -1371,6 +1372,7 @@ void CURVE_OT_separate(wmOperatorType *ot)
|
|||
static int curve_split_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
ListBase newnurb = {NULL, NULL};
|
||||
|
||||
|
@ -1380,7 +1382,7 @@ static int curve_split_exec(bContext *C, wmOperator *op)
|
|||
Curve *cu = obedit->data;
|
||||
const int len_orig = BLI_listbase_count(editnurb);
|
||||
|
||||
curve_delete_segments(obedit, true);
|
||||
curve_delete_segments(obedit, v3d, true);
|
||||
cu->actnu -= len_orig - BLI_listbase_count(editnurb);
|
||||
BLI_movelisttolist(editnurb, &newnurb);
|
||||
|
||||
|
@ -1690,7 +1692,7 @@ static void ed_surf_delete_selected(Object *obedit)
|
|||
}
|
||||
}
|
||||
|
||||
static void ed_curve_delete_selected(Object *obedit)
|
||||
static void ed_curve_delete_selected(Object *obedit, View3D *v3d)
|
||||
{
|
||||
Curve *cu = obedit->data;
|
||||
EditNurb *editnurb = cu->editnurb;
|
||||
|
@ -1709,7 +1711,7 @@ static void ed_curve_delete_selected(Object *obedit)
|
|||
a = nu->pntsu;
|
||||
if (a) {
|
||||
while (a) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
|
@ -1771,7 +1773,7 @@ static void ed_curve_delete_selected(Object *obedit)
|
|||
if (nu->type == CU_BEZIER) {
|
||||
bezt = nu->bezt;
|
||||
for (a = 0; a < nu->pntsu; a++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
memmove(bezt, bezt + 1, (nu->pntsu - a - 1) * sizeof(BezTriple));
|
||||
keyIndex_delBezt(editnurb, bezt);
|
||||
keyIndex_updateBezt(editnurb, bezt + 1, bezt, nu->pntsu - a - 1);
|
||||
|
@ -2859,7 +2861,7 @@ void CURVE_OT_smooth_tilt(wmOperatorType *ot)
|
|||
static int hide_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Curve *cu = obedit->data;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BPoint *bp;
|
||||
|
@ -2873,11 +2875,11 @@ static int hide_exec(bContext *C, wmOperator *op)
|
|||
a = nu->pntsu;
|
||||
sel = 0;
|
||||
while (a--) {
|
||||
if (invert == 0 && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (invert == 0 && BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
||||
bezt->hide = 1;
|
||||
}
|
||||
else if (invert && !BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
else if (invert && !BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
|
||||
bezt->hide = 1;
|
||||
}
|
||||
|
@ -2998,7 +3000,7 @@ void CURVE_OT_reveal(wmOperatorType *ot)
|
|||
* curve nodes (Bezier or NURB). If there are no valid segment
|
||||
* selections within the current selection, nothing happens.
|
||||
*/
|
||||
static void subdividenurb(Object *obedit, int number_cuts)
|
||||
static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts)
|
||||
{
|
||||
Curve *cu = obedit->data;
|
||||
EditNurb *editnurb = cu->editnurb;
|
||||
|
@ -3030,7 +3032,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
|
|||
break;
|
||||
}
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt) && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, nextbezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt) && BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nextbezt)) {
|
||||
amount += number_cuts;
|
||||
}
|
||||
bezt++;
|
||||
|
@ -3052,7 +3054,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
|
|||
break;
|
||||
}
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt) && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, nextbezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt) && BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nextbezt)) {
|
||||
float prevvec[3][3];
|
||||
|
||||
memcpy(prevvec, bezt->vec, sizeof(float) * 9);
|
||||
|
@ -3384,6 +3386,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
|||
const int number_cuts = RNA_int_get(op->ptr, "number_cuts");
|
||||
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
uint objects_len = 0;
|
||||
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||
|
@ -3395,7 +3398,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
subdividenurb(obedit, number_cuts);
|
||||
subdividenurb(obedit, v3d, number_cuts);
|
||||
|
||||
if (ED_curve_updateAnimPaths(cu))
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
|
||||
|
@ -3497,7 +3500,7 @@ bool ED_curve_pick_vert(
|
|||
}
|
||||
|
||||
static void findselectedNurbvert(
|
||||
Curve *cu,
|
||||
Curve *cu, View3D *v3d,
|
||||
Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp)
|
||||
{
|
||||
/* in nu and (bezt or bp) selected are written if there's 1 sel. */
|
||||
|
@ -3517,7 +3520,7 @@ static void findselectedNurbvert(
|
|||
bezt1 = nu1->bezt;
|
||||
a = nu1->pntsu;
|
||||
while (a--) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt1)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1)) {
|
||||
if (*r_nu != NULL && *r_nu != nu1) {
|
||||
*r_nu = NULL;
|
||||
*r_bp = NULL;
|
||||
|
@ -4094,6 +4097,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
/* joins 2 curves */
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Curve *cu = obedit->data;
|
||||
ListBase *nubase = object_editcurve_get(obedit);
|
||||
Nurb *nu, *nu1 = NULL, *nu2 = NULL;
|
||||
|
@ -4141,7 +4145,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if ((nu->flagu & CU_NURB_CYCLIC) == 0) { /* not cyclic */
|
||||
if (nu->type == CU_BEZIER) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu - 1]))) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, &(nu->bezt[nu->pntsu - 1]))) {
|
||||
/* Last point is selected, preferred for nu2 */
|
||||
if (nu2 == NULL) {
|
||||
nu2 = nu;
|
||||
|
@ -4152,13 +4156,13 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
/* Just in case both of first/last CV are selected check
|
||||
* whether we really need to switch the direction.
|
||||
*/
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(cu, nu1->bezt)) {
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nu1->bezt)) {
|
||||
BKE_nurb_direction_switch(nu1);
|
||||
keyData_switchDirectionNurb(cu, nu1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, nu->bezt)) {
|
||||
else if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nu->bezt)) {
|
||||
/* First point is selected, preferred for nu1 */
|
||||
if (nu1 == NULL) {
|
||||
nu1 = nu;
|
||||
|
@ -4169,7 +4173,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
/* Just in case both of first/last CV are selected check
|
||||
* whether we really need to switch the direction.
|
||||
*/
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(cu, &(nu->bezt[nu2->pntsu - 1]))) {
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, &(nu->bezt[nu2->pntsu - 1]))) {
|
||||
BKE_nurb_direction_switch(nu2);
|
||||
keyData_switchDirectionNurb(cu, nu2);
|
||||
}
|
||||
|
@ -4268,8 +4272,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
if (!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu > 1) {
|
||||
if (nu1->type == CU_BEZIER && BEZT_ISSEL_ANY_HIDDENHANDLES(cu, nu1->bezt) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, &nu1->bezt[nu1->pntsu - 1]))
|
||||
if (nu1->type == CU_BEZIER && BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nu1->bezt) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, &nu1->bezt[nu1->pntsu - 1]))
|
||||
{
|
||||
nu1->flagu |= CU_NURB_CYCLIC;
|
||||
BKE_nurb_handles_calc(nu1);
|
||||
|
@ -4580,7 +4584,7 @@ void CURVE_OT_spin(wmOperatorType *ot)
|
|||
|
||||
/***************** extrude vertex operator **********************/
|
||||
|
||||
static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb)
|
||||
static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d)
|
||||
{
|
||||
Nurb *nu = NULL;
|
||||
Nurb *nu_last = NULL;
|
||||
|
@ -4615,7 +4619,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb)
|
|||
BezTriple *nu_bezt_old = nu->bezt;
|
||||
BezTriple *bezt = nu->bezt;
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
BezTriple *bezt_new;
|
||||
BEZT_DESEL_ALL(bezt);
|
||||
|
||||
|
@ -4645,7 +4649,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb)
|
|||
BezTriple *nu_bezt_old = nu->bezt;
|
||||
BezTriple *bezt = &nu->bezt[nu->pntsu - 1];
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
BezTriple *bezt_new;
|
||||
BEZT_DESEL_ALL(bezt);
|
||||
|
||||
|
@ -4756,7 +4760,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb)
|
|||
BezTriple *bezt;
|
||||
|
||||
for (bezt = &nu->bezt[i]; i < i_end; i++, bezt++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
Nurb *nurb_new;
|
||||
BezTriple *bezt_new;
|
||||
|
||||
|
@ -4811,7 +4815,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb)
|
|||
|
||||
/***************** add vertex operator **********************/
|
||||
|
||||
static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float location_init[3])
|
||||
static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const float location_init[3])
|
||||
{
|
||||
Nurb *nu;
|
||||
|
||||
|
@ -4829,7 +4833,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat
|
|||
BezTriple *bezt;
|
||||
|
||||
for (i = 0, bezt = nu->bezt; i < nu->pntsu; i++, bezt++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
add_v3_v3(center, bezt->vec[1]);
|
||||
verts_len += 1;
|
||||
}
|
||||
|
@ -4847,7 +4851,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat
|
|||
}
|
||||
}
|
||||
|
||||
if (verts_len && ed_editcurve_extrude(cu, editnurb)) {
|
||||
if (verts_len && ed_editcurve_extrude(cu, editnurb, v3d)) {
|
||||
float ofs[3];
|
||||
int i;
|
||||
|
||||
|
@ -4862,7 +4866,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat
|
|||
if (nu->type == CU_BEZIER) {
|
||||
BezTriple *bezt;
|
||||
for (i = 0, bezt = nu->bezt; i < nu->pntsu; i++, bezt++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
add_v3_v3(bezt->vec[0], ofs);
|
||||
add_v3_v3(bezt->vec[1], ofs);
|
||||
add_v3_v3(bezt->vec[2], ofs);
|
||||
|
@ -4976,6 +4980,7 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat
|
|||
static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Curve *cu = obedit->data;
|
||||
EditNurb *editnurb = cu->editnurb;
|
||||
float location[3];
|
||||
|
@ -4986,7 +4991,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
|||
invert_m4_m4(imat, obedit->obmat);
|
||||
mul_m4_v3(imat, location);
|
||||
|
||||
if (ed_editcurve_addvert(cu, editnurb, location)) {
|
||||
if (ed_editcurve_addvert(cu, editnurb, v3d, location)) {
|
||||
if (ED_curve_updateAnimPaths(obedit->data)) {
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
|
||||
}
|
||||
|
@ -5019,7 +5024,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
cu = vc.obedit->data;
|
||||
|
||||
findselectedNurbvert(cu, &nu, &bezt, &bp);
|
||||
findselectedNurbvert(cu, vc.v3d, &nu, &bezt, &bp);
|
||||
|
||||
if (bezt) {
|
||||
mul_v3_m4v3(location, vc.obedit->obmat, bezt->vec[1]);
|
||||
|
@ -5115,6 +5120,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
|
|||
static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Curve *cu = obedit->data;
|
||||
EditNurb *editnurb = cu->editnurb;
|
||||
bool changed = false;
|
||||
|
@ -5134,7 +5140,7 @@ static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
|
||||
if (obedit->type == OB_CURVE || as_curve) {
|
||||
changed = ed_editcurve_extrude(cu, editnurb);
|
||||
changed = ed_editcurve_extrude(cu, editnurb, v3d);
|
||||
}
|
||||
else {
|
||||
changed = ed_editnurb_extrude_flag(editnurb, SELECT);
|
||||
|
@ -5175,7 +5181,7 @@ void CURVE_OT_extrude(wmOperatorType *ot)
|
|||
static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Curve *cu = obedit->data;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
|
@ -5199,7 +5205,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
|
|||
a = nu->pntsu;
|
||||
bezt = nu->bezt;
|
||||
while (a--) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
nu->flagu ^= CU_NURB_CYCLIC;
|
||||
break;
|
||||
}
|
||||
|
@ -5339,19 +5345,19 @@ void CURVE_OT_duplicate(wmOperatorType *ot)
|
|||
|
||||
/********************** delete operator *********************/
|
||||
|
||||
static int curve_delete_vertices(Object *obedit)
|
||||
static int curve_delete_vertices(Object *obedit, View3D *v3d)
|
||||
{
|
||||
if (obedit->type == OB_SURF) {
|
||||
ed_surf_delete_selected(obedit);
|
||||
}
|
||||
else {
|
||||
ed_curve_delete_selected(obedit);
|
||||
ed_curve_delete_selected(obedit, v3d);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int curve_delete_segments(Object *obedit, const bool split)
|
||||
static int curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
|
||||
{
|
||||
Curve *cu = obedit->data;
|
||||
EditNurb *editnurb = cu->editnurb;
|
||||
|
@ -5368,12 +5374,12 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
|
||||
if (nu->type == CU_BEZIER) {
|
||||
for (a = 0, bezt = nu->bezt; a < nu->pntsu; a++, bezt++) {
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (!BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
enda = a;
|
||||
if (starta == -1) starta = a;
|
||||
if (a < nu->pntsu - 1) continue;
|
||||
}
|
||||
else if (a < nu->pntsu - 1 && !BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt + 1)) {
|
||||
else if (a < nu->pntsu - 1 && !BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt + 1)) {
|
||||
/* if just single selected point then continue */
|
||||
continue;
|
||||
}
|
||||
|
@ -5397,8 +5403,8 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
bezt2 = &nu->bezt[nu->pntsu - 2];
|
||||
|
||||
if ((nu->flagu & CU_NURB_CYCLIC) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt2))
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt2))
|
||||
{
|
||||
/* check if need to join start of spline to end */
|
||||
nu1 = BKE_nurb_copy(nu, cut + 1, 1);
|
||||
|
@ -5419,8 +5425,8 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
bezt2 = &nu->bezt[1];
|
||||
|
||||
if ((nu->flagu & CU_NURB_CYCLIC) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt2))
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt2))
|
||||
{
|
||||
/* check if need to join start of spline to end */
|
||||
nu1 = BKE_nurb_copy(nu, cut + 1, 1);
|
||||
|
@ -5460,8 +5466,8 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
bezt1 = nu->bezt;
|
||||
bezt2 = &nu->bezt[1];
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt2))
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt2))
|
||||
{
|
||||
nu1 = BKE_nurb_copy(nu, 1, 1);
|
||||
ED_curve_beztcpy(editnurb, nu1->bezt, bezt1, 1);
|
||||
|
@ -5471,8 +5477,8 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
bezt1 = &nu->bezt[nu->pntsu - 1];
|
||||
bezt2 = &nu->bezt[nu->pntsu - 2];
|
||||
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt2))
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt1) &&
|
||||
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt2))
|
||||
{
|
||||
nu1 = BKE_nurb_copy(nu, 1, 1);
|
||||
ED_curve_beztcpy(editnurb, nu1->bezt, bezt1, 1);
|
||||
|
@ -5750,12 +5756,13 @@ static int curve_delete_segments(Object *obedit, const bool split)
|
|||
static int curve_delete_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Curve *cu = (Curve *)obedit->data;
|
||||
eCurveElem_Types type = RNA_enum_get(op->ptr, "type");
|
||||
int retval = OPERATOR_CANCELLED;
|
||||
|
||||
if (type == CURVE_VERTEX) retval = curve_delete_vertices(obedit);
|
||||
else if (type == CURVE_SEGMENT) retval = curve_delete_segments(obedit, false);
|
||||
if (type == CURVE_VERTEX) retval = curve_delete_vertices(obedit, v3d);
|
||||
else if (type == CURVE_SEGMENT) retval = curve_delete_segments(obedit, v3d, false);
|
||||
else BLI_assert(0);
|
||||
|
||||
if (retval == OPERATOR_FINISHED) {
|
||||
|
@ -5821,14 +5828,15 @@ void CURVE_OT_delete(wmOperatorType *ot)
|
|||
|
||||
static bool test_bezt_is_sel_any(const void *bezt_v, void *user_data)
|
||||
{
|
||||
Curve *cu = user_data;
|
||||
View3D *v3d = user_data;
|
||||
const BezTriple *bezt = bezt_v;
|
||||
return BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt);
|
||||
return BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt);
|
||||
}
|
||||
|
||||
static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Curve *cu = (Curve *)obedit->data;
|
||||
|
||||
{
|
||||
|
@ -5843,7 +5851,7 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
while (BLI_array_iter_span(
|
||||
nu->bezt, nu->pntsu,
|
||||
(nu->flagu & CU_NURB_CYCLIC) != 0, false,
|
||||
test_bezt_is_sel_any, cu,
|
||||
test_bezt_is_sel_any, v3d,
|
||||
span_step, &span_len))
|
||||
{
|
||||
BezTriple *bezt_prev = &nu->bezt[mod_i(span_step[0] - 1, nu->pntsu)];
|
||||
|
@ -5900,7 +5908,7 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
}
|
||||
|
||||
ed_curve_delete_selected(obedit);
|
||||
ed_curve_delete_selected(obedit, v3d);
|
||||
|
||||
{
|
||||
cu->actnu = cu->actvert = CU_ACT_NONE;
|
||||
|
@ -6173,7 +6181,7 @@ int join_curve_exec(bContext *C, wmOperator *op)
|
|||
static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Curve *cu = obedit->data;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
|
@ -6185,7 +6193,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
bezt = nu->bezt;
|
||||
a = nu->pntsu;
|
||||
while (a--) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) bezt->alfa = 0.0;
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) bezt->alfa = 0.0;
|
||||
bezt++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,14 +115,14 @@ static bool swap_selection_bpoint(BPoint *bp)
|
|||
return select_bpoint(bp, SELECT, SELECT, VISIBLE);
|
||||
}
|
||||
|
||||
bool ED_curve_nurb_select_check(Curve *cu, Nurb *nu)
|
||||
bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
|
||||
{
|
||||
if (nu->type == CU_BEZIER) {
|
||||
BezTriple *bezt;
|
||||
int i;
|
||||
|
||||
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ bool ED_curve_nurb_select_check(Curve *cu, Nurb *nu)
|
|||
return false;
|
||||
}
|
||||
|
||||
int ED_curve_nurb_select_count(Curve *cu, Nurb *nu)
|
||||
int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu)
|
||||
{
|
||||
int sel = 0;
|
||||
|
||||
|
@ -149,7 +149,7 @@ int ED_curve_nurb_select_count(Curve *cu, Nurb *nu)
|
|||
int i;
|
||||
|
||||
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
sel++;
|
||||
}
|
||||
}
|
||||
|
@ -216,12 +216,12 @@ void ED_curve_nurb_deselect_all(Nurb *nu)
|
|||
}
|
||||
}
|
||||
|
||||
bool ED_curve_select_check(Curve *cu, struct EditNurb *editnurb)
|
||||
bool ED_curve_select_check(View3D *v3d, struct EditNurb *editnurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
|
||||
for (nu = editnurb->nurbs.first; nu; nu = nu->next) {
|
||||
if (ED_curve_nurb_select_check(cu, nu)) {
|
||||
if (ED_curve_nurb_select_check(v3d, nu)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -459,6 +459,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
|
|||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
uint objects_len = 0;
|
||||
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||
|
||||
|
@ -468,7 +469,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
|
|||
Object *obedit = objects[ob_index];
|
||||
Curve *cu = obedit->data;
|
||||
|
||||
if (ED_curve_select_check(cu, cu->editnurb)) {
|
||||
if (ED_curve_select_check(v3d, cu->editnurb)) {
|
||||
action = SEL_DESELECT;
|
||||
break;
|
||||
}
|
||||
|
@ -487,7 +488,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
|
|||
ED_curve_deselect_all(cu->editnurb);
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
ED_curve_select_swap(cu->editnurb, (cu->drawflag & CU_HIDE_HANDLES) != 0);
|
||||
ED_curve_select_swap(cu->editnurb, (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -525,6 +526,7 @@ void CURVE_OT_select_all(wmOperatorType *ot)
|
|||
static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
uint objects_len = 0;
|
||||
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||
|
@ -537,7 +539,7 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
bool changed = false;
|
||||
|
||||
for (nu = nurbs->first; nu; nu = nu->next) {
|
||||
if (ED_curve_nurb_select_check(cu, nu)) {
|
||||
if (ED_curve_nurb_select_check(v3d, nu)) {
|
||||
ED_curve_nurb_select_all(nu);
|
||||
changed = true;
|
||||
}
|
||||
|
|
|
@ -60,15 +60,15 @@ bool ED_curve_editnurb_select_pick(struct bContext *C, const int mval[2], boo
|
|||
|
||||
struct Nurb *ED_curve_add_nurbs_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob);
|
||||
|
||||
bool ED_curve_nurb_select_check(struct Curve *cu, struct Nurb *nu);
|
||||
int ED_curve_nurb_select_count(struct Curve *cu, struct Nurb *nu);
|
||||
bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu);
|
||||
int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu);
|
||||
void ED_curve_nurb_select_all(struct Nurb *nu);
|
||||
void ED_curve_nurb_deselect_all(struct Nurb *nu);
|
||||
|
||||
int join_curve_exec(struct bContext *C, struct wmOperator *op);
|
||||
|
||||
/* editcurve_select.c */
|
||||
bool ED_curve_select_check(struct Curve *cu, struct EditNurb *editnurb);
|
||||
bool ED_curve_select_check(struct View3D *v3d, struct EditNurb *editnurb);
|
||||
void ED_curve_deselect_all(struct EditNurb *editnurb);
|
||||
void ED_curve_select_all(struct EditNurb *editnurb);
|
||||
void ED_curve_select_swap(struct EditNurb *editnurb, bool hide_handles);
|
||||
|
|
|
@ -129,12 +129,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
BMVert *eve;
|
||||
BMIter iter;
|
||||
Curve *cu;
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
BPoint *bp;
|
||||
|
@ -175,15 +175,13 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
|
|||
else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
|
||||
cu = obedit->data;
|
||||
|
||||
nu = editnurb->first;
|
||||
while (nu) {
|
||||
if (nu->type == CU_BEZIER) {
|
||||
bezt = nu->bezt;
|
||||
a = nu->pntsu;
|
||||
while (a--) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) {
|
||||
if (BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
|
||||
if (v1 == 0) v1 = nr;
|
||||
else if (v2 == 0) v2 = nr;
|
||||
else if (v3 == 0) v3 = nr;
|
||||
|
|
|
@ -186,6 +186,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
|
|||
static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
if (!ob)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -209,7 +210,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
if (nurbs) {
|
||||
for (nu = nurbs->first; nu; nu = nu->next) {
|
||||
if (ED_curve_nurb_select_check(ob->data, nu)) {
|
||||
if (ED_curve_nurb_select_check(v3d, nu)) {
|
||||
nu->mat_nr = ob->actcol - 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -337,7 +337,9 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
|
|||
V3D_OVERLAY_EDIT_FREESTYLE_FACE |
|
||||
V3D_OVERLAY_EDIT_EDGES |
|
||||
V3D_OVERLAY_EDIT_CREASES |
|
||||
V3D_OVERLAY_EDIT_BWEIGHTS;
|
||||
V3D_OVERLAY_EDIT_BWEIGHTS |
|
||||
V3D_OVERLAY_EDIT_CU_HANDLES |
|
||||
V3D_OVERLAY_EDIT_CU_NORMALS;
|
||||
|
||||
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
|
||||
|
||||
|
|
|
@ -305,7 +305,7 @@ void nurbs_foreachScreenVert(
|
|||
if (bezt->hide == 0) {
|
||||
float screen_co[2];
|
||||
|
||||
if (cu->drawflag & CU_HIDE_HANDLES) {
|
||||
if ((vc->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
|
||||
if (ED_view3d_project_float_object(vc->ar, bezt->vec[1], screen_co,
|
||||
V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) == V3D_PROJ_RET_OK)
|
||||
{
|
||||
|
|
|
@ -676,7 +676,7 @@ static void do_lasso_select_curve__doSelect(
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (cu->drawflag & CU_HIDE_HANDLES) {
|
||||
if ((data->vc->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
|
||||
/* can only be (beztindex == 0) here since handles are hidden */
|
||||
const bool is_select = bezt->f2 & SELECT;
|
||||
const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside);
|
||||
|
@ -1996,7 +1996,7 @@ static void do_nurbs_box_select__doSelect(
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (cu->drawflag & CU_HIDE_HANDLES) {
|
||||
if ((data->vc->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
|
||||
/* can only be (beztindex == 0) here since handles are hidden */
|
||||
const bool is_select = bezt->f2 & SELECT;
|
||||
const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside);
|
||||
|
@ -2920,7 +2920,7 @@ static void nurbscurve_circle_doSelect(
|
|||
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
|
||||
}
|
||||
else {
|
||||
if (cu->drawflag & CU_HIDE_HANDLES) {
|
||||
if ((data->vc->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
|
||||
/* can only be (beztindex == 0) here since handles are hidden */
|
||||
bezt->f1 = bezt->f2 = bezt->f3 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
|
||||
}
|
||||
|
|
|
@ -1660,7 +1660,8 @@ static void createTransCurveVerts(TransInfo *t)
|
|||
int a;
|
||||
int count = 0, countsel = 0;
|
||||
const bool is_prop_edit = (t->flag & T_PROP_EDIT) != 0;
|
||||
short hide_handles = (cu->drawflag & CU_HIDE_HANDLES);
|
||||
View3D *v3d = t->view;
|
||||
short hide_handles = (v3d != NULL) ? ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) : false;
|
||||
ListBase *nurbs;
|
||||
|
||||
/* to be sure */
|
||||
|
|
|
@ -904,7 +904,7 @@ int ED_transform_calc_gizmo_stats(
|
|||
* if handles are hidden then only check the center points.
|
||||
* If the center knot is selected then only use this as the center point.
|
||||
*/
|
||||
if (cu->drawflag & CU_HIDE_HANDLES) {
|
||||
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
|
||||
if (bezt->f2 & SELECT) {
|
||||
calc_tw_center(tbounds, bezt->vec[1]);
|
||||
totsel++;
|
||||
|
|
|
@ -835,7 +835,8 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
|
|||
}
|
||||
}
|
||||
else {
|
||||
const bool use_handle = (cu->drawflag & CU_HIDE_HANDLES) == 0;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
const bool use_handle = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) != 0;
|
||||
|
||||
for (nu = nurbs->first; nu; nu = nu->next) {
|
||||
/* only bezier has a normal */
|
||||
|
|
|
@ -278,11 +278,13 @@ enum {
|
|||
CU_AUTOSPACE = 1,
|
||||
};
|
||||
|
||||
#if 0 /* Moved to overlay options in 2.8 */
|
||||
/* Curve.drawflag */
|
||||
enum {
|
||||
CU_HIDE_HANDLES = 1 << 0,
|
||||
CU_HIDE_NORMALS = 1 << 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Curve.flag */
|
||||
enum {
|
||||
|
@ -443,8 +445,8 @@ typedef enum eBezTriple_KeyframeType {
|
|||
/* checks if the given BezTriple is selected */
|
||||
#define BEZT_ISSEL_ANY(bezt) \
|
||||
(((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT))
|
||||
#define BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt) \
|
||||
(((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZT_ISSEL_ANY(bezt))
|
||||
#define BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt) \
|
||||
((((v3d) != NULL) && ((v3d)->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) ? (bezt)->f2 & SELECT : BEZT_ISSEL_ANY(bezt))
|
||||
|
||||
#define BEZT_SEL_ALL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } ((void)0)
|
||||
#define BEZT_DESEL_ALL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } ((void)0)
|
||||
|
|
|
@ -448,6 +448,9 @@ enum {
|
|||
V3D_OVERLAY_EDIT_FACE_ANG = (1 << 17),
|
||||
V3D_OVERLAY_EDIT_FACE_AREA = (1 << 18),
|
||||
V3D_OVERLAY_EDIT_INDICES = (1 << 19),
|
||||
|
||||
V3D_OVERLAY_EDIT_CU_HANDLES = (1 << 20),
|
||||
V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21),
|
||||
};
|
||||
|
||||
/* View3DOverlay->arm_flag */
|
||||
|
|
|
@ -1383,16 +1383,6 @@ static void rna_def_curve(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
|
||||
rna_def_curve_splines(brna, prop);
|
||||
|
||||
prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES);
|
||||
RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode");
|
||||
RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS);
|
||||
RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode");
|
||||
RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL);
|
||||
|
||||
rna_def_path(brna, srna);
|
||||
|
||||
/* Number values */
|
||||
|
|
|
@ -2879,6 +2879,16 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_curve_handles", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_HANDLES);
|
||||
RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_curve_normals", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_NORMALS);
|
||||
RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "overlay.normals_length");
|
||||
RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
|
||||
|
|
Loading…
Reference in New Issue