blender.git
5 months agoFix T74504: Cycles wrong progress bar with CPU adaptive sampling
Brecht Van Lommel [Fri, 6 Mar 2020 22:13:03 +0000 (23:13 +0100)]
Fix T74504: Cycles wrong progress bar with CPU adaptive sampling

5 months agoFix error in Cycles Optix adaptive sampling after recent cleanup
Brecht Van Lommel [Fri, 6 Mar 2020 22:28:33 +0000 (23:28 +0100)]
Fix error in Cycles Optix adaptive sampling after recent cleanup

5 months agoCleanup: VFont: Move to IDTypeInfo and remove unused BKE API
Dalai Felinto [Fri, 6 Mar 2020 19:00:42 +0000 (20:00 +0100)]
Cleanup: VFont: Move to IDTypeInfo and remove unused BKE API

This was particularly strange because we had a _free_data() function.
But still the one I replaced was of course the _free() one.

And we should rename the _free_data_ function later to avoid confusions.

5 months agoCleanup: Text: Move to IDTypeInfo and remove unused BKE API.
Dalai Felinto [Fri, 6 Mar 2020 18:48:18 +0000 (19:48 +0100)]
Cleanup: Text: Move to IDTypeInfo and remove unused BKE API.

5 months agoAPI Docs: Point to manual for Operator Cheat Sheet
Aaron Carlisle [Fri, 6 Mar 2020 17:49:52 +0000 (12:49 -0500)]
API Docs: Point to manual for Operator Cheat Sheet

5 months agoUI: Remove Windows 3D Object Folder Reference
Harley Acheson [Fri, 6 Mar 2020 17:33:13 +0000 (09:33 -0800)]
UI: Remove Windows 3D Object Folder Reference

Remove Windows special folder FOLDERID_Objects3D. Requires newer SDK.

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

Reviewed by Brecht Van Lommel

5 months agoCleanup: tweak Freestyle #includes in preparation for clang-format sorting
Dalai Felinto [Fri, 6 Mar 2020 15:45:16 +0000 (16:45 +0100)]
Cleanup: tweak Freestyle #includes in preparation for clang-format sorting

5 months agoCleanup: Fix forward declaration of headers
Dalai Felinto [Fri, 6 Mar 2020 15:45:06 +0000 (16:45 +0100)]
Cleanup: Fix forward declaration of headers

5 months agoCleanup: Rename ARegion variables from ar to region
Julian Eisel [Fri, 6 Mar 2020 15:56:42 +0000 (16:56 +0100)]
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.

5 months agoCleanup: Image: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 16:11:55 +0000 (17:11 +0100)]
Cleanup: Image: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: Texture: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 15:52:42 +0000 (16:52 +0100)]
Cleanup: Texture: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: Material: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 15:38:04 +0000 (16:38 +0100)]
Cleanup: Material: Move to IDTypeInfo and remove unused BKE API.

5 months agoFix build error on windows
Germano Cavalcante [Fri, 6 Mar 2020 15:49:15 +0000 (12:49 -0300)]
Fix build error on windows

```
Error C4013 '_VA_ELEM1' undefined; assuming extern returning int
```

5 months agoCleanup: Action: Move to IDTypeInfo, and remove unused BKE API.
Dalai Felinto [Fri, 6 Mar 2020 15:35:23 +0000 (16:35 +0100)]
Cleanup: Action: Move to IDTypeInfo, and remove unused BKE API.

5 months agoCleanup: Armature: Move to IDTypeInfo, and remove unused BKE API.
Dalai Felinto [Fri, 6 Mar 2020 15:03:00 +0000 (16:03 +0100)]
Cleanup: Armature: Move to IDTypeInfo, and remove unused BKE API.

5 months agoBring back code accidentally removed by previous commit
Julian Eisel [Fri, 6 Mar 2020 15:38:58 +0000 (16:38 +0100)]
Bring back code accidentally removed by previous commit

Probably got lost when resolving merge conflicts.

5 months agoCleanup: Reduce context usage in UI functions
Julian Eisel [Fri, 6 Mar 2020 15:22:28 +0000 (16:22 +0100)]
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.

5 months agoCleanup: Lattice: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 15:22:49 +0000 (16:22 +0100)]
Cleanup: Lattice: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: MetaBall: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 15:08:24 +0000 (16:08 +0100)]
Cleanup: MetaBall: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: Curve: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 14:51:31 +0000 (15:51 +0100)]
Cleanup: Curve: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: Mesh: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 14:38:52 +0000 (15:38 +0100)]
Cleanup: Mesh: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: move Alembic, AVI, Collada, and USD to `source/blender/io`
Sybren A. Stüvel [Fri, 6 Mar 2020 15:19:35 +0000 (16:19 +0100)]
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.

5 months agoDepsgraph: remove unused no-op nodes after building
Sybren A. Stüvel [Fri, 6 Mar 2020 14:25:37 +0000 (15:25 +0100)]
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

5 months agoCleanup: Move Multiplane Scrape brush to its own file
Pablo Dobarro [Fri, 6 Mar 2020 15:00:33 +0000 (16:00 +0100)]
Cleanup: Move Multiplane Scrape brush to its own file

5 months agoFix narrowing from int to short when removing material slot
Sergey Sharybin [Fri, 6 Mar 2020 14:56:09 +0000 (15:56 +0100)]
Fix narrowing from int to short when removing material slot

5 months agoSculpt: Cleanup, remove macro re-definition
Sergey Sharybin [Fri, 6 Mar 2020 14:52:36 +0000 (15:52 +0100)]
Sculpt: Cleanup, remove macro re-definition

5 months agoFix integer overflow in BLI_mempool_as_arrayN()
Sergey Sharybin [Fri, 6 Mar 2020 14:33:47 +0000 (15:33 +0100)]
Fix integer overflow in BLI_mempool_as_arrayN()

`(size_t)(int * int)` will actually cast overflown integer to size_t,
which isn't what was intended here. Correct thing would be to cast
in the following manner `(size_t)int * int`.

In this particular case can as well use function which is designed to
allocate an array of memory without overflow.

5 months agoCycles: cleanup warning
Dalai Felinto [Fri, 6 Mar 2020 14:26:54 +0000 (15:26 +0100)]
Cycles: cleanup warning

5 months agoCleanup: Collection: Move to IDTypeInfo, and remove unused BKE API.
Dalai Felinto [Fri, 6 Mar 2020 14:17:47 +0000 (15:17 +0100)]
Cleanup: Collection: Move to IDTypeInfo, and remove unused BKE API.

Note: we still need BKE_collection_free since we call it from scene.c.

5 months agoCleanup: Use the SCULPT_ prefix in all sculpt_intern functions
Pablo Dobarro [Fri, 6 Mar 2020 14:24:15 +0000 (15:24 +0100)]
Cleanup: Use the SCULPT_ prefix in all sculpt_intern functions

5 months agoCleanup: bScreen: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 14:19:32 +0000 (15:19 +0100)]
Cleanup: bScreen: Move to IDTypeInfo and remove unused BKE API.

5 months agoCleanup: use ELEM macro for path slash checks
Campbell Barton [Fri, 6 Mar 2020 13:58:48 +0000 (00:58 +1100)]
Cleanup: use ELEM macro for path slash checks

5 months agoFluid: Revert bc2ce31d7940 (changes to open boundaries)
Sebastián Barschkis [Fri, 6 Mar 2020 14:01:19 +0000 (15:01 +0100)]
Fluid: Revert bc2ce31d7940 (changes to open boundaries)

Changes from that commit turned out to be unstable.

5 months agoFix T73842: UI: add cloth collision settings to Hair Dynamics panel
Philipp Oeser [Wed, 4 Mar 2020 16:31:36 +0000 (17:31 +0100)]
Fix T73842: UI: add cloth collision settings to Hair Dynamics panel

Since hair collisions were integrated with the cloth solver
(rBd42a7bbd6ea5), there are a couple of relevant settings which were not
exposed to the User:
- Collision Quality
- Minimum Distance (this was reported in T73842, default of 0.015m was
still limiting in certain scenarios - this can now be made smaller)
- Impulse clamping
- Collision collection

This will add a 'Collisions' panel to Hair Dynamics with those settings

Note: in contrast to 'real' cloth, self-collisions are not supported for
hair

Maniphest Tasks: T73842

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

5 months agoCleanup: bNodeTree: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 13:57:26 +0000 (14:57 +0100)]
Cleanup: bNodeTree: Move to IDTypeInfo and remove unused BKE API.

5 months agoImprove modifier error message with sculpt mode
Philipp Oeser [Fri, 6 Mar 2020 13:15:38 +0000 (14:15 +0100)]
Improve modifier error message with sculpt mode

Make it obvious that this relates to being in sculpt mode.

ref T74489

Maniphest Tasks: T74489

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

5 months agoCleanup: tweak Cycles #includes in preparation for clang-format sorting
Brecht Van Lommel [Fri, 6 Mar 2020 13:15:21 +0000 (14:15 +0100)]
Cleanup: tweak Cycles #includes in preparation for clang-format sorting

5 months agoCleanup: avoid use of BLI_cleanup_dir
Campbell Barton [Fri, 6 Mar 2020 13:35:55 +0000 (00:35 +1100)]
Cleanup: avoid use of BLI_cleanup_dir

Some cases don't need to add the trailing slash.
Use BLI_cleanup_path in this case.

5 months agoDocumentation: added bpy.msgbus description and examples
Sybren A. Stüvel [Fri, 6 Mar 2020 13:28:54 +0000 (14:28 +0100)]
Documentation: added bpy.msgbus description and examples

The `bpy.msgbus` namespace was not included in the documentation generation.
I've added it, and ported Campbell's examples from P563.

5 months agoCleanup: Message bus, removed incorrect return type from docstring
Sybren A. Stüvel [Fri, 6 Mar 2020 13:27:47 +0000 (14:27 +0100)]
Cleanup: Message bus, removed incorrect return type from docstring

The docstring was likely copy-pasted, and the return type was not adjusted.
Since the `bpy.msgbus.subscribe_rna()` returns nothing, I just removed the
return type documentation.

5 months agoCleanup: remove BLI_cleanup_file
Campbell Barton [Fri, 6 Mar 2020 13:13:03 +0000 (00:13 +1100)]
Cleanup: remove BLI_cleanup_file

In practice, references to files rarely have trailing slashes
(by accident). Remove this function in favor of BLI_cleanup_path.

5 months agoCleanup: spelling
Campbell Barton [Fri, 6 Mar 2020 13:05:27 +0000 (00:05 +1100)]
Cleanup: spelling

5 months agoFix using wrong property name for preserve face sets when remeshing
Pablo Dobarro [Fri, 6 Mar 2020 13:17:30 +0000 (14:17 +0100)]
Fix using wrong property name for preserve face sets when remeshing

Spotted by Roel Koster in the initial face set commit.

5 months agoNodes: fix writing socket default values to file
Jacques Lucke [Fri, 6 Mar 2020 12:29:58 +0000 (13:29 +0100)]
Nodes: fix writing socket default values to file

Previously, `writedata` was used to store `bNodeSocket->default_value`.
There are a couple of issues with that:
* Breaks if someone tries to load the file on a big endian system (afaik).
* There is a `/* do not use for structs */` comment on `writedata`.
* Depends on `MEM_allocN_len` which should be avoided in my opinion.
* Now it is more apparent, that this should be handled by callbacks as well.

The part in `readfile.c` should work just fine still. I could also do a case
distinction there, but the code would be the same for every case for now.
Just `sock->default_value = newdataadr(fd, sock->default_value);`.

This might change, if we want to store more complex socket type specific data
that does not fit into a single struct.

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

Reviewers: brecht

5 months agoCodeCleanup: Added View3DShading enums
Jeroen Bakker [Fri, 6 Mar 2020 11:59:09 +0000 (12:59 +0100)]
CodeCleanup: Added View3DShading enums

Added the core enums that workbench draw engine uses.

5 months agoCleanup: Brush: Move to IDTypeInfo, and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 11:47:26 +0000 (12:47 +0100)]
Cleanup: Brush:  Move to IDTypeInfo, and remove unused BKE API.

5 months agoCleanup: ShapeKey: Move to IDTypeInfo and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 11:16:56 +0000 (12:16 +0100)]
Cleanup: ShapeKey: Move to IDTypeInfo and remove unused BKE API.

5 months agoNodes: Support storing socket link limits in bNodeSocketType
Jacques Lucke [Fri, 6 Mar 2020 11:20:05 +0000 (12:20 +0100)]
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

5 months agoCodeCleanup: move include statements before extern "C"
Jeroen Bakker [Fri, 6 Mar 2020 11:31:38 +0000 (12:31 +0100)]
CodeCleanup: move include statements before extern "C"

Mistake on recent changes that would fail when used in CPP.

5 months agoFix memory leak in the colorio fallback implementation.
Sebastian Parborg [Fri, 6 Mar 2020 11:26:47 +0000 (12:26 +0100)]
Fix memory leak in the colorio fallback implementation.

We would previously not store the transforms that were added to the
group transform node. This would lead to pointer to allocated memory
being lost and not freed.

5 months agoFluid: Added missing UI options for effector objects
Sebastián Barschkis [Fri, 6 Mar 2020 11:26:22 +0000 (12:26 +0100)]
Fluid: Added missing UI options for effector objects

UI was missing some of the new functionality introduced in a5c4a44df67e.

5 months agoCodeCleanup: Use eDrawType
Jeroen Bakker [Fri, 6 Mar 2020 11:21:39 +0000 (12:21 +0100)]
CodeCleanup: Use eDrawType

This patch will make use of the eDrawType where it was used as a
variable or parameter name. The eObjectDrawType was renamed to eDrawType
as it is also used by `View3DShading.type`.

5 months agoCleanup: move camera, lights, world to IDTypeInfo
Brecht Van Lommel [Fri, 6 Mar 2020 10:51:17 +0000 (11:51 +0100)]
Cleanup: move camera, lights, world to IDTypeInfo

5 months agoCodeCleanup: Added enums to opengl render functions
Jeroen Bakker [Fri, 6 Mar 2020 11:08:03 +0000 (12:08 +0100)]
CodeCleanup: Added enums to opengl render functions

Motivation the functions get 3 different kind of flag parameters (ImBuf,
DrawType, OffscreenRendering) the naming of the flags were not clear,
leading to mistakes and unnecessary time spend debugging.

5 months agoCleanup: remove MLOOPUV_EDGESEL
Philipp Oeser [Fri, 7 Feb 2020 10:31:20 +0000 (11:31 +0100)]
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

5 months agoAttempt to fix build errors on macOS
Julian Eisel [Fri, 6 Mar 2020 10:43:13 +0000 (11:43 +0100)]
Attempt to fix build errors on macOS

Mistake in 5be0e3430d13

5 months agoAnimation: improved error handling when adding/deleting keyframes
Sybren A. Stüvel [Fri, 6 Mar 2020 10:36:37 +0000 (11:36 +0100)]
Animation: improved error handling when adding/deleting keyframes

There are two ways in which adding/deleting keyframes can fail, but only
one of those was handled. The other would be shown as a successful
add/delete of -2 keyframes.

5 months agoCleanup: Animation, renamed and clarified 'success' variable
Sybren A. Stüvel [Fri, 6 Mar 2020 10:32:38 +0000 (11:32 +0100)]
Cleanup: Animation, renamed and clarified 'success' variable

The `ANIM_apply_keyingset()` returns a value that indicates the number of
changed channels (if nonnegative) or an error state (negative). In the
places where the return value was actually used, this value was stored in
a badly named variable.

5 months agoCleanup: Library: Move to IDTypeInfo, and remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 10:27:29 +0000 (11:27 +0100)]
Cleanup: Library: Move to IDTypeInfo, and remove unused BKE API.

5 months agoCleanup: Object: remove unused BKE API.
Bastien Montagne [Fri, 6 Mar 2020 10:18:14 +0000 (11:18 +0100)]
Cleanup: Object: remove unused BKE API.

5 months agoCleanup: Scene: New IDTypeInfo, and remove unused API from BKE.
Bastien Montagne [Fri, 6 Mar 2020 10:10:10 +0000 (11:10 +0100)]
Cleanup: Scene: New IDTypeInfo, and remove unused API from BKE.

5 months agoFix T73254: Drivers with the object.dimension variable are not updated
Sybren A. Stüvel [Thu, 5 Mar 2020 16:37:30 +0000 (17:37 +0100)]
Fix T73254: Drivers with the object.dimension variable are not updated

This fixes an issue where drivers using `object.dimension` only add a dependency on `GEOMETRY` to the depsgraph, whereas they should also depend on `TRANSFORM`.

This patch adds a new no-op operation that depends on the geometry and transform components to the Parameters component.

An alternative implementation would be to have `RNANodeQuery::construct_node_identifier` return multiple node identifiers. However, this would spread throughout the depsgraph code and unnecessarily force many other functions to either return or handle multiple nodes where in 99.999% of the time a single node would suffice.

The new `DIMENSIONS` node is added for each object. An upcoming patch will go over all no-op operation nodes and remove them from the depsgraph. Since this is a more dangerous operation, it'll be reviewed separately.

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

5 months agoFluid: Cleanup naming for emmission bounding box
Sebastián Barschkis [Fri, 6 Mar 2020 10:03:21 +0000 (11:03 +0100)]
Fluid: Cleanup naming for emmission bounding box

Since the bounding boxes are now also being used for effector objects, there needs to be a better name for them. Instead of calling them EmissionMap, which caters only to emission objects, they will now be called FluidObjectBB.

5 months agoKeymap: ignore repeat events for transform actions
Campbell Barton [Fri, 6 Mar 2020 07:12:56 +0000 (18:12 +1100)]
Keymap: ignore repeat events for transform actions

Resolves T54297

5 months agoCodeCleanup: eevee_materials Use Struct Assignments
Jeroen Bakker [Fri, 6 Mar 2020 09:28:02 +0000 (10:28 +0100)]
CodeCleanup: eevee_materials Use Struct Assignments

5 months agoCleanup: typo in function name
Philipp Oeser [Fri, 6 Mar 2020 08:47:27 +0000 (09:47 +0100)]
Cleanup: typo in function name

contect -> context

5 months agoGHOST/Keymap: support for detecting repeat events
Campbell Barton [Fri, 6 Mar 2020 06:24:12 +0000 (17:24 +1100)]
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.

5 months agoCleanup: keyframing return arguments
Campbell Barton [Fri, 6 Mar 2020 05:45:56 +0000 (16:45 +1100)]
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.

5 months agoCleanup: remove unused 'eInsertKeyFlags' from delete API call
Campbell Barton [Fri, 6 Mar 2020 04:07:57 +0000 (15:07 +1100)]
Cleanup: remove unused 'eInsertKeyFlags' from delete API call

There is no need for an insertion flag in a delete function.

5 months agoCleanup: keyframe API naming, high level keyframe API
Campbell Barton [Fri, 6 Mar 2020 02:41:27 +0000 (13:41 +1100)]
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.

5 months agoCleanup: rename 'verify' to 'ensure' for BKE_image_viewer functions
Campbell Barton [Fri, 6 Mar 2020 02:02:59 +0000 (13:02 +1100)]
Cleanup: rename 'verify' to 'ensure' for BKE_image_viewer functions

5 months agoCleanup: rename 'verify' to 'ensure' for argument name
Campbell Barton [Fri, 6 Mar 2020 02:00:01 +0000 (13:00 +1100)]
Cleanup: rename 'verify' to 'ensure' for argument name

5 months agoCleanup: use 'BKE_' prefix for BKE_deform API calls
Campbell Barton [Fri, 6 Mar 2020 01:50:56 +0000 (12:50 +1100)]
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.

5 months agoCleanup: use 'r_' prefix for return arguments
Campbell Barton [Fri, 6 Mar 2020 01:49:00 +0000 (12:49 +1100)]
Cleanup: use 'r_' prefix for return arguments

Also avoid a redundant strlen call.

5 months agoCleanup: use BLI_strnlen instead of strlen
Campbell Barton [Fri, 6 Mar 2020 01:43:58 +0000 (12:43 +1100)]
Cleanup: use BLI_strnlen instead of strlen

5 months agoCleanup: clang-format
Campbell Barton [Fri, 6 Mar 2020 01:39:00 +0000 (12:39 +1100)]
Cleanup: clang-format

5 months agoCleanup: use MEM_recallocN_id
Campbell Barton [Fri, 6 Mar 2020 01:00:37 +0000 (12:00 +1100)]
Cleanup: use MEM_recallocN_id

5 months agoCleanup: spelling
Campbell Barton [Fri, 6 Mar 2020 00:40:37 +0000 (11:40 +1100)]
Cleanup: spelling

5 months agoCleanup: add decimal values for event types, order by value
Campbell Barton [Fri, 6 Mar 2020 00:14:50 +0000 (11:14 +1100)]
Cleanup: add decimal values for event types, order by value

5 months agoCleanup: quiet switch warnings
Campbell Barton [Fri, 6 Mar 2020 00:52:14 +0000 (11:52 +1100)]
Cleanup: quiet switch warnings

5 months agoCleanup: redundant-decls warning
Campbell Barton [Fri, 6 Mar 2020 00:14:21 +0000 (11:14 +1100)]
Cleanup: redundant-decls warning

5 months agoUI: Using Consistent Font Icon in File Browser
Harley Acheson [Thu, 5 Mar 2020 21:23:28 +0000 (13:23 -0800)]
UI: Using Consistent Font Icon in File Browser

Use only one font icon in File Browser for all platforms. Correct mistake to allow this icon to be used.

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

Reviewed by Brecht Van Lommel

5 months agoSculpt Face Sets
Pablo Dobarro [Thu, 5 Mar 2020 13:53:23 +0000 (14:53 +0100)]
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

5 months agoUI: File Browser Favorites
Harley Acheson [Thu, 5 Mar 2020 19:49:56 +0000 (11:49 -0800)]
UI: File Browser Favorites

Adding more Windows special folder locations, used when browsing or bookmarking.

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

Reviewed by Brecht Van Lommel

5 months agoUI: Mac File Browser System List Changes
Yevgeny Makarov [Thu, 5 Mar 2020 18:38:55 +0000 (10:38 -0800)]
UI: Mac File Browser System List Changes

Nicer icons for File Browser System and Favorites lists on Mac.

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

Reviewed by Brecht Van Lommel

5 months agoGhost: Support drawing OpenGL framebuffers into a DirectX 11 buffer
Julian Eisel [Thu, 5 Mar 2020 17:29:29 +0000 (18:29 +0100)]
Ghost: Support drawing OpenGL framebuffers into a DirectX 11 buffer

Adds a minimal DirectX 11 Ghost context, plus some shared DirectX-OpenGL
resource interface using the NV_DX_interop2 WGL extension. From what I
know, this should be available on modern GPUs. If not, it should fail
gracefully.
There should be no user visible changes at this point.

Needed for DirectX-only OpenXR platforms (e.g. Windows Mixed Reality). I
heard there are other use-cases as well though.

It's known that this currently fails on some AMD systems, but that seems
to be fixable.

Most of this comes from the 2019 GSoC project, "Core Support of Virtual
Reality Headsets through OpenXR"
(https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).

Reviewed by: Jeroen Bakker, Ray Molenkam, Brecht van Lommel

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

5 months agoFluid: Optimization in mesh generating loop
Sebastián Barschkis [Thu, 5 Mar 2020 16:51:08 +0000 (17:51 +0100)]
Fluid: Optimization in mesh generating loop

No need to have three separate loops for vertices, normals and speed vectors. Since all of them loop over the vertex count, a single loop can be used.

5 months agoCleanup: Move std::deque to depsgraph_type.h
Sybren A. Stüvel [Thu, 5 Mar 2020 16:31:40 +0000 (17:31 +0100)]
Cleanup: Move std::deque to depsgraph_type.h

Since `std::deque` is used in a few areas of the Depsgraph, and an
upcoming patch adds one more, it's time it's considered as "commonly
used type".

No functional changes.

5 months agoAdd an session-wise uuid integer to IDs.
Bastien Montagne [Thu, 5 Mar 2020 15:17:14 +0000 (16:17 +0100)]
Add an session-wise uuid integer to IDs.

"session-wise" here mean while editing a same .blend file. So creating
or opening a new one will reset the uuid counter. This should avoid any
overflow in practice.

Only IDs added to Main database get an uuid, runtime-only ones are not
affected.

This is intended to provide undo with a way to find IDs across several
'memory realms' (undo speedup project).

No behavior change is expected from this commit itself.

Part of T60695.

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

5 months agoFix T74393: Cycles crashes when both OSL and Optix Denoising are enabled
Patrick Mours [Thu, 5 Mar 2020 15:28:31 +0000 (16:28 +0100)]
Fix T74393: Cycles crashes when both OSL and Optix Denoising are enabled

Enabling viewport denoising causes Cycles to use a multi-device, which always returned NULL when
asked for OSL memory and would subsequently crash. This fixes that by returning the correct OSL
memory pointer from the CPU device in the special viewport denoising multi-device.

5 months agoFix T74332: selection sync replacing parent selection
Nathan Craddock [Thu, 5 Mar 2020 06:01:23 +0000 (23:01 -0700)]
Fix T74332: selection sync replacing parent selection

Selecting certain child datablocks also selects the parent (e.g.
selecting a pose bone selects the armature). The base was selected, but
the outliner tree element was left unselected. The subsequent selection
sync would then deselect the parent base because it was not flagged as
selected in the outliner.

This led to issues like T74332 where selecting a pose bone in the
outliner did not show drivers in the driver editor unless the armature
was explicitly added to the selection afterwards.

The solution is to also flag the outliner elements as selected when
selecting parent bases.

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

5 months agoFluid: Fix initial velocities for new static emission mode
Sebastián Barschkis [Thu, 5 Mar 2020 13:58:15 +0000 (14:58 +0100)]
Fluid: Fix initial velocities for new static emission mode

For now, disabling static mode whenever initial velocities are being used.

5 months agoFluid: More optimizations in smoke / liquid scripts
Sebastián Barschkis [Thu, 5 Mar 2020 13:22:51 +0000 (14:22 +0100)]
Fluid: More optimizations in smoke / liquid scripts

Reduced extrapolation distances, no need to extrapolate that far.

5 months agoFluid: Diffusion settings now optional
Sebastián Barschkis [Thu, 5 Mar 2020 11:35:50 +0000 (12:35 +0100)]
Fluid: Diffusion settings now optional

For optimization purposes these settings need to be enabled explicitly from now on.

5 months agoEEVEE: Render Passes Blending
Jeroen Bakker [Thu, 5 Mar 2020 11:20:58 +0000 (12:20 +0100)]
EEVEE: Render Passes Blending

Changed the blending mode to full blending. I found the issue when
during development of a material pass containing alpha values.

5 months agoAdaptive Sampling for Cycles.
Stefan Werner [Thu, 5 Mar 2020 11:05:42 +0000 (12:05 +0100)]
Adaptive Sampling for Cycles.

This feature takes some inspiration from
"RenderMan: An Advanced Path Tracing Architecture for Movie Rendering" and
"A Hierarchical Automatic Stopping Condition for Monte Carlo Global Illumination"

The basic principle is as follows:
While samples are being added to a pixel, the adaptive sampler writes half
of the samples to a separate buffer. This gives it two separate estimates
of the same pixel, and by comparing their difference it estimates convergence.
Once convergence drops below a given threshold, the pixel is considered done.

When a pixel has not converged yet and needs more samples than the minimum,
its immediate neighbors are also set to take more samples. This is done in order
to more reliably detect sharp features such as caustics. A 3x3 box filter that
is run periodically over the tile buffer is used for that purpose.

After a tile has finished rendering, the values of all passes are scaled as if
they were rendered with the full number of samples. This way, any code operating
on these buffers, for example the denoiser, does not need to be changed for
per-pixel sample counts.

Reviewed By: brecht, #cycles

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

5 months agoFix T74446: Liquid Inflow Does Not Work
Sebastián Barschkis [Thu, 5 Mar 2020 10:40:59 +0000 (11:40 +0100)]
Fix T74446: Liquid Inflow Does Not Work

Somehow this was forgotton in the optimization patch a5c4a44df67e.

5 months agoInitial step for IDTypeInfo refactor 'cleanup' project.
Bastien Montagne [Thu, 5 Mar 2020 09:54:00 +0000 (10:54 +0100)]
Initial step for IDTypeInfo refactor 'cleanup' project.

Introduce new IDTypeInfo structure.

Each ID type will have its own, with some minimal basic common info,
and ID management callbacks.

This patch only does it for Object type, for demo/testing purpose.
Moving all existing IDs is a goal of next "cleanup Friday".

Note that BKE_idcode features should then be merged back into BKE_idtype -
but this will have to be done later, once all ID types have been properly
converted to the new system.

Another later TODO might be to try and add callbacks for file read/write,
and lib_query ID usages looper.

This is part of T73719.

Thanks to @brecht for initial idea, and reviewing the patch.

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

5 months agoCleanup: Clarified comment
Sybren A. Stüvel [Thu, 5 Mar 2020 09:46:52 +0000 (10:46 +0100)]
Cleanup: Clarified comment

No functional changes.

5 months agoFix T74431: EEVEE AO Render Pass
Jeroen Bakker [Thu, 5 Mar 2020 07:58:00 +0000 (08:58 +0100)]
Fix T74431: EEVEE AO Render Pass

Missing code-path in recent refactoring.