[Bf-blender-cvs] [2cff9b4cb60] blender2.8: Curves: Move draw options to overlays
Clément Foucault
noreply at git.blender.org
Tue Sep 25 22:52:47 CEST 2018
Commit: 2cff9b4cb605047927fbb1c774fdafcfd2ab534e
Author: Clément Foucault
Date: Tue Sep 25 18:50:57 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB2cff9b4cb605047927fbb1c774fdafcfd2ab534e
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.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/blenloader/intern/versioning_280.c
M source/blender/draw/intern/draw_cache_impl_curve.c
M source/blender/draw/modes/edit_curve_mode.c
M source/blender/editors/curve/editcurve.c
M source/blender/editors/curve/editcurve_select.c
M source/blender/editors/include/ED_curve.h
M source/blender/editors/object/object_relations.c
M source/blender/editors/render/render_shading.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_iterators.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/editors/transform/transform_conversions.c
M source/blender/editors/transform/transform_gizmo_3d.c
M source/blender/editors/transform/transform_orientations.c
M source/blender/makesdna/DNA_curve_types.h
M source/blender/makesdna/DNA_view3d_types.h
M source/blender/makesrna/intern/rna_curve.c
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index cded9d613ec..cc961fe2ce0 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -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):
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index f292cc56f73..ffe7a682554 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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;
}
}
}
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index bad15dfe697..1f20babdcae 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -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;
diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c
index cdc9a9617b9..fb3f67e6d9f 100644
--- a/source/blender/draw/modes/edit_curve_mode.c
+++ b/source/blender/draw/modes/edit_curve_mode.c
@@ -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);
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index ff0fdbe8f2a..ec661c0e4fa 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -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;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list