Blender Git Loki

Git Commits -> Revision fcc23fa

Revision fcc23fa by Campbell Barton (master)
April 2, 2009, 05:38 (GMT)
Added getitem/setitem access for KX_GameObject
ob.someProp = 10
can now be...
ob["someProp"] = 10

For simple get/set test with an objects 10 properties, this is ~30% faster.

Though I like the attribute access, its slower because it needs to lookup BGE attributes and methods (for parent classes as well as KX_GameObject class).

This could also be an advantage if there are collisions between new attributes added for 2.49 and existing properties a game uses.

Made some other small optimizations,
- Getting and setting property can use const char* as well as STR_String (avoids making new STR_Strings just to do the lookup).
- CValue::SetPropertiesModified() and CValue::SetPropertiesModified(), were looping through all items in the std::map, advancing from the beginning each time.

Commit Details:

Full Hash: fcc23faa3a5ec3c697e85e9a6b604ac7db80a05b
SVN Revision: 19497
Parent Commit: 48e4a48
Lines Changed: +174, -94

4 Modified Paths:

/source/gameengine/Expressions/Value.cpp (+88, -90) (Diff)
/source/gameengine/Expressions/Value.h (+4, -2) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+75, -1) (Diff)
/source/gameengine/Ketsji/KX_GameObject.h (+7, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021