Commit Graph

272 Commits

Author SHA1 Message Date
Dalai Felinto
5184476fe1 bugfix: [bf-blender-Game Engine][28167] Restart game actuator don't get changed material mode
http://projects.blender.org/tracker/?func=detail&aid=28167&group_id=9&atid=306
Game Actuator (restart or load a new file) will not keep some settings alive (as
we had in 2.49).

In 2.49 the solution used was to use Blender globals (G.fileflags) to get/set
those settings. That was causing the blender file to change if you change the
material mode from the game.

In 2.5 this never worked, and the implementation was buggy (it's relying in the
scene settings, which get reset ever time we restart/load a new file).

My idea for fixing this is to create a new struct (GlobalSettings) where we
store any setting to be preserver during the course of the game. This is
specially important for options that require the game to restart/load new file
(graphic ones). But it later can be expanded to support other things such as
audio settings (e.g. volume), ...
I'm also planning to expand it for stereo and dome settings, but I prefer to
first get this committed and then build a new patch on top of that.


I had some problems in finding a correct way for build/link the blenderplayer
changes, so although it's working I'm not sure this is the best code (e.g. I
couldn't make forward declaration to work in GPG_Application.h for the struct
GlobalSettings so I ended up including KX_KetsjiEngine.h)

[note: I talked with Brecht and he find this is an ok solution. He implemented
it originally so it's good to have his go. However I still think there must be a way to make forward declaration to work. I will see with other devs if there is a better solution]
[also I'm likely renaming glsl to flags later if there are more settings stored in the flags to be used. But for now we are only handling glsl flags]
2011-09-11 05:54:07 +00:00
Campbell Barton
9161d3ce4b use Py_ssize_t rather than int when dealing with list sizes (original patch from Fedora but applied changes elsewhere too), also replace PyList_Size with PyList_GET_SIZE where typechecking is already done. 2011-09-06 23:46:20 +00:00
Campbell Barton
0cd5dce245 whitespace edits 2011-09-03 02:15:49 +00:00
Joerg Mueller
f0d5abfcb2 Merging trunk up to r39637. 2011-08-22 20:31:46 +00:00
Campbell Barton
17c8621cc8 fix [bf-blender-Patches][27924] Redundant applying of SetNetworkDevice
noticed by Jorge Bernal (lordloki)
2011-08-21 21:17:55 +00:00
Mitchell Stokes
c5ef9b62c1 BGE Animations: Adding an option to let users choose whether or not to lock animation updates to the framerate. If this option is enabled, animations are only updated at the same speed as the animation framerate. This can give a significant speed up in performance, but at the cost of smoothness in animations. I'm defaulting this behavior to off for now, which is the behavior seen in trunk. 2011-08-12 20:53:29 +00:00
Joerg Mueller
2d884fc035 3D Audio GSoC:
* Pepper depends on ffmpeg 0.7.1 or higher now, windows and mac build systems set to ffmpeg-0.8
* Fixed orientation retrieval in OpenAL device code.
* Added stopAll() method to AUD_IDevice (also for Python) and call it on BGE exit
* Changed BGE to use audaspace via native C++ instead over the C API.
* Made AUD_SequencerFactory and AUD_SequencerEntry thread safe.
* Changed sound caching into a flag which fixes problems on file loading, especially with undo.
* Removed unused parameter from sound_mute_scene_sound
* Fixed bug: changing FPS didn't update the sequencer sound positions.
* Fixed bug: Properties of sequencer strips weren't set correctly.
* Minor warning fixes.
2011-08-07 11:54:58 +00:00
Campbell Barton
5792bd7cc7 cmake: cleanup include paths, some duplicates and going up some unneeded dirs. 2011-07-17 09:11:13 +00:00
Campbell Barton
bb3742fe91 correction to recent commit & made ffmpeg includes only add when enabled. 2011-06-23 15:58:41 +00:00
Campbell Barton
2023db70a8 cmake option to build without an audio library. 2011-06-23 09:27:56 +00:00
Dalai Felinto
40c171a69f fix of fix :| [real fix for #36787 -- it was wrongly fixed on #36964]
I guess I tested the fix outside the camera view (which always worked). duhhh
Working now.
2011-06-08 09:01:41 +00:00
Campbell Barton
09da9d4393 cmake maintenance
blender_add_lib now takes a separate include argument to suppress warnings in system includes (mostly ffmpeg & python).
also only build wm_apple.c on apple+carbon configuration.
2011-05-31 01:15:44 +00:00
Mitchell Stokes
221472f7b5 Moving the letterbox clear for the embedded player so it only clears when it needs to. Thanks to Juha Mäki-Kanto for the tip. 2011-05-29 18:09:38 +00:00
Dalai Felinto
d580ae1087 fix for embeded BGE viewport broken when not using letterboxing
this was broken after rev.36787 (api rewritten)
own reported bug, nowhere in the track (just to mess up with the bug fixing statistics)
2011-05-28 01:29:56 +00:00
Brecht Van Lommel
18ff3d5200 Attempted fix for #27482: game engine running slow due to revision 36698 which
fixed frame colors for letterbox drawing (happens when in camera view).

Cause is unclear, seems some sort of strange graphics driver thing on 32 bit.
Changes are a fix for the incorrect usage of glViewport, and avoiding the extra
clear if it's not needed.
2011-05-27 16:20:49 +00:00
Campbell Barton
984d2e42e4 make api functions for converting rv3d->camzoom, so the odd logic for this isn't inlined all over. 2011-05-20 04:14:29 +00:00
Mitchell Stokes
d05b26c635 BGE:
This fixes frame colors not showing up right when using letterbox in the embedded player. Frames are drawn by clearing the whole canvas and then changing the viewport to be within the frames. The problem is that the embedded player's canvas is setup to be within the frames. This means that the extra that would normally be cleared and filled with the frame color is instead the gray color of Blender's region since nothing is actually drawn there by the BGE. To solve this, I just handle the frames in BL_KetsjiEmbedStart.
2011-05-15 08:48:43 +00:00
Brecht Van Lommel
cb12337363 Code cleanup: remove source/kernel module, this wasn't really the kernel of
anything, only contained a hash map and functions to pass command line args
to the game engine. Moved those to container and BlenderRoutines modules.
2011-05-06 20:18:42 +00:00
Campbell Barton
1c6956a4d6 quiet msvc/mingw compiler warnings. 2011-04-10 09:37:04 +00:00
Campbell Barton
ca254dd37b add option WITH_BUILTIN_GLEW, so linux packagers can disable to use their own glew library. 2011-04-05 23:31:01 +00:00
Campbell Barton
53139432dd image.depth, 96/128 for float color images, was 24/32 for byte images.
also use <> for system includes
2011-03-09 01:25:59 +00:00
Nathan Letwory
90917f78da doxygen: gameengine/BlenderRoutines tagged. 2011-02-25 13:29:48 +00:00
Nathan Letwory
5b607701a7 doxygen: prevent GPL license block from being parsed as doxygen comment. 2011-02-23 10:52:22 +00:00
Nathan Letwory
5138615554 doxygen: entries for blenderroutines, converter, expressions, gamelogic, gameplayer, ketsji 2011-02-22 10:33:14 +00:00
Campbell Barton
89c617a116 remove nan-makefiles 2011-01-30 15:29:22 +00:00
Dalai Felinto
e46895811e bge fix: debug text didn't have GL_DEPTH disabled - text got clipped when we have objects too close to the camera
fix only in embed bge, blenderplayer seems to be doing differently.
-- reported live by Mike Pan
2011-01-26 22:16:58 +00:00
Dalai Felinto
d58c31704b BGE: option in the UI to start with the mouse cursor visible. Patch by Vitor Balbio, changes by me.
----------------------------------
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).
2011-01-23 17:25:27 +00:00
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