diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 18:30:37 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 18:30:37 +0400 |
commit | 5acde0d24c72a4ee2149d1105986f5f119231686 (patch) | |
tree | 2c6737694fc60b7151af7920f3986bd8ded2ba5f /source/blender/blenkernel/intern/curve.c | |
parent | c1c3d66079adb2e0ea7b7eb9bdb2997f37623591 (diff) |
Fix #29369: bpy.data.curves.new(name= "test" , type = 'SURFACE') does not create a surface
This issue it totally related on issue with changing object datablock.
For curves it used to guess object type from curve datablock based on
count of control points in V direction.
This quess fails in case when SurfCircle datablock is trying to be reused
by another surface object or as another sample empty surface databouck used
to be treated as curve.
Store type in Curve when creating new Curve datablock which is used in
this object type quessing function.
Note: Previously saved files wouldn't change behavior at all.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 8a6e8faf29a..358c63b4f9f 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -169,6 +169,7 @@ Curve *add_curve(const char *name, int type) cu->texflag= CU_AUTOSPACE; cu->smallcaps_scale= 0.75f; cu->twist_mode= CU_TWIST_MINIMUM; // XXX: this one seems to be the best one in most cases, at least for curve deform... + cu->type= type; cu->bb= unit_boundbox(); @@ -303,16 +304,23 @@ ListBase *curve_editnurbs(Curve *cu) short curve_type(Curve *cu) { Nurb *nu; + int type= cu->type; + if(cu->vfont) { return OB_FONT; } - for (nu= cu->nurb.first; nu; nu= nu->next) { - if(nu->pntsv>1) { - return OB_SURF; + + if(!cu->type) { + type= OB_CURVE; + + for (nu= cu->nurb.first; nu; nu= nu->next) { + if(nu->pntsv>1) { + type= OB_SURF; + } } } - - return OB_CURVE; + + return type; } void update_curve_dimension(Curve *cu) |