Commit Graph

245 Commits

Author SHA1 Message Date
Campbell Barton
89c9aaaa25 remove references to BKE_utildefines where its not needed.
- move GS() define into DNA_ID.h
- add BLI_utildefines as an automatic include with makesrna generated files.
2011-01-07 19:18:31 +00:00
Campbell Barton
5e382eb8e5 rename blenderlib to blender_add_lib 2010-12-22 23:09:30 +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
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
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
51a66c27f3 replace overly verbose matrix creation for BGE camera, typo fix from MikeS. 2010-11-29 20:57:02 +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
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
Campbell Barton
030253cdf6 fix for building, also use const char in more places. 2010-11-11 07:51:12 +00:00
Campbell Barton
0876fce009 rename and negate DISABLE_PYTHON --> WITH_PYTHON 2010-10-31 04:11:39 +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
4d37cf90b9 remove G.sce, use G.main->name instead.
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.
2010-10-18 06:41:16 +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
Campbell Barton
1807beabf5 - UNUSED macro wasn't throwing an error with GCC if a var become used.
- 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
2010-10-16 02:40:31 +00:00
Dalai Felinto
682740e7aa make file update for recent bge.render.makeScreenshot commit 2010-10-11 18:47:28 +00:00
Dalai Felinto
6b8ca3ccdf patch [#24178] bge.render.makeScreeshot - with help from Campbell(ideasman42)
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 :) *
2010-10-09 13:46:34 +00:00
Nathan Letwory
663ce490e0 Enable CXX_GUARDEDALLOC support through SCons. 2010-10-08 20:39:56 +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
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
Nathan Letwory
6c113b54b3 Finally change SConscript tabs to spaces. 2010-08-29 20:52:05 +00:00
Benoit Bolsee
972c6d86f0 BGE bug #23213: VBO preference make object with modifiers crash the BGE. Fix by disabling VBO inside the BGE, it brings no advantage anyway. 2010-08-23 20:53:02 +00:00
Joerg Mueller
47d38dbd20 svn merge -r 31211:31313 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2010-08-13 10:50:29 +00:00
Guillermo S. Romero
95aa8cfa4a Update address in license block. 2010-08-10 21:22:26 +00:00
Joerg Mueller
06d2dc86a1 svn merge -r 30954:31059 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2010-08-05 08:23:26 +00:00
Campbell Barton
940d1dcd0a remove commented scons lines from cmake files, fixed use of pointer poll function for ID drobdowns (currently unused) 2010-08-03 08:12:55 +00:00
Joerg Mueller
c59b930d13 Audaspace: Refactored the complete 3D Device code giving a nicer API. 2010-07-30 22:20:08 +00:00
Joerg Mueller
3cef95cd93 Fix for ipo conversion on file transition in the game engine. 2010-07-08 17:47:46 +00:00
Joerg Mueller
229b7639e7 Merged revision 29562 from /branches/soc-2010-nexyon. 2010-06-19 10:50:23 +00:00
Joerg Mueller
7019089dca * New users_logic property for Texts to find out which texts are used in a GE logic brick.
* Fixed a bug in KX_ObjectActuator where the fuzzy flags weren't updated when setting properties from within python.
* Moved do_versions_ipos_to_animato from blender.c to readfile.c, where it should be.
* Fixed a bug on file transitions with the GE when files have different FPS settings.
2010-06-19 10:47:24 +00:00
Campbell Barton
ed338da8c9 - WITH_CXX_GUARDEDALLOC working again
- CMake building without python or fluidsim working again (broke in recent commit)
- remove BLI_short_filename(), it wasnt used anywhere.
2010-06-06 01:15:44 +00:00
Dalai Felinto
edc56fae18 BGE Fix: [#19951] mouse over sensor is broken with letterboxing framing
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/
2010-04-23 22:48:26 +00:00
Matt Ebb
45abe2baf2 Added F13 - F19 keys for game engine too. 2010-04-20 01:04:00 +00:00
Campbell Barton
8f1500da00 remove config.h references, was added for automake build system rev around 124-126 but isnt used by any build systems now. 2010-04-18 10:28:37 +00:00
Dalai Felinto
795b438bf5 Patch #21789 - BGE Keyboard and Mouse Python types - by Mitchell Stokes(Moguri)
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.
2010-04-17 06:52:14 +00:00
Dalai Felinto
a8bca52d09 BGE fix #20456 - 2.5: mouse position problem (offseted by 1 vertically)
In Blender 2.49 the win width and height were been calculated including an extra pixel (e.g. a fullscreen editor would be (width + 1) by (height + 1) )
In opposite to that, Blender 2.5 window/editor code were fixed to have the exact width,height size.
So although the BGE canvas code was still the same as 2.49 it was producing a wrong result.

I'm also adding some commentaries in the setViewport code. BGE is setting the viewports 1 pixel larger.
the setViewport command is been used as if one should pass (minx, miny, width, height), while it should be (minx, miny, maxx, maxy). I will take care of that later, if any one has extra comments on that, please let me know.
2010-04-11 01:53:21 +00:00
Campbell Barton
1708ac0723 rename some functions to use easier to understand names.
'BLI_makestringcode' --> 'BLI_path_rel'
'BLI_convertstringcwd' --> 'BLI_path_cwd'
'BLI_convertstringframe' --> 'BLI_path_frame'
'BLI_convertstringframe_range' --> 'BLI_path_frame_range'
'BLI_make_cwdpath' --> 'BLI_path_cwd'
2010-03-09 17:36:23 +00:00
Dalai Felinto
0cad3ae24c BGE 2D Filters: filters run per scene now (fix for [#18152]) - it (slightly) breaks backward compatibility !!!
Originally we had 2DFilters (m_filtermanager) stored in RenderTools. That way filters were stored globally and were being called once per each scene. This was producing two big problems: (1) performance and (2) flexibility of use.

(1) Performance - To run the filters 2X == 2X slower
(2) flexibility of use - Very often we want the filter in the scene but not in the UI for example.

For those reasons I believe that 2DFilters with multiple scenes was very useless or unpredictable. I hope they work fine now.
To make it work as before (2.4) you can simply recreate the 2dfilter actuators across the scenes.

* * * * *

Imagine that we have:
(a) Main Scene
(b) Overlay Scene

in Main Scene the Z Buffer and RGB will be from the main scene.
in Overlay Scene the Z Buffer will be from the Overlay Scene and the RBG buffer is from both [(a + 2D Filter) + b].

So in pseudo code if we have a,b,c,d,e scenes we have: (2DFilterE(2DFilterD(2DFilterC(2DFilterB(2DFilterA(a) + b) + c) + d) + e)
2010-03-03 06:38:47 +00:00
Campbell Barton
0c89dcc25c matrix functions, to_3x3, to_4x4
force fixed time when recording in the BGE.
2010-02-23 09:39:47 +00:00
Campbell Barton
4ef1fd1078 game engine support for recording animation back & some other minor changes. 2010-02-22 12:25:58 +00:00
Campbell Barton
b65a983d39 use BLI_findstring in more places & remove some warnings, no functional changes. 2010-02-22 09:22:36 +00:00
Campbell Barton
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Campbell Barton
affe84a453 get rid of annoying duplicate python initialization code, added setupGamePython() which initializes modules 2010-01-10 22:03:26 +00:00
Dalai Felinto
e37e3845a1 BGE: stereoscopic settings changes: (1) eye separation is the UI (2) focallength uses camera focallength
Now the default eye separation value is 0.10 (reasonable for games with 1 meter == 1 B.U.
The focallength used is the camera focal length (DOF settings). It allow you to even use different focal lengths for different scenes (good for UI)

In order to change it you can change the camera focal length or use Rasterizer.setFocalLength.
If you use the Rasterizer method it will use this value for all the cameras.

ToDo:
- Blenderplayer settings
- Update wiki documentation (any volunteer)?

* Note to stereo fans:
I don't have a real stereo environment to test it (other than cheap cyan-red glasses). If you can give it a try in a more robust system and report bugs or problems with BGE current system please let me know. I would be glad to help to make it work 100% by the time Blender 2.5 is out.

For the record, BGE is using the method known as 'parallel axis asymmetric frustum perspective projection'. This method is well documented here:
http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/stereographics/stereorender/
2009-12-29 15:47:20 +00:00
Benoit Bolsee
2318886f70 BGE: fix bug in mouse button release detection 2009-12-08 08:46:07 +00:00
Dalai Felinto
d875f4927e patch [#19796] GLEW update by Mitchell Stokes (Moguri)
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)
2009-11-21 20:36:03 +00:00
Campbell Barton
b2bb9ca39a Mitchell Stokes BGE MouseWarp patch + warning fix
[#19854] [bugfix] Fix for broken Rasterizer mouse functions
---
This patch fixes the embedded player's ability to control the mouse. For example, hiding and unhiding the mouse cursor
did not work in 2.5, nor could the mouse's position be controlled. This was because these parts still needed to be ported
to 2.5 window manager code.
2009-11-11 08:32:29 +00:00
Campbell Barton
1c1659eb28 - Right click menu can open links directly to API reference docs (rna and operators)
- Generated and uploaded api docs - http://www.blender.org/documentation/250PythonDoc
- Added Edit docs menu item & operators as discussed with Mindrones, Brecht, Stani & Letterip @ bconf, needs some web backend. python operator can aparently use xml/rpc to upload docstrings.
- Added operator invoke function - context.manager.invoke_props_popup(self.__operator__, event)
  this calls a popup for invoke by default (which intern calls execute())

- Own recent commit to game framing applied to non-camera views too.
- v3d->persp is deprecated but still used in some places.

- Transforming strips could overlap 1 frame if moving them below frame 0
- Transforming overlapping strips could go into an eternal loop (though overlapping strips should not exist)
2009-10-27 02:54:25 +00:00