more epy doc updates

added a constant dict "Blender.Object.IpoKeyTypes" to pass to ob.insertIpoKey(keytype), previously these constants were not documented well and added to Blender.Object directly
This commit is contained in:
Campbell Barton
2007-05-05 06:09:03 +00:00
parent df8cb37e1e
commit 66ffd1d207
5 changed files with 69 additions and 36 deletions

View File

@@ -5220,6 +5220,27 @@ static PyObject *M_Object_RBShapeBoundDict( void )
return M;
}
static PyObject *M_Object_IpoKeyTypesDict( void )
{
PyObject *M = PyConstant_New( );
if( M ) {
BPy_constant *d = ( BPy_constant * ) M;
PyConstant_Insert( d, "LOC", PyInt_FromLong( IPOKEY_LOC ) );
PyConstant_Insert( d, "ROT", PyInt_FromLong( IPOKEY_ROT ) );
PyConstant_Insert( d, "SIZE", PyInt_FromLong( IPOKEY_SIZE ) );
PyConstant_Insert( d, "LOCROT", PyInt_FromLong( IPOKEY_LOCROT ) );
PyConstant_Insert( d, "LOCROTSIZE", PyInt_FromLong( IPOKEY_LOCROTSIZE ) );
PyConstant_Insert( d, "PI_STRENGTH", PyInt_FromLong( IPOKEY_PI_STRENGTH ) );
PyConstant_Insert( d, "PI_FALLOFF", PyInt_FromLong( IPOKEY_PI_FALLOFF ) );
PyConstant_Insert( d, "PI_SURFACEDAMP", PyInt_FromLong( IPOKEY_PI_SURFACEDAMP ) );
PyConstant_Insert( d, "PI_RANDOMDAMP", PyInt_FromLong( IPOKEY_PI_RANDOMDAMP ) );
PyConstant_Insert( d, "PI_PERM", PyInt_FromLong( IPOKEY_PI_PERM ) );
}
return M;
}
/*****************************************************************************/
/* Function: initObject */
/*****************************************************************************/
@@ -5233,12 +5254,15 @@ PyObject *Object_Init( void )
PyObject *PITypesDict = M_Object_PITypesDict( );
PyObject *RBFlagsDict = M_Object_RBFlagsDict( );
PyObject *RBShapesDict = M_Object_RBShapeBoundDict( );
PyObject *IpoKeyTypesDict = M_Object_IpoKeyTypesDict( );
PyType_Ready( &Object_Type ) ;
module = Py_InitModule3( "Blender.Object", M_Object_methods,
M_Object_doc );
/* We Should Remove these!!!! */
PyModule_AddIntConstant( module, "LOC", IPOKEY_LOC );
PyModule_AddIntConstant( module, "ROT", IPOKEY_ROT );
PyModule_AddIntConstant( module, "SIZE", IPOKEY_SIZE );
@@ -5256,7 +5280,9 @@ PyObject *Object_Init( void )
PyModule_AddIntConstant( module, "VORTEX",PFIELD_VORTEX );
PyModule_AddIntConstant( module, "MAGNET",PFIELD_MAGNET );
PyModule_AddIntConstant( module, "WIND",PFIELD_WIND );
/* Only keeping above so as not to break compat */
if( DrawModesDict )
PyModule_AddObject( module, "DrawModes", DrawModesDict );
if( DrawTypesDict )
@@ -5271,7 +5297,8 @@ PyObject *Object_Init( void )
PyModule_AddObject( module, "RBFlags", RBFlagsDict );
if( RBShapesDict )
PyModule_AddObject( module, "RBShapes", RBShapesDict );
if( IpoKeyTypesDict )
PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict );
/*Add SUBMODULES to the module*/
dict = PyModule_GetDict( module ); /*borrowed*/

View File

@@ -286,19 +286,19 @@ static PyGetSetDef Config_getseters[] = {
(void *)EXPP_CONF_ATTR_UNDOSTEPS},
{"textureTimeout",
(getter)getIntAttr, (setter)setIntAttrClamp,
"undo steps",
"time for textures to stay in openGL memory",
(void *)EXPP_CONF_ATTR_TEX_TIMEOUT},
{"textureCollectRate",
(getter)getIntAttr, (setter)setIntAttrClamp,
"undo steps",
"intervel for textures to be tagged as used",
(void *)EXPP_CONF_ATTR_TEX_COLLECT_RATE},
{"sequenceMemCacheLimit",
(getter)getIntAttr, (setter)setIntAttrClamp,
"undo steps",
"maximum memory for the sequencer to use as cache",
(void *)EXPP_CONF_ATTR_MEM_CACHE_LIMIT},
{"fontSize",
(getter)getIntAttr, (setter)setIntAttrClamp,
"undo steps",
"user interface font size",
(void *)EXPP_CONF_ATTR_FONT_SIZE},
/* Paths */

View File

@@ -97,6 +97,20 @@ Example::
- ANISOTROPIC: Enable anisotropic friction (requires ACTOR, DYNAMIC)
- CHILD: reserved
@type IpoKeyTypes: readonly dictionary
@var IpoKeyTypes: Constant dict used for with L{Object.insertIpoKey} attribute.
Values can be ORed together.
- LOC
- ROT
- SIZE
- LOCROT
- LOCROTSIZE
- PI_STRENGTH
- PI_FALLOFF
- PI_SURFACEDAMP
- PI_RANDOMDAMP
- PI_PERM
@type RBShapes: readonly dictionary
@var RBShapes: Constant dict used for with L{Object.rbShapeBoundType}
attribute. Only one type can be selected at a time. Values are
@@ -125,8 +139,8 @@ def New (type, name='type'):
object = Blender.Object.New('Lamp')
lamp = Blender.Lamp.New('Spot')
object.link(lamp)
scene = Blender.Scene.GetCurrent()
scene.link(object)
sce = Blender.Scene.GetCurrent()
sce.link(object)
Blender.Redraw()
@Note: if an object is created but is not linked to object data, and the
@@ -764,11 +778,11 @@ class Object:
the scene and prints the name and location of each object::
import Blender
objects = Blender.Object.Get()
sce = Blender.Scene.GetCurrent()
for obj in objects:
print obj.getName()
print obj.getLocation()
for ob in sce.objects:
print obj.name
print obj.loc
@note: the worldspace location is the same as ob.matrixWorld[3][0:3]
"""
@@ -817,11 +831,10 @@ class Object:
the scene and prints the name of each object::
import Blender
scn= Blender.Scene.GetCurrent()
objects = scn.getChildren()
sce= Blender.Scene.GetCurrent()
for obj in objects:
print obj.getName()
for ob in sce.objects:
print ob.getName()
"""
def getParent():
@@ -881,10 +894,10 @@ class Object:
true number 'pi'. A better, less error-prone value of pi is math.pi from the python math module.::
import Blender
objects = Blender.Object.Get()
sce = Blender.Scene.GetCurrent()
for obj in objects:
if obj.getType() == 'Camera':
for obj in sce.objects:
if obj.type == 'Camera':
obj.LocY = -obj.LocY
obj.RotZ = 3.141592 - obj.RotZ
@@ -896,19 +909,9 @@ class Object:
def insertIpoKey(keytype):
"""
Inserts keytype values in object ipo at curframe. Uses module constants.
@type keytype: Integer
@param keytype:
-LOC
-ROT
-SIZE
-LOCROT
-LOCROTSIZE
-PI_STRENGTH
-PI_FALLOFF
-PI_PERM
-PI_SURFACEDAMP
-PI_RANDOMDAMP
Inserts keytype values in object ipo at curframe.
@type keytype: int
@param keytype: A constant from L{IpoKeyTypes<Object.IpoKeyTypes>}
@return: None
"""

View File

@@ -112,7 +112,7 @@ class Scene:
@type timeline: Timeline
@ivar timeline: The L{timeline<TimeLine.TimeLine>} for this scene, named markers are stored here. (read only)
@type render: RenderData
@ivar render: The scenes L{render<Render>} settings. (read only)
@ivar render: The scenes L{render<Render.RenderData>} settings. (read only)
@type radiosity: RenderData
@ivar radiosity: The scenes L{radiosity<Radio>} settings. (read only)
"""