Commit Graph

26 Commits

Author SHA1 Message Date
Jacques Lucke 80face1be5 Depsgraph: simplify DEG_evaluate_* API
This mainly removes the bmain argument, which can be
retrieved from the graph itself.

Also, I removed some outdated/unnecessary comments.

Reviewers: sergey, sybren

Differential Revision: https://developer.blender.org/D8614
2020-08-18 17:40:56 +02:00
Jacques Lucke 6a4f5e6a8c Depsgraph: simplify build API
Reviewers: sergey, sybren

Differential Revision: https://developer.blender.org/D8611
2020-08-18 15:51:32 +02:00
Campbell Barton 61a045b7d3 Clenup: use STREQ macro 2020-08-08 13:38:00 +10:00
Sybren A. Stüvel 686ab4c940 T77086 Animation: Passing Dependency Graph to Drivers
Custom driver functions need access to the dependency graph that is
triggering the evaluation of the driver. This patch passes the
dependency graph pointer through all the animation-related calls.

Instead of passing the evaluation time to functions, the code now passes
an `AnimationEvalContext` pointer:

```
typedef struct AnimationEvalContext {
  struct Depsgraph *const depsgraph;
  const float eval_time;
} AnimationEvalContext;
```

These structs are read-only, meaning that the code cannot change the
evaluation time. Note that the `depsgraph` pointer itself is const, but
it points to a non-const depsgraph.

FCurves and Drivers can be evaluated at a different time than the
current scene time, for example when evaluating NLA strips. This means
that, even though the current time is stored in the dependency graph, we
need an explicit evaluation time.

There are two functions that allow creation of `AnimationEvalContext`
objects:

- `BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float
  eval_time)`, which creates a new context object from scratch, and
- `BKE_animsys_eval_context_construct_at(AnimationEvalContext
  *anim_eval_context, float eval_time)`, which can be used to create a
  `AnimationEvalContext` with the same depsgraph, but at a different
  time. This makes it possible to later add fields without changing any
  of the code that just want to change the eval time.

This also provides a fix for T75553, although it does require a change
to the custom driver function. The driver should call
`custom_function(depsgraph)`, and the function should use that depsgraph
instead of information from `bpy.context`.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D8047
2020-07-20 11:51:09 +02:00
Campbell Barton 81c33f0ba7 Cleanup: clang-format 2020-06-01 15:04:30 +10:00
Richard Antalik f13b687551 Merge branch 'blender-v2.83-release' 2020-05-24 21:14:23 +02:00
Richard Antalik 0d0df683d9 Fix(unreported): Crash on prefetching while transforming strip.
While investigating T76274, I found crash scenario when playhead is near end
frame and moving a strip. It is not as easy to reproduce, about 5% success
rate, and it will be even harder after rB4066c921fbe5. Exact cause wasn't
identified yet.

I wanted to disable prefetching during modal operator execution in VSE, but
currently I don't have any signalling method in place. Checking for G.moving
seems to resolve this problem, but it doesn't adress root cause of bug.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7820
2020-05-24 21:03:31 +02:00
Richard Antalik f5c682045d Merge branch 'blender-v2.83-release' 2020-05-22 13:36:23 +02:00
Richard Antalik 4066c921fb Fix (unreported): prefetching wastes resources when end frame is reached
This bug is not really visible for user. When end frame is reached by
prefetching thread, it doesn't stop and keeps on getting images from
cache.

Add chech for this situation and simplify logic involved in suspending,
so it's easier to read.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7757
2020-05-22 13:31:49 +02:00
Richard Antalik c4edc6f3f7 Fix (unreported): Don't restart prefetching during rendering.
Prefetching is stopped in BKE_sequencer_cache_cleanup, but is restarted quickly.

Prefetching has negative effect on performance while rendering.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7751
2020-05-22 13:05:08 +02:00
Richard Antalik f9d0f59bed Merge branch 'blender-v2.83-release' 2020-05-13 00:14:44 +02:00
Richard Antalik 50ef801a79 Fix T76320: Thread race condition on undo with prefetching enabled
Stop prefetch jobs before undoing.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7633
2020-05-13 00:10:58 +02:00
Richard Antalik 613715a994 Merge branch 'blender-v2.83-release' 2020-05-12 23:19:00 +02:00
Richard Antalik be69f23b68 Fix T70612: Sequencer Crash on enabling Prefetch
Disable (skip) preftching scene strips if they target 3D scene.
Try to continue prefetching complete frame if disk cache images are found.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7514
2020-05-12 23:13:18 +02:00
Richard Antalik 87602d886f Merge branch 'blender-v2.83-release' 2020-05-01 21:28:55 +02:00
Richard Antalik 98990f6ba4 Fix T76033: VSE crash with prefetch, disk cache and meta strips
`BKE_sequencer_prefetch_get_original_sequence()` didn't look in metas
and returned NULL. This caused crash in disk cache that was trying to
read seq->name.

Add function that will look in meta strips recursively and condition
that seq must not be NULL.

Reviewed By: brecht

Maniphest Tasks: T76033

Differential Revision: https://developer.blender.org/D7597
2020-05-01 21:22:04 +02:00
Richard Antalik 13abd3784a Merge branch 'blender-v2.83-release' 2020-04-27 00:57:17 +02:00
Richard Antalik d0d16eb7d3 Fix T74346 VSE: Prefetching doesn't work properly with property animations
Make sure depsgraph was updated before evaluating the animation.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7467
2020-04-27 00:51:44 +02:00
Campbell Barton 1685f5824d Cleanup: remove unused scene argument 2020-04-16 11:05:52 +10:00
Sybren A. Stüvel 3208454aa8 Cleanup: Animation, move AnimData API to `anim_data.c`/`BKE_anim_data.h`
The `BKE_animsys.h` and `anim_sys.c` files already had a an "AnimData
API" section. The code in that section has now been split off, and
placed into `BKE_anim_data.h` and `anim_data.c`.

All files that used to include `BKE_animsys.h` have been adjusted to
only include the animation headers they need (sometimes none).

No functional changes.
2020-04-03 16:46:48 +02:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00
Bastien Montagne 56116bbdf4 Cleanup/refactor: Rename `BKE_library` files to `BKE_lib`.
Note that `BKE_library.h`/`library.c` were renamed to
`BKE_lib_id.h`/`lib_id.c` to avoid having a too generic name here.

Part of T72604.
2020-02-10 13:00:42 +01:00
Brecht Van Lommel 3788901107 Cleanup: fix compiler warnings 2020-01-27 12:19:49 +01:00
Richard Antalik 2b29bf25fc Fix T69924: Prefetch stops when moving playhead
Fix T70194: Prefetch freezes Blender in some cases

- Initialize depsgraph in isolated bmain struct.
- Fix prefetching range (forgot in initial prefetch commit).
- Fix crash - Add check if prefetch job is initialized and running.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5899
2019-10-02 13:48:39 -07:00
Jacques Lucke 5055a55bc4 VSE: quiet missing prototype warnings 2019-09-14 16:54:59 +02:00
Richard Antalik ab3a9dc1ed VSE: prefetching
When enabled prefetching(preview panel>view settings), a pernament running job
is created, that will render frames in the background until the cache is full.
If the cache is not filled fast enough, prefetch job suspends itself
at the last moment and will wait until it has chance to "catch up".
Effectively this will decouple rendering to separate thread, so rendering
itself is a bit faster.
Cache recycling behavior will be changed to "free furthest frame to the left
of playhead if possible, otherwise rightmost frame".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5386
2019-09-13 17:24:42 -07:00