Commit Graph

1087 Commits

Author SHA1 Message Date
Jacques Lucke 725973485a Clang Tidy: enable readability-non-const-parameter warning
Clang Tidy reported a couple of false positives. I disabled
those `NOLINTNEXTLINE`.

Differential Revision: https://developer.blender.org/D8199
2020-07-13 11:27:09 +02:00
Sergey Sharybin 9739fc4d1b Clang-Tidy: More fixed of redundant check before delete
For some reason got unnoticed in the original cleanup pass.
2020-07-03 16:47:59 +02:00
Hans Goudey 19ff145e66 Clang-Tidy: Enable readability-redundant-control-flow 2020-07-03 09:41:55 -04:00
Jacques Lucke 2633683b52 Clang-tidy: enable readability-container-size-empty warning
Reviewers: sergey

Differential Revision: https://developer.blender.org/D8197
2020-07-03 14:59:27 +02:00
Campbell Barton 4b96f47831 Docs: correct invalid doxygen params & references 2020-06-27 15:43:20 +10:00
Sergey Sharybin 16d09a5864 Fix T67358: Compositor Disabled Node Config -> SegFault
The issue was caused by wrong conversion happening after some of the
proxies are removed. Easiest solution is to first remove proxies and
then add required converter operations.

Thanks Jeroen for the review!
2020-06-19 14:49:36 +02:00
Sergey Sharybin 665acd2903 Fix T69497: Color Correction node ignores mask in certain cases
Happens when some of the color correction terms are mathematically
undefined: foe example, when pow() is to be calculated and the X
argument is negative.

There is no ground-truth result in such cases, so ignore such terms
entirely.

This is a generalization of D6696 from Jacques.

Differential Revision: https://developer.blender.org/D7966
2020-06-11 11:02:33 +02:00
Brecht Van Lommel 120e9924c1 Cleanup: remove legacy mmap memory allocation for 32 bit
This helped to go beyond the 4GB limit, but is no longer relevant for 64 bit.
2020-05-20 00:57:41 +02:00
Campbell Barton d06384aa41 Cleanup: spelling 2020-05-09 17:19:28 +10:00
Jacques Lucke 6f985574b7 Cleanup: take includes out of 'extern "C"' blocks
Surrounding includes with an 'extern "C"' block is not necessary anymore.
Also that made it harder to add any C++ code to some headers, or include headers
that have "optional" C++ code like `MEM_guardedalloc.h`.

I tested compilation on linux and windows (and got help from @LazyDodo).
If this still breaks compilation due to some linker error, the header containing
the symbol in question is probably missing an 'extern "C"' block.

Differential Revision: https://developer.blender.org/D7653
2020-05-08 18:22:41 +02:00
Aaron Carlisle 34792f5e81 Cleanup: Doxygen: Remove Blank Page 2020-05-07 23:43:19 -04:00
Sergey Sharybin 3135791395 Tracking: Specify image image for (un)distortion model
Allows to support distortion models which needs to know actual
image dimensions to apply or inverse camera intrinsics.
2020-04-20 16:26:31 +02:00
Campbell Barton 19352bca16 Cleanup: spelling 2020-04-05 22:22:21 +10:00
Germano Cavalcante e1b2ded7b2 Fix build WITH_CXX_GUARDEDALLOC 2020-03-19 14:42:04 -03:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +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
Dalai Felinto 96e2bd8493 Cleanup: Fix forward declaration of headers 2020-03-06 17:26:32 +01:00
Campbell Barton 07d13be678 Cleanup: rename 'verify' to 'ensure' for BKE_image_viewer functions 2020-03-06 13:06:21 +11:00
Campbell Barton 38ed95fe8d Cleanup: replace CLAMP macros with functions 2020-03-04 11:31:51 +11:00
Campbell Barton a5c984a57d Cleanup: cmake indentation 2020-03-04 11:02:35 +11:00
Jacques Lucke d7429e76b8 Merge branch 'blender-v2.82-release' 2020-02-06 10:25:16 +01:00
Jacques Lucke 10705807fe Fix T68076: Color Correction node generates NaN
This is the same fix that the `GammaOperation` uses.

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

Reviewers: brecht
2020-02-06 10:19:51 +01:00
Brecht Van Lommel 1107af1abb Fix OBJECT_GUARDED_FREE compiler error when type is in namespace 2020-01-27 12:22: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
mano-wii 9b3c9ab61a Fix T53178: Casting in Blur node with Relative
In this case the user expects rounding.
2020-01-16 23:32:45 -03:00
Campbell Barton bcd38b398c Cleanup: remove contributors, license begin/end & doxy file argument
This had already been removed for all source files,
recent patches re-introduced them.
2019-12-17 09:27:01 +11:00
Lukas Stockner c30d6571bb Add support for tiled images and the UDIM naming scheme
This patch contains the work that I did during my week at the Code Quest - adding support for tiled images to Blender.

With this patch, images now contain a list of tiles. By default, this just contains one tile, but if the source type is set to Tiled, the user can add additional tiles. When acquiring an ImBuf, the tile to be loaded is specified in the ImageUser.
Therefore, code that is not yet aware of tiles will just access the default tile as usual.

The filenames of the additional tiles are derived from the original filename according to the UDIM naming scheme - the filename contains an index that is calculated as (1001 + 10*<y coordinate of the tile> + <x coordinate of the tile>), where the x coordinate never goes above 9.
Internally, the various tiles are stored in a cache just like sequences. When acquired for the first time, the code will try to load the corresponding file from disk. Alternatively, a new operator can be used to initialize the tile similar to the New Image operator.

The following features are supported so far:
- Automatic detection and loading of all tiles when opening the first tile (1001)
- Saving all tiles
- Adding and removing tiles
- Filling tiles with generated images
- Drawing all tiles in the Image Editor
- Viewing a tiled grid even if no image is selected
- Rendering tiled images in Eevee
- Rendering tiled images in Cycles (in SVM mode)
- Automatically skipping loading of unused tiles in Cycles
- 2D texture painting (also across tiles)
- 3D texture painting (also across tiles, only limitation: individual faces can not cross tile borders)
- Assigning custom labels to individual tiles (drawn in the Image Editor instead of the ID)
- Different resolutions between tiles

There still are some missing features that will be added later (see T72390):
- Workbench engine support
- Packing/Unpacking support
- Baking support
- Cycles OSL support
- many other Blender features that rely on images

Thanks to Brecht for the review and to all who tested the intermediate versions!

Differential Revision: https://developer.blender.org/D3509
2019-12-12 18:40:37 +01:00
Sergey Sharybin 312b6fd713 Cleanup: Redundant variable assignment to self
Was triggering strict compiler warning.
2019-12-09 14:56:53 +01:00
Charlie Jolly 0406eb1103 Maths Node: Additional functions
When creating shaders and using maths functions it is expected that Blender should match functions in other DCC applications, game engines and shading languages such as GLSL and OSL.

This patch adds missing functions to the Blender maths node.

Ideally, it would be nice to have these functions available to vectors too but that is not part of this patch.

This patch adds the following functions trunc, snap, wrap, compare, pingpong, sign, radians, degrees, cosh, sinh, tanh, exp, smoothmin and inversesqrt.

Sign function is based on GLSL and OSL functions and returns zero when x == 0.

Differential Revision: https://developer.blender.org/D5957
2019-12-07 12:33:07 +00:00
Campbell Barton 249f4423ee Cleanup: doxygen comments
Also correct some outdated symbol references,
add missing 'name' commands.
2019-11-25 01:51:11 +11:00
Jeroen Bakker bcac0ed977 Fix T70913: OpenCL Compiler Errors
Reverting part of a clean up that was done 6 months ago. The
consequence was that OpenCL compositing wasn't working since
then.
2019-10-29 09:40:29 +01:00
Campbell Barton 312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Brecht Van Lommel 86042b7ced Build: add WITH_TBB option, in preparation of sculpt using it
It should no longer be tied to OpenVDB and OpenImageDenoise then.

Differential Revision: https://developer.blender.org/D6029
2019-10-10 17:35:35 +02:00
Campbell Barton f795bdbf21 Cleanup: use header guards 2019-09-13 21:12:43 +10:00
Campbell Barton a22c2ceb0f Cleanup: line breaks with comments 2019-09-12 18:59:44 +10:00
Campbell Barton fd05f01be6 Partially revert "Cleanup: use post increment/decrement"
This partially reverts commit 0b2d1badec

Post increment can deep-copy for C++ iterators, while in my own checks
GCC was able to optimize this to get the same output,
better follow C++ best practice and use pre-increment for iterators.
2019-09-08 04:08:10 +10:00
Campbell Barton 0b2d1badec Cleanup: use post increment/decrement
When the result isn't used, prefer post increment/decrement
(already used nearly everywhere in Blender).
2019-09-08 00:23:25 +10:00
Ray Molenkamp 2a2fd75ef9 Cleanup: Fix build error with MSVC
`BLI_cpu_support_sse41` needs BLI_System.h.

Reviewers: brecht
2019-08-27 08:13:23 -06:00
Stefan Werner cd890c4c25 Compositor: Reversed order of Normal and Albedo in Denoising Node. 2019-08-27 14:43:48 +02:00
Stefan Werner d547f9d3d2 Fix T68944: Added check for SSE4.1 to denoising node.
Since OpenImageDenoise requires a CPU with SSE 4.1 or newer,
let the node act as passthrough on unsupported CPUs and display
a message in the node itself.
2019-08-27 14:03:49 +02:00
Brecht Van Lommel a7609598fa Cleanup: clang-format 2019-08-27 12:18:28 +02:00
Stefan Werner b91b9a8eca Compositor: Run only one instance of OIDN at a time.
Running multiple instances of OIDN simultaneously can use dozens
of GBs of memory. Since OIDN is multithreaded internally, we can run
only one instance at a time and should not lose much performance.
Fixing T69006
2019-08-27 11:06:48 +02:00
Campbell Barton f1ddc6ed0a Cleanup: clang-format 2019-08-25 16:45:47 +10:00
EitanSomething 8eb2296872 UI: use consistent "Color Burn" name for blend mode
Previously it was named just "Burn" in some places.

Differential Revision: https://developer.blender.org/D5186
2019-08-23 13:14:15 +02:00
Campbell Barton 8919c1cad5 Cleanup: clang-format, sorted lists 2019-08-20 22:47:25 +10:00
Campbell Barton 8ac40e4163 Cleanup: spelling, change breaked to braked 2019-08-18 19:30:33 +10:00
Campbell Barton 14e3c0b3e3 Cleanup: unused warning 2019-08-18 19:30:13 +10:00
OmarSquircleArt e5618725fd Shading: Refactor Math node and use dynamic inputs.
- Implement dynamic inputs. The second input is now unavailable in single
operand math operators.
- Reimplemenet the clamp option using graph expansion for Cycles.
- Clean up code and unify naming between Blender and Cycles.
- Remove unused code.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5481
2019-08-18 11:16:04 +02:00
Campbell Barton b1959a96a2 Cleanup: spelling 2019-08-18 04:26:34 +10:00
Campbell Barton 2790740813 Cleanup: spelling 2019-08-17 00:57:05 +10:00