Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-06-18Cleanup: style, whitespace, doxy filepathsCampbell Barton
2016-04-11BGE: Fix T48071: Global logic managerPorteries Tristan
Previously the logic manager was used as a global variable for SCA_ILogicBrick::m_sCurrentLogicManager, this request to always update it before run any python script and allow call function like ConvertPythonTo[GameObject/Mesh]. The bug showed in T48071 is that as exepted the global m_sCurrentLogicManager is not updated with the proper scene logic manager. Instead of trying to fix it by updating the logic manager everywhere and wait next bug report to add a similar line. The following patch propose a different way: - Every logic brick now contain its logic manager to SCA_ILogicBrick::m_logicManager, this value is set and get by SCA_ILogicBrick::[Set/Get]LogicManager, It's initialized from blender conversion and scene merging. - Function ConvertPythonTo[GameObject/mesh] now take as first argument the logic manager to find name coresponding object or mesh. Only ConvertPythonToCamera doesn't do that because it uses the KX_Scene::FindCamera function. Reviewers: moguri Differential Revision: https://developer.blender.org/D1913
2016-02-26Fix T47015: BGE, objects vanish aligning to vectorCampbell Barton
1811 by @mangostaniko Fixes regression since moving to floats.
2016-02-23Fix warnings reported by MSVCSergey Sharybin
Mainly it's related on a bad practice in SDL to force-define __SSE__ and __SSE2__ flags which generates quite some warnings and causes too much noise. There are some other warnings fixed. Should be no functional changes. NeXyon, please check the changes in audaspace :)
2015-12-16BGE Ketsji clean-up: double-promotion warningsJorge Bernal
2015-12-13BGE: Use float as default instead of double in Moto library.Porteries Tristan
Use float in moto instead of double for MT_Scalar. This switch allow future optimization like SSE. Additionally, it changes the OpenGL calls to float versions as they are very bad with doubles. Reviewers: campbellbarton, moguri, lordloki Reviewed By: lordloki Subscribers: brecht, lordloki Differential Revision: https://developer.blender.org/D1610
2015-11-26BGE: Fix ray cast with unfound property.Porteries Tristan
To return a valid ray cast result the object must not be NULL and KX_RayCast::RayTest must return true.
2015-10-29BGE: Fix T35188: Duplicate an instance of group.Porteries Tristan
This behavior caused a double free. Before when we duplicated an instance of a group the new instance keep the pointer of the group but was not added in the group instance list (normal). And during the object deletion we tried to remove the object in the instance list but anyways if it failed decrement the reference count. Set the group and the instance list to NULL in ProcessReplica avoid these kind of problems.
2015-10-26BGE: generic python callback list + replace KX_PythonSeq.Porteries Tristan
I made this patch to declared a python list without converting all elements in python object (too slow) or use a CListValue which required CValue items (too expensive in memory). In the case of a big list of points like a collision contacts points list, to use a CListValue we must implement a new class based on CValue for 3D vector to create a python proxy even if mathutils do it perfectly, we must also convert all points (frequently ~100 points) when fill the CListValue even if the list is not used (in the case of the collision callback). The easy way is to use callback (it doesn't worth to do an inheritance) which convert the item in PyObject only during an acces. 5 callbacks are used : - Check if the list is valid = allow acces (like PyObjectPlus.invalid) - Get the list size - Get an item in the list by index. - Get an item name in the list by index (used for operator `list["name"]`) - Set an item in the list at the index position. All of these callback take as first argument the client instance. Why do we use a void * for the client instance ? : In KX_PythonInitTypes.cpp we have to initialize each python inherited class, if we use a template (the only other way) we must add this class each time we use a new type with in KX_PythonInitTypes.cpp To check if the list can be accessed from python by the user, we check if the python proxy, which is the `m_base` member, is still a valid proxy like in PyObjectPlus. But we can use a callback for more control of user access (e.g a list of collision point invalidate a frame later, in this case no real python owner). This python list is easily defined with : ``` CPythonCallBackList( void *client, // The client instance PyObject *base, // The python instance which owned this list, used to know if the list is valid (like in KX_PythonSeq) bool (*checkValid)(void *), // A callback to check if this list is till valid (optional) int (*getSize)(void *), // A callback to get size PyObject *(*getItem)(void *, int), // A callback to get an item const char *(*getItemName)(void *, int), // A callback to get an item name (optional) use for acces by string key bool (*setItem)(void *, int, PyObject *) // A callback to set an item (optional) ) ``` To show its usecase i replaced the odd KX_PythonSeq, it modify KX_Gameobject.sensors/controllers/actuators, SCA_IController.sensors/actuators and BL_ArmatureObject.constraints/channels. Example : {F245193}, See message in console, press R to erase the object and see invalid proxy error message. Reviewers: brita_, #game_python, youle, campbellbarton, moguri, agoose77, sergey Reviewed By: campbellbarton, moguri, agoose77, sergey Subscribers: sergey Projects: #game_engine Differential Revision: https://developer.blender.org/D1363
2015-10-19BGE: Fix T46381 : last action frame not updated.Porteries Tristan
It fix T46381. Normally BL_Action::Update (manage action time, end, loop…) should be called the same number of times as BL_Action::UpdateIPO (update action position, scale ect… in the game object). But the bug report shows that UpdateIPO is called one less time than Update. To fix it i revert the commit 362b25b38287cb75e4d22b30bdbc7f47e8eb3fdf and implement a mutex in BL_Action::Update. Example file : {F245823} Reviewers: lordloki, kupoman, campbellbarton, youle, moguri, sybren Reviewed By: youle, moguri, sybren Maniphest Tasks: T39928, T46381 Differential Revision: https://developer.blender.org/D1562
2015-10-07BGE : Collision mask support in raycast + and raycast cleanup.Porteries Tristan
I have removed the m_pHitObject, m_xray and m_testPropName and replace them by a temporary struct "RayCastData" which contains these datas and a collision mask. Finally i add a collision mask argument in the python function "rayCast" : ``` rayCast(to, from, dist, prop, face, xray, poly, mask) ``` It can be useful to hit only object which are on the right colision layer. for example if you have hitbox for a charater or vehicle you don't want to hit it with raycast. test file : {F237337} left mouse click on two planes and see console messages. Somewhat more elaborate test file by @sybren: {F237779} Look around and click on the cubes. One cube lamp responds, the other doesn't, based on their collision groups. Reviewers: moguri, hg1, agoose77, campbellbarton, sybren Reviewed By: agoose77, campbellbarton, sybren Subscribers: campbellbarton, sergey, blueprintrandom, sybren Projects: #game_engine, #game_physics Differential Revision: https://developer.blender.org/D1239
2015-08-10BGE: Fix T19377 restore dynamics after unparenting object.Porteries Tristan
Reviewers: scorpion81
2015-08-06Cleanup: whitespaceCampbell Barton
2015-08-04BGE: Added getActionName() function to KX_GameObject()Mateo de Mayo
It works similar to getActionFrame(), you have to give a layer or not (for layer 0) as the argument and it returns the name of the animation that the object is currently playing. Example: ``` import bge own = bge.logic.getCurrentController().owner own.playAction("SomeAction",0,20) print(own.getActionName()) ``` >> SomeAction Here is an example file, just open the blend file with the terminal opened and press P, you can see how the current animation is being printed: {F217484} Reviewers: moguri, hg1, panzergame, campbellbarton Reviewed By: panzergame Subscribers: campbellbarton, hg1, #game_engine Projects: #game_engine Differential Revision: https://developer.blender.org/D1443
2015-07-12BGE Clean-up: New EXP prefix for the BGE Expression moduleJorge Bernal
The expression module now uses an EXP prefix and it follows a distribution similar to blender. Additionally the hash function in EXP_HashedPtr.h was simplified and the files EXP_C-Api.h &.EXP_C-Api.cpp were deleted because were unused. Reviewers: campbellbarton, moguri, sybren, hg1 Projects: #game_engine Differential Revision: https://developer.blender.org/D1221
2015-07-07BGE: Fix wrong current logic manager in collision callback.Porteries Tristan
2015-07-01BGE: Fix T44069 playing action during libfree.Porteries Tristan
2015-06-28BGE: added clamping of angular velocity.Sybren A. Stüvel
Angular velocity clamping was missing from the BGE. It is implemented similarly to the linear velocity clamping. It is needed to be able to drive physical simulations of systems that have a limited rotational speed. Reviewed by: campbellbarton, panzergame, ton Differential Revision: https://developer.blender.org/D1365
2015-06-13Fix for building without PythonCampbell Barton
2015-06-02Fix T44919: BGE marhutils attrs leak memoryCampbell Barton
2015-05-14BGE: Code Cleanup: LOD hysteresis calculationThomas Szepe
* Cleanup duplicated code. * Remove unnecessary "this->" Reviewers: kupoman, lordloki Reviewed By: kupoman, lordloki Differential Revision: https://developer.blender.org/D1293
2015-05-04BGE: Added 'ghost' arg to KX_GameObject.suspendDynamics() methodSybren A. Stüvel
The implementation of this 'ghost' argument already existed in the C++ source, but wasn't exposed to Python yet.
2015-04-19BGE : Standardization of callbacks execution.Porteries Tristan
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-19BGE: Support for collision group/mask from the api + activated on EndObject.Porteries Tristan
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-02CleanupCampbell Barton
2015-03-27rename BGE attr from D1091 (match methods)Campbell Barton
2015-03-27BGE: New isDynamicSuspended python attributePorteries Tristan
This is a new KX_GameObject attribute that it increments the possibilities of optimization during the game Additionally the unused m_bSuspendDynamics variable is removed. Reviewers: moguri, agoose77, lordloki Reviewed By: agoose77, lordloki Subscribers: agoose77, lordloki Differential Revision: https://developer.blender.org/D1091
2015-03-23BGE: LoD Hysteresis clean upJorge Bernal
Move scene hysteresis value to KX_Scene where it should be (instead of KX_GameObject)
2015-03-22BGE: New hysteresis offset to improve LOD level transitionsJorge Bernal
This change introduces a new hysteresis parameter that it will be added or subtracted to/from the LOD distance to avoid popping when a LOD object moves close to the LOD transition continuously. Then, we have the following: - a new LOD Hysteresis setting per scene (default 10%) which is located in Scene context --> Level of Detail panel. This scene parameter also will active/deactive the scene hysteresis. - and a new LOD Hysteresis setting per object (default 10%) which is located in Object context --> Levels of Detail panel. The LOD hysteresis setting per object (if active) will overwrite the hysteresis setting per scene value. For the new blends: the hysteresis setting per scene would be active by default and the per object would be inactive by default. For the old blends: both hysteresis settings (per scene and per object) would be inactive by default. A quick way to take advantage of this feature for old blends would be to activate the hysteresis parameter in the scene context -> Level of Detail panel Reviewers: campbellbarton, kupoman, moguri Reviewed By: kupoman, moguri Subscribers: nonamejuju, lordodin Differential Revision: https://developer.blender.org/D957
2015-03-22BGE: Add physics constraints replicationThomas Szepe
This patch will add a physics constraints replication for group instances (dupli group). It also fix crashing when when a group instance is made from a linked group instance and both are on the active layer. Initial patch T31443 from moerdn (Martin Sell). Reviewers: lordloki, sergof, moguri, sybren Reviewed By: moguri, sybren Differential Revision: https://developer.blender.org/D658
2015-03-15BGE - new read-only attribute in KX_GameObject python api (LOD level)Pierluigi Grassi
Added a new "current_lod_level" property to the python api of KX_GameObject. The property returns the current lod level of the game object. The purpose of the property is activate logic routines only when an object is at a certain lod-distance from the camera, avoiding to separately recomputing the same distance in the logic script. Usage in python script might look like: owner = bge.logic.getCurrentController().owner lod_level = owner.currentLodLevel if lod_level == 0: ...do something else: ... object might be too distant Reviewers: dfelinto, kupoman, moguri Reviewed By: kupoman, moguri Subscribers: lordloki Projects: #game_engine Differential Revision: https://developer.blender.org/D978
2015-02-18BGE: Fix T41570: Blender crash when physics createConstraintJorge Bernal
Move physicsid type to unsigned long long to avoid crashes on Windows 8.1 64bits. Other systems also modified to put them inline with this solution. Reviewers: dfelinto, brita_, moguri, juicyfruit, campbellbarton Reviewed By: juicyfruit, campbellbarton Subscribers: juicyfruit Differential Revision: https://developer.blender.org/D1122
2015-02-08BGE physics: When colliding, report first contact point to PythonSybren A. Stüvel
This patch adds two parameters to the functions in the collisionCallbacks list. The callback function should thus be like this: ``` def on_colliding(other, point, normal): print("Colliding with %s at %s with normal %s" % (other, point, normal)) game_ob.collisionCallbacks.append(on_colliding) ``` The `point` parameter will contain the collision point in world coordinates on the current object, and the `normal` contains the surface normal at the collision point. The callback functions are checked for the number of arguments `co_argcount`. The new `point` and `normal` arguments are only passed when `co_argcount > 1` or when `co_argcount` cannot be determined. Reviewers: brita_, campbellbarton Subscribers: sergey, sybren, agoose77 Projects: #game_physics Differential Revision: https://developer.blender.org/D926
2015-01-15BGE physics: get/set linear and angular dampingSybren A. Stüvel
This patch adds the following R/W properties and method to `KX_GameObject`: - `linearDamping` -- get/set linear damping - `angluarDamping` -- get/set angular damping - `setDamping(linear, angular)` -- set both simultaneously These allow runtime changes to the same properties that are accessible at design time in Blender's UI via `game.damping` and `game.rotation_damping`. The names of the properties were chosen to mirror the internal names of the BGE physics engine, as these are (AFAIK) also the commonly used names in physics literature. Reviewers: campbellbarton Projects: #game_physics Differential Revision: https://developer.blender.org/D936
2015-01-08Revert "Fix T40257: Frustum culling not working properly"Mitchell Stokes
This reverts commit 315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9. This fix still causes more issues than it solves.
2014-11-21Cleanup: typoCampbell Barton
2014-10-11Fix another crash with Navigation mesh.Benoit Bolsee
Navigation mesh object need to access the current scene at creation time. This can be at scene start or when an object is instantiated from an inactive layer. The method of getting the scene differs in these cases. This fix handles both.
2014-08-09BGE: Fix bug with Steering Actuator Python API.Benoit Bolsee
It was not possible to set the navmesh attribute from Python due to a double bug.
2014-07-12BGE debug API and actuatorHG1
This patch adds some new debug methods to the KX_GameObject for manually adding the debug list and bge.render for controlling the debug visualization. It also adds a new debug actuator, which allows to control the same functions. This patch is a updated version of T33701. Thread on Blenderartists: http://blenderartists.org/forum/showthread.php?264745-Debug-proerties-for-added-objects-patch&p=2256018&viewfull=1#post2256018 Reviewers: moguri Reviewed By: moguri Differential Revision: https://developer.blender.org/D635
2014-07-11Fix T40257: Frustum culling not working properlyMitchell Stokes
This is mostly the same fix as before, but now code depending on culling checks is executed after KX_Scene->CalculateVisibleMeshes(). As a side-effect, LoD checks and animation culling now use the current frame's culling information rather than the previous frame's.
2014-07-10Revert "Fix T40257: Frustum culling not working properly"Mitchell Stokes
This reverts commit 978dba4616852e0b94374f2ae56934049d9b3669. The change still doesn't provide accurate culling information, and actually breaks animation culling.
2014-07-07BGE: Fix for applyImpulse functionJorge Bernal
This is related to task T29419. Credit also goes to Goran Milovanovic (goran) for proposing an initial fix for this issue. The issue is the current behavior of applyImpulse doesn't match the behavior described in the documentation as instead of a impulse point in world coordinates, it seems to require a coordinate in a local space. Additionally, applyImpulse function isn't consistent with similar functions (applyForce, applyTorque, etc) as it doesn't allow to choose in which space (local or global) the impulse is applied. Now, we have the following function: applyImpulse(point, impulse, local=False) being "point" the point to apply the impulse to (in world or local coordinates). When local is False will have both point and impulse in World space and when local is True will have point and impulse in local space. Reviewers: moguri, dfelinto, brita_ Reviewed By: moguri Differential Revision: https://developer.blender.org/D567
2014-07-03Fix T40912: Collision Callbacks Don't Work if Set DirectlyMitchell Stokes
2014-07-01Fix T40257: Frustum culling not working properlyMitchell Stokes
Adding a hack so that KX_GameObjects' culling status is updated based on mesh slots.
2014-05-15Fix T40182: Crash when using KX_GameObject.rayCast/rayCastTo().Mitchell Stokes
Missed another parent->release().
2014-05-05Fix T39928: Blender crash/freeze when game engine is started with animation ↵Mitchell Stokes
played directly on camera object with parents. Updating object IPOs is not currently thread-safe since it also updates children. This leads to problems when parents and children are both animated. For now, updating object IPOs is done in its own loop to avoid threading issues.
2014-05-01BGE cleanup: KX_GameObject::GetParent() no longer increases the object's ↵Mitchell Stokes
refcount. I'm not sure why this function ever increased the object's refcount. Any place in the code that calls KX_GameObject::GetParent() has to turn around and call parent->Release(). Forgetting to call Release() was a common cause of memory leaks (in fact, KX_SteeringActuator was probably leaking). If the refcount needs to be increased, the calling code can handle calling AddRef().
2014-04-24COmpilation error fix after recent cleanup in BGESergey Sharybin
2014-04-24BGE Cleanup: Moving reinstancing physics shapes from KX_ConvertPhysicsObject ↵Mitchell Stokes
to PHY_IPhysicsController This was the last item in KX_ConvertPhysicsObject. Therefore, KX_ConvertPhysicsObject.h and KX_ConvertPhysicsObjects.cpp have been removed.
2014-04-16Fix T39509: Crash when assign an empty as a LoDDaniel Stokes
Missing check when looking for appropriate LoD