Revision: 15350
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15350
Author:   campbellbarton
Date:     2008-06-25 15:21:38 +0200 (Wed, 25 Jun 2008)

Log Message:
-----------
added r/w access to nurb curves orderU for migius

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/CurNurb.c
    trunk/blender/source/blender/python/api2_2x/doc/Curve.py

Modified: trunk/blender/source/blender/python/api2_2x/CurNurb.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/CurNurb.c       2008-06-25 
01:04:21 UTC (rev 15349)
+++ trunk/blender/source/blender/python/api2_2x/CurNurb.c       2008-06-25 
13:21:38 UTC (rev 15350)
@@ -53,6 +53,8 @@
 static PyObject *CurNurb_getFlagV( BPy_CurNurb * self );
 static PyObject *CurNurb_oldsetFlagV( BPy_CurNurb * self, PyObject * args );
 static int CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args );
+static PyObject *CurNurb_getOrderU( BPy_CurNurb * self );
+static int CurNurb_setOrderU( BPy_CurNurb * self, PyObject * args );
 static PyObject *CurNurb_getType( BPy_CurNurb * self );
 static PyObject *CurNurb_oldsetType( BPy_CurNurb * self, PyObject * args );
 static int CurNurb_setType( BPy_CurNurb * self, PyObject * args );
@@ -176,6 +178,9 @@
         (getter)CurNurb_getFlagV, (setter)CurNurb_setFlagV,
         "The knot type in the V direction",
         NULL},
+       {"orderU",
+        (getter)CurNurb_getOrderU, (setter)CurNurb_setOrderU,
+        "order setting for U direction", NULL},
        {"type",
         (getter)CurNurb_getType, (setter)CurNurb_setType,
         "The curve type (poly: bezier, or NURBS)",
@@ -710,6 +715,35 @@
        return 0;
 }
 
+static PyObject *CurNurb_getOrderU( BPy_CurNurb * self )
+{
+       return PyInt_FromLong( ( long ) self->nurb->orderu );
+}
+
+static int CurNurb_setOrderU( BPy_CurNurb * self, PyObject * args )
+{
+       int order;
+
+       args = PyNumber_Int( args );
+       if( !args )
+               return EXPP_ReturnIntError( PyExc_TypeError,
+                          "expected integer argument" );
+
+       order = ( int )PyInt_AS_LONG( args );
+       Py_DECREF( args );
+
+       if( order < 2 ) order = 2;
+       else if( order > 6 ) order = 6;
+
+       if( self->nurb->pntsu < order )
+               order = self->nurb->pntsu;
+
+       self->nurb->orderu = (short)order;
+       makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
+
+       return 0;
+}
+
 /*
  * CurNurb_getIter
  *

Modified: trunk/blender/source/blender/python/api2_2x/doc/Curve.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Curve.py    2008-06-25 
01:04:21 UTC (rev 15349)
+++ trunk/blender/source/blender/python/api2_2x/doc/Curve.py    2008-06-25 
13:21:38 UTC (rev 15350)
@@ -535,6 +535,8 @@
        @type flagU: int
        @ivar flagV: The CurNurb knot flag V.  See L{setFlagU} for description.
        @type flagV: int
+       @ivar orderU: The CurNurb knot order U, for nurbs curves only, this is 
clamped by the number of points, so the orderU will never be greater.
+       @type orderU: int
        @ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
        @type type: int
        @ivar knotsU: The knot vector in the U direction. The tuple will be 
empty


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

Reply via email to