? blender ? blender_back ? config.opts ? source/blender/python/api2_2x/buttons_editing.c ? source/blender/python/api2_2x/doc/Armature.pyc ? source/blender/python/api2_2x/doc/BGL.pyc ? source/blender/python/api2_2x/doc/BPY_API_233 ? source/blender/python/api2_2x/doc/Blender.pyc ? source/blender/python/api2_2x/doc/Bone.pyc ? source/blender/python/api2_2x/doc/Camera.pyc ? source/blender/python/api2_2x/doc/Curve.pyc ? source/blender/python/api2_2x/doc/Draw.pyc ? source/blender/python/api2_2x/doc/Effect.pyc ? source/blender/python/api2_2x/doc/Image.pyc ? source/blender/python/api2_2x/doc/Ipo.pyc ? source/blender/python/api2_2x/doc/Lamp.pyc ? source/blender/python/api2_2x/doc/Lattice.pyc ? source/blender/python/api2_2x/doc/Library.pyc ? source/blender/python/api2_2x/doc/Material.pyc ? source/blender/python/api2_2x/doc/Mathutils.pyc ? source/blender/python/api2_2x/doc/Metaball.pyc ? source/blender/python/api2_2x/doc/NLA.pyc ? source/blender/python/api2_2x/doc/NMesh.pyc ? source/blender/python/api2_2x/doc/Noise.pyc ? source/blender/python/api2_2x/doc/Object.pyc ? source/blender/python/api2_2x/doc/Registry.pyc ? source/blender/python/api2_2x/doc/Render.pyc ? source/blender/python/api2_2x/doc/Scene.pyc ? source/blender/python/api2_2x/doc/Sys.pyc ? source/blender/python/api2_2x/doc/Text.pyc ? source/blender/python/api2_2x/doc/Texture.pyc ? source/blender/python/api2_2x/doc/Types.pyc ? source/blender/python/api2_2x/doc/Window.pyc ? source/blender/python/api2_2x/doc/World.pyc ? source/blender/src/tooltip.diff Index: SConstruct =================================================================== RCS file: /cvsroot/bf-blender/blender/SConstruct,v retrieving revision 1.54 diff -u -r1.54 SConstruct --- SConstruct 12 May 2004 22:11:39 -0000 1.54 +++ SConstruct 30 May 2004 10:00:34 -0000 @@ -38,9 +38,9 @@ build_blender_static = 'false' build_blender_player = 'false' build_blender_plugin = 'false' - release_flags = ['-O2'] - debug_flags = ['-O2', '-g'] - extra_flags = ['-pipe', '-fPIC', '-funsigned-char'] + release_flags = ['-O3'] + debug_flags = ['-O3', '-g'] + extra_flags = ['-march=athlon-xp', '-m3dnow', '-msse', '-mfpmath=sse', '-maccumulate-outgoing-args', '-pipe', '-fPIC', '-funsigned-char'] cxxflags = [] defines = [] warn_flags = ['-Wall'] Index: source/blender/python/api2_2x/Object.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Object.c,v retrieving revision 1.73 diff -u -r1.73 Object.c --- source/blender/python/api2_2x/Object.c 20 May 2004 06:26:43 -0000 1.73 +++ source/blender/python/api2_2x/Object.c 30 May 2004 10:00:50 -0000 @@ -39,6 +39,7 @@ #include "DNA_scene_types.h" #include "BSE_edit.h" + /*****************************************************************************/ /* Python API function prototypes for the Blender module. */ /*****************************************************************************/ @@ -47,6 +48,7 @@ PyObject *M_Object_get(PyObject *self, PyObject *args); static PyObject *M_Object_GetSelected (PyObject *self, PyObject *args); static PyObject *M_Object_getSelected (PyObject *self, PyObject *args); +static PyObject *M_Object_Centre (PyObject *self, PyObject *args); /*****************************************************************************/ /* The following string definitions are used for documentation strings. */ @@ -70,6 +72,10 @@ "() - Returns a list of selected Objects in the active layer(s)\n\ The active object is the first in the list, if visible"; +char M_Object_Centre_doc[] = +"(mode) - Moves the objects centre depending on the mode (1,2 or 3)\n\ +0-Object to Centre, 1-Centre to Object, 2-Centre to Cursor"; + /*****************************************************************************/ /* Python method structure definition for Blender.Object module: */ /*****************************************************************************/ @@ -84,6 +90,8 @@ M_Object_GetSelected_doc}, {"getSelected", (PyCFunction)M_Object_getSelected, METH_VARARGS, M_Object_GetSelected_doc}, + {"Centre", (PyCFunction)M_Object_Centre, METH_VARARGS, + M_Object_Centre_doc}, {NULL, NULL, 0, NULL} }; @@ -111,6 +119,7 @@ static PyObject *Object_getType (BPy_Object *self); static PyObject *Object_getBoundBox (BPy_Object *self); static PyObject *Object_getAction (BPy_Object *self); +static PyObject *Object_getSel (BPy_Object *self); static PyObject *Object_makeDisplayList (BPy_Object *self); static PyObject *Object_link (BPy_Object *self, PyObject *args); static PyObject *Object_makeParent (BPy_Object *self, PyObject *args); @@ -127,6 +136,7 @@ static PyObject *Object_setSize (BPy_Object *self, PyObject *args); static PyObject *Object_setTimeOffset (BPy_Object *self, PyObject *args); static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args); +static PyObject *Object_setSel (BPy_Object *self, PyObject *args); /*****************************************************************************/ /* Python BPy_Object methods table: */ @@ -151,6 +161,8 @@ "Returns the object draw type"}, {"getAction", (PyCFunction)Object_getAction, METH_NOARGS, "Returns the active action for this object"}, + {"getSel", (PyCFunction)Object_getSel, METH_NOARGS, + "Return a 1/0 depending on weather the object is selected"}, {"getEuler", (PyCFunction)Object_getEuler, METH_NOARGS, "Returns the object's rotation as Euler rotation vector\n\ (rotX, rotY, rotZ)"}, @@ -224,6 +236,8 @@ {"shareFrom", (PyCFunction)Object_shareFrom, METH_VARARGS, "Link data of self with object specified in the argument. This\n\ works only if self and the object specified are of the same type."}, + {"setSel", (PyCFunction)Object_setSel, METH_VARARGS, + "Set the selected state of the object 1/0."}, {"setIpo", (PyCFunction)Object_setIpo, METH_VARARGS, "(Blender Ipo) - Sets the object's ipo"}, {"clearIpo", (PyCFunction)Object_clearIpo, METH_NOARGS, @@ -514,6 +528,38 @@ } /*****************************************************************************/ +/* Function: M_Object_Centre */ +/* Python equivalent: Blender.Object.Centre */ +/*****************************************************************************/ +static PyObject *M_Object_Centre (PyObject *self, PyObject *args) +{ + // 0 Centre object over its own centre. + // 1 Move objects centre to moddle of the object. + // 2 Place the objects centre to the cursor. + int centreType; + + if (!PyArg_ParseTuple(args, "i", ¢reType)) + return EXPP_ReturnPyObjError + (PyExc_TypeError, "expected an int, 0, 1 or 2"); + + if (centreType == 0) + { + docentre(); + } else if (centreType == 1) + { + docentre_new(); + } + else if (centreType == 2) + { + docentre_cursor(); + } + + Py_INCREF (Py_None); + return (Py_None); +} + + +/*****************************************************************************/ /* Function: initObject */ /*****************************************************************************/ PyObject *Object_Init (void) @@ -754,6 +800,29 @@ } } + +static PyObject *Object_getSel (BPy_Object *self) +{ + Base *base; + base= FIRSTBASE; + + PyObject *sel; + + while (base) { + if (base->object == self->object) + { + if (base->flag & SELECT) { + sel = Py_BuildValue ("b", 1); + } else { + sel = Py_BuildValue ("b", 0); + } + return sel; + } + base= base->next; + } +} + + static PyObject *Object_getDrawType (BPy_Object *self) { PyObject *attr = Py_BuildValue ("b", self->object->dt); @@ -1350,6 +1419,7 @@ return (Py_None); } + static PyObject *Object_setIpo(BPy_Object *self, PyObject *args) { PyObject *pyipo = 0; @@ -1590,6 +1660,42 @@ return (Py_None); } + + +static PyObject *Object_setSel (BPy_Object *self, PyObject *args) +{ + Base *base; + base= FIRSTBASE; + + int sel; + + if (!PyArg_ParseTuple (args, "i", &sel)) + return EXPP_ReturnPyObjError + (PyExc_TypeError, "expected an int, 0 or 1"); + + while (base) { + if (base->object == self->object) + { + if (sel == 1) + { + base->flag |= SELECT; + self->object->flag= base->flag; + } else { + base->flag &= ~SELECT; + self->object->flag= base->flag; + } + Py_INCREF (Py_None); + return (Py_None); + } + base= base->next; + } + + countall(); + + +} + + /*****************************************************************************/ /* Function: Object_CreatePyObject */ /* Description: This function will create a new BlenObject from an existing */ @@ -1793,7 +1899,9 @@ return (Py_BuildValue ("b", object->dtx)); if (StringEqual (name, "name")) return (Py_BuildValue ("s", object->id.name+2)); - + if (StringEqual (name, "sel")) + return (Object_getSel (obj)); + /* not an attribute, search the methods table */ return Py_FindMethod(BPy_Object_methods, (PyObject *)obj, name); } @@ -2002,7 +2110,15 @@ else return (0); } - + + if (StringEqual (name, "sel")) + { + if (Object_setSel (obj, valtuple) != Py_None) + return (-1); + else + return (0); + } + printf ("Unknown variable.\n"); return (0); } Index: source/blender/python/api2_2x/doc/Object.py =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/doc/Object.py,v retrieving revision 1.16 diff -u -r1.16 Object.py --- source/blender/python/api2_2x/doc/Object.py 20 May 2004 07:21:07 -0000 1.16 +++ source/blender/python/api2_2x/doc/Object.py 30 May 2004 10:00:51 -0000 @@ -88,6 +88,15 @@ print objects """ +def Centre (mode): + """ + Moves all selected objects centre point, this is shown as a purple dot in blender 3d window. + @param mode: One of the following: + - 0 - Centre object data around its centre point (moves objects data). + - 1 - Centre New, moves centre point to the centre of the object. + - 2 - Centre Cursor, moves the objects centre point to the curser position. + """ + class Object: """ The Object object @@ -131,12 +140,11 @@ @cvar EffZ: The Z effector coordinate of the object. Only applies to IKA. @cvar Layer: The object layer. This value is a bitmask with one position set for each of the 20 possible layers starting from the low order bit. - The easiest way to deal with these values in in hexadecimal notation. - Example:: - ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 ) - - After setting the Layer value, call Blender.Redraw( -1 ) to update the - interface. + The easiest way to deal with these values in in hexadecimal notation. + Example:: + ob.Layer = 0x04 # sets layer 3 ( bit pattern 0100 ) + After setting the Layer value, call Blender.Redraw( -1 ) to update the + interface. @cvar parent: The parent object of the object. (Read-only) @cvar track: The object tracking this object. (Read-only) @cvar data: The data of the object. (Read-only) @@ -152,6 +160,7 @@ of: 2 - axis, 4 - texspace, 8 - drawname, 16 - drawimage, 32 - drawwire. @cvar name: The name of the object. + @cvar sel: The selection of the object, 1/0. """ def buildParts(): @@ -163,7 +172,7 @@ def clearIpo(): """ Unlinks the ipo from this object. - @return: True if there was an ipo linked or False otherwise. + """ def clrParent(mode = 0, fast = 0): @@ -346,6 +355,12 @@ Blender.Redraw() """ + def getSel(): + """ + Returns the objects selection state as 1 or 0 + @rtype: int + @return: Objects selection state as 1 or 0 + """ def link(object): """ @@ -468,13 +483,22 @@ @type timeOffset: float @param timeOffset: The new time offset for the object's animation. """ - + def shareFrom(object): """ Link data of self with object specified in the argument. This works only if self and the object specified are of the same type. @type object: Blender Object @param object: A Blender Object of the same type. + """ + + def setSel(boolean): + """ + Sets the object's selection state. + @type boolean: Integer + @param boolean: A sum of the following: + - 0 - unselected + - 1 - selected """ def getBoundBox(): Index: source/blender/src/buttons_editing.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v retrieving revision 1.49 diff -u -r1.49 buttons_editing.c --- source/blender/src/buttons_editing.c 24 May 2004 19:48:06 -0000 1.49 +++ source/blender/src/buttons_editing.c 30 May 2004 10:00:58 -0000 @@ -544,12 +544,15 @@ break; case B_DOCENTRE: docentre(); + allqueue(REDRAWVIEW3D, 0); break; case B_DOCENTRENEW: docentre_new(); + allqueue(REDRAWVIEW3D, 0); break; case B_DOCENTRECURSOR: docentre_cursor(); + allqueue(REDRAWVIEW3D, 0); break; case B_SETSMOOTH: case B_SETSOLID: Index: source/blender/src/editobject.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/editobject.c,v retrieving revision 1.86 diff -u -r1.86 editobject.c --- source/blender/src/editobject.c 29 May 2004 16:17:46 -0000 1.86 +++ source/blender/src/editobject.c 30 May 2004 10:01:11 -0000 @@ -1404,7 +1404,6 @@ base= base->next; } - allqueue(REDRAWVIEW3D, 0); } void docentre_new(void)