Commit Graph

2922 Commits

Author SHA1 Message Date
Mitchell Stokes
411650f2fa Partial fix for T3817: BGE crashing when using LibNew.
The BGE needs to use BKE_main_new() isntead of calloc for
allocating a Main struct since the threaded depsgraph changes.
2014-02-23 12:44:33 -08:00
brita
9753641c5d Fix T38645 - Mouse reversed in standalone player with kde
Reviewers: moguri

Differential Revision: https://developer.blender.org/D344
2014-02-22 17:23:18 -08:00
Campbell Barton
3a44e975a9 Fix T38539: Can't set near sensor distance above 100 via python 2014-02-22 13:57:12 +11:00
Mitchell Stokes
16c75cf594 Fix T38654: Using a non-camera object for the SetCamera Scene Actuator causes a segfault.
Non-camera objects are not supported as cameras, and trying to use them
just causes memory errors (some bad typecasts are involved). When converting
a Scene Actuator, only use the object as a camera if it is actually a camera.
Also, the logic brick UI now filters for camera objects, which should help
avoid confusion.
2014-02-17 14:38:08 -08:00
Mitchell Stokes
f3c7cb02b2 Fix T37964: KX_GameObject missing NULL checks for m_physicsController.
KX_GameObject::PySuspendDynamics() and KX_GameObjectPyRestoreDynamics()
now make sure GetPhysicsController() is non NULL before attempting
to use it.
2014-02-14 13:17:51 -08:00
Campbell Barton
5621e63d36 Code cleanup: duplicate headers 2014-02-14 10:55:38 +11:00
IRIE Shinsuke
38e58612ef Revert own previous commit rBe2f9afbaabbd.
The "Cast Shadows" worked as expected, but it can cause problem in some cases.
For example, when using strand render, we need disabling only buffer shadows,
but the previous changes made that impossible. "Cast Shadows" should be added
as a newly created option.
2014-02-12 05:46:26 +09:00
Sergey Sharybin
c0a13322cd Fix T38553: Crash load new level; array modifier using curve length
Since threaded object update we've disabled in-place
curve evaluation (in cases when applying curve modifier
with target curve non-evaluated yet).

This requires game engine to take care of DAG and object
evaluation (currently it's designed to export only objects
it able to render).

This workaround will make sure that curve_cache for curves
is up-to-date.
2014-02-11 18:25:53 +06:00
IRIE Shinsuke
e2f9afbaab Blender Internal: Modify material property "Cast Buffer Shadows" to affect ray shadows also, and rename it to "Cast Shadows".
This allows us to make materials that don't cast ray shadows.
Turning off this property can reduce the rendering time slightly.

Note: RNA path is changed to "use_cast_shadows" as well. The older
path "use_cast_buffer_shadows" still can be used as its alias, but
it will be removed after updating some addons.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D272
2014-02-11 17:06:21 +09:00
Campbell Barton
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
Mitchell Stokes
88843caaa3 BGE: Fixing memory corruption/double free when duplicating (e.g., addObject) LibLoaded lights. 2014-02-04 14:48:22 -08:00
Mitchell Stokes
6a2c467443 Blenderplayer: Fixing a memory leak.
IMB_moviecache_destruct() was not being called.
2014-02-03 14:25:59 -08:00
Campbell Barton
76543574bc Code cleanup: declarations for removed functions 2014-02-04 07:20:19 +11:00
Sergey Sharybin
9bec4f7779 Fix T38455: Blenderplayer is not working
Was a regression since avg_frame_rate changes.

Didn't find reliable way to get stream duration which will
work with both FFmpeg and Libav so added some freaking black
magic to distinguish one from another.
2014-02-03 17:25:47 +06:00
Campbell Barton
37381ef492 BGE: correct for last commit 2014-02-03 21:41:36 +11:00
Campbell Barton
1dc1d92dab Code cleanup: white space and cmake was broken on all platforms 2014-02-03 13:56:34 +11:00
Campbell Barton
fed1b8b16d Code cleanup: suffix vars to make obvious they are squared 2014-02-03 02:46:45 +11:00
Anton Khirnov
f99e581ae1 libavformat API usage: use avformat_close_input() instead of av_close_input_file() 2014-01-28 14:20:22 +06:00
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