1
1

Compare commits

...

1080 Commits

Author SHA1 Message Date
eed93aaa07 make dot output more compact 2021-08-22 22:34:25 +02:00
fc0bb6cdee avoid allocating index array in some cases 2021-08-22 20:29:52 +02:00
10f2ad1556 add return instruction and initial procedure validation 2021-08-22 20:16:27 +02:00
6d77b87b13 support span buffer reuse 2021-08-22 15:07:23 +02:00
2101b46802 fix comment 2021-08-22 12:49:22 +02:00
34f6765630 Merge branch 'master' into temp-multi-function-procedure 2021-08-22 12:21:52 +02:00
721fad37a1 Fix Windows builds after Zstandard commits 2021-08-21 23:31:51 +02:00
67c29bc5a2 Use Zstandard compression for the sequencer cache
Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2ea66af742 Add support for Zstandard compression for .blend files
Compressing blendfiles can help save a lot of disk space, but the slowdown
while loading and saving is a major annoyance.
Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there
are now several more modern algorithms that outperform it in every way.

In this patch, I decided for Zstandard aka Zstd for several reasons:
- It is widely supported, both in other programs and libraries as well as in
  general-purpose compression utilities on Unix
- It is extremely flexible - spanning several orders of magnitude of
  compression speeds depending on the level setting.
- It is pretty much on the Pareto frontier for all of its configurations
  (meaning that no other algorithm is both faster and more efficient).

One downside of course is that older versions of Blender will not be able to
read these files, but one can always just re-save them without compression or
decompress the file manually with an external tool.

The implementation here saves additional metadata into the compressed file in
order to allow for efficient seeking when loading. This is standard-compliant
and will be ignored by other tools that support Zstd.
If the metadata is not present (e.g. because you manually compressed a .blend
file with another tool), Blender will fall back to sequential reading.

Saving is multithreaded to improve performance. Loading is currently not
multithreaded since it's not easy to predict the access patterns of the
loading code when seeking is supported.
In the future, we might want to look into making this more predictable or
disabling seeking for the main .blend file, which would then allow for
multiple background threads that decompress data ahead of time.

The compression level was chosen to get sizes comparable to previous versions
at much higher speeds. In the future, this could be exposed as an option.

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2b170f16d6 Refactor low-level blendfile reading into separate files
Instead of handling mmap, compression etc. all directly in readfile.c, refactor
the code to use a generic FileReader.
This makes it easier to add new compression methods or similar, and allows to
reuse the logic in other places (e.g. thumbnail reading).

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:38:57 +02:00
34a05f39be Clang: warn about C++20 designated initializers
With the ongoing transition to C++ files, Windows build
breaks often because of designated initializers.
Now we have two compilers to catch the MSVC build error on.

Reviewed By: #platform_macos, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D11940
2021-08-21 14:02:50 +05:30
0b7947e855 Cleanup: minor changes to blf_font.c
- Use early return when kerning isn't used.
- Remove early return that prevented matching acquire/release calls.
2021-08-21 17:46:50 +10:00
47e68537f8 Cleanup: organize blf_font.c functions using doxy-sections
Functions in this file were scattered and not well organized.
2021-08-21 17:41:40 +10:00
c671bfe14e Cleanup: spelling in comments & minor cleanup
Also hyphenate 'mouse-move' use doxy sections in render_update.c &
move function comment from the header to the source.
2021-08-21 13:26:54 +10:00
aed5a27755 Correct build error from 0d7aab2375 2021-08-21 13:22:47 +10:00
0d7aab2375 Refactor: BLF Kerning Cache After Use
Optimization of font kerning by only caching kerning values after a
pair is encountered. Also saves unscaled values so they don't have to
be rebuilt between font size changes.

See D12274 for more details and speed comparison.

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

Reviewed by Campbell Barton
2021-08-20 17:48:42 -07:00
b6a1bf757d DocPy: Cleanup missing newline resulting in wrong html generation 2021-08-20 14:54:46 -04:00
86622467c5 DocPy: Update Dependancies
Updates sphinx and the theme to the latest version along with any of their dependencies.

Note that we will be sticking to sphinx 4.1.1 until sphinx 4.2 for the same reasons listed in:
https://developer.blender.org/rBM8334
2021-08-20 13:46:38 -04:00
Alaska
cd8d9383e7 Fix T90804: small grammatical error in noise threshold description
Differential Revision: https://developer.blender.org/D12277
2021-08-20 17:43:24 +02:00
1b5f17b867 Cleanup, use BKE_scene_uses_cycles_experimental_features 2021-08-20 15:00:58 +02:00
6a404bc633 Cleanup, remove extra code from previous commit
This got accidentally introduced while revising dependencies between
patches for this feature, did not notice until it was too late.
2021-08-20 14:48:47 +02:00
9bfc47c933 Alembic Procedural: basic cache control settings
This adds a setting to enable data caching, and another one to set the
maximum cache size in megabytes.

When caching is enabled we load the data for the entire animation in
memory, as we already do, however, if the data exceeds the memory limit,
render is aborted.

When caching is disabled, we simply load the data for the current frame
in memory.

Ref D10197

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11163
2021-08-20 14:34:43 +02:00
c58d1acba8 improve naming 2021-08-20 14:29:01 +02:00
accf3045be Fix memory leak while processing mouse event
Assignment missed.
2021-08-20 09:06:19 -03:00
ef502127dd Fix T90795: Moving keys in Grease Pencil Dopesheet crashes Blender
`td->loc` is referenced but not initialized.
2021-08-20 08:40:37 -03:00
0ee79f304e cleanup 2021-08-20 13:38:38 +02:00
e642de3d6f Merge branch 'master' into temp-multi-function-procedure 2021-08-20 13:37:32 +02:00
0081200812 Functions: remove multi-function network
The multi-function network system was able to compose multiple
multi-functions into a new one and to evaluate that efficiently.
This functionality was heavily used by the particle nodes prototype
a year ago. However, since then we only used multi-functions
without the need to compose them in geometry nodes.

The upcoming "fields" in geometry nodes will need a way to
compose multi-functions again. Unfortunately, the code removed
in this commit was not ideal for this different kind of function
composition. I've been working on an alternative that will be added
separately when it becomes needed.

I've had to update all the function nodes, because their interface
depended on the multi-function network data structure a bit.
The actual multi-function implementations are still the same though.
2021-08-20 13:14:39 +02:00
eca5a8b695 Merge branch 'master' into temp-multi-function-procedure 2021-08-20 12:48:18 +02:00
7d8c71e800 Geometry Nodes: add missing versioning for subdivision surface node
This was missing from rBfecec1644ce54ea386eaeed5ca6748d4a7b2737b.
2021-08-20 12:19:24 +02:00
c1227fd408 Cleanup: remove duplicate line 2021-08-20 12:05:03 +02:00
d217b34214 Functions: add utility methods to parameter builder 2021-08-20 11:48:31 +02:00
fd51b05a02 Functions: add clear method to vector array 2021-08-20 11:48:31 +02:00
2b6f0cc836 BLI: add utility methods to IndexMask 2021-08-20 11:48:31 +02:00
79c79f3c70 cleanup 2021-08-20 11:37:23 +02:00
e95b197e98 Cleanup: Add CLOG to wm_files_link.c 2021-08-20 11:27:42 +02:00
a9970d3cb9 bring back clamping in math node 2021-08-20 10:44:29 +02:00
b812f289f5 Merge branch 'master' into mf-procedure 2021-08-20 10:36:04 +02:00
cea24b4b4a Cleanup: use "free_data" suffix when the argument isn't freed
Avoid API misuse that caused leaks in T90791 &
2788b0261c.
2021-08-20 16:37:50 +10:00
e05db0c26b Cleanup: rename BKE_mesh_free_data -> BKE_mesh_free_data_for_undo
This function only makes sense for undo which doesn't
initialize the meshes ID. Otherwise BKE_id_free should be used.
2021-08-20 16:21:29 +10:00
40f0783d51 Cleanup: remove BKE_mesh_free_data use for lineart mesh copies
Even though this didn't leak memory, BKE_mesh_free_data doesn't
handle freeing data that is part of the ID making it error prone.
2021-08-20 16:08:35 +10:00
15a46a8b72 Cleanup: accidentally included printf 2021-08-20 16:02:39 +10:00
9e2cd6b077 Fix memory leak with building springs in the cloth simulator
Error in 2788b0261c.
2021-08-20 16:00:12 +10:00
a48df97ada Fix T90791: Knife project leaks memory with curve/text cutter 2021-08-20 15:19:58 +10:00
ce3a6d7989 Cleanup: rename BKE_mesh_free -> BKE_mesh_free_data
It wasn't obvious this didn't free the memory of the mesh it's self
leading to memory leaks.
2021-08-20 15:08:27 +10:00
44b25b0ea5 Cleanup: unused warnings 2021-08-20 15:03:32 +10:00
fca6b2780f Cleanup: clang-format 2021-08-19 19:27:49 -07:00
f8637cd8af Alembic Procedural: only subdivide if subsurf modifier is present
As subdivision objects are first class citizens in Alembic, to
differentiate them with non-subdivided polygon meshes, the Alembic
Procedural automatically sets up subdivision properties on the generated
Cycles Mesh.

However, for real-time playback subdivision is far too slow, so this
modifies the detection of a MeshSeqCache modifier used to activate the
procedural to allow for a Subsurf modifier right after the cache one. If
present, the procedural will tag the object for subdivision, if absent, the
object will be treated as a regular mesh.

This is a temporary measure for until subdivision surface settings are part
of the Mesh datablock (see T68891).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11162
2021-08-20 02:40:37 +02:00
5b51df0f33 Cleanup, format 2021-08-20 02:30:11 +02:00
962153dbed Cycles: missing case for ignoring subdivision vertex normals
This was missing from rBb8ecdbcd964a.
2021-08-19 20:36:34 +02:00
c0dd6f1164 Fix T90776: Cycles normal map node produces artifacts
This is caused by a typo in rBb8ecdbcd964a `sd->prim` is the primitive
index, but was used to discriminate the primitive type (stored in `sd-
>type`).
2021-08-19 20:36:34 +02:00
72f73c0b71 UI: Use theme's alpha for Summary instead of a hardcoded value 2021-08-19 20:24:46 +02:00
dbc4f6fdc9 Fix error rendering Cycles shader nodes from before 2013
After the recent changes to use socket identifiers instead of names.
2021-08-19 20:12:50 +02:00
871f7f4ad8 GPencil: Cleanup old printf debug lines
These lines were very old debug code and now it's not required because the code is very tested.
2021-08-19 19:23:13 +02:00
215ce0fb57 fix 2021-08-19 18:19:15 +02:00
5154598845 Merge branch 'master' into mf-procedure 2021-08-19 18:11:51 +02:00
1ee80d792c cleanup 2021-08-19 18:09:52 +02:00
95284d2f1e bring back function nodes 2021-08-19 18:07:36 +02:00
3febcb98ed Image blendwrite: Fix handling of packedfiles.
Packedfiles need some special attention when writing Image to disk.

Source: D12242, Jeroen Bakker (@jbakker), thanks.
2021-08-19 18:00:00 +02:00
0896457c59 Partially fix T90593: Image ID wrongly seen as changed on undos.
Several pure runtime data in this ID type were not properly cleared by
write/read processes.

Note that the initial undo step (the one leading back to initial read
file state) is still forcing re-load of image, for some reasons.

Common investigation together with Jeroen Bakker (@jbakker), thanks. See
also D12242.
2021-08-19 18:00:00 +02:00
214e4aac97 Fix Python error in ./benchmark init after recent changes 2021-08-19 17:45:37 +02:00
7281f3eb56 start bringing back function nodes 2021-08-19 17:28:15 +02:00
479cc9a83e UI: Match row color for Summary in Mask animation editor
The back color of the row was missing.
2021-08-19 17:06:49 +02:00
71655ff8df GPencil: Match row color for Summary in Grease Pencil animation editor
The background of the summary row was different in Grease Pencil mode.

Reviewed by: Pablo Vazquez, Matias Mendiola
2021-08-19 17:06:41 +02:00
607ef8f6c5 pull out multi function network 2021-08-19 16:49:00 +02:00
1ce640cc0b test vector processing 2021-08-19 16:24:32 +02:00
7192e57d63 Fix the value in the graphical editor header when transforming
The header did not display the actual value when transforming with snapping
2021-08-19 10:34:13 -03:00
b0d9e6797f Fix T87173: wrong Auto-Snap in animation editors
This was partially broken with {rBde9ea94fc6f}.

The `Frame Step` and `Second Step` snapping options were working as if
they were `Nearest Frame` and `Nearest Second` respectively in the
`Dope Sheet` and `NLA` editors.

In the `Graph Editor` the problem was more serious:
"Second Step: ... The keyframe itself moves along as though in snapping
were active at all, while its handles 'stay behind' until it reaches
the next second boundary, at which point the teleport handles to
'catch up'".

The snapping code for these modes was spread across the transform
mode code and `recalcData` of each data type. Therefore, create a
unified snapping code for these options so that all issues are fixed in
one place.

Differetial Revision: https://developer.blender.org/D12241
2021-08-19 10:34:13 -03:00
119d53263f Transform Convert Action: conventionalize TransData creation
`td2d->loc`, `td2d->loc2d`, `td->loc` and `td->iloc` were not being
initialized as is done with the other conversion types.

This avoids problems with transform modes becoming incompatible.

This avoids problems with incompatible transform modes that could
result in a crash.
2021-08-19 10:34:13 -03:00
Germano Cavalcante
85b044b3ef Fix incremental snap in animation editors
Animation editors have their own snap types and incremental is not
supported.
2021-08-19 10:34:13 -03:00
46aafbbf66 Cleanup: move animation snap utilities to a separate compilation unit
The snap functions of animation editors were scattered in
`transform_mode` and `transform_snap`.
2021-08-19 10:34:13 -03:00
7bed18fdb1 support creating loops with builder 2021-08-19 15:33:35 +02:00
e648e38887 Undo: Clear more ID runtime data on filewrite.
This should help reducing false 'changed' status detection when reading
back a memfile undo step.

Related to T90593 & D12242.
2021-08-19 15:09:33 +02:00
0f49e4832c Cleanup: Blendwrite: Move code deciding if an ID should be written out of ID callbacks.
This was not really useful, and added estra useless steps in case and ID
should not actually be written.

Further more, it prevented clearing the usercount on write, which can be
cause a false positive 'chanhged' detection in undo/redo case.
2021-08-19 15:09:33 +02:00
d5776f4829 LibOverride: Tag all embedded IDs RNA opinters as overridablei, part II.
Not sure how I failed to include those files in rBe5f8db92b696...
2021-08-19 15:09:33 +02:00
51862c8445 Cycles: experimental integration of Alembic procedural in viewport rendering
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache
modifier in order to use and test it from Blender.

To enable it, one has to switch the render feature set to experimental and
activate the Procedural in the modifier. An Alembic Procedural is then
created for each CacheFile from Blender set to use the Procedural, and each
Blender object having a MeshSequenceCache modifier is added to list of objects
of the right procedural.

The procedural's parameters derive from the CacheFile's properties which are
already exposed in the UI through the modifier, although more Cycles specific
options might be added in the future.

As there is currently no cache controls and since we load all the data at the
beginning of the render session, the procedural is only available during
viewport renders at the moment. When an Alembic procedural is rendered, data
from the archive are not read on the Blender side.

If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural,
bounding boxes are used to display the objects in the scene as a signal that the
objects are not processed by Blender anymore. This is standard in other DCCs.
However this does not reduce the memory usage from Blender as the Alembic data
was already loaded either during an import or during a .blend file read.

This is mostly a hack to test the Cycles Alembic procedural until we have a
better Blender side mechanism for letting renderers load their own geometry,
which will be based on import and export settings on Collections (T68933).

Ref T79174, D3089

Reviewed By: brecht, sybren

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D10197
2021-08-19 14:40:51 +02:00
5b97c00e9f Alembic import: option to always add a cache reader
The current behavior of the Alembic importer is to only create a
`MeshSequenceCache` modifier or a `Transform Cache` constraint to imported
objects if they have some animated properties.

Since static objects do not have a cache reader, when reloading files those
objects are not updated. Currently, the only way to properly reload a file
because of this is to reimport it.

This adds an option to the importer to always add a cache reader, even if
there is no animated data, to ensure that all objects coming from Alembic
archive are linked to them and updated properly upon reloads.

Reviewed by: brecht, sybren

Ref D10197.
2021-08-19 14:29:42 +02:00
c827b50d40 add dummy instruction type 2021-08-19 14:06:43 +02:00
3c7e3c8e44 improve naming 2021-08-19 13:46:19 +02:00
98e38ce4f3 cleanup 2021-08-19 13:44:15 +02:00
132cf268c0 add comments 2021-08-19 13:36:52 +02:00
fd7edc9b05 cleanup 2021-08-19 13:28:15 +02:00
ecf7c90840 remove redundant utilties 2021-08-19 13:15:11 +02:00
d78a530af1 initial procedure builder 2021-08-19 13:09:41 +02:00
3ebe61db9f support evaluation on one 2021-08-19 11:22:57 +02:00
86c2f139c6 cleanup 2021-08-19 10:09:02 +02:00
3596c348eb cleanup 2021-08-19 10:07:51 +02:00
4db4123409 Correct assert from 22ab0159a9 2021-08-19 17:56:25 +10:00
cf72194214 Fix T71137: curve minimum twist producing wrong geometry
Originally D11886 by @ghaspias with minor edits applied.
2021-08-19 17:10:34 +10:00
22ab0159a9 Refactor: BLF Without Kerning Modes
Simplification of BLF code after removal of kerning modes.

See D12262 for more details.

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

Reviewed by Campbell Barton
2021-08-18 20:31:47 -07:00
4734de1093 Cleanup: correction to unused warning removal
This broke building without opensubdiv
2021-08-19 13:18:51 +10:00
594790d8a5 UI: add function to access the buttons text without it's shortcut 2021-08-19 12:50:50 +10:00
7a4ef5256a Cleanup: reduce indentation in loops that check region visibility 2021-08-19 12:50:50 +10:00
feaa61a968 UI: Remove "Unfitted" Kerning Style Option
This patch removes the "Kerning Style" option for UI widget font
drawing and uses only the current default of "Fitted", since the other
option of "Unfitted" is just the result of truncation errors.

see D12231 for much more information.

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

Reviewed by Campbell Barton
2021-08-18 19:48:30 -07:00
ac09411368 Cleanup: unused warning 2021-08-19 12:15:15 +10:00
a217e043be Audaspace: porting PulseAudio fixes from upstream. 2021-08-18 22:22:21 +02:00
55f9014616 Alembic procedural: remove Generated attribute creation
The main reason for this is to speed up updates by avoid unnecessary
copies as the Generated coordinates are a copy of the vertices.

Creating this attribute may become optional in the future, with UI
parameters to select which attribute to use from the Alembic archive as
reference.
2021-08-18 21:27:52 +02:00
6b041ad3d0 Cycles: use object coordinates when generated coordinates are missing
This modifies the attribute lookup to use object coordinates if no
generated coordinates are found on the geometry.

This is useful to avoid creating and copying this attribute, thus saving
a bit of time and memory.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12238
2021-08-18 21:20:39 +02:00
b8ecdbcd96 Cycles: avoid copying vertex normals attribute twice to the devices
Vertex normals are needed for normals maps and therefore are packed and send
to the device alongside the other float3 attributes. However, we already pack
and send vertex normals through `DeviceScene.tri_vnormal`.

This removes the packing of vertex normals from the attributes buffer, and
reuses `tri_vnormal` in the kernel for normals lookup for normal maps, which
reduces memory usage a bit, and speeds up device updates.

This also fixes potential missing normals updates following rB12a06292af86,
since the need for vertex normals for normals maps was overlooked.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12237
2021-08-18 21:12:39 +02:00
41a81474e4 refactor procedure executor 2021-08-18 20:19:12 +02:00
aa2822d137 cleanup 2021-08-18 20:18:19 +02:00
e5f8db92b6 LibOverride: Tag all embedded IDs RNA opinters as overridable.
Followup to previous commit, rBfffe219bdb8drBfffe219bdb8d

Again this is only for sake of sane ID/overrides managment for now,
the nodetrees themselves are not overridable from user PoV yet.
2021-08-18 17:05:49 +02:00
fffe219bdb LibOverride: Make nodetree of material overrideable again.
This reverts rB6899dbef77cd and makes the pointer explicitely
processable by override & diffing code.

Previous changes & fixes have fixed the 'driver-workaround' case afaict.

Note that this only enables proper generic handling of overrides and
their ID pointers, no node property is actually overridable currently.
2021-08-18 16:49:20 +02:00
1d06d35034 LibOverride: Do not report embedded IDs as non-overridable in 'foreach_id' code.
Embedded IDs (root nodetrees, master collection, etc.) pointer itself is
not editable, but their content may be overridden.

LibOverride code is supposed to know how to handle those embedded IDs.
2021-08-18 16:49:20 +02:00
ba71eb467e LibOverride: Add several missing 'OVERRIDABLE' flags to NodeTrees RNA.
This should be a no-change commit for now, but is required to enable
initial basic support of nodetrees in library override.

NOTE: Proper full support of liboverrides in nodes is yet to be designed
(has UX unresolved issues, since we likely do not want to expose/make
overridable ALL settings of ALL nodes).
2021-08-18 16:49:20 +02:00
9bfd4ae222 LibOverride: tweak resync detection code at apply phase.
This code checks whether an ID pointer property of an override does not
match its linked reference when it is expected to do so.

This is a goiod indication that a resync is needed.

Previous code would falsy detect overrides of IDs referencing themselves
as needing a resync, when this is not effectively the case.
2021-08-18 16:49:20 +02:00
55b333d3e3 Merge branch 'master' into mf-procedure 2021-08-18 16:14:32 +02:00
Charlie Jolly
04376c3bac Geometry Nodes: Add shader Color Mix node
Port color mix shader node to Geometry Nodes.

Differential Revision: https://developer.blender.org/D10585
2021-08-18 14:50:52 +01:00
787350dde8 Fix T90737: VSE adding nested strips could have non-unique names
Caused by {rBbbb1936411a5}.

When adding strips via the new SEQ_add_XXX_strip functions, the
`Editing->seqbasep` pointer was passed around.
Following in `seq_add_generic_update` this `seqbasep` pointer was used
to ensure a unique name.
But `seqbasep` is the pointer to the current list of seq's being edited
(**which can be limited to the ones within a meta strip**).

We need unique names across all strips though (since these are used for
RNA paths, FCurves as reported), so now use the scene's `Editing-
>seqbase` (**which is the list of the top-most sequences**) instead.

Unfortunately this might have screwed files to a borked state, not sure
if this could easily be fixed...

Maniphest Tasks: T90737

Differential Revision: https://developer.blender.org/D12256
2021-08-18 14:43:16 +02:00
7bffafab7b Fix T90718: Object selection toggle do not work inside edit mode
The object was not deselected as it was expected that it would be
activated.

But this activation does not happen in edit mode.
2021-08-18 09:39:45 -03:00
00cfad8578 add utility method 2021-08-18 10:00:51 +02:00
Jeroen Bakker
c0f600cad1 T73434: Improve Weight Paint Overlay Drawing.
Master multiplied the weight paint on top of the rendered image. This
reduced readability.

This patch removes the multiplication for weight painting and adds a
hint of the geometry below the overlay.

Reviewed By: Mets, pablodp606, campbellbarton

Maniphest Tasks: T73434

Differential Revision: https://developer.blender.org/D12170
2021-08-18 07:32:23 +02:00
400cb25fc7 UDIM: Support tile sets that do not start at 1001
Removes the artificial requirement that UDIM tile sets start at 1001.
Blender was already capable of handling sparse tile sets (non-contiguous
tiles) so the restriction around starting at 1001 was unnecessary in
general.

This required fixing a few UDIM-related python bugs around manually
updating the `tile_number` field on images as well. See the differential
for details. No script changes are necessary but they will now work,
correctly, in many more cases.

Differential Revision: https://developer.blender.org/D11859
2021-08-17 21:44:36 -07:00
f41beca977 Fix T90695: Lower tile splitting limit for lineart
Lowers tile splitting limit so models with extremely dense mesh
portions could still have reasonable performance while for more
common cases the performance impact should be minimal.

Reviewed By: Sebastian Parborg (zeddb), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12236
2021-08-18 12:02:53 +08:00
24c16f5457 Fix wireframe overlay not blending over paint overlay correctly
When using wireframe opacity, the paint overlay needs to be drawn
before the wireframes in order to alpha blend correctly.
Sculpt overlays were also affected by this, so this commit refactors
this part of the code in case other overlays needs to be added in
the future.

Reviewed By: Mets

Differential Revision: https://developer.blender.org/D12235
2021-08-17 23:54:45 +02:00
809dce5bde Cleanup: move 'recalcData' to 'transform_convert.h'
The `recalcData` function is defined in `transform_convert.c`, so the
header is most expected to be `transform_convert.h`.
2021-08-17 17:23:57 -03:00
Henrik Dick
e3098de2a1 GPencil: Fix unreported switch direction not flipping weights
There was an unreported bug that switch direction would not switch the order of the vertex group weights. This caused join to do it wrong as well.

Changed to use `BLI_array_reverse` function here to reverse both the normal points and the weights, therefore simplifying the code.

Differential Revision: https://developer.blender.org/D12251
2021-08-17 22:20:26 +02:00
23132fcdc1 Fix T77307: Particle Info Node Does Not Consider Time Remapping
`frame_current_final()` should be used to access the Scene time after
remapping, which also matches how the particles system handles time.

Reviewed By: brecht

Maniphest Tasks: T77307

Differential Revision: https://developer.blender.org/D12239
2021-08-17 21:41:18 +02:00
60d6333b80 Fix T82336: Cycles standard attributes missing in displacement shaders
Standard attributes are not added to the attributes requests when
shaders only have displacement. This is because nodes are only
considering the case when the surface socket is connected.

To support this, added `Shader.has_surface_link()` which checks for both
cases (`has_surface` and `has_displacement`) and replaces all checks on
`Shader.has_surface`.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12240
2021-08-17 21:38:04 +02:00
Henrik Dick
88dc274d05 GPencil: Convert from Mesh copying Vertex Groups
This patch adds the missing ability to keep the vertex groups when converting to a grease pencil object. This is increadible useful to create rigged grease pencil objects which move together with rigged meshes.

Differential Revision: https://developer.blender.org/D12249
2021-08-17 20:20:47 +02:00
96d0cd57dc Fix T90719: Boost sources dowload address needed to be updated. 2021-08-17 18:01:42 +02:00
1891c956e5 refactor variable store 2021-08-17 17:24:01 +02:00
e98824d6c4 CMake: add missing headers 2021-08-18 00:37:04 +10:00
7f38872533 RNA: de-duplicate enums in generated source
Reuse existing enums instead of expanding them since it bloats the binary.

The icons enum for example contains over 900 items and was being
expanded 17 times (once for each function that takes an icon argument).
Similar with the event type enum which contains over 200 items and was
duplicated 7 times.

makesrna.c now matches enum definitions from declarations in
RNA_enum_items.h, using their identifiers when found.

The overall space saving on my system is 776kb
(tested with a stripped release build).

Reviewed By: brecht

Ref D12245
2021-08-18 00:23:50 +10:00
0246128b7f Fix wrong Anim Auto-Snap Ctrl toggle
This was not working like elsewhere in both NLA and Graph Editor
(meaning that when snapping was already enabled, {key Ctrl} during
transform did not disable it).

Now use getAnimEdit_SnapMode() for this in NLA and GE as well.

Maniphest Tasks: T87173

Differential Revision: https://developer.blender.org/D12244
2021-08-17 15:52:28 +02:00
249c050757 add single test 2021-08-17 15:27:46 +02:00
a0081046b6 cleanup instruction scheduling 2021-08-17 15:01:27 +02:00
635f73b7f1 fixes after merge 2021-08-17 14:00:06 +02:00
74fcd50e2f Merge branch 'master' into mf-procedure 2021-08-17 13:44:25 +02:00
f8dd0080a9 Cleanup: clang tidy
The parameter name was inconsistent between declaratation
and implementation.
2021-08-17 11:12:59 +02:00
6028ac44a1 Cleanup: unused defines 2021-08-17 17:45:57 +10:00
7304541f66 Edit Mesh: skip unselected meshes for "Tris to Quads"
Also move property assignment out of the object loop.
2021-08-17 17:12:36 +10:00
32844d32c1 Edit Mesh: skip unselected meshes for "Set Normals from Faces" 2021-08-17 17:12:24 +10:00
4443831c6b Edit Mesh: skip normals to vector with unselected meshes for "Delete"
Meshes with unselected elements are skipped but still called
BM_custom_loop_normals_to_vector_layer.
2021-08-17 17:11:49 +10:00
6baa62245f Edit Mesh: skip flipping custom normals for meshes with no selection
Also split out normal calculation into functions.
2021-08-17 17:10:59 +10:00
cb40c7ca1f Fix memory leak in edit-mesh dissolve degenerate 2021-08-17 16:46:52 +10:00
4c8d68c032 Cleanup: replace degenerate check with assert
Use an assert since this should never happen.
2021-08-17 15:16:34 +10:00
736b6a70a4 Docs: improve word wrap comment 2021-08-17 15:11:54 +10:00
nutti
69fdcea978 Docs: add API docs for gpu.capabilities
Adds Python API documentations for gpu.capabilities module.

Ref D12226
2021-08-17 15:04:35 +10:00
ba055493a0 Cleanup: clang-format 2021-08-17 14:46:46 +10:00
nutti
d60e28093f Docs: add API docs for gpu.platform
Adds Python API documentations for gpu.platform module.

Ref D12222
2021-08-17 14:45:40 +10:00
869b84452a Cleanup: compiler warnings 2021-08-17 14:42:12 +10:00
eaa1527385 UDIM: Fix tile number calculation when adding a range of image tiles
When adding a range of tiles, the operator could incorrectly calculate
the end_tile. It would not account for the start_tile itself and the
IMA_UDIM_MAX value was 1 too small. This is most noticeable when
attempting to fill the entire supported range of tiles.

Differential Revision: https://developer.blender.org/D11857
2021-08-16 21:19:39 -07:00
4dba206011 PyAPI: GPUShader: make 'uniform_vector_*' less restricted
Buffers larger than required may be allowed without restriction.
2021-08-16 13:57:25 -03:00
b5117660da PyAPI: GPU Buffer: Buffer protocol support
The code was commented due to lack of testing and short release deadline.
2021-08-16 13:57:25 -03:00
035d4c28ab Add sanity NULL checks when loading sound sequences
Would cause crashes in files that had lingering invalid sound sequences around.
For example our tests/render/volume/fire.blend test file.
2021-08-16 16:52:38 +02:00
df3884d512 Fix T90689, T90705: Cycles math node with 3 inputs broken after recent changes
Thanks Charlie Jolly for finding the fix.
2021-08-16 15:54:18 +02:00
7db3746033 Cleanup: spelling 2021-08-16 23:46:28 +10:00
394a0b0da5 Fix building without audaspace 2021-08-16 23:19:54 +10:00
118946d195 Fix T87967: M2T video seeking is broken
Bug caused by integer overflow in ffmpeg_generic_seek_workaround().
Function max_ii() was used to limit int_64tvalue.

After fixing the issue there was another issue, where near-infinite loop
was caused by requested_pos being very large and stream being cut in a
way, that it was missing keyframe at beginning.
This was fixed by checking if we are reading beyond file content.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11888
2021-08-16 15:12:19 +02:00
2946f72a2a VSE: Use lines to draw waveform
Refactor and improve waveform drawing.

Drawing now can use line strips to draw waveforms instead of only
triangle strips. This makes us able to properly visualize thin waveforms
as they would not be visible before. We now also draw the RMS value of
the waveform.

The waveform drawing is now also properly aligned to the screen pixels
to avoid flickering when transforming the strip.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11184
2021-08-16 15:12:19 +02:00
ded68fb102 VSE: Fix audaspace not reading ffmpeg files with start offset correctly
The duration and start time for audio strips were not correctly read in
audaspace.

Some video files have a "lead in" section of audio that plays before the
video starts playing back. Before this patch, we would play this lead in
audio at the same time as the video started and thus the audio would not
be in sync anymore.

Now the lead in audio is cut off and the duration should be correctly
calculated with this in mind.

If the audio starts after the video, the audio strip is shifted to
account for this, but it will also lead to cut off audio which might not
be wanted. However we don't have a simple way to solve this at this
point.

Differential Revision: http://developer.blender.org/D11917
2021-08-16 15:10:58 +02:00
6df81ddb84 VSE: Fix seeking issues.
The seek pts was not correctly calculated.
In addition to that we were not seeking in the video pts time base.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11921
2021-08-16 14:52:57 +02:00
a01cf90fd8 VSE: Fix video strip duration calculation
The video duration was not read correctly from the video file.

It would use the global duration of the file which does in some cases
not line up with the actual duration of the video stream.
Now we take the video stream duration and start time into account when
calculating the strip duration.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11920
2021-08-16 14:52:57 +02:00
43ad345caa VSE: Fix memory leak when adding bad image/movie strips
If the add strip operator errored out, we wouldn't free custom data allocated

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11919
2021-08-16 14:52:57 +02:00
e314260fa7 VSE: Fix "off by one" error when encoding audio
Before we didn't encode the audio up until the current frame.
This lead to us not encoding the last video frame of audio.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11918
2021-08-16 14:52:57 +02:00
08af3e6e92 VSE: Flush audio encode after finishing video export
We didn't flush audio after encoding finished which lead to audio
packets being lost.

In addition to this the audio timestamps were wrong because we
incremented the current audio time before using it.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11916
2021-08-16 14:52:56 +02:00
Eitan
fecec1644c Geometry Nodes: Add UV Smooth, Boundary Smooth options to subdivision node
Replaces the boolean option with enum menus for consistency
with the subdivision modifier (rB66151b5de3ff,rB3d3b6d94e6e).
Adds all UV interpolation options.
Original patch by Eitan. Updated by Himanshi Kalra <calra>.
{F9883204}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10417
2021-08-16 14:31:50 +05:30
ddecd7aaca Cleanup: shadow variable warning 2021-08-16 18:06:10 +10:00
Himanshi Kalra
c48a01a88a Add cutom data color property for mesh comparison
Add color data type comparison for meshes, adding it as
part of comparing meshes with geometry nodes applied.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12192
2021-08-16 12:28:12 +05:30
c0016a8581 BLF: avoid unnecessary lookups in blf_kerning_cache_new
blf_kerning_cache_new was performing many unnecessary hash lookups,
calling blf_glyph_search 32768 times. Use a lookup table to reduce this
to the number of ASCII characters (128 calls).
2021-08-16 14:35:38 +10:00
4300050e20 Cleanup: rename kerning table to ascii_table
It wasn't obvious this was only for ASCII characters.
2021-08-16 14:35:38 +10:00
87adcbc94f BLF: use fast ASCII kerning for word-wrap calculations
While this wasn't a bottleneck, using the fast version of this function
removes some duplicate code that doesn't use the look-up table.
2021-08-16 14:35:38 +10:00
6aebbe6a0a Cleanup: replace macros with inline functions for font drawing
Also assert blf_font_ensure_ascii_kerning has been called in
blf_kerning_step_fast.
2021-08-16 14:35:38 +10:00
eb278f5e12 XR: Color Depth Adjustments
This addresses reduced visibility of scenes (as displayed in the VR
headset) that can result from the 8-bit color depth format currently
used for XR swapchain images.

By switching to a swapchain format with higher color depth (RGB10_A2,
RGBA16, RGBA16F) for supported runtimes, visibility in VR should be
noticeably improved.

However, current limitations are lack of support for these higher
color depth formats by some XR runtimes, especially for OpenGL.

Also important to note that GPU_offscreen_create() now explicitly
takes in the texture format (eGPUTextureFormat) instead of a
"high_bitdepth" boolean.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D9842
2021-08-16 11:46:09 +09:00
899935d5d0 Fix wrong usage of 'sizeof'
The intention was to use `ARRAY_SIZE`.

No functional changes.
2021-08-15 20:08:17 -03:00
3f0d785d23 Fix T90658: selection of some 3D gizmos failing
Small error due to wrong variable usage.

Introduced in rBfcd2d63b644e.
2021-08-15 17:55:09 -03:00
d5261e973b BLF: Do Not Preload Glyph Cache
This patch turns off the preloading of ascii glyphs and instead caches
each glyph the first time it is actually used.

See D12215 for much more detail.

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

Reviewed by Campbell Barton
2021-08-14 13:50:51 -07:00
8f2b60ddbf Cleanup: Variable names, formatting, reduce indentation 2021-08-13 21:46:59 -05:00
6a4533dd02 BLF Cleanup: Size Defines, Comments, etc
This patch makes some non-functional changes to BLF code. Some size
defines added, comments changed, simplification of macro
BLF_KERNING_VARS.

See D12200 for more details.

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

Reviewed by Campbell Barton
2021-08-13 14:31:10 -07:00
ae3472998a Cleanup: rearrange includes
Bring the includes from the same project together.
2021-08-13 17:36:35 -03:00
Germano Cavalcante
0ed2df81cc Fix T90637: Outliner: VSE context menu options are not working
Some of the enum options in the context menu operations are not
supported for all element types.

`TSE_SEQUENCE`, for example, only supports the `Select` option.

So, populate the enum list dynamically depending on the type.

Also add some calls that were missing for the `TSE_SEQUENCE` type.
(`WM_event_add_notifier` and `ED_undo_push`).
2021-08-13 17:28:46 -03:00
5655b3d1c5 Cleanup: fix typos in static variables
_desps --> _deps
2021-08-13 15:45:07 -03:00
5225e459da Fix T86883: Add/fix suport of liboverrides in relocate/reload library case.
There was already some code for that, but it was broken, and proper
resync was completely missing.

There might still be more resync needed in library linking operators
though.
2021-08-13 16:37:29 +02:00
bb0e29c922 Blendloader: Option to reports to skip list of recursively liboverride-resynced libs.
This extra info is not always needed/convinient to use, and requires
special attention to free the list, so allow not generating it.
2021-08-13 16:37:29 +02:00
7772880d69 ViewLayer resync: Add sanity checks for objects/bases mappings.
Add a debug-only check regarding consistency of the cache (mapping from
objects to their bases) for a given ViewLayer.

Issues can happen otherwise when some code does remapping of objects,
and forgets to call `BKE_main_collection_sync_remap()` (which clears
those caches) instead of `BKE_main_collection_sync()`.
2021-08-13 16:37:29 +02:00
77744b581d Fix T90595: some VSE strip properties do not identify strip name in anim
channel names

Working with multiple strips keyframes was unneccessarily difficult in
Animation Editors (since some anim channels could not be distinguished).

Namely `Crop` and `Transform` are nested structs (nested under
`Sequence`), so these were just displaying the raw struct name.
Also strip modifiers did not have their strip name in their channel
names. Now include the strip name for these.

before
{F10277439}

after
{F10277441}

Maniphest Tasks: T90595

Differential Revision: https://developer.blender.org/D12193
2021-08-13 15:17:00 +02:00
Matteo F. Vescovi
0b3c7544b5 Fix FTBFS on mips64el architecture
While trying to get Blender 2.93.x LTS to build fine on all release architectures in Debian, I noticed that the misleading use of "mips" as integer variable caused problems when compiling on mips64el. The patch should fix the issue.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12194
2021-08-13 14:33:50 +02:00
4cadccebfa Revert "Mesh: replace saacos with acosf for normal calculation"
This reverts commit 41e6509818.

This broke "CubeMaskFirst" test.

Any value even slightly outside the [-1.0..1.0] range
caused the result to be nan, which can happen when calculating
the dot-product between two unit length vectors.
2021-08-13 19:45:01 +10:00
b9486c39bc Cleanup: Unused function parameter warning 2021-08-13 11:16:01 +02:00
fd29a161cc Fix Action Editor unlink button when in tweak mode
When in NLA tweak mode, the action unlink button in the Dopesheet /
Action Editor should be a mere shortcut to exiting tweak mode [nothing
else].

Instead, it was also clearing the action fully, not returning to the
previous edited action before going into tweak mode.

Now dont "flush" by clearing the action, instead exit tweakmode, clear
the scenes SCE_NLA_EDIT_ON flag (if this isnt done some NLA operators
like pushdown were not immediately available because their poll checked
this flag) and send appropriate notifier to have everything update nicely.

Part of T87681 (Bug 4/5/6).

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11052
2021-08-13 11:07:27 +02:00
00f264ea42 Cleanup: correct comment exiting NLA tweakmode
Comment was pasted from entering tweakmode.
2021-08-13 10:52:53 +02:00
0ae23636e7 Fix missing animation UI update in the Properties Editor
Animation indicators as well as decorators for properties were not
updating correctly in the following cases:
- NLA pushdown (this was reported in T87681)
- NLA enter/exit tweakmode
- Outliner unlinking/setting action

These actions all send a ND_NLA_ACTCHANGE notifier which the Properties
Editor was not listening to [which is now added].

part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11040
2021-08-13 10:09:12 +02:00
5f6033e091 Keyframe: Reduce GPU context switches.
This change reduces the GPU context switches when drawing keyframes.
In the previous situation the keyframe blocks and keyframe keys were
drawn per channel. With this patch first all the keyframe blocks are
drawn for all channels and after that the keyframe keys are collected
for all channels and send to the GPU in a single draw call.
2021-08-13 09:37:38 +02:00
7b5acc8009 Cleanup: remove unused draw_gpencil_channel.
Code is integrated with draw_scene_channel since 2.80.
2021-08-13 08:34:10 +02:00
160d57d33c Docs: tooltip update missing from 3e775a4fc5 2021-08-13 16:01:45 +10:00
3e775a4fc5 PyAPI: remove the .py extension requirement for startup registration
This was left over from when these scripts were loaded as modules,
where their names needed to be compatible with Pythons module naming.

Version patch existing files so text with register enabled
without a `.py` extension wont start executing on startup.

Resolves T89532.
2021-08-13 15:51:08 +10:00
41e6509818 Mesh: replace saacos with acosf for normal calculation
The clamped version of acos isn't needed as degenerate (nan) coordinates
result in zeroed vectors which don't need clamping.
2021-08-13 15:39:39 +10:00
8fa05efe0a Docs: note that normalize_v# functions zero out input containing nan 2021-08-13 15:15:54 +10:00
92f4abc37f Cleanup: remove unused BKE_mesh_calc_normals_mapping functions
This supported calculating normals for MPoly array which was copied to
an MFace aligned array.

Remove the functions entirely since MFace use is being phased out and
these function isn't used anywhere.
2021-08-13 14:41:42 +10:00
b51a473e29 Cleanup: remove use of BKE_mesh_calc_normals_mapping_simple
Use BKE_mesh_calc_normals instead of
BKE_mesh_calc_normals_mapping_simple for curve modifier calculation.

This only made sense for derived-mesh which is no longer used.
2021-08-13 14:37:30 +10:00
ab344775c2 Cleanup: code-comments
Use capitalization, remove unnecessary ellipsis.
2021-08-13 13:55:25 +10:00
ed38d0c25d Cleanup: split BKE_mesh_calc_normals_poly function in two
Remove the 'only_face_normals' argument.

- BKE_mesh_calc_normals_poly for polygon normals.
- BKE_mesh_calc_normals_poly_and_vertex for poly and vertex normals.

Order arguments logically:

- Pair array and length arguments.
- Position normal array arguments (to be filled) last.
2021-08-13 13:33:03 +10:00
399b6ec76c Mesh: optimize normal calculation
Optimize mesh normal calculation.

- Remove the intermediate `lnors_weighted` array, accumulate directly
  into the normal array using a spin-lock for thread safety.
- Remove single threaded iteration over loops
  (normal calculation is now fully multi-threaded).
- Remove stack array (alloca) for pre-calculating edge-directions.

Summary of Performance Characteristics:

- The largest gains are for single high poly meshes, with isolated
  normal-calculation benchmarks of meshes over ~1.5 million showing
  2x+ speedup, ~25 million polygons are ~2.85x faster.

- Single lower poly meshes (250k polys) can be ~2x slower.

  Since these meshes aren't normally a bottleneck,
  and this problem isn't noticeable on large scenes,
  we considered the performance trade-off reasonable.

- The performance difference reduces with larger scenes,
  tests with production files from "Sprite Fight" showing
  the same or slightly better overall performance.

NOTE: tested on a AMD Ryzen TR 3970X 32-Core.

For more details & benchmarking scripts, see the patch description.

Reviewed By: mont29

Ref D11993
2021-08-13 10:21:30 +10:00
1275ce61b1 Cleanup: Remove unused includes
I noticed this file was recompiling when adding a node.
2021-08-12 14:12:14 -05:00
e0fd5fef12 Geometry Nodes: tag normals dirty after join
Under some circumstances the normals were not tagged dirty
even though they are.
2021-08-12 17:36:53 +02:00
f801d40daf Fix T89241: 3D Text "Scale to Fit" wraps onto the second line
Disable wrapping when "scale to fit" is used, assert the error is
small so an invalid scale-to-fit value wont go by unnoticed.
2021-08-13 01:07:30 +10:00
3930b8c69e Fix NLA action cannot be unlinked in certain cases
The poll for unlinking calls `nla_panel_context` without providing an
adt pointer, and there is a check for this pointer in
`nla_panel_context` leading to never returning true if it is not
provided. (this is fine if there are tracks already, poll would succeed
in this case, `nla_panel_context` goes a different code path then)

Same call to `nla_panel_context` is also done in the beginning of the
corresponding unlink exec function (but this time providing the pointer
because it is used later), so it makes sense to do the same thing in the
poll function. Equal check is also done in the panel poll function, so
now these are all in sync.

Part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11041
2021-08-12 16:46:28 +02:00
333c3c92ab Fix T89805: NLA crash without active track
Was reported for a file which does not have an active track set in
AnimData even though it was in strip twek mode (but this was accessed in
is_nlatrack_evaluatable()).

Root cause for this is not totally clear, but I assume the situation is
described as part T87681 (and is fixed in D11052).

This patch here just prevents the crash for files that are already in the
borked state.

Reviewers: sybren

Maniphest Tasks: T89805

Differential Revision: https://developer.blender.org/D12085
2021-08-12 16:41:49 +02:00
dc8844f8ef Fix T88498: 'Clear Parent' does not clear parent_bone
Clearing the parent from the UI using the X (or from python) clears the
`parsubstr` and set `partype` back to `PAROBJECT`.

Using the Clear Parent operator would leave the `parsubstr` (and thus
`parent_bone`) untouched even though this operator claims to "clear
parenting relationship completely" (it also removes parent deform
modifiers for example).

So now, also clear `parsubstr` and set back to `PAROBJECT` [which is
default].

Maniphest Tasks: T88498

Differential Revision: https://developer.blender.org/D11503
2021-08-12 16:33:20 +02:00
Henrik Dick
d6891d9bee Add Extras Dropdown Menu to Constraints
Add Apply Constraint, Duplicate Constraint, and Copy To Selected
operators, and include them in a menu similar to the menu for modifiers.
The shortcuts in the extras menu are also matched to modifiers.

All the here added operators are intended to work exactly like the
analogous ones for modifiers. That means the apply operator should apply
a constraint as if it was first in the list, just like modifiers do. I
have added the same warning message as for modifiers when that happens.

The decision to use this approach of appling the constraint as if it was
first, was made for consistency with modifiers. People are already used
to how it works there. Is also provides more intricate control over the
applied transforms, then just applying all constraints up to that one.
Apply all constraints is already kinda implemented in Bake Animation.

Reviewed By: HooglyBoogly, sybren, #user_interface

Differential Revision: https://developer.blender.org/D10914
2021-08-12 14:24:27 +02:00
215734bc52 Fix T88386: Continuous Grab occasionally jumping on Arm64 MacOS
During the processing of a continuous drag event, other mouse move
events may be in the queue waiting to be processed.

But when a mouse wrapping happens, these waiting mouse move events
become out of date as they report a mouse position prior to wrapping.

The current code ignores these events by comparing their `timestamp` to
the time recorded in the last mouse wrapping.

The bug happens because the computed value in
`mach_absolute_time() * 1e-9` for some reason is incompatible with the
value of `[event timestamp]`.

Since macOS 10.6, we have a new way to get the amount of time the
system has been awake. `[[NSProcessInfo processInfo] systemUptime]`.

Using this updated method fixed the problem.

Differential Revision: https://developer.blender.org/D12202
2021-08-12 08:52:50 -03:00
6293cf6131 Fix T90630: Crash loading certain user preferences
Clearing the window was done in wm_file_read_post which was deferred.

This was needed as it left the context in an invalid state
where the window was set but the screen wasn't.

Crashing when setting up keymaps that attempted to access the
scene from the window in the property update function.

Regression in 497bc4d199
2021-08-12 20:43:16 +10:00
ad2fb92e9c Cleanup: remove redundant variable 2021-08-12 17:42:04 +10:00
04ef718226 RNA: include base types in RNA_struct_type_find_property search
Add RNA_struct_type_find_property_no_base for use in the rare situations
when this isn't desired.

Resolves T90617, where sequence strip sub-types weren't detecting
properties that exist in the base "Sequence" types.
2021-08-12 17:14:15 +10:00
806bf3f452 datadoc: add newlines to generated source files 2021-08-12 16:23:08 +10:00
83603ba26a Cleanup: comments/disabled code
- Remove old comment for editors with weak syntax highlighting.
- Remove disabled code to initialize Blender with a file path.
- Remove file name references to function names since these
  were outdated, modern development environments can look up this info.
2021-08-12 16:15:01 +10:00
497bc4d199 Fix T89046: Startup file with Python drivers crashes on load
Resolve order of initialization error reading startup file,
support postponing running wm_file_read_post until Blender
has been initialized.

Deferring updates allows duplicate initialization
to be removed from WM_init.

Reviewed By: mont29

Ref D12184
2021-08-12 14:59:08 +10:00
216414c65a Cleanup: use parameters struct for wm_homefile_read
Also add wm_homefile_read_ex which is only needed for the first
execution at startup.
2021-08-12 14:38:58 +10:00
c741558509 Cleanup: spelling in comments 2021-08-12 14:34:43 +10:00
1ef275963d Cleanup: use C++ style comments for disabled code 2021-08-12 14:34:41 +10:00
4f61843a7e Cleanup: remove *.orig file from 6a9d7139f7 2021-08-12 14:34:39 +10:00
45d100208e Makesdna: Fix detecting 32 bit padding issues.
Makesdna fails to detect issues in 32 bit code that can
only be resolved by adding a padding pointer.

We never noticed since we ourselves no longer build for
32 bit, but debian's 32 bit builds got bitten by this

A rather extensive explanation on why this is alignment
requirement is there can be found in this comment:

https://developer.blender.org/D9389#233034

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

Reviewed by: sergey, campbellbarton
2021-08-11 19:20:51 -06:00
48c8f9fc9a Fix: DNA struct alignment on 32 bit
Some of the dna structs were not properly
aligned for 32 bit builds causing issues
for some of the 32 platforms Debian builds
for.

Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D9389
2021-08-11 16:57:56 -06:00
cd1bb63159 BLF: Do Not Cache Unused Rendered Glyphs
The loading of a font size or style renders bitmaps of the characters
0-255 and stores them in a cache. But glyphs 128-255 in this cache are
not accessible. What used to be ansi high-bit characters are now multi-
byte UTF-8 sequences.

Therefore this patch reduces the glyph_ascii_table size to 128 and
only caches characters 32-127, the visible portion of ASCII, which
greatly reduces the time to load a font.

See D12189 for more details.

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

Reviewed by Campbell Barton
2021-08-11 13:55:58 -07:00
Jeroen Bakker
bb487bc2bc Fix T89984: Improve Icon previews reflective and transmissive materials.
Before this commit rendering material icons the floor will is hidden.
This reduces the readability of reflective/refractive materials.

check patch for additional screenshots and notes.

This patch will switch the floor material that uses ray visibility tricks to render a floor for reflective rays.

Eevee uses screen space reflections that makes this a different problem. There is nothing else drawn in
the scene in screen space so we need a different trick. Using math we convert a reflective ray to UV space
and generate a world that projects a checker pattern to infinity.

As now the floor is in the world it is being reflected via
a cubemap. As the film is transparent the background (including the floor isn't rendered)

In the future when Eevee supports vulkan raytracing we can re-evaluate and perhaps remove this
approximation.

We tried lightprobes but that wasn't able to do the trick.
Using the compositor would lead to more memory usage (render layers and intermediate buffers) and slower performance.
Solution has been validated with Simon

Reviewed By: sybren, Severin

Differential Revision: https://developer.blender.org/D11988
2021-08-11 16:59:57 +02:00
e53afad241 Cleanup: moved keyframe drawing to a draw list.
In preparation to do threaded drawing preparation. There should not be any
functional changes.
2021-08-11 16:47:12 +02:00
c9a9d5332b PyAPI: GPU: Expose builtin shaders
Expose `3D_POLYLINE_SMOOTH_COLOR` and
`3D_POLYLINE_FLAT_COLOR` builtins.

Requested by addon developers.
2021-08-11 11:39:51 -03:00
Pedro A
e6bbbd965a Cycles: OSL metadata support for UI labels and checkboxes
To improve the presentation of nodes in the node editor. Recognize the
following metadata from the OSL specification:

* [[ string label = "UI Label" ]]
* [[ string widget = "checkBox" ]]
* [[ string widget = "boolean" ]]

Ref T89741

Differential Revision: https://developer.blender.org/D12074
2021-08-11 16:12:27 +02:00
6d24017529 Cleanup: use socket identifier instead of names in Cycles shader export
Will be required when we support setting different names and identifiers
for OSL.

Ref D12074
2021-08-11 16:12:27 +02:00
6a9d7139f7 Cleanup: ID management: remove unused old BKE_libblock_copy_for_localize function. 2021-08-11 14:49:56 +02:00
Michael Kowalski
bbcb60fb22 Fix T90519: USD Exporter Error
Fixes: `Error: metersPerUnit does not match retrieved type float`
2021-08-11 09:40:27 -03:00
62cb5c5c4a Enable Asset Browser by default for poses, rest stays experimental
Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.

* Adds a new experimental option "Extended Asset Browser", replacing
  "Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
  This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
  disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
  browing inside .blend files. That way you can hide data-blocks that
  are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
  it's needed for pose library access.

Addresses T90181, T90180 and T90300.

Differential Revision: https://developer.blender.org/D12120
2021-08-11 14:32:07 +02:00
48ba341d15 Cleanup: Keylist Drawing - Split up in multiple functions. 2021-08-11 13:34:11 +02:00
6aae140278 Cleanup: Minor comment update on LIB_TAG_NEW. 2021-08-11 11:23:31 +02:00
f3e26c847b PyAPI: report unreleased ID's with WITH_PYTHON_SAFETY enabled
This would have made T88033 more straightforward to track down.
2021-08-11 17:37:38 +10:00
cbc671947a Fix T88033: Python reference memory leaks for non main data-blocks
ID data-blocks that could be accessed from Python and weren't freed
using BKE_id_free_ex did not release the Python reference count.

Add BKE_libblock_free_data_py function to clear the Python reference
in this case.

Add asserts to ensure no Python reference is held in situations
when ID's are copied for internal use (not exposed through the RNA API),
to ensure these kinds of leaks don't go by unnoticed again.
2021-08-11 17:10:02 +10:00
18fbcaf7b9 Cleanup: rename BKE_collection_{free => free_data}
This function doesn't free the collection, only it's memory.
2021-08-11 16:09:23 +10:00
Henrik Dick
2f39f7f815 Modifier: use high quality normals for vertex offset
Using high quality normals for vertex offset when set
for higher precision offsets.

This was only used for calculating even-offset.

Reviewed By: campbellbarton

Ref D12176
2021-08-11 10:26:49 +10:00
d480f03952 Cleanup: clang-format 2021-08-11 10:11:12 +10:00
55615e2600 Cleanup: trailing space, remove BOM 2021-08-11 10:11:11 +10:00
fcd2d63b64 Fix 'GPU_matrix_unproject_3fv' not working with out-of-bounds points
To solve this, the unproject code was redone in order to simplify and optimize.
2021-08-10 18:06:52 -03:00
8652e69d8b Fix T90447: 3D view transform locks do not use driver colors
Caused by rB6942dd9f4900.
2021-08-10 12:33:47 -05:00
32c687b5ec Clean-up: Remove UTF8-BOM markers
Done at the request of Sergey.
2021-08-10 11:27:18 -06:00
946da86e02 Win32 IME: Replace Usage of Language IDs
This is a slight refactoring of the Win32 IME code to remove the use of
Language IDs, which is now strongly deprecated. Instead this uses the
new recommended Locale Names, ie ISO-639-1 2-letter abbreviated names
like "en" for English rather than ID 0x09.

See D12143 for more details.

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

Reviewed by Ray Molenkamp
2021-08-10 08:54:03 -07:00
6806459246 UI: hide Viewport Display Bounds for object types that dont have
bounding boxes

These are namely 'LIGHT', 'CAMERA', 'EMPTY', 'SPEAKER' and 'LIGHTPROBE'.

Note that Empties are included here despite the fact that they have
instancing capabilities ('Display As' can be 'Bounds' for example which
then displays all instanced geometry with boundingboxes -- this however
is not meant to work with the 'Bounds' checkbox and the display bounds
type, these are only affective for the object itself, not its instances)

Issue came up in T88443.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11344
2021-08-10 17:30:43 +02:00
b6538e1492 Fix T90572: "Render Region" is broken due to compositing
It was using viewer instead of render border. A copy-paste error.
2021-08-10 16:16:23 +02:00
eb03529ab9 Compositor: Full frame output nodes
Adds full frame implementation to "Composite", "File Output" and
"Split Viewer" nodes.
The other nodes in "Output" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12091
2021-08-10 16:16:23 +02:00
d481c6651d Compositor: Full frame color nodes
Adds full frame implementation to "Alpha Over",
"Hue Saturation Value", "Invert", "Tonemap" and "ZCombine" nodes.
The other nodes in "Color" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12092
2021-08-10 16:16:23 +02:00
8f6cc16490 Compositor: Full frame curve nodes
Adds full frame implementation to "RGB Curves",
"Vector Curves" and "Hue Correct" nodes.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12093
2021-08-10 16:16:23 +02:00
b81d88a8e2 Compositor: Fix memory leaks when initializing tiles multi-threaded
It was only affecting tiled fallback on full frame mode. If tiles from a
constant operation were multi-thread initialized, its buffer
was inflated multiple times.
2021-08-10 16:16:23 +02:00
1a9b9dd64d Compositor: Full frame input nodes
Adds full frame implementation to "Bokeh Image" node, "Track Position"
node, `SetVectorOperation` and `MovieClipAttribute`.
The other nodes in "Input" submenu are implemented separately.

`MovieClipAttribute` needs resolution to calculate its constant value, it can't be constant folded,
which requires it to be a `ConstantOperation`. Now `ConstantOperation` contemplate this case
and any operation that is always constant without depending on inputs should implement it.
If in the future an operation needs to get an input constant element during
`determineResolution` it must first determine its input resolution.

The nodes have no functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12090
2021-08-10 16:16:22 +02:00
5deb3229a0 Compositor: Full frame Mask node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11751
2021-08-10 16:16:22 +02:00
079f35572b Compositor: Full frame Bilateral Blur node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11634
2021-08-10 16:16:22 +02:00
0116a567dd Compositor: Full frame Sun Beams node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11694
2021-08-10 16:16:22 +02:00
6c0c766bca UI: hide instancing options for empties which cannot be used
Empties can only instance a collection, instancing on "Vertices" or
"Faces" does not make sense for empties, make that clear in the UI.

ref D11348

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11349
2021-08-10 16:05:01 +02:00
4599748962 UI: hide object instancing panel for object types that dont support instancing
Basically, only meshes, empties and pointclouds support direct
instancing atm., no need to have the panel for other types.

note: prior to rB2eca054e14b1, collection instancing was possible on all
types (but that was removed in said commit)

note2: for empties, rna_Object_instance_type_itemf should also be
tweaked so we dont get "Vertices" and "Faces" options, but that can be
done in a separate commit

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11348
2021-08-10 16:04:45 +02:00
Himanshi Kalra
e38de11f05 Refactor: Custom data comparison in meshes
Added the comparison of non-generic attributes with generic
attributes in the same loop to avoid issues with different
order in layer->types of the two meshes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12149
2021-08-10 19:22:29 +05:30
9c0f11344e Fix T90564: Crash when linking 2 node inputs
Caused by {rB37570a73170e}.

Above commit wasnt taking into account that at this point the link could
still be NULL.

Maniphest Tasks: T90564

Differential Revision: https://developer.blender.org/D12180
2021-08-10 15:44:53 +02:00
05879f2c36 File/Asset Browser: Select/Activate File on Right Click for Context Menu
Right clicking would spawn the context menu under the cursor, but some
operators would actually act on the active asset/file which wasn't
the one clicked on.

When multiple files are selected and one of them is right-clicked on,
selection is not changed to allow operations on multiple files. E.g.
deletion.

This makes the File/Asset Browser match the Outliner (in behavior, not
implementation).

For the right-click selection keymap:
* The context menu still only spawns on W.
* Bonus: Right click now does something, it actually selects files!
  I could have done additional changes here to avoid this, but it seems
  like a good addition.

This is also a better alternative to rB5edfde58fe60, which didn't work
properly either. Using rename from the context menu would only work if
the clicked on file was also active...

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

Reviewed by: Campbell Barton
2021-08-10 13:04:49 +02:00
fe1740ae6a Cleanup: use give_object_under_cursor when dragging materials.
It used to invoke give_base_under_cursor, but only accessed the `object` from the base.
2021-08-10 12:07:13 +02:00
aab7540b7a Fix crash: mouse is over file space during startup.
When blender starts and the mouse is over a file/asset browser it
crashes. This is because blender wants to highlight a file, but the
layout isn't initialized yet.
2021-08-10 12:03:40 +02:00
895d3cd11e Fix T89253: template_list allows arbitrary data changes
Blender forbids property changes in .draw() methods. But they weren't
caught after a call to .template_list() with a custom list type.

Support nested calls that disallow writes.
2021-08-10 19:53:08 +10:00
182edd4c35 Fix T89284: Greasepencil top bar draw tool settings missing
Caused by {rBe3faef686d38}.

Error was getting the preview [which wasnt there yet]
These only appeared once the material tab in the Properties Editor was
used (since this ensured a valid preview icon).

Above commit changed behavior for RNA icon getter (this does not create
data anymore), so ensure the preview by hand here.

Maniphest Tasks: T89284

Differential Revision: https://developer.blender.org/D12178
2021-08-10 11:37:03 +02:00
76d52cbcb4 Cleanup: Comment COW/LOCALIZED ID tags.
This was really missing there (some COW tags behavior was also
documented in some code using them, like in `sound.c`, but not in their
definition).

Ref. T88555.
2021-08-10 10:07:10 +02:00
7c2c66cdb8 Fix T90268: Mesh.from_pydata error using numpy array for edges/faces
Technically not a bug but worth supporting.
2021-08-10 17:51:48 +10:00
61040a36aa PyDoc: fix for renamed context member
Missing change from 9cff9f9f5d.
2021-08-10 17:28:09 +10:00
128ca8c7f6 Fix T90551: Dopesheet displays keyframes differently.
Regression introduced by {rB73b047bcd431}. Missing a check when
converting the file to use LISTBASE_FOREACH.
2021-08-10 08:42:06 +02:00
692e926b18 Silensed compilation warning in gpu test case. 2021-08-10 07:57:41 +02:00
49ea8e4fea Edit Mesh: multi-object edit-mode support for knife project 2021-08-10 15:10:20 +10:00
b83ee724a4 Fix T90418: macOS codesign fails with dylib next to executable
Change the dylib folder relative to `Blender` executable to be
the same as before rB652fbc200500497a67bd11d18b786587ba34e3d9 and same
as bpy.so : `@loader_path/../Resources/${BLENDER_VERSION}/lib`
2021-08-10 10:30:55 +05:30
4ca19c7153 Fix T90493: Undo a knife-project operation crashes
The crash occurred calling because mesh_get_eval_final in edit-mode
freed all derived mesh data without tagging the object for updating.

However meshes in edit-mode weren't meant to be used as knife-project
source-data, adding support for multi object edit-mode  caused this.
2021-08-10 14:44:36 +10:00
3335f852a1 Cleanup: mixing enum/non-enum type warning in conditional expression 2021-08-10 12:04:17 +10:00
26fea4de63 Cleanup: unused function warning 2021-08-10 11:57:33 +10:00
d9930cddfd Fix invalid string comparison in cd692c6954 2021-08-10 11:47:09 +10:00
cb7b4064d6 VSE: Fix cache invalidation
Blend mode replace is done in preprocessing stage, but property update
function invalidated composite cache.
2021-08-10 01:26:49 +02:00
Wannes Malfait
cd692c6954 Geometry Nodes: Add labels for switch node texture sockets
This makes texture sockets have a label by default. This can be changed
by adding the SOCK_HIDE_LABEL flag to the socket. With this change the
switch node now shows the labels "True" and "False" like for the other
types of sockets.
2021-08-09 17:30:44 -05:00
3b87fd376a Cleanup: Remove unecessary RNA get and set functions 2021-08-09 15:25:05 -05:00
Rob Ranieri
8e3dea27ec Docs: Blend-File: Fix typo
Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12162
2021-08-09 15:36:42 -04:00
2d867426b1 UI: Clip Editor: Expose 2D Cursor Location to RNA and UI
To be consistent with the image editors and 3D viewport
the cursor location can be changed from the sidebar.
This was missing from the clip editor, but support has been added in this commit.
Previously, the only way to precisely set the cursor was
to call the set cursor operator then use the redo panel to adjust the value.
2021-08-09 15:33:06 -04:00
ce95a2b148 UI: Clip Editor: Move Annotation Panel to new View tab
To be consistent with all other editors the annotation
layers pannel should be placed in a "View Tab".
In my next commit, this tab will be expanded to include other options.
2021-08-09 15:33:06 -04:00
b04997cca4 Fix T90547: Add node errors when compiled without OpenVDB or Bullet
These were added in other places but were overlooked here.
2021-08-09 13:42:19 -05:00
fddd5eb692 UI: Image Editor: Fix missing 2D cursor in mask edit mode
The 2D cursor should be visible in both mask and uv edit modes.

This was likely and oversight when splitting the image editor
into the UV and Image editors
2021-08-09 11:53:28 -04:00
ff594715b8 Build: macOS library upgrade fixes
* Revert back to OpenMP 9.0.1 due to bug causing cloth physics test to fail.
* Skip flex build on macOS to avoid link error, only reason we build this is
  due to old flex version on Linux CentOS 7.
* Fix PNG cmake argument that expects lowercase on instead of ON.

 Ref T90507, T88438
2021-08-09 16:50:31 +02:00
71e2c366f7 Cleanup: Fix compiler warning 2021-08-09 15:28:12 +02:00
6fe00939b0 PyAPI: resolve build error with Python 3.10
Resolves T89931
2021-08-09 22:55:41 +10:00
6deb37474e Cleanup: spelling in comments 2021-08-09 22:55:38 +10:00
e2a411570e Cleanup/fixes in UI messages. 2021-08-09 14:42:47 +02:00
3886ab05b4 Cleanup: Spelling and typos in comment 2021-08-09 14:32:12 +02:00
73b047bcd4 Cleanup: Changed keyframe_keylist to CPP.
Just a straight-forward change. Not utilizing CPP features.
2021-08-09 13:00:30 +02:00
22ed1c7b61 Cleanup: filelist, pass FileListReadJob to job functions
Pass `FileListReadJob` to the `read_job_fn` callback, instead of exploding
the struct into its individual fields, passing those as parameters, and
marking a bunch of those as unused again.

No functional changes.
2021-08-09 12:37:23 +02:00
0e4a250279 Fix invalid helps and description of session UUID verification
A copy-paste error.
2021-08-09 12:09:02 +02:00
7ea577eef3 Fix depsgraph check for tag during evaluation
- Only do print when asked for tags debugging.
- Add missing newline to the message.
2021-08-09 12:09:02 +02:00
d6f162dfa9 Fix T90540: NoneType object error with entering grease pencil draw mode
The preview was not ready when the panel was displayed.

Just need to check if None.
2021-08-09 12:08:08 +02:00
0986992dbd Cleanup: document FileListReadJob::tmp_filelist
Add a comment to document what `FileListReadJob::tmp_filelist` is for,
and how it's freed.

No functional changes.
2021-08-09 11:32:16 +02:00
909e0819ae Fix T90532: Crash editing meshes with auto-smooth
Caused by fix for T90256 and a misunderstanding in D11928.

Don't skip tagging edges when the auto-smooth angle is 180 degrees
since this skips topology checks which are needed for properly
calculating edge loop normals.
2021-08-09 18:32:53 +10:00
52c349cfcd Fix T90511: Cycles preview does not update once preview is done
Caused by 4f64fa4f86.

Was a bad backport from the Cycles X branch: the fact that CPU and GPU
has different reset code paths was not taken into account.
2021-08-09 10:28:54 +02:00
b417fb9251 Cleanup: return True/False from gpencil toolbar function
This was returning None/False which could cause problems in the future.
2021-08-09 15:05:04 +10:00
64d750fb73 Cleanup: indentation 2021-08-09 15:03:47 +10:00
d3a699925d Cleanup: use 'cls' for class methods first argument 2021-08-09 15:03:32 +10:00
eb165f574b Cleanup: remove redundant imports
The module was importing it's own functions.
2021-08-09 15:02:31 +10:00
Yuki Hashimoto
8830cfe541 Fix text object inserting multiple characters with a selection
`bpy.ops.font.text_insert(text="multiple characters")` wasn't working.

When the text is selected does not correctly insert multiple characters.

- When the text was selected from left to right,
  the cursor only move one position next to the selected text.
- When the text is selected from right to left,
  a part of the selected text remain.

Ref D12161
2021-08-09 14:31:57 +10:00
ff9bc901f4 Cleanup: grease pencil app-template versioning
- Remove check for screens being None as this would raise an error.
- Replace loop over `area.spaces` with `area.spaces.active`.
- Loop over grease pencil data directly instead of accessing
  through the scenes objects.
- Split versioning into functions.
- Use `update_factory_startup_*` prefix for function names
  as this isn't versioning existing files.
2021-08-09 12:45:06 +10:00
3ea6cf7d41 Cleanup: avoid using context in versioning code
Also extract versioning into a function that makes it's purpose clear.
2021-08-09 12:01:11 +10:00
4c26bb0232 UI: Show Mask Display Options Conistently
This commit makes the display options for mask only show in the header for the clip and image editors.
Prior to this change they would display in the header for the clip editor and in the sidebar for the image editors.
2021-08-08 16:09:23 -04:00
Aaron Carlisle
0be26f563e UI: Sequencer: Fix placement of display options in sequencer & preview mode
This commit does two things, first it removes the proportional editing tool settings.
This is not accessible code and is has not been used since the grease pencil/annotations changes in 2.8.

Second, this patch reorders the if statements so that the display options are always shown on the rightside.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12163
2021-08-08 13:30:52 -04:00
76e24609fd Cleanup: Remove stale/dead code
This seems to be really old code from 2.4 or earlier.
I was unable to find when it was removed gitk and git blame both couldnt find anything.
However, it is safe to say that this code is long gone.
2021-08-08 13:29:29 -04:00
3f1873111e Cleanup: Fix comment typo 2021-08-08 15:11:50 +02:00
b541b5f875 GPencil: Fix memory leak in previous commit 2021-08-08 15:09:34 +02:00
a7aeec2655 GPencil: New Select Random operator
Select strokes or points randomly (similar to meshes).

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12157
2021-08-08 14:56:33 +02:00
a7bb537a61 Cleanup: unnecessary double pointers in XR module
No functional changes.
2021-08-07 21:30:15 +09:00
nutti
b33b70ed07 PyDoc: Fix poll_message_set API documentation to consistent with Python style
Fix poll_message_set API documentation to consistent with Python style

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12150
2021-08-06 20:18:31 -04:00
d245782b80 Windows: Add support to compile python api docs from make file
This adds support to compile the html python api docs from the command line by running `make doc_py` matching support between windows and unix.

This patch also makes it so the compiler is not needed if you set the `blender_bin` variable, this affects icon generation as well.

In the future, I want to move away from generating the build output in the build directory but that can come in a later change.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D12144
2021-08-06 13:55:14 -04:00
3fab16fe8e Fix T90477: Cursor vertex snapping not working in UV editor
`t->obedit_type` is read to indicate if we are in uv edit mode.

Also fixes a crash introduced in {rBdd14ea18190ff27082009f73a556569a43377a71}.
2021-08-06 11:44:26 -03:00
4f64fa4f86 Cycles: Fix for possible viewport dead-lock
This is a backport of recent development in the Cycles X branch.

Fixes possible dead-lock in viewport rendering when exiting at an
exact bad moment (couldn't reproduce in master branch, but in the
cycles-x branch it was happening every now and then).

Differential Revision: https://developer.blender.org/D12154
2021-08-06 16:26:51 +02:00
69c9363e39 Cleanup: Use conventional naming for private Session members
Makes it consistent with the guidelines and the Cycles X branch, and
allows to backport fix for the viewport update from the branch. Will
cause a merge conflict, which should be simple accept-ours in the
branch.
2021-08-06 15:56:00 +02:00
335379d8fc Cleanup: Add missing newline at end of file 2021-08-06 15:32:28 +02:00
3fbe6f513d Move NanoSVG lib to extern
The library has some modifications and it has been included in a diff.

Reviewed By: campbellbarton

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

(Some minor changes done in the patch)
2021-08-06 15:29:54 +02:00
9cff9f9f5d Cleanup: rename FileList::asset_libraryasset_library_ref
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.

This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.

No functional changes.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D12151
2021-08-06 15:20:39 +02:00
2796ee7da0 Fix error setting the ID name in disabled alembic nurbs importe
This corrects code that's currently disabled, see `USE_NURBS` define.

The name passed to `BKE_curve_add` was overwritten,
bypassing uniqueness and utf8 encoding checks.

Longer names would cause a buffer overrun as the length of the source
data was passed to `BLI_strncpy` instead of the destination.

Reviewed By: sybren

Ref D12125
2021-08-06 23:01:57 +10:00
01c1b1e82e Fix shortcut for Asset Details not showing in Asset Browser pulldown
The shortcut wouldn't show up in the Asset Browser's "View" pulldown for
the "Asset Details" item. It's the "N" key to toggle the right sidebar.
2021-08-06 14:39:09 +02:00
f4adb35f28 Fix T90476: intermittent wrong generated texture coordinates with modifiers
This caused Cycles texture_space_mesh_modifier and panorama_dicing tests to
randomly fail.

The issue was introduced with D11377, due to a missing dependency. Now ensure
we first copy the texture space parameters, and only then use or recompute then.

In general it seems like this dependency should have already been there, since
parameter evaluation includes animation and drivers, and geometry evaluation
may depend on that (even if you would not typically animate e.g. an autosmooth
angle).

Thanks Campbell for tracking this one down.
2021-08-06 13:59:25 +02:00
b0df8f53ba Cleanup: rna_xr.c
- Rename functions to use RNA identifiers
- Use SET_FLAG_FROM_TEST macro
- Specify max string length for relevant function params
2021-08-06 17:56:06 +09:00
4c675bc356 Fix missing function param definition in rna_xr.c
Was accidentally left out in rBe844e9e8f3bb.
2021-08-06 17:55:32 +09:00
151eed752b Fix invalid XR action map indices after alloc
Although the relevant structs (wmXrRuntime/XrActionMap/
XrActionMapItem) are zero-allocated, the selected and active action
map indices need to be initialized to -1 to prevent potential
out-of-bounds list access.
2021-08-06 17:55:00 +09:00
d98791a106 Cleanup: clang tidy
`bugprone-signed-char-misuse`
2021-08-06 10:20:24 +02:00
6188c29603 Cleanup: use const result in ED_keyframes_find_* functions. 2021-08-06 09:54:56 +02:00
1ab75c1d49 Cleanup: use range2f in ED_keylist_find_any_between. 2021-08-06 09:46:36 +02:00
bb8ce95b5e Cleanup: const pass keyframes_keylist. 2021-08-06 09:10:28 +02:00
bc97d78329 Cleanup: use MEM_SAFE_FREE macro 2021-08-06 14:24:16 +10:00
99738fbfdc Fix memory leak from rB263fa406cd2b 2021-08-05 21:10:54 -05:00
1f8485ae82 Geometry Nodes: Select by Handle Type Node
Just like the "Select by Material" node, this node outputs a
boolean attribute for control points that have a matching handle
type. By default left and right handles are considered, but it's
possible to only check one side with the toggle in the node.

Differential Revision: https://developer.blender.org/D12135
2021-08-05 18:42:20 -05:00
Mattias Fredriksson
bc0d55e724 Fix: Avoid floating point error in some mesh primitive nodes
Some mesh primitives created using geometry nodes use loops to create
vertices and accumulates positions/angles in FP variables. This allows
rounding errors to accumulate and can introduce significant errors.

To minimize changes from original implementation, variables allowing
errors to accumulate are replaced by: delta * index. Affected Mesh
Primitives nodes are Line, Grid, Cylinder, Circle, Cone, and UV-Sphere.

Differential Revision: https://developer.blender.org/D12136
2021-08-05 18:34:32 -05:00
263fa406cd Fix T90087: Assigning object data doesn't copy vertex groups
Assigning a mesh seems to do its own parameter copying, which
means we need to manual copy its vertex groups here, which was
just overlooked in rB3b6ee8cee708.

Differential Revision: https://developer.blender.org/D12110
2021-08-05 18:27:07 -05:00
Himanshi Kalra
92edf37997 Add custom data comparison for generic attributes
Generic attributes CD_PROP_* comparison is added in customdata_compare
Checks for built-in as well as user created attributes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12137
2021-08-06 00:07:40 +05:30
Germano Cavalcante
89014b51f1 Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS

So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.

Reviewed By: brecht, ankitm

Differential Revision: https://developer.blender.org/D12132
2021-08-05 15:31:41 -03:00
cf10eb54cc Action Constraint: add Split Channels Mix choices from Copy Transforms
Practice shows that when combining actions and direct animation
it is usually best to combine location, rotation and scale
separately, which is implemented by the Split Channels modes
recently introduced in D9469 for Copy Transforms. This completes
the same set of 6 choices for the Action Constraint.

The default for new constraints is changed to the newly
added Before Original (Split Channels) mode.

The original patch is motivated by Loic Pinsard, who created
an addon that does the equivalent of this feature by splitting
the action into two, separating location and rotation+scale.

Differential Revision: https://developer.blender.org/D7547
2021-08-05 21:21:29 +03:00
d01781129f Fix T90235: Smooth Brush not working with interior vertices with two adjacent edges
The exception to automatically pin vertices of grid corners also
has to take into account that the vertex is in a boundary.

Reviewed By: JacquesLucke

Maniphest Tasks: T90235

Differential Revision: https://developer.blender.org/D12044
2021-08-05 20:10:02 +02:00
4dd6c9ad45 Fix T90236: Sculpt automasking failing when the stroke does not start over the mesh
The active geometry element are usually updated by the cursor drawing
code (as they are needed for the cursor preview) and when an sculpt
operator starts. For brushes, this was not happening. This was making
brushes rely by default on the last cursor drawing update, which can
be incorrect if the mouse moved after starting the stroke without
hovering the active geometry.

Reviewed By: JacquesLucke

Maniphest Tasks: T90236

Differential Revision: https://developer.blender.org/D12045
2021-08-05 20:08:36 +02:00
6844f7bedb PyDoc: document how parameter are used for 3D and 2D textures
Improves on rB171433e841379e7efad069bbda9880fb271e2fc4
2021-08-05 13:06:13 -04:00
Eitan
bd44e82b25 Geometry Nodes: Add more warnings for out of bounds parameters
Add warning(info) to nodes that don't work when an input value is
out of range. For example, the grid node doesn't work with Vertices X
or Verices Y less than 2.

These are purposefully added as "Info" warnings, because they don't
show in the modifier and they aren't printed to the terminal.

Differential Revision: https://developer.blender.org/D11923
2021-08-05 10:44:59 -05:00
c15635bd8d BMesh: support laplacian smooth for n-gons
Follow the same logic already used by the modifier.
2021-08-06 01:43:13 +10:00
04c24bec07 Cleanup: replace short with boolean for zero area array
Also remove redundant fabsf on the area of a quad/tri &
reduce indentation using continue in for loop.
2021-08-06 01:42:01 +10:00
ff2265f0a9 Cleanup: comment blocks & spelling 2021-08-06 01:36:43 +10:00
8158211198 Cleanup: quiet array-parameter warning 2021-08-06 01:32:04 +10:00
ca64bd0aac Render: move Cycles visibility, holdout and shadow catcher properties to Blender
The immediate reason for this is that we want to be able to initialize them
to different defaults for light objects, which is hard with Python properties.
But in general it is useful to be able to share these with other renderers.

As a side effect, Eevee now supports a per-object holdout instead of only
per-collection.

Differential Revision: https://developer.blender.org/D12133
2021-08-05 17:22:38 +02:00
6c326ba0a2 Fix T83164: Spline IK joint_bindings parameter is broken.
Code freeing the array would not properly reset its length value to
zero.

Note that this corrupted data could also be saved in .blend files, so
had to bump fileversion and add some doversion code too.

Fix T90166: crash when creating a liboverride.
2021-08-05 17:21:25 +02:00
834523e239 Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.
This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.
2021-08-05 17:21:25 +02:00
27b9cb7a1e GPencil: New Merge Layer keymap: Shift+Ctrl+M
The keymap is available in: Draw, Edit, Sculpt, Weight Paint and Vertex Paint modes.

The keymap is not available in Object mode to avoid any conflict.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12128
2021-08-05 17:12:34 +02:00
03d7561708 Fix build error when WITH_XR_OPENXR not defined 2021-08-06 00:08:56 +09:00
b4f950cbbe GPencil: New Caps icons
These icons are used to define the type of caps.

Designed by: Matias Mendiola
Reviewed by: Pablo Vazquez
2021-08-05 17:07:21 +02:00
Germano Cavalcante
cc4e674e41 DRW: New Select Debug Engine
This is a simple engine used only to debug the texture of select ids.

It is only used when the `WITH_DRAW_DEBUG` option is enabled and the
debug value is 31.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5490
2021-08-05 11:56:51 -03:00
e844e9e8f3 XR Controller Support Step 2: Action Maps
Addresses the remaining portions of T77137 (Python API for Controller
Interaction), which was partially completed by D10942.

Adds an XR "action maps" system for loading XR action data from a
Python script. Action maps are accessible via the Python API, and are used
to pass default actions to the VR session during the
xr_session_start_pre() callback.

Since action maps are stored only as runtime data, they will be
cleaned up with the rest of the VR runtime data on file read or exit.

Reviewed By: Julian Eisel, Hans Goudey

Differential Revision: https://developer.blender.org/D10943
2021-08-05 23:40:17 +09:00
0cff7c2a22 LibOverride: Make it reasonably impossible for users to create overrides of scenes.
This is not supported currently,doing so through RNA API remains
possible, but from regular UI operations it should not be doable
anymore.

Ref. T90459.
2021-08-05 15:26:08 +02:00
720ea8a67d Fix T89963: crash when library override is applied to an object from a linked scene.
LibOverride of scenes is not really supported currently, there are many
issues with it.

Will disable most user-accessible ways to create such overrides in a
following commit.
2021-08-05 15:26:08 +02:00
be6409a748 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-05 22:39:24 +10:00
fb1822ddeb XR: Controller Data Improvements
Provides two key improvements to runtime controller data.

1. Separates controller poses into two components, "grip" and "aim",
which are both required to accurately represent the controllers
without manual offsets.

Following their OpenXR definitions, the grip pose represents the
user's hand when holding the controller, and the aim pose represents
the controller's aiming source.

2. Runtime controller data is now stored as a dynamic array instead
of a fixed array. This makes the API/functionality more adaptable to
different systems.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12073
2021-08-05 21:11:01 +09:00
f45860fba9 Cleanup: Remove unused members in FileSelectParams 2021-08-05 12:52:58 +02:00
ed9759349b Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates
Vertices with no connected faces would attempt to divide by the combined
face area causing a divide by zero.

Use the same weight for wire vertices as vertices connected
to zero area faces.
2021-08-05 20:49:20 +10:00
02e0c6f42e Fix T90430: Crash when dragging material
Was trying to get asset information even when there was none, i.e. when
the material wasn't an asset or not dragged from the Asset Browser.
2021-08-05 12:14:11 +02:00
317f09ebf9 Fix T90170: RNA_property_pointer_get creating data in non-thread-safe way.
Protect this accessor with a local static mutex when it needs to
create/write data.

Ideally accessors should never create or modify data, but there are some
cases where this bad behavior is currently unavoidable.

This is the case of the Pointer accessor when the actual IDProperty has
not yet been created.

NOTE: this fixes a memory leak in liboverride diffing process when
several different overrides use a same linked reference ID.

Differential Revision: https://developer.blender.org/D12060
2021-08-05 12:12:13 +02:00
03e2f11d48 Fix T89835: Crash after Instancing to Scene after making linked Collection local.
Even though the ID itself remain the same after being made local, from
depsgraph point of view this is a different ID. Hence we need to tag all
of its users for COW update, as well as rebuild depsgraph relationships.

Should be also backported to LTS 2.93 (and 2.83 if possible).
2021-08-05 11:31:49 +02:00
647a8bff06 Fix T90256: faces are flat shaded in edit mode with auto smooth
Regression in 39b2a7bb7e.
2021-08-05 18:21:17 +10:00
f5acfd9c04 Cleanup: remove redundant parenthesis 2021-08-05 16:54:34 +10:00
d8582d966f Fix slicing with negative indices
Negative indices that remained negative after adding the sequence length
caused incorrect slicing.

With the default scene for example:

   bpy.context.scene.objects[-4:2]

Gave a different result to:

   tuple(bpy.context.scene.objects)[-4:2]

Clamp indices above zero so loops that step forward works as intended.
2021-08-05 16:44:03 +10:00
2b51124d6a Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-05 16:44:01 +10:00
450593ddf0 Cleanup: Fix Clang braced-scalar-init warning 2021-08-05 11:00:56 +05:30
d3d4be1db3 XR: Action Binding Improvements
Provides several important improvements to the runtime action
bindings operation and internal API.

Moves input-specific action data (input thresholds, input regions,
pose offsets/spaces) from actions to more granular action bindings.
This allows a single action to be mapped to a variety of inputs,
without having to share a single input threshold, region, or space.

Also removes the need for action space creation API, as spaces for
pose actions will be automatically created with the bindings.

The correct action data for the current inputs is set by calling
xrGetCurrentInteractionProfile() to get the current profile and then
retrieving the corresponding mapped data.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12077
2021-08-05 13:14:26 +09:00
d1c5e2e050 Cleanup: license headers
These were removed globally in 65ec7ec524.

Some files re-introduced these conventions since.
2021-08-05 12:03:41 +10:00
604ae5f7b6 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-05 12:03:41 +10:00
1def985d78 Windows: Add icons and icons_geom to make.bat
This adds support for building the icons from make.bat
unlike bash there is no passing environment variables
on the command line.

The scripts go out of their way to locate both blender
and inkscape however if they are not found, the user is
given a helpful error message telling them how to set
the variables.

Although some extra help can be given there, if your
normal build is a 2019 full build running

`make 2019 full icons`

will help it find the blender executable as well.

finally if you know the name of your build folder
running

`make builddir build_windows_Lite_x64_vc16_Release icons`

will also work, if all fails you can point directly to
the blender executable by running

`set BLENDER_BIN=c:\where\blender\lives\blender.exe`

before running `make icons` or `make icons_geom`

The python scripts needed some small modifications since
without the PATHEXT, SystemRoot and SystemDrive
environment variables python will not initialize properly
on windows. (Not blender related, even mainline python
won't start without those)
2021-08-04 19:32:24 -06:00
438d645a36 PyDoc: Update GPU Example of draw_view3d
This function was changed in rBc8004ab4078c98c54a70113c12bbb186403e90cf but didnt update the example.

Part of T84227
2021-08-04 20:25:50 -04:00
171433e841 PyDoc: Improve description of texture.evaluate
Inspired by the old 2.49 docs: https://docs.blender.org/api/249PythonDoc/Texture.Texture-class.html#evaluate
2021-08-04 19:26:01 -04:00
d6ca7ab20e Cleanup: make format 2021-08-04 19:24:19 -04:00
07b702f828 Win32 IME: Rename SetInputLanguage()
GHOST_ImeWin32::SetInputLanguage() has a confusing name because it does
not set the input language. It actually retrieves the current input
locale from the OS and caches the value of the current input language
ID. Therefore this patch renames it to "UpdateInputLanguage"

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

Reviewed by Ray Molenkamp
2021-08-04 14:30:16 -07:00
1d1020b79f Win32 IME: Remove ime_status_
This removes one member of GHOST_ImeWin32 that is not used and cannot
be used in the future. It is holding the result of ImmIsIME, which is
whether an input language supports IME. It does not indicate that one
is in use, turned on, composing, in English mode, etc.

see D12131 for more information.

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

Reviewed by Ray Molenkamp
2021-08-04 13:20:45 -07:00
49acc52e02 Cycles: make object Fast GI Approximation panel a subpanel of Shading 2021-08-04 20:52:29 +02:00
8abf6efcf6 Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer
This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.
2021-08-04 19:18:34 +02:00
Romain Toumi
10b9621079 Fix Cycles material slots list being too short
Bring it in line with Eevee.

Differential Revision: https://developer.blender.org/D11982
2021-08-04 18:43:39 +02:00
ae920d789e VSE: Allow Wingdings and Symbol Fonts
This patch makes us less restrictive on the allowed types of FreeType
font character maps we allow, rather than primarily unicode-only. This
allows us to use some legacy, symbol, specialty, and proprietary fonts
like Wingdings. Note we were a little less restrictive with vfonts,
used for 3D Text Objects, so this patch primarily helps VSE.

See D12124 for details and examples.

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

Reviewed by Brecht Van Lommel
2021-08-04 09:31:01 -07:00
b5bfb5f34c UI: VFont Display Names
When displaying the names of fonts for 3D Text objects, use the same
format as shown in File Browser: Family name + Style name. They are
currently shown with Postscript Name, which doesn't match well.

see D12069 for more details.

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

Reviewed by Campbell Barton
2021-08-04 08:34:28 -07:00
c18d91918f Cycles: More flexible GI Approximation AO distance control
The goal: allow to easily use AO approximation in scenes which combines
both small and large scale objects.

The idea: use per-object AO distance which will allow to override world
settings. Instancer object will "propagate" its AO distance to all its
instances unless the instance defines own distance (this allows to
modify AO distance in the shot files, without requiring to modify props
used in the shots.

Available from the new Fats GI Approximation panel in object properties.

Differential Revision: https://developer.blender.org/D12112
2021-08-04 17:26:24 +02:00
58ba75f9e3 LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides.

Ref. T86656.
2021-08-04 16:57:08 +02:00
a8185d2d74 LibOverride: Add RNA API to reset/delete overrides.
Ref. T86656.
2021-08-04 16:57:08 +02:00
2af789d1f3 Added some TODO remarks. 2021-08-04 16:05:49 +02:00
c1730ed165 GPencil: New Brush option to define Caps type
This is used to set the default caps type for the stroke. Before always was rounded and only could be changed later in Edit mode

Two new buttons has been added to topbar.

NOTE: New icons are been designed (T90414)

The buttons are expanded to list in Properties panel.

Reviewed By: mendio, HooglyBoogly

Differential Revision: https://developer.blender.org/D11999
2021-08-04 15:54:54 +02:00
145270d8d7 Fix T90427: Center View to Mouse broken
rBfb87d236edb7 made the values returned by `projmat_dimensions` more
standardized following the documentations. But the functions in Blender
that called `projmat_dimensions` followed a proposal that these values
corresponded to a distance of 1m of clip.

Adjust these functions to follow the new algorithm.
2021-08-04 10:46:54 -03:00
e5d4a0c559 BLI: add double version of 'scaleform'
No functional changes. New utility.
2021-08-04 10:46:54 -03:00
26c2c617b4 Fix T90421: edit-mode auto-smooth crash when angle set to 180degrees
Error in 39b2a7bb7e
which failed to set edge flags with single threaded calculation,
used for low poly models.
2021-08-04 22:40:25 +10:00
Gavin Li
76dcf70dac Fix transparent faces on certain AMD cards
This patch fixes an issue with missing faces when assigning a material slot other than the first to faces on AMD TAHITI cards. Refer to T78390 and T74024 for a description of this issue.

This patch also incorporates fix from T78390 for KAVERI.

{F9029258}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9305
2021-08-04 13:22:44 +02:00
d2130c5327 Cleanup: remove *.rej from cb67bfdba2 2021-08-04 21:09:21 +10:00
add719e31a Tweak to recent liboverride API addition: naming.
Rename new API function introduced in recent rB3b0fab6dfaa0 to match our
convention to put the action (verb) at the end of names:
`operations_update`.

Sorry for not catching that during review.
2021-08-04 12:38:13 +02:00
ac6b263906 Cleanup: inconsistent parameter name 2021-08-04 12:32:25 +02:00
557e7f135e Cleanup: initialize variable to quiet warning 2021-08-04 12:31:48 +02:00
051141acde Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.
Previous check was too blunt, preventing e.g. re-organization of
collection overrides inside a local parent collection, which is
perfectly valid operation.

Reported by @hjalti from the studio, thanks!
2021-08-04 11:42:13 +02:00
d9a530c55e Fix compile error without WITH_OCEANSIM enabled
Was changed in 218df99410.
2021-08-04 11:30:24 +02:00
Pratik Borhade
8c21076add Fix T87635: Rename shader node "Specular" to "Specular BSDF"
Node name edited in Specular node definition

Reviewed By: fclem

Maniphest Tasks: T87635

Differential Revision: https://developer.blender.org/D11022
2021-08-04 11:21:44 +02:00
Gottfried Hofmann
c8004ab407 Expose Color Management as argument for gpu.types.GPUOffScreen.draw_view3d()
Fix for https://developer.blender.org/T84227

The problem was that https://developer.blender.org/rBe0ffb911a22bb03755687f45fc1a996870e059a8 turned color management for offscreen rendering off by default, which makes it non-color-managed in some cases. So the idea here is that script authors get the choice wether they want color managed non-color-managed output. Thus this patch introduces a new argument do_color_management as a bool to gpu.types.GPUOffScreen.draw_view3d().

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11645
2021-08-04 11:20:22 +02:00
Anthony Edlin
b867df903f Make loopcut drawing consistent between gizmo and operator.
Loopcut drawing from gizmo had thicker lines because
it was using line smoothing without alpha blend, compared
to thin jagged lines from operator.

Make the drawing anti aliased and consistent by using
3D_POLYLINE/3D_POINT shaders, and making sure alpha
blending is on.

Reviewed By: #eevee_viewport, fclem

Differential Revision: https://developer.blender.org/D11333
2021-08-04 11:19:24 +02:00
cb67bfdba2 Viewport normal drawing with constant length
Patch for: T37878

{F10169694}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11487
2021-08-04 10:55:05 +02:00
218df99410 Modifier: warn if the ocean simulation fails to allocate memory
While most modifies don't handle out of memory cases, ocean simulation
could attempt huge allocations: 2048 gb at the maximum resolution.

Resolves T83952.
2021-08-04 18:29:43 +10:00
3b0fab6dfa Override: API update_operations.
The update_operations function will update the override structure of the
local object. When working with overrides the override structure is only
updated when the work-file is stored. When using scripts you might want
to enforce the update of override properties and operations.

This function removes a hack on the test cases.

Reviewed By: mont29

Maniphest Tasks: T86656

Differential Revision: https://developer.blender.org/D10848
2021-08-04 09:28:18 +02:00
effc048710 T90371: Asset: Drop Material Tooltip.
This patch changes the drop named material tooltip to give feedback to
the user what is going to happen when they invoke the change.

There are 3 states:
* "": Operator will be canceled as not all data is present (dropping on
  background.)
* "Drop <named material> on <object name> (slot <slot number>, replacing
  <current material in slot>).
* "Drop <named material> on <object name> (slot <slot number).

Reviewed By: Severin

Maniphest Tasks: T90371

Differential Revision: https://developer.blender.org/D12106
2021-08-04 08:58:39 +02:00
cd92b2350f Cleanup: use C comments for descriptive text 2021-08-04 13:34:02 +10:00
10464843dd Cleanup: add comment to fix for T90417 2021-08-04 13:34:02 +10:00
Johnny Matthews
0f45576590 Geometry Nodes: Curve Set Spline Type
This node sets the selected (or all) splines in curve to a chosen target
spline type. Poly, Bezier, and NURB splines can be converted to any of
the other types. This is meant to be a building block node, useful in
many procedural situations.

In the future the node could be optimized with multi-threading, or by
avoiding copying in many cases, either by retrieving the curve for write
access or by passing the raw vectors to the new splines where possible.

With edits from Hans Goudey (@HooglyBoogly)

Differential Revision: https://developer.blender.org/D12013
2021-08-03 23:14:03 -04:00
26f1a5e2c8 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-04 13:02:59 +10:00
5950b3ab73 Cleanup: de-duplicate ID renaming utility for versioning 2021-08-04 12:43:07 +10:00
71dc134f89 Icons: add license headers to utilities 2021-08-04 11:45:43 +10:00
7389fd9a35 Icons: resolve various issues for generating icons
- INKSCAPE_BIN environment variable was ignored by
  alert_icons_update & prvicons_update.
- `make icons` wasn't regenerating alert icons.
- Updating SVG icons failed using blender built with ASAN.
2021-08-04 11:35:05 +10:00
8a1c1279b3 Icons: update alert icon script
Missed from c549d736cf.
2021-08-04 11:03:23 +10:00
0d2589d08c Cleanup: spelling 2021-08-04 10:03:07 +10:00
fb87d236ed Fix calculation of 'projmat_dimensions'
`r_left`, `r_right`, `r_bottom` and `r_top` were ignoring `clip_near` value
when in perspective view.

Also rename `projmat` to `winmat` in these cases.
2021-08-03 17:35:35 -03:00
18d900caca macOS: Fix OpenMP dynamic loader error. 2021-08-04 01:22:27 +05:30
41357d556f Fix broken logic in Windows directory query function
Mistake in a5bbdd6998
2021-08-03 19:37:34 +02:00
39e914cee7 Fix select engine buffer having wrong vertex size
The theme used was wrong and the vertex size is twice as set in the theme.
2021-08-03 13:37:55 -03:00
57281b73c4 Install_deps: Always re-create shortcuts to installed lib paths.
For some reasons looks like those shortcuts could get out of sync, which
created weird hard to understand building errors.

So for sake of simplicity and security, just re-create them all the
time, just like we update ld paths.
2021-08-03 17:22:48 +02:00
652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
a25a1f39aa Cleanup: interface, reduce indentation of copy_to_selected_button()
Reduce cognitive complexity of `copy_to_selected_button()` by flipping
conditions, returning early, and using `continue`.

No functional changes.
2021-08-03 17:12:08 +02:00
4e1a1821e0 Fix T90313: Align to Transform Orientation Axis Property Doesn't Work
`Orientation Axis` is a property incompatible with `Align` mode and
should not be visible.
2021-08-03 11:29:36 -03:00
391af6bea2 Cleanup: Replace int with bool for pointcache function
Was using an int for boolean return value.
2021-08-03 15:51:25 +02:00
7724251af8 WM: don't store selection properties typically set in the key-map
While this was already the case for the most part
some selection operators stored common settings for reuse such as
"toggle", "extend" & "deselect".

Disabling storing these settings for later execution
as it means failure to set these options in the key-map re-uses
the value of the shortcut that was last called.

Skip saving these settings since this is a case where reusing them
isn't helpful.

Resolves T90275.
2021-08-03 23:33:40 +10:00
d3dd735fea UI: building without Python again
Also quiet some warnings.
2021-08-03 22:45:37 +10:00
cec103d5a9 Silenced clang-tidy warnings. 2021-08-03 13:56:46 +02:00
0342fb5d20 Fix T90387: division by zero when trying to invert scale
Fix division by zero when `BKE_bone_parent_transform_invert()` inverts a
scale vector with zero components.

Zero values in the to-be-inverted vector are now simply skipped, i.e.
remain zero after inversion. This at least ensures that
`invert_v3_safe(invert_v3_safe(vector))` results in the same vector.

This commit does NOT fix the conceptual problem that an inversion of a
potentially non-invertible vector is relied upon. It just avoids the
division by zero.
2021-08-03 13:43:42 +02:00
dbd34a5acb Fix T90364: buttons (partially) behind animchannel search block search
When channels are scrolled to be (partially) behind the search bar,
their widget buttons would still be interactive, preventing the seach
buttons to be usable.

We have to make sure the events are consumed from the search and dont
reach other UI blocks.
We can do so by flagging the block `UI_BLOCK_CLIP_EVENTS` -- but also
have to make sure the bounds are calculated correctly (otherwise the
check relating `UI_BLOCK_CLIP_EVENTS` in `ui_but_find_mouse_over_ex` wont
trigger properly.

Maniphest Tasks: T90364

Differential Revision: https://developer.blender.org/D12103
2021-08-03 13:20:50 +02:00
b35a96e195 Fix T90346: particle force field self effect amount off by one
When calculating the particle step in `get_effector_tot`, we have to
round up (otherwise we might get an extra round in the for-loop in
`BKE_effectors_apply` for certain cases).

Example from the report:
- 10.000 particles, Effector Amount 3
- was rounding the step down to 3333
- going into the for-loop for 0, 3333, 6666 and 9999 (4 times)
- now rounding the step up to 3334
- going into the for-loop for 0, 3334 and 6668 (3 times as desired)

Maniphest Tasks: T90346

Differential Revision: https://developer.blender.org/D12113
2021-08-03 13:07:46 +02:00
20d5d7b8ec Blender Readfile: Fix annoying useless Object reading error messages.
Extend the 'reading error' container to produce the generic short
message in the popup directly visible by the user, and move all detailed
info the `INFO` reports that only show up in the console and Info
editor.
2021-08-03 12:54:05 +02:00
c6f64d46ed Cleanup: USD importer, consistent naming of function parameter
Rename function parameter `flags` to `read_flag` in the declaration, to
be consistent with the definition.

No functional changes.
2021-08-03 12:44:16 +02:00
Michael Kowalski
ea54cbe1b4 USD: add USD importer
This is an initial implementation of a USD importer.

This work is comprised of Tangent Animation's open source USD importer,
combined with features @makowalski had implemented.

The design is very similar to the approach taken in the Alembic
importer. The core functionality resides in a collection of "reader"
classes, each of which is responsible for converting an instance of a
USD prim to the corresponding Blender Object representation.

The flow of control for the conversion can be followed in the
`import_startjob()` and `import_endjob()` functions in `usd_capi.cc`.
The `USDStageReader` class is responsible for traversing the USD stage
and instantiating the appropriate readers.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D10700
2021-08-03 12:33:36 +02:00
28b9dd7b1f Cleanup: Remove redundant checks in File Browser UI script
Was already checking these preconditions in the poll method.
2021-08-03 12:25:38 +02:00
c0900a64ce Fix T90341: Crash opening 2.4 file with File Browser editor open
The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
2021-08-03 12:25:38 +02:00
b1a607ce04 Cleanup: deduplicate type conversion logic 2021-08-03 10:38:37 +02:00
f8abc3fb2f Fix T85436: Separate by loose parts doesn't show new objects
Only the "changed" state from the last edit-object was used,
this meant the operator would not perform the necessary update
with multi-object edit-mode.

Use "changed" & "changed_multi" naming convention.
2021-08-03 18:13:06 +10:00
d6e97a53ab Correct task ID in 00b57136e4 2021-08-03 18:13:06 +10:00
b54e741a8b UI: Add light count to viewport statistics
Even though lights were part of `SceneStats`, they were not used when
rBfd10ac9acaa0 was committed.

This patch adds the light count back into the statistics. When a light is
the active object, it will display the total number of lights in the
scene, as well as how many lights are currently selected.

{F10141354}

Reviewed By: #user_interface, Severin, Blendify, harley

Maniphest Tasks: T88512

Differential Revision: https://developer.blender.org/D11387
2021-08-03 09:42:53 +02:00
00b57136e4 Revert "Fix spin-gizmo not allowing click events to select vertices"
This reverts commit 0b903755a9.

This caused T86030, left-mouse selection override clicking,
which is used for creating a full revolution.
2021-08-03 16:34:26 +10:00
Jeroen Bakker
6f50969406 Cleanup: Hide implementation details for ED_keyframe_keylist.
For T78995 we want to change the data structure of keylists to
improve performance. (Probably a Vector with bin-search capabilities).

This patch hides the internal structure of the keylists behind `AnimKeylist`
structure. This allows us to change the internals without 'breaking' where it is
being used.

The change adds functions to create, free, find and walk over the
keylist.

Reviewed By: sybren

Maniphest Tasks: T78995

Differential Revision: https://developer.blender.org/D11974
2021-08-03 08:10:21 +02:00
Jeroen Bakker
ebd55b4acd T90372: Assets: When dropping material use active material slot.
Currently when dropping an asset the first material slot is always updated.
This patch changes that logic to update the active material slot.

In future the behavior will be updated to use the material slot of the face under the cursor.
That requires better feedback tot he user.

Reviewed By: Severin

Maniphest Tasks: T90372

Differential Revision: https://developer.blender.org/D12056
2021-08-03 08:08:20 +02:00
Miguel G
a53feb0aff Fix T89691: Solidify modifier simple/complex inconsistency
Maintain the sign when clamping non zero offset.

Reviewed By: campbellbarton, weasel

Ref D11832
2021-08-03 16:00:32 +10:00
c1a477b497 Cleanup: use C++ comments or 'if 0' for commented code 2021-08-03 15:27:20 +10:00
1973fd89df Fix crash adding custom normals
Caused by error converting this file to C++
eccdced972.
2021-08-03 15:01:39 +10:00
04c75c5ce7 Edit Mesh: Correct normal calculation for "Set From Faces"
Setting normals from faces wasn't weighting the faces contribution
by the corner angle, giving lop-sided results in some cases.

This removes the epsilon check for CLNORS_VALID_VEC_LEN,
in favor of matching the behavior of vertex normals exactly.
2021-08-03 12:22:11 +10:00
223f048138 Fix annotations placement option in the Movie Clip editor
In rB6ee14c966d05362228511756c4906e043b87e346 the enum items were renamed/removed, this change was not propagated to this setting
2021-08-02 20:15:11 -04:00
efd7c95bb2 Cleanup: Remove duplicate special case check 2021-08-02 15:45:25 -04:00
a4813379f9 Fix T90042: Spline tangent calculation assert with coincident points 2021-08-02 15:43:37 -04:00
4f6f445120 Cleanup: Make spline settings copy function public
It will be useful in the spline type conversion node. Theoretically it
could become protected again if that conversion moves out of a node,
which might be a nice improvement after an initial version.
2021-08-02 14:21:19 -04:00
8b93265c19 Mesh: Tag normals dirty instead of calculating
Because mesh vertex and face normals are just derived data, they can
be calculated lazily instead of eagerly. Often normal calculation is
a relatively expensive task, and the calculation is often redundant
if the mesh is deformed afterwards anyway.

Instead, normals should be calculated only when they are needed. This
commit moves in that direction by adding a new function to tag a mesh's
normals dirty and replacing normal calculation with it in some places.

Differential Revision: https://developer.blender.org/D12107
2021-08-02 13:47:32 -04:00
a2203a27d9 Fix T90356: Frame selected includes active strip
Don't include active strip in this operator.

This was confusing due to name of operator and inconsistent with other
editors.
2021-08-02 18:51:00 +02:00
67d56eb71e Cleanup: Remove unused/unecessary OpenVDB C API
This commit uses OpenVDB more directly for the voxel remesher, without
the extra indirection of copying to a Blender API. This makes the code
simpler, shorter, and easier to understand (though I didn't observe any
performance improvement).

This also removes the rest of the unused and undocumented OpenVDB C API,
which was written when Blender's code didn't really use C++, and doesn't
serve a purpose anymore. Those features will be implemented as nodes in
the future anyway (see D12100).

Differential Revision: https://developer.blender.org/D12097
2021-08-02 12:26:28 -04:00
77187718e4 Fix T78469: Output Metadata: Strip Name no longer accessible
Caused by rB7fc60bff14a6.

This has actually been reported and closed, but that was clearly a
misunderstanding (above commit changed a checkbox to be an enum, but a
second checkbox was simply removed)

Maniphest Tasks: T78469

Differential Revision: https://developer.blender.org/D12084
2021-08-02 17:26:50 +02:00
eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
1062649b5e Fix T87041: Driver Editor not updated in realtime
Caused by {rBbbb2e0614fc3}

Since above commit only the playhead is updated as an overlay in
animation playback (was moved out of drawing of the main region for
perfomance reasons).
The driver value "debug" visualization is very useful to have during
playback though but was left in main region drawing as part of
`draw_fcurve` (thus does not update in realtime anymore).

Moving `graph_draw_driver_debug` into the overlay is not feasible
because it requires animation filtering which has significant overhead
which needs to be avoided in the overlay which is redrawn on every UI
interaction.

Now tag the whole main region for updates in the Driver Editor during
playback instead (which will make the Drivers Editor as slow during
playback as before rBbbb2e0614fc3 -- but with realtime updates of the
debug visualization).

Maniphest Tasks: T87041

Differential Revision: https://developer.blender.org/D12003
2021-08-02 17:11:58 +02:00
3ff5d8f719 Asset Browser: Proper context menu for assets
Add a context menu dedicated to asset operations to the Asset Browser.
There are two separate context menus to keep things separated well and
avoid confusing if-else logic (similar to D12057 & D12059). Their polls
make sure they are displayed for the right contexts only.

Also (to be committed as followup cleanup): Remove now unused special
handling for assets in file delete operator.

Differential Revision: https://developer.blender.org/D12062
2021-08-02 17:00:20 +02:00
ceb049133c Asset Browser: Don't show inapplicable filter and display settings
So far the Asset Browser just showed the same popups and settings as the
File Browser. Not all of them made sense for the Asset Browser though.

* Don't show inapplicable recursion toggle.
* Don't show sorting options, which don't work with assets anyway.
* Don't show the Filter popover, there are currently no applicable items
  in there.

Just like in D12057, I decided to add separate classes for the Asset
Browser case.

Differential Revision: https://developer.blender.org/D12059
2021-08-02 17:00:20 +02:00
d8bf332f86 Asset Browser: Adjust header pulldowns to be Asset Browser specific
So far the Asset Browser just showed the same menus as the File Browser.
Not all of their entries made sense for the Asset Browser though. I
decided to just give them entirely different classes to avoid confusing
if-else checks everywhere. I think the code duplication this adds is a
minor issue, it's better to keep things seperated clearly IMO.

* View menu: Add "Asset Details" toggle for the sidebar region.
* View menu: Remove recursion sub-menu
* View menu: Remove "File Path" region toggle, which doesn't apply for
  the Asset Browser.

Differential Revision: https://developer.blender.org/D12057
2021-08-02 17:00:20 +02:00
James Monteath
0e4f7b4a4b Delete pipeline_config.json file. The yaml file is now used.
Update README.md.
2021-08-02 16:57:29 +02:00
11cfa6c718 Fix T90332: Auto-smooth crashes in edit-mode
Regression in 39b2a7bb7e
that meant non-manifold edges were not being tagged
when they should have been.
2021-08-02 23:58:55 +10:00
d60a7a8744 WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.

The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.

NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12104
2021-08-02 15:13:21 +02:00
8edb2222ae Cleanup: simplify subclassing CPPType
`CPPType` can wrap any C++ type so that code can work
with the wrapped type in a generic way. The goal of subclassing
`CPPType` is to provide additional methods for some types.
For example, the `CPPType` for `Array<int>` could have a `.element_type()`
method that returns the `CPPType` for `int`.
2021-08-02 12:44:17 +02:00
aa60416361 Revert "Asset Catalogs: loading a catalog definition file"
This reverts commit 1f0d6f7635 and the
cleanup 06cb48e1b2. Committed too early on
Monday morning, still has issues that should be resolved first.
2021-08-02 12:07:55 +02:00
06cb48e1b2 Cleanup: Asset catalogs, C++ to C-style comments
No functional changes.
2021-08-02 11:15:50 +02:00
1f0d6f7635 Asset Catalogs: loading a catalog definition file
Initial, limited implementation of loading a single asset catalog
definition file. These files are structured as follows:

  CATALOG_ID virtual/path/of/catalog
  SUBCATALOG_ID virtual/path/of/catalog/child
  SOMETHING_ELSE some/unrelated/hierarchy

These virtual paths will be used to show the catalog in a tree
structure; the tree structure itself is not part of this commit. Each
asset will have one catalog ID that determines where in that tree the
asset shows up.

Currently only a single catalog definition file can be read; merging
data from multiple such files, and writing them out again after changes
are made, is for future commits.

This commit only contains the code to load a single file, and unittests
to check that this actually works. No UI, no user-facing functionality
yet.
2021-08-02 11:08:02 +02:00
3fd5c93f9c Geometry Nodes: increase threshold to make regression tests pass
The real fix here is to use some kind of relative error in `customdata_compare`
instead of the absolute error used now. If vertex coordinates get larger in magnitude,
the allowed error should increase as well.
2021-08-02 10:38:11 +02:00
de91cdd930 Cleanup: separate base and geometry nodes specific socket cpp type
This simplifies changing how geometry nodes handles different socket types
without affecting other systems.
2021-08-02 10:34:50 +02:00
48722e8971 LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:45:30 +08:00
1cf45fe10f Cleanup: spelling 2021-08-02 15:22:54 +10:00
Takahiro Shizuki
836aeebf70 IME Win32: Fix Duplicated Initial Character
When entering characters using IME on Windows, Japanese and Chinese
will both usually result in the first keystroke being duplicated. The
problem is that we are informed too late, after the first key is
pressed, that we are IME composing. This patch ensures we are entering
non-English characters using ImmGetConversionStatus() and then deals
with editing keys (like arrows and backspace) on a per-language basis.

see D11929 for more details.

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

Reviewed by Brecht Van Lommel
2021-08-01 11:52:22 -07:00
79277986c2 Cleanup: Sort node types alphabetically 2021-07-31 23:22:36 -04:00
17243337d7 Cleanup: Remove unecessary helper function
Retrieving a mesh's looptris now take's a const mesh after
rB5f8969bb4b4, which removes the need for this function.
Since it's only two lines, avoiding the use of a separate function
in this case is simpler.
2021-07-31 14:26:01 -04:00
2f63303e25 Cleanup: Use const mesh arguments
These functions do not change their source or input mesh,  so it can
be passed with const, which means in one case that a function doesn't
have to be responsible for freeing its argument mesh, which is a clearly
better separation of concerns.
2021-07-30 23:26:35 -04:00
8063f10166 Cleanup: Remove unused includes 2021-07-30 22:28:25 -04:00
37e2fec090 Cleanup: Voxel remesh function naming
- Remove BKE prefix for static functions
- Make specific intermediate functions static
- Avoid unecessary "_to_mesh_nomain" suffix
2021-07-30 22:18:44 -04:00
7c961e716d LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 10:02:47 +08:00
524908146c Cleanup: Reorder functions
The Quadriflow remeshing was in the middle of the voxel remesh code.
2021-07-30 21:51:47 -04:00
d91c266986 LineArt: Material flag versioning correction.
By the patch made it in master the version value already advanced (see https://developer.blender.org/D11839), so this versioning code needs to be moved down to that point.
2021-07-31 09:29:39 +08:00
e9dc6a0e09 UI: Show a notification when saving preferences
So far the only way to know if they were saved properly was
to check the terminal.

Also notify when preferences fail to save.
2021-07-31 03:15:10 +02:00
35894dc700 Cleanup: Simplify logic, follow style guide for integer types
- Use `int` instead of `unsigned int` for mesh indices
- Use C++ types (Array, float3, IndexRange)
- Use range based for loops
2021-07-30 15:08:43 -04:00
54bd5efa68 Fix build error in debug builds and uninitialized structs
This BMesh iterator hadn't been used in C++ code yet, and needed
a macro for a proper cast. The parameter structs need to be initialized
when declared without designated initializers.
2021-07-30 14:28:55 -04:00
549e2b7539 Compositor: Buffer iterators tests
See D11882 for a description of the iterators.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12001
2021-07-30 20:20:27 +02:00
d2675c3c5d Cleanup: unneeded default constructor definitions 2021-07-30 20:20:27 +02:00
5762e7a679 Compositor: Fix wrong number of threads during constant folding
The variable was uninitialized at that point of execution.
2021-07-30 20:20:27 +02:00
4dbf4eb100 Assets: Rename "Mark Asset" operator to "Mark as Asset"
This naming change was agreed on during the asset workshop. See
https://code.blender.org/2021/06/asset-browser-workshop-outcomes/#terms-definitions.
2021-07-30 20:18:22 +02:00
96fb21f3af UI: Move Mark/Clear asset out of ID Data in Outliner context menu
They are now always shown in the top-level of the Outliner context menu.
Having them in the ID Data submenu was just a hassle to work with, and
often confusing to users - even if technically correct (the asset status
is part of the ID data).

Part of T82680.
2021-07-30 19:41:19 +02:00
a9ea310d30 Cleanup: Move remesh files to C++
This will be helpful for some cleanups I'd like to do, including
removing the unecessary C API for OpenVDB and unifying some
attribute transfer code.
2021-07-30 13:15:01 -04:00
0b10a96474 Assets: Disable File Browser only operators for asset browsing
These operators shouldn't be available in the Asset Browser.

https://developer.blender.org/T83556

Added a comment to each operator poll assignment to explicitly mention
the intention. That should also remind devs to decide if the operator
should apply for both file & asset browsing when copy & pasting operator
definition code.
2021-07-30 19:07:51 +02:00
f7836019b3 Fix incorrect poll function used for file path dropping
The operator to drop file paths into the File Browser was just checking
if there's an active window. This wasn't really an issue since the
operator was only used as drop-operator for the File Browser. But the
operator would show up in the operator search. Plus, for asset browsing,
we'll also have to check the file browsing mode, so the more specific
poll function will be needed.
2021-07-30 19:07:51 +02:00
9ac782b823 Fix EGL version being printed on every startup
After the switch to enable EGL over GLX. No need to print this debugging
information always.
2021-07-30 18:44:26 +02:00
c1ec2e9d5f Cleanup: compiler warnings 2021-07-30 18:44:26 +02:00
3848507511 Cleanup: clarify license and origin of voronoi and dithering code 2021-07-30 18:44:26 +02:00
b90887da5a Cleanup: Refactor logic of file deletion poll callback
* Early exit instead of complex if-else blocks.
* Avoid iterating over entire file list.
* Use `true`/`false` for boolean values.
* Declare variables in smaller scopes.
2021-07-30 18:42:38 +02:00
3b2a6bf8e8 UI: Don't show Windows file association operator in search on other OSes
The Windows-specific "Register File Association" operator would show in
the search menu of other platforms. Decided to not disable it at
compile-time, like we do it with "Toggle System Console" (another
Windows-only operator), because that would require workarounds for the
translation tools. Instead the operator poll function always returns
false on unsupported platforms now.
2021-07-30 16:43:05 +02:00
3316e28418 Preferences: Move "Register File Association" to preferences level
The operator was register as a "file" operator, which are by convention
used for File Browser operators only. Move it to the "preferences"
operators, where it's displayed in the UI too.
2021-07-30 16:25:34 +02:00
e7e9364d23 Cleanup: remove disabled code from property lookup
This allowed custom ID-properties to share a name-space
with regular properties which won't work well as the names may collide.
2021-07-31 00:23:23 +10:00
4c3d4ebefc Cleanup: remove redundant ifdef check
The define that was tested no longer exists.
2021-07-31 00:15:23 +10:00
eb2a6f454b Fix T90318: Dragging asset while Asset Browser is still loading crashes
This partially reverts cb0b017d8f: We can't store the asset handle in
the drag data, because the file pointer it wraps may be freed as the
Asset Browser generates its file list.
2021-07-30 15:54:54 +02:00
4647ffd918 Cleanup: Remove unused file description storage
This isn't used at all in the current File and Asset Browser design.
2021-07-30 14:34:33 +02:00
c8b7745172 Cleanup: headers, use 'pragma once', remove argument to '\file' 2021-07-30 22:29:30 +10:00
5aa45c43f2 Cleanup: missing leading '*' from comment blocks 2021-07-30 22:20:31 +10:00
88e774aa34 Cleanup: workaround for unstable formatting in clang-format
Running multiple times would re-indent differently.
2021-07-30 21:56:14 +10:00
Flix
a787bcbf5c Fix: script.reload() operator reloads current app template
Ref D12040
2021-07-30 21:43:22 +10:00
James Monteath
8796a2827f Update REAME.md file 2021-07-30 13:40:48 +02:00
b98735ec29 Kernel: include header file in BKE_appdir.h defining size_t
In `BKE_appdir.h`, include `<stddef.h>` as that defines `size_t`. This
follows the "include what you use" principle, and makes it possible to
use `BKE_appdir.h` without having to bother with its dependencies.

No functional changes.
2021-07-30 13:16:14 +02:00
020431408f Cleanup: limit scope of temporary variables
Also remove early return as it duplicates cleanup calls.
2021-07-30 16:44:39 +10:00
93eb460dd0 Cleanup: clang-format (re-run after v12 version bump) 2021-07-30 16:19:19 +10:00
f81a6a2ff1 Cleanup: spelling in comments 2021-07-30 16:16:38 +10:00
63f7eceb53 PyAPI: defer freeing existing properties on registration
Registering a property could remove the existing property,
then fail to parse one of the arguments of the new property -
leaving the struct without a property.

Now freeing the existing property is deferred until immediately
before the new property is registered.
2021-07-30 16:04:08 +10:00
d06b03f80d PyAPI: include the property name & type in registration errors
This gives useful context in errors,
also remove newline endings from exceptions.
2021-07-30 16:04:00 +10:00
9764d90fda Cleanup: use pyrna_enum_value_parse_string parser for enum args 2021-07-30 16:03:56 +10:00
228edcaedd Cleanup: bpy.props variable names
- Use `default` instead of `def` abbreviation.
- Rename `BPYPropArrayLength` to `BPyPropArrayLength`
  in keeping with other local structs.
- Remove _PyArg_Parser.fname value accidentally left in
  (harmless as it's not used).
2021-07-30 16:03:52 +10:00
a2b8dad469 PyAPI: support accessing the original value for RNA enum parsing
Needed in siturations when the input argument is needed for exception messages.
2021-07-30 16:03:47 +10:00
ddcb6b1023 Cleanup: replace macros with converter callbacks for bpy.props
Macros were used for expanding shared logic for some properties.

Replace this with Python converters & a funciton that handles
deferred registration.

Add generic converter functions for RNA enums:

- pyrna_enum_value_parse_string
- pyrna_enum_bitfield_parse_set
2021-07-30 11:57:43 +10:00
5280d4bf0b GPencil: Fix unreported problems painting after import SVG
After doing an import, the bounding box of the stroke was not calculated and any operation related to brushes (Sculpt, Weight Paint and Vertex Paint) was not working as expected because the bounding box of the stroke was wrong.

This problem was solved automatically after any edit operation, but must be solved in the import process.
2021-07-29 22:30:48 +02:00
8f05520083 Fix T89213: Some modifier properties have wrong subtype
This commit resolves these RNA warnings:
```
offset: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'offset', 'subtype'
project_limit: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'project_limit', 'subtype'
falloff_radius: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65567' matches no enum in 'FloatProperty', 'falloff_radius', 'subtype'
```
2021-07-29 17:16:08 -03:00
0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
c7b12e31e6 Fix T89976: Mirror Keys By Value performs wrong scale conversion
In the graph editor, Mirror Keys by Value would convert the value to mirror
over, to account for different units for linear & rotational properties.
The conversion was done in the different direction, though, resulting in
values that were too large by a factor of (180/pi)^2.
2021-07-29 18:34:10 +02:00
cae18abef4 deps/win: Remove media foundation dep for ffmpeg
This caused a blender load error on windows N,
given we do not use these codecs they can safely
be disabled.

This will fix T90200 once the new libraries are
in SVN
2021-07-29 10:21:43 -06:00
8f12457c25 Fix T90295: inconsistent render pass order between Cycles and Eevee 2021-07-29 17:59:03 +02:00
0b0c2901f6 Render: remove unused Blender Internal view layer settings
These should have been removed earlier but were forgotten.
2021-07-29 17:59:03 +02:00
646f7ef73c Render: disable Z pass by default, leave only Combined
It was somewhat arbitrary to have this one pass enabled that adds a bit of
additional memory and render time overhead, even though it's not necessarily
more important than others.
2021-07-29 17:59:03 +02:00
2d3e5eda3f Assets/UI: Resolve major asset view UI template limitation
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.

Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.

Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
2021-07-29 17:35:06 +02:00
8cb4e3d046 Cleanup: Remove unnecessary code for asset view UI template
From what I can tell there is no reason anymore to do this. The design
has changed since this was added.
2021-07-29 17:35:06 +02:00
49c0b9ec43 Assets/UI: Sanity check argument for UILayout.template_asset_view()
Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
2021-07-29 17:35:06 +02:00
5be54cce36 Cleanup: Pass asset handle to asset iterator, rather than wrapped file
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
2021-07-29 17:35:06 +02:00
b361b2f214 Cleanup: Consistent indent style for asset CMakeLists file
Was mixing 4 and 2 space indent in a single file.
2021-07-29 17:35:06 +02:00
33322086f6 install_deps: update OIDN to 1.4.1, and ISPC to 1.16.0.
Ref. T88438.
2021-07-29 17:00:49 +02:00
ceec7cabf5 install_deps: Update OSL to 1.11.14.1.
This has been a huge pain to get working, for several reasons (new flags
needed, patching is now mandatory, etc.).

Further more, discovered that debian OIIO package is now silently
relying on OpenCV, without even proper handling of this dependency (at
least in the `-dev` package), so had to revert to force-build own OIIO
again on that distro for the time being.

Ref. T88438.
2021-07-29 17:00:48 +02:00
b60e72100b Cleanup: OSL buildlib patch: Remove .rej part.
This patch contained changes for an `.rej` rejection file generated by
failed patch apply... Definitly nothing to do here.
2021-07-29 17:00:48 +02:00
21b4799793 install_deps: Update OIIO to 1.1.15.1.
Ref. T88438.
2021-07-29 17:00:48 +02:00
bd2bfa469f install_deps: Update llvm to 12.0 (with minimal now being 11.0).
Ref T88438.
2021-07-29 17:00:48 +02:00
12d93e44d0 Install_deps: add flex dependency.
Was already installed on Debian-like and Fedore/Suse actually, now also
explicitely required on Arch and listed in docs.

Ref. T88438.
2021-07-29 17:00:48 +02:00
4d28703277 Install_deps: Add zstd dependency.
Ref T88438.
2021-07-29 17:00:48 +02:00
Germano Cavalcante
1775c39986 Fix 'BLI_task_parallel_mempool' keeping 'user_chunk' unchanged
When `BLI_task_parallel_mempool` does not use threading, the
`userdata_chunk` is allocated locally simulating a TLS.

However `func_reduce` is not called so the original chunk is ignored.

`task_parallel_iterator_no_threads` is another function that doesn't call
`func_reduce`. It also ignores `userdata_chunk_local` in the main iterator.

The solution in these cases is not to create a `userdata_chunk_local`.

This fixes T90131

Differential Revision: https://developer.blender.org/D12067
2021-07-29 11:37:10 -03:00
0f1c84f171 deps: Reduce llvm/clang footprint for windows
We shipped the whole bin folder for llvm/clang
while we only needed clang-format, by shipping
just the bits we need we save about 700 megabytes
off our svn lib download.
2021-07-29 07:45:38 -06:00
cafb1bc47f Data-block Preview: Create preview using current frame
The preview was always using frame 1, but maybe the object has changed and it's better create preview using the current frame.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12018
2021-07-29 15:08:12 +02:00
24ba931f40 Cleanup: Remove debug-only code 2021-07-29 14:46:54 +02:00
810c88b5f1 Fix building without Cycles logging
Ideally can use assert() checks instead of suppressing the check entirely,
but for now just fix compilation error quickly.
2021-07-29 14:32:10 +02:00
3f84f0123e Cleanup: Fix build warning
Introduced in 3964785a14
2021-07-29 13:11:55 +02:00
jim man
9cc8d50a04 cleanup: editor_image : Remove unused draw functions
These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968
2021-07-29 12:46:24 +02:00
5116b7a4c2 Fix Cycles crash with fluid object motion blur disabled
Motion attributes expects mesh to have non-zero number of motion steps,
which was violated in the case when fluid mesh had motion blur disabled.

This is a bit of annoying fix, because of the order of updates. More
ideal solution would be to handle cached and fluid velocities in the
sync_mesh_motion() which ensures all the dependencies between settings.
2021-07-29 12:28:46 +02:00
0491052a96 VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-29 11:38:43 +02:00
5c9979ff03 VSE: don't snap by default
Snapping by default goes against convention, so this setting was
re-evaluated. Also snapping by default can conflict with new image
transform system, see T90156

There wasn't consensus, so disable snapping by default to follow
established convention.

ref T89665

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12054
2021-07-29 11:38:43 +02:00
3964785a14 UI: Fix time labels drawing
Calculate frequency of time/frame label drawing, such that labels have
at least 10px margin and don't overlap.

Change timecode format:
- Use at least `mm:ss` format
- Don't display frames if all labels would end with +00

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11792
2021-07-29 11:38:43 +02:00
a70f37bd8a Fix T89952: GPencil channel box selection offset
The channel box selection was offset for grease pencil layers.

This is a proposed fix by @yann-lty

Before:
{F10227973}

After:
{F10227974}

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T89952

Differential Revision: https://developer.blender.org/D11962
2021-07-29 10:42:05 +02:00
d5fd09ab58 Fix memory leaks in Python gizmo get/set handlers 2021-07-29 14:32:25 +10:00
3c50687073 Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-29 14:11:37 +10:00
fd0b2b8dfd Cleanup: use PyC_AsArray_FAST function where possible
Oversight in 2453dc1b0e.
2021-07-29 13:41:48 +10:00
bc0a7d3fae PyAPI: support multi-dimensional arrays for bpy.props vector types
- Multi-dimensional boolean, int and float vector types are supported.
- A sequence of int's for the "size" is used to declare dimensions.
- Nested sequences are required for default arguments.

Now it's possible to define matrix properties, for e.g:

  bpy.props.FloatVectorProperty(size=(4, 4), subtype='MATRIX')
2021-07-29 11:09:21 +10:00
2453dc1b0e PyAPI: add multi-dimensional array conversion utility functions
Add array conversion functions that take dimension arguments.

- PyC_AsArray_Multi (version of PyC_AsArray).
- PyC_Tuple_PackArray_Multi_* (version of PyC_Tuple_Pack_*).
2021-07-29 11:04:33 +10:00
0358951b9e Cleanup: spelling 2021-07-29 10:52:08 +10:00
8aa1c0a326 Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"

see D12020 for details and examples.

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

Reviewed by Campbell Barton and Julian Eisel
2021-07-28 11:16:04 -07:00
073bf8bf52 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-28 19:27:57 +02:00
3bf9675849 Cleanup: Remove unnecesary undefs
Macros `SEQ_ALL_END` and `SEQ_ALL_BEGIN` no longer use `seq->tmp`.
Therefore they are safe to use regardless from where they are called.
2021-07-28 18:16:48 +02:00
40ef71f465 Assets: Improve error message when "Clear Asset" fails
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
2021-07-28 18:05:25 +02:00
0088b412ff VSE: Fix audio not recalculated
Changing strip offsets with RNA properties didn't tag depsgraph to
update for new strip start/end points.
2021-07-28 17:45:22 +02:00
08154d237f Cleanup: VSE cache invalidated twice
Multiple RNA update function invalidated cache twice.
2021-07-28 17:20:23 +02:00
Wannes Malfait
b304616f2a Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes.
This patch ensures that when ctrl shift clicking on a node, it will only
link to geometry sockets.

Differential Revision: https://developer.blender.org/D12055
2021-07-28 15:54:17 +02:00
3db37075f6 Remove the code in BKE_collection_move to preserve LayerCollection flags.
This code was actually buggy (forcefully re-enabling excluded layers in some
cases).

Further more, it should not be needed now that layerCollection resync code
reuses as much as possible existing layers instead of deleting and
re-creating them all the time.

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
b18d0244fc LayerCollection: Refactor of resync-with-Collection-hierarchy process.
The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
 * Prefer layers children of current one first (in old hierarchy), and only
   use those from other higher-level hierarchies if no (grand-)child is found.
 * Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
Wannes Malfait
31fcb934a4 Fix T89415: update multi input indices after deleting a node
When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete as well as after a delete with reconnect.

Differential Revision: https://developer.blender.org/D11716
2021-07-28 15:43:24 +02:00
f9308a585e Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.

Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).

ref. T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D12033
2021-07-28 15:06:35 +02:00
dfc597202f Fix T90154, T90213: curve issues since recent cleanup commit
Caused by {rB8cbff7093d65}.

Since above commit only one modifier would get calculated and the
displaylist boundingbox was calculated wrong.

Maniphest Tasks: T90154

Differential Revision: https://developer.blender.org/D12037
2021-07-28 14:59:50 +02:00
7d0765cbdc Fix menu poll function being ignored for UILayout.menu
Using `UILayout.menu()` [1] or `UILayout.menu_contents() [2], the menu
would just always be added, the `poll()` check not being executed. As
API user I would expect the `poll()` to deterimine visiblity of the
menu.

[1] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu
[2] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu_contents

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

Reviewed by: Campbell Barton
2021-07-28 14:44:45 +02:00
8e9d06f5a0 LineArt: Camera Overscan
Expand camera effective region to a portion beyond image frame so strokes won't end right at the border.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12049
2021-07-28 19:55:29 +08:00
544ddcdaac Fix (studio-reported) liboverride resync crash after recent changes.
Recent own rBabf3ce811f6e prevented any LayerCollection update during
the whole liboverride resync process, for both performances and feature
reasons.

However that means that the various runtime caches like the Base GHash
are not cleared anymore during ID remapping process, so we need to call
`BKE_main_collection_sync_remap` instead of `BKE_main_collection_sync`
when we finally are ready for this update.

Reported by @eyecandy (Andy Goralczyk) from Blender studio, thanks!
2021-07-28 12:33:16 +02:00
91dd1a1ba3 VSE: Add tooltips for add_effect_strips operator
This patch adds propper tooltips to the effect strips in the "Add" menu.
Note that not all effect strips are actually in the "Effect Strips"
submenu like color strips, text strips or transitions. For these types
of effect strips, a dediacted tooltip is especially useful.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11714
2021-07-28 10:16:43 +02:00
ce68888d1b Cleanup: reduce indentation in bpy.props
Remove unnecessary NULL checks.
2021-07-28 13:38:35 +10:00
f5cc348610 VSE: Draw strips transparent during transform overlap
While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.
2021-07-27 20:14:22 +02:00
ae034d27d2 Deps: ensure osl/bin/oslc is using static libpng
Pass `-DLINKSTATIC=ON` to the OSL CMake, to ensure it statically links to
our libpng. Previously this was only applied on Windows, it's now on all
platforms.
2021-07-27 19:49:29 +02:00
7e91a60be6 Add StringRef::trim() functions
Add three functions that trim characters from the front & end of a
`StringRef`. All functions return a new `StringRef` that references a
sub-string of the original `StringRef`.

- `trim(chars_to_remove)`: strips all characters from the start and end
  that occur in `chars_to_remove`.
- `trim(char_to_remove)`: same, but with a single character to remove.
- `trim()`: remove leading & trailing whitespace, so same as
  `trim(" \r\n\t")`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12031
2021-07-27 19:49:29 +02:00
c6ba7359ae Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-07-27 17:45:17 +02:00
f4abd3cfc4 Fix LibOverride crashing in some cases where reference linked data gets MIA.
When the root of an override hierarchy disapears, there is no way to do
a proper resync, just abort.

Reported by studio, thx.
2021-07-27 17:41:15 +02:00
Himanshi Kalra
4a02b9ffeb Regression Testing: Running tests based on blend files
Runs tests based on blend files with minimum python interaction.
Developed as part of GSoC 2021 - Regression Testing of Geometry Nodes.
Earlier, tests were built from scratch by adding a modifier/operation
from the Python API.
Now, tests can also be created inside blender and are compared using
Python script.

Features: Automatically adding expected object if it doesn't exist.
This patch adds tests for the following Geometry Nodes category:
* Curves
* Geometry
* Mesh
* Points

The implemented UML diagram for refactoring of mesh test framework.
{F10225906}

Technical Changes:
SpecMeshTest: It adds the modifier/operation based on the Spec provided.
BlendFileTest: It applies already existing modifier/operation from the blend file.

Test folders hierarchy with tests. This folder should be extracted to `lib\tests\modeling`
{F10240651}
Note: The `geometry_nodes` folder might lie under another `geometry_nodes` folder while extracting, please double check. Use the inner-most one.
The hierarchy should be:
-`lib\tests\modeling\geometry_nodes\mesh`
-`lib\tests\modeling\geometry_nodes\points`
and so on.

* From `ctest` the tests should be run as `ctest -R geo_node -C [Configuration]` on Windows.
* Each single test can be run with its entire name e..g `ctest -R geo_node_geometry_join_geometry`.(just an example). Run `ctest -N -R geo_node` to see all tests.
* From blender, the tests can be run `blender -b path\to\blend\file --python path\to\geo_node_test.py`

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D11611
2021-07-27 21:01:15 +05:30
d6d44faff0 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-07-28 01:12:26 +10:00
Charlie Jolly
766e67e55d Geometry Nodes: Add node labels to Attribute maths nodes
This adds the operator name to the node label which is consistent with the shading nodes.
The vector node has `Vector` as a prefix.

The Attribute nodes already have a different coloured header.

The same label is used when collapsing nodes, this helps readability.

Reviewed By: pablovazquez

Differential Revision: https://developer.blender.org/D10749
2021-07-27 14:34:08 +01:00
07688ca2d2 Added YAML builtbot config file.
Builtbot is switching over from json to yaml. Both
configuration files should be kept in sync for now.

The json file will be removed when everything works as expected.
2021-07-27 15:06:43 +02:00
db4fe8e322 BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.

Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.

Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).

More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.

NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.

Differential Revision: https://developer.blender.org/D11757
2021-07-27 14:53:49 +02:00
e37c876cd7 PyAPI: support different int sizes for PyC_AsArray 2021-07-27 22:38:50 +10:00
58eacb8e7c Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.

This allows supporting different sized int types more easily.
2021-07-27 22:36:01 +10:00
b1a2abd6b2 Fix missing passes update on Use Denoising change
Makes it so Render Layers node in the compositor is updated as soon
as Use Denoising is changed for the final render.

Differential Revision: https://developer.blender.org/D12010
2021-07-27 11:48:14 +02:00
c5e5ac4a17 Deps builder: OIIO/OSL/ISPC/OIDN/LLVM/Flex updates
This diff somewhat snowballed out of updating OIDN to 1.4.1 it had some
changes that allowed us to remove the arm hacks we had in place and
revert to using identical versions for a whole bunch of deps. But that
required an update to ISPC which needed a newer LLVM and if we're
updating LLVM we may as well update OSL, and when we update OSL, OIIO
may as well be dragged in soo......anyhow...

This diff updates:

LLVM 9.0.0 (11.0.1 for mac/arm) -> 12.0.0
OIIO 2.1.15.0 -> 2.2.15.1
OSL 1.11.10.0 -> 1.11.14.1
winflex_bison 2.5.5-> 2.5.24 (ispc needed newer bison, windows only dep)
OIDN 1.4.0 -> 1.4.1
ISPC v1.14.1(random hash for mac/arm) -> v1.16.0
Flex 2.6.4 (ISPC needed newer Flex than available on CentOS 7)

and removes most of the "special arm/mac" versions. I think just ssl and
embree are left with special versions.

notable changes:
@LazyDodo included some clang headers in the linux/mac harvest which are
needed to start writing custom clang based tooling like D9465 these were
already shipping on windows, but not the other platforms.

[macOS] Change the `LC_ID_DYLIB` of OpenMP  for {D11997}. This changes
where the executables look for dylibs.

Reviewed By: sebbas, LazyDodo

Differential Revision: https://developer.blender.org/D11748
2021-07-27 10:15:31 +02:00
5a07174ce3 Cleanup: add note from T85517 fix 2021-07-27 18:14:08 +10:00
b331acf477 Cleanup: comment spelling & punctuation 2021-07-27 18:06:29 +10:00
675d8a9c43 LineArt: Occlusion accuracy fix.
This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
2021-07-27 14:02:34 +08:00
Aaron Carlisle
6ee14c966d Anotations: Fix a several issues with stroke placement
Previously, this option was not exposed in the UI, only for the clip editor.
There were also multiple rna properties that did the same thing for each of the 2D editors.

There was also an issue where the property enum items were the same as the 3d view which didnt make much sense.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12027
2021-07-26 18:53:30 -04:00
05315af81d Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
2021-07-26 22:44:56 +02:00
Christoph Lendenfeld
6a903d9088 Fix: Instantly hide bones after hitting H key in pose sliding
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
2021-07-26 21:42:04 +01:00
a4a72bffd3 Compositor: Full frame Box Mask node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11627
2021-07-26 21:43:30 +02:00
e33814ef6b Compositor: Full frame Levels node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11749
2021-07-26 20:13:55 +02:00
883fb49d4f Compositor: Fix memory leak when exporting operations on debug 2021-07-26 20:13:03 +02:00
a117794f8c Compositor: Full frame Scale node
Adds full frame implementation to this node operations.
No functional changes.

Includes a new operation method `init_data` used to initialize any data
needed after operations are linked and resolutions determined.
Once tiled implementation is removed `initExecution` may be renamed
to `init_rendering` and `init_data` to `init_execution`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11944
2021-07-26 20:13:03 +02:00
cf74cd9367 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-26 19:46:51 +02:00
Nikhil Shringarpurey
6eb94d8df2 Cleanup: fix compiler warnings due to implicit cast
Differential Revision: https://developer.blender.org/D11950
2021-07-26 18:04:40 +02:00
22b03e1c68 Fix Python error in benchmark executable detection after recent changes 2021-07-26 18:04:40 +02:00
abf3ce811f LayerCollections: Add a way to prevent their resync with Collection hierarchy.
This is an easy & safe, yet not-so-nice way to address the
LayerCollections vs. Collections hierarchy resync problem.

Currently this resync is enforced everytime something changes in the
Collections hierarchy, which is extremely inneficient, and can even
produce 'loss' of LayerCollection data during complex Collection
processes.

Current example is during Library Overrides resync process. New code:
 * Makes resync significantly faster (between 10 and 15%).
 * Fixes 'disappearing' layer collections settings on sub-collections'
   layers.

NOTE: This is not a proper fix for the underlying issue. However,
implementing and testing the 'lazy update' solution as proposed by
{T73411} requires a significant amount of time (especially in testing
and tracking all places where code would need to ensure LayerCollections
are up-to-date), which is not possible currently.

Differential Revision: https://developer.blender.org/D11889
2021-07-26 17:36:46 +02:00
cee67f3be2 Cleanup: Fix compiler warning in previous commit 2021-07-26 17:25:56 +02:00
a14ee85ccd Fix T90127: Merge Down layer doesn't take the transform location into account
Now the layer transformation is applied before the merge.
2021-07-26 17:20:00 +02:00
231b313c55 Mantaflow: Remove Noise Type Option
Mantflow only supports wavelet noise, thus the parameter with only one option is no longer useful.

Differential Revision: https://developer.blender.org/D6770
2021-07-26 10:59:49 -04:00
Germano Cavalcante
3059853732 Cleanup: Rearrange mesh extraction files
In the draw module, it's not easy to identify what its header is, and
where the shared functions are.

So move `draw_cache_extract_mesh_extractors.c` and
`draw_cache_extract_mesh_private.h` to the same folder as the extractors
and rename these files to make them more identifiable.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11991
2021-07-26 10:25:39 -03:00
a9121640be macOS Cleanup: Remove old version specific code
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D12021
2021-07-26 18:39:08 +05:30
14f94fd1ca VSE: Fix snapping bugs
Fix hold offset check causing missing snapping point when strip have
only still frames.

Fix effect strips of transformed strips causing snapping to prevoius
strip positions.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11948
2021-07-26 14:57:13 +02:00
1b53fde9fc Cleanup: missed comment in D12029
No functional change.
2021-07-26 13:25:57 +01:00
71d7505487 Geometry Nodes: Fix vector math project bug
Implementation is incorrect compared to Cycles/Eevee.

Reported by @DrDubosc in comments of T88922.

Differential Revision: https://developer.blender.org/D12029
2021-07-26 13:06:15 +01:00
a0cba9fb95 VSE: Fix truncated label
Label for snapping current frame to strips was cut off and not very readable.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11951
2021-07-26 12:57:48 +02:00
faa65f151d Revert "cmake: enable Wayland by default"
This reverts commit a2ccd0e495.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:18:53 +02:00
c17a266e29 Revert "GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set"
This reverts commit c971c851d3.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:16:42 +02:00
Stefan Werner
1a3cb90e4e Cycles: Fixed memory leak in ColorSpaceManager
Cached OCIO processors were not freed, instead the color spaces were freed twice.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D12011
2021-07-26 11:45:29 +02:00
12afb19959 Cleanup: clang tidy 2021-07-26 11:43:51 +02:00
Himanshi Kalra
6abf63f463 Fix T85517: Cannot type Space while holding Shift key in text-field like spaces.
Fix for T85517
Bug: Couldn't type space while holding down the shift key in text spaces (e.g. when saving a file, changing the name of object).

Changes: Removing the key combination of Shift + space in `WM_event_is_ime_switch` method.

Reviewed By: harley, mont29

Maniphest Tasks: T85517

Differential Revision: https://developer.blender.org/D10452
2021-07-26 09:33:03 +02:00
501bca9f5b Cleanup: clang-format 2021-07-26 12:41:49 +10:00
828c66f393 Cleanup: spelling in comments 2021-07-26 12:32:42 +10:00
471d4b105a Cleanup: use doxy comments 2021-07-26 12:32:40 +10:00
a77d203932 UI: Line Art: Rename "Baking" panel to "Bake"
Avoid using verbs for panel names, and be consistent with the
"Bake" panel in Cycles, Ocean Modifier, etc.
2021-07-26 00:03:17 +02:00
0cb25a51de UI: Line Art: Always use Material icon on picker
The Material picker shouldn't change icon based on it's state,
it should always display the Material icon.
2021-07-25 23:59:53 +02:00
6a673b6000 UI: Fix button alignment on Grease Pencil modifiers 2021-07-25 23:57:32 +02:00
8fda1f363a UI: Line Art Modifier: Tweaks to labels and tooltips
- Clearer tooltips for Source Object/Collection.
- Remove redundant Source/Target on labels.
- Always write Grease Pencil with title case.
2021-07-25 23:55:23 +02:00
4886ed2863 Fix T86768, bevel doesn't loop slide sometimes.
Six years ago, Bug T44961 about unwanted spikes had me not do a loop
slide if the angle was too extreme, to avoid unwanted spikes.
The current bug showed that that angle was much too big, and limited
desired behavior in many cases. Changing the angle from 0.25 radians
to 0.0001 radians (about 0.006 degrees) still fixes the original bug
and seems very unlikely to be limiting desired behavior now.
2021-07-25 15:14:37 -04:00
0aad8100ae Fix T89391, etc. Boolean bugs when objects have negative scale.
The old modifier code, now just used for Fast, has code in it to
flip faces of arguments when their tranform's negativity differs
from the main object's transform's negativity.
I had neglected to put that logic in when I made the change that
skipped the round trip through BMesh.
Fixing this means that the results are more what the user expects
when some or all operands have negative scales.
2021-07-25 13:29:45 -04:00
Christoph Lendenfeld
aa32121174 Fix: Remove automatic hiding of bones when using the pose slider
This patch addresses the issue raised in T88340.
When entering a pose sliding operator bones would automatically get hidden.
While technically not a bug it was decided that it is too confusing.
Hiding with 'H' is still possible though, just won't happen automatically

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D11883
Ref: D11883
2021-07-24 21:25:23 +01:00
c971c851d3 GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set 2021-07-24 12:30:14 +01:00
a2ccd0e495 cmake: enable Wayland by default 2021-07-24 12:30:14 +01:00
1029577a51 GHOST/wayland: explicitly delete 'GHOST_SystemWayland' when fallback to X11 2021-07-24 12:30:13 +01:00
05c7d935e7 Cleanup: fix warning -Wparentheses 2021-07-24 19:16:13 +09:00
8fe0aecfde UI: Do not abbreviate/shorten wording
Abbreviations are harder to read and understand thus it is best to be direct.
For example without understanding and context it is hard to know exactly what "Len" means.
2021-07-23 20:46:09 -04:00
ede1ce6e9a GTest: Use INC/INC_SYS for Libmv/OSD tests
This change transitions libmv/osd tests to our
blender_add_test_executable macro that explicitly
takes the include directories as a parameter.

This is in preparation for future clean-up of
global include directories.

Differential Revision: https://developer.blender.org/D12012
Reviewed By: sergey
2021-07-23 16:50:13 -06:00
8031326262 Revert "VSE UX: Make Speed Effect strips more user friendly."
This reverts commit 3123f33380 and
a092baa7f9.
2021-07-23 19:00:13 -03:00
Fredrik Hansson
2beff6197e Weld Modifier: add "loose_edges" option
This improve the cloth modeling workflow by allowing you to weld only the
edges that are used for the sewing forces.

Reviewed By: mano-wii, weasel

Differential Revision: https://developer.blender.org/D10710
2021-07-23 18:52:25 -03:00
3123f33380 Many tweaks to f-curve drawing code 2021-07-23 18:47:07 -03:00
Germano Cavalcante
a092baa7f9 VSE UX: Make Speed Effect strips more user friendly.
**Drawing Changes:**
- F-curve drawing for Stretch, Multiply, Length and Frame Number.
- Value drawing when no keyframes for Stretch, Length and Frame Numbers.

General view of the new drawing for each speed effect mode:
{F9796642, size=full}

Detail of the horizontal zero (blue) line in the new `Multiply` mode:
{F9798520, size=full}

Nice to have (but I don't know how):
- Auto adjusting of endframe when using Multiply or Boost.

Differential Revision: https://developer.blender.org/D6110
2021-07-23 18:47:07 -03:00
5e3d0840a3 PyDocs: Fix syntax errors resulting in warnings 2021-07-23 16:50:10 -04:00
c41b93bda5 XR: Fix for Viewport Denoising Artifacts
Addresses T76003. When using VR with Eevee and viewport denoising,
scene geometry could sometimes be occluded for one eye. Solution is
to use a separate GPUViewport/GPUOffscreen for each VR view instead
of reusing a single one for rendering.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D11858
2021-07-24 00:12:17 +09:00
eb43477851 Fix T89393: crash when selecting edges when geometry nodes has "on cage" turned on
The core problem is that the geometry nodes modifier sometimes support
"mapping" (i.e. it remembers which new vertices correspond to edit mode
vertices) and sometimes it does not, depending on what the nodes are doing.
Also see rB07ce9910f7cc.

The solution here is that the fallback case in `BKE_mesh_foreach_mapped_edge`
does not call the callback with "invalid" indices.

Differential Revision: https://developer.blender.org/D12007
2021-07-23 16:15:18 +02:00
239a74a130 Fix T90065: disable attribute search in places where there is too little context
Differential Revision: https://developer.blender.org/D12008
2021-07-23 16:13:04 +02:00
6ac378e685 Fix: avoid creating improper rotation matrix
This might change the rotation of some instances after a Curve to Points.
Unfortunately, there is not much we can do about that, the math before
was just wrong. The forward and up axis stayed the same though.

Differential Revision: https://developer.blender.org/D12006
2021-07-23 16:10:03 +02:00
25fc77f46c Fix T89829: wrong active context path check in spreadsheet
The problem was that the modifier was reevaluated all the time, even
between showing the attribute search and clicking on the attribute
name. This freed the data referenced by attribute search. The real bug
here was that the dependency graph was tagged for update even
though nothing changed. This was because the spreadsheet thought
its active context has changed and it wanted to compute the new
value to be shown in the spreadsheet.

The reason for the bug was that I confused how the tree-path of a
node editor works. The second element in the tree path contains
the name of the group node in the root tree that we're in (instead
of the first element).

Differential Revision: https://developer.blender.org/D12009
2021-07-23 16:06:41 +02:00
de2c4ee587 Another slight increase in speed for Delaunay CDT.
When the new "need_ids" flag is false and the output type is not
one of the valid BMesh kinds, there is no need to propagate even
a dummy id to all of the faces.
2021-07-23 08:31:40 -04:00
f23b14091f Cleanup: double spaces in strings 2021-07-23 17:04:21 +10:00
ced94bc11c Cleanup: code comments punctuation / spacing 2021-07-23 17:03:51 +10:00
7ce0d9d791 Cleanup: de-duplicate code for edge-split tagging
Share functionality for single and multi-threaded edge-split tagging.

Remove logic that ensured vert & loop indices in bm_mesh_edges_sharp_tag
(missing from fd9fc809b7).
2021-07-23 16:40:51 +10:00
36c0649d32 XR: Reference Space Improvements
Improves control over the XR reference space by using the stage ref
space (user-defined tracking bounds) instead of local ref space
(position at application launch), if available. Also adds an
"absolute tracking" session option to skip applying eye offsets that
are normally added for placing users exactly at landmarks.

By enabling absolute tracking, users can define the tracking origin
in a way that is not linked to the headset position. Instead, the
tracking values given by the XR runtime are left unadjusted and a
user can manually calibrate an "origin" landmark object to adjust to
their real world space.

Can be useful for applications that use external tracking systems
and those that primarily only need to use controllers and not the
headset (e.g. motion capture).

The absolute tracking option requires an update to the VR
Scene Inspection addon to be accessible by regular users.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10946
2021-07-23 14:54:56 +09:00
66548007a8 Cleanup: "position tracking" typo in enum member 2021-07-23 14:54:24 +09:00
eea65cbd42 Cleanup: remove unused BM_mesh_loop_normals_update function
The only difference with BM_loops_calc_normal_vcos was passing in
custom coordinates which may be NULL.
2021-07-23 15:10:59 +10:00
66dfef10a7 Fix error setting sharp edges in recent normal calculation changes
bm_mesh_edges_sharp_tag was called with setting sharp edges enabled.
Error in 39b2a7bb7e.
2021-07-23 15:02:04 +10:00
fd9fc809b7 Cleanup: remove normal assignment from bm_mesh_edges_sharp_tag
This was added in 0b7f581397
but seems not to be needed as the assignment was never correct
since only one corner on either side of the smooth edge had the
vertex normal written to it.
2021-07-23 14:36:40 +10:00
39b2a7bb7e Edit Mesh: multi-thread auto-smooth sharp-edge calculation
Merge the sharp edge tagging into bm_mesh_loops_calc_normals,
this has the advantage that edge tagging can be performed as part of
walking over each vertices edges - instead of tagging in a separate loop.

Even though this will tag edges twice (once for each vertex),
the computation isn't heavy as it's only calculating a dot-product
between the two face users to compare the angle.

This change combined with 4ba06ad0a8
makes BM_loops_calc_normal_vcos around 5.68x faster,
with an overall speedup over 2.6x when transforming a high poly mesh.
(tested on a system with 32 cores).

Reviewed By: mont29

Ref D11970
2021-07-23 12:55:58 +10:00
4ba06ad0a8 Edit Mesh: multi-thread auto-smooth & custom normal calculations
Supported multi-threading for bm_mesh_loops_calc_normals.

This is done by operating on vertex-loops instead of face-loops.

Single threaded operation still loops over faces since iterating
over vertices adds some overhead in the case of custom-normals
as the order used for accessing loops must be the same as iterating
of a faces loops.

From isolated timing tests of bm_mesh_loops_calc_normals on high
poly models, this gives between 3.5x to 10x speedup,
with larger gains for meshes with custom-normals.

NOTE: this is part one of two patches for multi-threaded auto-smooth,
tagging edges as sharp is still single threaded.

Reviewed By: mont29

Ref D11928
2021-07-23 12:54:17 +10:00
3fb47956c0 Man Page: Fix spelling 2021-07-22 20:13:14 -04:00
Christoph Lendenfeld
fafd21b14c Animation: Generic Slider implementation
Extract the slider gui implemented for the pose slide tools.
Generalise it so it can be used by other tools as well.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9314
Ref: D9314
2021-07-22 23:44:53 +01:00
49e68f15f2 Geometry Nodes: Display Node Warnings in Modifier
With this commit, node warnings added to nodes during evaluation
(not "Info" warnings) will also draw in the modifier. In the future
there could be a "search for this node" button as well.

Differential Revision: https://developer.blender.org/D11983
2021-07-22 17:53:35 -04:00
f76dfe8fb4 Cleanup: Add function to check a curve's spline types
The need for this has come up a few times.
2021-07-22 17:20:04 -04:00
524d172742 Fix: "Bake" automatically calculated handles in set handle node
Because these handles are calculated lazily, we need to make sure they
are calculated before switching to a manually positioned mode.
I doubt it would ever be necessary, but theoretically this could happen
on a per-point level, to avoid calculating handles not in the selection.
2021-07-22 17:11:26 -04:00
Germano Cavalcante
f013e3de81 VSE: Speed Effect layout updates
**Changes:**
- New enums correspond to 4 modes: `Stretch`, `Multiply`, `Frame Number` and `Length`.
- "`Multiply Factor`" has been removed;
- Value corresponding to "`use as speed`" enabled is now the value appended to the `Multiply` enum;
- Value corresponding to "`use as speed`" disabled is now the value appended to the `Frame Number` enum;
- Value corresponding to "`Scale to Length`" enabled is now the value appended to the `Length` enum;
- Except `Stretch` each mode has now its respective control values.

Differential Revision: https://developer.blender.org/D11856
2021-07-22 17:51:07 -03:00
e77a1dc6b0 Fix name used when parsing arguments 2021-07-22 15:29:09 -03:00
1b44b47f69 PyGPU: new method 'GPUFrameBuffer.read_depth'
Method requested by users in order to port addons to new API.
2021-07-22 15:17:48 -03:00
1a91c57320 Compositor: Fix crash when using empty input sources
It's the case of Image or Movie Clip node when not selecting any
source or an empty one.
Render methods expect an output buffer with size, only render
operations with resolution.
2021-07-22 18:51:51 +02:00
b1bf4c2a05 Compositor: Full frame Texture node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-22 18:51:51 +02:00
48e27ad122 Compositor: Full frame Movie Clip node
Adds full frame implementation to this node operation.
No functional changes.
2x faster than tiled fallback.
2021-07-22 18:51:51 +02:00
91e2b1dcaf Compositor: Fix buffer area iterating past the end 2021-07-22 18:51:51 +02:00
5f28a90b34 Compositor: Add coordinates to BuffersIterator
Allows to cover many use cases where iterating both buffers and
coordinates is needed.
2021-07-22 18:05:55 +02:00
97712b018d Fix T90026: attributes added in editmode are lost on modeswitch
When exiting editmode, customdata [and thus attributes] are copied from
**BMesh** to **Mesh** (in `BM_mesh_bm_to_me`).
When adding attributes, these were always added via
`CustomData_add_layer_named` only.
Instead (if we are in mesh editmode), we need to go through
`BM_data_layer_add_named` to properly update the **BMesh** (see
`update_data_blocks`) so we have stuff available to copy back to
**Mesh** when exiting editmode.
Same is done for removing (also going through BMesh).

This is now done, DomainInfo is updated to point to BMesh (instead of
Mesh) customdata when in editmode.

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11998
2021-07-22 17:57:46 +02:00
Johnny Matthews
0e8d1c6bcf Geometry Nodes: Set Bezier Handle Type Node
This node takes a curve and a point selection and allows you to set the
specified (or all) points left/right or both handles to a given type.

Differential Revision: https://developer.blender.org/D11992
2021-07-22 10:55:50 -04:00
320f34af86 Tests: continue running benchmarks if some tests fail to build or run
Convenient when testing many revisions where some might be broken.
2021-07-22 16:35:00 +02:00
19b597c55d Tests: improve finding of Blender executables in benchmarking
* Allow specifying a folder and automatically setting the proper executable
  name depending on the operating system
* Use executables from configs for listing devices instead of a blender
  command being available
2021-07-22 16:34:57 +02:00
f2cce48698 Versioning: move "until next subveresion bump" code
Move "until next subveresion bump" code into the 300.13 version block.
This should have happened in rB8d5b9478a25.
2021-07-22 15:19:58 +02:00
0eccf57161 Cleanup: Silence warning - unused parameter 2021-07-22 08:59:43 -03:00
Yann Lanthony
574995478a Fix T89733: Py API: bpy.data.orphans_purge argument parsing
On Windows, using `bpy.data.orphans_purge` with some arguments (eg: `do_recursive=True`) does not produce the expected results. This is due to arguments not being parsed correctly on this platform with the current code.

The proposed fix is based on how other functions with boolean attributes are exposed to the Python API.

Reviewed By: #python_api, mont29

Maniphest Tasks: T89733

Differential Revision: https://developer.blender.org/D11963
2021-07-22 12:52:37 +02:00
Philipp Oeser
57668d84cf Make polls for removing mesh data layers consistent
This was reported in T90026 for attributes, but was also true for:
- UVMaps
- Vertex Colors
- Sculpt Vertex Colors
- Face Maps

For Vertex groups and Shapekeys this was already done (in that their
remove poll would check if there is a vertex group or shapekey to begin
with), now make this consistent across all mentioned types.

Thx @vvv for the initial patch (where this was done for attributes only)

ref T90026

Reviewed By: HooglyBoogly

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11990
2021-07-22 10:11:44 +02:00
8d5b9478a2 Bump subversion to avoid infinite enabling pose_library add-on
Bump Blender's sub-version to make sure the pose_library add-on isn't
auto-enabled on every run of Blender.
2021-07-22 09:51:52 +02:00
64bb49fa4e Cleanup: Move reorganize asset files
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.

Also corrected the name of `ED_asset_can_make_single_from_context()`.
2021-07-21 20:41:29 +02:00
Germano Cavalcante
178086d581 Draw Cache: extract tris in parallel ranges
The `ibo.tris` extraction in multithread is currently only done if the
mesh has only 1 material.

Now we cache a map indicating the index of each polygon after sort and
thus allow the extraction of tris with materials in multithreaded.

As caching is a heavy operation and was already being performed in
multi-thread for triangle offsets, no significant improvements are
expected.

The benefit will be much greater when we can skip updating the cache
while transforming a geometry.

**Profiling:**
||master:|PATCH:
|---|---|---|
|large_mesh_editing_materials:|Average: 13.855380 FPS|Average: 15.525684 FPS
||rdata 9ms iter 36ms (frame 71ms)|rdata 9ms iter 29ms (frame 64ms)
|subdiv_mesh_final_only_materials:|Average: 28.113742 FPS|Average: 28.633599 FPS
||rdata 0ms iter 1ms (frame 36ms)|rdata 0ms iter 1ms (frame 35ms)

1.1x overall speedup

Differential Revision: https://developer.blender.org/D11445
2021-07-21 15:09:43 -03:00
785d87ee42 Fix T90017: Bone widget drawing inconsistent with editing
The `lines_loose` extractor did not trigger loose geometry caching.
2021-07-21 14:46:53 -03:00
c830c5b16b Cleanup: Move loose geometry cache creation to render data task
This centralizes caching functions.
2021-07-21 14:46:53 -03:00
e850c2b06d Cleanup: Centralize/unify asset library reference from/to enum code
This was an open TODO, I wanted to have code for translating asset
library references from and to enum values in a central place, and
access that in the same way from both the Asset Browser and the
Workspace RNA code.

* Adds own file for the related functions.
* Adds doxygen comments.
* Updates RNA callbacks to properly use these functions.
* Let these functions call each other, avoid duplicating logic.
2021-07-21 19:35:39 +02:00
10e28bd270 Assets: Replace duplicated asset library reference type from DNA
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.

This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
8de2b6a020 Assets: Rename workspace active asset library DNA variable
This new variable was introduced with 7898089de3. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.

This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
952ded57de Cleanup: Add missing doxygen file/group comment in new asset file 2021-07-21 19:35:39 +02:00
581a6da804 Fix incorrect use of BLI_assert with error strings
Some asserts were never raised because of invalid checks.
2021-07-22 00:47:29 +10:00
63da2c4082 Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text) 2021-07-22 00:46:45 +10:00
Yuki Hashimoto
22bef356ae Cleanup: correct the comment in ghost
The same comments were written in clientToScreen and screenToClient in
GHOST. I corrected them.

Ref D11986
2021-07-21 23:14:03 +10:00
3cfd6439c6 Fix bug in assert in delaunay test.
Assert was trying to say x coords of arcs lined up, and didn't do that.
2021-07-21 08:33:29 -04:00
16804297e6 Cleanup: Split set_preview_visibilty. 2021-07-21 14:12:24 +02:00
d1e1d6c491 Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text") 2021-07-21 20:59:19 +10:00
bbcc8330f7 Cleanup: spelling 2021-07-21 20:42:11 +10:00
e7082fbdb0 Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg 2021-07-21 20:39:51 +10:00
ab101d444d Fix T89881: ignore unavailable sockets when searching for link cycles 2021-07-21 11:28:26 +02:00
8b0fac4116 Fix compile issue. 2021-07-21 11:09:52 +02:00
82ff5dd911 Fix i18n utils_cli mistake.
Reported by James Monthea (@jmonteath), thanks.
2021-07-21 10:37:45 +02:00
9aa0a3f533 Cleanup Preview rendering: Separate world preparation.
Small cleanup that moves world preparation out of scene preparation.
2021-07-21 09:35:21 +02:00
75e41b1279 Cleanup: use named enum types.
Added ePreviewRenderMethod and ePreviewType.
2021-07-21 08:18:34 +02:00
265c3a4724 Cleanup: replace NB with NOTE in comments 2021-07-21 13:10:32 +10:00
Smitty van Bodegom
dc8a924efa UI: Use more descriptive wording for particle modifier conversions
Currently the wording is a bit unclear: it doesn't specify //what// the particles will be converted into. This clarifies it by stating what the particles will be converted into: they will either be converted to a mesh or the instances will be made real.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11795
2021-07-20 17:39:25 -04:00
Romain Toumi
14d5a45750 UI: Fix Cycles Materials menu Layout
Fix an incoherence between the Eevee Materials menu and the Cycles Materials menu :

Eevee :
{F10230448}

Cycles :
{F10230449}

Simply Fixed by replacing the Cycles UI code by the Eevee UI code.

Thanks to @Brainzman for helping me create this diff and translate

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11979
2021-07-20 17:23:34 -04:00
807bb450a0 Fix API doc generation after recent context additions 2021-07-20 22:07:41 +02:00
bfe6b55aa7 Fix T89827: Attribute transfer node crash on mesh with no faces
Just add a check for whether the mesh has faces when retrieving an
attribute on the corner domain. In the future there could be an info
message in the node in this case, since maybe it's not intuitive.
2021-07-20 15:56:36 -04:00
d3445496b1 Fix memory leak with asset view template operator properties 2021-07-20 21:50:09 +02:00
cb0b017d8f Cleanup: Store asset-handle in drag data
Would previously pass a few properties that are available via the
asset-handle now. This asset-handle is also required for some of the
asset API, e.g. the temporary ID loading. This will probably be needed
before too long.
2021-07-20 21:30:04 +02:00
0af08cea40 Cleanup: Use asset utility function to get the asset .blend path
For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
2021-07-20 21:30:04 +02:00
e99801390c Cleanup: Move asset-handle functions to own file
Keeps files minimal and focused. I much prefer that over having all
kinds of stuff in general files like `asset_edit.cc`.
2021-07-20 21:30:03 +02:00
5a1b1c0ed2 Cleanup: Getters for asset-handle data
While the asset-handle design is supposed to be temporary (see
35affaa971), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
2021-07-20 21:30:03 +02:00
207df439e1 Cleanup: Use const for internal file data of asset-handle
Note that the current asset-handle design is temporary, see
35affaa971. I still prefer this to be const, as code outside the
asset-list/file-list code should never mess with the file data of an
asset.
2021-07-20 21:30:03 +02:00
36fb03e2b9 Asset: Clearly describe RNA property description as temporary
The asset handle design is only temporary (see 35affaa971) and this
RNA property is only needed for internal, technical reasons of the asset
view template. So although not nice, at least make it clear in the RNA
property description that this should not be used.
2021-07-20 21:30:03 +02:00
8ffc3ee257 Cleanup: Correct asset TODO comment, move setter next to getter 2021-07-20 21:30:03 +02:00
aeee7f390d Fix T89993: Failed assert drawing single point cyclic splines
The same check used for the curve to mesh node.
2021-07-20 14:54:01 -04:00
cf28398471 Fix T89687: Curve to mesh node incorrect face orientation
The new faces should have a winding direction that points them outward,
the fix was swapping the order of each face's edge and vertex indices.
2021-07-20 14:39:24 -04:00
1e063a0242 Cleanup: Use const arguments and less sequential iteration
Using const indexes and offsets helps to make the logic less sequential,
which is hopefully easier to understand and possibly easier to parallelize
in the future. Also order return arguments last.
2021-07-20 14:28:33 -04:00
b65ec08bbb Armature test: properly initialize bone hierarchy
Fix segfault in `BKE_armature_find_selected_bones_test` by property
initializing the bone hierarchy listbases.

No functional changes to Blender.
2021-07-20 19:02:43 +02:00
Jagannadhan Ravi
26b2a35dd4 Speedup rigid body "Copy from Active" operator
If there were lots of selected objects without an existing rigid body,
we would add rigid bodies to them one by one.

This would be slow in python, now we instead do this as a batch
operation in C.

On my (Intel) MacBook it used to take 60 seconds and with this change it
takes about 0.3 seconds.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11957
2021-07-20 18:57:12 +02:00
f53ca7e41c Cleanup: Fix missing braces warning on Clang 2021-07-20 21:03:47 +05:30
6754d7aef6 Pose Library: remove assumption about Action group names
Remove the assumption of the pose library that Action groups are named
after the bones in the armature. Even though this assumption is correct
when the keys are created by Blender, action groups can be renamed. Keys
created by Python scripts can also use arbitrary group names.

Since there is more code in Blender making this assumption, and looping
over selected bones is also a common occurrence, this commit contains
some generic functionality to aid in this:

- `BKE_armature_find_selected_bones`: function that iterates over all
  bones in an armature and calls a callback for each selected one. It
  returns a struct with info about the selection states (all or no bones
  selected).
- `BKE_armature_find_selected_bone_names(armature)` uses the above
  function to return a set of selected bone names.
- `BKE_pose_find_fcurves_with_bones()` calls a callback for each FCurve
  in an Action that targets a bone, also passing it the bone name.
2021-07-20 17:12:01 +02:00
c4f71f3193 Cleanup: fix clang-tidy warning readability-qualified-auto
No functional changes.
2021-07-20 17:11:29 +02:00
3e4c98429b Cleanup: fix clang-tidy readability-else-after-return
No functional changes
2021-07-20 17:11:29 +02:00
f763929486 Cleanup: fix clang-tidy warning modernize-use-nullptr
No functional changes.
2021-07-20 17:11:29 +02:00
3ea4c6b9c9 Pose backup: convert from C to C++
Convert `pose_backup.c` (in C) to `pose_backup.cc` (in C++). This will
make future improvements easier. For now, it's the same code with just
some additional explicit casts (C++ doesn't allow implicitly casting
`void *`), `NULL` changed into `nullptr`, and some other simple changes.

No functional changes.
2021-07-20 17:11:29 +02:00
f164188a6d Fix T89981: missing refresh on the compositors render layer node when adding/removing AOVs
Just refresh the node's outputs via ntreeCompositUpdateRLayers().

Maniphest Tasks: T89981

Differential Revision: https://developer.blender.org/D11973
2021-07-20 17:00:01 +02:00
3e29175af3 Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context
When done from the Properties Editor, the context's modifier should be
used (this is where the button is located), when done from elsewhere,
the active modifier is still the way to go (since the context modifier is
not available then)

Maniphest Tasks: T89982

Differential Revision: https://developer.blender.org/D11972
2021-07-20 16:53:34 +02:00
Johnny Matthews
83b6fcc70c Fix: Bezier segment node adds handles incorrectly
This caused the "cyclic" attribute to appear dysfunctional.
2021-07-20 09:58:24 -04:00
76a3ff70d5 Fix T89979: Assert in edit mode with curve to mesh node
The node tagged polys normals dirty,  but the function to calculate the
normals didn't clear the dirty flags for polys. Now clear the poly and
corner dirty normal flags.
2021-07-20 09:37:40 -04:00
c3a400b73f Cleanup: use single back-tick quoting in comments
While doxygen supports both, conform to our style guide.

Note that single back-tick's are already used in a majority of comments.
2021-07-20 22:58:14 +10:00
48a45c43e4 Cleanup: use doxygen style parameters in noise.c
These used their own ad-hoc syntax.
2021-07-20 22:54:48 +10:00
9e1fdd1f14 Cleanup: added const keyword to BLI_dlrbTree search functions. 2021-07-20 14:49:49 +02:00
6c5f8bf5aa Cleanup: Remove redundant forward declarations. 2021-07-20 14:49:49 +02:00
9471715720 Fix crash in delaunay C interface test.
The test forgot to set the new need_ids field, which luckily
exposed a bug in the C api for delaunay when that field is false.
Fixed the bug and the test, and added a test for the need_ids false
case.
2021-07-20 07:28:46 -04:00
75c9788c27 Compositor: Fix crash when connecting multiple constant inputs
Operation receiving inputs was being folded more than once
when it was constant foldable.
2021-07-20 12:31:40 +02:00
d218ba8009 LineArt: UI cleanups.
Wording on the UI, slider consistency and material mask switches layout.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: http://developer.blender.org/D11839
2021-07-20 13:06:45 +08:00
77e927b58f Cleanup: reserve C++ comments for disabled code
Use C comments for plain text.
2021-07-20 15:01:05 +10:00
fe2f43a15c Cleanup: use '#if 0' for disabling multiple lines 2021-07-20 15:01:03 +10:00
59eb71afa1 Cleanup: Make function static, use const object argument
Also use `const Curve *` instead of `const Object *`, since the
function works at a lower level than objects anyway.

And also remove another unused function. Since this section of code
for converting curves to meshes will likely be replaced, it's nicer to
see which parts actually remain used at this point.
2021-07-19 21:19:59 -04:00
0e9c04a3ea Cleanup: spelling 2021-07-20 11:12:24 +10:00
cf8ea741f2 Cleanup: quiet GCC maybe-uninitialized warning
Function signatures for snap callbacks used `const` incorrectly
which was hidden by casting function types.

This made it seem as if the input arguments wouldn't be change and
wouldn't be initialized.

Name return arguments with an `r_` prefix, order them last,
remove function casts and correct `const` usage.
2021-07-20 11:12:24 +10:00
0733926a34 Cleanup: Remove unused function 2021-07-19 20:51:57 -04:00
24aae7ed63 Docs: Update RNA to user manual mappings 2021-07-19 18:41:58 -04:00
3021f9b48c Cleanup: Clang format 2021-07-19 17:12:01 -04:00
468765d29e Compositor: Export operation results as debug option
When fixing issues, seeing operation results can be helpful for
detecting which operation went wrong.

This commit adds an option for exporting all operations results to
image files.
Exceptions are:
- Output operations: They are already exported or can be seen in UI.
- Constant operations: There are too many and is rarely useful.

They are exported to "<temp session folder>/COM_operations/"
with filenames "<operation class name>_<operation id>.png".
Only works on full frame execution mode.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11722
2021-07-19 22:05:39 +02:00
9aa88a6604 Compositor: Full frame Brightness node
Adds full frame implementation to this node operation.
No functional changes.
2.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11677
2021-07-19 22:05:39 +02:00
b35efa932e Compositor: Full frame Mix node
Adds full frame implementation to this node operations.
No functional changes.
2.3x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11686
2021-07-19 22:05:39 +02:00
300fe84bf0 Compositor: Full frame Viewer node
Adds full frame implementation to this node operation.
No functional changes.
No performance changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11698
2021-07-19 22:05:39 +02:00
b848d5cdf5 Compositor: Full frame Double Edge Mask node
Adds full frame implementation to this node operation.
No functional changes.
No performances changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11750
2021-07-19 22:05:39 +02:00
0a0c2c0217 Compositor: Full frame Ellipse Mask node
Adds full frame implementation to this node operation.
No functional changes.
3x times faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11635
2021-07-19 21:26:58 +02:00
45b46e5de9 Compositor: Buffer iterators
Currently we mostly iterate buffer areas using x/y loops or through
utility methods extending from base classes.

To simplify code in simple operations this commit adds wrappers for
specifying buffer areas and their iterators for raw buffers with any
element stride:
- BufferRange: Specifies a range of contiguous buffer elements from a
 given element index.
- BufferRangeIterator: Iterates elements in a BufferRange.
- BufferArea: Specifies a rectangle area of elements in a 2D buffer.
- BufferAreaIterator: Iterates elements in a BufferArea.
- BuffersIterator: Simultaneously iterates an area of elements in an
 output buffer and any number of input buffers.
- BuffersIteratorBuilder: Helper for building BuffersIterator adding
 buffers one by one.
For iterating areas coordinates it adds `XRange` and `YRange` methods
that return `IndexRange`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11882
2021-07-19 20:06:21 +02:00
582c5530b6 Cleanup: Move asset library reference C++ wrapper to own files
Although currently only the asset list code uses the asset library
reference wrapper, it can stand on its own and may be used in more
places in the future. So I prefer to give it its own source & header
file.

Also removed unused includes, added proper namespaces as per our C++
style guidelines, and removed an unnecessary TODO comment.
2021-07-19 18:28:27 +02:00
ebe32e01e1 Cleanup: Remove unused function, unused declaration 2021-07-19 11:56:52 -04:00
07a77816a1 Fix some mesh edition macro operators incorrectly setting an empty description string.
No operator or macro should be missing description. But if they do, then
they should use NULL pointer, and not an empty string.

This behavior was already enforced (through an assert) for operators,
previous commit made it the same for macros.
2021-07-19 16:05:24 +02:00
bae1b64525 Fix broken 'undocumented' case in registration of Macro opertators.
Code dealing with macro operators missing description field was slightly
different than the one from Operator registration.

This lead to invalid memory accesses in some python introspection cases
like the i18n messages extraction code in `bl_i18n_utils` module.
2021-07-19 16:05:24 +02:00
132522cba8 Cleanup: Separate keyframes_draw and keyframes_keylist.
The keylist functions are used in other places for none drawing related
stuff. Fe pose_slide uses it.
2021-07-19 15:53:04 +02:00
ceb612a79c Revert "Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'"
This reverts commits
 bfa3dc91b7,
 52b94049f2,
 ae379714e4,
 a770faa811,
 4ed029fc02,
 101a493ab5 and
 62a2faa7ef.

And fixes T89955.

Changing the dependency graph is a can of worms and the result is
a kind of unpredictable.

A different solution will be planned.
2021-07-19 10:17:38 -03:00
62a2faa7ef Object update: Remove fallback from batch_cache_deform_tag
Falback is not really necessary, and causes
`BKE_object_data_batch_cache_dirty_tag` to run multithreaded in an
unsafe way.

No functional changes.
2021-07-19 09:50:53 -03:00
101a493ab5 Fix T89941: No path`s bevel update, when I change bevel profile curve
Update was skipping the batch cache.
2021-07-19 09:47:56 -03:00
ff01070b5c Cleanup: minor correction to delaunay_2d_cdt doc-string
Use more conventional syntax for default arguments.
2021-07-19 11:57:28 +10:00
ee857cc266 Cleanup: remove unused pathlib import 2021-07-19 11:30:27 +10:00
ad7455cd14 Cleanup: remove unused MTex.pmapto, pmaptoneg & defines
These have not been in use since 2.57
fafbd9d71b.
2021-07-19 11:24:24 +10:00
83883ae66a Fix: memcpy overlapping region ASAN warning in curve trim node 2021-07-18 19:24:11 -04:00
75ae328d62 Cleanup: Make curve trim node code more semantically correct
The code used `Spline::LookupResult` in a way that referred to evaluated
points and control points interchangeably. That didn't affect the logic,
but the code became harder to read. Instead, introduce a local struct
to contain the data in a more obvious way.
2021-07-18 19:20:57 -04:00
76f0ef294a Update documentation string for mathutils.geometry.delaunay_2d_cdt. 2021-07-18 15:24:12 -04:00
72d1ddfc9c Make it optional to track input->output mapping in delaunay_2d_calc.
Some uses of delaunay_2d_calc don't need to know the original verts,
edges, and faces that correspond to output elements.
This change adds a "need_ids" value to the CDT input spec, default true,
which tracks the input ids only when true.
The python api mathutils.geometry.delaunay_2d_cdt gets an optional
final bool argument that is the value of need_ids. If the argument
is not supplied, it is true by default, so this won't break old uses
of the API.

On a sample text test, not tracking ids save about 30% of the runtime.
For most inputs the difference will not be so dramatic: it only really
kicks in if there are a lot of holes.
2021-07-18 15:10:34 -04:00
4ed029fc02 Fix T89929: Crash when hiding in the render a previously keyframed volume
Regression introduced in {rBbfa3dc91b754}.

`ID_RECALC_GEOMETRY` should tag all operations of the `GEOMETRY`
component and not just the operation of node `GEOMETRY_EVAL_INIT`.
2021-07-18 15:11:44 -03:00
Angus Stanton
e7a800c52f Geometry Nodes: Curve Trim Node
This node implements shortening each spline in the curve based on
either a length from the start of each spline, or a factor of the
total length of each spline, similar to the "Start & End Mapping"
panel of curve properties.

For Bezier curves, the first and last control points are adjusted
to maintain the shape of the curve, but NURB splines are currently
implicitly converted to poly splines.

The node is implemented to avoid copying where possible, so it outputs
a changed version of the input curve rather than a new one.

Differential Revision: https://developer.blender.org/D11901
2021-07-18 14:09:38 -04:00
24801e0a4a Speed up Delaunay raycast.
From Erik Abrahamsson, this uses parallel loops for raycasting.
It speeds up one example with many crossings of a bezier curve,
from 0.68s to 0.28s.
2021-07-18 12:13:41 -04:00
fc32567cda Versioning: fix vertex group name loss in linked duplicates.
After rB3b6ee8cee708 by @HooglyBoogly vertex groups were moved
to mesh data, and versioning code was provided to upgrade old
files. However, it fails to consider the case of linked duplicates
having different name lists, and dependent on the object order
can cause some of the names to be lost. This can even be all of
them, if there is a duplicate without any names, which can be
easily created by lazy Python code.

To fix this, change the code to use the longest available name list.

Differential Revision: https://developer.blender.org/D11958
2021-07-18 19:09:56 +03:00
Angus Stanton
9eafdb985d Fix: Incorrect logic in spline lookup function
This section of code deals with evaluated points,
so that is the size it should use.
2021-07-18 11:59:23 -04:00
3c8d261557 Greatly improve speed of Delaunay when have a lot of holes.
Using part of a patch from Erik Abrahamsson, this replaces the
use of linked lists for original id tracking by Sets.
I had thought that the lists were unlikely to grow to more than
a few elements, but when the mesh has a lot of holes (whose
original ids go *outside* the hole, and therefore, most of the
mesh), this assumption can be very wrong.
On a Text regression test, the time went from 11.67s to 0.16s
with this fix. I also tested to make sure that Boolean didn't
slow down with this, and found it actually had a very slight speedup.

Using Sets exposed a dependency on the ordering of the items
in the id lists, luckily caught by a mesh intersect regression test,
so fixed that.
2021-07-18 10:48:57 -04:00
Jesse Yurkovich
e82c5c6607 Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero.

Clamp at 1 to prevent a crash, also add an assert to scaling functions.

Ref D11956
2021-07-18 10:44:02 +10:00
118803893e Cleanup: Simplify realizing of pointcloud instances
Just a small change to make the function slightly shorter.
2021-07-16 15:29:42 -04:00
0793ced8ad Fix T89624: Vertex painting causes mesh to flicker
The `ibo.lines_paint_mask` extractor doesn't have a callback to iterate
bmesh faces, this made `filter_into` ignore the extractor.
2021-07-16 16:20:05 -03:00
e7b441a05c Cleanup: Simplify logic, use C++ types
Also remove an unecessary null check, and make inner loop simpler.
2021-07-16 13:32:25 -04:00
53743adc29 VSE: Fix multicam splitting all selected strips
`split_multicam` used split operator, where if more strips than
multicam were selected, all would be split, which is undesirable.

Add `Sequence.split()` RNA API function. to split individual strips.
Function accepts `frame` and `split_method arguments`. Returns right
strip after splitting.

In case when strip being split have effects, these will be split too, so
no invalid state should be created.

Selection is not handled, this is by design up to user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11926
2021-07-16 19:16:35 +02:00
1dcf0f9cf1 Fix T89722: Duplicate macro can cause strips to overlap
Bug caused by 78693d524c accidentally removing overlap handling when
transform operator is canceled.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11899
2021-07-16 19:16:35 +02:00
feba1fe974 Cleanup: Move gpencil_geom.c to C++
This will help enable development on optimizations to the perimeter
calculation here. Using C++ data structures like Array can make the
code easier to read as well.

Longer term, this can help improve integration with attributes
and possibly the new curve code (since strokes and curves are
quite similar in theory).

Differential Revision: https://developer.blender.org/D11941
2021-07-16 13:00:33 -04:00
c4df8ac1a4 Fix T89899: Crashes when accessing vertex groups from objects
We need to be more strict about trying to retrieve a list of vertex group
names from objects now, as only three object types support them.
This commit adds a check for vertex group support in a few places, the
data transfer operator/modifier, copying vertex groups to selected
objects, and the vertex group remove and clear functions.

Differential Revision: https://developer.blender.org/D11947
2021-07-16 12:23:55 -04:00
6025897cd6 Cleanup: Get vertex group names directly from grease pencil data 2021-07-16 12:05:21 -04:00
802a59a58a Cleanup: Remove redundant logic
The object type was checked twice unnecessarily. Also use a function
for the check to be more explicit.
2021-07-16 12:02:38 -04:00
1ab6d5c1dc Surface Deform: support sparse binding mode for improving performance.
When a vertex group is used to limit the influence of the modifier
to a subset of vertices, binding data for vertices with zero weight
is not needed. This wastes memory, disk space and CPU cycles.

If the vertex group contents is known to be final and constant,
it is reasonable to optimize by only storing data group vertices.
This has to be an option in case the group can change.

Supporting this requires adding a vertex index field and spliting
the vertex count into mesh and bind variants, but both happen to
fit in available padding. The old numverts field is renamed to the
new bound vertex count field to maintain the array length invariant.
Versioning is used to initialize the other new fields.

If a file with sparse binding is opened in an old blender version,
it is corrupted into a non-sparse bind with vertex count mismatch,
preventing the modifier from working until rebind.

Differential Revision: https://developer.blender.org/D11924
2021-07-16 16:12:00 +03:00
a770faa811 Fix T89875: False dependency cycle on particle systems
`POINT_CACHE_RESET` pointed to `GEOMETRY_EVAL_INIT` while
`GEOMETRY_EVAL_INIT` pointed to `POINT_CACHE_RESET`.

Now `POINT_CACHE_RESET` points to the same nodes pointed to by
`GEOMETRY_EVAL_INIT` thus avoiding the dependency cycle.
2021-07-16 09:53:00 -03:00
15cfb375a3 Fix T89782: Segfault populating popup menu with dimensions above the opengl limit
The crash happens because `GPU_offscreen_create` is called with `err_out` `NULL`.

This patch proposes a solution within the `GPU_offscreen_create` itself
and raises an error report in the interface if a menu is called with
dimensions beyond what is supported.

Ref T89782

Maniphest Tasks: T89782

Differential Revision: https://developer.blender.org/D11927
2021-07-16 09:53:00 -03:00
e78e235cc5 Cleanup: preview rendering, update assumptions in comment
The `action_preview_render()` function used to just render, but now it
also temporarily applies the pose. Its comment is now updated for this.

No functional changes.
2021-07-16 14:48:03 +02:00
3ec9681ac4 Rename UI error message on attributes panel for name collisions
* Name Collisions > Name collisions
* Info icon > Error icon
2021-07-16 14:36:44 +02:00
038345fa56 Fix T89861: Checking face selection breaks UV stitch operator 2021-07-16 17:47:42 +10:00
38131cc5e5 Fix T70356: Scaling up 1x1 pixel image reads past buffer bounds
Also resolve a crash when when displaying thumbnails, see T89868.
2021-07-16 16:58:06 +10:00
f61f4c89bb Cleanup: reduce variable scope in task_iterator.c
Would have prevented the error in
15cdcb4e90.
2021-07-16 14:39:57 +10:00
e26887598f Fix error using uninitialized state in BLI_task_parallel_mempool
Single threaded operation used the state before it had variables
written into it.

Error in 15cdcb4e90.
2021-07-16 12:07:03 +10:00
42017b006e Cleanup: sort struct declarations 2021-07-16 11:48:54 +10:00
bf5b1fa726 Cleanup: remove redundant parentheses 2021-07-16 11:45:52 +10:00
09b89da349 Cleanup: spelling in comments 2021-07-16 11:45:51 +10:00
d3c454d66c Cleanup: compiler warnings 2021-07-16 11:45:03 +10:00
Aidan Haile
98c4224ff0 Fix T49944: Compositor ID Mask Anti-Aliasing not working
Replaces current ID Mask node Anti-Aliasing operation by SMAA
operations with default settings as proposed by Jeroen Bakker.
SMAA produces smoother edges.

Reviewed By: manzanilla

Differential Revision: https://developer.blender.org/D11881
2021-07-15 22:23:31 +02:00
Red Mser
eccd03a826 UI: Flip driver editor debug lines
In driver editor, vertically flip the value debug lines to align
them with the timeline header values. This makes it easier to read
the values. Also set the line width explicitly, which was incorrect
in some cases.

Differential Revision: https://developer.blender.org/D8877
2021-07-15 15:20:37 -04:00
7d618b4dde Cleanup: Clang tidy 2021-07-15 13:40:30 -04:00
a566dc25aa Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2021-07-15 13:36:40 -04:00
9d9c879f4b Cleanup: Move UI list template code to own file (C++)
This move was already prepared with 788d380460 and 26b098c04f. The
template is quite big already, better to give it its own file. Plus it
could use some C++ features like RAII and maybe some more object
oriented code. I plan further refactoring there.
2021-07-15 19:09:49 +02:00
0cc2a72f94 Fix failing tests from vertex group name parameter copy
It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.

Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.

Fixes T89877, and also the failing `deform_modifiers` test.

Differential Revision: https://developer.blender.org/D11936
2021-07-15 12:25:36 -04:00
3af0e1f6fd Cleanup: unused variable capture 2021-07-15 18:07:03 +02:00
34771cc9f5 Animation/add-ons: Enable the poselib add-on by default
The new Asset Browser-based pose library is partially implemented in an
add-on. This commit enables the add-on by default, as the old pose
library was built-in and thus always enabled.

The ability to disable the add-on is there mostly for cases where
people/studios want to use their own custom pose library.
2021-07-15 16:19:08 +02:00
72c34068cb Fix T88281: Pose Library 'flip pose' sometimes flips wrong
Correct cases where the X-axis of the bone (in pose space) aligns with
the pose-space Y or Z-axis. In these cases the decomposition of the
matrix fails, and a negative scale of the X-axis turns into a 180°
rotation around the Y-axis. An extra -1 scale to the X and Z axes of the
resulting matrix seems to fix things.
2021-07-15 16:12:37 +02:00
f52e3aa210 Asset Browser: Python mixin utility for category-specific panels
Using this mixin for a panel definition, it's possible to set in which
categories the panel should appear. This is used by the Pose Library
add-on.
2021-07-15 16:12:36 +02:00
8925d3b7bf UI/Assets: Initial Asset View UI template
The asset view UI template is a mini-version of the Asset Browser that
can be placed in regular layouts, regions or popups. At this point it's
made specifically for placement in vertical layouts, it can be made more
flexible in the future.
Generally the way this is implemented will likely change a lot still as
the asset system evolves.

The Pose Library add-on will use the asset view to display pose
libraries in the 3D View sidebar.

References:
* https://developer.blender.org/T86139
* https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building
* https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport

Notes:
* Important limitation: Due to the early & WIP implementation of the
  asset list, all asset views showing the same library will show the
  same assets. That is despite the ID type filter option the template
  provides. The first asset view created will determine what's visible.
  Of course this should be made to work eventually.
* The template supports passing an activate and a drag operator name.
  The former is called when an asset is clicked on (e.g. to apply the
  asset) the latter when dragging (e.g. to .blend a pose asset). If no
  drag operator is set, regular asset drag & drop will be executed.
* The template returns the properties for both operators (see example
  below).
* The argument list for using the template is quite long, but we can't
  avoid that currently. The UI list design requires that we pass a
  number of RNA or custom properties to work with, that for the Pose
  Libraries should be registered at the Pose Library add-on level, not
  in core Blender.
* Idea is that Python scripts or add-ons that want to use the asset view
  can register custom properties, to hold data like the list of assets,
  and the active asset index. Maybe that will change in future and we
  can manage these internally.

As an example, the pose library add-on uses it like this:
```
activate_op_props, drag_op_props = layout.template_asset_view(
    "pose_assets",
    workspace,
    "active_asset_library",
    wm,
    "pose_assets",
    workspace,
    "active_pose_asset_index",
    filter_id_types={"filter_action"},
    activate_operator="poselib.apply_pose_asset",
    drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
```
2021-07-15 16:12:36 +02:00
6bd42baaeb Cleanup: Use const for UI icon getter function 2021-07-15 16:12:36 +02:00
26b098c04f UI: Support defining UI lists in C
So far all UI lists had to be defined in Python, this makes it possible
to define them in C as well. Note that there is a whole bunch of special
handling for the Python API that isn't there for C. I think most
importantly custom properties support, which currently can't be added
for C defined UI lists.

The upcoming asset view UI template will use this, which needs to be
defined in C.

Adds a new file `interface_template_list.cc`, which at this point is
mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition.
I plan a separate cleanup to move the UI-list template to that file.
2021-07-15 16:12:36 +02:00
bc4f99aa86 UI: New button/widget type for Asset Browser like preview tiles
This button type shows a preview image above centered text, similar to
the File Browser files in Thumbnail Display Mode or the default Asset
Browser display. In fact we may want to port these over to use the new
button type at some point.

Will be used by the asset view UI template that will be added in a
following commit. That is basically a mini version of the Asset Browser
that can be displayed elsewhere in the UI.
2021-07-15 16:12:36 +02:00
0c83ef567c UI: Auto-scroll to keep active text buttons in view
If a text button is activated that is not in view (i.e. scrolled away),
the scrolling will now be adjusted to have it in view (with some
small additional margin). While entering text, the view may also be
updated should the button move out of view, for whatever reason. For the
most part, this feature shouldn't be needed and won't kick in, except
when a clicked on text button is partially out of view or very close to
the region edge. It's however quite important for the previously
committed feature, that is, pressing Ctrl+F to start searching in a UI
list. The end of the list where the scroll button appears may not be in
view. Plus while filtering the number of visible items changes so the
scrolling has to be updated to keep the search button visible.

Note that I disabled the auto-scrolling for when the text button spawned
an additional popup, like for search-box buttons. That is because
current code assumes the button to have a fixed position while the popup
is open. There is no code to update the popup position together with the
button/scrolling.

I also think that the logic added here could be used in more places,
e.g. for the "ensure file in view" logic the File Browser does.
2021-07-15 16:12:36 +02:00
89fd3afd1e UI: Support pressing Ctrl+F over UI lists to search
Adds an operator invoked by default with Ctrl+F that while hovering a UI
list, opens the search field of the list and enables text input for it.
With this commit the search button may actually be out of view after
Ctrl+F still. The following commit adds auto-scroll to solve that.

A downside is that in the Properties, there also is Ctrl+F to start
the editor-wide search. That's not unusual in Blender though (e.g.
scolling with the mouse over a UI list also scrolls the list, not the
region).
2021-07-15 16:12:36 +02:00
87c1c8112f UI: Support UI list tooltips, defined via Python scripts
Makes it possible to create tooltips for UI list rows, which can be
filled in .py scripts, similar to how they can extend other menus. This
is used by the (to be committed) Pose Library add-on to display pose
operations (selecting bones of a pose, blending a pose, etc).

It's important that the Python scripts check if the UI list is the
correct one by checking the list ID.
For this to work, a new `bpy.context.ui_list` can be checked. For
example, the Pose Library add-on does the following check:
```
def is_pose_asset_view() -> bool:
  # Important: Must check context first, or the menu is added for every kind of list.
  list = getattr(context, "ui_list", None)
  if not list or list.bl_idname != "UI_UL_asset_view" or list.list_id != "pose_assets":
    return False
  if not context.asset_handle:
    return False
  return True
```
2021-07-15 16:12:36 +02:00
8edcb3af96 UI: Support left-right arrow key walk navigation in UI lists
Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.

Note from Julian:
In combination with the following commit, this has the important
limitation that the list's custom activate operator won't be called when
"walking over" an item that is scrolled out of the list. That is because
we don't actually create any buttons for those that could be used for
the handling logic. For our purposes of the pose libraries that should
be fine since the asset view list is always made big enough to display
all items. Solving this might be difficult, we don't properly support
nesting boxes with proper scrolling in regular layouts. It's all just
hacked a bit for UI-lists to work. Overlaps quite a bit with T86149.

Differential Revision: https://developer.blender.org/D11063
2021-07-15 16:12:36 +02:00
ae1dc8f5f9 UI: Internal support for custom UI list item drag & activate operators
For pose libraries, we need to be able to apply a pose whenever
activating (clicking) an item in the Pose Library asset view and blend
it by dragging (press & move). And since we want to allow Python scripts
to define what happens at least when activating an asset (so they can
define for example a custom "Apply" operator for preset assets), it
makes sense to just let them pass an operator name to the asset view
template. The template will be introduced in a following commit.
2021-07-15 16:12:36 +02:00
00c7ea68a8 UI: New UI list layout type for big preview tiles
This new layout type is meant for the upcoming asset view UI template.
With it it is possible to show big asset previews with their names in a
responsive grid layout.

Notes:
* The layout is only available for C defined UI lists. We could expose
  it to Python, but I think there are still some scrolling issues to be
  fixed first. (The asset view template doesn't use scrolling for the UI
  list.)
* I'd consider this a more usable version of the existing `GRID` layout
  type. We may remove that in favor of the new one in future.
2021-07-15 16:12:36 +02:00
788d380460 UI: UI list refactor & preparations for asset view template
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.

No functional changes for users.

* Split the huge template function into more manageable functions, with
  clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
  callback called from BKE. This is UI data and should be managed at
  that level.
* Replace boolean arguments with bit-flags (easily extendable and more
  readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
  .blends) into function. This is a quite important bit and a later
  commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.

As part of further cleanups I'd like to move this to an own file.
2021-07-15 16:12:36 +02:00
6e01b52100 Assets: temporarily apply pose when generating preview image
When generating a preview image for a pose, temporarily apply it to the
armature. Contrary to the usual pose application, this ignores the
selected bones and always applies the entire pose.
2021-07-15 16:12:36 +02:00
f3610a23d1 Animation: new pose library based on Asset Browser
Introduce new pose library, based on the Asset Browser. Contrary to the
old pose library (in `editors/armature/pose_lib.c`), which stored an
entire library of poses in an `Action`, in the new library each pose is
its own `Action` datablock. This is done for compatibility with the
asset browser, and also to make it easier to attach preview images,
share datablocks, etc. Furthermore, it opens the door to having
animation snippets in the pose library as well.

This commit contains the C code for the pose library; in order to fully
use it, an addon is required as well (which will be committed shortly).
2021-07-15 16:12:36 +02:00
28dc07a153 Animation: add function to blend Action into pose
Add function `BKE_pose_apply_action_blend()`, which blends a given
Action into current pose. The Action is evaluated at a specified frame,
and the result is applied to the armature's pose.

A blend factor can be given to blend between the current pose and the
one in the Action. Quaternions are interpolated with SLERP; it is
assumed that their FCurves are consecutively stored in the Action.

This function will be used in the upcoming new Pose Library.
2021-07-15 16:12:36 +02:00
9473c61b36 Animation: apply pose to all or selected bones of armature
New function `BKE_pose_apply_action_all_bones()`, which will be
necessary for the upcoming pose library v2.0.

This renames the function `BKE_pose_apply_action` to
`BKE_pose_apply_action_selected_bones`, to reflect that it only works on
selected bones, to contrast it to the new function.
2021-07-15 16:12:36 +02:00
b40e05fcd1 Assets: Open Blend File operator
Add operator 'Open Blend File' to the Asset Browser. This operator:
- starts a new Blender process,
- opens the blend file containing the asset,
- monitors the new Blender process, and when it stops,
- reloads the assets to show any changes made.
2021-07-15 16:12:36 +02:00
637731dc61 Assets: Abstraction for temporary loading of asset data-blocks
This is an editor-level abstraction for the `BLO_library_temp_xxx()`
API for temporary loading of data-blocks from another Blend file. It
abstracts away the asset specific code, like asset file-path handling
and local asset data-block handling.

Main use-case for this is applying assets as presets that are based on
data-blocks, like poses. Such preset assets are an important part of the
asset system design, so such an abstraction will likely find more usage
in the future.
2021-07-15 16:12:36 +02:00
55d48defc5 File/Asset Browser: Extend file-entry and asset handle Python API
Adds the following to `bpy.types.FileSelectEntry`:
* `id_type`: The data-block type the file represenets, if any.
* `local_id`: The local data-block it represents, if any (assets only).

And the following to `bpy.types.AssetHandle`:
* `local_id`: The local data-block the asset represents, if any.

This kind of information and the references are important for asset related
operators and UIs. They will be used by upcoming Pose Library features.
2021-07-15 16:12:36 +02:00
a26a059244 Assets: Initial Asset List as part of the Asset System design
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.

See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184

Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.

Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
  gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
  eternally for asset views. File Browsers have this issue too, but
  should be fixed separately.
2021-07-15 16:12:36 +02:00
add6fa0924 Assets: Show asset path in asset browser sidebar
It's useful to know where an asset is stored in, before this there was no way
to tell this. This could probably be displayed nicer in the UI but we're
currently unsure how. But at least the information is there now.
2021-07-15 16:12:36 +02:00
35affaa971 Assets: AssetHandle type as temporary design to reference assets
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.

However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
2021-07-15 16:12:36 +02:00
3feb3ce32d Assets: Expose active asset library in context
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.

This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
2021-07-15 16:12:36 +02:00
7898089de3 Assets: Add an active asset library per workspace, for the UI to use
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.

As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
2021-07-15 16:12:36 +02:00
Robert Sheldon
59f9a5e6ac Fix T88188: Allow keyframing vertex mass in cloth sim
Update vertex weights between simulation steps if they have changed.
This allows for animated vertex weights in the cloth sim.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11640
2021-07-15 16:09:24 +02:00
60fee69682 Library loading: Fix access of out-of-scope memory in py context manager
The `__enter__` function of the `bpy.data.libraries.load` context manager
was storing a pointer to a stack-allocated variable, which was subsequently
used in the `__exit__` function, causing a crash. This is now fixed.

Thanks @Severin for the patch.
2021-07-15 16:04:22 +02:00
Paul Golter
3df40cc343 Fix: Subtitles: Order of channels in the .blend file will be kept in the .rst file.
If text strips have the same start frame but are stacked on top of each
other in different channels the order in which they are written in the
.rst file was random before.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11903
2021-07-15 15:49:25 +02:00
Heinrich Schuchardt
468d59e496 Add support for RISC-V architecture
* On RISC-V GCC 10.3 does not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n.
* Avoid a build error
  "Please add support for your platform in build_config.h"
  Cf: https://github.com/sergeyvfx/libNumaAPI/pull/3

Differential Revision: https://developer.blender.org/D11910
2021-07-15 14:22:35 +02:00
709e443152 Cleanup: LayerCollection resync: Proper r_ prefix for return function parameter. 2021-07-15 14:06:09 +02:00
ddc7e5f1b6 Cleanup: improve comments, remove debug printf 2021-07-15 21:09:39 +10:00
e509f9c3a0 Keymap: use Shift-Tab to toggle snap in the sequencer
Match the same shortcut for the 3D view & UV editor.
2021-07-15 20:58:13 +10:00
e7e5fd96c4 Cleanup: LayerCollection resync code.
Mainly naming (also droping the `layer_collection`  in favor of just
`layer` for internal code, this is clear enough and much shorter). Add
proper parent/child identifiers, `r_` prefix for parameters also used as
return values, etc.

Also made some parameters const.
2021-07-15 12:49:43 +02:00
2e8641e45e Fix: crash when creating new node links
This was a regression in rBc27ef1e9e8e663e02173e518c1e669e9845b3d1f.
2021-07-15 12:43:59 +02:00
ae30f72c80 Fix T89870: Vertex groups lost when opening 3.0 files in 2.93
The original refactor for vertex groups (3b6ee8cee7)
forgot to bump the minimum file requirement.

I'm also bumping the subversion to 12 so everyone can switch to a
working subversion number.

Differential Revision: https://developer.blender.org/D11931
2021-07-15 12:23:34 +02:00
49b798ca7e macOS/glog: Silence syscall deprecation warning
Upstream will release the fix in 0.6 which will take time.
Silence two warnings.

Differential Revision: https://developer.blender.org/D11246
2021-07-15 15:23:06 +05:30
c614eadb47 Keymap: use Alt-Q instead of D for transfer mode operator
This now works in all modes (not just sculpt) and activates on press
instead of release. See design task T89757.
2021-07-15 19:13:22 +10:00
757ec00f83 Revert "Keymap: use D-Key for view-pie menu"
This reverts commit f92f5d1ac6.

See: T89757 for rationale for reverting this change.
2021-07-15 19:13:22 +10:00
de913516dd Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
2021-07-15 11:07:41 +02:00
c27ef1e9e8 Geometry Nodes: dim links whose start and end sockets are not visible
This makes node trees with long links that cross other nodes easier to work with.
Dimmed links will be ignored by various modal operators like cut and reroute insertion.

Differential Revision: https://developer.blender.org/D11813
2021-07-15 11:00:23 +02:00
d5e626b243 Cleanup: use raw strings, quiet clang-tidy warnings 2021-07-15 18:29:20 +10:00
8e8a6b80cf Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")
This shows the text as part of the assertion message.
2021-07-15 18:29:01 +10:00
a63a0ee24b Cleanup: clang-format 2021-07-15 18:14:51 +10:00
d35b14449e Cleanup: ensure one newline at end of file, strip trailing space 2021-07-15 17:53:26 +10:00
41e0a5b5ed CMake: update config for checking utility 2021-07-15 17:52:27 +10:00
15cdcb4e90 BLI_task: add a callback to initialize TLS
Useful when TLS requires it's own allocated structures.
2021-07-15 14:45:46 +10:00
5cd1aaf080 BLI_memarena: support merging memory arenas
Useful when thread-local storage has it's own memory arena containing
data which is kept after the multi-threaded operation has finished.
2021-07-15 14:37:26 +10:00
4be166b6b5 deps_builder: zstd 1.5.0
Having zstd available is a requirement for landing D5799

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11079
2021-07-14 18:22:23 -06:00
4e65b1ef6c GHOST/wayland: create mmap-ed file manually if memfd_create is unavailable 2021-07-14 23:15:00 +01:00
ebf7673f83 CMake: Have CMake Control the C++ version.
We were manually setting the compiler flags
for C++17 support for this previously. CMake
can do this for us in a uniform way without
having to worry about compiler specifics.

Setting these flags manually somehow brought
out some unwanted behaviour (CMake switching
back to C++14) in the nightly CMake builds.

Unsure if that's a CMake bug or planned
new behaviour for future version, but best
to play it safe.

These flags are supported since CMake 3.1
so should not break anything.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D11891
2021-07-14 15:17:02 -06:00
093074aefe Bezier Spline: Add a more generalized insertion utility
This logic is from the curve sundivide node, used to add points with
proper handles in between two existing points. However, the same logic
is used for trimming of Bezier splines, and possibly interactive point
insertion in the future, so it's helpful as a general utility.

The logic is converted to depend on a bezier spline instead of being
static. A temporary segment spline can be used for the latter use case.
2021-07-14 15:13:17 -04:00
2829caa9f8 Cleanup: Layer resync: Split object/base resync part in own function.
No behavioral change expected here.
2021-07-14 17:49:57 +02:00
c202d38659 Python API: Add functions to ensure and clear IDProperties
This adds id_properties_clear() and id_properties_ensure() functions
to RNA structs. This is meant as an initial change based on discussion
in review of D9697. However, they may be useful in other situations.

The change requires refactoring the internal idproperties callback to
return a pointer to the IDProperty pointer, which actually turns out
to be quite a nice cleanup.

An id_properties attribute could be added in the future potentially.

Differential Revision: https://developer.blender.org/D11908
2021-07-14 10:51:28 -04:00
37a5ff4a84 Tests: support graphing peak memory in Cycles performance tests
The general graphing mechanism will create one graph for each output
variable. So it's not limited to time and memory, but that is what the
Cycles tests now output.
2021-07-14 16:12:10 +02:00
2acebcae24 Cleanup: Avoid duplication in line art stroke generation
The BKE_gpencil_stroke_add_points API function worked well for
creating the primitives in the add object menu, but it expected a
specific data format that doesn't make sense in a dynamic context.
As evidence of that we can see the way source data was duplicated
in the line art file just to use this API function.

This commit solves that problem in two ways:
 - Clean up the line art function (this should make it faster too).
 - Move/rename the function so its intended use is more clear.

Differential Revision: https://developer.blender.org/D11909
2021-07-14 10:11:41 -04:00
3de3c3c23a Fix (unreported) LibOverride diffing generating operations for non-editable properties.
Non-pointer-like properties that are not editable should never generate
override operations.

While harmless (those would never be applied back anyway), better not
clutter override operations list, and also enjoy the symbolic
performances improvement here.

NOTE: Pointer-like properties (pointers and collections) remain
processed as usual here since they usually imply recursivity. We could
make an exception to the exception for ID pointers, but for now I don't
think this is worth it.
2021-07-14 14:23:19 +02:00
c9e9a42215 Fix T89771: Cloth disk cache is not read on library overrides in some cases.
Issue would happen when the original, linked data already had 'Disk Cache'
setting enabled. Override would then see no difference with linked data,
and not create any rule for it (as expected).

Root of the issue was that in Cloth modifier copy code, those disk cache
settings were not copied at all, so every time local overrides were
re-generated by copying linked data, those flags would be reset to their
default values.

NOTE: this might exist in other PointCache usages as well, but this code is
in such a bad state that I'd rather do minimal strictly needed changes
there, on a case-by-case basis. Proper recode of that whole system is
wayyyyy out of scope here.
2021-07-14 14:23:19 +02:00
f0ddbcb31d Cleanup: Turn PointCache flags defines into an anonymous enum. 2021-07-14 14:23:19 +02:00
7cd91a06eb Fix T88908: Incorrect path handling in adding strips
When image strip is added from python using `image_strip_add` operator
and directory path is not terminated with slash, last part of directory
was ignored.

Use `BLI_join_dirfile` instead of simple string concatenation.
2021-07-14 13:56:09 +02:00
efe90944ee Fix crash displaying invalid enum value with translations enabled
Found loading a cycles-x .blend file saved with different integer values for
enum items.
2021-07-14 13:54:52 +02:00
765406cb51 Fix T88088: Cycles and Eevee Vector Rotate node inconsistent with zero axis
Pass along the unmodified vector in this case.
2021-07-14 13:54:52 +02:00
2761679180 Fix T89826: VSE snapping with constrained axis
Constraining to X axis caused snapping to not work at all. Constraining
to Y axis caused snapping indicator to be drawn, when snapping doesn't
occur.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11898
2021-07-14 13:22:40 +02:00
5583d51773 Fix T89851: Geometry nodes: wrongly detected "Node group has unidentified
nodes or sockets" error

rBfe22635bf664 introduced a utility to check for this (but it was always
returning true).

This wasnt a problem in master (since it is unused there), but in the
2.93 branch, this utility is actually used and the error results in all
geometry nodetrees to appear with the "Node group has unidentified nodes
or sockets" message (and being unusable).

Now return false in has_undefined_nodes_or_sockets if all nodes and
sockets have been successfully checked.

This commit then needs to end up in the 2.93 branch.

Maniphest Tasks: T89851

Differential Revision: https://developer.blender.org/D11911
2021-07-14 11:55:07 +02:00
192f0c9e17 Fix T89734: incorrect dependency cycle with id property on modifier
Differential Revision: https://developer.blender.org/D11851
2021-07-14 11:25:15 +02:00
271f34f77e Geometry Nodes: initial socket inspection
Socket inspection helps with debugging a geometry node group.
Now, when hovering over a socket, a tooltip will appear that provides
information about the data in the socket. Note, socket inspection only
works for sockets that have been computed already. Nodes that are not
connected to an output are not computed.

Future improvements can include ui changes to make the tooltip look
more like in the original design (T85251). Furthermore, additional
information could be shown if necessary.

Differential Revision: https://developer.blender.org/D11842
2021-07-14 11:21:10 +02:00
3e125d12af Fix T89849: Time offset not working with Bake Object transform to Grease pencil
The bake animation was not using the remap of time done by grease pencil time modifier.
2021-07-14 11:09:25 +02:00
6644e96f01 Cleanup: use BMLoop.next/prev for BMesh auto-smooth logic
Use more direct access to next/previous vertices.

- `BM_edge_other_vert(l_curr->e, l_curr->v)` -> `l_curr->next->v`.
- `BM_edge_other_vert(l_curr->prev->e, l_curr->v)` -> `l_curr->prev->v`.

Add asserts to keep the intention clear.
2021-07-14 14:22:13 +10:00
ae379714e4 Transform: Identify more safely when the mesh is deform only
Depending on the modifiers, geometry can be destructive which is not safe.
2021-07-13 18:59:42 -03:00
96a4b54cfb Compositor: Full frame Render Layers node
Adds full frame implementation to this node operations.
No functional changes.
2.5x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11690
2021-07-13 22:34:28 +02:00
538f452ea9 Compositor: Full frame Translate node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-13 22:34:28 +02:00
2ea47057d3 Compositor: Fix pixels being wrapped outside buffer area
Not causing issues in current master because all buffer areas are at
(0, 0) position and `Extend` is not used. But areas may be at any
position in future developments and it will crash.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11784
2021-07-13 22:34:28 +02:00
209aff0a35 Compositor: Fix convert resolutions linking different socket datatypes
Link sockets are always connected to inserted translate or scale
operation `Color` sockets even when they have different data type.
This causes crashes on full frame mode when operations read inputs 
with non expected datatypes.

Because data type conversions need to be executed before, convert
resolutions must ensure same datatypes are linked.
2021-07-13 22:32:53 +02:00
3b6ee8cee7 Refactor: Move vertex group names to object data
This commit moves the storage of `bDeformGroup` and the active index
to `Mesh`, `Lattice`, and `bGPdata` instead of `Object`. Utility
functions are added to allow easy access to the vertex groups given
an object or an ID.

As explained in T88951, the list of vertex group names is currently
stored separately per object, even though vertex group data is stored
on the geometry. This tends to complicate code and cause bugs,
especially as geometry is created procedurally and tied less closely
to an object.

The "Copy Vertex Groups to Linked" operator is removed, since they
are stored on the geometry anyway.

This patch leaves the object-level python API for vertex groups in
place. Creating a geometry-level RNA API can be a separate step;
the changes in this commit are invasive enough as it is.

Note that opening a file saved in 3.0 in an earlier version means
the vertex groups will not be available.

Differential Revision: https://developer.blender.org/D11689
2021-07-13 12:10:34 -04:00
52b94049f2 Fix 'Correct Face Attributes' option
With this option enabled, updating the geometry is no longer deform only.
2021-07-13 12:51:29 -03:00
2373a2196e Cleanup: duplicate checks, unused initialization 2021-07-13 22:41:48 +10:00
6a0fe79db5 Cleanup: replace BKE_customdata.h in BKE_editmesh.h
Only DNA_customdata_types.h is needed for BMEditMesh.
2021-07-13 22:23:17 +10:00
10428ca472 Cleanup: reduce indentation 2021-07-13 22:14:42 +10:00
d31abfef2c Fix x/y mismatch in retract region tracker
Correct X/Y mismatch in RetrackRegionTracker.

NOTE: This isn't used at the moment.

Reviewed By: sergey

Ref D11895
2021-07-13 21:58:45 +10:00
6a5e1bf9a1 Cleanup: improve BMEditMesh docstrings
Also remove white-space added last commit.
2021-07-13 21:24:46 +10:00
488690c864 Cleanup: minor changes to recent sequencer clipboard addition
- Make the variable to store the name 'static'.
- Use STRNCPY macro.
- Set the first character to nil instead of memset for the while string.
2021-07-13 21:23:35 +10:00
d374469f4c VSE: Make pasted strip active
When adding texts or various simple effects I often copy-paste strips
to reuse properties from a template such as font or position. I assume
this is common workflow. Issue with this workflow is, that active strip
is not changed after pasting, so when adjusting property, it is original
strip that is being modified.

This is not issue when duplicating strips - selection state is
transfered to duplicate strips, such that duplicate of active strip is
set to be active and duplicate of selected strip is set to selected.

Implement same selection transfering behavior in paste operator, that
exists in duplicate operator.

Since strip can be deleted after copying, it is not possible to rely
on sequencer state. This is true even when pasting strips to different
scene. Therefore active strip name must be stored in clipboard.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D11781
2021-07-13 12:53:56 +02:00
af42b35e53 Fix UV snapping broken
Caused by fba9cd019f, then fixed by 0e4245bc28, but without
subversion bump, so some files were still broken after fix.

Repeat fix again, but this time also bump subversion.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D11864
2021-07-13 12:52:57 +02:00
71b4a1687e Cleanup: clang-tidy, comments 2021-07-13 20:51:24 +10:00
25c2875e0f Edit Mesh: use partial updates editing vertices with number buttons
Use the same partial-update functions used by transform when
editing vertex locations with the number buttons.

This avoids unnecessary calculations for normals and tessellation.

This gives around 1.44x overall speedup on high poly meshes.
2021-07-13 20:17:30 +10:00
8839b4c32a UI: support persistent state during number/slider interaction
Support for begin/update/end callbacks allowing state to be cached
and reused while dragging a number button or slider.

This is done using `UI_block_interaction_set` to set callbacks.

- Dragging multiple buttons at once is supported,
  passing multiple unique events into the update function.

- Update is only called once even when multiple buttons are edited.

- The update callback can detect the difference between click & drag
  actions so situations to support skipping cache creation and
  freeing for situations where it's not beneficial.

Reviewed by: Severin, HooglyBoogly

Ref D11861
2021-07-13 20:03:40 +10:00
1b4d5c7a35 Undo System: avoid redundant decoding on undo
In most cases the undo system was loading undo steps twice.

This was needed since some undo systems (sculpt, paint, text)
require stepping out of the current undo step.

Use a flag to limit this to the undo systems that need it.

This improves performance for other undo systems.
This gives around 1.96x speedup in edit-mesh for high-poly objects.

Reviewed by: mont29

Ref D11893
2021-07-13 19:43:05 +10:00
f9c9e000ca Undo: optimize edit-mode undo
- Tag the object data instead of the object when decoding
  (this avoids duplicating mesh object-data on each undo-step).
- Calculate face normals as part of multi-threaded tessellation.

This gives ~11% speedup with 1.5x million polygons.
2021-07-13 17:10:30 +10:00
7a4fc9f59d Cleanup: quiet stringop-overflow compiler warning 2021-07-13 16:54:25 +10:00
22c4323b21 Cleanup: remove commented code
Replace with brief note in warning.
2021-07-13 15:27:38 +10:00
7a084c2eee Cleanup: minor changes to edit-mesh API calls
Rename:

- EDBM_mesh_free -> EDBM_mesh_free_data
  BKE_editmesh_free -> BKE_editmesh_free_data

  Since this doesn't free the edit-mesh pointer.

- BKE_editmesh_free_derivedmesh -> BKE_editmesh_free_derived_caches

  Since this no longer uses derived-mesh, match naming for the related
  object function BKE_object_free_derived_caches.

Also remove `do_tessellate` argument from BKE_editmesh_create,
since the caller can explicitly do this if it's needed,
with the advantage that it can be combined with normal calculation
which is faster on high-poly meshes.
2021-07-13 15:13:33 +10:00
b90b1af25c Event Simulate: and a --time-actions command line argument
When enabled, print the time taken between running actions.
2021-07-13 14:50:52 +10:00
5098678308 Cleanup: Use correct _WIN32/64 defines for MSVC
Docs: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros

Differential Revision: https://developer.blender.org/D11460
2021-07-12 21:01:18 -07:00
dc679f6247 Cleanup: Use C99 format string for the SIZET_FORMAT macro
All platforms support the proper format string and it's already used in
various other places.

Differential Revision: https://developer.blender.org/D11460
2021-07-12 20:32:37 -07:00
2e7e7a6fb6 Fix object "Set Origin" operating on linked library data
Regression in d25747ee75
2021-07-13 13:03:39 +10:00
d6b1d35bf8 Cleanup: Use C++ float3 type, use prefix for return argument 2021-07-12 17:24:45 -04:00
Germano Cavalcante
bfa3dc91b7 Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'
During a mesh transformation in edit mode (Move, Rotate...), only part of
the batch cache needs to be updated.

This commit allows only update only the drawn batches seen in
`BKE_object_data_eval_batch_cache_deform_tag` if the new
`ID_RECALC_GEOMETRY_DEFORM` flag is used.

This new flag is used in the transforms operation for edit-mesh and
results in 1.6x overall speedup in heavy subdiv cube.

Differential Revision: https://developer.blender.org/D11599
2021-07-12 18:05:13 -03:00
7b6c77aa84 Fix T88015: Round end caps on Freestyle lines not shaped as documented
This might be an artistic choice, but round end caps are supposed to be
a "half circle centered at the end point of the line" as documented
here: https://docs.blender.org/manual/en/dev/render/freestyle/
parameter_editor/line_style/strokes.html#caps

They are a shashed half circle instead.

This patch makes this pure half circles [and also fixes the case where
thickness of beginning was used for both beginning and end of the
stroke]

Maniphest Tasks: T88015

Differential Revision: https://developer.blender.org/D11340
2021-07-12 22:14:57 +02:00
7b954ba7a1 GHOST/wayland: remove unused 'input-event-codes.h' header
This was accidentally committed by rBecbf838feefc.
2021-07-12 20:20:08 +01:00
5e1702e7a5 Fix T87844: Cycles losing 1 bit of precision when loading packed byte images
This could lead to colors that are supposed to be exactly white to be slightly
darker.
2021-07-12 19:19:04 +02:00
Johnny Matthews
2a41ab5e6c Geometry Nodes: Curve Primitive Quadrilateral
This commit adds a curve primitive node for creating squares,
rectangles, trapezoids, kites, and parallelograms. It also includes
a mode where the four points are just vector inputs.

Differential Revision: https://developer.blender.org/D11665
2021-07-12 13:11:52 -04:00
a072e87e04 Fix T89040: dependency graph not handling time remapping correctly
In this bug report it resulted in rendering animations stopping too early,
but this affected more areas.

After the previous cleanup commit, it becomes clear that frame and ctime
values were mixed up.
2021-07-12 17:41:26 +02:00
2ea565b0ec Cleanup: improve naming and comments of scene frame/ctime functions
Confusingly, BKE_scene_frame_get did not match the frame number as expected by
BKE_scene_frame_set. Instead it return the value after time remapping, which
is commonly named "ctime".

* Rename BKE_scene_frame_get to BKE_scene_ctime_get
* Add a new BKE_scene_frame_get that matches BKE_scene_frame_set
* Use int/float depending if fractional frame is expected
2021-07-12 17:41:15 +02:00
f709f12d93 Fix T89736: Cycles error with persistent data, displacement and motion blur 2021-07-12 15:56:31 +02:00
45a47142fc Fix T89396: Cycles missing passes with multiple view layers and persistent data 2021-07-12 15:40:45 +02:00
5f3f5db95d Cleanup: Clang format
Sorry, missed this in 53cf8e83b3.
2021-07-12 14:40:26 +02:00
8e69409eed Fix T89775: geometry nodes logging crash during render
Under some circumstances (e.g. when rendering) the geometry
nodes logger is not used. This was missing a simple null check.
2021-07-12 14:29:28 +02:00
280dac323c Blenlib: Add BLI_assert_msg() for printing an extra string if the assert fails
It always bothered me that we'd do the `BLI_assert(... || !"message")` trick to
print a message alongside the assert, while it should be trivial to have a way
to pass an extra string as additional argument.

This adds `BLI_assert_msg()` with a second argument for a message. E.g.:
```
BLI_assert_msg(
    params->rename_id == NULL,
    "File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.");
```

On failure this will print like this:
```
0   Blender                             0x00000001140647a3 BLI_system_backtrace + 291
[...]
13  Blender                             0x00000001092647a6 main + 3814
14  libdyld.dylib                       0x00007fff203d8f5d start + 1
BLI_assert failed: source/blender/editors/space_file/file_ops.c:2352, file_directory_new_exec(), at 'params->rename_id == ((void*)0)'
  File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.
```

Reviewed by: Sybren Stüvel, Jacques Lucke, Sergey Sharybin, Campbell Barton

Differential Revision: https://developer.blender.org/D11827
2021-07-12 11:46:24 +02:00
c4f9bfcf5e Fix T89765: boolean modifier collection refcount issue
The 'collection' property is flagged PROP_ID_REFCOUNT, so the
modifiers foreachIDLink functions should walk with IDWALK_CB_USER
(instead of IDWALK_CB_NOP).

Otherwise the modifier wont be included as a user for the collection
(e.g. on file read); removing the collection from the modifier will
decrement usercount though (which in worst case scenario makes the
collection orphan and will result in data loss)

Maniphest Tasks: T89765

Differential Revision: https://developer.blender.org/D11877
2021-07-12 10:48:27 +02:00
2289e26fa3 Cleanup: correct spelling in comments, remove profanity 2021-07-11 15:31:36 +10:00
0f201049b4 Edit Mesh: tag the object data for updating instead of the object
When editing vertices with number buttons, tag the mesh, not the object.

This prevents the evaluated mesh being re-created for the object
and is correct as the mesh is being edited not the object.

Note that all tags for updating object geometry should be checked
to see if this change should be applied there too.

From a simple test on a high-poly mesh this gives around 1.3x
overall speedup.
2021-07-11 15:22:20 +10:00
49a363f0e0 LineArt: Fix edge type panel use_cache prop.
The name was mistakenly written as `use_cached_result`. Fixed.
2021-07-10 21:52:35 +08:00
77a28f34d5 LineArt: Fix modifier apply.
After cache implementation line art apply will not show strokes properly, now fixed.

# Conflicts:
#	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
2021-07-10 14:04:23 +08:00
62d9dabc7d UI: Clip: Fix checkbox wrongly greying out entire column
The Pattern and Search display options in the Clip Editor display settings
are independent and should not be grayed out since those options
remain relevant even with path display turned off.

Alternative solution were propoesed in D11630 and D11715
but each of those patches had downsides.
This solution is the simplest and does not break muscle memory.
2021-07-09 19:23:08 -04:00
d5e91ae883 make.bat: Update detection order of MSVC
VS2019 is the preferred version to use these
days, look for it before looking for 2017
and 2022.
2021-07-09 15:17:05 -06:00
53cf8e83b3 Fix channel packed images display in the Image/Node editor
Channel packed images should not have their RGB affected by alpha.
rendering in Cycles and Eevee was fine already, but displaying these was
not right in the Image and Node editors.

Not 100% sure what to do for the "Color and Alpha" mode, but I guess
this should stay like it was before (applying the alpha).

"Color", "R", "G", and "B" modes were changed to not have color be
affected by alpha though.

ref. T89034

Maniphest Tasks: T89034

Differential Revision: https://developer.blender.org/D11871
2021-07-09 22:00:04 +02:00
Johnny Matthews
d7f88982a8 Geometry Nodes: fix direction mode in curve primitive line node
Differential Revision: https://developer.blender.org/D11872
2021-07-09 18:34:40 +02:00
4c716ced09 Fix a compiler warning on Windows for Exact Boolean.
For some reason, the Windows compiler didn't like the
static function being used in the parallel_reduece.
2021-07-09 09:29:33 -04:00
09082f6e85 Fix: crash when using empty attribute search 2021-07-09 15:21:25 +02:00
c749c24682 Walk Navigation: Z axis correction
Fly navigation has always had this option. They is particularly useful
when users use "Trackball" as their orbit method.

For walk navigation this works as a one off option. Not as a toggle like
for fly navigation.

Differential Revision: https://developer.blender.org/D11863
2021-07-09 15:03:50 +02:00
Sybren A. Stüvel
c04cceb40e Fix T89435: Reordering FCurves can cause crash or corruption
Correctly reset `prev` and `next` pointers of action group FCurves when
separating them into distinct `ListBase`s per `bActionGroup`.

These `NULL` pointers are necessary to temporarily demarcate the start &
end of the `bActionGroup::channels` list. Having them still point to
other FCurves caused ordering issues when moving curves towards the
start/end of a group.

This commit corrects the above issue and adds versioning code to rectify
any ordering issues that may have been caused. For this purpose the
`BKE_action_groups_reconstruct()` function is rewritten to avoid relying
on the `bAction::curves` list order or `prev` link integrity.

Differential Revision: https://developer.blender.org/D11811
2021-07-09 12:21:12 +03:00
b69ab42982 Deps: upgrade OpenXR 1.0.14 → 1.0.17
Simple upgrade of OpenXR to 1.0.17. A version bump was enough, no
Blender code had to change.

Reviewed By: LazyDodo, mont29

Differential Revision: https://developer.blender.org/D11848
2021-07-09 11:06:40 +02:00
16099c00d0 Fix cycles crash when changing viewport display pass
It was possible that render buffers and scene kernel data will be out
of sync because reset and scene update happens in different locks.

This is similar issue we've fixed in the Cycles X branch, so backported
relevant changes from there.

This change removes what seems to be unused feature kernel.

Differential Revision: https://developer.blender.org/D11828
2021-07-09 10:43:47 +02:00
8dd941cac0 Tracking: Fix "Lock to Selection" option from header causing jump
This change makes the behavior consistent between shortcut and
option from space clip's header.

The only caveat is that the "Lock to Selection" is removed from the
Display popover. This is because it is rather hard to make operator
to render same as regular checkbox. However, shouldn't be a problem
because the setting in popover was redundant.

Differential Revision: https://developer.blender.org/D10423
2021-07-09 10:37:36 +02:00
249a7e2307 Cleanup: Walk Navigation define remame
WALK_MODAL_TOGGLE > WALK_MODAL_GRAVITY_TOGGLE
2021-07-09 10:27:29 +02:00
8225b610dd Fix typo in Fly mode tooltip
The bug was always around and was introduced with the original code
e2a7168e96 (2009).
2021-07-09 10:21:02 +02:00
07faa3c5ac Nodes: Moved group interface panel code to python.
The node group interface panels were still implemented in C.
Now they ported over to python for easier maintenance.

Differential Revision: https://developer.blender.org/D11834
2021-07-09 07:57:29 +01:00
d0c5c67e94 Make Single User: support object data animation
In addition to _object_ animation, now _object data_ (mesh, curve, ...)
animation can now be made single user as well.

This came up in T89369 and while it is possible to do this via the
Outliner [where all actions have to be selected individually], this
seems to be more convenient to be done from the 3DView.

note: usercount of the action is checked now, if it single-user already,
no copy takes place (same thing could/should be done for
single_object_action_users as well).

note2: obdata is made single user as well (otherwise duplicated actions
will be assigned to the same shared obdata - which does not result in
unique animadata which is what we are after here)

ref. T89369

Maniphest Tasks: T89369

Differential Revision: https://developer.blender.org/D11683
2021-07-09 08:09:43 +02:00
0416aa767f Cleanup: use 'uint' for BLI_array 2021-07-09 13:37:52 +10:00
7592a5097c BLI_array: add BLI_array_deduplicate_ordered utility & tests 2021-07-09 13:35:54 +10:00
ab70133db0 Cleanup: rename BKE_animdata_{add=>ensure}_id
Use the term `ensure` as existing data is used when present.
2021-07-09 11:53:16 +10:00
af8fb707da BLI: avoid calling deleted copy constructor in some compilers
Previously, this did not compile in VS 2017, because
`new T(initializer_())` would try to call the copy constructor of `T`.

Now, `initializer_` will construct the `T` inplace.
2021-07-08 19:54:09 +02:00
Pratik Borhade
4e5537d0ed Fix T89169: Rename Compositor Node "View Switch" to "Switch View" in search panel
Renaming compositor node in search panel "View Switch" to "Switch View"
for better consistency.

Reviewed By: dfelinto

Differential Revision: https://developer.blender.org/D11717
2021-07-08 14:59:26 +02:00
80d0b68290 GPencil: Support camera "Frame Selected" and object previews
Using the "Camera Fit Frame to Selected" operator didn't work for Grease Pencil
objects. The same issue caused grease pencil preview thumbnails to be useless
(e.g. when using "Mark Asset" on a Grease Pencil object).
Reason was that there was no logic to handle grease pencil data and its strokes
for the object display-point iterators used for the "Frame Selected" logic.

Addresses T89656.

Reviewed by: Antonio Vazquez, Campbell Barton

Differential Revision: https://developer.blender.org/D11833
2021-07-08 14:20:14 +02:00
5d54f38949 Fix: instances are made real when they shouldn't be
The original assumption that the `modifyMesh` function is only
called when the modifier is applied was wrong. There are still a
couple of other places calling it through `BKE_modifier_modify_mesh`.

Now there is an extra check that makes sure instances are only
realized when the modifier is actually applied.
2021-07-08 13:11:21 +02:00
c304807099 Fix compositor backdrop gizmo refresh problem when toggling sidebar
The backdrop image gizmo was not following the backdrop image, it
needs to be refreshed whenever the view changes. The region init
callback is executed whenever the region size changes, so that should be
a reliable place to do that.

Reported as part of T87591.
2021-07-08 13:08:10 +02:00
4c8a8950cf Cleanup: remove trailing spaces from install_deps.sh
No functional changes.
2021-07-08 11:38:48 +02:00
b6a35a8153 Outliner: use 'compacted' row for bones as well
In a collapsed hierarchy, some type of data are listed as one icon per
item (2.79 did this for all data),
others are 'compacted' as a single icon with a counter (also indicating
if the active item is down that collapsed hierarchy) from 2.80 on.

Not quite sure if {rB92dfc8f2673e} was meant to do this (if it was, this
was not working though because relevant code would only get executed for
object hierarchies it seems), so now this is done for bones as well.

Fixes T88413.

Maniphest Tasks: T88413

Differential Revision: https://developer.blender.org/D11404
2021-07-08 10:41:38 +02:00
7489427e4d Cleanup: spelling 2021-07-08 13:31:38 +10:00
c3cb565250 CMake: add missing headers, sort file lists 2021-07-08 13:21:22 +10:00
8346417d09 Fix crash displaying the sequencer without a valid 'scene->ed'
Regression in 45d54ea67f
2021-07-08 10:15:03 +10:00
nutti
695e025c82 Docs: Fix minor incorrect syntax errors
This patch fixes the incorrect syntax in documentations.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11822
2021-07-07 19:41:46 -04:00
51019fbfce Cleanup: Consolidate tablet walk mode rotate factors.
Walk rotate speed for tablets was being modified at runtime by scaling
the user preference mouse_speed by a constant factor; this consolidates
scaling into the the compile time tablet scale factor in walkApply.

No change in behavior.
2021-07-07 16:33:50 -07:00
139c3f791e Cleanup: Remove wrong File Browser comment
Accidentally included this in rB01e1944cd455, it came from a merge
conflict.
2021-07-07 19:49:28 +02:00
54fa5041e2 Cleanup: Correct comment in earlier commit (f4cb3ccd9c)
Comment was based on an older version of the patch.
2021-07-07 19:38:37 +02:00
2b41b2f05b Cleanup: Code-style correction in Ghost (Clang-format) 2021-07-07 19:26:47 +02:00
f4cb3ccd9c Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.

Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).

Reviewed by: Sybren Stüvel

Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
fb98f22ddd MSVC: Fix build issue with TBB
TBB includes in windows.h which will by
default define min/max macro's by default,
which collide with stl's min/mac functions.

this change instructs windows.h not to
add the offending macros
2021-07-07 10:55:27 -06:00
6b0869039a File Browser: Select files and directories after renaming
(Note: This is an alternative version for D9994 by @Schiette. The commit
message is based on his description.)

Currently, when a new directory is created it is not selected.
Similarly, when renaming an existing file or directory, it does not
remain active/highlighted blue after renaming.

This change makes sure the file or directory is always selected after
renaming, even if the renaming failed or was cancelled.
This has some usability advantages:
 - Open the newly created directory without having to select it (ENTER).
 - If you make a naming mistake, you can immediately fix that (F2)
   without having to click it again.
 - If you create a directory and forget to name it, you can fix that
   (F2) without having to select it.
 - This is consistent with many common File Browsers.

Further, selecting the item even after renaming failed or was cancelled
helps keeping the file in focus, so the user doesn't have to look for it
(especially if the renaming just failed which the user may not notice).
In other words, it avoids disorienting the user.

Also see D11119 which requires this behavior.

We could also always select the file/directory on mouse press. This
would make some hacks unnecessary, but may have further implications. I
think eventually that's what we should do though.
2021-07-07 18:41:27 +02:00
13672f8b32 Cleanup: Move file deselection function to more appropriate file
`filesel.c` seems like the place that should contain file selection
functions. Previously it was in `file_ops.c` because that was the only
file that actually used it. But a followup commit needs it from a
different file.
2021-07-07 18:41:27 +02:00
cffbfe5568 Fix crash accessing sequencer strips
Was caused by recent clange sequences_all iterator in RNA (D11793).
2021-07-07 14:22:52 +02:00
ecbf838fee Cleanup: comment on source of button event codes 2021-07-07 13:21:57 +01:00
0153e99780 Geometry Nodes: refactor logging during geometry nodes evaluation
Many ui features for geometry nodes need access to information generated
during evaluation:
* Node warnings.
* Attribute search.
* Viewer node.
* Socket inspection (not in master yet).

The way we logged the required information before had some disadvantages:
* Viewer node used a completely separate system from node warnings and
  attribute search.
* Most of the context of logged information is lost when e.g. the same node
  group is used multiple times.
* A global lock was needed every time something is logged.

This new implementation solves these problems:
* All four mentioned ui features use the same underlying logging system.
* All context information for logged values is kept intact.
* Every thread has its own local logger. The logged informatiton is combined
  in the end.

Differential Revision: https://developer.blender.org/D11785
2021-07-07 11:20:19 +02:00
77834aff22 Fix T89397: animation in geometry nodes modifier does not update
The geometry nodes modifier uses id properties for the inputs to node groups.
That is because the set of properties changes depending on which geometry
node group is selected.

The animation was not updated correctly because the `ANIMATION_EVAL`
depsgraph node was not evaluated, because nothing depended on it in the
depsgraph. This patch makes sure that the proper link to the geometry
component is inserted.

Differential Revision: https://developer.blender.org/D11831
2021-07-07 10:56:45 +02:00
3fe0088cab Fix T89559: Outliner shows extra view layer column when it shouldn't
This issue happened because of some miscommunication during the original
patch review. Since we have the parent element in other outliner modes
(Blender File, Data API) I was on the fence here. Rolling this back now
so that when Show All View Layers is off we don't see the current View
Layer top element.

The fix is simple, but it was better to format the code around to
follow the style in this file.

Differential Revision: https://developer.blender.org/D11830
2021-07-07 10:41:12 +02:00
8f94724f22 Cleanup: Sort nodes alphabetically 2021-07-06 23:33:02 -05:00
89831fae0c Cleanup: update filename references 2021-07-07 14:08:47 +10:00
0b1050bf09 Geometry Nodes: Rename nodes for clarity between mesh and curve
Rename the mesh circle to "Mesh Circle", mesh line to "Mesh Line",
and mesh subdivide to "Mesh Subdivide". Previously they looked exactly
the same in the search menu, and the nodes themselves had the same
label. This is a "deep" rename that also renames internal defines and
function names to match the UI.
2021-07-06 23:00:27 -05:00
Jagannadhan Ravi
eccdced972 Cleanup: Moving mesh_evaluate and mesh_normals to C++
No functional changes.

Reviewed By: HooglyBoogly

Ref D11744
2021-07-07 13:58:18 +10:00
5bbbc98471 Cleanup: spelling in comments 2021-07-07 13:42:46 +10:00
Angus Stanton
63a8b3b972 Geometry Nodes: Curve Endpoints Node
This node is quite similar to the curve to points node, but creates
points for only the start and end of each spline. This is a separate
node because the sampling from the curve to points node don't apply,
and just for ease of use.

All attributes from the curves are copied, including the data for
instancing: tangents, normals, and the derived rotations. One simple
use case is to make round caps on curves by instancinghalves of a
sphere on each end of the splines.

Differential Revision: https://developer.blender.org/D11719
2021-07-06 22:24:04 -05:00
31e6f0dc7a makesdna: fix parsing 'const', 'struct', 'unsigned' as a prefix
DNA parsing assumed any identifier which starts with
(`struct`, `unsigned`, `const`) was that identifier.

So a struct called `constTest foo;` would be parsed as `est foo;`.

Add utility function to check identifiers are not
part of a larger identifier.

This also supports skipping these identifiers in any order.

Reviewed By: LazyDodo

Ref D11837
2021-07-07 12:35:03 +10:00
f85ef3d442 Cleanup: clang-tidy, unused function 2021-07-07 12:34:00 +10:00
cd38daeff4 Fix T89702: Curve to points node assert on single point spline
This function could be refactored slightly if we assumed the input was
always sorted, but a special for a single point input is also fine.
2021-07-06 21:09:01 -05:00
0521272ab3 Fix: Curve Resample Node: Copy attributes to 1 point results
The curve resample node neglected to copy attributes to single point
result splines. That could have caused errors if some of the splines
in the result had only one point but others had more.
2021-07-06 20:42:33 -05:00
4e80573a76 VSE: Use snapping settings for scrubbing
Use "Snap Playhead to Strips" option to enable playhead snapping.
Change behavior of CTRL key to invert snapping similar to transform operator.

Currently this option is disabled by default. It makes editing quite unpleasant
for me personally, but ideally I should gather feedback from more users.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11745
2021-07-07 03:26:14 +02:00
c5b2381703 VSE: Remove seq->tmp usage from RNA code
This field was used to reference "parent" meta strips in `sequences_all`
RNA collection iterator functions.

Use `SeqIterator` wrapped in `BLI_Iterator` to iterate over elements.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11793
2021-07-07 03:14:05 +02:00
45d54ea67f VSE: Fix cache bar not visible
Cache bar was only visible when Frame overlay was enabled

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11779
2021-07-07 03:02:01 +02:00
6ac3a10619 Compositor: Fix constant folded operations not being rendered
Many operations do not expect single element buffers as output.
Use full buffers with a single pixel instead.
2021-07-07 01:09:43 +02:00
1657fa039d Compositor: Fix crash when executing works in constant folding
Work scheduler needed initialization and execution models are
not created during constant folding. This moves work execution
method to execution system.
2021-07-07 01:09:31 +02:00
f49f406f67 GPencil: Rename BKE_gpencil_visible_stroke_iter
Renamed to  BKE_gpencil_visible_stroke_advanced_iter

Also created a simple version of the iterator to be used without multiframe and onion skin.
2021-07-06 22:18:49 +02:00
Vincent Blankfield
4a24c6fe37 UI: Center the Status Bar Progress Text
This patch horizontally centers the text inside the progress bar
widget. It is currently left-aligned and offset to the middle, which
doesn't center properly.

see D11205 for details and examples.

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

Reviewed by Julian Eisel
2021-07-06 12:17:42 -07:00
46a261e108 Compositor: Fix execution system unset during constant folding 2021-07-06 20:22:43 +02:00
40de5742af Fix: Crash when geometry nodes NURB spline has no evaluated points 2021-07-06 13:12:27 -05:00
586cf8b190 Nodes: Adds button to groups to change type of sockets.
The menu lists all socket types that are valid for the node tree.
Changing a socket type updates all instances of the group and keeps
existing links to the socket.
If changing the socket type leads to incorrect node connections the
links are flagged as invalid (red) and ignored but not removed. This is
so users don't lose information and can then fix resulting issues.
For example: Changing a Color socket to a Shader socket can cause an
invalid Shader-to-Color connection.

Implementation details:
The new `NODE_OT_tree_socket_change_type` operator uses the generic
`rna_node_socket_type_itemf` function to list all eligible socket types.
It uses the tree type's `valid_socket_type` callback to test for valid
types. In addition it also checks the subtype, because multiple RNA
types are registered for the same base type. The `valid_socket_type`
callback has been modified slightly to accept full socket types instead
of just the base type enum, so that custom (python) socket types can be
used by this operator.

The `nodeModifySocketType` function is now called when group nodes
encounter a socket type mismatch, instead of replacing the socket
entirely. This ensures that links are kept to/from group nodes as well
as group input/output nodes. The `nodeModifySocketType` function now
also takes a full `bNodeSocketType` instead of just the base and subtype
enum (a shortcut `nodeModifySocketTypeStatic` exists for when only
static types are used).

Differential Revision: https://developer.blender.org/D10912
2021-07-06 18:36:11 +01:00
933eddc9a1 cmake: use harvested 'wayland-protocols' if system version is insufficient 2021-07-06 18:17:27 +01:00
c26b46ddca cmake: add 'wayland-protocols' to 'make deps' 2021-07-06 18:17:27 +01:00
257bfb65b2 doc: add Wayland dependencies
The wayland support requires the following development packages:
libwayland-dev, wayland-protocols, libegl-dev, libxkbcommon-dev,
libdbus-1-dev, linux-libc-dev
2021-07-06 18:17:21 +01:00
a069fffcc4 GHOST/wayland: define BTN event codes manually 2021-07-06 18:17:21 +01:00
9182c882fe Geometry Nodes: Allow 3 points in curve star primitive 2021-07-06 12:11:09 -05:00
1364f1e35c Fix T89592: Can't remove keyframes without active keying set
Partially revert 7fc220517f, as it
introduced two issues:

- Deleting keys without active keying set was no longer possible, and
- there was no more confirmation popup.

Pressing {key Alt I} in the 3D Viewport now executes
`ANIM_OT_keyframe_delete_v3d`, adjusted to suit both T88068 and T89592:

- If there is an active keying set, delete keys according to that keying
  set.
- Otherwise, behave as `ANIM_OT_keyframe_delete_v3d` did before, that
  is, delete all keyframes of the selected object and in pose-mode also
  of selected bones.
2021-07-06 18:20:26 +02:00
563ef943c7 Cleanup: Keyframing, remove duplicate code
Remove duplicate code from the `ANIM_OT_keyframe_delete` operator. The
actions of the removed code are already performed by the preceding
`keyingset_get_from_op_with_error()` call.

No functional changes.
2021-07-06 18:20:26 +02:00
e2c4a4c510 Compositor: Graphviz improvements
Graphs are usually large, needing a lot of horizontal scrolling and
they can include more information for debugging.

This patch makes graph more compact horizontally by splitting
labels in lines and removing namespaces.
Furthermore it adds following information:
- Operation ID.
- SetValueOperation float value.
- Optionally, operation node name.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11720
2021-07-06 18:11:49 +02:00
5780de2ae0 Compositor: Enable constant folding on operations
Only on current full frame operations that can be constant.
2021-07-06 18:11:49 +02:00
fc5be0b598 Compositor: Constant folding
Currently there is no clear way to know if an operation is constant
(i.e. when all rendered pixels have same values). Operations may 
need to get constant input values before rendering to determine 
their resolution or areas of interest. This is the case of scale, rotate
and translate operations. Only "set operations" are  known as 
constant but many more are constant when all their inputs are so.
Such cases can be optimized by only rendering one pixel.

Current solution for tiled implementation is to get first pixel
from input. This works for root execution groups, others
need previous groups to be rendered.

On full frame implementation this is not possible, because buffers
are created on rendering to reduce peak memory and there is
no per pixel calls.

This patch evaluates all operations that are constant into primitive
operations (Value/Vector/Color) before determining resolutions.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11490
2021-07-06 18:11:49 +02:00
a070dd8bdd Cleanup: Set execution system as operations member in Compositor 2021-07-06 18:04:37 +02:00
1af722b819 Deps builder: macOS/ ffmpeg: Fix linker warning
ld: warning: could not create compact unwind for _ff_rl_init_vlc: stack
subq instruction is too different from dwarf stack size
Similar to rB2de5de57c58521862e0fecc95fc474ea347b7468

Differential Revision: https://developer.blender.org/D11796
2021-07-06 21:13:31 +05:30
Bastien Montagne
b05ba2ef0e Rename Scene's embeded collections from "Master Collection" to "Scene Collection"
Note that this name is essentially never used anywhere, besides as 'information'
mostly accessible from python console. Those embedded IDs are not in Main, so they
are not accessible by name ever, and mostly unusable from animation perspective
(either drivers or fcurves).

Therefore, no breakage is expected in user scripts or addons, nor when
loading in older versions of Blender.

Reviewed By: dfelinto, brecht

Differential Revision: https://developer.blender.org/D11812
2021-07-06 17:24:26 +02:00
7af40ccf5f GPU: Fix crash when using EGL with --gpu-debug flag.
During initialization of the platform a debug message is generated and
interpreted by de callback. Here the platform is checked what requires
an initialized platform.

Fixed by giving the platform check less priority in the check.
2021-07-06 14:24:42 +02:00
8f5a4a2453 Alembic export: evaluation mode option
This option will determine visibility on either render or the viewport
visibility. Same for modifer settings. So it will either evaluate the
depsgrah with DAG_EVAL_RENDER or DAG_EVAL_VIEWPORT.
This not only makes it more flexible, it is also a lot
clearer which visibility / modfier setting is taken into account (up
until now, this was always considered to be DAG_EVAL_RENDER)

This option was always present in the USD exporter, this just brings
Alembic in line with that.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11820
2021-07-06 13:22:22 +02:00
834e87af7b Alembic: remove non-functional "Renderable Objects" only option
When introduced in {rB61050f75b13e} this was actually working (meaning
it checked the Outliner OB_RESTRICT_RENDER flag and skipped the object if
desired).

Behavior has since then been commented in rBae6e9401abb7 and apparently
refactored out in rB2917df21adc8.

If checked, it seemed to be working (objects marked non-renderable in
the Outliner were pruned from the export), however unchecking that
option did not include them in the export.

Now it changed - for the worse if you like - in rBa95f86359673 which
made it so if "Renderable Objects" only is checked, it will still export
objects invisible in renders. So since we now have the non-functional
option with a broken/misleading default, it is better to just remove it
entirely.

In fact it has been superseeded by the "Visible Objects" option (this
does the same thing: depsgraph is evaluated in render mode) and as a
second step (and to make this even clearer) a choice whether
Render or Viewport evaluation is used can be added (just like the USD
exporter has). When that choice is explicit, it's also clear which
visibility actually matters.

This is breaking API usage, should be in release notes.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11808
2021-07-06 13:22:07 +02:00
ae8fa7062c Fix incompatible type passed to XR haptic
Likely caused by recent fixed-size types changes.
Seems to be no-functional-changes since the function is unused.
2021-07-06 12:36:42 +02:00
3382b07ad6 Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation
(typically linked lists).
2021-07-06 12:09:52 +10:00
432bfbf7a3 Cleanup: pep8 2021-07-06 12:05:27 +10:00
36584bbc2d Cleanup: quiet discarded-qualifiers warning 2021-07-06 12:05:25 +10:00
4eeec6e9b5 Fix macOS builds after removing Ghost integral types. 2021-07-05 15:24:39 -07:00
ceff86aafe Various Exact Boolean parallelizations and optimizations.
From patch D11780 from Erik Abrahamsson.
It parallelizes making the vertices, destruction of map entries,
finding if the result is PWN, finding triangle adjacencies,
and finding the ambient cell.
The latter needs a parallel_reduce from tbb, so added one into
BLI_task.hh so that if WITH_TBB is false, the code will still work.

On Erik's 6-core machine, the elapsed time went from 17.5s to 11.8s
(33% faster) on an intersection of two spheres with 3.1M faces.
On Howard's 24-core machine, the elapsed time went from 18.7s to 10.8s
for the same test.
2021-07-05 18:09:36 -04:00
cf17f7e0cc Fix T89671: Crash when using Denoise node on Full Frame mode
Tiled fallback doesn't support single element buffers.
Ensure tiles are initialized as full buffers.
2021-07-05 23:36:43 +02:00
3d9ecf1cf2 Compositor: Full frame Color Balance node
Adds full frame implementation to this node operations.
No functional changes.
1.3x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11764
2021-07-05 23:36:43 +02:00
0c90aa097d Compositor: Full frame Color Correction node
Adds full frame implementation to this node operation.
No functional changes.
1.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11765
2021-07-05 23:36:43 +02:00
bf75106ae9 Compositor: Full frame Exposure node
Adds full frame implementation to this node operation.
No functional changes.
1.7x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11766
2021-07-05 23:36:43 +02:00
c94877ae3d Compositor: Full frame Gamma node
Adds full frame implementation to this node operation.
No functional changes.
1.5x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11767
2021-07-05 23:36:43 +02:00
00c6cbb985 Compositor: Add base operation for updating buffer rows
Simplifies code for operations with correlated
coordinates between inputs and output.
2021-07-05 23:36:43 +02:00
61afbf55f1 Cleanup: Use enum for UI block emboss type 2021-07-05 14:52:21 -05:00
Nicholas Rishel
f3ec0d8e58 Replace Ghost integrals with stdint fixed width integers.
Also replace integer with bool in Ghost API when only used as boolean,
and uint8* with char* in Ghost API when variable is a string.

Reviewed By: brecht

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

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2021-07-05 11:00:45 -07:00
b66c21f8b0 Geometry Nodes: Use same shape as mesh line in curve line node
The line starts at the origin and ends at (0,0,1m), just like the mesh node.
2021-07-05 12:42:33 -05:00
Johnny Matthews
29d6750134 Geometry Nodes: Curve Primitive Line
This node creates a poly spline line in one of 2 modes:
 - Line between two points
 - Start Point, Direction, and Length

Both modes create splines with only start and endpoints.
A resample node can be used afterward to increase the point count.

Differential Revision: https://developer.blender.org/D11769
2021-07-05 12:27:12 -05:00
de70bcbb36 Cleanup: Clang tidy, unused include
Also a stupidly-included change I made when committing the patch.
2021-07-05 12:05:28 -05:00
Nikhil Shringarpurey
fd0370acc2 Geometry Nodes: Add explicit Float to Int conversion node
This patch adds a very simple node that explicitly converts a float to
an int. While this may seem redundant, it would offer 2 benefits to the
current requirement to use implicit float conversions:
 1. It makes the node tree's intent more clear and self-documenting
    (especially if changes in the future require integer inputs).
 2. It eliminates undefined behavior in current/future nodes from float
    inputs by guaranteeing that the input is an integer.

The node offers a variety of rounding techniques to make it more flexible.

Differential Revision: https://developer.blender.org/D11700
2021-07-05 11:52:10 -05:00
08241b313c Fix (studio reported) missing object's parent handling in readfile expand code.
This would prevent loading a parent that would only be referenced by
children during a linking operation.

Looks like this missing bit of code has been there since the stone ages,
it is fairly baffling to find that such critical low-levels mistakes can
survive decades in a codebase...

Note that such fully-indirectly linked parent object is not instantiated
in scene currently, this is fairly bad I think, but kind of a different
issue.
2021-07-05 18:07:02 +02:00
Yuki Hashimoto
0ef794b553 macOS: support Chinese and Korean input for text buttons
This patch extends D11695 to provide full support for Chinese and Korean
input on macOS.

Chinese input notes:

You can input symbolic characters (such as '! , '$') during Chinese input.

The difference from Japanese input is that multiple `insertText` may be
called with a single key down (`keyDown` method). This happens when you input
a symbolic character (such as '! , '$') during conversion.

The conversion is confirmed (`insertText`) and the symbolic character is
entered (`insertText`). To solve this problem, I have `result_text` to
concatenate the strings and store them in `result`.

Korean input notes:

Korean does not display a conversion suggestion window.

Like Chinese, Korean input may call multiple `insertText` methods. Also,
in Korean, the previous confirmation (`setMarkedText` and `insertText`) and
the next conversion is processed (`setMarkedText`) may be called
simultaneously with a single key down (`keyDown` method).

For example:
1. press g ㅎ (`setMarkedText`)
2. press k 하 (`setMarkedText`)
3. press t 앗 (`setMarkedText`)
4. press k 하세 (`setMarkedText`, `insertText`, `setMarkedText`)

Fixed so that the `insertText` and the last `setMarkedText` are processed.

Also, if a control character (such as Arrow, Enter) is input during Korean
input, the conversion will be confirmed (`setMarkedText`, `insertText`) and
the original control character will be processed.

In other words, if you press the left arrow key while typing in Korean, the
cursor will move to the left after the character is confirmed. Therefore, I
modified the `keyDown` method so that the `handleKeyEvent` is called again
after the `insertText` is processed in the `interpretKeyEvents` method.

Differential Revision: https://developer.blender.org/D11699
2021-07-05 17:24:34 +02:00
Yuki Hashimoto
83e2f8c993 macOS: support Japanese input for text buttons
Blender did not support to input East Asian characters (Chinese, Japanese,
Korean) on macOS. This patch adds support for Japanese input, by implementing
the appropriate processing for the NSTextInputClient protocol.

Technical notes:
* The conversion candidate window is drawn by the input method program calling
  `firstRectForCharacterRange`.
* The string before confirmation (called `composite` in blender) is handled in
  the `setMarkedText` method called by the input method program.
* The string after confirmation (called `result` in the blender) is processed
  in the `insertText` method called by the input method program.

Ref T51283

Differential Revision: https://developer.blender.org/D11695
2021-07-05 17:24:27 +02:00
Yuki Hashimoto
ac1ed19eae Fix: macOS wrong IME candidate window position on first display
IME conversion candidate window was displayed at the mouse position, instead of
below the cursor or text selection.

Blender need to tell the input method program where the conversion candidate
window is during Japanese and Chinese input.

In macOS, the `firstRectforCharacterRange` is called when input by the input
method starts, and the position of the conversion candidate window is
specified. Therefore, it is necessary to set the position of the conversion
candidate window before input starts. This patch changes it so that the position
of the conversion candidate window is always set when the cursor is drawn.

Differential Revision: https://developer.blender.org/D11697
2021-07-05 17:20:05 +02:00
673c254c7d Cleanup: Rename ambiguous "params" variable in File Browser notifier listeners
File Browser code uses the term "params" for its file selection parameters a
lot. Avoid confusion/ambiguity by calling the notifier listener parameters
"listener_params".
2021-07-05 16:45:15 +02:00
cadda7aa5c Assets: Disable file renaming operator for Asset Browsers
This operator only works with renaming files, not assets.
2021-07-05 16:06:47 +02:00
b8115f0c5b Fix performance regression in Exact boolean due to exact triangulation.
Went back to using Blender's polyfill for triangulation, which is much
faster (time for a 3.1M face boolean went from 103s to 48s).
Had to put in detection for the case that needs the exact triangulator
(bug T86805), and also a fix for non-convex quads (bug T89330).
2021-07-05 10:00:29 -04:00
dac81ad71b EditMesh: extract restore logic out of EDBM_redo_state_free
Split mesh restore logic into a new function:
`EDBM_redo_state_restore_and_free`.
2021-07-05 23:45:21 +10:00
d27db03444 LineArt: Fix occlusion effectiveness for culled triangles. 2021-07-05 20:43:03 +08:00
Yuki Hashimoto
2d0b9faaf6 Fix: IME conversion candidate window not correctly placed on macOS
Blender needs to tell the input method program where the conversion
candidate window is during Japanese and Chinese input.

In macOS, there are displays where the window size and the native pixel size
are different, so the candidate window may appear in an unnatural position.

This patch converts the cursor position x and y for matching macOS window
coordinate. On Windows, GHOST_GetNativePixelSize returns 1, so it has no effect.

Differential Revision: https://developer.blender.org/D11696
2021-07-05 14:32:35 +02:00
Yuki Hashimoto
32124b940e Fix: IME input displays text after cursor before cursor
When inserting text using IME on a button, the character after the cursor is
displayed before the cursor.

This bug seems to have occurred during the refactoring in D765.

Differential Revision: https://developer.blender.org/D11072
2021-07-05 14:32:35 +02:00
bd0de99b52 Cleanup: spelling, punctuation 2021-07-05 22:27:03 +10:00
2ecc33d84b Cleanup: move repeated assignment out of nested for loop 2021-07-05 22:02:57 +10:00
6eb8340ef4 Cleanup: use const arguments 2021-07-05 22:02:57 +10:00
416e006a2a Cleanup: use 'use_' prefix for RNA booleans 2021-07-05 22:02:57 +10:00
92b775d319 Cleanup: remove unnecessary bmesh operator comments 2021-07-05 22:02:57 +10:00
ab6a011b3b GPencil: Fix memory leak in trim and split functions.
`dvert->dw` from old strokes are not freed properly, fixed.
2021-07-05 19:56:41 +08:00
aad8b8405c Fix T89655: tweak Cycles transparent bounces UI for clarity
Transparent bounces are independent of other bounces, so don't group
them together.
2021-07-05 13:42:54 +02:00
2eca9c7ed4 Cleanup: Move common File Browser renaming code into functions
Code would manually do the same things in a couple of places, obvious case of
unnecessary code duplication.
2021-07-05 13:35:41 +02:00
Yuki Hashimoto
2c6c1b6cc0 Cleanup: replace NSTextInput with NSTextInputClient
This revision replaces the deprecated protocol NSTextInput with
NSTextInputClient in Cocoa Text View. No functional changes.

For more information of the methods, please see:
https://developer.apple.com/documentation/appkit/nstextinputclient

Differential Revision: https://developer.blender.org/D11407
2021-07-05 13:10:08 +02:00
Yuki Hashimoto
c1ba68dd04 Cleanup: use arrayWithObject to reduce the code
Similar code is found in Apple's code samples.

Differential Revision: https://developer.blender.org/D11434
2021-07-05 13:10:08 +02:00
24a77745a4 Functions: add utility to create string from value of generic type 2021-07-05 13:02:16 +02:00
fb46c047bd BLI: wrap more features off tbb::enumerable_thread_specific
* Make the wrapper enumerable.
* Support an initializer function.
2021-07-05 13:02:16 +02:00
ded4dc7761 BLI: add conversion constructor for destruct_ptr
This allows converting between different `destruct_ptr` types (which is
just a `std::unique_ptr` with a custom deleter).

The most common use case is to convert from a derived type to
the type of the base class.
2021-07-05 13:02:16 +02:00
dc3f46d96b Tests: performance testing framework
These are scripts for benchmarking Blender features on real-world .blend
files. They were originally written for benchmarking Cycles performance, and
were made generic so they can be used for more Blender features.

The benchmarks can be run locally by developers. But the plan is to also run
these as part of continuous integration to track performance over time.

Currently there are tests for Cycles rendering and .blend file loading.

Documentation:
https://wiki.blender.org/wiki/Tools/Tests/Performance

Main features:
* User created configurations to quickly run, re-run and analyze a selected
  subset of tests.
* Supports both benchmarking with existing builds, and automatic building of
  specified git commits, tags and branches.
* Generate HTML page with bar and line graphs from test results.
* Controlled using simple command line tool.
* For writing tests, convenient abstraction to run a Python function in Blender
  with arguments and return value.

Ref T74730

Differential Revision: https://developer.blender.org/D11662
2021-07-05 12:32:32 +02:00
bb971bead9 Fix T89523: Cycles OpenCL compile error after shadow terminator changes 2021-07-05 11:26:40 +02:00
e785569c95 Cleanup: clang-tidy 2021-07-05 19:09:24 +10:00
c9eaf04afb Cleanup: remove outdated comment 2021-07-05 19:08:19 +10:00
a87593e62a Fix early return in reverse-color where continue was intended 2021-07-05 18:54:53 +10:00
9009ac2c3d Geometry Nodes: new Viewer node
This adds a viewer node similar to the one in the compositor.
The icon in the headers of nodes is removed because it served
the same purpose and is not necessary anymore.

Node outputs can be connected to the active viewer using
ctrl+shift+LMB, just like in the compositor. Right now this collides
with the shortcut used in the node wrangler addon, which will
be changed separately.

As of now, the viewed geometry is only visible in the spreadsheet.
Viewport visualization will be added separately.

There are a couple of benefits of using a viewer node compared
to the old approach with the icon in the node header:
* Better support for nodes that have more than one geometry output.
* It's more consistent with the compositor.
* If attributes become decoupled from geometry in the future,
  the viewer can have a separate input for the attribute to visualize.
* The viewer node could potentially have visualization settings.
* Allows to keep "visualization points" around by having multiple
  viewer nodes.
* Less visual clutter in node headers.

Differential Revision: https://developer.blender.org/D11470
2021-07-05 10:46:36 +02:00
04313f1bb5 BMesh: remove redundant mesh-backups from EDBM_op_* API
Using BMesh operators through the edit-mesh API created a full copy
of the mesh so it was possible to restore the mesh in case
one of the operators raised an error.

Remove support for automatic backup/restore from the EDBM_op_* API's
as it adds significant overhead and was rarely used.

Operators that need this can use the BMBackup API to backup & restore
the mesh in case of failure.

Add warning levels to BMO_error_raise so operators can report problems
without it being interpreted as a request to cancel the operation.

For high-poly meshes creating and freeing a full copy is an expensive
operation, removing this gives a speedup of ~1.77x for most operators
except for "connect_verts" / "connect_vert_pair"
which still uses this functionality.
2021-07-05 18:36:33 +10:00
afe7387be8 BMesh: remove redundant copy-on-write tagging
The evaluated meshes no longer store a copy of the edit-mesh
so tagging when a BMesh operator fails can be removed.
2021-07-05 18:31:44 +10:00
b29a8a5dfe BMesh: dissolve faces no longer fails when some faces can't dissolve
Previously, any face groups that could not be merged into a face
caused the entire operation to report an error and do nothing.

Now these cases are skipped over, dissolving faces where possible.
2021-07-05 18:31:44 +10:00
9075f63e8f Cleanup: unused variable 2021-07-05 10:29:21 +02:00
76f7b22989 Cleanup: minor improvements to BMesh dissolve faces
- Only create arrays with groups of two or more faces.
- Remove raising exception for zero length arrays.
- Remove redundant exception check (assert there is no exception).
- Use a struct for face array & it's length instead of a NULL
  terminated array (removes the need to count faces in a loop).
2021-07-05 15:54:57 +10:00
dccadc9e78 Cleanup: update comment formatting
- Replace '[mce]' with "Mike Erwin".
- Remove references to turn-table author as it isn't useful information,
  the author was credited in the commit message.
2021-07-05 15:54:57 +10:00
5b2d2b2319 Cleanup: remove temporary header 2021-07-05 15:54:57 +10:00
2929cfe5de Cleanup: remove unused defines 2021-07-05 15:54:57 +10:00
f0f7282d9d Cleanup: spelling in comments 2021-07-05 15:54:57 +10:00
b73dc36859 GPencil: Add weight factor to Offset randomize
Now, The weight is used in the randomize parameters of the offset modifier. 

This is useful to generate effects like explosions.

Related to the new Vertex Weight modifiers.
2021-07-03 17:41:12 +02:00
9b89de2571 Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
2021-07-04 00:43:40 +10:00
05f970847e GPencil: Fix unreported PDF export offset
When exporting a PDF, the image was displaced towards top right a few pixels.

Also removed is_orthographic variable because is not needed now.
2021-07-03 12:32:44 +02:00
2d146b61d8 Cleanup: Use simpler method to retrieve attribute domain 2021-07-02 23:16:39 -05:00
5f5cf21a83 Cleanup: Remove unused transform matrix from objects
This was the only reference to this matrix.

https://developer.blender.org/D11770
2021-07-02 13:27:56 -05:00
55f27617cf Geometry Nodes: Add mesh input warning to curve to mesh node
A point of confusion about this node is that it doesn't work on the
output of the mesh circle primitive node. This patch adds a warning to
help with that. This avoids adding a warning when the geometry set
input has no mesh.

Differential Revision: https://developer.blender.org/D11771
2021-07-02 13:24:42 -05:00
00e30f122b Build: upgrade NanoVDB library to latest revision
This includes improved handling of OpenVDB trees with inactive voxels,
which previously could throw an error.

Ref T89581, T88438
2021-07-02 19:06:08 +02:00
82466ca2e5 Fix T89581: Cycles crash rendering some OpenVDB files with inactive voxels
Print an error message instead.
2021-07-02 19:01:53 +02:00
0c84939117 Cleanup: use template utility function to handle OpenVDB grid types in Cycles 2021-07-02 19:01:53 +02:00
8221d64844 Cleanup: Further use of const when accessing evaluated mesh
Also resolve a warning from the previous commit. The next blocker to
using const is `BKE_mesh_wrapper_ensure_mdata`.
2021-07-02 11:56:29 -05:00
5f8969bb4b Cleanup: Use const mesh to ensure BVH and triangulation cache
As noted in a comment now, these functions only update a cache, so they
don't change the logical state of the mesh, which is "it will have the
data when necessary." Using a const argument will help const correctness
when accessing an object's evaluated mesh.
2021-07-02 11:37:01 -05:00
a1609340b4 Cleanup: Fix variable redeclaration warning 2021-07-02 10:07:43 -05:00
b04a2a7be7 add utility 2021-06-13 14:42:22 +02:00
083671e8ac progress 2021-06-13 14:25:23 +02:00
78ea401e19 Merge branch 'master' into mf-procedure 2021-06-13 14:13:22 +02:00
f3ca987bce start constructing procedure from node tree 2021-06-11 13:39:38 +02:00
2245add9f8 Merge branch 'master' into mf-procedure 2021-06-11 12:59:12 +02:00
31004d7fac start with creating procedure for node tree 2021-05-31 10:51:34 +02:00
3d3f66ed41 fix merge conflicts 2021-05-29 12:14:48 +02:00
c9c0195da5 Merge branch 'master' into mf-procedure 2021-05-29 12:07:13 +02:00
70c0403858 fixes 2021-03-27 22:58:44 +01:00
8d4de82c7f initial network to procedure 2021-03-27 22:30:53 +01:00
22c51c2d51 cleanup 2021-03-27 21:22:28 +01:00
158bd7c6a0 cleanup 2021-03-27 21:18:48 +01:00
4a28d0b583 another check 2021-03-27 15:52:13 +01:00
0501e6e693 fix memory leak in test 2021-03-27 15:45:59 +01:00
8450ac09c1 comment containing things to check 2021-03-27 15:36:08 +01:00
1af00015e8 initial destruct support 2021-03-27 15:29:02 +01:00
b44c3a3125 count initializations 2021-03-27 15:12:36 +01:00
d729f1ca37 cleanup 2021-03-27 15:08:21 +01:00
0fc9f00c14 start extracting container 2021-03-27 14:53:39 +01:00
6c9b339af7 refactor variable store 2021-03-27 14:46:53 +01:00
b7a976af01 branch test 2021-03-27 14:07:23 +01:00
a689037917 initial branch instruction 2021-03-27 13:48:18 +01:00
313403c1f1 support mutable params 2021-03-27 13:33:42 +01:00
60409b8823 simplify 2021-03-27 13:19:46 +01:00
773dc2ec94 improve dot graph 2021-03-27 13:14:19 +01:00
2a98c5d06b initial execution 2021-03-27 13:06:50 +01:00
6d1b4ce3c6 simplify 2021-03-27 12:06:40 +01:00
0b2d961b70 move executor to separate file 2021-03-27 11:55:51 +01:00
d553b70470 Merge branch 'master' into mf-procedure 2021-03-27 11:52:12 +01:00
6954f2cdd7 dot export 2021-03-24 18:46:17 +01:00
8cc832110a more 2021-03-24 18:23:36 +01:00
7b8c54b5a1 more 2021-03-24 17:51:37 +01:00
e850d175b5 more 2021-03-24 17:42:18 +01:00
326f79d59b more 2021-03-24 17:39:22 +01:00
ec4954ece2 destructor 2021-03-24 17:34:14 +01:00
b30e782c82 more stuff 2021-03-24 17:30:53 +01:00
e34fe5d28e add destruct instruction 2021-03-24 16:49:52 +01:00
8581a062f1 Merge branch 'master' into mf-procedure 2021-03-24 16:47:48 +01:00
b43971e5e9 add executor class 2021-03-23 16:20:40 +01:00
855382170e initial mf procedure data structure 2021-03-23 16:18:23 +01:00
2195 changed files with 63280 additions and 32245 deletions

View File

@@ -110,6 +110,10 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
@@ -349,7 +353,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
if(WIN32)
if(WIN32 OR APPLE)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
@@ -403,14 +407,14 @@ set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified
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)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
@@ -424,6 +428,10 @@ mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD)
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
if(APPLE)
@@ -604,12 +612,6 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -627,6 +629,18 @@ if(WIN32)
endif()
if(WIN32 OR XCODE)
option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
if (IDE_GROUP_PROJECTS_IN_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
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)
@@ -1584,6 +1598,10 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
# Designated initializer is a C++20 feature & breaks MSVC build. Dropping MSVC 2019 or
# updating to C++20 allows removing this.
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
@@ -1705,22 +1723,18 @@ if(WITH_PYTHON)
endif()
endif()
if(MSVC)
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)
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"
)
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
# Select C++17 as the standard for C++ projects.
set(CMAKE_CXX_STANDARD 17)
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Do not enable compiler specific language extentions.
set(CMAKE_CXX_EXTENSIONS OFF)
# 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 AND MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
# Visual Studio has all standards it supports available by default
@@ -1915,6 +1929,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INPUT_IME)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)

View File

@@ -63,7 +63,7 @@ Package Targets
* package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package.
* package_archive: Build an archive package.
Testing Targets
Not associated with building Blender.
@@ -167,7 +167,7 @@ endef
# This makefile is not meant for Windows
ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make")
$(error On Windows, use "cmd //c make.bat" instead of "make")
endif
# System Vars
@@ -379,7 +379,7 @@ deps: .FORCE
@cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
@echo
@echo Building dependencies ...
@@ -456,7 +456,8 @@ project_eclipse: .FORCE
check_cppcheck: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
$(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
@@ -518,8 +519,9 @@ source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE
cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
cmake \
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@@ -527,9 +529,11 @@ source_archive_complete: .FORCE
INKSCAPE_BIN?="inkscape"
icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \
@@ -543,7 +547,7 @@ update_code: .FORCE
format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# -----------------------------------------------------------------------------
@@ -553,8 +557,9 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
@@ -563,8 +568,9 @@ doc_doxy: .FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE

View File

@@ -56,6 +56,7 @@ else()
endif()
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
include(cmake/png.cmake)
include(cmake/jpeg.cmake)
@@ -81,7 +82,11 @@ if(UNIX)
endif()
include(cmake/openimageio.cmake)
include(cmake/tiff.cmake)
include(cmake/flexbison.cmake)
if(WIN32)
include(cmake/flexbison.cmake)
elseif(UNIX AND NOT APPLE)
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
@@ -164,6 +169,7 @@ endif()
if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
endif()
include(cmake/harvest.cmake)

View File

@@ -87,7 +87,10 @@ download_source(LIBGLU)
download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
download_source(FLEX)

View File

@@ -30,6 +30,7 @@ if(WIN32)
--enable-w32threads
--disable-pthreads
--enable-libopenjpeg
--disable-mediafoundation
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS

View File

@@ -0,0 +1,28 @@
# ***** 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 *****
ExternalProject_Add(external_flex
URL file://${PACKAGE_DIR}/${FLEX_FILE}
URL_HASH ${FLEX_HASH_TYPE}=${FLEX_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/flex
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flex
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make install
INSTALL_DIR ${LIBDIR}/flex
)

View File

@@ -106,6 +106,7 @@ harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
@@ -126,6 +127,8 @@ if(UNIX AND NOT APPLE)
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
@@ -190,6 +193,8 @@ harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")

View File

@@ -35,6 +35,7 @@ elseif(APPLE)
else()
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
-DARM_ENABLED=Off
)
endif()
@@ -43,6 +44,7 @@ elseif(UNIX)
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
)
endif()
@@ -82,4 +84,9 @@ if(WIN32)
external_ispc
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_ispc
external_flex
)
endif()

View File

@@ -66,7 +66,11 @@ ExternalProject_Add(ll
if(MSVC)
if(BUILD_MODE STREQUAL Release)
set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ )
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib ${HARVEST_TARGET}/llvm/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include ${HARVEST_TARGET}/llvm/include &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/llvm/bin/clang-format.exe ${HARVEST_TARGET}/llvm/bin/clang-format.exe
)
else()
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ &&

View File

@@ -45,7 +45,6 @@ ExternalProject_Add(external_openimagedenoise
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/oidn.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimagedenoise
)

View File

@@ -16,15 +16,20 @@
#
# ***** END GPL LICENSE BLOCK *****
if(APPLE)
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
else()
set(OPENMP_PATCH_COMMAND)
endif()
ExternalProject_Add(external_openmp
URL file://${PACKAGE_DIR}/${OPENMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
PREFIX ${BUILD_DIR}/openmp
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_DIR ${LIBDIR}/openmp
)

View File

@@ -20,12 +20,10 @@ if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
SET(OSL_PLATFORM_FLAGS -DLINKSTATIC=ON)
else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
SET(OSL_PLATFORM_FLAGS)
endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
@@ -51,12 +49,13 @@ set(OSL_EXTRA_ARGS
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF
-DPNG_ROOT=${LIBDIR}/png
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
${OSL_PLATFORM_FLAGS}
-DLINKSTATIC=ON
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
@@ -69,13 +68,9 @@ set(OSL_EXTRA_ARGS
${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
)
# Apple arm64 uses LLVM 11, LLVM 10+ requires C++14
if (APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
list(APPEND OSL_EXTRA_ARGS -DCMAKE_CXX_STANDARD=14)
endif()
ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -93,10 +88,20 @@ add_dependencies(
ll
external_openexr
external_zlib
external_flexbison
external_openimageio
external_pugixml
)
if(WIN32)
add_dependencies(
external_osl
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_osl
external_flex
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -23,7 +23,7 @@ set(PNG_EXTRA_ARGS
)
if(BLENDER_PLATFORM_ARM)
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=ON -DCMAKE_SYSTEM_PROCESSOR="aarch64")
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
endif()
ExternalProject_Add(external_png

View File

@@ -152,35 +152,28 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
if(BLENDER_PLATFORM_ARM)
# Newer version required by ISPC with arm support.
set(LLVM_VERSION 11.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH e700af40ab83463e4e9ab0ba3708312e)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_VERSION 12.0.0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
if(APPLE)
# Cloth physics test is crashing due to this bug:
# https://bugs.llvm.org/show_bug.cgi?id=50579
set(OPENMP_VERSION 9.0.1)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
else()
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_VERSION ${LLVM_VERSION})
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
endif()
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -190,9 +183,9 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.10.0)
set(OSL_VERSION 1.11.14.1)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH dfdc23597aeef083832cbada62211756)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -216,9 +209,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
@@ -370,12 +363,18 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4)
set(FLEXBISON_HASH_TYPE MD5)
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEX_VERSION 2.6.4)
set(FLEX_URI https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz)
set(FLEX_HASH 2882e3179748cc9f9c23ec593d6adc8d)
set(FLEX_HASH_TYPE MD5)
set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
# Libraries to keep Python modules static on Linux.
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
@@ -432,9 +431,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.0)
set(OIDN_VERSION 1.4.1)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 421824019becc5b664a22a2b98332bc5)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -444,10 +443,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(MESA_VERSION 20.3.4)
set(MESA_VERSION 21.1.5)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 556338446aef8ae947a789b3e0b5e056)
set(MESA_HASH_TYPE MD5)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(NASM_VERSION 2.15.02)
@@ -456,25 +455,23 @@ set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(XR_OPENXR_SDK_VERSION 1.0.14)
set(XR_OPENXR_SDK_VERSION 1.0.17)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
set(XR_OPENXR_SDK_HASH bf0fd8828837edff01047474e90013e1)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
if(BLENDER_PLATFORM_ARM)
# Unreleased version with macOS arm support.
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
else()
set(ISPC_VERSION v1.14.1)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
endif()
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(ISPC_VERSION v1.16.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
set(GMP_VERSION 6.2.0)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
@@ -494,5 +491,11 @@ set(HARU_HASH 4f916aa49c3069b3a10850013c507460)
set(HARU_HASH_TYPE MD5)
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
set(ZSTD_VERSION 1.5.0)
set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)

View File

@@ -0,0 +1,27 @@
# ***** 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 *****
ExternalProject_Add(external_wayland_protocols
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
PREFIX ${BUILD_DIR}/wayland-protocols
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -0,0 +1,51 @@
# ***** 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(ZSTD_EXTRA_ARGS
-DZSTD_BUILD_PROGRAMS=OFF
-DZSTD_BUILD_SHARED=OFF
-DZSTD_BUILD_STATIC=ON
-DZSTD_BUILD_TESTS=OFF
-DZSTD_LEGACY_SUPPORT=OFF
-DZSTD_LZ4_SUPPORT=OFF
-DZSTD_LZMA_SUPPORT=OFF
-DZSTD_MULTITHREAD_SUPPORT=ON
-DZSTD_PROGRAMS_LINK_SHARED=OFF
-DZSTD_USE_STATIC_RUNTIME=OFF
-DZSTD_ZLIB_SUPPORT=OFF
)
ExternalProject_Add(external_zstd
URL file://${PACKAGE_DIR}/${ZSTD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ZSTD_HASH_TYPE}=${ZSTD_HASH}
PREFIX ${BUILD_DIR}/zstd
SOURCE_SUBDIR build/cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zstd ${DEFAULT_CMAKE_FLAGS} ${ZSTD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/zstd
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_zstd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zstd/lib/zstd_static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/zstd_static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
DEPENDEES install
)
endif()
endif()

View File

@@ -474,25 +474,25 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.1"
OIIO_VERSION="2.2.15.1"
OIIO_VERSION_SHORT="2.2"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="2.2.10"
OIIO_VERSION_MAX="2.3.0"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
OIIO_SKIP=false
LLVM_VERSION="9.0.1"
LLVM_VERSION_SHORT="9.0"
LLVM_VERSION_MIN="6.0"
LLVM_VERSION_MAX="12.0"
LLVM_VERSION="12.0.0"
LLVM_VERSION_SHORT="12.0"
LLVM_VERSION_MIN="11.0"
LLVM_VERSION_MAX="13.0"
LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
OSL_VERSION="1.11.10.0"
OSL_VERSION="1.11.14.1"
OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11"
OSL_VERSION_MAX="2.0"
@@ -553,7 +553,7 @@ EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false
OIDN_VERSION="1.4.0"
OIDN_VERSION="1.4.1"
OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MAX="1.5"
@@ -561,7 +561,7 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false
OIDN_SKIP=false
ISPC_VERSION="1.14.1"
ISPC_VERSION="1.16.0"
FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4"
@@ -572,7 +572,7 @@ FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.14"
XR_OPENXR_VERSION="1.0.17"
XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8"
XR_OPENXR_VERSION_MAX="2.0"
@@ -1019,7 +1019,7 @@ PRINT ""
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" )
@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false
@@ -1108,9 +1108,9 @@ FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
XR_OPENXR_USE_REPO=false
XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz")
#~ XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
#~ XR_OPENXR_REPO_UID="5900c51562769b03bea699dc0352cae56acb6419d"
#~ XR_OPENXR_REPO_BRANCH="master"
XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
XR_OPENXR_REPO_UID="bf21ccb1007bb531b45d9978919a56ea5059c245"
XR_OPENXR_REPO_BRANCH="master"
# C++11 is required now
CXXFLAGS_BACK=$CXXFLAGS
@@ -1128,7 +1128,8 @@ Those libraries should be available as packages in all recent distributions (opt
* Basics of dev environment (cmake, gcc, svn , git, ...).
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1446,9 +1447,7 @@ compile_Python() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1
fi
@@ -1464,6 +1463,9 @@ compile_Python() {
INFO "If you want to force rebuild of this lib, use the --force-python option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "python-$PYTHON_VERSION_SHORT"
# Extra step: install required modules with pip.
@@ -1557,9 +1559,7 @@ compile_Boost() {
--prefix=$_inst --disable-icu boost.locale.icu=off install
./b2 --clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1
fi
@@ -1573,7 +1573,9 @@ compile_Boost() {
INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "boost"
}
@@ -1686,9 +1688,7 @@ compile_TBB() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting"
exit 1
fi
@@ -1702,6 +1702,9 @@ compile_TBB() {
INFO "If you want to force rebuild of this lib, use the --force-tbb option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "tbb"
}
@@ -1821,9 +1824,7 @@ compile_OCIO() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1
fi
@@ -1837,6 +1838,9 @@ compile_OCIO() {
INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "ocio"
}
@@ -1952,9 +1956,7 @@ compile_OPENEXR() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1
fi
@@ -1970,7 +1972,9 @@ compile_OPENEXR() {
_with_built_openexr=true
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openexr"
}
@@ -2111,9 +2115,7 @@ compile_OIIO() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1
fi
@@ -2127,7 +2129,9 @@ compile_OIIO() {
INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi
# Just always run it, much simpler this way!
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oiio"
}
@@ -2236,9 +2240,7 @@ compile_LLVM() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1
fi
@@ -2251,6 +2253,10 @@ compile_LLVM() {
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -2315,6 +2321,7 @@ compile_OSL() {
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
-xf $_src.tar.gz
fi
patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff
fi
cd $_src
@@ -2337,7 +2344,6 @@ compile_OSL() {
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
@@ -2345,7 +2351,10 @@ compile_OSL() {
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF"
cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_Qt5=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D INSTALL_DOCS=OFF"
if [ $(uname -m) != "aarch64" ]; then
cmake_d="$cmake_d -D USE_SIMD=sse2"
@@ -2367,10 +2376,7 @@ compile_OSL() {
fi
if [ -d $INST/oiio ]; then
cmake_d="$cmake_d -D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
# HACK! SIC!!!!
# Quiet incredible, but if root dir is given, path to lib is found, but not path to include...
cmake_d="$cmake_d -D OPENIMAGEIO_INCLUDE_DIR=$INST/oiio/include"
cmake_d="$cmake_d -D OpenImageIO_ROOT=$INST/oiio"
fi
if [ ! -z $LLVM_VERSION_FOUND ]; then
@@ -2389,9 +2395,7 @@ compile_OSL() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1
fi
@@ -2405,6 +2409,9 @@ compile_OSL() {
INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osl"
}
@@ -2505,9 +2512,7 @@ compile_OSD() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1
fi
@@ -2521,6 +2526,9 @@ compile_OSD() {
INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osd"
}
@@ -2610,9 +2618,7 @@ compile_BLOSC() {
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
exit 1
fi
@@ -2625,6 +2631,9 @@ compile_BLOSC() {
magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "blosc"
}
@@ -2715,9 +2724,7 @@ install_NanoVDB() {
#~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1
fi
@@ -2729,6 +2736,10 @@ install_NanoVDB() {
else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
@@ -2737,7 +2748,7 @@ _init_openvdb() {
_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
@@ -2842,15 +2853,13 @@ compile_OPENVDB() {
if [ -d $INST/blosc ]; then
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
fi
cmake $cmake_d ..
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
exit 1
fi
@@ -2864,6 +2873,9 @@ compile_OPENVDB() {
INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then
@@ -2961,9 +2973,7 @@ compile_ALEMBIC() {
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
@@ -2977,6 +2987,9 @@ compile_ALEMBIC() {
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "alembic"
}
@@ -3061,9 +3074,7 @@ compile_USD() {
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "USD-$USD_VERSION failed to compile, exiting"
exit 1
fi
@@ -3077,6 +3088,9 @@ compile_USD() {
INFO "If you want to force rebuild of this lib, use the --force-usd option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "usd"
}
@@ -3170,9 +3184,7 @@ compile_OpenCOLLADA() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1
fi
@@ -3185,6 +3197,10 @@ compile_OpenCOLLADA() {
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3285,9 +3301,7 @@ compile_Embree() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
exit 1
fi
@@ -3300,6 +3314,10 @@ compile_Embree() {
INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-embree option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3362,9 +3380,7 @@ install_ISPC() {
mkdir -p $_inst
cp -r $_src/bin $_inst/bin
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "ISPC-v$ISPC_VERSION failed to install, exiting"
exit 1
fi
@@ -3377,6 +3393,10 @@ install_ISPC() {
INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!"
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
_ispc_path_bin=$_inst/bin
run_ldconfig "ispc"
}
@@ -3476,9 +3496,7 @@ compile_OIDN() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
exit 1
fi
@@ -3492,6 +3510,9 @@ compile_OIDN() {
INFO "If you want to force rebuild of this lib, use the --force-oidn option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oidn"
}
@@ -3608,9 +3629,7 @@ compile_FFmpeg() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1
fi
@@ -3623,6 +3642,10 @@ compile_FFmpeg() {
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
}
# ----------------------------------------------------------------------------
@@ -3721,9 +3744,7 @@ compile_XR_OpenXR_SDK() {
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
if [ ! -d $_inst ]; then
ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting"
exit 1
fi
@@ -3737,6 +3758,9 @@ compile_XR_OpenXR_SDK() {
INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option."
fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "xr-openxr-sdk"
}
@@ -3839,10 +3863,11 @@ install_DEB() {
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev"
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev"
# libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true
@@ -4110,6 +4135,8 @@ install_DEB() {
PRINT ""
# Debian OIIO includes again libopencv, without even properly dealing with this dependency...
OIIO_FORCE_BUILD=true
if [ "$OIIO_SKIP" = true ]; then
WARNING "Skipping OpenImageIO installation, as requested..."
elif [ "$OIIO_FORCE_BUILD" = true ]; then
@@ -4508,10 +4535,11 @@ install_RPM() {
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
gmp-devel pugixml-devel potrace-devel libharu-devel"
gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel"
OPENJPEG_USE=true
VORBIS_USE=true
@@ -5089,10 +5117,11 @@ install_ARCH() {
BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
fi
_packages="$BASE_DEVEL git cmake fontconfig \
_packages="$BASE_DEVEL git cmake fontconfig flex \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu"
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
zstd"
OPENJPEG_USE=true
VORBIS_USE=true

View File

@@ -68,3 +68,32 @@
+
return ret;
}
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{
int i, q;
- VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size };
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
int qmul = q * 2;
int qadd = (q - 1) | 1;
- if (!rl->rl_vlc[q])
+ if (!rl->rl_vlc[q]){
+ av_free(table);
return;
+ }
if (q == 0) {
qmul = 1;
@@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
rl->rl_vlc[q][i].run = run;
}
}
+ av_free(table);
}

View File

@@ -1,10 +0,0 @@
--- external_openimagedenoise/cmake/oidn_ispc.cmake 2021-02-15 17:29:34.000000000 +0100
+++ external_openimagedenoise/cmake/oidn_ispc.cmake2 2021-02-15 17:29:28.000000000 +0100
@@ -98,7 +98,7 @@
elseif(OIDN_ARCH STREQUAL "ARM64")
set(ISPC_ARCHITECTURE "aarch64")
if(APPLE)
- set(ISPC_TARGET_OS "--target-os=ios")
+ set(ISPC_TARGET_OS "--target-os=macos")
endif()
endif()

View File

@@ -34,24 +34,3 @@ 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,18 +1,3 @@
diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej 1969-12-31 17:00:00 -0700
+++ external_osl/src/cmake/flexbison.cmake.rej 2018-08-24 17:42:11 -0600
@@ -0,0 +1,11 @@
+--- src/cmake/flexbison.cmake 2018-05-01 16:39:02 -0600
++++ src/cmake/flexbison.cmake 2018-08-24 10:24:03 -0600
+@@ -77,7 +77,7 @@
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+ ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx}
+- COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+ MAIN_DEPENDENCY ${flexsrc}
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600
@@ -63,19 +48,50 @@ diff -Naur org/CMakeLists.txt external_osl/CMakeLists.txt
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
index 445f6400..3d468de2 100644
--- a/src/liboslexec/llvm_util.cpp
+++ b/src/liboslexec/llvm_util.cpp
@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
#endif
//llvm_gen_debug_printf (std::string("start ") + std::string(name));
#if OSL_LLVM_VERSION >= 110
- OSL_DASSERT(llvm::isa<llvm::Function>(func));
- llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
+ llvm::Value* r = builder().CreateCall(
+ llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
+ llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
#else
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 990f50d69..46ef7351d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -252,11 +252,9 @@ install (EXPORT OSL_EXPORTED_TARGETS
FILE ${OSL_TARGETS_EXPORT_NAME}
NAMESPACE ${PROJECT_NAME}::)
-
-
-
-osl_add_all_tests()
-
+if (${PROJECT_NAME}_BUILD_TESTS AND NOT ${PROJECT_NAME}_IS_SUBPROJECT)
+ osl_add_all_tests()
+endif ()
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
include (packaging)
diff -Naur external_osl_orig/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
--- external_osl_orig/src/cmake/externalpackages.cmake 2021-06-01 13:44:18 -0600
+++ external_osl/src/cmake/externalpackages.cmake 2021-06-28 07:44:32 -0600
@@ -80,6 +80,7 @@
checked_find_package (ZLIB REQUIRED) # Needed by several packages
+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
# IlmBase & OpenEXR
checked_find_package (OpenEXR REQUIRED
diff -Naur external_osl_orig/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
--- external_osl_orig/src/liboslcomp/oslcomp.cpp 2021-06-01 13:44:18 -0600
+++ external_osl/src/liboslcomp/oslcomp.cpp 2021-06-28 09:11:06 -0600
@@ -21,6 +21,13 @@
#if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS 1
#endif
+
+// clang uses CALLBACK in its templates which causes issues if it is already defined
+#ifdef _WIN32 && defined(CALLBACK)
+# undef CALLBACK
+#endif
+
+//
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>

View File

@@ -0,0 +1,66 @@
# - Find Zstd library
# Find the native Zstd includes and library
# This module defines
# ZSTD_INCLUDE_DIRS, where to find zstd.h, Set when
# ZSTD_INCLUDE_DIR is found.
# ZSTD_LIBRARIES, libraries to link against to use Zstd.
# ZSTD_ROOT_DIR, The base directory to search for Zstd.
# This can also be an environment variable.
# ZSTD_FOUND, If false, do not try to use Zstd.
#
# also defined, but not for general use are
# ZSTD_LIBRARY, where to find the Zstd library.
#=============================================================================
# Copyright 2019 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ZSTD_ROOT_DIR was defined in the environment, use it.
IF(NOT ZSTD_ROOT_DIR AND NOT $ENV{ZSTD_ROOT_DIR} STREQUAL "")
SET(ZSTD_ROOT_DIR $ENV{ZSTD_ROOT_DIR})
ENDIF()
SET(_zstd_SEARCH_DIRS
${ZSTD_ROOT_DIR}
)
FIND_PATH(ZSTD_INCLUDE_DIR
NAMES
zstd.h
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(ZSTD_LIBRARY
NAMES
zstd
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set ZSTD_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Zstd DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
IF(ZSTD_FOUND)
SET(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
SET(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
ENDIF()
MARK_AS_ADVANCED(
ZSTD_INCLUDE_DIR
ZSTD_LIBRARY
)

View File

@@ -8,6 +8,9 @@ IGNORE_SOURCE = (
# specific source files
"extern/audaspace/",
# Use for `WIN32` only.
"source/creator/blender_launcher_win32.c",
# specific source files
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",

View File

@@ -82,7 +82,7 @@ def create_nb_project_main():
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
make_exe_basename = os.path.basename(make_exe)
# --------------- NB specific
# --------------- NetBeans specific.
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]

View File

@@ -7,7 +7,6 @@
set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEBUG ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_GTESTS ON CACHE BOOL "" FORCE)

View File

@@ -29,6 +29,7 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -30,6 +30,7 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -208,7 +208,7 @@ function(blender_source_group
)
# if enabled, use the sources directories as filters.
if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
if(IDE_GROUP_SOURCES_IN_FOLDERS)
foreach(_SRC ${sources})
# remove ../'s
get_filename_component(_SRC_DIR ${_SRC} REALPATH)
@@ -240,8 +240,8 @@ function(blender_source_group
endforeach()
endif()
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
# if enabled, set the FOLDER property for the projects
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})

View File

@@ -404,32 +404,16 @@ endif()
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
if(WITH_OPENMP)
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# Use OpenMP from our precompiled libraries.
message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
set(OPENMP_CUSTOM ON)
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(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` `LC_ID_DYLIB` is added by the deps builder.
# For single config generator datatoc, tests etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
)
# For multi-config generator datatoc, etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
)
# For multi-config generator tests.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
)
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
endif()
endif()
@@ -457,6 +441,9 @@ if(WITH_HARU)
endif()
endif()
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
find_package(Zstd REQUIRED)
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
@@ -480,10 +467,8 @@ else()
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
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
endif()
# Clang has too low template depth of 128 for libmv.
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
@@ -513,3 +498,15 @@ if(WITH_COMPILER_CCACHE)
endif()
endif()
endif()
# For binaries that are built but not installed (also not distributed) (datatoc,
# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
#
# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH
# is modified to find the dylib in an adjacent folder. Install step puts the libraries there.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")

View File

@@ -99,6 +99,7 @@ endif()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_PYTHON)

View File

@@ -57,8 +57,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
if(NOT WITH_PYTHON_MODULE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender)
endif()
@@ -217,8 +215,8 @@ else()
endif()
if(WITH_WINDOWS_PDB)
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
@@ -875,3 +873,6 @@ if(WITH_HARU)
set(WITH_HARU OFF)
endif()
endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)

View File

@@ -1,8 +1,10 @@
Pipeline Config
===============
This configuration file is used by buildbot new pipeline for the `update-code` step.
The `yaml` configuration file is used by buildbot build pipeline `update-code` step.
It will soon be used by the ../utils/make_update.py script.
The file allows to set branches or specific commits for both git submodules and svn artifacts. Can also define various build package versions for use by build workers. Especially useful in experimental and release branches.
Both buildbot and developers will eventually use the same configuration file.
NOTE:
* The configuration file is ```NOT``` used by the `../utils/make_update.py` script.
* That will implemented in the future.

View File

@@ -1,87 +0,0 @@
{
"update-code":
{
"git" :
{
"submodules":
[
{ "path": "release/scripts/addons", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/scripts/addons_contrib", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/datafiles/locale", "branch": "master", "commit_id": "HEAD" },
{ "path": "source/tools", "branch": "master", "commit_id": "HEAD" }
]
},
"svn":
{
"tests": { "path": "lib/tests", "branch": "trunk", "commit_id": "HEAD" },
"libraries":
{
"darwin-x86_64": { "path": "lib/darwin", "branch": "trunk", "commit_id": "HEAD" },
"darwin-arm64": { "path": "lib/darwin_arm64", "branch": "trunk", "commit_id": "HEAD" },
"linux-x86_64": { "path": "lib/linux_centos7_x86_64", "branch": "trunk", "commit_id": "HEAD" },
"windows-amd64": { "path": "lib/win64_vc15", "branch": "trunk", "commit_id": "HEAD" }
}
}
},
"buildbot":
{
"gcc":
{
"version": "9.0"
},
"sdks":
{
"optix":
{
"version": "7.1.0"
},
"cuda10":
{
"version": "10.1"
},
"cuda11":
{
"version": "11.3"
}
},
"cmake":
{
"default":
{
"version": "any",
"overrides":
{
}
},
"darwin-x86_64":
{
"overrides":
{
}
},
"darwin-arm64":
{
"overrides":
{
}
},
"linux-x86_64":
{
"overrides":
{
}
},
"windows-amd64":
{
"overrides":
{
}
}
}
}
}

View File

@@ -0,0 +1,70 @@
#
# Used by Buildbot build pipeline make_update.py script only for now
# We intended to update the make_update.py in the branches to use this file eventually
#
update-code:
git:
submodules:
- branch: master
commit_id: HEAD
path: release/scripts/addons
- branch: master
commit_id: HEAD
path: release/scripts/addons_contrib
- branch: master
commit_id: HEAD
path: release/datafiles/locale
- branch: master
commit_id: HEAD
path: source/tools
svn:
libraries:
darwin-arm64:
branch: trunk
commit_id: HEAD
path: lib/darwin_arm64
darwin-x86_64:
branch: trunk
commit_id: HEAD
path: lib/darwin
linux-x86_64:
branch: trunk
commit_id: HEAD
path: lib/linux_centos7_x86_64
windows-amd64:
branch: trunk
commit_id: HEAD
path: lib/win64_vc15
tests:
branch: trunk
commit_id: HEAD
path: lib/tests
benchmarks:
branch: trunk
commit_id: HEAD
path: lib/benchmarks
#
# Buildbot only configs
#
buildbot:
gcc:
version: '9.0.0'
cuda10:
version: '10.1.0'
cuda11:
version: '11.4.0'
optix:
version: '7.1.0'
cmake:
default:
version: any
overrides: {}
darwin-arm64:
overrides: {}
darwin-x86_64:
overrides: {}
linux-x86_64:
overrides: {}
windows-amd64:
overrides: {}

View File

@@ -1,9 +1,9 @@
echo No explicit msvc version requested, autodetecting version.
call "%~dp0\detect_msvc2017.cmd"
call "%~dp0\detect_msvc2019.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2019.cmd"
call "%~dp0\detect_msvc2017.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2022.cmd"

View File

@@ -0,0 +1,34 @@
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
if "%BF_LANG%" == "" set BF_LANG=en
set SPHINXOPTS=-j auto -D language=%BF_LANG%
call "%~dp0\find_sphinx.cmd"
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
exit /b 1
:detect_sphinx_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%BLENDER_BIN% ^
--background -noaudio --factory-startup ^
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
"%SPHINX_BIN%" -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
:EOF

View File

@@ -0,0 +1,28 @@
REM First see if there is an environment variable set
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the build folder next, if ninja was used there will be no
REM debug/release folder
set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the release folder next
set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the debug folder next
set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM at this point, we don't know where blender is, clear the variable
set BLENDER_BIN=
:detect_blender_done

View File

@@ -0,0 +1,21 @@
REM First see if there is an environment variable set
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Then see if inkscape is available in the path
for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Finally see if it is perhaps installed at the default location
set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM If still not found clear the variable
set INKSCAPE_BIN=
:detect_inkscape_done

View File

@@ -0,0 +1,23 @@
REM First see if there is an environment variable set
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Then see if inkscape is available in the path
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINX_BIN environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
REM If still not found clear the variable
set SPHINX_BIN=
:detect_sphinx_done

View File

@@ -0,0 +1,42 @@
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_inkscape.cmd"
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
exit /b 1
:detect_inkscape_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
:EOF

View File

@@ -0,0 +1,29 @@
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py
:EOF

View File

@@ -107,6 +107,15 @@ if NOT "%1" == "" (
set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
goto EOF
) else if "%1" == "icons" (
set ICONS=1
goto EOF
) else if "%1" == "icons_geom" (
set ICONS_GEOM=1
goto EOF
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else (
echo Command "%1" unknown, aborting!
goto ERR

View File

@@ -31,3 +31,6 @@ set PYDEBUG_CMAKE_ARGS=
set FORMAT=
set TEST=
set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set DOC_PY=

View File

@@ -31,6 +31,10 @@ echo - 2019 ^(build with visual studio 2019^)
echo - 2019pre ^(build with visual studio 2019 pre-release^)
echo - 2019b ^(build with visual studio 2019 Build Tools^)
echo.
echo Documentation Targets ^(Not associated with building^)
echo - doc_py ^(Generate sphinx python api docs^)
echo.
echo Experimental options
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)

View File

@@ -123,7 +123,7 @@ def Align(handle):
class BlendFile:
'''
Reads a blendfile and store the header, all the fileblocks, and catalogue
structs foound in the DNA fileblock
structs found in the DNA fileblock
- BlendFile.Header (BlendFileHeader instance)
- BlendFile.Blocks (list of BlendFileBlock instances)

View File

@@ -122,7 +122,7 @@ is a full-featured 3D application. It supports the entirety of the 3D pipeline -
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
Use Blender to create 3D images and animations, films and commercials, content for games, '''
r'''architectural and industrial visualizatons, and scientific visualizations.
r'''architectural and industrial visualizations, and scientific visualizations.
https://www.blender.org''')

View File

@@ -12,6 +12,7 @@ such cases, lock the interface (Render → Lock Interface or
Below is an example of a mesh that is altered from a handler:
"""
def frame_change_pre(scene):
# A triangle that shifts in the z direction
zshift = scene.frame_current * 0.1

View File

@@ -16,10 +16,12 @@ execution_queue = queue.Queue()
def run_in_main_thread(function):
execution_queue.put(function)
def execute_queued_functions():
while not execution_queue.empty():
function = execution_queue.get()
function()
return 1.0
bpy.app.timers.register(execute_queued_functions)

View File

@@ -31,11 +31,13 @@ owner = object()
subscribe_to = bpy.context.object.location
def msgbus_callback(*args):
# This will print:
# Something changed! (1, 2, 3)
print("Something changed!", args)
bpy.msgbus.subscribe_rna(
key=subscribe_to,
owner=owner,

View File

@@ -44,7 +44,7 @@ class OBJECT_OT_object_to_curve(bpy.types.Operator):
# Remove temporary curve.
obj.to_curve_clear()
# Invoke to_curve() with applying modifiers.
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers = True)
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers=True)
self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.")
# Remove temporary curve.
obj.to_curve_clear()

View File

@@ -21,6 +21,7 @@ batch = batch_for_shader(
},
)
def draw():
shader.bind()
shader.uniform_sampler("image", texture)

View File

@@ -31,7 +31,8 @@ def draw():
context.space_data,
context.region,
view_matrix,
projection_matrix)
projection_matrix,
True)
gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

View File

@@ -1,13 +1,13 @@
sphinx==3.5.4
sphinx==4.1.1
# Sphinx dependencies that are important
Jinja2==2.11.3
Pygments==2.9.0
docutils==0.16
Jinja2==3.0.1
Pygments==2.10.0
docutils==0.17.1
snowballstemmer==2.1.0
babel==2.9.1
requests==2.25.1
requests==2.26.0
# Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used.
sphinx_rtd_theme==0.5.2
sphinx_rtd_theme==1.0.0rc1

View File

@@ -254,6 +254,8 @@ else:
"gpu.shader",
"gpu.state",
"gpu.texture",
"gpu.platform",
"gpu.capabilities",
"gpu_extras",
"idprop.types",
"mathutils",
@@ -1047,6 +1049,7 @@ context_type_map = {
"annotation_data": ("GreasePencil", False),
"annotation_data_owner": ("ID", False),
"armature": ("Armature", False),
"asset_library_ref": ("AssetLibraryReference", False),
"bone": ("Bone", False),
"brush": ("Brush", False),
"camera": ("Camera", False),
@@ -1113,6 +1116,7 @@ context_type_map = {
"texture_slot": ("MaterialTextureSlot", False),
"texture_user": ("ID", False),
"texture_user_property": ("Property", False),
"ui_list": ("UIList", False),
"vertex_paint_object": ("Object", False),
"view_layer": ("ViewLayer", False),
"visible_bones": ("EditBone", True),
@@ -1998,6 +2002,8 @@ def write_rst_importable_modules(basepath):
"gpu.shader": "GPU Shader Utilities",
"gpu.state": "GPU State Utilities",
"gpu.texture": "GPU Texture Utilities",
"gpu.platform": "GPU Platform Utilities",
"gpu.capabilities": "GPU Capabilities Utilities",
"bmesh": "BMesh Module",
"bmesh.ops": "BMesh Operators",
"bmesh.types": "BMesh Types",

View File

@@ -111,5 +111,5 @@ if(WITH_MOD_FLUID)
endif()
if (WITH_COMPOSITOR)
add_subdirectory(smaa_areatex)
add_subdirectory(smaa_areatex)
endif()

View File

@@ -86,6 +86,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
info.specs.channels = AUD_CHANNELS_INVALID;
info.specs.rate = AUD_RATE_INVALID;
info.length = 0.0f;
info.start_offset = 0.0f;
try
{
@@ -95,6 +96,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
{
info.specs = convSpecToC(reader->getSpecs());
info.length = reader->getLength() / (float) info.specs.rate;
info.start_offset = reader->getStartOffset();
}
}
catch(Exception&)
@@ -245,7 +247,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
buffer[i * 3] = min;
buffer[i * 3 + 1] = max;
buffer[i * 3 + 2] = sqrt(power) / len;
buffer[i * 3 + 2] = sqrt(power / len); // RMS
if(overallmax < max)
overallmax = max;

View File

@@ -176,4 +176,5 @@ typedef struct
{
AUD_Specs specs;
float length;
double start_offset;
} AUD_SoundInfo;

View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import sys
import os

View File

@@ -70,6 +70,12 @@ public:
*/
virtual int getPosition() const=0;
/**
* Returns the start offset the sound should have to line up with related sources.
* \return The required start offset in seconds.
*/
virtual double getStartOffset() const { return 0.0;}
/**
* Returns the specification of the reader.
* \return The Specs structure.

View File

@@ -67,4 +67,4 @@ public:
virtual void read(int& length, bool& eos, sample_t* buffer);
};
AUD_NAMESPACE_END
AUD_NAMESPACE_END

View File

@@ -68,7 +68,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
for(int i = 0; i < m_frame->nb_samples; i++)
{
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size);
m_frame->data[channel] + i * single_size, single_size);
}
}
}
@@ -109,7 +109,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
for(int i = 0; i < m_frame->nb_samples; i++)
{
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
m_frame->data[channel] + i * single_size, single_size);
m_frame->data[channel] + i * single_size, single_size);
}
}
}
@@ -126,7 +126,10 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
void FFMPEGReader::init()
{
m_position = 0;
m_start_offset = 0.0f;
m_pkgbuf_left = 0;
m_st_time = 0;
m_duration = 0;
if(avformat_find_stream_info(m_formatCtx, nullptr) < 0)
AUD_THROW(FileException, "File couldn't be read, ffmpeg couldn't find the stream info.");
@@ -134,15 +137,41 @@ void FFMPEGReader::init()
// find audio stream and codec
m_stream = -1;
double dur_sec = 0;
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
#ifdef FFMPEG_OLD_CODE
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
if(m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#else
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
if(m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
#endif
&& (m_stream < 0))
{
AVStream *audio_stream = m_formatCtx->streams[i];
double audio_timebase = av_q2d(audio_stream->time_base);
if (audio_stream->start_time != AV_NOPTS_VALUE)
{
m_st_time = audio_stream->start_time;
}
int64_t ctx_start_time = 0;
if (m_formatCtx->start_time != AV_NOPTS_VALUE) {
ctx_start_time = m_formatCtx->start_time;
}
m_start_offset = m_st_time * audio_timebase - (double)ctx_start_time / AV_TIME_BASE;
if(audio_stream->duration != AV_NOPTS_VALUE)
{
dur_sec = audio_stream->duration * audio_timebase;
}
else
{
/* If the audio starts after the stream start time, subract this from the total duration. */
dur_sec = (double)m_formatCtx->duration / AV_TIME_BASE - m_start_offset;
}
m_stream=i;
break;
}
@@ -213,6 +242,7 @@ void FFMPEGReader::init()
}
m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
m_duration = lround(dur_sec * m_codecCtx->sample_rate);
}
FFMPEGReader::FFMPEGReader(std::string filename) :
@@ -338,21 +368,17 @@ void FFMPEGReader::seek(int position)
{
if(position >= 0)
{
uint64_t st_time = m_formatCtx->start_time;
uint64_t seek_pos = ((uint64_t)position) * ((uint64_t)AV_TIME_BASE) / ((uint64_t)m_specs.rate);
double pts_time_base =
av_q2d(m_formatCtx->streams[m_stream]->time_base);
if(st_time != AV_NOPTS_VALUE) {
seek_pos += st_time;
uint64_t seek_pts = (((uint64_t)position) / ((uint64_t)m_specs.rate)) / pts_time_base;
if(m_st_time != AV_NOPTS_VALUE) {
seek_pts += m_st_time;
}
double pts_time_base =
av_q2d(m_formatCtx->streams[m_stream]->time_base);
uint64_t pts_st_time =
((st_time != AV_NOPTS_VALUE) ? st_time : 0)
/ pts_time_base / (uint64_t) AV_TIME_BASE;
// a value < 0 tells us that seeking failed
if(av_seek_frame(m_formatCtx, -1, seek_pos,
if(av_seek_frame(m_formatCtx, m_stream, seek_pts,
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
{
avcodec_flush_buffers(m_codecCtx);
@@ -374,7 +400,7 @@ void FFMPEGReader::seek(int position)
if(packet.pts != AV_NOPTS_VALUE)
{
// calculate real position, and read to frame!
m_position = (packet.pts - pts_st_time) * pts_time_base * m_specs.rate;
m_position = (packet.pts - m_st_time) * pts_time_base * m_specs.rate;
if(m_position < position)
{
@@ -405,8 +431,7 @@ void FFMPEGReader::seek(int position)
int FFMPEGReader::getLength() const
{
// return approximated remaning size
return (int)((m_formatCtx->duration * m_codecCtx->sample_rate)
/ AV_TIME_BASE)-m_position;
return m_duration - m_position;
}
int FFMPEGReader::getPosition() const
@@ -414,6 +439,11 @@ int FFMPEGReader::getPosition() const
return m_position;
}
double FFMPEGReader::getStartOffset() const
{
return m_start_offset;
}
Specs FFMPEGReader::getSpecs() const
{
return m_specs.specs;
@@ -450,11 +480,13 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
// decode the package
pkgbuf_pos = decode(packet, m_pkgbuf);
// copy to output buffer
data_size = std::min(pkgbuf_pos, left * sample_size);
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
left -= data_size / sample_size;
if (packet.pts >= m_st_time) {
// copy to output buffer
data_size = std::min(pkgbuf_pos, left * sample_size);
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
left -= data_size / sample_size;
}
}
av_packet_unref(&packet);
}

View File

@@ -54,6 +54,22 @@ private:
*/
int m_position;
/**
* The start offset in seconds relative to the media container start time.
* IE how much the sound should be delayed to be kept in sync with the rest of the containter streams.
*/
double m_start_offset;
/**
* The start time pts of the stream. All packets before this timestamp shouldn't be played back (only decoded).
*/
int64_t m_st_time;
/**
* The duration of the audio stream in samples.
*/
int64_t m_duration;
/**
* The specification of the audio data.
*/
@@ -182,6 +198,7 @@ public:
virtual void seek(int position);
virtual int getLength() const;
virtual int getPosition() const;
virtual double getStartOffset() const;
virtual Specs getSpecs() const;
virtual void read(int& length, bool& eos, sample_t* buffer);
};

View File

@@ -32,17 +32,24 @@ void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data
device->m_state = AUD_pa_context_get_state(context);
}
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t num_bytes, void *data)
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data)
{
PulseAudioDevice* device = (PulseAudioDevice*)data;
void* buffer;
AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
while(total_bytes > 0)
{
size_t num_bytes = total_bytes;
device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
total_bytes -= num_bytes;
}
}
void PulseAudioDevice::PulseAudio_underflow(pa_stream *stream, void *data)
@@ -96,7 +103,6 @@ void PulseAudioDevice::runMixingThread()
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
m_state(PA_CONTEXT_UNCONNECTED),
m_buffersize(buffersize),
m_underflows(0)
{
m_mainloop = AUD_pa_mainloop_new();
@@ -187,6 +193,9 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this);
AUD_pa_stream_set_underflow_callback(m_stream, PulseAudio_underflow, this);
buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs);
m_buffersize = buffersize;
pa_buffer_attr buffer_attr;
buffer_attr.fragsize = -1U;

View File

@@ -59,7 +59,7 @@ private:
* \param num_bytes The length in bytes to be supplied.
* \param data The PulseAudio device.
*/
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t num_bytes, void* data);
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data);
/**
* Reports an underflow from the PulseAudio server.

View File

@@ -57,4 +57,4 @@ void VolumeReader::read(int& length, bool& eos, sample_t* buffer)
buffer[i] = buffer[i] * m_volumeStorage->getVolume();
}
AUD_NAMESPACE_END
AUD_NAMESPACE_END

View File

@@ -7,3 +7,4 @@ Local modifications:
checks for functions and so are needed.
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
in Windows' specific config.h.
* Silenced syscall deprecation warnings on macOS >= 10.12.

View File

@@ -59,7 +59,7 @@
# include <unistd.h>
#endif
#if defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && (!(defined OS_MACOSX))
# define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
#else
// Not so safe, but what can you do?

View File

@@ -259,7 +259,13 @@ pid_t GetTID() {
#endif
static bool lacks_gettid = false;
if (!lacks_gettid) {
#ifdef OS_MACOSX
uint64_t tid64;
const int error = pthread_threadid_np(NULL, &tid64);
pid_t tid = error ? -1 : (pid_t)tid64;
#else
pid_t tid = syscall(__NR_gettid);
#endif
if (tid != -1) {
return tid;
}

7
extern/nanosvg/README.blender vendored Normal file
View File

@@ -0,0 +1,7 @@
Project: NanoSVG
URL: https://github.com/memononen/nanosvg
License: zlib
Upstream version:
Local modifications: Added some functionality to manage grease pencil layers
Added a fix to SVG import arc and float errors (https://developer.blender.org/rB11dc674c78b49fc4e0b7c134c375b6c8b8eacbcc)

86
extern/nanosvg/patches/NanoSVG.diff vendored Normal file
View File

@@ -0,0 +1,86 @@
diff --git a/c:/tmp/nanosvg_original.h b/c:/tmp/nanosvg_modif.h
index 24a01a86d3d..eca0d07e79d 100644
--- a/c:/tmp/nanosvg_original.h
+++ b/c:/tmp/nanosvg_modif.h
@@ -24,7 +24,8 @@
*
* Bounding box calculation based on http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
*
- */
+ * This is a modified version for Blender used by importers.
+ **/
#ifndef NANOSVG_H
#define NANOSVG_H
@@ -148,6 +149,8 @@ extern "C" {
typedef struct NSVGshape
{
char id[64]; // Optional 'id' attr of the shape or its group
+ /* Blender: Parent ID used for layer creation. */
+ char id_parent[64];
NSVGpaint fill; // Fill paint
NSVGpaint stroke; // Stroke paint
float opacity; // Opacity of the shape.
@@ -370,6 +373,7 @@ int nsvg__parseXML(char* input,
/* Simple SVG parser. */
#define NSVG_MAX_ATTR 128
+#define NSVG_MAX_BREADCRUMB 5
enum NSVGgradientUnits
{
@@ -471,6 +475,10 @@ typedef struct NSVGparser
float dpi;
char pathFlag;
char defsFlag;
+ /** Blender breadcrumb for layers. */
+ char breadcrumb[NSVG_MAX_BREADCRUMB][64];
+ /** Blender number of elements in breadcrumb. */
+ int breadcrumb_len;
} NSVGparser;
static void nsvg__xformIdentity(float* t)
@@ -980,6 +988,14 @@ static void nsvg__addShape(NSVGparser* p)
memset(shape, 0, sizeof(NSVGshape));
memcpy(shape->id, attr->id, sizeof shape->id);
+ /* Copy parent id from breadcrumb. */
+ if (p->breadcrumb_len > 0) {
+ memcpy(shape->id_parent, p->breadcrumb[0], sizeof shape->id_parent);
+ }
+ else {
+ memcpy(shape->id_parent, attr->id, sizeof shape->id_parent);
+ }
+
scale = nsvg__getAverageScale(attr->xform);
shape->strokeWidth = attr->strokeWidth * scale;
shape->strokeDashOffset = attr->strokeDashOffset * scale;
@@ -2814,6 +2830,14 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
if (strcmp(el, "g") == 0) {
nsvg__pushAttr(p);
nsvg__parseAttribs(p, attr);
+
+ /* Save the breadcrumb of groups. */
+ if (p->breadcrumb_len < NSVG_MAX_BREADCRUMB) {
+ NSVGattrib *attr_id = nsvg__getAttr(p);
+ memcpy(
+ p->breadcrumb[p->breadcrumb_len], attr_id->id, sizeof(p->breadcrumb[p->breadcrumb_len]));
+ p->breadcrumb_len++;
+ }
}
else if (strcmp(el, "path") == 0) {
if (p->pathFlag) // Do not allow nested paths.
@@ -2874,7 +2898,12 @@ static void nsvg__endElement(void* ud, const char* el)
NSVGparser* p = (NSVGparser*)ud;
if (strcmp(el, "g") == 0) {
- nsvg__popAttr(p);
+ /* Remove the breadcrumb level. */
+ if (p->breadcrumb_len > 0) {
+ p->breadcrumb[p->breadcrumb_len - 1][0] = '\0';
+ p->breadcrumb_len--;
+ }
+ nsvg__popAttr(p);
}
else if (strcmp(el, "path") == 0) {
p->pathFlag = 0;

View File

@@ -32,7 +32,7 @@
* - #TPOOL_STRUCT: Name for pool struct name.
* - #TPOOL_CHUNK_SIZE: Chunk size (optional), use 64kb when not defined.
*
* \note #TPOOL_ALLOC_TYPE must be at least ``sizeof(void *)``.
* \note #TPOOL_ALLOC_TYPE must be at least `sizeof(void *)`.
*
* Defines the API, uses #TPOOL_IMPL_PREFIX to prefix each function.
*

View File

@@ -49,9 +49,9 @@
#include "atomic_ops_utils.h"
#if defined(__arm__)
/* Attempt to fix compilation error on Debian armel kernel.
* arm7 architecture does have both 32 and 64bit atomics, however
#if defined(__arm__) || defined(__riscv)
/* Attempt to fix compilation error on Debian armel and RISC-V kernels.
* Both architectures do have both 32 and 64bit atomics, however
* its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
*/
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1

View File

@@ -307,9 +307,9 @@ if(WITH_CYCLES_LOGGING)
)
endif()
# Debugging capabilities (debug passes etc).
if(WITH_CYCLES_DEBUG)
add_definitions(-DWITH_CYCLES_DEBUG)
# NaN debugging
if(WITH_CYCLES_DEBUG_NAN)
add_definitions(-DWITH_CYCLES_DEBUG_NAN)
endif()
if(NOT OPENIMAGEIO_PUGIXML_FOUND)

View File

@@ -115,6 +115,16 @@ if(WITH_OPENVDB)
)
endif()
if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
list(APPEND INC_SYS
${ALEMBIC_INCLUDE_DIRS}
)
list(APPEND LIB
${ALEMBIC_LIBRARIES}
)
endif()
if(WITH_OPENIMAGEDENOISE)
add_definitions(-DWITH_OPENIMAGEDENOISE)
list(APPEND INC_SYS

View File

@@ -61,6 +61,7 @@ class CyclesRender(bpy.types.RenderEngine):
bl_use_save_buffers = True
bl_use_spherical_stereo = True
bl_use_custom_freestyle = True
bl_use_alembic_procedural = True
def __init__(self):
self.session = None

View File

@@ -235,9 +235,12 @@ def system_info():
def list_render_passes(scene, srl):
# Builtin Blender passes.
crl = srl.cycles
# Combined pass.
yield ("Combined", "RGBA", 'COLOR')
# Data passes.
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR')
@@ -245,8 +248,8 @@ def list_render_passes(scene, srl):
if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR')
if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE')
if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE')
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
# Light passes.
if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR')
if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR')
if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR')
@@ -256,19 +259,16 @@ def list_render_passes(scene, srl):
if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR')
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR')
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
# Cycles specific passes.
crl = srl.cycles
# Debug passes.
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
if crl.pass_debug_bvh_traversed_nodes: yield ("Debug BVH Traversed Nodes", "X", 'VALUE')
if crl.pass_debug_bvh_traversed_instances: yield ("Debug BVH Traversed Instances", "X", 'VALUE')
if crl.pass_debug_bvh_intersections: yield ("Debug BVH Intersections", "X", 'VALUE')
if crl.pass_debug_ray_bounces: yield ("Debug Ray Bounces", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
# Cryptomatte passes.
crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2

View File

@@ -227,6 +227,11 @@ def update_render_passes(self, context):
view_layer.update_render_passes()
def update_render_engine(self, context):
scene = context.scene
scene.update_render_engine()
class CyclesRenderSettings(bpy.types.PropertyGroup):
device: EnumProperty(
@@ -240,6 +245,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Feature set to use for rendering",
items=enum_feature_set,
default='SUPPORTED',
update=update_render_engine,
)
shading_system: BoolProperty(
name="Open Shading Language",
@@ -263,6 +269,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
name="Use Denoising",
description="Denoise the rendered image",
default=False,
update=update_render_passes,
)
use_preview_denoising: BoolProperty(
name="Use Viewport Denoising",
@@ -401,7 +408,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
adaptive_threshold: FloatProperty(
name="Adaptive Sampling Threshold",
description="Noise level step to stop sampling at, lower values reduce noise the cost of render time. Zero for automatic setting based on number of AA samples",
description="Noise level step to stop sampling at, lower values reduce noise at the cost of render time. Zero for automatic setting based on number of AA samples",
min=0.0, max=1.0,
default=0.0,
precision=4,
@@ -482,7 +489,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
transparent_max_bounces: IntProperty(
name="Transparent Max Bounces",
description="Maximum number of transparent bounces",
description="Maximum number of transparent bounces. This is independent of maximum number of other bounces ",
min=0, max=1024,
default=8,
)
@@ -1163,12 +1170,6 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
bpy.types.Object.cycles_visibility = PointerProperty(
name="Cycles Visibility Settings",
description="Cycles visibility settings",
type=cls,
)
bpy.types.World.cycles_visibility = PointerProperty(
name="Cycles Visibility Settings",
description="Cycles visibility settings",
@@ -1177,7 +1178,6 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
@classmethod
def unregister(cls):
del bpy.types.Object.cycles_visibility
del bpy.types.World.cycles_visibility
@@ -1267,18 +1267,12 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
default=0.1,
)
is_shadow_catcher: BoolProperty(
name="Shadow Catcher",
description="Only render shadows on this object, for compositing renders into real footage",
default=False,
)
is_holdout: BoolProperty(
name="Holdout",
description="Render objects as a holdout or matte, creating a "
"hole in the image with zero alpha, to fill out in "
"compositing with real footage or another render",
default=False,
ao_distance: FloatProperty(
name="AO Distance",
description="AO distance used for approximate global illumination (0 means use world setting)",
min=0.0,
default=0.0,
subtype='DISTANCE',
)
@classmethod
@@ -1324,30 +1318,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
pass_debug_bvh_traversed_nodes: BoolProperty(
name="Debug BVH Traversed Nodes",
description="Store Debug BVH Traversed Nodes pass",
default=False,
update=update_render_passes,
)
pass_debug_bvh_traversed_instances: BoolProperty(
name="Debug BVH Traversed Instances",
description="Store Debug BVH Traversed Instances pass",
default=False,
update=update_render_passes,
)
pass_debug_bvh_intersections: BoolProperty(
name="Debug BVH Intersections",
description="Store Debug BVH Intersections",
default=False,
update=update_render_passes,
)
pass_debug_ray_bounces: BoolProperty(
name="Debug Ray Bounces",
description="Store Debug Ray Bounces pass",
default=False,
update=update_render_passes,
)
pass_debug_render_time: BoolProperty(
name="Debug Render Time",
description="Render time in milliseconds per sample and pixel",

View File

@@ -485,10 +485,12 @@ class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(cscene, "diffuse_bounces", text="Diffuse")
col.prop(cscene, "glossy_bounces", text="Glossy")
col.prop(cscene, "transparent_max_bounces", text="Transparency")
col.prop(cscene, "transmission_bounces", text="Transmission")
col.prop(cscene, "volume_bounces", text="Volume")
col = layout.column(align=True)
col.prop(cscene, "transparent_max_bounces", text="Transparent")
class CYCLES_RENDER_PT_light_paths_clamping(CyclesButtonsPanel, Panel):
bl_label = "Clamping"
@@ -934,29 +936,6 @@ class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, ViewLayerCryptomattePan
bl_parent_id = "CYCLES_RENDER_PT_passes"
class CYCLES_RENDER_PT_passes_debug(CyclesButtonsPanel, Panel):
bl_label = "Debug"
bl_context = "view_layer"
bl_parent_id = "CYCLES_RENDER_PT_passes"
@classmethod
def poll(cls, context):
import _cycles
return _cycles.with_cycles_debug
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
cycles_view_layer = context.view_layer.cycles
layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_nodes")
layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_instances")
layout.prop(cycles_view_layer, "pass_debug_bvh_intersections")
layout.prop(cycles_view_layer, "pass_debug_ray_bounces")
class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, ViewLayerAOVPanel):
bl_label = "Shader AOV"
bl_context = "view_layer"
@@ -1123,7 +1102,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
if ob:
is_sortable = len(ob.material_slots) > 1
rows = 1
rows = 3
if (is_sortable):
rows = 4
@@ -1134,7 +1113,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
col = row.column(align=True)
col.operator("object.material_slot_add", icon='ADD', text="")
col.operator("object.material_slot_remove", icon='REMOVE', text="")
col.separator()
col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="")
if is_sortable:
@@ -1149,16 +1128,15 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
row.operator("object.material_slot_select", text="Select")
row.operator("object.material_slot_deselect", text="Deselect")
split = layout.split(factor=0.65)
row = layout.row()
if ob:
split.template_ID(ob, "active_material", new="material.new")
row = split.row()
row.template_ID(ob, "active_material", new="material.new")
if slot:
row.prop(slot, "link", text="")
else:
row.label()
icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
row.prop(slot, "link", text="", icon=icon_link, icon_only=True)
elif mat:
split.template_ID(space, "pin_id")
split.separator()
@@ -1250,6 +1228,26 @@ class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
class CYCLES_OBJECT_PT_shading_gi_approximation(CyclesButtonsPanel, Panel):
bl_label = "Fast GI Approximation"
bl_parent_id = "CYCLES_OBJECT_PT_shading"
bl_context = "object"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
scene = context.scene
ob = context.object
cob = ob.cycles
cscene = scene.cycles
col = layout.column()
col.active = cscene.use_fast_gi
col.prop(cob, "ao_distance")
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
bl_label = "Visibility"
bl_context = "object"
@@ -1272,10 +1270,9 @@ class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
col.prop(ob, "hide_render", text="Renders", invert_checkbox=True, toggle=False)
if has_geometry_visibility(ob):
cob = ob.cycles
col = layout.column(heading="Mask")
col.prop(cob, "is_shadow_catcher")
col.prop(cob, "is_holdout")
col.prop(ob, "is_shadow_catcher")
col.prop(ob, "is_holdout")
class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
@@ -1295,19 +1292,17 @@ class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
scene = context.scene
ob = context.object
cob = ob.cycles
visibility = ob.cycles_visibility
col = layout.column()
col.prop(visibility, "camera")
col.prop(visibility, "diffuse")
col.prop(visibility, "glossy")
col.prop(visibility, "transmission")
col.prop(visibility, "scatter")
col.prop(ob, "visible_camera", text="Camera")
col.prop(ob, "visible_diffuse", text="Diffuse")
col.prop(ob, "visible_glossy", text="Glossy")
col.prop(ob, "visible_transmission", text="Transmission")
col.prop(ob, "visible_volume_scatter", text="Volume Scatter")
if ob.type != 'LIGHT':
sub = col.column()
sub.prop(visibility, "shadow")
sub.prop(ob, "visible_shadow", text="Shadow")
class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel):
@@ -2316,7 +2311,6 @@ classes = (
CYCLES_RENDER_PT_passes_data,
CYCLES_RENDER_PT_passes_light,
CYCLES_RENDER_PT_passes_crypto,
CYCLES_RENDER_PT_passes_debug,
CYCLES_RENDER_PT_passes_aov,
CYCLES_RENDER_PT_filter,
CYCLES_RENDER_PT_override,
@@ -2328,6 +2322,7 @@ classes = (
CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_shading,
CYCLES_OBJECT_PT_shading_shadow_terminator,
CYCLES_OBJECT_PT_shading_gi_approximation,
CYCLES_OBJECT_PT_visibility,
CYCLES_OBJECT_PT_visibility_ray_visibility,
CYCLES_OBJECT_PT_visibility_culling,

View File

@@ -137,9 +137,9 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
cp[0] = (cp[0] * cp[3]) / 255;
cp[1] = (cp[1] * cp[3]) / 255;
cp[2] = (cp[2] * cp[3]) / 255;
}
}
}

View File

@@ -1038,29 +1038,47 @@ static void create_subd_mesh(Scene *scene,
/* Sync */
static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob)
/* Check whether some of "built-in" motion-related attributes are needed to be exported (includes
* things like velocity from cache modifier, fluid simulation).
*
* NOTE: This code is run prior to object motion blur initialization. so can not access properties
* set by `sync_object_motion_init()`. */
static bool mesh_need_motion_attribute(BL::Object &b_ob, Scene *scene)
{
if (b_ob.modifiers.length() > 0) {
BL::Modifier b_mod = b_ob.modifiers[b_ob.modifiers.length() - 1];
const Scene::MotionType need_motion = scene->need_motion();
if (need_motion == Scene::MOTION_NONE) {
/* Simple case: neither motion pass nor motion blur is needed, no need in the motion related
* attributes. */
return false;
}
if (b_mod.type() == BL::Modifier::type_MESH_SEQUENCE_CACHE) {
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(b_mod);
if (MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
return mesh_cache;
}
if (need_motion == Scene::MOTION_BLUR) {
/* A bit tricky and implicit case:
* - Motion blur is enabled in the scene, which implies specific number of time steps for
* objects.
* - If the object has motion blur disabled on it, it will have 0 time steps.
* - Motion attribute expects non-zero time steps.
*
* Avoid adding motion attributes if the motion blur will enforce 0 motion steps. */
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
const bool use_motion = get_boolean(cobject, "use_motion_blur");
if (!use_motion) {
return false;
}
}
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
/* Motion pass which implies 3 motion steps, or motion blur which is not disabled on object
* level. */
return true;
}
static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
if (scene->need_motion() == Scene::MOTION_NONE)
if (!mesh_need_motion_attribute(b_ob, scene)) {
return;
}
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob);
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob, true, nullptr);
if (!b_mesh_cache) {
return;
@@ -1102,8 +1120,9 @@ static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *me
static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
{
if (scene->need_motion() == Scene::MOTION_NONE)
if (!mesh_need_motion_attribute(b_ob, scene)) {
return;
}
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
@@ -1222,7 +1241,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
}
/* Cached motion blur already exported. */
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(b_ob);
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(b_ob, true, nullptr);
if (mesh_cache) {
return;
}

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "render/alembic.h"
#include "render/camera.h"
#include "render/graph.h"
#include "render/integrator.h"
@@ -109,23 +110,23 @@ void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob
}
Geometry *geom = object->get_geometry();
geom->set_use_motion_blur(false);
geom->set_motion_steps(0);
uint motion_steps;
int motion_steps = 0;
bool use_motion_blur = false;
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
geom->set_motion_steps(motion_steps);
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
geom->set_use_motion_blur(true);
use_motion_blur = true;
}
}
else {
motion_steps = 3;
geom->set_motion_steps(motion_steps);
}
geom->set_use_motion_blur(use_motion_blur);
geom->set_motion_steps(motion_steps);
motion.resize(motion_steps, transform_empty());
if (motion_steps) {
@@ -199,8 +200,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* Visibility flags for both parent and child. */
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_holdout = get_boolean(cobject, "is_holdout") ||
b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
bool use_holdout = b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY;
if (b_parent.ptr.data != b_ob.ptr.data) {
@@ -287,8 +287,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object->set_visibility(visibility);
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
object->set_is_shadow_catcher(is_shadow_catcher);
object->set_is_shadow_catcher(b_ob.is_shadow_catcher());
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
@@ -297,6 +296,13 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
"shadow_terminator_geometry_offset");
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
float ao_distance = get_float(cobject, "ao_distance");
if (ao_distance == 0.0f && b_parent.ptr.data != b_ob.ptr.data) {
PointerRNA cparent = RNA_pointer_get(&b_parent.ptr, "cycles");
ao_distance = get_float(cparent, "ao_distance");
}
object->set_ao_distance(ao_distance);
/* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent();
ustring parent_name;
@@ -479,6 +485,71 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
/* Object Loop */
void BlenderSync::sync_procedural(BL::Object &b_ob,
BL::MeshSequenceCacheModifier &b_mesh_cache,
bool has_subdivision_modifier)
{
#ifdef WITH_ALEMBIC
BL::CacheFile cache_file = b_mesh_cache.cache_file();
void *cache_file_key = cache_file.ptr.data;
AlembicProcedural *procedural = static_cast<AlembicProcedural *>(
procedural_map.find(cache_file_key));
if (procedural == nullptr) {
procedural = scene->create_node<AlembicProcedural>();
procedural_map.add(cache_file_key, procedural);
}
else {
procedural_map.used(procedural);
}
float current_frame = b_scene.frame_current();
if (cache_file.override_frame()) {
current_frame = cache_file.frame();
}
if (!cache_file.override_frame()) {
procedural->set_start_frame(b_scene.frame_start());
procedural->set_end_frame(b_scene.frame_end());
}
procedural->set_frame(current_frame);
procedural->set_frame_rate(b_scene.render().fps() / b_scene.render().fps_base());
procedural->set_frame_offset(cache_file.frame_offset());
string absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath());
procedural->set_filepath(ustring(absolute_path));
procedural->set_scale(cache_file.scale());
procedural->set_use_prefetch(cache_file.use_prefetch());
procedural->set_prefetch_cache_size(cache_file.prefetch_cache_size());
/* create or update existing AlembicObjects */
ustring object_path = ustring(b_mesh_cache.object_path());
AlembicObject *abc_object = procedural->get_or_create_object(object_path);
array<Node *> used_shaders = find_used_shaders(b_ob);
abc_object->set_used_shaders(used_shaders);
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
const float subd_dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
abc_object->set_subd_dicing_rate(subd_dicing_rate);
abc_object->set_subd_max_level(max_subdivisions);
abc_object->set_ignore_subdivision(!has_subdivision_modifier);
if (abc_object->is_modified() || procedural->is_modified()) {
procedural->tag_update(scene);
}
#else
(void)b_ob;
(void)b_mesh_cache;
#endif
}
void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
BL::SpaceView3D &b_v3d,
float motion_time)
@@ -494,6 +565,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
light_map.pre_sync();
geometry_map.pre_sync();
object_map.pre_sync();
procedural_map.pre_sync();
particle_system_map.pre_sync();
motion_times.clear();
}
@@ -534,15 +606,39 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
/* Object itself. */
if (b_instance.show_self()) {
sync_object(b_depsgraph,
b_view_layer,
b_instance,
motion_time,
false,
show_lights,
culling,
&use_portal,
sync_hair ? NULL : &geom_task_pool);
#ifdef WITH_ALEMBIC
bool use_procedural = false;
bool has_subdivision_modifier = false;
BL::MeshSequenceCacheModifier b_mesh_cache(PointerRNA_NULL);
/* Experimental as Blender does not have good support for procedurals at the moment, also
* only available in preview renders since currently do not have a good cache policy, the
* data being loaded at once for all the frames. */
if (experimental && b_v3d) {
b_mesh_cache = object_mesh_cache_find(b_ob, false, &has_subdivision_modifier);
use_procedural = b_mesh_cache && b_mesh_cache.cache_file().use_render_procedural();
}
if (use_procedural) {
/* Skip in the motion case, as generating motion blur data will be handled in the
* procedural. */
if (!motion) {
sync_procedural(b_ob, b_mesh_cache, has_subdivision_modifier);
}
}
else
#endif
{
sync_object(b_depsgraph,
b_view_layer,
b_instance,
motion_time,
false,
show_lights,
culling,
&use_portal,
sync_hair ? NULL : &geom_task_pool);
}
}
/* Particle hair as separate object. */
@@ -575,6 +671,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
object_map.post_sync();
geometry_map.post_sync();
particle_system_map.post_sync();
procedural_map.post_sync();
}
if (motion)

View File

@@ -71,7 +71,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
Particle pa;
pa.index = persistent_id[0];
pa.age = b_scene.frame_current() - b_pa.birth_time();
pa.age = b_scene.frame_current_final() - b_pa.birth_time();
pa.lifetime = b_pa.lifetime();
pa.location = get_float3(b_pa.location());
pa.rotation = get_float4(b_pa.rotation());

View File

@@ -487,6 +487,24 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
if (param->varlenarray || param->isstruct || param->type.arraylen > 1)
continue;
/* Read metadata. */
bool is_bool_param = false;
ustring param_label = param->name;
for (const OSL::OSLQuery::Parameter &metadata : param->metadata) {
if (metadata.type == TypeDesc::STRING) {
if (metadata.name == "widget") {
/* Boolean socket. */
if (metadata.sdefault[0] == "boolean" || metadata.sdefault[0] == "checkBox") {
is_bool_param = true;
}
}
else if (metadata.name == "label") {
/* Socket label. */
param_label = metadata.sdefault[0];
}
}
}
/* determine socket type */
string socket_type;
BL::NodeSocket::type_enum data_type = BL::NodeSocket::type_VALUE;
@@ -494,6 +512,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
float default_float = 0.0f;
int default_int = 0;
string default_string = "";
bool default_boolean = false;
if (param->isclosure) {
socket_type = "NodeSocketShader";
@@ -523,10 +542,19 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
}
else if (param->type.aggregate == TypeDesc::SCALAR) {
if (param->type.basetype == TypeDesc::INT) {
socket_type = "NodeSocketInt";
data_type = BL::NodeSocket::type_INT;
if (param->validdefault)
default_int = param->idefault[0];
if (is_bool_param) {
socket_type = "NodeSocketBool";
data_type = BL::NodeSocket::type_BOOLEAN;
if (param->validdefault) {
default_boolean = (bool)param->idefault[0];
}
}
else {
socket_type = "NodeSocketInt";
data_type = BL::NodeSocket::type_INT;
if (param->validdefault)
default_int = param->idefault[0];
}
}
else if (param->type.basetype == TypeDesc::FLOAT) {
socket_type = "NodeSocketFloat";
@@ -546,33 +574,57 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
else
continue;
/* find socket socket */
BL::NodeSocket b_sock(PointerRNA_NULL);
/* Update existing socket. */
bool found_existing = false;
if (param->isoutput) {
b_sock = b_node.outputs[param->name.string()];
/* remove if type no longer matches */
if (b_sock && b_sock.bl_idname() != socket_type) {
b_node.outputs.remove(b_data, b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL);
for (BL::NodeSocket &b_sock : b_node.outputs) {
if (b_sock.identifier() == param->name) {
if (b_sock.bl_idname() != socket_type) {
/* Remove if type no longer matches. */
b_node.outputs.remove(b_data, b_sock);
}
else {
/* Reuse and update label. */
if (b_sock.name() != param_label) {
b_sock.name(param_label.string());
}
used_sockets.insert(b_sock.ptr.data);
found_existing = true;
}
break;
}
}
}
else {
b_sock = b_node.inputs[param->name.string()];
/* remove if type no longer matches */
if (b_sock && b_sock.bl_idname() != socket_type) {
b_node.inputs.remove(b_data, b_sock);
b_sock = BL::NodeSocket(PointerRNA_NULL);
for (BL::NodeSocket &b_sock : b_node.inputs) {
if (b_sock.identifier() == param->name) {
if (b_sock.bl_idname() != socket_type) {
/* Remove if type no longer matches. */
b_node.inputs.remove(b_data, b_sock);
}
else {
/* Reuse and update label. */
if (b_sock.name() != param_label) {
b_sock.name(param_label.string());
}
used_sockets.insert(b_sock.ptr.data);
found_existing = true;
}
break;
}
}
}
if (!b_sock) {
/* create new socket */
if (param->isoutput)
b_sock = b_node.outputs.create(
b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
else
b_sock = b_node.inputs.create(
b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
if (!found_existing) {
/* Create new socket. */
BL::NodeSocket b_sock = (param->isoutput) ? b_node.outputs.create(b_data,
socket_type.c_str(),
param_label.c_str(),
param->name.c_str()) :
b_node.inputs.create(b_data,
socket_type.c_str(),
param_label.c_str(),
param->name.c_str());
/* set default value */
if (data_type == BL::NodeSocket::type_VALUE) {
@@ -590,9 +642,12 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
else if (data_type == BL::NodeSocket::type_STRING) {
set_string(b_sock.ptr, "default_value", default_string);
}
}
else if (data_type == BL::NodeSocket::type_BOOLEAN) {
set_boolean(b_sock.ptr, "default_value", default_boolean);
}
used_sockets.insert(b_sock.ptr.data);
used_sockets.insert(b_sock.ptr.data);
}
}
/* remove unused parameters */
@@ -1098,14 +1153,6 @@ void *CCL_python_module_init()
PyModule_AddStringConstant(mod, "osl_version_string", "unknown");
#endif
#ifdef WITH_CYCLES_DEBUG
PyModule_AddObject(mod, "with_cycles_debug", Py_True);
Py_INCREF(Py_True);
#else
PyModule_AddObject(mod, "with_cycles_debug", Py_False);
Py_INCREF(Py_False);
#endif
#ifdef WITH_NETWORK
PyModule_AddObject(mod, "with_network", Py_True);
Py_INCREF(Py_True);

View File

@@ -149,7 +149,7 @@ BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_r
static BL::NodeSocket get_node_output(BL::Node &b_node, const string &name)
{
for (BL::NodeSocket &b_out : b_node.outputs) {
if (b_out.name() == name) {
if (b_out.identifier() == name) {
return b_out;
}
}
@@ -215,7 +215,12 @@ static void set_default_value(ShaderInput *input,
break;
}
case SocketType::INT: {
node->set(socket, get_int(b_sock.ptr, "default_value"));
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
node->set(socket, get_boolean(b_sock.ptr, "default_value"));
}
else {
node->set(socket, get_int(b_sock.ptr, "default_value"));
}
break;
}
case SocketType::COLOR: {
@@ -1002,71 +1007,59 @@ static bool node_use_modified_socket_name(ShaderNode *node)
return true;
}
static ShaderInput *node_find_input_by_name(ShaderNode *node,
BL::Node &b_node,
BL::NodeSocket &b_socket)
static ShaderInput *node_find_input_by_name(ShaderNode *node, BL::NodeSocket &b_socket)
{
string name = b_socket.name();
string name = b_socket.identifier();
ShaderInput *input = node->input(name.c_str());
if (node_use_modified_socket_name(node)) {
bool found = false;
int counter = 0, total = 0;
if (!input && node_use_modified_socket_name(node)) {
/* Different internal name for shader. */
if (string_startswith(name, "Shader")) {
string_replace(name, "Shader", "Closure");
}
input = node->input(name.c_str());
for (BL::NodeSocket &b_input : b_node.inputs) {
if (b_input.name() == name) {
if (!found) {
counter++;
}
total++;
if (!input) {
/* Different internal numbering of two sockets with same name.
* Note that the Blender convention for unique socket names changed
* from . to _ at some point, so we check both to handle old files. */
if (string_endswith(name, "_001")) {
string_replace(name, "_001", "2");
}
else if (string_endswith(name, ".001")) {
string_replace(name, ".001", "2");
}
else if (string_endswith(name, "_002")) {
string_replace(name, "_002", "3");
}
else if (string_endswith(name, ".002")) {
string_replace(name, ".002", "3");
}
else {
name += "1";
}
if (b_input.ptr.data == b_socket.ptr.data)
found = true;
input = node->input(name.c_str());
}
/* rename if needed */
if (name == "Shader")
name = "Closure";
if (total > 1)
name = string_printf("%s%d", name.c_str(), counter);
}
return node->input(name.c_str());
return input;
}
static ShaderOutput *node_find_output_by_name(ShaderNode *node,
BL::Node &b_node,
BL::NodeSocket &b_socket)
static ShaderOutput *node_find_output_by_name(ShaderNode *node, BL::NodeSocket &b_socket)
{
string name = b_socket.name();
string name = b_socket.identifier();
ShaderOutput *output = node->output(name.c_str());
if (node_use_modified_socket_name(node)) {
bool found = false;
int counter = 0, total = 0;
for (BL::NodeSocket &b_output : b_node.outputs) {
if (b_output.name() == name) {
if (!found) {
counter++;
}
total++;
}
if (b_output.ptr.data == b_socket.ptr.data) {
found = true;
}
}
/* rename if needed */
if (name == "Shader")
if (!output && node_use_modified_socket_name(node)) {
/* Different internal name for shader. */
if (name == "Shader") {
name = "Closure";
if (total > 1)
name = string_printf("%s%d", name.c_str(), counter);
output = node->output(name.c_str());
}
}
return node->output(name.c_str());
return output;
}
static void add_nodes(Scene *scene,
@@ -1209,7 +1202,7 @@ static void add_nodes(Scene *scene,
if (node) {
/* map node sockets for linking */
for (BL::NodeSocket &b_input : b_node.inputs) {
ShaderInput *input = node_find_input_by_name(node, b_node, b_input);
ShaderInput *input = node_find_input_by_name(node, b_input);
if (!input) {
/* XXX should not happen, report error? */
continue;
@@ -1219,7 +1212,7 @@ static void add_nodes(Scene *scene,
set_default_value(input, b_input, b_data, b_ntree);
}
for (BL::NodeSocket &b_output : b_node.outputs) {
ShaderOutput *output = node_find_output_by_name(node, b_node, b_output);
ShaderOutput *output = node_find_output_by_name(node, b_output);
if (!output) {
/* XXX should not happen, report error? */
continue;

View File

@@ -59,6 +59,7 @@ BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
b_scene(b_scene),
shader_map(scene),
object_map(scene),
procedural_map(scene),
geometry_map(scene),
light_map(scene),
particle_system_map(scene),
@@ -404,8 +405,6 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
Film *film = scene->film;
vector<Pass> prevpasses = scene->passes;
if (b_v3d) {
film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
}
@@ -435,11 +434,6 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
break;
}
}
if (!Pass::equals(prevpasses, scene->passes)) {
film->tag_passes_update(scene, prevpasses, false);
film->tag_modified();
}
}
/* Render Layer */
@@ -545,12 +539,6 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
MAP_PASS("BakePrimitive", PASS_BAKE_PRIMITIVE);
MAP_PASS("BakeDifferential", PASS_BAKE_DIFFERENTIAL);
#ifdef __KERNEL_DEBUG__
MAP_PASS("Debug BVH Traversed Nodes", PASS_BVH_TRAVERSED_NODES);
MAP_PASS("Debug BVH Traversed Instances", PASS_BVH_TRAVERSED_INSTANCES);
MAP_PASS("Debug BVH Intersections", PASS_BVH_INTERSECTIONS);
MAP_PASS("Debug Ray Bounces", PASS_RAY_BOUNCES);
#endif
MAP_PASS("Debug Render Time", PASS_RENDER_TIME);
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER);
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT);
@@ -648,24 +636,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
}
}
#ifdef __KERNEL_DEBUG__
if (get_boolean(crl, "pass_debug_bvh_traversed_nodes")) {
b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_BVH_TRAVERSED_NODES, passes, "Debug BVH Traversed Nodes");
}
if (get_boolean(crl, "pass_debug_bvh_traversed_instances")) {
b_engine.add_pass("Debug BVH Traversed Instances", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_BVH_TRAVERSED_INSTANCES, passes, "Debug BVH Traversed Instances");
}
if (get_boolean(crl, "pass_debug_bvh_intersections")) {
b_engine.add_pass("Debug BVH Intersections", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_BVH_INTERSECTIONS, passes, "Debug BVH Intersections");
}
if (get_boolean(crl, "pass_debug_ray_bounces")) {
b_engine.add_pass("Debug Ray Bounces", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_RAY_BOUNCES, passes, "Debug Ray Bounces");
}
#endif
if (get_boolean(crl, "pass_debug_render_time")) {
b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_RENDER_TIME, passes, "Debug Render Time");
@@ -749,10 +719,13 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
DENOISING_CLEAN_ALL_PASSES);
scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
denoising.type == DENOISER_NLM);
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
scene->film->tag_passes_update(scene, passes);
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
if (!Pass::equals(passes, scene->passes)) {
scene->film->tag_passes_update(scene, passes);
scene->film->tag_modified();
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
}
return passes;
}

View File

@@ -151,6 +151,10 @@ class BlenderSync {
TaskPool *geom_task_pool);
void sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob, Object *object);
void sync_procedural(BL::Object &b_ob,
BL::MeshSequenceCacheModifier &b_mesh_cache,
bool has_subdivision);
bool sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object);
/* Volume */
@@ -221,6 +225,7 @@ class BlenderSync {
id_map<void *, Shader> shader_map;
id_map<ObjectKey, Object> object_map;
id_map<void *, Procedural> procedural_map;
id_map<GeometryKey, Geometry> geometry_map;
id_map<ObjectKey, Light> light_map;
id_map<ParticleSystemKey, ParticleSystem> particle_system_map;

View File

@@ -145,7 +145,7 @@ static inline void curvemapping_minmax(/*const*/ BL::CurveMapping &cumap,
float *min_x,
float *max_x)
{
/* const int num_curves = cumap.curves.length(); */ /* Gives linking error so far. */
// const int num_curves = cumap.curves.length(); /* Gives linking error so far. */
const int num_curves = rgb_curve ? 4 : 3;
*min_x = FLT_MAX;
*max_x = -FLT_MAX;
@@ -246,7 +246,11 @@ static inline string image_user_file_path(BL::ImageUser &iuser,
string filepath_str = string(filepath);
if (load_tiled && ima.source() == BL::Image::source_TILED) {
string_replace(filepath_str, "1001", "<UDIM>");
string udim;
if (ima.tiles.length() > 0) {
udim = to_string(ima.tiles[0].number());
}
string_replace(filepath_str, udim, "<UDIM>");
}
return filepath_str;
}
@@ -568,6 +572,45 @@ static inline BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b
return BL::FluidDomainSettings(PointerRNA_NULL);
}
static inline BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob,
bool check_velocity,
bool *has_subdivision_modifier)
{
for (int i = b_ob.modifiers.length() - 1; i >= 0; --i) {
BL::Modifier b_mod = b_ob.modifiers[i];
if (b_mod.type() == BL::Modifier::type_MESH_SEQUENCE_CACHE) {
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(b_mod);
if (check_velocity) {
if (!MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
}
}
return mesh_cache;
}
/* Skip possible particles system modifiers as they do not modify the geometry. */
if (b_mod.type() == BL::Modifier::type_PARTICLE_SYSTEM) {
continue;
}
/* Only skip the subsurf modifier if we are not checking for the mesh sequence cache modifier
* for motion blur. */
if (b_mod.type() == BL::Modifier::type_SUBSURF && !check_velocity) {
if (has_subdivision_modifier) {
*has_subdivision_modifier = true;
}
continue;
}
break;
}
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
}
static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
bool preview,
bool experimental)
@@ -596,15 +639,14 @@ static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
static inline uint object_ray_visibility(BL::Object &b_ob)
{
PointerRNA cvisibility = RNA_pointer_get(&b_ob.ptr, "cycles_visibility");
uint flag = 0;
flag |= get_boolean(cvisibility, "camera") ? PATH_RAY_CAMERA : 0;
flag |= get_boolean(cvisibility, "diffuse") ? PATH_RAY_DIFFUSE : 0;
flag |= get_boolean(cvisibility, "glossy") ? PATH_RAY_GLOSSY : 0;
flag |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0;
flag |= get_boolean(cvisibility, "shadow") ? PATH_RAY_SHADOW : 0;
flag |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0;
flag |= b_ob.visible_camera() ? PATH_RAY_CAMERA : 0;
flag |= b_ob.visible_diffuse() ? PATH_RAY_DIFFUSE : 0;
flag |= b_ob.visible_glossy() ? PATH_RAY_GLOSSY : 0;
flag |= b_ob.visible_transmission() ? PATH_RAY_TRANSMIT : 0;
flag |= b_ob.visible_shadow() ? PATH_RAY_SHADOW : 0;
flag |= b_ob.visible_volume_scatter() ? PATH_RAY_VOLUME_SCATTER : 0;
return flag;
}

View File

@@ -40,8 +40,8 @@ BlenderViewportParameters::BlenderViewportParameters(BL::SpaceView3D &b_v3d)
BL::View3DShading shading = b_v3d.shading();
PointerRNA cshading = RNA_pointer_get(&shading.ptr, "cycles");
/* We only copy the shading parameters if we are in look dev mode. otherwise
* defaults are being used. These defaults mimic normal render settings */
/* We only copy the shading parameters if we are in look-dev mode.
* Otherwise defaults are being used. These defaults mimic normal render settings. */
if (shading.type() == BL::View3DShading::type_RENDERED) {
use_scene_world = shading.use_scene_world_render();
use_scene_lights = shading.use_scene_lights_render();

View File

@@ -13,7 +13,7 @@
# limitations under the License.
function(cycles_set_solution_folder target)
if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
get_filename_component(folderdir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" folderdir ${folderdir})
set_target_properties(${target} PROPERTIES FOLDER ${folderdir})

View File

@@ -351,9 +351,6 @@ string CUDADevice::compile_kernel_get_common_cflags(
if (extra_cflags) {
cflags += string(" ") + string(extra_cflags);
}
# ifdef WITH_CYCLES_DEBUG
cflags += " -D__KERNEL_DEBUG__";
# endif
if (split) {
cflags += " -D__SPLIT__";
@@ -461,18 +458,19 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
const int nvcc_cuda_version = cuewCompilerVersion();
VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << ".";
if (nvcc_cuda_version < 80) {
if (nvcc_cuda_version < 101) {
printf(
"Unsupported CUDA version %d.%d detected, "
"you need CUDA 8.0 or newer.\n",
"you need CUDA 10.1 or newer.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
return string();
}
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102)) {
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102 || nvcc_cuda_version == 111 ||
nvcc_cuda_version == 112 || nvcc_cuda_version == 113 || nvcc_cuda_version == 114)) {
printf(
"CUDA version %d.%d detected, build may succeed but only "
"CUDA 10.1 and 10.2 are officially supported.\n",
"CUDA 10.1 to 11.4 are officially supported.\n",
nvcc_cuda_version / 10,
nvcc_cuda_version % 10);
}

View File

@@ -57,8 +57,8 @@
#include "util/util_function.h"
#include "util/util_logging.h"
#include "util/util_map.h"
#include "util/util_openimagedenoise.h"
#include "util/util_opengl.h"
#include "util/util_openimagedenoise.h"
#include "util/util_optimization.h"
#include "util/util_progress.h"
#include "util/util_system.h"

View File

@@ -233,9 +233,6 @@ class OptiXDevice : public CUDADevice {
break;
}
};
# endif
# if OPTIX_ABI_VERSION >= 41 && defined(WITH_CYCLES_DEBUG)
options.validationMode = OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL;
# endif
check_result_optix(optixDeviceContextCreate(cuContext, &options, &context));
# ifdef WITH_CYCLES_LOGGING
@@ -369,13 +366,8 @@ class OptiXDevice : public CUDADevice {
OptixModuleCompileOptions module_options = {};
module_options.maxRegisterCount = 0; // Do not set an explicit register limit
# ifdef WITH_CYCLES_DEBUG
module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
# else
module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
# endif
# if OPTIX_ABI_VERSION >= 41
module_options.boundValues = nullptr;
@@ -578,11 +570,7 @@ class OptiXDevice : public CUDADevice {
OptixPipelineLinkOptions link_options = {};
link_options.maxTraceDepth = 1;
# ifdef WITH_CYCLES_DEBUG
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
# else
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
# endif
# if OPTIX_ABI_VERSION < 24
link_options.overrideUsesMotionBlur = motion_blur;
# endif

View File

@@ -1968,10 +1968,6 @@ string OpenCLDevice::kernel_build_options(const string *debug_src)
build_options += "-D__KERNEL_OPENCL_DEBUG__ ";
}
# ifdef WITH_CYCLES_DEBUG
build_options += "-D__KERNEL_DEBUG__ ";
# endif
# ifdef WITH_NANOVDB
if (info.has_nanovdb) {
build_options += "-DWITH_NANOVDB ";

View File

@@ -380,11 +380,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
# warn for other versions
if((CUDA_VERSION MATCHES "101") OR (CUDA_VERSION MATCHES "102") OR (CUDA_VERSION MATCHES "111"))
if((CUDA_VERSION MATCHES "101") OR
(CUDA_VERSION MATCHES "102") OR
(CUDA_VERSION MATCHES "111") OR
(CUDA_VERSION MATCHES "112") OR
(CUDA_VERSION MATCHES "113") OR
(CUDA_VERSION MATCHES "114"))
else()
message(WARNING
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
"build may succeed but only CUDA 10.1, 10.2 and 11.1 are officially supported")
"build may succeed but only CUDA 10.1 to 11.4 are officially supported")
endif()
# build for each arch
@@ -439,10 +444,6 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(name ${name}_experimental)
endif()
if(WITH_CYCLES_DEBUG)
set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__)
endif()
if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB
@@ -557,11 +558,6 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
--use_fast_math
-o ${output})
if(WITH_CYCLES_DEBUG)
set(cuda_flags ${cuda_flags}
-D __KERNEL_DEBUG__)
endif()
if(WITH_NANOVDB)
set(cuda_flags ${cuda_flags}
-D WITH_NANOVDB

View File

@@ -67,8 +67,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
isect->prim = PRIM_NONE;
isect->object = OBJECT_NONE;
BVH_DEBUG_INIT();
/* traversal loop */
do {
do {
@@ -118,7 +116,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
--stack_ptr;
}
}
BVH_DEBUG_NEXT_NODE();
}
/* if node is leaf, fetch triangle list */
@@ -138,7 +135,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
switch (type & PRIMITIVE_ALL) {
case PRIMITIVE_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (triangle_intersect(kg, isect, P, dir, visibility, object, prim_addr)) {
/* shadow ray early termination */
@@ -151,7 +147,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
#if BVH_FEATURE(BVH_MOTION)
case PRIMITIVE_MOTION_TRIANGLE: {
for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
if (motion_triangle_intersect(
kg, isect, P, dir, ray->time, visibility, object, prim_addr)) {
@@ -169,7 +164,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
case PRIMITIVE_CURVE_RIBBON:
case PRIMITIVE_MOTION_CURVE_RIBBON: {
for (; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION();
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
const bool hit = curve_intersect(
@@ -201,8 +195,6 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
traversal_stack[stack_ptr] = ENTRYPOINT_SENTINEL;
node_addr = kernel_tex_fetch(__object_node, object);
BVH_DEBUG_NEXT_INSTANCE();
}
}
} while (node_addr != ENTRYPOINT_SENTINEL);

View File

@@ -42,33 +42,6 @@ CCL_NAMESPACE_BEGIN
#define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0)
/* Debugging helpers. */
#ifdef __KERNEL_DEBUG__
# define BVH_DEBUG_INIT() \
do { \
isect->num_traversed_nodes = 0; \
isect->num_traversed_instances = 0; \
isect->num_intersections = 0; \
} while (0)
# define BVH_DEBUG_NEXT_NODE() \
do { \
++isect->num_traversed_nodes; \
} while (0)
# define BVH_DEBUG_NEXT_INTERSECTION() \
do { \
++isect->num_intersections; \
} while (0)
# define BVH_DEBUG_NEXT_INSTANCE() \
do { \
++isect->num_traversed_instances; \
} while (0)
#else /* __KERNEL_DEBUG__ */
# define BVH_DEBUG_INIT()
# define BVH_DEBUG_NEXT_NODE()
# define BVH_DEBUG_NEXT_INTERSECTION()
# define BVH_DEBUG_NEXT_INSTANCE()
#endif /* __KERNEL_DEBUG__ */
CCL_NAMESPACE_END
#endif /* __BVH_TYPES__ */

View File

@@ -86,8 +86,7 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
n = normalize(
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
object_normal_transform(kg, sd, &n); /* Normal x scale, world space */
/* Parabolic approximation */
float a = dot(N[2] - N[0], V[0] - V[2]);
@@ -240,4 +239,14 @@ ccl_device_forceinline int intersection_get_shader(KernelGlobals *ccl_restrict k
return shader & SHADER_MASK;
}
ccl_device_forceinline int intersection_get_object(KernelGlobals *ccl_restrict kg,
const Intersection *ccl_restrict isect)
{
if (isect->object != OBJECT_NONE) {
return isect->object;
}
return kernel_tex_fetch(__prim_object, isect->prim);
}
CCL_NAMESPACE_END

View File

@@ -432,9 +432,9 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
xi *= bssrdf->channels;
if (xi < 1.0f) {
radius = (bssrdf->radius.x > 0.0f) ?
bssrdf->radius.x :
(bssrdf->radius.y > 0.0f) ? bssrdf->radius.y : bssrdf->radius.z;
radius = (bssrdf->radius.x > 0.0f) ? bssrdf->radius.x :
(bssrdf->radius.y > 0.0f) ? bssrdf->radius.y :
bssrdf->radius.z;
}
else if (xi < 2.0f) {
xi -= 1.0f;

View File

@@ -52,15 +52,14 @@ typedef struct TileInfo {
tile_buffer_6, tile_buffer_7, tile_buffer_8, tile_buffer_9
# define ccl_get_tile_buffer(id) \
(id == 0 ? tile_buffer_1 : \
id == 1 ? \
tile_buffer_2 : \
id == 2 ? \
tile_buffer_3 : \
id == 3 ? tile_buffer_4 : \
id == 4 ? tile_buffer_5 : \
id == 5 ? tile_buffer_6 : \
id == 6 ? tile_buffer_7 : \
id == 7 ? tile_buffer_8 : tile_buffer_9)
id == 1 ? tile_buffer_2 : \
id == 2 ? tile_buffer_3 : \
id == 3 ? tile_buffer_4 : \
id == 4 ? tile_buffer_5 : \
id == 5 ? tile_buffer_6 : \
id == 6 ? tile_buffer_7 : \
id == 7 ? tile_buffer_8 : \
tile_buffer_9)
#else
# ifdef __KERNEL_CUDA__
# define CCL_FILTER_TILE_INFO ccl_global TileInfo *tile_info

Some files were not shown because too many files have changed in this diff Show More