Commit Graph

1670 Commits

Author SHA1 Message Date
Nathan Craddock 2b95f2439e Merge branch 'blender-v2.83-release' 2020-04-24 20:53:34 -06:00
Sybren A. Stüvel a8441fc900 Fix T69753 Instanced Metaballs not rendering but showing up in Viewport
This hides the original metaballs when they are used in
duplifaces/-verts instancing, and still shows the instanced metaballs.

The visibility of the original metaballs is now determined by the
visibility of the instancer. I'm not too thrilled about this, but at
least it gives users the ability to show/hide the metaballs for
viewport/render.

Differential Revision: https://developer.blender.org/D7478
2020-04-24 17:23:44 +02:00
Jacques Lucke 47ae0affc8 Depsgraph: Use BLI::Map instead of GHash for operations_map
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7509
2020-04-24 11:34:04 +02:00
Jacques Lucke 69b6c89842 Depsgraph: Use BLI::Set instead of std::unordered_set
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7506
2020-04-24 10:48:25 +02:00
Campbell Barton af0a042da7 Cleanup: remove unused arg, clang-format 2020-04-24 11:43:30 +10:00
Jacques Lucke ed4f33a7bd Cleanup: silence unused parameter warning 2020-04-23 20:49:42 +02:00
Brecht Van Lommel 5e04548500 Merge branch 'blender-v2.83-release' 2020-04-23 15:45:46 +02:00
Brecht Van Lommel 869472b3f0 Fix T75611: slow transform of many objects at the same time
Solve O(n^2) time complexity problem where a dependency graph iterator loops
over all nodes to clear flags, which happened for every object at the start
of transform.

Differential Revision: https://developer.blender.org/D7503
2020-04-23 15:41:57 +02:00
Jeroen Bakker 2d6ad88466 CleanUp: Renamed `BLI_task_pool_userdata` to `BLI_task_pool_user_data`
In preparation for {D7475}
2020-04-21 15:37:36 +02:00
Luc Revardel 23919d2275 Fix T75845: some dependencies update missing when painting textures.
issue: Painting a texture that is set as a particle system influencer, doesn't
update particles. An external trigger (such as changing influence slider)
is required to update particles.

fix: The root cause is a missing relationship from image to texture in the
dependency graph.

test: Once fixed, image texture painting updates expected dependencies
such as particle system influence or displacement modifier.

Reviewed By: sergey

Maniphest Tasks: T75845

Differential Revision: https://developer.blender.org/D7472
2020-04-21 15:27:21 +02:00
Jacques Lucke eb4e3bbe68 Simulations: Add new simulation data block
This data block will be the container for simulation node trees.
It will be used for the new particle node system (T73324).

The new data block has the type `ID_SIM`.
It is not visible to users and other developers by default yet.
To enable it, activate the cmake option `WITH_NEW_SIMULATION_TYPE`.

New simulation data blocks can be created by running `bpy.data.simulations.new("name")`.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7225
2020-04-20 10:45:18 +02:00
Sybren A. Stüvel 20614d331d Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-04-17 16:39:40 +02:00
Sybren A. Stüvel 6adb254bb0 Fix T75686: Animating scene audio volume doesn't work
Scene audio volume changes require the scene to be tagged with
`ID_RECALC_AUDIO_VOLUME` (see `BKE_scene_update_sound()`). Tagging
happens in the RNA update function `rna_Scene_volume_update()`, but that
function is not called by the animation system. As a result, animated
volume changes are not sent to the audio system.

This commit adds a new depsgraph operation node that sets this tag when
necessary, so that the animated values are used in the rest of the
depsgraph evaluation.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7429
2020-04-17 16:33:05 +02:00
Campbell Barton ab93e568eb Cleanup: use colon after doxygen parameters, spelling 2020-04-17 11:15:00 +10:00
Campbell Barton f83ccbc673 Cleanup: unused variable, spelling 2020-04-16 00:12:39 +10:00
Brecht Van Lommel 47084bac9f Fix T75542: toggling modifier visibility not working correct with undo speedup
The problem was that in direct_link_id_restore_recalc, recalc_undo_accumulated
should contain the changes from the target state to the current state. However
it had already been cleared at that point, to start accumulating changes up to
the next undo push.

Delaying the clear of this flag seems like the obvious solution, but it's hard
to find the right place for that (if there is one). Instead this splits up the
flag into two separate variables.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7402
2020-04-14 11:07:56 +02:00
Campbell Barton 5f059c8751 Cleanup: spelling 2020-04-14 10:49:31 +10:00
Sebastian Parborg 9a7f5f1bb4 Fix T67232: Multiples targetless IKs in a chain gives weird behaviour (known as FakeIK for FK posing)
The issue was that the deps graph relation builder assumed that all
bones that had a IK constraint on them would be evaluated.  However for
targetless IK bones, only the active bone would receive updates and the
others would be skipped (as those would be treated as if the IK
constraint was disabled).

I didn't see an easy way to solve this from the depsgraph side of
things.

Instead I came up with a solution that I feel is quite strait forward
and reflects what is actually supposed to happen under the hood.

Now all targetless IK constraints are treated as disabled and will not
be added to any relations in the depsgraph.

Instead, a temporary IK constraint will be created when the bone in
question is transformed.  This is basically activating "Auto IK" for the
bone while transforming.

Reviewed By: Sergey, Brecht

Differential Revision: http://developer.blender.org/D7378
2020-04-10 14:01:02 +02:00
Brecht Van Lommel 78f56d5582 TaskScheduler: Minor Preparations for TBB
Tasks: move priority from task to task pool {rBf7c18df4f599fe39ffc914e645e504fcdbee8636}
Tasks: split task.c into task_pool.cc and task_iterator.c {rB4ada1d267749931ca934a74b14a82479bcaa92e0}

Differential Revision: https://developer.blender.org/D7385
2020-04-09 19:18:14 +02:00
Brecht Van Lommel 9d0f452076 Fix missed depsgraph update after undo in some cases
Forgot to take into account legacy DEG_id_tag_update with zero flag.
2020-04-07 23:56:07 +02:00
Brecht Van Lommel c5ed2eb95e Undo: change depsgraph recalc flags handling to improve performance
These changes only have an effect when the experimental Undo Speedup preference
is enabled.

* For DEG_id_tag_update, accumulate recalc flags immediately before the undo
  push happens instead of afterwards. Otherwise the undo state does not
  contain enough flags, and the current state may contain too many flags.

  This also means we call DEG_id_tag_update after undo with the accumulated
  flags to ensure they are flushed to other datablocks.

* For undo, accumulate recalc flags in id->recalc and clear accumulated flags
  immediately. Not clearing would cause circular behavior where accumulated
  flags may never end up being cleared.

  This matches what happens after an undo push where these are also cleared,
  indicating that the undo state and current in-memory state match exactly.

* Don't change id->recalc of identical datablocks, it should not be needed.
  There is one exception for armatures where pointers across datablocks
  exist which otherwise would cause problems. There may be a better solution
  to this but it seems to work in agent 327 production files.

* This contains a change in undofile.c to avoid detecting all datablocks as
  changed for the first of the two undo steps, where we restore to the state
  of the last undo push before going to the one before.

  Without this the whole system is much less efficient. However this is unsafe
  in the sense that if an app handler or operators edits a datablock after an
  undo push, that change will not be undone.

  It can be argued that this is acceptable behavior, since a following undo push
  will include that change and this may already have unexpected side effects.

Ref T60695

Differential Revision: https://developer.blender.org/D7339
2020-04-07 17:14:19 +02: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
Sybren A. Stüvel b5253159b6 Cleanup: split `BKE_anim.h` and `anim.c` into smaller pieces
The files are now split up into the following sections:
- `BKE_anim_path.h` and `anim_path.c` for path/curve functions.
- `BKE_anim_visualization.h` and `anim_visualizationanim_path.c` for
  animation visualization (mostly motion paths).
- `BKE_duplilist.h` for DupliList function declarations. These were
  already implemented in `object_dupli.c`, so they were rather out of
  place being declared in `BKE_anim.h` in the first place.

No functional changes.
2020-04-03 12:13:51 +02:00
Campbell Barton 05dcb007e1 Cleanup: use tern 'sync' instead of 'synchronization' for function names
This is a common, unambiguous abbreviation
already used throughout the code-base.
2020-04-03 16:46:34 +11:00
Sybren A. Stüvel e276558a50 Fix T74983: Material preview icons don't refresh
The root cause of the issue reported in T74983 is that an `IDNode` would
not be marked as user-modified. This marking happened while looping over
outgoing relations of one of its operation nodes. Since rBff60dd8b18ed
unused relations are removed, and as a result the `IDNode` would not be
marked.

The solution was to move the responsible code outside the loop; this is
probably a good idea anyway, as the code did not actually use the
looped-over relations at all, and was thus repeated unnecessarily.
2020-04-02 16:54:17 +02:00
Jacques Lucke 25b2b6724d Fix T74224: Add missing depsgraph relations for boid particles
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7302
2020-04-01 16:21:34 +02:00
Jörg Müller bdec24b40d Cleanup: Removing unused parameter. 2020-03-28 09:14:07 +01:00
Brecht Van Lommel 90aa771b30 Cleanup: compiler warnings 2020-03-27 23:21:16 +01:00
Campbell Barton d0d251b53b Cleanup: spelling 2020-03-24 10:36:42 +11:00
Germano Cavalcante b701af328a Revert "COW: Edit Mesh: Do not copy the looptris pointer"
The looptri is repeated in the linked Meshes but the pointer
is only referenced in the evaluated ones.

This reverts commit 64982e213f.
2020-03-23 14:18:36 -03:00
Sergey Sharybin ed386507e1 Fix T74984: Crash opening specific production files
More detailed symptoms: there was no curve cache created for an object
which was used by draw manager.

A bit tricky situation, which involves collection instances and their
proxies.

The root of the problem in the dependency graph was that instanced
collections visibility was not updated when object is requested with
different visibility. So what was happening is that one of the objects
was pulled as an indirect dependency of something invisible, so it
built instanced collections as if the instancer is invisible. After
that the same object was built as visible. Before this fix this was
only update object flags, the instanced collections still believed they
are invisible. Since there is no path via relations which would connect
visible object with instanced objects the visibility flush which is
happening during graph finalization did not "fix" the visibility flags.

This change makes it so instanced collections are updating their
visibility when their instancer's visibility is changing to truth.
This is similar to how collections will accumulate their visibility
when same collection is used from multiple ones with different
visibility.

However, this alone wasn't enough to get crash fixed. This marked
collections as visible, but the geometry component of the curve object
was still considering self as invisible.

This is something tricky, since the code which is responsible for this
issue was added as an optimization in afb4da6650. This looks like like
an oversight in that commit since it's rather weird that ID node's
flag would depend on construction order (in "normal" object builder the
ID node's directly_visible flag is initialized to object's visibility).
So it seems logical to get this part of code in sync between "regular"
and "accumulative" object builder.

And last but not least the naming is_directly_visible is old and does
not really represent what it actually mans now: a more correct name
would be "will be used by the draw manager".

Differential Revision: https://developer.blender.org/D7217
2020-03-23 17:19:44 +01:00
Sybren A. Stüvel f9855800e0 Depsgraph: Driver Relations, skip finding possible relation with one driver
The `build_driver_relations()` function in the depsgraph relations builder
adds relations between drivers that potentially write to the same memory
location. This of course is only useful when there are two or more drivers.
2020-03-23 14:54:07 +01:00
Sybren A. Stüvel 7192a1bca3 Fix T73593: Drivers on hide_viewport and hide_render are unreliable
My previous fix (rB4c30dc343165) worked, except for an off-by-one error.
2020-03-23 14:54:07 +01:00
Germano Cavalcante 64982e213f COW: Edit Mesh: Do not copy the looptris pointer
No functional changes.

Differential Revision: https://developer.blender.org/D7173
2020-03-23 09:30:26 -03:00
Sergey Sharybin bceb91ffd2 Sound: Fix asymmetrical mutex lock/unlock logic
Started to happen after recent fix for T72632.

Was caused by runtime fields backup doing an early exit in the case the
given ID was never expanded by the Copy-on-Write mechanism, but it was
not done int the backup restore function (since it was not possible to
know "locally").

Now both init() and restore() will do an early exit when the ID had
nothing to be backed up.
2020-03-23 09:55:15 +01:00
Jörg Müller 0710fb724b Fix T72632: Blender crashes using Jack with AV Sync enabled (repeatable) 2020-03-23 09:34:26 +01:00
Bastien Montagne 12b621059a Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Mpving utils from idcode to idtype proved to be somewhat painful for
some reasons, but now all looks good.

Had to add a fake/empty shell for the special snowflake too,
`ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
2020-03-19 19:39:23 +01:00
Germano Cavalcante 3be7d74cba Fix T70126: Can't snap between objects with Rigid Body
`DEG_FOREACH_COMPONENT_IGNORE_TRANSFORM_SOLVERS` was `0`
2020-03-19 13:19:15 -03:00
Philipp Oeser 7e9575f7a1 Fix T74701: Text on Curve Scaling Issue
Both scaling the text itself, as well as scaling the curve wasnt
updating, now added relations for this.

Maniphest Tasks: T74701

Differential Revision: https://developer.blender.org/D7140
2020-03-19 10:43:10 +01:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00
Brecht Van Lommel b0a1cf2c9a Objects: add Volume object type, and prototypes for Hair and PointCloud
Only the volume object is exposed in the user interface. It is based on OpenVDB
internally. Drawing and rendering code will follow in another commit.
https://wiki.blender.org/wiki/Source/Objects/Volume
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Volumes

Hair and PointCloud object types are hidden behind a WITH_NEW_OBJECT_TYPES
build option. These are unfinished, and included only to make it easier to
cooperate on development in the future and avoid tricky merges.
https://wiki.blender.org/wiki/Source/Objects/New_Object_Types

Ref T73201, T68981

Differential Revision: https://developer.blender.org/D6945
2020-03-18 11:23:05 +01:00
Antonio Vazquez 2518f60109 GPencil: Fix Parent layer not working
The parenting was using the old logic, but with new engine the draw is done using eval data.

Fixed the depsgraph relationship missing with bones to get an update when the bone is transformed.

Also fixed Snap cursor to Selected
2020-03-17 17:28:49 +01:00
Bastien Montagne b02a25b7e1 Add accumulated recalc flags to IDs.
Those accumulated flags get cleared every time an undo step is written
to memfile.

Preliminary work for undo-speedup.

Part of T60695/D6580.
2020-03-17 12:10:52 +01:00
Bastien Montagne 2ba3e6a02e Depsgraph: Adds helpers to extract/restore despgraphs in a given Main.
Extract will steal all depsgraphs currently stored in given bmain, and
restore will put them back in place, using scene and viewlayers as keys.

Preliminary work for undo-speedup.

Part of T60695/D6580.
2020-03-17 11:24:37 +01:00
Campbell Barton f0b0524c5f Cleanup: spelling 2020-03-14 15:43:21 +11:00
Sergey Sharybin e9220d5cd0 Depsgraph: Fix crash deleting Viewer image from Outliner
Was happening when having compositor open with Viewer node attached
directly to Render Layers output.

There were two things involved here:

1. The code which was storing CoW-ed versions of IDs was checking all
   IDs for whether they are expanded or not. This was causing access
   of freed memory for deleted IDs which do not need CoW (such as IM).

   Simple fix: store ID type as a scalar and use early check before
   doing more elaborate check based on accessing fields of id_cow.

2. The code which was ensuring view layer pointer is doing CoW for
   scene. This isn't an issue on its own, but scene might have an
   embedded ID such as compositor which was actually traversed by the
   ID remap routines. This was causing remapping procedure to go into
   non-updated copy of compositor, accessing freed Viewer image ID.

   Solved by not recursing into embedded IDs for datablocks as those
   are supposed to have own copy-on-write operations which takes care
   of re-mapping.

Reported my Bastien, and also pair-coded with him.
2020-03-11 17:38:42 +01:00
Clément Foucault 7dd0be9554 EEVEE: Replace octahedron reflection probe by cubemap array
We implement cubemap array support for EEVEE's lightcache reflection probes.
This removes stretched texels and bottom hemisphere seams artifacts caused
by the octahedral projection previously used.

This introduce versioning code for the lightcache which will discard any
lightcache version that is not compatible.

Differential Revision: https://developer.blender.org/D7066
2020-03-11 17:12:16 +01:00
Antonio Vazquez 29f3af9527 GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes.

Also, a huge code cleanup has been done at all levels.

Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development.

Differential Revision: https://developer.blender.org/D6293
2020-03-09 16:27:24 +01:00
Sybren A. Stüvel dcb9312687 Depsgraph: fix crash caused by removing too many NO-OP nodes
Unused no-op operation nodes are not bound to a callback function, and
have no outgoing relations. Incoming relations of such nodes are removed
since ff60dd8b18. However, this was done
too broadly, causing too many relations to be lost and indirectly linked
objects to be unevaluated.

This commit introduces a `DEPSOP_FLAG_FAKE_USER` flag for operation
nodes, which indicates they are not to be removed, even when they appear
to be unused.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7074
2020-03-09 16:05:33 +01:00
Sybren A. Stüvel ff60dd8b18 Depsgraph: remove unused no-op nodes after building
This is the companion of D7031. That patch adds a new DIMENSIONS node to
the depsgraph for each object that has geometry. However, this node is
only necessary when there are drivers using an object's dimensions as
variable. Since this is rare, it's easiest to remove these nodes after
they turn out to be unnecessary. This is what (almost) happens in this
patch.

Removing nodes from the depsgraph is hard, and there are no functions to
do this yet. Instead, this patch recursively removes all the incoming
relations from unused no-op nodes (i.e. no-op operation nodes without
outgoing connections). Actually removing the nodes will be left as a
future improvement.

I've tested this on a Spring file [1]. Here are there results of blender
--debug-depsgraph-time spring_02_055_A.eevee.blend and letting it run
for a while to stabilise the reported FPS:

    master: 11.7 FPS
    Just D7031: 11.7 FPS
    Just D7033: 11.8 FPS
    Both D7031 + D7033: 12.3 FPS

[1] https://cloud.blender.org/p/spring/5d30a1076249366fa1939cf1

Differential Revision: https://developer.blender.org/D7033
2020-03-06 16:19:45 +01:00