---------------------------------------------------------------------------
The Rasterizer code was relying in the values defined on TF_ DNA files. I'm working in the recode of TexFace, bringing the options to the material panel and ran into those cases. They are hard to spot and add a lot of the "magic" effect to the code. Hardcoded values are at least easy to spot. We (still) have a few defines duplicated, relying on each other (a flag previously defined in the code is checked later on but using a different define (although with same value. (e.g. TF_BMFONT and RAS_RENDER_3DPOLYGON_TEXT). It's hell =)
I'm adding some comments to help on that.
Things will be revamped anyways, but it's nice to keep the code a bit more coherent before the real feature commit. That's all, thanks for listening.
From the tracker:::
Issues fixed:
- ConeTwist-constraint's params weren't making it to the CcdPhysicsEnvironment, also added Hinge's params.
- UI wasn't using angles where applicable.
- btHingeConstraint's constructor can create frame-matrices which don't align so the hinge doesn's start at 0 degree tilt.
This is an issue when setting limits.
Changes:
- UI: Hinge limits can be set (and disabled).
- UI: ConeTwist only has max-limits and only the twistX can be disabled
- PyApi via rna_constraint.c: added the functions limit_xyz_min, limit_xyz_max (for 6dof), limit_angle_xyz_min,
limit_angle_xyz_max (for 6dof), limit_angle_x_min, limit_angle_x_max (for hinge).
- PyApi: dropped python-function limit_cone_min.
.:. Extra:
UI Changes:
- renamed "RigidBody Joint" to "Rigid Boidy Joint"
- reorganized UI to conform with other parameters (e.g. Limit Rot)
- added dis/active all over the place :)
X_Material's mScene member variable wasn't properly set on merge if it didn't have an mBlenderShader defined. This patch always makes sure it gets set on merge.
example of usage:
0) Game Properties: text (String) and log (Boolean=True)
1) Keyboard Sensor set to AllKeys with log as logging and text as Target
2) Expression Controller: text=="quit\n"
3) Game Actuator: Quit Game
[1] <-> [2] <-> [3] .:. this will quit the game when you write quit + Enter
4) Keyboard Sensor: set to Return
5) And Controller
6) Property Actuator: Assign text property to ""
[4] <-> [5] <-> [6] .:. this will reset the string everytime you press Enter
# # # # # # # # # # # # # # # # # # # # # # #
Since the change is in the InputParser.cpp it actually affects all the text
input fields in the Logic Editor. So for instance you can use it in the
assign Property Actuator.
# # # # # # # # # # # # # # # # # # # # # # #
Connect an expression controller: text="idclip\n" with an actuator to disable
the Collision of your walls and you can re-create Doom with only Logic Bricks (:
I have no idea why this hasn't been implemented before (the DEFINES were even there already). But since the Ipo (Fcurve) Actuator supports it I don't see why Action and ShapeKey shouldn't.
More than a new feature or a bugfix this is actually a step forward into unifying them.
after discussion over the mailing-list it seems that it really makes no sense to restrict that. Specially since we have the "Property" playback mode that usually will be a float.
Since there is no need for do_version or whatoever I don't see a problem. Any Thoughts? Maube to allow it only through the Python API?
----------------------------------
While we are more and more moving towards enabling features in the Python API, it's also important to have Logic Bricks working with no scripts.
This option allows you to start the game with the mouse cursor on (it's on Render Buttons). The defalt is still off (no do_version needed here).
Support for physics is done by skiping the modifiers that
don't support mapping to original mesh. This mapping is
required to report the hit polygon to the application
by the rayCast() function.
Support for graphics is done by using the same render
function that blender uses for the 3D view. This guantees
equal result.
Limitation: there is still a known bug if all these conditions are met:
- Display list enabled
- Old tex face with a several textures mapped to the same material
- no armature or shape keys
- active modifiers
In this case, only a part of the mesh will be rendered
with the wrong texture. To avoid this bug, use the GLSL
materials or make sure to have 1 material=1 texture in
your old tex face objects.
Since rev.2 (hans ftw) we have a strange situation where horizon color was being used at Convert time for the WorldInfo background color (and for the fog). However through the Python API only the Rasterizer background color was being updated. On top of that the KX_KetsjiEngine.cpp::SetBackGround was using the WorldInfo bgcolor when render mode was the potato one (TEXTURED). Bottomline, when in potato mode the glClearColor used was the original one in worldinfo, not the API updated one in Rasterized.
implemented the support for animated colors and a workaround for non animated colors. To be cleaned if/when this bug is fixed:
[#25487] BGE: Object Color only works when it has a keyed frame
* also increased the size of the text. Now it supports 280 (or 140 unicode) chars.
Problem/Bug:
------------
There were no way to have proper unicode characters (e.g. Japanese) in Blender Game Engine. Now we can :)
You can see a sample here: http://blog.mikepan.com/multi-language-support-in-blender/
Functionality Explanation:
--------------------------
This patch converts the Blender Font Objects to a new BGE type: KX_FontObject
This object inherits KX_GameObject.cpp and has the following properties:
- text (the text of the object)
- size (taken from the Blender object, usually is 1.0)
- resolution (1.0 by default, maybe not really needed, but at least for debugging/the time being it's nice to have)
The way we deal with linked objects is different than Blender. In Blender the text and size are a property of the Text databock. Therefore linked objects necessarily share the same text (and size, although the size of the object datablock affects that too). In BGE they are stored and accessed per object. Without that it would be problematic to have addObject adding texts that don't share the same data.
Known problems/limitations/ToDo:
--------------------------------
1) support for packed font and the <builtin>
2) figure why some fonts are displayed in a different size in 3DView/BGE (BLF)
3) investigate some glitches I see some times
4) support for multiline
5) support for more Blender Font Object options (text aligment, text boxes, ...)
[1] Diego (bdiego) evantually will help on that. For the time being we are using the "default" (ui) font to replace the <builtin>.
[2] but not all of them. I need to cross check who is calculating the size/dpi in/correctly - Blender or BLF. (e.g. fonts that work well - MS Gothic)
[3] I think this may be related to the resolution we are drawing the font
[4] It can't/will not be handled inside BFL. So the way I see it is to implement a mini text library/api that works as a middlelayer between the drawing step and BLF.
So instead of:
BLF_draw(fontid, (char *)text, strlen(text));
We would do:
MAGIC_ROUTINE_IM_NOT_BLF_draw(fontir, (char *)text, styleflag, width, height);
[5] don't hold your breath ... but if someone wants to have fun in the holidays the (4) and (5) are part of the same problem.
Code Explanation:
-----------------
The patch should be simple to read. They are three may parts:
1) BL_BlenderDataConversion.cpp:: converts the OB_FONT object into a KX_FontObject.cpp and store it in the KX_Scene->m_fonts
2) KetsjiEngine.cpp::RenderFonts:: loop through the texts and call their internal drawing routine.
3) KX_FontObject.cpp::
a) constructor: load the font of the object, and store other values.
b) DrawText: calculate the aspect for the given size (sounds hacky but this is how blf works) and call the render routine in RenderTools
4) KX_BlenderGL.cpp (called from rendertools) ::BL_print_game_line:: Draws the text. Using the BLF API
*) In order to handle visibility of the object added with AddObject I'm adding to the m_scene.m_fonts list only the Fonts in a visible layer - unlike Cameras and Lamps where all the objects are added.
Acknowledgements:
----------------
Thanks Benoit for the review and adjustment suggestions.
Thanks Diego for the BFL expertise, patches and support (Latin community ftw)
Thanks my boss for letting me do part of this patch during work time. Good thing we are starting a project in a partnership with a Japanese Foundation and eventual will need unicode in BGE :) for more details on that - www.nereusprogram.org - let's call it the main sponsor of this "bug feature" ;)
In windows this was producing Linking dependence errors because we have BLF_api.h in the /blenfont/ and blf_api.h in /python/generic/. It doesn't produces crash out of the box but I was trying to link both "api" files to the same project (Ketjsi folder). For the linking order was determining what header to use. A workaround is to "include" the file using some ../../ relative folder. But renaming it is less error prone.
Probably Ketsji folder shouldn't link to BLF_api.h anyways, but this is something I will look better later before another commit. In the mean time it's not a good idea to have 2 api files with the same name (for non case-sensitive systems).
from the tracker:
"""The required functionality is provided by the localOrientation property: setting this value will change the dynamic object orientation. This is because dynamic object have no parent and thus the local and world orientation are identical. However, setting worldOrientation will only change the scenegraph node, which has no effect as the physics controller will reset the orientation on next physics synchronization."""
This is a bug as old as the ability to change the actuator values through Python.
For the records: although Blender supports floats as frame values BGE doesn't. It could but it doesn't. So only integers (longs) will be valid start/end frames.
- Exceptions from reading vector values in the game engine where not being caught.
- Also wrote specific KX_GameObject exceptions, without these the errors are quite confusing.
- Object actuator rotation was being scaled by: (1/0.02)*2*PI/360 == 0.872, since revision 2.
- Remove scaling and use do_versions to adjust existing files.
we were using SENSOR_RAY for the radar sensor axis. However the Ray axis is inverted (God knows why) so I created a set of defines only for radar sensor.
Also I thought it was a good idea to replace some hardcoded values in Radar and Ray codes by their defines in DNA_sensor_types.h (similar to what Benoit did for Armature Sensor, so I see no problem on that).
Here is a image of it in action:
http://www.pasteall.org/pic/show.php?id=6351
What it monitors:
* VRAM used by textures created via bf_gpu and BL_Textures
What it does not monitor:
* VRAM used by the Blender ui
* VRAM used by 2d filters
* VRAM allocated by the user via KX_Scene.pre_draw and KX_Scene.pre_draw
- incorrect range check broke ZYX euler rotations, use MIN/MAX constants so this doesn't happen again.
- BGE Armature PyAPI also wasn't using correct min/max with rotation modes.
- clamp on file read rather then when calling the rotation functions, so developers don't use invalid args without realizing it.
- added assert() checks for debug builds so invalid axis constants don't slip through.
* Built-in filters were not being analyzed, which means no depth or luminance textures for them
* Removed an unnecessary if that becomes really hairy when new built-in filters are added (ie, when filters are defined beyond the value used for custom filters)
having the blend file as a part of the __file__ variable is not essential, this is fixed in python 3.2 so add an ifdef and don't use the blend file path for py older then 3.2.
Simple python benchmark shows this to be about 3x faster in the case where an update isn't needed.
This also speeds up rna function argument parsing, since each arg in a function call did 2 string lookups on the context which were never needed.
running a shape actuator on a softbody would crash because it assumed the deformer was a BL_MeshDeformer.
Added TODO note, since it would be nice if softbody would work with shape keys too.
globbing vs explicit is discussed here.
http://www.cmake.org/pipermail/cmake/2008-December/025694.html
Practical implications are:
- developers need to keep CMakeLists.txt files up to date.
- Users wont get strange linking errors if they build after a file is added, since CMake detects CMakeLists.txt is modified and automatically reconfigure.
Both stored the filename of the blend file, but G.sce stored the last opened file.
This will make blender act differently in some cases since a relative path to the last opened file will no longer resolve (which is correct IMHO since that file isnt open and the path might not even be valid anymore).
Tested linking with durian files and rendering to relative paths when no files is loaded however we may need to have some operators give an error if they are used on the default startup.blend.
- omit render code from this warning (cmake only), until render branch is merged.
- moved -Wunused-parameter warning to apply to all C code in blender (not just ./source/blender), (cmake only).
- removed deprecated bitmap arg from IMB_allocImBuf (plugins will need updating).
- mostly tagged UNUSED() since some of these functions look like they may need to have the arguments used later.
- made interface, windowmanager, readfile build without unused warnings.
- re-arranged CMake's source/blender build order so less changed libs are build later, eg: IK, avi
First commit to make some structure in doc/ directory.
- moved source/blender/python/doc -> doc/python_api
- moved source/gameengine/PyDoc/*.rst -> doc/python_api/rst
- modified accordingly sphinx_doc_gen.py and sphinx_doc_gen.sh
(later on I'll try alternative/ scripts by neXyon as promised :)
- source/gameengine/PyDoc/ is still there because contains epydoc stuff for the bge, will ask more and look into it later
disabling GL_Blend at the 2dfilter drawing routine makes the trick here. there is not a clear function invoked before the 2dfilter drawing routine. Therefore I found better to disable alpha blending while we are setting the other OpenGl attributes/matrixes.
We are not re-enabling GL_BLEND after we disable it. We could and it wouldn't hurt but I can't see why to. open to suggestions here of course.
Whenever using AddObject actuator, this feature gives you control over morbid events (a.k.a. trigger events before the object ends).
Demo file here:
http://blenderecia.orgfree.com/blender/tmp/cube_life.blend
Feature implemented as part of the BGE development workshop in BlenderPRO 2010 - Fortaleza, Brazil
This patch brings back the old functionality from Blender 2.49.
However we are forcing the format to be PNG only (as we had previously on blenderplayer).
Note: If letterboxing is on, we are recording only the camera area of the canvas (cool hein?).
Note2: I have a feeling that this is faster than what we had in 2.49 (which was really slow imo). Maybe it could be even faster if we disable PNG compression. Maybe an option for the future.
* patch finalized and committed as part of the BlenderPRO 2010 - BGE development workshop :) *
* A few places in the bge.events docs mentioned bge.keys, when it should have been bge.events
* Created two aliases to bge.events.RETKEY: ENTERKEY and RETURNKEY
* ENTERKEY and RETURNKEY have been added to the docs and RETKEY marked as deprecated
* Added an example of using bge.logic.keyboard to the bge.events docs
now addon path is created using the same path functions and selecting where to save the startup.blend
also made some minor changes to path handling funcs.
* Fix var declaration in bpy_interface.c
* Remove forward declarations from py_capi_utils.h: they are unnecessary and break compiles (there were probably many warnings about this during compile with GCC).
- ignore MSVC warnings when FREE_WINDOWS is defined to quiet warnings.
- the CMake flags were not being set correctly making blender have weirdo colors (no -funsigned-char).
The funny thing is: I only spotted this bug in March of this year. Almost one year after the original release. I think I don't parent objects to the camera often.
In terms of code I think that I can even think in a more elegant solution. I don't really need to rotate the camera, but simply to calculate its Modelview Matrix.
"""
m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0);
cam->SetModelviewMatrix(viewmat);
"""
The reason why I originally was rotating the camera was to make sure the frustum calculation was using the right camera frustum. For the frustum it takes the camera modelviewmatrix so the rotation really shouldn't be necessary. Leaving as it's for the time being.
* Note: the bug was never officially reported
The FullScreen state was never set. Therefore the window boundary was returning the wrong dimensions (it was assuming that it was not fullscreen).
* Note: blender.exe -W has a similar problem. We are working on that ...
Tested in Windows only. If someone can test in Linux and OSX please let me know if it's good there as well. To test it: ./blenderplayer -f myfile.blend
After last commit I realized that we have a different behavior when running blenderplayer or a runtime. Reason being is that when running blenderplayer the filename is mandatory. While in runtime mode it has no use for it (it can still be passed, but it makes no difference).
I also updated the -h (help) message to be multiplataform and to pass the filename argument only when in blenderplayer mode.
If someone wants to have fun it would be nice to port the blender new parsing code to the gameplayer.
* note: how come "noaudio" is used in the examples but it's not in the options list? *ouch*
I'm leaving as it's in case noaudio get implemented ...
argc always include the filename, therefore all the optional parameters should check for < argc instead of <=argc.
E.g. That was causing "blenderplayer -f 800 600 myfile.blend" to play in a wrong Bpp (since it was trying to parse the filename to fullScreenBpp).
Bug introduced on rev. 16448 (in 2.49) and merged to 2.5 in rev. 19323
this was the one module left to be renamed.
We didn't get to any conclusion in the mailing list, but Campbell suggested texture and I think its a good name. We can change any time before next Beta, but for now I think it's handy to have something.
The original proposal is from May:
http://lists.blender.org/pipermail/bf-committers/2010-May/027587.html
This patch makes SCA_PythonKeyboard.events and SCA_PythonMouse.events return a dictionary of all inputs (including inactive) instead of a list of active inputs.
Example usage:
import bge
if bge.logic.keyboard.events[bge.events.SPACEBAR] = bge.logic.KX_INPUT_JUST_ACTIVATED:
print("Spacebar pressed!")
A couple of changes to the patch:
* Wrap python stuff in #ifndef DISABLE_PYTHON
* Clear and decref m_event_dict in the destructors
A couple of things not related to the patch:
* Made member variables private
* Removed a commented out (and no longer used) method (SCA_PythonMouse.show())
This patch allows a user to pass binary data to LibLoad() to load a blend file from memory instead of a file path. I don't know how useful this will be for others, but I've used it so far for:
* Decrypting .blend files and loading them without having to store the .blend on the hard drive
* Pulling .blend data out of an archive and loading it (again skipping the hard drive)
So, it seems the biggest use for this is skipping a bit of file IO (and possibly some security problems).
Example usage:
import bge
with f as open('myfile.blend', 'rb'):
data = f.read()
bge.logic.LibLoad('Name', 'Scene', data)
Rough summary of fixes/changes:
- Blender Py API: GameLogic -> bge.logic
- Blender Py API: Implemented missing KX_PYATTRIBUTE_TODOs and -DUMMYs.
- Fix for [#22924] KX_PolygonMaterial.diffuse does not return expected list[r,g,b]
- Py API: Renaming _owner attribute of mathutils classes to owner.
- Fix some minor errors in mathutils and blf.
- Enabling game engine autoplay again based on a patch by Dalai:
* The biggest 3D view in the open scene is used, if there is none, blender opens the file normally and raises an error.
* The 3D view are is made fullscreen.
* Quad view, header, properties and toolbox panel are all hidden to get the maximum view.
* If the game engine full screen setting is set, the game starts in fullscreen.
- Fix for ipo conversion on file transition in the game engine.
* All audaspace changes from the GSoC branch including the aud Python module
* This commit also includes some minor changes in source/gameengine/Ketsji/KX_PythonInit.cpp:
- Fixing names of some constants
- removing outdated stopDSP() python function
- Autoinclusion of bge instead of GameLogic
- Fix for some error messages: GameLogic -> bge.logic
The BGE was getting the namespace dict directly from __main__ which conflicts
with my recent fix to get the pickle module working which to overwrote the __main__ module on script execution.
Simple fix is to have the BGE and Blender use the same method of getting namespaces.
Renamed CreateGlobalDictionary() to bpy_namespace_dict_new() and moved into bpy_internal_import.c
pickle still wont work in the BGE since we make a copy of __main__ namespace but for speed would rather not have to replace the __main__ module many times per second.
* add support for LCMS (disabled by default, set WITH_LCMS to true to enable it)
* fixed typo that prevented TIFF support to be properly enabled
* enable ray optimization by default (scons and cmake already did this)
* fixed building with libsndfile on darwin (disabled by default)
* quicktime: use audaspace headers from $(NAN_AUDASPACE)/include instead of intern
* gameengine: add -DWITH_FFMPEG to compiler flags when building with ffmpeg support
- remove scons option WITH_BF_FHS, its not needed anymore.
- comment WITH_BF_DOCS, was using epydocs which we dont use now.
- blenderlite target was broken, always using openmp.
- building without python wasnt working.
- fixed some warnings.
BL_ArmatureChannel.rotaion_euler -> BL_ArmatureChannel.rotation_euler
Making the docs match the code:
BL_ArmatureChannel.rotation -> BL_ArmatureChannel.rotation_quaternion
BL_ArmatureChannel.euler_rotation -> BL_ArmatureChannel.rotation_euler
BGE Py Controllers were effectively doing this...
"a.b.c" --> "__import__('a').b.c()"
This was annoying because it meant module 'a' would need to import 'b' explicitly.
Now use import like this.
"a.b.c" --> "__import__("a.b").c()"
Note that this has the slight disadvantage that these need to be modules, where as before they could be collections of functions in a class instance for eg. So its possible this breaks existing files but dont think anyone used this since its a fairly obscure use case.
Rather then only baking parent objects. Only bake objects which are have no parents in the original scene.
This allows for parenting and unparenting within the game engine without gaps in the animation curves.
bge.types
---------
- removed lists if they were already available in bge.logic and crosslinked
where the list contained description, moved the descriptions in bge.logic
so we have useful thing in one place only
- fixed a lot of bad formatting, like bad indentation and usage of TAB
- changed from literal to codeblocks that smerch for the useful suggestion :)
- whered appropriate I've moved code examples to the end, after notes and all
it is blocking to have a big black block before actually see a method parameters or return type
- have doubt about the list at bge.types.html#bge.types.SCA_MouseSensor.mode
possibly tomorrow will ask Dalai
bge.logic
---------
- added sensor status list
- cross linked with bge.types where needed
- added a section "ShapeAction Actuator" because in bge.types these constants are docuemented, but in 2.5 I don't see the ShapeAction Actuator
(anymore, or for now)
I'll ask Dalai tomorrow or when possible (check bge.logic.html#shape-action-actuator once cambo rebuilds the docs)
- moved descriptions from bge.types lists to logic page where appropriate
- where possible, added custom directive :value: so we have a consistent way to show the value of constants
some more cleanup:
- made structure in source/gameengine/PyDoc/bge.events.rst to be able to crosslink properly
- cleaned notes and warnings syntax, and also now they are always the last elements after all the other tags
- substituted some lists of possible values of a parameter with links to lists of values (not finished)
like in bge.types.html#bge.types.SCA_PythonKeyboard
- uncertain about some values, like in http://www.blender.org/documentation/250PythonDoc/bge.types.html#bge.types.SCA_ISensor.status
(list of KX_SENSOR_INACTIVE,... etc aren't documented or non-existant, will investigate)
- now that I've made syntax changes in the previous commit I moved blocks to to have sensors/actuators grouped together
- added sections to have a nice table of contents
- formatted 2 lists and links to classes
* source/blender/python/doc/sphinx_doc_gen.py
changed syntax for declating attributes type to use :type: instead of *type* os it
* source/gameengine/Ketsji/KX_PythonInit.cpp
While documenting I've found that we have two naming conventions for constraints in BGE python api,
example: KX_CONSTRAINTACT_DIRPZ and KX_ACT_CONSTRAINT_FHPX: the right convention is KX_CONSTRAINTACT_xxx
After talking with dalai and cambpell we agreed that this kind of change is better suited for NExyon GSoC
so I marked as TODO
Also, found 2 duplicate rows, fixed after askin nexyon
* source/gameengine/PyDoc/bge.logic.rst
there were 2 blocks for constraints, I've put them together in docs and fixed some other lines
* source/gameengine/PyDoc/bge.types.rst
first cleanup: mainly started using ":type:", it was mixed usage of *type* and **type**
started cleaning some bullet list in a way that varibles link to the constant in appropriate page
I'll continue later
This fix the problem of not being able to play animations created with Blender 2.5 in BGE. Patch reviewed by Benoit
Added also other parent to modifier conversions as requested by Joshua (aligorith). I didn't bump subversion here, but the patch should work still. If not I'm increasing subversion sooner anyways (tomorrow or by the middle of the week I hope).
I was waiting to commit this one together with the Logic Editor datablock patch (converting material_name DNA properties to struct Material *). However my patch is getting too big and it's better if it's alone (easier to analyze later, eventual fixes, ...)
Mitchell, this commit adds a function that can help hardware skinning - HasArmatureDeformer()
tile cache code in imbuf, but it is not hooked up to the render engine.
Imbuf module: some small refactoring and removing a lot of unused or old code
(about 6.5k lines).
* Added a ImFileType struct with callbacks to make adding an file format type,
or making changes to the API easier.
* Move imbuf init/exit code into IMB_init()/IMB_exit() functions.
* Increased mipmap levels from 10 to 20, you run into this limit already with
a 2k image.
* Removed hamx, amiga, anim5 format support.
* Removed colormap saving, only simple colormap code now for reading tga.
* Removed gen_dynlibtiff.py, editing this is almost as much work as just
editing the code directly.
* Functions removed that were only used for sequencer plugin API:
IMB_anim_nextpic, IMB_clever_double, IMB_antialias, IMB_gamwarp,
IMB_scalefieldImBuf, IMB_scalefastfieldImBuf, IMB_onethird, IMB_halflace,
IMB_dit0, IMB_dit2, IMB_cspace
* Write metadata info into OpenEXR images. Can be viewed with the command
line utility 'exrheader'
For the image tile cache code, see this page:
http://wiki.blender.org/index.php/Dev:2.5/Source/Imaging/ImageTileCache
Tested with GameLogic.mouse.position and mouse over sensor.
It should be working with other mouse sensor as well. If not, please help to test and report a bug.
(couldn't test blenderplayer but it should be working there as well).
(Benoit, this is the same patch that I sent you. I hope it's OOP enough. Looking forward to hear from you on that)
I believe that this was the last "mouse" related bug we had reported. MouseLoook scripts should be working 100% in Blender/BGE 2.50 now \o/
PhysicsConstraints module documented by Jean-François (Ninja Goliath) based on GameKit 2nd ed.
Thanks for the initiative and the great help!
General advice for anyone helping with EpyDocs:
* use :: instead of : to keep the indentation correct,
* use B{} for clarity when needed (e.g. createConstraints)
Adding F13 to F19 to complement Matt's recent commit
* There are other (not so important) functions in PhysicsConstraints module that are not exposed in the documentation right now.
The generated page is temporarily here, if someone want to review it:
http://blenderecia.orgfree.com/blender/tmp/PhysicsConstraints-module.html
- collada export would run MEM_freeN on an un-initialized pointer in some cases.
- makesrna was missing a call to close a file.
- text cursor update function was missing a NULL check for st->text.
- possible (unlikely) un-initialized return value for bge python lamp.type, set error instead.
- possible (unlikely) missing NULL terminator with strncpy for ffmpeg.
- BGE Shader.setSampler(name, index): index range check was wrong.
- Compositor check for an invalid channel was incorrect.
- getting the center of selected verts used an uninitalized z axis.
- do_init_render_material() used && rather then & when testing for MA_TRANSP.
- weight paint activate flipped bone used && rather then & for flag checking.
The patch exposes mouse and keyboard read-only properties in the GameLogic module
Also renames bge.keys to bge.events (* Note: name of bge submodules (logic, render, ...) may change before 2.5 final release [right Campbell?]).
"""
This patch adds two new types to the BGE:
SCA_PythonKeyboard
SCA_PythonMouse
These two types allow users to make use of the keyboard and mouse without the need for a keyboard or mouse sensor.
SCA_PythonKeyboard has an events property that acts just like SCA_KeyboardSensor.events.
SCA_PythonMouse also has an events property to check for mouse events. Further more it supports getting and setting normalized cursor position (from 0.0 to 1.0) with SCA_PythonMouse.position. The cursor can be shown/hidden using SCA_PythonMouse.visible.
"""
Its use is similar with current mouse and keyboard controllers. With the exception of mouse position being normalized and writable as well (replacing Rasterizer.setMousePosition).
Code Sample:
######
from bge import logic, events
mouse = logic.mouse
keyboard = logic.keyboard
for key,status in keyboard.events:
if status == logic.KX_INPUT_JUST_ACTIVATED:
if key == events.WKEY:
print(mouse.position)
# move_forward()
mouse.visible = True # turn cursor visible
mouse.position = 0.5,0.5 # centralize mouse - use tuple
######
* Important Note: mouse.position still will not work properly for Letterbox mode.
In order to fix letterboxing I may need to move the set x,y mouse function to inside the canvas code (to avoid duplicated code between mouse sensor and bge.logic.mouse). I'll leave this for another commit though.
Thanks Mitchell for the work on that.