Skip to content
Snippets Groups Projects
Ipo.c 36.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
     *
     * ***** 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.
     *
    
    Ton Roosendaal's avatar
    Ton Roosendaal committed
     * Contributor(s): Jacques Guignot, Nathan Letwory
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
     *
     * ***** END GPL/BL DUAL LICENSE BLOCK *****
     */
    
    #include "Ipo.h"
    
    
    #include <BKE_main.h>
    #include <BKE_global.h>
    #include <BKE_object.h>
    #include <BKE_library.h>
    
    Ton Roosendaal's avatar
    Ton Roosendaal committed
    #include <BSE_editipo.h>
    
    #include <DNA_curve_types.h>
    
    #include "Ipocurve.h"
    
    #include "constant.h"
    #include "gen_utils.h"
    
    char *GetIpoCurveName( IpoCurve * icu );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*****************************************************************************/
    
    /* Python API function prototypes for the Ipo module.                        */
    /*****************************************************************************/
    
    static PyObject *M_Ipo_New( PyObject * self, PyObject * args );
    static PyObject *M_Ipo_Get( PyObject * self, PyObject * args );
    static PyObject *M_Ipo_Recalc( PyObject * self, PyObject * args );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*****************************************************************************/
    
    /* The following string definitions are used for documentation strings.      */
    /* In Python these will be written to the console when doing a               */
    /* Blender.Ipo.__doc__                                                       */
    /*****************************************************************************/
    char M_Ipo_doc[] = "";
    char M_Ipo_New_doc[] = "";
    char M_Ipo_Get_doc[] = "";
    
    /*****************************************************************************/
    /* Python method structure definition for Blender.Ipo module:             */
    /*****************************************************************************/
    
    struct PyMethodDef M_Ipo_methods[] = {
    
    	{"New", ( PyCFunction ) M_Ipo_New, METH_VARARGS | METH_KEYWORDS,
    	 M_Ipo_New_doc},
    	{"Get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
    	{"get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc},
    	{"Recalc", M_Ipo_Recalc, METH_VARARGS, M_Ipo_Get_doc},
    	{NULL, NULL, 0, NULL}
    
    };
    
    /*****************************************************************************/
    /* Python BPy_Ipo methods declarations:                                     */
    /*****************************************************************************/
    
    static PyObject *Ipo_getName( BPy_Ipo * self );
    static PyObject *Ipo_setName( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getBlocktype( BPy_Ipo * self );
    static PyObject *Ipo_setBlocktype( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getRctf( BPy_Ipo * self );
    static PyObject *Ipo_setRctf( BPy_Ipo * self, PyObject * args );
    
    static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getCurves( BPy_Ipo * self );
    static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getNcurves( BPy_Ipo * self );
    static PyObject *Ipo_getNBezPoints( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_DeleteBezPoints( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getCurveBP( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_EvaluateCurveOn( BPy_Ipo * self, PyObject * args );
    
    
    static PyObject *Ipo_setCurveBeztriple( BPy_Ipo * self, PyObject * args );
    static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args );
    
    
    /*****************************************************************************/
    /* Python BPy_Ipo methods table:                                            */
    /*****************************************************************************/
    static PyMethodDef BPy_Ipo_methods[] = {
    
    	/* name, method, flags, doc */
    	{"getName", ( PyCFunction ) Ipo_getName, METH_NOARGS,
    	 "() - Return Ipo Data name"},
    	{"setName", ( PyCFunction ) Ipo_setName, METH_VARARGS,
    	 "(str) - Change Ipo Data name"},
    	{"getBlocktype", ( PyCFunction ) Ipo_getBlocktype, METH_NOARGS,
    	 "() - Return Ipo blocktype -"},
    	{"setBlocktype", ( PyCFunction ) Ipo_setBlocktype, METH_VARARGS,
    	 "(str) - Change Ipo blocktype"},
    	{"getRctf", ( PyCFunction ) Ipo_getRctf, METH_NOARGS,
    	 "() - Return Ipo rctf - "},
    	{"setRctf", ( PyCFunction ) Ipo_setRctf, METH_VARARGS,
    	 "(str) - Change Ipo rctf"},
    	{"addCurve", ( PyCFunction ) Ipo_addCurve, METH_VARARGS,
    	 "() - Return Ipo ncurves"},
    	{"getNcurves", ( PyCFunction ) Ipo_getNcurves, METH_NOARGS,
    	 "() - Return Ipo ncurves"},
    	{"getNBezPoints", ( PyCFunction ) Ipo_getNBezPoints, METH_VARARGS,
    	 "() - Return curve number of Bez points"},
    	{"delBezPoint", ( PyCFunction ) Ipo_DeleteBezPoints, METH_VARARGS,
    	 "() - Return curve number of Bez points"},
    	{"getCurveBP", ( PyCFunction ) Ipo_getCurveBP, METH_VARARGS,
    	 "() - Return Ipo ncurves"},
    	{"EvaluateCurveOn", ( PyCFunction ) Ipo_EvaluateCurveOn, METH_VARARGS,
    	 "() - Return curve value at given time"},
    	{"getCurveCurval", ( PyCFunction ) Ipo_getCurvecurval, METH_VARARGS,
    	 "() - Return curval"},
    	{"getCurveBeztriple", ( PyCFunction ) Ipo_getCurveBeztriple,
    	 METH_VARARGS,
    	 "() - Return Ipo ncurves"},
    	{"setCurveBeztriple", ( PyCFunction ) Ipo_setCurveBeztriple,
    	 METH_VARARGS,
    	 "() - Return curval"},
    	{"getCurves", ( PyCFunction ) Ipo_getCurves, METH_NOARGS,
    	 "() - Return curval"},
    	{"getCurve", ( PyCFunction ) Ipo_getCurve, METH_VARARGS,
    	 "() - Return curval"},
    	{NULL, NULL, 0, NULL}
    
    };
    
    /*****************************************************************************/
    /* Python Ipo_Type callback function prototypes:                          */
    /*****************************************************************************/
    
    static void IpoDeAlloc( BPy_Ipo * self );
    
    //static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);
    
    static int IpoSetAttr( BPy_Ipo * self, char *name, PyObject * v );
    static PyObject *IpoGetAttr( BPy_Ipo * self, char *name );
    static PyObject *IpoRepr( BPy_Ipo * self );
    
    
    /*****************************************************************************/
    /* Python Ipo_Type structure definition:                                  */
    /*****************************************************************************/
    PyTypeObject Ipo_Type = {
    
    	PyObject_HEAD_INIT( NULL ) 
    	0,	/* ob_size */
    	"Ipo",			/* tp_name */
    	sizeof( BPy_Ipo ),	/* tp_basicsize */
    	0,			/* tp_itemsize */
    	/* methods */
    	( destructor ) IpoDeAlloc,	/* tp_dealloc */
    	0,			/* tp_print */
    	( getattrfunc ) IpoGetAttr,	/* tp_getattr */
    	( setattrfunc ) IpoSetAttr,	/* tp_setattr */
    	0,			/* tp_compare */
    	( reprfunc ) IpoRepr,	/* tp_repr */
    	0,			/* tp_as_number */
    	0,			/* tp_as_sequence */
    	0,			/* tp_as_mapping */
    	0,			/* tp_as_hash */
    	0, 0, 0, 0, 0, 0,
    	0,			/* tp_doc */
    	0, 0, 0, 0, 0, 0,
    	BPy_Ipo_methods,	/* tp_methods */
    	0,			/* tp_members */
    
    };
    
    /*****************************************************************************/
    /* Function:              M_Ipo_New                                          */
    /* Python equivalent:     Blender.Ipo.New                                    */
    /*****************************************************************************/
    
    
    static PyObject *M_Ipo_New( PyObject * self, PyObject * args )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	Ipo *add_ipo( char *name, int idcode );
    	char *name = NULL, *code = NULL;
    	int idcode = -1;
    	BPy_Ipo *pyipo;
    	Ipo *blipo;
    
    	if( !PyArg_ParseTuple( args, "ss", &code, &name ) )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError,
    			   "expected string string arguments" ) );
    
    	if( !strcmp( code, "Object" ) )
    		idcode = ID_OB;
    	if( !strcmp( code, "Camera" ) )
    		idcode = ID_CA;
    	if( !strcmp( code, "World" ) )
    		idcode = ID_WO;
    	if( !strcmp( code, "Material" ) )
    		idcode = ID_MA;
    	if( !strcmp( code, "Texture" ) )
    		idcode = ID_TE;
    	if( !strcmp( code, "Lamp" ) )
    		idcode = ID_LA;
    	if( !strcmp( code, "Action" ) )
    		idcode = ID_AC;
    	if( !strcmp( code, "Constraint" ) )
    		idcode = IPO_CO;
    	if( !strcmp( code, "Sequence" ) )
    		idcode = ID_SEQ;
    	if( !strcmp( code, "Curve" ) )
    		idcode = ID_CU;
    	if( !strcmp( code, "Key" ) )
    		idcode = ID_KE;
    
    	if( idcode == -1 )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError, "Bad code" ) );
    
    
    	blipo = add_ipo( name, idcode );
    
    	if( blipo ) {
    		/* return user count to zero because add_ipo() inc'd it */
    		blipo->id.us = 0;
    		/* create python wrapper obj */
    		pyipo = ( BPy_Ipo * ) PyObject_NEW( BPy_Ipo, &Ipo_Type );
    	} else
    		return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
    						"couldn't create Ipo Data in Blender" ) );
    
    	if( pyipo == NULL )
    		return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
    						"couldn't create Ipo Data object" ) );
    
    	pyipo->ipo = blipo;
    
    	return ( PyObject * ) pyipo;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    /*****************************************************************************/
    /* Function:              M_Ipo_Get                                       */
    /* Python equivalent:     Blender.Ipo.Get                                 */
    /* Description:           Receives a string and returns the ipo data obj  */
    /*                        whose name matches the string.  If no argument is  */
    /*                        passed in, a list of all ipo data names in the  */
    /*                        current scene is returned.                         */
    /*****************************************************************************/
    
    static PyObject *M_Ipo_Get( PyObject * self, PyObject * args )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	char *name = NULL;
    	Ipo *ipo_iter;
    	PyObject *ipolist, *pyobj;
    	BPy_Ipo *wanted_ipo = NULL;
    	char error_msg[64];
    
    	if( !PyArg_ParseTuple( args, "|s", &name ) )
    		return ( EXPP_ReturnPyObjError( PyExc_TypeError,
    						"expected string argument (or nothing)" ) );
    
    	ipo_iter = G.main->ipo.first;
    
    	if( name ) {		/* (name) - Search ipo by name */
    		while( ( ipo_iter ) && ( wanted_ipo == NULL ) ) {
    			if( strcmp( name, ipo_iter->id.name + 2 ) == 0 ) {
    				wanted_ipo =
    					( BPy_Ipo * ) PyObject_NEW( BPy_Ipo,
    								    &Ipo_Type );
    				if( wanted_ipo )
    					wanted_ipo->ipo = ipo_iter;
    			}
    			ipo_iter = ipo_iter->id.next;
    		}
    
    		if( wanted_ipo == NULL ) {	/* Requested ipo doesn't exist */
    			PyOS_snprintf( error_msg, sizeof( error_msg ),
    				       "Ipo \"%s\" not found", name );
    			return ( EXPP_ReturnPyObjError
    				 ( PyExc_NameError, error_msg ) );
    		}
    
    		return ( PyObject * ) wanted_ipo;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	else {			/* () - return a list with all ipos in the scene */
    		int index = 0;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    		ipolist = PyList_New( BLI_countlist( &( G.main->ipo ) ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    		if( ipolist == NULL )
    			return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
    							"couldn't create PyList" ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    		while( ipo_iter ) {
    			pyobj = Ipo_CreatePyObject( ipo_iter );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    			if( !pyobj )
    				return ( EXPP_ReturnPyObjError
    					 ( PyExc_MemoryError,
    					   "couldn't create PyString" ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    			PyList_SET_ITEM( ipolist, index, pyobj );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    			ipo_iter = ipo_iter->id.next;
    			index++;
    		}
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    		return ( ipolist );
    
    static PyObject *M_Ipo_Recalc( PyObject * self, PyObject * args )
    
    	void testhandles_ipocurve( IpoCurve * icu );
    	PyObject *a;
    	IpoCurve *icu;
    	if( !PyArg_ParseTuple( args, "O", &a ) )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError, "expected ipo argument)" ) );
    	icu = IpoCurve_FromPyObject( a );
    	testhandles_ipocurve( icu );
    
    	Py_INCREF( Py_None );
    	return Py_None;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*****************************************************************************/
    
    Willian Padovani Germano's avatar
     
    Willian Padovani Germano committed
    /* Function:              Ipo_Init                                           */
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*****************************************************************************/
    
    PyObject *Ipo_Init( void )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	PyObject *submodule;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	Ipo_Type.ob_type = &PyType_Type;
    
    Willian Padovani Germano's avatar
     
    Willian Padovani Germano committed
    
    
    	submodule = Py_InitModule3( "Blender.Ipo", M_Ipo_methods, M_Ipo_doc );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	return ( submodule );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    /*****************************************************************************/
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /* Python BPy_Ipo methods:                                                  */
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    /*****************************************************************************/
    
    static PyObject *Ipo_getName( BPy_Ipo * self )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	PyObject *attr = PyString_FromString( self->ipo->id.name + 2 );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	if( attr )
    		return attr;
    	Py_INCREF( Py_None );
    	return Py_None;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    static PyObject *Ipo_setName( BPy_Ipo * self, PyObject * args )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	char *name;
    	char buf[21];
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	if( !PyArg_ParseTuple( args, "s", &name ) )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError, "expected string argument" ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	PyOS_snprintf( buf, sizeof( buf ), "%s", name );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	rename_id( &self->ipo->id, buf );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	Py_INCREF( Py_None );
    	return Py_None;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    
    static PyObject *Ipo_getBlocktype( BPy_Ipo * self )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	PyObject *attr = PyInt_FromLong( self->ipo->blocktype );
    	if( attr )
    		return attr;
    	return ( EXPP_ReturnPyObjError
    		 ( PyExc_RuntimeError,
    		   "couldn't get Ipo.blocktype attribute" ) );
    
    static PyObject *Ipo_setBlocktype( BPy_Ipo * self, PyObject * args )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	int blocktype = 0;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	if( !PyArg_ParseTuple( args, "i", &blocktype ) )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError, "expected string argument" ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	self->ipo->blocktype = ( short ) blocktype;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	Py_INCREF( Py_None );
    	return Py_None;
    
    static PyObject *Ipo_getRctf( BPy_Ipo * self )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	PyObject *l = PyList_New( 0 );
    	PyList_Append( l, PyFloat_FromDouble( self->ipo->cur.xmin ) );
    	PyList_Append( l, PyFloat_FromDouble( self->ipo->cur.xmax ) );
    	PyList_Append( l, PyFloat_FromDouble( self->ipo->cur.ymin ) );
    	PyList_Append( l, PyFloat_FromDouble( self->ipo->cur.ymax ) );
    	return l;
    
    static PyObject *Ipo_setRctf( BPy_Ipo * self, PyObject * args )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    {
    
    	float v[4];
    	if( !PyArg_ParseTuple( args, "ffff", v, v + 1, v + 2, v + 3 ) )
    		return ( EXPP_ReturnPyObjError
    			 ( PyExc_TypeError, "expected 4 float argument" ) );
    
    	self->ipo->cur.xmin = v[0];
    	self->ipo->cur.xmax = v[1];
    	self->ipo->cur.ymin = v[2];
    	self->ipo->cur.ymax = v[3];
    
    	Py_INCREF( Py_None );
    	return Py_None;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    
    static PyObject *Ipo_getNcurves( BPy_Ipo * self )
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	IpoCurve *icu;
    	for( icu = self->ipo->curve.first; icu; icu = icu->next ) {
    		i++;
    	}
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    	return ( PyInt_FromLong( i ) );
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    }
    
    
    int Ipo_laIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "Energy" ) ) {
    		*param = LA_ENERGY;
    		ok = 1;
    	}
    	if( !strcmp( s, "R" ) ) {
    		*param = LA_COL_R;
    		ok = 1;
    	}
    	if( !strcmp( s, "G" ) ) {
    		*param = LA_COL_G;
    		ok = 1;
    	}
    	if( !strcmp( s, "B" ) ) {
    		*param = LA_COL_B;
    		ok = 1;
    	}
    	if( !strcmp( s, "Dist" ) ) {
    		*param = LA_DIST;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpoSi" ) ) {
    		*param = LA_SPOTSI;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpoBl" ) ) {
    		*param = LA_SPOTBL;
    		ok = 1;
    	}
    	if( !strcmp( s, "Quad1" ) ) {
    		*param = LA_QUAD1;
    		ok = 1;
    	}
    	if( !strcmp( s, "Quad2" ) ) {
    		*param = LA_QUAD2;
    		ok = 1;
    	}
    	if( !strcmp( s, "HaInt" ) ) {
    		*param = LA_HALOINT;
    		ok = 1;
    	}
    	return ok;
    
    Willian Padovani Germano's avatar
    Willian Padovani Germano committed
    
    
    int Ipo_woIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "HorR" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "HorG" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "HorB" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "ZenR" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "ZenG" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "ZenB" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "Expos" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "Misi" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "MisDi" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "MisHi" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "StarR" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "StarB" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "StarG" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "ClSta" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "StarDi" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "StarSi" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	return ok;
    
    int Ipo_maIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "R" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "G" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "B" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpecR" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpecG" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpecB" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "MirR" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "MirG" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "MirB" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "Ref" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "Alpha" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "Emit" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "Amb" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "Spec" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "Hard" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "SpTra" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "Ior" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "Mode" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "HaSize" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "Translu" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "RayMir" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "FresMir" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "FresMirI" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "FresTra" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	if( !strcmp( s, "FresTraI" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "TraGlow" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	return ok;
    
    int Ipo_keIcuName( char *s, int *param )
    
    	char key[10];
    	int ok = 0;
    	int nr = 0;
    	if( !strcmp( s, "Speed" ) ) {
    		*param = KEY_SPEED;
    		ok = 1;
    	}
    	for( nr = 1; nr < 64; nr++ ) {
    		sprintf( key, "Key %d", nr );
    		if( !strcmp( s, key ) ) {
    			*param = nr;
    			ok = 1;
    			break;
    		}
    	}
    
    	return ok;
    
    int Ipo_seqIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "Fac" ) ) {
    		*param = SEQ_FAC1;
    		ok = 1;
    	}
    
    	return ok;
    
    int Ipo_cuIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "Speed" ) ) {
    		*param = CU_SPEED;
    		ok = 1;
    	}
    
    	return ok;
    
    int Ipo_coIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "Inf" ) ) {
    		*param = CO_ENFORCE;
    		ok = 1;
    	}
    
    	return ok;
    
    int Ipo_acIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "LocX" ) ) {
    		*param = AC_LOC_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "LocY" ) ) {
    		*param = AC_LOC_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "LocZ" ) ) {
    		*param = AC_LOC_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeX" ) ) {
    		*param = AC_SIZE_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeY" ) ) {
    		*param = AC_SIZE_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeZ" ) ) {
    		*param = AC_SIZE_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "QuatX" ) ) {
    		*param = AC_QUAT_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "QuatY" ) ) {
    		*param = AC_QUAT_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "QuatZ" ) ) {
    		*param = AC_QUAT_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "QuatW" ) ) {
    		*param = AC_QUAT_W;
    		ok = 1;
    	}
    	return ok;
    
    int Ipo_caIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "Lens" ) ) {
    		*param = CAM_LENS;
    		ok = 1;
    	}
    	if( !strcmp( s, "ClSta" ) ) {
    		*param = CAM_STA;
    		ok = 1;
    	}
    	if( !strcmp( s, "ClEnd" ) ) {
    		*param = CAM_END;
    		ok = 1;
    	}
    	return ok;
    
    int Ipo_texIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "NSize" ) ) {
    		*param = TE_NSIZE;
    		ok = 1;
    	}
    	if( !strcmp( s, "NDepth" ) ) {
    		*param = TE_NDEPTH;
    		ok = 1;
    	}
    	if( !strcmp( s, "NType" ) ) {
    		*param = TE_NTYPE;
    		ok = 1;
    	}
    	if( !strcmp( s, "Turb" ) ) {
    		*param = TE_TURB;
    		ok = 1;
    	}
    	if( !strcmp( s, "Vnw1" ) ) {
    		*param = TE_VNW1;
    		ok = 1;
    	}
    	if( !strcmp( s, "Vnw2" ) ) {
    		*param = TE_VNW2;
    		ok = 1;
    	}
    	if( !strcmp( s, "Vnw3" ) ) {
    		*param = TE_VNW3;
    		ok = 1;
    	}
    	if( !strcmp( s, "Vnw4" ) ) {
    		*param = TE_VNW4;
    		ok = 1;
    	}
    	if( !strcmp( s, "MinkMExp" ) ) {
    		*param = TE_VNMEXP;
    		ok = 1;
    	}
    	if( !strcmp( s, "DistM" ) ) {
    		*param = TE_VN_DISTM;
    		ok = 1;
    	}
    	if( !strcmp( s, "ColT" ) ) {
    		*param = TE_VN_COLT;
    		ok = 1;
    	}
    	if( !strcmp( s, "iScale" ) ) {
    		*param = TE_ISCA;
    		ok = 1;
    	}
    	if( !strcmp( s, "DistA" ) ) {
    		*param = TE_DISTA;
    		ok = 1;
    	}
    	if( !strcmp( s, "MgType" ) ) {
    		*param = TE_MG_TYP;
    		ok = 1;
    	}
    	if( !strcmp( s, "MgH" ) ) {
    		*param = TE_MGH;
    		ok = 1;
    	}
    	if( !strcmp( s, "Lacu" ) ) {
    		*param = TE_MG_LAC;
    		ok = 1;
    	}
    	if( !strcmp( s, "Oct" ) ) {
    		*param = TE_MG_OCT;
    		ok = 1;
    	}
    	if( !strcmp( s, "MgOff" ) ) {
    		*param = TE_MG_OFF;
    		ok = 1;
    	}
    	if( !strcmp( s, "MgGain" ) ) {
    		*param = TE_MG_GAIN;
    		ok = 1;
    	}
    	if( !strcmp( s, "NBase1" ) ) {
    		*param = TE_N_BAS1;
    		ok = 1;
    	}
    	if( !strcmp( s, "NBase2" ) ) {
    		*param = TE_N_BAS2;
    		ok = 1;
    	}
    
    	return ok;
    
    int Ipo_obIcuName( char *s, int *param )
    
    	int ok = 0;
    	if( !strcmp( s, "LocX" ) ) {
    		*param = OB_LOC_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "LocY" ) ) {
    		*param = OB_LOC_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "LocZ" ) ) {
    		*param = OB_LOC_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "RotX" ) ) {
    		*param = OB_ROT_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "RotY" ) ) {
    		*param = OB_ROT_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "RotZ" ) ) {
    		*param = OB_ROT_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeX" ) ) {
    		*param = OB_SIZE_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeY" ) ) {
    		*param = OB_SIZE_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "SizeZ" ) ) {
    		*param = OB_SIZE_Z;
    		ok = 1;
    	}
    
    	if( !strcmp( s, "dLocX" ) ) {
    		*param = OB_DLOC_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "dLocY" ) ) {
    		*param = OB_DLOC_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "dLocZ" ) ) {
    		*param = OB_DLOC_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "dRotX" ) ) {
    		*param = OB_DROT_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "dRotY" ) ) {
    		*param = OB_DROT_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "dRotZ" ) ) {
    		*param = OB_DROT_Z;
    		ok = 1;
    	}
    	if( !strcmp( s, "dSizeX" ) ) {
    		*param = OB_DSIZE_X;
    		ok = 1;
    	}
    	if( !strcmp( s, "dSizeY" ) ) {
    		*param = OB_DSIZE_Y;
    		ok = 1;
    	}
    	if( !strcmp( s, "dSizeZ" ) ) {
    		*param = OB_DSIZE_Z;
    		ok = 1;
    	}
    
    	if( !strcmp( s, "Layer" ) ) {
    		*param = OB_LAY;
    		ok = 1;
    	}
    	if( !strcmp( s, "Time" ) ) {
    		*param = OB_TIME;
    		ok = 1;
    	}
    
    	if( !strcmp( s, "ColR" ) ) {
    		*param = OB_COL_R;
    		ok = 1;
    	}
    	if( !strcmp( s, "ColG" ) ) {
    		*param = OB_COL_G;
    		ok = 1;
    	}
    	if( !strcmp( s, "ColB" ) ) {
    		*param = OB_COL_B;
    		ok = 1;
    	}
    	if( !strcmp( s, "ColA" ) ) {
    		*param = OB_COL_A;
    		ok = 1;
    	}
    	if( !strcmp( s, "FStreng" ) ) {
    		*param = OB_PD_FSTR;
    		ok = 1;
    	}
    	if( !strcmp( s, "FFall" ) ) {
    		*param = OB_PD_FFALL;
    		ok = 1;
    	}
    	if( !strcmp( s, "Damping" ) ) {
    		*param = OB_PD_SDAMP;
    		ok = 1;
    	}