Commit Graph

935 Commits

Author SHA1 Message Date
Dalai Felinto
95dcf11a88 BGE: Font Object support to animated (object) colors
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.
2011-01-04 21:27:44 +00:00
Campbell Barton
5e382eb8e5 rename blenderlib to blender_add_lib 2010-12-22 23:09:30 +00:00
Campbell Barton
fb977b793e minor warnings removed. 2010-12-17 16:05:40 +00:00
Dalai Felinto
61a7c8d4ae BGE Font: increasing the limit of the text object to 140 2010-12-17 02:45:17 +00:00
Guillermo S. Romero
fef0549ea5 SVN maintenance.
Plus some typo fixes in comments.
2010-12-16 19:05:47 +00:00
Dalai Felinto
0890b80ed9 Patch:[#25163] BGE support for Blender Font objects - unicode support
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" ;)
2010-12-16 10:25:41 +00:00
Dalai Felinto
f1c4688e25 renaming blf_api.h to blf_py_api.h
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).
2010-12-09 17:31:42 +00:00
Campbell Barton
afacd18498 use lowercase for cmake builtin names and macros, remove contents in else() and endif() which is no longer needed. 2010-12-08 08:43:06 +00:00
Dalai Felinto
70df57df0f BGE BugFix: [#24052] Can't change dynamic object's orientation using python (fix by Benoit)
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."""
2010-12-08 06:59:13 +00:00
Dalai Felinto
fe0f78a669 BGE BugFix: [#21246] Some values for ipoactuator.frameEnd and frameStart make ipo not play the first time
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.
2010-12-07 01:54:25 +00:00
Campbell Barton
357826aa6e bugfix [#24967] bge.KX_GameObject.worldAngularVelocity does not work, breaks mathutils somehow
- 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.
2010-12-06 08:29:41 +00:00
Campbell Barton
cd97253502 - added GCC warning -Wstrict-prototypes
- fixed bug in paste material, exposed by stricter warnings.
- removed/renamed various shadowed vars.
- removed BGE lamp.colour, only allow lamp.color attribute.
2010-12-03 12:30:59 +00:00
Campbell Barton
df6169dada bugfix [#23423] Multi-window : closing game windows cause blender crash
detect closing window while the BGE runs and exit without crashing, as if Esc was pressed.
2010-11-30 21:51:03 +00:00
Campbell Barton
42d6603cae Add option for CMake to build libredcode, also use CODEC prefix for ffmpeg, quicktime & sndfile options. 2010-11-30 18:52:39 +00:00
Campbell Barton
1dd1cea06e fix for error when changing DISBALE_PYTHON -> WITH_PYTHON,
This define wasn't set in some parts of the BGE causing problems with the view matrix.
in CMake define for the entire BGE fixes this.
2010-11-29 07:56:45 +00:00
Campbell Barton
e8397e6193 include headers in cmake source, added a script to check for consistency, reporting missing headers & C files.
this is important so IDE's using CMake integration always get blender headers. - QtCreator & MSVC for eg, probably others too.
2010-11-29 04:35:56 +00:00
Dalai Felinto
9d9a88348e BGE Bugfix: [#24926] Sensor 'Radar' les axes X+ et Y+ ont été inversé. (oui, a french bug report :)
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).
2010-11-26 03:37:08 +00:00
Mitchell Stokes
32eba0898b Reverting revision 33120, which added vram monitoring. The method used had some problems (especially in the freeing function). I will research an alternative solution and submit it to the tracker. 2010-11-24 06:27:07 +00:00
Mitchell Stokes
8abb58b7ce Changing KX_Camera.perspective didn't actually change the camera's perspective because the camera's matrix was cached. The setter for KX_Camera.perspective now invalidates the camera's matrix so it's recomputed with the change. 2010-11-21 01:55:08 +00:00
Mitchell Stokes
844e63f3b6 Fixing a crash when dynamically loading a scene that contains a bone parent. 2010-11-19 04:06:06 +00:00
Campbell Barton
da1f288f50 rename libs internal libs for CMake + SCons (used in MSVC project files)
for game engine use "ge_" prefix & make names generally more descriptive.
2010-11-18 11:42:05 +00:00
Mitchell Stokes
1bb98b4194 Adding monitoring for (approximate) VRAM used by textures. The information is currently only used in the profiling data of the BGE.
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
2010-11-17 05:28:25 +00:00
Campbell Barton
1f1c0b8027 patch #24737] PyCObject depreciated in py3k [patch]
from Dan Eicher (dna), use PyCapsule rather then PyCObject
2010-11-16 02:18:50 +00:00
Campbell Barton
0876fce009 rename and negate DISABLE_PYTHON --> WITH_PYTHON 2010-10-31 04:11:39 +00:00
Campbell Barton
bae43df4ec building the BGE without bullet works again. 2010-10-31 01:04:31 +00:00
Daniel Salazar
bd8758561f Build fix by Mike S 2010-10-30 02:59:42 +00:00
Campbell Barton
676829ccba workaround for python bug [#24400] If Script is executed with TEXT Editor, it becomes an error.
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.
2010-10-27 06:05:22 +00:00
Campbell Barton
3264ced377 move geometry python module into mathutils.geometry, since it provides utility functions using mathutils types. 2010-10-25 22:44:01 +00:00
Campbell Barton
29605fc06d Added function RNA_property_update_check() to check if an update call is needed,
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.
2010-10-25 21:57:45 +00:00
Campbell Barton
c6976e7351 use explicit file paths for CMake rather then globing, This is recommended by cmake devs.
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.
2010-10-23 04:05:55 +00:00
Campbell Barton
a9f79ee536 Quiet compiler warnings. 2010-10-20 12:33:00 +00:00
Campbell Barton
8268a4be71 most unused arg warnings corrected.
- 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.
2010-10-16 14:32:17 +00:00
Dalai Felinto
4814ffa07b BGE object.life - gives you the life countdown for temporary objects.
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
2010-10-11 10:47:20 +00:00
Campbell Barton
a20843bf34 building without python works again for the BGE 2010-10-10 20:59:30 +00:00
Campbell Barton
f49fc58df6 enable building the game engine without bullet for scons & cmake 2010-10-10 07:01:56 +00:00
Mitchell Stokes
f7fb4e70b3 Fixing a memory leak with SCA_PythonKeyboard and SCA_PythonMouse. 2010-10-09 01:31:20 +00:00
Nathan Letwory
663ce490e0 Enable CXX_GUARDEDALLOC support through SCons. 2010-10-08 20:39:56 +00:00
Mitchell Stokes
02d97e4da2 Campbell requested that I remove one of the bge.events.RETKEY aliases, so I'm removing bge.events.RETURNKEY. 2010-10-06 00:36:12 +00:00
Mitchell Stokes
3cf2d2fd4e A bit of bge.events work:
* 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
2010-10-05 05:44:15 +00:00
Campbell Barton
ab8aa13b82 bugfix [#24087] Blender can not install add-ons unless running with root priviledges
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.
2010-10-03 20:00:22 +00:00
Guillermo S. Romero
fbe1b518f0 Fix attribution, as noticed by Dalai Felinto. 2010-10-03 16:39:07 +00:00
Campbell Barton
90665eb107 use constant rather then sqrt(2.0) 2010-09-30 07:06:00 +00:00
Nathan Letwory
ab5b95d148 * Update BGE for change in r32001
* 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).
2010-09-18 19:38:27 +00:00
Campbell Barton
9b518710c6 update for MingW/CMake
- 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).
2010-09-15 16:13:32 +00:00
Dalai Felinto
ee7a2ccb22 BGE Dome: fix for "objects parented to the camera will be rendered multiple times in Dome mode"
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
2010-09-15 07:05:55 +00:00
Dalai Felinto
3a2fc4d6dc BGE module reshuffling - VideoTexture -> bge.texture
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
2010-09-11 19:38:11 +00:00
Campbell Barton
2406ebe1a4 - added back zlib include (needed for win32).
- use list append in more places.
- remove non existing include dir.
2010-09-07 01:13:10 +00:00
Guillermo S. Romero
a8269c8946 SVN maintenance. 2010-09-03 03:30:20 +00:00
Nathan Letwory
6c113b54b3 Finally change SConscript tabs to spaces. 2010-08-29 20:52:05 +00:00
Benoit Bolsee
ad70072009 BGE patch #22623 applied: new bound type: Capsule. 2010-08-28 20:56:54 +00:00