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:
-rw-r--r--source/blender/blenkernel/BKE_curve.h1
-rw-r--r--source/blender/blenkernel/intern/curve.c29
-rw-r--r--source/blender/makesrna/intern/rna_curve.c21
3 files changed, 32 insertions, 19 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 9282f0ef29a..f0704741ebb 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -65,6 +65,7 @@ void make_local_curve( struct Curve *cu);
struct ListBase *curve_editnurbs(struct Curve *cu);
short curve_type( struct Curve *cu);
void test_curve_type( struct Object *ob);
+void update_curve_dimension( struct Curve *cu );
void tex_space_curve( struct Curve *cu);
int count_curveverts( struct ListBase *nurb);
int count_curveverts_without_handles( struct ListBase *nurb);
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)
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index cbac594a80f..1f52b0ac149 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -271,23 +271,10 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
ListBase *nurbs= BKE_curve_nurbs(cu);
Nurb *nu= nurbs->first;
- if(value==CU_3D) {
- cu->flag |= CU_3D;
- for( ; nu; nu= nu->next) {
- nu->flag &= ~CU_2D;
- }
- }
- else {
- cu->flag &= ~CU_3D;
- 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);
- }
- }
+ if(value==CU_3D) cu->flag |= CU_3D;
+ else cu->flag &= ~CU_3D;
+
+ update_curve_dimension(cu);
}
static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))