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>2011-11-03 20:16:19 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-03 20:16:19 +0400
commitb99f6e3d082b1b47591cdae1d2f3b78a75dd719b (patch)
treeff5e76ae5c12f071a86496b161df50655a925c73 /source/blender/blenkernel/intern/curve.c
parent665f602f152984f5a6f4ea05a2a90382acbf700a (diff)
Fix #29005: Bezier/Surface Datablock switching bug?
This commit updates curve datablock to respect curve dimension flag when setting datablock for curve. Not ideal but this makes behavior quite expected, avoids big changes in curves core stuff which depends on object type and prevents restrictions on changing data datablock which works in general cases.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 5d2180fe702..adc08f5cd9f 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -315,9 +315,34 @@ short curve_type(Curve *cu)
return OB_CURVE;
}
+void update_curve_dimension(Curve *cu)
+{
+ ListBase *nurbs= BKE_curve_nurbs(cu);
+ Nurb *nu= nurbs->first;
+
+ if(cu->flag&CU_3D) {
+ for( ; nu; nu= nu->next) {
+ nu->flag &= ~CU_2D;
+ }
+ }
+ else {
+ for( ; nu; nu= nu->next) {
+ nu->flag |= CU_2D;
+ test2DNurb(nu);
+
+ /* since the handles are moved they need to be auto-located again */
+ if(nu->type == CU_BEZIER)
+ calchandlesNurb(nu);
+ }
+ }
+}
+
void test_curve_type(Object *ob)
-{
- ob->type = curve_type(ob->data);
+{
+ ob->type= curve_type(ob->data);
+
+ if(ob->type==OB_CURVE)
+ update_curve_dimension((Curve *)ob->data);
}
void tex_space_curve(Curve *cu)