Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Mackay <mackay.ka@gmail.com>2014-01-27 08:18:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-27 08:21:04 +0400
commitfbc7ab30ff025ad3db59a73e2901883986e2e81e (patch)
tree3cbb2d7d4e6749d9216a73cbc45b323f03bd381f /source/blender/editors/space_view3d
parentf91368d82216497482a011e6b0987d3a5cdac951 (diff)
Curves: save active point to file
Changed curve active point from pointer to index. Allows curve active point to be saved to file and retained between modes for free. Also some small optimisations by removing pointer look up code. - Made active point access functions into BKE API calls. - Fixes operators where curve de-selection resulted in unsel-active point. - Split curve delete into 2 functions
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c18
2 files changed, 14 insertions, 19 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 05583f90ba3..0caf679d775 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -1854,7 +1854,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
if (bp->hide == 0) {
/* check for active BPoint and ensure selected */
if ((bp == actbp) && (bp->f1 & SELECT)) {
- UI_ThemeColor(TH_LASTSEL_POINT);
+ UI_ThemeColor(TH_ACTIVE_VERT);
bglVertex3fv(dl ? co : bp->vec);
UI_ThemeColor(color);
}
@@ -5358,7 +5358,7 @@ static void drawhandlesN_active(Nurb *nu)
glLineWidth(1);
}
-static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, void *lastsel)
+static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, const void *vert)
{
BezTriple *bezt;
BPoint *bp;
@@ -5383,8 +5383,8 @@ static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, void *
a = nu->pntsu;
while (a--) {
if (bezt->hide == 0) {
- if (sel == 1 && bezt == lastsel) {
- UI_ThemeColor(TH_LASTSEL_POINT);
+ if (sel == 1 && bezt == vert) {
+ UI_ThemeColor(TH_ACTIVE_VERT);
bglVertex3fv(bezt->vec[1]);
if (!hide_handles) {
@@ -5411,8 +5411,8 @@ static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, void *
a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->hide == 0) {
- if (bp == lastsel) {
- UI_ThemeColor(TH_LASTSEL_POINT);
+ if (bp == vert) {
+ UI_ThemeColor(TH_ACTIVE_VERT);
bglVertex3fv(bp->vec);
UI_ThemeColor(color);
}
@@ -5621,6 +5621,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
Curve *cu = ob->data;
Nurb *nu;
BevList *bl;
+ const void *vert = BKE_curve_vert_active_get(cu);
const bool hide_handles = (cu->drawflag & CU_HIDE_HANDLES) != 0;
int index;
unsigned char wire_col[3];
@@ -5700,7 +5701,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
for (nu = nurb; nu; nu = nu->next) {
- drawvertsN(nu, 1, hide_handles, cu->lastsel);
+ drawvertsN(nu, 1, hide_handles, vert);
}
if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index d18fb452022..8dfb0e86ac2 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -62,6 +62,7 @@
#include "BKE_armature.h"
#include "BKE_context.h"
+#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
@@ -537,7 +538,6 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
if (BLI_lasso_is_point_inside(data->mcords, data->moves, screen_co[0], screen_co[1], IS_CLIPPED)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
- if (bp == cu->lastsel && !(bp->f1 & SELECT)) cu->lastsel = NULL;
}
else {
if (cu->drawflag & CU_HIDE_HANDLES) {
@@ -555,8 +555,6 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
}
}
-
- if (bezt == cu->lastsel && !(bezt->f2 & SELECT)) cu->lastsel = NULL;
}
}
}
@@ -571,10 +569,11 @@ static void do_lasso_select_curve(ViewContext *vc, const int mcords[][2], short
view3d_userdata_lassoselect_init(&data, vc, &rect, mcords, moves, select);
if (extend == false && select)
- CU_deselect_all(vc->obedit);
+ ED_curve_deselect_all(vc->obedit->data);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, do_lasso_select_curve__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ BKE_curve_nurb_vert_active_validate(vc->obedit->data);
}
static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, const float screen_co[2])
@@ -1710,7 +1709,6 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
if (BLI_rctf_isect_pt_v(data->rect_fl, screen_co)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
- if (bp == cu->lastsel && !(bp->f1 & SELECT)) cu->lastsel = NULL;
}
else {
if (cu->drawflag & CU_HIDE_HANDLES) {
@@ -1728,8 +1726,6 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
}
}
-
- if (bezt == cu->lastsel && !(bezt->f2 & SELECT)) cu->lastsel = NULL;
}
}
}
@@ -1740,10 +1736,11 @@ static int do_nurbs_box_select(ViewContext *vc, rcti *rect, bool select, bool ex
view3d_userdata_boxselect_init(&data, vc, rect, select);
if (extend == false && select)
- CU_deselect_all(vc->obedit);
+ ED_curve_deselect_all(vc->obedit->data);
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, do_nurbs_box_select__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ BKE_curve_nurb_vert_active_validate(vc->obedit->data);
return OPERATOR_FINISHED;
}
@@ -2474,8 +2471,6 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
-
- if (bp == cu->lastsel && !(bp->f1 & SELECT)) cu->lastsel = NULL;
}
else {
if (cu->drawflag & CU_HIDE_HANDLES) {
@@ -2493,8 +2488,6 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint
bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
}
}
-
- if (bezt == cu->lastsel && !(bezt->f2 & SELECT)) cu->lastsel = NULL;
}
}
}
@@ -2506,6 +2499,7 @@ static void nurbscurve_circle_select(ViewContext *vc, const bool select, const i
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
nurbs_foreachScreenVert(vc, nurbscurve_circle_doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ BKE_curve_nurb_vert_active_validate(vc->obedit->data);
}