Commit Graph

3187 Commits

Author SHA1 Message Date
Porteries Tristan
2fa4a48bce BGE: Fix T44700 mesh without material in blenderplayer.
If a mesh doesn't have a material we don't initialize the mSavedData in KX_BlenderMaterial to avoid crash.
2015-05-15 14:54:38 +02:00
Thomas Szepe
e7f2aec81b BGE: Add 'Lock Translation' for dynamic objects
The XYZ translation lock was missing for dynamic object.

Reviewed By: panzergame
2015-05-14 15:23:42 +02:00
Thomas Szepe
8bf9e1412f BGE: Fix: Double jumps are not working with character motion actuator
The actual character motion actuator triggers every frame the jump method.
Adding an edge detection to trigger the jump method.

Reviewers: lordloki, sybren, moguri

Reviewed By: moguri

Differential Revision: https://developer.blender.org/D1220
2015-05-14 09:45:51 +02:00
Thomas Szepe
687f6a9752 BGE: Code Cleanup: LOD hysteresis calculation
* Cleanup duplicated code.
* Remove unnecessary "this->"

Reviewers: kupoman, lordloki

Reviewed By: kupoman, lordloki

Differential Revision: https://developer.blender.org/D1293
2015-05-14 09:40:03 +02:00
Porteries Tristan
909d3228b1 BGE : Fix Bullet shape margin for triangle mesh static objects 2015-05-12 13:38:46 +02:00
Mitchell Stokes
8478c71a7b BGE: Adding material IPO support to GLSL materials
Most of this patch was created by Daniel Stokes, I'm mostly just cleaning
it up and testing it. Still todo: hardness. I need to figure out how to
handle the integer -> float conversion on a dynamic uniform.

Reviewers: psy-fi, brecht

Reviewed By: psy-fi

Subscribers: psy-fi

Differential Revision: https://developer.blender.org/D511
2015-05-11 23:05:04 -07:00
Porteries Tristan
4d8f7eddda BGE : Fix crash during physics mesh update.
Currently we can't update the physics mesh of an added rigid body.
The cause is that that we need to update all shapes to say that the mesh was changed, for static object we don't do that previously because we use a odd way to reallocate memory at the same place.
So now when a mesh is changed we iterate all physics controllers which use the same shape info and recreate its shape with the correct mesh.

example file : {F168100}

Reviewers: scorpion81, sergof, hg1, sybren, moguri, agoose77

Reviewed By: moguri, agoose77

Subscribers: sybren

Differential Revision: https://developer.blender.org/D1269
2015-05-10 19:21:21 +02:00
Jorge Bernal
dc95ca92ca BGE: Fix T43822 Videotexture does not use sky color for off-screen
rendering

Make scene background color as default for render-to-texture instead of
current blue color (0, 0, 255).

It is very useful for mirrors setups.

Reviewers: moguri, ben2610, sybren, panzergame, hg1

Reviewed By: panzergame, hg1, moguri

Subscribers: mpan3

Differential Revision: https://developer.blender.org/D1287
2015-05-10 00:56:51 +02:00
Porteries Tristan
8647c7d501 Fix T38335: incorrect triangle index in raycast with more than 2 quads
eb81153896 broke the fix for T38335, and this fix was incomplete, now we iterate by triangles and polys in the same while block.
2015-05-09 19:12:22 +02:00
Campbell Barton
eb81153896 Cleanup: warning (sequence-point) 2015-05-09 11:00:50 +10:00
Porteries Tristan
6ee0327594 Fix T38335: incorrect triangle index in raycast result
Previously we forgot to do a special operation for indexes to convert a quad to two triangles.
2015-05-08 21:12:36 +02:00
Porteries Tristan
2e6634e4a8 BGE: Cleanup function UpdateMesh and SetMesh in CcdPhysicsController.cpp
"if (value == true)" -> "if(value)"
"if (ptr == NULL)" -> "if (!ptr)"
"vector<bool>" -> "std::vector<bool>"
And other blender typo.
2015-05-08 18:17:37 +02:00
Porteries Tristan
fb0dd596e9 BGE : KX_VertexProxy support for more than 2 UV channel.
I have added an optional named "index" argument for methode get/setUV, I have also modified the and set to deprecated methodes setUV2 and getUV2 : the doc was wrong and the methode can't be called anyway because it declared as VARARG in the .h and convert directly the args value to a vector in the .cpp.

Reviewers: sybren, lordloki, hg1

Reviewed By: lordloki, hg1

Subscribers: agoose77

Differential Revision: https://developer.blender.org/D1240
2015-05-06 22:55:46 +02:00
Porteries Tristan
15751238d5 BGE: Fix compound child shape added on instance game object 2015-05-06 14:23:22 +02:00
Porteries Tristan
4616a7a4d3 BGE: Fix collision callbacks for compound controllers
It fix some mistakes in b5e96530353ef22d184a60cd2b59a5e451ee211f and made a more safety behavior for collision callbacks used in compound controllers during adding and removing.
2015-05-05 19:54:12 +02:00
Porteries Tristan
b5e9653035 BGE: Remove function DisableCcdPhysicsController and EnableCcdPhysicsController in CcdPhysicsEnvironment
Replace EnableCcdPhysicsController by AddCcdPhysicsController and DisableCcdPhysicsController by RemoveCcdPhysicsController.
Tested with compound shapes and collision sensors.

Reviewers:agoose77, ideasman42
2015-05-05 15:18:29 +02:00
Porteries Tristan
be30070d86 BGE: Cleanup KX_BlenderSceneConverter.cpp
This commit is a little cleanup for whitspaces, braces, spaces around operators and useless keywords struct/class.

Reviewers:sybren
2015-05-04 13:36:11 +02:00
Sergey Sharybin
23a79c42b5 BGE Player: Fix compilation error after cleanup commit da8a62a 2015-05-04 14:39:12 +05:00
Sybren A. Stüvel
4e7ef3f5cd BGE: Added 'ghost' arg to KX_GameObject.suspendDynamics() method
The implementation of this 'ghost' argument already existed in the C++
source, but wasn't exposed to Python yet.
2015-05-04 12:04:09 +08:00
Porteries Tristan
8e4ac2d229 Fix ghash assert during BGE libload.
The assert message was caused by the multi call of BLO_library_append_begin in KX_BlenderSceneConverter::LinkBlendFile.
2015-05-02 18:43:39 +02:00
Campbell Barton
84db9fdf4d Fix T44464: Viewport mipmaps no longer toggle off 2015-04-28 01:18:50 +10:00
Porteries Tristan
5efbd2a407 BGE : addObject in python without reference object.
Making the reference argument optional for the addObject function.
```
scene.addObject("Cube")
```

This allows to keep the rotation, scale and position of the original object.
To avoid layer problems with lights if the reference arguments is None, the new object have the same layer than the active layers in scene.

Reviewers: lordloki, moguri, hg1, sybren

Reviewed By: hg1, sybren

Subscribers: agoose77

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1222
2015-04-26 16:29:58 +02:00
Porteries Tristan
546031b694 BGE : fix bugs with physics collision mask/group
Currently there are bugs with physics objects in inactive layers,
character and softbody.
I added a function in CcdPhysicsEnvironement to know if a physics
controller is currently active and for soft body I added the correct function in UpdateCcdPhysicsController to re-add a softbody in the dynamics world.

The bug was introduced in D1243 commit 3d55859

Reviewers: hg1, scorpion81, lordloki, moguri, agoose77, sergof

Reviewed By: sergof

Subscribers: youle, moguri

Differential Revision: https://developer.blender.org/D1253
2015-04-24 11:57:38 +02:00
Campbell Barton
87b3e62b3d Cleanup: warnings 2015-04-23 16:09:30 +10:00
Dalai Felinto
9425a8ff38 BGE: scene.pre_draw_setup[] callback
This callback allows the user to change the camera data right before the
rendering calculations.

scene.pre_draw[] is not enough here, because if you want to change the
camera matrices (projection/modelview) the culling test is done before
that (after pre_draw_setup[] though).

Reviewers: moguri, campbellbarton

Differential Revision: https://developer.blender.org/D1251

Python sample code using this. The sample scene would need a default
camera (not used for rendering), a dummy camera ('Camera.VR'), and two
cameras ('Camera.Left', 'Camera.Right') that will be used for the actual
rendering.

```
import bge

def callback():
    scene = bge.logic.getCurrentScene()
    objects = scene.objects

    vr_camera = objects.get('Camera.VR')

    if bge.render.getStereoEye() ==  bge.render.LEFT_EYE:
        camera = objects.get('Camera.Left')
    else:
        camera = objects.get('Camera.Right')

    vr_camera.worldOrientation = camera.worldOrientation
    vr_camera.worldPosition =  camera.worldPosition

def init():
    scene = bge.logic.getCurrentScene()
    main_camera = scene.active_camera
    main_camera.useViewport = True

   scene.pre_draw_setup.append(callback)

    objects = scene.objects
    vr_camera = objects.get('Camera.VR')
    vr_camera.useViewport = True
    vr_camera.setViewport(
            0,
            0,
            bge.render.getWindowWidth(),
            bge.render.getWindowHeight() )
```
2015-04-21 17:41:23 -03:00
Sergey Sharybin
0aa2eed0c2 Compilation error fix for MSVC: It does not support expressions in array
declarations
2015-04-20 14:07:26 +05:00
Sybren A. Stüvel
bf6bde232d Fix: BGE crashes when RunPythonCallBackList() is called with maxargcount != minargcount 2015-04-20 13:53:54 +08:00
Sybren A. Stüvel
07a7d77ec1 Fix: solved BGE compiler error on Linux/gcc 2015-04-20 10:58:25 +08:00
Porteries Tristan
62f79856e9 BGE : Standardization of callbacks execution.
A new function (RunPythonCallBackList) to call all python functions
contained in a python list was developed.

This function has:
  - first argument is the python list of callbacks
  - second argument is a python list of arguments
  - third argument is the minimum quantity of arguments
  - forth argument is the maximum quantity of arguments

It improves flexibility and supports *args.

Reviewers: moguri, dfelinto, campbellbarton, sybren

Reviewed By: campbellbarton, sybren

Subscribers: sybren

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1102
2015-04-19 20:33:08 +02:00
Porteries Tristan
3d55859924 BGE: Support for collision group/mask from the api + activated on EndObject.
A Python API for the collision group / mask has been added:
```
KX_GameObject.collisionGroup
KX_GameObject.collisionMask
```
The maximum number of collision groups and masked has been increased from eight to sixteen.
This means that the max value of collisionGroup/Mask is (2 ** 16) - 1

EndObject will now activate objects that were sleeping and colliding with the removed object.
This means that, unlike now, if a rigid body starts sleeping on top of another object, when the latter is removed the rigid body will activate and fall, rather than float midair as before.

Collision groups that do not intersect used to collide on the first frame. Now this has been fixed so that they collide appropriately.

Thanks to agoose77 for his help.

Reviewers: scorpion81, hg1, agoose77, sergof

Reviewed By: agoose77, sergof

Subscribers: sergof, moguri

Projects: #game_physics, #game_engine

Differential Revision: https://developer.blender.org/D1243
2015-04-19 01:04:22 +02:00
Porteries Tristan
a2f9a0cfd9 BGE: Fix T43536 logic.getCurrentScene() returning wrong scene in
pre_draw and post_draw calls

A simple insert of KX_SetActiveScene(scene) before pre_draw and
post_draw calls solves the issue.

Reviewers: dfelinto, sybren, brita_, campbellbarton, moguri, lordloki

Reviewed By: moguri, lordloki

Projects: #game_logic, #game_engine

Differential Revision: https://developer.blender.org/D1129
2015-04-18 21:37:59 +02:00
Porteries Tristan
e0aeafdf0a BGE : Fix light layer check
The layers in Blender are using a bit field for the 20 layers. The light layer value was limited to 20, so the highest usable light layer was five.
The patch modify the range and add layer out of range error messages.

Reviewers: sybren, hg1, moguri

Reviewed By: hg1, moguri

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1238
2015-04-17 18:12:51 +02:00
Jorge Bernal
4cd37541b0 BGE: Fix for T44374 Crash when collision sensor deactivated
Don't allocate memory for sensor logic brick if it is deactivated
2015-04-17 02:12:57 +02:00
Jorge Bernal
8c98b1649d BGE: Fix for T42341 Sensor.frequency is badly named
"Frequency" parameter is renamed to "Skip" in the LogicBricks sensors as it represents skipped frames between pulses.

Naming something (frequency) the exact opposite of what it represents (period) was the worst choice.

Also, a new BGE python attribute 'skippedTicks' was introduced. 'frequency' attribute is maintained but deprecated.

Internally, freq variable is used yet at DNA_Sensor to maintain compability and to avoid do_versions.

Thanks to Sybren for the investigation.

{F162440}

Reviewers: campbellbarton, sybren, moguri, hg1

Reviewed By: sybren, hg1

Differential Revision: https://developer.blender.org/D1229
2015-04-16 06:39:33 +02:00
Campbell Barton
99299da4b5 Cleanup: warnings, ws 2015-04-16 01:12:22 +10:00
Porteries Tristan
7730391d74 BGE: subclass with more than 1 argument, D1237
In the BGE you can't create a subclass with more than 1 argument like : "player = Player(owner, 10)"
I have modified the py_base_new to check only the first argument of args tuple.
Now we can do :

    class Player(types.KX_GameObject):
        def __init__(self, gameobj, life):
            print("create new player :", self, ", life :", life)

    player = Player(own, 50)
2015-04-15 22:02:16 +10:00
Thomas Szepe
87b6d3c796 BGE: Add keyword arguments to createConstraint API
Added keyword arguments to createConstraint.
Changed initial values for the pivod XYZ  form 1 to 0.0.
Changed initial values for the axis Z form 1 to 0.0.
Delete the parsing for 4 parameters, because parsing only the X pivot is not necessary, also it was not working correctly (int instead of  float).

Reviewers: brita_, sybren, lordloki, campbellbarton, moguri

Reviewed By: lordloki, campbellbarton

Subscribers: campbellbarton

Differential Revision: https://developer.blender.org/D705
2015-04-11 16:17:07 +02:00
Benoit Bolsee
b329016b29 BGE: FIX T43537: ImageMirror does not work in BlenderPlayer with quad buffer
In quad-buffer stereo mode, the GE render pass ends with the right eye on the right buffer, but we need to draw on the left buffer to capture the render.

Reviewed By: agoose77, HG1
2015-04-11 16:08:15 +02:00
Thomas Szepe
465a5d29c0 BGE : Fix T43800: getScreenVect()/getScreenPosition()/modelview_matrix returns incorrect results
The getScreenVect(), getScreenPosition() and modelview_matrixmethod returns an incorrect results if called after the camera has been translated on the same frame.
The model view matrix will be update only once per frame with Cam->SetModelviewMatrix in KX_KetsjiEngine::RenderFrame.
Using GetWorldToCamera as model view matrix to get an actual view matrix even if the camera is moved.

Reviewers: sergey, dfelinto, brita_, sybren, hg1, campbellbarton

Reviewed By: hg1, campbellbarton

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1170
2015-04-10 20:20:52 +02:00
Porteries Tristan
f5648f6db9 BGE : Fix T36285 Wrong viewport scale.
Fix of T36285, I just invalidate projection matrix when a camera switch
to viewport mode, because we need to rewrite the projection matrix in
RenderFrame.
It worked with old blender version because when you use viewport render
one camera is added in the camera list and initialize its projection
matrix for the first time. But when we used several cameras + viewport
for splitscreen we had issues.

Reviewers: dfelinto, hg1, ben2610, lordloki, moguri

Reviewed By: moguri

Projects: #game_rendering, #game_engine

Differential Revision: https://developer.blender.org/D1202
2015-04-08 06:56:17 +02:00
Campbell Barton
c89637be30 BGE: use tuple for returning display size 2015-04-08 06:28:05 +10:00
Thomas Szepe
e36b0cb8f3 BGE: New API method getDisplayDimensions
This patch adds a new API function to get the actual display dimensions in pixels.

Reviewers: dfelinto, sybren, lordloki, moguri

Reviewed By: lordloki, moguri

Differential Revision: https://developer.blender.org/D648
2015-04-07 18:32:25 +02:00
Sybren A. Stüvel
593b4d84c4 BGE: followup of renaming parameter "other" to "reference"
See commit 3e5332bb959c686cb5bc5b6007d96088d5d1bc23
2015-04-06 18:23:56 +02:00
Sybren A. Stüvel
3e5332bb95 BGE: fixed nomenclature of KX_Scene::addObject and KX_Scene::AddReplicaObject
KX_Scene::addObject: Changed the parameter "other" to "reference", as "other" doesn't mean anything.
KX_Scene::AddReplicaObject: Changed the parameter "parentobject" to "referenceobject", as the parameter did NOT contain a parent object in any way.

Now both functions use the same kind of name for the same thing.

Thanks to panzergame / Porteries Tristan.
2015-04-06 17:11:36 +02:00
Thomas Szepe
29e968a315 BGE: Fix T36703: Character motion actuator local movement not working correct.
The character motion actuator local movement does not taking account of the object rotation.
It is necessary to rotate the motion vector before adding the local movement.

Reviewers: sybren, lordloki, moguri

Reviewed By: lordloki, moguri

Maniphest Tasks: T42709

Differential Revision: https://developer.blender.org/D1206
2015-04-05 10:13:04 +02:00
Campbell Barton
f5949efb53 Missed in recent cleanup 2015-04-04 18:58:49 +11:00
Campbell Barton
77667ad80f Cleanup 2015-04-02 16:12:33 +11:00
Thomas Szepe
660173ed72 BGE: Fix: VehicleWrapper compiler warning.
The return type of raise_exc_wheel() is bool, but the method return -1. The compiler will change the return type type to an int. This can cause some problems on 64bit systems.

Reviewers: lordloki, sybren

Reviewed By: lordloki, sybren

Differential Revision: https://developer.blender.org/D1204
2015-03-30 22:47:46 +02:00
Antony Riakiotakis
98cbde91d2 Fix compilation of game engine in ubuntu 2015-03-30 13:06:54 +02:00
Sergey Sharybin
6cd82dbf57 CMake: Enable strict flags for C++ 2015-03-27 18:23:31 +05:00