Commit Graph

467 Commits

Author SHA1 Message Date
Antonio Vazquez a5ffc6309e GPencil: Split Curve geometry functions to new file
This prepare the code for future curve editors
2020-05-06 18:14:05 +02:00
Brecht Van Lommel c54ced9f55 Build: print TBB ON/OFF state on first configure, cleanup old TBB logic 2020-05-05 14:06:08 +02:00
Sybren A. Stüvel aa72e3abf9 Cleanup: moved drivers to BKE_fcurve_driver.h / fcurve_driver.c
All the driver-specific code in `fcurve.c` has been moved into a new file
`fcurve_driver.c`. The corresponding declarations have been moved from
`BKE_fcurve.h` to `BKE_fcurve_driver.h`.

All the `#include "BKE_fcurve.h"` statements have been investigated and
replaced with `BKE_fcurve_driver.h` where necessary.

No functional changes.
2020-05-01 13:08:22 +02:00
Pablo Dobarro 134619fabb Multires: Subdivide Simple and Subdivide Linear
This introduces two alternative subdivision modes that generates
displacement on the grids that look as Simple subdivisions but while
using the Catmull-Clark subdivision type in the modifier. This way,
Simple and Catmull-Clark subdivision can be combined when creating new
levels if needed, for example, to sculpt hard surface objects.

Subdivide simple smooths the sculpted data when creating a new
subdivision level. Subdivide linear also preserves the sharpness
in the sculpted data.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7415
2020-04-30 16:57:29 +02:00
Pablo Dobarro f28875a998 Multires: Unsubdivide and Rebuild Subdivisions
This implements the main unsubdivide algorithm which rebuilds a base mesh and extracts the grid's data from a high resolution mesh.
It includes the Rebuild Subdivisions operator, which generates all subdivision levels down to the level 0 base mesh.

It supports:
- Rebuilding an arbitrary number of levels (Unsubdivide) or as many levels as possible down to level 0 in a single step (Rebuild Subdivisions).
- Rebuilding with already existing grids.
- Meshes with n-gons and triangles
- Meshes with more than 2 faces per edge
- Base mesh made completely out of triangles
- Meshes without poles
- Meshes with multiple disconnected elements at the same subdivision level

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7372
2020-04-30 16:49:56 +02:00
Brecht Van Lommel d8a3f3595a Task: Use TBB as Task Scheduler
This patch enables TBB as the default task scheduler. TBB stands for Threading Building Blocks and is developed by Intel. The library contains several threading patters. This patch maps blenders BLI_task_* function to their counterpart. After this patch we can add more patterns. A promising one is TBB:graph that can be used for depsgraph, draw manager and compositor.

Performance changes depends on the actual hardware. It was tested on different hardwares from laptops to workstations and we didn't detected any downgrade of the performance.
* Linux Xeon E5-2699 v4 got FPS boost from 12 to 17 using Spring's 04_010_A.anim.blend.
* AMD Ryzen Threadripper 2990WX 32-Core Animation playback goes from 9.5-10.5 FPS to 13.0-14.0 FPS on Agent 327 , 10_03_B.anim.blend.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D7475
2020-04-30 08:09: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 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
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
Antonio Vazquez 6e39445f80 GPencil: Cleanup - Split BKE_gpencil.h geometry functions into BKE_gpencil_geom.h
This split prepare the code for future geometry functions.
2020-03-19 11:38:22 +01:00
Brecht Van Lommel fd53b72871 Objects: Eevee and workbench rendering of new Volume, Hair, PointCloud
Only the volume drawing part is really finished and exposed to the user. Hair
plugs into the existing hair rendering code and is fairly straightforward. The
pointcloud drawing is a hack using overlays rather than Eevee and workbench.

The most tricky part for volume rendering is the case where each volume grid
has a different transform, which requires an additional matrix in the shader
and non-trivial logic in Eevee volume drawing. In the common case were all the
transforms match we don't use the additional per-grid matrix in the shader.

Ref T73201, T68981

Differential Revision: https://developer.blender.org/D6955
2020-03-18 11:23:05 +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
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
Sergey Sharybin bc0a0cdf17 Multires: Fix Subdivide, Reshape and Apply Base
This change fixes artifacts produced by these operations.

On a technical aspect this is done by porting all of the operations
to the new subdivision surface implementation which ensures that
tangent space used to evaluate modifier and those operations is
exactly the same (before modifier will use new code and the operations
will still use an old one).

The next step is to get sculpting on a non-top level to work, and
that actually requires fixes in the undo system.
2020-03-13 14:14:56 +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
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
Bastien Montagne c328049535 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
2020-03-05 10:58:58 +01:00
Sergey Sharybin 7a8a074a30 Multires: Move current reshaping/propagation logic to legacy file
It will eventually rewritten.
This commit prepares some clean space to start this process.

So far no functional changes.
2020-02-28 12:42:27 +01:00
Bastien Montagne f3a3a976b7 Refactor: move `Library`-specific functions into proper `BKE_library` file.
Even though we do not have much of those, this might change in the
future, and in any case having specific functions for this ID type in
generic `BKE_lib` area was really confusing.
2020-02-10 17:10:17 +01:00
Bastien Montagne ec6fcac628 Cleanup/Refactor: Move ID deletion into its own .c file.
Having functions defined in `BKE_lib_id.h` implemented into
`lib_remap.c` was confusing at best.

Besides trivial code splitting and header includes cleanup, had to add a
new `lib_intern.h` header for callbacks used by both remapping and
deletion code.
2020-02-10 15:56:11 +01:00
Bastien Montagne 56116bbdf4 Cleanup/refactor: Rename `BKE_library` files to `BKE_lib`.
Note that `BKE_library.h`/`library.c` were renamed to
`BKE_lib_id.h`/`lib_id.c` to avoid having a too generic name here.

Part of T72604.
2020-02-10 13:00:42 +01:00
Bastien Montagne faf08954d5 Cleanup: Rename `BKE_library_idmap` file to `BKE_main_idmap`
Part of T72604:
> Proposal: BKE_library and BKE_main API naming: prefixes conventions
2020-02-07 16:29:02 +01:00
Clément Foucault c27d30f3ea Displist: Add mikktspace tangent space generation for DL_INDEX3
This now matches the Mesh behavior. Surfaces and metaball implementation
are yet to be implemented.
2020-01-30 02:46:01 +01:00
Sergey Sharybin 517870a4a1 CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.

While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).

Top-level idea: leave it to CMake to keep track of dependency graph.

The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.

It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.

For example, this order will likely fail:

  libbf_blenfont.a libfreetype6.a libbf_blenfont.a

This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.

General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.

The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.

Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.

The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:

- Have every library prefixed as "optimized" or "debug" if
  separation is needed (non-prefixed libraries will be considered
  "generic").

- Loop through libraries passed to function and do simple parsing
  which will look for "optimized" and "debug" words and specify
  following library to corresponding category.

This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.

Tested the following configurations on Linux, macOS and Windows:

- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer

NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.

Differential Revision: https://developer.blender.org/D6642
2020-01-23 16:59:18 +01:00
Campbell Barton 2ba9572d9e Cleanup: remove unused statvis code & struct members
This code has been moved into the draw manager.
2019-12-24 22:40:07 +11:00
Campbell Barton bc92d05522 Cleanup: sort file lists 2019-12-17 10:07:44 +11:00
Sebastián Barschkis d27ccf990c Mantaflow [Part 6]: Updates in /blender/source
A collection of smaller changes that are required in the /blender/source files. A lot of them are also due to variable renaming.

Reviewed By: sergey

Maniphest Tasks: T59995

Differential Revision: https://developer.blender.org/D3855
2019-12-16 16:37:01 +01:00
Pablo Dobarro 0e4014ef92 Sculpt/Paint: Move Elastic Deform Kelvinlets to BKE
After this commit it should be possible to share the same deformation
formulas that are used in the Elastic Deform brush with other areas of
Blender such as Grease Pencil or proportional editing.

This also removes a lot of code from sculpt.c that is not direclty
related to sculpting.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6281
2019-11-27 17:08:15 +01:00
Campbell Barton bb0708a483 CMake: support building without Python
Resolve linking issues, warnings.
2019-11-25 15:45:49 +11:00
Campbell Barton b2d940250c Cleanup: remove unused CMake WITH_MOD_CLOTH_ELTOPO option 2019-11-25 14:52:44 +11:00
Campbell Barton 35f2e4a35c Cleanup: BKE_suggestions -> BKE_text_suggestions
The term suggestions on it's own is too ambiguous, use BKE_text prefix.
2019-11-22 13:32:57 +11:00
Campbell Barton 2ecb664520 Cleanup: rename mirror -> mesh_mirror
The term mirror on it's own is too ambiguous, use BKE_mesh prefix.
2019-11-22 13:15:04 +11:00
Hans Goudey ba1e9ae473 Bevel: Custom Profile and CurveProfile Widget
Custom profiles in bevel allows the profile curve to be controlled by
manually placed control points. Orientation is regularized along
groups of edges, and the 'pipe case' is updated. This commit includes
many updates to comments and changed variable names as well.

A 'cutoff' vertex mesh method is added to bevel in addition to the
existing grid fill option for replacing vertices.

The UI of the bevel modifier and tool are updated and unified.

Also, a 'CurveProfile' widget is added to BKE for defining the profile
in the interface, which may be useful in other situations.

Many thanks to Howard, my mentor for this GSoC project.

Reviewers: howardt, campbellbarton

Differential Revision: https://developer.blender.org/D5516
2019-11-20 16:25:28 -05:00
Campbell Barton 312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Brecht Van Lommel 6c302d6529 Sculpt: use TBB instead of BLI_task for multithreading
This solves performance issues on some computers where there is significant
threading overhead. Rather than doing the complicated work of optimizing our
own task scheduler, use TBB which appears to work well. The downside is that
we have another thread pool, but it is already there when using OpenVDB voxel
remesh.

For future releases we can switch to using TBB to replace our task scheduler
implementation entirely, and use the same thread pool for BLI_task, Cycles,
Mantaflow, etc.

Differential Revision: https://developer.blender.org/D6030
2019-10-10 17:36:12 +02:00
Campbell Barton 92686c667e Cleanup: structs, cmake file lists 2019-09-27 12:45:54 +10:00
Pablo Dobarro e5c9bf3aa2 Quadriflow: Symmetry support
This patch adds paint symmetry support to Quadriflow. It bisects and mirrors the input and the output from the remesher to build the final mesh using the preserve boundary option.
This is also an important performance improvement in Quadriflow because it only needs to process half of the mesh with half the resolution.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5855
2019-09-26 16:43:35 +02:00
Sergey Sharybin 65d8c771c7 Subdiv: Add deformation-only subdivision
Is intended to be used to generate an array of coordinates of coarse vertices
placed to the final subdivided position.
2019-09-19 11:51:25 +02:00
Sergey Sharybin 296c03a389 Subvid: Initial support of subdiv topology query
Just some higher level functions to access topology information.
2019-09-18 17:56:22 +02:00
Richard Antalik ab3a9dc1ed VSE: prefetching
When enabled prefetching(preview panel>view settings), a pernament running job
is created, that will render frames in the background until the cache is full.
If the cache is not filled fast enough, prefetch job suspends itself
at the last moment and will wait until it has chance to "catch up".
Effectively this will decouple rendering to separate thread, so rendering
itself is a bit faster.
Cache recycling behavior will be changed to "free furthest frame to the left
of playhead if possible, otherwise rightmost frame".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5386
2019-09-13 17:24:42 -07:00
Sebastian Parborg 57e55906f0 Add QuadriFlow remesher 2019-09-13 10:36:05 +02:00
Campbell Barton ff085e85d3 DNA: move View3D, View3DOverlay into DNA_view3d_defaults.h 2019-09-12 06:48:13 +10:00
Brecht Van Lommel 8594cdb456 Fix build error after DNA defaults changing
dna_type_offsets.h must be generated before we use it in blenkernel,
similar to what we already do for blenloader.
2019-09-09 19:09:13 +02:00
Campbell Barton f5e0dfe59c DNA: initial DNA defaults support
This provides an API to access structs
with their members set to default values:

- DNA_struct_default_get(name)
- DNA_struct_default_alloc(name)

Currently this is only used for scene & view shading initialization,
eventually it can be used for RNA defaults and initializing
DNA struct members on file reading.
2019-09-09 23:17:03 +10:00
Sergey Sharybin 322c03f13c Move callbacks API from BLI to BKE
Preparing for the bigger changes which will be related on passing
dependency graph to various callbacks which need it.

Differential Revision: https://developer.blender.org/D5725
2019-09-09 14:26:42 +02:00
Campbell Barton 655f5818a5 Cleanup: use BKE_mesh_ prefix for the remesh API
These functions deal with voxel remeshing of Mesh data,
and aren't related to MOD_remesh.c for e.g.

Name so other kinds of remeshing wont cause confusion.
2019-08-15 04:46:51 +10:00
Pablo Dobarro 45a45f7d66 OpenVDB: Voxel Remesher
The voxel remesher introduces a new workflow for sculpting without any of the limitations of Dyntopo (no geometry errors or performance penalty when blocking shapes). It is also useful for simulations and 3D printing.

This commit includes:
- Voxel remesh operator, voxel size mesh property and general remesh flags.
- Paint mask reprojection.
- Geometry undo/redo for sculpt mode. This should support remesh operations as well as future tools that modify the topology of the sculpt in a single step, like trimming tools or mesh insert brushes.
- UI changes in the sculpt topbar and the mesh properties pannel.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5407
2019-08-14 18:58:19 +02:00
Campbell Barton 07499c04f6 Preferences: don't store preferences in the startup
Simplify preferences by removing the ability to load them from
either the startup.blend or userpref.blend.

Also simplifies updating default preferences by moving
them to a struct definition.
2019-07-31 21:36:12 +10:00
Campbell Barton 2753959ed7 Cleanup: sort CMake include paths 2019-04-24 14:41:12 +10:00