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>2010-12-06 20:20:22 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2010-12-06 20:20:22 +0300
commit14ec2d91228596adc466a898b97c4093f5694243 (patch)
tree4126f806a309aa2b3e8b81a5674be6afd4183787 /source/blender/editors/curve
parent9d636334e95cfbeb79692265a07ea5c2536627e0 (diff)
Curves CV animation
=================== Update fcurves RNA pathes after making changes to curve topology, so animation will no longer lost after edit and wouldn't lead to crash. Will be very useful for RotoBezier addon. Also NodeKeyIndex renamed to CVNodeIndex due to node is an entity from another module and better not used in others.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c303
1 files changed, 247 insertions, 56 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 2f87e1b4650..86cc4f2dd9d 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -40,6 +40,7 @@
#include "DNA_key_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_anim_types.h"
#include "MEM_guardedalloc.h"
@@ -58,6 +59,7 @@
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_report.h"
+#include "BKE_animsys.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -85,9 +87,11 @@ typedef struct {
/* Definitions needed for shape keys */
typedef struct {
- void *origNode;
- int index;
-} NodeKeyIndex;
+ void *orig_cv;
+ int key_index, nu_index, pt_index;
+ int switched;
+ Nurb *orig_nu;
+} CVKeyIndex;
void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus);
static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus);
@@ -271,17 +275,21 @@ void printknots(Object *obedit)
/* ********************* Shape keys *************** */
-static NodeKeyIndex *init_nodeKeyIndex(void *node, int index)
+static CVKeyIndex *init_cvKeyIndex(void *cv, int key_index, int nu_index, int pt_index, Nurb *orig_nu)
{
- NodeKeyIndex *nodeIndex = MEM_callocN(sizeof(NodeKeyIndex), "init_nodeKeyIndex");
+ CVKeyIndex *cvIndex = MEM_callocN(sizeof(CVKeyIndex), "init_cvKeyIndex");
- nodeIndex->origNode= node;
- nodeIndex->index= index;
+ cvIndex->orig_cv= cv;
+ cvIndex->key_index= key_index;
+ cvIndex->nu_index= nu_index;
+ cvIndex->pt_index= pt_index;
+ cvIndex->switched= 0;
+ cvIndex->orig_nu= orig_nu;
- return nodeIndex;
+ return cvIndex;
}
-static void free_nodeKeyIndex(NodeKeyIndex *pointIndex)
+static void free_cvKeyIndex(CVKeyIndex *pointIndex)
{
MEM_freeN(pointIndex);
}
@@ -293,7 +301,10 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
GHash *gh;
BezTriple *bezt, *origbezt;
BPoint *bp, *origbp;
- int a, keyindex= 0;
+ CVKeyIndex *keyIndex;
+ int a, key_index= 0, nu_index= 0, pt_index= 0;
+
+ if(editnurb->keyindex) return;
gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "editNurb keyIndex");
@@ -302,26 +313,33 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
a= orignu->pntsu;
bezt= nu->bezt;
origbezt= orignu->bezt;
+ pt_index= 0;
while (a--) {
- BLI_ghash_insert(gh, bezt, init_nodeKeyIndex(origbezt, keyindex));
- keyindex+= 12;
+ keyIndex= init_cvKeyIndex(origbezt, key_index, nu_index, pt_index, orignu);
+ BLI_ghash_insert(gh, bezt, keyIndex);
+ key_index+= 12;
bezt++;
origbezt++;
+ pt_index++;
}
} else {
a= orignu->pntsu * orignu->pntsv;
bp= nu->bp;
origbp= orignu->bp;
+ pt_index= 0;
while (a--) {
- BLI_ghash_insert(gh, bp, init_nodeKeyIndex(origbp, keyindex));
- keyindex+= 4;
+ keyIndex= init_cvKeyIndex(origbp, key_index, nu_index, pt_index, orignu);
+ BLI_ghash_insert(gh, bp, keyIndex);
+ key_index+= 4;
bp++;
origbp++;
+ pt_index++;
}
}
nu= nu->next;
orignu= orignu->next;
+ nu_index++;
}
editnurb->keyindex= gh;
@@ -332,64 +350,65 @@ static void free_editNurb_keyIndex(EditNurb *editnurb)
if (!editnurb->keyindex) {
return;
}
- BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
+ editnurb->keyindex= NULL;
}
-static NodeKeyIndex *getNodeKeyIndex(EditNurb *editnurb, void *node)
+static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
{
- return BLI_ghash_lookup(editnurb->keyindex, node);
+ return BLI_ghash_lookup(editnurb->keyindex, cv);
}
-static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, void *node)
+static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, BezTriple *bezt)
{
- NodeKeyIndex *index= getNodeKeyIndex(editnurb, node);
+ CVKeyIndex *index= getCVKeyIndex(editnurb, bezt);
if (!index) {
return NULL;
}
- return (BezTriple*)index->origNode;
+ return (BezTriple*)index->orig_cv;
}
-static BPoint *getKeyIndexOrig_bp(EditNurb *editnurb, void *node)
+static BPoint *getKeyIndexOrig_bp(EditNurb *editnurb, BPoint *bp)
{
- NodeKeyIndex *index= getNodeKeyIndex(editnurb, node);
+ CVKeyIndex *index= getCVKeyIndex(editnurb, bp);
if (!index) {
return NULL;
}
- return (BPoint*)index->origNode;
+ return (BPoint*)index->orig_cv;
}
-static int getKeyIndexOrig_index(EditNurb *editnurb, void *node)
+static int getKeyIndexOrig_keyIndex(EditNurb *editnurb, void *cv)
{
- NodeKeyIndex *index= getNodeKeyIndex(editnurb, node);
+ CVKeyIndex *index= getCVKeyIndex(editnurb, cv);
if (!index) {
return -1;
}
- return index->index;
+ return index->key_index;
}
-static void keyIndex_delNode(EditNurb *editnurb, void *node)
+static void keyIndex_delCV(EditNurb *editnurb, void *cv)
{
if (!editnurb->keyindex) {
return;
}
- BLI_ghash_remove(editnurb->keyindex, node, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, cv, NULL, (GHashValFreeFP)free_cvKeyIndex);
}
static void keyIndex_delBezt(EditNurb *editnurb, BezTriple *bezt)
{
- keyIndex_delNode(editnurb, bezt);
+ keyIndex_delCV(editnurb, bezt);
}
static void keyIndex_delBP(EditNurb *editnurb, BPoint *bp)
{
- keyIndex_delNode(editnurb, bp);
+ keyIndex_delCV(editnurb, bp);
}
static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
@@ -405,7 +424,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
a= nu->pntsu;
while (a--) {
- BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)free_cvKeyIndex);
++bezt;
}
} else {
@@ -413,7 +432,7 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
a= nu->pntsu * nu->pntsv;
while (a--) {
- BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_remove(editnurb->keyindex, bp, NULL, (GHashValFreeFP)free_cvKeyIndex);
++bp;
}
}
@@ -430,11 +449,11 @@ static void keyIndex_delNurbList(EditNurb *editnurb, ListBase *nubase)
}
}
-static void keyIndex_updateNode(EditNurb *editnurb, char *node,
- char *newnode, int count, int size, int search)
+static void keyIndex_updateCV(EditNurb *editnurb, char *cv,
+ char *newcv, int count, int size, int search)
{
int i;
- NodeKeyIndex *index;
+ CVKeyIndex *index;
if (editnurb->keyindex == NULL) {
/* No shape keys - updating not needed */
@@ -443,34 +462,34 @@ static void keyIndex_updateNode(EditNurb *editnurb, char *node,
for (i = 0; i < count; i++) {
for (;;) {
- index= getNodeKeyIndex(editnurb, node);
+ index= getCVKeyIndex(editnurb, cv);
if (!search || index) {
break;
}
- node += size;
+ cv += size;
}
- BLI_ghash_remove(editnurb->keyindex, node, NULL, NULL);
+ BLI_ghash_remove(editnurb->keyindex, cv, NULL, NULL);
if (index) {
- BLI_ghash_insert(editnurb->keyindex, newnode, index);
+ BLI_ghash_insert(editnurb->keyindex, newcv, index);
}
- newnode += size;
- node += size;
+ newcv += size;
+ cv += size;
}
}
static void keyIndex_updateBezt(EditNurb *editnurb, BezTriple *bezt,
BezTriple *newbezt, int count, int search)
{
- keyIndex_updateNode(editnurb, (char*)bezt, (char*)newbezt, count, sizeof(BezTriple), search);
+ keyIndex_updateCV(editnurb, (char*)bezt, (char*)newbezt, count, sizeof(BezTriple), search);
}
static void keyIndex_updateBP(EditNurb *editnurb, BPoint *bp,
BPoint *newbp, int count, int search)
{
- keyIndex_updateNode(editnurb, (char*)bp, (char*)newbp, count, sizeof(BPoint), search);
+ keyIndex_updateCV(editnurb, (char*)bp, (char*)newbp, count, sizeof(BPoint), search);
}
static void keyIndex_updateNurb(EditNurb *editnurb, Nurb *nu, Nurb *newnu)
@@ -484,8 +503,8 @@ static void keyIndex_updateNurb(EditNurb *editnurb, Nurb *nu, Nurb *newnu)
static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
{
- NodeKeyIndex *index1= getNodeKeyIndex(editnurb, a);
- NodeKeyIndex *index2= getNodeKeyIndex(editnurb, b);
+ CVKeyIndex *index1= getCVKeyIndex(editnurb, a);
+ CVKeyIndex *index2= getCVKeyIndex(editnurb, b);
BLI_ghash_remove(editnurb->keyindex, a, NULL, NULL);
BLI_ghash_remove(editnurb->keyindex, b, NULL, NULL);
@@ -497,6 +516,7 @@ static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
{
int a;
+ CVKeyIndex *index1, *index2;
if (nu->bezt) {
BezTriple *bezt1, *bezt2;
@@ -511,8 +531,15 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
a/=2;
while (a--) {
+ index1= getCVKeyIndex(editnurb, bezt1);
+ index2= getCVKeyIndex(editnurb, bezt2);
+
+ if(index1) index1->switched= !index1->switched;
+
if (bezt1 != bezt2) {
keyIndex_swap(editnurb, bezt1, bezt2);
+
+ if(index2) index2->switched= !index2->switched;
}
bezt1++;
@@ -527,7 +554,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
bp2= bp1+(a-1);
a/= 2;
while(bp1!=bp2 && a>0) {
+ index1= getCVKeyIndex(editnurb, bp1);
+ index2= getCVKeyIndex(editnurb, bp2);
+
+ if(index1) index1->switched= !index1->switched;
+
if (bp1 != bp2) {
+ if(index2) index2->switched= !index2->switched;
+
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -546,7 +580,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
a/= 2;
while(bp1!=bp2 && a>0) {
+ index1= getCVKeyIndex(editnurb, bp1);
+ index2= getCVKeyIndex(editnurb, bp2);
+
+ if(index1) index1->switched= !index1->switched;
+
if (bp1 != bp2) {
+ if(index2) index2->switched= !index2->switched;
+
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -619,7 +660,8 @@ static void keyData_switchDirectionNurb(Curve *cu, Nurb *nu)
}
keyIndex_switchDirection(editnurb, nu);
- switch_keys_direction(cu, nu);
+ if(cu->key)
+ switch_keys_direction(cu, nu);
}
static GHash *dupli_keyIndexHash(GHash *keyindex)
@@ -632,13 +674,13 @@ static GHash *dupli_keyIndexHash(GHash *keyindex)
for(hashIter = BLI_ghashIterator_new(keyindex);
!BLI_ghashIterator_isDone(hashIter);
BLI_ghashIterator_step(hashIter)) {
- void *node = BLI_ghashIterator_getKey(hashIter);
- NodeKeyIndex *index = BLI_ghashIterator_getValue(hashIter);
- NodeKeyIndex *newIndex = MEM_callocN(sizeof(NodeKeyIndex), "dupli_keyIndexHash index");
+ void *cv = BLI_ghashIterator_getKey(hashIter);
+ CVKeyIndex *index = BLI_ghashIterator_getValue(hashIter);
+ CVKeyIndex *newIndex = MEM_callocN(sizeof(CVKeyIndex), "dupli_keyIndexHash index");
- memcpy(newIndex, index, sizeof(NodeKeyIndex));
+ memcpy(newIndex, index, sizeof(CVKeyIndex));
- BLI_ghash_insert(gh, node, newIndex);
+ BLI_ghash_insert(gh, cv, newIndex);
}
BLI_ghashIterator_free(hashIter);
@@ -881,7 +923,7 @@ static void calc_shapeKeys(Object *obedit)
a= nu->pntsu;
while(a--) {
- index= getKeyIndexOrig_index(editnurb, bezt);
+ index= getKeyIndexOrig_keyIndex(editnurb, bezt);
if (index >= 0) {
curofp= ofp + index;
@@ -919,7 +961,7 @@ static void calc_shapeKeys(Object *obedit)
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
while(a--) {
- index= getKeyIndexOrig_index(editnurb, bp);
+ index= getKeyIndexOrig_keyIndex(editnurb, bp);
if (index >= 0) {
curofp= ofp + index;
@@ -962,6 +1004,121 @@ static void calc_shapeKeys(Object *obedit)
}
}
+/* ********************* Amimation data *************** */
+
+static int curve_is_animated(Object *ob)
+{
+ Curve *cu= (Curve*)ob->data;
+ AnimData *ad= BKE_animdata_from_id(&cu->id);
+
+ return ad && ad->action;
+}
+
+static void fcurve_path_rename(char *orig_rna_path, char *rna_path, ListBase *orig_curves, ListBase *curves)
+{
+ FCurve *fcu, *nfcu, *nextfcu;
+ int len= strlen(orig_rna_path);
+
+ fcu= orig_curves->first;
+ while (fcu) {
+ nextfcu= fcu->next;
+ if(!strncmp(fcu->rna_path, orig_rna_path, len)) {
+ char *spath, *suffix= fcu->rna_path + len;
+ nfcu= copy_fcurve(fcu);
+ spath= nfcu->rna_path;
+ nfcu->rna_path= BLI_sprintfN("%s%s", rna_path, suffix);
+ BLI_addtail(curves, nfcu);
+
+ BLI_remlink(orig_curves, fcu);
+ free_fcurve(fcu);
+
+ MEM_freeN(spath);
+ }
+ fcu= nextfcu;
+ }
+}
+
+void ED_curve_updateAnimPaths(Object *obedit)
+{
+ int nu_index= 0, a, pt_index;
+ Curve *cu= (Curve*)obedit->data;
+ EditNurb *editnurb= cu->editnurb;
+ Nurb *nu= editnurb->nurbs.first;
+ CVKeyIndex *keyIndex;
+ char rna_path[64], orig_rna_path[64];
+ ListBase orig_curves= {0, 0};
+ ListBase curves= {0, 0};
+ AnimData *ad= BKE_animdata_from_id(&cu->id);
+
+ if(!curve_is_animated(obedit)) return;
+
+ copy_fcurves(&orig_curves, &editnurb->fcurves);
+
+ while(nu) {
+ if(nu->bezt) {
+ BezTriple *bezt= nu->bezt;
+ a= nu->pntsu;
+ pt_index= 0;
+
+ while (a--) {
+ keyIndex= getCVKeyIndex(editnurb, bezt);
+ if(keyIndex) {
+ sprintf(rna_path, "splines[%d].bezier_points[%d]", nu_index, pt_index);
+ sprintf(orig_rna_path, "splines[%d].bezier_points[%d]", keyIndex->nu_index, keyIndex->pt_index);
+
+ if(keyIndex->switched) {
+ char handle_path[64], orig_handle_path[64];
+ sprintf(orig_handle_path, "%s.handle_left", orig_rna_path);
+ sprintf(handle_path, "%s.handle_right", rna_path);
+ fcurve_path_rename(orig_handle_path, handle_path, &orig_curves, &curves);
+
+ sprintf(orig_handle_path, "%s.handle_right", orig_rna_path);
+ sprintf(handle_path, "%s.handle_left", rna_path);
+ fcurve_path_rename(orig_handle_path, handle_path, &orig_curves, &curves);
+ }
+
+ fcurve_path_rename(orig_rna_path, rna_path, &orig_curves, &curves);
+ }
+
+ bezt++;
+ pt_index++;
+ }
+ } else {
+ BPoint *bp= nu->bp;
+ a= nu->pntsu * nu->pntsv;
+ pt_index= 0;
+
+ while (a--) {
+ keyIndex= getCVKeyIndex(editnurb, bp);
+ if(keyIndex) {
+ sprintf(rna_path, "splines[%d].points[%d]", nu_index, pt_index);
+ sprintf(orig_rna_path, "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index);
+ fcurve_path_rename(orig_rna_path, rna_path, &orig_curves, &curves);
+ }
+
+ bp++;
+ pt_index++;
+ }
+ }
+ nu= nu->next;
+ nu_index++;
+ }
+
+ nu_index= 0;
+ while(nu) {
+ if(keyIndex) {
+ sprintf(rna_path, "splines[%d]", nu_index);
+ sprintf(orig_rna_path, "splines[%d]", keyIndex->nu_index);
+ fcurve_path_rename(orig_rna_path, rna_path, &ad->action->curves, &curves);
+ }
+ nu_index++;
+ }
+
+ free_fcurves(&ad->action->curves);
+ free_fcurves(&orig_curves);
+ ad->action->curves= curves;
+}
+
/* ********************* LOAD and MAKE *************** */
/* load editNurb in object */
@@ -990,6 +1147,7 @@ void load_editNurb(Object *obedit)
cu->nurb= newnurb;
calc_shapeKeys(obedit);
+ ED_curve_updateAnimPaths(obedit);
freeNurblist(&oldnurb);
}
@@ -1004,19 +1162,26 @@ void make_editNurb(Object *obedit)
EditNurb *editnurb= cu->editnurb;
Nurb *nu, *newnu, *nu_act= NULL;
KeyBlock *actkey;
+ int is_anim;
if(obedit==NULL) return;
set_actNurb(obedit, NULL);
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
- actkey = ob_get_keyblock(obedit);
+ actkey= ob_get_keyblock(obedit);
+ is_anim= curve_is_animated(obedit);
+
if(actkey) {
// XXX strcpy(G.editModeTitleExtra, "(Key) ");
undo_editmode_clear();
key_to_curve(actkey, cu, &cu->nurb);
}
+ if (is_anim) {
+ undo_editmode_clear();
+ }
+
if(editnurb) {
freeNurblist(&editnurb->nurbs);
free_editNurb_keyIndex(editnurb);
@@ -1046,6 +1211,13 @@ void make_editNurb(Object *obedit)
editnurb->shapenr= obedit->shapenr;
init_editNurb_keyIndex(editnurb, &cu->nurb);
}
+
+ if(is_anim) {
+ AnimData *ad= BKE_animdata_from_id(&cu->id);
+
+ init_editNurb_keyIndex(editnurb, &cu->nurb);
+ copy_fcurves(&editnurb->fcurves, &ad->action->curves);
+ }
}
}
@@ -1054,6 +1226,7 @@ void free_curve_editNurb (Curve *cu)
if(cu->editnurb) {
freeNurblist(&cu->editnurb->nurbs);
free_editNurb_keyIndex(cu->editnurb);
+ free_fcurves(&cu->editnurb->fcurves);
MEM_freeN(cu->editnurb);
cu->editnurb= NULL;
}
@@ -1475,6 +1648,8 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu= next;
}
+ ED_curve_updateAnimPaths(obedit);
+
return OPERATOR_FINISHED;
}
@@ -1785,6 +1960,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
keyData_switchDirectionNurb(cu, nu);
}
+ ED_curve_updateAnimPaths(obedit);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -3007,6 +3183,8 @@ static int subdivide_exec(bContext *C, wmOperator *op)
subdividenurb(obedit, number_cuts);
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -3309,6 +3487,8 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
}
if(changed) {
+ ED_curve_updateAnimPaths(obedit);
+
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -3889,6 +4069,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -4094,6 +4276,8 @@ static int spin_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -4249,6 +4433,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
test2DNurb(nu);
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -4320,6 +4506,8 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
}
else {
if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
}
@@ -5249,6 +5437,7 @@ static int delete_exec(bContext *C, wmOperator *op)
} else {
keyIndex_delNurbList(editnurb, nubase);
freeNurblist(nubase);
+ ED_curve_updateAnimPaths(obedit);
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5520,6 +5709,8 @@ static int delete_exec(bContext *C, wmOperator *op)
freeNurblist(nubase);
}
+ ED_curve_updateAnimPaths(obedit);
+
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
@@ -6517,7 +6708,7 @@ static void undoCurve_to_editCurve(void *ucu, void *cue)
freeNurblist(editbase);
if (undoCurve->undoIndex) {
- BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)free_cvKeyIndex);
editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex);
}
@@ -6582,7 +6773,7 @@ static void free_undoCurve(void *ucv)
freeNurblist(&undoCurve->nubase);
if (undoCurve->undoIndex) {
- BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)free_nodeKeyIndex);
+ BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)free_cvKeyIndex);
}
MEM_freeN(undoCurve);