Revision: 31252
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31252
Author:   nazgul
Date:     2010-08-11 17:40:55 +0200 (Wed, 11 Aug 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

Merge rev29934 from nurbs25 branch

Revision Links:
--------------
    
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29934

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

Modified: branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c
===================================================================
--- branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c     
2010-08-11 15:40:46 UTC (rev 31251)
+++ branches/nurbs-merge/source/blender/makesrna/intern/rna_curve.c     
2010-08-11 15:40:55 UTC (rev 31252)
@@ -399,16 +399,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;
@@ -1354,12 +1366,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! 
*/


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to