[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12904] trunk/blender/source/blender/ python: some of the files didnt get added, not sure why
Campbell Barton
ideasman42 at gmail.com
Sun Dec 16 06:14:02 CET 2007
Revision: 12904
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12904
Author: campbellbarton
Date: 2007-12-16 06:14:01 +0100 (Sun, 16 Dec 2007)
Log Message:
-----------
some of the files didnt get added, not sure why
Modified Paths:
--------------
trunk/blender/source/blender/python/BPY_interface.c
Added Paths:
-----------
trunk/blender/source/blender/python/api2_5x/BezTriple.c
trunk/blender/source/blender/python/api2_5x/BezTriple.h
trunk/blender/source/blender/python/api2_5x/Bone.c
trunk/blender/source/blender/python/api2_5x/Camera.c
trunk/blender/source/blender/python/api2_5x/Camera.h
trunk/blender/source/blender/python/api2_5x/Const.c
trunk/blender/source/blender/python/api2_5x/Curve.c
trunk/blender/source/blender/python/api2_5x/Draw.h
trunk/blender/source/blender/python/api2_5x/EXPP_interface.h
trunk/blender/source/blender/python/api2_5x/Effect.c
trunk/blender/source/blender/python/api2_5x/Effect.h
trunk/blender/source/blender/python/api2_5x/Geometry.h
trunk/blender/source/blender/python/api2_5x/Group.c
trunk/blender/source/blender/python/api2_5x/Image.h
trunk/blender/source/blender/python/api2_5x/Ipo.c
trunk/blender/source/blender/python/api2_5x/Ipocurve.c
trunk/blender/source/blender/python/api2_5x/Ipocurve.h
trunk/blender/source/blender/python/api2_5x/MTex.c
trunk/blender/source/blender/python/api2_5x/Makefile
trunk/blender/source/blender/python/api2_5x/Mathutils.h
trunk/blender/source/blender/python/api2_5x/Mesh.h
trunk/blender/source/blender/python/api2_5x/Metaball.c
trunk/blender/source/blender/python/api2_5x/Metaball.h
trunk/blender/source/blender/python/api2_5x/Modifier.h
trunk/blender/source/blender/python/api2_5x/NLA.c
trunk/blender/source/blender/python/api2_5x/Object.c
trunk/blender/source/blender/python/api2_5x/Pose.c
trunk/blender/source/blender/python/api2_5x/Registry.c
trunk/blender/source/blender/python/api2_5x/Scene.h
trunk/blender/source/blender/python/api2_5x/Texture.c
trunk/blender/source/blender/python/api2_5x/Window.c
trunk/blender/source/blender/python/api2_5x/World.h
trunk/blender/source/blender/python/api2_5x/bpy.c
trunk/blender/source/blender/python/api2_5x/bpy_app.c
trunk/blender/source/blender/python/api2_5x/bpy_gl.h
trunk/blender/source/blender/python/api2_5x/bpy_list.c
trunk/blender/source/blender/python/api2_5x/charRGBA.h
trunk/blender/source/blender/python/api2_5x/color.h
trunk/blender/source/blender/python/api2_5x/euler.h
trunk/blender/source/blender/python/api2_5x/gen_library.c
trunk/blender/source/blender/python/api2_5x/gen_utils.c
trunk/blender/source/blender/python/api2_5x/layer_set.c
trunk/blender/source/blender/python/api2_5x/logic.c
trunk/blender/source/blender/python/api2_5x/matrix.h
trunk/blender/source/blender/python/api2_5x/meshPrimitive.h
trunk/blender/source/blender/python/api2_5x/quat.c
trunk/blender/source/blender/python/api2_5x/quat.h
trunk/blender/source/blender/python/api2_5x/sceneRadio.h
trunk/blender/source/blender/python/api2_5x/sceneRender.c
trunk/blender/source/blender/python/api2_5x/sceneRender.h
trunk/blender/source/blender/python/api2_5x/sceneSequence.c
trunk/blender/source/blender/python/api2_5x/sceneTimeLine.c
trunk/blender/source/blender/python/api2_5x/windowTheme.c
Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c 2007-12-16 03:42:41 UTC (rev 12903)
+++ trunk/blender/source/blender/python/BPY_interface.c 2007-12-16 05:14:01 UTC (rev 12904)
@@ -365,10 +365,10 @@
* to NULL, after this, using this data will raise an error.
****************************************************************************/
-GHash *bpy_idhash_text;
-GHash *bpy_idhash_scene;
-GHash *bpy_idhash_object;
-GHash *bpy_idhash_group;
+GHash *bpy_idhash_text = NULL;
+GHash *bpy_idhash_scene = NULL;
+GHash *bpy_idhash_object = NULL;
+GHash *bpy_idhash_group = NULL;
static GHash * idhash__internal(ID *id)
{
@@ -388,7 +388,6 @@
/* Use so duplicate PyObjects are never created */
void * BPY_idhash_get(ID *id)
{
- printf("getting hash\n");
return BLI_ghash_lookup(idhash__internal(id), id);
}
/* Use when python decref's the data
@@ -399,7 +398,7 @@
GHash *hash = idhash__internal(id);
if (!hash) /* TODO - Dont allow invalid hashes at all*/
return;
-
+ printf("remove hash %s\n", id->name);
BLI_ghash_remove(hash, id, NULL, NULL);
}
@@ -412,9 +411,11 @@
void BPY_idhash_invalidate(ID *id)
{
GHash *hash = idhash__internal(id);
+
if (!hash) /* TODO - Dont allow invalid hashes */
return;
+ printf("invalidate hash %s\n", id->name);
BLI_ghash_remove(hash, id, NULL, genlib_invalidate);
}
@@ -423,7 +424,7 @@
void BPY_idhash_add(void *value)
{
ID *id = ((BPyGenericLibObject *)value)->id;
- printf("adding hash\n");
+ printf("adding hash %s\n", id->name);
BLI_ghash_insert(idhash__internal(id), (void *)id, (void *)value);
}
/* END OF BPY ID HASH */
Added: trunk/blender/source/blender/python/api2_5x/BezTriple.c
===================================================================
--- trunk/blender/source/blender/python/api2_5x/BezTriple.c (rev 0)
+++ trunk/blender/source/blender/python/api2_5x/BezTriple.c 2007-12-16 05:14:01 UTC (rev 12904)
@@ -0,0 +1,637 @@
+/*
+ * $Id: BezTriple.c 11416 2007-07-29 14:30:06Z campbellbarton $
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * This is a new part of Blender.
+ *
+ * Contributor(s): Jacques Guignot RIP 2005,
+ * Stephen Swaney, Ken Hughes
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include "BezTriple.h" /*This must come first */
+#include "DNA_ipo_types.h"
+
+#include "MEM_guardedalloc.h"
+#include "gen_utils.h"
+#include "Const.h"
+
+/****************************************************************************
+ Python BPyBezTripleObject instance methods declarations:
+****************************************************************************/
+static int BezTriple_setPoints( BPyBezTripleObject * self, PyObject * args );
+static PyObject *BezTriple_getPoints( BPyBezTripleObject * self );
+static PyObject *BezTriple_getTriple( BPyBezTripleObject * self );
+
+/*****************************************************************************/
+/* PythonTypeObject constant declarations */
+/*****************************************************************************/
+
+/*
+ * structure of "tuples" of constant's string name and int value
+ *
+ * For example, these two structures will define the constant category
+ * "bpy.class.Object.DrawTypes" the constant
+ * "bpy.class.Object.DrawTypes.BOUNDBOX" and others.
+ */
+
+static constIdents handleTypesIdents[] = {
+ {"FREE", {(int)HD_FREE}},
+ {"AUTO", {(int)HD_AUTO}},
+ {"VECT", {(int)HD_VECT}},
+ {"ALIGN", {(int)HD_ALIGN}},
+ {"AUTOANIM", {(int)HD_AUTO_ANIM}},
+};
+
+/*
+ * structure with constant internal type (int), constant category name,
+ * and number of constant values in the category.
+ */
+
+static constDefinition handleTypes = {
+ EXPP_CONST_INT, "HandleTypes",
+ sizeof(handleTypesIdents)/sizeof(constIdents), handleTypesIdents
+};
+
+/*****************************************************************************/
+/* Python BPyBezTripleObject methods table: */
+/*****************************************************************************/
+static PyMethodDef BPyBezTriple_methods[] = {
+ /* name, method, flags, doc */
+ {"getTriple", ( PyCFunction ) BezTriple_getTriple, METH_NOARGS,
+ "() - return list of 3 floating point triplets. order is H1, knot, H2"},
+ {NULL, NULL, 0, NULL}
+};
+
+
+/****************************************************************************
+ Function: BezTriple_dealloc
+ Description: This is a callback function for the BPyBezTripleObject type. It is
+ the destructor function.
+****************************************************************************/
+static void BezTriple_dealloc( BPyBezTripleObject * self )
+{
+ if( self->own_memory)
+ MEM_freeN( self->beztriple );
+
+ PyObject_DEL( self );
+}
+
+/*
+ * BezTriple_getTriple
+ *
+ * Get the coordinate data for a BezTriple. Returns a list of 3 points.
+ * List order is handle1, knot, handle2. each point consists of a list
+ * of x,y,z float values.
+ */
+
+static PyObject *BezTriple_getTriple( BPyBezTripleObject * self )
+{
+ BezTriple *bezt = self->beztriple;
+ return Py_BuildValue( "[[fff][fff][fff]]",
+ bezt->vec[0][0], bezt->vec[0][1], bezt->vec[0][2],
+ bezt->vec[1][0], bezt->vec[1][1], bezt->vec[1][2],
+ bezt->vec[2][0], bezt->vec[2][1], bezt->vec[2][2] );
+}
+
+/*
+ * BezTriple_setTriple
+ *
+ * Set the cordinate data for a BezTriple. Takes a sequence of 3 points,
+ * of the same format at BezTriple_getTriple.
+ */
+
+static int BezTriple_setTriple( BPyBezTripleObject * self, PyObject * args )
+{
+ int i, j;
+ struct BezTriple *bezt = self->beztriple;
+ float vec[3][3];
+
+ if( !PySequence_Check( args ) || PySequence_Size( args ) != 3 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected three sequences of three floats" );
+
+ for( i = 0; i < 3; i++ ) {
+ PyObject *obj1 = PySequence_ITEM( args, i );
+ if( !PySequence_Check( obj1 ) || PySequence_Size( obj1 ) != 3 ) {
+ Py_DECREF( obj1 );
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected three sequences of three floats" );
+ }
+ for( j = 0; j < 3; j++ ) {
+ PyObject *obj2 = PySequence_ITEM( obj1, j );
+
+ if( !PyNumber_Check(obj2) ) {
+ Py_DECREF( obj1 );
+ Py_DECREF( obj2 );
+ return EXPP_ReturnIntError( PyExc_ValueError,
+ "expected float parameter" );
+ }
+ vec[i][j] = ( float )PyFloat_AsDouble( obj2 );
+ }
+ Py_DECREF( obj1 );
+ }
+
+ for( i = 0; i < 3; i++ )
+ for( j = 0; j < 3; j++ )
+ bezt->vec[i][j] = vec[i][j];
+
+ return 0;
+}
+
+/*
+ * BezTriple_getPoint
+ *
+ * Get the coordinate data for a BezTriple. Returns the control point,
+ * as a list of x,y float values.
+ */
+
+static PyObject *BezTriple_getPoints( BPyBezTripleObject * self )
+{
+ BezTriple *bezt = self->beztriple;
+ return Py_BuildValue( "[ff]", bezt->vec[1][0], bezt->vec[1][1] );
+}
+
+/*
+ * BezTriple_setPoint
+ *
+ * Set the coordinate data for a BezTriple. Accepts the x,y for the control
+ * point and builds handle values based on control point.
+ */
+
+static int BezTriple_setPoints( BPyBezTripleObject * self, PyObject * args )
+{
+ int i;
+ struct BezTriple *bezt = self->beztriple;
+ float vec[2];
+
+ if( !PySequence_Check( args ) || PySequence_Size( args ) != 2 )
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected sequence of two floats" );
+
+ for( i = 0; i < 2; i++ ) {
+ PyObject *obj = PySequence_ITEM( args, i );
+ vec[i] = ( float )PyFloat_AsDouble( obj );
+ if (vec[i]==-1 && PyErr_Occurred()) {
+ Py_DECREF(obj);
+ return -1;
+ }
+ }
+
+ for( i = 0; i < 2; i++ ) {
+ bezt->vec[0][i] = vec[i] - 1;
+ bezt->vec[1][i] = vec[i];
+ bezt->vec[2][i] = vec[i] + 1;
+ }
+
+ /* experimental fussing with handles - ipo.c: calchandles_ipocurve */
+ if( bezt->vec[0][0] > bezt->vec[1][0] )
+ bezt->vec[0][0] = bezt->vec[1][0];
+
+ if( bezt->vec[2][0] < bezt->vec[1][0] )
+ bezt->vec[2][0] = bezt->vec[1][0];
+
+ return 0;
+}
+
+static PyObject *BezTriple_getTilt( BPyBezTripleObject * self )
+{
+ return PyFloat_FromDouble( self->beztriple->alfa );
+}
+
+static int BezTriple_setTilt( BPyBezTripleObject * self, PyObject *value )
+{
+ float f = ( float )PyFloat_AsDouble( value );
+ if (f ==-1 && PyErr_Occurred())
+ return -1;
+
+ self->beztriple->alfa = f;
+ return 0;
+}
+
+static PyObject *BezTriple_getWeight( BPyBezTripleObject * self )
+{
+ return PyFloat_FromDouble( self->beztriple->weight );
+}
+
+static int BezTriple_setWeight( BPyBezTripleObject * self, PyObject *value )
+{
+ float f = ( float )PyFloat_AsDouble( value );
+ if (f ==-1 && PyErr_Occurred())
+ return -1;
+
+ self->beztriple->weight = f;
+ return 0;
+}
+
+static PyObject *BezTriple_getRadius( BPyBezTripleObject * self )
+{
+ return PyFloat_FromDouble( self->beztriple->radius );
+}
+
+static int BezTriple_setRadius( BPyBezTripleObject * self, PyObject *value )
+{
+ float f = ( float )PyFloat_AsDouble( value );
+ if (f ==-1 && PyErr_Occurred())
+ return -1;
+
+ self->beztriple->radius = f;
+ return 0;
+}
+
+static PyObject *BezTriple_getHide( BPyBezTripleObject * self )
+{
+ return PyInt_FromLong( self->beztriple->hide == IPO_BEZ );
+}
+
+static int BezTriple_setHide( BPyBezTripleObject * self, PyObject *value )
+{
+ int pybool = PyObject_IsTrue( value );
+ if (pybool==-1)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list