Commit Graph

10512 Commits

Author SHA1 Message Date
Alexander Gavrilov 084bf7daee Weight Paint: Implement a new Lock-Relative mode.
This check box alters how weights are displayed and painted,
similar to Multi Paint, but in a different way. Specifically,
weights are presented as if all locked vertex groups were
deleted, and the remaining deform groups normalized.

The new feature is intended for use when balancing weights within
a group of bones while all others are locked. Enabling the option
presents weight as if the locked bones didn't exist, and their
weight was proportionally redistributed to the editable bones.

Conversely, the Multi-Paint feature allows balancing a group of
bones as a whole against all unselected bones, while ignoring
weight distribution within the selected group.

This mode also allows temporarily viewing non-normalized weights
as if they were normalized, without actually changing the values.

Differential Revision: https://developer.blender.org/D3837
2020-03-18 11:55:44 +03:00
Julian Eisel 7ba403dc94 Fix typo causing compile error with WITH_XR_OPENXR disabled 2020-03-17 22:23:02 +01:00
Julian Eisel dc2df8307f VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.

Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.

To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.

- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.

Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.

---------------

This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)

Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
  regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
  based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
  context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
  to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.

For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.

---------------

A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
  have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
  first bigger application to adopt OpenXR. Congratulations to them and
  ourselves :)

This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report

Differential Revisions: D6193, D7098

Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 21:42:44 +01:00
Aaron Carlisle c9a8de1d70 Fluid: Correct Tooltip 2020-03-17 16:32:56 -04:00
Ray Molenkamp a7c660fe61 Cleanup: Fix warnings about function signature of register pass
RE_engine_register_pass is sometimes in the headers with type
as an integer parameter, sometimes as eNodeSocketDatatype.

This caused warnings, the root cause was makesrna was not able
to generate the proper type for enums and defaulted to int.

makesrna has been extended with the RNA_def_property_enum_native_type
that allows telling makesrna the native type of an enum, if set it
will be used otherwise it will still fall back to int.

Differential Revision: https://developer.blender.org/D7117

Reviewed By: brecht
2020-03-17 13:45:35 -06:00
Bastien Montagne b852db57ba Add experimental global undo speedup.
The feature is hidden behind an experimental option, you'll have to
enable it in the preferences to try it.

This feature is not yet considered fully stable, crashes may happen, as
well as .blend file corruptions (very unlikely, but still possible).

In a nutshell, the ideas behind this code are to:
* Detect unchanged IDs across an undo step.
* Reuse as much as possible existing IDs memory, even when its content
  did change.
* Re-use existing depsgraphs instead of building new ones from scratch.
* Store accumulated recalc flags, to avoid needless re-compute of things
  that did not change, when the ID itself is detected as modified.

See T60695 and D6580 for more technical details.
2020-03-17 15:02:05 +01:00
Mateusz Grzeliński 9ce3890950 Cleanup: rename function
This function was missed in rBec471a9b1c1.

Differential Revision: https://developer.blender.org/D7155
2020-03-17 14:46:50 +01:00
Sebastián Barschkis 20d7c04305 Fluid: Re-dded Empty Space option in the UI
This option existed already and was just hidden in the UI. With the new fluids system though, it will only be used for rendering - and not to optimize the cache.
2020-03-17 11:57:04 +01:00
Campbell Barton b87997f59b Cleanup: rename 'centre' to 'center' in View3D 2020-03-17 11:34:11 +11:00
Campbell Barton 5029b97d02 Cleanup: add NULL check for RNA filename argument
Currently some of the code supports a NULL filename,
add the NULL check so RNAProcessItem's with a NULL filename
don't crash in the future.
2020-03-15 21:53:20 +11:00
Dalai Felinto 5593efec01 Fix stereoscopy drawing for camera background
Part of the fix was to get gputexture to use an array to accomodate each
eye. This takes care of viewports showing individual Left or Right
views.

For the combined view the fix was in overlay_image.c:camera_background_images_stereo_setup.

Note 1: Referece images are still not supporting stereo.

Note 2: For painting, and getting image bindcode I'm hardcording a
single-view experience.

Note 3: Without D6922 stereo is too broken to even test this patch.
With D6922 + this patch the fullscreen modes work (anaglyph/interlace
not yet).

Differential Revision: D7143
2020-03-13 15:40:20 +01:00
Antonio Vazquez cf9b3310c0 GPencil: Fix Noise modifier versioning
The versioning was setting the factor for all modes without checking flags.

Also cleanup some unused code.
2020-03-13 12:24:49 +01:00
Antonio Vazquez de9c7bae7b GPencil: Join Tint and Vertex Color modifier
Both are doing almost the same and can be merged. This reduce complexity for user and less code to maintain.

Reviewed By: mendio, pepeland, fclem

Differential Revision: https://developer.blender.org/D7134
2020-03-13 10:28:59 +01:00
Bastien Montagne 4669dfe2cc Expose 'is embedded data' ID flag to RNA.
Relevant currently for root node trees and master collections.
2020-03-12 18:08:11 +01:00
Phil Stopford 6ce709dceb Ocean: add new spectra modes to the ocean modifier
This extends the ocean modifier to add new spectra
(Pierson-Moskowitz, Jonswap, TMA).

These models are very different to the Phillips spectrum.
They are intended for more established,
large area, oceans and/or shallow water situations.
2020-03-12 15:48:20 +11:00
Brecht Van Lommel 6cf4861c3a Cleanup: refactor image loading to use abstract ImageLoader base class
Rather than passing around void pointers, various Blender image sources now
subclass this. OIIO is also just another type of image loader.

Also fixes T67718: Cycles viewport render crash editing point density settings
2020-03-11 20:45:39 +01:00
Antonio Vazquez 6a632f11c8 GPencil: Add missing Layer buttons in Dopesheet header and remove unneeded options
Update Dopesheet header to include missing buttons, remove Scene Active only buttton and also removed duplicated search box.

The removed options come from old 2.7x version and they are not required now.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D7107
2020-03-11 16:10:47 +01:00
Brecht Van Lommel c8acb6dd6c Smoke: put density/color in separate textures, fixes for workbench shader
This is more in line with standard grids and means we don't have to make
many special exceptions in the upcoming change for arbitrary number of volume
grids support in Eevee.

The workbench shader was also changed to fix bugs where squared density was
used, and the smoke color would affect the density so that black smoke would
be invisible. This can change the look of smoke in workbench significantly.

When using the color grid when smoke has a constant color, the color grid
will no longer be premultiplied by the density. If the color is constant
we want to be able not to store a grid at all. This breaks one test for
Cycles and Eevee, but the setup in that test using a color without density
does not make sense. It suffers from artifacts since the unpremultiplied
color grid by itself will not have smooth boundaries.

Differential Revision: https://developer.blender.org/D6951
2020-03-11 14:42:46 +01:00
Bastien Montagne 68c0d77b0c Cleanup: rename 'private' to 'embedded' for sub-data IDs.
'Private' can be a rather confusing term, especially when considering
its meaning in programming languages.

So now root node trees and master collections are 'embedded' IDs
instead.
2020-03-11 12:53:10 +01:00
Campbell Barton 8b2072868d Cleanup: spelling 2020-03-11 21:39:56 +11:00
Brecht Van Lommel 796683db8e Cycles: add view layer setting to exclude volumes, like hair and surfaces 2020-03-11 11:25:57 +01:00
Campbell Barton d195deef5c Cleanup: clang-format 2020-03-11 19:23:52 +11:00
Julian Eisel e06888cf89 Cleanup: Add comment explaining DPI influence on RNA pixel-properties
Good to be explicit about the fact that we may still use the pixel
property sub-type when DPI will be applied.
See comments in https://developer.blender.org/D7077.
2020-03-10 15:19:22 +01:00
Hans Goudey d55231e5a1 UI: Clarify 3D View Grid Size Tooltip
The 3D view grid size property is a multiplier, not the size of the grid itself.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7085
2020-03-10 08:44:30 -05:00
Lucas Veber 915998111b Modifiers: Corrective Smooth modifier, new Scale parameter
When scaling the root bone of a rig to apply a global scale, the
corrective smooth modifier results in wrong deformation due to incorrect
scaling. The delta calculations are not taking into account any scale
value.

To fix it, a scale property is added to the modifier, allowing to set
manually the scale value for the deltas by simply multiplying the
vectors by this value. There is a similar implementation in Maya's Delta
Mush deformer. This property can be for example driven by the scale of
the root bone of the rig, to dynamically update when the animator scale
this bone.

Reviewed By: brecht, sybren

Differential Revision: https://developer.blender.org/D6622
2020-03-10 12:49:08 +01:00
Clément Foucault 71712d828d GPencil: Fix RNA range for uv_rotation 2020-03-10 04:47:37 +01:00
Pablo Dobarro 84b94f9e7b Sculpt: Edge Automasking
This automasking option protects the open boundary edges of the mesh from the brush deformation. This is needed to sculpt cloths and it works nicely with the cloth brush.
It has a Propagation Steps property that controls the falloff of the mask from the edge.

Limitations:
- The automask is recalculated at the beginning of each stroke, creating a little bit of lag in high poly meshes, but it is not necessary. This can be fixed in the future by caching the edge distances, increasing a little bit the complexity of the code.
- The boundary vertex detection in meshes is not ideal and it fails with triangulated geometry, but it is the same as in the smooth brush. After fixing this, we should refactor the smooth brush to use the API and let the automasking option manually control the affected vertices.
- It does not work in Multires (it needs to be implemented in the API). The smooth brush in Multires is also not making boundary vertices.
- The falloff has a visible line artifact on grid patterns. We can smooth the final automasking factors several iterations, but it will make the initialization much slower. This can also be added in the future if we decided to cache the distances.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6705
2020-03-09 21:16:02 +01:00
Adrian Newton 848a4f002d UI: add "Samples" text to audio mixing buffer size preference for clarity
Differential Revision: https://developer.blender.org/D7076
2020-03-09 20:18:11 +01:00
Adrian Newton a468368540 UI: use pixel units for tile sizes and node auto-offset margin
Differential Revision: https://developer.blender.org/D7077
2020-03-09 18:49:42 +01:00
Sebastián Barschkis 32fc22db56 Fix T72253: Mantaflow adaptive domain cuts off
The issue of T72253 was that the density threshold (RNA adapt_threshold) was considering cells as empty cells too early and thus also shrinking the domain too early. The fix for this is to use smaller threshold values for the adaptive domain. This fix gives more flexibility in the UI to do just that.
2020-03-09 17:42:38 +01:00
Adrian Newton 1276380fd2 UI: add space before px unit in Eevee properties for consistency
Differential Revision: https://developer.blender.org/D7072
2020-03-09 17:11:24 +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
Sergey Sharybin 598ab525da Cleanup: Replace ABS/SQUARE/CUBE with function calls
While it might be handy to have type-less functionality which is
similar to how C++ math is implemented it can not be easily achieved
with just preprocessor in a way which does not have side-effects on
wrong usage.

There macros where often used on a non-trivial expression, and there
was at least one usage where it was causing an actual side effect/bug
on Windows (see change around square_f(sh[index++]) in studiolight.c).

For such cases it is handy to have a function which is guaranteed to
have zero side-effects. The motivation behind actually removing the
macros is that there is already a way to do similar calculation. Also,
not having such macros is a way to guarantee that its usage is not
changed in a way which have side-effects and that it's not used as an
inspiration for cases where it should not be used.

Differential Revision: https://developer.blender.org/D7051
2020-03-09 14:47:59 +01:00
Germano Cavalcante a922a097ef Transform Snap Object: Remove depsgraph when creating context
Currently, this change does not bring functional changes.
But it is necessary to extend the use of the snap system for gizmos,
since, after a Undo, the `depsgraph` pointed by the `snap_context`
has its memory invalidated.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7013
2020-03-09 10:02:11 -03:00
Sybren A. Stüvel f881162f81 Revert "Constraints: remove special meaning of Local Space for parentless Objects."
This reverts commit 7728bfd4c4.

Although this brings back an inconsistency in the behaviour of
constraints on objects and bones, people were relying on the old
behaviour, and the new behaviour broke their files.

It is still desired to remove this inconsistency, but it will happen
more gradually.
2020-03-09 10:44:55 +01:00
Julian Eisel b2ee1770d4 Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea.
Part of https://developer.blender.org/T74432.

This is mostly a batch rename with some manual fixing. Only single word
variable names are changed, no prefixed/suffixed names.

Brecht van Lommel and Campbell Barton both gave me a green light for
this convention change.

Also ran clan clang format on affected files.
2020-03-06 17:19:23 +01:00
Julian Eisel d5572eacc5 Cleanup: Reduce context usage in UI functions
Part of https://developer.blender.org/T74429.

There's a chance that this causes some issues becaue in some cases we
change from getting the window from context to getting it from somewhere
else.
2020-03-06 16:27:13 +01:00
Sybren A. Stüvel eb522af4fe Cleanup: move Alembic, AVI, Collada, and USD to `source/blender/io`
This moves the `alembic`, `avi`, `collada`, and `usd` modules into a common
`io` directory.

This also cleans up some `#include "../../{somedir}/{somefile}.h"` by
adding `../../io/{somedir}` to `CMakeLists.txt` and then just using
`#include "{somefile}.h"`.

No functional changes.
2020-03-06 16:19:45 +01:00
Jacques Lucke c08151c6fa Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.

In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.

Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.

This patch consists of three parts:

**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.

**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)

**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.

Differential Revision: https://developer.blender.org/D7038

Reviewers: brecht
2020-03-06 12:33:04 +01:00
Philipp Oeser 9fa29fe765 Cleanup: remove MLOOPUV_EDGESEL
This was not set anywhere, code relies on MLOOPUV_VERTSEL everywhere.

BMLoopUV.select_edge was never returning True and wasnt updating uv
select state when set manually.

Afaict, there were no official Addons using this from python.

Resolves T65836

Maniphest Tasks: T65836

Differential Revision: https://developer.blender.org/D6772
2020-03-06 11:59:28 +01:00
Campbell Barton 5be0e3430d GHOST/Keymap: support for detecting repeat events
- Keymap items now have 'repeat' boolean which can be set
  to make keymap items respond to key repeat events or not.
- Support for X11 & WIN32 (not macOS currently).

This allows for the possibility to perform actions while a key is held
and finish the action upon release.

Thanks to @Severin for review and WIN32 support.
2020-03-06 17:31:28 +11:00
Campbell Barton 73ef27f156 Cleanup: keyframing return arguments
- Use 'int' for counters instead of short.
- Use 'bool' instead of a counter when only a change is being detected.
- Use typed enum for keying set flags.
- Include in comments when a negate error code may be returned.
2020-03-06 17:05:18 +11:00
Campbell Barton b15c658801 Cleanup: keyframe API naming, high level keyframe API
- Split 'verify_fcurve' into two functions:

  ED_action_fcurve_ensure which adds the f-curve if needed.
  ED_action_fcurve_find which returns NULL when not found.

  Callers of ED_action_fcurve_find had unused 'group'
  argument which has been removed.

- Rename verify_adt_action to ED_id_action_ensure

  It had an argument to add data which was always true,
  remove this instead of splitting in into a separate function.
2020-03-06 14:16:38 +11:00
Campbell Barton bba4a09b2f Cleanup: use 'BKE_' prefix for BKE_deform API calls
- Use 'BKE_object_defgroup' prefix for object functions.

- Rename 'defvert_verify_index' to 'defvert_ensure_index'
  since this adds the group if it isn't found.
2020-03-06 12:56:44 +11:00
Campbell Barton da30e9a104 Cleanup: quiet switch warnings 2020-03-06 11:52:31 +11:00
Pablo Dobarro 38d6533f21 Sculpt Face Sets
Face Sets are the new system to control the visibility state of the mesh in sculpt and paint modes. They are designed to work in modes where brushes are the primary way of interaction and they provide much more control when working with meshes with complex shapes and overlapping surfaces.

This initial commit includes:
- Sculpt Face Sets data structures and PBVH rendering.
- Face Set overlay and opacity controls.
- Sculpt Undo support.
- Remesher reprojection support. The visibility state of the mesh is also preserved when remeshing.
- Automasking and Mesh filter support.
- Mask expand operator mode to expand Face Sets (Shift + W) and flood fill areas by connectivity (press Ctrl while expanding).
- Sculpt Mode Face Sets and Visibility API.
- Sculpt Face Sets creation and visibility management operators.
- Operator to randomize the Face Sets colors.
- Draw Face Sets brush tool to create and edit the Face Sets. Drawing on the mesh creates a new Face Set. Pressing Ctrl before drawing modifies the Face Set under the brush at the beginning of the stroke.
- Updated keymap and menu to work with Face Sets from Sculpt Mode (H to toggle visibility, Alt + H to show all, Shit + H to hide).
- Pie menu on the W key with Face common Sets operations.

Know limitations:
- Multires support. The Face Sets and Visibility API needs to be implemented for Multires.

Reviewed By: jbakker, #user_interface, Severin

Differential Revision: https://developer.blender.org/D6070
2020-03-05 21:07:20 +01:00
Sebastián Barschkis cd0a6ff5c4 Fluid: Diffusion settings now optional
For optimization purposes these settings need to be enabled explicitly from now on.
2020-03-05 12:36:00 +01:00
Campbell Barton 2fb4de1f8c Cleanup: material API naming
- Use 'BKE_object_material_*', 'BKE_id_material_*' prefix
  for functions that operate on Object and ID types.
- Use '_len' suffix for length (matching BLI naming).
- Use '_p' suffix for functions that return a pointer to values
  where the value would typically be returned.

Functions renamed:

- BKE_object_material_resize      was BKE_material_resize_object
- BKE_object_material_remap       was BKE_material_remap_object
- BKE_object_material_remap_calc  was BKE_material_remap_object_calc

- BKE_object_material_array_p     was BKE_object_material_array
- BKE_object_material_len_p       was BKE_object_material_num
- BKE_id_material_array_p         was BKE_id_material_array
- BKE_id_material_len_p           was BKE_id_material_num

- BKE_id_material_resize          was BKE_material_resize_id
- BKE_id_material_append          was BKE_material_append_id
- BKE_id_material_pop             was BKE_material_pop_id
- BKE_id_material_clear           was BKE_material_clear_id
2020-03-05 08:21:31 +11:00
Campbell Barton a297a6c444 Cleanup: replace unnecessary MEM_callocN calls
Use MEM_mallocN when memory is immediately copied over.
2020-03-05 07:59:34 +11:00
Sebastián Barschkis a5c4a44df6 Fluid: Bounding boxes for effector objects
This commit adds bounding box support for emission objects - similarly to flow objects. Before, each effector object had to iterate over the entire domain. Bake times of scenes with multiple obstacles improved significantly with this optimization.

Other improvements that were implemented alongside the bbox feature:
- Option for subframe sampling for effector objects
- Option to enable / disable effectors (can be animated)
- Optimization for static objects. If a flow or effector object does not move and the adaptive domain is not in use, the bake time will be optimized further by reusing the flow / effector grids from the previous frame (no recalculation).
2020-03-04 18:46:48 +01:00