Commit Graph

2904 Commits

Author SHA1 Message Date
Sergej Reich
6fe5b3be38 Fix T37673: Ray casting could fail with 0 collision margins
Use bullet's old method of doing ray casts to stay compatible with old
files. It's faster but a bit less accurate.
2014-01-28 08:31:56 +01:00
Sergey Sharybin
f0b9b65740 Fix compilation error caused by 67f1fd2
Did one tried building blender before commit even?
2014-01-24 14:06:23 +06:00
Dalai Felinto
67f1fd25ee game engine: implement hitMaterial for collision and ray sensors
Reviewed By: moguri, kupoman

Differential Revision: https://developer.blender.org/D167
2014-01-24 02:10:45 -02:00
Campbell Barton
3b71cab420 Fix T38110: GameEngine keyboard sensor ignores unicode characters 2014-01-23 14:58:04 +11:00
Campbell Barton
51c32ac199 Revert "Fix T37920: BGE LibLoad failed for meshes with no materials"
This reverts commit 6a473305af22468abfc4c4f8f3002dc0a97fffd7.

Caused T38296, need to investigate this further but for now
better not leave blender in unstable state.
2014-01-23 00:50:01 +11:00
Tom Edwards
1f2136b329 Python/Depsgraph: bpy.data.*.is_updated now detects add/remove of any datablock.
Previously this only worked for some datablocks relevant to rendering, now it
can be used to detect if any type of datablock was added or removed (but not
yet to detect if it was modified, we need many more depsgraph tags for that).

Most of the changes are some function parameter changes, the important parts
are the DAG_id_type_tag calls.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D195
2014-01-15 16:47:53 +01:00
Dalai Felinto
dfac6c4189 fix #T37892 BL_ArmatureConstraint.active returns wrong value
patch (with changes from me) by Séverin Lemaignan (skadge)
2014-01-14 13:22:41 -02:00
Campbell Barton
61ff3dfdda Code Cleanup: spelling 2014-01-13 15:31:57 +11:00
Campbell Barton
5fc2fe9fad Code Cleanup: move MOUSEX/Y to BGE, describe INBETWEEN_MOUSEMOVE 2014-01-12 01:59:17 +11:00
Benoit Bolsee
c7029f06d9 Add new BGE Stereo mode: 3DTV top-bottom.
This mode is designed for passive 3D TV: the viewport is split
horizontally - left eye above, right eye below - but the original camera
viewport is squashed in each half (with half the vertical resolution).
This is necessary to restore the aspect ratio in the 3D output because the TV expands each half to the full screen size.
2014-01-02 00:26:15 +01:00
Campbell Barton
6a473305af Fix T37920: BGE LibLoad failed for meshes with no materials 2013-12-30 15:49:13 +11:00
Campbell Barton
0d6ae3fda2 Main API: refactor naming, use BKE_main_ prefix and add main arg. 2013-12-30 13:25:27 +11:00
Campbell Barton
d44132d0d0 Fix for crash with game engines LibLoad feature 2013-12-30 12:18:41 +11:00
Sergey Sharybin
709041ed0b Threaded object update and EvaluationContext
Summary:
Made objects update happening from multiple threads. It is a task-based
scheduling system which uses current dependency graph for spawning new
tasks. This means threading happens on object level, but the system is
flexible enough for higher granularity.

Technical details:

- Uses task scheduler which was recently committed to trunk
  (that one which Brecht ported from Cycles).

- Added two utility functions to dependency graph:
  * DAG_threaded_update_begin, which is called to  initialize threaded
    objects update. It will also schedule root DAG node to the queue,
    hence starting evaluation process.

    Initialization will calculate how much parents are to be evaluation
    before current DAG node can be scheduled. This value is used by task
    threads for faster detecting which nodes might be scheduled.

  * DAG_threaded_update_handle_node_updated which is  called from task
    thread function when node was fully handled.

	This function decreases num_pending_parents of node children and
	schedules children with zero valency.

    As it might have become clear, task thread receives DAG nodes and
    decides which callback to call for it.

    Currently only BKE_object_handle_update is called for object nodes.

    In the future it'll call node->callback() from Ali's new DAG.

- This required adding some workarounds to the render pipeline.
  Mainly to stop using get_object_dm() from modifiers' apply callback.
  Such a call was only a workaround for dependency graph glitch when
  rendering scene with, say, boolean modifiers before displaying
  this scene.

  Such change moves workaround from one place to another, so overall
  hackentropy remains the same.

- Added paradigm of EvaluaitonContext. Currently it's more like just a
  more reliable replacement for G.is_rendering which fails in some
  circumstances.

  Future idea of this context is to also store all the local data needed
  for objects evaluation such as local time, Copy-on-Write data and so.

  There're two types of EvaluationContext:

  * Context used for viewport updated and owned by Main. In the future
    this context might be easily moved to Window or Screen to allo
    per-window/per-screen local time.

  * Context used by render engines to evaluate objects for render purposes.
    Render engine is an owner of this context.

  This context is passed to all object update routines.

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: lukastoenne

Differential Revision: https://developer.blender.org/D94
2013-12-26 17:24:42 +06:00
Campbell Barton
ca36091266 correction to last commit 2013-12-26 08:37:28 +11:00
Campbell Barton
7a3594dbd7 BGE: Add missing NULL check from recent LOD updates 2013-12-26 08:28:00 +11:00
Campbell Barton
a5606fadbb Code Cleanup: remove object arg to CDDM_from_mesh mesh_create_derived 2013-12-26 08:27:08 +11:00
HG1
d94db03ac8 Style cleanup: BGE 2013-12-24 05:44:54 +11:00
Sergey Sharybin
ff9974ed69 Fix T37898: blenderplayer painfully slow in recent builds
Issue was caused by recent image cache rewrite and root of
the issue goes to the fact that blender player doesn't
initialize cache limiter and it uses 32meg of memory only.

This leads to infinite image loading/freeing.

For now disabled cache limiter in game engine, this brings
back old behavior.

In theory we might be smarter here, but better caching
policy is to be discussed.
2013-12-22 15:26:59 +06:00
Campbell Barton
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
Daniel Stokes
e9e08a1d12 Game Engine: Level of detail support and tools
Levels of detail can be added and modified in the object panel. The object
panel also contains new tools for generating levels of detail, setting up
levels of detail based on object names (useful for importing), and
clearing an object's level of detail settings. This is meant as a game
engine feature, though the level of details settings can be previewed in
the viewport.

Reviewed By: moguri, nexyon, brecht

Differential Revision: http://developer.blender.org/D109
2013-12-17 17:03:27 -08:00
James Yonan
1831c930a5 Game Engine: Option to record static objects animation 2013-12-09 22:28:38 +11:00
Bastien Montagne
46eef60d93 Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.

WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
         in previous versions (a few angle properties would use radians values as degrees...).

Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
                  (using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.

- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.

- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.

- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
                        it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
                        can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
                                                                           as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.

Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt

Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!

Differential Revision: http://developer.blender.org/D59
2013-12-03 20:35:45 +01:00
Mitchell Stokes
8aff45d8f6 Fix T36804: the property sensor when set to interval was causing a memory leak
The property sensor was using CValue::FindIdentifier(), which does an AddRef(). However,
the property sensor was not calling Release() when it was done with the value. This could
cause more leaks when used in conjunction with the copy property actuator since it would
really throw off ref counts.
2013-11-29 18:34:06 -08:00
Mitchell Stokes
eba07b77da Fix T37566: KX_GameObject.resumeDynamics() was not properly restoring collision groups and masks. 2013-11-29 14:32:56 -08:00
HG1
406289497f Fix T37636: double added pyattr_get_lights 2013-11-27 08:42:41 +11:00
Campbell Barton
91a24654dd Code Cleanup: whitespace / formatting 2013-11-24 15:23:38 +11:00
Campbell Barton
d4a11388bf Code Cleanup: warnings 2013-11-22 11:30:40 +11:00
Campbell Barton
0c0bed3b16 Fix: Game Engine regression drawing text from recent cleanup 2013-11-20 00:01:20 +11:00
Mitchell Stokes
0f32bc49ec Fix T37171: Camera parented to a bone doesn't move with the bone, unless another object is parented too
Armatures used to check if any of their meshes were culled to see if they needed
to be updated. However, this meant armatures with no meshes would never update,
since non-mesh objects are always considered culled. Instead, if a non-culled
child was not found, we now check to see if the armature contained only
non-mesh objects. If this is the case, always update the armature. If this
becomes a problem, we can look into being able to cull non-mesh objects.
2013-11-18 14:52:07 -08:00
Mitchell Stokes
c73f82b6f0 Fix T37040: Removing vehicles in BGE causes a crash
The vehicle constraint is now properly removed if bge.constraints.removeConstraint()
is used or the object is deleted. This also fixes a memory leak with the
vehicle wrapper.
2013-11-18 09:37:58 -08:00
Sergey Sharybin
53753c0ddc Fix T37488: Crash with --debug reading userpref.blend
Issue was in fact caused by wrong DNA storage, which
apparently was considering unsigned long as just 4
bytes here.

Now use uint64_t to be sure timestamp does fit into
storage on all the platforms.

Thanks Campbell for help looking in the issue.
2013-11-18 18:13:23 +06:00
Sergey Sharybin
2b0162b622 Fix T37289: ID User decrement error for Shapes on Bones when playing in BGE
GE was copying the pose channels without increasing user counter for a
custom bone shape object. Freeing copied pose will for give decrement
errors.

The same increment issue seems to happen in BKE_pose_copy_data, which
is also solved now.
2013-11-18 17:19:15 +06:00
Mitchell Stokes
537f28fc0e Fix T37325: applyRotation() wasn't working correctly on rigid bodies in the game engine.
During the physics cleanup/refactor, the rotation matrix in
CcdPhysicsController::RelativeRotate() became transposed.
2013-11-17 16:04:26 -08:00
Campbell Barton
85bbef0f4e python api internals: no need to set the stop-iter exception string. 2013-11-17 15:09:57 +11:00
Mitchell Stokes
5cd28bbe80 BGE: Fix for #37335 "Moving the camera with a key (after the recent BGE cleanup commits) now crashes the game" reported by Ace Dragon.
CcdPhysicsEnvironment->GetCharacterController(); was missing a NULL check.
2013-11-06 19:40:37 +00:00
Campbell Barton
7874447e4a code cleanup: typo and warning when openmp's disabled. 2013-11-05 21:59:30 +00:00
Jens Verwiebe
dba787f529 OSX/player: Remove some very old code ( 11 years+ ), was commented anyway 2013-11-05 20:30:09 +00:00
Jens Verwiebe
1808dd0828 Scons: Fix BGE compile after cleanup 2013-11-05 10:56:52 +00:00
Campbell Barton
9e2beaa1e2 bge builds again without bullet. 2013-11-05 06:19:19 +00:00
Thomas Dinges
cbbf6bfe25 * More fixes to make scons / Windows happy. :) 2013-11-04 22:33:02 +00:00
Bastien Montagne
93de84f267 Fix for recent BGE commits, when building with c++ guardedalloc. 2013-11-04 22:22:54 +00:00
Thomas Dinges
ee854a04fa * Fix blenfont scons include after recent GE changes.
Mitchell: Please check if these includes also need to be added in scons: https://projects.blender.org/scm/viewvc.php/trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt?root=bf-blender&r1=61087&r2=61086&pathrev=61087
2013-11-04 22:14:04 +00:00
Mitchell Stokes
b792ad2b46 BGE Physics Cleanup: Fixing an error that GCC didn't catch. 2013-11-04 19:23:00 +00:00
Mitchell Stokes
efa40ea590 BGE: Fixing up a small issue from merging Rasterizer cleanup code. 2013-11-04 19:22:56 +00:00
Mitchell Stokes
be114086f2 BGE: The recent physics cleanup was using KX_GameObject::GetParent() with out calling parent->Release(). Since GetParent() does an AddRef(), this was causing a leak, which resulted in Zombie Object errors. 2013-11-04 19:22:52 +00:00
Mitchell Stokes
b90de0331d BGE: Cleaning up the BGE's physics code and removing KX_IPhysicsController and KX_BulletPhysicsController. Instead, we just use PHY_IPhysicsController, which removes a lot of duplicate code.
This is a squashed commit of the following:
    BGE Physics Cleanup: Fix crashes with LibLoading and replication. Also fixing some memory leaks.
    BGE Physics Cleanup: Removing KX_IPhysicsController and KX_BulletPhysicsController.
    BGE Physics Cleanup: Moving the replication code outside of KX_BlenderBulletController and switching KX_ConvertPhysicsObjects to create a CcdPhysicsController instead of a KX_BlenderBulletController.
    BGE Physics Cleanup: Getting rid of an unsued KX_BulletPhysicsController.h include in KX_Scene.cpp.
    BGE Physics Cleanup: Removing unused KX_IPhysicsController and KX_BulletPhysicsController includes.
    BGE Physics Cleanup: Removing m_pPhysicsController1 and GetPhysicsController1() from KX_GameObject.
    BGE Physics Cleanup: Remove SetRigidBody() from KX_IPhysicsController and remove GetName() from CcdPhysicsController.
    BGE Physics Cleanup: Moving Add/RemoveCompoundChild() from KX_IPhysicsController to PHY_IPhysicsController.
    BGE Physics Cleanup: Removing GetLocalInertia() from KX_IPhysicsController.
    BGE Physics Cleanup: Making BlenderBulletCharacterController derive from PHY_ICharacter and removing CharacterWrapper from CcdPhysicsEnvironment.cpp. Also removing the character functions from KX_IPhysicsController.
    BGE Physics Cleanup: Removing GetOrientation(), SetOrientation(), SetPosition(), SetScaling(), and GetRadius() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing GetReactionForce() since all implementations returned (0, 0, 0). The Python interface for KX_GameObject still has reaction force code, but it still also returns (0, 0, 0). This can probably be removed as well, but removing it can break scripts, so I'll leave it for now.
    BGE Physics Cleanup: Removing Get/SetLinVelocityMin() and Get/SetLinVelocityMax() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing SetMargin(), RelativeTranslate(), and RelativeRotate() from KX_IPhysicsController.
    BGE Physics Cleanup: Using constant references for function arguments in PHY_IPhysicsController where appropriate.
    BGE Physics Cleanup: Removing ApplyImpulse() from KX_IPhysicsController.
    BGE Physics Cleanup: Removing ResolveCombinedVelocities() from KX_IPhysicsController.
    BGE Physics Cleanup: Accidently removed a return when cleaning up KX_GameObject::PyGetVelocity().
    BGE Physics Cleanup: Remove GetLinearVelocity(), GetAngularVelocity() and GetVelocity() from KX_IPhysicsController. The corresponding PHY_IPhysicsController functions now also take Moto types instead of scalars to match the KX_IPhysicsController interface.
    BGE Physics Cleanup: Moving SuspendDynamics, RestoreDynamics, SetMass, GetMass, and SetTransform from KX_IPhysicsController to PHY_IPhysicsController.
    BGE Physics Cleanup: PHY_IPhysicsEnvironment and derived classes now use the same naming scheme as PHY_IController.
    BGE Physics Cleanup: PHY_IMotionState and derived classes now use the same naming convention as PHY_IController.
    BGE Phsyics Cleanup: Making PHY_IController and its derived classes follow a consistent naming scheme for member functions. They now all start with capital letters (e.g., setWorldOrientation becomes SetWorldOrientation).
    BGE Physics Cleanup: Getting rid of KX_GameObject::SuspendDynamics() and KX_GameObject::RestoreDynamics(). Instead, use the functions from the physics controller.
    BGE: Some first steps in trying to cleanup the KX_IPhysicsController mess. KX_GameObject now has a GetPhysicsController() and a GetPhysicsController1(). The former returns a PHY_IPhysicsController* while the latter returns a KX_IPhysicsController. The goal is to get everything using GetPhysicsController() instead of GetPhysicsController1().
2013-11-04 19:22:47 +00:00
Mitchell Stokes
64c346ed1e BGE Rasterizer Cleanup: The Blenderplayer now loads the monospace font so it can properly draw the framerate and profile display. 2013-11-04 19:22:15 +00:00
Mitchell Stokes
fb94a53978 BGE Rasterizer Cleanup: Cleaning up some includes. 2013-11-04 19:22:10 +00:00
Mitchell Stokes
0cec5c63da BGE Rasterizer Cleanup: Removing the Singletexture material mode. More conversion code will probably be needed. 2013-11-04 19:21:50 +00:00