Commit Graph

1750 Commits

Author SHA1 Message Date
Nathan Letwory
79f79e0cac doxygen: BGE Network, Physics, Rasterizer 2011-02-22 12:42:55 +00:00
Nathan Letwory
148eb5ca9c remove unused code. 2011-02-22 11:43:50 +00:00
Nathan Letwory
5138615554 doxygen: entries for blenderroutines, converter, expressions, gamelogic, gameplayer, ketsji 2011-02-22 10:33:14 +00:00
Mitchell Stokes
b5e3d2a2ea Bugfix #25803 (LibLoad'ed scene objects don't have timer property updated)
The KX_Scenes' SCA_TimeEventManagers were not being merged. These handle the timer prop
2011-02-21 23:44:11 +00:00
Mitchell Stokes
648dec3411 Fix for bug #25804 (LibLoad'ed scene objects material CRASH when doing mat.getShader())
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.
2011-02-21 23:41:47 +00:00
Nathan Letwory
75bcf5b0b1 Remove header include, conflicts otherwise with BLI_math.h 2011-02-18 14:30:36 +00:00
Dalai Felinto
11e3b6b0b5 BGE Expressions: convert "\n" to real \n
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 (:
2011-02-18 10:10:48 +00:00
Campbell Barton
6524d27462 py api was raising SystemError exception incorrectly, this is intended for internal interpreter problems.
Replace most with RuntimeError.
2011-02-18 06:04:05 +00:00
Dalai Felinto
230aed6242 BGE: Action and ShapeKey Actuator PingPong playmode.
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.
2011-02-16 19:53:39 +00:00
Michael Fox
c195e68e8e small correction to BGE as recent commits broken normal mapping in the GE 2011-02-16 00:04:37 +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
Mitchell Stokes
62602c797d Fixing a recounting bug so KX_Scene.pre_draw.append() and KX_Scene.post_draw.append() work. 2011-02-12 15:44:09 +00:00
Dalai Felinto
8fd81ab9e6 BGE: frame start/end in action/fcurves/shapekey to support floats
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?
2011-02-11 00:03:26 +00:00
Campbell Barton
0d8416acc7 minor edits, no functional changes.
- BGE was getting MCol array and not using it.
- use list lookup functions for getting constraint from pose bone.
- use const char * in more places.
2011-02-07 22:48:23 +00:00
Campbell Barton
89c617a116 remove nan-makefiles 2011-01-30 15:29:22 +00:00
Campbell Barton
6a2e5ad599 [#25815] Patch gcc 4.6
with minor edits, made sure it works in CMake too.
2011-01-27 00:02:25 +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
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
Benoit Bolsee
fc66b3f2ef BGE: support modifiers without mapping to original mesh both graphically and physically, fixes bug #24942 and #25286.
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.
2011-01-23 17:17:21 +00:00
Campbell Barton
d2076e38f1 correct own bad spelling 2011-01-23 12:42:07 +00:00
Dalai Felinto
eff0e29cba BGE BugFix [#25711]render.setBackgroundColor() does not work:
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.
2011-01-18 22:27:18 +00:00
Campbell Barton
3b0c2accc6 support building with python3.2 2011-01-18 21:39:50 +00:00
Campbell Barton
8cf1184c04 bad spelling; 'indicies' --> 'indices' 2011-01-18 01:58:19 +00:00
Campbell Barton
fd448bcfc7 remove/comment unused defines, also zero FileGlobal.filename to quiet valgrind. 2011-01-16 21:12:38 +00:00
Campbell Barton
c9f353956c use PySequence_Size() rather then PySequence_Length(), this is only kept in python for backwards compatibility. 2011-01-09 14:53:18 +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
8f21a43535 split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
2011-01-07 18:36:47 +00:00
Campbell Barton
54ceccd0ee - cmake use execute_process, exec_program is deprecated.
- game engine builds without python again.
2011-01-07 08:43:29 +00:00
Campbell Barton
a0b134cd88 bugfix [#25488] Game engine crash when try to run after blender app start
- also found other places where utf8 isnt ensured.
- remove duplicate NULL checks in object_edit.c
2011-01-06 05:04:07 +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
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
Mitchell Stokes
f71ff8639c Fix to make two-side texface option work with modifiers in the BGE. However, there appear to be some issues when a mesh has mixed two-side and non two-side faces. I think it's a problem in the converter and possibly related to this bug: https://projects.blender.org/tracker/index.php?func=detail&aid=24948&group_id=9&atid=306 2011-01-04 07:43:32 +00:00
Campbell Barton
1ba9dde22d - add in asserts for unlikely cases of invalid ID types being assigned to key->from.
- mode duplicate pointer/offset code into a static function.
2011-01-03 04:59:57 +00:00
Mitchell Stokes
6127bcf854 CXX_Guardedalloc was complaining about freeing NULL pointers in VideoTexture. I've added guards around the deletes to prevent this. 2011-01-02 10:05:22 +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
6fdfa97edb CMake: use blender_include_dirs("${OPENGL_INCLUDE_DIR}") rather then blender_include_dirs(${OPENGL_INCLUDE_DIR})
Apparently this is needed for MSVC in some cases, reported by Tamito Kajiyama r33895.
2010-12-31 04:29:11 +00:00
Campbell Barton
5e382eb8e5 rename blenderlib to blender_add_lib 2010-12-22 23:09:30 +00:00
Guillermo S. Romero
29799bf09c Compact -I paths in makefiles for more readble files/output.
Also some white space cleaning and removal of redundant parameter.
2010-12-22 22:15:20 +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
Campbell Barton
fb977b793e minor warnings removed. 2010-12-17 16:05:40 +00:00
Campbell Barton
902b239aa8 no functional changes: SETLOOPER macro assumed a scene was defined called 'sce' used to loop over, now make this an argument, helps to make it clear what's going on. 2010-12-17 15:37:59 +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
b4b636386f BGE BugFix: [#25106] modelview matrix incorrect after using VideoTexture - affecting mouse.position. Patch by Benoit Bolsee (ben2610) 2010-12-11 00:04:01 +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