From BlenderWiki
[edit] 2.49b Release
[edit] Python API Bugfixes 2.49b
- Converting a mesh from a python argument was broken but happened to work in some cases.
- Memory leak fix for action.channelNames.
- Was writing to freed memory when freeing a python object in some cases.
- Removing GameLogic.EvalExpression(), was unstable.
- Crash fix when casting a ray to the same location as the object.
- Fixed KX_PolyProxy returning improper VertexIndex with mixed triangles and quads with using .getVertexIndex() and .v1, .v2, etc. [bug #19254]
- Fixed obj.sendMessage() with 4 arguments crashing blender [bug #18963]
[edit] Python API Bugfixes 2.49a
- Camera functions getScreenPosition, Ray and Vect fixes
- Bug in KX_GameObject.get() and ListValue.get() returning python types float/int/string.
- Pythons sys.path creation was broken in windows (caused YoFrankie game to not start)
- Action Actuator setChannel() function was broken in a number of ways.
- Deprecation warnings were printed twice.
[edit] Python API Improvements 2.49a
- GE Python support for __contains__ "prop" in gameOb and "OBCube" in scene.objects syntax.
- GE Python support for dictionary style get() cont.actuators.get("key", default), works for sensors and object controllers too.
- Action actuator getChannel("name") function to get the bone loc,size,quat for a bone.
[edit] 2.49 Release
[edit] GE Python API: Changes
- Replacing many get/set methods with attributes that give direct access to the properties.
- Deprecation warnings can be disabled with "Ignore deprecation warnings" option to the game menu (disabled in Game Player by default).
- Improved range clamping for attributes.
- Added a utility that updates old scripts to use the new API. Be sure to keep a backup and carefully review the changes that are made.
Menu: Text → Text plugins → Convert BGE 2.49
- Internal and external scripts can now be imported as python modules.
- Python's dir(ob) now reliably returns all methods, attributes and property names for all game-engine types.
- Accessing game engine data that has been removed will raise a SystemError, check for this case with the 'invalid' [[1]] property.
- Python 2.6 compatibility (now supports python 2.3 - 2.6)
- GameObject names are now read only, (renaming was buggy)
- printing a GameObject wont raise an exception anymore.
- CListValue changes...
- disable changing CValueLists that the BGE uses internally
scene.objects.append(1) would crash when drawing.
- types can now accept negative indicies eg scene.objects[-1]
- fix for printing, scene.objects will no longer show [,,,]
- An asserts for not yet implimented functionality, this would close blender.
Better to print an error if the user manages to run this functions (I managed to by ListValue.count([1,2,3]))
- New method - ListValue.from_id(int) which uses the int return of pythons id() function to lookup a list item.
- disable changing CValueLists that the BGE uses internally
gameOb.other = id(otherGameOb) ...some time later... otherGameOb = scene.objects.from_id(gameOb.other)
- Changed GameLogic.addActiveActuator(actu, bool) to raise an error if the actuator is not in the list.
Before it would allow any value as the actuator and fail silently (makes debugging scripts more difficult). - Allow the actuator to be a string which is convenient if you dont want to change the settings of the actuator.
GameLogic.addActiveActuator(controller.getActuator("SomeAct"), True)
...can be replaced with...
controller.activate("SomeAct")
- Existing method ob.isA("KX_GameObject")now accepts python types eg. ob.isA(GameTypes.KX_GameObject)
[edit] GE Python API: Additions
- VideoTexture module
TODO Document this - OpenGL access from the game engine as a module so you can import BGL directly.
- New module GameTypes which gives access to all types defined by the BGE.
- GameLogic.getSceneList()
- Dictionary style access to GameObject's ob.someProp = 10 can now be ob["someProp"] = 10
This avoids naming conflicts with new attributes and is faster since it does not have to look up built in attributes first.
- Dictionary style access to GameObject's ob.someProp = 10 can now be ob["someProp"] = 10
- print warnings when python attributes and methods conflict with game properties.
- experimental KX_GameObject attributes "sensors", "controllers" and "actuators" (NEAT !!!!)
- KX_GameObject.localInertia attribute.
- KX_GameObject.replaceMesh(mesh)
- KX_GameObject.sendMessage(...) and GameLogic.sendMessage(...)
- KX_GameObject.setParent(parent,compound,ghost), compound, ghost are new args.
- KX_GameObject.get(key, value) - dictionary like alternative to KX_GameObject["key"].
- KX_GameObject.has_key(key) - dictionary like function to check for a key.
- ListValue.get(key, value) - dictionary like alternative to ListValue["key"].
- ListValue.has_key(key) - dictionary like function to check for a key.
- KX_Camera.useViewport to get/set the viewport toggle, (deprecates enableViewport(bool))
- KX_Scene.addObject(...)
- KX_Scene.active_camera can now be set to set the camera without an actuator.
- KX_Scene.lights - list of light objects
- KX_Scene.cameras - list of cameras
- KX_Scene.objects_inactive - allows access to objects in unseen layers (before the AddObject actuator adds them).
BGE KX_Camera methods to handle Screen Space - (getScreenPosition, getScreenVect, getScreenRay)
- getScreenPosition(obj): Gets the position of an object projected on screen space.
- getScreenVect(x, y): Gets the vector from the camera position in the screen coordinate direction.
- getScreenRay(x, y, dist, property): Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop.
[edit] 2.40 Release
[edit] API and Modules changed
Armature - complete overhaul - see docs
BezTriple - code cleanup and bug fixes
BGL - code cleanup
Blender - code cleanup
Bone - complete overhaul - see docs
Build - removed
constant - complete overhaul
CurNurb - code cleanup and bug fixes
Curve - added functions getKey, getTaperOb, setTaberOb
Draw - code cleanup
Effect - major over haul and additions
euler - rotate, nds, setattr, richcmpr, slicing, cleanup
gen_utils - FlaotsAreEqual, VectorsAreEqual, GetModuleConstant, intError, objError, incr2, incr3, decr2, decr2, setFloatClamped, setIvalueClamped, setFloatRange, setIValueRange, setModuleConstant, getBitfield, setBitfield, setterWrapper, setterWrapperTuple, dict-set_item_str
Image - GetCurrent, New, getPixelI, setPixelF, setPixelI, getMinXY, save, getStart, getEnd, getSpeed, setStart, setEnd, setSpeed
Ipo - cleanup
Ipocurve - getDriver, setDriver, getDriverObject, setDriverObject, getDriverChannel, setDriverChannel, getseters, improved Init, removed setPoints
Key - New module
Lamp - setComponent, getTypesConst, getModesConst, getComponent, getUsers, getsetters, removed setIpo, (ask about deprecated...)
Lattice - getKey
Library - cleanup
Material - getseters, getColorComponent, getOopsLoc, getOopsSel, setOopsLoc, setOopsSel, getUsers
Mathutils - major overhaul see below
matrix - len, item, ass_item, slice, coerce
Mesh - new module
Metaball - clean up
MTex - getsetters
NLA.c - minimal changes (shouldn't this have a major update??)
NMesh - getKey, nmedge_from_index,nmvert_from_float, nmface_from_index, correctFaceIndex, new_NMesh_displist, removed addEdgesData (edges are always present now)
Object - getParentBoneName, makeParentDeform, makeParentVertex, getEffects, updateDag, add the
following attributes - DupSta, DupEnd, DupOn, DupOff, Dupliframes, effects, users, protectFlags, removed functions getSBEnable, setSBEnable, getSBPostDef, setSBPostDef
Particle - New, Get, getType, setType, getFlag, setFlag, getsta, setSta, getEnd, setEnd, getLifetime, setLifetime, getNormfac, setNormfac, getObfac, setObfac, getRandfac, setRandfac, getTexfac, setTexfac, getRandlife, setRandlife, getNabla, setNabla, getVectsize, setVecSize, getTotpart, setTotpart, getTotkey, setTotkey, getSeed, setSeed, getForce, setForce, getMut, setMult, getLife, setLife, getMat, setMat, getChild, setChild, getDefvec, setDefvec
point - new module
quat - getsetter, repr (print self) richcmpr, len,
item, coerce - major improvements in robustness and
automatic type conversion
rgbTuple - cleanup
Scene - getTimeLine
sceneRender - SaveRenderedImage added HDR type
sceneTimeLine - new module
Text3d - code cleanup
Texture - getsetters, compare, ProjDict, NoiseDict,
BlendModesDict, MappingsDict
Types - Mesh_Type, MFace_Type, MVert_Type, PVert-Type,
MEdge_Type, MCol_Type, point_type, remove Build_Type,
Particle_Type
vector - toPoint, toTrackQuat
Wave - removed
windowTheme - lamp, textfield_hi
[edit] Scripts
- added - 3ds_import, 3ds_export, md2_export, md2_import, XSI_export
- updated - ac3d_import, ac3d_export, bevel_center, bvh2arm, bvh_import, console, DirectX8Exporter, discombobulator, disp_paint, hotkeys, lightwave_export, lightwave_import, obj_export, obj_import, rvk1_torvk2, skin, tex2uvbaker, uv_export, wings_export, wings_import
[edit] Mathutils
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list,
or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now
set a ROW of the matrix through a sequence. index cannot go above the row
size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example:
mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print
vector.internalmethod() or vector.internalmethod().nextmethod()
(no more print matrix.inverse() returning 'none')
- added the ability to negate vectors/points with "-vec"
* deprecated vector.negate()
- added the ability to shorthand inverse matrices with "~mat" (tilde)
- added some equivalency testing for vector classes
>, >=, <, <= test vector magnitude
==, != test vector values 'within epsilon' :)
Added some equvalency tests for the other math objects
* ==, != are defined for matrix, quat, euler.
- conversion between vector/point with toXXX() methods
- intersection tests for lines
- triangle area function
- tracking quaternion from vector
- some helpful normal calculators
-fix for angleBetweenVecs
* adds a test to check for zero-length vectors
- these methods have been deprecated (still functioning but suggested to use
the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated
blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' -
data that is created on the fly will now be a 'py_object' with its memory managed
by python otherwise if the data is returned by blender's G.main then the math object
is a 'simple wrapper' and data can be accessed directly from the struct just like other
python objects.







![[]](/skins/blender/open.png)
