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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-08-01 08:56:20 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-08-01 10:30:41 +0400
commit2f2bf513e97a3955f3d98582bf7e837ca44b8009 (patch)
treef90f0bf6e6528e9698d0de12bcfd9bb21224e7ca /source/blender/editors/curve
parent3e607f61b5804770f6802d33f0128a2c6fa9ff8e (diff)
Revert "Fix T41226: Wrong Undo on curves and hooks"
This reverts commit e042c8428f8c0c0a72cdd23d2c058c20ab5745ed. Proper fix will come later, or be declared a TODO.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c59
1 files changed, 16 insertions, 43 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4db22154e68..b0371b8dd6c 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1165,7 +1165,7 @@ int ED_curve_updateAnimPaths(Curve *cu)
/* ********************* LOAD and MAKE *************** */
-static int *initialize_index_map(Object *obedit, int *r_old_totvert, bool reverse)
+static int *initialize_index_map(Object *obedit, int *r_old_totvert)
{
Curve *curve = (Curve *) obedit->data;
EditNurb *editnurb = curve->editnurb;
@@ -1200,29 +1200,15 @@ static int *initialize_index_map(Object *obedit, int *r_old_totvert, bool revers
while (a--) {
keyIndex = getCVKeyIndex(editnurb, bezt);
if (keyIndex) {
- if (reverse) {
- if (keyIndex->switched) {
- old_to_new_map[vertex_index] = keyIndex->vertex_index + 2;
- old_to_new_map[vertex_index + 1] = keyIndex->vertex_index + 1;
- old_to_new_map[vertex_index + 2] = keyIndex->vertex_index;
- }
- else {
- old_to_new_map[vertex_index] = keyIndex->vertex_index;
- old_to_new_map[vertex_index + 1] = keyIndex->vertex_index + 1;
- old_to_new_map[vertex_index + 2] = keyIndex->vertex_index + 2;
- }
+ if (keyIndex->switched) {
+ old_to_new_map[keyIndex->vertex_index] = vertex_index + 2;
+ old_to_new_map[keyIndex->vertex_index + 1] = vertex_index + 1;
+ old_to_new_map[keyIndex->vertex_index + 2] = vertex_index;
}
else {
- if (keyIndex->switched) {
- old_to_new_map[keyIndex->vertex_index] = vertex_index + 2;
- old_to_new_map[keyIndex->vertex_index + 1] = vertex_index + 1;
- old_to_new_map[keyIndex->vertex_index + 2] = vertex_index;
- }
- else {
- old_to_new_map[keyIndex->vertex_index] = vertex_index;
- old_to_new_map[keyIndex->vertex_index + 1] = vertex_index + 1;
- old_to_new_map[keyIndex->vertex_index + 2] = vertex_index + 2;
- }
+ old_to_new_map[keyIndex->vertex_index] = vertex_index;
+ old_to_new_map[keyIndex->vertex_index + 1] = vertex_index + 1;
+ old_to_new_map[keyIndex->vertex_index + 2] = vertex_index + 2;
}
}
vertex_index += 3;
@@ -1236,12 +1222,7 @@ static int *initialize_index_map(Object *obedit, int *r_old_totvert, bool revers
while (a--) {
keyIndex = getCVKeyIndex(editnurb, bp);
if (keyIndex) {
- if (reverse) {
- old_to_new_map[vertex_index] = keyIndex->vertex_index;
- }
- else {
- old_to_new_map[keyIndex->vertex_index] = vertex_index;
- }
+ old_to_new_map[keyIndex->vertex_index] = vertex_index;
}
vertex_index++;
bp++;
@@ -1253,7 +1234,7 @@ static int *initialize_index_map(Object *obedit, int *r_old_totvert, bool revers
return old_to_new_map;
}
-static void remap_hooks_and_vertex_parents(Object *obedit, bool reverse)
+static void remap_hooks_and_vertex_parents(Object *obedit)
{
Object *object;
Curve *curve = (Curve *) obedit->data;
@@ -1268,9 +1249,7 @@ static void remap_hooks_and_vertex_parents(Object *obedit, bool reverse)
ELEM(object->partype, PARVERT1, PARVERT3))
{
if (old_to_new_map == NULL) {
- old_to_new_map = initialize_index_map(obedit,
- &old_totvert,
- reverse);
+ old_to_new_map = initialize_index_map(obedit, &old_totvert);
}
if (object->par1 < old_totvert) {
@@ -1299,9 +1278,7 @@ static void remap_hooks_and_vertex_parents(Object *obedit, bool reverse)
int i, j;
if (old_to_new_map == NULL) {
- old_to_new_map = initialize_index_map(obedit,
- &old_totvert,
- reverse);
+ old_to_new_map = initialize_index_map(obedit, &old_totvert);
}
for (i = j = 0; i < hmd->totindex; i++) {
@@ -1338,6 +1315,8 @@ void load_editNurb(Object *obedit)
Nurb *nu, *newnu;
ListBase newnurb = {NULL, NULL}, oldnurb = cu->nurb;
+ remap_hooks_and_vertex_parents(obedit);
+
for (nu = editnurb->first; nu; nu = nu->next) {
newnu = BKE_nurb_duplicate(nu);
BLI_addtail(&newnurb, newnu);
@@ -6892,9 +6871,8 @@ void CURVE_OT_tilt_clear(wmOperatorType *ot)
/****************** undo for curves ****************/
-static void undoCurve_to_editCurve(void *ucu, void *edata, void *cu_v)
+static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
{
- Object *obedit = (Object *) edata;
Curve *cu = cu_v;
UndoCurve *undoCurve = ucu;
ListBase *undobase = &undoCurve->nubase;
@@ -6903,8 +6881,6 @@ static void undoCurve_to_editCurve(void *ucu, void *edata, void *cu_v)
EditNurb *editnurb = cu->editnurb;
AnimData *ad = BKE_animdata_from_id(&cu->id);
- remap_hooks_and_vertex_parents(obedit, true);
-
BKE_nurbList_free(editbase);
if (undoCurve->undoIndex) {
@@ -6938,9 +6914,8 @@ static void undoCurve_to_editCurve(void *ucu, void *edata, void *cu_v)
ED_curve_updateAnimPaths(cu);
}
-static void *editCurve_to_undoCurve(void *edata, void *cu_v)
+static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
{
- Object *obedit = (Object *) edata;
Curve *cu = cu_v;
ListBase *nubase = BKE_curve_editNurbs_get(cu);
UndoCurve *undoCurve;
@@ -6976,8 +6951,6 @@ static void *editCurve_to_undoCurve(void *edata, void *cu_v)
undoCurve->actvert = cu->actvert;
undoCurve->actnu = cu->actnu;
- remap_hooks_and_vertex_parents(obedit, false);
-
return undoCurve;
}