1
1

Compare commits

...

2195 Commits

Author SHA1 Message Date
3b3908ce99 Update node UI redesign patch to latest master 2021-01-26 11:21:31 -06:00
89484e9754 Geometry Nodes: Use highest complexity attribute in join node
This just implements a todo with a utility function that didn't exist
at the time. For example, if one geometry has a "scale" attribute with
a float type and another has a "scale" attribute with a vector type,
the vector type will be used for the resulting geometry.

Differential Revision: https://developer.blender.org/D10206
2021-01-26 10:10:07 -06:00
66f8835f9c Fix T84850: "Lock to Selection" causes unwanted jumps
Adding new tracks, mask points, mask primitives, changing selection was
causing an unwanted jumps in the view.

This change makes it so those operations are preserving view offset.

Differential Revision: https://developer.blender.org/D10146
2021-01-26 16:23:09 +01:00
3d3b6d94e6 Subdiv: Use better default UV interpolation
The default one is now UVs are smoothed, boundaries are kept sharp.

After some time of experimentation seems this is better default from
interoperability point of view.

This fixes distortion reported in T83470.

Differential Revision: https://developer.blender.org/D10111
2021-01-26 16:23:09 +01:00
66151b5de3 Subsurf: Expose all UV interpolation options
Useful for interoperability, and allows to change default mode
without breaking compatibility.
2021-01-26 16:23:09 +01:00
c1d0b234fb Subdiv: Fix typo in RNA enum value name
Was duplicated from SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES value.
2021-01-26 16:23:09 +01:00
8d51c06611 Cleanup: Reduce variable scope 2021-01-26 09:21:42 -06:00
20d0bb43af GPencil: Swap positions of Pie menu options for Vertex Paint and Weight Paint
This keep the same logic used with meshes because now the Weight Paint and Vertex Paint are not in the same position for grease pencil.
2021-01-26 16:11:06 +01:00
c51a5b204c Fix T85048: Cycles sculpt vertex color issues after recent changes
Attribute fields were not fully copied.

Ref D10208
2021-01-26 15:32:05 +01:00
26b5760d6d Fix T85038: No curve is "active" after selecting all curves
Check for selection status beforec learing the "active" flag from an
FCurve. This allows the "Select All Curves" operator to retain what is
seen as the active curve.
2021-01-26 15:13:42 +01:00
84671d796d Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-26 14:38:40 +01:00
b665781808 Asset Browser: fix context properties reported to Python
Change `"active_id"` to `"id"` so that tab completion in the asset browser
context returns the correct properties.

055ef5df61 renamed the `active_id` property
to `id`, but `dir(thecontext)` still returned `"active_id"`.
2021-01-26 14:27:33 +01:00
ed809866b1 Viewport Rendering: Don't clamp when overlays are disabled.
During viewport rendering the color values were clamped in order to
apply the overlay on top of it. This clamping would show the scene
colors washed out.

This patch adds a work around to skip the clamping when the overlays are
turned off.

Parial fix for {T77909}
2021-01-26 14:25:18 +01:00
e6aece32a0 GPU: Enable HQ normals workaround for any AMD Drivers on Polaris. 2021-01-26 12:48:50 +01:00
74633c0456 Merge branch 'blender-v2.92-release' 2021-01-26 12:41:47 +01:00
Robert Guetzkow
c399651637 Fix T84708: Versioning for Set Alpha node
The versioning code introduced in rB38df935c0985 skips the composite node
tree that is used by the scene thus not correctly versioning Set Alpha
nodes outside of node groups. This fix iterates through all node trees to
version all Set Alpha nodes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10110
2021-01-26 12:38:43 +01:00
c3a4c6c209 GPU: Enable HQ normals workaround for AMD 21.1.1 driver.
AMD 21.1.1 still has the same issues as reported in T82856.
2021-01-26 12:30:54 +01:00
4935ed6ce6 Fix T84907: incorrect dirty mask after geometry join node
Hans noticed that these dirty flags are only used for normals currently
and that the edge flag is not used at all. This patch still applies the
"entire" fix with all four flags.

Differential Revision: https://developer.blender.org/D10193
2021-01-26 12:09:44 +01:00
dc8b31af57 Fix T84935: boolean custom data layers not saved correctly
The issue was that boolean custom data layers were not written to files,
because the dna struct name `bool` does not exist. Adding a struct that
just contains a `bool/uint8_t` does not seem to be possible, it looks like
the minimum dna struct size is 4 bytes.

The proposed solution has two parts:

1. Write the custom data layer using `BLO_write_raw` instead of
   `BLO_write_struct_array_by_name`.
2. When loading a file, reinitialize any custom data layer that was
   not saved correctly (this is just a fix for existing files).

Differential Revision: https://developer.blender.org/D10194
2021-01-26 12:05:40 +01:00
f066cee92f Merge branch 'blender-v2.92-release' 2021-01-26 22:04:21 +11:00
548d8a397c Fix T85011: "Allow Execution" reloads the wrong file when recovering
Support custom revert actions, necessary for recover operations
to be able to reload the file with scripts enabled.
2021-01-26 21:56:49 +11:00
2a8122fb65 ed_undo refactor: split/remove ed_undo_step_impl.
This function was doing too many things, with behaviors fairly different
depending on its input parameters. This was making the code fragile and
hard to follow.

Split it in three:
* `ed_undo_step_pre` does the common actions before we actually undo
  data.
* `ed_undo_step_post` does the common actions after we have undone/redone
  data.

Then, `ed_undo_step_direction`, `ed_undo_step_by_name` and
`ed_undo_step_by_index` do their actual specific actions, with their own
logic.

Note: Since the actual behavior of those three funtions is fairly
different (the first only undo/redo one effective step, the second is only
supposed to **undo** //before// given named step, and the third actually
undo/redo until given indexed step become active), we could also find
better names for those. right now, it sounds like they are doing the
same thing, with just different ways to specify the target step.

Note: This is part of on-going refactor work on undo system, see T83806.

Differential Revision: https://developer.blender.org/D10112
2021-01-26 09:44:46 +01:00
0d9f79b163 Cleanup: Reduce variable scope, use LISTBASE_FOREACH macro 2021-01-25 23:47:56 -06:00
f21de01b84 Merge branch 'blender-v2.92-release' 2021-01-26 15:38:08 +11:00
7909f70f64 WM: add "use_scripts" to recover auto-save/session operators
Support recovering blend files with scripts enabled,
needed to fix T85011, can be useful in general too.

Adding this also resolves an assert in BKE_autoexec_match,
since it ran even when scripts were enabled.
2021-01-26 15:34:38 +11:00
e9e054b987 Geometry Nodes: Add float2 to attribute complexity map 2021-01-25 22:20:41 -06:00
71a8e32dc0 Merge branch 'blender-v2.92-release' 2021-01-26 15:18:10 +11:00
d55d95b04d WM: return success from WM_recover_last_session, minor cleanup
- Return success from WM_recover_last_session
- Avoid setting global variables is already called in WM_file_read.
  While it didn't cause any problems, these assignments ran even when
  recovering the session failed to load the file.
- Return OPERATOR_CANCELLED when the operator fails.

Returning success is needed to fix T85011.
2021-01-26 15:16:12 +11:00
Juanfran Matheu
7d2f746369 TEXTURE PAINT: Tools with wrong cursor
Texture paint tools were using DEFAULT cursor instead of PAINT_CROSS cursor as vertex paint, weight paint and sculpt modes.

Before
{F9591366}

After
{F9591370}

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10172
2021-01-25 22:37:14 -05:00
Zev Eisenberg
6499a2ec5c Fix typos in driver_functions.py
I'm learning how driver functions work, and I found a couple of typos in the driver_functions.py template file. Here's a quick patch to fix them up.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10149
2021-01-25 22:37:14 -05:00
d7a2e0b83c Cleanup: Use const arguments 2021-01-25 21:11:57 -06:00
Juanfran Matheu
be262cf561 TEXTURE PAINT: Tools with wrong cursor
Texture paint tools were using DEFAULT cursor instead of PAINT_CROSS cursor as vertex paint, weight paint and sculpt modes.

Before
{F9591366}

After
{F9591370}

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10172
2021-01-25 22:01:12 -05:00
Zev Eisenberg
0734b235d2 Fix typos in driver_functions.py
I'm learning how driver functions work, and I found a couple of typos in the driver_functions.py template file. Here's a quick patch to fix them up.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10149
2021-01-25 21:59:25 -05:00
ae1e68f514 Cleanup: Declare variables where initialized 2021-01-25 17:22:52 -06:00
70e064f111 Cleanup: Correct comments in ID type enum 2021-01-25 16:28:00 -06:00
c4f3475612 Cleanup: update comment from 77f73a9284 2021-01-26 09:23:44 +11:00
6249995c5e Fix T85054: undo/redo app handlers broken
Regression in recent commit c13383da41
which swapped undo/redo when calling the handlers.

Ref D10200
2021-01-26 09:18:26 +11:00
eaa726542e Merge branch 'blender-v2.92-release' 2021-01-25 23:12:02 +01:00
77f73a9284 Fix library name clipping most of the data-block name in data-block menus
Issue is visible here https://developer.blender.org/F8626313.

If there is enough space for both the item name and the library hint, display
both. Otherwise, clip either the item name, the library hint, or both so that
not more than 60% and 40% of the available width are used repectively.
There are further improvements we could do, as noted in T84188, this just fixes
the regression for the release.

Part of T84188. There were multiple reports about this, see merged in and
mentioned reports in T84188 and T78012.
2021-01-25 23:10:16 +01:00
a35c0fe6ce Merge branch 'blender-v2.92-release' 2021-01-26 08:16:22 +11:00
14f61c619b Fix wm.context_* operators reusing values when it's not expected
wm.context_* operators typically have their options set by menus
or key bindings.

Re-using options in this case can cause problems where two
actions that change unrelated properties will re-use a setting
from the previous execution.

For example changing the lights Power impacted
changing it's Radius afterwards.
2021-01-26 08:13:58 +11:00
4fc54ddae1 Cleanup: spelling 2021-01-26 07:50:40 +11:00
1559aa3da0 Merge branch 'blender-v2.92-release' 2021-01-25 21:11:48 +01:00
Greg Neumiller
c134d7437d Fix T84031 initialize connectivity info of the base mesh before using Displacement Smear brush.
Reviewed By: pablodp606

Maniphest Tasks: T84031

Differential Revision: https://developer.blender.org/D9956
2021-01-25 21:09:58 +01:00
93e3aed041 Merge branch 'blender-v2.92-release' 2021-01-25 11:48:53 -06:00
aa030d3459 Fix: Unable to animate nodes modifier exposed properties
The RNA path used for animating the settings passed to the node tree
is incorrect. Currently it's just `settings.property_name`, but it's
the path from the ID, not the modifier, so it should be
`modifiers[modifier_name].settings.property_name`.

However, the "Settings" struct is separated in RNA and DNA, which means
that the callback to get the RNA path does not know about the modifier's
name in order to fill the above path, so some reference to the modifier
in the "Settings" struct would be necessary, which would create a
convoluted layout in the `ModifierData` struct.

Instead, this commit simply removes the "Settings" struct from RNA,
which isn't as elegant from the point of view of the Python API,
but otherwise it's a nice simplification. Note that we don't remove the
"Settings" struct from DNA, because it would break reading old files.

Differential Revision: https://developer.blender.org/D10175
2021-01-25 11:46:55 -06:00
51c433f1a5 Windows: Remove zero terminator from stack trace
Important lesson to be learned here, leaving comments
is great and in the moment, they usually make sense.

Many months later they may not quite make as much sense
any more and time will have to be spend to figure out
what was meant, all of this would have been averted with a
better comment.

The zero terminator in this case, I can find no evidence
of it being used or relied on at any point. It does however
break GTests's `EXPECT_EXIT` macro that stops looking in
the output as soon as it sees the zts and doesn't end up
looking at the actual assert text being thrown. Which in
turn makes the`fcurve_active_keyframe`test fail when run
in debug mode on windows.
2021-01-25 08:50:37 -07:00
8a77019474 Cycles: modernize usage of rna iterators
Using rna iterators in range-based for loops is possible since {rBc4286ddb095d32714c9d5f10751a14f5871b3844}.

This patch only updates the places that are easy to update
without more changes in surrounding code.

Differential Revision: https://developer.blender.org/D10195
2021-01-25 16:25:27 +01:00
04f91bce53 Fix build error after Cycles Amembic procedural commit 2021-01-25 16:15:35 +01:00
b64f0fab06 Cycles: internal support for Alembic procedurals
The implementation is currently optimized to load animation sequences once
and then quickly scrubbing through them. Later on an option should be added
to optimize for memory usage and only load the current frame into memory.

Currently mesh and curve objects are supported, including support for UV and
vertex color attributes. Missing still is support for arbitrary attributes and
motion blur, as well as better handling of changing topology. Shader assignments
are made using FaceSets found in the Alembic archive.

The animation (and constant) data of the objects inside the Alembic archive is
loaded at once at the beginning of the render and kept inside a cache. At each
frame change we simply update the right socket of the corresponding Cycles node
if the data is animated. This allows for fast playback in the viewport
(depending on the scene size and compute power).

Note this is not yet exposed in the Blender UI, it's a feature that is still under
development and not ready for general use.

Ref T79174, D3089
2021-01-25 15:51:42 +01:00
2e67191c86 Cycles: internal support for the concept of procedurals
Procedurals are nodes in the scene that can generate an arbitrary number of
other nodes at render time. This will be used to implement an Alembic procedural
that can load an Alembic file into Cycles nodes. In the future we also expect to
have a USD procedural.

Direct loading of such files at render time is a standard feature in other
production renderers. Reasons to support this are memory usage and performance,
delayed loading of heavy scene data until rendering, Cycles standalone rendering
using standard file formats beyond our XML files, and shared functionality for
Cycles integration in multiple 3D apps.

Ref T79174, D3089
2021-01-25 15:51:38 +01:00
3656fc3aee Cleanup: move code to find geometry shaders into own function
Ref D3089
2021-01-25 15:48:39 +01:00
2a81d948ad LibOverride: refactor of relationships handling in library overrides.
First step towards a better handling of relationships between IDs in
override context, especially when a resync is needed.

First, introduce a new flag to override operations,
`IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE`, for ID pointers.
It keeps track of whether an RNA ID pointer has been kept to its
'natural overriden ID' (in override hierarchy context), or has actually
been re-assigned to some other data-block.

Second, refactor how we deal with relationships between IDs in override
hierarchy code, especially in resync case. This will fixe several cases
listed in T83811, especially the case where an ID pointer to an existing
override needs to be updated to a new one due to a matching change in
linked data.
2021-01-25 14:48:51 +01:00
5c490bcbc8 Fix T85027: Crash dragging a collection over empty Outliner
Filtering may make the Outliner tree empty. The function to find the drop
element should just return null then and let the caller decide how to deal with
it.
2021-01-25 14:37:24 +01:00
ef6d652428 Fix T83344: Cycles baking with progressive refine fails on GPU 2021-01-25 14:27:01 +01:00
f226687bb9 Cleanup: Knife Tool: Remove redundant 'view3d_operator_needs_opengl' calls
This function sets the `RegionView3D` matrices to the GPU.
But the OpenGL library is not actually being used by the operator.
2021-01-25 10:07:50 -03:00
4792d988fb Fix T84964: Crash when running Knife Project in the background
Although the Knife Project operator converts 3D coordinates to screen
space, it doesn't really need opengl.

Differential Revision: https://developer.blender.org/D10178
2021-01-25 10:07:50 -03:00
e9a47223cb Merge branch 'blender-v2.92-release' 2021-01-25 23:48:00 +11:00
4bc7996e2e Merge branch 'blender-v2.92-release' 2021-01-25 23:47:56 +11:00
72a207de35 Merge branch 'blender-v2.92-release' 2021-01-25 23:47:52 +11:00
William Reynish
601b690a24 Fix T84911: Add Primitive and IC keymap - 3d navigation conflict
Ref D10176
2021-01-25 23:46:57 +11:00
William Reynish
da2955fdf6 UI: improve categorization in Grease Pencil Layers sub-panels
The "Layers" panel for Grease Pencil objects uses sub-panels to organize
their properties in categories. Currently, this isn't so clear.
This patch cleans up these sub-panels with clearer categorization.

Reviewed By: #grease_pencil, antoniov, Blendify, HooglyBoogly

Ref D10184
2021-01-25 23:41:00 +11:00
7a005fb7d1 Fix T84324: Crash when combining two scenes in compositor.
In the CompositorOperation::deinitExecution the viewer could be freed at
the same time it was drawn in the image editor or node editor. There is
a guard for that but wasn't added during the migration of the two
editors to the draw manager.
2021-01-25 12:44:18 +01:00
dd2b616320 Buildbot: Fixed crash when building RC builds
Building RC builds would parse `BLENDER_VERSION_CYCLE_NUMBER` that
doesn't exist anymore. It was removed by {D7748}.

This change removes it from `buildbot_utils.py`.
2021-01-25 11:53:35 +01:00
06fdbe6664 Merge branch 'blender-v2.92-release' 2021-01-25 11:36:31 +01:00
fba35a02c6 Fix padding issue in DNA
Was introduced in the previous change in the image.
2021-01-25 11:35:29 +01:00
William Reynish
5f2c5e5bb8 UI: object context menu tweaks for consistency
Currently, the object context menu includes some inconsistencies
between object types. This is a small patch that fixes these.

- Adds the same ability to Join and Set Origin
  to all supported object types.
- Adds Set Active Camera for cameras.
- Adds Adjust Stroke Width for GP Objects.
- Adds Trace Image to Grease Pencil for Image Empties.

Reviewed By: #grease_pencil

Ref D10144
2021-01-25 21:28:39 +11:00
ebaa3fcedd Fix T84398: Multiview images show only one view.
The `image_get_gpu_texture` didn't use the iuser->view_index but
recalculated the requested view again. This lead to inconsistent
behavior when switching between multi view textures or stereo textures.

This has been fixed by ensuring that the `iuser->view_index` is always
used.

An Image has only place to store 2 view textures. This is done for
right/left eye compositing. A multi view texture can have more views.
This would lead to reading and writing to unallocated space.

When a multiview texture is requested that is larger than 1. It will
always be cached as being the first eye. The `gpu_view` of the Image is
also used as a cache key to check this.
2021-01-25 11:27:55 +01:00
7cb65a1e67 Fix T84990: Proportional Editing falloff drawing for masks in MCE is broken
This got broken in 4b1112c8c9. A fix which will be consistent with image
editor is not obviously clear, so for the time being revert the change and
go back to state which was working for a long time.
2021-01-25 11:10:42 +01:00
be8b60aa20 Merge branch 'blender-v2.92-release' 2021-01-25 11:07:08 +01:00
02404ded80 Fix UI message typo in own previous commit.
//sigh//
2021-01-25 11:06:21 +01:00
a0b85800ec Merge branch 'blender-v2.92-release' 2021-01-25 10:56:55 +01:00
3df2bea88b Fix UI messages.
Avoid sticking words together when it's not absolutely necessary.
2021-01-25 10:56:36 +01:00
4d94e2afc8 Merge branch 'blender-v2.92-release' 2021-01-25 20:37:50 +11:00
2188047d9d Merge branch 'blender-v2.92-release' 2021-01-25 20:37:46 +11:00
52022cba78 UI: increase the context menu's light power
This roughly matches the behavior when
editing this value via the buttons.

Part of D10144
2021-01-25 20:35:56 +11:00
William Reynish
5f55022276 UI: tweak object context menu labels
A number of naming changes for consistency and clarity

- Use 'Adjust...' for all entries that adjust properties
  rather than being normal operators.
- Follow naming conventions (ie Draw -> Display etc).
- Less naming ambiguity and more correctness and consistency.

Part of D10144
2021-01-25 20:12:39 +11:00
292685ea39 Fix T84878: Eevee cryptomatte broken with stereoscopy
During multiview rendering the `cryptomatte_accum_buffer` is not cleared
between the views and leaves artifacts on the next view to be rendered.
This change clears the accum buffer when it already exists and will be
reused for the next view.
2021-01-25 09:40:03 +01:00
0cb264a282 Cleanup: pass 'rctf' rectangle to 2D box drawing functions
Passing 4x arguments for the rectangle,
mixed in with round-box radius & color wasn't very readable.

Instead, pass a `rctf` as the first argument to UI box drawing functions.
2021-01-25 18:34:29 +11:00
17ac860cef Cleanup: remove redundant len() calls 2021-01-25 18:09:15 +11:00
32fd000b4b UI: Round-box drawing cleanup
The new GPU_SHADER_2D_WIDGET_BASE shader allows us to draw
many complex shapes with anti-aliasing.
One thing it can do is draw an opaque rounded rectangle with colors
that differ between its interior and outline.

In order to do the above in a single pass I recently added an "_ex"
version of UI_draw_roundbox that exposes most of that shaders features.

This simplifies interface_draw.c by removing redundancy in the calling
of this shader by using this new uber "_ex" version.

Ref D10189
2021-01-25 18:06:39 +11:00
1ac3c861fd Cleanup: remove unused UI_draw_roundbox_shade_y function
Marked unused 2017 f69678482c)

Remove since this remains unused,
split from D10189 to allow reverting if we ever need it back.
2021-01-25 17:57:59 +11:00
William Reynish
5a1cef2e76 UI: move 'Trace Image to Grease Pencil' to 'Convert' sub-menu
This operator is very specific, and may not warrant being placed in
such a prominent place. Move it together with other convert operators.

Ref D10188
2021-01-25 17:49:02 +11:00
bf329d37da Merge branch 'blender-v2.92-release' 2021-01-25 17:43:00 +11:00
7a0281914e Fix T85010: Cycles viewport not showing certain material changes when using GPU compute
Modifications to triangle shader association were not considered when checking for updates and the associated device data array was not tagged as modified so it was not resent to the device(s).
2021-01-25 07:40:49 +01:00
7f9ed0178a Cleanup: compiler warning, clang-format, spelling 2021-01-25 17:40:40 +11:00
b90ccaa067 Merge branch 'blender-v2.92-release' 2021-01-25 06:01:14 +01:00
Olivier Jolly
5501a5de32 Fix T84705: Snapping strip handle offset animation
Only offset animation if whole strip is snapped.

Bug introduced in e36c05b3d1.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10116
2021-01-25 05:51:36 +01:00
Peter Fog
d6bbcc4f66 VSE: Inherit blend mode with single input effects
It is very likely, that after applying effect like transform or speed on
strip with certain blending, user would want to change effect blending
to match original strip.

Feature suggested on RCS:
https://blender.community/c/rightclickselect/HVgbbc/

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10156
2021-01-25 05:42:10 +01:00
6d21703e89 Merge branch 'blender-v2.92-release' 2021-01-25 05:09:13 +01:00
e16c786022 Fix T83267: Crash prefetching scene strip in meta strip
Scene strips can't be prefetched and seq_prefetch_do_skip_frame()
should check if scene strip is in timeline. But it did not recurse into
meta strips, which resulted in crash.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9999
2021-01-25 05:03:15 +01:00
93c10797dc Fix T82698: Speed effect not working on generator strips
Generator strips with zero inputs have their length set to 1 pernamently.

In some cases it is useful to use speed effect on these strips because they
can be animated. This can be done by using their length as is on timeline as
content length.

This is very simplified and temporary solution, as cutting these strips won't
give expected results. Lot of code relies on length of these strips being fixed
to 1, resolving this properly should be done by T59540.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10026
2021-01-25 04:55:10 +01:00
744fa41e7e Fix T83266: Proxy building with meta strips fails
Building proxy with meta strip selected resulted in attempt to render
meta strip itself and save result as image as is done when building
image proxies.

Remove meta strip from list of supported strips.

Multicam, Meta and scene strip are cleared from poll function in UI as well.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10001
2021-01-25 04:42:46 +01:00
77b51d4e58 VSE: Remove skip_disk_cache argument
This argument was used to prevent infinite loop in lookups between disk
and RAM cache.

Code was refactored, so this can be handled internally in cache.

Reviewed By: sybren, sergey

Differential Revision: https://developer.blender.org/D9955
2021-01-25 04:28:13 +01:00
6623d572aa Cleanup: minor changes and comments to screen_bounds_get access 2021-01-25 13:49:32 +11:00
9708aa6341 Fix view-axis gizmo tool-tip placement
Bounding box calculation ignored the gizmo size preference.
2021-01-25 13:44:42 +11:00
c5e409b013 Merge branch 'blender-v2.92-release' 2021-01-25 13:38:02 +11:00
850115531d Merge branch 'blender-v2.92-release' 2021-01-25 13:37:54 +11:00
652dd4e27f Fix ruler end-caps not following interface scale 2021-01-25 13:34:15 +11:00
d1c6704413 UV: tweak island select behavior
Selecting inside an island no longer de-selects
when it's too far from an edge.

When edge select fails fall back to inside-face test.

This follows 908b383b7d
which made this change for face-select.

Apply to island selection since it doesn't make sense
for island select to behave differently.
2021-01-25 13:30:02 +11:00
cf6d17a6aa UI: Gizmo Tooltip Positioning
Position Gizmo tooltips below their bounds so they do not obscure the content.

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

Reviewed by Julian Eisel
2021-01-24 15:16:05 -08:00
2fec46c3e6 Asset Browser: Support dragging in object-data assets (meshes, curves, etc.)
The Asset Browser already displayed object-data assets, but you couldn't
actually drag & drop them. This is now supported.

The object-data drop poll needed access to the data-block. But with a small
tweak it doesn't need that and can just check the ID type (which is known for
asset dragging too).

Part of T82661.
2021-01-24 22:33:17 +01:00
c8d6e2dfa0 UI: Avoid showing drop hint on drag & drop if dropping won't succeed
If the poll check of the operator fails, the operator won't run. We can check
that in advance to hide the drop hint if dropping will fail anyway.
This improves feedback during dragging.
2021-01-24 21:29:14 +01:00
e90a2a3f01 Asset Browser: Avoid appending asset data-block when drop operator will fail
For assets, the copy callback of the drop-box would append the asset
data-block. Check if the operator's poll succeeds before calling the copy
callback.
Otherwise the data-block is "secretly" appended, which the user doesn't expect
and won't notice without checking the file data in the Outliner.

For masks I had to extend the poll function, it didn't check context
sufficiently.
2021-01-24 21:29:14 +01:00
f04206cbc7 Cleanup: Add/use helper to check if dragging a certain ID type or asset ID type
This check is a common pattern, avoid duplication by using a helper function.
2021-01-24 21:29:14 +01:00
e747c07156 GPencil: New option to trace current frame
Instead to trace the image of the sequence starting in first frame, now it uses the current frame by default.
2021-01-24 17:22:44 +01:00
b449da3a7d Asset Browser: Support dragging mask assets into compositors
The normal drag & drop support was already there, just needed minor tweaks to
respect asset importing. The dragged in mask will create a mask node for
compositor node editors.

Part of T82661.
2021-01-24 17:16:20 +01:00
db15df0baa Asset Browser: Support dragging image assets into node editors
The normal drag & drop support was already there, just needed minor tweaks to
respect asset importing. The dragged in image will create a image/texture node
for the internally known node-tree types (shader, texture and compositing
nodes).

Part of T82661.
2021-01-24 16:53:34 +01:00
aa065a2951 Merge branch 'blender-v2.92-release' 2021-01-24 18:43:58 +11:00
d3506c86da Fix UV editor vertex/face drawing ignoring UI scale 2021-01-24 18:38:05 +11:00
9ad181a5d0 Cleanup: email address formatting
Match git style email addresses, ignored by the spell checker.
2021-01-24 16:08:17 +11:00
9c088b1b97 Cleanup: spelling 2021-01-24 16:06:58 +11:00
2b0d08961a Cleanup: remove toolbar popup release hack
This isn't needed since key-map items can ignore repeat events.
2021-01-24 15:51:05 +11:00
de9977260c Merge branch 'blender-v2.92-release' 2021-01-24 15:25:57 +11:00
e9cd3d50a7 Fix T84988: Armature symmetries crashes with action constraint
Action constraint without an action pointer set was crashing.
2021-01-24 15:24:04 +11:00
9f3c5a061d Fix outliner and animation editors exiting multi-object edit-mode
When multiple objects were in edit-mode,
only the active object would exit edit-mode.
2021-01-24 15:24:04 +11:00
e77c65f73c Cleanup: group navigation gizmo size with generic gizmo size
Also use `char` for these gizmo size & flag.
2021-01-24 13:45:17 +11:00
bd4ed5ca9a Fix "use after scope" reported by ASAN
The float array is declared inside a smaller scope, pointed to, and then
used later. This simply moves the declaration outside of the if statement.
Also remove two redundant lines.
2021-01-23 18:38:51 -06:00
ded9484925 UI: Viewport Navigate Gizmo Refactor
Simplification and changes to the Navigation gizmo. Better indication of negative axes, consistent use of color and size to indicate orientation, ability to be resized.

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

Reviewed by Campbell Barton
2021-01-23 13:10:07 -08:00
aaa1d58054 Merge branch 'blender-v2.92-release' 2021-01-22 19:30:23 +01:00
90bcd5e724 Cleanup: remove unused render camera code 2021-01-22 19:30:17 +01:00
a1f44e43a2 Fix T84745: more build errors with TBB 2021
* tbb::blocked_range moved to a different namespace and since the fix is
  non-trivial, remove some unused code that used this.
* Task group priorities are no longer supported. It's unclear if they are
  useful at all right now and even set correctly, for now all tasks are equal
  priority with TBB 2021.
2021-01-22 19:24:13 +01:00
5d6e5a9076 Fix vertex color baking using wrong color space
Now light baking should match the render.
2021-01-22 19:24:13 +01:00
e91b59b589 Merge branch 'blender-v2.92-release' 2021-01-22 11:28:59 -06:00
e845467d93 Fix: Mouse presses in some areas do not set active modifier
There are a couple of operations that are meant to set the active
modifier that currently don't. The first is a mouse press on the drag
icon on the right of the header, and the second is mouse presses on
modifier sub-panels headers.

This was an oversight in the implementation, especially the second,
because the blank space on the right of a sub-panel header often looks
just like the blank space elsewhere on the modifier's panel that
*does* set the active modifier.

Note that this purposefully doesn't include collapsing and expanding
the modifier as operations that set the active, since regardless of
whether that makes sense, it wasn't in the agreed upon design, which
would ideally not need changing for 2.92.

Differential Revision: https://developer.blender.org/D10155
2021-01-22 11:08:58 -06:00
735093dee8 Fix crashes from recent refactor rB131a758b6f88.
Much better to add a relation entry for all IDs, even if they are not
connected to any other ID.
2021-01-22 17:37:09 +01:00
3469e06c1a Fix memory leak when opening file browser
The name string of each file was duplicated but not freed. The new flag to
ensure the file-list frees the name wasn't set. Mistake in ca475479eb.
2021-01-22 16:58:23 +01:00
bbe6d44928 Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).

Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.

The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.

On average, for a variety of animated scenes, this gives a 3x speedup.

Reviewed By: #cycles, brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D9555
2021-01-22 16:08:25 +01:00
131a758b6f Refactor BMain relations temp data.
`bmain.relations` is used to store temp data of relations between IDs,
to speed-up some complex processes heavily relying on such information.

Previous implementation was failry unclear/confusing, and required a
not-so-nice hack to 'tag' some ID as processed.

New code changes as such:
* Using `from`/`to` naming (instead of `user`/`used`).
* More clear separation between `to` `id_pointer` and `from` one,
  using an union instead of hacking around difference between `ID *` and
  `ID **` pointers.
* Adds storage of `session_uuid` informations (mainly useful as
  debug/ensuring proper consistency of data currently).
* Adds a structure per ID in the mapping. This enables possibility of
  storing tags (and potentially more  data in the future) per-ID,
  without polluting the IDs themselves with very short-life info.

Differential Revision: https://developer.blender.org/D10164
2021-01-22 16:05:17 +01:00
be7106a974 LibOverride: Add an 'post apply' callback to IDTypeInfo.
Currently this is needed to properly tag PointCache's for info update
(fixes an issue reported in T82503).

Suspect we may need this in more cases in the future though, RNA
assign/update processes are not always 100% enough to deal with
complicated corner cases.
2021-01-22 15:31:15 +01:00
7e32bb8492 Merge branch 'blender-v2.92-release' 2021-01-22 14:32:01 +01:00
226eb5e366 Cycles: Fix usage of double floating precision in CNanoVDB
Double floating point precision is an extension of OpenCL, which might
not be implemented by certain drivers, such as Intel Xe graphics.

Cycles does not use double floating point precision, and there is no
need on keeping doubles unless there is an explicit decision to use
them.

This is a simple fix from Cycles side to replace double floating point
type with a type of same size and alignment rules. Inspired by Brecht
and Patrick.

Tested on NVidia Titan V, Radeon RX Vega M, and TGL laptop.

Differential Revision: https://developer.blender.org/D10143
2021-01-22 14:31:06 +01:00
18e063b69d Functions: use better conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.

Ideally this should be solved in float2/float3 itself, but my first fix for
that resulted in a compile error: rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82

This is an alternative fix that can be used for now. Will have to look
into the conversion in more detail again.
2021-01-22 13:46:13 +01:00
7a07ca1f8c Merge branch 'blender-v2.92-release' 2021-01-22 13:41:35 +01:00
644976548d Revert "BLI: add conversion from float2 to float3"
This reverts commit 6ac0a3d83c.
2021-01-22 13:40:45 +01:00
9fbf3075ad Merge branch 'blender-v2.92-release' 2021-01-22 12:26:23 +01:00
2ba2d2bd9d Fix T76936: Mesh shape amended upon undoing in sculpt mode
Was happening when there are deform modifiers prior to the multires.

There are detail in the comment around sculpt_undo_refine_subdiv(),
but briefly: the subdiv was refined with wrong base mesh coordinates.

Differential Revision: https://developer.blender.org/D10158
2021-01-22 12:26:02 +01:00
7f96e6ed7e Merge branch 'blender-v2.92-release' 2021-01-22 12:17:44 +01:00
6ac0a3d83c BLI: add conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.
2021-01-22 12:16:53 +01:00
ae4a430755 Merge branch 'blender-v2.92-release' 2021-01-22 11:54:43 +01:00
526373b897 Cleanup - Point Instance: Use own DNA struct
We will need to expand this node soon to add weight/count for different
elements inside the collection. For that it is better to have the node
to use its own DNA.
2021-01-22 11:47:47 +01:00
cd8893d446 Fix (unreported) LibOverride: hair cache settings not working.
Thanks to that same point cache being exposed in **four** different RNA
paths (twice in particle system, and twice in its embedded cloth
simulation settings).

Only way is to also make particle system overridable.
2021-01-22 11:39:56 +01:00
d179e1c6e4 Merge branch 'blender-v2.92-release' 2021-01-22 11:26:15 +01:00
0373d1b09f GPencil: Fix unreported Vertex Paint masking error
The masking was not working as expected and allowed to paint non selected strokes.
2021-01-22 11:25:32 +01:00
8eaea99d98 Merge branch 'blender-v2.92-release' 2021-01-22 20:00:14 +11:00
Stefan Werner
927d099ec0 Particles: Fixed thread work size calculation.
Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Differential Revision: https://developer.blender.org/D10157
2021-01-22 09:30:35 +01:00
Stefan Werner
cdf564277c Particles: Fixed thread work size calculation.
Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Differential Revision: https://developer.blender.org/D10157
2021-01-22 09:22:13 +01:00
3a9d43cf31 Fix outliner and animation editors exiting multi-object edit-mode
When multiple objects were in edit-mode,
only the active object would exit edit-mode.
2021-01-22 18:43:00 +11:00
2469ddc1a9 Cleanup: correct last spelling cleanup 2021-01-22 17:12:11 +11:00
c0bbb93b88 Cleanup: spelling, remove outdated/invalid comments 2021-01-22 16:54:35 +11:00
421c5127f4 Merge branch 'blender-v2.92-release' 2021-01-22 16:43:48 +11:00
295b21f56a Merge branch 'blender-v2.92-release' 2021-01-22 16:43:44 +11:00
ee5a4f41eb Fix the NLA setting the active object without exiting edit-mode
This is done by convention in the outliner and dope-sheet.

Missing edit-mode exit causes glitches with mixed object/edit-mode undo.
2021-01-22 16:08:12 +11:00
141f17eaf4 Fix dope-sheet exiting edit-mode when activating an object
Regression from d8992192e5
The original code relied on having a separate edit-object pointer
than the active object.
2021-01-22 16:00:31 +11:00
8d958fe685 Merge branch 'blender-v2.92-release' 2021-01-22 15:45:48 +11:00
1a30687c24 Fix undo crash on active object change without exiting edit-mode
While the previous fix for T84920 is correct, the crash could still be
triggered by changing the active object while in edit-mode.

Ensure stale data isn't used by tagging for depsgraph update when
edit-mode data is freed on undo.

While exiting edit-mode normally does this, it's possible to set the
active object to a non edit-mode mesh, skipping the mode-switch
operator and it's depsgraph tagging.
2021-01-22 15:43:25 +11:00
4f3fba2aa7 Merge branch 'blender-v2.92-release' 2021-01-22 12:42:20 +11:00
665eca85ba Merge branch 'blender-v2.92-release' 2021-01-22 12:42:15 +11:00
7b528b2a3a Fix T84920: Crash undoing object activation in the outliner
Regression from d8992192e5
The original code relied on having a separate edit-object pointer
than the active object.

Use a utility function to avoid code duplication as there are
other areas that have similar functionality.
2021-01-22 12:38:55 +11:00
99e5d5ba21 Fix marker camera switch + undo crashes in edit-mode
Selecting markers and cameras could crash when in edit-mode.

Only support this in object mode as mode-switching as part of
activating cameras doesn't seem like a priority.

This has the same root cause as T84920.
2021-01-22 12:38:55 +11:00
e391ad7bbc Merge branch 'blender-v2.92-release' 2021-01-21 23:24:19 +01:00
b9e07c1e0b Fix T84896: Boundary brush not affected by automasking
This uses the values form the stroke automasking cache to control the
falloff of all deformers in the boundary brush. Usually this is already
considered in the general brush falloff function for the rest of the
brushes, but this is one of the exceptions where the brush implements
its custom falloff.

Reviewed By: JacquesLucke

Maniphest Tasks: T84896

Differential Revision: https://developer.blender.org/D10161
2021-01-21 23:23:08 +01:00
96fa78f5b0 Fix editors showing old data-block name after renaming in Outliner
E.g. the graph editor channels list would still show the old name of a material
that was renamed in the Outliner. Same for the Asset Browser when showing
data-blocks in the "Current File" repository.

The Outliner didn't send the notifier for some data-block types that editors
listen to for data-block name changes.
2021-01-21 22:56:38 +01:00
ca475479eb Fix Asset Browser showing old name after renaming data-block
The "Current File" asset library didn't get refreshed after the data-block name
changed. But rather than entirely refreshing the file list, or doing possibly
problematic partial refreshes, reference the data-block name directly, so a
simple redraw gets the new name displayed.

Addresses T83751
2021-01-21 22:23:43 +01:00
41982af6a0 Merge branch 'blender-v2.92-release' 2021-01-21 21:59:56 +01:00
f24992d2ec GPencil: Deactivate interpolation of gpencil curves
To avoid unexpected behavior and desync issues with
stroke and curve data, the interpolation operators are deactivated
in curve edit mode.
2021-01-21 21:58:39 +01:00
b4b02eb4ff UI: Transform Arrow Cursor Refactor
Mouse cursors used during transforms made to work better with changes of user scale and line width.

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

Reviewed by Campbell Barton
2021-01-21 08:19:26 -08:00
ceb500df03 Geometry Nodes: fix losing data when attribute has incorrect type
Differential Revision: https://developer.blender.org/D10165
2021-01-21 17:02:07 +01:00
425e706921 Geometry Nodes: new Attribute Sample Texture node
This node allows sampling a texture for every vertex based on some
mapping attribute. Typical attribute names are the name of a uv map
(e.g. "UVMap") and "position". However, every attribute that can be
converted to a vector implicitly is supported.

It should be noted that as of right now, uv map attributes can only be
accessed after a Point Distribute node.

Ref T82584.

Differential Revision: https://developer.blender.org/D10121
2021-01-21 16:49:06 +01:00
a92ebab5da Windows: Add "--debug-cycles" argument to "blender_debug_gpu.bat" batch file
This extends the "blender_debug_gpu.bat" batch file to also be useful for triaging Cycles
problems. OptiX initialization errors or problem while iterating CUDA devices are only
logged when the `--debug-cycles` flag is specified, so adding that here.

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D10167
2021-01-21 16:47:16 +01:00
b32e8e5ba7 Gpencil: Fix missing change in previous commit
This was related to the changes for Layer and Frame duplication.
2021-01-21 16:04:12 +01:00
cfd54ad7d7 GPencil: New option to Duplicate Layers with Empty Keyframes
This option allows to duplicate the layer and keyframes but without copying the strokes. This is very handy for the cleanup and paint process.
2021-01-21 16:00:12 +01:00
9c4c3fbabc GPencil: Make Layer and Frame duplicate functions more flexible
Now it's possible to copy only part of the data. This will be used in future operators.
2021-01-21 15:57:10 +01:00
3fd92b5c22 Fix T83344: Cycles baking + progressive refine fails 2021-01-21 15:12:17 +01:00
f817a11dc6 Cleanup: variable rename.
Avoid using two or three chars names when it's not absolutely obvious
what they mean.
2021-01-21 14:59:25 +01:00
1135790ad5 Asset Browser: Enable by default in alpha builds
The Asset Browser is still considered an experimental feature right now. But it
can be enabled by default for alpha builds, to get further testing and
feedback. It will hopefully be a non-experimental feature by the end of bcon1.
This is done in agreement with Dalai.
2021-01-21 14:40:13 +01:00
84702bd3d8 Fix T84242: freestyle animated camera shift lags behind in animation render 2021-01-21 14:21:49 +01:00
f4d07196bd Merge branch 'blender-v2.92-release' 2021-01-21 13:20:58 +01:00
aff7d59986 Fix T84908: Cycles GPU + CPU and denoising failure after recent fix 2021-01-21 13:20:05 +01:00
324d6d2192 Tracking: Cleanup, yet another spelling in the same line
Spotted by Jacques, thanks!
2021-01-21 12:53:14 +01:00
649c87814d Merge branch 'blender-v2.92-release' 2021-01-21 12:42:21 +01:00
9237b2019c Fix T84867: Transform node applies transforms in the wrong order 2021-01-21 12:39:30 +01:00
35f379ba26 Tracking: Actual spelling cleanup in the comment
The previous spelling cleanup did not catch this, so didn't the
review of the coming proportional editing code change.
2021-01-21 12:34:37 +01:00
793547e7d1 Geometry Nodes: initial support for volumes
For the most part, this just adds boilerplate code for volume support in geometry nodes:
* Add `VolumeComponent` next to `MeshComponent`, etc.
* Support `VolumeComponent` in depsgraph object iterator.

Furthermore, I added initial volume support in a few nodes:
* The Object Info node outputs an object instance when the input is a volume object
  (that will be the same for mesh objects soonish, to avoid copies).
* Support transforming a `VolumeComponent` in the Transform node.
* Support the `VolumeComponent` in Join Geometry nodes, but only when just one of the
  inputs has a volume component for now.

Right now, there is no way to create a `VolumeComponent`, because the Object Info node
outputs an object instance. The `VolumeComponent` will be necessary for upcoming nodes,
which will generate volumes on the fly.

Viewport selection does not work correctly with `VolumeComponent`s currently. I don't
know why that is. That can be figured out a bit later, once we can actually create
new volumes in geometry nodes.

Ref T84604.

Differential Revision: https://developer.blender.org/D10147
2021-01-21 10:32:42 +01:00
985bc08688 Merge branch 'blender-v2.92-release' 2021-01-21 16:37:52 +11:00
eb45e7be47 UI: particle tool properties layout tweaks
Adopt some of the newer layout abilities to
clean up the Particle Tool Properties a bit.

- Use in-line check-boxes next to values.
- Use text heading for Preserve toggles and mirror/topology mirror.

Reads clearer. Uses less space. Is more consistent.

Reviewed By: #user_interface, pablovazquez, Blendify, campbellbarton

Ref D10130
2021-01-21 16:08:43 +11:00
William Reynish
cd4e27a4a1 Industry Compat Keymap: Fix box/lasso selection for GP edit mode
There was a bug which which prevented box and lasso select to work
correctly in GP Edit Mode. It would select a nearby vertex before the
box selection.

This patch fixes it so it works with a click event,
like the default keymap, which fixes box and lasso selection.

Ref D10119
2021-01-21 15:11:33 +11:00
011a79215d Merge branch 'blender-v2.92-release' 2021-01-21 15:00:58 +11:00
d7cfee0b68 Fix use of uninitialized variable in image sequence detection
Uninitialized stack memory was being re-used in a loop.

Error in original commit from 04f81c8225

This happened to work as the same memory location was re-used
between iterations and not overwritten.
2021-01-21 14:59:40 +11:00
b243fab16b Merge branch 'blender-v2.92-release' 2021-01-21 14:05:59 +11:00
eaf5ee8981 Cleanup: NULL used for boolean 2021-01-21 14:05:16 +11:00
41a945d746 Docs: add note on convention for setting line-width 2021-01-21 11:12:11 +11:00
7b45850eac Cleanup: spelling 2021-01-21 10:59:50 +11:00
b303769d2e Merge branch 'blender-v2.92-release' 2021-01-20 20:01:40 +01:00
c60c30205d Fix T82966, T78152: Cycles GPU render hair ribbon artifacts and differences
Now it should match CPU rendering much more closely.
2021-01-20 19:59:43 +01:00
c07c110467 Merge branch 'blender-v2.92-release' 2021-01-20 18:18:38 +01:00
b33d839162 Fix T84867: Transform node does not rotate/scale instances
The manipulation of rot/scale was simply not implemented.
2021-01-20 18:17:25 +01:00
a823e825c8 Fix T84569: crash when trying to bake an object with no faces
Differential Revision: https://developer.blender.org/D10125
2021-01-20 18:07:51 +01:00
0d599ce95a GPencil: Fix unreported NaN value for UV Rotation in Primitives
Using primitive drawings, the point UV rotation was not initialized.
2021-01-20 16:53:42 +01:00
e12eb89f22 Fix T81429: move tool's axis constraints not drawn completely when using local orientation
In fact, the drawing was that of the local contraint axis (which is
summarized so as not to fill the screen with too much information).

Use the local contraint axis only when more than one object is selected.
2021-01-20 12:35:38 -03:00
736b0d6894 Revert "Transform: Use orientation of active object with Auto Constraint"
This reverts commit 54f248fa87.

And fixes T84259.

Apparently the ideal behavior was the previous one.
2021-01-20 12:28:00 -03:00
1f691050e5 Fix T84539: cryptomatte metadata lost when using save buffers option 2021-01-20 14:59:23 +01:00
10d2cbfa36 Fix T84872: OptiX GPU + CPU rendering uses branched path samples
Branched path tracing is not supported for OptiX, and it would still use the
number of AA samples from there when branched path was enabled by the user
earlier but auto disabled and hidden in the UI when using OptiX.

Ref D10159
2021-01-20 14:59:23 +01:00
1451f7d093 Fix T84813: enabling Cycles OpenImageDenoise during GPU viewport render fails 2021-01-20 14:59:23 +01:00
fc5f9a8ac9 Merge branch 'blender-v2.92-release' 2021-01-20 14:40:46 +01:00
4a09907eab Fix T84049: Crash when using Cycles Progressive Refine with OptiX+CPU
Tile stealing may steal a CPU tile buffer and move it to the GPU, but next time around that
tile may be re-used on the CPU again (in progressive refinement mode). The buffer would
still be on the GPU then though, so is inaccessible to the CPU. As a result Blender crashed
when the CPU tried to write results to that tile buffer.
This fixes that by ensuring a stolen tile buffer is moved back to the device it is used on before
rendering.
2021-01-20 14:40:27 +01:00
6a8f4bfc60 Tracking: Fix missing average of track offset 2021-01-20 14:07:48 +01:00
b01c865687 Merge branch 'blender-v2.92-release' 2021-01-20 13:48:44 +01:00
87db3423c9 Fix Lock to Selection does not work in mask mode
A regression since 2.80: need to use evaluated mask to calculate
its bounds. Non-evaluated mask does not contain state for the
current frame, so iterating over control points of the original
mask gives points state from the time they were edited last (aka,
not affected by the animation).
2021-01-20 13:46:39 +01:00
Yevgeny Makarov
a73dfac519 Fix T73575: Zooming out a lot faster than zooming in
- Zooming out a lot faster than zooming in,
  it had the wrong aspect ratio, make all the preparations
  with the factors instead of deltas.
- Improved following the `zoom_invert`
  (should not apply to `MOUSEZOOM`) and "trackpad natural scroll"
  preferences.
- `zoomfac` adjustment, same as in `view_zoomdrag_modal`.

Ref D8686
2021-01-20 22:56:35 +11:00
Yevgeny Makarov
9425628c84 Fix T65837: Zoom Axis is not working in the Node Editor
It was already fixed for the mouse in
bcda8cc89b, T65837
now the same logic is applied for the track-pad.

Ref D8685
2021-01-20 22:56:35 +11:00
f2988543c2 Merge branch 'blender-v2.92-release' 2021-01-20 22:10:15 +11:00
8e5b6320a6 Add Object Tool: minor improvements to tool-tips 2021-01-20 21:47:52 +11:00
William Reynish
685419d6be UI: Object "Make Links" sub-menu overhaul
- Rename to "Link/Transfer Data".
- Move Mesh Data Transfer operators here from the Relations sub-menu.
- Clarify which operations links to, copies or transfers/projects
  data using Link, Copy and Transfer leading text.
- Re-order contents to fit each category and add separators.
- Add enum tool-tips.

Reviewed By: Blendify, campbellbarton pablovazquez, mont29

Ref D10090
2021-01-20 20:51:44 +11:00
91bf24dd00 Cleanup: clang-format 2021-01-20 20:43:58 +11:00
f0ab9034d9 Merge branch 'blender-v2.92-release' 2021-01-20 20:42:54 +11:00
aee7d8f411 Cleanup: clang-format 2021-01-20 20:42:15 +11:00
e69034e6d9 Merge branch 'blender-v2.92-release' 2021-01-20 10:16:30 +01:00
c082b21625 Fix typo in UI message.
Noted by Satoshi Yamasaki (@yamyam) in rBTS5522.
2021-01-20 10:15:59 +01:00
160d8c1ea6 Merge branch 'blender-v2.92-release' 2021-01-20 18:56:29 +11:00
fad8a753a9 Add Object Tool: adjust cursor alpha when near view aligned
The cursor-plane was too dense/bright when approaching view alignment.
2021-01-20 18:55:44 +11:00
2c31a84bd1 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:56 +11:00
1db904d954 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:53 +11:00
74c6c504b2 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:49 +11:00
908b383b7d UV: tweak face select behavior
When the mouse cursor is inside the UV face,
extend the selection threshold.

This means when zoomed in, a face can always be selected when the cursor
is inside it.
In the case of multiple overlapping faces - the face with the closest
center is used.

----

Prior to 246efd7286, the UV selection
threshold was scaled by the zoom level, so selecting a face when zoomed
in close would often often select faces even when the on-screen center
was outside the intended threshold.

Having a zoom-independent threshold may require more precision than
users are used to.

This change addresses this.
2021-01-20 17:07:20 +11:00
9f337bef80 Cleanup: move UvNearestHit.ob assignment in find nearest functions
Splitting assignments between functions complicates refactoring.

Also rename 'hit_final' to 'hit', since there are no longer a local
'hit' variable defined in these functions.
2021-01-20 17:00:39 +11:00
8bd5d58860 BMesh: add function to check if a point is inside a faces UV's 2021-01-20 16:56:59 +11:00
255c850e0b Cleanup: spelling 2021-01-20 16:15:53 +11:00
b2a6e2abdb Cleanup: remove extra in trailing asterisk
Comment blocks not conforming to convention.
2021-01-20 16:14:00 +11:00
69d30c1543 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:22 +11:00
41d1729148 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:19 +11:00
6f47549fe5 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:15 +11:00
c7f6309437 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:12 +11:00
b2037464e4 CMake: add missing headers
Resolves 'cmake_consistency_check' reports.
2021-01-20 16:08:52 +11:00
be970c03c2 Cleanup: spelling & cleanup for cmake_consistency_check
Much more could be done here, some obvious corrections.
2021-01-20 16:04:03 +11:00
d3fe320b83 CMake: update checking utility to ignore nanovdb files 2021-01-20 16:03:57 +11:00
0706a756f9 Cleanup: remove unused file SEQ_util.h
Committed by accident when SEQ_utils.h was also created.
2021-01-20 16:01:40 +11:00
6290091bac Cleanup: Store runtime space node variables in a separate struct
This commit moves runtime-only variables from the `SpaceNode`
DNA struct to a private struct in `node_intern.h`. Before, it was hard
to tell which data needed to be saved in files, this should make it
more clear.

Node that the `edittree` field is basically a runtime variable, since
it's set from the `treepath` list on read, but moving it would require
some more invasive changes that I don't think are worth it right now.
Also, not all of the moved variables were explicitly cleared on read--
`aspect` is set at the start of a redraw, `cursor` is set in a region
callback, and `recalc` was used as an update flag.

Differential Revision: https://developer.blender.org/D10141
2021-01-19 16:43:08 -06:00
da6dea5701 Cleanup: Use const arguments, explicit type 2021-01-19 16:09:34 -06:00
694032c9d1 Merge branch 'blender-v2.92-release' 2021-01-19 19:02:57 +01:00
c2e6969c56 Refactor modifier copying code.
Things like pointers to particle systems, or softbody data being stored
outside of its modifier, make it impossible for internal modifier copy
data code to be self-contained currently. It requires extra processing.

In existing code this was handled in several different places, in
several ways, and alltogether fairly inconsistently. Some cases were
even not properly handled, causing e.g. crashes as in T82945.

This commit addresses those issues by:
 * Adding comments about the hackish/unsafe parts `psys` implies when
   copying some modifier data (since we need to ensure particle system
   copying and remapping of those pointers separately).
 * Adding as-best-as-possible handling of those cases to
   `BKE_object_copy_modifier` (note that it remains fragile, but is
   expected to behave 'good enough' in any practical usecase).
 * Remove special handling for specific editor code
   (`copy_or_reuse_particle_system`). This should never have been
   accepted in ED code area, and is now handled by
   `BKE_object_copy_modifier`.
 * Factorize copying of the whole modifier stack into new
   `BKE_object_modifier_stack_copy`, now used by both `object_copy_data`
   and `BKE_object_link_modifiers`.

Note that this implies that `BKE_object_copy_modifier` and
`BKE_object_copy_gpencil_modifier` are now to be used exclusively to
copy single modifiers. Full modifier stack copy should always use
`BKE_object_modifier_stack_copy` instead.

Fix T82945: Crash when dragging modifiers in Outliner.

Maniphest Tasks: T82945

Differential Revision: https://developer.blender.org/D10148
2021-01-19 18:58:35 +01:00
bc95c249a7 Refactor modifier copying code.
Things like pointers to particle systems, or softbody data being stored
outside of its modifier, make it impossible for internal modifier copy
data code to be self-contained currently. It requires extra processing.

In existing code this was handled in several different places, in
several ways, and alltogether fairly inconsistently. Some cases were
even not properly handled, causing e.g. crashes as in T82945.

This commit addresses those issues by:
 * Adding comments about the hackish/unsafe parts `psys` implies when
   copying some modifier data (since we need to ensure particle system
   copying and remapping of those pointers separately).
 * Adding as-best-as-possible handling of those cases to
   `BKE_object_copy_modifier` (note that it remains fragile, but is
   expected to behave 'good enough' in any practical usecase).
 * Remove special handling for specific editor code
   (`copy_or_reuse_particle_system`). This should never have been
   accepted in ED code area, and is now handled by
   `BKE_object_copy_modifier`.
 * Factorize copying of the whole modifier stack into new
   `BKE_object_modifier_stack_copy`, now used by both `object_copy_data`
   and `BKE_object_link_modifiers`.

Note that this implies that `BKE_object_copy_modifier` and
`BKE_object_copy_gpencil_modifier` are now to be used exclusively to
copy single modifiers. Full modifier stack copy should always use
`BKE_object_modifier_stack_copy` instead.

Fix T82945: Crash when dragging modifiers in Outliner.

Maniphest Tasks: T82945

Differential Revision: https://developer.blender.org/D10148
2021-01-19 18:50:32 +01:00
bcdba7c34d UI: Deselect other objects when dragging into 3D View
When dragging an object into the 3D View, e.g. from the Outliner or the Asset
Browser, other objects wouldn't get deselected. That differs from what other
drop operations do, which create a new object. They deselect other objects in a
lower-level function, which happens to not be called for just dropping objects.
So I guess this is an oversight.
Old behavior was also a bit annoying because users seem to expect this to
deselect.
2021-01-19 18:47:20 +01:00
02a63115d2 Merge branch 'blender-v2.92-release' 2021-01-19 18:40:40 +01:00
c371d699ca Fix T84784: Time Remapping not displaying in the timeline
Caused by rBbbb2e0614fc3.

Oversight to not take the remapped framelength into account.

Maniphest Tasks: T84784

Differential Revision: https://developer.blender.org/D10134
2021-01-19 18:31:21 +01:00
7d114e5d87 Merge branch 'blender-v2.92-release' 2021-01-19 18:28:45 +01:00
36f0a1ead7 Fix T84823: crash rendering with unconnected input socket in File Output node
Caused by rB957e292c5864.

Now just skip unconnected sockets.

Maniphest Tasks: T84823

Differential Revision: https://developer.blender.org/D10137
2021-01-19 18:23:53 +01:00
b39ee69789 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-19 18:23:08 +01:00
d311a76931 Fix merge from 2.92 (subversion bump 292.14) 2021-01-19 18:20:12 +01:00
c3207d88c2 Object Info: Fix tooltip for the transform space option
This was agreed outside the patch discussion. And it did not make into
the submitted code on 8b777ee6d6.
2021-01-19 18:13:50 +01:00
40e089716b Merge branch 'blender-v2.92-release' 2021-01-19 18:12:34 +01:00
05179a0ba4 Volumes: fix calling BKE_volume_load from multiple threads
`BKE_volume_is_loaded` uses `grids.filepath` to determine if the
grids are already loaded. The issue was that `grids.filepath` was
set before the grids were loaded, resulting in incorrect early
returns for other threads.

Differential Revision: https://developer.blender.org/D10150
2021-01-19 18:01:22 +01:00
8b777ee6d6 Geometry Nodes - Object Info: option to apply obj transform to the geometry
By design the modified object transformations should still work and
affect the geometry nodes results. The current behaviour, however, would
make the geometry from the object info to not be affected by the
modified object transformations. This patch changes that by default.

In a similar fashion the Location, Rotation and Scale sockets outputs
should be aware of whether the output should be in the global space or in the
space of the nodetree.

To solve this, the patch introduces a new transformation space "enum"
where users can pick "Original" or "Relative" space.

Original
--------
Output the geometry relative to the input object transform, and the
location, rotation and scale relative to the world origin.

Relative
--------
Bring the input object geometry, location, rotation and scale into the
modified object maintaining the relative position between the two objects in
the scene.

Relative space violates a bit the design of the nodetree. The geometry in this
case is transformed so that moving the modified object doesn't interfere with
the geometry. This is particularly useful for the boolean node for instance.

"Original" is the default space, but old files are set to "Relative" for
backwards compatibility.

Differential Revision: https://developer.blender.org/D10124
2021-01-19 17:30:44 +01:00
9a32c7130b Geometry Nodes: pass depsgraph to nodes during execution
The depsgraph will have to be accessed in an upcoming patch.
2021-01-19 16:58:05 +01:00
d60b128274 Merge branch 'blender-v2.92-release' 2021-01-19 12:32:07 +01:00
a9203e25a2 Fix T84642: Reassign effect-strip ignores animdata
When reassigning an effect strip to another sequence, any animation data
in the effect strip will not be offset like expected.

The fix calls `SEQ_offset_animdata` to offset the animation data after
the seqence has been moved.

Reviewed By: ISS

Maniphest Tasks: T84642

Differential Revision: https://developer.blender.org/D10096
2021-01-19 12:31:02 +01:00
089cd25982 Merge branch 'blender-v2.92-release' 2021-01-19 20:43:49 +11:00
a86bb2594f Fix T84698: error adding movie clip tracks
The movie clip's `region->v2d` was being resized by the view2d code,
causing mouse cursor to movie-clip coordinate mapping to fail.

This commit removes `UI_view2d_region_reinit`,
matching the behavior for the image editor's 2D view.

Reviewed By: sergey

Ref D10106
2021-01-19 20:39:31 +11:00
df2ed1550d Fix T74755: Cap of curve doesn't have smooth shading
Copy the smooth setting when filling in curve caps.

For drawing this doesn't change behavior as a single normal is used
for all faces.

The difference may be noticed when converting to a mesh or with
modifiers applied.
2021-01-19 17:24:25 +11:00
1cc54107a9 Merge branch 'blender-v2.92-release' 2021-01-19 17:14:47 +11:00
d26588268d Merge branch 'blender-v2.92-release' 2021-01-19 17:14:43 +11:00
418cd7c4ba Fix T84041: Bevel caps have invalid normals
Bevel caps always had incorrect normals, causing display glitches
in some cases.

It seems this never worked properly (at least 2.79 also had this bug).

Use the projection vector as the normal.
2021-01-19 17:12:01 +11:00
e25f7e33ff Fix T84568: UV loop selection marks edges sharp
Regression in 6a10e69d27
(added when testing).
2021-01-19 15:32:00 +11:00
94e9d3ca3e Merge branch 'blender-v2.92-release' 2021-01-19 13:36:53 +11:00
d31dd1da80 Fix T84824: Incorrect height using interactive add tool
When using the interactive add tool for primitives with a fixed
height and base aspect ratio, the height of the created primitive
would be incorrect (two times too small or two times too big).

When the base origin was centered, the `fixed_aspect_dimension`
was not changed even though the base length was doubled.
Additionally, when the height origin was centered but the height
aspect ratio was fixed, the height was doubled leading to an
incorrect size.

The fix doubles `fixed_aspect_dimension` when the base origin is
centered and correctly calculates the height of the primitive when
the aspect ratio is set to fixed.

Ref D10140
2021-01-19 13:20:02 +11:00
2fa7e81d9c Cleanup: use 'const' argument for parameter argument 2021-01-19 12:59:00 +11:00
d144337098 Merge branch 'blender-v2.92-release' 2021-01-19 12:45:11 +11:00
58e554a55c Fix T66681: Blender 2.7x keymap inconsistencies
Match Blender 2.7x keymap more closely.

- Image Editor: F3 for save image as.
- Node Editor: Ctrl-LMB to cut links.
- Cycle the falloff types instead of showing a pie-menu.
- Use regular menu instead of pie menu for snapping.
2021-01-19 12:20:48 +11:00
09c7c63890 UI Code Quality: Use "params" struct for area and region callbacks
These functions with many arguments can be unwieldy. Aside from the obvious issues
with rewriting the list of arguments and the opportunities for error and frustration
that presents, the long list of arguments make these systems hard to change. So when
an argument should be added, someone might skip that and add some hack instead.

So, as proposed in T73586#1037210, this patch instead uses a "params" struct for
each of these callbacks.

- Use param argument for `ARegionType.listener`
    - Remove unused window field in region listener
- Use param argument for `SpaceType.listener`
- Use params struct for `ARegionType.message_subscribe`

Differential Revision: https://developer.blender.org/D9750
2021-01-18 17:28:47 -06:00
4b4aec2884 Cleanup: Clang tidy else after return 2021-01-18 14:21:24 -06:00
bfa083f873 Cleanup: Clang tidy else after return 2021-01-18 12:48:51 -06:00
40d6ee5304 Merge branch 'blender-v2.92-release' 2021-01-18 20:08:41 +03:00
b5c3f26cba Armature: fix B-Bone deformation blending artifacts with Preserve Volume.
The double quaternion blending method in addition to the deformation
matrix of each bone requires their rest matrices. For ordinary bones
this literally should use the bone rest matrix without any ambiguity.

However, it was also using the bone rest matrix for all of its
B-Bone segments, which is incorrect and causes strange deformation
in some cases involving extreme non-uniform scale, especially
at boundaries between different B-Bones. There is also a similar
known issue that happens with scale at bending joints, and this
fix reduces the distortion when both bones are B-Bones.

This changes both the Armature modifier and the Armature constraint
to use the actual segment rest matrices. Unlike bones, these can have
scale even in rest pose, so normalization is required.

Differential Revision: https://developer.blender.org/D10003
2021-01-18 20:08:16 +03:00
f17b26bbed Tracking: Implement tracks average operator
Average selected tracks into the new one. This can be used to improve
stability of tracking on blurry or non-very-sharp feature shapes.

Averaging happens for all position, pattern corners and search area.
Disabled markers do not take effect on averaging. Keyframed flag is
copied from source.

Gaps in the source tracks will be linearly interpolated, to reduce
result track jump. Note that this only applies to gaps "inbetween".
This means that if an input track doesn't have markers in the
beginning/end of it, there is nothing to interpolate with and the
result track will jump.

Available from the Track panel, under the Merge category.

Differential Revision: https://developer.blender.org/D6323
2021-01-18 16:38:40 +01:00
0ac8fec3be Tracking: Add interpolated accessor for markers
Allows to get marker position interpolated through out a gap.

Currently unused, but is covered with test. Aimed to be used for
track average operator.
2021-01-18 16:38:40 +01:00
0ca0d3366d Tracking: Re-write marker request function
There are two main things.

First, remove the marker index caching. Thins makes it possible to
safely use function from a threaded environment.

Second, replace linear search with binary search, which speeds up
random lookup.

There is no measurable difference in the stabilization which had a
comment about caching nature of track lookup. The random lookup
complexity changed from O(N) to O(log N). In practice this also
unlikely to be measurable, but thread-safety worth it.
2021-01-18 16:38:40 +01:00
f508292277 Fix T84719: Doversion for curve edit settings
Make sure default values for curve edit mode are filled for older files.

Reviewed By: antoniov

Maniphest Tasks: T84719

Differential Revision: https://developer.blender.org/D10136
2021-01-18 16:29:09 +01:00
5e0ef4ef85 Fix T84719: Doversion for curve edit settings
Make sure default values for curve edit mode are filled for older files.

Reviewed By: antoniov

Maniphest Tasks: T84719

Differential Revision: https://developer.blender.org/D10136
2021-01-18 16:23:13 +01:00
0145c8d484 Merge branch 'blender-v2.92-release' 2021-01-18 15:47:33 +01:00
0d8948387e Cycles: Fix missing OpenCL extensions in certain cases
If extensions string is longer than 1024 then the old code would have
reported empty string instead of extensions.

Now the code does dynamic string allocation to store result of request,
similar to what is done in `OpenCLInfo::get_hardware_id`.

The code looks a bit ugly, but it didn't really change much with this
patch. In other words, the code can become more modern and clear, but
it is considered to be outside of the scope of this change.

Differential Revision: https://developer.blender.org/D10135
2021-01-18 15:47:00 +01:00
ce0f212498 Merge branch 'blender-v2.92-release' 2021-01-18 15:30:48 +01:00
4fde594fda Fix T84650: CPU render + OptiX denoiser leaves empty tiles unprocessed
The OptiX denoiser is part of the OptiX device, so to the tile manager looks like a GPU device. As a
result the tile stealing implementation erroneously stole CPU tiles and moved them to that OptiX
device, even though in this configuration the OptiX device was only set up for denoising and not
rendering. Launching the render kernel therefore caused a crash because of a missing AS etc.
This fixes that by ensuring tiles can only be stolen by devices that support render tiles.
2021-01-18 15:30:25 +01:00
023ebb890b Merge branch 'blender-v2.92-release' 2021-01-18 15:02:24 +01:00
1c2b203795 Fix T84600: prevent bone groups operators on proxies and library
overrides

Editing bone groups is not supported on proxies/overrides [changes a re
lost on file reload], need to do proper polling (and also prevent this
from rna) for:

- adding bone groups
- removing bone groups
- renaming bone groups
- setting bone groups colors

Previously, this was hinted at by setting the layout inactive, with
preoper polls, this is now not needed anymore.

note: Selection of bone groups actually makes sense here and is
supported, so this is not prevented in this patch, but UI wise this is
not nice in the override case, because one cannot set an active_index
(aka select) in the UI list.

Maniphest Tasks: T84600

Differential Revision: https://developer.blender.org/D10131
2021-01-18 15:00:37 +01:00
a1fb3dc7ae Fix T84808: Individual projection works even when snap options don't affect the transform mode
Individual projection is a different branch of snap and always projects
the transformed elements on the surface of objects.

Perhaps this option should be limited to the Move mode due to similarity.

But in order not to change the current behavior too much, this commit only
disables this option in modes not affected by snap.
2021-01-18 10:57:45 -03:00
3584f1d224 Merge branch 'blender-v2.92-release' 2021-01-18 14:07:11 +01:00
b4530deec4 Fix T84586: missing Outliner redraws for certain NLA operators
Outliner display under 'Animation' > 'NLA Tracks' was not updating in
the following cases:
- adding strips
- removing strips
- duplicating strips (possibly to different track)
- swapping strips
- reordering tracks
- changing strip order by translating
- translating strips between tracks
- renaming tracks

In the case of deleting strips/tracks, this was also resulting in a use-
after-free error in Outliner drawing code (this was reported specifically
in T84586).

Most of these operators already sent a ND_NLA|NA_EDITED notifier, but the
Outliner is not listening to these. Listening to NA_EDITED is also not
what we want since this also happens a lot in cases irrelevant to the
Outliner. Now be a bit more specific and send ND_NLA|NA_ADDED / ND_NLA|
NA_REMOVED or a new ND_NLA_ORDER (to distinguish from NA_EDITED
'only' - where a redraw is not neccessary) and listen to these from the
Outliner.

(note: places that were listening to ND_NLA|NA_EDITED before are also
listening to NA_ADDED or NA_REMOVED, so changing NA_EDITED should not be
a problem here)

(note 2: for cases like swapping tracks/strips order, NA_ADDED or
NA_REMOVED does not make sense, neither can we use NA_EDITED [since we
dont want to listen to this], so in this case an additional ND_NLA_ORDER
is now sent)

(note 3: in nla transform code, this is now always sent on confirm. There
are cases were the notifier would not be needed, but checking exactly all
cases were it actually would be needed seems overkill [history of D10073
has example code to check if strips moved between tracks])

Maniphest Tasks: T84586

Differential Revision: https://developer.blender.org/D10073
2021-01-18 13:58:31 +01:00
e061bbadec Merge branch 'blender-v2.92-release' 2021-01-18 13:55:11 +01:00
dfdf79fb03 Fix T84250: Eevee world/material parameter animation not updating the viewport
The WORLD_UPDATE operation (needed to free the gpu material) was already
defined in DepsgraphNodeBuilder::build_world, but corresponding relation
was only set up for changes in the nodetree, not for changes in the
world/material itself in DepsgraphRelationBuilder::build_world.
Direct changes to these surface properties in the UI were updating
properly through RNA property update callbacks, but these are not called
from the animation system.

So now add these relations in the depsgraph.

Not 100% sure this is the right place for this (since e.g. eevee engine
seems to handle e.g. animated light paramters just fine through
EEVEE_cache_populate / eevee_light_setup, but properly freeing gpu
materials wont happen for worlds in e.g eevee_id_world_update and also
not for materials)

Maniphest Tasks: T84250

Differential Revision: https://developer.blender.org/D9959
2021-01-18 13:51:28 +01:00
95af2e39f6 Merge branch 'blender-v2.92-release' 2021-01-18 12:18:31 +01:00
9f2271d354 Fix T84739: Crash with curve brush in sculpt mode.
No idea why we did not pass context to `ED_paintcurve_undo_push_end`, it
is easily availbale everywhere...
2021-01-18 12:15:46 +01:00
6251eb8bda Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-18 12:02:55 +01:00
Karthik Rangasai Sivaraman
c85317e669 Fix T83657: Pose Mode: Clearing transform doesn't respect Mirror X
Extend the pose bone "clear loc/rot/scale" functions so that they
respect the "Mirror X" option.

Reviewed By: sybren

Maniphest Tasks: T83657

Differential Revision: https://developer.blender.org/D9938
2021-01-18 11:59:45 +01:00
Karthik Rangasai Sivaraman
f7a5695676 Fix T83657: Pose Mode: Clearing transform doesn't respect Mirror X
Extend the pose bone "clear loc/rot/scale" functions so that they
respect the "Mirror X" option.

Reviewed By: sybren

Maniphest Tasks: T83657

Differential Revision: https://developer.blender.org/D9938
2021-01-18 11:59:14 +01:00
4ef0654449 GPencil: Fix Autojoin error using layer transform
The target stroke bounding box was not checked properly and when using layer transform the error was noticeable, but really the error was before the layer transform commit.
2021-01-17 12:35:27 +01:00
502eadb2f7 Merge branch 'blender-v2.92-release' 2021-01-17 21:40:11 +11:00
ced673c833 Merge branch 'blender-v2.92-release' 2021-01-17 21:40:07 +11:00
9fb755fe4c Merge branch 'blender-v2.92-release' 2021-01-17 21:40:03 +11:00
2ee2f87f29 Add Object Tool: move extra settings popover last
This is intended to be used when settings don't fit in the top bar,
so it makes sense to keep them last.
2021-01-17 21:36:49 +11:00
06da6e2eaf Add Object Tool: scale the cursor plane based on the depth
Draw the cursor plane smaller then further away from the view.

This makes the plane being drawn onto easier to perceive.
2021-01-17 21:21:18 +11:00
5f9358a373 Add Object Tool: split aspect & origin options for base/height
In practice it's common these settings shouldn't be linked for drawing
the initial (base) plane, compared with the height.
2021-01-17 21:16:22 +11:00
14bb9f09ab Merge branch 'blender-v2.92-release' 2021-01-17 18:30:14 +11:00
54c28e5bfb Merge branch 'blender-v2.92-release' 2021-01-17 18:30:10 +11:00
ca476a638c RNA: report an error when the name property is set twice
This helps avoid copy-paste errors which have happened a few times,
no functional changes.
2021-01-17 18:24:34 +11:00
66a87fc9f4 Fix workspace tool name property
The fallback tool was used as the tool name.

Regression in a8ce9a143a
2021-01-17 18:24:34 +11:00
1e8ed36a90 Merge branch 'blender-v2.92-release' 2021-01-16 13:11:33 -06:00
Wannes Malfait
6fb7d0f559 Fix T84713: Geometry nodes reroute sockets have incorrect type
This implements the node tree update function, which is needed so that the
reroutes get updated to the correct type. It is based on the same code in
the shader and compositor node trees.

Differential Revision: https://developer.blender.org/D10123
2021-01-16 13:09:19 -06:00
4e8c78245d GPencil: Hide layer if the scale is zero
When scale a layer to zero must be hidden.
2021-01-16 19:36:00 +01:00
24cdffde55 GPencil: Cleanup - Rename ED_gpencil_stroke_color_use to ED_gpencil_stroke_material_editable 2021-01-16 16:44:49 +01:00
f5ec29023d GPencil: Fix initial value for fill factor after last changes
The value has changed due a previous commit and the minimum value cannot be 0.
2021-01-16 16:36:49 +01:00
e02d84eb3b GPencil: Add new parameteres to transform layers
When using grease pencil for drawing Storyboards, it's very common to require a transform of the layers. This transform can be done using the offset modifier, but in some cases, the scene requires a lot of modifiers and makes the file hard to work.

This new feature adds a transforms Location, Rotation and Scale at Layer level, and allows to transform the layer without using a modifier, keeping the scene more clean.

{F9480695}

This feature was suggested by @pepeland after receiving feedback from several artists.

Also, done some code cleanup and rename some functions to get a better naming.

Maniphest Tasks: T83660

Differential Revision: https://developer.blender.org/D9761
2021-01-16 15:46:45 +01:00
0a44c4b594 Merge branch 'blender-v2.92-release' 2021-01-16 15:26:43 +01:00
1e193a0b56 Fix T84757: feedback loop with when modifying vertex group with nodes
The issue was that the mesh shared its vertex weights with the
original mesh (to reduce memory consumption). The solution is
to make a local copy of the vertex weights in this case.
2021-01-16 15:24:22 +01:00
79dd9fedb2 Fix T84758: Revert "LibOverride: Also consider regular embedded IDs as virtual overrides."
This made Blender considers all materials to be overridden.

This reverts commit 2aa7bc06e7.
2021-01-16 10:28:47 +01:00
3cc1bcce4f Merge branch 'blender-v2.92-release' 2021-01-16 11:39:37 +11:00
7573631d69 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:34 +11:00
d4ffccbeae Merge branch 'blender-v2.92-release' 2021-01-16 11:39:31 +11:00
3adb9530bb Merge branch 'blender-v2.92-release' 2021-01-16 11:39:29 +11:00
3856c58f5d Merge branch 'blender-v2.92-release' 2021-01-16 11:39:27 +11:00
6403c8c025 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:23 +11:00
39b752316d Merge branch 'blender-v2.92-release' 2021-01-16 11:39:21 +11:00
66161ba3a1 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:12 +11:00
f7829961c6 Add Object Tool: include shortcuts in the tool-tip 2021-01-16 11:37:52 +11:00
ecffd231a0 Add Object Tool: add initial "Fixed Aspect" option
This makes it more convent to add many objects with a fixed aspect ratio.
2021-01-16 11:37:52 +11:00
fef7b792e7 Add Object Tool: make UI more compact
Move some of the more obscure options into a popover,
so they don't take up so much room in the top-bar.
2021-01-16 11:37:52 +11:00
cdfa3feb91 Add Object Tool: support incremental snapping
This adds a "Snap to" option that allows using all the scenes snap
settings which includes incremental & absolute grid snapping options.

This is optional because always following scene snapping would not
snap to geometry by default (which seems to be the most useful default).
2021-01-16 11:36:55 +11:00
c4bbe44e47 Add Object Tool: workaround non-orthogonal orientation matrices 2021-01-16 11:32:00 +11:00
2f0d919f89 Add Object Tool: quiet warning setting size
The size property was only used for the cube
2021-01-16 11:32:00 +11:00
8fd3ffcb31 Add Object Tool: rename keymap, expose in keymap editor
Make the name follow the convention of other View3D keymaps.
2021-01-16 11:31:35 +11:00
27c142aa29 Add Object Tool: remove from experimental
Based on feedback from @dbystedt, include this in 2.92
with some updates (coming next).
2021-01-16 11:28:02 +11:00
a8436334bd Merge branch 'blender-v2.92-release' 2021-01-15 12:23:13 -08:00
957de39191 Fix T84645 cursor moves when clicking selector.
The absolute position desktop mapping has been corrected. The correct
mapping is 0-65535 inclusive. Additionally, division by the virtual
desktop width and height needed to be subtracted by 1 as width and
height are one more than the final pixel index.
2021-01-15 12:18:13 -08:00
Aaron Carlisle
f71a7d3914 Cleanup: Remove Unused tracking properties
These properties are unused and serve no purpose.

Reviewed By: sergey, #motion_tracking

Differential Revision: https://developer.blender.org/D9803
2021-01-15 14:58:24 -05:00
fa817b8c96 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-15 12:36:35 -07:00
de60dc84e2 Fix: Build error with MSVC 2017
BKE_cryptomatte_extract_layer_name was using std::isdigit
without including <cctype> somehow only MSVC 2017 had a
problem with that.
2021-01-15 12:36:03 -07:00
bf7fdd0f67 Cleanup: LibOverride: Update comment. 2021-01-15 19:36:38 +01:00
2aa7bc06e7 LibOverride: Also consider regular embedded IDs as virtual overrides.
Those (aka root node trees and master collections) share same 'traits'
as the shapekeys: RNA cannot assign them, so we need to handle them as
sub-data of their owner IDs.

Not sure how much this will help in improving support of overrides for
scenes and nodetrees, but this is a mandatory step towards that goal for
sure.
2021-01-15 19:27:49 +01:00
ce317c9faa LibOverride: fix/update/re-enable ID-related debug checks in diffing code.
We should now have the tools to ensure consistency of ID pointers
diffing in `rna_property_override_diff_propptr`.

As a reminder, for most ID pointers we just check the actual pointer value,
but this is not possible for embedded IDs like root node trees or master
collections, and for fake embedded ones like shapekeys, so those should be
handled as mere sub-data of their owner IDs in override context.
2021-01-15 19:18:26 +01:00
f1a577b38a Merge branch 'blender-v2.92-release' 2021-01-15 19:00:46 +01:00
dc69ef6f3b Fix T84373: Overrides : shapes keys driven by armature don't work on second instance.
Code generating override operations would not deal properly with Pointer
RNA properties, trying by default to use and check pointers' names
properties like it does with items of a collection.

However, using name property in pointer RNA property case makes no
sense, so specialize the `no_prop_name` flag for each case (pointer or
collection).

here, since second override would generate local data-blocks with
different names than the linked data ones, name matching would fail and
breck handling of override diffing in shapekeys.

Note that shape keys are the only one concerned by that problem, since
other embedded IDs (root node trees and master collections) are fully
real ones, so they always get the same names.
2021-01-15 19:00:38 +01:00
5cf04fe2ba Fix (unreported) copying liboverride of mesh breaks overrides of shape keys.
Our beloved shapekeys are 'virtual' overrides, they need special
snowflake treatment here as well.

They do not have any override data, from override perspective they are
considered as mere sub-data from their owning ID (mesh, lattice, etc.).
Therefore, we should not copy override data from them, but instead
properly flag those new IDs as `LIB_EMBEDDED_DATA_LIB_OVERRIDE`.

Found while investigating T84373.
2021-01-15 19:00:38 +01:00
319056679b Fix T84373: Overrides : shapes keys driven by armature don't work on second instance.
Code generating override operations would not deal properly with Pointer
RNA properties, trying by default to use and check pointers' names
properties like it does with items of a collection.

However, using name property in pointer RNA property case makes no
sense, so specialize the `no_prop_name` flag for each case (pointer or
collection).

here, since second override would generate local data-blocks with
different names than the linked data ones, name matching would fail and
breck handling of override diffing in shapekeys.

Note that shape keys are the only one concerned by that problem, since
other embedded IDs (root node trees and master collections) are fully
real ones, so they always get the same names.
2021-01-15 18:51:04 +01:00
69a7015e12 Fix (unreported) copying liboverride of mesh breaks overrides of shape keys.
Our beloved shapekeys are 'virtual' overrides, they need special
snowflake treatment here as well.

They do not have any override data, from override perspective they are
considered as mere sub-data from their owning ID (mesh, lattice, etc.).
Therefore, we should not copy override data from them, but instead
properly flag those new IDs as `LIB_EMBEDDED_DATA_LIB_OVERRIDE`.

Found while investigating T84373.
2021-01-15 18:50:50 +01:00
3459f75f5b Merge branch 'blender-v2.92-release' 2021-01-15 11:04:53 -06:00
0b0e45252b Geometry Nodes: Use a default value in the point scale node
This commit adds the ability to provide a default value to
`attribute_try_get_for_output` and uses it for the `Point Scale` node,
which is important because the node uses multiplication.

The idea is to keep "name-specific" functionality in nodes rather than in
the attribute API, otherwise the complexity will be hard to keep track of.
So this fix doesn't apply to the Attribute Vector Math node, but hopfully
that is okay since that's now a lower level node for this purpose anyway.

Differential Revision: https://developer.blender.org/D10115
2021-01-15 11:04:32 -06:00
237e27e161 Cleanup: Add const in various places in node code
Also includes some various other minor cleanups, like using bool
instead of int in a couple places.
2021-01-15 10:48:22 -06:00
20a54347ee Tracking: Fix transform cancel for plane tracks
Use exact marker accessor. Harmless due to the current way the
transform system is used by tracking. But for the future development
proper accessor needs to be used.
2021-01-15 17:42:13 +01:00
3732508c64 Fix T84745: build error with TBB 2021
task_group::is_canceling() was removed.
2021-01-15 17:29:36 +01:00
c4286ddb09 RNA: support range-based for loops in C++ api
Cycles has a lot of code like this:
```lang=c++
BL::Object::modifiers_iterator b_mod;
for (b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
```

Range-based for loops allow us to simplify this to:
```lang=c++
for (BL::Modifier &b_mod : b_ob->modifiers) {
```

In order to support this, a collection (such as `b_ob->modifiers`) must have
a `begin()` and `end()` method, that take no parameters and return an iterator.
The `end` method already exists, but the `begin` method takes the iterator as
argument currently.

This patch adds a new `begin` method that returns the iterator. The old `begin`
method is still available to avoid breaking existing code.

My assumption is that the old `begin` method took the iterator as parameter so
that the iterator is not copied or moved, i.e. its memory address is stable and
the destructor is only called once. I'm not sure if both of these requirements
are really necessary to ensure that the iterators work correctly. To be on the
safe side, I deleted the copy/move constructors/assignment operators.

Since C++17 there is "guaranteed copy elision" which basically allows us to
return a non-copyable and non-movable type from a function. To make that work,
I had to add a new constructor to `CollectionIterator` that calls `begin` on itself.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D10120
2021-01-15 16:35:22 +01:00
Piotr Barejko
340529a845 Fix Cycles build error with OSL 1.12
Differential Revision: https://developer.blender.org/D10118
2021-01-15 15:41:17 +01:00
df96a9c6ea Merge branch 'blender-v2.92-release' 2021-01-15 11:28:15 -03:00
c63442d2f2 Fix T84673: Skin resize operator always using object origin as pivot
The TransData converted to work in Skin Resize had no defined center.

Caused by rB54ee4109143b
2021-01-15 11:24:45 -03:00
cab6d5e94a Merge branch 'blender-v2.92-release' 2021-01-15 08:19:19 -06:00
6c840a2cb9 Fix "Make Instances Real" to work with nodes modifier instances
This commit changes the check at the beginning of the
"Make Instances Real" operator to account for the instances
created by nodes modifiers in the modifier stack.

Differential Revision: https://developer.blender.org/D10059
2021-01-15 08:18:52 -06:00
a51584dc70 Geometry Nodes: transfer corner and point attributes in Point Distribute node
If the mesh has any corner or point attributes (e.g. vertex weights or
uv maps), those attributes will now be available on the generated points
as well.

Other domains can be supported as well. I just did not implement those yet,
because we don't have a use case for them.

Differential Revision: https://developer.blender.org/D10114
2021-01-15 12:00:38 +01:00
04572f0899 Cleanup: spelling 2021-01-15 12:23:50 +11:00
dc59955481 Cleanup: use 'pragma once' 2021-01-15 12:17:11 +11:00
f03752b92f Nla: Rename NlaEvalChannel->valid to domain
For term consistency with usage.

The clarity is more for consistency with the nla domain() processing
function names and the core struct member name it stores the results
in, "valid". The name "domain", which implies a function can operate
on it, seems more natural than "valid", which implies something is
wrong if false.

No functional changes.

Reviewed by: sybren

Differential Revision: http://developer.blender.org/D9692
2021-01-14 19:27:46 -05:00
10ce2a1016 NLA: Redundant NlaEvalChannel Valid Mask Write
The field will already be properly written to in (anim_sys.c)
nla_eval_domain_action(). It's easier to understand the property's
usage after removing the redundancy.

No functional changes.

Reviewed by: ChrisLend, sybren

Differential Revision: http://developer.blender.org/D9689
2021-01-14 19:04:40 -05:00
32e4ded24b Nla Refactor: is_fcurve_evaluatable()
No functional changes.

Future patches {D8867} {D8296} make use of it.

Reviewed by: sybren, ChrisLend

Differential Revision: http://developer.blender.org/D9691
2021-01-14 18:47:12 -05:00
09709a7e64 Nla Refactor: Split animsys_evaluate_nla()
No intended functional changes.

Refactors animsys_evaluate_nla() into 2 versions:
animsys_evaluate_nla_for_keyframing(), animsys_evaluate_nla_for_flush()
to make it clear what data is being calculated and why.

Dummy strip creation has been refactored to two separate functions,
animsys_create_tweak_strip() and animsys_create_action_track_strip().
Both are evaluated differently from other strips and eachother. There's
no need to interweave them. A future patch D8296, generally requires
both strips.

___

XXX anim_sys.c) nlatrack_find_tweaked() is a temporary work around.
If anyone has any insight into this problem, help is appreciated.

Reviewed by: sybren

Differential Revision: http://developer.blender.org/D9696
2021-01-14 18:25:01 -05:00
b75552ebbb UI: Draw socket type colors on the left in group sockets list
Previously the colors were on the right for outputs, but this is now
unecessary because of the organization in separate panels after
rBb1d1a58c77fb1658.
2021-01-14 16:49:20 -06:00
40d391fa60 Fix T81533: NLA Properly Draw FModifiers
When NLA strips weren't time-aligned with the underlying action, then
fcurve modifiers would not be drawn anchored to the strip. Fmodifiers
were evaluating properly, they just weren't drawn with the proper
offset and scale.

To fix it in this specific case, I've chosen to undo the keyframe
remapping then remap the draw-evaluation-time from scene time to
fcurve time. Afterward, I redo the keyframe remapping so the controls
are properly drawn.

The Envelope fmodifier has special drawing code which was fixed too. In
this case, no mapping at all was happening. The solution was similar,
to remap the envelope control points from fcurve time to scene time.
2021-01-14 16:50:14 -05:00
Cody Winchester
7a4bdc3a4f Gpencil Noise - Add noise offset parameter
This patch adds a noise offset option to the grease pencil noise modifier.
It allows the user to animate the noise along the length of the stroke to create movement that is currently not possible.

It works by adding an offset to the noise table and adding the remaining floating point value to the noise table sampling.

Reviewed By: #grease_pencil

Differential Revision: https://developer.blender.org/D10021
2021-01-14 22:25:36 +01:00
Lukas Stockner
0f2ae614a1 Use mmap() IO for reading uncompressed .blends
Instead of submitting tons of tiny IO syscalls, we can speed things up
significantly by `mmap`ing the .blend file into virtual memory and directly
accessing it.

In my local testing, this speeds up loading the Dweebs file with all its
linked files from 19sec to 10sec (on Linux).

As far as I can see, this should be supported on Linux, OSX and BSD.
For Windows, a second code path uses `CreateFileMapping` and
`MapViewOfFile` to achieve the same result.

Reviewed By: mont29, brecht

Differential Revision: https://developer.blender.org/D8246
2021-01-14 22:03:29 +01:00
30dd31a7b3 Fix T81533: NLA Properly Draw FModifiers
When NLA strips weren't time-aligned with the underlying action, then
fcurve modifiers would not be drawn anchored to the strip. Fmodifiers
were evaluating properly, they just weren't drawn with the proper
offset and scale.

To fix it in this specific case, I've chosen to undo the keyframe
remapping then remap the draw-evaluation-time from scene time to
fcurve time. Afterward, I redo the keyframe remapping so the controls
are properly drawn.

The Envelope fmodifier has special drawing code which was fixed too. In
this case, no mapping at all was happening. The solution was similar,
to remap the envelope control points from fcurve time to scene time.
2021-01-14 15:13:26 -05:00
33a558bf21 Geometry Nodes: support accessing UV layers with attribute system
Note that uv layers still can't be accessed with nodes, because those
only access attributes on the point domain currently, while uv data
is stored per corner. Implicit domain conversion hasn't been
implemented yet.
2021-01-14 18:11:44 +01:00
5c1b740f1e Geometry Nodes: add implicit conversions for float2 and others
Some of these conversions are arbitrary to some degree.
However, the user experience is better when at least something
happens when converting between types, instead of just getting
zeros. I left out a few conversions that I wasn't sure about yet.

I also added conversions for float2.
2021-01-14 18:02:59 +01:00
0815e2fdb1 Fix automated tests when building with GCC and march=native
When building with more aggressive optimization flags, GCC will add FMA
(Fused Multiply Add) instructions that will slightly alter the floating
point operation results.

This causes some automated tests to fail in blender.

In clang and the intel compiler ffp-contract is set to off per default
it seems from my research.  (They do not have the exact same setting,
but the default seems to match the off behavior)

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D9047
2021-01-14 17:37:39 +01:00
406d747695 Fix automated tests when building with GCC and march=native
When building with more aggressive optimization flags, GCC will add FMA
(Fused Multiply Add) instructions that will slightly alter the floating
point operation results.

This causes some automated tests to fail in blender.

In clang and the intel compiler ffp-contract is set to off per default
it seems from my research.  (They do not have the exact same setting,
but the default seems to match the off behavior)

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D9047
2021-01-14 17:32:21 +01:00
9131c697dd Merge branch 'blender-v2.92-release' 2021-01-14 15:55:51 +01:00
e5ee7e9a2d Geometry Nodes: don't delete existing attribute before new attribute is computed
This fixes the behavior of some nodes when the same attribute
name is used for input and output. If both attributes have a
different type, they can't exist at the same time. Therefore,
the input attribute has to be removed in order to create the
output attribute.

Previously, the input attribute was remove before it was used
in any computations. Now, the output is written to a temporary
buffer and only later saved in the geometry component. This
allows both attributes to coexist within the node.

The temporary attribute is only create when necessary. The
normal case without name collisions still works the same
as before.

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

Ref T83793.
2021-01-14 15:52:08 +01:00
8795514384 Merge branch 'blender-v2.92-release' 2021-01-14 15:19:24 +01:00
8ed7ed0255 Geometry Nodes: extract function for adding attributes in distribute node
This shouldn't have any functional changes.
2021-01-14 15:16:20 +01:00
53bd58993e Fix T84167: Saving half-float EXR might result in NaN pixels
Clamp value to the -HALF_MAX .. HALF_MAX.

The non-clamped values were causing NaN and inf values saved to
the file, which was the root cause of glare node giving unexpected
result.

The nan/inf on overflow is something mentioned in the half data
type in OpenEXR header.

Differential Revision: https://developer.blender.org/D10105
2021-01-14 14:54:08 +01:00
3cc7e2ad9d Fix various issues with regions in Asset Browser
Fixes a number of glitches, e.g. the sidebar disappearing when selecting an
asset or wrong AZones (the little chevrons to indicate a hidden region).

There were a couple of issues:
* Execution region was created, but not used.
* If an execution region already existed when refreshing the area, it was
  tagged as hidden, not removed.
* The sidebar was always set to be hidden on refreshes.
* When toggling from Asset Browser to File Browser as regular editor (i.e. not
  opened temporary via Ctrl+O or such), the sidebar region wasn't removed.

Adresses T83644.
2021-01-14 13:45:22 +01:00
Sebastian Parborg
74f6b81c12 Tests: skip OSL render tests in build without OSL
Differential Revision: https://developer.blender.org/D9990
2021-01-14 13:14:43 +01:00
4e90266fd8 Tests: enable bake and shader raytracing tests for OptiX
These are now supported and so can be tested.

Also refactor the code a bit to move Cycles specific blacklist out of generic
render test code.
2021-01-14 13:14:43 +01:00
6704372f04 GPencil: Allow small resolution for Fill tool
Now the resolution can be reduced to get less details. This is very useful for doing storyboards to get a quick fill of any character.

Following UI review, the name "Resolution" has been changed to "Precision" because is more clear.

Differential Revision: https://developer.blender.org/D10076
2021-01-14 12:57:17 +01:00
10423d462a Geometry Nodes: output color from Attribute Color Ramp node
The other output types did not work currently anyway.
There is not a significant benefit in somehow deducing the output
attribute type from the existing attribute types.
2021-01-14 12:44:37 +01:00
6f28c199b3 Cleanup: ed_undo: naming of parameters, const, etc.
No behavrioral change expected here.
2021-01-14 12:02:51 +01:00
a0029a678f Cleanup/refactor: Remove logically broken code from GPencil undo.
`ED_undo_gpencil_step` only support valid undo step direction, passing
step name here is useless and only add confusion to what works or not.

Undo by step name or step index is fully not supported by GPencil undo
mode currently.

Note that since GPencil undo mode does not seem to ever be used anyway,
this is not an urgent issue in practice, but this needs to be cleaned up
at some point. See also T84703.
2021-01-14 12:02:51 +01:00
8cdd701b45 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-14 11:42:22 +01:00
442b6e5e09 MeshCache: add error handling to fread() calls
Handle return value of `fread()`, by showing an error message when the
file cannot be read from and stopping further processing. Not only is
error handing a good idea, it also prevents GCC from warning that the
return value of `fread()` should not be ignored.

This is similar to {D9916}.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10079
2021-01-14 11:38:14 +01:00
9e038a2c6b Tracking: Make transform cancel use explicit frame number
Before transform cancel will request marker at a current frame number
and restore transform flags to it. This worked fine if there was only
one marker from track in the transform data. This did not work correct
when multiple markers from track were added to transform data.

This allows to implement proportional editing in the clip editor.
2021-01-14 11:37:36 +01:00
4b1112c8c9 Tracking: Fix wrong projection for post-draw pass
Allows to draw proportional editing circle at a proper location.
2021-01-14 11:37:36 +01:00
5cf87b4a8e Tracking: Re-duplicate logic used to count and initialize data
Allows to easily implement more comprehensive checks about which
markers get added to the transformation context.

No user measurable changes are expected, purely house-keeping to
ease an upcoming development.
2021-01-14 11:37:36 +01:00
ab536824a6 Tracking: Simplify transform code
Reduce amount of duplicated pointer offset logic: advance transform
data pointers deep in the loop rather than have offset duplicated in
the outer loop.

Array size calculation still has duplicated, but that is another story.
2021-01-14 11:37:36 +01:00
4b0871af87 Bmesh: Deprecate deform parameter of from_object()
The deform parameter of the Bmesh from_object method is deprecated,
always assumed to be True, and will be removed in version 3.0.

That is because the cases where it is False don't work correctly and are
subject to memory leaks. One of the symptoms of the incorrect behavior
is the application of constructive modifiers twice if the input object
is an evaluated one, as demonstrated in D10053.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D10086
2021-01-14 12:20:46 +02:00
Cody Winchester
3191b76eb5 GPencil: Noise Modifier - Move noise seed value outside of randomize subpanel
Currently the grease pencil noise modifier seed value is under the randomize subpanel.

Moved the seed value outside of this panel because it doesn't only change the noise when using the randomize option. Moving the seed value prevents it from being hidden/greyed out so the user can manually keyframe it to control the noise animation.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D10020
2021-01-14 11:10:33 +01:00
024ac9c089 Fix T84549: Keymap presets written without repeat enabled
Key map items using TEXTINPUT didn't include the repeat setting.
2021-01-14 20:52:36 +11:00
e7c36ce43c GPencil: Disable Multiframe edition when play animation
When the multiframe is enabled, playing animation must be disabled or the animation is not visible,

{F9527854}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9930
2021-01-14 10:44:45 +01:00
3e4dd7b000 Merge branch 'blender-v2.92-release' 2021-01-14 15:55:34 +11:00
a4226a050b Fix T64518: Blender 2.7 keymap inconsistencies
- Add missing Shift-Space for toggle maximize area.
- Add missing Alt-F10 for toggle fullscreen area.
- Match 2.7x keymap for setting the pivot center.
2021-01-14 15:53:06 +11:00
646f1cc89a Merge branch 'blender-v2.92-release' 2021-01-14 11:50:55 +11:00
f64746177f Fix add-object tool snap placement when activated from tweak event
When activating add-object from from a tweak event (default keymap),
the snap gizmo could snap to a new location while dragging.

Workaround this by re-calculating the snap position where the tweak
event starts.

Reported T57210#1077747
2021-01-14 11:50:08 +11:00
0876829e7a Merge branch 'blender-v2.92-release' 2021-01-14 10:58:19 +11:00
5804bf25bd Fix uninitialized stack memory use accessing the snap normal
Using the add-object tool, snapping to object types such as
curve, armature ... etc, copied uninitialized stack memory.
2021-01-14 10:55:49 +11:00
c13383da41 Cleanup: use enum for undo step direction
The step direction was confusingly 1 for undo, -1 for redo.
This convention is from 2004 (562d6958cb).

Use enum for ed_undo.c for better readability.
2021-01-14 09:53:38 +11:00
01b9dfeab4 Fix T84684: Undo operators not working
Mistake in 2771dfd563. The commit left the new editors operator registration
in `ed_util_ops.c`, but removed the function call to it.
In other words, the ED-utils operators were not registered.
2021-01-13 23:41:14 +01:00
73169628a1 Fix T84684: Undo operators not working
Mistake in 2771dfd563. The commit left the new editors operator registration
in `ed_util_ops.c`, but removed the function call to it.
In other words, the ED-utils operators were not registered.
2021-01-13 23:39:04 +01:00
b6aa8daf49 Fix T84645 cursor moves when clicking selector.
The absolute position desktop mapping has been corrected. The correct
mapping is 0-65535 inclusive. Additionally, division by the virtual
desktop width and height needed to be subtracted by 1 as width and
height are one more than the final pixel index.
2021-01-13 14:07:49 -08:00
c4c2c4bdb8 Merge branch 'blender-v2.92-release' 2021-01-13 14:33:53 -06:00
cf9709fd1e Fix T84686: Node vector socket default values not animate-able
{rB1d3b92bdeabc} disabled animating other properties of the socket default
values, like the "min" and "max" properties, as well as the "default_value"
of the "default_value". That naming confusion lead to the commit
inadvertently removing animation for the vector socket in RNA.

I checked that the other socket types don't have the same issue.
2021-01-13 14:33:28 -06:00
21b9231d7f Transform: geodesic distances for proportional edit connected mode
Use approximate geodesic distance computatiom that crosses through triangles
rather than only along edges. Using only edges would give artifacts already
on a simple grid.

Fixes T78752, T35590, T43393, T53602

Differential Revision: https://developer.blender.org/D10068
2021-01-13 18:24:33 +01:00
00b2c7c5cc Merge branch 'blender-v2.92-release' 2021-01-13 11:21:09 -06:00
9dab489d51 Bump file subversion after recent node versioning commit 2021-01-13 11:16:11 -06:00
08ee5573a9 Fix Python warnings in node editor after revert of datablock changes
Revert was done in 2771dfd, ref T84669
2021-01-13 18:06:39 +01:00
09fe0e8aa9 Nodes: use green color again for shader sockets and shader category
The green is still distinct from the more turquoise use for geometry, and
they are never used in the same node graph. The use of red makes sense, but
would need changes to other sockets and categories to set it apart well.

Ref T82689
2021-01-13 18:00:14 +01:00
d08ec3120f Revert "2.92 splashscreen"
This reverts commit 5d826866a3.
2021-01-13 17:49:28 +01:00
84c08748d8 Revert "Blender 2.92 beta - bcon3"
This reverts commit cfc9b95abd.
2021-01-13 17:49:24 +01:00
a60e270efb Merge branch 'blender-v2.92-release' 2021-01-13 17:49:08 +01:00
8ad305382e Blender 2.93 bcon1 - alpha
Bump the version number for the new release cycle.
2021-01-13 17:33:27 +01:00
5d826866a3 2.92 splashscreen
Credit: Joanna Kobierska - artstation.com/joanna_kobierska
2021-01-13 17:33:22 +01:00
cfc9b95abd Blender 2.92 beta - bcon3
Bump the release cycle to beta. This also hides away the experimental features
from the user interface.
2021-01-13 17:33:22 +01:00
1f4c1c5fc7 Geometry Nodes: Add "Point Translate" and "Point Scale" nodes
The translate node moves every point in the geometry, and the scale
node multiplies the "scale" attribute of the input geometry by its input.
While these operations are already possible with the "Attribute" nodes,
these new nodes fit nicely with the nodes specifically for changing the
"rotation" attribute that already exist, and they provide a simpler way
to do the same thing.

Differential Revision: https://developer.blender.org/D10100
2021-01-13 10:32:06 -06:00
bae4d00e2a UI: Use gray color for float sockets in nodes
The shade is too close to RGBA sockets.

Related to T82689
2021-01-13 17:17:54 +01:00
7d749720ad UI: Use capital letters for X Y and Z axes
Also add another comma and use plural "axes".
2021-01-13 10:13:00 -06:00
8df0268e2b Geometry Nodes: Rename "Rotate Points" to "Point Rotate"
This is consistent with the other node names, giving (almost) all of the
nodes in the "Point" category the same prefix.
2021-01-13 10:10:25 -06:00
80578a9d54 Geometry Nodes: Rename boolean input sockets
"Geometry A" becomes "Geometry 1", just to be more consistent
with other nodes.
2021-01-13 10:00:20 -06:00
2771dfd563 UI: Revert design changes to data-block selector for the 2.92 release
Partially reverts 2250b5cefe.

Removing the user count and fake user count icons was controversial (which was
expected) and there are a few further changes needed, that won't make it in
time for the release, see D9946.
While there is a design to bring back the user count and fake user indicators,
a new design idea was proposed that the UI team wants to follow. This came too
late for the 2.92 release, the new design is targeted at the 2.93 release now.
Meanwhile, UI team decision was to simply revert the design changes.

The new design is being worked on in https://developer.blender.org/T84669.

Note that this commit does not revert some internal changes done in
2250b5cefe. Namely the introduction of `ed_util_ops.c` and data-block
operators in there. These will still be needed in the new design.
2021-01-13 15:31:02 +01:00
ad4202a14f Cleanup: Remove unecessary namespace prefixes 2021-01-13 08:29:03 -06:00
89f490932f Geometry Nodes: Enable exposing object and collection sockets
This patch allows connecting wires for object and collection socket
types to the "Group Input" node, which exposes them to be adjusted
in the modifier.

Thanks to @angavrilov's recent work in rB8964c02348f6, it is now
possible to edit pointer IDProperties in the interface when they are
drawn with `uiItemPointerR`.

This patch is composed of a few changes:
  - Add code to create pointer properties in the modifier settings for
    object and collection sockets, and also to draw them in the UI.
  - Also search through the modifier's `IDProperty` settings to find IDs
    used by the modifier.
  - Change the setting's UI layout to support the change.

Differential Revision: https://developer.blender.org/D10056
2021-01-13 08:13:57 -06:00
Eric Bickle
55c56f1ffb Fix T79356: Improved icons for MSIX builds
Fixed an issue that was causing the app icon to render with a
'plated' background color in the taskbar and other areas of Windows.

Updated all app icons in Microsoft Store package to match Microsoft's
design recommendations.

Added multiple scales for app icons for high resolution displays.

Added high contrast app icons.

Reviewed By: pablovazquez, jmonteath

Maniphest Tasks: T79356

Differential Revision: https://developer.blender.org/D9681
2021-01-13 14:42:05 +01:00
5f411f7f38 Revert "Fix T79356: Improved icons for MSIX builds"
This reverts commit 78011d712d.
2021-01-13 14:31:52 +01:00
Eric Bickle
78011d712d Fix T79356: Improved icons for MSIX builds
Fixed an issue that was causing the app icon to render with a
'plated' background color in the taskbar and other areas of Windows.

Updated all app icons in Microsoft Store package to match Microsoft's
design recommendations.

Added multiple scales for app icons for high resolution displays.

Added high contrast app icons.

Reviewed By: pablovazquez, jmonteath

Maniphest Tasks: T79356

Differential Revision: https://developer.blender.org/D9681
2021-01-13 13:32:00 +01:00
d985751324 Geometry Nodes: improve Point Distribute node
This greatly simplifies the Point Distribute node. For a poisson disk
distribution, it now uses a simpler dart throwing variant. This results
in a slightly lower quality poisson disk distribution, but it still
fulfills our requirements: have a max density, minimum distance input
and stability while painting the density attribute.

This new implementation has a number of benefits over the old one:
* Much less and more readable code.
* Easier to extend with other distribution algorithms.
* Easier to transfer more attributes to the generated points later on.
* More predictable output when changing the max density and min distance.
* Works in 3d, so no projection on the xy plane is necessary.

This is related to T84640.

Differential Revision: https://developer.blender.org/D10104
2021-01-13 12:44:17 +01:00
ed1042ee06 Geometry Nodes: cleanup attribute usage
Now that typed attribute wrappers don't need to own the
attribute anymore, many `std::move` calls can be removed.
2021-01-13 12:27:38 +01:00
76fd41e9db Depsgraph: Remove redundant copy-on-write operations
This change removes copy-on-write operations from ID nodes which do not
need copy-on-write.

Should be no functional changes, as before the copy-on-write operation
would do nothing for those nodes anyway.
2021-01-13 12:13:35 +01:00
0f95f51361 Fix T83411: Crash when using a workspace/layout data path in a driver
Building IDs which are not covered by copy-on-write process was not
implemented, which was causing parameters block not present, and, hence
causing crashes in areas which expected parameters to present.

First part of this change is related on making it so Copy-on-Write is
optional for ID nodes in the dependency graph.

Second part is related on using a generic builder for all ID types
which were not covered by Copy-on-Write before.

The final part is related on making it so build_id() is properly
handling ParticleSettings and Grease Pencil Data. Before they were not
covered there at all, and they need special handling because they do
have own build functions.

Not sure it worth trying to split those parts, as they are related to
each other and are not really possible to be tested standalone. Open
for a second opinion though.

Possible nut-tightening is to re-organize build_id() function so
that every branch does return and have an assert at the end, so that
missing ID type in the switch statement is easier to spot even when
using compilers which do not report missing switch cases.

As for question "why not use default" the answer is: to make it more
explicit and clear what is a decision when adding new ID types. We do
not want to quietly fall-back to a non-copy-on-write case for a newly
added ID types.

Differential Revision: https://developer.blender.org/D10075
2021-01-13 12:13:34 +01:00
2cd091e9c7 Fix Cycles not taking into account CYCLES_SHADER_PATH for finding stdcycles.h
Contributed by howetuft.

Differential Revision: https://developer.blender.org/D9973
2021-01-13 12:12:36 +01:00
Jesse Y
dc170a6d67 Fix: popout windows are sized incorrectly on high DPI screens
There should be a conversion to native pixel size as expected by GHOST at the
window manager level, the dimensions at screen level do not need a conversion.

Differential Revision: https://developer.blender.org/D9976
2021-01-13 12:12:36 +01:00
8964c02348 RNA: allow editing pointer IDProperty values from the UI.
Currently it is not possible to edit bare IDProperty pointer
values which are not explicitly defined through python via
UI fields. This is likely mostly because, unlike numeric values,
pointers aren't marked PROP_EDITABLE by default. However there
are also some bugs in the RNA code that need fixing.

The Geometry Nodes modifier uses bare properties to store
input settings for the node group it wraps, so supporting
Object and Collection sockets requires editable pointers.

This patch marks bare IDProperties editable, and ensures
that changing ID pointers rebuilds the dependency graph.
A type check is needed because an IDPROPERTY PointerPropertyRNA
can actually wrap a group value rather than an ID pointer.

Making pointers editable is not likely to accidentally
affect UI fields that were not intended to be editable,
because a simple `layout.prop` cannot determine which
datablocks to display in the menu and remains read-only.

The PROP_NEVER_UNLINK flag is also removed: it seems it
was added because the edit field that couldn't produce
a menu to set the pointer used to still display the unlink
button, but that seems not to be the case anymore.

Actual support for Object & Collection inputs in the modifier
is added in D10056, which can be used to test this code.

Differential Revision: https://developer.blender.org/D10098
2021-01-13 14:09:31 +03:00
8185d07ace RNA: fix a crash when setting bare IDProperty pointers.
The rna_idproperty_check call should be done before accessing
the prop pointer so that it can detect IDProperty values and
replace them with the actual PointerPropertyRNA object.

Ref D10098
2021-01-13 14:09:31 +03:00
38df935c09 Fix T84646: Compositor: In Blender 292 "Set Alpha" node is undefined
Incorrect version code introduced by 9dbea1db66 would not check inside
node groups.
2021-01-13 12:07:26 +01:00
aed5b88ec1 Asset System: Disable Asset Browser as experimental feature
The Asset Browser will be disabled and not available for the 2.92 release. In
alpha/beta builds, there will be an "Asset Browser" option under Preferences >
Experimental, if the developer extras are enabled.
Note that this also disables related UI elements (e.g. "Mark Asset" buttons,
Preferences settings for asset libraries, etc.).

The code is still in master of course, development and testing will continue
there. But there simply needs to be too much polishing and fixing before the
2.92 release, plus there are some design decisions to be reevaluated.

Check the milestone 1 project to follow ongoing work:
https://developer.blender.org/project/view/124/
2021-01-13 11:10:17 +01:00
Robert Guetzkow
27b78c9c94 Compositor: "Save as Render" for the file output node
This commit adds the "Save as Render" feature to the file output node,
that allows to disable the application of the configured view transform
and other color management settings on the image. If disable it uses
the standard view transform instead. This feature was originally
suggested in T83842 and is part of the color management improvements
task in T68926. With this feature it is possible to toggle the
application of the color management settings for each input socket
of the File Output node individually.

Reviewed By: brecht

Maniphest Tasks: T68926, T83842

Differential Revision: https://developer.blender.org/D9921
2021-01-13 11:04:02 +01:00
614bd239f8 Geometry Nodes: support optional ownership for typed attributes
This will simplify some code in an upcoming commit and will be
useful for T83793.
2021-01-13 10:48:39 +01:00
7b68d0679e Cleanup: rename enum for event value items
This contains all value items (with overlapping values),
name this to make it clear it contains all items.
2021-01-13 19:58:57 +11:00
7af8271c34 Fix WM_event_print error printing tweak events value 2021-01-13 19:56:49 +11:00
ba44919601 Fix Event.value RNA access with tweak event types
Accessing event.value would return unrelated values such as
PRESS, RELEASE, CLICK... etc. instead of NORTH, SOUTH... etc.
2021-01-13 19:56:40 +11:00
0b711e6758 Fluid: Updated Mantaflow source files
Includes minor fixes / cleanups from the viscosity plugin.
2021-01-13 09:49:38 +01:00
3f7c294a95 Mix modifiers test after commit to bevel modifier defaults
{rB6b5e4ad5899d} neglected to update the modifier tests to reflect
the fact that the default limit method is no longer "NONE".
2021-01-12 23:54:46 -06:00
97a6b3ceee Cleanup: use single quotes for enum literals 2021-01-13 16:41:12 +11:00
37c5552742 Fix memory leak with image drag and drop
Dragging an image from the file selector into the sequencer
was leaking memory.

Regression in b5d778a7d4.
2021-01-13 16:23:14 +11:00
Philipp Oeser
5d99199880 Fix T83084: Smart UV Project inverts the resulting UVs
Caused by 850234c1b1,

Flip the normal to avoid flipped projection.
2021-01-13 13:37:14 +11:00
92826a921c Cleanup: spelling 2021-01-13 13:21:29 +11:00
bc58425862 Cleanup: clang-format, trailing space 2021-01-13 13:15:22 +11:00
b9e02eace6 UI: Clarify the property name of "F-Curve Visibility"
"F-Curve Visibility" is a bad UI label for a property that only affects
the display of unselected F-Curves. This commit clarifies the property
name by making it more specific with the word "Unselected", and by using
the word "Opacity". "F-Curve" is redundant in the UI label anyway because
it is included in the panel title.

Resolves T82587

Differential Revision: https://developer.blender.org/D10027
2021-01-12 19:14:57 -06:00
6b5e4ad589 Bevel Modifier: Use angle limit method by default
This right click select post outlines the reasons to make "Angle" the
default limit method: https://blender.community/c/rightclickselect/BVfbbc/
In short: Beveling every single edge rather than just sharp edges is
rarely the desired behavior, and the placement of the property in the UI
makes it easy to see the property's importance and toggle it.

Differential Revision: https://developer.blender.org/D8961
2021-01-12 18:55:27 -06:00
719bea0d6d Geometry Nodes: Output the most complex attribute data type
In order to avoid losing information, it sometimes makes sense for the
output attribute type to depend on the types of the input attributes.

Such a function already exists, `attribute_data_type_highest_complexity`,
it just needs to be used in a few more places. The change for the attribute
compare node is just so the code there uses the same code style as in the
attribute mix node.

Addresses part of T83793
Differential Revision: https://developer.blender.org/D10099
2021-01-12 14:03:35 -06:00
Aaron Carlisle
6c15b70279 UI: Update Clip Tracking menus
- Add operators that previously could only be found in panels
- Re order menus to match other menus
- Organize Code

|Before|After|
|{F9493583}|{F9493584}|
|{F9493585}|{F9493586}|
|{F9493588}|{F9493590}|
|{F9493591}|{F9493592}|

Reviewed By: sergey, sebastian_k, #motion_tracking

Differential Revision: https://developer.blender.org/D9781
2021-01-12 14:45:20 -05:00
bf5d45fd99 Cleanup: Fix incorrect function name
The function used "domain" incorrectly where it meant "data type".
2021-01-12 11:47:51 -06:00
abbc43e4e4 Fix T84397: Creating and removing many objects very quickly causes a crash
The root of the issue was caused by the dependency graph using ID pointer
to map evaluated state from old depsgraph to new one upon relations update.
This was failing when IDs were re-allocated rapidly: was possible that
Object ID's evaluated state assigned to Mesh and vice versa.

Now depsgraph uses Session UUID to identify which IDs to restore evaluated
state to. The session UUID is stored in the IDNode, so that id_orig is not
dereferenced on depsgraph update since the ID might be freed.

The root of the issue is identified by Campbell, original patch was done
by Bastien, thanks! Also thanks to Oliver and Ray and everyone else for
testing!
2021-01-12 17:16:48 +01:00
957e292c58 Fix T64953: Add cryptomatte meta data to file output node.
This change will try to add meta data when using a multilayered open
exr file output node in the compositor. It adds the current scene meta
data and converts existing cryptomatte keys so it follows the
naming that is configured in the file output node.

This change supports the basic use-case where the compositor is
used to output cryptomatte layers with a different naming scheme to
support external compositors. In this case the Multilayered OpenEXR
files are used and the meta data is read from the render result.

Meta data is found when render layer node is connected with the
file output node without any other nodes in between. Redirects and empty
node groups are allowed.

The patch has been verified to work with external compositors.
See https://devtalk.blender.org/t/making-sense-of-cryptomatte-usage-in-third-party-programs/16576/17

See patch for example files.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D10016
2021-01-12 16:24:26 +01:00
c3b68fa7b1 Fix T81965: Library-Override Not able to edit Keyframe properties
Fix keyframe properties not being editable when animating a
library-overridden datablock.

The problem was that RNA pointers were created based on the datablock
affected by the animation (for example an Object), instead of the
datablock that contains the FCurve itself (the Action). The latter can
be local to the current blend file and should thus be editable, even
when the former is not.

Reviewed By: mont29

Maniphest Tasks: T81965

Differential Revision: https://developer.blender.org/D10091
2021-01-12 15:43:42 +01:00
c96d596f43 GPU: Remove Limited Support AMD Polaris
Removing the limited support message as the known opengl issues of the
recent drivers with polaris cards have been tackled.
2021-01-12 13:54:50 +01:00
b2ad52a763 Tests: skip unit test if built without ocean sim modifier
Disable the Ocean Sim test when building with `WITH_MOD_OCEANSIM=OFF`.
2021-01-12 13:50:29 +01:00
e0a4b392f3 Cleanup: use exact check for fread, move out of the loop
Without this, additional items could be added in the future
which wouldn't be included in the check.

Move the check out of the loop since this is such an unlikely
situation that checking every iteration isn't needed.

Also remove redundant casts.
2021-01-12 23:31:34 +11:00
28b17ef0e6 Cleanup: replace 'long long' with int64_t in imbuf indexer 2021-01-12 23:31:34 +11:00
3b77bd48f9 Geometry Nodes: new Align Rotation to Vector node
This adds a new Align Rotation to Vector node based on the mockup
in T83669.

Reviewers: HooglyBoogly, simonthommes

Differential Revision: https://developer.blender.org/D10081
2021-01-12 12:55:14 +01:00
3a254b93fd Geometry Nodes: support reading from spans of WriteAttribute
Previously, the span returned by `WriteAttribute`s might not contain the
current value of the attribute for performance reasons. To avoid some
bugs, the span now always contains the old values (they might have to
be copied over from the internal storage, dependending on how the
attribute is stored).
The old behavior is still available with the `get_span_for_write_only`
method. The span that it returns might not contain the current
attribute values. Therefore, it should only be used when you want
to overwrite an attribute without looking at the old values.
2021-01-12 12:50:29 +01:00
58dae919e5 Weight Paint: avoid creating very small values with locked weights.
When painting using Auto-Normalize or Lock Relative with some
groups locked, the locked weights may not add up precisely to
1 because of precision limitations, which results in creating
nonzero weights close to FLT_EPSILON. With Lock Relative display
mode this is very obvious and annoying (random red points amid
black or blue), so add an epsilon check to consider less than
1e-6 unlocked weight to be the same as 0.

In addition, in cases when no weight can be painted due to locks,
don't create vertex group entries at all if they don't exist yet.
Also, don't run Auto Normalize when not painting a deform group.

Differential Revision: https://developer.blender.org/D10000
2021-01-12 14:32:05 +03:00
Robert Guetzkow
f5c0ef52cf Fix T84588: Cache access in rna_Particle_uv_on_emitter
The function `rna_Particle_uv_on_emitter` did not handle the case where
`particle->num_dmcache` was `DMCACHE_ISCHILD`. This resulted in an
incorrect offset for the `mtface` pointer. The commit checks for the
case and sets the offset accordingly, similar to existing code in
e.g. `particle_calculate_parent_uvs`.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10072
2021-01-12 12:14:34 +01:00
c56da67716 Fix: Bmesh from_object applies modifiers twice
The Bmesh from_object method applies modifiers twice when the input
deform is enabled and the input depsgraph is a render one.

The evaluated object already have modifiers applied, and
mesh_create_eval_final() applies modifiers again. To fix this, the
BKE_mesh_new_from_object() function is used instead.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D10053
2021-01-12 13:07:12 +02:00
26fd55fad1 UndoSys: Refactor step 1: cleanup and simplify logic in main undo/redo handlers.
* Simplify and clarify logic in `BKE_undosys_step_undo/redo_with_data_ex`,
  by adding early return on invalid situations, renaming some variables,
  and adding comments.
* Add more sanity checks in those functions.

No behavioral change are expected here, besides in potential edge-case,
invalid situations.

This is a preliminary change, before some deeper modifications of
`BKE_undosys` undo/redo API.

Differential Revision: https://developer.blender.org/D10033
2021-01-12 11:58:14 +01:00
1dc9650d20 Cycles: upgrade to OptiX SDK version 7.1 on buildbot
This means that NVIDIA driver version 450 or newer is now required for Cycles
OptiX rendering. This upgrade is required to take advantage of new features and
improvements.

Ref T81431
2021-01-12 11:51:42 +01:00
89ae4a7a2a Fix NLA liboverride issues re tracks handling.
From original rBc0bd240ad0a1 commit, issues reported with suggested
fixes by Wayde Moss (@GuiltyGhost), thx.
2021-01-12 11:32:17 +01:00
Oliver Weissbarth
401279253e Fix T84515: Status bar is reporting the average solve error of the wrong tracking object
Reviewed By: sergey

Maniphest Tasks: T84515

Differential Revision: https://developer.blender.org/D10047
2021-01-12 11:02:12 +01:00
Janusch Patas
2a23addf52 Fix T83122: NURBS Extruding multiple points only moves existing points
The Surface -> Nurbs Curve behaves now like the Curve -> Nurbs Curve,
if you initially select less than all points. So, multiple points can
be selected and extruded which just moves the selected points similar
to Curve -> Nurbs Curve object.

Differential Revision: https://developer.blender.org/D9934
2021-01-12 10:56:51 +01:00
ff51afb194 Fix T84593: Operators on material (linked to local object but with
linked obdata) fail

Caused by rB1a650fdcb286.

Above commit made polling more restricitive in that it did not allow for
actions on material slots (linked to object, not object data) on objects
with liked object data. This should be allowed though.

Maniphest Tasks: T84593

https://developer.blender.org/D10078
2021-01-12 10:03:48 +01:00
55059af01d Fix T84455: Circle select tool cursor draws in overlapping regions 2021-01-12 14:19:32 +11:00
Rahul Chaudhary
acbda123ad UI: Icon for Multires Displacement Smear Tool
This commit adds the icon for the new tool.
2021-01-11 15:30:26 -06:00
b9b59aa6de UI: Update geometry icon files
None of these changes should be visible, but the files were somehow
out of sync with the blend file, so they need to be updated to reflect
those changes.
2021-01-11 15:29:20 -06:00
Lukas Stockner
688e5c6d38 Fix T82351: Cycles: Tile stealing glitches with adaptive sampling
In my testing this works, but it requires me to remove the min(start_sample...) part in the
adaptive sampling kernel, and I assume there's a reason why it was there?

Reviewed By: brecht

Maniphest Tasks: T82351

Differential Revision: https://developer.blender.org/D9445
2021-01-11 21:04:49 +01:00
b70f4a265a Fix T84496: Cycles: Tile stealing does not work with NLM
Reviewed By: brecht

Maniphest Tasks: T84496

Differential Revision: https://developer.blender.org/D10066
2021-01-11 21:04:49 +01:00
Nicholas Rishel
d5c59913de Fix T81211 Add high frequency mouse input for Windows.
Also send mouse move event instead of moving cursor via SetCursorPos.
SetCursorPos did not reliably move the mouse when it is leaving the
window quickly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9981
2021-01-11 11:40:21 -08:00
ecdbd83a8d Geometry Nodes: Attribute Vector Math Node
This patch implements the same operations and interface as the regular
vector math node, but it runs for every element of the attribute. This
should expand what's possible with geometry nodes quite a bit.

Differential Revision: https://developer.blender.org/D9914
2021-01-11 12:06:52 -06:00
5bd822dc46 Geometry Nodes Point Distribution: Align points to face normals
This patch makes the point distribute node write to the "rotation"
attribute with the normal of each face at each distributed point.
The "normal" attribute is also created with the triangle normal
at each point.

The conversion from the triangle normal to an Euler rotation is somewhat
arbitrary, since we only have one direction vector. For a more flexible
rotation for each point, the "Align Rotation to Vector" node can be used
in the future.

Differential Revision: https://developer.blender.org/D9965
2021-01-11 11:42:16 -06:00
2a8b987e9e Fix T83422: Dimensions incorrect after undoing if it has modified geometry.
Root of the issue is that `BKE_object_eval_boundbox` (that ports back
evaluated bbox to orig object during active depsgraph evaluation) is
only called when object's geometry actually is evaluated.

However, with new undo, often Object itself can be changed by undo,
without requiring its geometry to be re-evaluated, which was leading to
the evaluated bbox not being copied back into orig object anymore.

Fixing that by moving bbox copying-to-orig code into
`BKE_object_sync_to_original` instead, which is always executed when
object is evaluated (as hinted by the comment above
`BKE_object_eval_boundbox` actually).

Also allows to cleanup code for armature eval, apparently.

Maniphest Tasks: T83422

Differential Revision: https://developer.blender.org/D9789
2021-01-11 17:59:21 +01:00
e44e0e4e78 Cloth: add a vertex group setting to exclude from object collision.
This can be useful as a workaround on the boundary with the pinned
vertices in some situations among other things, and completely copies
the existing design of the self collision vertex group setting.

Differential Revision: https://developer.blender.org/D10043
2021-01-11 19:34:33 +03:00
ac290bfbe4 Collision: allow disabling collision without removing the modifier.
The `object.collision.use` flag was treated as a redundant marker
of the existence of the modifier, going as far as adding/removing
it when the value was changed, which is not actually very useful.
Removing the modifier loses its position in the stack, and requires
a dependency graph rebuild. It feels it may be a legacy flag?

What would be useful however is the ability to toggle collisions
dynamically without removing the modifier. This patch adjusts the
code to keep the modifier when the flag is disabled, and add it
if it doesn't exist when the flag is enabled. The modifier now
checks the flag at the start and quickly exits after cleaning
up stale data. The redesigned setting is exposed in the UI.

Collisions can't be disabled by simply using the modifier enable
flags because the modifier merely saves a snapshot of the mesh at
a certain point of the modifier stack for other objects to use,
and thus has to be able to clear the stale data.

Differential Revision: https://developer.blender.org/D10064
2021-01-11 19:34:32 +03:00
b271475a9e ImBuf: Add error handling to IMB_indexer_open
Handle return value of `fread()` by printing an error and closing the
file when it cannot be read from. Not only is error handing a good idea,
it also prevents GCC from warning that the return value of `fread()`
should not be ignored:

```
.../blender/source/blender/imbuf/intern/indexer.c: In function ‘IMB_indexer_open’:
.../blender/source/blender/imbuf/intern/indexer.c:201:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  201 |     fread(&idx->entries[i].frameno, sizeof(int), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:202:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  202 |     fread(&idx->entries[i].seek_pos, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:203:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  203 |     fread(&idx->entries[i].seek_pos_dts, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:204:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  204 |     fread(&idx->entries[i].pts, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

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

Reviewed by: campbellbarton
2021-01-11 17:29:21 +01:00
bf90fcda47 ID Creation: generate session_uuid in more cases.
Previous code would not generate a session uuid for embedded IDs (like
root node trees or master collections). While this is not a problem
currently since those are not directly stored in Main data-base, this is
conceptually wrong, since those IDs still pertain the Main data.

Further more, this is blocking using `session_uuid` more in depsgraph in
place from ID pointer itself, as identifier (related to T84397).
2021-01-11 16:44:19 +01:00
1a26d15763 Fix Embedded IDs creation bypassing ID management completely.
No ID (even remotely) related to Main database should ever be created
directly through MEM_mallocN. Using `BKE_libblock_alloc` is the bare
minimum.

Note that there is no behavior change expected here.
2021-01-11 16:44:19 +01:00
2f9073adb1 Fix missing IDType init in ViewLayer tests.
Kinda miracle this did not cause problems so far, but was breaking tests
with some upcoming changes.
2021-01-11 16:44:19 +01:00
9e1ec5033d Fix T84516: ID properties have incorrect names in Python dir() list
Caused by not going through the proper accessor function to access the
property identifier.
2021-01-11 16:10:29 +01:00
98268e5c68 Cleanup: remove trailing whitespace 2021-01-11 15:49:42 +01:00
beb5863ed4 Geometry Nodes: transform Object Info outputs to local space
Ref T83670.

Differential Revision: https://developer.blender.org/D10071
2021-01-11 15:00:29 +01:00
c083398921 BLI: fix math operation
That fixes a stupid mistake of mine that was copied a couple of times.
2021-01-11 14:59:05 +01:00
7b6e55b933 Cleanup: remove redundant UV edge selection calls
Selecting vertices and faces first checked edge selection,
this was called to set vert1 & vert2 variables which have since been
removed.

These calls should have been removed in
51f04bf7b8.
2021-01-12 00:53:33 +11:00
2a297366f0 Fix T84565: UV face select fails when zoomed in
Exposed by recent commit 246efd7286

Although this was an existing logical error causing
`uv_find_nearest_face` to only work properly when the hit distance was
initialized to FLT_MAX, which wasn't the case in multi-object edit mode.
2021-01-12 00:31:54 +11:00
fe53b6a7fb Fluid: Adjusted viscosity strength step size in UI
Step size was too small.
2021-01-11 12:55:33 +01:00
Pi Lanningham
f0ae0f490e Fix T84327: outliner_id_copy_tag was only copying from expanded nodes.
If a node was closed in the hierarchy, we would only copy that node,
even if child nodes were selected.

Reviewed By: brecht, mont29

Maniphest Tasks: T84327

Differential Revision: https://developer.blender.org/D9995
2021-01-11 12:02:06 +01:00
6e7716f32e Cleanup: Added const to RenderLayersProg methods 2021-01-11 11:46:32 +01:00
445ebcaa30 VSE: store raw images in cache
Previously raw images were not cached if image wasn't preprocessed.
This caused issue, that image had to be read from disk on every redraw.

Effect strips must be excluded, because this would cause problem with
invalidation. Effect strips can use preprocessing however. This is
mainly to allow usimg modifiers on them.

This change should follow rBf448ff2afe7a77, but I have wrongly assumed,
that it has been implemented already.

ref T80278
2021-01-11 11:38:33 +01:00
54f8a5dd73 Tests: run suites instead of individual test cases
Group all tests of a test suite into a single test command invocation.
This reduces the number of invocations by `ctest` by an order of
magnitude.

Since rB56aa5b0d8c6b663, `bin/tests/blender_test` was run for every
individual test. Having over a 1000 tests made testing slower than
necessary. Individual tests can still be run if desired by invocation of
`bin/tests/blender_test --gtest_filter=suitename.testname`.

NOTE: For this commit to have an immediate effect, it may be necessary
to remove the `tests` and `Testing` directories and some CMake files
from your build directory and rebuild. Run `ctest -N` to see the list of
tests; there should be less than 200.

Reviewed By: sergey, LazyDodo, sebbas

Maniphest Tasks: T83222

Differential Revision: https://developer.blender.org/D9649
2021-01-11 11:29:30 +01:00
63cea2b793 Fix versioning code outside of version check
Bug introduced in f448ff2afe probably due to mistake when resolving
conflicts and not checking functionality.
2021-01-11 10:55:27 +01:00
d095411002 Fix T83544: Cycles crash when rendering with Save Buffers enabled
The issue is that the "Noisy Image" pass is added even though it should not.

`use_denoising` has to be enabled on the scene and on the view layer
to actually enable it.

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

Reviewers: lukasstockner97, brecht
2021-01-11 10:21:38 +01:00
4c44a5309c Fix T84459: Face normals not displaying (AMD GPU)
This is part two of the fix for T84459.
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Drawing normals in edit mode
uses the same OpenGL data type for storing normals that is known to be
faulty.

This change fixes the face dot normals by using GPU_COMP_I16.
2021-01-11 09:52:16 +01:00
618f7df7fc Cleanup: Incorrect comment 2021-01-11 09:52:16 +01:00
9fb32b2b29 Fix T84459: Wireframe not displaying with AMD GPU
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Wireframe drawing uses the same
OpenGL data type for storing normals what is known to be faulty.

This patch enabled storing the normals using GPU_COMP_I16. It also
solves the normals drawing in edit mode for vertex and loop normals.
2021-01-11 09:52:16 +01:00
64929398fb Cleanup: skip accessing sequence strip name/source when hidden 2021-01-11 17:58:08 +11:00
a83c67c183 Fix incorrect use of BLI_snprintf in sequencer text concatenation
The start of the text was stepped over without subtracting it's length
(introduced in fad80a95fd).

Replace this logic with BLI_string_join_array to simplify construction.
2021-01-11 17:51:42 +11:00
b01e62e399 Fix missing directory separator in image/movie strip identifier 2021-01-11 17:17:10 +11:00
16aefea9fa Cleanup: use switch statement for sequence types
Also remove duplicate NULL pointer check and replace
BLI_snprintf with BLI_strncpy.
2021-01-11 17:13:27 +11:00
50104b11a1 Fix T84582: WalkNavigation.mouse_speed ignored with tablet
Scale the speed up 4x instead of clamping the value to a minimum of 4.
2021-01-11 16:33:15 +11:00
ab5986cf3a Fix T84501: Wintab button lag.
Multiple Wintab tablets do not send relative button state when
configured to do so. This causes button events to be delayed until
processed as Win32 button events.

This commit fixes the issue by configuring Wintab to use absolute
button state and tracking changes manually.
2021-01-10 21:18:46 -08:00
af88d23ffa Revert "Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask"
This reverts commit 9db3d1951d.

This was an accidental commit of the patch D8826
2021-01-10 21:07:04 -03:00
d4330ae70b Transform: In the Header, show translation value in local space only with constraint
This partially reverts commit ad15e764dd.
The local value is only useful with constraint.
2021-01-10 20:58:45 -03:00
ad15e764dd Transform: In the Header, show the translation value in local space
Showing value in the global space was an unintentional change.
2021-01-10 20:30:25 -03:00
08e44b5e3e Fix Increment Snapping Without Constraints in Non-Axis-Aligned Views
The incremental snap was always operating in the local space, which in most
cases is the VIEW type orientation.

Use only local space when the operation is affected by constraint.

Differential Revision: https://developer.blender.org/D10052
2021-01-10 20:24:46 -03:00
9db3d1951d Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask 2021-01-10 19:01:53 -03:00
1d3b92bdea UI: Improve node group input / output list interface
This commit replaces the two-column list for editing node group inputs
and outputs with a cleaner solution with two panels. The new layout
has several benefits:
 - It uses the vertical space in the node editor sidebar better.
 - It should be more familiar because of similarity with other UI lists.
 - It should look better with consistent alignment and icons.

Note that displaying the "Name" property outside of the list itself is
a bit inconsistent and could possibly be removed in the future.

Differential Revision: https://developer.blender.org/D9683
2021-01-10 13:24:37 -06:00
30310a4fc8 Fix T83777: Crash when enabling guides
Also adjusted adjusted guiding UI parameters so that guiding will not get invalidated when changing domain values.
2021-01-10 19:16:44 +01:00
5b90ed6c06 Fluid: Fix cache saving issue with OpenVDB IO
Fixes issue where files would not be written when 'resumable' option was checked.
2021-01-10 19:16:44 +01:00
Peter Fog
544e371908 Fix T84529: Crash with strip using deleted scene
If scene strip has no scene assigned, leave source string empty.
Same goes for all other strips, that use ID datablocks.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10058
2021-01-10 17:37:07 +01:00
e45630a99f Fix sequencer disk cache not writing data
Error handling added in 512a23c3d6 caused that reading header of new
file failed, since it is empty.

Don't attempt to read header if file is empty. If header can not be read
anyway, try to delete the file. Add asserts, as this should never
happen.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9954
2021-01-10 16:50:08 +01:00
9441413cb2 VSE: Remove fit method tool setting from header
This property was intended to affect fit method for added strips prior
to running operator. However UI team did not agree with current
implementation.

ref T84535

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10055
2021-01-10 16:37:18 +01:00
6154aa1529 Cleanup: remove redundant decorator for eevee 'overscan_size'
All eevee scene properties are not animatable due to
`RNA_define_animate_sdna(false)` so there is no need for an animation
decorator here (would not show anyways).

Not sure if setting use_property_decorate to False and then manually
adding one again was a hack in rB7fc60bff14a6 to get the alignment
right, but seems to work good now without it.

Note: there also seems to be an inconsistency here generally:
- Eevee reserves room for an animation decorator in almost every panel
(except for "Sampling" and "Indirect Lighting") even though almost none
are animatable (except for stuff in "Hair" and "Film"). This looks nice
if multiple panels are expanded (except for mentioned "Sampling" and
"Indirect Lighting" -- maybe these should also reserve the room?)
- Cycles does not use animation decorators at all (even though pretty
much everything is animatable here -- maybe these should also use
animation decorators?)
- Then there is also the 'shared' "Grease Pencil", "Freestyle" and
"Colormanagement" -- these dont use animation decorators, but some stuff
is animatable...

Regarding the note: not sure what the guidelines here are, if this is
isolated to each panel then there is lots of stuff for eevee that could
set use_property_decorate to False, if multiple open panels are
considered (for nice visual consistency between them), then there is
romm for improvement elsewhere, too.

Maniphest Tasks: T81411

Differential Revision: https://developer.blender.org/D9164
2021-01-09 15:02:14 +01:00
fa82a15676 Cleanup: remove unused struct members
Non-projection painting in the viewport is no longer supported,
remove struct members used for this.
2021-01-09 19:07:31 +11:00
e718004edf Cleanup: use bool arguments & variables 2021-01-09 19:07:14 +11:00
246efd7286 Fix UV selection threshold which ignored image aspect and zoom level
Selecting UVs wasn't properly scaling based on the zoom or image aspect.

This now matches vertex selection in the 3D view.
2021-01-09 18:42:36 +11:00
645298be29 Fix build error after last commit 2021-01-08 23:10:58 -06:00
1bb530745f Cleanup: Use bool instead of int 2021-01-08 23:09:31 -06:00
9c07454816 Keymap: Enable repeat for "Make Edge/Face" operator
The "repeat" property was turned off by default in rBf5080c82dd91, but
it's important to have repeat turned on for this operator since it can be
used to fill large areas. This commit is similar to rBaa77689f77b4.

Fixes T84531
2021-01-08 17:19:04 -06:00
69a22a70ac Geometry Nodes: Don't start with empty group nodes selected
The nodes were selected in new node groups because they are by default,
but there's no particular reason for them to be selected, and it can
be distracting.
2021-01-08 16:29:10 -06:00
7fd19c20e0 Geometry Nodes: Gray out "New" button when curve object is active
Currently curve objects aren't supported by the node modifier, so the
new node group and modifier operator shouldn't be available.
2021-01-08 15:04:38 -06:00
3c1fcec652 Fix T84517: Two geometry node trees added with "New" button
Adding the modifier itself already adds a new node tree, which is
then displayed in the node editor because of the active object and
active modifier context. So there's no need to create the node tree
in the python code in this case.
2021-01-08 12:12:43 -06:00
bc788929aa Scenes: forbid deleting last local scene
Previously, it was only forbidden to delete the last scene. This can
lead to the situation where a .blend file only contains linked scenes.
This is problematic, because linked data might not always be available
or can be removed from a .blend file without having an additional check
for remaining scenes.

Now there always has to be at least one local scene.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D10049
2021-01-08 16:39:42 +01:00
2d3f96cace Fix T84453: Crash bezier curves transfrom
The pointer allocated to the `TransData` was being incorrectly incremented,
causing misalignment and consequently `heap-buffer-overflow`.

Because of this, `TD_NOTCONNECTED` was being set in a strange way that did
not correspond to other types of `TransData`.

The solution is to not increment the `TransData` pointer and set
`TD_NOTCONNECTED` only for "unconnected" segments.

The code was also a bit deduplicated.
2021-01-08 11:22:58 -03:00
c549d736cf Icons: Update script to generate icons from SVGs for Inkscape 1.0
The command line syntax for Inkscape changed quite a bit for the 1.0 release,
see https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line.
Think it's reasonable to expect Inkscape 1.0 or later be installed if you want
to generate the icons with the script. It's easy to get via the website, if the
distribution doesn't provide new enough packages. Only few people would use the
script anyway.

I also had to change the path for command line access on macOS which apparently
changed (https://stackoverflow.com/a/60068607). Although I didn't find a
mention of this change in the Inkscape release notes.
2021-01-08 15:07:54 +01:00
c66f00dc26 Fix Cycles rendering with OptiX after instance limit increase when building with old SDK
Commit d259e7dcfb increased the instance limit, but only provided
a fall back for the host code for older OptiX SDKs, not for kernel code. This caused a mismatch when
an old SDK was used (as is currently the case on buildbot) and subsequent rendering artifacts. This
fixes that by moving the bit that is checked to a common location that works with both old an new
SDK versions.
2021-01-08 13:38:26 +01:00
e3ae7d1f2f Fix T83942: improve error checking when trying to render high resolution volume
Reviewers: fclem

Differential Revision: https://developer.blender.org/D10032
2021-01-08 12:14:12 +01:00
c889ec916c Cleanup: clang format 2021-01-08 11:54:53 +01:00
c44a17ec4b Fix T84475: Outliner missing update when adding IDs to main via RNA
Was reported for meshes, but was true for any type.
Now add appropriate notifier to refresh the Outliner.

Maniphest Tasks: T84475

Differential Revision: https://developer.blender.org/D10030
2021-01-08 11:50:36 +01:00
1698678231 GPU: Mark AMD Polaris 20.11+ drivers with limited support.
The issue does not render wireframes correctly.
2021-01-08 11:44:31 +01:00
03f1d8acab Use the term "N-gon" instead of "Polygon" for triangulation method
This was reported for the Triangulate geometry node, but was also true
for the triangulate modifier and in exporters.

Note the modifier was introduced with "Ngon Method" in rBa7b44c82e5b9 but
was renamed to "Polygon Method" in rBf4762eb12ba5.

Since quads are also polygons (and quads have their own method), the
term "N-gon" is more appropriate here and is also described in the
glossary https://docs.blender.org/manual/en/2.92/glossary/
index.html#term-N-gon

Docs have been updated in rBM7539 (partially - the method would also
have to be renamed once this patch lands).

Note this also fixes the wrong enum used for the alembic exporter.

Fixes T83907

Maniphest Tasks: T83907

Differential Revision: https://developer.blender.org/D10022
2021-01-08 11:20:42 +01:00
4a0b8c9427 Cloth: completely exclude fully pinned triangles from collision.
Currently such triangles are effectively already excluded, because
the calculated forces are not applied to pinned vertices. However
these forces are still being computed, which is inefficient.

This adds an early check for triangles where all vertices are
pinned during BVH overlap detection, which significantly speeds
up certain use cases with big fully pinned areas that happen to
overlap a collider. In case of self collision both triangles must
be fully pinned to exclude safely, because the computation is
symmetric and handles two triangles at the same time.

Differential Revision: https://developer.blender.org/D10041
2021-01-08 12:24:50 +03:00
8877e294df Surface Deform: the Strength setting is not bind-specific.
It is used during evaluation so it shouldn't be greyed out in the UI.

Ref D10040
2021-01-08 12:24:50 +03:00
662b7c3edf Surface Deform: optimize memory allocation in the evaluation code.
Using malloc to allocate a temporary array for each vertex,
which most commonly contains just 4 elements, is not efficient.
Checking the mode with a switch is also better.

Differential Revision: https://developer.blender.org/D10040
2021-01-08 12:24:50 +03:00
ceaed47bf9 GPU: Enable HQ normal work around on Linux.
Linux does not report the driver version. It does report the OpenGL
version. This change will check the OpenGL version to enable the HQ
normal work around.
2021-01-08 10:23:20 +01:00
f448ff2afe VSE: Hide cache settings and adjust defaults
Adjust default cache settings for all files to store raw and final
images.

All settings are still available when developer extras option is
enabled in user preferences.

This is part of design task T80278

Differential Revision: https://developer.blender.org/D9745
2021-01-08 07:24:55 +01:00
09ea339a6c Cleanup: Use LISTBASE_FOREACH macro 2021-01-07 21:24:46 -06:00
15bb8f9f93 Fix file-handle leak when parsing xdg user directories 2021-01-08 13:19:11 +11:00
61f1faac3f Fix T83868: Disabled or inactive list items are not grayed out
The cause for this was quite simple-- a misplaced bitwise operation
before passing a value to the function that grayed out buttons based on
their state, caused by refactoring in rB933bf62a611f before committing.

What makes the situation a little more confusing is that the theme colors
are overridden for list buttons in UI lists, necessitating a second
call to `ui_widget_color_disabled()`. Ideally that wouldn't be necessary.
2021-01-07 16:28:26 -06:00
5530d6f86f PyAPI Docs: Terminal instructions for Windows incorrect
Fixes T84498
2021-01-07 15:58:47 -05:00
95c63babbb Cleanup: Declare variables where initialized 2021-01-07 12:30:18 -06:00
d259e7dcfb Cycles: Increase instance limit for OptiX acceleration structure building
For a while now OptiX had support for 28-bits of instance IDs, instead of the initial 24-bits (see also
value reported by OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID). This change makes use of
that and also adds an error reported when the number of instances an OptiX acceleration structure is
created with goes beyond the limit, to make this clear instead of just rendering an image with artifacts.

Manifest Tasks: T81431
2021-01-07 19:23:13 +01:00
3db2bc82aa Surface Deform: optimize handling of the vertex group weight.
There is no need to first copy weights to a separate array,
or create the data layer if it doesn't exist. The threaded
code can retrieve the weight directly from the layer.

Differential Revision: https://developer.blender.org/D10015
2021-01-07 21:08:44 +03:00
Juanfran Matheu
64277e8f3a UI: Use Eyedropper Cursor with Sample Weight Tool
While using the Sample Weight tool in Weight Paint mode, user eyedropper mouse cursor.

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

Reviewed by Pablo Vazquez
2021-01-07 09:44:48 -08:00
Juanfran Matheu
e3d9241a05 UI: Show Weight Value with Sample Weight Tool
While using the Sample Weight tool in Weight Paint mode, show weight value in tool header.

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

Reviewed by Pablo Vazquez
2021-01-07 09:29:36 -08:00
3db975f30d Fix T84326: No ID for geometry nodes instances after scattering
Instances are created with an "index" parameter used for persistence over
time through animation. Currently the geometry nodes instancer passes
the index in the array for this value, but the arrays created by the
"Point Distribution" node aren't necessarily stable  in this way when
the input mesh is deformed. In D9832 we already mostly solved this
problem with an `id` attribute. The solution here is to create instances
with this attribute as well.

It's important to note that deforming the instanced points *after*
distribution will usually be a better solution for this problem. This
solution is likely still important though.

Differential Revision: https://developer.blender.org/D10024
2021-01-07 09:27:42 -06:00
4c0fc60105 UndoSystem: Early out from core undo/redo handlers when undo step is NULL.
Also added `undosys_stack_validate` debug check to redo case.
2021-01-07 15:58:23 +01:00
044dd42a05 Cleanup: Undo system: minor simplification in non-debug code. 2021-01-07 15:58:23 +01:00
987e9e2145 Fix T84469: Online manual raises an exception with key-map options
Report an error instead of raising a Python exception.

Currently these properties aren't written to the manual
so it's best to show an error.
2021-01-07 23:36:25 +11:00
c55b578c9e Fix T84142: crash when mirroring hair emitted from vertices
The hair mirroring code seems to expect that hair is emitted from faces.
The PE_mirror_x contains the following expression: mirrorfaces[pa->num * 2].
This only makes sense when pa->num is a face index.

The simplest short term solution is to disable the mirror operator when
the particles haven't been emitted from faces.

Diffferential Revision: https://developer.blender.org/D10002
2021-01-07 13:32:36 +01:00
c26f46cb95 Fix T83497: missing relations update when group node changes
Changing which node group a group node references needs a depsgraph
relations update in some cases.

Differential Revision: https://developer.blender.org/D10018
2021-01-07 13:31:17 +01:00
0d042c8cca RNA: document Python instancing for ID's and RNA types
Document some of the less obvious implications for
re-using Python instances.
2021-01-07 21:36:39 +11:00
4a771263fd Outliner: use the scene ID for ObjectBase PointerRNA
While this didn't cause any problems, `Base` structs are part of the
scene which is being set in other uses of this type.
2021-01-07 16:20:08 +11:00
Yevgeny Makarov
dd0df3c5d2 UI: Fix various issues with UI text
- Use the name "Point Cloud" instead of "Pointcloud"
 - Fix a typo in UV_OT_smart_project.
 - Use the name "Install Light" to for the installation
   operator for MatCaps, HDRIs, and Studio Lights.

Fixes T83585, T65291, and T54921

Differential Revision: https://developer.blender.org/D9867
2021-01-06 22:54:10 -06:00
2dfd117ab5 Fix memory leak duplicating a scene with "Copy Settings" 2021-01-07 15:04:26 +11:00
a9dea9cfaa PyAPI: don't raise & clear exceptions when setting context members
BPY_context_dict_clear_members_array used PyDict_DelItemString
which raised & cleared the exception when the key didn't exist.

Even though setting/clearing the exception is supported,
it's worth avoiding where possible as it adds some overhead as well as
overwriting the previous error which can free PyObject's which are
unrelated to the code being executed.

Possible fix for T82552, crashing on Windows when setting the exception.
2021-01-07 14:41:52 +11:00
f35a38fba7 Fix BKE_blender_atexit_unregister error removing from linked list
This is an old bug exposed by having multiple atexit calls since
c65c4149c9.
2021-01-07 13:31:57 +11:00
27426c05b1 PyAPI Docs: Link to user docs instead of describing in API doc 2021-01-06 19:52:13 -05:00
b138c8f5b3 PyAPI Docs: Update Indirect Data Access docs
Fixes T84432
2021-01-06 19:34:21 -05:00
a9c607e60e PyAPI Docs: Fix wrong modifier path usage
Fixes T84430
2021-01-06 18:54:56 -05:00
133bdac306 PyAPI Docs: Clarify quick start guide tips
Some of the text here was outdated with 2.8x.
See T84427
2021-01-06 18:45:34 -05:00
211e161d76 Fix T84416: Vertex color baking checks for UVMap
Since the introduction in rB2221389d6e8e, baking to vertex colors would
still check for the existence of a valid UVMap (as if baking to image
textures).

Now check for vertex colors instead if target is
R_BAKE_TARGET_VERTEX_COLORS.

Maniphest Tasks: T84416

Differential Revision: https://developer.blender.org/D10006
2021-01-06 22:26:20 +01:00
6ea01dc509 UI: Use the 3D cursor icon for the RNA struct
Since there is a specific icon to represent the 3D cursor it makes sense
to add it to the RNA struct. This struct's icon is only displayed in the
Data API section of the outliner.
2021-01-06 14:00:44 -06:00
3028de9527 UndoType: Refactor: replace use_context boolean by a bitflag.
We will soon need more options here, sinmpler and cleaner to use a
bitflag then.
2021-01-06 18:07:09 +01:00
5cdf279ef4 Fix T84420: Linking regular materials to gpencil
When using "Make Links"->"Materials" regular materials could be linked
onto grease pencil objects. This caused a number of issues.

The fix changes the `allow_make_links_data` function to make sure that
if one object is of type `OB_GPENCIL`, the other has to be aswell.

Reviewed By: antoniov

Maniphest Tasks: T84420

Differential Revision: https://developer.blender.org/D10014
2021-01-06 17:54:44 +01:00
6672cbeb23 Fix T84202: Sculpt lasso mask crash after remesh.
'Caused'/revealed by rBd29a720c45e5: Operators that fully re-create the
mesh would previously rely on `sculpt_update_object` called from update
code to get required sculpt-specific data layers re-added to the new
mesh.

Now instead put all code adding data to orig mesh for sculpt purpose
into a new util function (`BKE_sculpt_ensure_orig_mesh_data`), and call
that function when entering sculpt mode, and from voxel remesher code.

This is contonuing effort to more clearly separate orig data from evaluated
data handling/usage in sculpt code.

TODO: there are likely other code paths that would need to call that
new function?

Reviewers: @sergey, @pablodp606

Subscribers:
2021-01-06 16:25:39 +01:00
a584aef470 Undo: Further tweak/fixes the 'use context' flag of undo types.
Note that this is fairly fragile still, especially in cases like paint
cureve undo, which actually does not use context in most cases (and can
be called with a NULL context), but do need it in one case. This will
need a proper rework at some point.
2021-01-06 15:59:23 +01:00
691c021679 Fix T82952: Crash changing mesh data block and switching scenes
Regression in 33ac3582bb.
2021-01-07 01:35:05 +11:00
f0071dfa10 Fix T79779: Pick shortest UV face-path ignores sticky setting 2021-01-07 00:37:05 +11:00
0e4f8ed90e UndoType: Fix some incinsistencies re context usage flag.
`use_context_for_encode` was not properly set regarding actual `encode` code for a few types.
2021-01-06 14:11:25 +01:00
eb1ff4b3a4 Cleanup: CodeStyle format 2021-01-06 13:55:27 +01:00
1c72a2f47d Cleanup: CodeStyle Format 2021-01-06 13:54:12 +01:00
967cf303f3 Fix T83372: Point.select can be True when unselected 2021-01-06 23:27:03 +11:00
bc3e38ca3a Cleanup/refactor: UndoType: Clarify use_context variable.
Rename it to mark it is only for `encode` callbacks, fix `encode`
callback of text undo to early fail in case it gets a NULL context, add
an assert to `BKE_undosys_step_push_with_type` that context is not NULL
when undotype requires a valid one.

Note that in practice this should not change anything, currently it
seems that we always get a valid context in
`BKE_undosys_step_push_with_type`?
2021-01-06 12:28:06 +01:00
4e23f08807 Fix object moved to cursor when editing last operation after dropping object
Steps to reproduce were:
* Drag object icon from the Outliner into the 3D view (or an object asset from
  the Asset Browser)
* Open the "Adjust Last Operation" panel
* Edit options in there - the object would move to the mouse location

The same issue happens with collection instance and object data adding (e.g.
via drag & drop). This patch addresses them too.

The operator used the event state stored in the window. This shouldn't be
accessed from the operator execute callback generally which happened here.
Especially not if the operator supports editing properties.
2021-01-06 11:55:21 +01:00
290b6d7ef3 Fix T70316: Custom "Delete Keyframes" shortcut still requires
confirmation

Deleting keyframes in the dopesheet or graph editor always required
confirmation, even if used ouside of the "Delete" menus.

Now add a "confirm" option [same as for deleting objects], which can be
disabled for immediate keyframe deletion.

This will also change the default behavior and bring this in line with
how object deletion works so there is one shortcut for bringing up the
menu/confirmation and another shortcut to delete immediately without
requiring confirmation / another click:

- Blender Default keymap: "X" for menu, "Del" for immediate
- Industry Compatible: "Backspace" for menu, "Del" for immediate

Maniphest Tasks: T70316

Differential Revision: https://developer.blender.org/D9651
2021-01-06 11:35:06 +01:00
4b56c18290 Fix T84426: Limit dissolve ignores selection with custom normals
Regression in 9969c2dd16.

Add note that custom normal calculation functions write into to tags.
2021-01-06 19:04:53 +11:00
947dc92083 BMesh: assert when a mesh has two kinds of shake-key data
Assert with comment to avoid confusion caused by
mixing two kinds of shape-key data.

This problem was exposed when investigating T84364.
2021-01-06 18:11:46 +11:00
Yevgeny Makarov
5424b4821d Fix T83094: Alternate rows in the Sequencer are green (macOS)
The issue is that `UI_GetThemeColorBlendShade4fv()` creates a color
with alpha, but there is not any background underneath to blend in with.

The solution is just to draw an opaque background first, which also
halves the number of rects to draw. Note that the brighter rows get
very slightly darker after this change.

Differential Revision: https://developer.blender.org/D9947
2021-01-05 14:21:54 -06:00
2ed6055209 Fix T79146: Sculpt Mode lags until the entire mesh is visible
This was caused when the BKE_pbvh_draw_cb function was used with
update_only_visible set to false. In that case, all nodes with the flag
were updating, but the update flag was only cleared for visible nodes.
This was causing constant updates per redraw in no visible nodes until
they enter the view frustum and their flag was cleared.

In order to fix this and prevent it from happening again:
 - Updating the buffers, flushing the updates and clearing the flags are
now part of the same function. It does not make sense to do these in
separate places.

 - The BKE_pbvh_draw_cb function was refactored so the
pbvh_update_draw_buffers is only called once. It should now be easier to
understand what the function does when it is used to update only visible
nodes or all nodes.

Reviewed By: mont29

Maniphest Tasks: T79146

Differential Revision: https://developer.blender.org/D9935
2021-01-05 20:23:41 +01:00
c20e482714 Fix T78681: "Add Primitive" icons are cropped in tool header
The issue can be simply resolved by moving the primitives and plus
icons slightly. They still bump up against the top and bottom of the
header but it looks much better now.
2021-01-05 13:00:35 -06:00
4ade409a87 Cleanup: Reduce variable scope 2021-01-05 12:22:23 -06:00
3373d14b1b Fix T83925: Crash when rendering on the CPU with OptiX denoiser enabled
Rendering on the CPU uses the Embree BVH layout, whether the OptiX denoiser is enabled or not.
This means the "build_bvh" function gets a "BVHEmbree" object to fill and not a "BVHMulti" as it
was assuming before, which caused crashes due to memory geting overwritten incorrectly. This
fixes that by redirecting Embree BVH builds to the Embree device.

Manifest Tasks: T83925
2021-01-05 18:37:31 +01:00
491a9e9ec4 Cleanup: Undo code: poll function.
Remove obviously outdated comment, and explictely set `poll` to `NULL`
in the one case it is not actually defined (sculpt undo).
2021-01-05 18:21:09 +01:00
90a26f900c Cleanup: UndoType: use size_t for memory size of structs. 2021-01-05 18:21:09 +01:00
166c0db3f9 Fix T83915: Subdivision Surface modifier causes visual artifacts in Cycles rendered viewport - CPU and OptiX
Changing the geometry in the current scene caused the primitive offsets for all geometry to
change, but the values would not be updated in all bottom-level BVH structures. Rendering
artifacts and crashes where the result. This fixes that by ensuring all BVH structures are
updated when the primitive offsets change.
2021-01-05 17:59:38 +01:00
da9d471e1d Fix T84389: RGB Curves node shows "tone" option outside of compositor
Since the introduction in rB4de7c0c3105a, the option is only used in the
compositor, it has no effect elsewhere [texture nodes, shader nodes].

Now only show the option for the compositor.

Maniphest Tasks: T84389

Differential Revision: https://developer.blender.org/D10005
2021-01-05 17:04:56 +01:00
583006d0ef Cleanup: clang tidy 2021-01-05 17:04:02 +01:00
39f99fd05c Fix: tried to set error message on modifier that does not exist
Without this, the example file in T83730 crashes in a debug build
when deleting the hair edit bake in the particle settings.
2021-01-05 16:50:23 +01:00
9dbea1db66 Compositor: Alpha Mode
{D9211} introduced pre-multiplying the color for the keying node. This
pre-multiplication should also be done by other keying nodes and should be
the default operation for alpha node.

This patch will change the logic of keying nodes (Cryptomatte Node,
Channel Matte, Chroma Matte, Color Matte, Difference Matte, Distance
Matte, Luminance Matte) and breaks old files.

The Set alpha node has a mode parameter. This parameter changes
the logic to `Apply Mask` the alpha on the RGBA channels of the input color
or only replace the alpha channel (old behavior).

The replace mode is automatically set for older files. When adding
new files the the multiply mode is set.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D9630
2021-01-05 16:34:55 +01:00
357e519575 Fix T83282: division by zero when creating psys tasks 2021-01-05 16:17:37 +01:00
cffa39358f Cleanup: Compositor comment style 2021-01-05 15:50:58 +01:00
36ae6e66c1 Fix T84367: Fix crash when showing invalid/legacy constraints
Exposed by rBeaa44afe703e.

Definition for CONSTRAINT_TYPE_NULL is not totally clear (it is set for
constraints without data, see an old comment from Ton), but for these, a
TypeInfo cannot be fetched.

Avoid processing those constraints in UI code, just do nothing instead.

Maniphest Tasks: T84367

Differential Revision: https://developer.blender.org/D9987
2021-01-05 15:31:40 +01:00
Jeroen Bakker
1f41bdc6f3 Eevee Cryptomatte: Store hashes in render result meta data
Stores cryptomatte hashes as meta data to the render result. Compositors could
use this for lookup on names in stead of hashes.

Differential Revision: https://developer.blender.org/D9553
2021-01-05 15:03:05 +01:00
7cd6f667e3 Fix T84053: Mask overlay in image editor not working
The mask overlay wasn't part of the overlay engine. The reasoning nehind
this was that more editors used the mask overlay and most of them used
old drawing code. This patch adds the mask overlay drawing to the draw
overlay engine. This code path will only be used by the image editor
VSE, Compositor and Movie Clip editor will still use the previous
method.

During this patch some alternatives have been researched:
1. `ED_mask_draw_region`: this would lead to different code paths when
   drawing in the image editor, and some hacks to retrieve the correct
   framebuffer.
2. Add mask drawing to image engine: Would lead to incorrect color
   management when viewing the mask.
3. Add mask drawing to image engine and overlay engine: Would lead to
   duplicated code.
4. Add mask drawing to overlay engine and for combined overlay select
   the correct framebuffer.

Option 4 was chosen as the exception (switching framebuffers) can be
done without hacks. The code stays clean.
2021-01-05 13:53:33 +01:00
f41de6dc46 Fix T84404: Crash when using Skin Resize in mesh without Skin modifier
Caused by rB54ee4109143b

Before that commit `TD_SKIP` was marked for all vertices.

Now skip the whole operation as all vertices are skipped.
2021-01-05 09:46:07 -03:00
fab772860d Asset browser: workspace in the wrong category
Workspaces [FILTER_ID_WS] were in the `Environment` category
IDFilterBoolean, whereas they are in the `Miscellaneous` category in
`rna_def_fileselect_asset_params`.

Make this consistent ['Miscellaneous'] in both cases.

(note this was already done in rB2c317457cbf2 for the file browser case)

Spotted while looking into T83983.

Maniphest Tasks: T83983

Differential Revision: https://developer.blender.org/D9911
2021-01-05 13:30:51 +01:00
acfa7b102b Sculpt: use distance threshold for dyntopo symmetrize
This was only used for non-dyntopo symmetrize.
There is no reason to use a hard-coded value in this case.
2021-01-05 23:19:34 +11:00
1f6846fa4e Cleanup: remove UNUSED(..) from public function declarations
This doesn't serve any purpose and can become out of sync
with the function it's self without reporting warnings.
2021-01-05 23:09:50 +11:00
e4884d224c Cleanup: remove redundant RNA_types.h header from UI_interface.h 2021-01-05 23:04:51 +11:00
105d385e4b Fix T84364: Sculpt symmetrize fails with shape keys
Use the BMesh symmetrize operator instead of using the modifier code.

While we could support shape-keys with the existing code used by the
mirror modifier, we'd need to add code-paths for evaluated mesh & bmesh
conversion to handle shape-keys differently just for this one case,
since we want to avoid copying & processing shape-keys layers for
evaluated meshes in general.
2021-01-05 22:48:12 +11:00
7241104877 Enabled Physics Particle Instance test 2021-01-05 16:16:08 +05:30
c0a8dd943f Fix T84018: bulk selection (box, circle, lasso) - unwarranted selection
of islands in vertex mode if "UV Sync Selection" is on

Caused by rB72b422c1e101: UV: support select linked with sync-select in
vert/edge modes

If you had island selection mode enabled in the UV editor with UV Sync
Selection off, and switch UV Sync Selection on, then in vertex selection
mode all bulk selection ops (box, circle, lasso) will be selecting whole
islands.

Prior to culprit commit, for sync selection ON plus island selection ON,
BM_uv_vert_map_create would always return a NULL vmap (it was called
with `use_select` = True, no faces tagged selected). After said commit,
for sync selection ON plus island selection ON, BM_uv_vert_map_create
would return a valid vmap (it is now called with `use_select` = False,
no faces tagged selected - but if `use_select` is False, all UVs will be
added here).

If I am not mistaken, it is never wanted to actually select islands with
box/lasso/circle when sync selection is turned ON [after all you dont
have the UI for it showing], so solution is now to check for this
earlier and not even call uv_select_linked_multi in those cases. (Maybe
in the future this can be unified and we dont need separate selection
modes fo UV and 3D?)

Maniphest Tasks: T84018

Differential Revision: https://developer.blender.org/D9917
2021-01-05 10:26:23 +01:00
dc4014c676 Cleanup: Enum for mask overlay mode 2021-01-05 10:13:00 +01:00
7d152bedc5 Fix T84216: Drawing a paintcurve [vertexpaint / weightpaint] fails
Caused by rB35e3dc9192e7.

Above commit moved 'Weight Paint' & 'Vertex Paint' keymap also before
'Paint Curve' keymap.
This way, paintcurve.add_point_slide would be overriden by:
- paint.vertex_paint (inverted)
- paint.weight_sample

Now move 'Paint Curve' above again.

Reviewers: campbellbarton

Maniphest Tasks: T84216

Differential Revision: https://developer.blender.org/D9939
2021-01-05 10:02:03 +01:00
08f00f4f6e BMesh: Add shape-key support to edit-mesh symmetrize
Symmetrize now flips shape-keys too since using the un-flipped
locations creates an overlapping surface which isn't useful.
2021-01-05 18:03:56 +11:00
4150facd61 BMesh: add use_shapekey to BMesh transform operators
Currently unused, needed for symmetrize to support shape keys.
2021-01-05 15:51:50 +11:00
5370a7dd40 Cleanup: use scale's 'space' argument instead of two transform calls 2021-01-05 15:51:50 +11:00
d3c62b682d Fix bmesh.mirror operator
Checks for merging vertices assumed all the geometry was being mirrored.
2021-01-05 15:51:50 +11:00
a0db43cd7b Fix T84388: Invalid operator reference in the quick-start 2021-01-05 15:51:50 +11:00
6990b6ed3b Cleanup: typos (repeated words) 2021-01-05 15:51:50 +11:00
f359102589 VSE: Fix incorrect condition for skipping prefetch frames
This error was overlooked in commit be69f23b68.
2021-01-05 04:04:06 +01:00
9b17e71c23 Cleanup: Use flag type explicitly
Using the `uiButtonGroupFlag` type explicitly can avoid the need
to look up which enum should be used as an argument.
2021-01-04 17:35:14 -06:00
5a6dfb7571 Fix T78017: Broken layout in "View Lock" panel with armature
The property split layout was broken when the bone dialog appeared,
because the name field was not set. Theoretically property split should
work in this case, but it makes sense to use the label anyway.
2021-01-04 17:32:22 -06:00
9316cb33d8 Cleanup: Remove unused variables in transform mesh skin code
Differential Revision: https://developer.blender.org/D9992
2021-01-04 17:11:59 -06:00
102eff0bd4 Fix T84382: Geometry Nodes: Vertex group attributes are removed
In the report, the geometry is copied because it has two users and the
final join node needs to write to it. The join node also happens to
remove attributes apparently, because it exposed a mistake in the "copy"
method of the `MeshComponent` class. The copy is supposed to be
a deep copy, but the vertex group name map was not duplicated.

Differential Revision: https://developer.blender.org/D9991
2021-01-04 17:07:10 -06:00
ec90dda318 UI: Fix typo in operator description 2021-01-04 15:42:15 -06:00
Pi Lanningham
5a498e6a7b Fix T84183: Dark area in the bevel custom profile widget
If there was a control point at an extreme position when drawing a curve
profile (in the bottom corner), the fill's trianglulation could fail, giving
a misleading view of the curve. This is because the extra points added to
create a closed shape were exactly on the border of the view.

This commit adds a small margin to those points, so the triangulation
doesn't fail because the line overlaps itself.

Another possible solution is to use a different algorithm to fill
the polygon, such as scanfill, which is used by curve objects.
This seemed simpler, and seems to work fairly robustly.

Differential Revision: https://developer.blender.org/D9989
2021-01-04 15:13:08 -06:00
54ee410914 Fix T84376: Skin Resize(Ctrl + A) does not work in Symmetry
Since the `TransData` converted from vertices is the same used for other
transform modes (Move, Rotate, Resize), the logic used for mirroring
focused only on the position of the vertices.

The solution here is to create a specific `TansData` for `CD_MVERT_SKIN`.
2021-01-04 17:37:08 -03:00
8c80299fc4 Make mesh modifier tests not fail with optimized OSD lib
When building opensubdiv with more aggressive optimization flags
(-march=native -02) the output meshes would differ a bit from what we
expected in the current automated modifier test file.

The differences in vertex position is within the 1e-6 range, which I
would call is acceptable for floats. In addition to this, all the
modifier test that tests the subdiv modifier in particular pass without
any modifications. I've updated two tests in the modifier test file and
script to make it pass (listed below).

Updated following test categories:

1. Decimate test

Here there was a subdiv modifier applied before the actual decimate
modifier. Because the decimate modifier creates a queue of potential
vertices it can remove, it is highly sensitive to even small changes as
it drastically changes in which order the vertices are decimated in.

As this test should only be testing the decimate modifier, I pre-applied
the subdiv modifier in the test file.

2. RandomCubeModifier
For these tests I removed the subdiv modifier as well. As with decimate,
a small change in vertex position here can lead to quite different
results.

Reviewed By: Sergey, Bastien

Differential Revision: http://developer.blender.org/D9004
2021-01-04 19:30:20 +01:00
5aab7f66a0 Fix T83876: blender crashes when baking particles + smoke sim
This was introduced in rBe5c0d4613a8943c712b57fb336997ecd78e6508e.

The issue is that the new fluid system does not use the pointcache
system for caching anymore, but still relies on pointcache for
other things. For example, it uses DEG_add_collision_relations
which internally creates relations with pointcache. Not sure if
there are other issues.

Ideally, this dependence should be resolved in one way or another
at some point, but that is out of scope for this fix.

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

Reviewers: brecht
2021-01-04 15:58:51 +01:00
09c1cb8a17 Fix T84260: NURBS edit mode lines not showing
When in edit mode, the edit lines for de-selected surfaces did not
show up.

The bug was caused by the is_gpencil bool which reused another flag.
Both grease pencil and nurbs surfaces use the edit_curve_handle shader.
A dedicated flag was added to make sure the is_gpencil bool is
set correctly.

Reviewed By: fclem

Maniphest Tasks: T84260

Differential Revision: https://developer.blender.org/D9985
2021-01-04 15:34:02 +01:00
c6e5b3f42d Fix T84095: Eevee vextex color isn't working with hair
Regression introduced by {c766d9b9dc56}. When converting the vertex
buffer to a texture buffer the fetch mode wasn't checked and the short
was bitwise interpreted as a float. This change checks the fetch_mode
and select the correct texture buffer.

This could also be added to other places when needed. At this time it is
only added here to support vertex colors when used with hair particles.
2021-01-04 15:05:37 +01:00
c716b9862a Fix: Update normals when switching scene quality
Recent commits also updated normals for metaballs, curves and volumetric
objects. This change tags will tag to generate geometry for these new
types.
2021-01-04 13:04:37 +01:00
cb2517016b GPU: Enable HQ normal work around for AMD Polaris
THe high quality normals work around is enabled for Polaris cards using
the official drivers. Since driver version 2.11.2 they fail to render
using low quality normals.

The detection of polaris cards is done by matching the opengl renderer.
The renderer strings have been extracted from various reports linked to
{T82856} but isn't complete as some reports are missing the exact
renderer as users don't always report via the help menu.
2021-01-04 12:19:51 +01:00
a3fcbb54f4 GPU: Add HQ normals workaround.
This change makes it possible for platforms to only support high quality
normal rendering. This is part of {T82856} where current AMD drivers
running on the polaris architecture does not support the low quality
setting due to a driver bug.

In a next commit the work around will be enabled.
2021-01-04 12:19:51 +01:00
02d1f1482a Fix mistake in rBef90a8e12caf in data transfer code.
Old mistake from 2.80 era when we got rid of DerivedMesh...

Not critical, but could be backported to 2.90LTS too.
2021-01-04 11:30:04 +01:00
5e38384034 Fix T84362: Crash when use Vertex Paint in subdivide strokes
Maniphest Tasks: T84362

Differential Revision: https://developer.blender.org/D9983
2021-01-04 11:29:47 +01:00
c7085be6c6 Fix T84345: Transforming the cursor fails with absolute grid-snap
Absolute grid snapping was using the pivot, which doesn't make sense
when transforming the cursor.
2021-01-04 21:15:00 +11:00
d11a87b88c DrawManager: High quality normals for non meshes
This adds high quality normals for non meshes. These include

* Volumetric Object Wireframe
* Metaballs
* Extracted Curves
* Curves in edit mode

This is in preparation to fix a regression in recent AMD
drivers where the `GL_INT_2_10_10_10_REV` data type isn't
working in Polaris cards.
2021-01-04 11:09:56 +01:00
17be2149a8 Fix T84106: attribute mix node worked incorrectly on float attributes 2021-01-04 10:43:56 +01:00
b8e536f381 Fix imbuf.new & resize allowing zero & negative dimensions 2021-01-04 20:05:32 +11:00
a6285339ba Cleanup: remove unused optional argument to imbuf.new
While this didn't cause any problems, it was incorrect.
2021-01-04 20:00:27 +11:00
Philipp Oeser
80e720ee4a Fix T84191: remove python API limits for Image.scale() dimensions
Since the introduction in 2c23bb8389,
these were set to 10000 each.

This seems like an arbitrary limit (BKE_image_scale / IMB_scaleImBuf
don't have limits and I couldn't spot similar size restrictions in
image relating functions), now match what we do for creating images
(rna_Main_images_new), use INT_MAX.

Ref D9950
2021-01-04 19:05:46 +11:00
14ee48d898 Fix crash reading files with unknown modifier ID's
Missing NULL check for the modifier type.
2021-01-04 17:40:05 +11:00
f43e8cceb3 Fix early exit check in BKE_appdir_app_template_has_userpref
Logical error in 84f21c170d
This check was a no-op, replace this with a check for an empty string.
2021-01-04 17:40:05 +11:00
f17184bfeb Fix clang_array_check checking utility
Use python3 which is now supported,
only use CLANG_BIND_DIR & CLANG_LIB_DIR when they are set.

Also add immediate mode GPU API function calls.
2021-01-04 17:40:05 +11:00
3254a63218 Cleanup: correct array size in argument 2021-01-04 17:40:05 +11:00
dcdc0f177a Cleanup: use const variables 2021-01-04 17:40:05 +11:00
cd29d76ab6 Cleanup: typo in c484b54453 2021-01-04 17:38:11 +11:00
2008c24123 Cleanup: add NULL check for filename argument which could be NULL
While it's never NULL at the moment, checks elsewhere in this function
support passing in a NULL filename, so keep this working as intended
in case RNAProcessItem.filename is NULL in the future.
2021-01-04 17:38:11 +11:00
82bbe257ee Cleanup: redundant call to WM_modalkeymap_find 2021-01-04 17:38:11 +11:00
a5081896bc Cleanup: redundant code, minor inconsistencies
- Remove ternary operators when both values are the same.
- Remove break after return.
- Remove redundant NULL checks for code which handles
  those cases immediately beforehand.
2021-01-04 17:38:11 +11:00
b5c2a75d26 Cleanup: use ARRAY_SIZE when when looping over the array indicies 2021-01-04 17:38:11 +11:00
22895d0f32 Cleanup: remove self-assignment
Use CLAMP_MAX to remove redundant comparison.
2021-01-04 17:38:11 +11:00
b34eded930 Cleanup: remove redundant code
Fix for T62504 missed removing return call.
2021-01-04 17:38:11 +11:00
9ff4012711 Cleanup: sort cmake file lists 2021-01-04 17:38:11 +11:00
fea1026bb8 Cleanup: use 'pragma once'
Add explanations for cases the header-guard defines are still used.
2021-01-04 17:38:11 +11:00
dfbda59a66 Cleanup: redundant struct declarations 2021-01-04 17:38:11 +11:00
f03c25bda8 Cleanup: sort structs 2021-01-04 17:38:11 +11:00
54f89e8704 Cleanup: docy comments beginning with '/**' don't end with '**/' 2021-01-04 17:38:11 +11:00
9b10b3930b Cleanup: clang-format 2021-01-04 17:38:11 +11:00
c61c7d9926 Cleanup: spelling (use 'gimbal' instead of 'gimble') 2021-01-04 17:38:07 +11:00
613c568df2 Cleanup: use doxy sections for render_preview.c 2021-01-04 17:37:44 +11:00
12409b2069 Cleanup: rename get_brush_icon, make it a static function
Group with other icon preview API functions.
2021-01-04 17:37:44 +11:00
01f38c10cb Cleanup: use const casts in DerivedMesh.cc 2021-01-04 17:37:44 +11:00
1e8f266591 API Docs: CSS: Fix long enum list
This commit makes some adjustments to a previous fix which broke with 
new versions of sphinx/theme.

Fixes T76453
2021-01-02 20:04:25 -05:00
c7e92e379d Update RNA to manual url mappings 2021-01-02 17:51:56 -05:00
Aaron Carlisle
e1b8af9ba7 Fix Unreported: Run time error in UI code
Steps to reproduce:

1. Add clip to clip editor
2. Open the tracking settings & tracking settings extra panels

To fix this the sub panel is only drawn if a track is active.
The main panel will exit early and display a "No active track" message.
This is consistent with other panels in the clip editor.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9727
2021-01-02 16:11:14 -05:00
0330b0552b Cleanup: Explicitly pass icon size to generation function, not just bool
* This way you don't have to look up the function declaration to know what the
  boolean value means.
* You can call the function in a loop over the available sizes and pass the
  index as size.
* Makes it easier to add a new size in future if needed.
2021-01-02 15:36:51 +01:00
057a8afb87 Fix T84024: Empty image opacity labeled transparency
This value really is the opacity, or the alpha, since a value of 1.0 means
that the image is fully visible, not invisible like "full transparency"
would suggest. Mistake in rBea4d28aea0343a.

Differential Revision: https://developer.blender.org/D9920
2021-01-01 12:07:42 -06:00
0da1fc2fc4 Fix T84029: Point Distribution node crash on mesh with no faces
This bug exposes some ugliness in the implementation in poisson disk
distribution implementation with likely incorrect resizing of vectors and
some other assumptions. However, a simple quick fix is to return early
when the input mesh has no faces. This makes sense anyway because
there is no surface to scatter on.
2020-12-31 17:01:29 -06:00
cda8979005 Fix mistake in recent rB8c135fa9a834 commit. 2020-12-31 15:12:06 +01:00
8c135fa9a8 LibOverride/RNA: refactor rna_property_override_property_real_id_owner.
Makes it more in line with more generic `RNA_find_real_ID_and_path`, and
avoids generating the rna path string if we do not need it.
2020-12-31 14:25:29 +01:00
85951f8fde Cleanup: Move functions from sequencer_edit.c
These are utility functions that are not used in this file.

No functional changes.
2020-12-31 05:22:19 +01:00
e5e57fe0a2 Cleanup: Remove unused functions from sequencer_edit.c
No functional changes.
2020-12-31 05:02:10 +01:00
8373f497bd Add regression tests for curve conversion to mesh
This adds a basic set of tests for curve sampling and bevel generation.
At the moment there are basic test cases for bevels, caps, and the
filling of 2D curves, but more tests can be added in the future.

Curves are actually converted to "DispLists" for displaying them in the
viewport, so it's much simpler to rely on the mesh conversion operator
instead of building a new test framework for another data structure.

Differential Revision: https://developer.blender.org/D9958
2020-12-30 13:12:29 -06:00
Yevgeny Makarov
2d86175bac Fix unreported: Sequencer grid lines are not drawn
By design, there should be lines between the alternating horizontal
stripes in the Sequencer. But currently they are all drawn in one place,
on top of each other. Mistake in rBfae895125efe.

Differential Revision: https://developer.blender.org/D9962
2020-12-30 12:56:24 -06:00
2be2165dd6 Cleanup: Use LISTBASE_FOREACH macro
Differential Revision: https://developer.blender.org/D9960
2020-12-30 17:03:06 +01:00
f910342c8d Outliner: Fix useless assert in new liboverride showing code.
It is perfectly 'valid' to find invalid RNA properties references in
override properties list. Data change, RNA changes, IDProperties change,
some linked ID may become unavailable, etc.

Note that those invaldi override properties are cleaned up when updating
the override info (so typically on undo step storage, and .blend file save).
2020-12-30 12:38:53 +01:00
761ef45a24 Cleanup: Fix typo in tests error message 2020-12-29 20:46:29 -06:00
c1740e9ad0 Fix T83991: Pasting sound strip not working correctly
New UUID was generated for original strip not new one.

Bug caused "invisible" sound strip playing that is impossible to
remove. Especially noticable when transforming pasted strips. In such
case, file reload was necessary.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9912
2020-12-29 19:57:56 +01:00
48e0e0e2ac Fix T83439: Sculpt: Radial symmetry combined with mirroring results in texture offsets
Looks like this has been wrong since the introduction in rB5505697ac508
10 years ago.

To get the proper texture lookup in the mirrored area, first rotate, then
translate/flip [instead of the other way around].

Maniphest Tasks: T83439

Differential Revision: https://developer.blender.org/D9897
2020-12-29 18:38:16 +01:00
ae82410329 Fix T83749: Better handling of alpha in generic Nodes material wrapper for IO add-ons.
Try to detect if a given image may have valid alpha data or not (based
on number of channels and depth). This may be a bit doggy in theory, but
in practice it should cover most fields as expected. We can always
adjust the euristic here in other wrong cases appear.

This will affect all import add-ons using that node shader wrapper (at
least OBJ and FBX ones).
2020-12-29 16:38:40 +01:00
e22a36e80a Cleanup: Use proper RNA_pointer_is_null helper.
Followup to rB7f3601e70dd and rBad63d2f60e2.
2020-12-29 12:11:18 +01:00
5428ad40e8 Test: Add utility to do near comparison for float[2] 2020-12-29 10:38:38 +01:00
81c57c9471 Fix T84144 cursor wrap broken for Windows.
Modifies WM_BUTTON processing to reuse existing mousemove logic. Fixes
case where cursor wrap was not being handled on mouse release.

Bonus: flattened mouse move logic so all paths lead to a single return.
Removed case where wrap is not handled until subsequent mousemove as
button press may rely on updated mouse move position.
2020-12-28 13:34:58 -08:00
1db27af38f Fix T84200: Rotating a paintcurve [all paintmodes] doesn’t work correctly
The transform code did not provide a 2d context to be used in 3d space.

The solution is to set all matrices for the screen space in these cases.

This commit also removes the dial3d drawing in these cases.
It was not correct anyway.
2020-12-28 16:19:37 -03:00
Erik Abrahamsson
6fbeb6e2e0 Add operator to copy a modifier to all selected objects
These two operators (one for grease pencil, one for other objects)
copy a single modifier from the active object to all selected objects.
The operators are exposed in the dropdown menus in modifier headers.

Note that It's currently possible to drag and drop modifiers between
objects in the outliner, but that only works for dragging to one object
at a time. Modifiers can also be copied with the "Make Links" operator,
but that copies *all* modifiers rather than just one. The placement
and scope of these new operators allow for more useful poll messages
and error messages as well.

Every object type that supports modifiers is supported. Although hook
and collision modifiers aren't supported because of an unexplained
comment in `BKE_object_copy_modifier`, other than that, every modifier
type is supported, including particle systems, nodes modifiers, etc.

The new modifiers are set active, which required two small tweaks to
`object.c` and `particle.c`.

Reviewed By: Hans Goudey (with additional edits)

Differential Revision: https://developer.blender.org/D9537
2020-12-28 11:18:52 -06:00
7f3601e70d Cleanup/refactor rna_idp_path code.
Factorize common processes and checks, early `continue` in invalid
cases, etc.
2020-12-28 17:40:27 +01:00
ad63d2f60e Fix T84091: IDProperties/RNA: Crash due to colliding name between custom data and static RNA property.
We have to check that the RNAProperty found in `rna_idp_path` from the
currently checked IDProperty name is actually a real runtime RNA-defined
one, and not a static C-defined RNAProperty...
2020-12-28 17:40:27 +01:00
b1d8aeeab2 Snap: Decrease the distance of the incremental snap in ortho view
This matches more the older versions (as shown in the T77819).
2020-12-28 11:44:43 -03:00
26c34a2a3a Tweak comment regarding Sculpt mode undo issues in object update code.
Original comment from rB8a9dedf82954. See also T84084.
2020-12-28 14:16:14 +01:00
823f0da702 Cleanup: UI messages fixes. 2020-12-28 10:22:02 +01:00
e6bb2cdec7 Cleanup: Typo: overriden -> overridden. 2020-12-28 10:22:02 +01:00
e0b6c8f777 Fix possible fall-through in outliner region listener
Reported as a strict compiler warning, and the need of fall-through is
not needed from just reading the code.

If it is something what must happen, the reasoning is to be explained
in the comment, and ATTR_FALLTHROUGH is to be used.
2020-12-28 09:57:59 +01:00
e590d2d167 Cleanup: Declare variables where initialized 2020-12-27 21:46:57 -06:00
57fe65b17e Cleanup: Reduce indentation
Since the if statement is just a NULL check, returning early is simpler
and makes reading the rest of the funtion easier.
2020-12-27 21:26:53 -06:00
aa64fd69e7 UI: List library overrides in the Outliner
Having a centeral place to find a list of all library overrides should be
useful for managing production scenes where library overrides are used a lot.
This change adds the individually overridden properties of a data-block under
the data-block itself. Just how we show modifiers, constraints or pose channels
there. This way we can also expose library override operations/options better
in future.

There's also a filter option for the library overrides now, so they can be
hidden. It is only available in the View Layer display mode though, like the
other filter options.

One internal change this has to do is adding more informative return values to
undo pushes and the library override functions called by it. That way we can
send a notifier when library overrides change for the Outliner to know when to
rebuild the tree.

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

Reviewed by: Andy Goralczyk, Bastien Montagne, William Reynish
2020-12-27 22:45:41 +01:00
960a0b892c Fix T84101: Duplicate operator not available for some data-block selectors
In some operators that previously allowed duplicating the selected data-block,
the operator would not be available now. 2250b5cefe split the "new" operators
into "new" and "delete" to allow clearly differentiating between the two. But I
apparently didn't amend all affected data-block selectors to use the added
"duplicate" operators.
I went over all operators that were split now and made sure all affected
data-block selectors are updated.
2020-12-27 15:55:58 +01:00
e56fe47748 Fix crash when saving render from temporarily maximized render window
Steps to reproduce were:
* Start with factory defaults
* Set "Render in" to "Maximized Area"
* Render
* Open "Save as"
* Click Cancel

Mistake in  78d2ce19c4. Was using the wrong area pointer, which I think
didn't make a difference in most cases, but here it did.
2020-12-27 15:11:26 +01:00
7916c59304 UI: Grammar: "Clean Up" vs "Cleanup" in operator name
"Cleanup" is a noun while "Clean Up" is the verb.
2020-12-26 16:50:44 -06:00
8491e4ab86 Fix unreported: Cycles CLI device override doesn't set peer memory usage flag
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9929
2020-12-25 23:13:03 +01:00
Nicholas Rishel
565ea3df60 Simplification of Wintab event handling.
Previously Wintab packets were added to a local queue to be processed
during Win32 mouse events, in order to correlate Wintab to Win32
mouse buttons. Wintab packets before Win32 mouse down events were
expired on a timer.

This commit drives mouse events during Wintab events when a device is
in range. When a Wintab button is found it is dispatched if an
equivalent event can be popped from the Win32 event queue. If a Win32
mouse button event is not associated with a Wintab event, it falls
through to WM_BUTTON handling. All Wintab packets are handled as they
are received.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9908
2020-12-24 16:41:19 -08:00
Yevgeny Makarov
af316d2761 UI: Cleanup spelling of compound words
Approximately 138 changes in the spelling of compound words
and proper names like "Light Probe", "Shrink/Fatten", "Face Map".
In many cases, hyphens were used where they aren't correct, like
"re-fit". Other common changes include:
 - "Datablock" -> "data-block"
 - "Floating point" -> "floating-point"
 - "Ngons" -> "n-gons"

These changes help give the language used in the interface
a consistent, more professional feel.

Differential Revision: https://developer.blender.org/D9923
2020-12-24 13:11:22 -06:00
Yevgeny Makarov
2917f550ca Cleanup: Fix capitalization in various UI strings
Approximately 195 changes of capitalization to conform to MLA title style.
UI labels and property names should use MLA title case, while descriptions
should be capitalized like regular prose, generally with only the start of
a sentence capitalized.

Differential Revision: https://developer.blender.org/D9922
2020-12-24 11:07:32 -06:00
fe440a92e9 Cleanup: compiler warning 2020-12-24 14:19:21 +01:00
29cd99e7fd Cycles: remove surface area computation for meshes with OSL
This is relatively expensive and as per the OSL spec, this value is not
expected to be meaningful for non-light shaders. This makes viewport updates
a little faster.

As a side effect also fixes T82723, viewport refresh issue with volume density.
2020-12-24 13:53:33 +01:00
c4f8aedbc2 Fix T84016: Cycles baking crash with OptiX after recent changes
This worked for CPU + GPU, but not GPU only.
2020-12-24 12:59:35 +01:00
2221389d6e Bake: vertex color baking support for Cycles
In the Bake > Output panel, there is now a choice between Image Textures and
Vertex Colors. The active vertex color layer is used for baking. This works
with both existing per-corner and sculpt per-vertex vertex colors.
2020-12-24 12:40:48 +01:00
0b4fae7a51 Cleanup: refactoring of bake code in preparation of vertex color baking
Split of internal/external image bake target code off into smaller functions and
refactor associated data structures for clarity. Designed so that a vertex color
bake target is easy to fit in.

Also avoid passing in a huge number of arguments into the main baking function,
pass a struct instead.
2020-12-24 12:00:58 +01:00
58c697a9ec Audaspace: port accuracy improvement from upstream. 2020-12-24 10:42:16 +01:00
83ad35cb9c Fix T83997: Duplicated audio does not sound the same
The issue was that sounds were always faded from 0 volume when they
started and depending on the currently used buffer size, the fading took
longer or shorter.

The solution stores whether the sound has ever been played back and
consequently does not fade when starting to play back.
2020-12-24 10:42:16 +01:00
c9efb54240 Cleanup: Clang format 2020-12-23 12:13:44 -06:00
d8dc4c5b32 Geometry Nodes: new Rotate Points node
This node updates the "rotation" attribute on points.
Multiple ways to specify the rotation are supported.

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

Ref T83668.
2020-12-23 16:37:47 +01:00
8a9dedf829 Workaround T84084: Assert/crash when undoing from Sculpt mode to Object one.
Disclaimer: This workaround avoids crashing with current state of the
code and is only committed as temporary band-aid until we can assess the
full issue and decide if/how it needs to be adressed.
2020-12-23 16:03:42 +01:00
d29a720c45 Fix T84002: Sculpt: Masking operations crash if multires is in play.
This fixes the main issue there (essentially a followup to
rB90e12e823ff0: Fix T81854: crash when undoing switch between sculpt and
edit mode).

We basically remove more (hopefully all the remaining!) modifications of
orig mesh from `sculpt_update_object`, as those done here will not be
immediately available in the evaluated data (that specific bug happened
because masking data was added to orig mesh there, but not flushed to
depsgraph evaluated one).

This also goes towards a better separation between handling of evaluated
data and orig one.

Note that modification of orig mesh data can still happen, e.g. values
in some cdlayers, but at least all pointers should now be valid in the
evaluated mesh.

There are still some issues, e.g. we now get an assert/crash in
`multires_reshape_assign_final_coords_from_ccg` when undoing out of the
Sculpt mode, presumably because subdiv_ccg data remains unchanged then
(and hence still has the `has_mask` flag set), while actual mesh data do
not have that cdlayer anymore...

This commit also cleans up/simplifies some code,
`ED_object_sculptmode_enter_ex` was (indirectly) calling
`BKE_sculpt_face_sets_ensure_from_base_mesh_visibility` twice e.g.
2020-12-23 16:03:42 +01:00
9d04fa39d1 Fix T84063: crash reading pointer properties in Attribute shader node
Path resolving can find e.g. a datablock rather than a float or integer,
treat that as a failure to find a valid property.
2020-12-23 15:50:31 +01:00
635694c0ff Fluid: Added new viscosity solver
Mainly updated the Mantaflow version. It includes the new viscosity solver plugin based on the method from 'Accurate Viscous Free Surfaces for Buckling, Coiling, and Rotating Liquids' (Batty & Bridson).

In the UI, this update adds a new 'Viscosity' section to the fluid modifier UI (liquid domains only). For now, there is a single 'strength' value to control the viscosity of liquids.
2020-12-23 15:48:38 +01:00
5cfda8e7f7 Fix crash closing File Browser window after closing temporary render window
This seems to be a longer standing issue. Steps to reproduce were:
* With factory settings, Ctrl+O then F12
* Close the render window using the window close button
* Close the File Browser window using the window close button

This could be OS specific though, at least on macOS this caused a crash.
2020-12-23 15:31:31 +01:00
21cb288029 Fix incorrect debugging text in extra operator icons for buttons 2020-12-23 14:43:40 +01:00
27fcaa6173 Cleanup: Move functions to new ED (editor) operators file & general cleanup
With the new `ed_util_ops.c` introduced in 2250b5cefe, existing code can be
cleaned up to use it.

* Move new ID preview operators to `ed_util_ops.c`
* Move ED operator registration to `ed_util_ops.c`
* Use doxygen sections in `ed_util_ops.c`
* Rename ID related ED operators to use `ED_OT_lib_id_` prefix.
* Remove unused `#include`s
2020-12-23 14:34:24 +01:00
78d2ce19c4 Fix T84013: Crash closing maximized File Browser opened from Preferences
After 1e799dd26e, the logic to recognize a temporary File Browser window
didn't work correctly anymore. It would recognize a maximized File Browser
inside a temporary window as a temporary File Browser window, and attempt to
close this (rather than returning to the previous layout).
The logic there was pretty weak, and still is I think. A more stable solution
would need bigger refactoring.

With this, it's also not possible to maximize or fullscreen an area within a
temporary window (Preferences, File Browser, render window) anymore. Think that
won't make a noticable difference, since you couldn't open multiple areas there
anyway, and the area seems to be maximized already.

Cleaned up the code a bit to not become more confusing with the changes.
2020-12-23 14:34:24 +01:00
9460051c1a Sculpt Undo: Fix broken memory size and potential use of uninitialized variables.
That code looked really like a joke tbh... Random reported memory usage
is not really that important, but the uninitialized items counts was
potentially fairly severe.
2020-12-23 11:17:58 +01:00
b4b888fd2a Cleanup: Reduce Variable scope clip_buttons 2020-12-22 20:13:05 -05:00
8d3d4c8840 Cleanup: Use true and false for booleans 2020-12-22 14:58:57 -06:00
4b46afae09 WM: minor optimization for when there is a large number of notifiers
Don't add the same stats refresh notifiers multiple times, it can be slow to
search the full list of notifiers for duplicates when there are many.

Fundamentally the time complexity in searching for duplicates is still bad.

Inspired by D9901 from Erik Abrahamsson
2020-12-22 19:26:06 +01:00
ac82904c49 UI: keep image open button always visible in image editor datablock selector
Does not need to be hidden in the menu.
2020-12-22 18:18:22 +01:00
00ff3dfb23 Cleanup: Reduce variable scope in object.c 2020-12-22 10:35:18 -06:00
b2edc716c1 Fix Cycles OptiX runtime compilation broken after shader raytracing
Need to pass the appropriate flags as we do for compilation as part of the
CMake build.
2020-12-22 15:08:59 +01:00
dad5aded0c Fix T84006: Cycles AOV not written with some mix shader node set ups 2020-12-22 14:25:50 +01:00
2601501fce RNA: make bpy.data.orphans_purge() return number of deleted datablocks
Sometimes multiple calls to `bpy.data.orphans_purge()` are needed to
delete all orphans, because a call can turn previously-used datablocks
into orphans. Returning the number of deleted datablocks makes it
possible to keep looping until nothing can be deleted any more.

This patch keeps track of deletions in `id_delete()` so that it can be
returned up the call stack.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9918
2020-12-22 14:05:49 +01:00
512a23c3d6 VSE: handle IO errors when reading disk cache header and version
Respond to return values of `fscanf()` and `fread()` to detect and
handle I/O errors. Not only is error handling a good idea, this also
prevents warnings from GCC that `fread()` and `fscanf()` return values
are ignored.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9915
2020-12-22 11:43:33 +01:00
0e85d701c6 Animation: Bake Action, improved discontinuity filter for bones
Perform the same filtering as e5528904f1
introduced for object rotations, for bone rotations.
2020-12-22 10:04:21 +01:00
9f34f2b20d VSE: Fix animation versioning for bezier F-curves
`seq_convert_transform_animation()` converted only keyframed value, but
when bezier interpolation is used, posotion of handles was unchanged.
This caused significant difference in animation.

I have checked only linear interpolation when testing versioning originally.
2020-12-22 05:50:34 +01:00
ffacce5be4 UI: Properties editor popover and outliner sync
This adds a popover to the properties editor. Currently the only setting
is for controlling outliner to properties syncing.

Because we cannot define a perfect heuristic to determine when
properties editors should change tabs based on outliner icon selection,
we need an option to enable or disable this behavior per properties
editor.

There are 3 options for controlling the syncing. Auto uses the heuristic
to only allow tab switching when a properties editor and outliner share
a border. On and off enable and disable syncing respectively.

Differential Revision: https://developer.blender.org/D9758
2020-12-21 14:31:32 -07:00
Wayde Moss
2d6e6d035b Nla Refactor: Better blend function parm naming
**Renames parms**:
| **old name** | **new name**
| old_value | lower_value
| target_value | blended_value
| value | strip_value
| inf | influence

**Reason**: {D8296} allows full nla stack evaluation with proper
keyframing support. These names should make it more intuitive how all
the data gets processed and inverted. Note, that I do use the term
"strip_value" instead of something like "fcurve_value" of the tweak
strip. Technically, "strip_value" is closer to what is solved for.
For example, if a noise fmodifier was active for the fcurve, then the
remapping would appear to be wrong. In the future, further solving can
be done afterward, outside of the nla system, to remove the effects of
fmodifiers.

**Renames functions**:
| nla_invert_blend_value | nla_blend_get_inverted_strip_value
| nla_invert_combine_value | nla_combine_get_inverted_strip_value

**Reason**: D8296 adds get_inverted_lower_value() variants,
so "invert" alone is too vague.

**Renames NlaKeyframingContext member**:
| nla_channels | lower_eval_data

**Reason**: D8296 evaluates the upper stack. This name makes it more
obvious what data is stored there.

No functional changes (relative to the dependency below)
Split from {D9247}
Depends on {D9694} since the code was so close to eachother.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9695
2020-12-21 14:07:16 -05:00
1e2c028a3a Fix/workaround geometry nodes not working with deformation motion blur
Always assume geometry nodes produce potentially animated meshes or point
clouds. In general it is hard to check if geometry nodes are animated, and
for modifiers this was already weak.

The better solution will likely involving checking which geometry was
modified by the depsgraph on frame change, to replace the current mechanism
of manually checking for certain types of modifiers and animation.
2020-12-21 19:19:59 +01:00
36b6ea6cb1 Weight Paint: fix Multi-Paint weight display after rB5502517c3.
Weight Paint Multi-Paint definitely depends on the weight specific
flag, and vertex group locking also involves group name symmetry
via BKE_object_defgroup_mirror_selection. These two are also
features implemented by me so I feel confident.

The rest of object_vgroup.c possibly should be changed too, but
that requires more consideration than these obvious cases.
2020-12-21 20:50:05 +03:00
be71bd8fcc Cleanup: Reduce indentation 2020-12-21 09:43:54 -06:00
Matteo Falduto
985528c9b9 UI: make light spot shape panel consistent between Cycles and Eevee
Differential Revision: https://developer.blender.org/D9906
2020-12-21 14:15:21 +01:00
d2239b685c UI: Use better icon for identifying assets
Use the `ASSET_MANAGER` icon which is more appropriate than the current one
which was just an unused icon that seemed sorta fitting, but was only meant to
be temporary.
The `ASSET_MANAGER` icon is already used for the Asset Browser, so it's being
reused which we normally avoid. So we may still want to create a dedicated one,
maybe a variation of this one.
2020-12-21 13:33:48 +01:00
626a9aae6d Fix part of T84004: Some 2.92 alpha UI strings can't be translated.
Adding 'new' (?) `heading` parameter of some UILayout functions...
2020-12-21 11:50:38 +01:00
5fe24ce295 Fix T84010: Missing scale animation versioning code
Code was removed in 247b10e6a2 but it was incorrect in first place.
Conversion was done for `offset_x` and `offset_y` channel originally,
but it should be done for `scale_x` and `scale_y`
2020-12-21 11:36:39 +01:00
c34ba26856 Fix part of T84004: Some 2.92 alpha UI strings can't be translated.
Not sure why, but py files from `bl_operators` were never considered for
i18n string extraction... They do define some UI strings though.
2020-12-21 11:35:02 +01:00
c9c3bf9833 Some more UI messages fixes... 2020-12-21 10:52:15 +01:00
42e2dd2178 Fix some UI messages and update i18n spellcheck utils. 2020-12-21 10:49:33 +01:00
720b2c6655 install-deps: Install OIIO utils, re-enable package on RPMs.
OIIO utils are mandatory for a whole set of tests (Cycles, VSE), and
it's a small package, no reason to not install it.

Also re-enabling package handling of OIIO on RPM-based distro, not sure
why it was disabled but this has become a fairly stable and standard
library now, would not expect issues anymore.
2020-12-21 09:49:08 +01:00
Matt Hill
fdb7623e09 Unix/macOS: support building with Ccache
This adds an option (WITH_COMPILER_CCACHE) to build using Ccache if it's
found. Makefiles-based, Ninja-based and Xcode generators are supported.

Pass `-DWITH_COMPILER_CCACHE=ON` to cmake to enable Ccache.
Utility option in GNUmakefile is also added: for e.g.,
`make ninja ccache`.

Reviewed By: brecht, ankitm
Differential Revision: https://developer.blender.org/D9665
2020-12-21 10:47:35 +05:30
Garry R. Osgood
84cc00f3b6 Fix T83989: Attribute Math node ignores its operation setting
T83989 observes that the Attribute Math node always adds its
operands regardless of its operator setting. This was caused
by an oversight committed in rB23233fcf056e42, which overlooked
adjusting the exec function to use the new storage location.

Differential Revision: https://developer.blender.org/D9909
2020-12-20 18:46:24 -06:00
c229d9876b Cleanup: Correct comment 2020-12-20 18:42:35 -06:00
d283a093d6 fix T83880: Added check for valid context object to avoid null pointer exception when no object in scene 2020-12-20 18:48:40 +01:00
Yevgeny Makarov
478ba53270 UI: Fix text padding in some list widgets
Normally, pure text buttons have no padding at their edges so they
align with edges of buttons, see D9058. However, in several cases
there are labels aligned to the right side of a list widget row,
so they're missing padding against the right edge.

The fix is to use emboss = 'NONE' for such labels, which changes
the drawing style, adding padding on the right edge. (Normally so
labels aligned with the text from non-embossed buttons). This is
not necessarily intended, but it works properly.

For more information, see the revision.

Differential Revision: https://developer.blender.org/D9874
2020-12-20 11:27:02 -06:00
16527ebaba UI: Slightly improve alignment in selection tool icons
Parts of the tool icons for box, circle, lasso, and tweak select that were
meant to be flat or at a 45 degree angle were slightly misaligned, making
the edge look blurry.
2020-12-20 10:53:23 -06:00
Peter Fog
5a69f70751 VSE: Add options to select neighboring handles
Options added to `sequencer.select_handles()` operator.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7707
2020-12-20 06:23:08 +01:00
Yevgeny Makarov
864c806863 UI: Reorder enums in render results image editor header
The convention is to put the label at the bottom of the enum, or in the
spot furthest away from the button. This commit reorders the items in
the "Slot", "Layer", and "Pass" menus to be consistent with this
convention. It also reorders the numbering so that higher numbers are
lower.

The original patch was by Adrian Newton (@TFS), with slight changes
and additions.

Differential Revision: https://developer.blender.org/D7142
2020-12-19 21:52:45 -06:00
38b77ef8b2 VSE: Remove cost calculation from cache
This value was meant to be used for keeping images that are slowest to
render in cache. Method of measurement was flawed, because it doesn't
take UI overhead into consideration.

Cache panel is to be removed because users should not have to tweak
settings like this. It is not useful for development either, therefore
it is removed completely.
2020-12-20 03:58:38 +01:00
c4ff91aab7 VSE: Fix incorrect cache memory usage calculation
If image is cached twice, it's size has been counted twice as well, but
only image reference count is increased, not memory usage.

Use `MEM_get_memory_in_use()` instead of size own tracking.
2020-12-20 03:51:56 +01:00
Aaron Carlisle
0144b70948 Movie Clip: Annotation UI Improvements
Previously, the Annotation panels were a bit buggy in the movie clip editor.
This commit fixes the issue of the panel in the sidebar would disappear
when selecting  "Tracks" if no tracks were added to the clip.
To solve this issue the user if given a label text saying "No annotation source"

This commit also removes some grease pencil operators from the toolbar
that do not work with the new annotation system.

This commit also moves the data source choice from the toolbar to the sidebar.
This is needed to migrate the current toolbar to the new tool system
(see T83612)

Some old invalid code was also removed.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D9729
2020-12-19 14:49:38 -05:00
Aaron Carlisle
6538f1e600 Compositor: New Exposure Node
This new node increases the radiance of an image by a scalar value.
Previously, the only way to adjust the the exposure of an image was with
math node or using the scene's color management.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D9677
2020-12-19 14:41:14 -05:00
09be4a0917 Cleanup: Use typedef for UI emboss type enum
Previously both `char` and `int` were used to represent this enum.

Differential Revision: https://developer.blender.org/D9903
2020-12-19 10:07:20 -06:00
a5a302bd18 Cleanup: Split SEQ_sequencer.h file 2020-12-19 07:25:01 +01:00
046ca0749a Cleanup: Rename BKE_sequencer functions
API functions get SEQ_ prefix.
Intern functions get seq_ prefix

Functions also have appropriate category included in name.
2020-12-19 06:29:15 +01:00
6942dd9f49 Fix T83868: Button animation states no longer visible without emboss
This bug was caused by making it so that non-embossed modifier icon
buttons could become an operator button and retain their red highlight
for disabled modifiers. The icon button needs emboss turned off, but
in earlier versions of Blender, `UI_EMBOSS_NONE` would be overridden
by animation or red alert states.

Instead of abusing "NONE" to mean "none unless there is animation or
red alert", this commit adds a new emboss flag for that situation,
`UI_EMBOSS_NONE_OR_STATUS`, which uses no emboss unless there is an
animation state, or another status. There are only a few situations
where this is necessary, so the change isn't too big.

Differential Revision: https://developer.blender.org/D9902
2020-12-18 17:13:15 -06:00
002722bb80 Fix build error after previous commit
I tested building so many times while making this patch, but somehow
the previous commit was missing a padding variable, I have no idea how.
2020-12-18 17:08:49 -06:00
c106b07e23 Cleanup: Remove unused variables from the bNode struct
In some cases the variables were set but never used anywhere.

Differential Revision: https://developer.blender.org/D9889
2020-12-18 17:04:52 -06:00
6367bc716a Cleanup: Use true and false for booleans 2020-12-18 15:12:15 -06:00
e298339289 Cleanup: Declare variables where initialized
Also decrease scope of some variable declarations.
2020-12-18 12:39:50 -06:00
6be9747b96 Cleanup: Use bool instead of int 2020-12-18 12:12:32 -06:00
2250b5cefe UI: Redesigned data-block selectors
The previous design is rather old and has a couple of problems:

* Scalability: The current solution of adding little icon buttons next to the
  data-block name field doesn't scale well. It only works if there's a small
  number of operations. We need to be able to place more items there for better
  data-block management. Especially with the introduction of library overrides.
* Discoverability: It's not obvious what some of the icons do. They appear and
  disappear, but it's not obvious why some are available at times and others
  not.
* Unclear Status: Currently their library status (linked, indirectly linked,
  broken link, library override) isn't really clear.
* Unusual behavior: Some of the icon buttons allow Shift or Ctrl clicking to
  invoke alternative behaviors. This is not a usual pattern in Blender.

This patch does the following changes:

* Adds a menu to the right of the name button to access all kinds of operations
  (create, delete, unlink, user management, library overrides, etc).
* Make good use of the "disabled hint" for tooltips, to explain why buttons are
  disabled. The UI team wants to establish this as a good practise.
* Use superimposed icons for duplicate and unlink, rather than extra buttons
  (uses less space, looks less distracting and is a nice + consistent design
  language).
* Remove fake user and user count button, they are available from the menu now.
* Support tooltips for superimposed icons (committed mouse hover feedback to
  master already).
* Slightly increase size of the name button - it was already a bit small
  before, and the move from real buttons to superimposed icons reduces usable
  space for the name itself.
* More clearly differentiate between duplicate and creating a new data-block.
  The latter is only available in the menu.
* Display library status icon on the left (linked, missing library, overridden,
  asset)
* Disables "Make Single User" button - in review we weren't sure if there are
  good use-cases for it, so better to see if we can remove it.

Note that I do expect some aspects of this design to change still. I think some
changes are problematic, but others disagreed. I will open a feedback thread on
devtalk to see what others think.

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

Reviewed by: Bastien Montagne

Design discussed and agreed on with the UI team, also see T79959.
2020-12-18 18:28:04 +01:00
7bee1489c1 UI: Rename "Float Color" attribute data type to "Color"
Since "Float Color" is more commonly used than "Byte Color",
which is not exposed in the interface yet anyway, it makes sense to
drop the "Float" label on the color data type name.
2020-12-18 09:34:21 -06:00
3deb21055a Geometry Nodes: support randomly picking instances from collection
This uses the "id" attribute to randomly pick instances from a collection
for each point.

There is one issue. When the collection is updated (e.g. when an object is
added to it), the nodes modifier is not automatically updated. It seems
like we don't have the infrastructure to support this dependency yet.
The same issue exists in the Boolean modifier and with collision collections.
This should be solved separately soonish.

When "Whole Collection" is disabled, one direct child of the input collection
is instanced at each point. A direct child can be an object or a collection.

Currently, all objects are picked approximately equally often. In the future,
we will provide more control over which point gets which instance.

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

Ref T82372.
2020-12-18 16:02:23 +01:00
1be465cccb GPencil: Fix potential error in interpolate frame
As now it is using a duplicated frame, the untag must be done before copying the frames.
2020-12-18 15:57:19 +01:00
f3b50380f0 Fix T83916: Cannot drag link from socket if node is inside frame
Caused by rB7470c10601d0 where iterating nodetree nodes was changed from
backwards to forwards by mistake.

Maniphest Tasks: T83916

Differential Revision: https://developer.blender.org/D9890
2020-12-18 14:41:38 +01:00
Vincent Blankfield
95afc53604 Fix T83716: Dope Sheet, incorrect scaling of channel UI elements
Change the top coordinate of the animation channel list UI elements to
`rect->ymin` so they correctly span from `rect->ymin` to
`channel_height`.

Some buttons in the dope sheet channels didn't scale properly with the
`Keyframe Scale Factor` preferences setting. This was caused by using
the `ymid` value (`ymid = BLI_rctf_cent_y(rect) - 0.5f * ICON_WIDTH`) to
position the buttons that supposed to fill all vertical space in the
channel (with `channel_height` height). The `ymid` value is only
appropriate for the UI elements that with `ICON_WIDTH` height.

Maniphest Tasks: T83716

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D9841
2020-12-18 14:13:52 +01:00
e5764013b0 Geometry Nodes: move Boolean node to mesh category
This node works on meshes specifically.
2020-12-18 13:33:24 +01:00
c5569ba140 Geometry Nodes: do not crash when there are undefined nodes
Undefined geometry nodes will just output a default value now.
2020-12-18 13:28:55 +01:00
79d6bd9a22 Functions: add generic pointer class for const pointers
This adds a GPointer class, which is mostly the same as GMutablePointer.
The main difference is that GPointer references const data, while GMutablePointer
references non-const data.
2020-12-18 13:28:55 +01:00
f43561eae6 Function Nodes: Input Vector
Ref: T82651

Normally people use "Combine XYZ" to input a vector, but it is more
interesting to have an explicit vector input.

So this is basically "Combine XYZ" without any input sockets, the values
are stored in the node itself.

Differential Revision: https://developer.blender.org/D9885
2020-12-18 13:03:27 +01:00
b342e089c3 Fix mistake in Bake Action discontinuity fix
Fix mistake in e5528904f1 where one change accidentally wasn't included
in the commit.
2020-12-18 13:02:28 +01:00
e5528904f1 Fix T83351: Baked object rotation has discontinuities
Fix Euler discontinuities in the Bake Action operator, by explicitly
using the previous Euler angles when converting from matrix to rotation.

This basically follows the same approach as used in e4ca1fc4ea, although
the Euler Discontinuity Filter also performs single-channel filtering which
the Bake Action operator doesn't.
2020-12-18 12:50:36 +01:00
fe5d2448c6 Fix T83494: Eevee clamp node incorrect when min > max.
In glsl the clamp function has undefined behavior when min > max. For
the clamp node this resulted in differences between cycles and eevee.
This patch adds the expected implementation for minmax.

The old clamp function is still used in cases where we know for certain
that the input values are correct (math node clamp option). GPU uses
optimized code and silicon in these cases.
2020-12-18 10:26:02 +01:00
ffb6648a97 Fix T83625: Shading attribute names cause compilation error.
Some GPU platforms don't support having more than one underscore in
sequence in an attribute name. This change will remove the underscore
as a possible character when encoding to save names.
2020-12-18 09:56:28 +01:00
4f9e21bdc9 Fix T82591: Performance regression when rendering at very high resolution
This patch introduces a partial update of GPUTexture. When rendering
a large image the GPUTexture could have been scaled. The old implementation
would rescale the image on CPU and create a new GPUTexture. This
resulted in flooding the PCI bus.

The new solution would only scale and upload the parts of the GPUTexture
that has been changed. It does this by keeping track of areas of 256x256
pixels. When something changes the tiles that cover that changes will be
rescaled and uploaded the next time the GPUTexture is requested.

Test situation: Default Cube, 4 samples, 19200x10800 tile size 512.

Blender 2.83.9: 4m27s.
Blender 2.91:   20+m (regression)
This patch:     1m01s.

There is still room for more optimizations:
* Reduce the time that an image is locked.
** Use task scheduling to update the tiles of an image.
** Generic optimization of the ImBuf scale method.

Maniphest Tasks: T82591

Differential Revision: https://developer.blender.org/D9591
2020-12-18 09:18:44 +01:00
095b693614 Outliner: Set active modifier on click
The outliner already expands the panel for the modifier you click on,
this just extends that idea to also set it active, which is consistent
with behavior of active and selected items elsewhere in Blender.
2020-12-17 23:35:05 -06:00
9dbc014af7 Cleanup: Various clang tidy warnings
There are more in the new mesh fairing code and in the poisson
distribution code, this commit doesn't fix those.
2020-12-17 22:53:47 -06:00
7d25139eaf Fix T82960: Inaccurate selection on collapsed outliner rows
After rB15083d9e1 the outliner tree is not rebuilt after expanding or
collapsing rows. Because the tree is no longer rebuilt the positions
and flags of the elements are not cleared when collapsing a row. This
caused hover highlights and selections on the collapsed child icons to
be incorrect in many cases.

For example, only the direct children of a collapsed element are drawn
inline. If any grandchild elements had been previously icon row flagged
they would continue to be evaluated as icon row elements despite being
hidden. In this case the x coordinates of the child and grandchild would
overlap causing selection to appear erratic.

Now the flags for inline row icons are explicitly cleared, which was
previously only done because the tree was rebuilt on collapsing rows.
2020-12-17 20:10:20 -07:00
7cbcfb7f49 Cleanup: Use LISTBASE_FOREACH macro in outliner code
No functional changes.
2020-12-17 19:59:49 -07:00
f880fe2d66 Fix T82288 Wintab walk navigation erratic.
Walk navigation relies on tablet data being set to detect if motion is
absolute. This patch sets tablet data in Ghost to dummy values when a
tablet pen is in range and not handled by Wintab processing.
2020-12-17 17:21:15 -08:00
Yevgeny Makarov
ef17fb2715 UI: Don't use abbreviations in label text
Expand abbreviations for words like "Bright" (instead of "Brightness"),
"Premul", "Lib", "Dir", etc.

Differential Revision: https://developer.blender.org/D9862
2020-12-17 19:06:21 -06:00
23233fcf05 Cleanup: Use abstraction for attribute math node input
Since creating the attribute node, a helper function has been added to
automatically get the input attribute or a constant value, depending on
the "input type" values for the node. This commit replaces the specific
implementation of that behavior with the new helper function.

The versioning is necessary since the node now has a "storage" struct.
2020-12-17 14:43:01 -06:00
b10d8e330e Cleanup: renaming and code deduplication for color space clarity in picker
Ref T68926
2020-12-17 20:08:58 +01:00
f193b1afb3 Color Management: use scene linear HSV for number buttons in color pickers
Previously these HSV values were in the color picking space, which meant the
relation to the scene linear RGB values was confusing.

The new situation:
* RGB number buttons: scene linear color space
* HSV number buttons: scene linear color space
* Picker widgets: color picking color space
* Hex: sRGB color space

Fixes T69562, T83853, Ref T68926
2020-12-17 20:08:58 +01:00
48ddb94a26 Geometry Nodes: Point separate and attribute compare nodes
This patch adds two related nodes, a node for separating points
and mesh vertices based on a boolean attribute input, and a node
for creating boolean attributes with comparisons.

See the differential for an example file and video.

Point Separate (T83059)
The output in both geometries is just point data, contained in the mesh
and point cloud components, depending which components had data in the
input geometry. Any points with the mask attribute set to true will be
moved from the first geometry output to the second. This means that
for meshes, all edge and face data will be removed. Any point domain
attributes are moved to the correct output geometry as well.

Attribute Compare (T83057)
The attribute compare does the "Equal" and "Not Equal" operations by
comparing vectors and colors based on their distance from each other.
For other operations, the comparison is between the lengths of the
vector inputs. In general, the highest complexity data type is used
for the operation, and a new function to determine that is added.

Differential Revision: https://developer.blender.org/D9876
2020-12-17 12:22:47 -06:00
Himanshi Kalra
e7b698327c Updated and extended Regression Testing frameworks (Gsoc 2020)
This revision contains the following changes-

  - Updated the existing testing framework for Modifiers for Regression
  Testing.
  - Tests for Physics modifiers and remaining Generate and Deform modifiers are added.
  - The existing `ModifierSpec` is updated with backward compatibility to support Physics Modifiers.
  - Now there is support for frame number and giving nested parameters for attributes.
  - Some Deform modifiers required Object Operators, e.g. "Bind" in Mesh Deform, so a new class was added to support that functionality.
  - A separate class for holding Particles System, they are tested by converting all the particles to mesh and joining it to the mesh they were added.
  - Updated the format to add tests for Bevel, Boolean and Operators as
  well.

Reviewed By: zazizizou, mont29, campbellbarton

Differential Revision: https://developer.blender.org/D8507
2020-12-17 20:58:20 +05:30
fed995ced5 Fix T83888: Ctrl F in Asset Browser crashes blender
In case of being in Asset browsing mode, the search field is located in
the header (RGN_TYPE_HEADER not RGN_TYPE_UI as for file browsing mode).
To be future proof, now iterate all regions and act if the
"filter_search" can be activated.

Maniphest Tasks: T83888

Differential Revision: https://developer.blender.org/D9882
2020-12-17 16:05:20 +01:00
3fc07d1e74 Fix T83886: Particle instance modifier broken
Caused by Caused by rB83980506957c.

Since above commit, the modifier was created with wrong initial values
[amount was 0.0 and offset was 1.0 -- instead of the other way around].

Since there is no way to fix existing files in a reasonable way I guess,
all we can do here is to make sure that from now on, the defaults are
correct.

Maniphest Tasks: T83886

Differential Revision: https://developer.blender.org/D9881
2020-12-17 16:00:18 +01:00
c9f8f7915f Geometry Nodes: Make random attribute node stable
Currently, the random attribute node doesn't work well for most
workflows because for any change in the input data it outputs
completely different results.

This patch adds an implicit seed attribute input to the node, referred
to by "id". The attribute is hashed for each element using the CPPType
system's hash method, meaning the attribute can have any data type.
Supporting any data type is also important so any attribute can be
copied into the "id" attribute and used as a seed.

The "id" attribute is an example of a "reserved name" attribute,
meaning attributes with this name can be used implicitly by nodes like
the random attribute node. Although it makes it a bit more difficult
to dig deeper, using the name implicitly rather than exposing it as an
input should make the system more accessible and predictable.

Differential Revision: https://developer.blender.org/D9832
2020-12-17 07:43:31 -06:00
a9edf2c869 Geometry-Nodes: Point Distribute - Sockets Renaming
The size of the nodes is not enough to give enough context to users what
the sockets are about.

Minimum Distance -> Distance Min
Maximum Density -> Distance Min

Note this does not handle doversion. That means users will have to
manually.
2020-12-17 14:31:41 +01:00
9258b70453 Explicitly link X11 libraries
Fix X11 library underlinking, which was breaking Debian and Ubuntu
packages.

From Ubuntu Hirsute changelog:

```
blender (2.83.5+dfsg-4ubuntu1) hirsute; urgency=medium

  * Try to also link ghost library with x11, needed because of missing
    XConvertSelection symbol link (used in ghost static library).
  * Don't use gold, but switch to bfd linker that seems to be working better
    on ppc64el.

 -- Gianfranco Costamagna <locutusofborg@debian.org>  Wed, 11 Nov 2020 14:17:29 +0100
```

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D9617
2020-12-17 13:24:35 +01:00
cf2ebaf27c Fix T83875: Converting Proxy to override crashes blender.
Some weird proxies apparently can have a local collection instancing...
Not sure this is even really valid for proxies, but in any case we
cannot override that, just detect and properly cancel the operation
then.

Should be backported to 2.91.1 should we do it.
2020-12-17 12:05:30 +01:00
0eedba328d Geometry Nodes: add Attribute Color Ramp node
Differential Revision: https://developer.blender.org/D9861

Ref T82585.
2020-12-17 11:56:18 +01:00
2945c1e3e5 Fix asset data-block name button not showing up in custom repositories
The Python syntax was wrong, as noted by Campbell in 0ae15e68c7.
2020-12-17 11:39:45 +01:00
6203a3ee68 Fix T83878: Crash right-clicking in Asset Browser with no asset active
Data of the File Browser context callback needs to be validated and
return `CTX_RESULT_NO_DATA` if the context member is valid but not set
in the current context.
2020-12-17 11:24:08 +01:00
7e535499d5 Clean-up: Fix build warning with MSVC
Callback function was using int while update_render_passes_cb_t was
using eNodeSocketDatatype leading to a build warning about different
argument types with MSVC.
2020-12-16 21:03:42 -07:00
8df6589585 VSE: Fix crash when adding image strip
Crash happens when using relative path to image in operator properties
and checking image dimensions by loading image with `IMB_loadiffname()`

Ensure path is absolute.
2020-12-17 02:32:24 +01:00
d11b219d40 Fix T83869: Crash when creating Sequencer in new scene
Crash on null dereference in `SEQ_timeline_boundbox()`. This function was
generalized in rB9e4a4c2e996c to work on arbitrary `seqbase`.

Fixed by refactoring `SEQ_timeline_boundbox()` functions to return default
sane values if `seqbase` is `NULL`

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9878
2020-12-17 02:19:34 +01:00
3a1d1aaa86 Synchronize Wintab and Win32 time.
Time is synchronized by the difference between the WT_PACKET receive
time and the last received PACKET's pkTime. This is used to prevent
Wintab packets from being prematurely expired.
2020-12-16 15:32:18 -08:00
9f588432e9 Fix T83861: Snapping panel from shortcut dissapears after click
This simple change sets the call_panel operator's "keep_open" property
to True for the viewport snapping panel called with `ctrl-shift-tab`.
There are quite a few settings in this panel, it often makes sense to
change more than one of them at a time, especially because multiple
snap elements can be active at the same time.
2020-12-16 14:40:30 -06:00
07c4615431 Fix T83856: Sculpt: anchored brushes with spherical falloff ignore topology automasking
Anchored brushes with spherical falloff start off with zero radius, thus
we have no pbvh nodes on the first brush step. This would prevent
initializing the automasking cache [which only happens on the first brush
step].

Maniphest Tasks: T83856

Differential Revision: https://developer.blender.org/D9873
2020-12-16 21:36:15 +01:00
247b10e6a2 Fix sequencer transform test failing
This was casued by incorrect versioning keyframe conversion in
recent commit 5713626422.
2020-12-16 21:28:01 +01:00
Gaia Clary
ad7682ffdb Allow vertex tools to operate on weight groups when armature is in object mode
Since a few versions (even before 2.79) we have an option that allows to restrict the vertex tools to operate only on deform groups. This was originally implemented for working with vertex groups for skeletal animation. In that case it is fortunate to have weight tools operate only on deforming vertext groups (vgroups assigned to bones)

In previous versions of Blender (up to 2.79) we have been able to use this option in Mesh Edit mode regardless of the armature mode. The current implementation (since 2.80 as far as i know) enables this option only when the associated armature is in pose mode. this has a bad consequence:

It is not at all intuitive that you have to put the armature into Pose mode before you can make use of the option in mesh edit mode.
Besides this it is not even necessary in the case when the user wants to restrict the tool only to all pose bones. In that case the armature can safely be kept in Object mode. However, when the tool shall apply only to selected pose bones, then it actually makes sense to have the armature in pose mode (as it is implemented right now)

I do not know why this feature has been restricted as described above. It must have got lost somewhere on the way to Blender 2.90

This patch fixes the issue as it allows to select the "restrict to pose bones" option when the armature is in any mode. I see no downsides of this change, actually this is a fix for a feature that once worked and apparently got forgotten in newer releases.

Reviewed By: sybren, campbellbarton

Differential Revision: https://developer.blender.org/D9658
2020-12-16 20:46:50 +01:00
5713626422 VSE: Improve motion-picture workflow
This commit resolves problem introduced in e1665c3d31 - it was
difficult to import media at their original resolution.
This is done by using original resolution as reference for scale.

All crop and strip transform values and their animation is converted
form old files.

To make both workflows easy to use, sequencer tool settings have been
created with preset for preffered scaling method. This setting is in
sequencer timeline header and add image or movie strip operator
properties.

Two new operators have been added:
`sequencer.strip_transform_fit` operator with 3 options: Scale To Fit,
Scale to Fill and Stretch To Fill.
Operator can fail if strip image or video is not loaded currently, this
case should be either sanitized or data loaded on demand.

`sequencer.strip_transform_clear` operator with 4 options:
Clear position, scale, rotation and all (previous 3 options combined).

Reviewed By: sergey, fsiddi

Differential Revision: https://developer.blender.org/D9582
2020-12-16 20:38:28 +01:00
9d15226383 Ghost/Linux: Avoid error print if special directory can't be determined
The function is supposed to fail gracefully if there is some error. That
includes not being able to find `xdg-user-dir`. So don't let the error
be printed to the console, it's misleading/annoying.
From what I can tell we'll detect that problem fine and return NULL
then.
2020-12-16 20:36:37 +01:00
a8da70f70a Geometry Nodes: Add boolean attribute in utility function
This follows up rBc484b54453e607, adding the boolean custom property
data type in one more place that was missed.
2020-12-16 12:50:45 -06:00
c484b54453 Geometry Nodes: Boolean attribute type
This adds a boolean attribute and custom data type, to be used in the
point separate node. It also adds it as supported data types in the
random attribute and attribute fill nodes.

There are more clever ways of storing a boolean attribute that make
more sense in certain situations-- sets, bitfields, and others, this
commit keeps it simple, saving those changes for when there is a proper
use case for them. In any case, we will still probably always want the
idea of a boolean attribute.

Differential Revision: https://developer.blender.org/D9818
2020-12-16 12:33:13 -06:00
c06c5d617a Cleanup: Replace mempcpy with memcpy
There is no need of using mempcpy here, memcpy is enough.

Note: This also fix building in Windows which was broken since a7628ec22a.
2020-12-16 18:02:55 +01:00
ebd8a703cc Fix T83851: Python: operator macros cause a crash
Caused by rB7447eb7e7430.

This is just a copy-paste error [previous LISTBASE_FOREACH substitution
of marco loop in that file has a different starting point which is not
appropriate here]

Maniphest Tasks: T83851

Differential Revision: https://developer.blender.org/D9872
2020-12-16 17:16:01 +01:00
a7628ec22a Geometry Nodes: Poisson disk point distribution node/method
This patch does two things:
* Introduce a Seed to the random distribution method
* Bring in a new distribution method for the point scattering node

Patch Review: https://developer.blender.org/D9787

Note: This commit doesn't not handle doversion. Which means that users
need to manually update their files that were using the Point Distribute
node and reconnect inputs to the "Maximum Density" socket.

Original patch by Sebastian Parborg, with changes to not rely on the cy
libraries and overall cleanup.

Patch review by Jacques Lucke, besides help with the new "heap" system
that was required for this algorithm.

Based on Cem Yuksel. 2015. Sample Elimination for Generating Poisson Disk
Sample. Sets. Computer Graphics Forum 34, 2 (May 2015), 25-32
http://www.cemyuksel.com/research/sampleelimination/
2020-12-16 17:13:46 +01:00
Pablo Dobarro
d23894d3ef Sculpt: Multires Displacement Smear
This tool implements smearing for multires displacement over the limit
surface, similar to how smearing for colors and topology slide works.
When used the displacement values of the vertices "slide" over the
topology, creating the effect of smearing the surface detail.

As the brush just modifies displacement values instead of coordinates,
the total displacement of the affected area doesn't change. This means
that this smearing effect can be used multiple times over the same area
without generating any artifacts in the topology.

When the brush is used with the pinch or expand smear modes,
displacement differences are pushed into the same area, creating hard
surface effects without pinching the topology.

As any other brush that relies on the limit surface (like displacement
erasers), this will work better after using apply base.

Reviewed By: sergey, JulienKaspar, dbystedt

Differential Revision: https://developer.blender.org/D9659
2020-12-16 17:08:19 +01:00
f3ab123e33 Cleanup: Remove unused crop field from RenderResult.
The `crop` field was used by Blender Internal to do an overscan per
tile and merge it back to the render result.
2020-12-16 16:54:24 +01:00
5c5550f7b8 Asset Browser: For assets without preview, show type icon in sidebar
Otherwise it would just show empty space where the icon is supposed to
be.
Unfortunately this icon is upscaled quite a bit and doesn't look too
great. Would be good to improve but not a high priority.
2020-12-16 16:38:56 +01:00
7ed69bd672 Fix T83843: Crash in Asset Browser sidebar with geometry asset selected
No icon should be created if the preview doesn't exist.
2020-12-16 16:38:56 +01:00
4463087223 BLI: remove implicit casts between some span types
Casting pointers from one type to another does change the
value of the pointer in some cases. Therefore, casting a span
that contains pointers of one type to a span that contains
pointers of another type, is not generally safe. In practice, this
issue mainly comes up when dealing with classes that have a
vtable.

There are some special cases that are still allowed. For example,
adding const to the pointer does not change the address.
Also, casting to a void pointer is fine.

In cases where implicit conversion is disabled, but one is sure
that the cast is valid, an explicit call of `span.cast<NewType>()`
can be used.
2020-12-16 16:00:17 +01:00
684c771263 Fix: Python warning in windows debug builds
When doing a debug build on windows, blender will
start with the following warning:

"Unable to find the python binary, the multiprocessing
module may not be functional!"

The root cause for this issue is: for a debug build
the python binary is called python_d.exe rather than
just python.exe

This change fixes BKE_appdir_program_python_search
to look for the _d suffix for debug builds on windows

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

Reviewed by: Campbell Barton
2020-12-16 07:27:47 -07:00
25543e6983 LibOverride: Better handling of missing linked data during resync.
We do not generate overrides for missing data-blocks (aka placeholder
ones) anymore, and properly delete the remaining old overrides of those
during the resync process.

This should prevent constant 'missing data-blocks' messages when opening
blend files with overrides whose libraries have beed edited.

Issue reported by @andy from Blender studio, thanks.
2020-12-16 15:12:56 +01:00
8d590e4b86 Fix T83801: UVEditor translation ignores "Pixel Coordinates" and aspect
ratio

Caused by rB4eda60c2d82d.

T83801 reported not moving in pixel space, but even without that toggle
above commit caused the translation to not take apsect ratio into
account properly [a translation of 1 on the x axis for example on an
image with non 1:1 aspect ration caused the UVs to not end up in the
same place on the next 'tile']

Above commit removed 'removeAspectRatio()' [the counterpart of
applyAspectRatio -- which does the pixel coord correction internally]
from 'applyTranslation()'.

This was also reported in T83352 [which was closed by rBf3b08af24c9f --
but that only solved the displax in header, not the actual
transformation]

Now bring back 'removeAspectRatio()'.

Maniphest Tasks: T83801

Differential Revision: https://developer.blender.org/D9869
2020-12-16 15:03:46 +01:00
8da62a9a86 Fix T83547: UV Editor stitching preview is gone.
Issue was related that the draw manager didn't invoked the draw handlers
for image editors.
2020-12-16 15:02:48 +01:00
245450b144 Fix exported keymaps loading in 2.91 and older
The generated keymaps used a keyword argument that doesn't exist
in older Blender versions.
2020-12-17 00:53:28 +11:00
Valdemar Lindberg
69c3f4a46d Fix 3D View is red when using stereo
Fix T83415: 3D View is red when using stereo

The red view was caused by SRGB not being enabled for an SRGB texture attached to the framebuffer.
Currently, when configuring a framebuffer, the first texture attachment needs to be an SRGB format in order for the framebuffer to be binded with SRGB enabled.
Thus, simply changing the SRGB texture attachment as the first texture attachment removes the red color in the view.

Reviewed By: #eevee_viewport, jbakker

Maniphest Tasks: T83415

Differential Revision: https://developer.blender.org/D9845
2020-12-16 14:21:51 +01:00
29f923b27c Fix T83557: Alpha blend + emissive colors renders white artifacts
Issue was that not all code paths were taken to determine if
the GPU Texture was premultiplied or not. In this case the result
was set to unpremultiplied what is incorrect.

This fixes broken test case image alpha blend from image_colorspace.
2020-12-16 13:57:28 +01:00
4c26dd430d Geometry Nodes: rename node to Attribute Randomize
Previously, the node was called Random Attribute. For consistency reasons,
we move the "Attribute" part of the name to the front.
2020-12-16 13:31:56 +01:00
985d673374 BLI: add new InplacePriorityQueue data structure
This data structure adds priority queue functionality to an existing array.
The underlying array is not changed. Instead, the priority queue maintains
indices into the original array.

Changing priorities of elements dynamically is supported, but the priority
queue has to  be informed of such changes.

This data structure is needed for D9787.
2020-12-16 12:19:17 +01:00
Eric Cosky
4f128269b2 Fix possible crash with custom (add-on defined) icons
This change is a simple null check on the ID provided to icon_set_image() which
appears to be a legitimate value for the ID when used by some addins
(discovered with PowerSave shortly after syncing to main).

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

Reviewed by: Julian Eisel
2020-12-16 12:13:49 +01:00
3fc9fc1cb4 UI: Indicate asset data-blocks with an icon in Outliners & search menus
It's useful to easily see which data-blocks are assets and which not. So just
like we usually show the library linking/override icons, we show the asset icon
there (these are mutually exclusive data-block states).

Uses the `'MAT_SPHERE_SKY` icon, which wasn't used before (except by an
add-on!) and is sorta fitting, but not quite. We should either change this one
or add an own asset icon. Meanwhile this isn't too bad :)

Also adds an internal macro to check if a data-block is an asset, consistent to
how we do it for libraries and library overrides.
2020-12-16 12:10:58 +01:00
58d818f8be Assets: Add operator & button to regenerate the automatic preview
This makes it possible to trigger a refresh of the data-block preview,
available next to the preview in the Asset Browser sidebar. The previews get
easily outdated and automatically refreshing it all the time is not an option
because it would be a consistently running, quite expensive process. So a
button to cause a refresh should be reasonable.

This button can also be used to switch back from a custom preview to a
generated one. Although that may not be clear, and we should probably think of
a way to explain that better.

Addresses T82719.
2020-12-16 12:10:58 +01:00
c7a500e3a0 Asset Browser UI: Changes to the sidebar layout
The current layout wasn't great at all, and it was planned to polish this. This
does a first round of improvements, some more tweaking may follow.
* Place name button at the top, with no panel and no leading label.
* Add "Preview" panel, people may not want to see the preview all the time,
  it's already visible in the file list.
* Move button to browse for a custom preview to the right of the preview, as
  icon-only. We have a similar layout in other places (UI-lists, matcaps).
* Don't make the details panel a sub-panel. Looked weird because the parent
  doesn't have a header.
* Add info icon to "No asset selected", looks a bit friendlier.
* Minor cleanups in the UI script.

Based on designs and feedback by William Reynish.
2020-12-16 12:10:58 +01:00
19fc30c15f Assets UI: Tweak position of the "Add Asset Library" icon-button in Preferences
It's weird to have a button that adds a new item at the bottom be placed at the
top. So rather move it below the list of custom asset library paths.
2020-12-16 12:10:58 +01:00
0ae15e68c7 Asset Browser: Allow renaming asset data-blocks from the sidebar directly
This is something we wanted to support doing. It's confusing if users see the
name but it's always grayed out. So be convenient and avoid the confusion.
2020-12-16 12:10:58 +01:00
055ef5df61 Cleanup: Rename Asset Browser context member from "active_id" to "id"
This is the same name we use elsewhere for the focused/active ID context
member, so this should follow it.
2020-12-16 12:10:58 +01:00
Nathan Letwory
975ca91939 Steam Release: Script creation of Steam build files
Script tool for automation of Steam build files for tasks like {T77348}

This script automates creation of the Steam files: download of the archives,
extraction of the archives, preparation of the build scripts (VDF files), actual
building of the Steam game files.

Requirements
============

* MacOS machine - Tested on Catalina 10.15.6. Extracting contents from the DMG
  archive did not work Windows nor on Linux using 7-zip. All DMG archives tested
  failed to be extracted. As such only MacOS is known to work.
* Steam SDK downloaded from SteamWorks - The `steamcmd` is used to generate the
  Steam game files. The path to the `steamcmd` is what is actually needed.
* SteamWorks credentials - Needed to log in using `steamcmd`.
* Login to SteamWorks with the `steamcmd` from the command-line at least once -
  Needded to ensure the user is properly logged in. On a new machine the user
  will have to go through two-factor authentication.
* App ID and Depot IDs - Needed to create the VDF files.
* Python 3.x - 3.7 was tested.
* Base URL - for downloading the archives.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D8429
2020-12-16 11:15:18 +01:00
9cbfcc4af5 Revert "Steam Release: Script creation of Steam build files"
This reverts commit 1a375d6ece.
2020-12-16 11:11:15 +01:00
Nathan Letwory
1a375d6ece Steam Release: Script creation of Steam build files
Script tool for automation of Steam build files for tasks like {T77348}

For in-depth information see the README.

Related Wiki page: https://wiki.blender.org/wiki/Process/Release_On_Steam

Reviewed By: jbakker

Maniphest Tasks: T77348

Differential Revision: https://developer.blender.org/D8429
2020-12-16 11:07:10 +01:00
d23a5b1d88 BLI: constexpr Span, IndexRange, StringRef(Null/Base)
Motivated by `std::string_view` being usable in
const (compile-time) context.
One functional change was needed for StringRef:
`std::char_traits<char>::length(str)` instead of `strlen`.

Reviewed By: JacquesLucke, LazyDodo
Differential Revision: https://developer.blender.org/D9788
2020-12-16 13:03:46 +05:30
e671c548e6 Cleanup: pep8 2020-12-16 18:02:40 +11:00
Vincent Blankfield
f34ca933a8 UI: include the category for add-ons search
This lead to some confusion, see T83747.

Now the category is included in the search when the category is "All".

Ref D9848
2020-12-16 16:35:26 +11:00
a869a61c88 Cleanup: sort struct blocks 2020-12-16 16:26:23 +11:00
b347c4e9ca Cleanup: remove redundant struct declarations 2020-12-16 16:25:56 +11:00
588f107f11 Cleanup: clang-format 2020-12-16 16:13:05 +11:00
87fdb71438 Cleanup: use static declarations 2020-12-16 16:12:50 +11:00
977bd7937a Fix warnings introduced in previous commit 2020-12-16 00:20:20 +01:00
Peter Fog
fad80a95fd VSE: Add Overlay popover panels
Add panels with overlay settings for strips and preview and overlay
enable/disable button.

Entries from the View menus moved to the overlay panels, which will
simplify cluttered View menus.

Additional options have been added:
 - Strip Name
 - Strip Source(ex. path)
 - Strip Duration

So users can now select what info they need to see on the strips. When
No text is displayed, waveforms are drawn in full height.

Reviewed By: ISS, HooglyBoogly, pablovazquez

Differential Revision: https://developer.blender.org/D9751
2020-12-15 23:50:18 +01:00
Peter Fog
f44dea0558 VSE: Reorder Tools in Sequencer/Preview
When in Sequencer/Preview mode, the Sampler was on top, which normally
is the place of Select, and Annotation seems to be after Sampler in the
bottom in the various editors.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9821
2020-12-15 22:30:01 +01:00
Peter Fog
dd9d12bf45 VSE: Paste strips after playhead by default
Paste copied strips after playhead, because this is more intuitive.

Previous functionality is still available by enabling "Keep Offset"
property, or under shortcut Ctrl+Shift+V.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9734
2020-12-15 22:30:01 +01:00
Falk David
151e847b87 GPencil: Improve interpolation of strokes with unequal lengths
Use the BKE_gpencil_stroke_uniform_subdivide function to subdivide strokes
before interpolation. When the target/source stroke is smaller than the other
stroke, it is subdivided until the lengths match. This improves the overall quality
of the interpolation of different sized strokes.

Before/After video:
{F9511779}

Reviewed By: #grease_pencil, antoniov, pepeland, mendio

Differential Revision: https://developer.blender.org/D9839
2020-12-15 22:29:21 +01:00
Cody Winchester
5535b0b887 GPencil Array - Add option for uniform random scaling
This patch adds the option to make the random scaling from the grease pencil array modifier uniform.
The current settings allow a separate value for each of the 3 scaling axis. The modifier also creates different seed values for each axis so there is no way to keep the random scaling uniform.
This patch creates 1 random seed value and applies it to each of the scaling axis.

Here is a demonstration of the previous behavior and the new optional behavior.
{F9485973}
{F9485981}

{F9485798}

Reviewed By: #grease_pencil, antoniov, pepeland

Differential Revision: https://developer.blender.org/D9764
2020-12-15 22:16:49 +01:00
9e4a4c2e99 VSE: Move remove gaps operator logic to module code
Logic was broken into finding gaps and ofsetting strips.
Functions were modified so they work on explicitly defined seqbase,
so they can be used as python API functions.

Functional changes:
 - Improve performance by calculating gap length and offseting strips
   at once. Previously strips were offset by one frame.
 - Calculate gap from start frame. Previously gap was considered only
   inbetween strips.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9730
2020-12-15 21:49:15 +01:00
7e8f6985d8 Fix crash selecting custom asset preview from maximized File Browser
If Preferences > Interface > Temporary Editors > File Browser is set to
"Maximized Area", "Load Custom Preview" in the Asset Browser would crash
after selecting the file.

1e799dd26e was important to get this issue fixed. This commit just
ensures the file-list is recreated correctly after closing the temporary
File Browser, so the custom preview operator can execute on valid
context.
2020-12-15 21:31:45 +01:00
1e799dd26e Fix various issues with temporary, maximized File Browsers
If Preferences > Interface > Temporary Editors > File Browser is set to
"Maximized Area", opening a File Browser from a File or Asset Browser as
regular editor would cause some issues. For example after closing the
temporary File Browser, the regular browser would take over the file
path and display settings from the temporary one. This is because they
used to share the same area data.

Some similar issues may have happend with temporary image editors.

Now, this commit finally separates the space data of temporary maximized
editors from the regular ones. So the editor data is entirely
independent now, as it should be.
2020-12-15 21:31:33 +01:00
c9b4d75336 Sculpt: Fair Face Sets operation for Face Set Edit
This implements a mesh fairing algorithm and implements the fair
operations for Face Set edit. This edit operations create a smooth as
possible geometry patch in the area of the selected Face Set.

The mesh fairing algorithm is designed by Brett Fedack for the addon
"Mesh Fairing": https://github.com/fedackb/mesh-fairing, with some
modifications:

- The main fairing function in BKE_mesh_fair.h does not triangulate
 the mesh. For the test I did in sculpt mode results are good enough
 without triangulating the topology. Depending on the use and the
 result quality needed for a particular tool, the mesh can be
 triangulate in the affected area before starting fairing.

- Cotangents loop weights are not implemented yet. The idea is to
also expose the vertex and loop weights in a different function in
 case a tool needs to set up custom weights.

This algorithm will also be used to solve the limitations of line
project and implement the Lasso Project and Polyline Project tools.
It can also be used in tools in other areas of Blender, like Edit Mode
or future retopology tools.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9603
2020-12-15 20:32:58 +01:00
288f2efbd4 Fix T83504: Cancel trim operators when there is no geometry
The boolean solver crashes when there is no geometry in the mesh. Also,
using the trimming tools without a valid intersection in the PBVH will
make the orientation and position functionality of the trimming shape
not work, so this is the safer solution.

Reviewed By: mont29

Maniphest Tasks: T83504

Differential Revision: https://developer.blender.org/D9777
2020-12-15 20:23:17 +01:00
c9de65679b Fix T83201: Cloth brush performance regression
The if statement of the dynamic area mode branch should be an else if.
When using local mode, this was running both the local and global code.

I moved this code to sculpt_cloth and refactored it to use a switch case
to prevent this from happening again.

Reviewed By: mont29

Maniphest Tasks: T83201

Differential Revision: https://developer.blender.org/D9762
2020-12-15 20:22:26 +01:00
26e9c2147e Blenloader: Add utility function to write double array
It makes sense to support writing double arrays just like floats.
This is just split from a patch (D9697) to slim it down some.
2020-12-15 12:43:21 -06:00
d59e87acf0 Cleanup: Use nullptr instead of NULL in C++ code 2020-12-15 12:41:41 -06:00
8df167873a Cleanup: Clang tidy else after return 2020-12-15 12:39:27 -06:00
3834dc2f7b Fix Adjust Last Operation popup for operators relying on button context
This was reported for duplicating particle systems, then using F9 to
enable the 'Duplicate Settings' option (see T83317).
In this case, the operator gets the particle_system from (buttons)
context and if none can get found will duplicate all settings instead.

The reason why none gets found here is that buttons_context() doesnt
have a valid path when called from F9/SCREEN_OT_redo_last, path is
cleared when global undo does a file-read which clears the path (see
lib_link_workspace_layout_restore). It can be recomputed though to be
valid even from redo_last (at least when in the Properties Editor).

This was likely causing other operators (relying on buttons context)
from the Properties Editor to fail as well.

Fixes T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D9825
2020-12-15 19:10:35 +01:00
ffe63b0440 Fix crash opening maximized File Browser from Asset Browser
If Preferences > Interface > Temporary Editors > File Browser is set to
"Maximized Area", opening a File Browser from an Asset Browser would
cause the new maximized editor to be an Asset Browser. Exiting it again
would crash.

This fixes the wrong behavior and the crash. There's still an issue with
exiting the editor again, it stays a File Browser then and doesn't go
back to being an Asset Browser. That's to be fixed separately.
2020-12-15 18:56:26 +01:00
b24712a9ca Fix (studio-reported) broken handling of relative font paths.
`blf_dir_search` BLF util would not properly handle relative fonts not
found in pre-defined 'system fonts' directoriesi stored in
`global_font_dir` global variable.

Now it rebases relative paths to current .blend file location as
expected.

Note: the fact that VSE is setting font ptaths relative by default is
probably not actually desired, but this is another issue really. See
`BKE_sequencer_text_font_load` code.
2020-12-15 18:22:22 +01:00
c6692014cf Fix redundant declaration warning
Function was declared twice (caused by merge conflicts) which GCC would
rightfully complain about.
2020-12-15 17:19:55 +01:00
990406e1ff Fix crash when deleting/renaming asset library while it's visible
Storing the asset library reference by name wasn't a good idea, I thought it
would work with a careful fallback, but it's easier to just use the index
instead. So change to using indices, make sure fallback methods work reliable
and make sure the file list is updated when asset libraries are removed.

I added a new notifier type for the latter, I prefer not using file notifiers
in asset-library/preferences code. We have more than enough values for
notifiers left.
2020-12-15 17:03:49 +01:00
7dc8db7cd1 Fix failing assert when generating material preview
The `!BKE_previewimg_is_finished()` in `icon_preview_startjob_all_sizes()`
would fail.

Caused by 990bd9acf243ae. We have to be more picky about tagging previews as
unfinished after file read. But we also have to consider files stored in old
versions and set the unfinished tag as needed.
2020-12-15 17:03:49 +01:00
9caeb9dfc7 Fix Asset Browser crash with undo in "Current File" library with sidebar
When the Asset Browser was showing the "Current File" repository and the
sidebar was open, undoing could crash, because the context API returned freed
data.

Don't let context return anything if a refresh is pending due to data changes
like undo/redo.
2020-12-15 17:03:49 +01:00
68e4a90240 Assets: Better path for the default asset library
In D9722 we agreed on using `[home-directory]/Documents/Blender/Assets` for
the default asset library. I just forgot to do the change before committing.

(The default repository is just a named path, it's *not* a default library with
bundled assets.)
2020-12-15 17:03:48 +01:00
303aceb917 Fix asset previews not showing in "Current File" repository after reading
Previews would be flagged as unfinished when reading. Instead clear the flag
and always consider them finished upon reading. If we wouldn't do this, the
File Browser would keep running the preview updating to wait for the preview to
finish. It could be smarter and also check if there's actually a preview job
running.
Instead, I think it will just display an unfilled buffer for now. Up until
today we wouldn't even know if a stored preview is finished or not, so it would
always assume they are finished. We do the same now, but have the option to
make it smarter.
2020-12-15 17:03:48 +01:00
2d6a69ae4e Asset System: New Asset Browser editor
This introduces the User Interface part of the Asset Browser, based on the
design in T54642.

Additions:
* New Asset Browser (internally a sub-editor of the File Browser).
* Navigation region showing asset categories.
* Main region showing the assets of the selected asset library with previews.
  The assets may be stored over multiple .blends in the directory that's
  "mounted" as asset library in the Preferences. They will all be shown in this
  list.
* Header with an asset library dropdown, allowing to choose the active asset
  library to show. Options are the "Current File" as asset library and all
  custom libraries.
* Display popover, filter popover and search box (partially dummies, see
  T82680).
* Sidebar showing the metadata of the currently active file (name, preview,
  description and tags), which can be edited for assets in the "Current File"
  asset library. (For others it will reset on reload.)
* The sidebar includes a button to load a custom preview image from a file.
* Make asset files draggable (with preview image).
* If a library with invalid path is selected, a message is drawn in the main
  region to help the user understand what's wrong.
* Operators to add and remove asset tags. Exposed in the sidebar.
* "Only Assets" option for Link/Append.
* Internal utilities for asset UI scripts.

For screenshots or demo videos, please see D9725. Or the 2.92 release notes.

Note that there are many things to be tweaked and polished in the Asset Browser
UI still. For example, the filter and display popovers are mostly dummies. See
T82680.

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Brecht Van Lommel, Hans Goudey
2020-12-15 17:03:48 +01:00
70474e1a7c Asset System: Prepare File Browser backend for the Asset Browser
The Asset Browser will be a sub-editor of the File Browser. This prepares the
File Browser code for that.

**File-Lists**
* Support loading assets with metadata read from external files into the
  file-list.
* New main based file-list type, for the "Current File" asset library.
* Refresh file-list when switching between browse modes or asset libraries.
* Support empty file-lists (asset library with no assets).
* Store file previews as icons, so scripts can reference them via icon-id. See
  previous commit.

**Space Data**
* Introduce "browse mode" to differeniate between file and asset browsing.
* Add `FileAssetSelectParams` to `SpaceFile`, with `FileSelectParams` as base.
  Makes sure data is separated between asset and file browsing when switching
  between them. The active params can be obtained through
  `ED_fileselect_get_active_params()`.
* `FileAssetSelectParams` stores the currently visible asset library ID.
* Introduce file history abstraction so file and asset browsing can keep a
  separate history (previous and next directories).

**General**
* Option to only show asset data-blocks while file browsing (not exposed here).
* Add "active_file" context member, so scripts can get and display info about
  the active file.
* Add "active_id" context member, so `ED_OT_lib_id_load_custom_preview` can set
  a custom ID preview. (Only for "Current File" asset library)
* Expose some of `FileDirEntry` in RNA as (non-editable). That way scripts can
  obtain name, preview icon and asset-data.

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Bastien Montagne
2020-12-15 17:03:48 +01:00
e413c80371 Asset System: Support custom asset library paths through Preferences
One of the core design aspects of the Asset Browser is that users can "mount"
custom asset libraries via the Preferences. Currently an asset library is just
a directory with one or more .blend files in it. We could easily support a
single .blend file as asset library as well (rather than a directory). It's
just disabled currently.

Note that in earlier designs, asset libraries were called repositories.

Idea is simple: In Preferences > File Paths, you can create custom libraries,
by setting a name and selecting a path. The name is ensured to be unique. If
the name or path are empty, the Asset Browser will not show it in the list of
available asset libraries.
The library path is not checked for validity, the Asset Browser will allow
selecting invalid libraries, but show a message instead of the file list, to
help the user understand what's going on.
Of course the actual Asset Browser UI is not part of this commit, it's in one
of the following ones.

{F9497950}

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Brecht Van Lommel, Hans Goudey
2020-12-15 17:03:48 +01:00
b5d778a7d4 Asset System: Support dragging assets and appending on drop
For the Asset Browser, it needs to be possible to drag assets into various
editors, which may not come from the current .blend file. In other words, the
dragging needs to work with just the asset metadata, without direct access to
the data-block itself.

Idea is simple: When dragging an asset, store the source file-path and
data-block name and when dropping, append the data-block. It uses existing drop
operators, but the function to get the dropped data-block is replaced with one
that returns the local data-block, or, in case of an external asset, appends
the data-block first.

The drop operators need to be adjusted to use this new function that respects
assets. With this patch it only works for dragging assets into the 3D view.

Note that I expect this to be a short-lived change. A refactor like D4071 is
needed to make the drag & drop system more future proof for assets and other
use cases.

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-15 17:03:48 +01:00
9363132c86 Asset System: Various changes to previews in preparation for Asset Browser
* Support defining (not necessarily rendering) icons in threads. Needed so the
  File Browser can expose file previews with an icon-id to scripts.
** For that, ported `icons.c` to C++, to be able to use scope based mutex locks
   (cleaner & safer code). Had to do some cleanups and minor refactoring for
   that.
* Added support for ImBuf icons, as a decent way for icons to hold the file
  preview buffers.
* Tag previews as "unfinished" while they render in a thread, for the File
  Browser to dynamically load previews as they get finished.
* Better handle cases where threaded preview generation is requested, but the
  ID type doesn't support it (fallback to single threaded). This is for general
  sanity of the code (as in, safety and cleanness)
* Enabled asset notifier for custom preview loading operator, was just disabled
  because `NC_ASSET` wasn't defined in master yet.

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-15 17:03:45 +01:00
c25e031049 Asset System: "Mark Asset" & "Clear Asset" operators and UI integration
This makes it possible to turn data-blocks into assets and back into normal
data-blocks. A core design decision made for the asset system is that not every
data-block should be an asset, because not every data-block is made for reuse.
Users have to explicitly mark data-blocks as assets.

Exposes "Mark Asset" and "Clear Asset" in Outliner context menus (currently ID
Data submenu) and button context menus. We are still not too happy with the
names, they may change.

This uses the new context members to pass data-blocks to operators, added in
af008f5532 and 0c1d476923.

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Brecht Van Lommel
2020-12-15 17:03:00 +01:00
b71eb3a105 Asset System: Data-block asset metadata storage, reading and API
Asset metadata is what turns a regular data-block into an asset. It is a small
data-structure, but a key part of the technical design of the asset system.

The design foresees that asset data-blocks store an `ID.asset_data` pointer of
type `AssetMetaData`. This data **must not** have dependencies on other
data-blocks or data-block data, it must be an independent unit. That way we can
read asset-metadata from .blends without reading anything else from the file.
The Asset Browser will use this metadata (together with the data-block name,
preview and file path) to represent assets in the file list.

Includes:
* New `ID.asset_data` for asset metadata.
* Asset tags, description and custom properties.
* BKE code to manage asset meta-data and asset tags.
* Code to read asset data from files, without reading IDs.
* RNA for asset metadata (including tags)

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

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

Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-15 17:03:00 +01:00
82645ff739 Move Point Cloud object back to Experimental Features
The geometry-nodes features no longer depend on the point cloud object.
Therefore the point cloud object, although important in the future, can
be postponed until we have render and edit mode fully working.

This reverts commits:
* ea74ed5a7a.
* dc614c68ef.
2020-12-15 13:07:55 +01:00
0d58eabee6 Geometry Nodes: support evaluating mesh object to geometry set
This implements the design proposed in T83357.

The goal is to allow the geometry nodes modifier on mesh objects to
output instances and potentially other geometry types. Both problems
are tackled by allowing mesh objects to evaluate to a geometry set,
instead of just a single mesh id data block. The geometry set can
contain a mesh but also other data like instances and a point cloud.

I can't say that I'm sure that this commit won't introduce bugs. Mainly
the temporary object creation during rendering seems a bit brittle.
BUT, we can be reasonably sure that this commit will not introduce
regressions (at least not ones, that are hard to fix). This is because
the code has been written in a way that minimizes changes for existing
functionality.

Given that we intend to hide the point cloud object for the next release,
we won't even have to worry about temporary object creation for now.

An important part of the technical design is to make sure that
`ObjectRuntime->data_eval` contains the same data before and after this
patch. This helps to make sure, that existing code paths are impacted as
little as possible.

Instead of fully replacing `data_eval`, there is `geometry_set_eval`,
which contains all the geometry components an object evaluated to
(including the data referenced by `data_eval`).

For now, not much code has to be aware of `geometry_set_eval`. Mainly
the depsgraph object iterator and the instances system have to know
about it.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9851
2020-12-15 12:42:10 +01:00
d8db5cb600 Fix: upward compatibility of cryptomatte matte id.
The matte_id is stored in a different structure in 2.92. This patch will
write the old matte_id field so the files can be opened correctly in
older versions.
2020-12-15 12:17:31 +01:00
ef2151d73d Fix T83776: Crashes with add-on's icon preview in menus
Apparently the ID pointer can be NULL, which most code here assumes is
not the case. But it's very fragile & finicky, there is one code path
were it's allowed to be NULL.

Add necessary NULL-checks, an assert as sanity check and a comment to
note the possibility of NULL.
2020-12-15 12:05:12 +01:00
1b130f17c9 Cleanup: make format 2020-12-15 12:01:45 +01:00
35368e8bfc Fix: mattes of cryptomatte node lost after write
Fix an issue introduced by {f4df036bc497} where the read/write
code missed to store and read the mattes from its new location.
2020-12-15 11:15:01 +01:00
12792ee70c Fix T83788: Topology mirror crashes for vertices aren't mirrored
Caused by da8dc204bd
2020-12-15 18:10:04 +11:00
e035d7301c Fix crash sliding effect sequence strips
Off by one error in array access.
2020-12-15 16:14:59 +11:00
a05d98884a RNA: disallow negative fcurve data-path array index 2020-12-15 12:48:33 +11:00
612598acd7 Cleanup: doxy comments (use colon after parameter name)
Also remove colon after `\note`.
2020-12-15 12:34:25 +11:00
001f2c5d50 Cleanup: spelling 2020-12-15 12:34:25 +11:00
e995296acb Cleanup: unused variables 2020-12-15 12:34:25 +11:00
525364be31 Cleanup: reduce indirect DNA header inclusion
Remove DNA headers, using forward declarations where possible.

Also removed duplicate header, header including it's self
and unnecessary inclusion of libc system headers from BKE header.
2020-12-15 12:34:14 +11:00
15f2f69694 Cleanup: Reduce variable scope 2020-12-14 17:48:57 -06:00
1e38e32cf6 Cleanup: type check failure, discarded-qualifiers warnings
Caused by 7f6ffe9195
2020-12-15 10:27:36 +11:00
7470c10601 Cleanup: Use LISTBASE_FOREACH macro, reduce variable scope 2020-12-14 17:19:43 -06:00
Wayde Moss
6074636387 NLA: Action Strip Defaults Sync Length On
See T82309#1055564 {T63675} and their duplicates for how Default-off
can cause confusion.

This is just for convenience since it allows animators to keyframe
outside of the strip's bounds by default. This was likely off by
default before since Syncing Length would undesirably shift the whole
animation after leaving tweak mode (fixed by {D7602}) and the animator
wasn't able to keyframe outside the strip bounds anyways
(fixed by {D7533}). Now it's better if the flag was on by default.
While the animator is still roughly developing their animation NLA-wise
they won't have to worry about strip bound keying failures. When they
are more certain of the strip bounds, they can disable the flag to
prevent affecting the rest of the NLA system.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9661
2020-12-14 17:32:14 -05:00
Wayde Moss
7f6ffe9195 Nla Refactor: Blend functions explicit Div0 check
It's an explicit check to prevent division by zero if caller hasn't
done the check. Future patch {D8867} will not use the nla remap
function and thus not do the check. This patch also replaces some
float (==) equality checks with IS_EQF().

Split from {D9247}

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9694
2020-12-14 17:11:41 -05:00
Wayde Moss
fa6bf8f5b6 Nla Refactor: nlaevalchan_validate_index_ex()
And removes redundant index local variable. Future patches {D8296} and
{D8867} make use of this function.

No functional changes.
Split from {D9247}

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9693
2020-12-14 17:06:59 -05:00
Wayde Moss
04ca93ef9b NLA: Fix context.selected_nla_strips PointerRNA
The strips were given the wrong owner ID.  This only caused issues for
python based UI as far as I know. Property changes would not properly
update the viewport.

Reviewed By: lichtwerk

Differential Revision: https://developer.blender.org/D9685
2020-12-14 17:00:04 -05:00
20bc1ab275 Fix incorrect RNA type warning
Using the RNA type for regular modifiers instead of grease pencil
modifiers caused a warning in context.c.
2020-12-14 15:12:18 -06:00
49ec3cef69 Geometry Nodes: Input data type utility function
This commit adds a simple utility function for getting the data type of an
attribute or its "constant" socket counterparts. No functional changes.

Differential Revision: https://developer.blender.org/D9819
2020-12-14 11:43:54 -06:00
010f44b855 Fix several issues with handling of numpy in CMake.
Issues were:
* Abusing of `WITH_PYTHON_INSTALL_NUMPY` by both Audaspace and
  Mantaflow.
    - `PYTHON_INSTALL` options only decide whether we copy python (and
      some extra modules) in our Blender installation. On linux it
      makes much more sense to use global python installation.
    - Now we have instead a proper `WITH_PYTHON_NUMPY`
* Bad assumptions regarding path of headers relative to path of python
  module.
    - In current Debian testing, modules are under `python3.9`
      directory, while headers are under `python3` directory.
    - Now we properly `find_path` for headers as well, modifying
      `find_python_package` to take an optional argument for headers.

Note that the required changes done to `extern` libraries are in
blender-specific files that do not exist upstream.

Differential Revision: https://developer.blender.org/D9773
2020-12-14 16:44:55 +01:00
f4df036bc4 Cryptomatte: Data structure in compositor node
This changes the way how the mattes are stored in the compositor node. This used to
be a single string what was decoded/encoded when needed. The new data structure
stores all entries in `CryptomatteEntry` and is converted to the old `matte_id`
property on the fly.

This is done for some future changes in the workflow where a more structured
approach leads to less confusing and easier to read code.
2020-12-14 16:14:38 +01:00
07ce9910f7 Geometry Nodes: enabled supports-mapping in nodes modifier
Sometimes the geometry nodes modifier does support mapping and
sometimes it does not. We have no infrastruture to determine this ahead
of time currently. In order to support common use cases, it makes sense
to add this flag to the modifier.

One such common use case is to use the mesh as surface that other
things are distributed on. Often, the distribution is controlled by vertex
groups. Therefore, it would be helpful if the modifier is evaluated
when the object is in vertex paint mode. This allows the user to see the
distributed objects while painting.

If the nodes modifier transforms the mesh in any way, vertex painting
might not work as expected anymore, because the `deformMatrices`
callback is not implemented. I'm not sure how this can be solved nicely, yet.
2020-12-14 15:44:28 +01:00
9ee7270e0a Geometry Nodes: require vertex groups data in nodes modifier
Without this, the modifier evaluation code might remove any
vertex groups from the mesh for performance reasons.
We can't say for sure whether the node group will need the vertex
groups, but it is quite likely.

Ref T83357.
2020-12-14 15:29:50 +01:00
6714b800d1 Cryptomatte: apply volume transmittance to Eevee.
This patch will add volumetric transmittance to the cryptomatte coverage
data of all samples when post processing the cryptomatte passes.

It was discussed with Cycles that this is desired, but tricky to
implement in Cycles.
2020-12-14 15:03:29 +01:00
e3068f38c8 Fix memory leak and possible other issues with custom previews
Mistake in 812ea91842. Fixed that same one before in the branch, I may have
brought it back when resolving merge conflicts.
2020-12-14 14:57:30 +01:00
Joan Bonet Orantos
68d5ad9983 Fix T75539: Cycles missing geometry update when switching displacement method
The shaders were not tagged for a needed geometry update when the displacement method was modified, neither were the Geometry and Object managers.

Reviewed By: kevindietrich

Maniphest Tasks: T75539

Differential Revision: https://developer.blender.org/D8896
2020-12-14 13:44:29 +01:00
4b0396695c UI/Assets: Support generating object preview images
Object previews are really helpful for visual data-block selection, like asset
browsing. Having them be generative should also be quite handy and should work
well enough in many, if not most cases.

What this does is simple:
* Place the object (actually a deep copy of it, for thread safety) in a virtual
  .blend into an empty scene/view-layer.
* Add a camera, point it towards the front of the object, assuming that means
  pointing towards its +Y axis.
* Use "Camera Fit Frame to Selected" logic to put the object into frame.
* Create a threaded off-screen render.

Of course, such an automatic preview will not work in all situations. E.g. it
currently does a bad job capturing a single plane. We could add options for
more advanced automatic previews, but probably custom previews is more
important, which I committed already (812ea91842).

Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.

Reviewed as part of https://developer.blender.org/D9719.
Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-14 13:17:57 +01:00
732d0b458b Blenkernel: move DerivedMesh.c to c++
Required changes to make it compile with clang tidy:
* Use c++ includes like (e.g. climits instead limits.h).
* Insert type casts when casting from void* to something else.
* Replace NULL with nullptr.
* Insert casts from int to enum.
* Replace designed initializers (not supported in C++ yet).
* Use blender::Vector instead of BLI_array_staticdeclare (does not compile with C++).
* Replace typedef statements.

Ref T83357.
2020-12-14 13:08:02 +01:00
551856ed32 Revert "Fix several issues with handling of numpy in CMake."
This reverts commit 5d570c875e.

Buildbots are still borken, need more time to investigate.
2020-12-14 12:29:34 +01:00
fdc9350a9f Revert "Fix own error in rB5d570c875eda in CMake script."
This reverts commit 6da609fcb3.

Buildbots are still broken, need more time to investigate.
2020-12-14 12:29:08 +01:00
6da609fcb3 Fix own error in rB5d570c875eda in CMake script.
My mistake, though CMake could handle default arguments but it needs to
be explicitly passed actually.
2020-12-14 12:23:21 +01:00
812ea91842 UI/Assets: Operator to load custom preview images for data-blocks
No automatic preview generation will ever be good enough to cover all cases
well. So custom preview images are a must for a preview driven data-block
selection - like for asset browsing.

The operator simply allows selecting an image file, which will then be read and
copied into the data-blocks preview (resized if necessary).

There's no UI for this currently and the operator won't be available in the
search menu yet. It will later once the Asset Browser UI is merged.

Reviewed as part of https://developer.blender.org/D9719.
Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-12-14 12:16:59 +01:00
6f7ced77e3 Fix windows build. 2020-12-14 14:09:18 +03:00
Bastien Montagne
f5a019ed43 LibOverride: Do not store some heavy data from override IDs.
This commit removes geometry from meshes and shapekeys, and embedded
files, from liboverride IDs.

This data is never overrideable, there is no reason to store extra
useless copies of it in production files.

See T78944.

Note that we may add more data to be skipped on write for liboverrides
in the future, but this commit should address all the most important
cases already.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9810
2020-12-14 11:37:01 +01:00
8e1b63d4bd GPencil: Add missing Pin icon for default eraser
This icon allows to set the default eraser when press Ctrl key and was removed by error in the brush refactor.
2020-12-14 11:31:01 +01:00
5d570c875e Fix several issues with handling of numpy in CMake.
Issues were:
* Abusing of `WITH_PYTHON_INSTALL_NUMPY` by both Audaspace and
  Mantaflow.
    - `PYTHON_INSTALL` options only decide whether we copy python (and
      some extra modules) in our Blender installation. On linux it
      makes much more sense to use global python installation.
    - Now we have instead a proper `WITH_PYTHON_NUMPY`
* Bad assumptions regarding path of headers relative to path of python
  module.
    - In current Debian testing, modules are under `python3.9`
      directory, while headers are under `python3` directory.
    - Now we properly `find_path` for headers as well, modifying
      `find_python_package` to take an optional argument for headers.

Note that the required changes done to `extern` libraries are in
blender-specific files that do not exist upstream.

Differential Revision: https://developer.blender.org/D9773
2020-12-14 11:00:28 +01:00
53ed96641c Cleanup: clang tidy 2020-12-14 10:48:11 +01:00
45bf470ee9 Fix T83712: arctangent math node does not work in Eevee
Caused by my refactoring of the math node.
Somehow this operation slipped through my double checking procedure.
2020-12-14 10:47:17 +01:00
067046c26a Cleanup: path_util.c comments 2020-12-14 20:44:26 +11:00
088df2bb03 Fix missing string escape for RNA path creation 2020-12-14 20:44:26 +11:00
b8ae90263a Fix version patching sequence strip alpha from 2.4x files
Regression in 4f5f868a52
2020-12-14 20:44:26 +11:00
7d4536cacc Fix enum-conversion, old-style-declaration warnings
Introduced in 8f3a401975
2020-12-14 20:44:26 +11:00
6327771bc9 Fix T83696: Add Additional menu to Effects panel
This adds the missing options for the effects as it is done in modifiers.

Reviewed By: HooglyBoogly

Maniphest Tasks: T83696

Differential Revision: https://developer.blender.org/D9838
2020-12-14 10:25:37 +01:00
8f3a401975 Eevee: Add Volume Transmittance to Color Render Passes.
In Cycles the volume transmittance is already composited into the color
passes. In Eevee the volume transmittance pass was separate and needed
to be composited in the compositor. This patch adds the volume
transmittance pass direct in the next render passes:

 * Diffuse Color
 * Specular Color
 * Emission
 * Environment

This patch includes the removal of the volume transmittance render pass.
It also renames the volume render passes to match Cycles. The setting
themselves aren't unified.

Maniphest Tasks: T81134
2020-12-14 09:27:58 +01:00
fddbcb5757 UI: Click modifier icon to set active modifier
This should be a final piece of the changes for the active modifier
interface. Before, it was necessary to click on the blank space of a
modifier panel to set it active (not the header), this commit allows
clicking on the icon also.

The spacing with the spacing with the expand button would ideally
be a bit larger, but the layout system doesn't offer much flexibility
here.
2020-12-13 23:49:14 -06:00
260fca5d08 Fix T83673: Custom node trees selectable in nodes modifier
Node tree types from addons were selectable in the modifier's drop-down.
Obviously they didn't do anything, but it shouldn't be possible anyway.
This was just caused by an unimplemented poll function.
2020-12-13 22:59:52 -06:00
Yevgeny Makarov
977ef04746 Cleanup: Fix capitalization in various places
Approximately 33 changes of capitalization to conform to MLA title style.

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

Reviewed by Julian Eisel
2020-12-13 13:12:56 -08:00
dd0520b93b Fix T83725 Inconsistent vertex group between exact and fast boolean.
This makes the exact boolean have zero weights for any vertex groups
on any newly created vertices, which is what the fast solver does.

The exact boolean solver was interpolating vertex data when interpolating
loop data in newly created faces. Not sure why I chose that. The Fast
boolean solver doesn't do that, so I stopped doing it too.
2020-12-13 16:04:05 -05:00
Yevgeny Makarov
a2693ba43e Cleanup: removing some uses of equal sign in descriptions
Using 'is/means/equal' words in place of equal sign in descriptions.

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

Reviewed by Hans Goudey
2020-12-13 12:59:36 -08:00
Yevgeny Makarov
afeaac8b18 Fix cursor position on HighDPI in stereo side-by-side mode
Could not select left quarter of the screen in stereo side-by-side mode on high dpi displays.

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

Reviewed by Julian Eisel
2020-12-13 12:48:50 -08:00
Yevgeny Makarov
2e5d9a73f7 UI: Improved Script Execution Warning
New dialog box layout with large alert icon for the Python script execution warning popup.

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

Reviewed by Hans Goudey
2020-12-13 12:39:28 -08:00
Yevgeny Makarov
bec583951d UI: Remove Unused 'U.wheellinescroll' Property
Remove 'U.wheellinescroll' preference, currently hidden and unused.

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

Reviewed by Brecht Van Lommel
2020-12-13 12:30:03 -08:00
9c0df8e275 Fix weird Swing+Twist decomposition with noncanonical quaternions.
It turns out that after the fix to T83196 (rB814b2787cadd) the matrix
to quaternion conversion can produce noncanonical results in large
areas of the rotation space, when previously this was limited to
way smaller areas. This in turn causes Swing+Twist math to produce
angles beyond 180 degrees, e.g. outputting a -120..240 range.

This fixes both issues, ensuring that conversion outputs a canonical
result, and decomposition canonifies its input.

This was reported in chat by @jpbouza.
2020-12-13 22:06:01 +03:00
c6075118d5 Cleanup: Reduce variable scope in view_2d_ops.c 2020-12-13 09:27:37 -06:00
4797c13e8f UI: Add more property editor operators to IC keymap
As a followup for rB2b3d85d7d6771, this commit adds the remove and
copy operators for grease pencil modifiers, effects, and constraints
where they apply.
2020-12-12 12:07:22 -06:00
57f900e4ef Fix T83705: GPencil - Duplicate strokes of destination layer when merge layer
If the destination layer hadn't keyframe, a new keyframe was added and later the merge layer strokes were added, but this could change the animation because the new frame replaced the old drawings of the target layer.

Now, before merge the layer, all keyframes are added in the target layer in order to keep the drawings.
2020-12-12 18:49:57 +01:00
3eb6649453 GPencil: Add uniform subdivide BKE to improve interpolation
This patch introduces a new BKE function that performs a uniform subdivide.

The goal of this function is to subdivide the stroke to reach a target number of points while maintaining its shape, color, and weights.
This is done by repeatedly subdividing the longest edge in the stroke. Every subdivision adds a new point at the exact middle point of an edge.

The function is intended to be used in the interpolation operators to give better results when interpolating between different sized strokes.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D9835
2020-12-12 16:49:38 +01:00
ae94a390a7 Cleanup: clang tidy 2020-12-12 12:24:14 +01:00
0c1d476923 UI: Allow UI to pass focused data-block to operators via context
This is similar to c4a2067130130d, but applies to the general UI and is only
about single data-blocks. Here there was a similar problem: How can buttons
pass the data they represent to operators? We currently resort to ugly ad-hoc
solutions like `UI_context_active_but_get_tab_ID()`. So the operator would need
to know that it is executed on a tab button that represents a data-block.

A single button can now hand operators a data-block to operate on. The operator
can request it via the "id" context member (`CTX_data_pointer_get_type(C, "id",
&RNA_ID)` in C, `bpy.context.id` in .py).
In this commit, it is already set in the following places:
* Generic RNA button code sets it to the pointed to data-block, if the button
  represents a data-block RNA pointer property. (I.e for general data-block
  search buttons.)
* Data-block selectors (`templateID`) set it to the currently active data-block.
* The material slot UI-List sets it for each slot to the material it represents.
The button context menu code is modified so its operators use the context set
for the layout of its parent button (i.e. `layout.context_pointer_set()`).

No user visible changes. This new design isn't actually used yet. It will be
soon for asset operators.

Reviewed as part of https://developer.blender.org/D9717.
Reviewed by: Brecht Van Lommel
2020-12-11 23:08:29 +01:00
af008f5532 UI: Allow Outliners to pass selected data-blocks to operators via context
The way the Outliner integrates operations on selected tree elements is known
to be quite problematic amongst developers. The context menu is generated in an
unusual way and doesn't use the normal operator system. Instead, changes are
applied via a recursive callback system. Things are quite ad-hoc, and the
callbacks often implement logic that should not be in the Outliner, but in
entirely different modules. Often these modules already contain the logic, but
as proper operators.

This commit is a step into a hopefully better direction that should allow us to
put actual operators into Outliner context menus. It starts solving the problem
of: How can the Outliner pass selected data to operators. It implements it for
data-blocks only, but other data could do it in the same way.

Idea is to keep doing what operators were initially designed to do: Operate on
context.
Operators can now query a "selected_ids" context member
(`CTX_data_selected_ids()` in C, `bpy.context.selected_ids` in .py). If an
Outliner is active, it will generate a list of selected data-blocks as a
response, via its `SpaceType.context` callback.
Any other editor could do the same.

No user visible changes. This new design isn't actually used yet. It will be
soon for asset operators.

Reviewed as part of https://developer.blender.org/D9717.
Reviewed by: Brecht Van Lommel
2020-12-11 23:08:29 +01:00
ba83ad226d Fix error in recent commit
Introduced in rBcada56b1f72f537f9ab007cfafd430ac10c292fb
2020-12-11 17:54:27 -03:00
0dbbcaf1e6 Fix: Fix potential memory leak in BLI_getenv
Issue introduced in rB87b19b3aba0c and unlikely to occur
but no reason not to have correct code.
2020-12-11 12:09:18 -07:00
bbd7f94d8a Cleanup: Python GPU: change prefix 'bpygpu_' to 'py_' in static functions 2020-12-11 16:06:22 -03:00
cada56b1f7 Cleanup: GPU Python: Use 'PyC_ParseStringEnum' for string enum 2020-12-11 16:06:22 -03:00
87b19b3aba Fix: BLI_getenv returns ascii not UTF8 on windows
BLI_getenv has always incorrectly returned ascii rather
than UTF-8. This change corrects this behaviour.

This resolves issues when the `BLENDER_USER_CONFIG`
environment variable contains a path with Unicode characters
on windows as reported in T74510 (but unlikely the root
cause for the issue at hand there)

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

Reviewed by: brecht
2020-12-11 11:59:14 -07:00
92ab76c38f Cleanup: clang-format
Forgot to run Make Format on recent spelling changes
2020-12-11 10:48:30 -08:00
Valdemar Lindberg
93c67b0b8e Fix T83586: Cycles failing to load OpenEXR image with EXR RGBAZ channels
Don't refuse to load 5-channel images, instead drop any channels after the 4th
and hope that the first channels represent RGBA.

Differential Revision: https://developer.blender.org/D9820
2020-12-11 19:36:09 +01:00
97651f428b Fix T83050: Crash dragging shared collection to master collection
The flag syncing code expects to find collection flags in same view
layer before and after the move, it even has an assert for it. However,
there is one case where this doesn't happen, when dragging a collection
that exists in two scenes to the master collection.

This commit removes this assert, frees the temporary flag structs
separately, and updates some comments with this information.
There is more detail in the adjusted comment.

Differential Revision: https://developer.blender.org/D9785
2020-12-11 12:15:51 -06:00
b73ed882c0 Cleanup: clang tidy 2020-12-11 19:02:46 +01:00
cef5d0923b Readme file to extern libraries about the attribution document 2020-12-11 18:53:22 +01:00
561d9169fe Fix T83280: Crash when deleting hair collision collection.
Root of the issue was missing management of ID pointers in the cloth
modifier data stored in ParticleSystem for hair physics, in the
'foreach_id' particle system code.

Using modifier's 'foreach_id' code in psys one unfortunately requires
some ugly conversion gymnastics, but this is still better than having
dedicated code for that case.

Note that this is actually a fairly critical issue, fix should be
backported to 2.91.1 should we do it, and to 2.83 LTS as well I think.
2020-12-11 18:46:21 +01:00
85cb238820 Licenses: Attribution document
This document helps Blender users to known what is the library of each
individual 3rd party components that Blender depend on.

Generated using:
https://github.com/amzn/oss-attribution-builder

This is based on the libraries in extern and the svn libraries.

For the libraries in extern the README.blender was used as reference.
For the libraries in svn I used `cmake/versions.cmake`.

Note that the crediting is a bit of hit and miss. For some projects this
is very clear, while for others I had to do some digging. Either way I
gave my best shot.

The sources to (re-)generate this file is local at the moment. But it
should be moved to our infra-structure at some point.

Differential Revision: https://developer.blender.org/D9798
2020-12-11 18:44:11 +01:00
f5dc34ec9c Geometry Nodes: support instancing collections
The Point Instance node can instance entire collections now.
Before, only individual collections were supported.

Randomly selecting objects from the collection on a per point basis
is not support, yet.

Last part of D9739.

Ref T82372.
2020-12-11 18:00:37 +01:00
5ced167336 Geometry Nodes: support collection sockets
Part of D9739.
2020-12-11 17:47:58 +01:00
4885fbc07b Nodes: add Collection socket type
The implementation is pretty much the same as for Object sockets.
The socket color is the one that is used for collections in the outliner.

Part of D9739.
2020-12-11 17:38:32 +01:00
f762d37790 Cycles: enable OpenCL rendering on recent Intel GPUs
Based on testing by Intel, rendering on Iris GPUs and upcoming Xe GPUs
should work. This is enabled on Windows and Linux.

More testing is needed to verify correctness and performance in production
scenes, but our basic benchmark files seem to give correct results.
2020-12-11 17:37:54 +01:00
c6626a2f8a Cleanup: compiler warnings
If you mark one function as override in a class, all must be marked.
2020-12-11 17:37:31 +01:00
Yevgeny Makarov
f7069d71aa Trackpad: Fix wrong scroll deltas on Retina
Scale Mac trackpad scrolling changes by pixel size of output device.

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

Reviewed by Brecht Van Lommel
2020-12-11 08:28:56 -08:00
Yevgeny Makarov
badbf816b8 UI: Consistent Range Descriptions
Unifying range descriptions as a value 'to' a value.

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

Reviewed by Julian Eisel
2020-12-11 07:35:44 -08:00
273aca964e Refactor/extend BKE API to get special user directories
The previous `BKE_appdir_folder_default()` was confusing, it would return the
home directory on Linux and macOS, but the Documents directory on Windows.
Plus, for the Asset Browser, we want to use the Documents directory for the
default asset library on all platforms.
This attempts to clean up the API to avoid confusion, while adding the newly
needed functionality.

* `BKE_appdir_folder_default()` should behave as before, but the implementation
  changed:
** Removes apparently incorrect usage of `XDG_DOCUMENTS_DIR` on Unix systems -
   this seems to be a config file variable, not an environment variable. Always
   use `$HOME` instead, which this ended up using anyway.
** On Windows it doesn't attempt to use `%HOME%` anymore and gets the Documents
   directory directly.
* Add `BKE_appdir_folder_home()` to gives the top-level user directory on all
  platforms.
* Add `BKE_appdir_folder_documents()` to always get the user documents
  directory on all platforms.

There should be no user noticable behavior change.

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

Reviewed by: Brecht Van Lommel
2020-12-11 16:20:53 +01:00
6de85a0cc0 Ghost: Support queries for special user directories (desktop, documents, etc.)
When we had to get special user directories, we'd usually do it in varying,
rather ad-hoc ways. It would be done with a bunch of `#ifdef`s for the
different operating systems. Also, some of the used Win32 functions were legacy
ones and the API docs recommend using newer ones.
Further, seems `BKE_appdir_folder_default()` used `XDG_DOCUMENTS_DIR` wrong.
It's not supposed to be an environment variable but a value inside a config
file.

This adds the platform dependent logic to Ghost, so we can abstract it away
nicely using the `GHOST_ISystemPaths` interface. Getting the desktop directory
for example can now easily be done with:
`GHOST_getUserSpecialDir(GHOST_kUserSpecialDirDesktop).`

For now I added the logic for desktop, documents, downloads, videos, images and
music directories, even though we only use the Documents one. We can extend/
change this as needed, it's easy to do now.
On Windows and macOS, it uses pretty much the same way to access the
directories as elsewhere already. On Linux, it uses the `xdg-user-dir` command
that seems to be available by default on most Linux systems.

No functional changes. The new queries are not actually used yet.

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

Reviewed by: Brecht Van Lommel
2020-12-11 16:20:53 +01:00
c8a3d1a1fa GPencil: Add Link support to Effects using Ctrl+L
The effects were not supported in this operator, but it was supported in the Outliner.

Differential Revision: https://developer.blender.org/D9824
2020-12-11 15:53:22 +01:00
727d5013a7 Fix T82881: Paint mask 'deselect on nothing' missed viewport update
Was failing for weightpaint and vertexpaint.

Selection flags were actually changed, but the update in the viewport
wasnt immediate, leading to confusion when the update happened later
(e.g. when using the weight gradient tool as done in the report).

We need to tag ID_RECALC_SELECT and send ND_SELECT notifier here. This
could be done explicitly, but there is also existing functionality
available that does this.
Note: the way updates happen for paintfaces vs. paintverts looks a bit
inconsistent (so this could be part of a later cleanup commit)

Maniphest Tasks: T82881

Differential Revision: https://developer.blender.org/D9631
2020-12-11 15:32:31 +01:00
7c8e01341f UI: Correct help text in the Parent panel
Tracking Axis and Up Axis were still referring to duplis (DupliFrame) - changed it to be in line with Aaron's info about them in our manual
2020-12-11 14:11:17 +01:00
bfb6fce659 Cycles: Add CPU+GPU rendering support with OptiX
Adds support for building multiple BVH types in order to support using both CPU and OptiX
devices for rendering simultaneously. Primitive packing for Embree and OptiX is now
standalone, so it only needs to be run once and can be shared between the two. Additionally,
BVH building was made a device call, so that each device backend can decide how to
perform the building. The multi-device for instance creates a special multi-BVH that holds
references to several sub-BVHs, one for each sub-device.

Reviewed By: brecht, kevindietrich

Differential Revision: https://developer.blender.org/D9718
2020-12-11 13:24:29 +01:00
d72ec16e70 Geometry Nodes: add Attribute Mix node
This node can be used to mix two attributes in various ways.
The blend modes are the same as in the MixRGB shader node.

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

Ref T82374.
2020-12-11 12:00:48 +01:00
150a1d158a Cleanup: remove some forward declared enums
Forward declaring enums are not allowed in C++.

Differential Revision: https://developer.blender.org/D9811
2020-12-11 11:48:58 +01:00
f5c7246717 Fix wrong operator return values in Outliner code.
Mistakes in rBac8b641b77e0 and rBf254f66587f2.

Spotted while inverstigating T83592.
2020-12-11 11:05:28 +01:00
f7e5f96f56 GeometryNodes: Make properties exposed in modifier overridable. 2020-12-11 10:53:08 +01:00
b62a9ef66f Cleanup: Fix typo in comment. 2020-12-11 10:53:08 +01:00
Evan Wilson
6e4fccd9fa Correct the order of the last two arguments in eevee_cryptomatte_shading_group_create
When compiling on Windows, the following warnings occur:
```[3468/4560] Building C object source\blender\draw\CMakeFiles\bf_draw.dir\engines\eevee\eevee_cryptomatte.c.obj
C:\blender-git\blender\source\blender\draw\engines\eevee\eevee_cryptomatte.c(306): warning C4047: 'function': 'bool' differs in levels of indirection from 'void *'
C:\blender-git\blender\source\blender\draw\engines\eevee\eevee_cryptomatte.c(306): warning C4024: 'eevee_cryptomatte_shading_group_create': different types for formal and actual parameter 5```

As @Severin pointed out [here](https://developer.blender.org/rB76a0b322e4d3244e59a154c8255b84a4fbc33117#288960), this is due to the last two arguments being flipped.  This diff corrects the order.

Reviewed By: Severin, fclem

Differential Revision: https://developer.blender.org/D9809
2020-12-11 08:45:05 +01:00
219dba8506 Workaround T83651: Crash dragging multiple buttons in the clip editor
Avoid the crash, dragging multiple buttons still needs fixing.
2020-12-11 15:32:14 +11:00
392a8e2907 Cleanup: sort cmake file lists 2020-12-11 15:32:14 +11:00
8cc951d2ae Cleanup: trailing space 2020-12-11 15:32:14 +11:00
ff6d7e9072 Cleanup: spelling, expand on FCurve.rna_path docstring 2020-12-11 15:32:14 +11:00
Yevgeny Makarov
a4a42f3171 UI: Use 'and' Instead of '&' in Descriptions
Use 'and' instead of ampersand in descriptions and comments.

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

Reviewed by Aaron Carlisle
2020-12-10 18:22:16 -08:00
caed4849d0 Fix T83640: No immediate updates when changing the settings of a just-
duplicated particle system

When particle settings are duplicated along with the particle system,
this means a change in relations, was missing
'DEG_relations_tag_update'.

Maniphest Tasks: T83640

Differential Revision: https://developer.blender.org/D9823
2020-12-10 22:48:47 +01:00
a7fcca1062 UI: Use words instead of symbols for float comparison items
Though they are nice and concise, users should not be expected to know
the meaning of symbols like `!=`.
2020-12-10 11:07:26 -06:00
8bdd996cd0 Geometry Nodes: Add helper function to check if attribute exists 2020-12-10 10:50:37 -06:00
3d25312617 Nodes: fix incorrectly parameter name and type
The parameter type was incorrectly changed in rB6be56c13e96048cbc494ba5473a8deaf2cf5a6f8 by me.
This can be any id and does not have to be a node tree.
2020-12-10 16:15:28 +01:00
1d447dcd19 Fix T83630 Exact Boolean assert failure in Debug build.
I thought I had reasoned that the add_patch would only happen
when the patch was not already in a cell, but I missed reasoning
about merged cells. So switched to a set 'add' instead of 'add_new'.
2020-12-10 09:15:16 -05:00
348bd319d5 Geometry Nodes: Attribute Fill Node
This commit adds a node that fills every element of an attribute
with the same value. Currently it supports float, vector, and color
attributes. An immediate use case is for "billboard" scattering.

Currently people are using the same input to a Random Attribute node's
min and max input to fill every element of a vector with the same value,
which is an unintuitive way to accomplish the same thing.

Differential Revision: https://developer.blender.org/D9790
2020-12-10 07:58:45 -06:00
efb741b280 Geometry Nodes: rename modifyPointCloud to modifyGeometrySet
Since the initial merge of the geometry nodes project, the modifyPointCloud
function already was already modifying a geometry set. The function wasn't
renamed back then, because then the merge would have touched many
more files.

Ref T83357.
2020-12-10 14:35:15 +01:00
2b9eb5eee5 Fix T83361: UV Editor does not draw pinned selected UVs as pinned
Caused by rB4212b6528af.

outlineColor is computed by the vertex shader, so not a uniform.
So outlineColor was undefined.

note: it was still possible to run into the situation that a selected UV
is drawn ontop of a selected pinned UV [you had to disable sticky
selection for this], now also make sure selected-pinned are drawn
topmost, then selected, then unselected UVs.

Maniphest Tasks: T83361

Differential Revision: https://developer.blender.org/D9786
2020-12-10 13:20:15 +01:00
e795ba1529 Geometry Nodes: fix recursive instance transforms
Previously, the transformation of recursive instances did not work as
on would expect. Second-level instances would detach from first-level
instances when the object was moved.
2020-12-10 10:23:54 +01:00
22959dc866 Fix missing custom-property escaping for whole-character keying set
Custom properties with characters that needed escaping
had f-curves created with invalid paths.
2020-12-10 19:31:22 +11:00
83f5a0b972 Fix missing string escaping in RNA_path_append
This was escaping the '[' character, which isn't needed for quoted text.
2020-12-10 17:57:59 +11:00
e21f1136c2 Tests: fix 'ctest -j' running multiple tests at once
bl_blendfile_io & bl_blendfile_liblink shared a filename,
which could make these tests fail.
2020-12-10 17:18:38 +11:00
2fbf9cb551 Cleanup: remove unused function bc_find_bonename_in_path 2020-12-10 17:10:19 +11:00
d97845a693 BLI_string: return NULL from BLI_str_quoted_substrN on failure
This was returning an empty allocated string, however almost
all callers checked if the return value was NULL before freeing,
making for misunderstandings on the intended use of this function.

BCAnimationSampler::initialize_curves for example detected the
f-curves animation type to 'bone' based on a non-NULL return value
which never failed.

Also fixes two leaks where the the result of BLI_str_quoted_substrN
wasn't freed.
2020-12-10 16:56:09 +11:00
3ec7cf64bc Fix BLI_str_quoted_substrN use with escaped strings
BLI_str_quoted_substrN didn't unescape the resulting string,
yet all callers were using this with animation paths which are
created using BLI_str_escape().

- Fix BLI_str_quoted_substrN use with escaped strings by calling
  BLI_str_unescape().

  Note that it's possible we want an a version of this function that
  keeps escape characters. This could be added if it's required.

- Fix end quote detection using BLI_str_escape_find_quote
  checking for `\"` isn't reliable since an even number of back-slashes
  before a quote means it's not escaped.
2020-12-10 16:12:25 +11:00
2814cdbd86 BLI_string: extract quote utility into BLI_str_escape_find_quote
Duplicate logic for this exists in BLI_str_quoted_substrN,
which doesn't properly support escaping.
2020-12-10 15:06:16 +11:00
aef9243ebb Cleanup: remove unnecessary vars in RNA token reading 2020-12-10 14:55:28 +11:00
ed2556e22c Cleanup: declare variables when used (RNA) 2020-12-10 14:55:28 +11:00
c5aaa11c3b Cleanup: declare variables when used (bpy) 2020-12-10 14:55:28 +11:00
51cbd5d91d Cleanup: avoid '_ln' suffix
Use '_len' or '_line_number'.
2020-12-10 14:55:28 +11:00
564ef8279b Cleanup: use snake-case instead of camel-case 2020-12-10 14:55:28 +11:00
b5bc9d80a1 PyAPI: add bpy.utils.unescape_identifier
Utility to perform the reverse of `bpy.utils.escape_identifier`
2020-12-10 14:40:01 +11:00
2f86518ac0 RNA: use BLI_str_unescape utility for parsing escaped strings 2020-12-10 14:40:01 +11:00
82e1b65d91 BLI_string: support escaping additional control character
Add support for escaping \a, \b & \f for completeness,
currently it's not required.
2020-12-10 14:40:01 +11:00
15d801625c BLI_string: add BLI_str_unescape utility function
Performs the reverse of BLI_str_escape.
This allows logic to be removed from RNA path handling.
2020-12-10 14:40:01 +11:00
7fc1d76037 Fix BLI_str_escape with control characters, add unit tests 2020-12-10 14:40:01 +11:00
65f139117d Cleanup: rename BLI_strescape to BLI_str_escape
Prepare for `BLI_str_unescape` which doesn't read well
without the separator.
2020-12-10 14:40:01 +11:00
548e9624d0 Fix T82852: Cycles crashes when editing a mesh with adaptive subdivision
The issue is caused by stale data on the Mesh Node which is not cleared
during synchronizing since the socket API refactor so that we can detect
changes. However, synchronization only updates the sockets of the Mesh,
so other properties were left with outdated values.

This caused an underflow when computing attribute size for undisplaced
coordinates as it was using the current number of vertices minus the
previous count of subdivision vertices, which at this point should be 0.

Added a simple method to clear non socket data. Also modified
Mesh.add_undisplaced to always use an ATTR_PRIM_GEOMETRY as the data is
not subdivided yet and it avoids any further issues regarding computing
attribute sizes.
2020-12-10 02:31:25 +01:00
b379f93484 Cleanup: Use const for filter queries 2020-12-09 23:43:01 +01:00
d870a60dd9 Sculpt: Elastic deform type for Snake Hook
This adds deformation types to snake hook and the elastic deformation
type. This mode deforms the mesh using a kelvinlet instead of applying
the displacement directly inside the brush radius, which is great for
stylized shapes sketching.

Changes in rake rotation when using elastic are too strong when set
to 1, so I'll add a nicer way to support rake rotations with smoother
transitions in the future.

Reviewed By: sergey, JulienKaspar

Differential Revision: https://developer.blender.org/D9560
2020-12-09 22:25:16 +01:00
19560eef1a Cleanup: Remove unused c popup menu for text editor
This code hase been usused for 10 years and the right click menu is now 
in python.
2020-12-09 16:09:51 -05:00
3b57927651 Fix T82242: creating particle influence textures does not set up DEG
relation immediately

Texture and ParticleSettings have a DEG relation, but
`DEG_relations_tag_update` was not called when the texture changed.
This lead to no updates when e.g. texture size changes, relation only
went into full effect after save/reload or adding/removing keyframes.

Two places were additional relation tagging is needed:
- ParticleSettings `active_texture` changes
- ParticleSettingsTextureSlot (basically any TextureSlots') texture
changes

Maniphest Tasks: T82242

Differential Revision: https://developer.blender.org/D9393
2020-12-09 21:45:36 +01:00
ac7694aee0 UI: Update theme to match Shader nodes category color with socket color
The change to match socket color and category was already done, but it was missing
versioning code to update the theme on load.

Fixes T83500 (already closed as invalid, but this would solve the non-matching colors)

Reviewed by Hans Goudey (HooglyBoogly)
2020-12-09 21:09:37 +01:00
41bca5a3ee Fix T83581: "Only local" ambient occlusion option causes error on OptiX 2.92
The SVM AO node calls "scene_intersect_local" with a NULL pointer for the intersection
information, which caused a crash with OptiX since it was not checking for this case and
always dereferencing this pointer. This fixes that by checking whether any hit information
was requested first (like is done in the BVH2 intersection routines).
2020-12-09 17:06:28 +01:00
c93f826661 Cleanup: various clang tidy fixes 2020-12-09 16:29:11 +01:00
4a5f36638b Geometry Nodes: simplify supporting different input socket types for attributes
This is a non-functional change. The functionality introduced in this commit
is not used in master yet. It is used by nodes that are being developed in
other branches though.
2020-12-09 16:20:57 +01:00
25e151cc34 Fix T83575: GPencil: VFX Blur is not disabled when samples are zero
Before the number of samples was not checked, only the pixel size.
2020-12-09 15:41:07 +01:00
37bf71ad04 Fix T83588: Crash with Shrink/Fatten and Offset Even
`t->keymap` can be `NULL`.

Bug introduced in rBc822f66bb83
2020-12-09 10:30:23 -03:00
Germano Cavalcante
b9eb592133 Fix T83460: Regression in snap for measure tool
Now the gizmo is drawn only when the eventstate located in
`wm->winactive->eventstate` has not changed.

So it doesn't matter if it's "selected" or not.

This commit also removes the use of the private header "wm.h"

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9539
2020-12-09 09:34:44 -03:00
5a8012b6a6 Degraded AMD 20.11.3 driver to limited support. 2020-12-09 12:37:20 +01:00
baf84ecbe4 Workaround for Access Violation startup crash on deprecated Radeon GPUs on Windows
This is a workaround for T80804.

There's a startup crash that happens on 2.91.0 on Windows, an `EXCEPTION_ACCESS_VIOLATION`
on `atio6axx.dll`. It is triggered by `glClear` on the `detect_mip_render_workaround`
function. The workaround moves the function after the device/driver workaround section and
sets the flag to the affected one to avoid running the check.

It is deprecated hardware that has not meet the minimum requirements since 2.79, but is
still usable and this extends its usability a bit before the cards are finally blacklisted.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9667
2020-12-09 12:15:15 +01:00
1a959e9fa8 Raised AMD/Terascale2 from unsupported to supported.
There is a patch that fixes the crash on startup {D9667}.
2020-12-09 12:12:35 +01:00
55d14210cc Raised AMD CEDAR on Linux from unsupported to limited support
There is a workaround available by setting the environment variable `R600_DEBUG=nosb`.
2020-12-09 12:10:32 +01:00
3a23f18e02 Blender LTS: Download + Release notes CMS scripts
This patch contains 2 scripts that will help with LTS releases

create_download_urls.py

    This python script is used to generate the download urls which we can
    copy-paste directly into the CMS of www.blender.org.

    Usage: create_download_urls.py --version 2.83.7

    Arguments:
      --version VERSION  Version string in the form of {major}.{minor}.{build}
                         (eg 2.83.7)

    The resulting html will be printed to the console.

create_release_notes.py
=======================

    This python script is used to generate the release notes which we can
    copy-paste directly into the CMS of www.blender.org and stores.

    Usage: ./create_release_notes.py --task=T77348 --version=2.83.7

    Arguments:
      --version VERSION  Version string in the form of {major}.{minor}.{build}
                         (e.g. 2.83.7)
      --task TASK        Phabricator ticket that is contains the release notes
                         information (e.g. T77348)
      --format FORMAT    Format the result in `text`, `steam`, `wiki` or `html`

Requirements
============

* Python 3.8 or later
* Python phabricator client version 0.7.0
  https://pypi.org/project/phabricator/

For convenience the python modules can be installed using pip.

    pip3 install -r ./requirements.txt

Differential Revision: https://developer.blender.org/D9055
2020-12-09 09:14:53 +01:00
abddd7d5f9 Fix T83566: bpy.props.CollectionProperty gives incorrect error
Error in commit a7b3047cef.
2020-12-09 18:46:07 +11:00
ebe4bf6286 Fix another id-property name length check
Missed this in 6c9263d817
2020-12-09 17:33:11 +11:00
acc6373939 Fix custom-property UI allowing long names that raised errors
Rename `rna_property` to `rna_custom_property`
to differentiate it from a more general property.
2020-12-09 17:20:44 +11:00
6c9263d817 Fix off by one error in id-property name validation
The Python API accepted a name with 64 bytes, clipping it to 63.
2020-12-09 17:16:43 +11:00
3b5a81936d Fix custom property UI handling names with quotes and back-slashes
Custom property names wasn't escaping strings, causing exceptions
editing custom properties with characters that needed to be escaped.
2020-12-09 17:04:05 +11:00
9d8aefaa5c Fix RNA un-escaping multiple slashes and strings ending with a slash
Fix for T78823 resolved the issue reported but didn't
properly support multiple back-slashes.
2020-12-09 16:56:08 +11:00
ceba6b2c21 Fix T78823: Slash in custom property name does not work
This fixes inserting key-frames for any collection names
containing a back-slash too (bones, modifiers, sequence strips etc).
2020-12-09 16:04:21 +11:00
d1cedf53fa Revert "Fix T78823: Slash in custom property name does not work"
This reverts commit cbae82ba96.

This change introduced the following problems:

- We could no longer reliably duplicate or use an existing
  custom property names.
- We could no longer assume a bone or ID name
  can be used in a custom-property.
- Importers that support custom properties (such as FBX)
  could fail with an exception creating custom properties.
2020-12-09 15:29:28 +11:00
cdfe733e70 Cleanup: use doxy sections for graph_edit.c 2020-12-09 14:34:40 +11:00
9c5d67411a creator: remove reference to SDL_AUDIODRIVER from --help text
This was added when Linux's audio support
often needed to be manually configured.

Further 3rd party libraries have their own environment variables & docs
these need not be part of Blender's help message unless they're likely
to be needed to properly run Blender.
2020-12-09 14:15:24 +11:00
5cdfceaa1a Cleanup: use common 'MOD_WELD_MODE_' prefix 2020-12-09 14:10:30 +11:00
Henrik Dick
9b11a7776f Modifier: Add "Connected" mode to the weld modifier
Implement improvement from T73139 for merging along edges.
It is now called "Connected" mode, while the default is called "All".

With the recent performance improvement, the Connected Mode is in some
cases only double the speed than the usual merge all strategy but in
other cases it may be even faster. The bottleneck is somewhere further
down the line of merging geometry.

The motivation for this patch came from T80897, because the merging in
complex solidify is making it very slow.
Now merging can be removed from solidify without greater consequences,
as this is just a quicker and more advanced algorithm to do the same
thing that solidify currently does slowly.

Reviewed by: mano-wii, campbellbarton

Ref D8966
2020-12-09 12:29:48 +11:00
e17967f890 Fix T83559: File Browser uses wrong operation
When opening a temporary File Browser, we have to make sure the file selection
parameters are refreshed. When opening it in a new Window that would always be
the case, if the File Browser uses a maximized window (as set in the
Preferences), it might reuse space-data from a previous use. So we have to
force the refresh.
Also renamed the relevant function to be more clear about what it's doing.

Mistake in 95b3c4c966.
2020-12-08 21:23:55 +01:00
41fa1fea40 Removing ISC license
Blender actually uses the ICS license, not ISC.
2020-12-08 18:51:56 +01:00
46e66d154c Missing README.blender license files + New BSD cases
I also changed New BSD to BSD 3 Clause.

Differential Revision: https://developer.blender.org/D9791
2020-12-08 18:51:14 +01:00
e08de974c3 Fix T83114: incorrect normals after joining subdivided meshes
This just makes sure that the mesh coming out of the subdivision
surface node has correct normals. Ideally, we would lazily compute
derived data like normals in more cases, but that can be solved later.
Correctness is more important right now.

In order to solve this better, it would be nice if functions like
`BKE_mesh_ensure_normals` would take a `const Mesh *`.
The mesh could be considered to be logically const, because
normals are derived data that is only cached for the current
state of the mesh.
2020-12-08 18:07:50 +01:00
Léo Depoix
40dd70882c Fix T83337: boundary smooth input in subdivision surface node is inverted
Differential Revision: https://developer.blender.org/D9753
2020-12-08 17:49:12 +01:00
Jamell Moore
5b73083d4f Fix T81950: GPencil - Draw - Stoke Placement Stroke Feature Broken
Buffer strokes weren't being the excluded from depth only draw calls
so were being included in depth tests. They are now excluded by
bypassing the creation of the buffer strokes.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9742
2020-12-08 16:48:22 +01:00
d7cf464b49 Cycles: Remove "OptiX support is experimental" notice
OptiX support is not in fact experimental anymore, so it is time for that notice to go.
All Cycles features that are currently supported on the GPU do work now when OptiX is selected.
2020-12-08 16:13:04 +01:00
612b83bbd1 Cycles: Enable baking panel in OptiX and redirect those requests to CUDA for now
This enables support for baking when OptiX is active, but uses CUDA for that behind the scenes, since
the way baking is currently implemented does not work well with OptiX.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9784
2020-12-08 16:06:39 +01:00
9962e5936d Cleanup: Use enum for file selection type definitions
Makes it more clear that these belong together and allows using the enum type
rather than just `int`.
2020-12-08 15:43:15 +01:00
2678953f69 Cleanup: Correct an own earlier commit to use an existing utility function
Didn't know this function existed, better to use it then to avoid verbosity.
2020-12-08 15:00:31 +01:00
95b3c4c966 File Browser: Refactor access to the selection parameters struct
* Avoid direct access to `SpaceFile.params`, use a getter instead. This matters
  because once the asset-browser changes are in, there will be an alternative
  selection parameter object. The getter can return the correct one.
* Rename the function to ensure the parameters. The old name
  `ED_fileselect_get_params()` wasn't a mere getter, it would create the
  parameters if necessary. Now we have an actual getter, so better be clear.
* In some instances, I replaced the old "get" function with the new mere
  getter. So the ensure logic is called less often. However, in these cases we
  should be able to assume the selection parameters were created already as
  part of the editor creation routine.

The term "active" in the new function names may seem a bit odd in the current
context, but that is a preparation for the Asset Browser merge as well. Like
said, there will be two file selection parameter objects in the space.
2020-12-08 14:39:31 +01:00
2a4fe88c13 Cleanup: Use guarded allocator for data-block names returned from file reading
Direcly using the C library allocator functions is usually avoided in favor of
our guarded allocator. It's more useful when debugging.
2020-12-08 12:56:11 +01:00
296bc35638 Fix unexpected "/" path after normalizing empty directory path
Caused problems in the Asset Browser branch when passing an empty path. The
function shouldn't blindly add a slash but sanity-check the input parameters
first.
2020-12-08 12:42:02 +01:00
Bastien Montagne
c0bd240ad0 LibOverride: Add initial support for adding new NLA tracks.
Also makes NLA tracks and strips overridable.

User can either edit existing strips in existing NLA tracks (but not add or remove them), and/or add new NLA tracks after those comming from the linked data.

Most of the work was as usual checking operators and adding protections against illegal operations in override context.

Note that since we can only rely on indices to deal with local added tracks, we forbid any local track being before any linked/original track.

Maniphest Tasks: T72629

Differential Revision: https://developer.blender.org/D9611
2020-12-08 10:55:57 +01:00
78080337f8 PyDoc: expanded documentation for bpy_struct.is_property_set
This patch expands on the `is_property_set` doc-string,
detailing the purpose of the `ghost` argument added in
d3bcbe10c2.

Reviewed By: sybren

Ref D9780
2020-12-08 20:52:31 +11:00
28169cea3d PyDoc: avoid blank lines at the beginning of code-examples 2020-12-08 20:49:28 +11:00
276f6840ed CMake: fix linking with WITH_SDL_DYNLOAD
While this was only needed in 'source/blender/python',
add to ghost to avoid problems in the future.
2020-12-08 20:48:11 +11:00
f43c9499bf Cleanup: use static declarations 2020-12-08 20:44:45 +11:00
d9918e3e53 shaders_test: correct arguments to EEVEE_shaders_cryptomatte_sh_get 2020-12-08 20:44:14 +11:00
922b8abea5 Cleanup: LibOverride: Forgot to update comments in previous commit. 2020-12-08 09:48:20 +01:00
682ccd770c LibOverride: Refactor collection items 'local' helper functions.
It's easier to read and less 'weird' to check that an item is non-local
in a liboverride data-block, than the other way around. Thanks to
@sybren for noticing it.
2020-12-08 09:40:42 +01:00
5f1a155a5e Fix T83117: Curve bevel not handle aligned at end-points
Caused by fix for T80742, 4987b7d347.

Keep the fix that calculates the start/end direction
from adjacent points but only use it as a fallback.
2020-12-08 12:20:27 +11:00
Yevgeny Makarov
ab9952e55f Spelling: Bit Depth Compound Modifiers
Correct usage of compound modifiers like '32-bit'.

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

Reviewed by Julian Eisel
2020-12-07 14:51:06 -08:00
Yevgeny Makarov
41e236c527 UI: Correct Usage of 'Eevee' Name
Use accepted capitalization of Eevee, not 'EEVEE'.

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

Reviewed by Julian Eisel
2020-12-07 13:46:01 -08:00
William Reynish
e258dfa421 UI: Add Heading to Curve Deform Toggles
Adds a heading to the three Properties Curve Deform toggles.

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

Reviewed by Julian Eisel
2020-12-07 13:35:50 -08:00
William Reynish
2b3d85d7d6 IC keymap: Properties and Modifier Changes
Updating Industry Compatible keymap for Property filtering and new Modifier behavior.

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

Reviewed by Julian Eisel
2020-12-07 13:34:06 -08:00
William Reynish
6858065754 Userprefs: Tooltips Section Layout Tweaks
Small improvements to the layout of the Tooltips section in Preferences.

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

Reviewed by Pablo Vazquez
2020-12-07 13:29:53 -08:00
c822f66bb8 Fix T83307: Some modal keys of transform operators don't correspond to the expected effect
The transform modes `shrinkfatten` and `seq_slide` have a special way of
handling events.

They use modal events in a different way than expected.

Therefore, this commit adds special event handles for these modes and
removes the keymodal tips from the status bar.

These effects are already described in the header anyway.
2020-12-07 17:36:23 -03:00
29fb12da58 Fix T83510: Convert Gpencil to curve crash when stroke has zero points
If the stroke had zero points the pointer returned NULL.

Also replaced for loop by FOREACH macro.

This is a corner case of "empty" strokes without points.
2020-12-07 19:08:29 +01:00
3e005a3214 Cleanup: Use LISTBASE_FOREACH in node transform code
Also decrease variable scope.
2020-12-07 11:11:03 -06:00
a61febe739 Add comment to clarify the use of mesh::symmetry
Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9776
2020-12-07 17:17:56 +01:00
4f25e168a2 Fix DPX image output having invalid float metadata
Casting 0xFFFFFFFF to float does not give NaN as is needed here. Found through
compiler warning which is now fixed.
2020-12-07 17:09:34 +01:00
b14b57fc05 Fix failing Eevee render tests after recent changes 2020-12-07 17:09:34 +01:00
Jim Eckerlein
3012446f02 glTF: update Draco library to new version
To support decoding and enhanced encoding of Draco compressed glTF files.

Differential Revision: https://developer.blender.org/D9642
2020-12-07 17:09:34 +01:00
fb82cfb539 Animation: Show Channel Group Colors is now off by default
Change the default for the Show Channel Group Colors preference to OFF.

This option in the user preferences was introduced in rBad85256e7108. It
moved a per-file-per-editor option to the user preferences. As this
option would be frequently turned off by animators, this would now have
to happen only once. This commit takes this one step further, and turns
it off by default, as it can cause major readability issues of the
animation channel list.
2020-12-07 16:58:39 +01:00
bab57550b6 LibOverride: Abstract a bit handling of local items of RNA collections.
RNA collections that support insertion of new items in liboverride
data-block need a special way to distiguish between locale and
orig-from-linked items (since some operations are allowed on the forer,
but no the latter).

In future we want a proper solution to abstract that at the
`BKE_lib_override` level, but for now we need to add some code for each
case.

Note that this commit also fixes a few potential issues with GPencil
modifiers, and constraints, regarding their handling of local overrides.
2020-12-07 16:55:51 +01:00
513578b182 Fix (unreported) LibOverride: GPencil local Modifiers not fully editable.
Missing case in `RNA_property_overridable_get`
2020-12-07 16:55:51 +01:00
c51a70537b Fix T81745: Auto Weights fails with Mirror mod + Vertex Groups X
Fix the Assign Automatic Weights operator in weight paint mode when the
Vertex Groups X option is enabled. This issue was probably introduced in
rB5502517c3c12 where `me->editflag & ME_EDIT_MIRROR_X` was replaced by
either `me->editflag & ME_EDIT_VERTEX_GROUPS_X_SYMMETRY` or
`me->symmetry & ME_SYMMETRY_X`. In this case, the former wasn't working,
so I replaced it with the latter.
2020-12-07 16:30:14 +01:00
2e221de4ce UI Code Quality: Start refactoring Outliner tree-element building (using C++)
Continuation of the work started with 249e4df110. After all display modes
were ported to this new design, this commit starts the (more complex) work on
the individual tree-element types. More concretely it ports animation
tree-elements (action data-blocks, drivers and NLA data).

The commit above explains motivations. In short, we need a better design that's
easier to reason about and better testable.

Changes done here are pretty straight forward and introduce similar class
hierarchy and building patterns as introduced for the display modes already.
I.e. an abstract base class, `AbstractTreeElement` with derived classes for the
concrete types, and a C-API with a switch to create the needed objects from a
type enum. The latter should be replacable with something nicer later on (RAII
based, and type-safer through meta-programming).
Each tree-element type has its own class, with an own header and source file
(okay some closely related types can share a header and source file, like the
NLA ones).

I added some further temporary bits for the transition to the new design, such
as the `TreeElement.type`. It should entirely replace `TreeElement` eventually,
just as `outliner_add_element()` should be quite small by then and easily
replacable by a `TreeBuilder` helper.
2020-12-07 14:51:15 +01:00
634b10acbb Fix missing type check for Outliner eyedropper query
Mistake in 35a5dee2ef.

Code would simply assume that the element under the cursor is an Object if it
was an ID (but not a collection).

This wouldn't cause any issues in current code, since the only other ID that
set the direct-data were collections, which are special in that they don't have
a `TreeStoreElem.type` of 0, which is already being checked for here. And if
there was no direct-data set, the object lookup in the View-Layer would
correctly fail too.
2020-12-07 14:35:54 +01:00
95734e32bf Cleanup: Avoid setting (unsafe) Outliner tree element data that won't be used
I carefully checked and am quite sure for `TSE_ANIMATION_DATA` and
`TSE_NLA_ACTION` the direct-data isn't used at all. This data is stored and
accessed in unsafe ways based on conventions anyway (`void *`). We should aim
for a safer design but it will be difficult to get there. Any removed
complexity will help.
2020-12-07 14:35:54 +01:00
0c0bc61918 Fix access to invalid data in Outliner tree building
Non-ID tree-elements would cast their data pointer to `ID *` and take the name
and ID-Code from there. The name would actually be overridden a few lines
later, so that didn't cause issues. But the ID-Code stored inside the tree
element kept an undefined value. In practice that probably didn't cause many
issues either, since it's just an undefined value that was very unlikely to
take a valid 16-bit ID-code value, meaning ID-Code checks would simply fail as
they should. Further there typically are other checks to see if the element
actually represents an ID.
However, in theory this may have caused a few random crashes or
data-corruptions.
2020-12-07 14:35:54 +01:00
cf9275dd4e Fix failing Cycles tests after Cryptomatte changes
For old files without Cycles cryptomatte settings, must provide the defaults.
2020-12-07 13:13:49 +01:00
d329a6a937 Fix bug in cleanup commit
Fix a copy-paste error in rB11c4066159e
2020-12-07 12:54:46 +01:00
11c4066159 Cleanup: partial Clang-Tidy modernize-loop-convert
Modernize loops by using the `for(type variable : container)` syntax.

Some loops were trivial to fix, whereas others required more attention
to avoid semantic changes. I couldn't address all old-style loops, so
this commit doesn't enable the `modernize-loop-convert` rule.

Although Clang-Tidy's auto-fixer prefers to use `auto` for the loop
variable declaration, I made as many declarations as possible explicit.
To me this increases local readability, as you don't need to fully
understand the container in order to understand the loop variable type.

No functional changes.
2020-12-07 12:41:17 +01:00
2072134faa UI: Fix mistakes in UI messages. 2020-12-07 10:57:27 +01:00
7d2745f8b3 Fix Cryptomatte panel not visible in EEVEE
Caused by {rB5baae026a86f}
2020-12-07 09:31:05 +01:00
9ac6ef7036 File Subversion Bump: 2.92.5 2020-12-07 08:07:18 +01:00
Jeroen Bakker
5baae026a8 Cycles: Use Blender Cryptomatte Settings.
Blender has now the place to store the Cryptomatte settings. This patch
migrates Cycles to use the new settings.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D9746
2020-12-07 08:01:49 +01:00
Greg Neumiller
3d0b65f89b Fix T83296: Unknown actions no longer perform an undo push
str_len_clip is initialized to 0, so when "Unknown Action"
occurs, set str_len_clip appropriately.
Regression in 0688309988

Ref D9759
2020-12-07 13:44:23 +11:00
Greg Neumiller
c2a01a6c11 Fix T83347: Smart UV project crashes with wire edges
Missing NULL check.
Regression in 9296ba8674

Ref D9757
2020-12-07 13:44:17 +11:00
fff0032a25 Cleanup: spelling 2020-12-07 13:25:53 +11:00
5c3fa5a424 Cleanup: correct enum type 2020-12-07 13:25:49 +11:00
ba740ad2ab GPencil: Enable Layer Onion Skin by default 2020-12-06 22:27:28 +01:00
6f22a536e6 Fluid: Updated Mantaflow source files
Includes outflow optimization - might have been the cause of instabilities.
2020-12-06 21:56:43 +01:00
Yevgeny Makarov
ee70eb96cf UI: Alert Dialog Helper Function
Shared helper function to create a split layout with an alert icon for popup dialogs.

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

Reviewed by Julian Eisel
2020-12-06 11:17:51 -08:00
Yevgeny Makarov
79eeabafb3 UI: 'About Blender' with Full Logo
New layout for the 'About' dialog featuring the full version of the Blender logo.

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

Reviewed by Hans Goudey
2020-12-06 10:29:26 -08:00
a90504303e Reorder fields in boolean's ITT_value to save memory. 2020-12-06 10:58:14 -05:00
538f41e949 Doxygen: Increase lookup cache
I could not measure any major speedup/memory usage but this resolves a 
message while running doxygen.
2020-12-05 20:17:32 -05:00
eb4eb07065 Doxygen: Disable HTMLHELP
This feature is intended to generate Microsoft Compiled HTML Help files 
which is not something we use/need.
This also fixes an error in generation because the executable cannot be 
found.
2020-12-05 20:17:32 -05:00
52a6c4f34d Fix crashes with invisible Outliners on fullscreen or window closing
I didn't actually confirm this is caused by invisible Outliners. But I'm pretty
sure the error happens with Outliners that aren't initialized (so were open in
an area before, but another editor is active there currently).
In that case, the runtime data may not be set yet and that is fine.

Fixes T83420.
2020-12-05 14:56:13 +01:00
237f9da4a0 Fix T83400: GPencil onion skin not visible when Edit Lines is enabled
The Edit Lines flag was not checking if Onion was enabled. In 2D template this is disabled by default, but default template has enabled it.
2020-12-05 13:55:10 +01:00
8982a315b7 Add more timing hooks for boolean. 2020-12-05 07:48:41 -05:00
887a602448 Cleanup: Finish porting outliner tree building to C++
No functional changes. This is a few minor cleanups to the remaining C
code for building the outliner tree after parts have been moved to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:58:46 -07:00
48acf15f98 Cleanup: Outliner Data API display mode
No functional changes. Moves the data API display building code to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:54:19 -07:00
aaa02984d3 Cleanup: Outliner scenes display mode
No functional changes. The scene display building code has been moved
to C++.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:53:42 -07:00
1db40c29e5 Cleanup: Outliner orphan data display mode
No functional changes. Code is ported to C++ with additional cleanups to
the logic and variable names.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:51:51 -07:00
1cc0a59be6 Cleanup: Outliner video sequencer display mode
No functional changes. Code is ported to C++. Variable names and logic
are also improved.

Differential Revision: https://developer.blender.org/D9741
2020-12-04 17:50:46 -07:00
ea37e4ea5a Fix incorrect variable name after last commit 2020-12-04 14:46:51 -06:00
67faa85fb0 Cleanup: Use LISTBASE_FOREACH macro in windowmanager intern
Also decrease the scope of variables related to the loops.
2020-12-04 13:50:53 -06:00
3daf28388b Cleanup: Move Outliner runtime hash into internal runtime struct, out of DNA
This way Outliner internal data stays internal, non-Outliner code will not be
able to access and mess with this. Further it allows us to use the real type
(rather than `void *`), change the type to a C++ container if needed and
slightly reduces the size for every Outliner stored in files.

Slightly changed how we set the `SO_TREESTORE_REBUILD` for this, but it should
effectively behave the same way as before.
2020-12-04 20:00:45 +01:00
f5eaf67e34 Atomics: Add 16 bit fetch + AND and fetch + OR signed integer operations
I could use a 16 bit atomic fetch + AND for D9719. The alternative would be to
turn a `short` into a `int` in DNA, which isn't a nice workaround.

Also adds tests for the new functions.
2020-12-04 18:28:46 +01:00
1d2c70d761 Fix API doc generation.
BMesh auto-extracting API info does not support comments inside BMesh
operators parameters definition.
2020-12-04 16:45:10 +01:00
719dfd4088 macOS deps: Support building clang tidy
This patch builds clang-extra-tools on macOS for the
clang-tidy binary. The script "run-clang-tidy.py" is
also harvested because using the `CMAKE_C[XX]_CLANG_TIDY`
option can miss out some files (like makesrna), and using the
script is faster as it does not compile the files.
Thanks to `@LazyDodo` for the base patch D8502.

Reviewed By: LazyDodo, sebbas, #platform_macos
Differential Revision: https://developer.blender.org/D9450
2020-12-04 21:13:15 +05:30
d07009498a Transform: Don't use Automatic Constraint Plane in 2D editors
Technically it shouldn't have any effect on these editors.

The key tips in the header can be misleading.

The effect it previously had was not intended.
2020-12-04 12:31:30 -03:00
b919511607 Cleanup: Deduplicate constraint event code 2020-12-04 12:31:30 -03:00
fe1f05de1b i18n utils CLI: add missing RTL process command. 2020-12-04 15:54:50 +01:00
ca4b809e63 i18n utils: Add first version of the CLI wrapper around i18n tools.
Plan is to use that in new 'buildbot' pipeline to automate generation of
i18n files for Blender.
2020-12-04 15:14:16 +01:00
b3306cf669 i18n utils: Add a helper to list and match po files with languages codes.
This code was previously done in the add-on, but we'll need it for the
CLI tool as well, so now it is a utils generator instead.
2020-12-04 15:14:16 +01:00
06ae2e3a60 i18n utils : Reduce dependency to Blender bpy API, step 2.
Remove some top imports of bpy, only import it in a few specific
functions that only make sense when used whithin Blender anyway.
2020-12-04 15:14:16 +01:00
7bd8b8cdac i18n utils: reduce dependency to Blender bpy API, step 1.
This involves re-implementing some of Blender-defined helpers in utils,
we keep debug code to ensure those are still matching on
behavior/results sides.

This will allow to get more i18n tools independent from blender
executable.
2020-12-04 15:14:16 +01:00
69dd7e42c8 i18n utils: Cleanup. 2020-12-04 15:14:16 +01:00
04d3b54000 Cleanup: Declare variables where initialized 2020-12-04 08:03:14 -06:00
4bb5314754 Cleanup: Use typedef for button string info type
Before, it wasn't clear what the int in `uiStringInfo` was supposed to
store. Using a typedef can make this someone more explicit.
2020-12-04 08:01:54 -06:00
6fda30cc54 Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release
With rBc0677b662f4b, we try to track all modal events in order to detect the
one corresponding to the release.

But modifier keys can mask the modal event and thus confirm realease ends up
being skipped.

This resulted in the T83387.

With this commit we now read the actual key drop value in the modal event.

This fixes T83387
2020-12-04 10:49:58 -03:00
2de49d1ff7 Revert "Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release"
This reverts commit c0677b662f.
2020-12-04 10:49:58 -03:00
c10546f5e9 Cycles: Add support for shader raytracing in OptiX
Support for the AO and bevel shader nodes requires calling "optixTrace" from within the shading
VM, which is only allowed from inlined functions to the raygen program or callables. This patch
therefore converts the shading VM to use direct callables to make it work. To prevent performance
regressions a separate kernel module is compiled and used for this purpose.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9733
2020-12-04 13:04:11 +01:00
7f2d356a67 Cleanup: Clang-Tidy, modernize-use-using
Replace `typedef` with `using` in C++ code.

In the case of `typedef struct SomeName { ... } SomeName;` I removed the
`typedef` altogether, as this is unnecessary in C++. Such cases have been
rewritten to `struct SomeName { ... };`

No functional changes.
2020-12-04 12:46:43 +01:00
10a8286a26 Cleanup: Clang-tidy, actually enable the modernize-use-override rule
Forgot this in rB168909d9741.

No functional changes.
2020-12-04 12:31:49 +01:00
168909d974 Cleanup: Clang-Tidy, modernize-use-override
No functional changes.
2020-12-04 12:02:52 +01:00
1166110a9d Cleanup: clang-format
Rerun `make format`.

No functional changes.
2020-12-04 11:28:56 +01:00
958df2ed1b Cleanup: Clang-Tidy, modernize-deprecated-headers
No functional changes.
2020-12-04 11:28:09 +01:00
f0df46287a Cleanup: replace NULL with nullptr in C++ code
No functional changes.
2020-12-04 10:50:06 +01:00
6ed6741ee3 Point users to new location of "Show Group Colors" option
In ad85256e71 the "Show Group Colors" option was changed from a
per-editor option to a user preference. Since so many people wanted to
turn this option off, this makes sense. However, this move caused some
confusion because the option was just gone from the menu.

This commit adds a dummy menu item. It's disabled, and the tooltip
explains that the option can now be found in Preferences.

T83390 was created to track the removal of these hints.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9735
2020-12-04 10:14:44 +01:00
Jeroen Bakker
76a0b322e4 EEVEE Cryptomatte
Cryptomatte is a standard to efficiently create mattes for compositing. The
renderer outputs the required render passes, which can then be used in the
compositor to create masks for specified objects. Unlike the Material and Object
Index passes, the objects to isolate are selected in compositing, and mattes
will be anti-aliased.

Cryptomatte was already available in Cycles this patch adds it to the EEVEE
render engine. Original specification can be found at
https://raw.githubusercontent.com/Psyop/Cryptomatte/master/specification/IDmattes_poster.pdf

**Accurate mode**

Following Cycles, there are two accuracy modes. The difference between the two
modes is the number of render samples they take into account to create the
render passes. When accurate mode is off the number of levels is used. When
accuracy mode is active, the number of render samples is used.

**Deviation from standard**

Cryptomatte specification is based on a path trace approach where samples and
coverage are calculated at the same time. In EEVEE a sample is an exact match on
top of a prepared depth buffer. Coverage is at that moment always 1. By sampling
multiple times the number of surface hits decides the actual surface coverage
for a matte per pixel.

**Implementation Overview**

When drawing to the cryptomatte GPU buffer the depth of the fragment is matched
to the active depth buffer. The hashes of each cryptomatte layer is written in
the GPU buffer. The exact layout depends on the active cryptomatte layers. The
GPU buffer is downloaded and integrated into an accumulation buffer (stored in
CPU RAM).

The accumulation buffer stores the hashes + weights for a number of levels,
layers per pixel. When a hash already exists the weight will be increased. When
the hash doesn't exists it will be added to the buffer.

After all the samples have been calculated the accumulation buffer is processed.
During this phase the total pixel weights of each layer is mapped to be in a
range between 0 and 1. The hashes are also sorted (highest weight first).

Blender Kernel now has a `BKE_cryptomatte` header that access to common
functions for cryptomatte. This will in the future be used by the API.

* Alpha blended materials aren't supported. Alpha blended materials support in
  render passes needs research how to implement it in a maintainable way for any
  render pass.

This is a list of tasks that needs to be done for the same release that this
patch lands on (Blender 2.92)

* T82571 Add render tests.
* T82572 Documentation.
* T82573 Store hashes + Object names in the render result header.
* T82574 Use threading to increase performance in accumulation and post
  processing.
* T82575 Merge the cycles and EEVEE settings as they are identical.
* T82576 Add RNA to extract the cryptomatte hashes to use in python scripts.

Reviewed By: Clément Foucault

Maniphest Tasks: T81058

Differential Revision: https://developer.blender.org/D9165
2020-12-04 08:46:34 +01:00
Jeroen Bakker
2bae11d5c0 EEVEE: Arbitrary Output Variables
This patch adds support for AOVs in EEVEE. AOV Outputs can be defined in the
render pass tab and used in shader materials. Both Object and World based
shaders are supported. The AOV can be previewed in the viewport using the
renderpass selector in the shading popover.

AOV names that conflict with other AOVs are automatically corrected. AOV
conflicts with render passes get a warning icon. The reason behind this is that
changing render engines/passes can change the conflict, but you might not notice
it. Changing this automatically would also make the materials incorrect, so best
to leave this to the user.

**Implementation**

The patch adds a copies the AOV structures of Cycles into Blender. The goal is
that the Cycles will use Blenders AOV defintions. In the Blender kernel
(`layer.c`) the logic of these structures are implemented.

The GLSL shader of any GPUMaterial can hold multiple outputs (the main output
and the AOV outputs) based on the renderPassUBO the right output is selected.
This selection uses an hash that encodes the AOV structure. The full AOV needed
to be encoded when actually drawing the material pass as the AOV type changes
the behavior of the AOV. This isn't known yet when the GLSL is compiled.

**Future Developments**

* The AOV definitions in the render layer panel isn't shared with Cycles.
  Cycles should be migrated to use the same viewlayer aovs. During a previous
  attempt this failed as the AOV validation in cycles and in Blender have
  implementation differences what made it crash when an aov name was invalid.
  This could be fixed by extending the external render engine API.
* Add support to Cycles to render AOVs in the 3d viewport.
* Use a drop down list for selecting AOVs in the AOV Output node.
* Give user feedback when multiple AOV output nodes with the same AOV name
  exists in the same shader.
* Fix viewing single channel images in the image editor [T83314]
* Reduce viewport render time by only render needed draw passes. [T83316]

Reviewed By: Brecht van Lommel, Clément Foucault

Differential Revision: https://developer.blender.org/D7010
2020-12-04 08:14:07 +01:00
2bd0263fbf Fix T83346: Scrolling doesn't work with mouse over panel header
Just a misplaced assignment to the return value from the panel handler
in rB600fb28b6295.
2020-12-03 23:37:16 -06:00
Yevgeny Makarov
a88e6261db UI: Remove Decorators from Keymap Preferences
Improvements to the layout of the Keymaps section of Preferences by removing unneeded Decorator columns.

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

Reviewed by Hans Goudey
2020-12-03 17:23:13 -08:00
cc6ec71b19 Sculpt: Wet paint area radius
This adds a new property to the sculpt vertex color paint brush to limit
the area of the brush that is going to be used to sample the wet paint
color. This is exactly the same concept as normal radius and area radius
that exist for sculpting brushes for sampling the surface depth and
orientation.

When working near color hard edges, this allows to prevent the color
from the other side of the edge to blend into the wet paint.

With 1.0 (the previous default) wet paint radius, as soon as the brush touches
one vertex of the other color, the wet paint mix color changes, making it
impossible to maintain the border between the two colors.

Reviewed By: sergey, dbystedt, JulienKaspar

Differential Revision: https://developer.blender.org/D9587
2020-12-03 22:55:35 +01:00
9234a6a619 Fix T82872: Add design task link for tilt support
Reviewed By: sergey, Blendify

Maniphest Tasks: T82872

Differential Revision: https://developer.blender.org/D9615
2020-12-03 22:50:02 +01:00
1bc75dfa4a Sculpt: Allow inverting the Erase Displacement mesh filter
When inverting erase displacement the filter can increase the
displacement over the limit surface. After using apply base, this can be
used as an alternative intensify details as it usually gives better
results.

This is the same concept as smoothing inverting to intensify details.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9679
2020-12-03 22:48:12 +01:00
92e44ce67c UI: Add sculpt stats to statusbar
This was missing from D9623. Now the same sculpt scene stats are also
displayed in the status bar.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9700
2020-12-03 22:46:32 +01:00
82e401031f UI: Fix Node Groups color in Geometry Nodes
Node Groups didn't have a category assigned so they looked like inputs (red)
instead of the Node Group theme color (green by default).
2020-12-03 20:21:09 +01:00
f3b08af24c Fix T83352: Move with constraint showing an incorrect value in the header
The displayed value was always that of the x axis.
2020-12-03 15:29:32 -03:00
f637b47064 MSVC: Enable clang-tidy analyser
This enables the use of clang-tidy in the VS IDE.

To use it:

1 - Enable WITH_CLANG_TIDY in your cmake configuration
2 - From the Analyse pull down menu select Run Code Analysis on...

The analyser is currently not enabled by default on build
given it is quite slow and there are quite a few problems
it reports that we still need to deal with.
2020-12-03 11:00:58 -07:00
769818f7f4 GPencil: Reduce UI range for Simplify Adaptive factor
The old range was too big, so now the soft limit is between 0 and 5
2020-12-03 17:42:12 +01:00
c821aa8ca7 GPencil: Fix unreported refresh of stroke after using Arrange operator
When change the order of the stroke using the arrange operator, the arrange was done, but the viewport did not display the result until you refresh the viewport.
2020-12-03 17:18:01 +01:00
986955a2d5 GPencil: Add Vertex Paint operators to Paint menu
These operators existed since 2.83, but the menu was hidden by error.

Also the operators have been cleanup and make multiframe compatible.

Reviewed By: mendio

Differential Revision: https://developer.blender.org/D9671
2020-12-03 16:49:40 +01:00
570a16da18 Fix: remove show_group_colors from graph editor menu
The `show_group_colors` option was moved to the user preferences in
ad85256e71, but accidentally remained in the graph editor menu.
2020-12-03 16:32:58 +01:00
107231eb95 Geometry Nodes: improve support for Color attributes
* Add typed attribute accessors for color attributes.
* Support implicit conversions between colors and floats.
2020-12-03 16:25:48 +01:00
2c181521ec Geometry Nodes: add custom data type getter for attribute accessor
This is just an utility method, that avoids that the caller has to do
the conversion every time it is necessary.
2020-12-03 16:20:09 +01:00
675d84826e Fix T83315: Crash showing animation channel context menu after baking sound
Fix a crash when right-clicking in the Graph Editor animation channel
list. The code for getting selected keyframes was not checking for baked
curves.
2020-12-03 15:28:14 +01:00
a3c4091215 Fix Cycles device kernels containing debug assertation code
NanoVDB includes "assert.h" and makes use of "assert" in several places and since the compile
pipeline for CUDA/OptiX kernels does not define "NDEBUG" for release builds, those debug
checks were always added. This is not intended, so this patch disables "assert" for CUDA/OptiX
by defining "NDEBUG" before including NanoVDB headers.
This also fixes a warning about unknown pragmas in NanoVDB thrown by the CUDA compiler.
2020-12-03 15:20:50 +01:00
5d13082622 Tracking: Improve multithreading of tracking many markers
This change solves a bottleneck which was caused by attempt to cache
postprocessed search areas used for tracking. It was a single cache
used by all threads, which required to have some synchronization
mechanism. This synchronization turned out to be making all threads
to idle while one thread is accessing the cache. The access was not
cheap, so the multi-threading did not provide expected speedup.

Current solution is to remove the cache of search areas. This avoids
any threading synchronization overhead because there is no need for
it anymore. The downside is that for certain configurations tracking
became slower when comparing to master branch. There is no expected
slowdown compared to 2.91 release.

The slowdown is mainly experienced when using big search area and
keyframe matching strategy. Other cases should still be within a
ballpark of performance of single-threaded code prior to this change.
The reason why is it so is because while this change makes it so the
image accessors needs to process images multiple times the complexity
of this process is almost the same as all the overhead for the cache
lookup and maintenance.

Here are Some numbers gained on different configurations.

CPU: Intel Xeom CPU E5-2699 v4
OS: Linux
Footage: Old_Factory MVI_4005.mov from the first part of Track Match
Blend training which can be found on the Blender Cloud.

Tracking 443 markers across 250 frames. The unit is seconds.
File: F9433209

  2.91: 401.520874
before: 358.650055
 after:  14.966302

Tracking single marker across 250 frames. The unit is seconds.
File: F9433211

                         2.91      before     after
        Big keyframe   1.307203   1.005324   1.227300
  Big previous frame   1.144055   0.881139   0.944044
      Small keyframe   0.434015   0.197760   0.224982
Small previous frame   0.463207   0.218058   0.234172
         All at once   2.338268   1.481220   1.518060
2020-12-03 14:51:11 +01:00
Henrik Dick
a6c4e39876 Add Custom Object Space to Constraints
Add Custom Space to the list of space conversions for constraints.

Constraints can use World Space, Local Space, Pose Space, Local with
Parent, and now also Custom Space with a custom object to define the
evaluation space.

The Custom Space option uses the Local Space of an other
object/bone/vertex group. If selected on owner or target it will show a
box for object selection. If an armature is selected, then it will also
show a box for bone selection. If a mesh object is selected it will show
the option for using the local space of a vertex group.

Reviewed By: #animation_rigging, sybren, Severin, angavrilov

Differential Revision: https://developer.blender.org/D7437
2020-12-03 11:20:21 +01:00
899dcc5f60 Fix linker errors when building without Cycles
Fix linker errors by explicitly linking PugiXML when OpenImageIO is
used.

PugiXML has been separated from OpenImageIO (D8628). This means that any
time OpenImageIO libraries are linked, the PugiXML libraries have to be
linked as well. This was set up correctly for Cycles, but not for imbuf.
Because of this, building without Cycles but with OIIO would produce
linker errors.
2020-12-03 11:07:06 +01:00
acaee97c2f Fix accendental copy/paste errors after last commit 2020-12-02 22:26:14 -05:00
fc05e2c0e0 Bmesh: Improve documentation of op parameters
These comments are used to generate Py API docs.
Most of the comments are just copies of the mesh operator counterparts.

More improvements can be made here in the future.

Thanks to Jon Denning on twitter:

https://twitter.com/gfxcoder/status/1334178566993555459
2020-12-02 22:01:00 -05:00
dc4feed59d Cleanup: view-port --> 2D/3D Viewport 2020-12-02 18:16:23 -05:00
cba5137f32 Fix crash in outliner on cursor hover
The previous commit surfaced a bug introduced in rBab4654cdfe8f in which
a boolean wasn't initialized to false.
2020-12-02 09:25:45 -07:00
3fc178b19e Outliner: Highlight icons on cursor hover
The icons for collapsed children already draw highlighted when hovered.
Because the item icons are now select targets (for outliner to properties
editor tab switching) this adds highlights on hover for all outliner
element icons.
2020-12-02 08:58:32 -07:00
3d0c5455ed Cleanup: Store "is_active" instead of pointer property in panel type
This is consistent with the way other panel type fields are stored.
2020-12-02 16:44:40 +01:00
9281a1f4eb UI: Add new node colors for geometry nodes
During the development of the new nodes in the `geometry-nodes` branch
the color of the new nodes wasn't considered, so all of the nodes ended
up red, the color for "input" nodes. This patch introduces two new
colors, one for "Geometry" and one for "Attributes". There are only two
attribute nodes currently, but the next sprint will add two more,
attribute mix, and sample from texture. The attribute nodes are
conceptually different enough from the nodes that modify the geometry
that they deserve their own color.

Differential Revision: https://developer.blender.org/D9682
2020-12-02 16:34:06 +01:00
8522b1b6fb Geometry Nodes: automatically reconnect when swapping inputs
This makes it easier to swap the inputs to the Join Geometry node.
The behavior is the same as in the Math node.
2020-12-02 16:34:06 +01:00
074de755e9 Geometry Nodes: correct modifier name when creating from node editor
The name should be the same as when the modifier is created in the
modifier tab of the properties editor.
2020-12-02 16:34:06 +01:00
58cc8938e1 Fix T83309: Hide metadata when overlays are off.
Inconsistency between overlay popover and implementation. Now the
metadata will not be visible when the overlays are turned off.
2020-12-02 16:19:15 +01:00
60760bd470 Geometry Nodes: unify icons -> use ICON_NODETREE for everything
Until there is a icon made specially for this, the nodetree icon is up
for grabs. Using it in the nodegroup + modifier + editor helps the users
to make a connection on where to edit those modifiers.
2020-12-02 15:38:47 +01:00
ea74ed5a7a Cleanup: remove all of "#ifdef WITH_POINT_CLOUD"
Since Point Cloud was removed from experimental this is no longer needed.
2020-12-02 15:38:47 +01:00
3d3a20d6d1 Cleanup: remove most of "#ifdef WITH_GEOMETRY_NODES"
The ones around the simulation datablock are still there, since they are not
needed for the features planned for master yet.
2020-12-02 15:38:47 +01:00
dc614c68ef Preferences: remove Point Cloud object from experimental
The point cloud object is the only one that will support instancing at
first. So we can expose it as a regular object.

It is limited since it has no edit mode. But this is not different than
the volume object.
2020-12-02 15:38:47 +01:00
56931f63c6 Preferences: remove Geometry Nodes from experimental 2020-12-02 15:38:47 +01:00
b1d1a58c77 Geometry Nodes: improve operators for node editor header
This allows users to create new modifiers directly from the
Geometry Nodes Editor.
2020-12-02 15:38:47 +01:00
600fb28b62 Geometry Nodes: active modifier + geometry nodes editor
This commit adds functions to set and get the object's active
modifier, which is stored as a flag in the ModifierData struct,
similar to constraints. This will be used to set the context in
the node editor. There are no visible changes in this commit.

Similar to how the node editor context works for materials, this commit
makes the node group displayed in the node editor depend on the active
object and its active modifier. To keep the node group from changing,
just pin the node group in the header.

* Shortcuts performed while there is an active modifier will affect
  only that modifier (the exception is the A to expand the modifiers).
* Clicking anywhere on the empty space in a modifier's panel will make it active.

These changes require some refactoring of object modifier code. First
is splitting up the modifier property invoke callback, which now needs
to be able to get the active modifier separately from the hovered
modifier for the different operators.

Second is a change to removing modifiers, where there is now a separate
function to remove a modifier from an object's list, in order to handle
changing the active.

Finally, the panel handler needs a small tweak so that this "click in panel"
event can be handled afterwards.
2020-12-02 15:38:47 +01:00
fc4a853846 Geometry Nodes: support muted nodes
The handling of muted nodes is handled at the derived node tree
level now. This is also where expanding node groups is handled.
Muted nodes are relinked and removed from the derived tree
during construction. The geometry node evaluation code does
not have to know about muted nodes this way.
2020-12-02 15:38:47 +01:00
ae0aa4b94c Geometry Nodes: support geometry components in depsgraph object iterator
Objects can evaluate to a geometry set instead of a single ID (only point cloud
objects for now). In the depsgraph object iterator, the evaluated geometry
components are expanded into temporary objects.

It's important to note that instanced objects can also contain geometry
components. Therefore, they have to be split up into multiple objects
as well in some cases.

At a high level the iterator works like so:

```
for object in depsgraph:
    for component in object:
        yield object_from_component(component)
    for dupli in make_duplis_list(object):
        for component in dupli:
            yield object_from_component(component)
```

DEG_iterator_objects_next has been cleaned up, to make this structure
a bit more apparent.

This should not change anything for objects that are not point clouds.
2020-12-02 15:38:47 +01:00
6be56c13e9 Geometry Nodes: initial scattering and geometry nodes
This is the initial merge from the geometry-nodes branch.
Nodes:
* Attribute Math
* Boolean
* Edge Split
* Float Compare
* Object Info
* Point Distribute
* Point Instance
* Random Attribute
* Random Float
* Subdivision Surface
* Transform
* Triangulate

It includes the initial evaluation of geometry node groups in the Geometry Nodes modifier.

Notes on the Generic attribute access API

The API adds an indirection for attribute access. That has the following benefits:
* Most code does not have to care about how an attribute is stored internally.
  This is mainly necessary, because we have to deal with "legacy" attributes
  such as vertex weights and attributes that are embedded into other structs
  such as vertex positions.
* When reading from an attribute, we generally don't care what domain the
  attribute is stored on. So we want to abstract away the interpolation that
  that adapts attributes from one domain to another domain (this is not
  actually implemented yet).

Other possible improvements for later iterations include:
* Actually implement interpolation between domains.
* Don't use inheritance for the different attribute types. A single class for read
  access and one for write access might be enough, because we know all the ways
  in which attributes are stored internally. We don't want more different internal
  structures in the future. On the contrary, ideally we can consolidate the different
  storage formats in the future to reduce the need for this indirection.
* Remove the need for heap allocations when creating attribute accessors.

It includes commits from:
* Dalai Felinto
* Hans Goudey
* Jacques Lucke
* Léo Depoix
2020-12-02 15:38:47 +01:00
ddbe3274ef BLI: add missing const 2020-12-02 15:38:47 +01:00
d65628466a Functions: add float2 cpp type
This also adds a hash function for `float2`, because `CPPType`
expects that currently.
2020-12-02 15:38:47 +01:00
8268b9827a Theme: update shader node color to match socket color
Reviewed by Brecht

Ref T82689.
2020-12-02 15:38:47 +01:00
96e131f246 UI: update node socket colors
Note: This also changes the Shader socket color, to match "Shading" in the Outliner.

Theme update for shader nodes will be committed separately.

Ref T82689.
2020-12-02 15:38:47 +01:00
69f57550bc Nodes: add geometry socket type
We still have to pick a color for this socket.

Ref T81848.
2020-12-02 15:38:47 +01:00
1d6284a6d5 Functions: add generic pointer class
This class represents a pointer whose type is only known at runtime.
2020-12-02 15:38:47 +01:00
c7f518fe35 Functions: add move operations to CPPType
Those are sometimes needed when dealing with c++ types in a generic way.
2020-12-02 15:38:47 +01:00
85f9d319a4 Fix T83293: crash when selecting bone
This partially reverts rBe922dd7d8a307c54d49bc01649a12610b022192b.
The issues fixed by that commit is still fixed.

Reviewers: fclem
2020-12-02 15:33:51 +01:00
13c3ad7e76 GPU: Show Limited support message for polaris + 20.11.2 drivers.
See T82856 for details.
2020-12-02 15:30:00 +01:00
f8d1378b84 Deps: Additional changes for PugiXML on macOS
This commit expands the Windows-specific code in rBdca9aa0053f7 and Linux-specific code in rB33b7d53df08a.

It also fixes a capitalization issue in FindPugiXML.cmake
2020-12-02 15:18:05 +01:00
d40f5d41af GPU: Blacklist unsupported GPUs that crash during startup.
Since Blender 2.91 the TeraScale 2 based cards crash during startup.
This patch will show the user a screen that the platform they are using
isn't supported.

The GPUs have been carefully handpicked from dozens of reports. T83124,
T83127, T83103, T83091, T83045, T83065, T82750, T82889, T82925, T82640,
T82429, T82436, T82446.
2020-12-02 15:17:13 +01:00
c576d65c2f Fix T83161: Crash when moving ruler endpoints and opening or closing the toolshelf
`invert_snap` could be called before `snap_gizmo->keymap` was found.

Use the lazy initialization in `invert_snap` then.
2020-12-02 10:27:41 -03:00
Henrik Dick
ec39d8de4a Transform: Correct Mirror for Object Mode along arbitrary axis
This fixes T68521, T82334.

The object are not properly mirrored in object mode.

For mirroring an object that has an arbitrary rotation along the X axis
this is the procedure:
1. mirror x location.
2. negate x scale of the
3. negate y and z component of the rotation (independent of which rotation mode is used).

This knowledge applies now for all angles and axes to finally make the
mirror operation work in object mode.

The new mirror function has the downside that it can not (in this form)
be used with proportional editing.

This is no problem since the old behavior can still be replicated by
scaling with -1 along any axis.

The solution to get perfect mirrors can not work for scaling in general,
because in that case there could be scew created.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D9625
2020-12-02 09:22:37 -03:00
da8dc204bd Fix T83119: Crash with topology mirror affecting a hidden vertex
Caused by rBba97da21acf2.

For non-topology mirror hidden verts were never respected/included in
EDBM_verts_mirror_cache_begin (they were excluded from the kdtree).

Prior to said commit, hidden mirrored verts that were still in the map
would have been excluded in a separate loop over vertices in
'editmesh_mirror_data_calc()' by checking BM_ELEM_HIDDEN. Due to the new
nature of this function this check was now moved to
EDBM_verts_mirror_cache_begin.

Maniphest Tasks: T83119

Differential Revision: https://developer.blender.org/D9673
2020-12-02 12:35:51 +01:00
Christian Friedrich
e4204a3979 Add Custom Falloff Curve to the Vertex Weight Proximity Modifier.
The Vertex Weight Edit Modifier already got the Custom Curve, there was no
real reason for the proximity not to have it as well.

With some fixes by Bastien Montagne (@mont29).

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9594
2020-12-02 11:20:03 +01:00
84451f89f5 Fix T83300: constant scene refreshing in Cycles with empty volumes
This infinite loop is caused by a conflict between the volume mesh
creation which unintentionally clears the shaders before early exiting
when no grid is found, and the Blender exporter which adds back the
shaders causing us to reupdate as the shaders changed.

To fix this simply preserve the shaders on the Volume node.
2020-12-02 11:18:45 +01:00
67353ae630 Fix build error on builds without audaspace
This was caused by incorrect argument type in dummy function
`rna_Sequences_new_sound()`

Caused by 13ca11ac52
2020-12-02 10:13:45 +01:00
2afc508eb4 Fix T83090: Multiple warnings accessing brush enum data.
We already have generic enums for empty and default 'none' value.
2020-12-02 09:29:37 +01:00
da22ec1254 Cleanup: Fix CMake syntax error in the last commit. 2020-12-02 13:55:52 +05:30
6535135ef7 CMake/macOS: consider MinSizeRel too for ASan. 2020-12-02 13:23:25 +05:30
a715839a55 Cleanup: add commits to .git-blame-ignore-revs. 2020-12-02 13:20:43 +05:30
13ca11ac52 VSE: Unify sequences collections API
Use RNA_api_sequences() for SequenceEditor and MetaSequence
sequences member.

Defines pair of dispatch functions rna_Sequences_editing_* and
rna_Sequences_meta_* that pass pointer to seqbase to
rna_Sequences_* function.

Downside of this implementation is, that it defines 2 seemingly
different RNA collections - SequencesMeta and SequencesTopLevel

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9601
2020-12-02 05:51:22 +01:00
1176591574 Codesign: Allo non-zero exit code for signtool on Windows 2020-12-01 17:16:48 +01:00
33b7d53df0 Deps: Add PugiXML as an official dependency
PugiXML was historically shipped hidden embedded into OIIO, the Grease
Pencil team had a requirement for an XML library recently so pugi seems
like a natural choice since it's not really a 'new' library, we just
turn an implicit dependency into an explicit one.

This commit expands the Windows-specific code in rBdca9aa0053f7 to
include Linux. macOS support will be handled in a later commit.

NOTE: run `cmake -U'*PUGIXML*' .` in the build directory to ensure CMake
finds PugiXML in the new location.

For details see D8628
2020-12-01 16:25:51 +01:00
29401d38d1 Tracking: Refactor autotrack tracking implementation
The idea is to avoid any synchronization needed in the worker threads
and make them to operate on a local data. From implementation detail
this is achieved by keeping track of "wavefront" of markers which are
to be tracked and the tracking result. Insertion of results to the
AutoTrack context happens from main thread, which avoids need in the
lock when accessing AutoTrack.

This change makes tracking of many (300+) about 10% faster on the
Xeon) CPU E5-2699 v4. More speedup will be gained by minimizing
threading overhead in the frame cache.

Another important aspect of this change is that it fixes non-thread
safe access which was often causing crashes. Quite surprising the
crash was never reported.
2020-12-01 15:24:34 +01:00
4c92fb6715 Libmv: Tweak default logging verbosity level
Log to verbosity level 1 rather than INFO severity.

Avoids a lot of overhead coming from construction of the INFO stream
and improves performance and threadability of code which uses logging.

This makes tracking of 250 frames of a track of default settings to
drop down from 0.6sec to 0.4sec.
2020-12-01 14:55:22 +01:00
c21265b29e Libmv: Cleanup, remove unused logging macros
Unused and was not entirely happy with such short abbreviations.
2020-12-01 14:46:35 +01:00
01b94c5d8a Cleanup: De-duplicate object mullptr checks
Makes it more clear whether object is allowed or not allowed to be NULL.
Also, avoids possible access to the different object mode enumerator.

Should be no functional changes.
2020-12-01 10:45:02 +01:00
edf1095176 Fix T83275: Crash with scene statics and empty scene
ob can be NULL, so it needs to be checked before accessing ob->mode

Differential Revision: https://developer.blender.org/D9680
2020-12-01 10:27:51 +01:00
645c2bd4d0 Fix sculpt transform incorrently flipping displacement in Y and Z axis
These functions were only checking the X axis for flipping the
displacement for a symmetry area depending on the initial position of
the pivot.
This affects transform and any other tools that transform vertices and
applies symmetry based on areas (the pose brush, for example).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9654
2020-11-30 23:40:06 +01:00
ea064133e5 UI: Add Sculpt Session info to stats
This adds the vertex and face count info to the scene stats in sculpt
mode. These stats count the active vertices and faces in the
sculptsession for the active object. This has the following advantages:
- It is possible to know how many vertices the sculptsession has active
comparted to the vertex count of the entire scene from sculpt mode
- When sculpting with constructive modifiers, these stats will report the
number of vertices that you can actually sculpt with, instead of the
vertex count of the modified mesh and the entire scene.

Reviewed By: sergey, dbystedt

Differential Revision: https://developer.blender.org/D9623
2020-11-30 23:35:39 +01:00
6b12dad190 Cleanup: Use LISTBASE_FOREACH for node tree sockets RNA code 2020-11-30 16:39:07 -05:00
007a0e43a0 Cleanup: Reduce variable scope in node drawing code
Also use LISTBASE_FOREACH in a few places and generally clean up
the code for the two sidebar panels "Sockets" and "Interface".
2020-11-30 13:56:46 -05:00
5a35e56bcb Cleanup: Remove unecessary code.
We already `memset` the whole mesh runtime to zero, no need to set some
of its pointer explicitly to NULL afterward.
2020-11-30 19:47:42 +01:00
814b2787ca Fix T83196: bad matrix to quaternion precision near 180 degrees rotation.
Adjust the threshold for switching from the base case to trace > 0,
based on very similar example code from www.euclideanspace.com to
avoid float precision issues when trace is close to -1.

Also, remove conversions to and from double, because using double
here doesn't really have benefit, especially with the new threshold.

Finally, add quaternion-matrix-quaternion round trip tests with
full coverage for all 4 branches.

Differential Revision: https://developer.blender.org/D9675
2020-11-30 21:46:45 +03:00
6022103264 Cleanup: Clang tidy void argument 2020-11-30 13:44:58 -05:00
c0677b662f Fix T83177: Industry Compatible keymap: MMB-dragging to transform engages axis-constraining on release
Release confirm did not consider modal keymap events.
2020-11-30 14:50:35 -03:00
3bdc42f97a Fix T82996: Library Overrides: Duplicate of overridden collection on Resync
Properly use given reference pointer in
`lib_override_library_create_post_process` when it is a Collection one
too.
2020-11-30 17:19:27 +01:00
a7cf6ad547 Fix (unreported) broken logic in BKE_collection_add_from_collection.
That function was adding given new collection to all ancestors of the
reference one, instead of only to its immediate parents.
2020-11-30 17:19:27 +01:00
c760ab0dda Cleanup: Graph Editor, refactor selection operators
Extract initialisation code of box selection into separate functions.

No functional changes.

Reviewed By: zeddb, sybren

Differential Revision: https://developer.blender.org/D9196
2020-11-30 17:14:55 +01:00
8c74c35ecb Fix T81628: Moving Python-made channels freezes Blender
Fix various problems in the Action Group rearranging code. All fixes are
necessary to resolve the bug.

- Before groups are rearranged, the channels are moved into their
  respective groups (so no longer referenced by `action->channels`). A
  temporary group is made for ungrouped channels. The code made
  assumptions about the channels being in the same order as the groups;
  that assumption has been removed.
- Looping over channels in an Action Group should stop when reaching the
  last channel, and not until `NULL`.
- After all the reshuffling is done, the `action->channels` linked list
  wasn't terminated properly. Now `first.prev` and `last.next` are set
  to `NULL` to avoid infinite loops.
2020-11-30 16:30:44 +01:00
ed9b70393c Cleanup: Animation, clean up action group rearranging code
Some minor cleanups to make an upcoming bugfix easier.

No functional changes.
2020-11-30 16:30:44 +01:00
0f30edc20c Tracking: Make image accessor own what it needs
Previously image accessor was sharing array pointer for tracks access.
Now it is possible to pass a temporary array valid only during the
initialization process.

Should be no functional changes.
2020-11-30 16:24:11 +01:00
13ce25d24c Tracking: Clarify tracks and options storage once again
This is something not-so-trivial to see from just reading code, which
shown an important of proper comments and clear naming.

Main source of confusion was that it is not immediately clear that
AutoTrack context is to see all tracks, but tracking to only operate on
selected ones.
2020-11-30 16:24:11 +01:00
83c872085d Windows/Ninja: allow parameters for rebuild.cmd
The windows build leaves a convenience helper script
in the build folder called, rebuild.cmd. This change
passes any parameters you give rebuild.cmd to ninja
so you can easily pass it additional parameters without
having to edit the batch file manually.
2020-11-30 08:22:50 -07:00
9081b80d15 GPencil: New operator to reset Vertex Colors
This operators reset the vertex color information of the strokes.

If nothing is selected, all strokes are reset. If any is selected, only selected strokes are reset.

Also added a new menu Paint in Vertex Color mode.

Differential Revision: https://developer.blender.org/D9647
2020-11-30 15:52:44 +01:00
f280300b6a Tracking: Cleanup, remove unused argument from image accessor 2020-11-30 15:50:21 +01:00
ba3bf822a1 Tracking: Cleanup, remove unused field
Was re-introduced after previous round of cleanups when was merging
refactor and master branches.
2020-11-30 15:44:42 +01:00
ecfacb7706 Tracking: Cleanup, use explicit frame match option
No functional changes, just allows to potentially extend the options
in the future, and also makes code more explicit.
2020-11-30 15:03:31 +01:00
c949062c6e Tracking: Cleanup pattern match DNA definition
Wrong comment was used for enumerator.

Also made it a real typed enumerator to ease use in the implementation
code.

Should be no functional changes.
2020-11-30 14:58:12 +01:00
f61ad0e101 Fix T83203 BGL: shader.program wrongly always returns 0
This was a leftover from the 2.91 GPU module refactor.

This is an exception that should be removed when we remove BGL.
2020-11-30 14:55:46 +01:00
6fba2726c7 Tracking: Cleanup, finish pass of comments in the context
Some fields are still not really documented, but they are subject of
refactor/fix which will happen shortly.
2020-11-30 14:48:48 +01:00
2f08906c47 Tracking: Cleanup, replace clip user with frame number
Makes it more clear from intent and usage point of view.
The user was not used for anything else than frame number.
2020-11-30 14:44:51 +01:00
9d3b6f75a1 Tracking: Cleanup, more clear variable naming
A no-functional-followup of the previous commit.
2020-11-30 14:40:00 +01:00
d61a6a8cc3 Tracking: Fix missing frame remap for plane tracks
Tracking track which is used for plane track and movie clip having
a scene frame offset would have trigger re-calculation from a wrong
frame.
2020-11-30 14:36:03 +01:00
88289d8f84 Tracking: Cleanup, clear variable names and indentation
Should be no functional changes.
2020-11-30 14:25:42 +01:00
8dac88b54a Tracking: Cleanup, unused field in autotrack context
Was only assigned to truth, always. Never read back.
2020-11-30 14:13:34 +01:00
Yevgeny Makarov
9306e01b10 Fix T82870: on macOS, continuous grab jumps when crossing editor border
The event queue can contain events from before pointer warping, ignore those
now. This is an old issue, but became more common now that we disabled event
coalescing and started using the event mouse location rather than the current
mouse location.

Thanks to Yevgeny Makarov and Nicholas Rishel for helping solve this.

Ref D9662
2020-11-30 13:41:38 +01:00
2a430a670c Tests: blacklist failing tests for Cycles CUDA and OptiX devices
Blacklist a bunch of tests on the GPU, which are known to currently have
differences with CPU. These can be enabled as they are fixed or the test
is modified to give compatible results when there are known limitations.

OSL tests were also moved to their own directory since those are not
supported on the GPU.

Ref T82193
2020-11-30 13:40:33 +01:00
dd391d38f6 Tests: add CMake option to run Cycles regression tests on GPU devices
CYCLES_TEST_DEVICES is a list of devices (CPU, CUDA, OPTIX, OPENCL). It is set
to CPU only by default.

Test output is now writen to build/tests/cycles/<device>, and the HTML report
has separate report pages for the different devices, with option to compare
between CPU and GPU renders.

Various GPU tests are still failing due to CPU/GPU differences, these are to be
fixed or blacklisted still.

Ref T82193
2020-11-30 13:40:33 +01:00
c986e46be7 Cleanup: avoid harmless but unnecessary float division by zero 2020-11-30 13:40:33 +01:00
057c15b549 Libmv: Add threading primitives
Allows to use mutex, scoped_lock, and conditional_variable from within
the libmv namespace.

Implementation is coming from C++11. Other configurations are easy to
implement, but currently C++11 is the way to go.
2020-11-30 12:12:39 +01:00
0f0c982ff4 Libmv: Add build configuration header
Allows to easily access build platform information, such as bitness,
compiler, supported C++ version and so on.
2020-11-30 12:12:39 +01:00
d3dd61aab3 Libmv: add missing files to bundler
Bundler wouldn't be able to pull changes form upstream until all the
changes are upstreamed, but is better to have information consistent.
2020-11-30 12:12:39 +01:00
Monique Dewanchand
c751d40e07 Cleanup hardcoded render percentage to factor conversion
During revision of {D8952} one of the comments was to make a function that converts the render percentage to a factor. This to avoid code duplication. However the duplicated code was already all over the compositor code. So in order to avoid this code duplication for {D8952} I propose to first cleanup the duplicated code and build patch {D8952} based on this clean up.

The method that converts the render percentage to a factor is put in the CompositorContext. Why? The CompositorContext keeps DNA information like the renderdata. DNA, and thus the CompositorContext, keeps the size of the render resolution in percentage (user oriented). The compositor needs the size of the render resolution as a factor. So the CompositorContext seems like the obvious place to have this conversion method.

Why not in de NodeBase? The method could've been added to the nodebase, but I wanted to keep the nodebase as clean as possible and not put simple "conversion" methods into this base class. Also I didn't really like the call flow: you'd always have to get the renderdata size from the context and then convert.
Putting it in the CompositorContext avoids this extra invoke of a call.

Why not in the Converter? See nodebase. And the Converter seems more like a class for "structural" and complex node tree conversions. Not the simple conversions.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D9566
2020-11-30 08:00:40 +01:00
f38cd7e188 RNA Manual Reference: Update 2020-11-29 22:01:23 -05:00
dc40bea003 Cleanup: Use LISTBASE_FOREACH macro in screen.c
This commit replaces while loops and for loops with the equivalent
macro. This results in much more readable code in some places,
and it's now more apparent when the situation is more complicated
than just iterating through a linked list.
2020-11-29 20:30:11 -05:00
748f468fdc Cleanup: Use "region" for ARegion variable names
As proposed in T74432 and already implemented in several commits,
"region" is the preferred name for `ARegion` variables, rather than
any variant of "ar". This commit changes a few "ar" variables that have
popped up over time and also adjusted names of variants like "arnew".
2020-11-29 18:10:47 -05:00
dca9aa0053 Deps: PugiXML 1.10
This separates out PugiXML that was previously
bundled by OIIO.

As this linux/mac libs are not available
this commit only contains the builder and windows
changes, and the option to enable pugixml is
guarded by a platform if, this can be removed
once all platforms have committed the svn libs.

For details see D8628
2020-11-29 14:01:33 -07:00
176324aa5c QuadriFlow: Fix std::allocator deprecation warnings
https://en.cppreference.com/w/cpp/memory/allocator/construct
"(deprecated in C++17) (removed in C++20)"
Same for `destroy`.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D9657
2020-11-30 00:46:27 +05:30
11f0169e88 Run clang-format to fix line length after D8915. 2020-11-29 17:26:33 +03:00
Rebecca Dengate
13c820d87b CMake/macOS: Use custom LIBDIR if set on CLI
Reviewed By: ankitm
Maniphest Tasks: T83174
Differential Revision: https://developer.blender.org/D9664
2020-11-29 13:34:33 +05:30
458d8a423a Speed up finding patch components in new boolean.
By checking if a cell has already been processed in the finding patch
component code, an enormous speedup happens. This only will be
noticeable if there are lots of patches, and some cells with a
large number of patches.
2020-11-28 14:27:10 -05:00
1169507308 Speedups for finding cells in new boolean.
In case where there are coplanar instersections where
each part has a lot of triangles, the finding-cells algorithm was
very inefficient. This uses a Set instead of a Vector to keep track
of a cell's patches, avoids going through all patch x patch combinations,
avoids going through all patches to renumber after a merge, and
merges smaller patch-sixe cells into larger ones.
All this reduces the time to find cells in the cited case by a factor of 10.
2020-11-28 13:26:52 -05:00
566e7e6145 Fix Auto Clamped limits when smoothing the transition of cyclic curves.
The value of l[count-1] should be ready by the time hmin/hmax is computed.
Otherwise the left limit for the transition key would be scaled wrong.
2020-11-28 15:54:18 +03:00
c99d767735 Fix some naming and comments in F-Curve smoothing code. 2020-11-28 15:54:18 +03:00
b3f20eed6e Fix T83023: incorrect shape of cyclic F-Curve with only two points.
The equation solver didn't handle the one unknown case correctly.
2020-11-28 15:54:17 +03:00
f8553de2cd GPencil: Fix unreported vertex size for Bezier handles
By error, the Bezier points were using the mesh vertex size, not the grease pencil vertex size.
2020-11-28 11:10:35 +01:00
fbdf1af355 Fix T82758: Convert Proxy to Override: Local constraints aren't saved.
Ensure consistent order of pose bones. Now it should always match the
one from bones in armature obdata (as exposed by e.g. RNA, i.e.
children-first).

Previously when some pose bones would need to be added or removed from a
pose due to changes in the bone armature, or if bones in armature were
re-ordered, the bones order in pose would not match anymore the one from
armature, and could even become different between e.g. a proxy and its
linked source.

This was not really nice, but not a big issue before either. But with
diffing process of override, consistent order of items between reference
linked collection and local override one is crucial.

Reviewed By: #animation_rigging, sybren

Maniphest Tasks: T82758

Differential Revision: https://developer.blender.org/D9646
2020-11-27 16:18:59 +01:00
e4e7dfc1d8 Fix transform snap mixed with incremental
The incremental was taking priority but the other elements are mandatory.
2020-11-27 10:51:33 -03:00
f9e994d0f4 Fix T83092: Direction of rotation with View orientation changed in 2.91
The change was intentional so that the orientation matrices match
(`rv3d->viewinv` becomes equal to the orientation matrix).

But, although in a projection matrix the Z axis is negative, this
should not be so from the user's point of view.

So the solution here is to negate the Z axis when the View orientation
is chosen.

This affects all modes, but is only evident for rotation.

---
Another change here is to use the final rotation value (`values_final`)
for the gizmo drawing since this value can be changed by the mode.
2020-11-27 10:41:33 -03:00
24e57eea43 Fix T82156: Object with constraints translates when parented
Avoid the evaluation of constraints when computing the parent-inverse
matrix.

Constraints are meant to be evaluated last; object transforms are
computed this order:

1. `parent->obmat` (the parent object's world matrix)
2. `ob->parentinv` (the object's parent-inverse matrix)
3. Object's loc/rot/scale
4. Object's constraint evaluation

When the constraints are used to compute the parent-inverse matrix,
their effect is moved from step 4 to step 2 in this list, potentially
rotating or scaling the object's local transform. This causes unwanted
movement as reported in T82156.

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9413
2020-11-27 12:11:43 +01:00
e4b6afbe6b Cleanup: Animation, clean up FCurve Cycles modifier
Simplify conditions and declare variables `const` where possible.

No functional changes.
2020-11-27 10:15:20 +01:00
45dca05b1c Cleanup: Add r_ to return parameter
Prefix a return parameter with `r_` to follow the style guide. No
functional changes.
2020-11-26 20:37:54 -07:00
ab4654cdfe Cleanup: Move logic to outliner_find_item_at_x_in_row
Move the logic for determining if the item at a given x position is an
icon into the function. This is used for determining selection over an
icon, and will be used in a later commit for checking for hover over an
icon. No functional changes.
2020-11-26 20:37:21 -07:00
1709bc5164 Add performance timing to mesh_boolean.cc.
You can uncomment the PERFDEBUG define to get timings.
2020-11-26 18:29:11 -05:00
64b58888fb Sculpt: Refactor transform code to allow incremental updates
This adds support for incremental updates in the sculpt transform
code. Now tools can define if they need the displacement applied
for the original coordinates or incrementally.

This is needed for features like elastic transform or cloth deformation
target in the transform tool.

No functional changes.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9547
2020-11-27 00:18:41 +01:00
26eb8d6aa0 UI: Use decorators in volume modifiers
This is consistent with the UI for other modifier types.
2020-11-26 12:56:12 -05:00
226b028523 GPencil: Cleanup - Remove unused old shaders
These fill shaders were used with the old draw engine.
2020-11-26 17:44:43 +01:00
9add12ff05 Transform: Improve event detection for AutoConstrain
The event "value" is not really required since this operation works as a toogle.

This change cleans and simplifies the code.
2020-11-26 13:42:56 -03:00
dd0e2da00e Cleanup unintentional change in rB8a2270efc52a
Note that the whole thing need to be redone/properly fixed, but this is
a bit more complicated so for now fix in  rB8a2270efc52a is 'good
enough'.
2020-11-26 17:30:20 +01:00
841ae18605 Fix T83055: setting rna pointer properties can create bogus custom properties
This was reported in the form of the eyedropper of the 'Parent' property
creating a custom property 'parent' if self was picked.

Problem arises when certain checks for setting rna pointer properties
failed (for example: the PROP_ID_SELF_CHECK check) and then a different
code path was entered (which was only meant for IDProperties).

Problem was introduced in rBa7b3047cefcb.

To solve, now first enter the branch for rna-based pointer properties,
then perform the sanity-checks (and if these fail: dont enter the other
unrelated codepath but instead do nothing)

Maniphest Tasks: T83055

Differential Revision: https://developer.blender.org/D9652
2020-11-26 17:18:48 +01:00
4b248c1658 Fix T82729: Crash in rna_EffectorWeight_path when object has fluid and
dynamic paint modifiers

Looks like prior to the introduction of mantaflow, the former
SmokeModifierData always had a domain initialized (even if its type was
set to None). Since mataflow, the FluidModifierData type needs to be set
to MOD_FLUID_TYPE_DOMAIN (otherwise domain is invalid)

Maniphest Tasks: T82729

Differential Revision: https://developer.blender.org/D9644
2020-11-26 16:57:02 +01:00
87030d8be5 Fix T83046: Material change not updating in the link of an override.
Code was actually not applying any override operation over linked data.

Reasonn behind that was that if library file is saved with latest
override applied then this is not needed, since data saved for the
override in the lib file is already up to date.

But this is actually fully breaking in case someone update the lib file
of the lib file, without re-saving the libfile itself.

So now we alwaya apply overrides also on linked data.

Note that this will not fix the case where a resync is needed.
2020-11-26 16:43:31 +01:00
4705fafa7e UI: Fix incorrect offset for panel label when zooming in
The panel title text intersected any buttons in the header because
the label offset retrieved from the layout code was not scaled by
the block's zoom level. Error in rB0d93bd8d63980.
2020-11-26 10:29:03 -05:00
44f5d99cbf Fix T83020: Transform: AutoConstraint being confirmed without releasing the MMB
The transform modifiers are confirmed by releasing any button.

Thus, the operation can be falsely confirmed if the button that launched
the operation is released after the modifier has been activated.

Previously the events that confirmed the modifiers were hardcoded.

An option to fix this would be to add custom confirmation keyitens for
specific modifiers. But this can be a bit confusing and would make the
modal keymap even bigger.

So the solution here is to skip the button that launched the operation
when confirming the modifier.
2020-11-26 11:42:28 -03:00
Joseph Brandenburg
849debe36c Fix T80970: Copy Rotation constraint incorrect under shear
Orthogonalize the constraint target's matrix before decomposing it into
Euler angles. This removes sheer, and is actually a requirement for
correct decomposition.

It's conceivable that someone has used the incorrect behaviour in a rig.
As the shear caused unpredictable flipping of the constrained object,
this is unlikely.

Reviewed By: angavrilov, sybren

Differential Revision: https://developer.blender.org/D8915
2020-11-26 13:12:13 +01:00
781429a8b0 Cleanup: clearer marking of what was changed in GTestAddTests.cmake
Replace `Blender` with `BLENDER` so that it's more clearly a marker, and
not just the name.

No functional changes.
2020-11-26 13:05:46 +01:00
Stefan Werner
0062b34e94 macOS: Patch OpenImageIO's ustring for ARM.
OpenImageIO's ustring makes assumptions about the interals of
std::string which aren't true on macOS/ARM. A patch for OpenImageIO
addresses this for macOS/ARM builds only, at the expense of potentially
duplicated allocations of strings.
2020-11-26 12:22:56 +01:00
Stefan Werner
05f410dd84 macOS: Added new location for Homebrew.
The build script for macOS dependencies expects to find bison provided
by Homebrew under /usr/local. Since the default install location for
Homebrew changes on macOS/ARM, the script now looks at the host
architecture and switches to /opt/homebrew on Macs with Apple Silicon.
2020-11-26 11:30:53 +01:00
8a2270efc5 Fix T81265: Animation is not evaluated when collection is included into view layer.
Just tag objects in un-excluded viewlayer for animation update.
2020-11-26 11:08:51 +01:00
774d18804f Fix T82452: Outliner: Cyclic "Original ID" panel in Data API.
I cannot think of any case where we'd want to show this pointer in UI
anyway, so just tag it with `PROP_HIDDEN`.
2020-11-26 10:46:35 +01:00
e09d0c0d07 Fluid: Updated Mantaflow source files
This update introduces two improvements from the Mantaflow repository:

(1) Improved particle sampling:
- Liquid and secondary particles are sampled more predictably. With all parameters being equal, baked particles will be computed at the exact same position during every bake.
- Before, this was not guaranteed.

(2) Sparse grid caching:
- While saving grid data to disk, grids will from now on be saved in a sparse structure whenever possible (e.g. density, flame but not levelsets).
- With the sparse optimization grid cells with a value under the 'Empty Space' value (already present in domain settings) will not be cached.
- The main benefits of this optimization are: Smaller cache sizes and faster playback of simulation data in the viewport.
- This optimization works 'out-of-the-box'. There is no option in the UI to enable it.
- For now, only smoke simulation grids will take advantage of this optimization.
2020-11-25 23:18:12 +01:00
Erik Abrahamsson
f7223d5f72 UI: Allow theming the alternate row color in the sequencer
Previously, the alternate row color in the Video Sequence Editor was
just a shaded version of the editor's background color. This makes it
theme-able just like in the file browser and outliner, although the
default color is very slightly different.

Differential Revision: https://developer.blender.org/D9634
2020-11-25 16:37:33 -05:00
05c4efc9b1 Fix Edit Face Set operator not being cancelled when the cursor is not over the mesh
If the cursor is not over the mesh, the operator was still using the
last Face Set ID updated by the drawing cursor code when the cursor was
over the mesh.

This now cancels the operator instead of modifying a Face Set that will
look random to the user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9545
2020-11-25 22:22:12 +01:00
8b9b3d98e0 Rename use paint symmetry to use mesh symmetry in quadriflow
The original name was chosen because symmetry was a property of
the Paint struct. Now symmetry is a property of meshes, which
also makes the name of the property easier to understand.

Reviewed By: sergey, dbystedt

Differential Revision: https://developer.blender.org/D9618
2020-11-25 22:21:02 +01:00
41a73909de Cleanup: Typo in print_default_info function name. 2020-11-25 20:45:47 +01:00
02a0f6b04a Fluid Particles: fix viscoelastic spring threading crash again after D7394.
Since D6133 fluid particle code uses thread local storage to collect
springs created during a time step before adding them to the actual
spring array.

Prior to the switch to TBB there was a single finalize callback which
was called on the main thread, so it could use psys_sph_flush_springs
and insert the new entries into the final buffer. However in D7394 it
was replaced with a reduce callback, which is supposed to be thread
safe and have no side effects. This means that the only thing it can
safely do is copy entries to the other temporary buffer.

In addition, careful checking reveals that the 'classical' solver
doesn't actually add springs, so reduce isn't needed there.

Differential Revision: https://developer.blender.org/D9632
2020-11-25 22:31:47 +03:00
8330e19cb2 RNA Armature: Improve the description of AxisRollFromMatrix
The roll value may not be as expected when a matrix is not orthogonal
or has a negative determinant.

This can lead to confusion as seen in T82930.

Therefore, make it clear that this is a limitation and that a value for
the roll is somewhat indeterminable in these cases.

This fixes T82930
2020-11-25 13:55:05 -03:00
f67f895770 GPencil: Disable vertex color when use holdout
If the material has the holdout enabled, the value of the vertex color must not be used.
2020-11-25 16:01:30 +01:00
436fd5663e Fix T82988: Div by zero with curve deform modifier
In `calc_curve_deform` a factor is calculated without checking if
the divisior is zero or close to zero. This patch adds the missing
checks and sets the factor to zero if the division shouldn't be
computed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9645
2020-11-25 15:18:18 +01:00
4a179e8e3e Atomics: Fix missing 64bit implementation for 32bit platforms
Blender uses 64bit atomics to manipulate SessionUUID, and these atomics
were not defined on any of 32bit platforms.

While official support is limited to 64bit platforms only, the code
should not make assumptions about bitness or endianess, in terms that
there should be codepaths and fallback (or provision of them) for 32bit
platforms.

This change makes 64bit atomic functions defined for all platforms.
The atomic_test was compiled and successfully tested on i686 and armv7l
platforms. The rest of compilation process of Blender will be very
tedious, so that was not done.

This change is essential, but not necessarily enough to make Blender
compilable on i686 (ability to compile Blender on 32bit platforms was
lost during the 2.91 development).

This is a functional part of original fix done by Brecht in D9577.
2020-11-25 12:43:43 +01:00
4323886123 Atomics: Cleanup, move defines closer to usage
There is a special defines block needed for ARM on Linux. Move it from
public header to an implementation file.

No functional changes.

This is a non-functional part of original fix done by Brecht in D9577.
2020-11-25 12:43:43 +01:00
1c86d32fa7 Nodes: deduplicate ping pong math operation
The formula did not change. The only side effect of this change should be
that the compositor node now does not divide by zero in some cases.
2020-11-25 12:24:44 +01:00
9e77fc533c Cleanup: remove useless cast. 2020-11-25 11:19:28 +01:00
b1533f8fa4 Tracking: Cleanup, de-duplicate implementation of marker lookup
The logic was duplicated.

Should be no functional changes. The modified function is expected
to give same exact results for all inputs.

On the "caching last-used track" topic. The code was using last_marker
to allow faster lookup of marker closest to the frame. With this
change it is still the case since the BKE_tracking_marker_get() does
cache last used marker.
2020-11-25 09:37:24 +01:00
e922dd7d8a Viewport: cannot select object by clicking on its instances
Selecting an object by clicking on its instances only worked,
when the object itself is visible. However, it is possible to hide
the object and still keep the instances visible.

The solution is to give every object the correct `select_id` in the
depsgraph object iterator right before rendering.

Reviewers: fclem, brecht

Differential Revision: https://developer.blender.org/D9640
2020-11-24 17:32:56 +01:00
256a9d983d Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-24 16:05:58 +01:00
278011e44d Fix T80748: Render Emissive Colors in Compositor Backdrop
This change will use the image engine to draw the backdrop of the compositor. With this patch the alpha blending will be done in Linear Scene Reference space and shows pure emissive colors.

See differential for an example image.

**Technical changes**

As only the backdrop drawing is done using the draw manager there are some technical changes.
1. The overlay buffer is partly drawn outside the draw manager. When drawing the backdrop image the overlay buffer needs to be masked to simulate premultiplied alpha under.
2. The backdrop of the node editor is done in region pixel space. A `DRWView` is constructed with this space.
3. UDIM textures uses world position to generate the UV coordinates. This has been implemented more strict by the `IMAGE_DRAW_FLAG_USE_WORLD_POS`. When the flag isn't used the local coordinates are used to generate the UV coordinates what is image space.
4. The draw manager now checks the actual `eSpaceType` of the space data to use different code paths. In the future the movie clip editor will be added.

NOTE: The preview images in nodes are drawn in display space and cannot show pure emissive colors. As preview images are used on more locations it is best to fix this in a separate patch.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9451
2020-11-24 13:22:17 +01:00
82cc21d5e4 Fix T77261: Multires creates spikes when subdividing ngons
The spikes were caused by non-initialized tangent matrix used during
smoothing process. The reason tangent matrix was not initialized was
because wrong usage of API: n-gons should pass corner of 0 to the
matrix construction function.

Corrected usage of the API and added assert() to help catching such
kind of non-initialized issues easier.
2020-11-24 12:40:42 +01:00
31bf8307af Graph Editor: fix keyframe not activating in certain cases
When clicking on an already-selected keyframe, mark it as active if the
click caused the previously-active keyframe to become deselected.

When clicking on a key in the graph editor, it is selected and all other
keys are deselected. If that key was already selected before the click,
it would not become the active keyframe. This is now fixed.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D9639
2020-11-24 12:27:43 +01:00
bb5c4de009 Fix T82962: Crash changing lattice resolution with Vertex Group
Regression introduced by {rB042143440d76}. The deform group lookup was
performed on the wrong object. Before the lookup was performed on
the lattice object. This patch changes this back.

Reviewed By: Bastien Montagne

Differential Revision: https://developer.blender.org/D9638
2020-11-24 11:46:38 +01:00
aca8eadb63 Animation: Remove debug prints
Remove accidentally-commited debug prints.

No functional changes.

Reviewed by: sergey

Differential Revision: https://developer.blender.org/D9637
2020-11-24 11:13:43 +01:00
e74f61b49a Fix Python API docs for the render API
The API doc for free_blender_memory() was used in
get_preview_pixel_size()

Issue introduced in 5494683651.
2020-11-24 10:42:28 +01:00
037ce662e5 Outliner: Switch properties tabs only on icon click
According to feedback the outliner to properties editor tab switching
was annoying when it always changed tabs on selection, especially for
selecting individual objects. This limits the tab switching behavior to
only when the icons in the outliner are selected.
2020-11-23 22:21:02 -07:00
Yevgeny Makarov
d86fcde39c UI: Batch Rename Layout Improvements
Improvements to the layout of the Batch Rename dialog.

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

Reviewed by Reviewed by Hans Goudey
2020-11-23 17:27:01 -08:00
Yevgeny Makarov
df31ecf0c3 UI: Add Trackpad Smooth Scrolling for Popovers
Adds smooth scrolling with the trackpad for popovers. Also fixes the position of the scroll arrows on high-DPI.

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

Reviewed by Brecht Van Lommel
2020-11-23 17:22:20 -08:00
Yevgeny Makarov
b6a50b5dcb UI: Block Safety Not Scaled Correctly
Layout block safety sizes were not scaled correctly with interface scale.

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

Reviewed by Brecht Van Lommel
2020-11-23 16:56:01 -08:00
246c11634f Speedups for new boolean. Better hash function for verts.
The existing hash function didn't work well with Set's method of
masking to the lower bits, because many verts have zeros in the
lower bits.
Also, replaced VectorSet with Set for Vert deduping.
2020-11-23 19:30:40 -05:00
Jeroen Bakker
b0a9081883 Fix T82884: Cycles Compilation Error OpenCL/NanoVDB
Recent changes introduced `acc` parameter into the texture read
functions. When nanovdb isn't enabled this leads to compilation errors
as the `acc` variable wasn't defined. OpenCL only compiles needed
features what made it more prominent.

Reviewed By: Patrick Mours

Differential Revision: https://developer.blender.org/D9629
2020-11-23 16:42:48 +01:00
Jeroen Bakker
8351760ed0 Cycles: Remove Compilation Warning
ROCm 3.9 already defined `NULL`. This patch will first check if it was
already defined to remove compilation warnings.

NOTE: This doesn't add official support for ROCm as it still fails to
render correctly (crashes with default cube).

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D9610
2020-11-23 16:36:15 +01:00
Christoph Lendenfeld
1f09dcc121 Cleanup: Animation, split graph_edit.c into separate files
Split some of the code of `graph_edit.c` into:
* `graph_view.c`: preview range, view all, view selected etc.
* `graph_slider_ops.c`: the decimate modal operator code.

The latter file will be extended later with more slider-based operators.

Maniphest Tasks: T81785

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9312
2020-11-23 15:26:54 +01:00
152754a477 Tracking: Cleanup, typos and spelling in DNA comments 2020-11-23 15:25:55 +01:00
e4ca1fc4ea Animation: New Euler filter implementation
This new discontinuity filter performs actions on the entire Euler
rotation, rather than only on the individual X/Y/Z channels. This makes
it fix a wider range of discontinuities, for example those in T52744.

The filter now runs twice on the selected channels, in this order:
- New: Convert X+Y+Z rotation to matrix, then back to Euler angles.
- Old: Add/remove factors of 360° to minimize jumps.

The messaging is streamlined; it now reports how many channels were
filtered, and only warns (instead of errors) when there was an actual
problem with the selected channels (like selecting three or more
channels, but without X/Y/Z triplet).

A new kernel function `BKE_fcurve_keyframe_move_value_with_handles()` is
introduced, to make it possible to move a keyframe's value and move its
handles at the same time.

Manifest Task: T52744

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9602
2020-11-23 12:48:04 +01:00
1318eaf166 Cleanup: CMake: use string(APPEND..), not set(..)
Left out in {rB7f28a99dd5a57216fb477d844ae1fec5510ad5d5}
2020-11-23 16:34:17 +05:30
36426b0a68 CMake/macOS: Replace -Xlinker with -Wl.
Causes link issues on Xcode's "New Build System" which was introduced
in Xcode 10 and is default on Xcode 12.
https://devtalk.blender.org/t/16273

Differential Revision: https://developer.blender.org/D9624
Reviewed by: brecht, #platform_macos
2020-11-23 16:34:17 +05:30
64513df8b6 Fix T82849: Assert When Unlinking "Edit Source" Text Data-block.
Simplify and sanitize handling of usercounts for Text IDs generated
trhough `BKE_text_load_ex`.
2020-11-23 11:56:40 +01:00
401612b8e1 Tracking: Cover markers access with basic tests
Just a beginning of tests coverage, related on the planned upcoming
development.
2020-11-23 09:23:19 +01:00
1e0ff6b723 Tracking: Cleanup, make units explicit in new track creation 2020-11-23 09:23:19 +01:00
6d314c940e Tracking: Cleanup, clarify comments in tracking settings
Make unit more explicit.

Ideally would be "embedded" into the field name itself, but this will be
more involved change.
2020-11-23 09:23:19 +01:00
2ee5bc33ea Tracking: Refactor, move track allocation to helper function
The caller is still responsible for allocating list of markers,
but the track allocation and initialization can now be reused.

Currently no functional changes, preparing for an upcoming
development.
2020-11-23 09:23:19 +01:00
7bab87c119 Fix T82918: File menu "Save Copy" shows "Save As" in File Browser
Use a dynamic name/description based on the set properties. This makes it more
clear what's going on and avoids confusion, as explained in the report.
2020-11-22 19:21:30 +01:00
4c01fbb564 Cleanup: Use const arguments in curve bevel
This makes it clear that only the final "r_data" is being changed.
Also rename a variable to be less vague.
2020-11-22 12:11:15 -05:00
b11d409ac4 Cleanup: Improve readability of curve displist building
Just a few minor improvements: declare variables where they are
initialized, decrease scope, expand some variable names, and use
LISTBASE_FOREACH.
2020-11-22 11:47:37 -05:00
1cc3a0e2cf Cleanup: Reduce indentation
Having up to nine levels of indentation make this function hard to
follow. Instead of indenting the rest of the loop for a simple special
case, just continue.
2020-11-22 11:25:10 -05:00
0f3ca3f4bc Fix unclear tooltip for the Affect Transform option of constraints. 2020-11-22 13:33:27 +03:00
d25e116889 Previous commit forgot to guard some things with #ifdef WITH_GMP. 2020-11-21 22:44:35 -05:00
df8cc5662b Improve speed of Constrained Delaunay Triangulation with exact arith.
By using floating point filters, the speed improves by a factor of 2 to 10.
This will help speed up some cases of the Exact Boolean modifier.
Changed the interface of mpq2::isect_seg_seg to not return mu, as it was
not needed and not calculating it saved 15% time.
2020-11-21 11:55:14 -05:00
38fe962d95 Merge branch 'blender-v2.91-release' 2020-11-21 14:18:12 +01:00
6c6a5a72c2 GPencil: Fix unreported assert when use select Box in single point strokes
The assert was when use segment selection mode.
2020-11-21 14:17:26 +01:00
0eb096f406 Cleanup: Declare variables where initialized
Reduce variable scope, and in a few cases, use bool instead of int.
2020-11-20 21:54:52 -05:00
c850ce93a4 Fix wireframe opacity creating artifacts on sculpt overlay edges
When lowering the wireframe opacity with sculpt overlays enabled, the
wireframe overlay was creating white artifacts along the edges.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9607
2020-11-20 18:02:07 +01:00
cec22ba8db Cleanup: Use LISTBASE_FOREACH macro 2020-11-20 11:00:51 -05:00
05ef031f37 UI: Remove excess row spacing in outliner popover
Some checkboxes had nonessential spacing between rows which made the
popover taller than needed.
2020-11-20 08:55:27 -07:00
2afdb4ba87 Outliner: Object state filter invert toggle
This adds an invert toggle for the outliner object state filters.
There are some cases where we want a filter for invertable states (Selected,
Unselected) and having a single toggle to invert the filter reduces the
number of separate filter types needed. This removes the "Hidden" filter
which can now be replicated with an inverted "Visible" filter.

Differential Revision: https://developer.blender.org/D9598
2020-11-20 08:47:51 -07:00
96995b2343 Fix (unreported) bug in liboverride diffing code for collection item insertion.
In case we do not use names, code adding new insert operations in
collections was broken.

Not a proble in practice so far, since this case was not yet in use, but
will be soon with NLA overrides.
2020-11-20 11:41:15 +01:00
07db110add Fix T82493: PyDoc generation throws exception on exit
Since add-ons now unregister on exit
(as of fa566157a5)
clearing functions in `bpy.app.handlers` caused an error on exit.

Resolve by restoring handlers before exiting.
2020-11-20 18:59:59 +11:00
056c9de30d Merge branch 'blender-v2.91-release' 2020-11-20 08:57:58 +01:00
93850c74c1 Fix add-object cursor plane failing to update on zoom
Zoom with an orthographic view wasn't refreshing the preview plane.
2020-11-20 17:32:09 +11:00
1501c3adad Add Object Tool: support placing objects in orthographic axis views
When an projecting onto a plane that is orthogonal to the views Z axis,
project onto a view aligned axis then map it back to the original plane.
see: ED_view3d_win_to_3d_on_plane_with_fallback

Since the depth can't be properly visualized in 3D, display a 2D so
it's possible to to tell the depth from the cursor motion.
2020-11-20 17:15:18 +11:00
a8f4affb2e Add Object Tool: use the closest view-aligned axis as a fallback
When using surface orientation and nothing is under the mouse-cursor,
pick the axis that's closest to the view's Z axis.

Now by default default, drawing into empty spaces wont use a plane
orthogonal to the view.
2020-11-20 16:45:06 +11:00
a1120892b0 UI: Fix panel drag icon added to redo panel
Error in cleanup commit 0d93bd8d63. Currently floating panels
cannot be dragged, so the widget should not be displayed.
2020-11-19 20:43:10 -05:00
5b34d11b55 Fix add-object tools cursor distorted drawing on save
Generating the thumbnail left the view matrices set to values
that couldn't be used for cursor drawing.

Backup/restore the matrices for off-screen drawing.
2020-11-20 12:15:04 +11:00
f0b75cc19d Cleanup: use a struct to backup/restore values for offscreen drawing
Variables to temporarily override values was scattered,
making it harder to follow.
2020-11-20 12:15:04 +11:00
cf780e0f67 Cleanup: remove unused off-screen drawing struct 2020-11-20 12:14:50 +11:00
f166fa67b7 Cleanup: rename do_sky argument to draw_background
This was leftover from Blender internal, follow the naming
already used by the draw manager.
2020-11-20 12:14:50 +11:00
219c3aa653 Cleanup: remove unused perspective argument to off-screen drawing
Some callers were passing in dummy values, this can be accessed from
`RegionView3D.is_persp` can be used to check this.
2020-11-20 12:14:50 +11:00
25266caa45 Cleanup: spelling 2020-11-20 11:39:22 +11:00
5f1bb8da96 Cleanup: clang-format 2020-11-20 11:28:58 +11:00
Stefan Werner
fdd3032f8f Cycles: Fixed zero sized normals when certain attributes were missing.
The Normal Map node was falling back to (0, 0, 0) when it was missing
the required attributes to calculate a new normal.
(0, 0, 0) is not a valid normal and can lead to NaNs when it is
normalized later in the shader. Instead, we now return sd->N,
the unperturbed surface normal.
2020-11-19 23:15:09 +01:00
dca36a8ec9 Fix T82769: remove thread local data from PTCacheMem
The issue was that the same point cache was read by multiple
threads at the same time (the same object was evaluated for
render and for the viewport).
Both threads incremented PTCacheMem->cur which lead to the crash.

The fix is to remove the PTCacheMem->cur and store it on the
stack instead. This way every thread has its own cur.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9606
2020-11-19 19:09:24 +01:00
72a199e148 Atomic: Cover with unit tests
Cover all atomic functions with unit tests.

The tests are quite simple, nothing special so far. The goal is to:

- Make sure implementation exists.
- Implementation behaves the same way on all platforms
  (We had issue when MSVC and GCC were behaving differently in the
  past).
- Proper bitness is used for implementation and non-fixed-size
  function implementation.

The tests can be extended further to make sure, for example, that
CAS operations do not cast arguments to a more narrow type for
comparison. Considering it a possible further improvement, as it is
better be done being focused on that specific task.

There is an annoying ifdef around 64bit implementation, which uses
same internal ifdef as the header does. This check is aimed to be
removed, so is easier to simply accept such duplication for now.

The tests seems somewhat duplicate for signed/unsigned variants and
things like this. The reason for that is to keep test code as simple
as possible: attempting to do something smart/tricky in the test code
often causes the test code to be a subject of being covered with its
own unit tests.

Differential Revision: https://developer.blender.org/D9590
2020-11-19 17:19:48 +01:00
0d027b4583 Fix RNA not giving error with invalid identifiers for collection properties 2020-11-19 16:29:29 +01:00
a44bb8603e Guarded allocator: Fix lock-free allocator tests
Previously the lock-free tests were actually testing guarded allocator
because the main entry point of tests was switching allocator to the
guarded one.

There seems to be no allocations happening between the initialization
sequence and the fixture's SetUp(), so easiest seems to be just to
switch to lockfree implementation in the fixture's SetUp().

The test are passing locally, so the "should work" has high chance
of actually being truth :)

Differential Revision: https://developer.blender.org/D9584
2020-11-19 16:17:48 +01:00
39ec64b13d Guarded allocator: Add safety around type change
While it might not cover all possible abuse of API, it does provide
basic checks against most obvious usage mistakes.
2020-11-19 16:17:48 +01:00
4a8cf9d182 Guarded allocator: Add explicit switch to the lockfree implementation
Previously the only way to use lockfree implementation was to start
executable and never switch to guarded allocator.

Surely, it is not possible to switch implementation once any allocation
did happen, but some tests are desired to test lock-free implementation
of the allocator. Those tests did not operate properly because the main
entry point of tests are forcing guarded allocator to help catching
bugs.

This change makes it possible for those tests to ensure they do operate
on lock-free implementation.

There is no functional changes here, preparing boilerplate for an
upcoming work on the allocator tests themselves.
2020-11-19 16:17:48 +01:00
42b2ae5f69 Fix lost node links when linked node group datablock is temporarily missing
Don't refresh the list of sockets, so that when the .blend file is restored the
links remain valid. Also display such nodes in red to indicate an error, same
as when the node type info is missing.
2020-11-19 15:55:05 +01:00
c5306dd0cd Merge branch 'blender-v2.91-release' 2020-11-20 01:41:17 +11:00
e01bf7a92e Fix T82540: Smart UV project ignores seams
The seam check was missed in 9296ba8674
which calculates islands from the BMesh.
2020-11-20 01:35:26 +11:00
ad4b7741db Build-system: Force C linkage for all DNA type headers
Some DNA headers already did this, most did not. Even though many of them would
be included in C++ files and thus compiled as C++. This would be confusing and
developers may think they have to add `extern "C"` too a whole lot of
(indirect) includes to be able to use a C header in C++.

However, this is a misconception.
`extern "C"` does not cause code to be compiled with C rather than C++! It only
causes the linker to not use C++ function name mangling. See
https://stackoverflow.com/a/1041880.
Because extern DNA headers don't have function declarations, using `extern "C"`
actually should not have any effect. On the other hand, adding it causes no
harm and avoids confusion. So let's just have it consistently in C header
files.

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

Reviewed by: Bastien Montagne, Sybren Stüvel
2020-11-19 13:41:50 +01:00
1395ba70bf Fix crash when adding strip using RNA API call
Don't allocate StripElem for movieclip, scene and mask strips. This
struct is not handled in seq_dupli function. This caused field to be
uninitialized in COW datablock.

StripElem is not allocated when adding strip with operator and it is
not needed for these strip types.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9600
2020-11-19 13:10:42 +01:00
abe95fbdff Cleanup: refactor sequencer_edit.c file
Move RNA enums and utility functions closer to operator definition.

No functional changes.
2020-11-19 13:04:17 +01:00
af7af488d4 Cleanup: Animation, fix uninitialised variable in Euler filter code
No functional changes.
2020-11-19 13:02:13 +01:00
226feb52ec Cleanup: Animation, refactor Euler filter
Split up the Euler filter function into two more functions. The Euler
filter operator works in two stages (find channels that define the X/Y/Z
Euler rotations, and perform filtering on those channels), and each
stage now has its own function. This makes it clearer which data are
used in which part of the code, and makes future improvements easier.

No functional changes.
2020-11-19 12:57:29 +01:00
b5e85321dc Docs: document bmesh.utils.vert_collapse_faces join_faces argument 2020-11-19 22:18:47 +11:00
fd88246d61 Fix error message prefix in Quaternion.to_euler()
Fix copy-paste error of error message prefix, so that the Quaternion
function no longer says it's a Matrix function error.
2020-11-19 11:26:54 +01:00
ae64898147 Cleanup: fix bad comment separator
Replace `* /` with `*/` to actually end the comment. As it was, the code
compiled but caused an "`/*` in comment" warning.

No functional changes.
2020-11-19 11:04:30 +01:00
71c6c95aec Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-19 10:43:46 +01:00
256e77c987 Fix T82833: GreasePencil crash when changing to Vertex Color mode
This is actually a user interface issue, introduced on 0688309988.

but->tip is checked for NULL in other parts, and rightly so, since here
it crashes Blender.

On a side note I don't know how to reliably reproduce the original bug
whose fix introduced this issue. That got on the way of seeing whether
this is the correct fix, if it happens outside greasepencil operators.

Maybe it is an operator that is missing a tooltip? Impossible to tell
without more information from said commit. That said since this happened
during the end of bcon3 and we are not in bcon4 I'm going ahead with
this NULL check commit.

Patch reviewed by Philipp Oeser and Sergey Sharybin.
2020-11-19 10:33:08 +01:00
e5df87b1b9 Cleanup: split sequencer_edit.c file
Move proxy operator functions to own file.

No functional changes.
2020-11-19 09:54:40 +01:00
8ec6b34b8e VSE: Move split operator logic to module code
Code was rewritten to work on per-sequence basis returning reference to
created strip.

There should be no functional changes.

Selection logic is left as is for now. I could simplify it, but it
belongs to operator, not split logic.

Reviewed By: sergey

Differential Revision: developer.blender.org/D9592
2020-11-19 05:31:40 +01:00
9d6d5b9beb Fix T82445: Wintab packets being discarded.
Switched timer to use GetTickCount instead of QueryPerformanceCounter
as Wintab's pkTime seems to (but is not guaranteed to) use the former.
2020-11-18 14:29:51 -08:00
e9ddb21df3 Cleanup: Grammar: "Allow to" vs gerund missed in last commit 2020-11-18 16:31:26 -05:00
8f30a88e63 Cleanup: Grammar: "Allow to" vs gerund
In cases where "Allow" is followed by an infinitive, a noun needs
to directly follow it. But it makes more sense to follow it with a
gerund instead.
2020-11-18 16:14:48 -05:00
038828f49a Fix: Sub-panel backdrop sometimes draws when closed
My last cleanup commit for this function missed this case. It likely
happens because the panel's block size doesn't update properly somewhere.
Short of investigating that right now, it makes sense to return early
in this case anyway.
2020-11-18 15:54:41 -05:00
e9607f45d8 GPencil: Automerge last drawn stroke with previous strokes
This option joins any stroke with an end near  the actual stroke. Now it is not limited to the last stroke, any stroke in the same layer for the actual frame can be joined. The join can join two strokes drawing a third stroke.

If the end and the start of the result stroke are very small, the stroke is changed to be cyclic automatically.

There is a limit distance to join the stroke, if the distance is greater than this value, the strokes are not joined. Actually, a constant, threshold distance is used, but we could expose 
as a parameter in the UI in the future.

The tool can be used with freehand drawing or with primitives.

Note: Great part of the patch is just a refactor of the old code to make it accessible and to keep code organized.

Reviewed By: mendio

Maniphest Tasks: T82377

Differential Revision: https://developer.blender.org/D9440
2020-11-18 21:35:06 +01:00
c126e27cdc Cleanup: Move function to proper section 2020-11-18 15:16:17 -05:00
0d93bd8d63 UI Code Quality: Refactor panel drawing function
The existing panel drawing function was a bit convoluted with dependent
conditions in different scopes, redundant and unecessary computations,
and un-helpful naming.

This commit separates the function into two parts, the backdrop and the
widgets. It also improves naming and uses const where possible, and in
general cleans up the code.

There are some slight visual changes, mostly with the placement of the
drag icon, which moves a bit downward to be centered with the triangle
icon. The black rectangle displayed while dragging is also removed.
2020-11-18 15:14:11 -05:00
ad58999b0d Fix pin icon in Properties not right-aligned after zooming
The logic for separator-spacers (used here for right-alignment) didn't take
region scaling into account. Usually that's not an issue because they are
otherwise only used in headers which can't zoom.
2020-11-18 19:54:35 +01:00
d6d7965307 Fix pin icon in Properties not right-aligned after zooming
The logic for separator-spacers (used here for right-alignment) didn't take
region scaling into account. Usually that's not an issue because they are
otherwise only used in headers which can't zoom.
2020-11-18 19:49:20 +01:00
56ef6fdb9e Merge branch 'blender-v2.91-release' 2020-11-18 08:19:37 -07:00
9a8f5022b7 Fix: Outliner hierarchy line width variations
During some operators like rotate in grease pencil edit mode the
hierarchy lines in the outliner would draw twice as thick. Set the width
before drawing the lines in the outliner.

Differential Revision: https://developer.blender.org/D9589
2020-11-18 08:17:42 -07:00
898231fdbc Fix transform redo panel showing only the first custom orientation
The error was introduced in rBf470a02afaea, but the problem is in
`ED_transform_calc_orientation_from_type_ex`
2020-11-18 11:57:08 -03:00
20f8130d6f Fix T82777: Some transform modes using incorrect default orientation
Some modes were always using `"Global"` orientation as the default.
2020-11-18 11:57:08 -03:00
466cd2535b Fix exact boolean coplanar problem due to inexact transform.
This is an addendum to previous boolean fix, where the object
transformation was "cleaned". Now the operand one is too.
This fixes the issue shown in the video in T82301 when you move
a column around the XY plane with the top and bottom faces
supposedly coplanar with a cube. The transformation matrix when
you do that has a tiny offset in the z component.
2020-11-18 09:56:20 -05:00
957f14a689 Merge branch 'blender-v2.91-release' 2020-11-18 15:39:43 +01:00
4edaa796d3 Fluid: Revert changes from T82488
Scaling of forces needs more work. Before making changes to them it would be nice to have a setup, that works physically correct across multiple modifiers (cloth, rigid bodies, fluid).

This will be a to do for 2.92.
2020-11-18 15:38:00 +01:00
f132d74c7d Merge branch 'blender-v2.91-release' 2020-11-18 14:26:01 +01:00
549a1cac88 Fix T82810: UV Editor, Crash with switching between single image and UDIM tile
Active tile could be NULL when it was on the second tile before
switching back and forth between the Image/UDIM.

In the future we might also check that the active_tile_index is always
valid.
2020-11-18 13:12:19 +01:00
4b55abc335 Fix T82586: Sculpt normals not updating with EEVEE enabled
The root cause of this bug is that the function that updates the PBVH
normals is drw_sculpt_generate_calls. As now both the overlays and
mesh can be drawn without using pbvh drawing, the normals were not
updating. This patch forces a normals updates also in the no PBVH
drawing code path of the overlays. This was affecting both shading and
sculpt surface sampling in both flat and smooth shading modes.

Having the sculpt normals being updated by the drawing code is a wrong
design which also causes other issues like:

    Brushes that sample the surface and do multiple stroke steps between

redraws will sample invalid normals, creating artifacts during the
stroke clearly visible in some brushes.

    Brushes that do not need to sample the surface update the normals on

each redraw. This affects performance a lot as in some cases, updating the
normals takes more time than doing the brush deformation. If flat shading
is being used, this is only necessary to do once after the stroke ends.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D9535
2020-11-18 12:20:57 +01:00
d2cddb1fda Merge branch 'blender-v2.91-release' 2020-11-18 16:43:01 +11:00
dfa2b0e1c9 Fix T82800: Changing settings from a pie menu doesn't add undo steps
Pie menu had inconsistent behavior for dragging & releasing the key
compared to clicking on the button.

This was caused by the `onfree` argument being set to true,
preventing the button from running callbacks such as setting
up undo data & auto-keyframe

This argument should only be used when freeing the button,
set this to false as is done for regular menus.
2020-11-18 16:40:48 +11:00
8b8328fbfc Merge branch 'blender-v2.91-release' 2020-11-18 15:13:26 +11:00
0688309988 Fix undo UI text containing shortcuts & newlines
- Shortcuts were being shown in the undo history.
- Multi-line tool-tips now only use the first line.
2020-11-18 15:10:51 +11:00
80a701c4e6 Merge branch 'blender-v2.91-release' 2020-11-17 19:55:49 -07:00
a352baccc3 Fix grease pencil draw mode icon color in outliner
ICON_GREASEPENCIL was defined as an object data icon when it was used as
a mode icon. This caused it to draw green in the outliner.
2020-11-17 19:51:14 -07:00
a3833abe2c Fix wrong grease pencil datablock icon in file browser
The datablock shown in the file browser was the draw mode icon rather
than the datablock icon.
2020-11-17 19:49:28 -07:00
bbdfeb751e Cleanup: remove break after return statements 2020-11-18 13:36:30 +11:00
88512646c0 Cleanup: clarify precedence of operations 2020-11-18 13:36:26 +11:00
d13edeaed4 Cleanup: 'false' use as NULL pointer 2020-11-18 13:19:53 +11:00
eb2c26bd38 Fix use of operator flag as boolean
Error in cb9de95d61
2020-11-18 13:13:52 +11:00
2485ee997b Cleanup: use descriptive argument name for uv parametrizer 2020-11-18 12:59:39 +11:00
ec6e88d4b2 Cleanup: simplify array usage for Python box packing API 2020-11-18 12:50:44 +11:00
75a4872c90 Cleanup: declare original function storage variables static
Also minor comment formatting changes.
2020-11-18 12:44:08 +11:00
3e325c35f8 Merge branch 'blender-v2.91-release' 2020-11-17 23:10:13 +01:00
e580c18853 Fix T82542: Boundary brush crash with dyntopo
This brush needs to be disabled for dyntopo as it stores its custom data
and deforms from original coordiantes.

Reviewed By: sergey

Maniphest Tasks: T82542

Differential Revision: https://developer.blender.org/D9516
2020-11-17 23:01:33 +01:00
9b20bbc3bf LibOverride: PointCache: Add UI feedback about need to enable Disk Cache.
Note that I chose to modify the label of the main `Bake` button instead
of adding an extra label line, as that would disturb the UI in a
annoying way.
2020-11-17 21:33:28 +01:00
df2bf164c7 Cleanup: Use LISTBASE_FOREACH macro 2020-11-17 13:00:43 -05:00
da6c968a95 Cleanup: Clang tidy else after return 2020-11-17 12:58:26 -05:00
7d23dd4430 Cleanup: Clang tidy inconsistent parameter name 2020-11-17 12:57:35 -05:00
75dbbaeda6 Merge branch 'blender-v2.91-release' 2020-11-17 17:39:47 +01:00
22161b6451 Cleanup: Fix incorrect RNA property label/tooltip re active NLA track.
The joys of copy/paste again.
2020-11-17 17:39:08 +01:00
ea7aae88cf Cleanup: Remove unecessary NULL check
Panels for active uiBlocks always have a type, because the process that
makes them uses the types. Add an assert just to make it clear that the
assumption is purposeful.
2020-11-17 10:28:57 -05:00
d952d1792a Merge branch 'blender-v2.91-release' 2020-11-17 10:17:00 -05:00
Jeroen Bakker
d73130cc28 Fix T82770: Artifacts when painting on generated transparent image
Regression introduced by {b17cca6966}. When centralizing the gpu texture
premultiplication setting it was assumed that generated images
(`IMA_TYPE_UV_TEST`) were stored as premultiplied. That assumption was
totally wrong as the alpha association is determined by the existing of
the float/byte buffer.

NOTE: This change will render generated images with pure emissive
colors (show colors when alpha=0.0) what might add more reports. Any
reports could be merged in the next report {T82790}.

Reviewed By: Clément Foucault, Philipp Oeser

Differential Revision: https://developer.blender.org/D9585
2020-11-17 16:10:42 +01:00
cc0b8cb359 Fix T82341: Warning in terminal during property search
After recent changes to the context panel layout (rB187cc5e26d28b1a8),
there has been an error printed when running propery search:

> Error: separator_spacer() not supported in popups.

The layout code thinks it's drawing in a menu because region->visible
isn't properly set for the other tab searches. This patch sets that field
for the temporary searching region, but it also disables searching in the
context breadcrumbs panel, because at best this will just give results
for the names of the active object, etc. This isn't helpful since
those labels are mostly in every tab anyway.

Differential Revision: https://developer.blender.org/D9425
2020-11-17 10:08:39 -05:00
0724fabcf5 Fix T81227: Modifier menu and text switch places
Logic was incorrect, mistake in f3b8792b96.

Updated comment to make intent more clear.

Same as fd78f8699e, but needed conflict resolution as the panel-type
flags where renamed in master.
2020-11-17 15:58:05 +01:00
dede4aac5b Fix T77561 EEVEE: Refraction BSDF is using world probe during glossy bake
This fixes light leaking during baking indoor environment when using
refraction bsdfs.
2020-11-17 15:56:24 +01:00
fd78f8699e Fix T81227: Modifier menu and text switch places
Logic was incorrect, mistake in f3b8792b96.

Updated comment to make intent more clear.
2020-11-17 15:31:50 +01:00
c12664a37f Merge branch 'blender-v2.91-release' 2020-11-18 00:27:40 +11:00
9d716b929d Merge branch 'blender-v2.91-release' 2020-11-18 00:27:36 +11:00
90e516d1a5 Merge branch 'blender-v2.91-release' 2020-11-18 00:27:33 +11:00
71def9738e Merge branch 'blender-v2.91-release' 2020-11-18 00:27:29 +11:00
9296ba8674 Fix T82637: pack UV islands fails with some non-manifold meshes
Edges with 3 or more connected UV's caused UV pack to fail.

Instead of using functions from uvedit_parametrizer.c which are intended
specifically for ABF/LSCM unwrapping, use a simpler method for packing
which stores arrays of BMesh faces.
2020-11-18 00:25:30 +11:00
a993600323 BMesh: support for comparing loops when calculating face-groups
Add an optional callback to check source/destination loops for
BM_mesh_calc_face_groups.

This is needed so it can be used to calculate UV islands.
2020-11-18 00:02:54 +11:00
6694d7ac5f BMesh: add UV face transform and minmax utility functions 2020-11-17 23:57:16 +11:00
7785a9c9d2 BLI_rect: add a float version of the 'pad' function 2020-11-17 23:57:16 +11:00
03ad2958d3 Merge branch 'blender-v2.91-release' 2020-11-17 13:12:21 +01:00
1e1c39fc89 Fix T82064: Add Image Clone tool to overlay engine
The clone tool in the image editor can show a second texture on top
of the image. This wasn't ported and now results into alpha and depth
issues. This fix adds the clone tool drawing to the overlay engine.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9352
2020-11-17 13:10:39 +01:00
Ankit Meel
88de58fd1a Clang-tidy, fix bugprone-exception-escape.
Remove redundant call to `ofstream::close()` from `~PSStrokeRenderer`
and `~TextStrokeRenderer`. ofstream will be destructed automatically.

- For `~Depsgraph`, `std::function`'s constructor can throw.
- Passing throwing statements in the lambda will not be detected by
  clang-tidy.
Fix these issues by using lambda as function argument.

Reviewed By: sergey, sybren
Differential Revision: https://developer.blender.org/D9497
2020-11-17 17:33:25 +05:30
417224a31b Merge branch 'blender-v2.91-release' 2020-11-17 13:02:30 +01:00
8b6ce77f16 VSE: Fix prefetch initialization sequence
In 8d1978a8e0 bmain entry is updated when prefetching is started,
but this must be done before seq_prefetch_update_context(). Otherwise
created cache keys will be incorrect.

This happens immediately after prefetch is started. When it's refreshed
problem goes away.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9581
2020-11-17 13:00:00 +01:00
cd9ce01657 RNA define: check and report invalid usages of ID pointers properties.
Some RNA structs, like operators or keymaps, are not allowed to have ID
pointer properties. now this check will ignore those, and report an
error message in the console.

Related to T82597.

Notes: While a bit more involved than rBf39fbb3e6046, this commit
remains fairly localized and non-intrusive.

It relies on some rather obscure and weird behaviors of our RNA code
though, a cleaner solution could be e.g. to add a tye to
`StructOrFunctionRNA`, so that we could properly 'rebuild' (re-cast) the
pointer to either `StructRNA` or `FunctionRNA` when needed in internal
code...
2020-11-17 12:56:26 +01:00
a25bc79633 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-17 11:11:34 +01:00
Wayde Moss
709ceddab2 Fix T82774: NLA Sync Length Typo Fix
When offsetting strips to the left, to make space when syncing strip
length, move the preceding NLA strips instead of the succeeding strips.

The bug seems to be from a copy/pasting typo.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9583
2020-11-17 11:01:28 +01:00
02efc0111c Fix T82588: Box Select selects keyframes hidden by "Only Show Selected"
Select only editable keys on selected curves when "Only Show Selected
Curves" is enabled in the Graph Editor's View menu.

This prevents selecting invisible keys with box, circle, and lasso
select in the Graph Editor.

Reviewed By: looch

Differential Revision: https://developer.blender.org/D9580
2020-11-17 10:58:40 +01:00
fb033341f9 Merge branch 'blender-v2.91-release' 2020-11-17 09:37:41 +01:00
2e1498ff16 Fix T82042: Crash when rendering huge images
Crash is related to the definition of the GL_MAX_TEXTURE_SIZE. OpenGL does not clearly
defined `GL_MAX_TEXTURE_SIZE` exactly means. Both on AMD and NVIDIA we have issues with
huge textures that they don't get created even if they are smaller. (See {D9530} for
research).

This patch will try to create the texture in a smaller size when the texture creation
failed.

Final implementation by: Clément Foucault

We should create a solution that doesn't need downscaling. For this specific case ARB_sparse_texture might help to create cleaner code, but you still have to commit the whole image what introduces several draw calls. Other improvement is to optimize the scaling; current implementation isn't optimized for performance.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D9524
2020-11-17 09:33:47 +01:00
797dfa6a0a Merge branch 'blender-v2.91-release'
Conflicts:
	source/blender/editors/render/render_opengl.c
	source/blender/sequencer/intern/effects.c
2020-11-17 04:10:51 +01:00
75bd286813 Fix T82703: Image not scaled when rendering
This is was caused by incorrectly set preview_render_size in VSE
rendering context. Value was set to SEQ_PROXY_RENDER_SIZE_FULL, but
it should be SEQ_PROXY_RENDER_SIZE_SCENE as scene render size is
being used.

This is same fix as 0d7036b40e, but I did not checked openGL
render pipeline.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9562
2020-11-17 03:56:53 +01:00
55be1dde5c Fix incorrect text size with downscaled preview
Use either scene render size or fixed preview scale factor.

Previously scene render size was used as baseline value for text size
correction. This is incorrect.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9563
2020-11-17 03:55:52 +01:00
4095835db1 Cycles: Fix compilation error and warning without OPENVDB 2020-11-17 01:31:33 +01:00
82b8c15684 Fix T81827: MacOS lines that should be thick are green instead
The issue was the use of alpha values of 0 when there were no blending
enabled.

This patch just disables the smoothing of the wires in this case.
2020-11-17 01:31:32 +01:00
09045ff64d Merge branch 'blender-v2.91-release' 2020-11-16 14:19:11 -07:00
906ff7b8fe Fix wrong collection icon in outliner popover
This icon was missed in rB0633a89e1827
2020-11-16 14:13:23 -07:00
1d4f3e2a26 Outliner: Collection icon color tweaks
The icons originally chosen for the collection colors were selected
during development and had a few issues with contrast in the light
theme, and the gray color was not a good choice against the default gray
backgrounds.

The new colors are more readable in both default Blender themes. Gray
was replaced with pink.

Differential Revision: https://developer.blender.org/D9504
2020-11-16 13:54:05 -07:00
96200110eb Fix T76699: Support macOS inbetween mouse/tablet.
Coalescing on macOS overwrites a singular unprocessed mouse event. To
receive all mouse and tablet events coalescing is disabled.

Disabling coalescing for macOS disables coalescing for trackpad
gestures. Repeat trackpad events are unnecessary and found to
negatively impact performance thus are re-coalesced in Window Manager.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9574
2020-11-16 12:46:16 -08:00
5d13cb5c2a Merge branch 'blender-v2.91-release' 2020-11-16 19:30:37 +01:00
457d537fe4 Fix T82673: Cycles crash with zero emission strength and linked emission color 2020-11-16 19:29:59 +01:00
07bd8eab97 Fix unreported wireframe opacity color blending broken
This was introduced by rBdb7d8281c5a2.

The color needs to be premultiplied as there is no blend mode and
the output color is replacing the framebuffer color & alpha.
2020-11-16 18:31:43 +01:00
13ec512f4b Fix T81983: volume tiles missing in Cycles renders
The OpenVDB data structure can store voxel data in leaf nodes or tiles
when all the nodes in a given region have a constant value. However,
Cycles is using the leaf nodes to generate the acceleration structure
for computing volume intersections which did not include constant tiles.

To fix this, we simply voxelize all the active tiles prior to generating
the volume bounding mesh. As we are using a MaskGrid, this will not
allocate actual voxel buffers for each leaf, so the memory usage will be
kept low.

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

Reviewed by: brecht, JacquesLucke
2020-11-16 17:55:39 +01:00
328aad8c98 UI: Remove X axis panel dragging
X axis panel dragging traces back to Blender versions before 2.5,
where panels could be aligned horizontally. But for many years now
panels have been vertically aligned. Considering this, keeping the
X axis dragging around is a bit odd. It makes interaction confusing,
or at least more complicated. It also looks bad, since any part of
the panel outside the region is cropped.

Differential Revision: https://developer.blender.org/D9549
2020-11-16 11:47:11 -05:00
c1d8df47f6 Revert "RNA define: check and report invalid usages of ID pointers properties."
This reverts commit f39fbb3e60.

Code is not valid, `DefRNA.laststruct` does not always point to the
proper struct when defined from Python, need to be done differently.
2020-11-16 17:13:12 +01:00
c48063d1f6 Merge branch 'blender-v2.91-release' 2020-11-16 11:00:23 -05:00
c645da98d8 Fix T82439: Crash moving collections between scenes
The original code for viewlayer collection flag syncing across moves
from D9158 didn't consider the case where the collection could no longer
be found in its original view layer (moving a collections betwen scenes).

The fix is to just check if the collection starts in the same scene as
it will be moved to before trying to do the flag syncing. I thought about
this for a while and tried a couple other solutions, but I couldn't come
up with a proper way to support syncing the layer collection flags across
scenes without making too many changes.

Differential Revision: https://developer.blender.org/D9568
2020-11-16 10:59:49 -05:00
13bcb000fa Fix broken pointcache on disk in some cases.
Root of the issue is that point caches are added to the object's list
on-demand, which often ends up with them being added only during
depsgraph evaluation, i.e. on COW objects.

This could result in having 'orig' data caches with invalid/unset stack
index at some points (e.g. when reading a file and applying
liboverrides), leading to discarding valid existing disk cache files.
Fact that one of those index is signed, and the other not, does not
help...

While this is very weak, fixing broken PointCache code is out of the
scope of a bug fix, so this patch merely:
* Simplifies and factorizes the code generating the 'extension' part of
  caches filenames;
* Ensures `BKE_object_insert_ptcache` is called when needed so that we
  always have a valid stack index to generate that filename extension.

This is only a bandaid, but it is simple and should be safe enough for
now.

Related to T82503.
2020-11-16 14:39:31 +01:00
97d52daf96 Fix (unreported) potential buffer overflow in PointCache code. 2020-11-16 14:39:31 +01:00
f39fbb3e60 RNA define: check and report invalid usages of ID pointers properties.
Some RNA structs, like operators or keymaps, are not allowed to have ID
pointer properties. now this check will ignore those, and report an
error message in the console.

Related to T82597.
2020-11-16 14:39:31 +01:00
b78bebb2af Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-16 14:15:01 +01:00
Fabrício Luis
75af3165ca Fix T82519: Adding 2nd driver doesn't recalculate
Remove `return` from for-loop which blocked the recalculation of driven
values when it found the first driver.

Reviewed By: sybren, sergey

Differential Revision: https://developer.blender.org/D9515
2020-11-16 14:10:24 +01:00
62c4d0419c Merge branch 'blender-v2.91-release' 2020-11-16 13:23:59 +01:00
8b815c7ce5 Fix T81271: Fix crash in BLI_gzopen on Windows
Previously the return value of `ufopen` wasn't checked and if it failed,
`NULL` was passed into `fclose()` which resulted in a crash. This patch
avoids this by returning from `BLI_gzopen` when the file cannot be created.

Reviewed By: sebbas, iss

Differential Revision: https://developer.blender.org/D9576
2020-11-16 13:17:24 +01:00
8b88739848 Merge branch 'blender-v2.91-release' into master 2020-11-16 12:55:50 +01:00
7db42b8f2a Fix T82460: Color Management Curves do not update when Image/UV Editor
is present

Caused by rB4212b6528afb.

'updateGLSLCurveMapping()' compares cacheIDs and in certain scenarios,
these are the same when they should not.

- whenever we had multiple viewports that are colormanaged with
curvemappings this worked right (cacheIDs were different)
- for example, this also worked right when the ImageEditor displays a
Render Result or a Compositor Viewer
- but it worked wrong when the Image Editor displays any other Image (or
no Image at all)
- it also worked right if there were multiple Image Editors [and one of
them displays a Render Result e.g]

Now why is this so?

For comparison, the curve mapping's pointer/address is used.

- update_glsl_display_processor frees the curve_mapping, see
BKE_curvemapping_free(global_glsl_state.curve_mapping)
- similar, update_glsl_display_processor creates a new curvemapping, see
BKE_curvemapping_copy(view_settings->curve_mapping)
- now for the situation that a viewport with curvemapping and a viewport
without curvemapping is present and you make changes to the curvemapping
the following happens:
-- curve_mapping_settings->cache_id is set once [to the memory address
of curvemapping before change]
-- change happens
-- viewport 1 frees curvemapping
-- viewport 2 duplicates using BKE_curvemapping_copy, but this one gets
the same address like before the change
-- this means we have different data on the same address with the same
cacheID...

Solution: to really make the cache ID unique we can combine the pointer
with its 'changed_timestamp' [which increases on every change].

Reviewers: jbakker

Maniphest Tasks: T82460

Differential Revision: https://developer.blender.org/D9559
2020-11-16 12:52:24 +01:00
cb9f6dfebd Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-16 12:23:05 +01:00
ada79b4707 Fix T82740: Drivers on movie clip datablock crash on file open
Add call to `BKE_animdata_blend_read_data()` after remapping the MovieClip
datablock address.
2020-11-16 12:21:03 +01:00
af013ff76f Cleanup: clang-tidy 2020-11-16 21:54:28 +11:00
64aa6c68d5 Fix T81817: use-after-free when trying to open file from splash screen
The issues was that Blender was trying to refresh the
splash screen region. However, opening the file browser
closed the splash screen and freed the region.

The fix is to simply not refresh the region.

Has been approved in T81817.
2020-11-16 11:30:24 +01:00
8fd27c152a Correct T82753 Fix from 979fe4f1be 2020-11-16 18:27:11 +11:00
979fe4f1be Fix T82753: Crash using add-object tool when gizmos are disabled 2020-11-16 18:24:02 +11:00
64ab084ca5 Grease Pencil: adjust behavior of target object detection
First detect the other selected object, then check it can be written to.

Otherwise the target object could be the first one found when
looping over objects which is random from the user perspective.

Move the type check to the operator, which also checks the data isn't
library data which was being ignored.
2020-11-16 16:48:44 +11:00
a3a6d6a670 Cleanup: spelling 2020-11-16 16:48:41 +11:00
4eac03d821 Cleanup: clang-format 2020-11-16 16:48:19 +11:00
01db805a82 Cleanup: split sequencer.c file
Move most functions into separate files.

File sequencer.c is reserved for alloc, free and duplicating functions.

There should be no functional changes.
2020-11-16 05:02:30 +01:00
52a189936b Merge branch 'blender-v2.91-release'
Bring in exact boolean fix.
2020-11-15 20:26:14 -05:00
fbffff26e4 Fix T82736, Exact Boolean fail with repeated subtraction of same object.
Two problems were fixed. One, the code for dissolving vertices
left a face around if dissolving a vertex would leave less than
three vertices. Instead, the face should be deleted.
Two, with transformations like "rotate 180 degrees", this should
be no problem with exact, but the current transformation matrix
has very small non-zero entries where it shouldn't. Cleaning the
transformation matrix makes it more likely that user expectations
about coplanar faces will be fulfilled.
2020-11-15 20:24:59 -05:00
194a57fd63 Outliner: Fix memory errors in runtime data
Fix a heap-use-after-free when duplicating outliner editors, and fully
free runtime data when freeing outliner editors.
2020-11-14 14:24:40 -07:00
6ac5e0b3e8 GPencil: Missing initialization in previous commit 2020-11-14 15:21:20 +01:00
c2f76f1550 GPencil: Cleanup clang format 2020-11-14 15:16:27 +01:00
b6041bfc6c GPencil: Fix unreported crash in some cases when duplicate a stroke
Some pointers were not initialized.
2020-11-14 15:16:02 +01:00
a3ce05d00e GPencil: Fix callback parameter list error
In the previous commit the bGPDframe parameter was removed, but this parameter is required to keep the same function signature.
2020-11-14 09:44:55 +01:00
83d0810a9f Merge branch 'blender-v2.91-release' 2020-11-13 20:52:06 -07:00
9b54c81414 Collections: Prevent setting scene collection color tag from rna
It should not be possible to set the scene collection's color tag
through rna. Also adds a missing notifier for setting the collection
color tag from python.
2020-11-13 20:36:35 -07:00
0633a89e18 UI: Remove remaining uses of old collection icon
After rB452a1c7b3838 there were still a few cases where the old
collection icon was used in the interface. Replace these with the new
filled collection icon.
2020-11-13 20:28:28 -07:00
2abbcaa021 GPencil: Fix compiler warning, unused variable 2020-11-13 22:31:58 +01:00
0be88c7d15 GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660

This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes
Using Curves" project. It adds a submode to greasepencil edit mode that
allows for the transformation of greasepencil strokes using bezier
curves. More information about the project can be found
here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
2020-11-13 21:43:00 +01:00
9d28353b52 Cleanup: Make panel type flag names more clear
The overlap with the `Panel` flags that start with "PNL" was quite
confusing because wasn't clear which enum a flag was from. The
new names are a bit longer, but the clarity is worth it.
2020-11-13 13:57:20 -05:00
4c193f731e Cleanup: Move PanelType flag from DNA to BKE header
Since this flag isn't saved in files and PanelType itself is defined in
BKE, the flag makes more sense there.
2020-11-13 13:15:41 -05:00
e9b955b99c GPencil: Remove ID from operators to fix T82597
Instead to use the ID of the object, now the parameter is an Enum with Selected object or New.

If use selected mode, the first grease pencil object selected is used. If none of the selected objects is a grease pencil object, a new object is created.

Small cleanup changes to the original patch.

Differential Revision: https://developer.blender.org/D9529
2020-11-13 15:21:15 +01:00
50ccf346f0 LibOverride: Adjust PointCache operators to properly handle overrides.
LibOverrides only support a small sub-set of PointCache features for now
(one cannot add new caches, baking in memory is not supported...).

Part of first step of T82503: support disk cache in liboverrides.
2020-11-13 14:21:27 +01:00
7e210e68ba LibOverride: Do not tag overrides for complete recalc.
This was done as some sort of safety, but should not actually be needed,
and including tags like `ID_RECALC_POINT_CACHE` e.g. makes usage of
point caches impossible with liboverrides (since it would systematically
invalidate all cache on file load).

In theory we should not have to tag anything here in fact, RNA accessors
are supposed to take care of it, but for now we keep the
`ID_RECALC_COPY_ON_WRITE` one.

Part of first step of T82503: support disk cache in liboverrides.
2020-11-13 14:21:27 +01:00
59910f7217 LibOverride: Make PointCache RNA properties overridable.
Note that due to convoluted layout of point caches in RNA (active one
also storing list of all available ones), we'll often have the
pointcache overrides rules twice. Should not be a huge problem,
practically speaking.

Part of first step of T82503: support disk cache in liboverrides.
2020-11-13 14:21:27 +01:00
75ea4b8a1f Ceres: Update to upstream version 2.0.0
We already were using one of earlier RC of the library, so there is no
expected big changes. Just making the update official, using official
version and stating it in the readme file.
2020-11-13 11:52:59 +01:00
7146e9696e CMake: Extend strict flags cancellation flags
Becomes rather annoying to duplicate them across C/C++ GCC/Clang sets,
almost as if the test should test both C and C++, and to do it for all
compilers.

Solves strict warning in the upstream of Ceres library.
2020-11-13 11:51:49 +01:00
a2e00236d0 Revert "Codesign: Versioning code to support older branches"
This reverts commit 9d172f007e.

Got a second thought and remembered why it was not done in the first place.
The issue here is that the server needs to communicate codesign result back
and that must happen within the new protocol. So if the client talks old
protocol it is possible to receieve data from it, but is not possible to
communicate result back to it.
2020-11-13 11:35:04 +01:00
a8f9a24939 Cleanup: use IMB_FTYPE_NONE instead of 0 for imbuf format comparison
Image format code checked the file type against an enum except for
zero which is used when the format can't be detected.

Also add doc-strings to some of the image file type callbacks.
2020-11-13 20:32:15 +11:00
4a3b26dd5e Fix building after 2e53b646f6f02ab112e0823b9577ff2e1920faaeq 2020-11-13 20:32:15 +11:00
2e53b646f6 GPencil: Remove "angle_split" from Multiply modifier. 2020-11-13 17:20:20 +08:00
5035057281 Object: show preview plane for add-object tool
The orientation & depth settings are used to show the preview plane
that is used when adding the object.
2020-11-13 20:15:03 +11:00
9d172f007e Codesign: Versioning code to support older branches
Turns out it is easier to have suboptimal versioning code on the server
side than to deal with branches where changes are to be merged into.
2020-11-13 09:49:02 +01:00
12f394ece7 refactor vec_roll_to_mat3_normalized() for clarity
the function vec_roll_to_mat3_normalized() has a bug as described in T82455. This Differential is only for refactoring the code such that it becomes more clear what the function does and how the bug can be fixed. This differential is supposed to not introduce any functional changes.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9410
2020-11-13 09:46:18 +01:00
Ivan Perevala
4efd87d56b UI: Adaptive HDRI preview resolution
HDRI preview should have resolution dependent on dpi, viewport scale and HDRI gizmo size.
This patch uses a LOD to render a more round sphere.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9382
2020-11-13 08:26:27 +01:00
YimingWu
b35b8c8849 Adding 3D_POLYLINE_UNIFORM_COLOR to PyGPU shader API
This would allow python script to access `lineWidth` uniform when drawing lines
without using `glLineWidth`.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9518
2020-11-13 08:23:04 +01:00
Manuel Castilla
4dc5920525 Fix CalculateStandardDeviationOperation incorrect results for R G B channels
Standard deviation formula wasn't being applied correctly when selecting
R G B cases. Issue is there since Blender 2.64 as it was incorrectly
ported over from the previous compositor.

Reviewed By: Sergey Sharybin, Jeroen Bakker

Differential Revision: https://developer.blender.org/D9384
2020-11-13 08:20:15 +01:00
Jun Mizutani
db7d8281c5 Add An Opacity Slider to Overlay Wireframe
This patch adds an opacity slider to the wireframe overlay. The previous
wireframe in dense geometry scenes could be too dark and sometimes the
user just wants an impression of the geometry during modelling.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D7622
2020-11-13 08:14:56 +01:00
f00ebd4dba UI: make add object tool experimental
Some changes here are planned which need feedback from users before
declaring this ready for the next release.
2020-11-13 17:27:39 +11:00
ccf8df66fe BLI_math: add floor_power_of_10, ceil_power_of_10
Add utility functions to get the floor/ceiling of a float value
to the next power of 10.
2020-11-13 17:05:46 +11:00
40b2ce5ea7 Cleanup: Remove unecessary logic in panel code
Also use short for panel flag arguments to functions since it matches
the type in DNA, and remove a comment that isn't helpful.
2020-11-12 23:32:50 -05:00
f3ab698951 Cleanup: Simplify panel activate state function
This commit moves some of the logic around so that the logic in
panel_activate_state is clearly separated by the state being activated.
There are fewer nested and redundant checks, and it's easier to see
the progression of interaction with the panel handler.
2020-11-12 23:28:53 -05:00
4eb57d00bb Merge branch 'blender-v2.91-release' 2020-11-13 11:37:47 +11:00
2e08500d04 Fix memory leak writing PNG when opening the file fails 2020-11-13 11:36:29 +11:00
454b7876ff Cleanup: remove unnecessary ImFileType.ftype callback
This callback made some sense before moving the file-type information
from a bit-flag to an enum: e142ae77ca

Since then, we can compare the type value directly.

Also replace loops over file types with IMB_file_type_from_{ibuf/ftype}.
2020-11-13 11:28:24 +11:00
ac299bb453 Cleanup: imbuf file format callback declaration
Use named members as this wasn't very readable given the number
of unnamed NULL members.
2020-11-13 10:39:48 +11:00
9a73417337 Fix T82349: file extension not added to unpacked images
Ensure the appropriate extension is set when unpacking generated images
that don't have a filepath set.

Ref D9500
2020-11-13 10:11:00 +11:00
cd49afc596 Fix T82596: Fly/walk navigation crash
Add a NULL check for the View3D's camera, because these
modes can be entered even without an active camera.
2020-11-12 17:06:57 -05:00
55e2930c18 Outliner: Sync with property editor physics tab
This commit makes the property editor switch to the physics tab instead
of the modifier tab when selecting physics modifiers. Since the modifier
isn't visible then, it's confusing to change the expansion, so this commit
also disables the modifier expansion for these modifiers.

Differential Revision: https://developer.blender.org/D9544
2020-11-12 16:59:30 -05:00
b6988de22a Merge branch 'blender-v2.91-release' 2020-11-12 20:30:14 +01:00
d59fa12f2a Fix T82607: crash cancelling Cycles render during adaptive subdivision update
Now that the Blender sync mechanism deletes nodes from the scene, we need to
ensure scene update is stopped before we do this.

Also add some more early out in scene geometry update to ensure we do not
continue working on incomplete geometry data, though that was not the cause of
this crash.
2020-11-12 20:14:12 +01:00
a6c1c0427c Cleanup: remove accidentally committed merge files 2020-11-12 19:52:04 +01:00
ddc6a45a54 Cleanup: compiler warning 2020-11-12 19:52:04 +01:00
5c01ecd2bf Fix T82516: Cycles crash updateding animated volumes after NanoVDB
Two issues:
* Automatic deduplication of OpenVDB grid data was failing when Cycles had
  already cleared the OpenVDB grid, causing an empty grid. Instead rely on
  Blender return the same OpenVDB grid pointer when deduplication is possible.
* The volume bounds mesh was not properly cleared when the OpenVDB grid was
  empty, causing a mismatch between mesh and voxel data.
2020-11-12 19:48:59 +01:00
c43283d10b fix: added missing float declarations 2020-11-12 19:27:12 +01:00
923b314a7a Test cases for vec_roll_to_mat3_normalized
The function vec_roll_to_mat3_normalized() basically has to handle 3 scenarios:

- When a bone is oriented along the negative Y axis
- When a bone is very close to the negative Y axis
- All other cases

The tests in the Differential make sure that all 3 situations are covered.

Reviewed By: sybren, mont29

Differential Revision: https://developer.blender.org/D9525
2020-11-12 18:16:35 +01:00
f17dfd575c Fix empty Cycles render devices panel showing in preferences on macOS
There is no GPU rendering support on macOS, so showing the panel only adds
confusion. Also hide the panels in builds without Cycles.
2020-11-12 17:39:19 +01:00
b9bd47c2e2 Merge branch 'blender-v2.91-release' into master 2020-11-12 16:24:18 +01:00
dad228a19c Fix asserts when two (or more) SplineIK constraints have the same root
Only a single DEG operation node `POSE_SPLINE_IK_SOLVER` should
be added in this case [ see `build_splineik_pose`, same is already done
for overlapping IK in `build_ik_pose`]

ref T82347.

Reviewers: sybren

Maniphest Tasks: T82347

Differential Revision: https://developer.blender.org/D9471
2020-11-12 16:20:48 +01:00
987732181f Merge branch 'blender-v2.91-release' 2020-11-12 14:04:02 +01:00
d0c1d93b7e Fluid: Removed clamp from force assignment
The clamp is too aggressive and results in forces being too weak.
2020-11-12 14:03:03 +01:00
a8f1bea590 Fix NanoVDB not being enabled/disabled correctly in CMake profiles
This caused warnings when e.g. building the lite profile because NanoVDB was not disabled, but
OpenVDB was. This Fixes this by setting the "WITH_NANOVDB" flag too.
2020-11-12 12:49:12 +01:00
dbbfba9428 Fix T81813: Keyframe handles don't follow keyframes
Add a new property `co_ui` to Keyframes, the modification of which will
apply to the keyframe itself as well as its Bézier handles.

Dragging the "Keyframe" slider in the properties panel now maintains the
deltas between the keyframe and its handles, just like moving the key in
the graph editor would.

Reviewed by @sybren in T81813.
2020-11-12 12:02:49 +01:00
5db114ae0f Merge branch 'blender-v2.91-release' into master 2020-11-12 11:51:25 +01:00
9067cd64a5 Fix T82466: Library Overrides: overrides disappear when appending.
`BKE_library_make_local` was not properly checking for tags and/or libs
in liboverrides case.
2020-11-12 11:50:33 +01:00
0d04bcd566 Merge branch 'blender-v2.91-release' into master 2020-11-12 11:39:34 +01:00
12dd26a2bb Sculpt: fix face set extract clicking in empty space
Should not do anything in that case.

ref T82615

Maniphest Tasks: T82615

Differential Revision: https://developer.blender.org/D9532
2020-11-12 11:36:29 +01:00
b4b4532ce0 Sculpt: use ESC key in addition to RMB to cancel eyedropper
This is more in line to other eyedropper usages throughout blender.

Affected operators:
- Sample Dyntopo detail
- Extract Face Set (as reported in T82615)

ref T82615

Maniphest Tasks: T82615

Differential Revision: https://developer.blender.org/D9531
2020-11-12 11:36:18 +01:00
d706aaa53d Merge branch 'blender-v2.91-release' into master 2020-11-12 11:26:24 +01:00
beb1460f8e Codesign: Report codesign errors from server to worker
Pass codesign errors (if any) from codesign buildbot server to the
buildbot worker, so that the latter one can abort build process if
the error happens. This solves issues when non-properly-notarized
DMG package gets uploaded to the buildbot website.
2020-11-12 11:26:06 +01:00
d7a2032846 Merge branch 'blender-v2.91-release' into master 2020-11-12 11:23:16 +01:00
eaf9ae643b Fix T82624: Skin modifiers root bone cannot be moved
When creating an armature from the skin modifier, resulting bones would
always be flagged BONE_CONNECTED.
Those bones cannot be transformed (just rotated).

Now only flag bones that really have a parent BONE_CONNECTED.

Maniphest Tasks: T82624

Differential Revision: https://developer.blender.org/D9534
2020-11-12 11:20:24 +01:00
bc090387ac Fix T82388: Sculpt mode: Unexpected undo behavior.
Issue exposed by rB4c7b1766a7f1.

Main idea is that non-memfile first undo step should check into previous
memfile and tag the ID it is editing as `future_changed`.

That way, when we go back and undo to the memfile, said IDs are properly
detected as changed and re-read from the memfile.

Otherwise, undo system sees them as unchanged, and just re-use the
current data instead.

Note that currently only Sculpt mode seems affected (probably because it
is storing the mode switch itself as a Sculpt undo step instead of a
memfile one), but similar action might be needed in some other cases
too.

Maniphest Tasks: T82388

Differential Revision: https://developer.blender.org/D9510
2020-11-12 10:47:50 +01:00
fb4113defb Codesign: Report codesign errors from server to worker
Pass codesign errors (if any) from codesign buildbot server to the
buildbot worker, so that the latter one can abort build process if
the error happens. This solves issues when non-properly-notarized
DMG package gets uploaded to the buildbot website.
2020-11-12 10:12:56 +01:00
88bb29dea6 Fix T82617: artifacts in Cycles viewport when changing subdivision attributes
The old attributes were not cleared when synchronizing the geometries, this could also lead to crashes in other cases.

Ref T82608.
2020-11-12 09:17:38 +01:00
08452d9956 Merge branch 'blender-v2.91-release' 2020-11-12 09:14:36 +01:00
cd2dfacfa5 Merge branch 'blender-v2.91-release' 2020-11-12 09:14:05 +01:00
Jeroen Bakker
c08827e659 Fix T82093: Sampled Colors Mismatch When Painting (Partial)
When painting in the image editor on data images (Non-color, Raw) the
color mismatched between the sampled color and the actual effect that
the painting has on the image. The root cause is that the sampling is
color managed, but the painting still uses a fixed color management
pipeline with a lot of assumptions. Due to recent changes the drawing
of the image editor is color managed, but the painting isn't what made
these changes show up.

This patch is a work-a-round so that the sampled colors and the effect
the paint has on the texture matches. This isn't the correct solution
as that would be to migrate all the painting tools to use proper color
management.

Reviewed By: Pablo Dobarro

Differential Revision: https://developer.blender.org/D9411
2020-11-12 09:13:06 +01:00
Jeroen Bakker
f93081a01b Fix T81673: Color picker picks up UI and Overlay
There are two implementations of the Sample Color operation. One is used
by the paint texture and one by the image editor. The image editor
variant sampled from the ibuf directly, but the paint texture variant
was sampling from the screen front buffer. This can lead into incorrect
samples due to color pipeline.

This patch will use the image editor variant when sampling a color for
2d texture painting

Reviewed By: Pablo Dobarro

Differential Revision: https://developer.blender.org/D9408
2020-11-12 09:08:32 +01:00
89c8b074e7 Cleanup: split view3d_placement depth & orientation calculation
Split out functionality needed for preview plane drawing.
2020-11-12 16:16:49 +11:00
934c2c8ac5 Cleanup: clang-tidy, remove invalid comments 2020-11-12 15:18:08 +11:00
977b6ca305 Cleanup: Imperative tense in property description 2020-11-12 04:59:50 +01:00
f284a40385 ImBuf: pass the number of bytes read to 'is_a' callbacks
Previously the header was a fixed size and assumed to be zeroed.
Now read in bytes up to `HEADER_SIZE`, pass the number or bytes
read to the callback which must not read past those bytes.
2020-11-12 12:30:18 +11:00
fa81a42539 Cleanup: RNA ID enum utility function
- Avoid calling `GS(id->name)` on each iteration.
- Remove unused arguments.
- Pass `const ID *` to the filter callback.
2020-11-12 11:46:30 +11:00
e00bb5a4b7 Cleanup: spelling 2020-11-12 11:35:31 +11:00
9e1e9516a0 Cleanup: warnings 2020-11-12 11:23:21 +11:00
Aaron Carlisle
2ef2b3e0fd Cleanup: Remove SSE math optimization i386 macOS builds
We haven't supported 32bit mac builds for a while so this should be safe to remove.

Reviewed By: #platform_macos, brecht

Differential Revision: https://developer.blender.org/D9489
2020-11-11 17:08:48 -05:00
1043ec7991 Merge branch 'blender-v2.91-release' 2020-11-11 16:37:22 -05:00
b99faa0f56 Fix T80475, bad bevel: side vertex in bad plane in some cases.
Needed a better normal to for plane to offset into when there are
non in-plane edges between two beveled edges. It was using the vertex
normal, which is just wrong.

Differential Revision: https://developer.blender.org/D9508
2020-11-11 16:24:01 -05:00
88e6341ce8 UI: Tooltips: dont add period to labels
These are generally only one or two word phrases and are not sentences.
This change slightly improves readability.

Note, the check when display labels:

```
Tip Label (only for buttons not already showing the label).
```

Could be improved here because there are a lot of false positives.
2020-11-11 14:58:50 -05:00
40aa69e2eb Cleanup: Split header for Outliner tree building into C and C++ headers
See https://developer.blender.org/D9499.

It's odd to include a C++ header (".hh") in C code, we should avoid that. All
of the Outliner code should be moved to C++, I don't expect this C header to
stay for long.
2020-11-11 19:09:15 +01:00
c2b3a68f24 Cleanup: Rename Outliner "tree-view" types to "tree-display" & update comments
See https://developer.blender.org/D9499.

"View" leads to weird names like `TreeViewViewLayer` and after all they are
specific to what we call a "display mode", so "display" is more appropriate.

Also add, update and correct comments.
2020-11-11 19:09:11 +01:00
01318b3112 Cleanup: Follow C++ code style for new Outliner building code
See https://developer.blender.org/D9499.

* Use C++17 nested namespaces.
* Use `_` suffix rather than prefix for private member variables.

Also: Simplify code visually in `tree_view.cc` with `using namespace`.
2020-11-11 19:09:06 +01:00
43b4570dcf Cleanup: General cleanup of Outliner Blender File display mode building
See https://developer.blender.org/D9499.

* Turn functions into member functions (makes API for a type more obvious &
  local, allows implicitly sharing data through member variables, enables order
  independend definition of functions, allows more natural language for
  function names because of the obvious context).
* Prefer references over pointers for passing by reference (makes clear that
  NULL is not a valid value and that the current scope is not the owner).
* Reduce indentation levels, use `continue` in loops to ensure preconditions
  are met.
* Add asserts for sanity checks.
2020-11-11 19:09:01 +01:00
44d8fafd7f UI Code Quality: Convert Outliner Blender File mode to new tree buiding design
See https://developer.blender.org/D9499.

Also:
* Add `space_outliner/tree/common.cc` for functions shared between display
  modes.
* I had to add a cast to `ListBaseWrapper` to make it work with ID lists.
* Cleanup: Remove internal `Tree` alias for `ListBase`. That was more confusing
  than helpful.
2020-11-11 19:08:56 +01:00
ad0c387fdf Cleanup: Put Outliner C++ namespace into blender::ed namespace, add comments
See https://developer.blender.org/D9499.

Also remove unnecessary forward declaration.
2020-11-11 19:08:49 +01:00
5fb67573b5 Fix possible null-pointer dereference in new Outliner tree building code 2020-11-11 19:08:43 +01:00
dc9a52a303 Cleanup: Remove redundant parameter from new Outliner tree building code
See https://developer.blender.org/D9499.
2020-11-11 19:08:36 +01:00
cad2fd99e7 Cleanup: Comments and style improvements for new Outliner C++ code
See https://developer.blender.org/D9499.

* Add comments to explain the design ideas better.
* Follow code style guide for class layout.
* Avoid uninitialized value after construction (general good practice).
2020-11-11 19:08:29 +01:00
6b18e13c5b UI Code Quality: Use C++ data-structures for Outliner object hierarchy building
See https://developer.blender.org/D9499.

* Use `blender::Map` over `GHash`
* Use `blender::Vector` over allocated `ListBase *`

Benefits:
* Significantly reduces the amount of heap allocations in large trees (e.g.
  from O(n) to O(log(n)), where n is number of objects).
* Higher type safety (no `void *`, virtually no casts).
* More optimized (e.g. small buffer optimization).
* More practicable, const-correct APIs with well-defined exception behavior.

Code generally becomes more readable (less lines of code, less boilerplate,
more logic-focused APIs because of greater language flexibility).
2020-11-11 19:08:13 +01:00
c9cc03b688 UI Code Quality: General refactor of Outliner View Layer display mode creation
See https://developer.blender.org/D9499.

* Turn functions into member functions (makes API for a type more obvious &
  local, allows implicitly sharing data through member variables, enables order
  independend definition of functions, allows more natural language for
  function names because of the obvious context).
* Move important variables to classes rather than passing around all the time
  (shorter, more task-focused code, localizes important data names).
* Add helper class for adding object children sub-trees (smaller, more focused
  units are easier to reason about, have higher coherence, better testability,
  can manage own resources easily with RAII).
* Use C++ iterators over C-macros (arguably more readable, less macros is
  generally preferred)
* Add doxygen groups (visually emphasizes the coherence of code sections,
  provide place for higher level comments on sections).
* Prefer references over pointers for passing by reference (makes clear that
  NULL is not a valid value and that the current scope is not the owner).
2020-11-11 19:07:55 +01:00
249e4df110 UI Code Quality: Start refactoring Outliner tree building (using C++)
This introduces a new C++ abstraction "tree-display" (in this commit named
tree-view, renamed in a followup) to help constructing and managing the tree
for the different display types (View Layer, Scene, Blender file, etc.).

See https://developer.blender.org/D9499 for more context. Other developers
approved this rather significantly different design approach there.

----

Motivation

General problems with current design:
* The Outliner tree building code is messy and hard to follow.
* Hard-coded display mode checks are scattered over many places.
* Data is passed around in rather unsafe ways (e.g. lots of `void *`).
* There are no individually testable units.
* Data-structure use is inefficient.

The current Outliner code needs quite some untangling, the tree building seems
like a good place to start. This and the followup commits tackle that.

----

Design Idea

Idea is to have an abstract base class (`AbstractTreeDisplay`), and then
sub-classes with the implementation for each display type (e.g.
`TreeDisplayViewLayer`, `TreeDisplayDataAPI`, etc). The tree-display is kept
alive until tree-rebuild as runtime data of the space, so that further queries
based on the display type can be executed (e.g. "does the display support
selection syncing?", "does it support restriction toggle columns?", etc.).

New files are in a new `space_outliner/tree` sub-directory.

With the new design, display modes become proper units, making them more
maintainable, safer and testable. It should also be easier now to add new
display modes.
2020-11-11 18:51:57 +01:00
5b5ec0a2e9 Fix T82521: Bump OpenImageIO minimum version 1.8 > 2.2.1 for install_deps.sh
Since rB6fdcca8de64cd70f, we need at least OpenImageIO 2.1.12 to build
Blender.
2020-11-11 15:10:01 +01:00
e47ea9fbc7 GPencil: Fix unreported crash when style is NULL 2020-11-11 12:16:22 +01:00
7b6d76f387 Cleanup: correct argument order to callback
Currently the callback isn't used,
found when testing a new enum callback.
2020-11-11 20:40:42 +11:00
251b7d77b3 Merge branch 'blender-v2.91-release' into master 2020-11-11 10:27:44 +01:00
7ba971d6d8 Fix T82553: Outliner F2 renaming issue when item is out of view
- scrolling would be restricted (usually, if the object to be renamed is
in view, this prevents scrolling away without finishing the rename
operation)
- renaming by typing and confirming with Enter was not possible (you
would have to escape, scroll to the object and use F2 again)
- other shortcuts like A and H are still active instead of being handled
as text input

Avoid all these issue by forcing the item into view using
outliner_show_active / outliner_scroll_view.

Maniphest Tasks: T82553

Differential Revision: https://developer.blender.org/D9521
2020-11-11 10:18:47 +01:00
9b3dabacbc Cleanup: Use NDEBUG define, DEBUG one is not reliable. 2020-11-11 10:15:58 +01:00
2d48f3e445 Fix 'outliner_scroll_view()' not reaching wanted element
Scrolling to an item after opening relevant parents can go wrong if said
parent e.g. the last in the list [as in: then the Outliner does not
scroll down all the way]
It stems from the fact that 'region->v2d.tot.ymin' is not up-to-date in
outliner_scroll_view after outliner_show_active opens up parents, 'tot'
will only update on a redraw.

Now calculate the trees height on the fly using
'outliner_tree_dimensions()'.

ref D9521
ref T82553

Maniphest Tasks: T82553

Differential Revision: https://developer.blender.org/D9523
2020-11-11 10:12:28 +01:00
15ffda3bcd Fix T82602: checking image header reads past buffer bounds
Use the size argument to ensure checking the header doesn't read
past the buffer bounds when reading corrupt/truncated headers
from image files.
2020-11-11 16:14:09 +11:00
2d60845786 Cleanup: pass header size to 'is_a' callbacks
No functional changes, prepare for fixing out-of-bounds access
when reading headers.
2020-11-11 16:14:06 +11:00
99f56b4c16 Cleanup: use 'filepath' instead of 'name' for ImBuf utilities 2020-11-11 16:14:06 +11:00
a5f8071bdf Cleanup: use bool for imbuf save callbacks 2020-11-11 16:14:05 +11:00
e9c19b2820 Cleanup: avoid boolean literals for functions that return int 2020-11-11 16:14:05 +11:00
11bf3b7035 Cleanup: use define for targa header size 2020-11-11 15:05:30 +11:00
75c18b989c Cleanup: remove redundant NULL checks in ImFileType.is_a callback
Most of these callbacks don't do a NULL check,
so there is no need to do this for bmp/png.

Also correct radiance_hdr comments.
2020-11-11 14:54:04 +11:00
36e5c9e026 Merge branch 'blender-v2.91-release' 2020-11-11 14:44:27 +11:00
12168ccf18 ImBuf: replace incorrect strstr use with memcmp
Besides being incorrect as only the first two bytes should be tested,
searching binary data using `strstr` can easily read past buffer bounds.
2020-11-11 14:41:04 +11:00
eeeb2c1967 Merge branch 'blender-v2.91-release' 2020-11-10 17:34:29 -07:00
8953485f56 Fix: Selection not possible from outliner gutter
Selection should be possible from the left gutter in object mode. When
in other modes the mode column displays icon buttons which should be
prioritized for selection only in those modes.

Introduced in rB2110af20f5e6.
2020-11-10 17:29:32 -07:00
c4d8f6a4a8 Cleanup: clang-format 2020-11-11 09:11:43 +11:00
cd9acfed4f Cleanup: use preprocessor version check for PyTypeObject declaration
While `tp_print` was deprecated, Python 3.8+ uses this for
'tp_vectorcall_offset' which wasn't stated in the comment from
efd71aad4f.

Instead of suppressing clang-tidy, use preprocessor a check since
this properly represents the difference between Python versions.
2020-11-11 09:11:21 +11:00
86bdd2acc6 Windows: Fix build issue with VCPKG
For blender we disable VCPKG to prevent it from picking
up the wrong libraries from VCPKG rather than our lib folder
some of the cycles tests needed this to link correctly.

reported by @alef on chat
2020-11-10 13:23:55 -07:00
b980cd163a Cycles: fix compilation of OSL shaders following API change
The names of the parameters are based on those of those of the sockets, so they also need to be updated. This was forgotten about in the previous commit (rBa284e559b90e).

Ref T82561.
2020-11-10 18:59:30 +01:00
a63208823c Fix NanoVDB compile errors with recent NanoVDB versions
There were some changes to the NanoVDB API that broke the way Cycles was previously using it.
With these changes it compiles successfully again and also still compiles with the NanoVDB revision
that is currently part of the Blender dependencies. Ref T81454.
2020-11-10 18:28:14 +01:00
339f442a93 Fix (unreported) potential assert in viewlayer synchronization.
Some operations, like remapping and ID (Object) to another, can lead to
having the same object in more than one base.

While this is not a valid state, this is being taken care of by the
`BKE_layer_collection_sync` call, so the object-to-base GHash generation
itself should be resilient to such issue.

Note: another way to fix this would be to make remapping post-process
code check explicitely for such doublons, but I would rather avoid
adding even more 'specialized' code there, it already has to deal with
too many of those corner cases.
2020-11-10 17:16:28 +01:00
626a79204e MSVC: Fix build warning
If a define of NOMINMAX was made before BLI_task.hh was included,
the compiler would emit a

warning C4005: 'NOMINMAX': macro redefinition

warning, to work around this only define it if it is not already
defined, and only undefine it if we were the ones that made the
define earlier.
2020-11-10 08:48:18 -07:00
bd6bfba64d Cycles: Enable NanoVDB usage by default
As discussed during the Rendering Metting. Ref T81454.
2020-11-10 16:20:15 +01:00
Germano Cavalcante
23614c49e9 Fix T81951: Add Cube new tool surface snaping not working
For the `plane_depth` of type `PLACE_DEPTH_SURFACE` to take effect, a `snap_context` is needed.

But, even if a temporary `snap_context` was created for `plane_orient == PLACE_ORIENT_SURFACE`,
this context was not used for `plane_depth`.

So, use a temporary `snap_context` for `PLACE_DEPTH_SURFACE` (as it is done for `PLACE_ORIENT_SURFACE`).

Differential Revision: https://developer.blender.org/D9345
Differential Revision: https://developer.blender.org/D9435
2020-11-10 12:18:19 -03:00
2ecab4c8a6 LibOverride: Optimize deletion of overrides in liboverride delete. 2020-11-10 16:14:16 +01:00
de8d7003bc Cleanup/Update comments in liboverride code. 2020-11-10 16:14:16 +01:00
a284e559b9 Fix T82561: shader compilation crashes in OSL
The "type" sockets on shader nodes were renamed in rB31a620b9420cab to
avoid clashes with the `NodeType type` member from the Node base class,
but the OSL shader compilation was missing those changes.
2020-11-10 16:05:47 +01:00
feb71f1d71 Animation: Expand unit tests for BKE_fcurve_active_keyframe_index()
Expand unit test for `BKE_fcurve_active_keyframe_index()` to test edge
cases better.

This also introduces a new test macro `EXPECT_BLI_ASSERT()`, which can be
used to test that an assertion fails successfully.

No functional changes to actual Blender code.
2020-11-10 15:36:21 +01:00
75a2db5d97 Multires: Cleanup, clarify comment 2020-11-10 15:32:06 +01:00
11c19c24bd Cleanup/Update comments in liboverride code. 2020-11-10 15:30:36 +01:00
01c7a94cdd install_deps: fix a typo in argument handling of new nanovdb option.
Spotted by  Patrick Mours (@pmoursnv), thanks!
2020-11-10 14:11:13 +01:00
2a2bc09096 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-10 14:02:28 +01:00
4960780d76 Animation: More explicit boundary checks when setting active keyframe
Fix unit test failing in debug mode by having more explicit boundary checks
when setting an FCurve's active keyframe.

No functional changes.
2020-11-10 13:44:47 +01:00
23c71a5fab ImBuf: support detecting the file format from in-memory images
Add `IMB_ispic_type_from_memory` so we can detect the file format
of in-memory images.

This removes `is_a_filepath` callback and uses a magic check for
photo-shop files that's compatible with OIIO.

Even though OIIO doesn't support packed images, we can still use the
file magic for detecting the format.

This change allows D9500 (a fix for unpacking images),
to be implemented without a significant performance penalty,
although the actual performance cost would depend heavily on the
blend file.

Reviewed By: dfelinto, sergey

Ref D9517
2020-11-10 22:25:05 +11:00
d2ab9b568e Merge branch 'blender-v2.91-release' 2020-11-10 19:09:04 +11:00
05a2382c08 Fix T82540: Smart UV project ignores seams
Functionality was lost in the Python to C conversion from
850234c1b1
2020-11-10 19:05:07 +11:00
291473bb3e Merge branch 'blender-v2.91-release' 2020-11-10 17:50:15 +11:00
476a0d2311 Fix T82555: Crash using copied object from Python
Also clear `gpd_eval` as this wasn't being copied either.
2020-11-10 17:44:56 +11:00
3bb6902235 Merge branch 'blender-v2.91-release' 2020-11-10 16:30:10 +11:00
b902edae75 Fix T65585: Knife fails when cursor away from the object
Zeroed mouse coordinates were being used making projection fail.
2020-11-10 16:25:58 +11:00
bff1707aae Cleanup: remove hard coded file format check in IMB_ispic_type
This is already being checked in the 'is_a' callback.
2020-11-10 11:58:56 +11:00
b5d310b569 Cleanup: clang-format 2020-11-10 09:42:03 +11:00
efd71aad4f Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print
Clang-tidy behavior changes from Python 3.7 to 3.8+ so it's simplest
to suppress the warning in this instance.
2020-11-10 09:40:20 +11:00
3a764c3e6d Cleanup: suppress clang-tidy warnings without FFMPEG/AVI/AUDASPACE 2020-11-10 09:40:20 +11:00
6faba2db08 Merge branch 'blender-v2.91-release' 2020-11-09 21:18:28 +01:00
f923b6faa9 Fix assert in the sculpt pen tilt code
Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9422
2020-11-09 21:17:17 +01:00
850f9452a4 Fix wrong DNA flag for hide face sets
It was using the same flag as SCULPT_DYNTOPO_DETAIL_MANUAL

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9484
2020-11-09 21:15:33 +01:00
716b7a60df install_deps: add support for NanoVDB.
re T81454.
2020-11-09 19:08:01 +01:00
cdb1da6bf6 Install_deps: update URLS for OpenVDB repo/sources. 2020-11-09 19:08:01 +01:00
cf751e3914 Merge branch 'blender-v2.91-release' 2020-11-09 18:50:56 +01:00
60c4d0b5fb Fix T78028: crash with grease pencil and save buffers
Perform grease pencil rendering delayed in this case, as there are no render
buffers available for compositing. This keeps memory usage lower, but does
involve multiple depsgraph evaluation. This seems in line with the intent of
the save buffers feature, to use minimal memory.
2020-11-09 18:49:28 +01:00
cc5294bd91 Fix potential crash closing Blender with persistent data option enabled
Found by address sanitizer.
2020-11-09 18:49:28 +01:00
cde2bd1828 Merge branch 'blender-v2.91-release' 2020-11-09 17:37:21 +01:00
ec6a9322e8 Fix T78956: banding artifacts of vertex colors in Cycles
Byte colors must be encoded in sRGB and converted to linear on lookup,
to avoid precision loss.
2020-11-09 17:30:34 +01:00
bd2dda90b6 Cleanup: Clang-tidy, inconsistent parameter name
readability-inconsistent-declaration-parameter-name
2020-11-09 21:31:13 +05:30
94b44a5228 Cleanup: Clang-tidy, modernize-use-nullptr. 2020-11-09 21:31:13 +05:30
880b0f981d Cleanup: more renaming in the render/ module for consistency 2020-11-09 16:19:49 +01:00
4f66cf3b8b Pointclouds: move blenkernel code to c++ 2020-11-09 15:47:16 +01:00
dfe50ef2d8 Fluid: Fix strict compiler warning
Proper way to check for DEBUG_PRINT is to do `if defined` check rather
than `if`: this is because in non-debug builds the symbol is not defined.
2020-11-09 15:43:22 +01:00
6507449e54 Cleanup: fix wrong merge, remove extra unique_ptr.
Mistakes added in 3cb4c51308 and
bec1765340

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9514
2020-11-09 19:32:16 +05:30
4d544d6ae7 Fix T80068: skin modifier not working with motion blur
The skin modifier did not output consistent results, causing failure to find
corresponding vertices across frames.

Remove unnecessary use of GSet, all we need is an array.
2020-11-09 14:54:50 +01:00
021c40167d Cycles: fix Node::tag_modified not setting modified flag's upper bits
Previous code was flipping the bits on a 32-bit number and doing a zero extension to cast to 64-bit, so mark the constant as long to begin with.

This would also erase previously set bits in this part the flag.
2020-11-09 14:52:48 +01:00
ed75a50119 Cycles: Fix function inline attributes
forceinline attribute is only applicable for function which are
marked inline. Interestingly, it can be used for class methods
without explicit inline statement. But for functions it is another
story.
2020-11-09 14:41:00 +01:00
1f4062cf6e Fluid: Fix strict compiler warning
Proper way to check for DEBUG_PRINT is to do `if defined` check rather
than `if`: this is because in non-debug builds the symbol is not defined.
2020-11-09 14:35:20 +01:00
Yevgeny Makarov
055ed335a1 macOS: follow system preference for natural trackpad scroll direction
And remove Blender preference, which was expected to be set to match the system
preference for correct behavior. Instead just handle this automatically.

Differential Revision: https://developer.blender.org/D9402
2020-11-09 13:51:08 +01:00
0c4d12986a Merge branch 'blender-v2.91-release' 2020-11-09 12:54:26 +01:00
0e6820cc5d Fix T82488: Mantaflow - force fields have very low influence compare to 2.90.1
Removed 0.2f factor when setting forces. Why this factor has been used when forces should only be clamped, nobody knows ..
2020-11-09 12:53:27 +01:00
5da05dd627 Fix T82210: Animation, Bake Action cleanup
Make post-bake cleanup of the Bake Action operator optional, and disable
by default.

Previously Bake Action would do two things:
- Bake the Action
- Clean up the FCurves

It is now possible (and even the default) to only perform the baking
operation.

Reviewed By: #animation_rigging, looch, sybren

Maniphest Tasks: T82210

Differential Revision: https://developer.blender.org/D9453
2020-11-09 12:41:51 +01:00
118e31a0a9 Cycles: Fix tricubic sampling with NanoVDB
Volumes using tricubic sampling were producing different results with NanoVDB compared
to dense textures. This fixes that by using the same tricubic sampling algorithm in both
cases. It also fixes some remaining offset issues and some minor things that broke OpenCL
kernel compilation on NVIDIA.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9491
2020-11-09 12:37:47 +01:00
92083772e7 Libmv: Fix warning about unused parameter in Ceres
Ceres is an external library, so consider it a system header which
makes it so all strict flags are properly ignored for them.
2020-11-09 12:12:00 +01:00
f26e267770 CMake: Extend supported strict flags cancelation for Clang 2020-11-09 12:12:00 +01:00
525a042c5c Cleanup: fix some clang tidy issues 2020-11-09 12:05:07 +01:00
5837ffc143 Merge branch 'blender-v2.91-release' into master 2020-11-09 11:49:44 +01:00
29693c7b07 Sculpt: Fix off-by-one error when creating bitmap for lasso gesture
Reviewers: pablodp606

Differential Revision: https://developer.blender.org/D9472
2020-11-09 11:48:55 +01:00
ad85256e71 Animation: move group colors switch to user preferences
Move the "Show Group Colors" toggle from a per-editor option to a single
user preference in the Animation preferences. The Grease Pencil
animation channel side panel allows picking a channel color; this now
shows a message when channel colors are disabled.

The old "Show Group Colors" toggle had to be set per editor, and was on
by default. This meant that disabling group colors would require an
action for every file, for every editor. It is very hard to select a
color that works both as bone color in the 3D Viewport (needs to be
bright there) as well as the channel list (needs to be dark there), most
animators turn channel list colors off.

Differential Revision: https://developer.blender.org/D9391
2020-11-09 11:11:05 +01:00
25375c769a Cleanup: Sequencer, remove unused function
Remove `static int clear_scene_in_allseqs_fn(...)`. It was a utility
function for `BKE_sequencer_clear_scene_in_allseqs()`, which was removed
in c063813c30.

No functional changes.
2020-11-09 11:11:05 +01:00
c356a3654d Merge branch 'blender-v2.91-release' 2020-11-09 20:37:03 +11:00
3c04a06178 Merge branch 'blender-v2.91-release' 2020-11-09 20:36:34 +11:00
ba179e3dd5 Merge branch 'blender-v2.91-release' 2020-11-09 20:36:31 +11:00
71ff935fd6 Revert "Fix T80742: curve bevel fails with zero length handles at end-point"
This reverts commit 4987b7d347.

This introduced a slight change in curve direction at end-points
(while correct), it caused tests to fail.

Keep this change for 2.92, revert for 2.91.
2020-11-09 20:33:27 +11:00
067e200564 Fix T82495: assert with cast modifier in edit-mode 2020-11-09 19:01:48 +11:00
af4c389f99 Cleanup: imbuf callback naming
Use `is_a` & `is_a_filepath` in callback names.
2020-11-09 17:03:28 +11:00
e118426e46 Fix T82520: error building freestyle with Python3.8
Caused by 16732def37,
This is a 'Py_ssize_t' in Python 3.8,
replace with zero as this works in both 3.7 and 3.8.
2020-11-09 16:08:29 +11:00
8c846cccd6 Cleanup: clang-format 2020-11-09 15:47:08 +11:00
39012146e1 Fix T81651, exact boolean modifier incorrect if operand hidden.
The code was trying to ignore hidden geometry when doing boolean,
which is correct when used as a tool, but not when a modifier.
Added a "keep_hidden" argument to bmesh_boolean to distinguish the
two cases.
Also fixed a bug when the tool is used with hidden geometry that
is attached to unhidden geometry that is deleted by the operation.
2020-11-08 10:12:53 -05:00
06dac0a453 Fix T81651, exact boolean modifier incorrect if operand hidden.
The code was trying to ignore hidden geometry when doing boolean,
which is correct when used as a tool, but not when a modifier.
Added a "keep_hidden" argument to bmesh_boolean to distinguish the
two cases.
Also fixed a bug when the tool is used with hidden geometry that
is attached to unhidden geometry that is deleted by the operation.
2020-11-08 08:39:01 -05:00
7be47dadea Cleanup: Clang-tidy, readability-else-after-return 2020-11-07 21:52:53 +05:30
4429b4b77e Cleanup: Clang-tidy, readability-non-const-parameter. 2020-11-07 21:52:53 +05:30
9cd9ea591f Cleanup: NULL to nullptr. 2020-11-07 21:52:53 +05:30
bec1765340 Merge new boolean fix from blender-v2.91-release. 2020-11-07 09:33:56 -05:00
46da8e9eb9 Fix T82301, exact boolean fail on cube with bump.
The code for determining coplanar clusters had a bug where it would
miss some triangles. The fix for now is to just put triangles in
the cluster if their bounding boxes overlap. This works but maybe
makes clusters bigger then they have to be. I'll follow this commit
with work on making the CDT routine faster when using exact arithmetic.
Also removed a lot of unused code, and added some new intersect
performance tests.
2020-11-07 09:02:58 -05:00
40d4a4cb1a Cleanup: Clang-format. 2020-11-07 18:48:13 +05:30
6e6b5e147c Noise: fix uninitialized variable warning.
Mistake in 74188e6502
2020-11-07 18:48:13 +05:30
ae342ed451 Cleanup: Clang-tidy else-after-return 2020-11-07 18:48:13 +05:30
4525049aa0 Cleanup: Clang-tidy, modernize-concat-nested-namespaces 2020-11-07 18:48:13 +05:30
a452fcb9a5 View3D: take clipping into account for Frame All
Clamp the min/max used for Frame All/Selected
by the clipping region if it's set.

Resolve T81050
2020-11-07 21:20:57 +11:00
19a0df25e3 Cleanup: move plane array intersection into a function
Also add check to ensure a point isn't occluded by it's own plane,
which could happen if a small epsilon values are passed in.
2020-11-07 21:01:42 +11:00
Yevgeny Makarov
d7b0ec9cb5 Fix for T78211: Trackpad Zoom to Mouse Position Error
When using a trackpad Zoom to Mouse Position would always zoom to center of canvas.

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

Reviewed by Brecht Van Lommel
2020-11-06 17:56:45 -08:00
Yevgeny Makarov
c87b7fdd8a Fix for T65714: Pinch Zooming Crash using Mac Trackpad
Ensure that Zoom does not crash on Mac Trackpad by checking for existence of Continuous Zoom timer.

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

Reviewed by Julian Eisel
2020-11-06 17:43:11 -08:00
d2c102060d Cleanup: Rename render texture files to texture_* 2020-11-06 14:20:44 -05:00
b3e71ee098 Cleanup: Remove unused variable 2020-11-06 12:50:03 -06:00
c2b7e83fae Cleanup: remove unused includes in readfile.c and writefile.c 2020-11-06 19:11:53 +01:00
2d26057751 Fix missing include warning
Caused by rB580ff2cb937daf43699908afe1190baea8d117aa
2020-11-06 12:48:13 -05:00
b0dcabdf65 Cleanup: fix naming and remove unnecessary code 2020-11-06 18:41:03 +01:00
992b8f6f5f Refactor: move Screen .blend data read to blenkernel
Ref T76372.
2020-11-06 18:37:52 +01:00
1762d5f43a Refactor: move Ipo .blend I/O to IDTypeInfo callbacks 2020-11-06 18:33:33 +01:00
638913a3c0 Refactor: move Object .blend I/O to IDTypeInfo callbacks 2020-11-06 18:25:51 +01:00
16732def37 Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.

No functional changes.
2020-11-06 18:08:25 +01:00
88926375a0 Clang-Tidy: error out when executable not found
Stop with an error when the Clang-Tidy executable cannot be found.

Without this check, CMake will happily report "Found Clang-Tidy" but with
the fallback version (0, 0, 0), when `CLANG_TIDY_EXECUTABLE` points to a
non-existing executable.
2020-11-06 18:08:25 +01:00
2acf01ec62 Refactor: move Pose .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:58:25 +01:00
Yevgeny Makarov
60ad4a761a UI: Improved macOS Application Icon Progress Bar
Nicer appearance for the progress bar that is drawn over the application icon during long processes on macOS.

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

Reviewed by Brecht Van Lommel
2020-11-06 08:55:05 -08:00
58e9b51f95 Refactor: move Constraint .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:45:29 +01:00
37ef37711d Refactor: move MotionPath .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:33:13 +01:00
a3a6443bfd Merge branch 'blender-v2.91-release' into master 2020-11-06 17:29:18 +01:00
42980abf8d Fix T81997: Subsurf Optimal Display sticks after object conversion
When using Optimal Display, some edges are not flagged `ME_EDGEDRAW` |
`ME_EDGERENDER`.
When the modifier is applied through the UI in the modifier stack this is
not an issue because the `modifyMesh` callback is run with
`MOD_APPLY_TO_BASE_MESH` (this will effectively turn of Optimal
Display).
When converting to mesh though, this will just get an evaluated mesh
(where the edge flags are still the same as with the subdivision
modifier).
Now ensure every edge is flagged to draw after conversion.

Maniphest Tasks: T81997

Differential Revision: https://developer.blender.org/D9331
2020-11-06 17:25:52 +01:00
57414e6d1d Refactor: move gpencil modifier .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:22:20 +01:00
019407810b Refactor: move modifier .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:13:16 +01:00
f6ad56b1bc Merge branch 'blender-v2.91-release' into master 2020-11-06 16:58:06 +01:00
1019df81ff Fix T82251: Outliner Material Drag&Drop missing tree update
Caused by rBb077de086e14.

Not entirely sure why this was rebuilding the tree prior to above
commit, but sending an ND_OB_SHADING notifier is appropriate (and also
what the Outliners listener listens to).

Maniphest Tasks: T82251

Differential Revision: https://developer.blender.org/D9396
2020-11-06 16:55:04 +01:00
3cb4c51308 Cleanup: Clang-Tidy, modernize-make-unique 2020-11-06 16:47:16 +01:00
ce70f2e1e0 Cleanup: Sort includes after recent render module cleanup 2020-11-06 10:45:18 -05:00
998ae29549 Fix T82220 Missing viewport update after manual "HDRI Preview Size" input
This is caused by the TAA being reset after the init phase, leading to
1 sample being kept as valid when it is clearly not.

To fix this, we run the lookdev validation before TAA init.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9452
2020-11-06 16:44:15 +01:00
c063813c30 Cleanup: remove unused functions 2020-11-06 16:43:48 +01:00
af24532612 Refactor: move ShaderFx .blend I/O to blenkernel
Ref T76372.
2020-11-06 16:42:50 +01:00
580ff2cb93 Cleanup: Render Module: combine intern/ source & include 2020-11-06 10:37:40 -05:00
90ac9770a4 Cleanup: whitespace 2020-11-06 16:16:14 +01:00
e15076b22f Cleanup: Render Module: move header files to main directory
Move headers files from `render/extern/` to `render/`

Part of T73586
2020-11-06 10:10:41 -05:00
Paul Melis
235c309e5f Add background rectangle option to video sequencer Text strip
This adds a Box option to the Text strip's style properties, plus related Box Margin value:

{F9208309}

When enabled the text is placed on top of a solid-filled rectangle of a chosen color, as shown below:

{F9208324}

When the box option is disabled the text strip works the same as it does now. When the box option is enabled the meaning of the Shadow option changes to provide a drop-shadow on the rectangle (and not on the text itself). The latter made more sense to me.

The box margin is specified as a fraction of the image width. The offset of the drop-down box shadow is fixed to a specific fraction of the image width as well.

I tested this feature on a movie of a couple of minutes containing dozens of text strips (all with box background), edge cases like multi-line strings and text overlapping the image edges.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9468
2020-11-06 16:05:50 +01:00
f6524aaa80 Refactor: move ParticleSystem .blend I/O to blenkernel
Ref T76372.
2020-11-06 15:58:39 +01:00
ba4da217ce Sequencer: Make naming consistent in header and implementation files 2020-11-06 15:46:56 +01:00
c74086376f VSE: Don't store proxy images in cache
Proxies are expected to be fast to read. Storing them in cache has
little to no effect on performance.

This change also allows to omit invalidation of cache when user switch
between proxies and original media.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9473
2020-11-06 15:38:44 +01:00
958ceaf5bf Refactor: move Scene .blend expand to IDTypeInfo callback 2020-11-06 15:37:56 +01:00
2f3181d0f2 Refactor: move Scene .blend lib reading to IDTypeInfo callback 2020-11-06 15:21:57 +01:00
1e7d29b012 Cleanup: rename time related variables
Variables renaned:
 - cfra -> timeline_frame
 - nr -> frame index
 - cfra_over -> overlap_frame

Function seq_give_stripelem_index was renamed to seq_give_frame_index.
2020-11-06 15:13:53 +01:00
e91d2ee777 Blenloader: access report list via api 2020-11-06 15:13:31 +01:00
0c26a44c76 Blenloader: expose BLO_reportf_wrap in api
This function is used by a couple of functions that are moved out of blenloader.
2020-11-06 15:07:10 +01:00
6ab0bd4798 Refactor: move Scene .blend data reading to IDTypeInfo callback 2020-11-06 14:57:36 +01:00
140d6cc4a2 Refactor: move Scene .blend writing to IDTypeInfo callback 2020-11-06 14:49:30 +01:00
a83fcf2b35 CMake: Fix wrong library used for dependency
Was causing compilation failure on fresh builds.
2020-11-06 14:47:46 +01:00
7dd76329e1 Refactor: move PointCache .blend I/O to blenkernel
Ref T76372.
2020-11-06 14:40:54 +01:00
6bca9d8c11 Cleanup: Fluid engine API return types
Use bool return type where possible instead of int (the return values from fluid object are already boolean instead of int).

Also removed several if guards in API functions. If one of the arguments is in fact invalid / nullptr (should not happen though), it better to catch them directly where they failed and not silently escape them.
2020-11-06 14:35:40 +01:00
af35ada2f3 Cleanup: Clang-Tidy, modernize-use-bool-literals 2020-11-06 14:32:51 +01:00
dfa027fe09 Refactor: move sequencer modifier .blend I/O to sequencer module
Ref T76372.
2020-11-06 14:28:33 +01:00
94ce248b30 Cleanup: Alembic, simplify expression
Change `1 + current_mat++` to `++current_mat`.

No functional changes.
2020-11-06 14:24:50 +01:00
047819e728 Cleanup: Alembic, simplify material assignment code
Refactor material assignment code such that:
- `build_mat_map()` just returns the built map (instead of relying on
  modifying a map passed as parameter),
- `LISTBASE_FOREACH` is used to loop over a `ListBase` (instead of a
  hand-crafted for-loop),
- just `return` when not enough material slots can be created (instead
  of setting a boolean to false, then doing some useless work, then
  checking the boolean),
- reorder some code for clarity, and
- rename `mat_map` to `matname_to_material` so that the semantics are
  clearer.

No functional changes.
2020-11-06 14:24:50 +01:00
c32a5ce17c Refactor: move Paint lib linking to blenkernel
Ref T76372.
2020-11-06 14:10:31 +01:00
62223e9851 Refactor: move color settings .blend I/O to blenkernel
Ref T76372.
2020-11-06 14:10:31 +01:00
8d5073345d Cleanup: Clang-Tidy, modernize-use-emplace 2020-11-06 14:06:52 +01:00
cee5a41518 Fix compilation error of bf_draw
Similar to previous commit, missing build dependency.
2020-11-06 13:53:47 +01:00
187adc64b4 Fix compilation error when building from scratch
Make sure the DNA offset files is ready at a time bf_windowmanager
need it.
2020-11-06 13:49:56 +01:00
a331d5c992 Cleanup: Clang-Tidy, modernize-redundant-void-arg 2020-11-06 13:40:46 +01:00
41db8f2fce Refactor: move LightCache .blend I/O to eevee_lightcache.c
Ref T76372.
2020-11-06 13:35:19 +01:00
da96389dcb Refactor: move remaining ViewLayer .blend I/O to blenkernel
Ref T76372.
2020-11-06 13:22:10 +01:00
3ee9e3a04f Cleanup: remove unnecessary function 2020-11-06 13:17:31 +01:00
9ad2965921 Refactor: move Paint .blend I/O to blenkernel
Ref T76372.
2020-11-06 13:16:17 +01:00
e810a16d75 Refactor: move wmWindowManager .blend I/O to IDTypeInfo callbacks 2020-11-06 13:04:56 +01:00
2de454c514 Merge branch 'blender-v2.91-release' into master 2020-11-06 12:57:27 +01:00
8df84f7be4 Fix T82364: Widget anim state not updated when deleting channel in Graph Editor
So a keyframed e.g. location slider would stay yellow/green even if its
corresponding channel was removed.

Needs a appropriate notifier so the listeners (e.g.
buttons_area_listener, view3d_buttons_region_listener) would cause a
redraw.

Maniphest Tasks: T82364

Differential Revision: https://developer.blender.org/D9438
2020-11-06 12:52:52 +01:00
3310e6d63e Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-06 12:29:45 +01:00
b35e3f2460 Fix T82457: Python error when clicking on a tool in the viewport
Ths variable was initialized for false, while it was expected to be
true.
2020-11-06 12:29:19 +01:00
3b77c670f0 Clang Tidy: Expand modernize category
Gives an idea of which warnings are affecting Blender code base.
2020-11-06 12:16:02 +01:00
311031ecd0 Cleanup: Use nullptr everywhere in fluid code
Switched from NULL to nullptr.
2020-11-06 12:06:05 +01:00
37b155420b Merge branch 'blender-v2.91-release' into master 2020-11-06 12:00:50 +01:00
390a0d5624 Fix T82387: Crash loading file saved with recent master in old versions
This fix makes sure new files save `wmWindow.global_areas` under a different
name, so old Blender versions don't recognize and 0-initialize it.

Since enabling global area writing (ef4aa42ea4), loading a file in old
Blender versions would cause `wmWindow.global_areas` to be read, because there
was already reading code for it and `ScrAreaMap` was in SDNA.
However the `ScrArea.global` of the global areas would be NULL, because it was
*not* in SDNA (`ScrGlobalAreaData` was excluded).
Now, issue is that the code assumes that areas in the global area-map have a
valid ScrArea.global pointer.

Think this was a mistake in rB5f6c45498c92. We should have cleared all this data
on reading, until the global area writing was enabled.

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

Reviewed by: Brecht Van Lommel
2020-11-06 11:58:06 +01:00
e6739ed91d Fix T82407: Negative number input gives syntax error for velocities and
accelerations

Caused by rB45dbc38a8b15.

Above commit would place parentheses surrounding a block until the next
operator was found.
For velocities and accelerations though, the '/' in 'm/s' or 'ft/s'
should not be considered an operator.

Maniphest Tasks: T82407

Differential Revision: https://developer.blender.org/D9467
2020-11-06 11:56:57 +01:00
190170d4cc Cleanup: Clang-Tidy, readability-redundant-member-init 2020-11-06 11:54:53 +01:00
dae004557a Merge branch 'blender-v2.91-release' into master 2020-11-06 10:45:39 +01:00
28e703b0a1 Fix Outliner editbone selection with 'Sync Selection'
When editbones were selected from the Outliner (and they were connected
to a parent) with the 'Sync Selection' option turned ON, they could not
get duplicated.

For duplication to work, the (connected) parent bone's tip also has to
be selected [which was not the case when selection is done from the
Outliner under above circumstances]. The reason being that
armature_duplicate_selected_exec ->
ED_armature_edit_sync_selection clears the BONE_ROOTSEL flag if the
parent bone's BONE_TIPSEL is not set.

Caused by rB71eb65328078 btw.

The correct "parent-tip-selection" would actually happen in activation
- `tree_element_active_ebone`
-- `tree_element_active_ebone__sel`
but for 'Sync Selection' this happens [also] in
- `outliner_sync_selection_from_outliner`
-- `outliner_select_sync_to_edit_bone`
which did not do the "flushing" to the parent bone's tip

Now use existing dedicated function for this.

ref. T82347

Reviewers: Zachman

Differential Revision: https://developer.blender.org/D9470
2020-11-06 10:42:14 +01:00
0573f86587 Cleanup: Clang-Tidy warnings 2020-11-06 09:54:02 +01:00
9c34391e0c Fix compilation error in GHOST
ELEM macro isn't available in GHOST library.
2020-11-06 08:23:13 +01:00
84bbdfb8af Cleanup: Fix the order of info_cfg_option. 2020-11-06 12:46:58 +05:30
ec9241cd59 Cleanup: add missing doxygen group 2020-11-06 01:46:50 -05:00
df4935b29b Cleanup: Fix wrong doxygen groups
Was missed in rB9b6088cb9da4df1a893361997fc1a22986bf6f2e
2020-11-06 01:46:50 -05:00
9762a0992b CMake: configue_file() to pass strings for build-info
Using configue_file(..) would have avoided the breakage from
1daa3c3f0a, caused by buildinfo not properly escaping quotes.

Rely on CMake to escaping strings instead using configure_file().
2020-11-06 17:26:29 +11:00
9a7da1242d Fix uninitialized value
Own mistake in rB74188e65028d268af887ab2140e4253087410c1e
2020-11-06 01:10:51 -05:00
d9e7a42640 Cleanup: use 'BKE_' prefix for initialization functions 2020-11-06 16:43:09 +11:00
3c097af51f Cleanup: use doxy sections for node_group.c 2020-11-06 16:25:09 +11:00
2f58535b78 Cleanup: use if/else check for property poll 2020-11-06 16:02:42 +11:00
f38ad4c66b Cleanup: replace STREQLEN with STRPREFIX for constant strings 2020-11-06 15:56:03 +11:00
2d803d3f6d Cleanup: use STR_ELEM macro 2020-11-06 15:42:03 +11:00
4f140ec7cc Cleanup: Use LISTBASE_FOREACH macro 2020-11-05 22:39:30 -06:00
06c030eaa4 Cleanup: Use descriptive variable names 2020-11-05 22:33:01 -06:00
a51455918c Cleanup: de-duplicate code for instancing objects when linking
Ref D8843
2020-11-06 15:00:07 +11:00
605425c006 Cleanup: doxygen comments 2020-11-06 14:35:38 +11:00
eed6bf22a4 Cleanup: doxygen comments in ghost
Use colon after parameters, use hash to reference symbols.
2020-11-06 14:25:44 +11:00
f11f7ce08e Cleanup: use ELEM macro (>2 args) 2020-11-06 12:54:19 +11:00
d89fedf266 Cleanup: clang-format
Missed this last commit.
2020-11-06 12:46:17 +11:00
aa3a4973a3 Cleanup: use ELEM macro 2020-11-06 12:32:54 +11:00
7cb20d841d Cleanup: follow our code style for float literals 2020-11-06 12:32:54 +11:00
4a78a2774b Cleanup: use bool argument in BLI_noise 2020-11-06 12:32:54 +11:00
29401f8ca2 Cleanup: BLI_noise
Use common prefix as this collided with existing API's (eg BLI_voronoi).

Also expand some non-obvious abbreviations:

- 'g'  -> 'generic'
- 'vl' -> 'variable_lacunarity'
- 'V'  -> 'v3'
2020-11-06 12:32:54 +11:00
155f42a12f Cleanup: remove unused BLI_turbulence1
A slightly modified version of BLI_turbulence1, unused for years.
2020-11-06 12:32:54 +11:00
548b351647 Cleanup: use snake case for BLI_args API 2020-11-06 12:32:54 +11:00
c8f2ad0ab9 Cleanup: remove unused BLI_argsArgv 2020-11-06 12:32:54 +11:00
2bd8f7e059 Cleanup: use string APPEND/PREPEND
Replace 'set' with 'string(APPEND/PREPEND ...)'.
This avoids duplicating the variable name.
2020-11-06 12:32:54 +11:00
7160682b0d Cleanup: transform.h comments, use doxy sections 2020-11-06 12:32:54 +11:00
262eeb3e95 Cleanup: sort structs, files 2020-11-06 12:32:54 +11:00
c19e4b706e Cleanup: clang-format 2020-11-06 12:32:54 +11:00
73ea68d0ca Cleanup: unused variable 2020-11-06 12:32:53 +11:00
Yevgeny Makarov
c99c02d3ba UI: Tweaks to the Warning Icon
Warning Sign Alert Icon given a more rounded border.

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

Reviewed by Pablo Vazquez
2020-11-05 16:11:59 -08:00
1682a47876 Merge branch 'blender-v2.91-release' 2020-11-05 23:42:11 +01:00
02677ec4e0 Fix T81915: Draw Face Sets not working with deformed sculpt mesh
The draw face sets brush uses the poly center when used in meshes to increase
its precision when working in low poly geometry. For this to work with deformed
meshes, the deformed coordinates from the PBVH should be used instead.

Reviewed By: sergey

Maniphest Tasks: T81915

Differential Revision: https://developer.blender.org/D9424
2020-11-05 23:40:30 +01:00
e041d0fc02 Fix memory leaks in sculpt mode trimming tools
BKE_mesh_free() seems to not free the meshes correctly, so using BKE_id_free() instead.
The looptri array was also not freed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9426
2020-11-05 23:31:58 +01:00
057f9caac6 Fix T82400: Dyntopo detail size edit operator visual glitch
Just a missing immUnbindProgram

Reviewed By: sergey

Maniphest Tasks: T82400

Differential Revision: https://developer.blender.org/D9459
2020-11-05 23:28:16 +01:00
e2b3681f09 Fix Dyntopo detail size preview orientation not matching the cursor
Used the sampled cursor normal when available instead of the raycast face normal.
This makes the preview match the previous orientation of the cursor.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9460
2020-11-05 23:26:18 +01:00
00374fbde2 Move "Camera Parent Lock" from preferences to Object Relations
"Camera Parent Lock" can be useful when rigging cameras, but it is not
intuitive, and has also generated a lot of confusion (bug reports).
This is because it breaks the fundamental parent <-> child relationship
conventions in Blender, and there is no indication that it's intended
without diving into the preferences.

This commit moves the setting to the object level, and exposes it in
the relations panel in the property editor. It is exposed for every
object type because any object type can be "View Locked" in the 3D view.
The property description is also updated to reflect this change and be
more specific without getting too long.

In the future this could become a more general feature of the transform
system, but for now it is limited to "Lock Camera to View".

Differential Revision: https://developer.blender.org/D9239
2020-11-05 16:08:00 -06:00
ad481bdd35 Fix T82423: Add modifier key back into keymap
Commit rBf5080c82dd915db6c7b9dd68a52aaaccf2600137
accidentally remove the Shift modifier key from
the `AUTOCONSTRAINPLANE` shortcut.

Differential Revision: https://developer.blender.org/D9480
2020-11-05 23:03:41 +01:00
1b9d9cb1ed Fix T82164: Knife tool draws huge vertices after using bgl.glPointSize
Since it is possible to have multiple draw callbacks, (some of which
use bgl and others gpu), check and force the reset of the drawing status
at the end of each callback.

Differential Revision: https://developer.blender.org/D9476
2020-11-05 18:34:47 -03:00
69e567cfe8 Merge branch 'blender-v2.91-release' 2020-11-05 21:35:27 +01:00
Robert Guetzkow
7fed420877 Fix T82423: Replace duplicate name in keymap
The two entries `TFM_MODAL_AUTOCONSTRAINT` and
`TFM_MODAL_AUTOCONSTRAINTPLANE` had the same name
displayed in the UI. The latter is now includes
"plane" in it's name.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D9474
2020-11-05 21:29:15 +01:00
74188e6502 Cleanup: Reduce variable scope
Differential Revision: https://developer.blender.org/D9475
2020-11-05 14:11:32 -05:00
b053312bdd Fix T80043: missing Cycles displacement update when relinking output sockets 2020-11-05 19:35:39 +01:00
60859d8912 Fluid: Potential fix for T74559: Adaptive Domain creates lines in smoke
This commit corrects the maximum resolution field in Fluid objects. The field should be set to the maximum possible resolution, i.e. it should not adjust with adaptive domains and stay constant all the time.

The reason for this is that this resolution value will be used to scale gravity. And this gravity should be constant for adaptive domains too.

It remains to be shown if this issue was the only reason for line-artifacts as seen in T74559.
2020-11-05 18:55:08 +01:00
6a2a6fa514 Fix T82428: Cycles crashes when building volume meshes
The Volume Node did not have all of the sockets from its Mesh base class
which are now required due to the recent socket API change.
2020-11-05 18:46:26 +01:00
d9dd408b42 Merge branch 'blender-v2.91-release' into master 2020-11-05 18:00:48 +01:00
c3e832144b GPU: Fix valgrind warnings about branching on uninitialized variables 2020-11-05 18:00:27 +01:00
aae60f0fec Fix T81752 EEVEE: Camera Motion Blur is not blending steps properly
This was due to improper calculation of velocity factor and an
error in the camera data swapping between two steps.
2020-11-05 18:00:27 +01:00
15eec7f8b9 Fix T80842 Grease Pencil: Subtract mode is not working as expected
The blend equation was not set correctly inside the GL Module
since the refactor.
2020-11-05 18:00:27 +01:00
8819a4dce8 Spelling: Predefined, Look Up, No One
Fixes 18 misspellings of 'predefined', 'Look Up', 'Lookup', and 'No One'.

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

Reviewed by Hans Goudey
2020-11-05 07:52:58 -08:00
d837923a56 VSE: cache performance optimization
Map frame for cached raw images to strip input media frame range. This
means that static images or extended frame range of movies will only
generate one cache entry.

timeline_frame is stored in cache key as a reference - on what frame
was this entry created, so we don't have to reverse lookup frame range.

Since each media frame corresponds to one cache frame with same frame
index key, there is no need to invalidate raw cache when changing time
remapping properties like use_reverse_frames or strobe

No changes are needed for disk cache, since invalidating raw entry
assumes all data will be invalidated.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9462
2020-11-05 15:55:17 +01:00
8720c66009 Fluid: Potential fix for T74559: Adaptive Domain creates lines in smoke
This commit corrects the maximum resolution field in Fluid objects. The field should be set to the maximum possible resolution, i.e. it should not adjust with adaptive domains and stay constant all the time.

The reason for this is that this resolution value will be used to scale gravity. And this gravity should be constant for adaptive domains too.

It remains to be shown if this issue was the only reason for line-artifacts as seen in T74559.
2020-11-05 15:06:01 +01:00
cba6b4f4a1 Cleanup: add commits to .git-blame-ignore-revs.
Quick python script to print commit messages, and finding
duplicates: P1736
2020-11-05 19:24:07 +05:30
2a6a26bbd7 Rename extern rendering and proxy functions
Replace BKE_sequencer wirh SEQ_render or SEQ_proxy prefixes.
In cases where function is very generic, only SEQ prefix is used.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9439
2020-11-05 14:05:25 +01:00
0f43fe7fa6 Cleanup: split sequencer.c file
Move functions closely related to rendering images and proxies into
render.c and proxy.c files. render.h and proxy.h are created for
functions used internally.

There should be no functional changes.
2020-11-05 13:33:27 +01:00
4988f5f39c Fix T82292: Set encoding for keymap export to UTF-8
Keymaps have previously been exported with an encoding dependent
on the current system locale. This caused issues when the
keymap contained non-ASCII characters, for instance in a string
property for an operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9449
2020-11-05 09:50:51 +01:00
7bc7b7da2d Merge branch 'blender-v2.91-release' 2020-11-05 18:27:47 +11:00
4987b7d347 Fix T80742: curve bevel fails with zero length handles at end-point
Initialize the direction on the first/last points of the curve.

The fix from 23a4149778 exposed this error.
2020-11-05 18:15:45 +11:00
e0db650483 Merge branch 'blender-v2.91-release' 2020-11-05 16:13:16 +11:00
60c3ef3d61 Fix T81136: Mesh.loop_triangles kept after applying modifiers 2020-11-05 16:10:30 +11:00
9ac0541563 Merge branch 'blender-v2.91-release' 2020-11-05 15:48:37 +11:00
a88b9a4e00 Merge branch 'blender-v2.91-release' 2020-11-05 15:48:24 +11:00
52a2d5cbd2 Transform: support individual origins for "To Sphere" 2020-11-05 15:45:48 +11:00
8d88d9fd33 Fix T65205: "To Sphere" radius too large with proportional editing
The radius is now calculated based on the vertices being transformed
by proportional editing, updated when the falloff changes.
2020-11-05 15:39:04 +11:00
63f7e69829 UI: Fix Support for Anonymous Menu Separators
Re-enables support for menus to have items without identifier or name that can be used to separate sections.

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

Reviewed by Hans Goudey
2020-11-04 17:19:46 -08:00
c23ee2a293 Cleanup: Use const for function arguments 2020-11-04 18:53:17 -06:00
86bdc959a3 Fix T82417: Panels draw below others while animating after drag
This adds a new runtime flag for panels that is set during the entire
drag and animation operation. The flag is set recursively so that
sub-panels know to draw on top too.

Note that this also replaces most of the fixes in 1960b8a361 and
8e08d80e52 (D7462) with a more "built-in" solution.
2020-11-04 18:02:27 -06:00
6c3849ea08 Cleanup: Simplify panel collapse handler logic 2020-11-04 16:35:54 -06:00
4572428e86 Cleanup: Remove unused Panel.snap from DNA and handler code
This was a remnant of floating panels from the horizontal layout in
pre 2.5 horizontal panels.
2020-11-04 16:25:38 -06:00
bf36080501 Cleanup: Remove unused drag scaling code for panels
This is done more universally now, and this implementation of this is
no longer used.
2020-11-04 16:05:23 -06:00
f888f3aa1f Cleanup: Make panel function static
These functions were not used elsewhere, and the handling for the panel
tabs should be kept local to this file where possible. Also remove
another unused function and removed an unecessary "_ex" function.
2020-11-04 15:54:56 -06:00
76416f336a Cleanup: Move function to proper file
This lower level drawing function didn't make sense in the panel code,
especially when it is used in multiple other places.
2020-11-04 15:38:11 -06:00
7ee518cf70 Fix T80313: Fix clipped text in splash screen on hiDPI monitors
The current layout gave too little space for the full "Search" string inside
the button.
Fix this by making sure radio-buttons have their text center aligned by default
in pop-ups too, like they do anywhere else.

This does affect a few other cases, e.g. the "RGB"/"HSV"/"Hex" radio-toggles
for color pickers. But this should be fine, I don't think they were ever
intentionally using left-aligned text (while similar buttons outside of pop-ups
didn't).
2020-11-04 22:32:26 +01:00
f9fbe4efd6 Cleanup: Improve property search related comments panel code
The comments related to property search changes should be generally
more correct and more helpful.
2020-11-04 15:30:56 -06:00
4d7ad82347 Cleanup: Use LISTBASE_FOREACH 2020-11-04 14:14:16 -06:00
f45d79f180 UI: Replace uses of "loc/rot" with full words
Use "Rotation" in place of "Rot" for the rotation header text.
Cleanup various RNA titles and tooltips.

Differential Revision: https://developer.blender.org/D9457
2020-11-04 12:36:59 -07:00
eca8cd8449 Cleanup: Remove incorrect comment
This function for replacing a button pointer in button groups is
needed by the block update from old code, so it cannot be removed
like its layout equivalent.
2020-11-04 13:30:59 -06:00
10914987a2 Merge branch 'blender-v2.91-release' 2020-11-04 13:27:13 -06:00
29780b8101 Remove incorrect assert in button group code
Even after the last commit to fix this assert, it still fails in the
case where a button was added before there was a button group
added to the block. Another fix for this would be to always create
a button group in UI_block_begin, but this assert has no particular
purpose, so it's simpler to just remove it.
2020-11-04 13:21:26 -06:00
568dc2665e Fix T73126 Eevee: light probe baking ignores indirect bounces from SSS 2020-11-04 19:36:48 +01:00
eb21222e64 Transform: Disable snap to plane-face intersection
This feature was added in D5608.
But in practice this confuses more than it helps.
This fixes T82386.
2020-11-04 15:23:08 -03:00
331614e09b Fix T82384: Custom Properties for ShaderNodeTree do not save in blend files.
Not sure why those were excluded, there is no reason not to write ID
data itself for embedded IDs...
2020-11-04 18:16:07 +01:00
afe5345a3f Fix (unreported) memory leak when freeing Master collections.
Potential ID properties there (or any other ID data itself) would not be
freed.
2020-11-04 18:16:07 +01:00
7a8c8ec5e9 Merge branch 'blender-v2.91-release' 2020-11-04 18:13:57 +01:00
fd110291a5 Fix T81794: ColorRampElement step regression
Set step in RNA property definition.

There was a hardcoded setting of a1 for this specific button, which
used to be the variable to store the step size of number buttons until
rBe6f0b60c2e91. hardcoded value is removed in rBe29206f86a5f.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9277
2020-11-04 18:09:21 +01:00
96e8dadda0 Fix T82385 EEVEE: Alpha Clip shadows actually using Alpha Hashed shadows
The shadow path was not using the alpha threshold.
2020-11-04 17:16:20 +01:00
c937f9c4e7 Cycles: fix another race condition in Geometry synchronization
This was forgotten in the previous fix, we should not modify sockets
updated in a separated thread.
2020-11-04 16:35:00 +01:00
0802e9cf54 Use compiler check for -fmacro-prefix-map
Use a more reliable method to check the availability of the flag than
compiler versions. Some compilers have different behaviors for
C and C++.

Reviewed By: campbellbarton, ChrisLend

Differential Revision: https://developer.blender.org/D9446
2020-11-04 21:00:29 +05:30
78234eb214 Fix T82197: Freestyle settings not visible for Workbench render engine
These had an effect but were not exposed in the UI.
2020-11-04 16:20:44 +01:00
abc5e7d596 Annotations: Set as visible when use the annotation tool
If the annotation draw operator is used, enable the annotations in the current area.

Before this change, some editors had the annotation flag set to OFF, but this could be solved with a versioning code, but this did not solve the root problem. The user can disable annotation visibility in the overlay or side panel, depending on the editor. If the user uses the annotation tool and this flag is OFF, the annotation is not visible, and this is not correct. With this patch, every time the user uses the tool, the annotation visibility flag is set to ON to ensure the annotation is visible.

This solves the problem of T82273, T79578 and T80294

Maniphest Tasks: T82273

Differential Revision: https://developer.blender.org/D9409
2020-11-04 16:13:39 +01:00
b63490bc4b Merge branch 'blender-v2.91-release' 2020-11-04 16:07:03 +01:00
cf9ea111bf macOS: remove deprecated touch event API call
Now that the minimum version is macOS 10.13, we can use the new API.

This reverts commit f97a64aa9b.
2020-11-04 16:01:03 +01:00
4dddd54393 Fix T82016: Cycles assert with empty OpenVDB volumes 2020-11-04 15:51:39 +01:00
fd9124ed6b Fix Cycles volume render differences with NanoVDB when using linear sampling
The NanoVDB sampling implementation behaves different from dense texture sampling, so this
adds a small offset to the voxel indices to correct for that.
Also removes the need to modify the sampling coordinates by moving all the necessary
transformations into the image transform. See also T81454.
2020-11-04 15:09:06 +01:00
43ceb0f047 UI: avoid using "loc/rot", use full words instead. 2020-11-04 14:27:18 +01:00
5af9b9f45b Merge branch 'blender-v2.91-release' 2020-11-04 14:14:38 +01:00
3ffa0452af Fix T67832: Camera Background Images View Transform
This patch will apply the view transform when a movie clip is used as
camera background image. It does this by rendering the image in the
color buffer when it needs the view transform. For other images it uses
the overlay buffer.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7067
2020-11-04 14:13:24 +01:00
7a7f294940 Fix T81775: Object Disappears During Texture Painting
Issue was that the `tris_per_mat` are not created when the first batch is drawn
during select operator and then is not created when needed by the workbench pass
since they are not tracked by mesh_buffer_cache_create_requested.

This change will create the `tris_per_mat` just in case they are needed later.
Solution by Clément Foucault

Differential Revision: https://developer.blender.org/D9430
2020-11-04 14:08:03 +01:00
17ccda4fe1 Cycles: fix multithreading issue introduced in previous commit
The issue is that the shaders are stolen from the original Geometry by
the temporary Geometry used to accumulate data, but the main thread
still needs them for syncing the attributes.

So make a copy of the shader array to preserve the data on the original
Geometry.
2020-11-04 14:03:35 +01:00
ed4855ecb4 Modifiers: Fix wrong object when setting error in modifier
This was introduced in rBe4facbbea54019abe257787a7e9e8594a6ce3609.
2020-11-04 13:43:00 +01:00
25a718aa90 Merge branch 'blender-v2.91-release' into master 2020-11-04 13:34:41 +01:00
27648ed537 Modifiers: return empty mesh in case of error in Volume to Mesh modifier
Passing on the original mesh does not really make sense.
For that one should simply disable the modifier.
2020-11-04 13:31:23 +01:00
cfcdae5549 Fix T82393: Volume to Mesh modifier with sequence fails during rendering
The issue was that the volume for the current frame
might not have been loaded already by the time the
modifier runs.

The solution is simply to make sure that the volume
is loaded. This is similar to the Volume Displace modifier.
2020-11-04 13:21:43 +01:00
f7320c3bf1 Fix T82292: Set encoding for keymap export to UTF-8
Keymaps have previously been exported with an encoding dependent
on the current system locale. This caused issues when the
keymap contained non-ASCII characters, for instance in a string
property for an operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9449
2020-11-04 13:20:10 +01:00
31a620b942 Cycles API: encapsulate Node socket members
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.

The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.

The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.

Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various modified methods
on Nodes in favor of Node::is_modified which checks the sockets'
update flags status.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8544
2020-11-04 13:03:33 +01:00
ba6977cb8b Fix assert on mouseover of blocks not using the layout system
When there was an active button in the "old" block from the last redraw,
this code tried to replace its pointer in the new block's button groups.
But in cases like the outliner or file browser, there are no groups
because the block doesn't use the layout system at all. This commit
just tweaks the assert to check whether there are any button groups.
2020-11-04 12:46:05 +01:00
a4a848d01b Merge branch 'blender-v2.91-release' 2020-11-04 22:17:29 +11:00
a0db971acf UI: disable add-object tool for 2.91 2020-11-04 22:16:03 +11:00
febfe436b9 Merge branch 'blender-v2.91-release' 2020-11-04 21:59:14 +11:00
e6a940a9b6 Merge branch 'blender-v2.91-release' 2020-11-04 21:59:10 +11:00
819a9622e9 CMake: remove -fmacro-prefix-map from build-info
Quotes caused build-info to fail,
remove these flags since they're not necessary.
2020-11-04 18:41:40 +11:00
9af147b5d3 Cleanup: make format 2020-11-04 02:14:48 -05:00
0523994687 Fix T63495: Add torus changes size each time when unit scale != 1.0
This matches behavior in WM_operator_view3d_unit_defaults.
2020-11-04 18:11:04 +11:00
029e1f066e Cleanup: Add BLI prefix to some BLI_noise functions 2020-11-04 02:07:21 -05:00
d3bcbe10c2 PyAPI: add Struct.is_property_set(..., ghost) option
This exposes the use_ghost argument to RNA_property_is_set_ex.
2020-11-04 18:06:34 +11:00
72f8a08880 CMake: use path_ensure_trailing_slash for fmacro-prefix-map
Use the native system slash so this can work on windows.
2020-11-04 16:00:37 +11:00
43a2494058 CMake: add path_ensure_trailing_slash utility macro 2020-11-04 15:59:55 +11:00
2f7ec507f4 Cleanup: spelling in curve.c 2020-11-04 15:59:51 +11:00
18729aff27 Merge branch 'blender-v2.91-release' 2020-11-04 15:47:06 +11:00
d3b85af6ca Fix T49850: Detailed curves are heavily reduced
Divide the threshold by the resolution to prevent duplicates
being detected in high resolution curves.
2020-11-04 15:39:41 +11:00
0511640815 Fix assert on mouseover of blocks not using the layout system
When there was an active button in the "old" block from the last redraw,
this code tried to replace its pointer in the new block's button groups.
But in cases like the outliner or file browser, there are no groups
because the block doesn't use the layout system at all. This commit
just tweaks the assert to check whether there are any button groups.
2020-11-03 22:03:08 -06:00
293cc70e4f Update RNA to Manual mapping 2020-11-03 22:56:57 -05:00
a31039e1ed Merge branch 'blender-v2.91-release' 2020-11-04 14:54:11 +11:00
0eb1cceea1 Fix T65449: Rip wire edges show error even when it works
Thanks to @zeddb for finding the root cause.
2020-11-04 14:52:45 +11:00
11843e7c29 UI: set the message for disabled vertex weight operators 2020-11-04 11:36:55 +11:00
951758c01f Merge branch 'blender-v2.91-release' 2020-11-04 11:33:12 +11:00
4d358855b8 Cleanup: avoid back-slash line continuations 2020-11-04 11:31:43 +11:00
ffa7bfdda5 Cleanup: unused argument 2020-11-04 11:28:31 +11:00
Jesse Y
c861517ca6 UI: Swap order of "Fade Inactive Geometry" in overlays popover
This simply makes the panel a bit nicer given how things are layed out--
the items with larger visual weight are grouped at the top.

Differential Revision: https://developer.blender.org/D9366
2020-11-03 18:21:02 -06:00
101c3d4ce4 Fix T60517: "Fix Deforms" crashes for meshes without vgroup data 2020-11-04 11:13:39 +11:00
564f3be20a Merge branch 'blender-v2.91-release' 2020-11-04 00:04:15 +01:00
c9fb25342b Fix T81799: Enable use self in trimming tool booleans
This enables self intersections in the sculpt trimming tools boolean operations.
This should fix wrong booleans results after using the operator to add new disconnected
geometry with the join mode.

Reviewed By: sergey

Maniphest Tasks: T81799

Differential Revision: https://developer.blender.org/D9423
2020-11-04 00:03:09 +01:00
e836c806e4 Fix T81842: Cloth brush not creating simulation areas for each tiling symmetry pass
The cloth brush fixed simulation areas are created using the initial_location variable in the
 StrokeCache. This variable was not being updated by tiling symmetry, so all symmetry passes
were using the same simulation area location.

Reviewed By: sergey

Maniphest Tasks: T81842

Differential Revision: https://developer.blender.org/D9421
2020-11-04 00:01:33 +01:00
a5aa56cd71 Fix mask extract and slice not preserving mesh symmetry options
When extracting new objects from a mesh in sculpt mode, it makes sense to keep
the current symmetry options and settings in the new mesh. In previous versions symmetry
options were stored in the tool settings, so this bug was not that obvious.

This also preserves the remember settings in the new object, which is also the desired
behaviour.

Reviewed By: sergey, mont29

Differential Revision: https://developer.blender.org/D9417
2020-11-03 23:59:24 +01:00
0dd599f916 Fix mask slice to new object preserving the mask
If the new object contains the mask it always needs to be cleared before starting
sculpting on it.

This fix was also committed before in the mask extract operator.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9416
2020-11-03 23:57:12 +01:00
dc3fb012e7 Fix T82297: Brush alpha not affecting smear tools strength
The strength of this brush needs to take alpha into account

Reviewed By: sergey

Maniphest Tasks: T82297

Differential Revision: https://developer.blender.org/D9419
2020-11-03 23:55:39 +01:00
4413f481be Merge branch 'blender-v2.91-release' 2020-11-03 16:31:17 -06:00
9e8a488af2 Fix T81691: Use-after-free with property search and hovered button
The list of buttons in the button group needs to be updated to take into
account the old button inserted into the button list for the new block.

Differential Revision: https://developer.blender.org/D9428
2020-11-03 16:30:58 -06:00
47876e9c5e Merge branch 'blender-v2.91-release' 2020-11-03 16:25:47 -06:00
5650468c84 Property Search: Fix missing update switching tabs after search
What I thought was an "optimization" was really a bug. The "use search
for expansion" value needs to be set for every panel, even panels in
other tabs. Otherwise it won't be properly set when switching back to
a tab that was visited during search.

Differential Revision: https://developer.blender.org/D9427
2020-11-03 16:24:22 -06:00
e29206f86a Cleanup: Remove broken/deprecated setting of color-ramp button step size
Setting the button's step size like this wouldn't work anymore after
e6f0b60c2e, which is reported in T81794. Instead, the step size should be set
for the RNA property, as proposed in D9277. That will be committed separately
as bug fix.
2020-11-03 22:31:46 +01:00
db7cf3652c Fix for previous cleanup commit 2020-11-03 15:26:23 -06:00
cabec08253 Cleanup: Clang tidy 2020-11-03 15:12:50 -06:00
f109b63431 Merge branch 'blender-v2.91-release' into master 2020-11-04 01:58:10 +05:30
Ankit Meel
8f2ebcf93f macOS: find Jack framework in system directories
Until it is decided whether to ship JACK with pre-compiled libraries,
search for the same in system directories.

Ref T79261
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9436
2020-11-04 01:53:33 +05:30
fe7093fae4 Cleanup: Remove dead code in bevel operator
The `poll_property` callback is only used when the `ui` callback isn't
defined.
2020-11-03 14:10:20 -06:00
76683af38c Cleanup: Declare variables where initialized 2020-11-03 13:57:20 -06:00
e3858f4716 Fluid: Updated APIC plugin
Updated version of APIC plugin in order to resolve ASAN issues.
2020-11-03 19:34:31 +01:00
57d1aea64f Cycles: add support for BVH refit in OptiX
This avoids recomputing the BVH for geometries that do not have changes in topology but whose vertices are modified (like a simple character animation), and gives up to 40% speedup for BVH building.

This is only available for viewport renders at the moment.

Reviewed By: pmoursnv, brecht

Differential Revision: https://developer.blender.org/D9353
2020-11-03 18:05:29 +01:00
216880bb47 GPencil: Reorganize Cleanup menu
Reviewed by @mendio
2020-11-03 17:22:03 +01:00
7567086276 GPencil: Add Recalculate Geometry operator to Cleanup menu
This operators was only accesible using the search menu.
2020-11-03 17:22:03 +01:00
ed4540b799 Fix paste f-curve modifiers default "Only Active" value
The tooltip implies that this option should be off per default instead
of on. Some talking with the animators at the studio and in the
animation module confirmed that this seems to be the most logical
default.
2020-11-03 17:21:14 +01:00
5deb2d42d9 Merge branch 'blender-v2.91-release' 2020-11-03 16:39:27 +01:00
0cf46631e1 Fix T82356: Gpencil merge freezes Blender
The `gps_next` variable had a typo error and was wrongly used as `gps->next`
2020-11-03 16:38:43 +01:00
e699546bde Fix T81756: relinking multiple links to group input removes links
The links where added to the socket one after the other. However,
the virtual socket had a link limit of 1, so whenever a new link was
added, the previously added one was removed.

There is not really a reason for why the link limit should be 1 instead
of something higher. I'm setting it to the max value: `0xFFF`.

I'm also setting the `input_link_limit` to that value. Blender does not
need this currently, but addons might have input sockets that allow
more than one incident link.
2020-11-03 15:11:40 +01:00
313086e212 GL: Fix default framebuffers being bound using srgb
Default backbuffers needs not to be bound with sRGB encoding
enabled. This works when using `GPU_framebuffer_restore` but
using `GPU_framebuffer_bind` would trigger the wrong behavior.

This fix T81969 UI turns whiteish when playing video sequence
based on a scene and moving in the image editor after saving
2020-11-03 14:44:28 +01:00
6fdcca8de6 Materials: add custom object properties as uniform attributes.
This patch allows the user to type a property name into the
Attribute node, which will then output the value of the property
for each individual object, allowing to e.g. customize shaders
by object without duplicating the shader.

In order to make supporting this easier for Eevee, it is necessary
to explicitly choose whether the attribute is varying or uniform
via a dropdown option of the Attribute node. The dropdown also
allows choosing whether instancing should be taken into account.

The Cycles design treats all attributes as one common namespace,
so the Blender interface converts the enum to a name prefix that
can't be entered using keyboard.

In Eevee, the attributes are provided to the shader via a UBO indexed
with resource_id, similar to the existing Object Info data. Unlike it,
however, it is necessary to maintain a separate buffer for every
requested combination of attributes.

This is done using a hash table with the attribute set as the key,
as it is expected that technically different but similar materials
may use the same set of attributes. In addition, in order to minimize
wasted memory, a sparse UBO pool is implemented, so that chunks that
don't contain any data don't have to be allocated.

The back-end Cycles code is already refactored and committed by Brecht.

Differential Revision: https://developer.blender.org/D2057
2020-11-03 16:35:44 +03:00
91d320edc3 Cycles: immediately store the used_shader list in Blender interface.
Uniform attributes require immediate access to the shader list
in object update code, so setting the field can't be deferred
to a background task. This required adding a parameter to the
clear method of Geometry.

Ref D2057
2020-11-03 16:35:43 +03:00
9bc177d8de Materials: support true float4 attributes in the Attribute node.
Add a new Alpha socket to the Attribute node that outputs the
fourth component of the attribute. Currently the only such
attribute is vertex color, but there may be more in the future.
If the attribute has no alpha channel, the expected value is 1.

The Cycles code is already refactored and committed by Brecht.

Ref D2057
2020-11-03 16:35:43 +03:00
da93da45ee Docs: add comments to some surface deform internal structures 2020-11-04 00:04:48 +11:00
3c953a1b09 Fix T82074: Volume to Mesh normals are inverted
OpenVDB seems to have a different winding order convention.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9434
2020-11-03 14:01:07 +01:00
7ceb622fd3 Cleanup: doxy param syntax 2020-11-04 00:01:00 +11:00
f278d814fd Cleanup: spelling 2020-11-03 23:59:24 +11:00
b1efea986d Fix sequence tests writing HTML report to wrong directory
It was missing from tests/report.html that gathers all tests reports.
2020-11-03 13:31:31 +01:00
c21ba10e0b Merge branch 'blender-v2.91-release' 2020-11-03 13:22:22 +01:00
df2a0cd6f4 Fluid: Fix crash with viewport display options
Overlay extras should not be drawn outside of the fluid domain cache range.
2020-11-03 13:21:07 +01:00
c32bee0099 Cleanup: Use recently added helper function to find File Browser UI data
`ED_fileselect_handler_area_find()` was added in a750acab78 and makes this
case more readable and avoids code duplication as well.
2020-11-03 12:27:20 +01:00
bc0a6b0400 Fix T71759: Sculpt/Vertex/Weight Paint Brush Size Gets Undone After Undoing a Stroke.
Add code preserving scene's toolsettings accross undo.

IDPointers are dealt with special care, we try to keep existing ones for
some (like brushes) when possible.

Note that this covers ToolSettings, Brushes and Palettes currently.

I'm not especially happy about how this new code mixes with existing
'foreach_id' one, in particular in scene. But cannot think of a better,
more generic way to do it currently.

Maniphest Tasks: T71759

Differential Revision: https://developer.blender.org/D9311
2020-11-03 12:09:00 +01:00
5610ccdc08 Add a callback to IDTypeInfo to allow preservation of some data accross memfile undos
This is essentially adding that new callback, and using it only for already
existing Scene's 3DCursor.

Note that the place where this is called has been moved again, after all
have been lib-linked, such that those callbacks may also work on ID pointers.

Maniphest Tasks: T71759

Differential Revision: https://developer.blender.org/D9237
2020-11-03 11:40:29 +01:00
da03eb854b Merge branch 'blender-v2.91-release' 2020-11-03 20:54:26 +11:00
e03575768f Merge branch 'blender-v2.91-release' 2020-11-03 20:54:22 +11:00
fc9f1b1754 Fix T81988: Surface Deform "Bind" causes vertices to spike
Surface deform weight calculation assigned weights in a non-uniform
way that caused vertices to deform upon binding.

This was caused by the face-corner angle being used in
calculations which where squared & scaled.
Causing a triangle fan of many thin faces to have a much greater
influence compared to the same shape made from a single triangle.

Change the calculation of the weight so each face-corner is scaled
by it's angle.
2020-11-03 20:52:53 +11:00
d93a6cdf00 DrawManager: Cleanup unneeded memory allocation
`tris_per_mat` is only valid for the final buffer cache. It was
allocated for every buffer cache.
2020-11-03 10:44:56 +01:00
093dfdfc94 Merge branch 'blender-v2.91-release' 2020-11-02 22:59:00 -07:00
Manuel Castilla
20e982e78d Fix T77161: Outliner - Hiding a Collection does not gray out children objects
Ensure that When checking "Hide in Viewport" option for a collection
that child objects are drawn grayed out for consistency with the
"Disable in Viewports" toggle.

For checking an object visibility in the viewport the flag
BASE_VISIBLE_VIEWLAYER should be used instead of BASE_VISIBLE_DEPSGRAPH
because the latter ignores viewport visibility.

Manifest Task: T77161

Differential Revision: https://developer.blender.org/D7904
2020-11-02 22:56:44 -07:00
Jaggz H
fbf2908674 Outliner: Add "Selectable" object filter
This addition to the filters allows the user to enable the
outliner tree to restrict the listing to only Selectable objects.

Differential Revision: https://developer.blender.org/D7310
2020-11-02 22:09:47 -07:00
084db58fbd Cleanup: Use typedef for bevel angle kind enum
This makes debugging slightly easier, and makes the code slightly more
explicit about its intentions.
2020-11-02 23:05:15 -06:00
6290bc4a37 Merge branch 'blender-v2.91-release' 2020-11-02 22:35:15 -06:00
c6d8300823 Fix T82120: Arc miter bevel creates miters on straight edges
In some situations where two beveled edges were very close to in-line
but not quite straight, bevel would build a miter when it shouldn't.
The code that chose whether to use a miter at each vertex was slightly
incorrect.

For outer miters there is a check for 3 or more selected edges, but an
inner miter can still be useful with only two beveled edges at a vertex,
so we can't use that here. Instead I changed the check for in-line edges
to run before determining whether the angle is reflex or not. The logic
ends up a bit more straightforward as well. This doesn't completely
remove the rather strange looking triangle vertex meshes at each corner,
but it does make it stable when locations are slightly adjusted.

The only other place this `edges_angle_kind` function was used is for
profile=1.0 vertex meshes. I tested and made sure that still works well.

Differential Revision: https://developer.blender.org/D9420
2020-11-02 22:34:57 -06:00
23f3c30b58 Fix T64138: Windows Ink continuous grab at window edge.
WM_POINTERLEAVE occurs when the pen goes out of range or when a
hovering pen leaves the window's boundary. When leaving the window
boundary the xy position is invalid for some Wacom devices.

This change removes creation of GHOST_EventCursor during
WM_POINTERLEAVE events. This prevents unexpected jumping behavior
during continuous grab.
2020-11-02 19:02:16 -08:00
3049704b15 Cleanup: Remove unused parameter in panel code
This is no longer used after rB54da72d3cd546ecb, but passing it to a
recursive call hid the warning.
2020-11-02 18:00:46 -06:00
c067b7460a Fix C operators can't set default display or sort type for File Browser
`WM_operator_properties_filesel()` allows C operators to set a display or sort
type for the File Browser to use. But the File Browser would always override
that because of an invalid `_is_set()` check. (The operators don't actually set
the value, they only set the property's default value.)

The only operator affected by this is "Recover Auto Save". It is supposed to
show a vertical list ordered chronologically. It used settings from the
previous File Browser usage before this patch.

Operators using the File Browser should generally use
`FILE_DEFAULTDISPLAY`/`FILE_SORT_DEFAULT` now, except if they have a reason not
to. See comments at their definition.

----

This makes it so operators that set a different display or sort type
don't change the sort or display type for the next File Browser operation.
So using "Recover Auto Save" entirely isolates display and sort type from other
operations.

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

Reviewed by: Bastien Montagne
2020-11-03 00:00:41 +01:00
a750acab78 Fix possible use-after-free when closing Blender with File Browser open
I think there wasn't actually any issue currently, but only by luck. We still
passed around and NULL-checked a pointer to freed memory (the file operator,
`SpaceFile.op`) which is easy to break and should be avoided.
Noticed while testing D8598.
2020-11-03 00:00:41 +01:00
9cfcc27319 Cleanup: Mark arguments as const 2020-11-02 16:25:59 -06:00
e1665c3d31 VSE: Media transform redesign
This patch changes behavior of strip transform and crop feature.

Purpose of this change is to allow display arbitrary portion of input
image, simplify user interface and workflow.
Offset and Crop values in old files are converted in versioning.
Offset animation is also converted. Crop animation and animation of
crop or offset enable properties is not taken into account

Changes in behavior and interface:
- If image is added to timeline it is scaled to fit inside preview area
while maintaining aspect ratio. Image is centered. This is considered
as a baseline for further transformation.
- Scale and rotation was added, so it is possible to transform image at
it's original resolution.
- Crop will not affect image transformation (does not move image).
- Values of Crop and Transform Position are in pixels, these values are
corrected if preview is fraction of project resolution.
- Transform and Mirror panel has been removed and new Transform panel
and Crop panel is moved to Adjust panel. Mirror is now part of new
Transform panel.

Technical changes:
- Preprocessing stage must work on duplicated image, because original is
cached. Previously Crop and Offset could run at once and required only
one duplication of image. This is not the case with new algorithms, so
duplication on demand is implemented. Transformation can read original
image and will output new image that is safe to modify. It should be
possible to add crop step to transform algorithm, so that Crop won't
require previous duplication though.
- Use Crop and Use Translation checkboxes were removed. Individual
values are compared to default values to check if image needs to be
processed. In case of transform this will be done also if resolution of
source.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8393
2020-11-02 22:15:52 +01:00
6b3eca661d Revert "VSE: Media transform redesign"
This reverts commit 0277579b28.

This commit caused build errors on Linux.
2020-11-02 20:59:21 +01:00
b9ec6c305c Revert "Cleanup: store results of function calls in const values."
This reverts commit 20c4aa13de.

Wrong buggy commit breaking tests, and not actually adding anything to
code quality.
2020-11-02 20:31:12 +01:00
0277579b28 VSE: Media transform redesign
This patch changes behavior of strip transform and crop feature.

Purpose of this change is to allow display arbitrary portion of input
image, simplify user interface and workflow.
Offset and Crop values in old files are converted in versioning.
Offset animation is also converted. Crop animation and animation of
crop or offset enable properties is not taken into account

Changes in behavior and interface:
- If image is added to timeline it is scaled to fit inside preview area
while maintaining aspect ratio. Image is centered. This is considered
as a baseline for further transformation.
- Scale and rotation was added, so it is possible to transform image at
it's original resolution.
- Crop will not affect image transformation (does not move image).
- Values of Crop and Transform Position are in pixels, these values are
corrected if preview is fraction of project resolution.
- Transform and Mirror panel has been removed and new Transform panel
and Crop panel is moved to Adjust panel. Mirror is now part of new
Transform panel.

Technical changes:
- Preprocessing stage must work on duplicated image, because original is
cached. Previously Crop and Offset could run at once and required only
one duplication of image. This is not the case with new algorithms, so
duplication on demand is implemented. Transformation can read original
image and will output new image that is safe to modify. It should be
possible to add crop step to transform algorithm, so that Crop won't
require previous duplication though.
- Use Crop and Use Translation checkboxes were removed. Individual
values are compared to default values to check if image needs to be
processed. In case of transform this will be done also if resolution of
source.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8393
2020-11-02 20:19:16 +01:00
5ed4e1e23a Fix T77819: Snap Incremental does not match grid in all cases
The behavior of the incremental snap did not take into account the
relative dimensions of the window, which resulted in a different behavior
if the area height was greater than the width.
2020-11-02 16:14:03 -03:00
ef4aa42ea4 UI: Enable writing global area data (top-bar, status-bar) to .blend's
There should not be much user visible here (other than T73668 being addressed).

I added the writing code already for the initial implementation of workspaces,
but we decided to keep it disabled until the top-bar design is more clear. It
was never planned to keep this disabled for so long.

Fixes T73668.
2020-11-02 18:35:13 +01:00
cf7343a355 Fix Cycles kernel compile error with NanoVDB because of type redefinition
Cycles defines some basic integer types since it cannot use the standard headers when
compiling with NVRTC. NanoVDB however only does this when the "__CUDACC_RTC__" define
is set and otherwise includes the standard "stdint.h" header which clashes with those typedefs.
So for compatibility do the same thing in the Cycles kernel headers. See also T81454.
2020-11-02 18:00:13 +01:00
1408052781 LibOverride: make some pose options overridable.
Request from the studio.
2020-11-02 17:29:04 +01:00
576bd98622 Grease Pencil UI code: use row for rows in the UI
Rename `col` to `row` when it's actually a row (and not a column).

No functional changes.
2020-11-02 17:18:55 +01:00
aee1e4fc6a UI: Simplify some tool icon geometry
Removing interior vertices can remove some complexity from the final
exports. Also improved the topology slightly in some cases.
2020-11-02 10:10:49 -06:00
20c4aa13de Cleanup: store results of function calls in const values. 2020-11-02 17:08:10 +01:00
db18ba07b5 Fix py-defined pointer properties wrong tag re ID ownership.
This fixes critical bug with liboverride when soe add-ons add some
RNA ID Pointer properties.

ID pointers should **never** have ownership of their ID when defined
from python.

(As a reminder, RNA properties owning their ID pointers are extremely
rare even from C code, only embedded IDs (root node trees, master
collections) and the shape keys snowflakes are concerned.)
2020-11-02 17:08:10 +01:00
4c460a2dbd Fix incorrect colors in grease pencil strength tool icon 2020-11-02 09:52:23 -06:00
7872bcafa0 Cleanup: Document output of BKE_object_where_is_calc and friends
Add a comment to the declaration of the `BKE_object_where_is_calc...()`
functions to explain where the result of the calculation is stored.

No functional changes.
2020-11-02 15:36:18 +01:00
7887e91d31 Cleanup: Sanitise return value of ED_object_parent_set()
Consistently return `false` from `ED_object_parent_set()` when parenting
is not possible. Before, when parent and child were the same object, the
function would return `true` even though the parent-child relation was
not made.

Just returning `false` in the `parent == child` case would break the
parenting operator, as `false` stops its loop over all selected objects.
This tight coupling caused T82312. The loop now has its own check for
this, so that it properly continues, and the implementation of
`ED_object_parent_set()` is decoupled from its surrounding code.

No functional changes.
2020-11-02 15:36:18 +01:00
417ba6aa1c GPencil: Cleanup comments typo error 2020-11-02 15:27:33 +01:00
b1213e8cf9 Add comment about size of generated previews of filebrowser thumnails. 2020-11-02 15:10:38 +01:00
42f6aada98 Fix crash opening some 2.4x .blend files with drivers or NLA editor
For example, outlinertest.blend from test240.zip.
2020-11-02 14:28:10 +01:00
dca65390f0 Another attempt at fixing T81963: Random rare crashes in override code.
Adding another pass of ensuring valid up-to-date pose data in RNA
function itself...
2020-11-02 11:58:01 +01:00
2b98a9269b LibOverride: Do not assert on missing operands in apply function.
This can happen after some changes in lib file and resync in user file
e.g..
2020-11-02 11:58:01 +01:00
f2c7b4a1c5 Re-enable WITH_COMPILER_SHORT_FILE_MACRO, fix build error.
The issue was in `buildinfo.c`:
  char build_c[xx]flags[] = BUILD_C[XX]FLAGS;

Non-escaped double-quotes were terminating the string early, and
causing the compile error. So use single-quotes.
2020-11-02 16:11:10 +05:30
19dec6c8a7 Turn off WITH_COMPILER_SHORT_FILE_MACRO temporarily.
It's causing build errors on compilers that I don't have. Turn it off
while I fix them.

Added in {rB1daa3c3f0a1cfd74bef527e0207f38154e591d46}.
2020-11-02 15:45:59 +05:30
b801369c8e Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-02 11:06:22 +01:00
9e736fc984 Revert "Parenting: fix return value when parenting object to itself"
This reverts commit ad35fa1993, it had
unintended side-effects (T82312).
2020-11-02 11:00:52 +01:00
1daa3c3f0a Clang/GCC: use relative path in __FILE__ macro
This change removes the user-specific information from
macros like `__FILE__` and keeps it relative to top level
source or build (for generated files) directory.
It makes traces concise.

Added option `WITH_COMPILER_SHORT_FILE_MACRO` enabled by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9386
2020-11-02 15:12:10 +05:30
cc09c0d048 Revert "Parenting: fix return value when parenting object to itself"
This reverts commit ad35fa1993, it had
unintended side-effects (T82312).
2020-11-02 10:11:46 +01:00
d49c71e96e Cleanup: use logging for "Found bundled Python" message
This was added when Python was initially bundled so any problems
finding Python could be investigated.

Move this to use logging so we can show this information when needed.
2020-11-02 19:33:32 +11:00
27acf8ced8 Cleanup: remove unused FileList.prv_w/h 2020-11-02 17:09:08 +11:00
0d10621630 Fix incompatible pointer types warning with GCC 2020-11-02 16:49:12 +11:00
Richard Antalik
c887a50f62 Add sequencer transform tests
Tests files are based on test from D8393

Test files should be in `lib\tests\sequence_editing`
These are files, I will add few more tests including animation test.
{F9155273}

Using generic tool to compare rendered vs reference image as other render engines.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9394
2020-11-01 21:34:18 +01:00
Richard Antalik
ea1c5a6c15 Rename BKE_sequencer.h
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9349
2020-11-01 21:10:36 +01:00
a1f46ac9dc Revert "PyAPI: remove bpy.app.binary_path_python"
This reverts commit 6527a14cd2.

Some 3rd party scripts made use of this so scripts can work with
2.90 to 2.92, although eventually this can still be removed.
2020-11-01 19:11:08 +11:00
4012c6e86f Merge branch 'blender-v2.91-release' 2020-11-01 18:22:19 +11:00
f4d6823fd6 Merge branch 'blender-v2.91-release' 2020-11-01 18:22:16 +11:00
f2fb26575c Merge branch 'blender-v2.91-release' 2020-11-01 18:22:12 +11:00
276d19f63b PyAPI: set sys.executable to None when Python can't be found
Without this, sys.executable may be set to Blender's
executable instead.
2020-11-01 18:12:26 +11:00
9de42337c8 Cleanup: Fix typo in comment 2020-10-31 22:54:13 -05:00
c271600101 Fix T82089 Boolean on empty mesh with collection fails.
For the fast solver, there was an optimization carried over
from the non-collection case for empty meshes which did not
work in the chained boolean code for collection operands.
Removed that optimization in the collection case.
2020-10-31 20:48:24 -04:00
4158b7f674 Fix T82089 Boolean on empty mesh with collection fails.
For the fast solver, there was an optimization carried over
from the non-collection case for empty meshes which did not
work in the chained boolean code for collection operands.
Removed that optimization in the collection case.
2020-10-31 20:07:00 -04:00
c249eb7a8d Fix new boolean performance bug.
The code that decided to use a faster double version of plane
side testing forgot to take an absolute value, so half the time
the exact code was being used when it was unnecessary.
2020-10-31 17:21:18 -04:00
30826a5e49 Fix new boolean performance bug.
The code that decided to use a faster double version of plane
side testing forgot to take an absolute value, so half the time
the exact code was being used when it was unnecessary.
2020-10-31 16:46:11 -04:00
64faa59846 Cycles: Fix debug compilation after tile stealing commit 2020-10-31 14:04:30 +01:00
e7dc3c91ab GPencil: Change maximum limit of Join stroke
Also, clarify comments.
2020-10-31 09:37:10 +01:00
fe90bb86c0 Merge branch 'blender-v2.91-release' 2020-10-31 09:25:13 +01:00
9af6c041e8 Fix T82265: GPencil interpolate crash when next frame was NULL
If the next frame of the layer was NULL and it was not the active layer crashed.
2020-10-31 09:24:43 +01:00
517ff40b12 Cycles: Implement tile stealing to improve CPU+GPU rendering performance
While Cycles already supports using both CPU and GPU at the same time, there
currently is a large problem with it: Since the CPU grabs one tile per thread,
at the end of the render the GPU runs out of new work but the CPU still needs
quite some time to finish its current times.

Having smaller tiles helps somewhat, but especially OpenCL rendering tends to
lose performance with smaller tiles.

Therefore, this commit adds support for tile stealing: When a GPU device runs
out of new tiles, it can signal the CPU to release one of its tiles.
This way, at the end of the render, the GPU quickly finishes the remaining
tiles instead of having to wait for the CPU.

Thanks to AMD for sponsoring this work!

Differential Revision: https://developer.blender.org/D9324
2020-10-31 01:57:39 +01:00
523414dda2 Cleanup: clang-format 2020-10-31 01:57:39 +01:00
316a5914bc Previous check seems to have a race condition, resulting in Wintab not being enabled. 2020-10-30 16:29:04 -07:00
af7b0003cb Add explanation for dequing Wintab PACKETs during WT_PACKET event into a local queue to consume during WM_* mouse events. 2020-10-30 16:29:04 -07:00
50558416b9 Commented assumption was incorrect, using tickCountToMillis causes underflow when compared to current time. 2020-10-30 16:29:04 -07:00
792e145c22 Cleanup: rename functions for consistency with other process*Events functions. 2020-10-30 16:29:04 -07:00
2b01c5a148 Cleanup: Use C style comments, punctuation, and capitalization.
Added missing function documentation.
2020-10-30 16:29:04 -07:00
632b345d35 Update tooltip, Tablet API can now be changed at runtime. 2020-10-30 16:29:04 -07:00
cbc1c83154 Remove Wintab logging. 2020-10-30 16:29:04 -07:00
a9d6eb8f0b Add Wintab debug logging as a CMake option WITH_WINTAB_DEBUG.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
d9b0ef2de4 Finish the comment's thought explaining pessimistic button ups events for
Wintab.
2020-10-30 16:29:04 -07:00
5badaa8390 Return of the Wintab refactor.
Previously Wintab was handled by saving the most recent tablet pressure and tilt information and deferred appending tablet infromation to Windows mouse events. This caused synchronization issues evident at the beginning and ending of strokes where pressure and tilt were either ahead or behind in time from mouse button up or down events. This also dicarded swaths of data which resulted in blockly grease pencil lines most apparent when a context switch resulted in several coalesced mouse events.

This patch changes the behavior of Wintab to instead rely entirely on Wintab information for pressure, tilt, position, and button input.

Wintab has several design decisions and conventions which complicate relying soley on it's input while retaining current workflows reliant on non-API behavior. For example, many device optionally allow the user to map barrel buttons to non-mouse actions. These mappings may or may not modify the intended behavior when touching the stylus down, such as scroll vs alt mappings. This behavior is not exposed in the Wintab API, but Wintab will continue updating button state sans this necessary context.

To work around the problem, this refactor synchronizations tablet input to Windows mouse down and up events, this captures events which should result in pen input while allowing events such as pen scrolling. Until a Windows mouse down event fires Wintab input is left unprocessed; when a Windows up event occurs Wintab is processed until a corresponding button up event is found.

Wintab allows for either button state or changes to be reported, but not both. An earlier refactor tried to use button changes to let state to be managed by Wintab. This was replaced when it was found that button change events were unreliable at corner cases such as switching windows. It was also found that with Wacom drivers Wintab peek functions would modify events in the queue causing errant and loss of button events.

For the latter stated reason this patch opts to read all Wintab events into a queue as they arrive, removing events as they become stale. This was chosen over using Wintab peek functions due to the afformentioned issue. As a bonus this seems to work better as it prevents the queue in Wintab from filling, thus neither a flood of events need to be handled when Wintab processing begins and a Wintab implementation need not be trusted to overwrite old events in it's queue.

Maniphest Tasks: T75566

Differential Revision: https://developer.blender.org/D7840
2020-10-30 16:29:04 -07:00
0ee4b0b965 Before a wintab button event is generated, generate a GHOST mouse move
event to the button down location as this should be a more accurate point
of contact than the last mouse move event.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
7599571904 Adding explanitory comment to explain why tablet API check is necessary
for Pointer input even when Wintab should be preventing Pointer events.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
a080accdb6 When there are not associated button events, assume there is no button
events until one is found. This prevents errant cursor moves that occur
before the Wintab button event is reported. We need to skip these events
because if no button event exists, we generate one assuming it will either
arrive later in the Wintab queue or that the button was from a non-Wintab
device. For the case that this was generated by a non-wintab device, such
as buttons mapped to mouse on the tablet pad, these cursor move events can
significantly move the cursor from the intended click position.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
1f25235ec3 Clarify comment to be more specific so that in the future someone knows
the issue with Wintab button events are more significant than simply
setting what buttons should receive button up/down events during context
initialization.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
efe3e4f023 Save Wintab packets to a local queue as WT_PACKET events arrive or when
handling mouse input. This Wintab to mouse synchronization issues, and
likely prevents queue exhaustion for some Wintab implmenetations.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
d58387cdda Correcting the type for indexing Wintab buttons.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
14cddad034 Change updateWintab interface to include whether window is visible so that
window intitialization can specify whether it will be visible regardless
of whether it is yet visible.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
b98ea1b268 Revert "Mask all button down/up and switch back to using relative button input."
This reverts commit 045aaf6f78f1fbb6e2bbefd234b7bae04844d42b.
2020-10-30 16:29:03 -07:00
c4821079b7 Fix type for physicalButton in wintabMouseToGhost.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
a6e31482e9 Fix return value of WTPacketsGet.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
a5f3c0e563 Move assignments into initializer list for GHOST_EventButton
and GHOST_EventCursor.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
1b535e8719 Mask all button down/up and switch back to using relative button input.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
3281507f7b Document inline that PACKETDATA and PACKETMODE modify external headers to
discourage reducing their scope to the only place they're used internally.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
538a2ac58f Allow double button up, otherwise there may be a trailing 0 pressure line.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
7c84f25453 Fix T75566
Button events now include tabletdata, so move is unnecessary.

Generate mouse button events when the system has an event but Wintab did not find a correlated event.

Only filter mouse button events, not Win32 Pointer events.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>

Maniphest Tasks: T75566

Differential Revision: https://developer.blender.org/D7404
2020-10-30 16:29:03 -07:00
70ca48b67f Button events now include tabletdata, so move is unnecessary.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
abbdfc8bf7 Revert "Revert "Windows: support high resolution tablet pen events for Wintab""
This reverts commit e90d8422d0.
2020-10-30 16:29:03 -07:00
c503c5f756 Fix T82244: Crash when trying to use the rotate operator on the timeline
Some tranform modes are not expected to be used in the `SPACE_ACTION`.
2020-10-30 20:13:05 -03:00
81090ded0d Fluid: Removed binary_python from fluid script
This hack is no longer required. It was fixed in rB52b38d9c3d84 and temporarily disabled in rBa877248ac203.
2020-10-30 18:36:21 +01:00
99a7c917ea Sculpt: Dyntopo detail size edit operator
This introduces a new operator to edit the detail size of constant
detail mode in dyntopo. The way this operator works and the
functionality it provides is similar to the "Voxel size edit" operator
for the voxel remesher.

It also includes a sample mode. When pressing Ctrl, the detail size
will be sampled from the surface under the cursor, updating the
preview in real time. This allows quick resolution changes without
using the operator multiple times.

The operator is set to Shift + D, replacing the old way to change
the constant detail size of dyntopo. Shift + R will remain available to
be enabled when the voxel remesher works with dyntopo. Deciding
if both detail sizes can be unified needs a separate discussion as the
new dyntopo can work with detail sizes in parts of the mesh that can
easily crash the remesher.

The structure of these operators is similar, but the data they control,
ranges, drawing and setup functions are completely different, making it
hard to merge them into one.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9355
2020-10-30 18:13:25 +01:00
39be996452 Sculpt: Add pie menu for global automasking options
Global automasking options are usually turned on/off for quick
adjustments both in brushes and filters, so it is convenient to have them
in a pie menu.

This uses the Alt + A shortcut.

Reviewed By: dbystedt, HooglyBoogly

Differential Revision: https://developer.blender.org/D9282
2020-10-30 18:09:54 +01:00
15cb67e0b0 Sculpt: Add normal orientation to lasso trim tool
This adds an option to orientate the trimming shape using the surface
normal instead of the view when lasso trim is used.

Reviewed By: dbystedt, sergey

Differential Revision: https://developer.blender.org/D9231
2020-10-30 18:09:03 +01:00
492a9e4023 Fix crash when using multiple Sculpt Vertex Color layers for rendering
This line was probable left there after a bad merge.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9367
2020-10-30 18:07:51 +01:00
0270223552 Merge branch 'blender-v2.91-release' 2020-10-30 17:37:23 +01:00
8b806c86e1 Fix T82027, T81718: Cycles crash with volume animation playback 2020-10-30 17:36:41 +01:00
62e532785d Refactor: move WorkSpace .blend I/O to IDTypeInfo callbacks 2020-10-30 16:32:55 +01:00
a877248ac2 Fluid: Switch to binary_python
This change is required since rB52b38d9c3d84. Why a bpy reference is there in the first place is to be investigated.
2020-10-30 16:25:43 +01:00
12c92433d8 Refactor: move bScreen .blend I/O to IDTypeInfo callbacks
I could not easily move `direct_link_screen` yet, because it
has a return value. That has to be solved differently at some point.
2020-10-30 16:01:26 +01:00
e6f61a4a37 GPencil: New material parameter to rotate texture
Add a parameter to rotate the texture for Dots and Squares

Differential Revision: https://developer.blender.org/D9369
2020-10-30 15:45:00 +01:00
aacdc39958 Merge branch 'blender-v2.91-release' into master 2020-10-30 15:34:12 +01:00
8b836f6894 Fix (unreported) buffer-overflow in new lattice code.
Follow-up to rBc0beeeb5de0cbc, fixing overflow accesses on arrays
introduced by rB042143440d76.

It's never 'OK' to access invalid memory...
2020-10-30 15:33:25 +01:00
fc9ec1b9d8 Refactor: move Area .blend I/O to blenkernel
There should be no functional changes.
Eventually, it would be good to handle the different space types
using callbacks.

Ref T76372.
2020-10-30 15:28:17 +01:00
a8c165f2a4 Merge branch 'blender-v2.91-release' 2020-10-30 15:16:04 +01:00
a1d8559a42 Fix Cycles map range node missing clamp socket
No effect on the Blender integration yet, but needs to be solved for the
upcoming change to encapsulate sockets.
2020-10-30 14:58:34 +01:00
c0beeeb5de Fix buffer-overflow in lattice deform evaluation
Caused Victor.blend from the cloud to crash with ASan. Four floats are
fetched from the stack, but the buffer was only three wide.

Caused by 042143440d. Issue was probably harmless since the fourth
element wasn't actually touched.
2020-10-30 14:56:32 +01:00
bcb612e361 Refactor: move view3dshading .blend I/O to blenkernel
Ref T76372.
2020-10-30 14:44:03 +01:00
ada45463b3 Refactor: move ParticleSettings .blend I/O to IDTypeInfo callbacks 2020-10-30 13:43:34 +01:00
f6d9a36534 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-30 13:17:49 +01:00
ad35fa1993 Parenting: fix return value when parenting object to itself
Ensure parenting an object to itself is seen as error, by returning
`false`.

This error was introduced as part of a supposed-to-be-non-functional
cleanup rBb8d4a2aff8069dd7d6fb91ad0d9427eed489b68f.
2020-10-30 12:40:03 +01:00
4c7b1766a7 Fix undo steps not allowing re-using old BMain in non-global undo.
Non-memfile undo steps never properly initialized the flag allowing to
re-use old Main data during undo/redo. This lead to doing a complete
full re-reading of data when undoing/redoing mode switches e.g.

Note that current undo system is supposed to support any kind of mode
switch across those steps, however this needs to be properly deeply
tested, so only comitting this to master. It would be way too risky for
2.91 release.
2020-10-30 11:51:48 +01:00
30b17e30f8 Fluid: Cleanup for APIC debug build setup
Fixes build issue
2020-10-30 11:15:24 +01:00
57d77bd922 Cleanup: malformed doxygen sections 2020-10-30 21:10:09 +11:00
9333f660d0 Docs: note the purpose of UserDef_Runtime.is_dirty 2020-10-30 21:00:43 +11:00
08d40ecbd8 Merge branch 'blender-v2.91-release' 2020-10-30 20:56:55 +11:00
62b68745fd Merge branch 'blender-v2.91-release' 2020-10-30 20:56:52 +11:00
ebb8f8fffc Merge branch 'blender-v2.91-release' 2020-10-30 20:56:48 +11:00
841517ca81 Merge branch 'blender-v2.91-release' 2020-10-30 20:56:45 +11:00
ff73dc244c Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-30 10:52:25 +01:00
9ab4536218 Outliner: use undo-group for outliner mode switching
Switching modes no longer adds multiple undo steps
from a user perspective.
2020-10-30 20:50:27 +11:00
3cc6b423b1 Object: use undo-group for object.switch_object
object.switch_object no longer adds multiple undo steps
from a user perspective.
2020-10-30 20:50:22 +11:00
8d2576fd29 Undo System: support for grouping steps with begin/end calls
This adds support for treating multiple undo steps as a single step
from the user perspective.

This is needed for outliner mode switching and `object.switch_object`
operator which change active object and mode in a single action.
2020-10-30 20:48:15 +11:00
3624c06007 Fix outliner mode toggling with multi-object pose/edit mode
For edit/pose modes clicking in the mode-column would include other
selected objects (besides the active object), causing other objects to
remain in the mode even though Control wasn't held.

Also replace `ED_object_mode_generic_exit(...)` on all objects with a
single call to `ED_object_mode_set(...)` so switching modes will only
exit the current mode, leaving objects in other modes unchanged.
2020-10-30 20:48:10 +11:00
8bdf191461 Fluid: Added APIC simulation method
Basic support for velocity updates with the APIC method.

This commit adds APIC to the already existing dropdown menu for the simulation method. The APIC plugin within Mantaflow has been updated to the latest version.
2020-10-30 09:52:05 +01:00
e3e5d595f6 Outliner: Remove "ID" from tooltip
The concept of IDs shouldn't be exposed to the user.
2020-10-29 21:50:47 -06:00
b018582cd3 Cleanup: parse '--thread' as part of ARG_PASS_ENVIRONMENT
While this isn't needed at the moment, it's possible
the animation player uses the scheduler in the future.
2020-10-30 13:30:16 +11:00
6ab8cbc68c Text: support "Text to 3D Object" for read-only data
Add poll function for read-only text data,
for operators that don't require the text to be editable.
2020-10-30 12:51:38 +11:00
6250a8725e Cleanup: Use an enum to set instanced panel expansion
This commit uses an enum to access expansion for specific panels for
each modifier, constraint, etc. Even though these values are quite simple,
 this can help make the code more explicit when the ui_expand_flag is
accessed directly. Also update comments about this bitfield to make
them consistent.
2020-10-29 19:34:29 -05:00
81a0fffb2d Fix T82205: Curve Hooks not working
Caused by my own cleanup commit rBa308607a5334. Just a simple copy-paste
error. Here the difference between `curve` and `editnurb` makes quite a bit
of difference.
2020-10-29 18:21:48 -05:00
d35cd32d56 Cleanup: Use doxygen sections
After the changes in D7997, this whole file will use doxygen sections.
2020-10-29 17:37:44 -05:00
e997eb8bf7 GPencil: Fix compiler warnings
These warnings were not vivible in MSVSC
2020-10-29 23:32:19 +01:00
9e85812acc Fix macOS mouse positions inaccuracy
Don't use the current mouse position at the time the event is handled, but
rather the position at the time of the event. This should make e.g. brush
stroke paths more accurate.

In addition, this may solve issues with other software that does mouse
position smoothing. Ref T82143.

Use of the current mouse position was added in 12b642062c as part of a
large commit that also made continuous grab work. But it appears to still
work getting the mouse position from the event.
2020-10-29 22:28:28 +01:00
21f201e25e GPencil: Improve join operator
Now the strokes join the points near, not always end with start.

Differential Revision: https://developer.blender.org/D9359
2020-10-29 20:15:00 +01:00
b85504337e Refactor: move Collection .blend I/O to IDTypeInfo callbacks
This one was a bit more tricky, because the file loading is
mixed with versioning code and because collections are
embedded into scenes.

All tests that passed before, still pass.
2020-10-29 19:34:15 +01:00
7bf0682aa9 GPencil: Add interpolate operators in Draw mode
Now the interpolate is available in draw mode (except the option of selected strokes).

Differential Revision: https://developer.blender.org/D9325
2020-10-29 19:22:42 +01:00
4a8146eb8f Cycles: silence unused variable warning 2020-10-29 18:33:29 +01:00
d9b22b8094 Merge branch 'blender-v2.91-release' 2020-10-29 17:41:46 +01:00
8c3d42bd0f Fix T82129: Cycles "Persistent Images" incorrectly retains scene data
The issue stems from the fact that scene arrays are not cleared when rendering is done. This was not really an issue before the introduction of the ownership system (rB429afe0c626a) as the id_map would recreate scene data arrays based on their new content. However, now that the id_maps do not have access to the scene data anymore the arrays are never created.

Another related issue is that the BlenderSync instance is never freed when the persistent data option is activated.

To fix this, we delete nodes created by the id_maps in their destructors, and delete the BlenderSync instance before creating a new one, so the id_maps destructors are actually called.

Reviewed By: brecht

Maniphest Tasks: T82129

Differential Revision: https://developer.blender.org/D9378
2020-10-29 17:39:21 +01:00
4bf565460d Merge branch 'blender-v2.91-release' 2020-10-29 17:27:21 +01:00
2e41db5277 Fix Zoom to Mouse Position ignored when zooming out
Own mistake in rB3a1cf838ca09. Thanks to @jenkm for pointing this out.
2020-10-29 17:24:34 +01:00
Yevgeny Makarov
dfc576426b Allow Trackpad Ctrl-Pan to Cycle Enum Values
Allow Trackpad Ctrl-Pan to cycle enum values. Also allows cycling in more button types.

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

Reviewed by Brecht Van Lommel
2020-10-29 09:03:49 -07:00
c26ad42ea4 Simplify and enable NanoVDB dependency installation
Changes NanoVDB to be a standalone dependency that is independent of the OpenVDB one.
It works by downloading the "feature/nanovdb" branch of OpenVDB, but using the NanoVDB
CMake in the "nanovdb" subdirectory. Since it is header-only, only the install target is used.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9383
2020-10-29 17:02:12 +01:00
Yevgeny Makarov
c1b30e0ed1 Fix for T78211: Trackpad Zoom to Mouse Position Error
When using a trackpad Zoom to Mouse Position would always zoom to center of canvas.

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

Reviewed by Brecht Van Lommel
2020-10-29 08:27:48 -07:00
Yevgeny Makarov
962a0a6c66 Allow Building Without UI_PROP_DECORATE
Allow project to build without definition of optional UI_PROP_DECORATE.

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

Reviewed by Julian Eisel
2020-10-29 08:16:34 -07:00
f75b09e7e6 Cycles: abort rendering when --cycles-device not found
Rather than just printing a message and falling back to the CPU. For render
farms it's better to avoid a potentially slow render on the CPU if the intent
was to render on the GPU.

Ref T82193, D9086
2020-10-29 16:01:38 +01:00
09be2a8358 BLI: use forwarding reference in Map
The is necessary when Map.add_or_modify is called with callbacks that
return a reference.
2020-10-29 15:19:43 +01:00
569b7c2821 Cleanup: remove unused Blender Internal render stats code 2020-10-29 14:23:06 +01:00
f4e8c0c104 Anim UI: Playback Sync menu improvement
Relabel the Playback Synchronisation menu so that it's clear:
- what does happen (instead of describing what does //not// happen), and
- that the synchronisation options don't just affect audio.

The changes are:
- Change label from "Audio" to "Sync"
- Change the labels of the sync enum:
    - No Sync → Play Every Frame
    - Frame Dropping stays the same
    - AV-sync → Sync to Audio

The "Audio" label has moved one option down, as that option does
actually relate to audio.

Reviewed By: looch, Severin, HooglyBoogly, campbellbarton

Differential Revision: https://developer.blender.org/D9269
2020-10-29 12:31:53 +01:00
b866100c1f Cleanup: spelling 2020-10-29 21:38:40 +11:00
Yevgeny Makarov
d26b746e36 UI: use "Save As" when saving un-saved image/text files
Now the behaviors are consistent for blend, image and text files:

- If the file is not writable, will report it.
- If the file is new (without a path), save as will be used.
- If the file was deleted, will try to recreate it.

Ref D6755
2020-10-29 21:11:23 +11:00
Ivan Perevala
cf78053027 Libmv: Fix clang inconsistent-missing-override warnings.
Reviewed By: sergey, ankitm

Differential Revision: https://developer.blender.org/D9377
2020-10-29 10:19:50 +01:00
e652ea5ab3 Merge branch 'blender-v2.91-release' 2020-10-29 10:05:29 +01:00
ee4cdef4e3 RNA properties subtypes enum: sync definitions everywhere
Some subtypes never made it to all neccessary places when they were
introduced. This was throwing warnings when accessing such a properties
subtype from python.

The sub_type enums were also defined in 4 different places:
- RNA_types.h 'PropertySubType'
- rna_rna.c 'rna_enum_property_subtype_items'
- rna_rna.c 'subtype_items'
- bpy_props.c as multiple enums

This patch syncs the definitions across all places so that they are the
same everywhere. It also looks redundant to define these twice in
rna_rna.c, now just use 'rna_enum_property_subtype_items' there (and get
rid off 'subtype_items').

Also moved 'POWER' & 'TEMPERATURE' to number enum in bpy_props (these
were defined in the array enum).

Fixes T82167.

Maniphest Tasks: T82167

Differential Revision: https://developer.blender.org/D9371
2020-10-29 10:03:56 +01:00
440ed3ade8 Fix T82188: Sculpt Grab Silhouette and symmetry fails
Wasnt checking the symmetrized 'grab_delta_symmetry' so result could
flip around.

Maniphest Tasks: T82188

Differential Revision: https://developer.blender.org/D9373
2020-10-29 09:47:05 +01:00
110d6a5130 Merge branch 'blender-v2.91-release' 2020-10-29 09:45:28 +01:00
3fc97727df CustomData color copying: use interpolated alpha
The alpha of the first layer was always used
here since introduction in rBee4453f08369 and was not updated when
customdata support for alpha was added.

Now also use the interpolated alpha.

thx @brecht noticing!

ref T81914

Reviewers: brecht, mont29

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9358
2020-10-29 09:41:26 +01:00
6a5d2f4ea2 Fix blend_color_interpolate_byte returning wrong alpha in certain case
When the combined alpha [the 'tmp' variable having the mixfactor applied
already] - reached zero it was handled like a no-op (for the alpha as
well) and just copied the first color.

So e.g mixing 255/255/255/255 with 0/0/0/0 with a factor of 1.0 gave
alpha of 255, which looks wrong.

cases where tmp gets zero:
src1 alpha:0 src2 alpha:whatever mixfactor 0.0
src1 alpha:whatever src2 alpha:0 mixfactor 1.0
src1 alpha:0 src2 alpha:0 mixfactor whatever

Now set alpha to zero in that case.

ref T81914

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9357
2020-10-29 09:27:10 +01:00
e78ded8b0f Merge branch 'blender-v2.91-release' 2020-10-29 13:15:49 +11:00
Erik Abrahamsson
01d02e78b5 Fix 3D smooth-view ignoring lens when exiting camera view
Add NULL checks for `sview->ofs`, while it's currently never NULL
when a camera is set. The API allows for each member
to be set independently.
2020-10-29 12:45:52 +11:00
83f369a0b9 Merge branch 'blender-v2.91-release' 2020-10-29 11:29:13 +11:00
52b38d9c3d PyAPI: point sys.executable to the Python binary
`sys.executable` is documented to be a Python interpreter or None.

This was set to Blender's executable which caused the multiprocessing
module to spawn new instances of Blender instead of Python on WIN32.
See issue described in D7815.

Deprecate 'bpy.app.binary_path_python' & warn when using.

Blender's executable remains accessible via `bpy.app.binary_path`.

Modified 04c5471cee, setting `sys.executable` instead of using
Py_SetProgramName, which is needed for a bundled Python installation.
2020-10-29 11:22:39 +11:00
Yevgeny Makarov
cac8a7cddb Fix for T65714: Pinch Zooming Crash using Mac Trackpad
Ensure that Zoom does not crash on Mac Trackpad by checking for existence of Continuous Zoom timer.

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

Reviewed by Julian Eisel
2020-10-28 16:40:28 -07:00
Yevgeny Makarov
b0a9a04f62 UI: Improvements to Close File Dialog
Improved alignment of items on the File Close Dialog.

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

Reviewed by Hans Goudey
2020-10-28 16:22:37 -07:00
Yevgeny Makarov
6bf043ac94 UI: Improved alignment of labels and buttons
Improved alignment of labels with other buttons.

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

Reviewed by Julian Eisel
2020-10-28 16:01:51 -07:00
d32188b85b Mesh: Fix BKE_mesh_translate changes referenced layer
This is the same fix that is implemented in rB3791dbea1e79.
2020-10-28 20:15:50 +01:00
911f9e00d1 Animation: Improve labels on Snap menu in NLA & Dopesheet
Add "Selection to" as prefix for those menu items that move the selected
keyframes to something, for both the Key → Snap menu and the Shift+S pie
menu.

No functional changes.

This was missed in rB477d983c2e8ab298cbf638d5aadd77fad9c2f677

Differential Revision: https://developer.blender.org/D9304
2020-10-28 14:06:26 -04:00
0e47e57eb7 Outliner: Properties editor sync on selection
When outliner datablocks are selected, switch to the corresponding tab
for that datablock in properties editors. Only properties editors
that share an edge with the outliner will change tabs.

Additionally, when modifiers, constraints, and shader effects are
selected from the outliner, the panel will be expanded in all properties
editors.

Part of T77408

Manifest Task: https://developer.blender.org/T63991

Differential Revision: https://developer.blender.org/D8638
2020-10-28 11:54:29 -06:00
Yevgeny Makarov
5af8fc8192 UI: Improved Checkbox Width Calculation
Improved calculation of checkbox width to include line width preference.

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

Reviewed by Hans Goudey
2020-10-28 10:21:18 -07:00
Yevgeny Makarov
f7e4b209e2 UI: Misc Label and Description Changes
Various changes to some labels and descriptions to be more accurate, clear, or less confusing.

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

Reviewed by Hans Goudey
2020-10-28 10:10:41 -07:00
9f8acce3ab Cleanup: name parameters instead of commenting them.
It generates warning C4138 in MSVC:
> '*/' found outside of comment

Old code added in {rBafd13710b897}
2020-10-28 21:48:33 +05:30
Yevgeny Makarov
683dc71c3c UI: Improve Text on 'Color Grid' Image
Change the sequence of characters shown on the 'Color Grid' generated image.

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

Reviewed by Hans Goudey
2020-10-28 09:03:42 -07:00
Yevgeny Makarov
1ebb7afe1d UI: Popover Position Change
Move popover down a very slight amount to fix clipping of its arrow tip.

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

Reviewed by Julian Eisel
2020-10-28 08:53:41 -07:00
8c04337231 Merge branch 'blender-v2.91-release' into master 2020-10-28 21:18:55 +05:30
30ec0753c7 Revert "Fix T81077 id_management test on macOS"
This reverts commit 2ddecfffc3.

The correct fix is to compile with -fno-strict-aliasing on
release/relwithdebinfo builds also.

See the last commit/ {D9372}.

Maniphest Task T81077
2020-10-28 20:54:10 +05:30
fc6a1f44d2 macOS: use -fno-strict-aliasing for all build types.
The old code was added in {rBbaa4a9c7d4dd}

While the hotfix committed in {rB2ddecfffc3d3a3a1db4ae45e8665ca} fixed
the id_management test, the correct reason was found at
https://bugs.llvm.org/show_bug.cgi?id=47984

This matches the behavior on Linux.
2020-10-28 20:53:32 +05:30
a087196a45 GPencil: Change trace tooltip for Threshold 2020-10-28 16:07:33 +01:00
abdd0198c0 GPencil: Change Trace tooltips 2020-10-28 15:41:16 +01:00
a5d237ac85 GPencil: New support to trace sequence images
Now it's possible to trace a sequence of images and not just a single one

When the trace is for more than one image, a bacth job is started to process all frames.

Note: All trace data is generated by Potrace library.

Differential revision: https://developer.blender.org/D9316
2020-10-28 15:36:01 +01:00
73378c2ba2 BLI: improve Map.add_new
Now it is possible to use Map.add_new_as which supports different types
for the key and value.
2020-10-28 13:57:53 +01:00
322b6ac52b UI: Save Preferences Button Not Translating
Ref D9338
2020-10-28 23:04:50 +11:00
4921b5d1c9 UI: Save Preferences Button Not Translating
Ref D9338
2020-10-28 22:57:54 +11:00
70040e7b0b Cycles: internal support for alpha output for attribute node
Not exposed in Blender yet.

Ref D2057
2020-10-28 12:43:42 +01:00
b7558e3c9c Cycles: internal support for per-instance and per-geometry attributes
The existing code for this was incomplete. Each instance can now have a set
of attributes stored separately from geometry attributes. Geometry attributes
take precedence over instance attributes.

Ref D2057
2020-10-28 12:43:42 +01:00
0767683496 Cycles: refactor to make attribute lookup slightly more efficient
Ref D2057
2020-10-28 12:43:42 +01:00
d58b55b55a Cycles: internal support for float4 geometry attributes
Previously only float3 and byte4 was supported.

Ref D2057
2020-10-28 12:43:42 +01:00
ee6b989f8e Cycles: refactor to split surface and volume attribute lookup more
This avoids OpenCL inlining heavy volume interpolation code once for every
data type, which could cause a performance regression when we add a float4
data type in the next commit.

Ref D2057
2020-10-28 12:43:42 +01:00
fb88d4eda8 Add a Un-Bake FCurves operator
We already had the ability to bake fcurves but no way to convert the
baked result back without using python. This patch adds and operator
that is available now next to the bake operator in the drop down menu,

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D6379
2020-10-28 11:45:24 +01:00
2f7c6149fc Merge branch 'blender-v2.91-release' into master 2020-10-28 11:08:42 +01:00
Bastien Montagne
0d772221c6 Fix T82149: Blender crash when using collection user_id remapping (python).
Not sure why Collection was the only ID for which depsgraph building did
not check for potential recursion?

Reviewed By: sergey

Maniphest Tasks: T82149

Differential Revision: https://developer.blender.org/D9365
2020-10-28 11:05:25 +01:00
2468635174 Tracking: Move optical center to lens panel
Optical center is in fact a property of lens rather than a camera body.
2020-10-28 10:39:37 +01:00
0269f0c574 Tracking: Simplify configuration of intrinsics to refine
Previously, only predefined and limited set of intrinsics combinations
could have been refined. This was caused by a bundle adjustment library
used in the early days of the solver.

Now it is possible to fully customize which intrinsics are to be refined
during camera solving. Internally solver supports per-parameter settings
but in the interface they are grouped as following:

* Focal length
* Optical center
* Radial distortion coefficients (which includes k1, k2, k3, k4)
* Tangential distortion coefficients (which includes p1, p2)

Differential Revision: https://developer.blender.org/D9294
2020-10-28 10:21:07 +01:00
1b1f46a98c Libmv: Fix typo in packed intrinsics
Was using doing an implicit cast of floating point value to boolean.
Was not noticed before because the boolean value was never never used.
2020-10-28 10:13:08 +01:00
283c7fecf9 Tracking: Decouple refine settings
Historically the refine options had a hardcoded list of possibilities.
This was caused by an old bundle adjustment code which did not support
all possible combinations.

Now the bundle adjuster is based on Ceres solver, allowing to refine
anything in any combination.
2020-10-28 10:13:08 +01:00
02ecf29d05 Merge branch 'blender-v2.91-release' 2020-10-28 19:43:58 +11:00
a8ca79cbe6 Revert "PyAPI: point sys.executable to the Python binary"
This reverts commit 04c5471cee.

This causes Blender not to start on some systems.
2020-10-28 19:40:52 +11:00
6527a14cd2 PyAPI: remove bpy.app.binary_path_python
This is deprecated in 2.91,
remove for 2.92 in favor of 'sys.executable'.
2020-10-28 17:40:07 +11:00
fb3f0d3cf0 Merge branch 'blender-v2.91-release' 2020-10-28 17:33:17 +11:00
4f24808d08 Fix T82049: material select button now only works for active object
Include edit-mode objects from space-properties context
unless there is a pinned object.

Regression caused by change in 12bc34b0b8.
2020-10-28 17:30:12 +11:00
1be819ea66 Cleanup: update comments
Some references to argument levels were still in comments.
2020-10-28 16:00:26 +11:00
a0f2866a8e Cleanup: update old comment for why we can't use PySys_SetArgv 2020-10-28 14:04:44 +11:00
58fc155976 Cleanup: move WM_init & arg parsing out of if/else branch 2020-10-28 14:04:44 +11:00
6445caa9b5 BLI_args: disallow zero to be used as a pass value
Introduced recently in 09139e41ed.
While this worked in the cases it was used, '--threads' for example
was failing to parse the number when it's pass was set to 0.

Increase the enum values to start at 1 &
add asserts so this wont happen again.
2020-10-28 14:04:44 +11:00
c518cd73cd Cleanup: use enum for command line argument passes 2020-10-28 14:04:44 +11:00
6ac46c9708 BLI_args: refactor argument passes
Avoid passing the pass argument to BLI_argsAdd, instead set this
once for each group of passes.

This means we can add new passes without having to bump the arguments
to BLI_argsAdd.
2020-10-28 14:04:41 +11:00
5711b85147 Cleanup: Remove unused IDProperty function
This function from 2017 came with a comment: "TODO Nuke this once its
only user has been correctly converted to use generic IDmanagement"
Since it is unused after rB91462fbb31ba, now is time to remove it.

Differential Revision: https://developer.blender.org/D9368
2020-10-27 20:12:42 -05:00
9dac5456b9 Merge branch 'blender-v2.91-release' 2020-10-28 11:52:15 +11:00
04c5471cee PyAPI: point sys.executable to the Python binary
`sys.executable` is documented to be a Python interpreter or None.

This was set to Blender's executable which caused the multiprocessing
module to spawn new instances of Blender instead of Python on WIN32.
See issue described in D7815.

Deprecate 'bpy.app.binary_path_python' & warn when using.

Blender's executable remains accessible via `bpy.app.binary_path`.
2020-10-28 11:49:29 +11:00
Yevgeny Makarov
d28676d89a UI: Move the 'Resolve Conflict' button closer to the text data-block
Moves the Text Editor 'Resolve Conflict' button closer to data-block selector and with 'Question' icon.

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

Reviewed by Hans Goudey
2020-10-27 16:30:37 -07:00
024b65b5e5 Cleanup: Update comment
This comment has to be updated since it was moved
from the header file to the source file.
2020-10-27 17:14:40 -05:00
1504ed99e6 Fix use after free in interface handler
ASAN reported a use after free in after rB15d78ea85b602c. This commit
removed a reassignment of the `data` variable here that was actually
required because it may have been freed earlier in the function. This
sort of error would be avoided if the same variable wasn't reused for
different purposes.
2020-10-27 13:44:47 -05:00
c80594f57f GPencil: New parameter in Texture modifier to rotate Dot textures
This new parameter allows to rotate the texture of any Dot or Square stroke.

Differential Revision:  https://developer.blender.org/D9343
2020-10-27 17:59:48 +01:00
3a7a936525 Merge branch 'blender-v2.91-release' 2020-10-27 17:39:59 +01:00
bee5921e82 GPencil: Fix unreported Fill when use boundary and Visble layers
The new option to filter the layers used by the Fill tool was not using the boundary strokes. The problem was the layers were skipped and any boundary stroke was not used.

Now, the layer is not skipped, but the strokes that are not boundary are skipped.
2020-10-27 17:38:44 +01:00
471c0bcd44 git blame: add file to help ignore cleanup commits
wiki.blender.org/wiki/Tools/Git#Tips has been updated.

A follow up to
lists.blender.org/pipermail/bf-committers/2020-October/050698.html
will be sent after commit.

Reviewed By: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D9234
2020-10-27 20:20:39 +05:30
90e12e823f Fix T81854: crash when undoing switch between sculpt and edit mode.
The logic of `BKE_sculpt_update_object_for_edit` was not correct. such
low-level functions should typically never preform depsgraph evaluation
themselves, they should be able to rely on getting a fully evaluated
depsgraph and just get needed data from there.

Supporting that required fixing other broken code higher in the
callstack, namely:
* `ED_object_sculptmode_enter_ex` was freeing evaluated data, for no
  valid reason it would seem.
* `sculpt_undosys_step_decode` was ensuring an evaluated depsgraph
  **before** calling `ED_object_mode_generic_exit`, which would
  invalidate a lot of evaluated data.

Note that it is fairly difficult to track down all code paths leading to
`BKE_sculpt_update_object_for_edit`, so there may be still cases where
this gets called with improperly evaluated depsgraph.

Reviewed By: sergey

Maniphest Tasks: T81854

Differential Revision: https://developer.blender.org/D9270
2020-10-27 15:27:07 +01:00
f6990c235a Merge branch 'blender-v2.91-release' 2020-10-27 15:13:39 +01:00
4975aa410c Fix T81844: Change Bone Layers fails in Pose Mode
When selecting multiple layers, the redo operator might not correctly
update the pose data. To make sure it is in a good state we have to
ensure that the pose data is good.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D9354
2020-10-27 15:10:44 +01:00
4b188bb08c Cleanup: use over-line for doxy comments
Follow our code style for doxygen sections.
2020-10-27 21:45:55 +11:00
30f626fe4c Revert "Cycles API: encapsulate Node socket members"
This reverts commit 527f8b32b3. It is causing
motion blur test failures and crashes in some renders, reverting until this is
fixed.
2020-10-27 11:40:42 +01:00
17381c7b90 Multires: Remove simple subdivision type
The simple subdivision as a type only causes issues like no-continuous
normals across edges, inability to reliably switch the type and things
like this.

The new subdivision operators supports wider variety of how to add
details to the model, which are more powerful than a single one-time
decision on the subdivision type.

The versioning code is adjusting topology converter to specify all
edges as infinitely sharp. The reason for this (instead of using
settings.is_simple) is because in a longer term the simple subdivision
will be removed from Subsurf modifier as well, and will be replaced
with more efficient bmesh-based modifier.

This is finished up version of D8436.

Differential Revision: https://developer.blender.org/D9350
2020-10-27 10:31:48 +01:00
09139e41ed Cleanup: simplify order of initialization with argument parsing
Sub-systems that use directories from BKE_appdir needed to be
initialized after parsing '--env-system-datafiles'.

This meant the animation player needed to call IMB_init it's self.

Avoid this complication by having a pass that can be used to setup
the environment before Blender's resources are accessed.

This reverts the workaround from 9ea345d1cf
2020-10-27 18:45:42 +11:00
Ivan Perevala
eebe274312 RNA: remove duplicate of Brush.tex_paint_map_mode
Use Brush.map_mode instead.

Ref D9290
2020-10-27 17:38:29 +11:00
4d15f4ac5b Cleanup: Use const for PointCloud variable 2020-10-26 23:12:22 -05:00
c686951233 Cleanup: improve comment about shape keys, correct spelling 2020-10-27 14:16:26 +11:00
6133159311 Merge branch 'blender-v2.91-release' 2020-10-27 14:13:39 +11:00
5e8c135540 Merge branch 'blender-v2.91-release' 2020-10-27 14:13:35 +11:00
Erik Abrahamsson
77a6b6fb1a Fix T80819: Border zoom is isn't accurate in perspective view
Improved user experience by using viewport focal length
to calculate the new camera distance.

Also resizing the border to the same aspect ratio as
the window will help not zooming in more than expected.

Ref D9341
2020-10-27 14:10:58 +11:00
66800a1deb BLI_rect: add resize_x/y functions
Without this, it's inconvenient to resize a single axis
and doesn't read very well.
2020-10-27 14:07:34 +11:00
Erik Abrahamsson
716af6a470 Modifier: apply modifier now works for lattice
Ref D9337
2020-10-27 13:27:08 +11:00
527f8b32b3 Cycles API: encapsulate Node socket members
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.

The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.

The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.

Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various `modified` methods
on Nodes in favor of `Node::is_modified` which checks the sockets'
update flags status.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8544
2020-10-26 23:11:14 +01:00
Pablo Dobarro
d6180dd2f7 Sculpt/Paint: Add Paint Studio Light preset
This studio light preset is designed for color painting tasks. As color
are multiplied on top of the current studio light/matcap, this should be
as white as possible and with very soft speculars to avoid color
distorsion while showing the volume of the mesh.

Reviewed By: jbakker, JulienKaspar

Differential Revision: https://developer.blender.org/D8209
2020-10-26 20:35:37 +01:00
45e8218f90 Merge branch 'blender-v2.91-release' into master 2020-10-26 18:35:34 +01:00
edf4378c44 Fix own previous commit re testing of BLI_rel_path.
Windows would need its own version of those tests, for now just
disabling them on that platform.
2020-10-26 18:29:54 +01:00
183c2fe031 Merge branch 'blender-v2.91-release' into master 2020-10-26 17:37:16 +01:00
01d3fbc496 Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.

Also add some basic tests for `BLI_path_rel`.
2020-10-26 17:36:53 +01:00
501854e4ee Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.

Also add some basic tests for `BLI_path_rel`.
2020-10-26 17:22:34 +01:00
253ae3d3f0 Merge branch 'blender-v2.91-release' 2020-10-26 16:33:54 +01:00
47eabae951 UI: Datatransfer modifier: set mix factor inactive when not in use
For Customdata layer copying, interpolation with the mixfactor is only
done for certain mix modes, now set the UI inactive if the mixfactor is
not in use.

Namely, the modes are the "Above / Below Threshold" which are only used
for flags, colors and normals and mixing is not supported in these cases.

Spotted while looking into T81914.

Differential Revision: https://developer.blender.org/D9327
2020-10-26 16:24:22 +01:00
841eaebfa4 Cycles: Add support for OptiX 7.2 SDK 2020-10-26 15:43:55 +01:00
9d24d1b20c Merge branch 'blender-v2.91-release' 2020-10-26 14:34:03 +01:00
5365409ec0 Fix T82079: Missing viewport redraw changing volume slicing axis
Send appropriate notifiers (via rna_Volume_update_display).

Maniphest Tasks: T82079

Differential Revision: https://developer.blender.org/D9351
2020-10-26 14:31:30 +01:00
786e160aff Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-26 13:52:36 +01:00
8a51178df9 Fix: Animation, Draw active keyframe handles only when Bézier
Draw the handles for the active keyframe only when the interpolation type
is set to Bézier. This now matches the behaviour of handles of regular
(non-active) keyframes.
2020-10-26 13:52:12 +01:00
d62309a20e Fix T81890: Active keyframe changes on deselect of keyframe
Activate an FCurve only on selecting, and not on deselecting a keyframe
or a handle.

Reviewed By: HooglyBoogly, Severin, looch, #animation_rigging

Differential Revision: https://developer.blender.org/D9328
2020-10-26 13:52:12 +01:00
4d5e0a8520 Merge branch 'blender-v2.91-release' 2020-10-26 13:07:00 +01:00
Philipp Oeser
f76f48c3d3 Fix T69911: Adaptive subdivision offscreen dicing does not work correctly if the camera is shifted
Code was assuming frustrum planes are symmetrical which is not the case
for shifting. This lead to a shrinking region if shift was negative (and
a growing region if shift was positive)

So instead of only keeping track of plane on one side (and mirroring
over in code) get the actual planes after shifting and use these
instead.

This code corrects this for ortho and perspective cameras, it does not
touch panoramic cameras.

Reviewed By: brecht

Maniphest Tasks: T69911

Differential Revision: https://developer.blender.org/D9342
2020-10-26 12:52:25 +01:00
ae5fd92228 Fix T81893: Cycles viewport crash changing mesh to smoke domain
Now that volume is a dedicated geometry type in Cycles, we need to re-allocate
the geometry when a mesh changes into a volume.
2020-10-26 12:31:01 +01:00
6fc0d743f1 Cleanup: compiler warnings 2020-10-26 12:31:01 +01:00
57fc44de6c Merge branch 'blender-v2.91-release' 2020-10-26 22:06:57 +11:00
9969c2dd16 Fix custom-normal support for mesh editing operations
Account for custom normals for edit-mesh tools:

- Limited Dissolve
- Split
- Split (Edges/Vertices)
- Triangulate
2020-10-26 22:02:31 +11:00
a207fb7ea7 Merge branch 'blender-v2.91-release' into master
Conflicts:
	source/blender/blenkernel/intern/armature.c
2020-10-26 11:29:20 +01:00
25c3a2e42d Proper, cleaner fix for T81963: Random rare crashes in override code.
Use new `BKE_pose_ensure` utils, and do so for reference linked object
too everywhere.
2020-10-26 11:26:55 +01:00
fff08e81ea Pose: Add a 'pose_ensure' new utils that only rebuilds if needed.
Avoids having to spread the check logic everywhere in the code.
2020-10-26 11:26:55 +01:00
19f74e4022 Merge branch 'blender-v2.91-release' 2020-10-26 21:10:33 +11:00
Ryan Inch
cf6c076046 Fix T82077: Tools popup error in the image editor
Add check for an image space type.

Ref D9347
2020-10-26 21:08:34 +11:00
38ba8a441f Merge branch 'blender-v2.91-release' 2020-10-26 11:03:30 +01:00
Jeroen Bakker
042143440d LatticeDeform: Performance
This patch improves the single core performance of the lattice deform.

1. Prefetching deform vert during initialization. This data is constant for
   each innerloop. This reduces the complexity of the inner loop what makes
   more CPU resources free for other optimizations.
2. Prefetching the Lattice instance. It was constant. Although performance
   wise this isn't noticeable it is always good to free some space in the
   branch prediction tables.
3. Remove branching in all loops by not exiting when the effect of the loop
   isn't there. The checks in the inner loops detected if this loop didn't
   have any effect on the final result and then continue to the next loop.
   This made the branch prediction unpredictable and a lot of mis
   predictions were done. For smaller inner loops it is always better
   to remove unpredictable if statements by using branchless code patterns.
4. Use SSE2 instruction when available.

This gives 50% performance increase measured on a
Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz with GCC 9.3.
Also check other compilers.

Before:
```
performance_no_dvert_10000 (4 ms)
performance_no_dvert_100000 (30 ms)
performance_no_dvert_1000000 (268 ms)
performance_no_dvert_10000000 (2637 ms)
```

After:
```
performance_no_dvert_10000 (3 ms)
performance_no_dvert_100000 (21 ms)
performance_no_dvert_1000000 (180 ms)
performance_no_dvert_10000000 (1756 ms)
```

Reviewed By: Campbell Barton

Differential Revision: https://developer.blender.org/D9087
2020-10-26 11:02:03 +01:00
336a675c64 Merge branch 'blender-v2.91-release' into master 2020-10-26 15:06:55 +05:30
2ddecfffc3 Fix T81077 id_management test on macOS
This looks like a optimizer bug where it makes wrong assumptions.
The code inside lib_id_delete:264 on rBafd13710b897cc1c11b
`for (id = last_remapped_id->next; id; id = id->next) {..}`
is not executed in release/relwithdebinfo builds.

This can be "fixed" by several ways:
- Adding a line that prints the `last_remapped_id->name` right before
  the said for-loop starts.
- Turning off optimization for the whole function `id_delete`:
  `#pragma clang optimize off/on` Ray Molenkamp
- Marking `last_remapped_id` volatile. Julian Eisel
- Marking `tagged_deleted_ids` volatile. But it adds a warning when
  calling `BLI_addtail`: discards volatile qualifier. Discovered by
  accident.

Fix T81077

Reviewed By: mont29

Maniphest Tasks: T81077

Differential Revision: https://developer.blender.org/D9315
2020-10-26 15:02:20 +05:30
2c024bd335 Merge branch 'blender-v2.91-release' into master 2020-10-26 09:52:37 +01:00
4b7abde11d Fix T81963: Random rare crashes in override code.
Finaly managed to reproduce, we not only have to ensure pose data is up
to date for the override armature, but also for the reference linked
data.
2020-10-26 09:51:49 +01:00
cd16a5cea8 Merge branch 'blender-v2.91-release' into master 2020-10-26 09:17:06 +01:00
81462f86bc Fix T81984: Crash in sculpt undo with mask extract after dyntopo toggle
More operators missing the mandatory undo flag...
2020-10-26 09:16:33 +01:00
e4facbbea5 Modifiers: include the object & modifier when logging errors
Without this, there was no way of finding out which object, modifier
combination caused the error, making the logs not very useful
for debugging.
2020-10-26 18:16:30 +11:00
aa77689f77 Keymap: enable repeat for text editing paste operations 2020-10-26 15:59:24 +11:00
4d3a386af2 Cleanup: spelling 2020-10-26 15:59:08 +11:00
6c7f30a6f6 UI: Use property split in vertex paint symmetry panels
Set property split in the higher level panel functions so that it carries
over to buttons added after. Also discard the redundant "Symmetry"
to make sure there is enough space for the checkbox label.
2020-10-25 23:23:38 -05:00
e9d21136ce UI: Fix Symmetry options in weight paint panels
The now redundant "X" checkbox is removed since it's also present in the
Symmetry panel above. The Topology Mirror is moved into the Symmetry
panel also.

This was needed because `Mesh.use_x_mirror` has recently been turned into
different functionality, and its old functionality now lives under
`Mesh.use_mirror_vertex_group_x`. Something went wrong in the UI in This
transition.

Differential Revision: https://developer.blender.org/D9287
2020-10-25 23:16:11 -05:00
3baf65975c Split BKE_sequencer.h intern/extern definitions
Intern definitions are moved to sequencer/intern/sequencer.h

BKE_sequencer.h was also cleaned up a bit to make sure that functions
and structs are in correct category.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9259
2020-10-26 00:47:06 +01:00
bf10a56eea Merge branch 'blender-v2.91-release' 2020-10-26 00:39:30 +01:00
8eb7344731 Fix Recursion when rendering scene strip
Recursion happens in case when scene strip point to it's own scene
indirectly by using SEQ_SCENE_STRIPS option.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9264
2020-10-26 00:31:49 +01:00
3deb4f4cb8 Fix T81426: Infinite loop building VSE relations
It is possible to create scene strips pointing to each other. This is
sanitized when rendering, but in dependency graph such setup will cause
infinite loop.

This patch fixes loop in dependency graph, but same problem exists in
audaspace

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9262
2020-10-26 00:30:27 +01:00
8d1978a8e0 Fix T81250: Crash after undoing with prefetching
Main DB and it's structs can point to different address after undoing.

In this case problem was that bmain was not updated. Same fix was
done for scene as well.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9240
2020-10-26 00:28:54 +01:00
e661df71e6 Merge branch 'blender-v2.91-release' 2020-10-25 23:07:25 +01:00
31629c1363 Fix T81904: Cloth brush simulation failing with local area and mirror
When using local area, all nodes need to build their constraints first
before activating them for simulation. THis ensures that nodes get their
structural constraints from the initial location of each symmetry pass.

Reviewed By: sergey

Maniphest Tasks: T81904

Differential Revision: https://developer.blender.org/D9303
2020-10-25 23:06:16 +01:00
c53b6067fa Sculpt: Implement plane deformation falloff for Grab
The plane deformation falloff was introduced in the first version of the
cloth brush, but due to the lack of all the new features and fixes in the
solver it was causing a lot of artifacts for deformation brushes. In
order to avoid that, the cloth brush was always using radial falloff for
the grab brush.

Now the plane falloff is properly implemented using the deformation
constraints.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9320
2020-10-25 22:59:01 +01:00
0eee384a8d Sculpt: Option to limit the action of line gestures to the segment
This adds a tool property for sculpt line gesture tools (line and
project) to limits its effect to the segment of the gesture instead of
using the infinite line to bisect the mesh in two parts.

To achieve that, the line gesture now has two extra side planes that can
be enabled/disabled for getting the nodes from the PBVH and to test the
vertices.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9307
2020-10-25 22:55:48 +01:00
c15bd1c4e6 Sculpt: Face Set Edit delete Geometry operation
This adds an operation mode to the Face Set Edit tool which deletes the
geometry of a Face Set by clicking on it.
The operator also checks for the mesh having a single Face Set to avoid
deleting the entire object by accident.
This is also disabled for Multires to avoid modifying the limit surface
without control (it is not an important limitation as base meshes for
multires are usually final, but maybe it can be supported in the future).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8938
2020-10-25 22:52:07 +01:00
1d9499bbbc UI Code Quality: Cleanup ui_but_update_from_old_block
This commit contains some improvements to this function to make this
function more purposeful and readable.
  - Split updating information of the old button to a new function.
  - Remove some 7 year old code disabled with `#if 0`.
  - Add comments explaining some of the less obvious aspects.

Differential Revision: https://developer.blender.org/D9117
2020-10-24 23:58:32 -05:00
76fd84f209 Cleanup: Use LISTBASE_FOREACH in curve code
This is a followup to rBa308607a533, using the macro in a few places
that were missed.
2020-10-24 23:32:11 -05:00
05129bc821 Fix T81999, Boolean Exact+Self Difference fails.
A cell with winding number > 1 for the second operand was incorrectly
included in the output.
2020-10-24 17:44:59 -04:00
1c653a0315 Fix T81999, Boolean Exact+Self Difference fails.
A cell with winding number > 1 for the second operand was incorrectly
included in the output.
2020-10-24 17:36:38 -04:00
2f9068449f Fix T81884, clamping with percent, addendum.
The previous fix forgot the case where there is an intermediate
edge and everything isn't in one plane.
2020-10-24 15:10:19 -04:00
574d711008 Fix T81884, clamping with percent, addendum.
The previous fix forgot the case where there is an intermediate
edge and everything isn't in one plane.

Differential Revision: https://developer.blender.org/D9336
2020-10-24 14:44:28 -04:00
Yevgeny Makarov
622b30225a UI: Capitalization Corrections
Approximately 141 changes of capitalization to conform to MLA title style.

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

Reviewed by Julian Eisel
2020-10-24 11:42:17 -07:00
ca83649b7d Fix T82019 Crash loading 2.78 splash demo.
The versioning code to default to old booleans for old files was
faulty because really old files had a 'solver' field (later removed,
but then added back for new booleans).
2020-10-24 14:07:05 -04:00
bc0a33a812 GPU: Debug: Trim shader stats from output log
We don't make use of it anyway.
2020-10-24 14:07:05 -04:00
0d1f65e516 GPU: Use CLOG to for debug output
This removes the escape color control caracters when the output
does not supports it (i.e: file output, windows cmd).
2020-10-24 14:07:05 -04:00
e856443c99 CLOG: Add getter to know if output supports coloring 2020-10-24 14:07:05 -04:00
b37c40a575 Fix Cycles unnecessary overhead cancelling finished task pool 2020-10-24 14:07:05 -04:00
d65e5e8bc5 Fix T82019 Crash loading 2.78 splash demo.
The versioning code to default to old booleans for old files was
faulty because really old files had a 'solver' field (later removed,
but then added back for new booleans).
2020-10-24 13:53:16 -04:00
70cc0d7121 GPU: Debug: Trim shader stats from output log
We don't make use of it anyway.
2020-10-23 19:33:51 +02:00
a4f883268b GPU: Use CLOG to for debug output
This removes the escape color control caracters when the output
does not supports it (i.e: file output, windows cmd).
2020-10-23 19:33:51 +02:00
8442d6ca8a CLOG: Add getter to know if output supports coloring 2020-10-23 19:33:51 +02:00
23eaf3117c Fix Cycles unnecessary overhead cancelling finished task pool 2020-10-23 19:07:34 +02:00
3521 changed files with 129399 additions and 76035 deletions

View File

@@ -15,7 +15,6 @@ Checks: >
-readability-misleading-indentation,
-readability-redundant-member-init,
-readability-use-anyofallof,
-readability-function-cognitive-complexity,
@@ -30,7 +29,19 @@ Checks: >
-bugprone-sizeof-expression,
-bugprone-integer-division,
-bugprone-exception-escape,
-bugprone-redundant-branch-condition,
modernize-*,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-use-equals-default,
-modernize-use-nodiscard,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-use-default-member-init,
-modernize-raw-string-literal,
-modernize-avoid-bind,
-modernize-use-transparent-functors,
WarningsAsErrors: '*'

169
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,169 @@
# git config blame.ignoreRevsFile .git-blame-ignore-revs
#
# After running the above, commits listed in this file will be
# ignored by git blame. The blame will be shifted to the person
# who edited the line(s) before the ignored commit.
#
# To disable this ignorance for a command, run as follows
# git blame --ignore-revs-file="" <other options>
#
# Changes that belong here:
# - Massive comment, doxy-sections, or spelling corrections.
# - Clang-format, PEP8 or other automated changes which are *strictly* "no functional change".
# - Several smaller commits should be added to this list at once, because adding
# one extra commit (to edit this file) after every small cleanup is noisy.
#
# Note:
# - The comment above the SHA should be the first line of the commit.
# - It is fine to pack together similar commits if they have the same explanatory comment.
# - Use only 40 character git SHAs; not smaller ones, not prefixed with rB.
#
# https://git-scm.com/docs/git-blame/2.23.0
# white space commit. (2 spaces -> tab).
0a3694cd6ebec710da7110e9f168a72d47c71ee0
# Cycles: Cleanup, spacing after preprocessor
cb4b5e12abf1fc6cf9ffc0944e0a1bc406286c63
# ClangFormat: apply to source, most of intern
e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1
# Code Style: use "#pragma once" in source directory
91694b9b58ab953f3b313be9389cc1303e472fc2
# Code Style: use "#pragma once" in some newer headers
8198dbb888856b8c11757586df02aca15f132f90
# Code Style: use "#pragma once" in intern/ghost
1b1129f82a9cf316b54fbc025f8cfcc1a74b8589
# Cleanup: mostly comments, use doxy syntax & typos
e0cb02587012b4b2f4b18363dc7d0a7da2c02093
# Cleanup: use C comments for descriptive text
2abfcebb0eb7989e3d1e7d03f37ecf5c088210af
# use lowercase for cmake builtin names and macros, remove contents in else() and endif() which is no longer needed.
afacd184982e58a9c830a3d5366e25983939a7ba
# Spelling: It's Versus Its
3a7fd309fce89213b0224b3c6807adb2d1fe7ca8
# Spelling: Then Versus Than
d1eefc421544e2ea632fb35cb6bcaade4c39ce6b
# Spelling: Miscellaneous
84ef3b80de4915a24a9fd2fd214d0fa44e59b854
# Spelling: Loose Versus Lose
c0a6bc19794c69843c38451c762e91bc10136e0f
# Spelling: Apart Versus A Part
3d26cd01b9ba6381eb165e11536345ae652dfb41
# Cleanup: use 2 space indentation for CMake
3076d95ba441cd32706a27d18922a30f8fd28b8a
# Cleanup: use over-line for doxy comments
4b188bb08cf5aaae3c68ab57bbcfa037eef1ac10
# Cleanup: General comment style clean up of graph_edit.c and fcurve.c
0105f146bb40bd609ccbda3d3f6aeb8e14ad3f9e
# Cleanup: pep8 (indentation, spacing, long lines)
41d2d6da0c96d351b47acb64d3e0decdba16cb16
# Cleanup: pep8, blank lines
bab9de2a52929fe2b45ecddb1eb09da3378e303b
# Cleanup: PEP8 for python changes
1e7e94588daa66483190f45a9de5e98228f80e05
# GPencil: Cleanup pep8
a09cc3ee1a99f2cd5040bbf30c8ab8c588bb2bb1
# Cleanup: trailing space, remove tabs, pep8
c42a6b77b52560d257279de2cb624b4ef2c0d24c
# Cleanup: use C style doxygen comments
8c1726918374e1d2d2123e17bae8db5aadde3433
# Cleanup: use doxy sections for imbuf
c207f7c22e1439e0b285fba5d2c072bdae23f981
# Cleanup: Clang-Tidy, modernize-use-bool-literals
af35ada2f3fa8da4d46b3a71de724d353d716820
# Cleanup: Use nullptr everywhere in fluid code
311031ecd03dbfbf43e1df672a395f24b2e7d4d3
# Cleanup: Clang-Tidy, modernize-redundant-void-arg
a331d5c99299c4514ca33c843b1c79b872f2728d
# Cleanup: Clang-Tidy modernize-use-nullptr
16732def37c5a66f3ea28dbe247b09cc6bca6677
# Cleanup: Clang-tidy, modernize-concat-nested-namespaces
4525049aa0cf818f6483dce589ac9791eb562338
# Cleanup: Clang-tidy else-after-return
ae342ed4511cf2e144dcd27ce2c635d3d536f9ad
# Cleanup: Clang-Tidy, readability-redundant-member-init
190170d4cc92ff34abe1744a10474ac4f1074086
# Cleanup: use 'filepath' instead of 'name' for ImBuf utilities
99f56b4c16323f96c0cbf54e392fb509fcac5bda
# Cleanup: clang-format
c4d8f6a4a8ddc29ed27311ed7578b3c8c31399d2
b5d310b569e07a937798a2d38539cfd290149f1c
8c846cccd6bdfd3e90a695fabbf05f53e5466a57
40d4a4cb1a6b4c3c2a486e8f2868f547530e0811
4eac03d821fa17546f562485f7d073813a5e5943
# Cleanup: use preprocessor version check for PyTypeObject declaration
cd9acfed4f7674b84be965d469a367aef96f8af3
# Cycles: fix compilation of OSL shaders following API change
b980cd163a9d5d77eeffc2e353333e739fa9e719
# Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print
efd71aad4f22ec0073d80b8dd296015d3f395aa8
# Cleanup: fix wrong merge, remove extra unique_ptr.
6507449e54a167c63a72229e4d0119dd2af68ae5
# Cleanup: fix some clang tidy issues
525a042c5c7513c41240b118acca002f6c60cc12
# Fix T82520: error building freestyle with Python3.8
e118426e4695a97d67e65d69677f3c4e2db50a56
# Cleanup: Clang-tidy, readability-else-after-return
7be47dadea5066ae095c644e0b4f1f10d75f5ab3
# Cleanup: Add `r_` to return parameter
45dca05b1cd2a5ead59144c93d790fdfe7c35ee6
# Cleanup: Typo in `print_default_info` function name.
41a73909dec716642f044e60b40a28335c9fdb10
# Cleanup: Reduce indentation
1cc3a0e2cf73a5ff4f9e0a7f5338eda77266b300
# Build-system: Force C linkage for all DNA type headers
ad4b7741dba45a2be210942c18af6b6e4438f129
# Cleanup: Move function to proper section
c126e27cdc8b28365a9d5f9fafc4d521d1eb83df
# Cleanup: remove break after return statements
bbdfeb751e16d939482d2e4b95c4d470f53f18a5
# Cleanup: clang-tidy
af013ff76feef7e8b8ba642279c62a5dc275d59f
# Cleanup: Make panel type flag names more clear
9d28353b525ecfbcca1501be72e4276dfb2bbc2a

View File

@@ -178,6 +178,7 @@ mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON)
option(WITH_PUGIXML "Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)" ON)
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
@@ -203,7 +204,7 @@ option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ON)
option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for accelerated rendering on the GPU" OFF)
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for rendering on the GPU" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -346,16 +347,21 @@ if(UNIX AND NOT APPLE)
endif()
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
if((WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE) OR WITH_MOD_FLUID)
option(WITH_PYTHON_NUMPY "Include NumPy in Blender (used by Audaspace and Mantaflow)" ON)
endif()
if(WIN32 OR APPLE)
# Windows and macOS have this bundled with Python libraries.
elseif(WITH_PYTHON_INSTALL OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
elseif(WITH_PYTHON_INSTALL OR WITH_PYTHON_NUMPY)
set(PYTHON_NUMPY_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module")
mark_as_advanced(PYTHON_NUMPY_PATH)
set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module")
set(PYTHON_NUMPY_INCLUDE_DIRS "" CACHE PATH "Path to the include directory of the NumPy module")
mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
endif()
if(WITH_PYTHON_INSTALL)
option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON)
option(WITH_PYTHON_INSTALL_NUMPY "Copy system NumPy into the blender install folder" ON)
if(UNIX AND NOT APPLE)
option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
@@ -377,6 +383,7 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
@@ -425,8 +432,8 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
mark_as_advanced(WITH_ASSERT_ABORT)
if(UNIX AND NOT APPLE)
option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Linux using Clang)" OFF)
if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+"))
option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Linux using Clang, or Windows using the Visual Studio IDE)" OFF)
mark_as_advanced(WITH_CLANG_TIDY)
endif()
@@ -526,10 +533,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# Silence the warning that object-size is not effective in -O0.
set(_asan_defaults "${_asan_defaults}")
else()
set(_asan_defaults "${_asan_defaults} -fsanitize=object-size")
string(APPEND _asan_defaults " -fsanitize=object-size")
endif()
else()
set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size")
string(APPEND _asan_defaults " -fsanitize=leak -fsanitize=object-size")
endif()
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
@@ -570,6 +577,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_COMPILER_SHORT_FILE_MACRO "Make paths in macros like __FILE__ relative to top level source and build directories." ON)
mark_as_advanced(WITH_COMPILER_SHORT_FILE_MACRO)
endif()
if(WIN32)
# Use hardcoded paths or find_package to find externals
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
@@ -598,6 +610,11 @@ if(WIN32)
endif()
if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
endif()
# The following only works with the Ninja generator in CMake >= 3.0.
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
option(WITH_NINJA_POOL_JOBS
@@ -692,6 +709,8 @@ set_and_warn_dependency(WITH_BOOST WITH_OPENCOLORIO OFF)
set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
set_and_warn_dependency(WITH_BOOST WITH_USD OFF)
set_and_warn_dependency(WITH_BOOST WITH_ALEMBIC OFF)
set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF)
set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO OFF)
if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
@@ -858,11 +877,11 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
# Since linker flags are not set, all compiler checks and `find_package`
# calls that rely on `try_compile` will fail.
# See CMP0066 also.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
string(APPEND CMAKE_C_FLAGS_DEBUG " ${COMPILER_ASAN_CFLAGS}")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${COMPILER_ASAN_CXXFLAGS}")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CXXFLAGS}")
endif()
if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
@@ -870,9 +889,11 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
if(APPLE AND COMPILER_ASAN_LIBRARY)
string(REPLACE " " ";" _list_COMPILER_ASAN_CFLAGS ${COMPILER_ASAN_CFLAGS})
add_compile_options("$<$<NOT:$<CONFIG:Release>>:${_list_COMPILER_ASAN_CFLAGS}>")
add_link_options("$<$<NOT:$<CONFIG:Release>>:-fno-omit-frame-pointer;-fsanitize=address>")
set(_is_CONFIG_DEBUG "$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>")
add_compile_options("$<${_is_CONFIG_DEBUG}:${_list_COMPILER_ASAN_CFLAGS}>")
add_link_options("$<${_is_CONFIG_DEBUG}:-fno-omit-frame-pointer;-fsanitize=address>")
unset(_list_COMPILER_ASAN_CFLAGS)
unset(_is_CONFIG_DEBUG)
elseif(COMPILER_ASAN_LIBRARY)
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
@@ -941,11 +962,11 @@ endif()
# Do it globally, SSE2 is required for quite some time now.
# Doing it now allows to use SSE/SSE2 in inline headers.
if(SUPPORT_SSE_BUILD)
set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
string(PREPEND PLATFORM_CFLAGS "${COMPILER_SSE_FLAG} ")
add_definitions(-D__SSE__ -D__MMX__)
endif()
if(SUPPORT_SSE2_BUILD)
set(PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}")
string(APPEND PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG}")
add_definitions(-D__SSE2__)
if(NOT SUPPORT_SSE_BUILD) # don't double up
add_definitions(-D__MMX__)
@@ -1157,8 +1178,8 @@ if(WITH_OPENMP)
if(OPENMP_FOUND)
if(NOT WITH_OPENMP_STATIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
else()
# Typically avoid adding flags as defines but we can't
# pass OpenMP flags to the linker for static builds, meaning
@@ -1475,10 +1496,12 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
@@ -1517,6 +1540,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
@@ -1527,15 +1551,18 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1548,8 +1575,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
# disable numbered, false positives
set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
string(APPEND C_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
string(APPEND CXX_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
# most msvc warnings are C & C++
set(_WARNINGS
@@ -1580,7 +1607,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(MSVC_VERSION GREATER_EQUAL 1911)
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
set(_WARNINGS "${_WARNINGS} /w35038") # order of initialization in c++ constructors
string(APPEND _WARNINGS " /w35038") # order of initialization in c++ constructors
endif()
string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
@@ -1604,36 +1631,33 @@ if(WITH_PYTHON)
if(WIN32 OR APPLE)
# Windows and macOS have this bundled with Python libraries.
elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR WITH_PYTHON_NUMPY)
if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
find_python_package(numpy)
unset(PYTHON_NUMPY_INCLUDE_DIRS CACHE)
set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module")
mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
find_python_package(numpy "core/include")
endif()
endif()
if(WIN32 OR APPLE)
# pass, we have this in lib/python/site-packages
elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests)
find_python_package(requests "")
endif()
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
endif()
@@ -1646,12 +1670,47 @@ if(
(CMAKE_C_COMPILER_ID MATCHES "Intel")
)
# Use C11 + GNU extensions, works with GCC, Clang, ICC
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
string(APPEND CMAKE_C_FLAGS " -std=gnu11")
endif()
if(UNIX AND NOT APPLE)
if(NOT WITH_CXX11_ABI)
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
string(APPEND PLATFORM_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
ADD_CHECK_C_COMPILER_FLAG(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
if(APPLE)
if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0)
# Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag)
# with Xcode-11 (the Clang of which doesn't support the flag).
message(WARNING
"-fmacro-prefix-map flag is NOT supported by Clang shipped with Xcode-${XCODE_VERSION}."
" Some Xcode functionality in Product menu may not work. Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
endif()
endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
path_ensure_trailing_slash(_src_dir "${CMAKE_SOURCE_DIR}")
path_ensure_trailing_slash(_bin_dir "${CMAKE_BINARY_DIR}")
# Keep this variable so it can be stripped from build-info.
set(PLATFORM_CFLAGS_FMACRO_PREFIX_MAP
"-fmacro-prefix-map=\"${_src_dir}\"=\"\" -fmacro-prefix-map=\"${_bin_dir}\"=\"\"")
string(APPEND PLATFORM_CFLAGS " ${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}")
unset(_src_dir)
unset(_bin_dir)
endif()
else()
message(WARNING
"-fmacro-prefix-map flag is NOT supported by C/C++ compiler."
" Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
endif()
endif()
@@ -1714,6 +1773,10 @@ elseif(WITH_CYCLES_STANDALONE)
endif()
endif()
#-----------------------------------------------------------------------------
# Testing
add_subdirectory(tests)
#-----------------------------------------------------------------------------
# Blender Application
if(WITH_BLENDER)
@@ -1721,11 +1784,6 @@ if(WITH_BLENDER)
endif()
#-----------------------------------------------------------------------------
# Testing
add_subdirectory(tests)
#-----------------------------------------------------------------------------
# Define 'heavy' submodules (for Ninja builder when using pools).
setup_heavy_lib_pool()
@@ -1755,7 +1813,7 @@ if(FIRST_RUN)
set(_msg " - ${_setting}")
string(LENGTH "${_msg}" _len)
while("32" GREATER "${_len}")
set(_msg "${_msg} ")
string(APPEND _msg " ")
math(EXPR _len "${_len} + 1")
endwhile()
@@ -1773,24 +1831,24 @@ if(FIRST_RUN)
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
info_cfg_text("Build Options:")
info_cfg_option(WITH_ALEMBIC)
info_cfg_option(WITH_BULLET)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_GMP)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_TBB)
info_cfg_option(WITH_GMP)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
@@ -1798,58 +1856,58 @@ if(FIRST_RUN)
info_cfg_text("System Options:")
info_cfg_option(WITH_INSTALL_PORTABLE)
info_cfg_option(WITH_MEM_JEMALLOC)
info_cfg_option(WITH_MEM_VALGRIND)
info_cfg_option(WITH_SYSTEM_GLEW)
info_cfg_option(WITH_X11_ALPHA)
info_cfg_option(WITH_X11_XF86VMODE)
info_cfg_option(WITH_X11_XFIXES)
info_cfg_option(WITH_X11_XINPUT)
info_cfg_option(WITH_MEM_JEMALLOC)
info_cfg_option(WITH_MEM_VALGRIND)
info_cfg_option(WITH_SYSTEM_GLEW)
info_cfg_text("Image Formats:")
info_cfg_option(WITH_OPENIMAGEIO)
info_cfg_option(WITH_IMAGE_CINEON)
info_cfg_option(WITH_IMAGE_DDS)
info_cfg_option(WITH_IMAGE_HDR)
info_cfg_option(WITH_IMAGE_OPENEXR)
info_cfg_option(WITH_IMAGE_OPENJPEG)
info_cfg_option(WITH_IMAGE_TIFF)
info_cfg_option(WITH_OPENIMAGEIO)
info_cfg_text("Audio:")
info_cfg_option(WITH_OPENAL)
info_cfg_option(WITH_SDL)
info_cfg_option(WITH_SDL_DYNLOAD)
info_cfg_option(WITH_JACK)
info_cfg_option(WITH_JACK_DYNLOAD)
info_cfg_option(WITH_CODEC_AVI)
info_cfg_option(WITH_CODEC_FFMPEG)
info_cfg_option(WITH_CODEC_SNDFILE)
info_cfg_option(WITH_JACK)
info_cfg_option(WITH_JACK_DYNLOAD)
info_cfg_option(WITH_OPENAL)
info_cfg_option(WITH_SDL)
info_cfg_option(WITH_SDL_DYNLOAD)
info_cfg_text("Compression:")
info_cfg_option(WITH_LZMA)
info_cfg_option(WITH_LZO)
info_cfg_text("Python:")
if(APPLE)
info_cfg_option(WITH_PYTHON_FRAMEWORK)
endif()
info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY)
if(APPLE)
info_cfg_option(WITH_PYTHON_FRAMEWORK)
endif()
info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_REMESH)
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)
info_cfg_option(WITH_MOD_REMESH)
info_cfg_text("OpenGL:")
info_cfg_option(WITH_GLEW_ES)
info_cfg_option(WITH_GL_EGL)
info_cfg_option(WITH_GL_PROFILE_ES20)
if(WIN32)
info_cfg_option(WITH_GL_ANGLE)
endif()
info_cfg_option(WITH_GL_EGL)
info_cfg_option(WITH_GL_PROFILE_ES20)
info_cfg_option(WITH_GLEW_ES)
info_cfg_text("")

View File

@@ -41,6 +41,7 @@ Convenience Targets
* developer: Enable faster builds, error checking and tests, recommended for developers.
* config: Run cmake configuration tool to set build options.
* ninja: Use ninja build tool for faster builds.
* ccache: Use ccache for faster rebuilds.
Note: passing the argument 'BUILD_DIR=path' when calling make will override the default build dir.
Note: passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments.
@@ -241,6 +242,10 @@ ifneq "$(findstring developer, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring ccache, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-DWITH_COMPILER_CCACHE=YES $(CMAKE_CONFIG_ARGS)
endif
# -----------------------------------------------------------------------------
# build tool
@@ -340,6 +345,7 @@ headless: all
bpy: all
developer: all
ninja: all
ccache: all
# -----------------------------------------------------------------------------
# Build dependencies

View File

@@ -85,6 +85,7 @@ include(cmake/flexbison.cmake)
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/nanovdb.cmake)
include(cmake/python.cmake)
include(cmake/python_site_packages.cmake)
include(cmake/package_python.cmake)
@@ -93,11 +94,7 @@ include(cmake/usd.cmake)
include(cmake/potrace.cmake)
# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
if(UNIX)
# Rely on PugiXML compiled with OpenImageIO
else()
include(cmake/pugixml.cmake)
endif()
include(cmake/pugixml.cmake)
if((NOT APPLE) OR ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)

View File

@@ -42,8 +42,14 @@ if(UNIX)
endforeach()
if(APPLE)
if(NOT EXISTS "/usr/local/opt/bison/bin/bison")
set(_software_missing "${_software_missing} bison")
# Homebrew has different default locations for ARM and Intel macOS.
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(HOMEBREW_LOCATION "/opt/homebrew")
else()
set(HOMEBREW_LOCATION "/usr/local")
endif()
if(NOT EXISTS "${HOMEBREW_LOCATION}/opt/bison/bin/bison")
string(APPEND _software_missing " bison")
endif()
endif()

View File

@@ -17,13 +17,14 @@
# ***** END GPL LICENSE BLOCK *****
set(CLANG_EXTRA_ARGS
-DCLANG_PATH_TO_LLVM_SOURCE=${BUILD_DIR}/ll/src/ll
-DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm
-DLLVM_DIR="${LIBDIR}/llvm/lib/cmake/llvm/"
-DLLVM_USE_CRT_RELEASE=MD
-DLLVM_USE_CRT_DEBUG=MDd
-DLLVM_CONFIG=${LIBDIR}/llvm/bin/llvm-config
)
set(BUILD_CLANG_TOOLS OFF)
if(WIN32)
set(CLANG_GENERATOR "Ninja")
else()
@@ -31,11 +32,32 @@ else()
endif()
if(APPLE)
set(BUILD_CLANG_TOOLS ON)
set(CLANG_EXTRA_ARGS ${CLANG_EXTRA_ARGS}
-DLIBXML2_LIBRARY=${LIBDIR}/xml2/lib/libxml2.a
)
endif()
if(BUILD_CLANG_TOOLS)
# ExternalProject_Add does not allow multiple tarballs to be
# downloaded. Work around this by having an empty build action
# for the extra tools, and referring the clang build to the location
# of the clang-tools-extra source.
ExternalProject_Add(external_clang_tools
URL ${CLANG_TOOLS_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${CLANG_TOOLS_HASH}
INSTALL_DIR ${LIBDIR}/clang_tools
PREFIX ${BUILD_DIR}/clang_tools
CONFIGURE_COMMAND echo "."
BUILD_COMMAND echo "."
INSTALL_COMMAND echo "."
)
list(APPEND CLANG_EXTRA_ARGS
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=${BUILD_DIR}/clang_tools/src/external_clang_tools/
)
endif()
ExternalProject_Add(external_clang
URL ${CLANG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -65,6 +87,14 @@ add_dependencies(
ll
)
if(BUILD_CLANG_TOOLS)
# `external_clang_tools` is for downloading the source, not compiling it.
add_dependencies(
external_clang
external_clang_tools
)
endif()
# We currently do not build libxml2 on Windows.
if(NOT WIN32)
add_dependencies(

View File

@@ -98,6 +98,10 @@ harvest(jpg/include jpeg/include "*.h")
harvest(jpg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
harvest(clang/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(clang/bin llvm/bin "clang-tidy")
harvest(clang/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(clang/include llvm/include "*")
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
@@ -146,10 +150,8 @@ harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
if(WITH_NANOVDB)
harvest(openvdb/nanovdb nanovdb/include/nanovdb "*.h")
endif()
harvest(openvdb/lib openvdb/lib "*.a")
harvest(nanovdb/nanovdb nanovdb/include/nanovdb "*.h")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
@@ -158,6 +160,8 @@ harvest(osl/lib osl/lib "*.a")
harvest(osl/shaders osl/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}m")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")

View File

@@ -25,8 +25,13 @@ if(WIN32)
elseif(APPLE)
# Use bison installed via Homebrew.
# The one which comes which Xcode toolset is too old.
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(HOMEBREW_LOCATION "/opt/homebrew")
else()
set(HOMEBREW_LOCATION "/usr/local")
endif()
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DBISON_EXECUTABLE=${HOMEBREW_LOCATION}/opt/bison/bin/bison
)
elseif(UNIX)
set(ISPC_EXTRA_ARGS_UNIX

View File

@@ -0,0 +1,54 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(NANOVDB_EXTRA_ARGS
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
# Do not need to include any of the dependencies because of this
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENCL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_BLOSC=OFF
-DNANOVDB_USE_ZLIB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
ExternalProject_Add(nanovdb
URL ${NANOVDB_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)
if(WIN32)
ExternalProject_Add_Step(nanovdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/nanovdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES install
)
endif()

View File

@@ -112,6 +112,9 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DSTOP_ON_WARNING=OFF
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
${WEBP_FLAGS}
${OIIO_SIMD_FLAGS}
)
@@ -134,6 +137,7 @@ add_dependencies(
external_jpeg
external_boost
external_tiff
external_pugixml
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
)

View File

@@ -54,20 +54,6 @@ set(OPENVDB_EXTRA_ARGS
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DOPENVDB_BUILD_BINARIES=Off
-DCMAKE_DEBUG_POSTFIX=_d
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
if(WIN32)
@@ -88,18 +74,12 @@ else()
)
endif()
if(WITH_NANOVDB)
set(OPENVDB_PATCH_FILE openvdb_nanovdb.diff)
else()
set(OPENVDB_PATCH_FILE openvdb.diff)
endif()
ExternalProject_Add(openvdb
URL ${OPENVDB_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENVDB_HASH}
PREFIX ${BUILD_DIR}/openvdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/${OPENVDB_PATCH_FILE}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openvdb
)
@@ -121,12 +101,6 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
DEPENDEES install
)
if(WITH_NANOVDB)
ExternalProject_Add_Step(openvdb nanovdb_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES after_install
)
endif()
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(openvdb after_install

View File

@@ -21,7 +21,6 @@ if(WIN32)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
option(WITH_NANOVDB "Enable building of OpenVDB with NanoVDB included" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE)
@@ -57,7 +56,7 @@ if(WIN32)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
set(COMMON_MSVC_FLAGS "${COMMON_MSVC_FLAGS} /bigobj")
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()

View File

@@ -78,14 +78,10 @@ set(OSL_EXTRA_ARGS
-DINSTALL_DOCS=OFF
${OSL_SIMD_FLAGS}
-DPARTIO_LIBRARIES=
-DPUGIXML_HOME=${LIBDIR}/pugixml
)
if(WIN32)
set(OSL_EXTRA_ARGS
${OSL_EXTRA_ARGS}
-DPUGIXML_HOME=${LIBDIR}/pugixml
)
elseif(APPLE)
if(APPLE)
# Make symbol hiding consistent with OIIO which defaults to OFF,
# avoids linker warnings on macOS
set(OSL_EXTRA_ARGS
@@ -114,17 +110,9 @@ add_dependencies(
external_zlib
external_flexbison
external_openimageio
external_pugixml
)
if(UNIX)
# Rely on PugiXML compiled with OpenImageIO
else()
add_dependencies(
external_osl
external_pugixml
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_osl after_install

View File

@@ -30,13 +30,13 @@ ExternalProject_Add(external_pugixml
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_pugixml after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/osl/lib/pugixml.lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pugixml ${HARVEST_TARGET}/pugixml
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_pugixml after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/osl/lib/pugixml_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pugixml/lib/pugixml.lib ${HARVEST_TARGET}/pugixml/lib/pugixml_d.lib
DEPENDEES install
)
endif()

View File

@@ -120,6 +120,9 @@ set(LLVM_HASH 31eb9ce73dd2a0f8dcab8319fb03f8fc)
set(CLANG_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-${LLVM_VERSION}.src.tar.xz)
set(CLANG_HASH 13468e4a44940efef1b75e8641752f90)
set(CLANG_TOOLS_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-tools-extra-${LLVM_VERSION}.src.tar.xz)
set(CLANG_TOOLS_HASH c76293870b564c6a7968622b475b7646)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
@@ -145,15 +148,13 @@ set(TBB_VERSION 2019_U9)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 26263622e9187212ec240dcf01b66207)
if(WITH_NANOVDB)
set(OPENVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${OPENVDB_GIT_UID}.tar.gz)
set(OPENVDB_HASH 90919510bc6ccd630fedc56f748cb199)
else()
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
endif()
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(IDNA_VERSION 2.9)
set(CHARDET_VERSION 3.0.4)

View File

@@ -51,7 +51,7 @@ ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,with-jack,with-embree,with-oidn,\
with-all,with-opencollada,with-jack,with-embree,with-oidn,with-nanovdb,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\
force-all,force-python,force-numpy,force-boost,force-tbb,\
force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
@@ -151,6 +151,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--with-oidn
Build and install the OpenImageDenoise libraries.
--with-nanovdb
Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
--with-jack
Install the jack libraries.
@@ -435,7 +438,7 @@ _with_built_openexr=false
OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.1"
OIIO_VERSION_MIN="1.8"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="3.0"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
@@ -676,6 +679,10 @@ while true; do
--with-oidn)
WITH_OIDN=true; shift; continue
;;
--with-nanovdb)
WITH_NANOVDB=true;
shift; continue
;;
--with-jack)
WITH_JACK=true; shift; continue;
;;
@@ -957,6 +964,11 @@ if [ "$WITH_ALL" = true -a "$OIDN_SKIP" = false ]; then
fi
if [ "$WITH_ALL" = true ]; then
WITH_JACK=true
WITH_NANOVDB=true
fi
if [ "$WITH_NANOVDB" = true ]; then
OPENVDB_FORCE_BUILD=true
fi
@@ -1029,11 +1041,15 @@ OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD
OPENVDB_USE_REPO=false
OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" )
OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
#~ OPENVDB_SOURCE_REPO=( "https:///dreamworksanimation/openvdb.git" )
OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
#~ OPENVDB_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/openvdb.git" )
#~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false
ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
@@ -2070,7 +2086,7 @@ compile_OIIO() {
cmake_d="$cmake_d -D USE_OPENCV=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=ON"
cmake_d="$cmake_d -D TXT2MAN="
#cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
@@ -2594,11 +2610,115 @@ compile_BLOSC() {
# ----------------------------------------------------------------------------
# Build OpenVDB
_init_nanovdb() {
_src=$SRC/openvdb-$OPENVDB_VERSION/nanovdb
_inst=$INST/nanovdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/nanovdb
}
_update_deps_nanovdb() {
:
}
clean_nanovdb() {
_init_nanovdb
if [ -d $_inst ]; then
_update_deps_nanovdb
fi
_git=true # Mere trick to prevent clean from removing $_src...
_clean
}
install_NanoVDB() {
# To be changed each time we make edits that would modify the compiled results!
nanovdb_magic=1
_init_nanovdb
# Clean install if needed!
magic_compile_check nanovdb-$OPENVDB_VERSION $nanovdb_magic
if [ $? -eq 1 ]; then
clean_nanovdb
fi
if [ ! -d $_inst ]; then
INFO "Installing NanoVDB v$OPENVDB_VERSION"
_is_building=true
# Rebuild dependencies as well!
_update_deps_nanovdb
prepare_inst
if [ ! -d $_src ]; then
ERROR "NanoVDB not found in openvdb-$OPENVDB_VERSION ($_src), exiting"
exit 1
fi
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
# NanoVDB is header-only, so only need the install target
cmake_d="$cmake_d -D NANOVDB_BUILD_UNITTESTS=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_EXAMPLES=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_BENCHMARK=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_DOCS=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D NANOVDB_CUDA_KEEP_PTX=OFF"
# Do not need to include any of the dependencies because of this
cmake_d="$cmake_d -D NANOVDB_USE_OPENVDB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPENGL=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPENCL=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_CUDA=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_TBB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_BLOSC=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_ZLIB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPTIX=OFF"
cmake_d="$cmake_d -D NANOVDB_ALLOW_FETCHCONTENT=OFF"
cmake $cmake_d $_src
make -j$THREADS install
make clean
#~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1
fi
magic_compile_set nanovdb-$OPENVDB_VERSION $nanovdb_magic
cd $CWD
INFO "Done compiling NanoVDB-v$OPENVDB_VERSION!"
_is_building=false
else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi
}
_init_openvdb() {
_src=$SRC/openvdb-$OPENVDB_VERSION
_git=false
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/openvdb
_openvdb_source=$OPENVDB_SOURCE
if [ "$WITH_NANOVDB" = true ]; then
_openvdb_source=$NANOVDB_SOURCE
fi
}
_update_deps_openvdb() {
@@ -2623,7 +2743,7 @@ compile_OPENVDB() {
PRINT ""
# To be changed each time we make edits that would modify the compiled result!
openvdb_magic=1
openvdb_magic=2
_init_openvdb
# Clean install if needed!
@@ -2633,7 +2753,7 @@ compile_OPENVDB() {
fi
if [ ! -d $_inst ]; then
INFO "Building OpenVDB-$OPENVDB_VERSION"
INFO "Building OpenVDB-$OPENVDB_VERSION (with NanoVDB: $WITH_NANOVDB)"
_is_building=true
# Rebuild dependencies as well!
@@ -2641,12 +2761,17 @@ compile_OPENVDB() {
prepare_inst
if [ ! -d $_src -o true ]; then
if [ ! -d $_src ]; then
mkdir -p $SRC
download OPENVDB_SOURCE[@] "$_src.tar.gz"
download _openvdb_source[@] "$_src.tar.gz"
INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
tar -C $SRC -xf $_src.tar.gz
if [ "$WITH_NANOVDB" = true ]; then
tar -C $SRC --transform "s,(.*/?)openvdb-$NANOVDB_SOURCE_REPO_UID[^/]*(.*),\1openvdb-$OPENVDB_VERSION\2,x" \
-xf $_src.tar.gz
else
tar -C $SRC -xf $_src.tar.gz
fi
fi
cd $_src
@@ -2660,33 +2785,40 @@ compile_OPENVDB() {
#~ git reset --hard
#~ fi
# Source builds here
cd openvdb
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
make_d="DESTDIR=$_inst"
make_d="$make_d HDSO=/usr"
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
if [ -d $INST/boost ]; then
make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib"
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
fi
if [ -d $INST/tbb ]; then
make_d="$make_d TBB_ROOT=$INST/tbb TBB_USE_STATIC_LIBS=OFF"
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
fi
if [ "$_with_built_openexr" = true ]; then
make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib"
make_d="$make_d EXR_INCL_DIR=$INST/openexr/include EXR_LIB_DIR=$INST/openexr/lib"
INFO "ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D IlmBase_ROOT=$INST/openexr"
cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr"
fi
if [ -d $INST/blosc ]; then
make_d="$make_d BLOSC_INCL_DIR=$INST/blosc/include BLOSC_LIB_DIR=$INST/blosc/lib"
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
fi
cmake $cmake_d ..
# Build without log4cplus, glfw, python module & docs
make_d="$make_d LOG4CPLUS_INCL_DIR= GLFW_INCL_DIR= PYTHON_VERSION= DOXYGEN="
make -j$THREADS lib $make_d install
make -j$THREADS install
make clean
if [ -d $_inst ]; then
@@ -2707,6 +2839,10 @@ compile_OPENVDB() {
fi
run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then
install_NanoVDB
fi
}
# ----------------------------------------------------------------------------
@@ -3936,7 +4072,7 @@ install_DEB() {
else
check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
install_packages_DEB libopenimageio-dev
install_packages_DEB libopenimageio-dev openimageio-tools
clean_OIIO
else
compile_OIIO
@@ -4578,13 +4714,13 @@ install_RPM() {
INFO "Forced OpenImageIO building, as requested..."
compile_OIIO
else
#check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
#if [ $? -eq 0 -a $_with_built_openexr == false ]; then
# install_packages_RPM OpenImageIO-devel
# clean_OIIO
#else
check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel OpenImageIO-utils
clean_OIIO
else
compile_OIIO
#fi
fi
fi
@@ -5691,6 +5827,13 @@ print_info() {
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
if [ -d $INST/nanovdb ]; then
_1="-D WITH_NANOVDB=ON"
_2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
fi
if [ "$WITH_OPENCOLLADA" = true ]; then

View File

@@ -34,3 +34,24 @@ diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/incl
# include <windows.h>
#endif
diff -Naur orig/src/libutil/ustring.cpp external_openimageio/src/libutil/ustring.cpp
--- orig/src/libutil/ustring.cpp 2020-05-11 05:43:52.000000000 +0200
+++ external_openimageio/src/libutil/ustring.cpp 2020-11-26 12:06:08.000000000 +0100
@@ -337,6 +337,8 @@
// the std::string to make it point to our chars! In such a case, the
// destructor will be careful not to allow a deallocation.
+ // Disable internal std::string for Apple silicon based Macs
+#if !(defined(__APPLE__) && defined(__arm64__))
#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) \
&& defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI
// NEW gcc ABI
@@ -382,7 +384,7 @@
return;
}
#endif
-
+#endif
// Remaining cases - just assign the internal string. This may result
// in double allocation for the chars. If you care about that, do
// something special for your platform, much like we did for gcc and

View File

@@ -1,135 +0,0 @@
diff -Naur orig/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake
--- orig/cmake/FindIlmBase.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindIlmBase.cmake 2020-08-12 12:48:44 -0600
@@ -217,6 +217,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake
--- orig/cmake/FindOpenEXR.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindOpenEXR.cmake 2020-08-12 12:48:44 -0600
@@ -210,6 +210,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(OPENEXR_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
--- orig/openvdb/openvdb/CMakeLists.txt 2019-12-06 12:11:33 -0700
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2020-08-12 14:12:26 -0600
@@ -105,7 +105,9 @@
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
set(BUILD_SHARED_LIBS ON)
- set(Boost_USE_STATIC_LIBS OFF)
+ if(NOT WIN32) # blender links boost statically on windows
+ set(Boost_USE_STATIC_LIBS OFF)
+ endif()
endif()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system)
@@ -193,6 +195,7 @@
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
+ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_OPENEXR_STATICLIB)
endif()
# @todo Should be target definitions
@@ -383,7 +386,12 @@
# imported targets.
if(OPENVDB_CORE_SHARED)
- add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ if(WIN32)
+ configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
+ else()
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ endif()
endif()
if(OPENVDB_CORE_STATIC)
diff -Naur orig/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/version.rc.in
--- orig/openvdb/openvdb/version.rc.in 1969-12-31 17:00:00 -0700
+++ openvdb/openvdb/openvdb/version.rc.in 2020-08-12 14:15:01 -0600
@@ -0,0 +1,48 @@
+#include <winver.h>
+
+#define VER_FILEVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_FILEVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@.@OpenVDB_PATCH_VERSION@.0\0"
+
+#define VER_PRODUCTVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_PRODUCTVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@\0"
+
+#ifndef DEBUG
+#define VER_DEBUG 0
+#else
+#define VER_DEBUG VS_FF_DEBUG
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS (VER_DEBUG)
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileDescription", "OpenVDB"
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", "OpenVDB"
+ VALUE "ProductName", "OpenVDB"
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
+ END
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ /* The following line should only be modified for localized versions. */
+ /* It consists of any number of WORD,WORD pairs, with each pair */
+ /* describing a language,codepage combination supported by the file. */
+ /* */
+ /* For example, a file might have values "0x409,1252" indicating that it */
+ /* supports English language (0x409) in the Windows ANSI codepage (1252). */
+
+ VALUE "Translation", 0x409, 1252
+
+ END
+END
diff -Naur openvdb-original/CMakeLists.txt openvdb/CMakeLists.txt
--- openvdb-original/CMakeLists.txt 2020-08-27 03:34:02.000000000 +0200
+++ openvdb/CMakeLists.txt 2020-09-02 10:56:21.665735244 +0200
@@ -68,6 +68,7 @@
option(OPENVDB_INSTALL_HOUDINI_PYTHONRC [=[Install a Houdini startup script that sets
the visibilty of OpenVDB nodes and their native equivalents.]=] OFF)
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
+option(OPENVDB_BUILD_NANOVDB "Build nanovdb" ON)
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
option(OPENVDB_CODE_COVERAGE "Enable code coverage. This also overrides CMAKE_BUILD_TYPE to Debug" OFF)
@@ -740,6 +741,10 @@
add_subdirectory(openvdb_maya)
endif()
+if(OPENVDB_BUILD_NANOVDB)
+ add_subdirectory(nanovdb)
+endif()
+
##########################################################################
add_custom_target(uninstall

View File

@@ -88,7 +88,6 @@ class VersionInfo:
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
@@ -97,8 +96,7 @@ class VersionInfo:
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
self.full_version = self.version + version_cycle
self.full_version = self.version + self.version_cycle
self.is_development_build = False
else:
# Development build

View File

@@ -18,12 +18,72 @@
# <pep8 compliant>
import dataclasses
import json
import os
from pathlib import Path
from typing import Optional
import codesign.util as util
class ArchiveStateError(Exception):
message: str
def __init__(self, message):
self.message = message
super().__init__(self.message)
@dataclasses.dataclass
class ArchiveState:
"""
Additional information (state) of the archive
Includes information like expected file size of the archive file in the case
the archive file is expected to be successfully created.
If the archive can not be created, this state will contain error message
indicating details of error.
"""
# Size in bytes of the corresponding archive.
file_size: Optional[int] = None
# Non-empty value indicates that error has happenned.
error_message: str = ''
def has_error(self) -> bool:
"""
Check whether the archive is at error state
"""
return self.error_message
def serialize_to_string(self) -> str:
payload = dataclasses.asdict(self)
return json.dumps(payload, sort_keys=True, indent=4)
def serialize_to_file(self, filepath: Path) -> None:
string = self.serialize_to_string()
filepath.write_text(string)
@classmethod
def deserialize_from_string(cls, string: str) -> 'ArchiveState':
try:
object_as_dict = json.loads(string)
except json.decoder.JSONDecodeError:
raise ArchiveStateError('Error parsing JSON')
return cls(**object_as_dict)
@classmethod
def deserialize_from_file(cls, filepath: Path):
string = filepath.read_text()
return cls.deserialize_from_string(string)
class ArchiveWithIndicator:
"""
The idea of this class is to wrap around logic which takes care of keeping
@@ -79,6 +139,19 @@ class ArchiveWithIndicator:
if not self.ready_indicator_filepath.exists():
return False
try:
archive_state = ArchiveState.deserialize_from_file(
self.ready_indicator_filepath)
except ArchiveStateError as error:
print(f'Error deserializing archive state: {error.message}')
return False
if archive_state.has_error():
# If the error did happen during codesign procedure there will be no
# corresponding archive file.
# The caller code will deal with the error check further.
return True
# Sometimes on macOS indicator file appears prior to the actual archive
# despite the order of creation and os.sync() used in tag_ready().
# So consider archive not ready if there is an indicator without an
@@ -88,23 +161,11 @@ class ArchiveWithIndicator:
f'({self.archive_filepath}) to appear.')
return False
# Read archive size from indicator/
#
# Assume that file is either empty or is fully written. This is being checked
# by performing ValueError check since empty string will throw this exception
# when attempted to be converted to int.
expected_archive_size_str = self.ready_indicator_filepath.read_text()
try:
expected_archive_size = int(expected_archive_size_str)
except ValueError:
print(f'Invalid archive size "{expected_archive_size_str}"')
return False
# Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != expected_archive_size:
if actual_archive_size != archive_state.file_size:
print('Partial/invalid archive size (expected '
f'{expected_archive_size} got {actual_archive_size})')
f'{archive_state.file_size} got {actual_archive_size})')
return False
return True
@@ -129,7 +190,7 @@ class ArchiveWithIndicator:
print(f'Exception checking archive: {e}')
return False
def tag_ready(self) -> None:
def tag_ready(self, error_message='') -> None:
"""
Tag the archive as ready by creating the corresponding indication file.
@@ -138,13 +199,34 @@ class ArchiveWithIndicator:
If it is violated, an assert will fail.
"""
assert not self.is_ready()
# Try the best to make sure everything is synced to the file system,
# to avoid any possibility of stamp appearing on a network share prior to
# an actual file.
if util.get_current_platform() != util.Platform.WINDOWS:
os.sync()
archive_size = self.archive_filepath.stat().st_size
self.ready_indicator_filepath.write_text(str(archive_size))
archive_size = -1
if self.archive_filepath.exists():
archive_size = self.archive_filepath.stat().st_size
archive_info = ArchiveState(
file_size=archive_size, error_message=error_message)
self.ready_indicator_filepath.write_text(
archive_info.serialize_to_string())
def get_state(self) -> ArchiveState:
"""
Get state object for this archive
The state is read from the corresponding state file.
"""
try:
return ArchiveState.deserialize_from_file(self.ready_indicator_filepath)
except ArchiveStateError as error:
return ArchiveState(error_message=f'Error in information format: {error}')
def clean(self) -> None:
"""

View File

@@ -58,6 +58,7 @@ import codesign.util as util
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.archive_with_indicator import ArchiveWithIndicator
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
@@ -145,13 +146,13 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
def cleanup_environment_for_builder(self) -> None:
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even mor etricky.
# talking to the same server it becomes even more tricky.
pass
def cleanup_environment_for_signing_server(self) -> None:
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even mor etricky.
# talking to the same server it becomes even more tricky.
pass
def generate_request_id(self) -> str:
@@ -220,9 +221,15 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
"""
Wait until archive with signed files is available.
Will only return if the archive with signed files is available. If there
was an error during code sign procedure the SystemExit exception is
raised, with the message set to the error reported by the codesign
server.
Will only wait for the configured time. If that time exceeds and there
is still no responce from the signing server the application will exit
with a non-zero exit code.
"""
signed_archive_info = self.signed_archive_info_for_request_id(
@@ -236,9 +243,17 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
time.sleep(1)
time_slept_in_seconds = time.monotonic() - time_start
if time_slept_in_seconds > timeout_in_seconds:
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit("Signing server didn't finish signing in "
f"{timeout_in_seconds} seconds, dying :(")
f'{timeout_in_seconds} seconds, dying :(')
archive_state = signed_archive_info.get_state()
if archive_state.has_error():
signed_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit(
f'Error happenned during codesign procedure: {archive_state.error_message}')
def copy_signed_files_to_directory(
self, signed_dir: Path, destination_dir: Path) -> None:
@@ -396,7 +411,13 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
temp_dir)
logger_server.info('Signing all requested files...')
self.sign_all_files(files)
try:
self.sign_all_files(files)
except CodeSignException as error:
signed_archive_info.tag_ready(error_message=error.message)
unsigned_archive_info.clean()
logger_server.info('Signing is complete with errors.')
return
logger_server.info('Packing signed files...')
pack_files(files=files,

View File

@@ -16,26 +16,11 @@
#
# ##### END GPL LICENSE BLOCK #####
import bpy
# <pep8 compliant>
class CodeSignException(Exception):
message: str
class NewSimulation(bpy.types.Operator):
"""Create a new simulation data block and edit it in the opened simulation editor"""
bl_idname = "simulation.new"
bl_label = "New Simulation"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
return context.area.type == 'NODE_EDITOR' and context.space_data.tree_type == 'SimulationNodeTree'
def execute(self, context):
simulation = bpy.data.simulations.new("Simulation")
context.space_data.simulation = simulation
return {'FINISHED'}
classes = (
NewSimulation,
)
def __init__(self, message):
self.message = message
super().__init__(self.message)

View File

@@ -33,6 +33,7 @@ from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
@@ -45,6 +46,10 @@ EXTENSIONS_TO_BE_SIGNED = {'.dylib', '.so', '.dmg'}
NAME_PREFIXES_TO_BE_SIGNED = {'python'}
class NotarizationException(CodeSignException):
pass
def is_file_from_bundle(file: AbsoluteAndRelativeFileName) -> bool:
"""
Check whether file is coming from an .app bundle
@@ -186,7 +191,7 @@ class MacOSCodeSigner(BaseCodeSigner):
file.absolute_filepath]
self.run_command_or_mock(command, util.Platform.MACOS)
def codesign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> bool:
def codesign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
Run codesign tool on all eligible files in the given list.
@@ -225,8 +230,6 @@ class MacOSCodeSigner(BaseCodeSigner):
file_index + 1, num_signed_files,
signed_file.relative_filepath)
return True
def codesign_bundles(
self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
@@ -273,8 +276,6 @@ class MacOSCodeSigner(BaseCodeSigner):
files.extend(extra_files)
return True
############################################################################
# Notarization.
@@ -334,7 +335,40 @@ class MacOSCodeSigner(BaseCodeSigner):
logger_server.error('xcrun command did not report RequestUUID')
return None
def notarize_wait_result(self, request_uuid: str) -> bool:
def notarize_review_status(self, xcrun_output: str) -> bool:
"""
Review status returned by xcrun's notarization info
Returns truth if the notarization process has finished.
If there are errors during notarization, a NotarizationException()
exception is thrown with status message from the notarial office.
"""
# Parse status and message
status = xcrun_field_value_from_output('Status', xcrun_output)
status_message = xcrun_field_value_from_output(
'Status Message', xcrun_output)
if status == 'success':
logger_server.info(
'Package successfully notarized: %s', status_message)
return True
if status == 'invalid':
logger_server.error(xcrun_output)
logger_server.error(
'Package notarization has failed: %s', status_message)
raise NotarizationException(status_message)
if status == 'in progress':
return False
logger_server.info(
'Unknown notarization status %s (%s)', status, status_message)
return False
def notarize_wait_result(self, request_uuid: str) -> None:
"""
Wait for until notarial office have a reply
"""
@@ -351,29 +385,11 @@ class MacOSCodeSigner(BaseCodeSigner):
timeout_in_seconds = self.config.MACOS_NOTARIZE_TIMEOUT_IN_SECONDS
while True:
output = self.check_output_or_mock(
xcrun_output = self.check_output_or_mock(
command, util.Platform.MACOS, allow_nonzero_exit_code=True)
# Parse status and message
status = xcrun_field_value_from_output('Status', output)
status_message = xcrun_field_value_from_output(
'Status Message', output)
# Review status.
if status:
if status == 'success':
logger_server.info(
'Package successfully notarized: %s', status_message)
return True
elif status == 'invalid':
logger_server.error(output)
logger_server.error(
'Package notarization has failed: %s', status_message)
return False
elif status == 'in progress':
pass
else:
logger_server.info(
'Unknown notarization status %s (%s)', status, status_message)
if self.notarize_review_status(xcrun_output):
break
logger_server.info('Keep waiting for notarization office.')
time.sleep(30)
@@ -394,8 +410,6 @@ class MacOSCodeSigner(BaseCodeSigner):
command = ['xcrun', 'stapler', 'staple', '-v', file.absolute_filepath]
self.check_output_or_mock(command, util.Platform.MACOS)
return True
def notarize_dmg(self, file: AbsoluteAndRelativeFileName) -> bool:
"""
Run entire pipeline to get DMG notarized.
@@ -414,10 +428,7 @@ class MacOSCodeSigner(BaseCodeSigner):
return False
# Staple.
if not self.notarize_staple(file):
return False
return True
self.notarize_staple(file)
def notarize_all_dmg(
self, files: List[AbsoluteAndRelativeFileName]) -> bool:
@@ -432,10 +443,7 @@ class MacOSCodeSigner(BaseCodeSigner):
if not self.check_file_is_to_be_signed(file):
continue
if not self.notarize_dmg(file):
return False
return True
self.notarize_dmg(file)
############################################################################
# Entry point.
@@ -443,11 +451,6 @@ class MacOSCodeSigner(BaseCodeSigner):
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# TODO(sergey): Handle errors somehow.
if not self.codesign_all_files(files):
return
if not self.codesign_bundles(files):
return
if not self.notarize_all_dmg(files):
return
self.codesign_all_files(files)
self.codesign_bundles(files)
self.notarize_all_dmg(files)

View File

@@ -29,6 +29,7 @@ from buildbot_utils import Builder
from codesign.absolute_and_relative_filename import AbsoluteAndRelativeFileName
from codesign.base_code_signer import BaseCodeSigner
from codesign.exception import CodeSignException
logger = logging.getLogger(__name__)
logger_server = logger.getChild('server')
@@ -40,6 +41,9 @@ BLACKLIST_FILE_PREFIXES = (
'api-ms-', 'concrt', 'msvcp', 'ucrtbase', 'vcomp', 'vcruntime')
class SigntoolException(CodeSignException):
pass
class WindowsCodeSigner(BaseCodeSigner):
def check_file_is_to_be_signed(
self, file: AbsoluteAndRelativeFileName) -> bool:
@@ -50,12 +54,46 @@ class WindowsCodeSigner(BaseCodeSigner):
return file.relative_filepath.suffix in EXTENSIONS_TO_BE_SIGNED
def get_sign_command_prefix(self) -> List[str]:
return [
'signtool', 'sign', '/v',
'/f', self.config.WIN_CERTIFICATE_FILEPATH,
'/tr', self.config.WIN_TIMESTAMP_AUTHORITY_URL]
def run_codesign_tool(self, filepath: Path) -> None:
command = self.get_sign_command_prefix() + [filepath]
try:
codesign_output = self.check_output_or_mock(command, util.Platform.WINDOWS)
except subprocess.CalledProcessError as e:
raise SigntoolException(f'Error running signtool {e}')
logger_server.info(f'signtool output:\n{codesign_output}')
got_number_of_success = False
for line in codesign_output.split('\n'):
line_clean = line.strip()
line_clean_lower = line_clean.lower()
if line_clean_lower.startswith('number of warnings') or \
line_clean_lower.startswith('number of errors'):
number = int(line_clean_lower.split(':')[1])
if number != 0:
raise SigntoolException('Non-clean success of signtool')
if line_clean_lower.startswith('number of files successfully signed'):
got_number_of_success = True
number = int(line_clean_lower.split(':')[1])
if number != 1:
raise SigntoolException('Signtool did not consider codesign a success')
if not got_number_of_success:
raise SigntoolException('Signtool did not report number of files signed')
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
# NOTE: Sign files one by one to avoid possible command line length
# overflow (which could happen if we ever decide to sign every binary
@@ -73,12 +111,7 @@ class WindowsCodeSigner(BaseCodeSigner):
file_index + 1, num_files, file.relative_filepath)
continue
command = self.get_sign_command_prefix()
command.append(file.absolute_filepath)
logger_server.info(
'Running signtool command for file [%d/%d] %s...',
file_index + 1, num_files, file.relative_filepath)
# TODO(sergey): Check the status somehow. With a missing certificate
# the command still exists with a zero code.
self.run_command_or_mock(command, util.Platform.WINDOWS)
# TODO(sergey): Report number of signed and ignored files.
self.run_codesign_tool(file.absolute_filepath)

View File

@@ -42,7 +42,7 @@ def get_cmake_options(builder):
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK')
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK-7.1')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
# Workaround to build sm_30 kernels with CUDA 10, since CUDA 11 no longer supports that architecture

View File

@@ -43,7 +43,10 @@ find_program(CLANG_TIDY_EXECUTABLE
${_clang_tidy_SEARCH_DIRS}
)
if(CLANG_TIDY_EXECUTABLE)
if(CLANG_TIDY_EXECUTABLE AND NOT EXISTS ${CLANG_TIDY_EXECUTABLE})
message(WARNING "Cached or directly specified Clang-Tidy executable does not exist.")
set(CLANG_TIDY_FOUND FALSE)
elseif(CLANG_TIDY_EXECUTABLE)
# Mark clang-tidy as found.
set(CLANG_TIDY_FOUND TRUE)

View File

@@ -49,7 +49,7 @@ FIND_LIBRARY(PUGIXML_LIBRARY
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PugiXML DEFAULT_MSG
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
IF(PUGIXML_FOUND)

View File

@@ -330,6 +330,9 @@ function(gtest_add_tests)
set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
# This will get a filter for each test suite.
set(test_filters "")
foreach(source IN LISTS ARGS_SOURCES)
if(NOT ARGS_SKIP_DEPENDENCY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
@@ -376,175 +379,32 @@ function(gtest_add_tests)
list(APPEND testList ${ctest_test_name})
endif()
else()
set(ctest_test_name ${ARGS_TEST_PREFIX}${gtest_test_name}${ARGS_TEST_SUFFIX})
add_test(NAME ${ctest_test_name}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_filter=${gtest_test_name}
${ARGS_EXTRA_ARGS}
)
list(APPEND testList ${ctest_test_name})
# BLENDER: collect tests named "suite.testcase" as list of "suite.*" filters.
string(REGEX REPLACE "\\..*$" "" gtest_suite_name ${gtest_test_name})
list(APPEND test_filters "${gtest_suite_name}.*")
endif()
endforeach()
endforeach()
# Join all found GTest suite names into one big filter.
list(REMOVE_DUPLICATES test_filters)
list(JOIN test_filters ":" gtest_filter)
add_test(NAME ${ARGS_TEST_PREFIX}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_filter=${gtest_filter}
${ARGS_EXTRA_ARGS}
)
list(APPEND testList ${ARGS_TEST_PREFIX})
if(ARGS_TEST_LIST)
set(${ARGS_TEST_LIST} ${testList} PARENT_SCOPE)
endif()
endfunction()
#------------------------------------------------------------------------------
function(gtest_discover_tests TARGET)
cmake_parse_arguments(
""
"NO_PRETTY_TYPES;NO_PRETTY_VALUES"
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;DISCOVERY_TIMEOUT;XML_OUTPUT_DIR;DISCOVERY_MODE"
"EXTRA_ARGS;PROPERTIES"
${ARGN}
)
if(NOT _WORKING_DIRECTORY)
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if(NOT _TEST_LIST)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
if(NOT _DISCOVERY_TIMEOUT)
set(_DISCOVERY_TIMEOUT 5)
endif()
if(NOT _DISCOVERY_MODE)
if(NOT CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE)
set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE "POST_BUILD")
endif()
set(_DISCOVERY_MODE ${CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE})
endif()
get_property(
has_counter
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
SET
)
if(has_counter)
get_property(
counter
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
)
math(EXPR counter "${counter} + 1")
else()
set(counter 1)
endif()
set_property(
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
${counter}
)
# Define rule to generate test list for aforementioned test executable
# Blender: use _ instead of [] to avoid problems with zsh regex.
set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_${counter}_")
set(ctest_include_file "${ctest_file_base}_include.cmake")
set(ctest_tests_file "${ctest_file_base}_tests.cmake")
get_property(crosscompiling_emulator
TARGET ${TARGET}
PROPERTY CROSSCOMPILING_EMULATOR
)
if(_DISCOVERY_MODE STREQUAL "POST_BUILD")
add_custom_command(
TARGET ${TARGET} POST_BUILD
BYPRODUCTS "${ctest_tests_file}"
COMMAND "${CMAKE_COMMAND}"
-D "TEST_TARGET=${TARGET}"
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
-D "TEST_PROPERTIES=${_PROPERTIES}"
-D "TEST_PREFIX=${_TEST_PREFIX}"
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
-D "NO_PRETTY_TYPES=${_NO_PRETTY_TYPES}"
-D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}"
-D "TEST_LIST=${_TEST_LIST}"
-D "CTEST_FILE=${ctest_tests_file}"
-D "TEST_DISCOVERY_TIMEOUT=${_DISCOVERY_TIMEOUT}"
-D "TEST_XML_OUTPUT_DIR=${_XML_OUTPUT_DIR}"
-P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}"
VERBATIM
)
file(WRITE "${ctest_include_file}"
"if(EXISTS \"${ctest_tests_file}\")\n"
" include(\"${ctest_tests_file}\")\n"
"else()\n"
" add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)\n"
"endif()\n"
)
elseif(_DISCOVERY_MODE STREQUAL "PRE_TEST")
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL
PROPERTY GENERATOR_IS_MULTI_CONFIG
)
if(GENERATOR_IS_MULTI_CONFIG)
set(ctest_tests_file "${ctest_file_base}_tests-$<CONFIG>.cmake")
endif()
string(CONCAT ctest_include_content
"if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n"
" if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n"
" include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n"
" gtest_discover_tests_impl(" "\n"
" TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n"
" TEST_EXECUTOR" " [==[" "${crosscompiling_emulator}" "]==]" "\n"
" TEST_WORKING_DIR" " [==[" "${_WORKING_DIRECTORY}" "]==]" "\n"
" TEST_EXTRA_ARGS" " [==[" "${_EXTRA_ARGS}" "]==]" "\n"
" TEST_PROPERTIES" " [==[" "${_PROPERTIES}" "]==]" "\n"
" TEST_PREFIX" " [==[" "${_TEST_PREFIX}" "]==]" "\n"
" TEST_SUFFIX" " [==[" "${_TEST_SUFFIX}" "]==]" "\n"
" NO_PRETTY_TYPES" " [==[" "${_NO_PRETTY_TYPES}" "]==]" "\n"
" NO_PRETTY_VALUES" " [==[" "${_NO_PRETTY_VALUES}" "]==]" "\n"
" TEST_LIST" " [==[" "${_TEST_LIST}" "]==]" "\n"
" CTEST_FILE" " [==[" "${ctest_tests_file}" "]==]" "\n"
" TEST_DISCOVERY_TIMEOUT" " [==[" "${_DISCOVERY_TIMEOUT}" "]==]" "\n"
" TEST_XML_OUTPUT_DIR" " [==[" "${_XML_OUTPUT_DIR}" "]==]" "\n"
" )" "\n"
" endif()" "\n"
" include(\"${ctest_tests_file}\")" "\n"
"else()" "\n"
" add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)" "\n"
"endif()" "\n"
)
if(GENERATOR_IS_MULTI_CONFIG)
foreach(_config ${CMAKE_CONFIGURATION_TYPES})
file(GENERATE OUTPUT "${ctest_file_base}_include-${_config}.cmake" CONTENT "${ctest_include_content}" CONDITION $<CONFIG:${_config}>)
endforeach()
file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")")
else()
file(GENERATE OUTPUT "${ctest_file_base}_include.cmake" CONTENT "${ctest_include_content}")
file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include.cmake\")")
endif()
else()
message(FATAL_ERROR "Unknown DISCOVERY_MODE: ${_DISCOVERY_MODE}")
endif()
# Add discovered tests to directory TEST_INCLUDE_FILES
set_property(DIRECTORY
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
)
endfunction()
###############################################################################
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_CURRENT_LIST_DIR}/GTestAddTests.cmake
)
# BLENDER: remove the discovery function gtest_discover_tests(). It's not used,
# as it generates too many test invocations.
# Restore project's policies
cmake_policy(POP)

View File

@@ -1,191 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
# Blender: disable ASAN leak detection when trying to discover tests.
set(ENV{ASAN_OPTIONS} "detect_leaks=0")
cmake_minimum_required(VERSION ${CMAKE_VERSION})
# Overwrite possibly existing ${_CTEST_FILE} with empty file
set(flush_tests_MODE WRITE)
# Flushes script to ${_CTEST_FILE}
macro(flush_script)
file(${flush_tests_MODE} "${_CTEST_FILE}" "${script}")
set(flush_tests_MODE APPEND)
set(script "")
endmacro()
# Flushes tests_buffer to tests
macro(flush_tests_buffer)
list(APPEND tests "${tests_buffer}")
set(tests_buffer "")
endmacro()
macro(add_command NAME)
set(_args "")
foreach(_arg ${ARGN})
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
string(APPEND _args " [==[${_arg}]==]")
else()
string(APPEND _args " ${_arg}")
endif()
endforeach()
string(APPEND script "${NAME}(${_args})\n")
string(LENGTH "${script}" _script_len)
if(${_script_len} GREATER "50000")
flush_script()
endif()
# Unsets macro local variables to prevent leakage outside of this macro.
unset(_args)
unset(_script_len)
endmacro()
function(gtest_discover_tests_impl)
cmake_parse_arguments(
""
""
"NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_EXECUTOR;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR"
"TEST_EXTRA_ARGS;TEST_PROPERTIES"
${ARGN}
)
set(prefix "${_TEST_PREFIX}")
set(suffix "${_TEST_SUFFIX}")
set(extra_args ${_TEST_EXTRA_ARGS})
set(properties ${_TEST_PROPERTIES})
set(script)
set(suite)
set(tests)
set(tests_buffer)
# Run test executable to get list of available tests
if(NOT EXISTS "${_TEST_EXECUTABLE}")
message(FATAL_ERROR
"Specified test executable does not exist.\n"
" Path: '${_TEST_EXECUTABLE}'"
)
endif()
execute_process(
COMMAND ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" --gtest_list_tests
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
TIMEOUT ${_TEST_DISCOVERY_TIMEOUT}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
)
if(NOT ${result} EQUAL 0)
string(REPLACE "\n" "\n " output "${output}")
message(FATAL_ERROR
"Error running test executable.\n"
" Path: '${_TEST_EXECUTABLE}'\n"
" Result: ${result}\n"
" Output:\n"
" ${output}\n"
)
endif()
# Preserve semicolon in test-parameters
string(REPLACE [[;]] [[\;]] output "${output}")
string(REPLACE "\n" ";" output "${output}")
# Parse output
foreach(line ${output})
# Skip header
if(NOT line MATCHES "gtest_main\\.cc")
# Do we have a module name or a test name?
if(NOT line MATCHES "^ ")
# Module; remove trailing '.' to get just the name...
string(REGEX REPLACE "\\.( *#.*)?" "" suite "${line}")
if(line MATCHES "#" AND NOT _NO_PRETTY_TYPES)
string(REGEX REPLACE "/[0-9]\\.+ +#.*= +" "/" pretty_suite "${line}")
else()
set(pretty_suite "${suite}")
endif()
string(REGEX REPLACE "^DISABLED_" "" pretty_suite "${pretty_suite}")
else()
# Test name; strip spaces and comments to get just the name...
string(REGEX REPLACE " +" "" test "${line}")
if(test MATCHES "#" AND NOT _NO_PRETTY_VALUES)
string(REGEX REPLACE "/[0-9]+#GetParam..=" "/" pretty_test "${test}")
else()
string(REGEX REPLACE "#.*" "" pretty_test "${test}")
endif()
string(REGEX REPLACE "^DISABLED_" "" pretty_test "${pretty_test}")
string(REGEX REPLACE "#.*" "" test "${test}")
if(NOT "${_TEST_XML_OUTPUT_DIR}" STREQUAL "")
set(TEST_XML_OUTPUT_PARAM "--gtest_output=xml:${_TEST_XML_OUTPUT_DIR}/${prefix}${suite}.${test}${suffix}.xml")
else()
unset(TEST_XML_OUTPUT_PARAM)
endif()
# sanitize test name for further processing downstream
set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}")
# escape \
string(REPLACE [[\]] [[\\]] testname "${testname}")
# escape ;
string(REPLACE [[;]] [[\;]] testname "${testname}")
# escape $
string(REPLACE [[$]] [[\$]] testname "${testname}")
# ...and add to script
add_command(add_test
"${testname}"
${_TEST_EXECUTOR}
"${_TEST_EXECUTABLE}"
"--gtest_filter=${suite}.${test}"
"--gtest_also_run_disabled_tests"
${TEST_XML_OUTPUT_PARAM}
${extra_args}
)
if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED")
add_command(set_tests_properties
"${testname}"
PROPERTIES DISABLED TRUE
)
endif()
add_command(set_tests_properties
"${testname}"
PROPERTIES
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]"
${properties}
)
list(APPEND tests_buffer "${testname}")
list(LENGTH tests_buffer tests_buffer_length)
if(${tests_buffer_length} GREATER "250")
flush_tests_buffer()
endif()
endif()
endif()
endforeach()
# Create a list of all discovered tests, which users may use to e.g. set
# properties on the tests
flush_tests_buffer()
add_command(set ${_TEST_LIST} ${tests})
# Write CTest script
flush_script()
endfunction()
if(CMAKE_SCRIPT_MODE_FILE)
gtest_discover_tests_impl(
NO_PRETTY_TYPES ${NO_PRETTY_TYPES}
NO_PRETTY_VALUES ${NO_PRETTY_VALUES}
TEST_EXECUTABLE ${TEST_EXECUTABLE}
TEST_EXECUTOR ${TEST_EXECUTOR}
TEST_WORKING_DIR ${TEST_WORKING_DIR}
TEST_PREFIX ${TEST_PREFIX}
TEST_SUFFIX ${TEST_SUFFIX}
TEST_LIST ${TEST_LIST}
CTEST_FILE ${CTEST_FILE}
TEST_DISCOVERY_TIMEOUT ${TEST_DISCOVERY_TIMEOUT}
TEST_XML_OUTPUT_DIR ${TEST_XML_OUTPUT_DIR}
TEST_EXTRA_ARGS ${TEST_EXTRA_ARGS}
TEST_PROPERTIES ${TEST_PROPERTIES}
)
endif()

View File

@@ -8,6 +8,17 @@
#
#=============================================================================
function(GET_BLENDER_TEST_INSTALL_DIR VARIABLE_NAME)
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
set(${VARIABLE_NAME} "${TEST_INSTALL_DIR}" PARENT_SCOPE)
endfunction()
macro(BLENDER_SRC_GTEST_EX)
if(WITH_GTESTS)
set(options SKIP_ADD_TEST)
@@ -75,13 +86,7 @@ macro(BLENDER_SRC_GTEST_EX)
target_link_libraries(${TARGET_NAME} ${GMP_LIBRARIES})
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
@@ -97,6 +102,7 @@ macro(BLENDER_SRC_GTEST_EX)
set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
unset(MANIFEST)
endif()
unset(TEST_INC)

View File

@@ -128,7 +128,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _git_changed_files STREQUAL "")
set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
string(APPEND MY_WC_BRANCH " (modified)")
else()
# Unpushed commits are also considered local modifications
execute_process(COMMAND git log @{u}..
@@ -137,7 +137,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(NOT _git_unpushed_log STREQUAL "")
set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
string(APPEND MY_WC_BRANCH " (modified)")
endif()
unset(_git_unpushed_log)
endif()
@@ -161,6 +161,7 @@ file(WRITE buildinfo.h.txt
"#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n"
"#define BUILD_DATE \"${BUILD_DATE}\"\n"
"#define BUILD_TIME \"${BUILD_TIME}\"\n"
"#include \"buildinfo_static.h\"\n"
)
# cleanup

View File

@@ -0,0 +1,8 @@
/* CMake expanded values that won't change between CMake execution (unlike date/time).
* This is included by `buildinfo.h` generated by `buildinfo.cmake`. */
#define BUILD_PLATFORM "@BUILD_PLATFORM@"
#define BUILD_TYPE "@BUILD_TYPE@"
#define BUILD_CFLAGS "@BUILD_CFLAGS@"
#define BUILD_CXXFLAGS "@BUILD_CXXFLAGS@"
#define BUILD_LINKFLAGS "@BUILD_LINKFLAGS@"
#define BUILD_SYSTEM "@BUILD_SYSTEM@"

View File

@@ -13,7 +13,7 @@ Invocation:
export CLANG_BIND_DIR="/dsk/src/llvm/tools/clang/bindings/python"
export CLANG_LIB_DIR="/opt/llvm/lib"
python2 clang_array_check.py somefile.c -DSOME_DEFINE -I/some/include
python clang_array_check.py somefile.c -DSOME_DEFINE -I/some/include
... defines and includes are optional
@@ -76,6 +76,32 @@ defs_precalc = {
"glNormal3bv": {0: 3},
"glNormal3iv": {0: 3},
"glNormal3sv": {0: 3},
# GPU immediate mode.
"immVertex2iv": {1: 2},
"immVertex2fv": {1: 2},
"immVertex3fv": {1: 3},
"immAttr2fv": {1: 2},
"immAttr3fv": {1: 3},
"immAttr4fv": {1: 4},
"immAttr3ubv": {1: 3},
"immAttr4ubv": {1: 4},
"immUniform2fv": {1: 2},
"immUniform3fv": {1: 3},
"immUniform4fv": {1: 4},
"immUniformColor3fv": {0: 3},
"immUniformColor4fv": {0: 4},
"immUniformColor3ubv": {1: 3},
"immUniformColor4ubv": {1: 4},
"immUniformColor3fvAlpha": {0: 3},
"immUniformColor4fvAlpha": {0: 4},
}
# -----------------------------------------------------------------------------
@@ -100,7 +126,8 @@ else:
if CLANG_LIB_DIR is None:
print("$CLANG_LIB_DIR clang lib dir not set")
sys.path.append(CLANG_BIND_DIR)
if CLANG_BIND_DIR:
sys.path.append(CLANG_BIND_DIR)
import clang
import clang.cindex
@@ -108,7 +135,8 @@ from clang.cindex import (CursorKind,
TypeKind,
TokenKind)
clang.cindex.Config.set_library_path(CLANG_LIB_DIR)
if CLANG_LIB_DIR:
clang.cindex.Config.set_library_path(CLANG_LIB_DIR)
index = clang.cindex.Index.create()

View File

@@ -20,6 +20,8 @@
# <pep8 compliant>
# Note: this code should be cleaned up / refactored.
import sys
if sys.version_info.major < 3:
print("\nPython3.x needed, found %s.\nAborting!\n" %
@@ -37,12 +39,23 @@ from cmake_consistency_check_config import (
import os
from os.path import join, dirname, normpath, splitext
from os.path import (
dirname,
join,
normpath,
splitext,
)
global_h = set()
global_c = set()
global_refs = {}
# Flatten `IGNORE_SOURCE_MISSING` to avoid nested looping.
IGNORE_SOURCE_MISSING = [
(k, ignore_path) for k, ig_list in IGNORE_SOURCE_MISSING
for ignore_path in ig_list
]
# Ignore cmake file, path pairs.
global_ignore_source_missing = {}
for k, v in IGNORE_SOURCE_MISSING:
@@ -178,6 +191,8 @@ def cmake_get_src(f):
if not l:
pass
elif l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
elif l.startswith("$"):
if context_name == "SRC":
# assume if it ends with context_name we know about it
@@ -227,10 +242,7 @@ def cmake_get_src(f):
# replace_line(f, i - 1, new_path_rel)
else:
if l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
else:
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
# print(new_file)
@@ -258,16 +270,16 @@ def cmake_get_src(f):
def is_ignore_source(f, ignore_used):
for index, ig in enumerate(IGNORE_SOURCE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_SOURCE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
def is_ignore_cmake(f, ignore_used):
for index, ig in enumerate(IGNORE_CMAKE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_CMAKE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
@@ -298,7 +310,7 @@ def main():
for cf, i in refs:
errs.append((cf, i))
else:
raise Exception("CMake referenecs missing, internal error, aborting!")
raise Exception("CMake references missing, internal error, aborting!")
is_err = True
errs.sort()
@@ -309,7 +321,7 @@ def main():
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
if is_err:
raise Exception("CMake referenecs missing files, aborting!")
raise Exception("CMake references missing files, aborting!")
del is_err
del errs
@@ -320,7 +332,7 @@ def main():
if cf not in global_c:
print("missing_c: ", cf)
# check if automake builds a corrasponding .o file.
# Check if automake builds a corresponding .o file.
'''
if cf in global_c:
out1 = os.path.splitext(cf)[0] + ".o"
@@ -356,21 +368,21 @@ def main():
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE' paths...")
for index, ig in enumerate(IGNORE_SOURCE):
for index, ignore_path in enumerate(IGNORE_SOURCE):
if not ignore_used_source[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE_MISSING' paths...")
for k, v in sorted(global_ignore_source_missing.items()):
for ig in v:
print("unused ignore: %r -> %r" % (ig, k))
for ignore_path in v:
print("unused ignore: %r -> %r" % (ignore_path, k))
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_CMAKE' paths...")
for index, ig in enumerate(IGNORE_CMAKE):
for index, ignore_path in enumerate(IGNORE_CMAKE):
if not ignore_used_cmake[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
if __name__ == "__main__":

View File

@@ -34,8 +34,18 @@ IGNORE_SOURCE = (
# Ignore cmake file, path pairs.
IGNORE_SOURCE_MISSING = (
# Use for cycles stand-alone.
("intern/cycles/util/CMakeLists.txt", "../../third_party/numaapi/include"),
( # Use for cycles stand-alone.
"intern/cycles/util/CMakeLists.txt", (
"../../third_party/numaapi/include",
)),
( # Use for `WITH_NANOVDB`.
"intern/cycles/kernel/CMakeLists.txt", (
"nanovdb/util/CSampleFromVoxels.h",
"nanovdb/util/SampleFromVoxels.h",
"nanovdb/NanoVDB.h",
"nanovdb/CNanoVDB.h",
),
),
)
IGNORE_CMAKE = (

View File

@@ -32,7 +32,7 @@ CHECKER_IGNORE_PREFIX = [
"intern/moto",
]
CHECKER_BIN = "python2"
CHECKER_BIN = "python3"
CHECKER_ARGS = [
os.path.join(os.path.dirname(__file__), "clang_array_check.py"),

View File

@@ -44,6 +44,7 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)

View File

@@ -51,6 +51,7 @@ set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_NANOVDB OFF CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_TBB OFF CACHE BOOL "" FORCE)

View File

@@ -45,6 +45,7 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)

View File

@@ -28,6 +28,7 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_NANOVDB OFF CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
# Depends on Python install, do this to quiet warning.

View File

@@ -60,6 +60,19 @@ function(list_assert_duplicates
unset(_len_after)
endfunction()
# Adds a native path separator to the end of the path:
#
# - 'example' -> 'example/'
# - '/example///' -> '/example/'
#
macro(path_ensure_trailing_slash
path_new path_input
)
file(TO_NATIVE_PATH "/" _path_sep)
string(REGEX REPLACE "[${_path_sep}]+$" "" ${path_new} ${path_input})
set(${path_new} "${${path_new}}${_path_sep}")
unset(_path_sep)
endmacro()
# foo_bar.spam --> foo_barMySuffix.spam
macro(file_suffix
@@ -183,7 +196,7 @@ function(blender_user_header_search_paths
foreach(_INC ${includes})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
# _ALL_INCS is a space-separated string of file paths in quotes.
set(_ALL_INCS "${_ALL_INCS} \"${_ABS_INC}\"")
string(APPEND _ALL_INCS " \"${_ABS_INC}\"")
endforeach()
set_target_properties(${name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}")
endif()
@@ -250,11 +263,11 @@ macro(add_cc_flags_custom_test
string(TOUPPER ${name} _name_upper)
if(DEFINED CMAKE_C_FLAGS_${_name_upper})
message(STATUS "Using custom CFLAGS: CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
string(APPEND CMAKE_C_FLAGS " ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
endif()
if(DEFINED CMAKE_CXX_FLAGS_${_name_upper})
message(STATUS "Using custom CXXFLAGS: CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
endif()
unset(_name_upper)
@@ -375,6 +388,43 @@ function(blender_add_lib
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
endfunction()
function(blender_add_test_suite)
if (ARGC LESS 1)
message(FATAL_ERROR "No arguments supplied to blender_add_test_suite()")
endif()
# Parse the arguments
set(oneValueArgs TARGET SUITE_NAME)
set(multiValueArgs SOURCES)
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Figure out the release dir, as some tests need files from there.
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
if(APPLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION})
else()
if(WIN32 OR WITH_INSTALL_PORTABLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/${BLENDER_VERSION})
else()
set(_test_release_dir ${TEST_INSTALL_DIR}/share/blender/${BLENDER_VERSION})
endif()
endif()
# Define a test case with our custom gtest_add_tests() command.
include(GTest)
gtest_add_tests(
TARGET ${ARGS_TARGET}
SOURCES "${ARGS_SOURCES}"
TEST_PREFIX ${ARGS_SUITE_NAME}
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
EXTRA_ARGS
--test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests"
--test-release-dir "${_test_release_dir}"
)
unset(_test_release_dir)
endfunction()
# Add tests for a Blender library, to be called in tandem with blender_add_lib().
# The tests will be part of the blender_test executable (see tests/gtests/runner).
function(blender_add_test_lib
@@ -408,6 +458,12 @@ function(blender_add_test_lib
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}")
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
blender_add_test_suite(
TARGET blender_test
SUITE_NAME ${name}
SOURCES "${sources}"
)
endfunction()
@@ -441,14 +497,10 @@ function(blender_add_test_executable
SKIP_ADD_TEST
)
include(GTest)
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/GTestAddTests.cmake
)
gtest_discover_tests(${name}_test
DISCOVERY_MODE PRE_TEST
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
blender_add_test_suite(
TARGET ${name}_test
SUITE_NAME ${name}
SOURCES "${sources}"
)
endfunction()
@@ -675,14 +727,14 @@ endmacro()
macro(add_c_flag
flag)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
string(APPEND CMAKE_C_FLAGS " ${flag}")
string(APPEND CMAKE_CXX_FLAGS " ${flag}")
endmacro()
macro(add_cxx_flag
flag)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
string(APPEND CMAKE_CXX_FLAGS " ${flag}")
endmacro()
macro(remove_strict_flags)
@@ -1126,6 +1178,7 @@ endfunction()
function(find_python_package
package
relative_include_dir
)
string(TOUPPER ${package} _upper_package)
@@ -1157,7 +1210,10 @@ function(find_python_package
dist-packages
vendor-packages
NO_DEFAULT_PATH
DOC
"Path to python site-packages or dist-packages containing '${package}' module"
)
mark_as_advanced(PYTHON_${_upper_package}_PATH)
if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}")
message(WARNING
@@ -1175,6 +1231,50 @@ function(find_python_package
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
else()
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
if(NOT "${relative_include_dir}" STREQUAL "")
set(_relative_include_dir "${package}/${relative_include_dir}")
unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
find_path(PYTHON_${_upper_package}_INCLUDE_DIRS
NAMES
"${_relative_include_dir}"
HINTS
"${PYTHON_LIBPATH}/"
"${PYTHON_LIBPATH}/python${PYTHON_VERSION}/"
"${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/"
PATH_SUFFIXES
"site-packages/"
"dist-packages/"
"vendor-packages/"
NO_DEFAULT_PATH
DOC
"Path to python site-packages or dist-packages containing '${package}' module header files"
)
mark_as_advanced(PYTHON_${_upper_package}_INCLUDE_DIRS)
if(NOT EXISTS "${PYTHON_${_upper_package}_INCLUDE_DIRS}")
message(WARNING
"Python package '${package}' include dir path could not be found in:\n"
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${_relative_include_dir}', "
"'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${_relative_include_dir}', "
"\n"
"The 'WITH_PYTHON_${_upper_package}' option will be disabled.\n"
"The build will be usable, only add-ons that depend on this package won't be functional."
)
set(WITH_PYTHON_${_upper_package} OFF PARENT_SCOPE)
else()
set(_temp "${PYTHON_${_upper_package}_INCLUDE_DIRS}/${package}/${relative_include_dir}")
unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)
set(PYTHON_${_upper_package}_INCLUDE_DIRS "${_temp}"
CACHE PATH "Path to the include directory of the ${package} module")
message(STATUS "${package} include files found at '${PYTHON_${_upper_package}_INCLUDE_DIRS}'")
endif()
endif()
endif()
endif()
endfunction()

View File

@@ -60,11 +60,19 @@ if(WITH_OPENAL)
endif()
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
else()
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
endif()
endif()
if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
@@ -72,6 +80,10 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
# -------------------------------------------------------------------------
# Find precompiled libraries, and avoid system or user-installed ones.
@@ -94,17 +106,6 @@ if(WITH_OPENSUBDIV)
find_package(OpenSubdiv)
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
else()
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
endif()
endif()
if(WITH_CODEC_SNDFILE)
find_package(SndFile)
find_library(_sndfile_FLAC_LIBRARY NAMES flac HINTS ${LIBDIR}/sndfile/lib)
@@ -194,7 +195,7 @@ if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -pipe -funsigned-char")
string(APPEND PLATFORM_CFLAGS " -pipe -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal -framework QuartzCore"
)
@@ -202,12 +203,12 @@ set(PLATFORM_LINKFLAGS
list(APPEND PLATFORM_LINKLIBS c++)
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
endif()
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
# force cmake to link right framework
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
endif()
if(WITH_OPENCOLLADA)
@@ -222,7 +223,7 @@ if(WITH_SDL)
find_package(SDL2)
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARY ${SDL2_LIBRARIES})
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback")
endif()
set(PNG_ROOT ${LIBDIR}/png)
@@ -266,7 +267,15 @@ if(WITH_BOOST)
endif()
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
string(APPEND PLATFORM_LINKFLAGS " -liconv") # boost_locale and ffmpeg needs it !
endif()
if(WITH_PUGIXML)
find_package(PugiXML)
if(NOT PUGIXML_FOUND)
message(WARNING "PugiXML not found, disabling WITH_PUGIXML")
set(WITH_PUGIXML OFF)
endif()
endif()
if(WITH_OPENIMAGEIO)
@@ -337,7 +346,7 @@ if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
# Increase stack size for Embree, only works for executables.
if(NOT WITH_PYTHON_MODULE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
string(APPEND PLATFORM_LINKFLAGS " -Wl,-stack_size,0x100000")
endif()
# Embree static library linking can mix up SSE and AVX symbols, causing
@@ -381,7 +390,7 @@ if(WITH_OPENMP)
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L'${LIBDIR}/openmp/lib' -lomp")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -L'${LIBDIR}/openmp/lib' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` is a default dylib search path.
@@ -428,36 +437,50 @@ endif()
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
string(APPEND CMAKE_C_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
endif()
else()
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
endif()
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
string(APPEND PLATFORM_LINKFLAGS
" -Wl,-unexported_symbols_list,'${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++")
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
if(WITH_COMPILER_CCACHE)
if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
# Makefiles and ninja
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()
endif()

View File

@@ -150,7 +150,36 @@ endif()
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
string(APPEND CMAKE_C_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
string(APPEND CMAKE_CXX_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(WITH_COMPILER_CCACHE)
if(CMAKE_GENERATOR STREQUAL "Xcode")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
get_filename_component(ccompiler "${CMAKE_C_COMPILER}" NAME)
get_filename_component(cxxcompiler "${CMAKE_CXX_COMPILER}" NAME)
# Ccache can figure out which compiler to use if it's invoked from
# a symlink with the name of the compiler.
# https://ccache.dev/manual/4.1.html#_run_modes
set(_fake_compiler_dir "${CMAKE_BINARY_DIR}/ccache")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_fake_compiler_dir})
set(_fake_C_COMPILER "${_fake_compiler_dir}/${ccompiler}")
set(_fake_CXX_COMPILER "${_fake_compiler_dir}/${cxxcompiler}")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_C_COMPILER})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_CXX_COMPILER})
set(CMAKE_XCODE_ATTRIBUTE_CC ${_fake_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_CXX ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_LD ${_fake_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
unset(_fake_compiler_dir)
unset(_fake_C_COMPILER)
unset(_fake_CXX_COMPILER)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()
endif()

View File

@@ -73,7 +73,7 @@ if(EXISTS ${LIBDIR})
endif()
if(WITH_STATIC_LIBS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -static-libstdc++")
endif()
# Wrapper to prefer static libraries
@@ -350,15 +350,12 @@ if(WITH_BOOST)
endif()
endif()
if(WITH_PUGIXML)
find_package_wrapper(PugiXML)
endif()
if(WITH_OPENIMAGEIO)
find_package_wrapper(OpenImageIO)
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
find_package_wrapper(PugiXML)
else()
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
set(PUGIXML_LIBRARIES "")
endif()
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO_LIBRARIES}
${PNG_LIBRARIES}
@@ -613,14 +610,20 @@ endif()
# GNU Compiler
if(CMAKE_COMPILER_IS_GNUCC)
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
# ffp-contract=off:
# Automatically turned on when building with "-march=native". This is
# explicitly turned off here as it will make floating point math give a bit
# different results. This will lead to automated test failures. So disable
# this until we support it. Seems to default to off in clang and the intel
# compiler.
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -ffp-contract=off")
# `maybe-uninitialized` is unreliable in release builds, but fine in debug builds.
set(GCC_EXTRA_FLAGS_RELEASE "-Wno-maybe-uninitialized")
set(CMAKE_C_FLAGS_RELEASE "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set(CMAKE_CXX_FLAGS_RELEASE "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(PREPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ")
unset(GCC_EXTRA_FLAGS_RELEASE)
if(WITH_LINKER_GOLD)
@@ -628,8 +631,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
string(APPEND CMAKE_C_FLAGS " -fuse-ld=gold")
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
@@ -641,8 +644,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "LLD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
string(APPEND CMAKE_C_FLAGS " -fuse-ld=lld")
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=lld")
else()
message(STATUS "LLD linker isn't available, using the default system linker.")
endif()
@@ -667,12 +670,12 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
endif()
mark_as_advanced(XILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
string(APPEND CMAKE_C_FLAGS " -fp-model precise -prec_div -parallel")
string(APPEND CMAKE_CXX_FLAGS " -fp-model precise -prec_div -parallel")
# set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
# string(APPEND PLATFORM_CFLAGS " -diag-enable sc3")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
string(APPEND PLATFORM_LINKFLAGS " -static-intel")
endif()
# Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may
@@ -685,5 +688,17 @@ set(PLATFORM_LINKFLAGS
# browsers can't properly detect blender as an executable then. Still enabled
# for non-portable installs as typically used by Linux distributions.
if(WITH_INSTALL_PORTABLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -no-pie")
endif()
if(WITH_COMPILER_CCACHE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
# Makefiles and ninja
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()

View File

@@ -49,7 +49,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
message(FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found.")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"${CLANG_OPENMP_LIB}\"")
string(APPEND CMAKE_EXE_LINKER_FLAGS " \"${CLANG_OPENMP_LIB}\"")
endif()
if(WITH_WINDOWS_STRIPPED_PDB)
message(WARNING "stripped pdb not supported with clang, disabling..")
@@ -112,9 +112,9 @@ unset(_min_ver)
# needed for some MSVC installations
# 4099 : PDB 'filename' was not found with 'object/library'
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
@@ -154,18 +154,18 @@ if(WITH_WINDOWS_PDB)
endif()
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc /bigobj")
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
endif()
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
string(APPEND CMAKE_CXX_FLAGS " /permissive-")
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
string(APPEND CMAKE_CXX_FLAGS " /Zc:twoPhase-")
endif()
if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND)
@@ -183,33 +183,33 @@ else()
set(SYMBOL_FORMAT /ZI)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
string(APPEND CMAKE_C_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_C_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT}")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT}")
unset(SYMBOL_FORMAT)
# JMC is available on msvc 15.8 (1915) and up
if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /JMC")
endif()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152")
string(APPEND PLATFORM_LINKFLAGS " /SUBSYSTEM:CONSOLE /STACK:2097152")
set(PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
string(APPEND PLATFORM_LINKFLAGS_DEBUG " /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
# Ignore meaningless for us linker warnings.
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
string(APPEND PLATFORM_LINKFLAGS " /ignore:4049 /ignore:4217 /ignore:4221")
set(PLATFORM_LINKFLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${PDB_INFO_OVERRIDE_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
string(APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221")
if(CMAKE_CL_64)
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
string(PREPEND PLATFORM_LINKFLAGS "/MACHINE:X64 ")
else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
string(PREPEND PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ")
endif()
if(NOT DEFINED LIBDIR)
@@ -239,9 +239,24 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "\n\nWindows requires pre-compiled libs at: '${LIBDIR}'. Please run `make update` in the blender source folder to obtain them.")
endif()
if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
MSVC_VERSION GREATER_EQUAL 1924 AND # Supported for 16.4+
WITH_CLANG_TIDY # And Clang Tidy needs to be on
)
set(CMAKE_VS_GLOBALS
"RunCodeAnalysis=false"
"EnableMicrosoftCodeAnalysis=false"
"EnableClangTidyCodeAnalysis=true"
)
set(VS_CLANG_TIDY On)
endif()
# Mark libdir as system headers with a lower warn level, to resolve some warnings
# that we have very little control over
if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG AND NOT WITH_WINDOWS_SCCACHE)
if(MSVC_VERSION GREATER_EQUAL 1914 AND # Available with 15.7+
NOT MSVC_CLANG AND # But not for clang
NOT WITH_WINDOWS_SCCACHE AND # And not when sccache is enabled
NOT VS_CLANG_TIDY) # Clang-tidy does not like these options
add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0)
endif()
@@ -253,6 +268,11 @@ foreach(child ${children})
endif()
endforeach()
if(WITH_PUGIXML)
set(PUGIXML_LIBRARIES optimized ${LIBDIR}/pugixml/lib/pugixml.lib debug ${LIBDIR}/pugixml/lib/pugixml_d.lib)
set(PUGIXML_INCLUDE_DIR ${LIBDIR}/pugixml/include)
endif()
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
@@ -651,11 +671,10 @@ if(WITH_CYCLES_OSL)
optimized ${OSL_LIB_COMP}
optimized ${OSL_LIB_EXEC}
optimized ${OSL_LIB_QUERY}
optimized ${CYCLES_OSL}/lib/pugixml.lib
debug ${OSL_LIB_EXEC_DEBUG}
debug ${OSL_LIB_COMP_DEBUG}
debug ${OSL_LIB_QUERY_DEBUG}
debug ${CYCLES_OSL}/lib/pugixml_d.lib
${PUGIXML_LIBRARIES}
)
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
@@ -720,7 +739,7 @@ if(WINDOWS_PYTHON_DEBUG)
string(REPLACE "/" "\\" _group_path "${_source_path}")
source_group("${_group_path}" FILES "${_source}")
endforeach()
# If the user scripts env var is set, include scripts from there otherwise
# include user scripts in the profile folder.
if(DEFINED ENV{BLENDER_USER_SCRIPTS})
@@ -731,7 +750,7 @@ if(WINDOWS_PYTHON_DEBUG)
# Include the user scripts from the profile folder in the blender_python_user_scripts project.
set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}/scripts")
endif()
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})

View File

@@ -31,7 +31,7 @@ if(WITH_WINDOWS_BUNDLE_CRT)
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
get_filename_component(filename ${lib} NAME)
file(SHA1 "${lib}" sha1_file)
set(CRTLIBS "${CRTLIBS} <file name=\"${filename}\" hash=\"${sha1_file}\" hashalg=\"SHA1\" />\n")
string(APPEND CRTLIBS " <file name=\"${filename}\" hash=\"${sha1_file}\" hashalg=\"SHA1\" />\n")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.crt.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.crt.manifest @ONLY)
file(TOUCH ${manifest_trigger_file})

View File

@@ -92,5 +92,5 @@ echo if "%%VSCMD_VER%%" == "" ^( >> %BUILD_DIR%\rebuild.cmd
echo call "%VCVARS%" %BUILD_ARCH% >> %BUILD_DIR%\rebuild.cmd
echo ^) >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
echo ninja install >> %BUILD_DIR%\rebuild.cmd
echo ninja install %%* >> %BUILD_DIR%\rebuild.cmd
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "V2.92"
PROJECT_NUMBER = "V2.93"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -453,7 +453,7 @@ TYPEDEF_HIDES_STRUCT = NO
# the optimal cache size from a speed point of view.
# Minimum value: 0, maximum value: 9, default value: 0.
LOOKUP_CACHE_SIZE = 0
LOOKUP_CACHE_SIZE = 3
#---------------------------------------------------------------------------
# Build related configuration options
@@ -1321,7 +1321,7 @@ DOCSET_PUBLISHER_NAME = Publisher
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = YES
GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm
# file. You can add a path in front of the file if the result should not be

View File

@@ -121,6 +121,10 @@
* \ingroup editors
*/
/** \defgroup edasset asset
* \ingroup editors
*/
/** \defgroup edcurve curve
* \ingroup editors
*/

View File

@@ -0,0 +1,30 @@
"""
.. note::
Properties defined at run-time store the values of the properties as custom-properties.
This method checks if the underlying data exists, causing the property to be considered *set*.
A common pattern for operators is to calculate a value for the properties
that have not had their values explicitly set by the caller
(where the caller could be a key-binding, menu-items or Python script for example).
In the case of executing operators multiple times, values are re-used from the previous execution.
For example: subdividing a mesh with a smooth value of 1.0 will keep using
that value on subsequent calls to subdivision, unless the operator is called with
that property set to a different value.
This behavior can be disabled using the ``SKIP_SAVE`` option when the property is declared (see: :mod:`bpy.props`).
The ``ghost`` argument allows detecting how a value from a previous execution is handled.
- When true: The property is considered unset even if the value from a previous call is used.
- When false: The existence of any values causes ``is_property_set`` to return true.
While this argument should typically be omitted, there are times when
it's important to know if a value is anything besides the default.
For example, the previous value may have been scaled by the scene's unit scale.
In this case scaling the value multiple times would cause problems, so the ``ghost`` argument should be false.
"""

View File

@@ -163,13 +163,13 @@ Now in the button's context menu select *Copy Data Path*, then paste the result
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels
bpy.context.active_object.modifiers["Subdivision"].levels
Press :kbd:`Return` and you'll get the current value of 1. Now try changing the value to 2:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels = 2
bpy.context.active_object.modifiers["Subdivision"].levels = 2
You can see the value update in the Subdivision Surface modifier's UI as well as the cube.
@@ -185,43 +185,31 @@ For example, if you want to access the texture of a brush via Python to adjust i
#. Start in the default scene and enable Sculpt Mode from the 3D Viewport header.
#. From the Sidebar expand the Brush Settings panel's *Texture* subpanel and add a new texture.
*Notice the texture data-block menu itself doesn't have very useful links (you can check the tooltips).*
#. The contrast setting isn't exposed in the Sidebar, so view the texture in the properties editor:
- In the properties editor select the Texture tab.
- Select brush texture.
- Expand the *Colors* panel to locate the *Contrast* number field.
#. The contrast setting isn't exposed in the Sidebar, so view the texture in the
:ref:`Properties Editor <blender_manual:bpy.types.Texture.contrast`
#. Open the context menu of the contrast field and select *Online Python Reference*.
This takes you to ``bpy.types.Texture.contrast``. Now you can see that ``contrast`` is a property of texture.
#. To find out how to access the texture from the brush check on the references at the bottom of the page.
Sometimes there are many references, and it may take some guesswork to find the right one,
but in this case it's ``Brush.texture``.
but in this case it's ``tool_settings.sculpt.brush.texture``.
#. Now you know that the texture can be accessed from ``bpy.data.brushes["BrushName"].texture``
but normally you *won't* want to access the brush by name, instead you want to access the active brush.
So the next step is to check on where brushes are accessed from via the references.
In this case there it is simply ``bpy.context.brush``.
Now you can use the Python console to form the nested properties needed to access brush textures contrast:
*Context -> Brush -> Texture -> Contrast*.
:menuselection:`Context --> Tool Settings --> Sculpt --> Brush --> Texture --> Contrast`.
Since the attribute for each is given along the way you can compose the data path in the Python console:
.. code-block:: python
bpy.context.brush.texture.contrast
There can be multiple ways to access the same data, which you choose often depends on the task.
An alternate path to access the same setting is:
.. code-block:: python
bpy.context.sculpt.brush.texture.contrast
bpy.context.tool_settings.sculpt.brush.texture.contrast
Or access the brush directly:
.. code-block:: python
bpy.data.brushes["BrushName"].texture.contrast
bpy.data.textures["Texture"].contrast
If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects

View File

@@ -35,12 +35,13 @@ but not to fully cover each topic.
A quick list of helpful things to know before starting:
- Blender uses Python 3.x; some online documentation still assumes version 2.x.
- The interactive console is great for testing one-liners.
It also has autocompletion so you can inspect the API quickly.
- Button tooltips show Python attributes and operator names.
- The context menu of buttons directly links to this API documentation.
- More operator examples can be found in the text editor's template menu.
- Enable :ref:`Developer Extra <blender_manual:prefs-interface-dev-extras`
and :ref:`Python Tooltips <blender_manual:prefs-interface-tooltips-python>`.
- The :ref:`Python Console <blender_manual:bpy.types.SpaceConsole>`
is great for testing one-liners; it has autocompletion so you can inspect the API quickly.
- Button tooltips show Python attributes and operator names (when enabled see above).
- The context menu of buttons directly links to this API documentation (when enabled see above).
- Many python examples can be found in the text editor's template menu.
- To examine further scripts distributed with Blender, see:
- ``scripts/startup/bl_ui`` for the user interface.
@@ -237,7 +238,7 @@ Examples:
{'FINISHED'}
>>> bpy.ops.mesh.hide(unselected=False)
{'FINISHED'}
>>> bpy.ops.object.scale_apply()
>>> bpy.ops.object.transform_apply()
{'FINISHED'}
.. tip::

View File

@@ -24,10 +24,9 @@ The three main use cases for the terminal are:
- If the script runs for too long or you accidentally enter an infinite loop,
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
.. note::
.. seealso::
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the Help menu.
:ref:`blender_manual:command_line-launch-index`.
Interface Tricks

View File

@@ -551,7 +551,7 @@ def example_extract_docstring(filepath):
file.close()
return "", 0
for line in file.readlines():
for line in file:
line_no += 1
if line.startswith('"""'):
break
@@ -559,6 +559,13 @@ def example_extract_docstring(filepath):
text.append(line.rstrip())
line_no += 1
# Skip over blank lines so the Python code doesn't have blank lines at the top.
for line in file:
if line.strip():
break
line_no += 1
file.close()
return "\n".join(text), line_no
@@ -2188,9 +2195,20 @@ def setup_blender():
# Remove handlers since the functions get included
# in the doc-string and don't have meaningful names.
for ls in bpy.app.handlers:
if isinstance(ls, list):
ls.clear()
lists_to_restore = []
for var in bpy.app.handlers:
if isinstance(var, list):
lists_to_restore.append((var[:], var))
var.clear()
return {
"lists_to_restore": lists_to_restore,
}
def teardown_blender(setup_data):
for var_src, var_dst in setup_data["lists_to_restore"]:
var_dst[:] = var_src
def main():
@@ -2199,7 +2217,7 @@ def main():
setup_monkey_patch()
# Perform changes to Blender it's self.
setup_blender()
setup_data = setup_blender()
# eventually, create the dirs
for dir_path in [ARGS.output_dir, SPHINX_IN]:
@@ -2305,6 +2323,8 @@ def main():
shutil.copy(os.path.join(SPHINX_OUT_PDF, "contents.pdf"),
os.path.join(REFERENCE_PATH, BLENDER_PDF_FILENAME))
teardown_blender(setup_data)
sys.exit()

View File

@@ -1,7 +1,5 @@
/* Prevent Long enum lists */
.field-body {
display: block;
width: 100%;
/* T76453: Prevent Long enum lists */
.field-list li {
max-height: 245px;
overflow-y: auto !important;
}

4
extern/README vendored Normal file
View File

@@ -0,0 +1,4 @@
When updating a library remember to:
* Update the README.blender with the corresponding version.
* Update the THIRD-PARTY-LICENSE.txt document

5
extern/audaspace/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: Audaspace
URL: https://audaspace.github.io/
License: Apache 2.0
Upstream version: 1.3 (Last Release)
Local modifications: None

View File

@@ -24,6 +24,6 @@ set(JACK_FOUND ${WITH_JACK})
set(LIBSNDFILE_FOUND ${WITH_CODEC_SNDFILE})
set(OPENAL_FOUND ${WITH_OPENAL})
set(PYTHONLIBS_FOUND TRUE)
set(NUMPY_FOUND TRUE)
set(NUMPY_FOUND ${WITH_PYTHON_NUMPY})
set(NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_INCLUDE_DIRS})
set(SDL_FOUND ${WITH_SDL})

View File

@@ -72,6 +72,9 @@ protected:
/// The channel mapper reader in between.
std::shared_ptr<ChannelMapperReader> m_mapper;
/// Whether the source is being read for the first time.
bool m_first_reading;
/// Whether to keep the source if end of it is reached.
bool m_keep;

View File

@@ -78,7 +78,7 @@ bool SoftwareDevice::SoftwareHandle::pause(bool keep)
}
SoftwareDevice::SoftwareHandle::SoftwareHandle(SoftwareDevice* device, std::shared_ptr<IReader> reader, std::shared_ptr<PitchReader> pitch, std::shared_ptr<ResampleReader> resampler, std::shared_ptr<ChannelMapperReader> mapper, bool keep) :
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(0.0f), m_old_volume(0.0f), m_loopcount(0),
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_first_reading(true), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(0.0f), m_old_volume(0.0f), m_loopcount(0),
m_relative(true), m_volume_max(1.0f), m_volume_min(0), m_distance_max(std::numeric_limits<float>::max()),
m_distance_reference(1.0f), m_attenuation(1.0f), m_cone_angle_outer(M_PI), m_cone_angle_inner(M_PI), m_cone_volume_outer(0),
m_flags(RENDER_CONE), m_stop(nullptr), m_stop_data(nullptr), m_status(STATUS_PLAYING), m_device(device)
@@ -106,6 +106,14 @@ void SoftwareDevice::SoftwareHandle::update()
if(m_pitch->getSpecs().channels != CHANNELS_MONO)
{
m_volume = m_user_volume;
// we don't know a previous volume if this source has never been read before
if(m_first_reading)
{
m_old_volume = m_volume;
m_first_reading = false;
}
m_pitch->setPitch(m_user_pitch);
return;
}
@@ -214,6 +222,13 @@ void SoftwareDevice::SoftwareHandle::update()
m_volume *= m_user_volume;
}
// we don't know a previous volume if this source has never been read before
if(m_first_reading)
{
m_old_volume = m_volume;
m_first_reading = false;
}
// 3D Cue
Quaternion orientation;
@@ -754,6 +769,8 @@ void SoftwareDevice::mix(data_t* buffer, int length)
{
m_mixer->mix(buf, pos, len, sound->m_volume, sound->m_old_volume);
sound->m_old_volume = sound->m_volume;
pos += len;
if(sound->m_loopcount > 0)

View File

@@ -22,6 +22,7 @@
#include <mutex>
#define KEEP_TIME 10
#define POSITION_EPSILON (1.0 / static_cast<double>(RATE_48000))
AUD_NAMESPACE_BEGIN
@@ -64,7 +65,7 @@ bool SequenceHandle::updatePosition(double position)
if(m_handle.get())
{
// we currently have a handle, let's check where we are
if(position >= m_entry->m_end)
if(position - POSITION_EPSILON >= m_entry->m_end)
{
if(position >= m_entry->m_end + KEEP_TIME)
// far end, stopping
@@ -76,7 +77,7 @@ bool SequenceHandle::updatePosition(double position)
return true;
}
}
else if(position >= m_entry->m_begin)
else if(position + POSITION_EPSILON >= m_entry->m_begin)
{
// inside, resuming
m_handle->resume();
@@ -98,7 +99,7 @@ bool SequenceHandle::updatePosition(double position)
else
{
// we don't have a handle, let's start if we should be playing
if(position >= m_entry->m_begin && position <= m_entry->m_end)
if(position + POSITION_EPSILON >= m_entry->m_begin && position - POSITION_EPSILON <= m_entry->m_end)
{
start();
return m_valid;

View File

@@ -423,7 +423,7 @@ set(LIB
if(CMAKE_COMPILER_IS_GNUCXX)
# needed for gcc 4.6+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
string(APPEND CMAKE_CXX_FLAGS " -fpermissive")
endif()
if(MSVC)

5
extern/bullet2/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: Bullet Continuous Collision Detection and Physics Library
URL: http://bulletphysics.org
License: zlib
Upstream version: 3.07
Local modifications: Fixed inertia

1137
extern/ceres/ChangeLog vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
Project: Ceres Solver
URL: http://ceres-solver.org/
Upstream version 1.11 (aef9c9563b08d5f39eee1576af133a84749d1b48)
License: BSD 3-Clause
Upstream version 2.0.0
Local modifications: None

View File

@@ -8,8 +8,8 @@ else
fi
repo="https://ceres-solver.googlesource.com/ceres-solver"
branch="master"
tag=""
#branch="master"
tag="2.0.0"
tmp=`mktemp -d`
checkout="$tmp/ceres"

View File

@@ -153,28 +153,44 @@ template <typename CostFunctor,
int... Ns> // Number of parameters in each parameter block.
class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
public:
// Takes ownership of functor. Uses the template-provided value for the
// number of residuals ("kNumResiduals").
explicit AutoDiffCostFunction(CostFunctor* functor) : functor_(functor) {
// Takes ownership of functor by default. Uses the template-provided
// value for the number of residuals ("kNumResiduals").
explicit AutoDiffCostFunction(CostFunctor* functor,
Ownership ownership = TAKE_OWNERSHIP)
: functor_(functor), ownership_(ownership) {
static_assert(kNumResiduals != DYNAMIC,
"Can't run the fixed-size constructor if the number of "
"residuals is set to ceres::DYNAMIC.");
}
// Takes ownership of functor. Ignores the template-provided
// Takes ownership of functor by default. Ignores the template-provided
// kNumResiduals in favor of the "num_residuals" argument provided.
//
// This allows for having autodiff cost functions which return varying
// numbers of residuals at runtime.
AutoDiffCostFunction(CostFunctor* functor, int num_residuals)
: functor_(functor) {
AutoDiffCostFunction(CostFunctor* functor,
int num_residuals,
Ownership ownership = TAKE_OWNERSHIP)
: functor_(functor), ownership_(ownership) {
static_assert(kNumResiduals == DYNAMIC,
"Can't run the dynamic-size constructor if the number of "
"residuals is not ceres::DYNAMIC.");
SizedCostFunction<kNumResiduals, Ns...>::set_num_residuals(num_residuals);
}
virtual ~AutoDiffCostFunction() {}
explicit AutoDiffCostFunction(AutoDiffCostFunction&& other)
: functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
virtual ~AutoDiffCostFunction() {
// Manually release pointer if configured to not take ownership rather than
// deleting only if ownership is taken.
// This is to stay maximally compatible to old user code which may have
// forgotten to implement a virtual destructor, from when the
// AutoDiffCostFunction always took ownership.
if (ownership_ == DO_NOT_TAKE_OWNERSHIP) {
functor_.release();
}
}
// Implementation details follow; clients of the autodiff cost function should
// not have to examine below here.
@@ -201,6 +217,7 @@ class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
private:
std::unique_ptr<CostFunctor> functor_;
Ownership ownership_;
};
} // namespace ceres

View File

@@ -38,8 +38,10 @@
#ifndef CERES_PUBLIC_C_API_H_
#define CERES_PUBLIC_C_API_H_
// clang-format off
#include "ceres/internal/port.h"
#include "ceres/internal/disable_warnings.h"
// clang-format on
#ifdef __cplusplus
extern "C" {

View File

@@ -144,8 +144,7 @@ class CostFunctionToFunctor {
// Extract parameter block pointers from params.
using Indices =
std::make_integer_sequence<int,
ParameterDims::kNumParameterBlocks>;
std::make_integer_sequence<int, ParameterDims::kNumParameterBlocks>;
std::array<const T*, ParameterDims::kNumParameterBlocks> parameter_blocks =
GetParameterPointers<T>(params, Indices());

View File

@@ -51,7 +51,7 @@ class CovarianceImpl;
// =======
// It is very easy to use this class incorrectly without understanding
// the underlying mathematics. Please read and understand the
// documentation completely before attempting to use this class.
// documentation completely before attempting to use it.
//
//
// This class allows the user to evaluate the covariance for a
@@ -73,7 +73,7 @@ class CovarianceImpl;
// the maximum likelihood estimate of x given observations y is the
// solution to the non-linear least squares problem:
//
// x* = arg min_x |f(x)|^2
// x* = arg min_x |f(x) - y|^2
//
// And the covariance of x* is given by
//
@@ -220,11 +220,11 @@ class CERES_EXPORT Covariance {
// 1. DENSE_SVD uses Eigen's JacobiSVD to perform the
// computations. It computes the singular value decomposition
//
// U * S * V' = J
// U * D * V' = J
//
// and then uses it to compute the pseudo inverse of J'J as
//
// pseudoinverse[J'J]^ = V * pseudoinverse[S] * V'
// pseudoinverse[J'J] = V * pseudoinverse[D^2] * V'
//
// It is an accurate but slow method and should only be used
// for small to moderate sized problems. It can handle
@@ -235,7 +235,7 @@ class CERES_EXPORT Covariance {
//
// Q * R = J
//
// [J'J]^-1 = [R*R']^-1
// [J'J]^-1 = [R'*R]^-1
//
// SPARSE_QR is not capable of computing the covariance if the
// Jacobian is rank deficient. Depending on the value of

View File

@@ -40,6 +40,7 @@
#include "ceres/dynamic_cost_function.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/jet.h"
#include "ceres/types.h"
#include "glog/logging.h"
namespace ceres {
@@ -78,10 +79,24 @@ namespace ceres {
template <typename CostFunctor, int Stride = 4>
class DynamicAutoDiffCostFunction : public DynamicCostFunction {
public:
explicit DynamicAutoDiffCostFunction(CostFunctor* functor)
: functor_(functor) {}
// Takes ownership by default.
DynamicAutoDiffCostFunction(CostFunctor* functor,
Ownership ownership = TAKE_OWNERSHIP)
: functor_(functor), ownership_(ownership) {}
virtual ~DynamicAutoDiffCostFunction() {}
explicit DynamicAutoDiffCostFunction(DynamicAutoDiffCostFunction&& other)
: functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
virtual ~DynamicAutoDiffCostFunction() {
// Manually release pointer if configured to not take ownership
// rather than deleting only if ownership is taken. This is to
// stay maximally compatible to old user code which may have
// forgotten to implement a virtual destructor, from when the
// AutoDiffCostFunction always took ownership.
if (ownership_ == DO_NOT_TAKE_OWNERSHIP) {
functor_.release();
}
}
bool Evaluate(double const* const* parameters,
double* residuals,
@@ -151,6 +166,9 @@ class DynamicAutoDiffCostFunction : public DynamicCostFunction {
}
}
if (num_active_parameters == 0) {
return (*functor_)(parameters, residuals);
}
// When `num_active_parameters % Stride != 0` then it can be the case
// that `active_parameter_count < Stride` while parameter_cursor is less
// than the total number of parameters and with no remaining non-constant
@@ -248,6 +266,7 @@ class DynamicAutoDiffCostFunction : public DynamicCostFunction {
private:
std::unique_ptr<CostFunctor> functor_;
Ownership ownership_;
};
} // namespace ceres

View File

@@ -44,6 +44,7 @@
#include "ceres/internal/numeric_diff.h"
#include "ceres/internal/parameter_dims.h"
#include "ceres/numeric_diff_options.h"
#include "ceres/types.h"
#include "glog/logging.h"
namespace ceres {
@@ -84,6 +85,10 @@ class DynamicNumericDiffCostFunction : public DynamicCostFunction {
const NumericDiffOptions& options = NumericDiffOptions())
: functor_(functor), ownership_(ownership), options_(options) {}
explicit DynamicNumericDiffCostFunction(
DynamicNumericDiffCostFunction&& other)
: functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
virtual ~DynamicNumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();

View File

@@ -62,7 +62,8 @@ class CERES_EXPORT GradientProblemSolver {
// Minimizer options ----------------------------------------
LineSearchDirectionType line_search_direction_type = LBFGS;
LineSearchType line_search_type = WOLFE;
NonlinearConjugateGradientType nonlinear_conjugate_gradient_type = FLETCHER_REEVES;
NonlinearConjugateGradientType nonlinear_conjugate_gradient_type =
FLETCHER_REEVES;
// The LBFGS hessian approximation is a low rank approximation to
// the inverse of the Hessian matrix. The rank of the

View File

@@ -198,7 +198,7 @@ struct Make1stOrderPerturbation {
template <int N, int Offset, typename T, typename JetT>
struct Make1stOrderPerturbation<N, N, Offset, T, JetT> {
public:
static void Apply(const T* /*src*/, JetT* /*dst*/) {}
static void Apply(const T* src, JetT* dst) {}
};
// Calls Make1stOrderPerturbation for every parameter block.
@@ -229,7 +229,9 @@ struct Make1stOrderPerturbations<std::integer_sequence<int, N, Ns...>,
// End of 'recursion'. Nothing more to do.
template <int ParameterIdx, int Total>
struct Make1stOrderPerturbations<std::integer_sequence<int>, ParameterIdx, Total> {
struct Make1stOrderPerturbations<std::integer_sequence<int>,
ParameterIdx,
Total> {
template <typename T, typename JetT>
static void Apply(T const* const* /* NOT USED */, JetT* /* NOT USED */) {}
};

View File

@@ -34,11 +34,11 @@
#define CERES_WARNINGS_DISABLED
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning(push)
// Disable the warning C4251 which is triggered by stl classes in
// Ceres' public interface. To quote MSDN: "C4251 can be ignored "
// "if you are deriving from a type in the Standard C++ Library"
#pragma warning( disable : 4251 )
#pragma warning(disable : 4251)
#endif
#endif // CERES_WARNINGS_DISABLED

View File

@@ -36,31 +36,26 @@
namespace ceres {
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> Vector;
typedef Eigen::Matrix<double,
Eigen::Dynamic,
Eigen::Dynamic,
Eigen::RowMajor> Matrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
Matrix;
typedef Eigen::Map<Vector> VectorRef;
typedef Eigen::Map<Matrix> MatrixRef;
typedef Eigen::Map<const Vector> ConstVectorRef;
typedef Eigen::Map<const Matrix> ConstMatrixRef;
// Column major matrices for DenseSparseMatrix/DenseQRSolver
typedef Eigen::Matrix<double,
Eigen::Dynamic,
Eigen::Dynamic,
Eigen::ColMajor> ColMajorMatrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>
ColMajorMatrix;
typedef Eigen::Map<ColMajorMatrix, 0,
Eigen::Stride<Eigen::Dynamic, 1>> ColMajorMatrixRef;
typedef Eigen::Map<ColMajorMatrix, 0, Eigen::Stride<Eigen::Dynamic, 1>>
ColMajorMatrixRef;
typedef Eigen::Map<const ColMajorMatrix,
0,
Eigen::Stride<Eigen::Dynamic, 1>> ConstColMajorMatrixRef;
typedef Eigen::Map<const ColMajorMatrix, 0, Eigen::Stride<Eigen::Dynamic, 1>>
ConstColMajorMatrixRef;
// C++ does not support templated typdefs, thus the need for this
// struct so that we can support statically sized Matrix and Maps.
template <int num_rows = Eigen::Dynamic, int num_cols = Eigen::Dynamic>
template <int num_rows = Eigen::Dynamic, int num_cols = Eigen::Dynamic>
struct EigenTypes {
typedef Eigen::Matrix<double,
num_rows,

View File

@@ -30,6 +30,7 @@
#ifndef CERES_PUBLIC_INTERNAL_FIXED_ARRAY_H_
#define CERES_PUBLIC_INTERNAL_FIXED_ARRAY_H_
#include <Eigen/Core> // For Eigen::aligned_allocator
#include <algorithm>
#include <array>
#include <cstddef>
@@ -37,8 +38,6 @@
#include <tuple>
#include <type_traits>
#include <Eigen/Core> // For Eigen::aligned_allocator
#include "ceres/internal/memory.h"
#include "glog/logging.h"

View File

@@ -62,7 +62,8 @@ struct SumImpl;
// Strip of and sum the first number.
template <typename T, T N, T... Ns>
struct SumImpl<std::integer_sequence<T, N, Ns...>> {
static constexpr T Value = N + SumImpl<std::integer_sequence<T, Ns...>>::Value;
static constexpr T Value =
N + SumImpl<std::integer_sequence<T, Ns...>>::Value;
};
// Strip of and sum the first two numbers.
@@ -129,10 +130,14 @@ template <typename T, T Sum, typename SeqIn, typename SeqOut>
struct ExclusiveScanImpl;
template <typename T, T Sum, T N, T... Ns, T... Rs>
struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T, N, Ns...>,
struct ExclusiveScanImpl<T,
Sum,
std::integer_sequence<T, N, Ns...>,
std::integer_sequence<T, Rs...>> {
using Type =
typename ExclusiveScanImpl<T, Sum + N, std::integer_sequence<T, Ns...>,
typename ExclusiveScanImpl<T,
Sum + N,
std::integer_sequence<T, Ns...>,
std::integer_sequence<T, Rs..., Sum>>::Type;
};

View File

@@ -47,15 +47,17 @@
#include "ceres/types.h"
#include "glog/logging.h"
namespace ceres {
namespace internal {
// This is split from the main class because C++ doesn't allow partial template
// specializations for member functions. The alternative is to repeat the main
// class for differing numbers of parameters, which is also unfortunate.
template <typename CostFunctor, NumericDiffMethodType kMethod,
int kNumResiduals, typename ParameterDims, int kParameterBlock,
template <typename CostFunctor,
NumericDiffMethodType kMethod,
int kNumResiduals,
typename ParameterDims,
int kParameterBlock,
int kParameterBlockSize>
struct NumericDiff {
// Mutates parameters but must restore them before return.
@@ -66,23 +68,23 @@ struct NumericDiff {
int num_residuals,
int parameter_block_index,
int parameter_block_size,
double **parameters,
double *jacobian) {
double** parameters,
double* jacobian) {
using Eigen::ColMajor;
using Eigen::Map;
using Eigen::Matrix;
using Eigen::RowMajor;
using Eigen::ColMajor;
DCHECK(jacobian);
const int num_residuals_internal =
(kNumResiduals != ceres::DYNAMIC ? kNumResiduals : num_residuals);
const int parameter_block_index_internal =
(kParameterBlock != ceres::DYNAMIC ? kParameterBlock :
parameter_block_index);
(kParameterBlock != ceres::DYNAMIC ? kParameterBlock
: parameter_block_index);
const int parameter_block_size_internal =
(kParameterBlockSize != ceres::DYNAMIC ? kParameterBlockSize :
parameter_block_size);
(kParameterBlockSize != ceres::DYNAMIC ? kParameterBlockSize
: parameter_block_size);
typedef Matrix<double, kNumResiduals, 1> ResidualVector;
typedef Matrix<double, kParameterBlockSize, 1> ParameterVector;
@@ -97,17 +99,17 @@ struct NumericDiff {
(kParameterBlockSize == 1) ? ColMajor : RowMajor>
JacobianMatrix;
Map<JacobianMatrix> parameter_jacobian(jacobian,
num_residuals_internal,
parameter_block_size_internal);
Map<JacobianMatrix> parameter_jacobian(
jacobian, num_residuals_internal, parameter_block_size_internal);
Map<ParameterVector> x_plus_delta(
parameters[parameter_block_index_internal],
parameter_block_size_internal);
ParameterVector x(x_plus_delta);
ParameterVector step_size = x.array().abs() *
((kMethod == RIDDERS) ? options.ridders_relative_initial_step_size :
options.relative_step_size);
ParameterVector step_size =
x.array().abs() * ((kMethod == RIDDERS)
? options.ridders_relative_initial_step_size
: options.relative_step_size);
// It is not a good idea to make the step size arbitrarily
// small. This will lead to problems with round off and numerical
@@ -118,8 +120,8 @@ struct NumericDiff {
// For Ridders' method, the initial step size is required to be large,
// thus ridders_relative_initial_step_size is used.
if (kMethod == RIDDERS) {
min_step_size = std::max(min_step_size,
options.ridders_relative_initial_step_size);
min_step_size =
std::max(min_step_size, options.ridders_relative_initial_step_size);
}
// For each parameter in the parameter block, use finite differences to
@@ -133,7 +135,9 @@ struct NumericDiff {
const double delta = std::max(min_step_size, step_size(j));
if (kMethod == RIDDERS) {
if (!EvaluateRiddersJacobianColumn(functor, j, delta,
if (!EvaluateRiddersJacobianColumn(functor,
j,
delta,
options,
num_residuals_internal,
parameter_block_size_internal,
@@ -146,7 +150,9 @@ struct NumericDiff {
return false;
}
} else {
if (!EvaluateJacobianColumn(functor, j, delta,
if (!EvaluateJacobianColumn(functor,
j,
delta,
num_residuals_internal,
parameter_block_size_internal,
x.data(),
@@ -182,8 +188,7 @@ struct NumericDiff {
typedef Matrix<double, kParameterBlockSize, 1> ParameterVector;
Map<const ParameterVector> x(x_ptr, parameter_block_size);
Map<ParameterVector> x_plus_delta(x_plus_delta_ptr,
parameter_block_size);
Map<ParameterVector> x_plus_delta(x_plus_delta_ptr, parameter_block_size);
Map<ResidualVector> residuals(residuals_ptr, num_residuals);
Map<ResidualVector> temp_residuals(temp_residuals_ptr, num_residuals);
@@ -191,9 +196,8 @@ struct NumericDiff {
// Mutate 1 element at a time and then restore.
x_plus_delta(parameter_index) = x(parameter_index) + delta;
if (!VariadicEvaluate<ParameterDims>(*functor,
parameters,
residuals.data())) {
if (!VariadicEvaluate<ParameterDims>(
*functor, parameters, residuals.data())) {
return false;
}
@@ -206,9 +210,8 @@ struct NumericDiff {
// Compute the function on the other side of x(parameter_index).
x_plus_delta(parameter_index) = x(parameter_index) - delta;
if (!VariadicEvaluate<ParameterDims>(*functor,
parameters,
temp_residuals.data())) {
if (!VariadicEvaluate<ParameterDims>(
*functor, parameters, temp_residuals.data())) {
return false;
}
@@ -217,8 +220,7 @@ struct NumericDiff {
} else {
// Forward difference only; reuse existing residuals evaluation.
residuals -=
Map<const ResidualVector>(residuals_at_eval_point,
num_residuals);
Map<const ResidualVector>(residuals_at_eval_point, num_residuals);
}
// Restore x_plus_delta.
@@ -254,17 +256,17 @@ struct NumericDiff {
double* x_plus_delta_ptr,
double* temp_residuals_ptr,
double* residuals_ptr) {
using Eigen::aligned_allocator;
using Eigen::Map;
using Eigen::Matrix;
using Eigen::aligned_allocator;
typedef Matrix<double, kNumResiduals, 1> ResidualVector;
typedef Matrix<double, kNumResiduals, Eigen::Dynamic> ResidualCandidateMatrix;
typedef Matrix<double, kNumResiduals, Eigen::Dynamic>
ResidualCandidateMatrix;
typedef Matrix<double, kParameterBlockSize, 1> ParameterVector;
Map<const ParameterVector> x(x_ptr, parameter_block_size);
Map<ParameterVector> x_plus_delta(x_plus_delta_ptr,
parameter_block_size);
Map<ParameterVector> x_plus_delta(x_plus_delta_ptr, parameter_block_size);
Map<ResidualVector> residuals(residuals_ptr, num_residuals);
Map<ResidualVector> temp_residuals(temp_residuals_ptr, num_residuals);
@@ -275,18 +277,16 @@ struct NumericDiff {
// As the derivative is estimated, the step size decreases.
// By default, the step sizes are chosen so that the middle column
// of the Romberg tableau uses the input delta.
double current_step_size = delta *
pow(options.ridders_step_shrink_factor,
options.max_num_ridders_extrapolations / 2);
double current_step_size =
delta * pow(options.ridders_step_shrink_factor,
options.max_num_ridders_extrapolations / 2);
// Double-buffering temporary differential candidate vectors
// from previous step size.
ResidualCandidateMatrix stepsize_candidates_a(
num_residuals,
options.max_num_ridders_extrapolations);
num_residuals, options.max_num_ridders_extrapolations);
ResidualCandidateMatrix stepsize_candidates_b(
num_residuals,
options.max_num_ridders_extrapolations);
num_residuals, options.max_num_ridders_extrapolations);
ResidualCandidateMatrix* current_candidates = &stepsize_candidates_a;
ResidualCandidateMatrix* previous_candidates = &stepsize_candidates_b;
@@ -304,7 +304,9 @@ struct NumericDiff {
// 3. Extrapolation becomes numerically unstable.
for (int i = 0; i < options.max_num_ridders_extrapolations; ++i) {
// Compute the numerical derivative at this step size.
if (!EvaluateJacobianColumn(functor, parameter_index, current_step_size,
if (!EvaluateJacobianColumn(functor,
parameter_index,
current_step_size,
num_residuals,
parameter_block_size,
x.data(),
@@ -327,23 +329,24 @@ struct NumericDiff {
// Extrapolation factor for Richardson acceleration method (see below).
double richardson_factor = options.ridders_step_shrink_factor *
options.ridders_step_shrink_factor;
options.ridders_step_shrink_factor;
for (int k = 1; k <= i; ++k) {
// Extrapolate the various orders of finite differences using
// the Richardson acceleration method.
current_candidates->col(k) =
(richardson_factor * current_candidates->col(k - 1) -
previous_candidates->col(k - 1)) / (richardson_factor - 1.0);
previous_candidates->col(k - 1)) /
(richardson_factor - 1.0);
richardson_factor *= options.ridders_step_shrink_factor *
options.ridders_step_shrink_factor;
options.ridders_step_shrink_factor;
// Compute the difference between the previous value and the current.
double candidate_error = std::max(
(current_candidates->col(k) -
current_candidates->col(k - 1)).norm(),
(current_candidates->col(k) -
previous_candidates->col(k - 1)).norm());
(current_candidates->col(k) - current_candidates->col(k - 1))
.norm(),
(current_candidates->col(k) - previous_candidates->col(k - 1))
.norm());
// If the error has decreased, update results.
if (candidate_error <= norm_error) {
@@ -365,8 +368,9 @@ struct NumericDiff {
// Check to see if the current gradient estimate is numerically unstable.
// If so, bail out and return the last stable result.
if (i > 0) {
double tableau_error = (current_candidates->col(i) -
previous_candidates->col(i - 1)).norm();
double tableau_error =
(current_candidates->col(i) - previous_candidates->col(i - 1))
.norm();
// Compare current error to the chosen candidate's error.
if (tableau_error >= 2 * norm_error) {
@@ -482,14 +486,18 @@ struct EvaluateJacobianForParameterBlocks<ParameterDims,
// End of 'recursion'. Nothing more to do.
template <typename ParameterDims, int ParameterIdx>
struct EvaluateJacobianForParameterBlocks<ParameterDims, std::integer_sequence<int>,
struct EvaluateJacobianForParameterBlocks<ParameterDims,
std::integer_sequence<int>,
ParameterIdx> {
template <NumericDiffMethodType method, int kNumResiduals,
template <NumericDiffMethodType method,
int kNumResiduals,
typename CostFunctor>
static bool Apply(const CostFunctor* /* NOT USED*/,
const double* /* NOT USED*/,
const NumericDiffOptions& /* NOT USED*/, int /* NOT USED*/,
double** /* NOT USED*/, double** /* NOT USED*/) {
const NumericDiffOptions& /* NOT USED*/,
int /* NOT USED*/,
double** /* NOT USED*/,
double** /* NOT USED*/) {
return true;
}
};

View File

@@ -35,17 +35,17 @@
#include "ceres/internal/config.h"
#if defined(CERES_USE_OPENMP)
# if defined(CERES_USE_CXX_THREADS) || defined(CERES_NO_THREADS)
# error CERES_USE_OPENMP is mutually exclusive to CERES_USE_CXX_THREADS and CERES_NO_THREADS
# endif
#if defined(CERES_USE_CXX_THREADS) || defined(CERES_NO_THREADS)
#error CERES_USE_OPENMP is mutually exclusive to CERES_USE_CXX_THREADS and CERES_NO_THREADS
#endif
#elif defined(CERES_USE_CXX_THREADS)
# if defined(CERES_USE_OPENMP) || defined(CERES_NO_THREADS)
# error CERES_USE_CXX_THREADS is mutually exclusive to CERES_USE_OPENMP, CERES_USE_CXX_THREADS and CERES_NO_THREADS
# endif
#if defined(CERES_USE_OPENMP) || defined(CERES_NO_THREADS)
#error CERES_USE_CXX_THREADS is mutually exclusive to CERES_USE_OPENMP, CERES_USE_CXX_THREADS and CERES_NO_THREADS
#endif
#elif defined(CERES_NO_THREADS)
# if defined(CERES_USE_OPENMP) || defined(CERES_USE_CXX_THREADS)
# error CERES_NO_THREADS is mutually exclusive to CERES_USE_OPENMP and CERES_USE_CXX_THREADS
# endif
#if defined(CERES_USE_OPENMP) || defined(CERES_USE_CXX_THREADS)
#error CERES_NO_THREADS is mutually exclusive to CERES_USE_OPENMP and CERES_USE_CXX_THREADS
#endif
#else
# error One of CERES_USE_OPENMP, CERES_USE_CXX_THREADS or CERES_NO_THREADS must be defined.
#endif
@@ -54,37 +54,57 @@
// compiled without any sparse back-end. Verify that it has not subsequently
// been inconsistently redefined.
#if defined(CERES_NO_SPARSE)
# if !defined(CERES_NO_SUITESPARSE)
# error CERES_NO_SPARSE requires CERES_NO_SUITESPARSE.
# endif
# if !defined(CERES_NO_CXSPARSE)
# error CERES_NO_SPARSE requires CERES_NO_CXSPARSE
# endif
# if !defined(CERES_NO_ACCELERATE_SPARSE)
# error CERES_NO_SPARSE requires CERES_NO_ACCELERATE_SPARSE
# endif
# if defined(CERES_USE_EIGEN_SPARSE)
# error CERES_NO_SPARSE requires !CERES_USE_EIGEN_SPARSE
# endif
#if !defined(CERES_NO_SUITESPARSE)
#error CERES_NO_SPARSE requires CERES_NO_SUITESPARSE.
#endif
#if !defined(CERES_NO_CXSPARSE)
#error CERES_NO_SPARSE requires CERES_NO_CXSPARSE
#endif
#if !defined(CERES_NO_ACCELERATE_SPARSE)
#error CERES_NO_SPARSE requires CERES_NO_ACCELERATE_SPARSE
#endif
#if defined(CERES_USE_EIGEN_SPARSE)
#error CERES_NO_SPARSE requires !CERES_USE_EIGEN_SPARSE
#endif
#endif
// A macro to signal which functions and classes are exported when
// building a DLL with MSVC.
//
// Note that the ordering here is important, CERES_BUILDING_SHARED_LIBRARY
// is only defined locally when Ceres is compiled, it is never exported to
// users. However, in order that we do not have to configure config.h
// separately for building vs installing, if we are using MSVC and building
// a shared library, then both CERES_BUILDING_SHARED_LIBRARY and
// CERES_USING_SHARED_LIBRARY will be defined when Ceres is compiled.
// Hence it is important that the check for CERES_BUILDING_SHARED_LIBRARY
// happens first.
#if defined(_MSC_VER) && defined(CERES_BUILDING_SHARED_LIBRARY)
# define CERES_EXPORT __declspec(dllexport)
#elif defined(_MSC_VER) && defined(CERES_USING_SHARED_LIBRARY)
# define CERES_EXPORT __declspec(dllimport)
// building a shared library.
#if defined(_MSC_VER)
#define CERES_API_SHARED_IMPORT __declspec(dllimport)
#define CERES_API_SHARED_EXPORT __declspec(dllexport)
#elif defined(__GNUC__)
#define CERES_API_SHARED_IMPORT __attribute__((visibility("default")))
#define CERES_API_SHARED_EXPORT __attribute__((visibility("default")))
#else
# define CERES_EXPORT
#define CERES_API_SHARED_IMPORT
#define CERES_API_SHARED_EXPORT
#endif
// CERES_BUILDING_SHARED_LIBRARY is only defined locally when Ceres itself is
// compiled as a shared library, it is never exported to users. In order that
// we do not have to configure config.h separately when building Ceres as either
// a static or dynamic library, we define both CERES_USING_SHARED_LIBRARY and
// CERES_BUILDING_SHARED_LIBRARY when building as a shared library.
#if defined(CERES_USING_SHARED_LIBRARY)
#if defined(CERES_BUILDING_SHARED_LIBRARY)
// Compiling Ceres itself as a shared library.
#define CERES_EXPORT CERES_API_SHARED_EXPORT
#else
// Using Ceres as a shared library.
#define CERES_EXPORT CERES_API_SHARED_IMPORT
#endif
#else
// Ceres was compiled as a static library, export everything.
#define CERES_EXPORT
#endif
// Unit tests reach in and test internal functionality so we need a way to make
// those symbols visible
#ifdef CERES_EXPORT_INTERNAL_SYMBOLS
#define CERES_EXPORT_INTERNAL CERES_EXPORT
#else
#define CERES_EXPORT_INTERNAL
#endif
#endif // CERES_PUBLIC_INTERNAL_PORT_H_

View File

@@ -32,7 +32,7 @@
#undef CERES_WARNINGS_DISABLED
#ifdef _MSC_VER
#pragma warning( pop )
#pragma warning(pop)
#endif
#endif // CERES_WARNINGS_DISABLED

View File

@@ -46,8 +46,10 @@ namespace internal {
// For fixed size cost functors
template <typename Functor, typename T, int... Indices>
inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
T* output, std::false_type /*is_dynamic*/,
inline bool VariadicEvaluateImpl(const Functor& functor,
T const* const* input,
T* output,
std::false_type /*is_dynamic*/,
std::integer_sequence<int, Indices...>) {
static_assert(sizeof...(Indices),
"Invalid number of parameter blocks. At least one parameter "
@@ -57,26 +59,31 @@ inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
// For dynamic sized cost functors
template <typename Functor, typename T>
inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
T* output, std::true_type /*is_dynamic*/,
inline bool VariadicEvaluateImpl(const Functor& functor,
T const* const* input,
T* output,
std::true_type /*is_dynamic*/,
std::integer_sequence<int>) {
return functor(input, output);
}
// For ceres cost functors (not ceres::CostFunction)
template <typename ParameterDims, typename Functor, typename T>
inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
T* output, const void* /* NOT USED */) {
inline bool VariadicEvaluateImpl(const Functor& functor,
T const* const* input,
T* output,
const void* /* NOT USED */) {
using ParameterBlockIndices =
std::make_integer_sequence<int, ParameterDims::kNumParameterBlocks>;
using IsDynamic = std::integral_constant<bool, ParameterDims::kIsDynamic>;
return VariadicEvaluateImpl(functor, input, output, IsDynamic(),
ParameterBlockIndices());
return VariadicEvaluateImpl(
functor, input, output, IsDynamic(), ParameterBlockIndices());
}
// For ceres::CostFunction
template <typename ParameterDims, typename Functor, typename T>
inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
inline bool VariadicEvaluateImpl(const Functor& functor,
T const* const* input,
T* output,
const CostFunction* /* NOT USED */) {
return functor.Evaluate(input, output, nullptr);
@@ -95,7 +102,8 @@ inline bool VariadicEvaluateImpl(const Functor& functor, T const* const* input,
// blocks. The signature of the functor must have the following signature
// 'bool()(const T* i_1, const T* i_2, ... const T* i_n, T* output)'.
template <typename ParameterDims, typename Functor, typename T>
inline bool VariadicEvaluate(const Functor& functor, T const* const* input,
inline bool VariadicEvaluate(const Functor& functor,
T const* const* input,
T* output) {
return VariadicEvaluateImpl<ParameterDims>(functor, input, output, &functor);
}

View File

@@ -73,7 +73,7 @@ struct CERES_EXPORT IterationSummary {
bool step_is_successful = false;
// Value of the objective function.
double cost = 0.90;
double cost = 0.0;
// Change in the value of the objective function in this
// iteration. This can be positive or negative.

View File

@@ -388,6 +388,8 @@ using std::cbrt;
using std::ceil;
using std::cos;
using std::cosh;
using std::erf;
using std::erfc;
using std::exp;
using std::exp2;
using std::floor;
@@ -573,6 +575,21 @@ inline Jet<T, N> fmin(const Jet<T, N>& x, const Jet<T, N>& y) {
return y < x ? y : x;
}
// erf is defined as an integral that cannot be expressed analyticaly
// however, the derivative is trivial to compute
// erf(x + h) = erf(x) + h * 2*exp(-x^2)/sqrt(pi)
template <typename T, int N>
inline Jet<T, N> erf(const Jet<T, N>& x) {
return Jet<T, N>(erf(x.a), x.v * M_2_SQRTPI * exp(-x.a * x.a));
}
// erfc(x) = 1-erf(x)
// erfc(x + h) = erfc(x) + h * (-2*exp(-x^2)/sqrt(pi))
template <typename T, int N>
inline Jet<T, N> erfc(const Jet<T, N>& x) {
return Jet<T, N>(erfc(x.a), -x.v * M_2_SQRTPI * exp(-x.a * x.a));
}
// Bessel functions of the first kind with integer order equal to 0, 1, n.
//
// Microsoft has deprecated the j[0,1,n]() POSIX Bessel functions in favour of

View File

@@ -90,8 +90,8 @@ namespace ceres {
//
// An example that occurs commonly in Structure from Motion problems
// is when camera rotations are parameterized using Quaternion. There,
// it is useful only make updates orthogonal to that 4-vector defining
// the quaternion. One way to do this is to let delta be a 3
// it is useful to only make updates orthogonal to that 4-vector
// defining the quaternion. One way to do this is to let delta be a 3
// dimensional vector and define Plus to be
//
// Plus(x, delta) = [cos(|delta|), sin(|delta|) delta / |delta|] * x
@@ -99,7 +99,7 @@ namespace ceres {
// The multiplication between the two 4-vectors on the RHS is the
// standard quaternion product.
//
// Given g and a point x, optimizing f can now be restated as
// Given f and a point x, optimizing f can now be restated as
//
// min f(Plus(x, delta))
// delta
@@ -306,6 +306,7 @@ class CERES_EXPORT ProductParameterization : public LocalParameterization {
public:
ProductParameterization(const ProductParameterization&) = delete;
ProductParameterization& operator=(const ProductParameterization&) = delete;
virtual ~ProductParameterization() {}
//
// NOTE: The constructor takes ownership of the input local
// parameterizations.
@@ -341,7 +342,8 @@ class CERES_EXPORT ProductParameterization : public LocalParameterization {
bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const override;
bool ComputeJacobian(const double* x, double* jacobian) const override;
bool ComputeJacobian(const double* x,
double* jacobian) const override;
int GlobalSize() const override { return global_size_; }
int LocalSize() const override { return local_size_; }
@@ -354,8 +356,8 @@ class CERES_EXPORT ProductParameterization : public LocalParameterization {
} // namespace ceres
// clang-format off
#include "ceres/internal/reenable_warnings.h"
#include "ceres/internal/line_parameterization.h"
#endif // CERES_PUBLIC_LOCAL_PARAMETERIZATION_H_

View File

@@ -192,7 +192,10 @@ class NumericDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
}
}
~NumericDiffCostFunction() {
explicit NumericDiffCostFunction(NumericDiffCostFunction&& other)
: functor_(std::move(other.functor_)), ownership_(other.ownership_) {}
virtual ~NumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();
}

View File

@@ -453,13 +453,15 @@ class CERES_EXPORT Problem {
// problem.AddResidualBlock(new MyCostFunction, nullptr, &x);
//
// double cost = 0.0;
// problem.Evaluate(Problem::EvaluateOptions(), &cost, nullptr, nullptr, nullptr);
// problem.Evaluate(Problem::EvaluateOptions(), &cost,
// nullptr, nullptr, nullptr);
//
// The cost is evaluated at x = 1. If you wish to evaluate the
// problem at x = 2, then
//
// x = 2;
// problem.Evaluate(Problem::EvaluateOptions(), &cost, nullptr, nullptr, nullptr);
// problem.Evaluate(Problem::EvaluateOptions(), &cost,
// nullptr, nullptr, nullptr);
//
// is the way to do so.
//
@@ -475,7 +477,7 @@ class CERES_EXPORT Problem {
// at the end of an iteration during a solve.
//
// Note 4: If an EvaluationCallback is associated with the problem,
// then its PrepareForEvaluation method will be called everytime
// then its PrepareForEvaluation method will be called every time
// this method is called with new_point = true.
bool Evaluate(const EvaluateOptions& options,
double* cost,
@@ -509,23 +511,41 @@ class CERES_EXPORT Problem {
// apply_loss_function as the name implies allows the user to switch
// the application of the loss function on and off.
//
// WARNING: If an EvaluationCallback is associated with the problem
// then it is the user's responsibility to call it before calling
// this method.
//
// This is because, if the user calls this method multiple times, we
// cannot tell if the underlying parameter blocks have changed
// between calls or not. So if EvaluateResidualBlock was responsible
// for calling the EvaluationCallback, it will have to do it
// everytime it is called. Which makes the common case where the
// parameter blocks do not change, inefficient. So we leave it to
// the user to call the EvaluationCallback as needed.
// If an EvaluationCallback is associated with the problem, then its
// PrepareForEvaluation method will be called every time this method
// is called with new_point = true. This conservatively assumes that
// the user may have changed the parameter values since the previous
// call to evaluate / solve. For improved efficiency, and only if
// you know that the parameter values have not changed between
// calls, see EvaluateResidualBlockAssumingParametersUnchanged().
bool EvaluateResidualBlock(ResidualBlockId residual_block_id,
bool apply_loss_function,
double* cost,
double* residuals,
double** jacobians) const;
// Same as EvaluateResidualBlock except that if an
// EvaluationCallback is associated with the problem, then its
// PrepareForEvaluation method will be called every time this method
// is called with new_point = false.
//
// This means, if an EvaluationCallback is associated with the
// problem then it is the user's responsibility to call
// PrepareForEvaluation before calling this method if necessary,
// i.e. iff the parameter values have been changed since the last
// call to evaluate / solve.'
//
// This is because, as the name implies, we assume that the
// parameter blocks did not change since the last time
// PrepareForEvaluation was called (via Solve, Evaluate or
// EvaluateResidualBlock).
bool EvaluateResidualBlockAssumingParametersUnchanged(
ResidualBlockId residual_block_id,
bool apply_loss_function,
double* cost,
double* residuals,
double** jacobians) const;
private:
friend class Solver;
friend class Covariance;

View File

@@ -320,8 +320,8 @@ inline void QuaternionToAngleAxis(const T* quaternion, T* angle_axis) {
}
template <typename T>
void RotationMatrixToQuaternion(const T* R, T* angle_axis) {
RotationMatrixToQuaternion(ColumnMajorAdapter3x3(R), angle_axis);
void RotationMatrixToQuaternion(const T* R, T* quaternion) {
RotationMatrixToQuaternion(ColumnMajorAdapter3x3(R), quaternion);
}
// This algorithm comes from "Quaternion Calculus and Fast Animation",

View File

@@ -360,7 +360,8 @@ class CERES_EXPORT Solver {
//
// If Solver::Options::preconditioner_type == SUBSET, then
// residual_blocks_for_subset_preconditioner must be non-empty.
std::unordered_set<ResidualBlockId> residual_blocks_for_subset_preconditioner;
std::unordered_set<ResidualBlockId>
residual_blocks_for_subset_preconditioner;
// Ceres supports using multiple dense linear algebra libraries
// for dense matrix factorizations. Currently EIGEN and LAPACK are
@@ -838,7 +839,7 @@ class CERES_EXPORT Solver {
int num_linear_solves = -1;
// Time (in seconds) spent evaluating the residual vector.
double residual_evaluation_time_in_seconds = 1.0;
double residual_evaluation_time_in_seconds = -1.0;
// Number of residual only evaluations.
int num_residual_evaluations = -1;

View File

@@ -50,7 +50,7 @@ namespace ceres {
// delete on it upon completion.
enum Ownership {
DO_NOT_TAKE_OWNERSHIP,
TAKE_OWNERSHIP
TAKE_OWNERSHIP,
};
// TODO(keir): Considerably expand the explanations of each solver type.
@@ -185,19 +185,19 @@ enum SparseLinearAlgebraLibraryType {
enum DenseLinearAlgebraLibraryType {
EIGEN,
LAPACK
LAPACK,
};
// Logging options
// The options get progressively noisier.
enum LoggingType {
SILENT,
PER_MINIMIZER_ITERATION
PER_MINIMIZER_ITERATION,
};
enum MinimizerType {
LINE_SEARCH,
TRUST_REGION
TRUST_REGION,
};
enum LineSearchDirectionType {
@@ -412,7 +412,7 @@ enum DumpFormatType {
// specified for the number of residuals. If specified, then the
// number of residuas for that cost function can vary at runtime.
enum DimensionType {
DYNAMIC = -1
DYNAMIC = -1,
};
// The differentiation method used to compute numerical derivatives in
@@ -433,7 +433,7 @@ enum NumericDiffMethodType {
enum LineSearchInterpolationType {
BISECTION,
QUADRATIC,
CUBIC
CUBIC,
};
enum CovarianceAlgorithmType {
@@ -448,8 +448,7 @@ enum CovarianceAlgorithmType {
// did not write to that memory location.
const double kImpossibleValue = 1e302;
CERES_EXPORT const char* LinearSolverTypeToString(
LinearSolverType type);
CERES_EXPORT const char* LinearSolverTypeToString(LinearSolverType type);
CERES_EXPORT bool StringToLinearSolverType(std::string value,
LinearSolverType* type);
@@ -459,25 +458,23 @@ CERES_EXPORT bool StringToPreconditionerType(std::string value,
CERES_EXPORT const char* VisibilityClusteringTypeToString(
VisibilityClusteringType type);
CERES_EXPORT bool StringToVisibilityClusteringType(std::string value,
VisibilityClusteringType* type);
CERES_EXPORT bool StringToVisibilityClusteringType(
std::string value, VisibilityClusteringType* type);
CERES_EXPORT const char* SparseLinearAlgebraLibraryTypeToString(
SparseLinearAlgebraLibraryType type);
CERES_EXPORT bool StringToSparseLinearAlgebraLibraryType(
std::string value,
SparseLinearAlgebraLibraryType* type);
std::string value, SparseLinearAlgebraLibraryType* type);
CERES_EXPORT const char* DenseLinearAlgebraLibraryTypeToString(
DenseLinearAlgebraLibraryType type);
CERES_EXPORT bool StringToDenseLinearAlgebraLibraryType(
std::string value,
DenseLinearAlgebraLibraryType* type);
std::string value, DenseLinearAlgebraLibraryType* type);
CERES_EXPORT const char* TrustRegionStrategyTypeToString(
TrustRegionStrategyType type);
CERES_EXPORT bool StringToTrustRegionStrategyType(std::string value,
TrustRegionStrategyType* type);
CERES_EXPORT bool StringToTrustRegionStrategyType(
std::string value, TrustRegionStrategyType* type);
CERES_EXPORT const char* DoglegTypeToString(DoglegType type);
CERES_EXPORT bool StringToDoglegType(std::string value, DoglegType* type);
@@ -487,41 +484,39 @@ CERES_EXPORT bool StringToMinimizerType(std::string value, MinimizerType* type);
CERES_EXPORT const char* LineSearchDirectionTypeToString(
LineSearchDirectionType type);
CERES_EXPORT bool StringToLineSearchDirectionType(std::string value,
LineSearchDirectionType* type);
CERES_EXPORT bool StringToLineSearchDirectionType(
std::string value, LineSearchDirectionType* type);
CERES_EXPORT const char* LineSearchTypeToString(LineSearchType type);
CERES_EXPORT bool StringToLineSearchType(std::string value, LineSearchType* type);
CERES_EXPORT bool StringToLineSearchType(std::string value,
LineSearchType* type);
CERES_EXPORT const char* NonlinearConjugateGradientTypeToString(
NonlinearConjugateGradientType type);
CERES_EXPORT bool StringToNonlinearConjugateGradientType(
std::string value,
NonlinearConjugateGradientType* type);
std::string value, NonlinearConjugateGradientType* type);
CERES_EXPORT const char* LineSearchInterpolationTypeToString(
LineSearchInterpolationType type);
CERES_EXPORT bool StringToLineSearchInterpolationType(
std::string value,
LineSearchInterpolationType* type);
std::string value, LineSearchInterpolationType* type);
CERES_EXPORT const char* CovarianceAlgorithmTypeToString(
CovarianceAlgorithmType type);
CERES_EXPORT bool StringToCovarianceAlgorithmType(
std::string value,
CovarianceAlgorithmType* type);
std::string value, CovarianceAlgorithmType* type);
CERES_EXPORT const char* NumericDiffMethodTypeToString(
NumericDiffMethodType type);
CERES_EXPORT bool StringToNumericDiffMethodType(
std::string value,
NumericDiffMethodType* type);
CERES_EXPORT bool StringToNumericDiffMethodType(std::string value,
NumericDiffMethodType* type);
CERES_EXPORT const char* LoggingTypeToString(LoggingType type);
CERES_EXPORT bool StringtoLoggingType(std::string value, LoggingType* type);
CERES_EXPORT const char* DumpFormatTypeToString(DumpFormatType type);
CERES_EXPORT bool StringtoDumpFormatType(std::string value, DumpFormatType* type);
CERES_EXPORT bool StringtoDumpFormatType(std::string value,
DumpFormatType* type);
CERES_EXPORT bool StringtoDumpFormatType(std::string value, LoggingType* type);
CERES_EXPORT const char* TerminationTypeToString(TerminationType type);

View File

@@ -41,8 +41,9 @@
#define CERES_TO_STRING(x) CERES_TO_STRING_HELPER(x)
// The Ceres version as a string; for example "1.9.0".
#define CERES_VERSION_STRING CERES_TO_STRING(CERES_VERSION_MAJOR) "." \
CERES_TO_STRING(CERES_VERSION_MINOR) "." \
CERES_TO_STRING(CERES_VERSION_REVISION)
#define CERES_VERSION_STRING \
CERES_TO_STRING(CERES_VERSION_MAJOR) \
"." CERES_TO_STRING(CERES_VERSION_MINOR) "." CERES_TO_STRING( \
CERES_VERSION_REVISION)
#endif // CERES_PUBLIC_VERSION_H_

View File

@@ -33,18 +33,19 @@
#ifndef CERES_NO_ACCELERATE_SPARSE
#include "ceres/accelerate_sparse.h"
#include <algorithm>
#include <string>
#include <vector>
#include "ceres/accelerate_sparse.h"
#include "ceres/compressed_col_sparse_matrix_utils.h"
#include "ceres/compressed_row_sparse_matrix.h"
#include "ceres/triplet_sparse_matrix.h"
#include "glog/logging.h"
#define CASESTR(x) case x: return #x
#define CASESTR(x) \
case x: \
return #x
namespace ceres {
namespace internal {
@@ -68,7 +69,7 @@ const char* SparseStatusToString(SparseStatus_t status) {
// aligned to kAccelerateRequiredAlignment and returns a pointer to the
// aligned start.
void* ResizeForAccelerateAlignment(const size_t required_size,
std::vector<uint8_t> *workspace) {
std::vector<uint8_t>* workspace) {
// As per the Accelerate documentation, all workspace memory passed to the
// sparse solver functions must be 16-byte aligned.
constexpr int kAccelerateRequiredAlignment = 16;
@@ -80,29 +81,28 @@ void* ResizeForAccelerateAlignment(const size_t required_size,
size_t size_from_aligned_start = workspace->size();
void* aligned_solve_workspace_start =
reinterpret_cast<void*>(workspace->data());
aligned_solve_workspace_start =
std::align(kAccelerateRequiredAlignment,
required_size,
aligned_solve_workspace_start,
size_from_aligned_start);
aligned_solve_workspace_start = std::align(kAccelerateRequiredAlignment,
required_size,
aligned_solve_workspace_start,
size_from_aligned_start);
CHECK(aligned_solve_workspace_start != nullptr)
<< "required_size: " << required_size
<< ", workspace size: " << workspace->size();
return aligned_solve_workspace_start;
}
template<typename Scalar>
template <typename Scalar>
void AccelerateSparse<Scalar>::Solve(NumericFactorization* numeric_factor,
DenseVector* rhs_and_solution) {
// From SparseSolve() documentation in Solve.h
const int required_size =
numeric_factor->solveWorkspaceRequiredStatic +
numeric_factor->solveWorkspaceRequiredPerRHS;
SparseSolve(*numeric_factor, *rhs_and_solution,
const int required_size = numeric_factor->solveWorkspaceRequiredStatic +
numeric_factor->solveWorkspaceRequiredPerRHS;
SparseSolve(*numeric_factor,
*rhs_and_solution,
ResizeForAccelerateAlignment(required_size, &solve_workspace_));
}
template<typename Scalar>
template <typename Scalar>
typename AccelerateSparse<Scalar>::ASSparseMatrix
AccelerateSparse<Scalar>::CreateSparseMatrixTransposeView(
CompressedRowSparseMatrix* A) {
@@ -112,7 +112,7 @@ AccelerateSparse<Scalar>::CreateSparseMatrixTransposeView(
//
// Accelerate's columnStarts is a long*, not an int*. These types might be
// different (e.g. ARM on iOS) so always make a copy.
column_starts_.resize(A->num_rows() +1); // +1 for final column length.
column_starts_.resize(A->num_rows() + 1); // +1 for final column length.
std::copy_n(A->rows(), column_starts_.size(), &column_starts_[0]);
ASSparseMatrix At;
@@ -136,29 +136,31 @@ AccelerateSparse<Scalar>::CreateSparseMatrixTransposeView(
return At;
}
template<typename Scalar>
template <typename Scalar>
typename AccelerateSparse<Scalar>::SymbolicFactorization
AccelerateSparse<Scalar>::AnalyzeCholesky(ASSparseMatrix* A) {
return SparseFactor(SparseFactorizationCholesky, A->structure);
}
template<typename Scalar>
template <typename Scalar>
typename AccelerateSparse<Scalar>::NumericFactorization
AccelerateSparse<Scalar>::Cholesky(ASSparseMatrix* A,
SymbolicFactorization* symbolic_factor) {
return SparseFactor(*symbolic_factor, *A);
}
template<typename Scalar>
template <typename Scalar>
void AccelerateSparse<Scalar>::Cholesky(ASSparseMatrix* A,
NumericFactorization* numeric_factor) {
// From SparseRefactor() documentation in Solve.h
const int required_size = std::is_same<Scalar, double>::value
? numeric_factor->symbolicFactorization.workspaceSize_Double
: numeric_factor->symbolicFactorization.workspaceSize_Float;
return SparseRefactor(*A, numeric_factor,
ResizeForAccelerateAlignment(required_size,
&factorization_workspace_));
const int required_size =
std::is_same<Scalar, double>::value
? numeric_factor->symbolicFactorization.workspaceSize_Double
: numeric_factor->symbolicFactorization.workspaceSize_Float;
return SparseRefactor(
*A,
numeric_factor,
ResizeForAccelerateAlignment(required_size, &factorization_workspace_));
}
// Instantiate only for the specific template types required/supported s/t the
@@ -166,34 +168,33 @@ void AccelerateSparse<Scalar>::Cholesky(ASSparseMatrix* A,
template class AccelerateSparse<double>;
template class AccelerateSparse<float>;
template<typename Scalar>
std::unique_ptr<SparseCholesky>
AppleAccelerateCholesky<Scalar>::Create(OrderingType ordering_type) {
template <typename Scalar>
std::unique_ptr<SparseCholesky> AppleAccelerateCholesky<Scalar>::Create(
OrderingType ordering_type) {
return std::unique_ptr<SparseCholesky>(
new AppleAccelerateCholesky<Scalar>(ordering_type));
}
template<typename Scalar>
template <typename Scalar>
AppleAccelerateCholesky<Scalar>::AppleAccelerateCholesky(
const OrderingType ordering_type)
: ordering_type_(ordering_type) {}
template<typename Scalar>
template <typename Scalar>
AppleAccelerateCholesky<Scalar>::~AppleAccelerateCholesky() {
FreeSymbolicFactorization();
FreeNumericFactorization();
}
template<typename Scalar>
template <typename Scalar>
CompressedRowSparseMatrix::StorageType
AppleAccelerateCholesky<Scalar>::StorageType() const {
return CompressedRowSparseMatrix::LOWER_TRIANGULAR;
}
template<typename Scalar>
LinearSolverTerminationType
AppleAccelerateCholesky<Scalar>::Factorize(CompressedRowSparseMatrix* lhs,
std::string* message) {
template <typename Scalar>
LinearSolverTerminationType AppleAccelerateCholesky<Scalar>::Factorize(
CompressedRowSparseMatrix* lhs, std::string* message) {
CHECK_EQ(lhs->storage_type(), StorageType());
if (lhs == NULL) {
*message = "Failure: Input lhs is NULL.";
@@ -234,11 +235,9 @@ AppleAccelerateCholesky<Scalar>::Factorize(CompressedRowSparseMatrix* lhs,
return LINEAR_SOLVER_SUCCESS;
}
template<typename Scalar>
LinearSolverTerminationType
AppleAccelerateCholesky<Scalar>::Solve(const double* rhs,
double* solution,
std::string* message) {
template <typename Scalar>
LinearSolverTerminationType AppleAccelerateCholesky<Scalar>::Solve(
const double* rhs, double* solution, std::string* message) {
CHECK_EQ(numeric_factor_->status, SparseStatusOK)
<< "Solve called without a call to Factorize first ("
<< SparseStatusToString(numeric_factor_->status) << ").";
@@ -262,7 +261,7 @@ AppleAccelerateCholesky<Scalar>::Solve(const double* rhs,
return LINEAR_SOLVER_SUCCESS;
}
template<typename Scalar>
template <typename Scalar>
void AppleAccelerateCholesky<Scalar>::FreeSymbolicFactorization() {
if (symbolic_factor_) {
SparseCleanup(*symbolic_factor_);
@@ -270,7 +269,7 @@ void AppleAccelerateCholesky<Scalar>::FreeSymbolicFactorization() {
}
}
template<typename Scalar>
template <typename Scalar>
void AppleAccelerateCholesky<Scalar>::FreeNumericFactorization() {
if (numeric_factor_) {
SparseCleanup(*numeric_factor_);
@@ -283,7 +282,7 @@ void AppleAccelerateCholesky<Scalar>::FreeNumericFactorization() {
template class AppleAccelerateCholesky<double>;
template class AppleAccelerateCholesky<float>;
}
}
} // namespace internal
} // namespace ceres
#endif // CERES_NO_ACCELERATE_SPARSE

View File

@@ -40,9 +40,9 @@
#include <string>
#include <vector>
#include "Accelerate.h"
#include "ceres/linear_solver.h"
#include "ceres/sparse_cholesky.h"
#include "Accelerate.h"
namespace ceres {
namespace internal {
@@ -50,11 +50,10 @@ namespace internal {
class CompressedRowSparseMatrix;
class TripletSparseMatrix;
template<typename Scalar>
struct SparseTypesTrait {
};
template <typename Scalar>
struct SparseTypesTrait {};
template<>
template <>
struct SparseTypesTrait<double> {
typedef DenseVector_Double DenseVector;
typedef SparseMatrix_Double SparseMatrix;
@@ -62,7 +61,7 @@ struct SparseTypesTrait<double> {
typedef SparseOpaqueFactorization_Double NumericFactorization;
};
template<>
template <>
struct SparseTypesTrait<float> {
typedef DenseVector_Float DenseVector;
typedef SparseMatrix_Float SparseMatrix;
@@ -70,14 +69,16 @@ struct SparseTypesTrait<float> {
typedef SparseOpaqueFactorization_Float NumericFactorization;
};
template<typename Scalar>
template <typename Scalar>
class AccelerateSparse {
public:
using DenseVector = typename SparseTypesTrait<Scalar>::DenseVector;
// Use ASSparseMatrix to avoid collision with ceres::internal::SparseMatrix.
using ASSparseMatrix = typename SparseTypesTrait<Scalar>::SparseMatrix;
using SymbolicFactorization = typename SparseTypesTrait<Scalar>::SymbolicFactorization;
using NumericFactorization = typename SparseTypesTrait<Scalar>::NumericFactorization;
using SymbolicFactorization =
typename SparseTypesTrait<Scalar>::SymbolicFactorization;
using NumericFactorization =
typename SparseTypesTrait<Scalar>::NumericFactorization;
// Solves a linear system given its symbolic (reference counted within
// NumericFactorization) and numeric factorization.
@@ -109,7 +110,7 @@ class AccelerateSparse {
// An implementation of SparseCholesky interface using Apple's Accelerate
// framework.
template<typename Scalar>
template <typename Scalar>
class AppleAccelerateCholesky : public SparseCholesky {
public:
// Factory
@@ -122,7 +123,7 @@ class AppleAccelerateCholesky : public SparseCholesky {
std::string* message) final;
LinearSolverTerminationType Solve(const double* rhs,
double* solution,
std::string* message) final ;
std::string* message) final;
private:
AppleAccelerateCholesky(const OrderingType ordering_type);
@@ -132,15 +133,15 @@ class AppleAccelerateCholesky : public SparseCholesky {
const OrderingType ordering_type_;
AccelerateSparse<Scalar> as_;
std::unique_ptr<typename AccelerateSparse<Scalar>::SymbolicFactorization>
symbolic_factor_;
symbolic_factor_;
std::unique_ptr<typename AccelerateSparse<Scalar>::NumericFactorization>
numeric_factor_;
numeric_factor_;
// Copy of rhs/solution if Scalar != double (necessitating a copy).
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> scalar_rhs_and_solution_;
};
}
}
} // namespace internal
} // namespace ceres
#endif // CERES_NO_ACCELERATE_SPARSE

View File

@@ -35,6 +35,7 @@
#include <cstddef>
#include <string>
#include <vector>
#include "ceres/stringprintf.h"
#include "ceres/types.h"
namespace ceres {
@@ -45,7 +46,7 @@ using std::string;
bool IsArrayValid(const int size, const double* x) {
if (x != NULL) {
for (int i = 0; i < size; ++i) {
if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
return false;
}
}
@@ -59,7 +60,7 @@ int FindInvalidValue(const int size, const double* x) {
}
for (int i = 0; i < size; ++i) {
if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
return i;
}
}
@@ -92,14 +93,13 @@ void AppendArrayToString(const int size, const double* x, string* result) {
void MapValuesToContiguousRange(const int size, int* array) {
std::vector<int> unique_values(array, array + size);
std::sort(unique_values.begin(), unique_values.end());
unique_values.erase(std::unique(unique_values.begin(),
unique_values.end()),
unique_values.erase(std::unique(unique_values.begin(), unique_values.end()),
unique_values.end());
for (int i = 0; i < size; ++i) {
array[i] = std::lower_bound(unique_values.begin(),
unique_values.end(),
array[i]) - unique_values.begin();
array[i] =
std::lower_bound(unique_values.begin(), unique_values.end(), array[i]) -
unique_values.begin();
}
}

View File

@@ -44,6 +44,7 @@
#define CERES_INTERNAL_ARRAY_UTILS_H_
#include <string>
#include "ceres/internal/port.h"
namespace ceres {
@@ -51,20 +52,22 @@ namespace internal {
// Fill the array x with an impossible value that the user code is
// never expected to compute.
void InvalidateArray(int size, double* x);
CERES_EXPORT_INTERNAL void InvalidateArray(int size, double* x);
// Check if all the entries of the array x are valid, i.e. all the
// values in the array should be finite and none of them should be
// equal to the "impossible" value used by InvalidateArray.
bool IsArrayValid(int size, const double* x);
CERES_EXPORT_INTERNAL bool IsArrayValid(int size, const double* x);
// If the array contains an invalid value, return the index for it,
// otherwise return size.
int FindInvalidValue(const int size, const double* x);
CERES_EXPORT_INTERNAL int FindInvalidValue(const int size, const double* x);
// Utility routine to print an array of doubles to a string. If the
// array pointer is NULL, it is treated as an array of zeros.
void AppendArrayToString(const int size, const double* x, std::string* result);
CERES_EXPORT_INTERNAL void AppendArrayToString(const int size,
const double* x,
std::string* result);
// This routine takes an array of integer values, sorts and uniques
// them and then maps each value in the array to its position in the
@@ -79,7 +82,7 @@ void AppendArrayToString(const int size, const double* x, std::string* result);
// gets mapped to
//
// [1 0 2 3 0 1 3]
void MapValuesToContiguousRange(int size, int* array);
CERES_EXPORT_INTERNAL void MapValuesToContiguousRange(int size, int* array);
} // namespace internal
} // namespace ceres

View File

@@ -29,6 +29,7 @@
// Author: sameeragarwal@google.com (Sameer Agarwal)
#include "ceres/blas.h"
#include "ceres/internal/port.h"
#include "glog/logging.h"

View File

@@ -31,6 +31,7 @@
#include "ceres/block_evaluate_preparer.h"
#include <vector>
#include "ceres/block_sparse_matrix.h"
#include "ceres/casts.h"
#include "ceres/parameter_block.h"
@@ -53,10 +54,8 @@ void BlockEvaluatePreparer::Prepare(const ResidualBlock* residual_block,
double** jacobians) {
// If the overall jacobian is not available, use the scratch space.
if (jacobian == NULL) {
scratch_evaluate_preparer_.Prepare(residual_block,
residual_block_index,
jacobian,
jacobians);
scratch_evaluate_preparer_.Prepare(
residual_block, residual_block_index, jacobian, jacobians);
return;
}

View File

@@ -30,9 +30,9 @@
#include "ceres/block_jacobi_preconditioner.h"
#include "ceres/block_random_access_diagonal_matrix.h"
#include "ceres/block_sparse_matrix.h"
#include "ceres/block_structure.h"
#include "ceres/block_random_access_diagonal_matrix.h"
#include "ceres/casts.h"
#include "ceres/internal/eigen.h"
@@ -65,13 +65,11 @@ bool BlockJacobiPreconditioner::UpdateImpl(const BlockSparseMatrix& A,
const int col_block_size = bs->cols[block_id].size;
int r, c, row_stride, col_stride;
CellInfo* cell_info = m_->GetCell(block_id, block_id,
&r, &c,
&row_stride, &col_stride);
CellInfo* cell_info =
m_->GetCell(block_id, block_id, &r, &c, &row_stride, &col_stride);
MatrixRef m(cell_info->values, row_stride, col_stride);
ConstMatrixRef b(values + cells[j].position,
row_block_size,
col_block_size);
ConstMatrixRef b(
values + cells[j].position, row_block_size, col_block_size);
m.block(r, c, col_block_size, col_block_size) += b.transpose() * b;
}
}
@@ -82,9 +80,7 @@ bool BlockJacobiPreconditioner::UpdateImpl(const BlockSparseMatrix& A,
for (int i = 0; i < bs->cols.size(); ++i) {
const int block_size = bs->cols[i].size;
int r, c, row_stride, col_stride;
CellInfo* cell_info = m_->GetCell(i, i,
&r, &c,
&row_stride, &col_stride);
CellInfo* cell_info = m_->GetCell(i, i, &r, &c, &row_stride, &col_stride);
MatrixRef m(cell_info->values, row_stride, col_stride);
m.block(r, c, block_size, block_size).diagonal() +=
ConstVectorRef(D + position, block_size).array().square().matrix();

View File

@@ -32,7 +32,9 @@
#define CERES_INTERNAL_BLOCK_JACOBI_PRECONDITIONER_H_
#include <memory>
#include "ceres/block_random_access_diagonal_matrix.h"
#include "ceres/internal/port.h"
#include "ceres/preconditioner.h"
namespace ceres {
@@ -51,7 +53,8 @@ struct CompressedRowBlockStructure;
// update the matrix by running Update(A, D). The values of the matrix A are
// inspected to construct the preconditioner. The vector D is applied as the
// D^TD diagonal term.
class BlockJacobiPreconditioner : public BlockSparseMatrixPreconditioner {
class CERES_EXPORT_INTERNAL BlockJacobiPreconditioner
: public BlockSparseMatrixPreconditioner {
public:
// A must remain valid while the BlockJacobiPreconditioner is.
explicit BlockJacobiPreconditioner(const BlockSparseMatrix& A);

Some files were not shown because too many files have changed in this diff Show More