Commit Graph

276 Commits

Author SHA1 Message Date
Joerg Mueller
60f5b51484 Fix for [#27562] audaspace not playing files in blenderplayer
blenderplayer wasn't initialising ffmpeg

This might also fix [#27558] GE Sound works in Blender but not in runtimes
2011-06-02 23:25:38 +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
ebdca474b5 Fixing the initglobals leak in the Blenderplayer (G.main reference was being reassigned before it was freed). 2011-05-29 04:15:35 +00:00
Campbell Barton
37178ab0fd cleanup only
- rename 'name', 'dir' --> 'filepath' where these actually represent a file path to avoid confusion.
- bugfix for possible (but unlikely) uninitialized string.
- remove commented script append function, now we have a python api for this.
2011-05-18 06:27:32 +00:00
Brecht Van Lommel
3a34dcde68 Code cleanup: remove readblenfile module, only contained some utility functions
to read .blend files from runtimes, folded those into blenloader.
2011-05-11 19:29:23 +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
Dalai Felinto
c56fe3efe6 Patch [#26799] 2.5x blenderplayer (BGE) anti-aliasing & embedding by Sebastian Korczak (with some small tweaks) + adding GHOST_PRINTF
The patch can also be found in http://codereview.appspot.com/4431072/

##############
This patch fix anti-aliasing (multisampling) implementation for win32 platform. It also gives opportunity to embed blenderplayer inside parent window.

Usage:
blenderplayer.exe -i 123456 -m 16 file.blend

where:
123456 - parent window handler (integer, default: 0)
16 - multisample level (integer, default: 0, max: 16. Put there maximum level you want. If not supported, player will automatically try 15,14,13,...,3,2,1)
##############

This patch was originally created as part of the Burster (aka webplugin) project but benefit any one embedding the bge in a custom OpenGL context. By the way, to embed the BGE in a .Net application is really straightforward now =)
The Multisampling work for blenderplayer as a whole.

Missing functionalities:
- to expose the multisampling to the ui (so far it only works in console)
- window focus and keyboard messages for embedded blenderplayer (supported in their previous patch for 2.49, yet to be ported over)
- handle resizing (to be investigated, indeed the changes in getState() in GHOST_WindowWin32.cpp are going to get in the way of that if I'm not mistaken. To be addressed together.

Doxygen documentation to be added whenever I sort out how to do so. Sorry Nathan too many stuff to deal with at the same time. The sooner this patch gets in, the sooner the missing functionalities can be patched on top of that.
2011-05-04 01:50:17 +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
02a7063a09 fix for blenderplayer crashing on exit.
the event consumer was being freed twice, once when going out of C++ scope, another when freeing the system.
2011-03-26 08:13:42 +00:00
Campbell Barton
cae59a78d8 print guarded-alloc memory leaks on blenderplayer exit. 2011-03-26 04:50:59 +00:00
Nathan Letwory
94f3851840 doxygen: gameengine/GamePlayer tagged. 2011-02-25 13:35:11 +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
Sergey Sharybin
dfb1395fa5 Fix #26064: blenderplayer is broken
This changes were forgotten in svn rev34810. Should work fine now.
2011-02-13 10:28:40 +00:00
Campbell Barton
89c617a116 remove nan-makefiles 2011-01-30 15:29:22 +00:00
Campbell Barton
1bd0db59f4 use cmake defined names for jpeg, png, zlib and python libs, building on *nix with non-standard libjpeg/png/zlib locations was broken.
in the case of python this makes it easier to move to find_package(PythonLibs) when 3.x is supported.
2011-01-25 14:43:13 +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
Mitchell Stokes
a9f8083551 Adding overhead drawing (frame rate, profile, debug props) capabilities back to the Blenderplayer by replacing commented out BMF_* functions with BLF_* equivalents. 2011-01-05 01:34:33 +00:00
Mitchell Stokes
f0b0cce7bd Fixing a crash on exit when using the Blenderplayer on win32. When free_blender() was freeing main, main was garbage since the blend file data was already freed. So, I just replaced free_blender) with IMB_exit() and free_nodesystem(). Using free_blender() worked when I was in Linux running tests. That or I'm just gong crazy. ;) 2010-12-31 10:56:06 +00:00
Campbell Barton
5e382eb8e5 rename blenderlib to blender_add_lib 2010-12-22 23:09:30 +00:00
Mitchell Stokes
48cda2e08e Plugging up some memory leaks in the Blenderplayer that I found with valgrind 2010-12-21 06:58:44 +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
a1b8bc93e2 remove unmaintained windows and unix game engine plugin code. 2010-11-30 19:08:44 +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
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
d43d5d7690 Getting BLF to work with the Blenderplayer. 2010-11-12 07:16:33 +00:00
Campbell Barton
da402c937e fix for linking the player, also fixes building without python and bullet. 2010-11-05 01:47:55 +00:00
Brecht Van Lommel
12812e494f Fix cmake building of blender player. 2010-10-31 12:31:15 +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
Nathan Letwory
a293f76cdf Use DEBUG instead of NDEBUG 2010-10-18 06:52:10 +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
30b79ddcc6 - fixed remaining unused warnings.
- 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).
2010-10-17 06:38:56 +00:00
Nathan Letwory
53ced0be29 Now sound init param removal revert should be fine (apparently my cmake project files missed rebuild hint for these, fortunately SCons did its job well). 2010-10-16 15:00:04 +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
46f25680aa blenderplayer fix for "offset" problem when in fullscreen mode (worked together with Nathan Letwory - jesterKing)
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
2010-09-14 08:19:42 +00:00
Dalai Felinto
898e7857f4 blenderplayer parsing code (better) fix
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 ...
2010-09-13 08:30:56 +00:00
Dalai Felinto
9153e82d21 blenderplayer commandline argument fixes (for -f and -w)
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
2010-09-13 04:52:20 +00:00
Nathan Letwory
6c113b54b3 Finally change SConscript tabs to spaces. 2010-08-29 20:52:05 +00:00
Campbell Barton
c20bb3ec43 own rna naming commits r31439 r31472 also renamed BGE vars unintentionally 2010-08-26 23:49:46 +00:00
Campbell Barton
4f5f868a52 rna data path names which are more likely to break animations.
Added an operator "Update Animation Data",
access from the search menu to update drivers and fcurves.
2010-08-20 06:09:58 +00:00
Guillermo S. Romero
95aa8cfa4a Update address in license block. 2010-08-10 21:22: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
Campbell Barton
75410037fd - correct some spelling errors.
- remove FreeCamera struct (wasnt used)
- remove world color alpha values (not used anywhre).
2010-07-20 10:41:08 +00:00
Dalai Felinto
c6bec43330 reverting previous commit from Mitchell. His commit went to the trunk instead of the branch :)
svn merge -r 29067:29066 https://svn.blender.org/svnroot/bf-blender/trunk/blender
2010-05-29 21:31:57 +00:00
Mitchell Stokes
9d3157eed0 Reversing the last merge because I botched it. 2010-05-29 21:22:24 +00:00