Even a static mesh can be used as replacement: the mesh
will be instantiated with the soft body settings of the
object. The position and orientation of the soft body
is preserved after the replacement.
Known limitation: the velocity of the soft body is reset
aftet the replacement. This is because soft body don't
have a well defined velocity.
patch from Mitchell Stokes (moguri)
simple use case
scene.post_draw = [pyOpenGLFunc]
this only needs to be set once, then the funcion runs each redraw.
note, this patch also changes how python scripts run (not modules): Dont clear the namespace after running a script, since functions still use the namespace, BGE API is now better when dealing with stale data.
made some changes to this patch.
- assigning a list didnt decrement the existing list.
- initialize as NULL rather then a blank list
- dont use string comparisons for the callbacks, pass the python list to use instead.
- dont check the list items are callable. python will display an error if they are not.
- use python list macros that dont do any type checking sine blender does this when assigning the list
---- from tracker, edited since an updated patch changes some things.
Here is a patch to be able to draw to the screen with BGE Python. This will be very handy for GUI stuff. This patch
works by having the user register a callback in the scene. Two options are available KX_Scene.pre_draw
and KX_Scene.post_draw. The difference between these is when Python draws to the screen (before or after the BGE).
Each can take a list of functions. Here is an example that draws a blue semi-transparent
GLEW update to version 1.5.1 [11-03-08]
this opens room for Geometry Shader support.
* - Brecht, Campbell told me you did some local changes in order to make it right in Linux. I get to you in order to know what those changes are (or feel free to commit them directly)
* Convert all code to use new functions.
* Branch maintainers may want to skip this commit, and run this
conversion script instead, if they use a lot of math functions
in new code:
http://www.pasteall.org/9052/python
merging now to save confusion later since the changes between last merge and 23172 shouldn't be merged.
brings 2.4 and trunk in sync aside from sequencer edits from Peter.
* bring back 'player' libtype, after investigation with ideasman.
scons/mingw works nicely, for some reason msvc fails to link still, will look further into it.
* further cleaning of 'player' stuff. Now only 3 libs are remaining, of which ideally the stubs lib will be fixed at some point, fading away into the dark history of not-so-nice code. The current blenderplayer part is still a little bit hackish, I'll see if I can find a better alternative, for now it works good enough.
* first working changes to get blenderplayer linking
* blenderplayer/ moved into source/ (CMakeLists.txt changed for that too)
* added externs for bprogname to gp_ghost, so that it links properly
* Add BGE_CXXFLAGS so we can get rid of hard-coded BGE compiler settings. This was only done for windows, but now linuxers and osxers should be able to set BGE-specific optimisation too. See the windows default configs for example.
Surprising this wasn't noticed before. Any mix of quads/tris caused the face verts of either quads/tries (whichever comes last).
Tested by exporting the KX_MeshProxy and re-importing as an OBJ.
This fix assumes there are only 2 m_darray's per face array which is currently true, but wont be if edge support is added back.
Instead use __contains__, eg.
if key in gameOb: ...
Mathutils returns from PyMath.cpp were incorrectly using wrapped Mathutils types. Wrapped types should only be used with a callback now.
Previously the only way to detect if the mouse moved over a different object was to enable true-level-triggering and have a python script detect the change.
When the Pulse option is set, focusing on a different object pulses true.
Python attribute is focusSensor.usePulseFocus.
This is similar to the collision sensors pulse option where changes in the set of collision objects generates an event too.
Found this functionality missing when trying to make a logic demo that used mouse-over with overlapping objects.