Todo item: linked curve objects behaves incorrect with modifiers
[blender-staging.git] / source / blender / editors / object / object_add.c
index fdf46ea19a717e98d14646eb7144b246b162b400..696d8bc2c6fa34a3cffd3cd690353804ef925bf8 100644 (file)
@@ -1036,9 +1036,7 @@ static EnumPropertyItem convert_target_items[]= {
 
 static void curvetomesh(Scene *scene, Object *ob) 
 {
-       Curve *cu= ob->data;
-       
-       if(cu->disp.first==0)
+       if(ob->disp.first==0)
                makeDispListCurveTypes(scene, ob, 0); /* force creation */
 
        nurbs_to_mesh(ob); /* also does users */
@@ -1188,7 +1186,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 
                        cu= newob->data;
 
-                       if (!cu->disp.first)
+                       if (!newob->disp.first)
                                makeDispListCurveTypes(scene, newob, 0);
 
                        newob->type= OB_CURVE;
@@ -1225,8 +1223,12 @@ static int convert_exec(bContext *C, wmOperator *op)
                        for(nu=cu->nurb.first; nu; nu=nu->next)
                                nu->charidx= 0;
 
-                       if(target == OB_MESH)
+                       if(target == OB_MESH) {
                                curvetomesh(scene, newob);
+
+                               /* meshes doesn't use displist */
+                               freedisplist(&newob->disp);
+                       }
                }
                else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
                        ob->flag |= OB_DONE;
@@ -1243,6 +1245,9 @@ static int convert_exec(bContext *C, wmOperator *op)
                                        newob->data= copy_curve(ob->data);
                                } else {
                                        newob= ob;
+
+                                       /* meshes doesn't use displist */
+                                       freedisplist(&newob->disp);
                                }
 
                                curvetomesh(scene, newob);