[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29934] branches/nurbs25/source/blender/ makesrna/intern/rna_curve.c: Recalculate knots for nurbs when nurb' s flag was changes with RNA

Sergey Sharybin g.ulairi at gmail.com
Sun Jul 4 16:36:59 CEST 2010


Revision: 29934
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29934
Author:   nazgul
Date:     2010-07-04 16:36:59 +0200 (Sun, 04 Jul 2010)

Log Message:
-----------
Recalculate knots for nurbs when nurb's flag was changes with RNA
Without this curve/surface could dissaper after toggling beizer/endpoints flag

Modified Paths:
--------------
    branches/nurbs25/source/blender/makesrna/intern/rna_curve.c

Modified: branches/nurbs25/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/nurbs25/source/blender/makesrna/intern/rna_curve.c	2010-07-04 13:57:34 UTC (rev 29933)
+++ branches/nurbs25/source/blender/makesrna/intern/rna_curve.c	2010-07-04 14:36:59 UTC (rev 29934)
@@ -302,16 +302,28 @@
 	BLI_strncpy(cu->str, value, len+1);
 }
 
-static void rna_Nurb_update_handle_data(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	Nurb *nu= (Nurb*)ptr->data;
 
-	if(nu->type == CU_BEZIER)
+	if(nu->type == CU_BEZIER) {
 		calchandlesNurb(nu);
+	} else {
+		makeknots(nu, 1, nu->flagu>>1);
+	}
 
 	rna_Curve_update_data(bmain, scene, ptr);
 }
 
+static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+	Nurb *nu= (Nurb*)ptr->data;
+
+	makeknots(nu, 2, nu->flagu>>1);
+
+	rna_Curve_update_data(bmain, scene, ptr);
+}
+
 static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	Nurb *nu= (Nurb*)ptr->data;
@@ -993,12 +1005,12 @@
 	prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction.");
-	RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */
+	RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
 
 	prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction.");
-	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+	RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
 
 
 	/* Note, endpoint and bezier flags should never be on at the same time! */





More information about the Bf-blender-cvs mailing list