Revision: 15122
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15122
Author:   campbellbarton
Date:     2008-06-04 18:41:09 +0200 (Wed, 04 Jun 2008)

Log Message:
-----------
svn  merge  -r15115:HEAD 
https://svn.blender.org/svnroot/bf-blender/trunk/blender/

Modified Paths:
--------------
    branches/apricot/source/blender/blenkernel/intern/text.c
    branches/apricot/source/blender/python/api2_2x/Object.c
    branches/apricot/source/blender/python/api2_2x/doc/Object.py

Modified: branches/apricot/source/blender/blenkernel/intern/text.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/text.c    2008-06-04 
16:38:55 UTC (rev 15121)
+++ branches/apricot/source/blender/blenkernel/intern/text.c    2008-06-04 
16:41:09 UTC (rev 15122)
@@ -2075,13 +2075,13 @@
          return;
        }
        else if (text->curc==0) { /* Appending two lines */
-           if (text->curl->prev) {
-             text->curl= text->curl->prev;
-             text->curc= text->curl->len;
-                       
-             txt_combine_lines(text, text->curl, text->curl->next);
-             txt_pop_sel(text);
-           }
+               if (!text->curl->prev) return;
+               
+               text->curl= text->curl->prev;
+               text->curc= text->curl->len;
+               
+               txt_combine_lines(text, text->curl, text->curl->next);
+               txt_pop_sel(text);
        } 
        else { /* Just backspacing a char */
          int i= text->curc-1;

Modified: branches/apricot/source/blender/python/api2_2x/Object.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Object.c     2008-06-04 
16:38:55 UTC (rev 15121)
+++ branches/apricot/source/blender/python/api2_2x/Object.c     2008-06-04 
16:41:09 UTC (rev 15122)
@@ -360,6 +360,8 @@
 static PyObject *Object_getParent( BPy_Object * self );
 static PyObject *Object_getParentBoneName( BPy_Object * self );
 static int Object_setParentBoneName( BPy_Object * self, PyObject * value );
+static PyObject *Object_getParentVertexIndex( BPy_Object * self );
+static int Object_setParentVertexIndex( BPy_Object * self, PyObject * value );
 static PyObject *Object_getSize( BPy_Object * self, PyObject * args );
 static PyObject *Object_getTimeOffset( BPy_Object * self );
 static PyObject *Object_getTracked( BPy_Object * self );
@@ -1491,6 +1493,92 @@
        return 0;
 }
 
+static PyObject *Object_getParentVertexIndex( BPy_Object * self )
+{
+       PyObject *pyls = NULL;
+       
+       if( self->object->parent) {
+               if (self->object->partype==PARVERT1) {
+                       pyls = PyList_New(1);
+                       PyList_SET_ITEM( pyls, 0, PyInt_FromLong( 
self->object->par1 ));
+                       return pyls;
+               } else if (self->object->partype==PARVERT3) {
+                       pyls = PyList_New(3);
+                       PyList_SET_ITEM( pyls, 0, PyInt_FromLong( 
self->object->par1 ));
+                       PyList_SET_ITEM( pyls, 1, PyInt_FromLong( 
self->object->par2 ));
+                       PyList_SET_ITEM( pyls, 2, PyInt_FromLong( 
self->object->par3 ));
+                       return pyls;
+               }
+       }
+       return PyList_New(0);
+}
+
+static int Object_setParentVertexIndex( BPy_Object * self, PyObject *value )
+{
+       PyObject *item;
+       int val[3] = {0,0,0};
+       if( !self->object->parent) {
+               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                       "This object has no vertex parent, cant set the vertex 
parent indicies" );
+       }
+       if (self->object->partype==PARVERT1) {
+               if (PySequence_Length(value) != 1)
+                       return EXPP_ReturnIntError( PyExc_RuntimeError,
+                               "Vertex parented to 1 vertex, can only assign a 
sequence with 1 vertex parent index" );
+               item = PySequence_GetItem(value, 0);
+               if (item) {
+                       val[0] = PyInt_AsLong(item);
+                       Py_DECREF(item);
+               }
+       } else if (self->object->partype==PARVERT3) {
+               int i;
+               if (PySequence_Length(value) != 3)
+                       return EXPP_ReturnIntError( PyExc_RuntimeError,
+                               "Vertex parented to 3 verts, can only assign a 
sequence with 3 verts parent index" );
+               
+               for (i=0; i<3; i++) {
+                       item = PySequence_GetItem(value, i);
+                       if (item) {
+                               val[i] = PyInt_AsLong(item);
+                               Py_DECREF(item);
+                       }
+               }
+       } else {
+               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                       "This object has no vertex parent, cant set the vertex 
parent indicies" );
+       }
+       
+       if (PyErr_Occurred()) {
+               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                       "This object has no vertex parent, cant set the vertex 
parent indicies" );
+       } else {
+               if (self->object->partype==PARVERT1) {
+                       if (val[0] < 0) {
+                               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                                       "vertex index less then zero" );
+                       }
+                       
+                       self->object->par1 = val[0];
+               } else if (self->object->partype==PARVERT3) {
+                       if (val[0]==val[1] || val[0]==val[2] || val[1]==val[2]) 
{
+                               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                                       "duplicate indicies in vertex parent 
assignment" );
+                       }
+                       if (val[0] < 0 || val[1] < 0 || val[2] < 0) {
+                               return EXPP_ReturnIntError( PyExc_RuntimeError,
+                                       "vertex index less then zero" );
+                       }
+               
+                       self->object->par1 = val[0];
+                       self->object->par2 = val[1];
+                       self->object->par3 = val[2];
+               }
+       }
+
+       return 0;
+}
+
+
 static PyObject *Object_getSize( BPy_Object * self, PyObject * args )
 {
        char *space = "localspace";     /* default to local */
@@ -4916,6 +5004,10 @@
         (getter)Object_getParentBoneName, (setter)Object_setParentBoneName,
         "The object's parent object's sub name",
         NULL},
+       {"parentVertexIndex",
+        (getter)Object_getParentVertexIndex, 
(setter)Object_setParentVertexIndex,
+        "Indicies used for vertex parents",
+        NULL},
        {"track",
         (getter)Object_getTracked, (setter)Object_setTracked,
         "The object's tracked object",

Modified: branches/apricot/source/blender/python/api2_2x/doc/Object.py
===================================================================
--- branches/apricot/source/blender/python/api2_2x/doc/Object.py        
2008-06-04 16:38:55 UTC (rev 15121)
+++ branches/apricot/source/blender/python/api2_2x/doc/Object.py        
2008-06-04 16:41:09 UTC (rev 15122)
@@ -389,6 +389,8 @@
        @ivar parentbonename: The string name of the parent bone (if defined).
                This can be set to another bone in the armature if the object 
already has a bone parent.
        @type parentbonename: string or None
+       @ivar parentVertexIndex: A list of vertex parent indicies, with a 
length of 0, 1 or 3. When there are 1 or 3 vertex parents, the indicies can be 
assigned to a sequence of the same length.
+       @type parentVertexIndex: list
        @ivar protectFlags: The "transform locking" bitfield flags for the 
object.  
        See L{ProtectFlags} const dict for values.
        @type protectFlags: int


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

Reply via email to