diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-05 10:09:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-05 10:09:03 +0400 |
commit | 66ffd1d2075dcc7a8fc9f197d3643d0cd26a9b79 (patch) | |
tree | f4792e485e46d81e12f41e9f1bfeec028e858aed | |
parent | df8cb37e1eeac4b846459378859f7eb8ff369e06 (diff) |
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
-rw-r--r-- | release/scripts/bvh_import.py | 7 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 33 | ||||
-rw-r--r-- | source/blender/python/api2_2x/bpy_config.c | 8 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Object.py | 55 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Scene.py | 2 |
5 files changed, 69 insertions, 36 deletions
diff --git a/release/scripts/bvh_import.py b/release/scripts/bvh_import.py index aa21cc82c57..d027956a507 100644 --- a/release/scripts/bvh_import.py +++ b/release/scripts/bvh_import.py @@ -354,7 +354,7 @@ def bvh_node_dict2objects(bvh_nodes, IMPORT_START_FRAME= 1, IMPORT_LOOP= False): bvh_node.temp.rot= rx*DEG2RAD,ry*DEG2RAD,rz*DEG2RAD - bvh_node.temp.insertIpoKey(Blender.Object.LOCROT) + bvh_node.temp.insertIpoKey(Blender.Object.IpoKeys.LOCROT) scn.update(1) return objects @@ -741,9 +741,12 @@ def main(): Blender.Window.FileSelector(load_bvh_ui, 'Import BVH', '*.bvh') if __name__ == '__main__': + #def foo(): main() ''' scn = bpy.data.scenes.active - for ob in list(scn.objects): scn.objects.unlink(ob) + for ob in list(scn.objects): + if ob.name!='arm__': + scn.objects.unlink(ob) load_bvh_ui('/test.bvh', False) '''
\ No newline at end of file diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 810748e21a3..8404945485b 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -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*/ diff --git a/source/blender/python/api2_2x/bpy_config.c b/source/blender/python/api2_2x/bpy_config.c index bdb5e3c3b47..5942ee56256 100644 --- a/source/blender/python/api2_2x/bpy_config.c +++ b/source/blender/python/api2_2x/bpy_config.c @@ -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 */ diff --git a/source/blender/python/api2_2x/doc/Object.py b/source/blender/python/api2_2x/doc/Object.py index 3e8cb5b044e..a837fd058c1 100644 --- a/source/blender/python/api2_2x/doc/Object.py +++ b/source/blender/python/api2_2x/doc/Object.py @@ -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 """ diff --git a/source/blender/python/api2_2x/doc/Scene.py b/source/blender/python/api2_2x/doc/Scene.py index c28460825d2..fb852f2aa49 100644 --- a/source/blender/python/api2_2x/doc/Scene.py +++ b/source/blender/python/api2_2x/doc/Scene.py @@ -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) """ |