Commit Graph

14957 Commits

Author SHA1 Message Date
Bastien Montagne 1859215576 Cleanup: some potentially critical changes in data transfer.
Removing that stuff should be valid with new depsgraph/modifiers stack
evaluation system... BUT it might not be, so rather have those in
separate own well-isolated commit.
2018-06-21 15:33:10 +02:00
Bastien Montagne fffff5a993 Cleanup: nuke DM out of data transfer code.
This was actually rather hairy, this code is huge and complicated, easy
to make mistakes...

Good thing is, it will allow for significant simplification and more
(name) cleanup in following commits ;)
2018-06-21 15:33:10 +02:00
Brecht Van Lommel 8534ce9384 Revert "Objects: when active object gets hidden, make it inactive."
This reverts commit fec97ec949, it's useful to be able to edit object
properties for hidden objects. The issue with mode locking that this
was meant to solve will be handled in another way.
2018-06-21 15:04:33 +02:00
Jeroen Bakker 00d52376f7 CodeStyle: Comments 2018-06-21 09:22:34 +02:00
Jeroen Bakker e60d4d6a0c Code cleanup: Added newline 2018-06-21 09:05:31 +02:00
Jeroen Bakker 54c4a107b1 Missed warning is previous commit 2018-06-21 09:04:03 +02:00
Jeroen Bakker 032c741214 Studiolight: Calculation of irradiance buffer
The calculation of the irradiance buffer was slow. Now it is only
calculated when it is being used (background_alpha > 0.0)
this solves the freeze when switching to LookDev mode.

Also changed the default calculation to use the Spherical Harmonics
calculation. This is able to generate the irradiance buffer fast, but is
less accurate. As the irradiance buffer is only used for visual
guidance speed is more important than accuracy.

Added compile directive to switch between the implementations.
(see STUDIOLIGHT_IRRADIANCE_METHOD)

Disabled caching the irradiance buffer when
STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS is used as it is not
needed.
2018-06-21 09:02:12 +02:00
Dalai Felinto 2e66e5faca Silence warning in greasepencil-object branch
We don't have warnings in 2.8 because of include order.
But headers shouldn't depend on that for warnings, really.
2018-06-20 18:44:17 +02:00
Brecht Van Lommel e1dff01e29 Depsgraph: add some missing depsgraph tags when relations change. 2018-06-20 18:12:48 +02:00
Jeroen Bakker a3428131b6 Studiolight: Spherical harmonics
Compile time option to reduce the level of the SH
2018-06-20 16:08:11 +02:00
Bastien Montagne 3df5625ae7 Cleanup: remove some useless Derivedmesh struct declarations. 2018-06-20 15:17:35 +02:00
Jeroen Bakker 0fb1093b14 Studiolight: fixed diffuse lighting
- Orientation of the cubemap were not conform cycles and eevee
- one side of the cubemap was flipped, so one side was overlit and the
other side was to dark.
2018-06-20 15:00:23 +02:00
Bastien Montagne c6ab911744 Merge branch 'master' into blender2.8 2018-06-20 14:16:22 +02:00
Brecht Van Lommel 4234cddda9 Objects: support for hiding all objects in a collection.
In the outliner there are now icons for it, Ctrl+Click isolates a
single collections.

In the 3D view, Ctrl+H key opens a menu that is more or less the
equivalent of the old layer buttons in the header. Regular Click isolates
the collection, Shift+Click toggle the collection visibility. Pressing
number keys and letters works in this menu, which can help for quickly
selecting a specific collection.

Shortcuts for quick switching by just pressing 1/2/3/.. keys are available
again. The order can be confusing with nested collections, but that seems
unavoidable. The first numbers control the top level collections, and then
sub collections if numbers are left.

Remaining design issues:

* The 3D view menu needs to be improved: support for sub collections,
  staying open on shift+click, access from the 3D view header somewhere,
  shortcut key display.
* Currently collection hiding just controls per-object hiding, we plan
  to separate this state still so alt+H doesn't affect collection hiding.
2018-06-20 13:04:51 +02:00
Brecht Van Lommel 5e968a996a Objects: restore per object restrict view/render/select.
Note this is now separate from H key hiding, and meant for more persistent
ways to define which objects are relevant to the viewport or render.

This avoids some cases where you'd have to create collection specifically
to hide objects for viewport/render.
2018-06-20 12:35:25 +02:00
Brecht Van Lommel 0619f960c2 Objects: restore H key per object hiding.
H hides selected objects, Shift+H hides unselected objects, and Alt+H
reveals hidden objects.

This hiding state is distinct from restrict viewport and render, and
meant for temporarily hiding objects without affecting more persistent
collection hiding.

Object hiding is per view-layer, same as selection. It affects the
viewport and any preview renders in there, but not final renders.

In the outliner, different icons are now used for temporary hiding, and
restrict viewport and render. Hidden objects are greyed out.

Remaining design issues:

* For lamps we probably still want to keep their effect on the scene,
  currently they are fully disabled by hiding. Arguably mesh lights or
  even objects being reflected or casting shadows are not that different
  but perhaps the special lamp exception from local view should remain.
* We need a feature still to disabled this hiding for specific viewports,
  for render or animation preview where you want to see the entire scene
  while working in another view.
* We need a new icon for restrict viewport, for now it uses a grid similar
  to the 2.4 icon.
* Hiding objects does not preserve selection state as it did in 2.7,
  it's probably convenient to support this again?
2018-06-20 12:35:25 +02:00
Bastien Montagne fd48e685c3 Cleanup: remove some G.main from BKE's node.c
Validate some cases using G_MAIN instead (I don't think we want to work
on any other Main than G.main one when registering/unregistering nodes
etc.).

And when freeing, all ID not in Main shall now be tagged accordingly, so
we *should* not need to do that stupi search over all ntrees in G.main
to check wether we have to free it ourself or not!
2018-06-20 12:27:26 +02:00
Campbell Barton b661a4d663 Merge branch 'master' into blender2.8 2018-06-20 11:09:07 +02:00
Sergey Sharybin 8763a8fd4b Particle edit: Fix missing hair in edit mode for new particle systems
Need to get away from thosae update flags in original datablocks.
2018-06-20 11:05:52 +02:00
Campbell Barton d4519f54b3 UI: only show "Edit Translations" when addon used 2018-06-20 10:45:03 +02:00
Campbell Barton 570f3e6719 Object Mode: enable mode locking by default
This is meant to be default behavior for 2.8, see T55246
2018-06-20 10:18:53 +02:00
Campbell Barton 9f9756ec35 Cleanup: strip space 2018-06-20 10:14:04 +02:00
Sybren A. Stüvel 8b9712faeb Fix T55540 Add foreachMappedXXX equivalent API for evaluated meshes 2018-06-20 10:03:50 +02:00
Jeroen Bakker e3052ecb0d Studiolight: removed raise condition
Happened when deleting many studiolights at the same time when the
previews were still beging calculated in the background.

Added a free function callback that is filled when the preview is being
generated. This free function will then kill the preview job

This patch also removes icons that are not valid anymore so the user
cannot accidentally render an icon where the studiolight is invalid.

In the end we should use a add/remove function in the studiolight as
currently icons are recalculated too much.
2018-06-20 09:29:40 +02:00
Bastien Montagne db0563e995 Fix re-entrant calls in some cases of mesh_evaluated generation.
`mesh_get_eval_final` and friends could call `mesh_build_data`, which in
paint/sculpt mode would call `BKE_sculpt_update_mesh_elements` which
would call `mesh_get_eval_final`... ugly!
2018-06-19 19:15:11 +02:00
Bastien Montagne 1292aae5c0 Correction to previous commit.
There is no guarantee that given ob pointer is not also an evaluated one
here...
2018-06-19 18:29:40 +02:00
Bastien Montagne 5372da0121 ModStack: Fix broken object_get_datamask helper.
Would compare evaluated ob pointer to original one...

Found while investigating some errors in incomming cleanup, but this was
probably generating lost of other issues in some cases...
2018-06-19 18:25:30 +02:00
Jeroen Bakker 0116c95d4c Studiolight: Temp Mutex issue
This is a temp fix for a better system.
Currently the studiolights can be referenced by a WM_job and being freed
via the API. This can happen when removing a studiolight via the
interface.

As the studiolight has no relation with the job, it is hard to detect if
it is still being used. I tried with a Mutex and a Thread Queue but they
were failing.

So the current temp fix is to keep the studiolights in memory until you
close blender. This Must be fixed ASAP! I added this fix so normal cases
can workish.
2018-06-19 16:37:23 +02:00
Brecht Van Lommel 86c1cad1cf Fix missing render slots bugs after recent changes. 2018-06-19 16:19:49 +02:00
Campbell Barton 7c3ecbf040 Correct rigidbody stub 2018-06-19 16:18:23 +02:00
Sybren A. Stüvel 96e6fd3b60 Remove rigid body from rbw->group when deleting
I moved some code from ED_rigidbody_object_remove() to
BKE_rigidbody_remove_object(), so that calling the latter doesn't leave
the object in rbw->group (causing a crash later on when rebuilding the
depsgraph).
2018-06-19 15:40:25 +02:00
Sergey Sharybin d8f9ec1547 Particles: Support changing modifiers during particle edit mode
The idea is to only use pointers to particles in original object when
creating an edit structure. The derived mesh we get from evaluated
object.

The rest of the commit is just keeping pointers in sync.
2018-06-19 15:28:33 +02:00
Sergey Sharybin 95306a4d19 Particles: Use utility function to copy particles 2018-06-19 15:28:33 +02:00
Sergey Sharybin aa3f0b0998 Particles: Add utility function to copy particles from one system to another 2018-06-19 15:28:33 +02:00
Campbell Barton 92c519ff17 Blender Version Bump
Without this, render slots aren't added.
2018-06-19 14:50:39 +02:00
Sybren A. Stüvel 92823275af Fixed rigid body simulation randomly stopping
This was caused by a floating point comparison using ==, instead of using
compare_ff_relative().
2018-06-19 14:22:48 +02:00
Jeroen Bakker de748bbedf Studiolight: Background Generation of icons 2018-06-19 14:04:51 +02:00
Sybren A. Stüvel 8f922b30b0 RigidBodyWorld: copy ptcache from evaluated scene back to original scene
This makes it possible to perform re-evaluation of the scene without
having to re-run the simulation.

The CoW → Orig copy is only performed when the depsgraph is active, so
as to not influence the current scene while rendering in the background.

Alternatively, we could have the CoW copy share the cache with the
original to prevent too much copying of cache data. This will be faster,
but I'm not sure whether we can reliably check the DEG_is_active()
status at CoW copy creation time.
2018-06-19 11:49:56 +02:00
Jeroen Bakker 65b3c7b72c Studiolight: Add SH2 cache
- the result of the SH2-coeffiecients are stored in a bin file (3*9
floats). As the file is a local file we do not care about the
architecture.
- solved issue that also for internal lights the irradiance file were
stored. We don't want that as it could be in a not accessible location
2018-06-19 09:06:35 +02:00
Campbell Barton 643370b10f Cleanup: code-style 2018-06-18 20:58:08 +02:00
Bastien Montagne 9fb5924446 Fix a very nasty and sneaky bug in lib remap / static override code.
Not sure why remap call for static override reference ID pointer was put
there, probably a mistake during some merge back in the days...

But this ended up with self_id of libquery data struct still being set
to previous ID pointer, which could randomly generate crap like falsly
reporting indirect data and such, leading to lost reference datablock at
writefile time...
2018-06-18 20:20:55 +02:00
Bastien Montagne 594bcf934e Cleanup: use DEG tag flags, instead of old OB ones.
Having those two in parallel is ratehr confusing... :/
2018-06-18 18:43:21 +02:00
Bastien Montagne 4efe8fc806 Fix crash when making static override of an object from a collection.
Since we free collection caches when we remap one of their objects, we
also need to tell depsgraph to flush this into the COWs of that
collection, otherwise things like draw code can access freed memory...
2018-06-18 18:43:21 +02:00
Jeroen Bakker 7356cec0c6 Studiolights: Radiance icons were inverted. 2018-06-18 15:45:55 +02:00
Jeroen Bakker 7747d4cecf Workbench: increased Quality of the diffuse lighting model
- implemented Spherical Harmonics L2 for diffuse shading.

TODO: caching the precalculated harmonics so it won't take soo long to
open the popover
2018-06-18 15:32:53 +02:00
Brecht Van Lommel fec97ec949 Objects: when active object gets hidden, make it inactive. 2018-06-18 15:20:06 +02:00
Brecht Van Lommel 7c836ac30a Cleanup: simplify some view layer code. 2018-06-18 15:20:06 +02:00
Sergey Sharybin 0365079676 Particles: Remove obsolete code for child particles in edit mode 2018-06-18 15:14:03 +02:00
Sergey Sharybin d5ec62a0c3 Multires: Remove unused function
It uses derived mesh, and relies on scene stored in modifier data.
So port is needed anyway.
2018-06-18 11:14:00 +02:00
Campbell Barton 06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00