1
1

Compare commits

...

2575 Commits

Author SHA1 Message Date
ed21b7dd64 LineArt: Intersection matching multithread. 2022-06-02 22:55:44 +08:00
3ae33717e6 LineArt: Edge cutter rare case handling. 2022-06-02 22:55:26 +08:00
fb8aa8d54c Merge branch 'temp-lineart-contained' into lineart-shadow 2022-06-02 21:35:33 +08:00
04f67fb2db Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-06-02 21:27:28 +08:00
e336345166 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-06-02 11:21:07 +08:00
2b445dac83 LineArt: threaded shadow
LineArt: threaded shadow
2022-06-02 10:58:26 +08:00
129028ee98 LineArt: Obindex fix. 2022-06-02 10:58:26 +08:00
b30cba5702 LineArt: Performance measurement of shadow stages. 2022-06-02 09:30:13 +08:00
b88d128e5f Merge remote-tracking branch 'origin/master' into lineart-shadow 2022-06-02 09:25:45 +08:00
53dc52c83d LineArt: split shadow functions into separate files. 2022-05-31 19:27:43 +08:00
c3a125d4cc LineArt: Silhouette bit mask logic fix 2022-05-30 11:58:04 +08:00
b6cfc82ca9 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-30 09:50:12 +08:00
90da8c5f4a LineArt: Cas 2022-05-30 09:49:31 +08:00
531fcb9f32 Merge branch 'master' into temp-lineart-contained 2022-05-30 09:45:58 +08:00
5d1c589f43 LineArt: Use double to pass isect arg 2022-05-23 23:13:49 +08:00
25d072436d LineArt: Intersection priority 2022-05-23 20:28:55 +08:00
679464141c Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-23 16:21:53 +08:00
38108373fd Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-23 16:21:37 +08:00
abaec1f83b LineArt: Fix loading. 2022-05-23 16:09:23 +08:00
cb64737022 LineArt: Fix adjacent edge sorting.
The sorting end element should be `start+len` not `start+len-1`.
2022-05-23 16:08:53 +08:00
ac344bd027 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-23 15:32:19 +08:00
0d959dcc53 Merge branch 'master' into temp-lineart-contained 2022-05-23 14:05:19 +08:00
ec3b38929e LineArt: Cas and try to use c11 atomics. 2022-05-23 13:25:09 +08:00
a9de546daa Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-18 15:43:59 +08:00
c4e9966f4f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-18 15:41:06 +08:00
016e452b5f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-15 22:16:54 +08:00
d89608cb04 LineArt: Use thread safe bound box. 2022-05-10 15:17:20 +08:00
7f004860b9 LineArt: Use safe remove_duplicated_edges 2022-05-10 15:06:52 +08:00
795109bba3 LineArt: Cleanup variables. 2022-05-09 22:06:36 +08:00
8202d2b356 LineArt: Fix wrong user data reference.
the user data in lineart_identify_loose_edges should be the `tls` one
rather than the plain `userdata`.

This will lead to incorrect address being accessed. Fixed now.
2022-05-09 22:06:02 +08:00
5efc1dea8a Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-07 21:02:32 +08:00
1be25a44b5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-07 21:00:54 +08:00
e8416ce70f Merge branch 'temp-lineart-contained' into lineart-shadow 2022-05-04 22:36:05 +08:00
1a5f2233b6 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-04 22:33:39 +08:00
ce63f7a5ab Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-05-04 22:30:33 +08:00
708eb259e0 LineArt: Patch review fixes for object load. 2022-05-04 22:27:38 +08:00
502c420170 LineArt: Fix light/shade cutting for intersections 2022-05-03 11:00:18 +08:00
2e27bc6743 LineArt: Silhouette group support. 2022-04-28 13:20:40 +08:00
34534fa01c Merge branch 'temp-lineart-contained' into lineart-shadow 2022-04-26 19:03:43 +08:00
f9a92a0e3f Merge branch 'lineart-object-load' into temp-lineart-contained 2022-04-26 16:40:49 +08:00
bcf2f3b9e9 LineArt: Fix back face culling 2022-04-26 16:34:33 +08:00
5de6b9db82 LineArt: Properly working object loading with index 2022-04-26 16:34:33 +08:00
e5e3857c32 LineArt: Try using sort/parallel_sort but crashes 2022-04-26 16:34:33 +08:00
728de0646a LineArt: Edge neighbor with object loading code WIP 2022-04-26 16:34:33 +08:00
c9a97ea913 Revert "LineArt: CAS-inspired tile tree (WIP)"
This reverts commit 77afe859a0.
2022-04-26 16:34:33 +08:00
cbec8481c8 LineArt: CAS-inspired tile tree (WIP) 2022-04-26 16:34:33 +08:00
b562534562 LineArt: Index calculation based adjacent lookup WIP 2022-04-26 16:34:33 +08:00
fef8b9dfe8 LineArt: Object loading fixes for master 2022-04-26 16:34:33 +08:00
f5cf49f893 LineArt: Face mark filtering for new object loading code. 2022-04-26 16:34:33 +08:00
034d96df42 LineArt: Working fix for new object loading 2022-04-26 16:34:33 +08:00
70332f6e17 LineArt: Crease in new object loading working correctly. 2022-04-26 16:34:33 +08:00
0b4f0ef411 LineArt: Crease by sharp 2022-04-26 16:34:33 +08:00
62c989ae82 LineArt: Crease support for new loading 2022-04-26 16:34:33 +08:00
6a2391afbc LineArt: Object loading wip 2022-04-26 16:34:32 +08:00
2186522bf9 Fix memory leak in Context.temp_override
Add missing check as the context override dict may have been copied
since it was assigned, also initialize the context manager with
PyType_Ready, while it didn't cause any errors - it's expected
that all types are initialized.
2022-04-26 16:34:32 +08:00
bfea8aae8c Cleanup: line length for Python scripts 2022-04-26 16:34:32 +08:00
0729ff1ef1 Cleanup: autopep8 2022-04-26 16:34:32 +08:00
cf6b68f9da pyproject: enable aggressive, ignore E501 (line wrapping)
Aggressive needs to be enabled for many useful edits to take effect,
the ignore list is currently used to disable edits that may need
further checks/investigation before they're enabled.

Note that aggressive was already enabled for the:
source/tools/utils/autopep8_clean.py script which was previously used
when applying autopep8.
2022-04-26 16:34:32 +08:00
ee64d344a0 Correct over allocation in "Fix Vertex Group Deform" operator
The pointer size was incorrectly being used instead of the float size.
2022-04-26 16:34:32 +08:00
19423b7496 Cleanup: use boolean arguments and return values 2022-04-26 16:34:32 +08:00
1bc954f427 Cleanup: replace in-line swapping with SWAP macro
Also use bool array for true/false values.
2022-04-26 16:34:32 +08:00
72cffb449a Cleanup: remove NULL check and outdated comment 2022-04-26 16:34:32 +08:00
7ec589d09e Cleanup: names in text functions
- Use filepath instead of file.
- Use relbase instead of relpath.

In both cases the new names are used more frequently throughout
exiting functions.
2022-04-26 16:34:32 +08:00
f55fc52b00 PyAPI: support persistent handlers for class & static methods
Support methods being used as persistent callbacks.

Resolves T97555.
2022-04-26 16:34:32 +08:00
dd8583509d Fix bone "auto-name by axis" failure to clip long names
Failure to clip automatic-names meant named could end with a "." for e.g.

Error in [0] meant the clipped text was copied then
immediately overwritten.

[0]: 354e6b9c18
2022-04-26 16:34:32 +08:00
892cde12af Fix string escaping in override versioning and modifier renaming 2022-04-26 16:34:32 +08:00
6756d98303 Cleanup: unused return value warning 2022-04-26 16:34:32 +08:00
b9930e5c34 Cleanup: simplify text copying string operations
- De-duplicate txt_new_linen & txt_new_line.
- Don't accept NULL as input for txt_new_linen & txt_new_line
  (callers can pass in an empty string instead).
- Avoid duplicate strlen calls in txt_new_linen.
- Use memcpy when the length of the string is known in txt_delete_sel &
  BKE_text_load_ex.
2022-04-26 16:34:31 +08:00
5d0235bc7e Fix: Correctly copy and update curve type counts cache
Missing from f431be224f.
2022-04-26 16:34:31 +08:00
e9edc8c817 Fix T97595: Modifier attribute output broken for vertex groups
`attribute_try_create` didn't understand that the vertex group
attribute already existed because it only looks for names in custom
data layers when the domain matches. Using `attribute_exists`
unfortunately requires another loop through all attribute names,
but that should be optimized separately in the future anyway.

Differential Revision: https://developer.blender.org/D14756
2022-04-26 16:34:31 +08:00
86f7099a56 Cleanup: Remove redundant vertex normal dirty tags
Applying the coordinates already tags the normals dirty
2022-04-26 16:34:31 +08:00
ab41172291 Vertex Paint: Fix brush color space
The brush color wasn't being converted
to scene linear space properly.
2022-04-26 16:34:31 +08:00
ad8ceee535 Cleanup: remove unused function parameter 2022-04-26 16:34:31 +08:00
8868a8f282 Fix T81452: Incorrect trim lasso radius
Added a fallback path to compute the
cursor radius for when the stroke
starts over a blank area of space
(in which case SCULPT_cursor_geometry_update
fails).
2022-04-26 16:34:31 +08:00
96204352a8 Mesh: Make vertex normal property read-only
This commit makes the `MeshVertex.normal` property read-only.
In practice it already was, since the value could be overwritten at any
time if code requests updated normals, so this just clarifies that
position and avoids misleading users.

Differential Revision: https://developer.blender.org/D14696
2022-04-26 16:34:31 +08:00
878a7f5cb2 Fix: Incorrect implicit enum conversion
Hardcode Catmull Rom curves for now, since nothing else is implemented.
2022-04-26 16:34:31 +08:00
394f1f7725 Geometry Nodes: Add "Named" to "Remove Attribute" node name
The goal is to be consistent with the other two nodes that deal with
named attributes. Ref T97512
2022-04-26 16:34:31 +08:00
b28461a024 Fix T97597: vertex paint initialization was
called by weight paint mode,
	    causing a crash
2022-04-26 16:34:31 +08:00
8591339a60 Fix T97553: SCULPT_handles_colors_report called for non-sculpt brushes 2022-04-26 16:34:31 +08:00
98f1ab96a9 Sculpt: Remove hardcoded setting of
auto-iteration property in mask filter

Note: Auto-iteration is still set manually
for increase/decrease contrast.  These should
probably become their own operators.
2022-04-26 16:34:31 +08:00
e241a6bf9b Fix T97423: Make mask filter less confusing
by showing redo panel.

The A hotkey has "auto iteration" enabled by default,
which calculates the number of times to run the filter
using a heuristic based on vertex count.

To make clear to the user what is going on the redo
panel is now shown for the mask filter operator.

NOTE: I discovered the source of the bug where sculpt
operators' redo panels were greyed out.  The name
fed to SCULPT_undo_push_begin must match the operator
name.  I've added a comment in sculpt_intern explaining
this.
2022-04-26 16:34:31 +08:00
e8a2bb68cf Curves: Cache the number of curves of each type
Remembering the number of curves of every type makes it fast to know
whether processing specific to a single curve type has to be done.
This information was accessed in quite a few places, so this should be
an overall reduction in overhead for the new curves type.

The cache is computed eagerly, in other words every time after changing
the curve types. In order to reduce verbosity I added helper functions
for some common ways to set the types.

Differential Revision: https://developer.blender.org/D14732
2022-04-26 16:34:31 +08:00
6657502d69 Cleanup: Use const for smoot scrolling function 2022-04-26 16:34:31 +08:00
e119e6fff4 Transform Snap Refactor: dedicate ghash to different SnapData types
Changes:
- Remove `BLI_memarena` (Use `MEM_cnew` and `MEM_delete` to allocate cached data)
- Implement `snap_object_data_mesh_free_ensure` and `snap_object_data_editmesh_free_ensure` and skip need to get original key Object for editmesh data
- Use `BMEditMesh` as key for editmesh `Ghash`
- Make a better distinction between `SnapObjectData`s. (`SnapData_Mesh` and `SnapData_EditMesh`)
2022-04-26 16:34:31 +08:00
a2c57b7153 Cleanup: Turn some 'eTFlag' into macros
Some of the enum values are a mixture of others and make it difficult
for the IDE to identify them.

Separating these values makes debugging easier.
2022-04-26 16:34:30 +08:00
bff4259ed4 Fix T97401: Snap options ignored for Nurbs surfaces
The editing data of a `SURF`s is similar to that of Curves and should be supported for snapping.

But unlike Curve objects, for snapping, only support the nurb points if the object is in edit mode.

This matches the solution for Meshes and avoids having to create a kind
of "boundbox" for the SURF nurb points.
2022-04-26 16:34:30 +08:00
aa5d4ebd07 Nodes: show overlays in node editor even when nodes are collapsed 2022-04-26 16:34:30 +08:00
d39e345d7c Geometry Nodes: improve attribute dependency overlay
* Adjust width based on node width, necessary to make the longer name below work.
* Show "X Named Attributes" in the overlay.
* Use "Accessed named attributes" in the tooltip.

Differential Revision: https://developer.blender.org/D14751
2022-04-26 16:34:30 +08:00
0847578a69 Geometry Nodes: show timing overlay above attributes overlay 2022-04-26 16:34:30 +08:00
590ea0a5a7 Fix: use natural string sorting for attribute names 2022-04-26 16:34:30 +08:00
c186277a81 Cleanup: fix unused variable warning in paint_vertex.cc
No functional changes.
2022-04-26 16:34:30 +08:00
b027c70fb3 Geometry Nodes: improve ui when trying to remove built-in attributes
* If removing an attribute failed (even though it exists), don't log it as being used.
* Make warning message a bit more informative.

Differential Revision: https://developer.blender.org/D14750
2022-04-26 16:34:30 +08:00
Pratik Borhade
8fd8b909a1 Fix T96925: Fast diagonal movement in walk navigation
View moves faster with two active directions.
This is probably because `dvec` is not normalized when moving in two directions.
Normalizing this direction vector will fix the problem.

Differential Revision: https://developer.blender.org/D14729
2022-04-26 16:34:30 +08:00
Brecht Van Lommel
cbcbb03aed Build: add autopep8 to bundled Python packages
For use in "make format" to automatically format Python code, see D14686.

Differential Revision: https://developer.blender.org/D14716
2022-04-26 16:34:30 +08:00
330483230a Fix build error on Linux + Clang 10 after recent changes to BLI_any
Differential Revision: https://developer.blender.org/D14749
2022-04-26 16:34:30 +08:00
210334e128 CMake: harvest zero-level SO files
Zero-level is built as shared library at the moment, so better to harvest
`*.so*` instead of `*.a`.
2022-04-26 16:34:30 +08:00
13009b7cd4 Revert "CMake: add harvesting of fmt library"
This reverts commit 7c55a7ccca. `fmt` is
only a build-time OIIO dependency and doesn't need to be bundled with
Blender.
2022-04-26 16:34:30 +08:00
80478c5a6c CMake: add ^NANOVDB to variables to reset after library upgrade
Cycles needed this to build properly after switching to the newly built
libraries.
2022-04-26 16:34:30 +08:00
54d5af92bc CMake: add harvesting of fmt library
The library was built with `make deps`, but not installed. Now it is.
2022-04-26 16:34:30 +08:00
bfcb733e17 Fix memory leak in cryptomatte
Since cbf033c055 the `matte_id` will be allocated in the node
storage for the forward compatibility purposes. However, this
field was never freed, leading to memory leak.

Causes annoying popup on macOS when running Cycles tests,
for example render_passes_cryptomatte_asset.blend

Differential Revision: https://developer.blender.org/D14728
2022-04-26 16:34:30 +08:00
3d698e1b00 BLI: optimize constructing new virtual array
Differential Revision: https://developer.blender.org/D14745
2022-04-26 16:34:30 +08:00
Brad Clark
381d2cdeb1 NLA: Add Bake Action to the NLA edit menu
Add Bake Action to the NLA edit menu to aid discoverablity and allow
people to understand that Bake Action is part of working with the NLA.

Part of the NLA road map improvement project for the Animation Module.
This was a community request to add access to the Bake without needing
to turn on developer tools in the preferences and then use search in the
NLA for bake.

It seems this was always intended, as the operator is called `nla.bake`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14575
2022-04-26 16:34:30 +08:00
e5211e30ea Cleanup: spelling in comments 2022-04-26 16:34:30 +08:00
854cb603cb Cleanup: add missing doxy sections in customdata 2022-04-26 16:34:30 +08:00
26b3b42ee5 VSE: Update first thumbnail when moving handle
When handles are moved, job is created only for strips that need to
update first thumbnail.

ref T91618
2022-04-26 16:34:30 +08:00
145d3fafea Cleanup: remove special cases for getting internal span or single
Those are handled in the called function already.
2022-04-26 16:34:30 +08:00
0340687fe4 BLI: prioritize detecting single values higher than detecting spans
In some contexts, single values can be handled more efficiently than spans.
2022-04-26 16:34:30 +08:00
9b203ca02c Cleanup: various minor changes
- Add missing doxy-section for Apply Parent Inverse Operator
- Use identity for None comparison in Python.
- Remove newline from operator doc-strings.
- Use '*' prefix multi-line C comment blocks.
- Separate filenames from doc-strings.
- Remove break after return.
2022-04-26 16:34:30 +08:00
e9b280648a Cleanup: clang-format 2022-04-26 16:34:30 +08:00
4a0e726394 pyproject: remove settings that cause other uses of autopep8 to fail
While the ability to run `autopep8 .` to format Blender's Python code
is handy, the settings to perform this can conflict with other uses
of autopep8 (which editors may use to auto-format on save).

Some arguments now need to be passed in, e.g:

    autopep8 . --in-place --recursive --jobs=0

We'll likely include this in `make format` convenience target so the
details for invoking autopep8 shouldn't be an issue in the long term.
2022-04-26 16:34:30 +08:00
44d6bebb92 Mikktspace: Reduce number of data queries to caller
The current code for computing tangents is not exactly fast.
This has been a long-standing issue, and recently came up again with T97378.

The main bottleneck is fetching the mesh data, since it's handled through a callback system and each vertex might have its data queried dozens of times.

I've tried a lot of things to optimize `mikktspace.c`, but unfortunately most weren't that useful:
- Vectorizing SVec3 gives a ~5% speedup, but I'm not sure if the additional ~70 lines of code are worth it
- Keeping an internal copy of the data instead of re-querying all the time helps a lot (~50-60% time reduction), but requires a lot of extra memory (~100 byte per face)
- Going C++ and replacing the internal quicksort with std::sort shows no difference
- Restructuring the entire file to be a header-only library so that the callbacks can be inlined gives ~10% reduction, but is a major change and deviation from the original library

In the end, two simple fixes that actually help remain:
- Don't re-query the number of faces in each loop iteration
- Don't bother looking for identical vertices if there's only one vertex with that hash

With this, time for the test case in T97378 goes from 6.64sec to 4.92sec. It's something I guess.

I feel like completely refactoring this library would not be a bad idea at some point, but for now it does the job...

Differential Revision: https://developer.blender.org/D14675
2022-04-26 16:34:30 +08:00
ec90db2a90 Fix a failing bmesh_bevel test by fixing buffer overflow.
The uv fix just submitted had a bug where I forgot to wrap around
after adding 1. This apparently worked anyway in a debug build
but not in release build, hence the buildbot tests were failing.
2022-04-26 16:34:29 +08:00
98b467df9a Bake: add UDIM tile baking support
Works for both Cycles and multires bake. Triangles are baked to multiple
UDIM images if they span across them, though such UV layouts are generally
discouraged as there is no filtering across UDIM tiles.

The bake margin currently only works within UDIM tiles. For the extend method
this is logical, for the adjacent faces method it may be useful to support
copying pixels from other UDIM tiles, though this seems somewhat complicated.

Fixes T95190

Ref T72390
2022-04-26 16:34:29 +08:00
bb6e700a49 Fix deprecation warning when building with OpenVDB 9
Based on patch by Sebastian Parborg.
2022-04-26 16:34:29 +08:00
52596a9fb7 Fix T97453: Blender crash when selecting Caching checkbox in VSE
Merge Audaspace fixes from upstream.
2022-04-26 16:34:29 +08:00
5a192385ad Cleanup: Clang tidy, unused variable warnings
Also remove unnecessary uses of `struct` and add const in one place.
2022-04-26 16:34:29 +08:00
0decb5803e Cleanup: Remove unused variables, adjust comments 2022-04-26 16:34:29 +08:00
Olivier Maury
f7355ae13a Cycles: removed UV requirement for MNEE, along with fixes and cleanups
Remove need for shadow caustic caster geometry to have a UV layout. UVs were
useful to maintain a consistent tangent frame across the surface while
performing the walk. A consistent tangent frame is necessary for rough
surfaces where a normal offset encodes the sampled h, which should point
towards the same direction across the mesh.

In order to get a continuous surface parametrization without UVs, the
technique described in this paper was implemented:

"The Natural-Constraint Representation of the Path Space for Efficient
 Light Transport Simulation" (Supplementary Material), SIGGRAPH 2014.

In addition to implementing this feature:
* Shadow caustic casters without smooth normals are now ignored (triggered
  some refactoring and cleaning).
* Hit point calculation was refactored using existing utils functions,
  simplifying the code.
* The max number of solver iterations was reduced to 32, a solution is
  usually found by then.
* Added generalized geometry term clamping (transfer matrix calculation can
  sometimes get unstable).
* Add stop condition to Newton solver for more consistent CPU and GPU result.
* Add support for multi scatter GGX refraction.

Fixes T96990, T96991

Ref T94120

Differential Revision: https://developer.blender.org/D14623
2022-04-26 16:34:29 +08:00
5735935688 LibOverride: Add hierarchy creation from IDTemplate UI widget.
This is fairly tricky to perform, since there is often very limited
contextual information available about the 'active' hierarchy to
override.

This commit is a first step, it is expected to handle decently well
cases like objects and obdata (recreating necessary object and
collection hierarchy, and/or hooking it to a potential existing
hierarchy), at least in most common cases.

Ref: {T95707}.
2022-04-26 16:34:29 +08:00
39dc6924ea Fix: Build error on macOS after previous commit 2022-04-26 16:34:29 +08:00
1eaf314aa1 Re-fix some comments in bmesh_bevel.c.
The UV fix just committed had gotten out of sync with some changes
that had been made inside some comments (spelling and folding).
2022-04-26 16:34:29 +08:00
74a03c129a Curves: Further split of curves draw code from particles
Extends the changes started in f31c3f8114 to completely separate
much of the DRW curves code from the particle hair drawing. In the short
term this increases duplication, but the idea is to simplify development
by making it easier to do larger changes to the new code, and the new
system will replace the particle hair at some point.

After this, only the shaders themselves are shared.

Differential Revision: https://developer.blender.org/D14699
2022-04-26 16:34:29 +08:00
Martijn Versteegh
368b291b08 BMesh: Add additional attribute access macros
Add macros to get/set boolean attributes, to set float2/float3
attributes and to get float2/float3 attributes via pointer access.
Needed for D14365 and further generic attribute integration.

Differential Revision: https://developer.blender.org/D14708
2022-04-26 16:34:29 +08:00
562f145986 Fix T56625: Bevel sometimes made zero area UV faces.
This substantially redoes the logic by which bevel chooses, for
the middle segment when there are an odd number of segments,
which face to interpolate in, and which vertices to snap to which
edges before doing that interpolation. It changes the UV layouts
of a number of the regression tests, for the better.
An example, in the reference bug, is a cube with all seams, unwrapped
and then packed with some margin around them, now looks much
better in UV space when there are an odd number of segments.
2022-04-26 16:34:29 +08:00
1520ecc5d4 Fix T96498: Modifiers affect multiple curve objects
The original mistake I made in b9febb54a4 was thinking
that the input curve object data to `BKE_displist_make_curveTypes`
was already copied from the original. I think I misread some of its
`ID` flags. This commit places the result of curves evaluation in a
duplicated curve instead, and copies the edit mode pointers
necessary for drawing overlays. `Curve` needs to know not to
free those pointers.

I still don't have a full understanding of why some of the tactics I've
used work and others don't. I've probably tried around 8 different
solutions at this point, and this is the best I came up with.

The dependency graph seems to have some handling of edit mode
pointers that make the edit mode overlays work if the evaluated
result is only an empty curve created by the evaluated geometry set.
This doesn't work with the current method and I need to set the
edit mode pointers at the end of evaluation explicitly.

We're constrained by the confusing duality of the old curves system
combined with the new design using the evaluated geometry set.
Older areas of Blender expect the evaluated `Curve` to be a copy
of the original, even if it was replaced by some arbitrary evaluated mesh.

Differential Revision: https://developer.blender.org/D14561
2022-04-26 16:34:29 +08:00
dd9e0b7561 Fix (unreported): Placement Tool not orienting the Object to normal
Regression introduced in
{rB721335553ccb5ce4f7a374b958b7d65befa319df}.

`plane_omat` is only computed if `snap_state->draw_plane` is `true`.
2022-04-26 16:34:29 +08:00
d6c31baf9b Fix: Assert failure with certain screw modifier settings
Caused by a typo/mistake in rB6a3c3c77b3ebdbcd4455.
2022-04-26 16:34:29 +08:00
ac9b18af01 Fix various typos and other UI messages issues. 2022-04-26 16:34:29 +08:00
cf3c4812c4 Fix T97429: Translateable Unit Names Missing in the File.
Added some regex magic in i18n py module to also extract UI names from
all of our units definitions.

Those enum values are fully dynamically generated, so they cannot be
extracted from RNA introspection.
2022-04-26 16:34:29 +08:00
Ramil Roosileht
2f64af2542 Change vertex paint icon color (fix)
Apply standard green tool color to vertex paint tools, to keep icon
color palette more consistent

https://developer.blender.org/D14694
2022-04-26 16:34:29 +08:00
6a642045f1 Fix Data Transfer Projected Face/Edge Interpolated mode is wrong
Caused by {rBcfa53e0fbeed}

Above commit mixed up source and destination meshes causing bad lookups
on calculated normals.

Now make sure we get normals from our destination mesh to project along.

Note this was only reported for Projected Face Interpolated mode, but
same was true for Projected Edge Interpolated mode (though that one is a
bit weird to test since I think there is generally something wrong with
that mode -- with or without rBcfa53e0fbeed).

Fixes T97528

Maniphest Tasks: T97528

Differential Revision: https://developer.blender.org/D14726
2022-04-26 16:34:29 +08:00
3b6dbe4384 Fix accessing attribute data in editmode
When in mesh editmode, attributes point to bmesh customdata, the
attribute data is empty since custom data is stored per element instead
of a single array there (same es UVs etc.).
Opposed to e.g. UVs, general attributes were not setting their data
length/size to zero in case of editmode though, which could lead to
- crash in Outliner Data Api view [that was reported in T95922]
- RuntimeError such as the following:
```
RuntimeError: bpy_prop_collection[index]: internal error, valid index 0
given in 8 sized collection, but value not found
```

Now check for mesh editmode in `BKE_id_attribute_data_length` (and
return zero in that case).
Alternatively, the check could also be done in
`rna_Attribute_data_length` only (such as UVs do in
`rna_MeshUVLoopLayer_data_length`).

Ref D11998
Fixes T95922

Maniphest Tasks: T95922

Differential Revision: https://developer.blender.org/D14714
2022-04-26 16:34:29 +08:00
5ba34cea85 Fix T97277: Tweak drag transforming is broken for masks (RMB select)
Regression in 4d0f846b93,
passing selection through to drag relied on tweak events running
even when the press event was handled which is not the case for drag.
2022-04-26 16:34:29 +08:00
Ramil Roosileht
709e4a83a2 Fix - Display correct units in "Edit voxel size" widget
Fix for T84962
Before the patch, edit voxel size always displayed voxel size without units, just as a number in meters.
Now it changes like in the voxel remesh panel and shows correct units
Video:
{F13009428}

In adaptive mode:
{F13009435}

Reviewed By: JulienKaspar

Maniphest Tasks: T84962

Differential Revision: https://developer.blender.org/D14682
2022-04-26 16:34:29 +08:00
Ramil Roosileht
07b10638aa Change viewport shading text from "Color" to "Attribute"
This change from T97104

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97104

Differential Revision: https://developer.blender.org/D14620
2022-04-26 16:34:29 +08:00
Ramil Roosileht
1b9bcdc32a Reorder sculpt tools
Changed tool order as proposed in [[ https://developer.blender.org/T97206 | T97206 ]]
{F12987559}

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97206

Differential Revision: https://developer.blender.org/D14612
2022-04-26 16:34:29 +08:00
682e6027a9 Fix: VSE channels region visible in preview
Hide region for preview and sequencer/preview combined view.
2022-04-26 16:34:29 +08:00
a89c7fcacc pyproject: add configuration for autopep8
This adds pyproject.toml, needed to configure defaults for autopep8.

The file is auto-discovered in a similar way to .clang-format, other
tools could be configured here too. For now just configure autopep8 so
this can be enabled in IDE's without causing unexpected edits such as
wrapping lines over 80 columns in width.

Now autopep8 can be used from the root directory by running: autopep8 .

This uses multiple-jobs to run autopep8 over all Python scripts except
paths that are explicitly ignored in exclude defined by pyproject.toml.

Reviewed By: mont29, brecht, sybren

Ref D14686
2022-04-26 16:34:28 +08:00
d3051bd4d7 Cleanup: spelling in comments 2022-04-26 16:34:28 +08:00
Brecht Van Lommel
3a8ceeeacb Cycles: enable AMD RDNA GPU support on Linux
This enables building of HIP binaries for AMD RDNA and RDNA2 GPUs.

This requires the 22.10 / ROCm 5.1 driver.

Ref T91571

Differential Revision: https://developer.blender.org/D14360
2022-04-26 16:34:28 +08:00
c3937ad912 Fix: VSE channels area has no background
Draw area background even when there is no sequencer data.
2022-04-26 16:34:28 +08:00
711a9b6210 Fix: Use alphabetical order in geometry nodes add menu 2022-04-26 16:34:28 +08:00
c2a2c51182 Fix: Memory leak writing to builtin attribute from modifier
If the attribute already existed, but had a different domain or data type
than the user tried to write to it with (i.e. writing to `position` with
a float), then the data from field evaluation wasn't freed.

This restructures the geometry nodes modifier attribute writing process
to solve that problem and remove some of the nested if statements
that made the process confusing.

One case that still doesn't work is writing to a builtin attribute from
a different domain. If `OutputAttribute` gets that feature then that
could be supported here too.

Differential Revision: https://developer.blender.org/D14706
2022-04-26 16:34:28 +08:00
f8aab87469 Fix T97490: snap to multiple objects with linked data can crash
The problem is old.

rB52be06301257 (fixed by rB4b35d6950d4f) just masked it.

`Object->data`, on evaluated objects, is not a safe pointer to get
objects with the same `BMEditData`.

Use `Object->runtime.data_orig` instead.
2022-04-26 16:34:28 +08:00
7b4bdfc474 Cleanup: Remove unused argument to mesh modifier evaluation 2022-04-26 16:34:28 +08:00
Germano Cavalcante
bc142f0529 gpu.types.GPUBatch: warn about deprecated primitive types
As `GPU_PRIM_LINE_LOOP` is not supported on Vulkan or Metal and
`GPU_PRIM_TRI_FAN` is not supported on Metal, they will be removed in
future releases.

So it is important to inform users that they are obsolete and may not
be supported for a long time.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14679
2022-04-26 16:34:28 +08:00
0c701e7f56 Cleanup: don't use allocation variables in OpenColorIO config
These are only needed for the legacy GPU renderer, which we don't use.
2022-04-26 16:34:28 +08:00
e8f2d2c23f Color Management: add ACEScg to the default configuration
For more easily reading and writing ACEScg EXR files.
2022-04-26 16:34:28 +08:00
e87921c201 Fix T97502: Issues/crashes with "color_attributes" AttributeGroup
Property collection functions were not really in sync which could result
in crashes in UI_LISTS.

The reason is that attributes of type color defined on domains other than
Points or Corners are still valid, but should really be skipped for the
special "color_attributes".
`rna_AttributeGroup_color_length` itself was fine here, it skips these,
but the iterator (`rna_AttributeGroup_color_iterator_begin` /
`rna_Attributes_noncolor_layer_skip`) wasnt, so when a UI_LIST
filter_items() would iterate the collection it would actually get
results were it shouldnt.

Now check a suiting domain in `rna_Attributes_noncolor_layer_skip` as
well.

Maniphest Tasks: T97502

Differential Revision: https://developer.blender.org/D14717
2022-04-26 16:34:28 +08:00
638dd261d0 Geometry Nodes: better support for byte color attributes
Since {rBeae36be372a6b16ee3e76eff0485a47da4f3c230} the distinction
between float and byte colors is more explicit in the ui. So far, geometry
nodes couldn't really deal with byte colors in general. This patch fixes that.
There is still only one color socket, which contains float colors. Conversion
to and from byte colors is done when read from or writing to attributes.

* Support writing to byte color attributes in Store Named Attribute node.
* Support converting to/from byte color in attribute conversion operator.
* Support propagating byte color attributes.
* Add all the implicit conversions from byte colors to the other types.
* Display byte colors as integers in spreadsheet.

Differential Revision: https://developer.blender.org/D14705
2022-04-26 16:34:28 +08:00
f950871d98 Nodes: raise exception when creating node group input/output fails
Previously this would silently return `None`.
Now the behavior is similar to when new sockets are added to a node.
2022-04-26 16:34:28 +08:00
721f44f8ad install_deps: Update USD to 22.03.
Add back a patch wrongly removed by rBb9c37608a9e9, and add another fix,
for gcc11 build support.

Re {T95206}.
2022-04-26 16:34:28 +08:00
0945e21e71 Functions: fix procedure executor not writing output in correct buffer
The issue was that the executor would forget about the caller provided
storage if the variable is destructed.
2022-04-26 16:34:28 +08:00
8b7ad6c7d2 Geometry Nodes: show used named attributes in modifier
This adds a new subpanel to the geometry nodes modifier which is just
used to display information about used attributes.

* A new panel is used because adding this information anywhere else
  clutters the ui too much imo.
* The general layout is similar to that in the tooltip. I found it to be more
  trouble than it's worth to share this code.

Possible future improvements:
* Don't show the panel if there are no used named attributes.
* Add some heuristics to determine which named attributes the user does
  not have to care about because they are only used in the node group
  and don't affect anything else.

Differential Revision: https://developer.blender.org/D14701
2022-04-26 16:34:28 +08:00
46419df258 Curves: show sculpt tool settings in panels
Ref T97444.

Differential Revision: https://developer.blender.org/D14700
2022-04-26 16:34:28 +08:00
Colin Basnett
2ee0404532 Fix T97497: NLA strip names are now properly contained within the strip bounds
Very easy fix, the bug seemed to be a result of a typo on the right-most margin.

Old: {F13013777}

New: {F13013782}

Maniphest Tasks: T97497

Differential Revision: https://developer.blender.org/D14711
2022-04-26 16:34:28 +08:00
7ce0ef01b9 Fix Empty "Only Axis Aligned" viewing angle depends on object scale
This was projecting the unnormalized z scale axis onto the plane defined
by the view vector. If object scale was very small, this made the empty
still visible at viewing angles far from the object axis.

Now use the normalized z scale axis to make this work the same at all
object scales.

Fixes T97004.

Maniphest Tasks: T97004

Differential Revision: https://developer.blender.org/D14557
2022-04-26 16:34:28 +08:00
f7d779afa8 Fix T97465: Moving compositor BG image cannot be cancelled
This was possible with the gizmo, but no using the operator (e.g. from
the sidebar).

Now store original offsets and reset to these on calcel (ESC or RMB).

Maniphest Tasks: T97465

Differential Revision: https://developer.blender.org/D14704
2022-04-26 16:34:28 +08:00
8db1303aad Sculpt: fix missing null pointer check
in workbench_engine.c
2022-04-26 16:34:28 +08:00
5538a5794e Fix T95932: Auto-close text breaks outliner drag-n-drop
Text inserted via TEXT_OT_insert would always have auto-close
logic applies which interfered any insertion of literal strings
containing brackets.

Now auto-closing brackets is restricted to characters read from
events from the operators invoke functions.
2022-04-26 16:34:28 +08:00
2883321572 Cleanup: clang format 2022-04-26 16:34:28 +08:00
267fafe0f1 Cleanup: fix various warnings after recent commit 2022-04-26 16:34:27 +08:00
3e8222fe18 Vertex paint: Fix debug compile error and a
few warnings.
2022-04-26 16:34:27 +08:00
6648638d41 Fix T97185: Data transfer modifier doesn't display
individual layers.

A few RNA property strings were misspelled.
2022-04-26 16:34:27 +08:00
f71dff27bb Fix T97469: Sculpt colors crash in multiresolution or dynamic topology modes.
Sculpt paint tools now pop up an error message if
dynamic topology or multires are enabled.

Implementation notes:

* SCULPT_vertex_colors_poll is now a static function in sculpt_ops.c.
  It is now used solely by the legacy color attribute conversion
  operators (SCULPT_OT_vertex_to_loop_colors and SCULPT_OT_loop_to_vertex_colors)
  and should be deleted when they are.
* There is a new method, SCULPT_handles_colors_report, that returns true if
  the sculpt session can handle color attributes; otherwise it returns false
  and displays an error message to the user.
2022-04-26 16:34:27 +08:00
24e103d2bc Commit D14179: Revamp Vertex Paint With C++
- Verrtex paint mode has been refactored into C++ templates.
  It now works with both byte and float colors and point
  & corner attribute domains.
- There is a new API for mixing colors (also based
  on C++ templates).  Unlike the existing APIs byte
  and float colors are interpolated identically.
  Interpolation does happen in a squared rgb space,
  this may be changed in the future.
- Vertex paint now uses the sculpt undo system.

Reviewed By: Brecht Van Lommel.

Differential Revision: https://developer.blender.org/D14179
Ref D14179
2022-04-26 16:34:27 +08:00
Jon Denning
7d25dc1fc4 Text Editor: add Python 3.10 soft keywords to builtinfunc list
Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.

The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.

Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).

This patch also updates the commented Python code for creating the list
of keywords, for convenience.

Before:

{F13012878}

After:

{F13012880}

Example from PEP-636 [1]

Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.

[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html

Ref D14707
2022-04-26 16:34:27 +08:00
edb999fbb4 Cleanup: explicitly disable autopep8 for rna_manual_reference
Currently the "exclude" option for autopep8 isn't as reliable as it
should be since passing in absolute paths to autopep8 causes
the paths not to match. See: D14686 for details.

So explicitly disable autopep8 in this generated file (the generator
has already been updated).

Also use spaces for indentation otherwise autopep8 re-indents them.
This seems like a bug in autopep8 since it's changing lines with
autopep8 disabled. Use a workaround instead of looking into a fix since
it's simpler for all our Python files to use spaces instead of tabs and
there isn't much benefit mixing indentation for scripts.
2022-04-26 16:34:27 +08:00
b10ba18ef8 Fix typo in previous commit 2022-04-26 16:34:27 +08:00
d31ad5cf48 Cleanup: VSE effect relationship checking
Use `SEQ_relation_is_effect_of_strip` for checking effect-input
relationship where this is applicable.
2022-04-26 16:34:27 +08:00
Shrey Aggarwal
02d38f453c Fix T70844: Incorrect snappping of strips when effects attached
Sometimes, when moving strip with 2 input effect attached and causing
strip overlap, this overlap is resolved incorrectly - too big offset
is applied. This is because effects are not taken into consideration
when "shuffeling" to resolve overlap.

To fix usual cases (transitions), overlap between strip and it's effect
is considered to be impossible.

There are edge cases, but these would be much more complicated to
implement and could have negative impact on performance.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14578
2022-04-26 16:34:27 +08:00
ok what
d30792eabd VSE: Add frame selected operator for preview
This operator moves the view to show the selected visible strips.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14222
2022-04-26 16:34:27 +08:00
7962a8d9f8 Fix T97254: VSE channel mute does mute sound
Add missing RNA update function
2022-04-26 16:34:27 +08:00
6d06e82c29 Fix T97356: Crash when adding adjustment layer strip
Crash was caused by incorrectly assuming, that rendered strip is meta
when editing code in bulk, but this wasn't true and strip had no
channels initialized, which caused crash on NULL dereference.

Correct approach is to find list of channels where on same level as
rendered strip, similar to how `SEQ_get_seqbase_by_seq` function works
for list of strips.
2022-04-26 16:34:27 +08:00
f290685d46 GL: Change array macro to not conflict with opensubdiv variable names
Fix T97449 GPU subdivision: Crash on adding subdivision surface modifier
2022-04-26 16:34:27 +08:00
4419e28386 Revert "Fix GPU subdivision: Crash on adding subdivision surface modifier"
The fix does not fix the case of shaders comming from the OpenSubdiv API.

This reverts commit f5191b8760.
2022-04-26 16:34:27 +08:00
cd3220a317 Revert "Fix Cycles HIP assuming warp size 32"
This reverts commit 390b9f1305. It seems to
break things on Linux for unknown reasons, so leave it out for now. A solution
to this will be required for Vega cards though.
2022-04-26 16:34:27 +08:00
c8b2c89c9c LibOverride: Make 'custom bone shape' and 'bbone custom handle' non-overridable.
There is not much point in having those editable in overrides, and since
those are pointers, their value always differs from ref linked ID vs.
local override one, generating 'noise' in Outliner's override property
view.
2022-04-26 16:34:27 +08:00
Jung Jaeyun
61edefcbb4 UI: Add option to create color attribute directly from canvas selector.
Added + and - buttons to create and delete color attributes from canvas selector.

{T97345}

{F13006374}

Reviewed By: jbakker, Ethan1080

Maniphest Tasks: T97345

Differential Revision: https://developer.blender.org/D14672
2022-04-26 16:34:27 +08:00
062edac582 Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until
the precompiled libraries are committed for all platforms.

* Enable WebP by default.
* Update Windows for new library file names.
* Automatically clear outdated CMake cache variables when upgrading to new
  libraries.
* Fix static library linking order issues on Linux for OpenEXR and OpenVDB.

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-26 16:34:27 +08:00
584ff1ec15 Build: upgrade many library dependencies to new versions for Blender 3.2
This only updates the build system, precompiled libraries for the various
platforms will be committed over the coming week.

New:
fmt 8.0.0
level_zero v1.7.15
pystring v1.1.3
robinmap v0.6.2
webp 1.2.2

Updated:
alembic 1.8.3
blosc 1.21.1
boost 1.78.0
embree 3.13.3
ffmpeg 5.0
fftw 3.3.10
flac 1.3.4
imath 3.1.4
ispc v1.17.0
jpeg 2.1.3
ogg 1.3.5
oidn 1.4.3
openal 1.21.1
opencolorio 2.1.1
openexr 3.1.4
openimageio v2.3.13.0
openjpeg 2.4.0
opensubdiv v3_4_4
openvdb 9.0.0
osl 1.11.17.0
sdl 2.0.20
tbb 2020_u3
tiff 4.3.0
usd 22.03
vorbis 1.3.7
vpx 1.11.0
x264 35fe20d1b
zlib 1.2.12

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-26 16:34:27 +08:00
293ca5bd2b Cleanup: Remove redundant types from custom data masks
Colors and byte colors are already included in `CD_MASK_PROP_ALL`.
2022-04-26 16:34:27 +08:00
31c831f35a Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLOR
The "PROP" in the name reflects its generic status, and removing
"LOOP" makes sense because it is no longer associated with just
mesh face corners. In general the goal is to remove extra semantic
meaning from the custom data types.
2022-04-26 16:34:27 +08:00
e471ef514f Merge branch 'lineart-object-load' into temp-lineart-contained 2022-04-26 16:25:35 +08:00
c67c2b494e LineArt: Fix back face culling 2022-04-26 16:24:31 +08:00
fbdb443f1a Merge branch 'lineart-object-load' into temp-lineart-contained 2022-04-26 15:59:50 +08:00
85e8a6424e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-04-26 15:23:10 +08:00
0bd8756321 Merge remote-tracking branch 'origin/master' into lineart-object-load 2022-04-26 15:22:00 +08:00
19e0ba9800 LineArt: Properly working object loading with index 2022-04-26 14:16:25 +08:00
5ba3e6001f LineArt: Try using sort/parallel_sort but crashes 2022-04-25 16:56:06 +08:00
0ebc062604 LineArt: Edge neighbor with object loading code WIP 2022-04-25 14:54:07 +08:00
a3b38c979a Revert "LineArt: CAS-inspired tile tree (WIP)"
This reverts commit 77afe859a0.
2022-04-25 12:49:25 +08:00
ef008bf11a LineArt: Fix pointer type error for MSVC 2022-04-22 18:16:57 +08:00
0b9c5184ef Merge branch 'temp-lineart-contained' into lineart-shadow 2022-04-22 17:20:15 +08:00
73bf98912a Revert "LineArt: Alternating triangle adding direction"
Doesn't really have much performance impact thus reverting.

This reverts commit c151c54a58.
2022-04-22 16:41:36 +08:00
ff29d5876f Revert "LineArt: Experimental smaller chunks on add_triangles."
This reverts commit 962e699d340c5d75a15d740a8dd9fb471352df83.
2022-04-22 16:04:04 +08:00
129b0d545c LineArt: Experimental smaller chunks on add_triangles. 2022-04-22 16:03:04 +08:00
c151c54a58 LineArt: Alternating triangle adding direction 2022-04-22 16:01:16 +08:00
164b5ce094 LineArt: Fix tile lock assigning, now not locking the entire hierachy. 2022-04-22 16:01:16 +08:00
77afe859a0 LineArt: CAS-inspired tile tree (WIP) 2022-04-21 21:02:28 +08:00
ce689964a4 LineArt: Index calculation based adjacent lookup WIP 2022-04-20 22:12:05 +08:00
516ec45d10 LineArt: Object loading fixes for master 2022-04-20 20:00:43 +08:00
58511c4175 LineArt: Face mark filtering for new object loading code. 2022-04-20 20:00:43 +08:00
f49948bf48 LineArt: Working fix for new object loading 2022-04-20 20:00:43 +08:00
50840bb2a3 LineArt: Crease in new object loading working correctly. 2022-04-20 20:00:43 +08:00
3a055e8f41 LineArt: Crease by sharp 2022-04-20 20:00:43 +08:00
0d5d554287 LineArt: Crease support for new loading 2022-04-20 20:00:43 +08:00
fe2df4c771 LineArt: Object loading wip 2022-04-20 20:00:43 +08:00
33c581882b LineArt: Fix potentially NULL pending edge array. 2022-04-20 11:08:29 +08:00
64355e3323 LineArt: Individual locks for each tile. 2022-04-20 11:06:09 +08:00
dbfaf57549 LineArt: Individual locks for each tile. 2022-04-20 11:02:08 +08:00
5a898d915b Revert "LineArt: Index calculation based adjacent lookup WIP"
This reverts commit 7ef1f7648f.
2022-04-20 10:53:35 +08:00
7ef1f7648f LineArt: Index calculation based adjacent lookup WIP 2022-04-20 10:53:21 +08:00
98a11a4599 Revert "LineArt: CAS-inspired tile tree (WIP)"
This reverts commit b4e38ab9d0.
2022-04-19 15:48:25 +08:00
b4e38ab9d0 LineArt: CAS-inspired tile tree (WIP) 2022-04-15 22:10:11 +08:00
d3e5d48387 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-04-14 21:18:24 +08:00
40efc9fb58 LineArt: Light contour reprojection is working. 2022-04-12 16:27:20 +08:00
a7ae8379f2 LineArt: Enclosed light/shadow shape support 2022-04-11 23:09:45 +08:00
75e17be7e7 LineArt: UI and correct logic for shadow region chaining 2022-04-11 15:08:21 +08:00
4c291b1191 LineArt: Lit/shade filtering logic corrected.
Intersection lines won't work at the moment.
2022-04-08 22:08:31 +08:00
c83a9d1390 LineArt: Remove e->v1(2)_obindex.
This vairable is no longer needed, was left as a hack for some
very rare situations in clipping and now those are replaced with
v->index (object) instead which has the same effect.

This part of the memory can then be used for other flags
reserved for shadow information.
2022-04-08 13:41:56 +08:00
8fbfd1f7d3 LineArt: Remove e->v1(2)_obindex.
This vairable is no longer needed, was left as a hack for some
very rare situations in clipping and now those are replaced with
v->index (object) instead which has the same effect.

This part of the memory can then be used for other flags
reserved for shadow information.
2022-04-08 13:41:11 +08:00
08f5361d74 LineArt: WIP shadow matching. 2022-04-08 13:33:48 +08:00
27c8f7eeb3 LineArt: Separate cast shadow and light contour in shadow edge loading. 2022-04-07 21:00:06 +08:00
80b5f27d23 LineArt: Adapt new object loading changes. 2022-04-07 20:24:48 +08:00
f7081aac31 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-04-07 19:33:52 +08:00
e03d78417a LineArt: Face mark filtering for new object loading code. 2022-04-07 09:31:04 +08:00
4cc585e462 LineArt: Working fix for new object loading 2022-04-05 22:59:13 +08:00
af1c35eeee Lineart: Fix problems in edge array. 2022-04-05 22:22:49 +08:00
9b3407c1bc Merge branch 'temp-lineart-contained' into lineart-shadow 2022-04-05 22:20:16 +08:00
d1dff82990 LineArt: Use array instead of list for final edges. 2022-04-05 21:40:08 +08:00
e92344337a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-04-05 19:42:39 +08:00
b96a814f90 LineArt: Crease in new object loading working correctly. 2022-04-03 18:03:36 +08:00
50b7609478 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-04-03 16:49:41 +08:00
bdb6d69419 LineArt: Crease by sharp 2022-04-03 16:46:10 +08:00
95fe75cace Revert " LineArt: Thread optimized memory pool"
This reverts commit f14ad1eabf.
2022-04-03 16:21:13 +08:00
f14ad1eabf LineArt: Thread optimized memory pool 2022-03-31 17:15:10 +08:00
b816ac5b59 LineArt: Crease support for new loading 2022-03-31 17:15:10 +08:00
6ab328ec3a LineArt: Set default tile count to 10x10
This increases performance by reducing conflicts.
2022-03-31 14:13:52 +08:00
06a6b3d86a Merge remote-tracking branch 'origin/master' into lineart-shadow 2022-03-31 14:12:22 +08:00
af680ff312 LineArt: Object loading wip 2022-03-31 14:10:11 +08:00
4f58e9a4c9 Depsgraph: minor optimization in order of checks
Checking BKE_image_user_id_has_animation loops over ID users
which never needs to run for material & world data-blocks.
2022-03-31 14:10:11 +08:00
6601054a17 Cleanup: spelling, trailing space for comment-blocks 2022-03-31 14:10:10 +08:00
63937e6c47 Cleanup: Remove unnecessary namespace specification 2022-03-31 14:10:10 +08:00
a28c87cc95 Cleanup: Avoid storing pointers for attribute search callback
It's better to use some local/stable identifiier to avoid relying on
the data not being freed in between creating the search menu and
the exec function. This is similar to c473b2ce8b.
2022-03-31 14:10:10 +08:00
Gilberto Rodrigues
f5999121ba UI: Fix outliner and buttons icons alignment
029cf23d71 changed some icons alignment, but after 9be49a1069
the icons don't align anymore. This commit reverts 029cf23d71 and
also makes a couple of other outliner icons left aligned, instead of
right aligned, for consistency and general alignment.

Differential Revision: https://developer.blender.org/D14501
2022-03-31 14:10:10 +08:00
ad72b57020 Cleanup: Curves draw cache renaming, use references
Also change some remaining cases of "hair object" to "curves object".
2022-03-31 14:10:10 +08:00
d9cef1d279 Nodes: Cut hidden links when creating node groups
Add a check to the creation of node groups to remove hidden links
that are connected to the outside of the node group. This avoids
creating sockets in the group's interface that aren't (visibly)
connected to anything within the node group.

Reviewed By: Jacques Lucke, Hans Goudey

Differential Revision: https://developer.blender.org/D14249
2022-03-31 14:10:10 +08:00
b5c27eb9f7 UI: Improve node editor dot background
This commit makes the dot grid used as background in the node editor
more visually stable when zooming in and out.

The dot grid now uses a continuously subdividing pattern, where
each level of subdivision divides the previous five times, similar to
the line grid in the 3D viewport.

The maximum for the "Grid Levels" theme setting is changed to 3, since
any further subdivisions are too small to be visible.
The "Grid Levels" value for the default themes "Blender Dark" and
"Blender Light" is therefore changed to 3, as well.

Reviewed By: Hans Goudey, Pablo Vazquez

Differential Revision: http://developer.blender.org/D13302
2022-03-31 14:10:10 +08:00
Jason Fielder
d68c8a8e45 Metal: Adding alternative support for GPU_PRIM_TRI_FAN/LINE_LOOP For Metal backend.
- Metal uniform array compatibility in DRW module.
- Guard OpenGL-specific workarounds and flushes behind GPU_type_matches_ex API guard. Add further render boundaries for render paths called outside of the main loop.

Authored by Apple: Michael Parkin-White

Ref: T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14438
2022-03-31 14:10:10 +08:00
19869ad66c Fix T85689: Assume Win32 Volumes are Valid
Skip validation when inserting items into the Win32 "Volumes" list.
This fixes some long hangs when launching Blender with disconnected
network shares.

See D14506 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-31 14:10:10 +08:00
Jason Fielder
0cc23472b8 Metal: GLSL Shader compatibility 5
MSL does not have an implicit global scope, this is emulated via macro's adding an indirection for uniforms, attributes, shader stage inputs and outputs such as:

#define roughness shaderinst->roughness.

Variables in GLSL which exist within uniform blocks can be directly referenced via the global scope, unlike standard C++. This means that variable name pollution occurs if subsequent local variables in the code use the same name, resulting in compilation errors.

A number of these conflicting names have been renamed to ensure unique naming and no further scope pollution.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14452
2022-03-31 14:10:10 +08:00
Jason Fielder
01373ee1ef Metal: GLSL Compatibility - explicit mat4_to_mat3 conversion
Explicit constructor for mat3 from a mat4 is not valid and cannot be overloaded.

Adding explicit texture resource type flags for depth textures. This is an explicit requirement for Metal Shading language. This is a temporary compatibility, as this path is already supported in GPU_SHADER_CREATE_INFO under ImageType::DEPTH_2D, though required in shader source for MSL shaders which do not have create info.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14418
2022-03-31 14:10:10 +08:00
7f71aeecf1 Curves: Port resample node to the new data-block
This commit re-implements the resample curve node to use the new curves
type instead of CurveEval. The largest changes come from the need to
keep track of offsets into the point attribute arrays, and the fact
that the attributes for all curves are stored in a flat array.

Another difference is that a bit more of the logic is handled by
building of the field network inputs. The idea is to let the field
evaluator handle potential optimizations while making the rest of the
code simpler.

When resampling 1 million small poly curves,the node is about 6
times faster compared to 3.1 on my hardware (500ms to 80ms).

This also adds support for Catmull Rom curve inputs.

Differential Revision: https://developer.blender.org/D14435
2022-03-31 14:10:10 +08:00
4224d63e4f Fix T96344: edit mode GPU subdivision crashes with X-ray mode and modifiers
The crash happens because the origindex layers created as part of
the modifier stack evaluation are not set in the `MeshRenderData` when
they should have been.

This is because when selecting in X-ray mode, a subdivision wrapper
is created to ensure that selection happens with a subdivided
geometry, and this replaces the `MDATA` wrapper which is also used to
setup the `MeshRenderData`.

As we do not seemingly have an `MDATA` wrapper, the draw code decides
that we can extract draw buffers directly from the BMesh, instead of
the mapped Mesh with origin indices layers.

To fix this, we should also consider to use mapped extraction if a
subdivision wrapper exists on the mesh.

Differential Revision: https://developer.blender.org/D14485
2022-03-31 14:10:10 +08:00
432132c2ff Overlay: Port Armature shader to ShaderCreateInfo
Should have no regression.
2022-03-31 14:10:10 +08:00
609b57a8da GL: Fix Invalid enum error on Apple Silicon
Guard shader storage related gets and bypass a buggy enum.

Fix T95592 OpenGL Invalid Enum
2022-03-31 14:10:10 +08:00
2c937d1c72 Overlay: Port Edit Mode shaders to ShaderCreateInfo
This should have no regression.
2022-03-31 14:10:10 +08:00
2de699c140 DRW: Port draw_common.c to use shared definition with GLSL
# Conflicts:
#	source/blender/draw/intern/draw_common_shader_shared.h
#	source/blender/draw/intern/shaders/draw_view_info.hh
2022-03-31 14:10:10 +08:00
c304e5fabd GPUShaderCreateInfo: Add DepthWrite option
This option lets specify explicitely how the fragment shader will change
the fragment's depth.
2022-03-31 14:10:10 +08:00
f935fb7382 GPU: ShaderBuilder: Remove do_static_compilation_ inheritance
This is because the inheritance is not done before checking if the shader
should be statically compiled. Also some inheritance scheme
might have intermediate permutation that are not compilable.
2022-03-31 14:10:10 +08:00
Pratik Borhade
aff0bfe664 Add soft limit for Bevel segments in modifier.
The recent change to allow a max segments of 1000 in the modifier
causes a lag when dragging or wheeling in the segments box.
This change makes the soft limit back to 100, but you can still
type numbers up to 1000 in the box.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14477
2022-03-31 14:10:10 +08:00
1b3c7adda2 GPU: ShaderBuilder: Fix compilation on non-Mac platform
Regression introduced in rB664eb1936946a077498a17c22576763c664e3186
2022-03-31 14:10:10 +08:00
ab4c704ffa Compositor: Fix Missing output UI for Normal node
There were multiple issues at hand here:

- The default value has been changed to `{0, 0, 1}` see: rB25f1783673de636a6f0ca4457df8c05bc685981a
- The output needs the subtype set `PROP_DIRECTION`
- The noder properties were missing in `node_composit_set_butfunc`

Fixes T96860
2022-03-31 14:10:10 +08:00
be172b7e4d Curves: support converting curves to legacy hair system
This adds a new operator that converts all selected curves objects
into hair particle systems on their respective surface objects. Existing
particle systems with the correct name are updated, otherwise a new
particle system is added.

The purpose of the operator is the make the new curve sculpting tools
useful even before all functionality is ported over from the old hair system.

The operator can be found in the `Object > Convert` menu in object mode,
when a curves object is active.

Differential Revision: https://developer.blender.org/D14441
2022-03-31 14:10:10 +08:00
339251d9ca Cleanup: Left over from review of apply transform
I miss the review notes about this for the
8621fdb10d commit.
2022-03-31 14:10:10 +08:00
a17105e8a6 GPencil: Fix double-free issue in update cache
When a `GPencilUpdateCacheNode` is created, it always allocates the
`children` pointer. This should not be freed until the whole cache is
deleted.
The `cache_node_update` would free the `children` pointer in a specific
case, causing a double-free later when the cache was removed.
2022-03-31 14:10:10 +08:00
4060f34153 Apply Object Transform: Multi-user data support
The current behaviour is to prevent multi-user data from having its
transformation applied.

However in some particular cases it is possible to apply them:
* If all the users of the multi-user data are part of the selection.
* If not all the users are in the selection but the selection is made
single-user.

The active object is used as reference to set the transformation of the
other selected objects.

Note: For simplicity sake, this new behaviour is only available if all
the selection is using the same data.

Differential Revision: https://developer.blender.org/D14377
2022-03-31 14:10:10 +08:00
58315a587e Modifiers: Support applying modifiers for multi-user data
The current behaviour is to prevent multi-user data from having its
modifier applied.

Instead, with this patch, we now warn the user that if they want to
proceed the object will be made single-user.

Note that this only makes the object data single-user. Not the material
or actions.

As a future step we can apply the same behaviour for the Grease Pencil modifiers

Differential Revision: https://developer.blender.org/D14381
2022-03-31 14:10:10 +08:00
8de4a1ed40 Iterator to loop over objects based on a flag 2022-03-31 14:10:10 +08:00
ecaedf9636 Cleanup: clang-format 2022-03-31 14:10:10 +08:00
8efedeca65 Cleanup: use "num" as a suffix in: source/blender/blenlib
Also replace "num" with:
- "number" when it's not used to denote the number of items.
- "digits" when digits in a string are being manipulated.
2022-03-31 14:10:10 +08:00
4e6f9549f1 Cleanup: use "num" as a suffix in: source/blender/gpencil_modifiers 2022-03-31 14:10:10 +08:00
04404d7cc0 Fix: Failing curves test after recent commit
87e9451d66 missed updating the behavior for Catmull Rom curves.
2022-03-31 14:10:10 +08:00
d37ac31797 Cleanup: use utility function to initialize SelectPick_Params 2022-03-31 14:10:09 +08:00
533573653b Fix leak transforming in the node-editor without a selection 2022-03-31 14:10:09 +08:00
5abb396344 Cleanup: remove redundant lattice de-selection 2022-03-31 14:10:09 +08:00
Aleksi Juvani
b2093f5c35 Cleanup: Move UV edit parameterize code to geometry module
This will allow reusing it elsewhere, such as in a geometry node.

Differential Revision: https://developer.blender.org/D14453
2022-03-31 14:10:09 +08:00
40e48b0542 Geometry Nodes: Remove soft min from extrude node scale
Extusion with a negative offset is possible and expected.
2022-03-31 14:10:09 +08:00
741dddf6ea Keymap: "Mouse Select & Move" now uses click to de-select others
While it's useful for click-drag to leave the selection as-is
(when clicking on items that are already selected), it's useful
for a single click to de-select all other elements.

This also removes the need for the initial selection to set the object
as active since this is possible by clicking on it.
2022-03-31 14:10:09 +08:00
ec7ee3b0d9 Curves: Port curves total length node to the new data-block
Ref T95443
2022-03-31 14:10:09 +08:00
98625a3ae7 Curves: Port length node to the new data-block
Ref T95443
2022-03-31 14:10:09 +08:00
1591af79b8 Curves: Port parameter node to the new data-block
Using the evaluated lengths cache from 72d25fa41d, re-implement
the curve parameter node with the new data structure. Conceptually
it works the same way, but the code is restructured and cleaned up
a bit as well. This also adds support for Catmull Rom curves.

Differential Revision: https://developer.blender.org/D14461
2022-03-31 14:10:09 +08:00
ba5e80606b Fix: Remove special case from curve segment size function
The idea that curves with two points cannot be cyclic came from some
existing code, but there's not fundamental reason for it, so remove the
check in this function. The case can be handled elsewhere if necessary.
2022-03-31 14:10:09 +08:00
21e92ea6e7 Curves: Add length cache, length paramerterize utility
This commit adds calculation of lengths along the curve for each
evaluated point. This is used for sampling, resampling, the "curve
parameter" node, and potentially more places in the future.

This commit also includes a utility for calculation of uniform samples
in blenlib. It can find evenlyspaced samples along a sequence of points
and use linear interpolation to move data from those points to the
samples. Making the utility more general aligns better with the more
functional approach of the new curves code and makes the behavior
available elsewhere.

A "color math" header is added to allow very basic interpolation
between two colors in the `blender::math` namespace.

Differential Revision: https://developer.blender.org/D14382
2022-03-31 14:10:09 +08:00
72f747d845 Cleanup: quiet warning for description ending with a full stop 2022-03-31 14:10:09 +08:00
638678098e Cleanup: spelling in comments 2022-03-31 14:10:09 +08:00
e94abfd46d Cleanup: use equality instead of contains for single-item sets 2022-03-31 14:10:09 +08:00
ee1dc73bd4 Cleanup: unbalanced doxy sections 2022-03-31 14:10:09 +08:00
022a3111f0 UI: Fix cosmetic papercuts of the reroute node
Fix small cosmetic issues with the reroute node:
1. Remove special case that allowed curved links to attach vertically.
2. Center align the reroute node's label.

The vertically attached node links could lead to kinks in the otherwise
smooth curves. This would break the visual flow and make the link
potentially intersect the node's label.

The center alignment of the label gives more consistent results for
different label lengths and also reduces the chance of the label
interfering with the node links.

Reviewed By: Hans Goudey, Pablo Vazquez

Differential Revision: D14457
2022-03-31 14:10:09 +08:00
35b025d4f0 Geometry Nodes: Don't create node tree when adding nodes modifier
Don't always create a new geometry nodes node tree when adding a
geometry nodes modifier.

This avoids files getting cluttered with empty and unused geometry node
trees that are created every time a nodes modifier is added to an
object - even if only to apply an already existing.
This is also more consistent with other modifiers that also don't
automatically create new data blocks.

The new modifier still automatically gets populated with a new node
tree when adding it via the "New" button in the header of the
geometry nodes editor.

Reviewed By: Hans Goudey, Dalai Felinto, Pablo Vazquez

Differential Revision: D14458
2022-03-31 14:10:09 +08:00
4dbf7d9692 GPencil: Remove UI prefix Use in Dot-Dash modifier
The "Use" word must not be used in UI.
2022-03-31 14:10:09 +08:00
6bd223741d Fix: incorrect assert in new code 2022-03-31 14:10:09 +08:00
f6b09d57e0 GPencil: Fix Windows compiler errors
For non trivial data must be used `MEM_new`
2022-03-31 14:10:09 +08:00
309fdd492e LibOverride: Massive edits to 'editable' IDs checks in editors code.
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes
previous check (simple `ID_IS_LINKED()` macro) for many editing cases.

This allows to also take into account 'system override' (aka
non-editable override) case.

Ref: {T95707}.
2022-03-31 14:10:09 +08:00
23100428e9 LibOverride: Rename 'delete hierarchy' to 'clear hierarchy', add 'clear single' operations.
'Delete' was a confusing name, even though it would delete the overrides
it would replace them by linked data.

Adding the 'single' version of that operation made it even more
confusing, since often it has to keep the override ID for sakes of
hierarchy, and just reset it and turn it back into a non-editable system
override.

Ref: {T95707}.
2022-03-31 14:10:09 +08:00
da192643dc LibOverride: Implement default 'user override' behavior.
Implement default behavior to decide which overrides remain 'system'
ones, and which become 'user editable' ones, when creating hierarchy
override from 3DView or the Outliner.

3DView:
If from an Empty-instanced collection, only Armature objects in
that collection are user overrides.
If from a set of selected objects, all overrides created from selected
objects are user overrides.

Outliner:
All override IDs created from selected elements in the Outliner are user
overrides.
There is one special case: When a collection is selected, and is
'closed' in the outliner, all its inner armature objects are also user
overrides.

Ref: {T95707}.
2022-03-31 14:10:09 +08:00
5bfa48f67d LibOverride: Add initial handling of system overrides in creation/duplication/resync code, and some basic do_version.
When creating with hierarchies, core code only generates system
overrides, responsibility to define 'user overrides' is then for the
higher-level calling code (Editor/Operator-level).

do_version code uses fairly basic euristics, should be good enough here
though in most cases. and can always be refined later if needed.

Ref: {T95707}.
2022-03-31 14:10:09 +08:00
e2dd7a9e62 LibOverride: make some override properties 'overridable'.
The whole liboverride data is still ignored by override diffing etc.,
but some of their flags should be editable (from script and/or advanced
technical/debug UI). So using a weird combination of flags to achieve
this.

Ref: {T95707}.
2022-03-31 14:10:09 +08:00
cd4010dd66 LibOverride: Add a new 'virtual' non-editable override icon and use it in Outliner.
Ref: {T95707}.
2022-03-31 14:10:08 +08:00
8dd9845344 LibOverride: Add initial System Override flag.
This merely adds the flag, exposes it in RMA, and uses it in some of the
most common 'is editable' checks (RNA, `BASE_EDITABLE` macro...).

Next step: do_version and defining systemoverrides at creation.

Ref: {T95707}.
2022-03-31 14:10:08 +08:00
38d19ec93c GPencil: Small UI tweaks to Build modifier
Changes in some names.
2022-03-31 14:10:08 +08:00
9531edae64 Cover DNA_gpencil_types.h with C++ structure methods
Ref T96847

Maniphest Tasks: T96847

Differential Revision: https://developer.blender.org/D14487
2022-03-31 14:10:08 +08:00
517871a54b Cleanup: Remove legacy dupli system from point cloud object
The "dupli" system now has a faster, more powerful, and more flexible
alternative with geometry nodes. Since the point cloud objects haven't
been exposed in the non-experimental UI yet, we can remove the dupli
implementation and the panel for the object type.

Differential Revision: https://developer.blender.org/D14482
2022-03-31 14:10:08 +08:00
7d6eb40913 GPencil: Fading for build modifier.
Adds fading support for build modifier so it's not a hard cut off

Reviewed By: Antonio Vazquez (antoniov), Matias Mendiola (mendio)

Differential Revision: https://developer.blender.org/D14309
2022-03-31 14:10:08 +08:00
Henrik Dick
efb5a77e1e GPencil: Fix sculpt mask ignoring one point strokes
The check for the selected status was missing in the case
where the stroke one has one point.

Differential Revision: http://developer.blender.org/D14490
2022-03-31 14:10:08 +08:00
37f65a2033 Assets: Support automatic collection previews
Adds supports for collection previews that are rendered automatically when
collections are marked as assets. (Or when preview rendering is triggered
differently, e.g. through the //Refresh Data-Block Previews// operator).

Idea in this patch is to create a collection instance empty outside of main for
the collection, and then reuse the object rendering code to render the preview.
This keeps things very simple and works just fine.

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

Reviewed by: Bastien Montagne
2022-03-31 14:10:08 +08:00
Yuki Hashimoto
3ed997dd2b Fix T63795: Display custom properties with brackets in info
When custom properties are changed, they are displayed with brackets in
info.

Ref D14380
2022-03-31 14:10:08 +08:00
5a470551ff Fix T96844: Crash when switching workspaces and outliner modes
Error exposed by ba49345705. Code just assumed that the tree-element
pointed to a real ID, but this is often not the case, and the ID pointer
contains completely different data. E.g. before ba49345705, it would
be a pointer to one of the `Main` listbases, so this code would have
undefined behavior. Now the pointer is null for elements in the "Current
File" element, causing a null-pointer dereference rather than undefined
behavior (that just happened to virtually always result in the intended
code path).
2022-03-31 14:10:08 +08:00
d8f8d72861 Curves: improve Snake Hook brush
This implements the spherical brush and different falloff
modes for the Snake Hook brush.

Differential Revision: https://developer.blender.org/D14408
2022-03-31 14:10:08 +08:00
d059d68d45 Icons: Programmatically create indirect library icon, remove from SVG
The indirect library data icon was just a grayed out version of the
regular one. This graying out is now done in code, so the icon can be
removed from the SVG. Note that the icon is still defined as
`ICON_LIBRARY_DATA_INDIRECT` (or `LIBRARY_DATA_INDIRECT` in BPY).
2022-03-31 14:10:08 +08:00
96cc07e53c Fix T96835: Grease pencil tweak tool selects but doesn't drag
Use the pass-through matching the view3d.select operator.
2022-03-31 14:10:08 +08:00
8e84ab4a17 Fix T96356: artefacts with GPU subdivision and vertex paint mask
The lines paint mask IBO extraction was not implemented for GPU subdivision.
For it to work, we also now need to preserve the subdivision loop to
subdivision edge map, which until now was overwritten to store coarse edges
(the map to coarse edges is still preserved).

Also the paint flag stored in the 4th dimension of the loop normal buffer
was not properly set for flat shaded faces, leading to other kind of
artefacts and render issues.
2022-03-31 14:10:08 +08:00
45f4061709 Cleanup: Remove commented lines of previous commit 2022-03-31 14:10:08 +08:00
27ef19f2cf Fix T96799: GPencil weight_get API cannot retrieve weights
The problem was when the stroke had less weights that the total number of vertex groups.

The API checked the total number of groups, but this is not required because `BKE_defvert_find_index` returns NULL is the vertex group index does not exist.
2022-03-31 14:10:08 +08:00
5e5273b2c8 Fix (unreported) LibOverride: re-creation of overrides in consecutive partial overrides of a same hierarchy.
If creating partial hierarchy overrides (from the outliner e.g.), that
need to create extra overrides, those could be re-created everytime,
leading to very bad situation where there would be several overrides of
the same reference ID in the same override hierarchy.

This fix makes it so that existing overrides in a given hierarchy will
always be re-used in case other overrides are added to the hierarchy.
2022-03-31 14:10:08 +08:00
d8569a9e76 Cleanup: Use higher level semantic for zeroing DNA objects in C++
Replaces old-style memzero-style of call with zero-initializer.
Allows to shorten typical initialization code to a single line:

  Object foo = blender:🧬:shallow_zero_initialize<Object>()

This will allow to more easily convert designated initializer
which is often used to fill object with zeroes to the explicit
function calls:

  MyDNAStruct foo = {};

will be translated to

  MyDNAStruct foo = blender:🧬:shallow_zero_initialize<MyDNAStruct>();

Differential Revision: https://developer.blender.org/D14486
2022-03-31 14:10:08 +08:00
4619d03f43 BLI: optimize Map/Set/VectorSet.clear methods
Previously, those methods would destruct and reconstruct
the data structure. While that was more simple in initial
implementation, it has some downsides which are not resolved:
* Already allocated memory is lost. So new memory would have
  to be allocated when the data structure is refilled.
* The clearing process itself was slower because it did unnecessary
  work.
2022-03-31 14:10:08 +08:00
5f2cb63660 Cleanup: Remove redundant DNA C++ helper function
Use shallow_copy, no need in copy_memory.

The latter appeared as some last minute solution for a compilation
warning on Friday.
2022-03-31 14:10:08 +08:00
e3e3353c68 Functions: move loops into function builders
This simplifies debugging, and can help improve performance
by making it easier for the compiler.

More optimization might still be possible by using `__restrict` in
a few places.
2022-03-31 14:10:08 +08:00
41f0aafca0 BLI: add utility to convert IndexMask to best mask type 2022-03-31 14:10:08 +08:00
92032519d1 Cleanup: use value initialization instead of copying default value
Value-initialization has the potential to be more efficient.
Also, the code becomes simpler.
2022-03-31 14:10:08 +08:00
e90dba5bfa BLI: support value initialization in CPPType
Value initialization differs from default-construction in that it
also zero-initializes trivial types.
2022-03-31 14:10:08 +08:00
dc7b293105 Fix T96701: RMB select fails to show gizmo on mouse button release
Regression in [0] which removed a special check when tweak events ended.
Add a similar check for drag events that runs drag is disabled in the
main event handling loop.

[0]: 4986f71848
2022-03-31 14:10:08 +08:00
0603b0804c Fix T96582: Wipe effect not working
Caused by oversight in 0e38002dd5. Constant x/y value was used to
calculate transition instead of pixel x/y coords.
2022-03-31 14:10:08 +08:00
d77f6bdb55 Fix T96699: Splitting strip does not copy animation
Since e49bf4019b, animation is handled explicitly. Split operator
wasn't updated.

Re-use backup-duplicate-restore animation functions, that other
operators use for splitting.
2022-03-31 14:10:08 +08:00
8638354f81 Fix T96347: Pose gizmo shown at wrong location with multiple objects
Regression in [0] error iterating over pose bones which only used the
active-object, also follow the same logic as edit-mode for using the
local-matrix.

[0]: d052169e7e
2022-03-31 14:10:08 +08:00
57a1ab192c Fix T96691: Heap corruption in file_browse_exec
Regression in [0], also use pad buffer by 1 instead of 2 which is no
longer needed as the trailing slash is no longer added
after allocating the string.

0682af0d63
2022-03-31 14:10:08 +08:00
f0e31511b7 Cleanup: Move two grease pencil files to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This changes builds on all
platforms on the buildbot.
2022-03-31 14:10:08 +08:00
0cc0f30071 Cleanup: Move scene.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This change builds and passes
tests on all platforms on the buildbot.
2022-03-31 14:10:08 +08:00
860edbe185 Cleanup: Use const mesh arguments
Also correct an enum value from review of D14475.
2022-03-31 14:10:08 +08:00
083d5369ca Cleanup: Move transform_snap_object.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`.

Differential Revision: https://developer.blender.org/D14475
2022-03-31 14:10:07 +08:00
1e160a29fe Fix T96728: 'Automatic Constraint' using the wrong orientation
If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means.

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
2022-03-31 14:10:07 +08:00
8c288938fa Transform: avoid excessive recalculation with 'TREDRAW_SOFT'
Contrary to the initial intention (in rB9916e0193c36), `TREDRAW_SOFT`
flag, when isolated, is not cleared in `transformApply` and therefore is
used in the `drawTransformApply` callback which basically recalculates
the `transformation` which finally clears the flag.

So remove the `drawTransformApply` callback so `transformApply` is not
called when unnecessary.

Differential Revision: https://developer.blender.org/D14430
2022-03-31 14:10:07 +08:00
bbfc968ffa Cleanup/Refactor: remove unused 'SNAP_ONLY_ACTIVE' enum parameter
`SNAP_ONLY_ACTIVE` was implemented in order to be used in the Knife tool,
but the project did not go ahead.
2022-03-31 14:10:07 +08:00
cf4b543516 Transform: Improve 'absolute grid snap' support detection
The solution supposedly listed all cases that `absolute grid snapping`
was supported. But it ignored some occasions like: Editing Surface
objects, Texture Space.

List now only the cases where this feature should not be supported.
2022-03-31 14:10:07 +08:00
6015ef401a Cleanup: transform, use early returns
This makes the flow clearer and avoids many `else` conditions.
2022-03-31 14:10:07 +08:00
0b68b29e10 Outliner: Don't show indirectly linked Library Overrides properties
The Library Overrides display mode is meant to show overridden
properties from the current file only, not library overrides in
data-blocks that just were linked in. The upcoming Hierarchies view mode
for Library Overrides will also display linked in data-blocks that have
overrides in the source file (but not the individual overridden
properties), see T95802.
2022-03-31 14:10:07 +08:00
0acc074a57 Fix T96812: Regression: Snapping is broken with proportional editing
This was a mistake in the conditional structure introduced in 4b35d6950d

This commit also adds a new type of snap exclusion: `SNAP_NOT_EDITED`.

Thanks to @Ethan1080 for pointing out the error.
2022-03-31 14:10:07 +08:00
46aa991ea4 Fix T96828: GPencil primitives handlers not working
Following the logic is not necessary to check the mouse button because the status has changed before.
2022-03-31 14:10:07 +08:00
6579beabdf Cleanup: Use bool literals in return statements of text editor poll functions. 2022-03-31 14:10:07 +08:00
64d417a41a Fix various UI messages issues. 2022-03-31 14:10:07 +08:00
ee8de09187 Fix (unreported) crash in some mesh-from-object code.
Crashed e.g. FBX exporter.

Mistake in rB0c33e84020deca.
2022-03-31 14:10:07 +08:00
86d8da522f Fix T96670: bake from multires not reflected in the Image Editor. 2022-03-31 14:10:07 +08:00
4b79dba416 Cleanup: return success from python_script_error_jump
Relying on checks for the assignment of return arguments isn't so
clear especially when there are multiple return arguments.
2022-03-31 14:10:07 +08:00
4be14517d7 Python: select the start-end range of syntax errors
Python 3.10's syntax errors can specify a range.
Use this for text editor error selection.
2022-03-31 14:10:07 +08:00
1ac6516da4 Cleanup: variable/argument naming for Python exception access
Names filename/filepath/fn were used interchangeably.
2022-03-31 14:10:07 +08:00
2519da2a41 Fix text editor failure to move the cursor for syntax errors
This broke between 3.0 and 3.1, upgrading to Python 3.10 seems the
likely cause as this code didn't change.
2022-03-31 14:10:07 +08:00
bc1e5cbbda Cleanup: early exit when there is no exception
Reduces noise in D9752, no functional change as PyErr_NormalizeException
doesn't do anything when there is no exception set.
2022-03-31 14:10:07 +08:00
675e80cdae Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
2022-03-31 14:10:07 +08:00
7b666758bb Cleanup: use "num" as a suffix in: source/blender/nodes 2022-03-31 14:10:07 +08:00
428033da3a Cleanup: use "num" as a suffix in: source/blender/render
See T85728
2022-03-31 14:10:07 +08:00
1710715b17 Cleanup: use "num" as a suffix in: source/blender/python
See T85728
2022-03-31 14:10:07 +08:00
f86f433967 Cleanup: Reduce duplication to prepare for UDIM packing
In preparation for supporting packing of UDIM tiled textures, this patch
refactors a small portion of image.cc. The refactor should lead to less
duplicate code now and when Tiled images are added in the near future.

This patch is based on the prior work done for D6492 where it was
requested this part be split and can be summarized as follows:
 - `load_sequence_single` is removed and merged with `load_image_single`
 - `image_load_sequence_file` is removed and merged with `image_load_image_file`

Reviewed By: lukasstockner97

Differential Revision: https://developer.blender.org/D14327
2022-03-31 14:10:07 +08:00
1ed3266d71 OBJ: use fmt library instead of sprintf for faster formatting
On Windows/MSVC this gives a minor (~20%) speedup presumably due to a faster float/int formatter. On macOS (Xcode13), this gives a massive speedup, since snprintf that is in system libraries ends up spending almost all the time inside some locale-related mutex lock.

The actual exporter code becomes quite a bit smaller too, since it does not have to do any juggling to support std::string arguments, and the buffer handling code is smaller as well.

Windows (VS2022 release build, Ryzen 5950X 32 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 4.57s -> 3.86s
- Monkey subdivided level 6 (330MB obj): 1.10s -> 0.99s

macOS (Xcode 13 release build, Apple M1Max) timings:
- Blender 3.0 splash scene (2.4GB obj): 21.03s -> 5.52s
- Monkey subdivided level 6 (330MB obj): 3.28s -> 1.20s

Linux (ThreadRipper 3960X 48 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 10.10s -> 4.40s
- Monkey subdivided level 6 (330MB obj): 2.16s -> 1.37s

The produced obj/mtl files are identical to before.

Reviewed By: Howard Trickey, Dalai Felinto

Differential Revision: https://developer.blender.org/D13998
2022-03-31 14:10:07 +08:00
f702d29803 Cleanup: Remove frameserver cmake definition
Left over from rBaab5ac25f2c2e6fbc50f9fb352e71ef0ae0ba2f1
2022-03-31 14:10:07 +08:00
Lictex Steaven
a783375846 GPencil: Add an xray toggle for each annotation layer
so a layer can be occluded by the scene instead of always showing in front

---

{F12827163}

Reviewed By: fclem, antoniov

Differential Revision: https://developer.blender.org/D13931
2022-03-31 14:10:07 +08:00
d1a888cb99 Increase bevel segment limit in modifier from 100 to 1000.
A user asked for this increase. The performance lags when reaching
the upper limit of this number of segments, but if you need that
many segments, I guess you are willing to wait.
2022-03-31 14:10:06 +08:00
5fe4560120 Cleanup: Remove double #ifdef WITH_TBB check 2022-03-31 14:10:06 +08:00
b34d568220 Fix T95901: Crash in Fill curve (set to N-gon)
The code that eats away faces until you find input faces in
the Constrained Delaunay Triangulation goes too far and crashes
when there are no input faces. In the test case there were input
faces but they only had two vertices, so were all ignored.
2022-03-31 14:10:06 +08:00
e2f3320c17 LineArt: FIx intersection filtering when no flag is set. 2022-03-31 14:05:41 +08:00
76574b3300 LineArt: Set default tile count to 10x10
This increases performance by reducing conflicts.
2022-03-29 14:03:51 +08:00
da5c36b1fb Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-03-26 21:32:03 +08:00
8acff9e7c4 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-03-14 22:56:33 +08:00
10a3654cac Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-03-13 14:41:30 +08:00
6f83dfa627 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-02-25 14:11:13 +08:00
86e83108fd LineArt: Consistent shifting for persp and ortho cam.
Now always properly shifting camera for ortho and perspective.
2022-02-25 13:50:23 +08:00
4da9568bfc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-02-25 12:51:07 +08:00
94b4ab6a16 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-01-17 17:29:21 +08:00
bf6677fecb LineArt: Preserve details option for noise tolerant chaining.
Added such option to control whether to show zig-zags.
2022-01-17 17:26:55 +08:00
1111465d26 LineArt: Noise tolerant chaining.
Tolerant zig-zag lines by ignoring occlusion change for a short distance
2022-01-17 10:18:45 +08:00
c1b1719267 LineArt: Remove prop decoration line on collection selector 2022-01-17 07:42:56 +08:00
322049a258 LineArt: Remve automatic back face culling.
This behaviour is still very confusing when you have single sided faces.
2022-01-17 07:27:50 +08:00
517407108b LineArt: Invert collection option.
Allows conveniently selecting an inverse of a collection.
2022-01-16 23:27:21 +08:00
67ebdefcf3 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-01-16 21:17:18 +08:00
e02a890c99 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-01-16 21:17:03 +08:00
467b4f3d74 Merge branch 'temp-lineart-contained' into lineart-shadow 2022-01-15 15:38:14 +08:00
85ab169a78 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-01-15 15:36:17 +08:00
56a2a0d827 Fix T94878: LineArt crease threshold logic error.
A coding mistake allows default crease to override object crease, now fixed.
2022-01-15 15:35:01 +08:00
a16f832aaa Fix T94089: GPencil Drawing don't Update after paste in Dopesheet
When paste new frames, the datablock need to be tagged to update the drawings.
2022-01-15 15:35:01 +08:00
febe11d8cd Fix T94903: GPencil: Copying keys doesn't preserve Keyframe Type
When a new frame is created, ensure the keytype of source key is used.
2022-01-15 15:35:01 +08:00
831b4cac72 Cleanup: move attribute operators to c++ 2022-01-15 15:35:01 +08:00
26e2aff32e Fix T94867: viewport render not updating when editing color ramp
The changed node wasn't tagged correctly.
2022-01-15 15:35:01 +08:00
c54990b9ac Cleanup: Fix warning when compiling without Audaspace 2022-01-15 15:35:01 +08:00
b6a6ed52cb Fix T94837: curve tilt on a 2-point-curve is wrong
2-point-curves are treated separately from 3plus-point-curves (assume a
lot of the twisting reduction can be skipped, so there is a dedicated
function for single segment curves).

And while using the 3plus-point-curves function [`make_bevel_list_3D`]
would actually work in this case, the dedicated function
`make_bevel_list_segment_3D` would only consider the tilt of the second
point and would just copy over the quat to the first point as well. Dont
see a reason for this, now consider the first point's tilt as well.

Maniphest Tasks: T94837

Differential Revision: https://developer.blender.org/D13813
2022-01-15 15:35:01 +08:00
318a47de3d Cleanup: Reduce indentation in foreach_libblock_remap_callback. 2022-01-15 15:35:01 +08:00
590b216e4a Python API: add "children_recursive" property to Object & Collection
This is a convenience property, already available for bones.

Simplifies D13821 which in-lined this function.
2022-01-15 15:35:01 +08:00
19b76e3066 Cleanup: spelling in comments, C++ style comments for disabled code
Also ensure space at end of comment.
2022-01-15 15:35:01 +08:00
b6672ee8df Fix crash caused by exception in Python gizmo target get handler 2022-01-15 15:35:01 +08:00
12eaaea013 Cleanup: Clang tidy
- modernize-deprecated-headers
- modernize-use-using
- modernize-use-nullptr
- modernize-use-bool-literals
2022-01-15 15:35:01 +08:00
b33e5d8c5c CMake: add WITH_LINKER_MOLD option for GCC/Clang Unix platforms
Can give considerably faster linking, especially on system with many
cores.

The mold linker recently reached 1.0, see:
https://github.com/rui314/mold

The current stable release of GCC can't use this linker via
-fuse-ld=mold, so this patch uses the "-B" argument to add a binary
directory containing an alternate "ld" command that points to
"mold" (which is part of the default mold installation).

Some timing tests for linking full builds for AMD TR 3970X:

- BFD: 20.78 seconds.
- LLD: 12.16 seconds.
- GOLD: 7.21 seconds.
- MOLD: 2.53 seconds.

Ref D13807

Reviewed by: sergey, brecht
2022-01-15 15:35:01 +08:00
f8d531123d Fix: Incorrect logic in mesh validation for removing layers
The mask is only used if it's not zero. Adding the normal mask made
it not zero, but it didn't include anything else, so all custom data
layers except normals were removed. The fix is to only add normals
to the mask when it should be used.
2022-01-15 15:35:01 +08:00
d9c6ceb3b8 Refactor: Move normals out of MVert, lazy calculation
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.

The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.

The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).

**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code

In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).

Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.

**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
 - Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
   showing that accessing just `MVert` is now more efficient.
 - Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
   change that at least shows there is no regression.
 - Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
   but observable speedup.
 - Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
   shows that using normals in geometry nodes is faster.
 - Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
   shows that calculating normals is slightly faster now.
 - File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
   Normals are not saved in files, which can help with large meshes.

As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.

**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
 - The subdivision surface modifier is not responsible for calculating
   normals anymore. In master, the modifier creates different normals
   than the result of the `Mesh` normal calculation, so this is a bug
   fix.
 - There are small differences in the results of some modifiers that
   use normals because they are not converted to and from `short`
   anymore.

**Future improvements**
 - Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
   already retrieves normals if they are needed anyway.
 - Copy normals as part of a better CoW system for attributes.
 - Make more areas use lazy instead of eager normal calculation.
 - Remove `BKE_mesh_normals_tag_dirty` in more places since that is
   now the default state of a new mesh.
 - Possibly apply a similar change to derived face corner normals.

Differential Revision: https://developer.blender.org/D12770
2022-01-15 15:35:01 +08:00
140dbcf2a7 Fix/workaround MSVC compile error with messag-bus
Some of the message-bus macros are not safe to use in C++. This has come
up before, but no good solution was found. Now @LazyDodo, @HooglyBoogly
and I concluded this is the best duct tape "solution" for the moment.
The message-bus API should address this.
2022-01-15 15:35:01 +08:00
0fed56b551 Cleanup: Run make format 2022-01-15 15:35:01 +08:00
944d9c558b Fix compilation error caused by missing target relation
compositor depends on DNA now so that it can access offsets.
2022-01-15 15:35:01 +08:00
84c8cbe101 Geometry Nodes: Rename String to Curves socket
Today many users seem to think the output from
this node is a single curve with multiple splines.
This patch renames the geometry output socket
from "Curves" to "Curve Instances" to avoid confusion.

Differential Revision: https://developer.blender.org/D13693
2022-01-15 15:35:01 +08:00
78090b052a CMake: fix build issue with gcc+clang-tidy
Precompiled headers are in a compiler specific format,
when using clang-tidy it tries to read the GCC PCH file
and fails at that.

Disable PCH's for now when WITH_CLANG_TIDY is enabled since
a clean work-around doesn't seem readily available.

relevant LLVM/CMake bugs:

https://bugs.llvm.org/show_bug.cgi?id=41579
https://gitlab.kitware.com/cmake/cmake/-/issues/22081

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

Reviewed by: sergey, Blendify
2022-01-15 15:35:01 +08:00
abacf896c8 Fix compilation error caused by missing target relation
Space clip depends on DNA now so that it can access offsets.
2022-01-15 15:35:01 +08:00
a7981a4cfb Cleanup: Use nullptr in new Outliner C++ files 2022-01-15 15:35:01 +08:00
f4ed4fdb5c Outliner: Compile all Outliner files in C++
We want to refactor quite some of the Outliner code using C++, this is a
logical step to help the transition to a new architecture.

Includes plenty of fixes to make this compile without warnings, trying
not to change logic. The usual stuff (casts from `void *`, designated
initializers, compound literals, etc.).
2022-01-15 15:35:01 +08:00
4930d0f057 Cleanup: Make message-bus utility macros callable from C++
C++ doesn't support compound literals like used here (GCC does via an
extension).
2022-01-15 15:35:01 +08:00
2d35cce262 Fix T94874: Drivers using bone custom properties don't work on modifiers 2022-01-15 15:35:01 +08:00
9daff7c6ec Cleanup: fix building all geometry nodes in one translation unit
There were a couple of function name collisions which were caused
by sharing code with the mask modifier. I just removed the dependence
on the mask modifier now. The code that I duplicated for that purpose
is only in a legacy node, so it can be expected to be removed soonish.
2022-01-15 15:35:01 +08:00
10958e5109 Fix link errors after recent FFMPEG / link_directories changes 2022-01-15 15:35:01 +08:00
bf55355bd1 Tests: skip some compositor tests when WITH_LIBMV=OFF 2022-01-15 15:35:01 +08:00
95f3f63aef Fix T94737: Cycles wrong normal map normal with OSL
Ensure valid reflection was moved elsewhere, should not be done in the node
anymore.
2022-01-15 15:35:01 +08:00
bd151ff1cf Fix T94050, T94570, T94527: Cycles Bevel and AO nodes not working with Metal
Workaround what may be a compiler bug, solution found by Michael Jones.
2022-01-15 15:35:01 +08:00
41aa760316 Fix Cycles CPU + GPU render not using CPU after recent changes
In some places the task scheduler was not initialized in time.
2022-01-15 15:35:01 +08:00
0bf55a8534 Fix T94758: wrong denoising albedo with BSSRDF retro reflection 2022-01-15 15:35:01 +08:00
Brecht Van Lommel
8d929467a7 Build: remove usage of link_directories
We are now always using absolute paths for libraries, as recommended by the
CMake docs.

Followup to D9177.
2022-01-15 15:35:01 +08:00
Brecht Van Lommel
1a8cbf6c05 CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-15 15:35:01 +08:00
29c2534a77 Fix T92953: Tool Settings: Drag on Tweak fails with LMB select 2022-01-15 15:35:00 +08:00
4e8b43560c Cleanup: follow code-style for float suffix 2022-01-15 15:35:00 +08:00
e45e3a68a9 Cleanup: quiet missing braces warning 2022-01-15 15:35:00 +08:00
4f55bc0af8 Fix T94624: Object as font instances don't work
The fundamental limitation is that we can only have one instance
("dupli") generator at a time. Because the mesh output of a curve
object is output as an instances, the geometry set instances existed,
replacing the object as font instances. The "fix" is to reverse the
order. The behavior won't be perfect still, but at least the old
behavior will be preserved, which is really what matters for a
feature like this.

One way to take this change further would be completely disabling
regular geometry evaluation while this option is active. However,
it doesn't seem like that would actually improve the state of the code.

Differential Revision: https://developer.blender.org/D13768
2022-01-15 15:35:00 +08:00
9815918947 Fix T85706: wm_window_make_drawable update DPI
When drawing windows on monitors that differ in DPI, we can sometimes
have UI elements draw at an incorrect scale. This patch just ensures
that `wm_window_make_drawable` always updates DPI.

See D10483 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-15 15:35:00 +08:00
f8eeddfeae Revert "CMake: use FFmpeg find module on Linux"
This reverts commit 62a0de1673. Linux buildbot
is giving link errors.
2022-01-15 15:35:00 +08:00
e626149195 Fix T94071: Area Split Improvements
Allow area Split to be initiated in any area and give better feedback
when not allowed.

See D13599 for more details and usage examples.

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

Reviewed by Campbell Barton
2022-01-15 15:35:00 +08:00
abccf61d14 Fix warnings after bab47b60cb
It's not really clear how this part of the defaults code should be used,
I think this is fine now and solves the warnings.
2022-01-15 15:35:00 +08:00
33bf8b3eb1 Cleanup: Correct indentation 2022-01-15 15:35:00 +08:00
Brecht Van Lommel
8a5bee4b63 CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-15 15:35:00 +08:00
Simon Lenz
a71bf8b3b8 DNA: Add space clip editor defaults
This is my attempt of adding defaults for the space clip editor struct
(in line with https://developer.blender.org/T80164).

It adds the default allocation for `SpaceClip` and
`node_composite_movieclip.cc`. This also solves the error below (for
C++ files using the DNA_default_alloc), which was put forward by
Sergey Sharybin.

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

Reviewed by: Julian Eisel
2022-01-15 15:35:00 +08:00
Bastien Montagne
2ce04665dc Outliner: Add way to display warning icon for items.
While theorically fairly generic, current code is only enabled for
bledfile and liboverride views, and only used to display messages from
library IDs.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13766
2022-01-15 15:35:00 +08:00
b02027851c BLI_math: Fix building when WITH_GMP is off 2022-01-15 15:35:00 +08:00
Nikhil Shringarpurey
2d36d242a7 Icons: Remove absolute pathnames and deprecated gradients from SVG files
SVG files contained specific detailed pathnames on developers'
computers. These included full local user profile and path and should
not be in the release.

This patches corrects those lines. It also removes unused gradients from
the private icons SVG.

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

Reviewed by: Yevgeny Makarov, Julian Eisel
2022-01-15 15:35:00 +08:00
2fba2fa548 DRW: Add DRW_gpu_wrapper.hh
This adds wrapper classes that make it easier to use GPU objects in C++.

####Motivations:####

 - Easier handling of GPU objects.
 - EEVEE rewrite already makes use of similar wrappers.
 - There is the ongoing effort to use more C++ in the codebase
 and lans to port more engines to it.
 - The shader code refactor will make use of many UBOs with shared
 struct declaration. This helps managing them.
 - Safer handling of `TextureFromPool` which can't be bound as normal
 texture (only texture ref) and can be better tracked in the future.

####Considerations:####

 - I chose the `blender::draw` namespace because `blender::gpu` already has private classes (i.e: `gpu::Texture`).
 - Theses are wrappers that manage a GPU object internally. They might be confused with actual `Texture`. However, the name `TextureWrapper` is a bit too much verbose in my opinion. I'm open to suggestion about better name.

Reviewed By: jbakker

Differential Revision: http://developer.blender.org/D13805
2022-01-15 15:35:00 +08:00
bac5171865 Cleanup: codestyle obj_exporter_tests.cc. 2022-01-15 15:35:00 +08:00
bb816d0bec Cleanup: Not needed if statement around delete. 2022-01-15 15:35:00 +08:00
58a0cec84e BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
This means we will use many of the existing vector types and others
we currently don't have (uintX, intX). All these variations were
asking for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector
functions should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
incompleteness.
- The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
bit of a let down. Most clases are incomplete, out of sync with each
others with different codestyles, and some functions that should be
static are not (i.e: `float3::reflect()`).

####Upsides:
- Still support `.x, .y, .z, .w` for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types
and can be restricted to certain types. Also template specialization
let us define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance
is the same.

####Downsides:
- Might impact debugability. Though I would arge that the bugs are
rarelly caused by the vector class itself (since the operations are
quite trivial) but by the type conversions.
- Might impact compile time. I did not saw a significant impact since
the usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length.
For instance, one can't call `len_squared_v3v3` in
`math::length_squared()` and call it a day.
- Type cast does not work with the template version of the `math::`
vector functions. Meaning you need to manually cast `float *` and
`(float *)[3]` to `float3` for the function calls.
i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
- Some parts might loose in readability:
`float3::dot(v1.normalized(), v2.normalized())`
becoming
`math::dot(math::normalize(v1), math::normalize(v2))`
But I propose, when appropriate, to use
`using namespace blender::math;` on function local or file scope to
increase readability.
`dot(normalize(v1), normalize(v2))`

####Consideration:
- Include back `.length()` method. It is quite handy and is more C++
oriented.
- I considered the GLM library as a candidate for replacement. It felt
like too much for what we need and would be difficult to extend / modify
to our needs.
- I used Macros to reduce code in operators declaration and potential
copy paste bugs. This could reduce debugability and could be reverted.
- This touches `delaunay_2d.cc` and the intersection code. I would like
to know @howardt opinion on the matter.
- The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-15 15:35:00 +08:00
0ad841eaef Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce.
2022-01-15 15:35:00 +08:00
Clment Foucault
b2d0a46513 BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
 - We are aiming to share UBO and SSBO structures between GLSL and C++.
 This means we will use many of the existing vector types and others
 we currently don't have (uintX, intX). All these variations were
 asking for many more code duplication.
 - Deduplicate existing code which is duplicated for each vector size.
 - We also want to share small functions. Which means that vector
 functions should be static and not in the class namespace.
 - Reduce friction to use these types in new projects due to their
 incompleteness.
 - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
 bit of a let down. Most clases are incomplete, out of sync with each
 others with different codestyles, and some functions that should be
 static are not (i.e: `float3::reflect()`).

####Upsides:
 - Still support `.x, .y, .z, .w` for readability.
 - Compact, readable and easilly extendable.
 - All of the vector functions are available for all the vectors types
 and can be restricted to certain types. Also template specialization
 let us define exception for special class (like mpq).
 - With optimization ON, the compiler unroll the loops and performance
 is the same.

####Downsides:
 - Might impact debugability. Though I would arge that the bugs are
 rarelly caused by the vector class itself (since the operations are
 quite trivial) but by the type conversions.
 - Might impact compile time. I did not saw a significant impact since
 the usage is not really widespread.
 - Functions needs to be rewritten to support arbitrary vector length.
 For instance, one can't call `len_squared_v3v3` in
 `math::length_squared()` and call it a day.
 - Type cast does not work with the template version of the `math::`
 vector functions. Meaning you need to manually cast `float *` and
 `(float *)[3]` to `float3` for the function calls.
 i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
 - Some parts might loose in readability:
 `float3::dot(v1.normalized(), v2.normalized())`
 becoming
 `math::dot(math::normalize(v1), math::normalize(v2))`
 But I propose, when appropriate, to use
 `using namespace blender::math;` on function local or file scope to
 increase readability.
 `dot(normalize(v1), normalize(v2))`

####Consideration:
 - Include back `.length()` method. It is quite handy and is more C++
 oriented.
 - I considered the GLM library as a candidate for replacement. It felt
 like too much for what we need and would be difficult to extend / modify
 to our needs.
 - I used Macros to reduce code in operators declaration and potential
 copy paste bugs. This could reduce debugability and could be reverted.
 - This touches `delaunay_2d.cc` and the intersection code. I would like
 to know @howardt opinion on the matter.
 - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
 But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-15 15:35:00 +08:00
9706907aa6 Revert "BLI: Refactor vector types & functions to use templates"
Reverted because the commit removes a lot of commits.

This reverts commit a2c1c368af.
2022-01-15 15:35:00 +08:00
Nathan Rozendaal
270695828b Compositor: Add Scene Time Node, Rename Time node
Fixes issue T94603
It adds a new compositor node called Scene Time which is already present as a geo node, having the same basic nodes available in all node trees is a nice thing to have.
Renames "Time" node to "Time Curve", this is done to avoid confusion between the Time node and the Scene Time node.

Reviewed By: jbakker

Maniphest Tasks: T94603

Differential Revision: https://developer.blender.org/D13762
2022-01-15 15:35:00 +08:00
23e02e15d1 BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:float2) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
  This means we will use many of the existing vector types and others we
  currently don't have (uintX, intX). All these variations were asking
  for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector functions
  should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
  incompleteness.
- The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a
  let down. Most clases are incomplete, out of sync with each others with
  different codestyles, and some functions that should be static are not
  (i.e: float3::reflect()).

Upsides:
- Still support .x, .y, .z, .w for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types and
  can be restricted to certain types. Also template specialization let us
  define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance is
  the same.

Downsides:
- Might impact debugability. Though I would arge that the bugs are rarelly
  caused by the vector class itself (since the operations are quite trivial)
  but by the type conversions.
- Might impact compile time. I did not saw a significant impact since the
  usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length. For
  instance, one can't call len_squared_v3v3 in math::length_squared() and
  call it a day.
- Type cast does not work with the template version of the math:: vector
  functions. Meaning you need to manually cast float * and (float *)[3] to
  float3 for the function calls.
  i.e: math::distance_squared(float3(nearest.co), positions[i]);
- Some parts might loose in readability:
  float3::dot(v1.normalized(), v2.normalized())
  becoming
  math::dot(math::normalize(v1), math::normalize(v2))
  But I propose, when appropriate, to use
  using namespace blender::math; on function local or file scope to
  increase readability. dot(normalize(v1), normalize(v2))

Consideration:
- Include back .length() method. It is quite handy and is more C++
  oriented.
- I considered the GLM library as a candidate for replacement.
  It felt like too much for what we need and would be difficult to
  extend / modify to our needs.
- I used Macros to reduce code in operators declaration and potential
  copy paste bugs. This could reduce debugability and could be reverted.
- This touches delaunay_2d.cc and the intersection code. I would like to
  know @Howard Trickey (howardt) opinion on the matter.
- The noexcept on the copy constructor of mpq(2|3) is being removed.
  But according to @Jacques Lucke (JacquesLucke) it is not a real problem
  for now.

I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who
helped during this and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: http://developer.blender.org/D13791
2022-01-15 15:34:59 +08:00
7dace943c2 Cleanup: make format 2022-01-15 15:34:59 +08:00
b3d93feb5e Fix T94797: crash when playing animation in eevee rendered view
The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2.
Since this commit, the image users in gpu materials were updated
during depsgraph evaluation as well. However, there was a race
condition when one thread is deleting gpu materials in `BKE_material_eval`
while another thread is updating the image users at the same time.

The solution is to make sure that deleting gpu materials is done before
iterating over all gpu materials, by adding a new depsgraph relation.
2022-01-15 15:34:59 +08:00
7db8ac26d5 Fix T94812: render layer sockets are missing after file load
The main issue was the use of `G_MAIN` during file load.
This patch refactors the code so that iterating over `G_MAIN`
is not necessary anymore. See D13800 for more details.

Differential Revision: https://developer.blender.org/D13800
2022-01-15 15:34:59 +08:00
5a112d17f9 Fix T94041: Loading a new file gives crash while rendering in viewport
The issue was caused by Cycles display driver not being able to restore
window's OpenGL context after disposing Cycles-side OpenGL context.

This is due to the window OpenGL re-activation needing to access window
manager which gets cleared out form global main during file reading.

Defer clearing window manager from the global main to until after all
screens are "exited". This allows Cycles to properly stop rendering,
dispose its OpenGL context, and restore window's drawable context.

It is unclear why it was required to clear window manager list early
on. Guess is that it comes from an original code in a1c8543f2a where
there was an early return which then got replaced with an actual logic
without changing the order of de-initialization and window manager list
clear.

Differential Revision: https://developer.blender.org/D13799
2022-01-15 15:34:59 +08:00
e783b6c5c2 CMake: exclude linker options for APPLE and non-UNIX
These are only used for non-apple unix systems.
2022-01-15 15:34:59 +08:00
97a7f56990 Revert "Cleanup GPencil strength previous commit"
This reverts commit e339946515.

This broken the tablet pressure and it was impossible to set a proper strength.
2022-01-15 15:34:59 +08:00
4594283f9a Cleanup: use utility functions 2022-01-15 15:34:59 +08:00
0d35838274 Fix T89542: Crash when loading certain .hdr files
The direct cause of the bug in question was passing in the raw memory
buffer to sscanf. It should be called with a null-terminated buffer;
which isn't guaranteed when blindly trusting the file data.

When attempting to fuzz this code path, a variety of other crashes were
discovered and fixed.

Differential Revision: https://developer.blender.org/D11952
2022-01-15 15:34:59 +08:00
f3c63bab1f Cleanup: remove redundant const qualifiers for POD types 2022-01-15 15:34:59 +08:00
a1bf0efc41 Cleanup: VSE channel drawing
Remove code that very slightly darkened line on bottom of timeline, when
backdrop is enabled. Purpose of the code wasn't dodumented, and 2.79
doesn't seem to produce this darkened line.
Rename drawing functions to appropriate names.
2022-01-15 15:34:59 +08:00
19fcae8da1 deps_builder: GMP 6.2.1
Pretty straightforward update, nothing noteworthy to report.

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

Reviewed by: brecht, sybren
2022-01-15 15:34:59 +08:00
fe2e435d70 BLF: UI_fontstyle_draw Usage
Add maximum string length argument to UI_fontstyle_draw to reduce usage
of BLF_DRAW_STR_DUMMY_MAX. Reorders arguments to UI_fontstyle_draw_ex

See D13794 for more details.

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

Reviewed by Campbell Barton
2022-01-15 15:34:59 +08:00
f1acacf220 BLF: Reduction of use of BLF_DRAW_STR_DUMMY_MAX
Reduction of the number of uses of the define BLF_DRAW_STR_DUMMY_MAX
by using actual sizes of static character arrays.

See D13793 for more details.

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

Reviewed by Campbell Barton
2022-01-15 15:34:59 +08:00
75c94ae9ad Fix T94751: ground created by Setup Tracking Scene not marked as Shadow Catcher
Change that was missing in {rBca64bd0aacda}.
2022-01-15 15:34:59 +08:00
e005d0be93 Cleanup: Fix build warning with MSVC
comparing a bool > 0 make MSVC emit
warning C4804: '>': unsafe use of type 'bool' in operation.

int does the job nicely.
2022-01-15 15:34:59 +08:00
4ca2f35982 Build: Enable unity build for bf_compositor
Blender's compositor code already makes extensive use of
namespace which makes it very simple to enable unity build.
There was one duplicated function that has since to be moved
to a common header.

I saw roughly a 3x speedup of bf_compositor using ninja on
linux using i5 8250u (1:34 down to 0:34).

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13792
2022-01-15 15:34:59 +08:00
9529bad35f Build: Add precompiled headers for bf_compositor
With this change, compilation saw a 2.4x improvement.

This can be combined with unity build to give an overall 4x improvement

Depends on D13797

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13798
2022-01-15 15:34:59 +08:00
008f6cd2a8 cleanup: hipew remove unused variables
caused 4 warnings, nothing even conditionally
uses them, can be safely removed.
2022-01-15 15:34:59 +08:00
b71b3fe742 Cleanup previous commit
Don't need check minimum constant value, brush value is enough.
2022-01-15 15:34:59 +08:00
8c5fdf12ed Fix T94799: GPencil Strokes drawn at 0.0 Strength still visible
There was a clamp with a value greater than 0.
2022-01-15 15:34:59 +08:00
c19e3403bf Fix T93588: some videos loaded flipped over Y axis on macOS Arm
Was not actually flipping in the need_aligned_ffmpeg_buffer case.
2022-01-15 15:34:59 +08:00
07b69ae9c4 IME Cleanup: Unused GHOST_TEventImeData Member
Removal of unused tmp member of GHOST_TEventImeData. Not used now,
nor was it used by the commit that added it to begin with.

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

Reviewed by Ray Molenkamp
2022-01-15 15:34:59 +08:00
3b09c713e6 Cleanup: Fix build warnings with MSVC
our UNUSED macro is essentially a no-op for MSVC, which lead to
the situation  where this well meant macro was emitting the
following warning:

C4189: 'UNUSED_i': local variable is initialized but not referenced

However since we have been on c++17 for a while now the UNUSED
macro can be replaced with the standard [[maybe_unused]] attribute
in cpp files.

This changes cleans up the use of the UNUSED macro in the
bf_nodes_geometry project.

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

Reviewed by: JacquesLucke, Severin, Sergey, HooglyBoogly
2022-01-15 15:34:59 +08:00
b11a85931f Build: use precompiled headers on all platforms
Since CMake 3.16, CMake has native precompiled header (PCH) support.

This change swaps Blender's own PCH implementation with the native implementation.
Previously, PCH was only enabled on Windows however,
this new implementation works on all platforms.

For more information see https://cmake.org/cmake/help/latest/command/target_precompile_headers.html

On my system, Linux with ninja running on an i5 8250U
I saw a 60% reduction in compile times for `bf_freestyle` + linking time.

Reviewed By: LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13797
2022-01-15 15:34:59 +08:00
178e39051a Fix T94804: GPencil Simplify when strokes are Automerged in Draw Mode
The problem was the points were selected in edit mode and then sampled. Now, in draw mode, the points are always unselected to avoid this effect in the auto merge process.
2022-01-15 15:34:59 +08:00
Henrik Dick
cabd13d14f Add support for a longest diagonal quad triangulation mode
The new triangulation mode for quads is the opposite of the current default
shortest diagonal mode. It is optimal for cloth simulations using quad meshes.

Differential Revision: http://developer.blender.org/D13777
2022-01-15 15:34:58 +08:00
8d4c1acae7 Fix T94299: Object asset set as visible but doesn't show
Differential Revision: https://developer.blender.org/D13738

Reviewed by: Bastien Montagne, Sergey Sharybin
2022-01-15 15:34:58 +08:00
05786845e1 Cleanup compiler warning in Windows
`bool` used instead of `int`
2022-01-15 15:34:58 +08:00
176101b242 Fix T94728: Auto Depth problem with Cliping Region
Issue introduced in rB1d49293b80446b89b5b12fa0eeefaf14e5051e48

`drw_manager_init` must be called after `drw_context_state_init` as
`DST.draw_ctx.sh_cfg` (indicating when the view is clipped) must be set
first.

Differential Revision: https://developer.blender.org/D13795
2022-01-15 15:34:58 +08:00
8b69395b7f Cleanup: remove unnecessary 'use_opengl_context' parameter
The argument passed is always false.
2022-01-15 15:34:58 +08:00
Aleksi Juvani
0700ab32c5 Fix PSYS_GLOBAL_HAIR stripped even if connecting the hair fails
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.

Differential Revision: https://developer.blender.org/D13703
2022-01-15 15:34:58 +08:00
b0be0aeb16 Select Similar: hide 'threshold' from UI when not used
When the 'threshold' is not used in the type we are comparing, just hide
it. This was obvious for some types (e.g. Materials), but maybe not so
on others (e.g. Polygon Sides) and potentionally confusing.

Reported by @hitrpr in chat.

Differential Revision: https://developer.blender.org/D13760
2022-01-15 15:34:58 +08:00
ad20f4ef76 GPU: Utility function to bind UBO to batches. 2022-01-15 15:34:58 +08:00
Evan Wilson
1681b5d8e4 Explicit Color OCIO role comment fix.
This is an update to the correct OCIO role.

It changes `SceneReference` to `scene_linear`

See https://opencolorio.readthedocs.io/en/latest/guides/authoring/overview.html#config-roles

>     - reference - the color space against which the other color spaces are defined
>NOTE: The reference role has sometimes been misinterpreted as being the space in which “reference art” is stored in.
>
>    - scene_linear - the scene-referred linear-to-light color space, often the same as the reference space

The current OCIO UX working group doc says:

>reference: This role has had multiple interpreted meanings over the years and is a common point of confusion. It is kept in OCIO for backwards compatibility, but the recommendation is that it is not used by apps.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11398
2022-01-15 15:34:58 +08:00
75484721da Cleanup: use unity build for composite nodes
GIves about a 2.1x improvement in compilation times.
2022-01-15 15:34:58 +08:00
307a8d0204 Cleanup: Deduplicate finv_test function 2022-01-15 15:34:58 +08:00
f3a2b429ed Cleanup: quite missing-variable-declarations warnings 2022-01-15 15:34:58 +08:00
cb5a252e87 Cleanup: correct exception message 2022-01-15 15:34:58 +08:00
0f690abd4a Revert "Cleanup: remove declaration for removed function"
This reverts commit aa363ec2ae.

The function still exists, this commit caused a warning with Clang
So keep MEM_printmemlist_pydict.
2022-01-15 15:34:58 +08:00
8d68c5898b Cleanup: Composite nodes: add namespace for every file
This puts all static functions in composite node files into a new
namespace. This allows using unity build which can improve
compile times significantly.

This is a follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5
but for compositor nodes.

The namespace name is derived from the file name.
That makes it possible to write some tooling that checks the names later on.
The filename extension (`cc`) is added to the namespace name as well.
his also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.

Reviewed By: JacquesLucke, HooglyBoogly, jbakker

Differential Revision: https://developer.blender.org/D13466
2022-01-15 15:34:58 +08:00
3caea67aaf Fix T94768: Crash in VSE prefetching
If timeline contains scene strip outside of edited meta strip, this will
cause crash. This is because prefetchin ignored meta strips being edited
when rendering, but did check for scene strips only inside edited meta
strip.

Change active seqbase pointer when entering meta strip. This makes it
possible to prefetch only content that is being presented to user.
2022-01-15 15:34:58 +08:00
abf0251b57 Fix T94671: performance regression with subsurf modifier
rBeed45d2a239a introduced a GPU backend for OpenSubDiv which lets us do
the subdivision at render time. However, some tools might still need to
have the subdivision data available on the CPU side. For this a
subdivision mesh wrapper was also introduced, and is computed whenever a
CPU side mesh is needed. The subdivision settings for this wrapper are
stored during modifier evaluation if GPU subdivision can be done.

The performance regression is due to the fact that although the
subdivision mesh was already computed on the CPU, and no subdivision
wrapper is generated, some checks for creating subdivision data in
`BKE_mesh_wrapper_ensure_subdivision` where still run, one of which is
very expensive.

To fix this we first check the runtime settings of the mesh to see if
subdivision is needed at all.
2022-01-15 15:34:58 +08:00
99d375de0a Spreadsheet: Add mesh topology information with a debug value
This commit adds topology information from mesh data structs to the
spreadsheet when the debug value `4001` is set. Eventually we could
expose these. For now it can be a useful tool for developers when
working on mesh algorithms.

Differential Revision: https://developer.blender.org/D13735
2022-01-15 15:34:58 +08:00
b5fed0bd10 Cleanup: Remove unused "active ID" node flag
The value of this flag was only retrieved in `nodeGetActiveID`, which
wasn't used anywhere. Other than that, the `NODE_ACTIVE_ID` and
related functions seem to come from the Blender internal renderer.

Differential Revision: https://developer.blender.org/D13770
2022-01-15 15:34:58 +08:00
3d582eb463 Geometry Nodes: Move normal field input to be usable elsewhere
This commit moves the normal field input to `BKE_geometry_set.hh`
from the node file so that normals can be used as an implicit input to
other nodes.

Differential Revision: https://developer.blender.org/D13779
2022-01-15 15:34:58 +08:00
ca9e891ad8 Docs: correct doc-string for bl_run_operators_event_simulate
The event() action swapped type/value arguments.
2022-01-15 15:34:58 +08:00
de6dd3a36d macOS: fix xcrun sdk detection for minimal CLT
Differential Revision: https://developer.blender.org/D13783
2022-01-15 15:34:58 +08:00
4178748f81 Docs: Add comments to node socket struct header 2022-01-15 15:34:58 +08:00
760256d7bf UI: Allow AltGr Key + C,V,X Text Input
Slight change to our processing of Ctrl-C, Ctrl-V, and Ctrl-X so that
they will not be triggered if Alt is also pressed. This allows entry
of AltGr-C, -V, -X when using International keyboard layouts.

See D13781 for more details

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

Reviewed by Brecht Van Lommel
2022-01-15 15:34:58 +08:00
Takahiro Shizuki
93a3446bf9 Fix T94434: Windows IME Pinyin Forward Slash
Treat "/" as a key that should be evaluated by the Win IME system when
the input language is Chinese. This fixes a duplication of the input
character and results in the expected output of a Chinese wide comma.

See D13771 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-15 15:34:58 +08:00
07e84c85b6 Tests: disable all but one simple test for the Cycles Metal device
Until all tests are passing, this lets us run a basic test on the buildbot.

Ref T92212
2022-01-15 15:34:58 +08:00
ace1c7bc4d Fix T94111: nurb normal calculation does not work
The normals were computed with an uninitialized tilt.
2022-01-15 15:34:58 +08:00
e08a663edf Fix compilation error after recent fix
For some reason GCC accepted C++-style of unused variable marking.
2022-01-15 15:34:58 +08:00
b1cf3750cd Fix compile error with msvc 2022-01-15 15:34:58 +08:00
ce9051f5f8 Fix T93727: Tiled render error in Cycles after changing temp directory
Consider temporary directory to be variant part of session configuration
which gets communicated to the tile manager on render reset.

This allows to be able to render with one temp directory, change the
directory, render again and have proper render result even with enabled
persistent data.

For the ease of access to the temp directory expose it via the render
engine API (engine.temp_directory).

Differential Revision: https://developer.blender.org/D13790
2022-01-15 15:34:58 +08:00
9f2d504c7e Fix second render failure with Cycles persistent data
The issue was caused by the recent changes in the way how the
render result is drawn: the display driver now could hold an
OpenGL resources. Those resources are not shared across contexts
so whenever OpenGL context is destroyed those resources are to
be destroyed as well (and not attempted to be re-used for a next
render).

Do such destruction and entire driver re-creation since it does
simplifies things from API usage point of view without causing
measurable slowdown.

Steps to reproduce the issue:
- Set the render resolution to 2x of Full HD
- Enable persistent data
- Render (F12)
- Render again

Observe OpenGL state being corrupted. Easy to see in debug mode
where IMM abstraction level reports issues about the buffer size
not being the proper size. This was caused by the display driver
trying to use VAO from the previous OpenGL context.

Differential Revision: https://developer.blender.org/D13789
2022-01-15 15:34:58 +08:00
24a9d59e16 Fix T94661: Out-of-bounds memory access due to malformed DDS image file
Harden bounds check in the stream reader avoiding integer overflow.
2022-01-15 15:34:58 +08:00
bd5e46811a Fix Cycles compilation with Optix on Windows.
Since Optix 7.3 is required, update the default path accordingly.
2022-01-15 15:34:58 +08:00
d631a3da32 Fix T94766: texture coordinates from other object do not refresh
The core issue is that flushing dependencies are created from an object
to a node tree when it contains e.g. a Texture Coordinate node.
That is an issue because the evaluation of the node tree itself does not
depend on the object (node tree evaluation is essentially a no-op).

Only other systems that parse and evaluate the node tree in a specific
context actually depend on e.g. the position of the referenced object.
It can even be the case that the node tree depends on objects that
the actual evaluator (geometry nodes modifier/material) does not depend
on, because a node is not connected to the output.

Geometry nodes makes the distinction between dependencies to the
node tree and to the evaluator already. Shader nodes do not.
Therefore, shader nodes need a flushing relation from node groups
to their parent node groups.

This brings back some unnecessary updates from rB7e712b2d6a0d
(e.g. when creating a node group from nodes that are not connected
to the output). This is a bit unfortunate, but refactoring how
dependencies work with shader nodes is a out of scope for this fix.
2022-01-15 15:34:58 +08:00
Demeter Dzadik
be3a97583c Fix error when keyframing with Custom Properties
Since rBf9ccd26b037d, calling `data.path_resolve()` on custom properties
with `None` value do not cause a `ValueError` exception any more. This
is now taken into account in the keying sets targeting custom
properties.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13787
2022-01-15 15:34:58 +08:00
69a39f1eae Remove GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-15 15:34:58 +08:00
33316572d7 Remove GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-15 15:34:58 +08:00
db79dcefe2 Remove GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA.
Shader isn't used and not accessible via py-api.
2022-01-15 15:34:58 +08:00
8aa5ad323f Remove GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-15 15:34:58 +08:00
c56bf36c8a Remove GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via the py-api.
2022-01-15 15:34:58 +08:00
ee2864ade5 Remove GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA.
Shader isn't used and isn't accessible via py-api.
2022-01-15 15:34:58 +08:00
a7a611cde4 Cleanup: Remove unused source files. 2022-01-15 15:34:57 +08:00
1251119fdb Cleanup: Consistent naming GPU_SHADER_2D_AREA_BORDERS. 2022-01-15 15:34:57 +08:00
53002bd3bf GPU: Remove unused UV shaders.
The UV shaders have been migrated to the overlay engine and aren't
accessible via the python API.
2022-01-15 15:34:57 +08:00
35c9107bf0 Cleanup: add utility macro to simplify using std::enable_if 2022-01-15 15:34:57 +08:00
78727e9e56 Fix T94409: GPencil smooth stroke thickness operator weird result
The smooth was not working "smoothly" and any change in the factor produced a weird result.
2022-01-15 15:34:57 +08:00
b36a67d801 Fix compile error in gpu test. 2022-01-15 15:34:57 +08:00
ae99858c73 Fix T94600: Apply single shrinkwrap constraint fails
rBd6891d9bee2b introduced a way to apply a single constraint from the
constraint stack. For this we want to work in the evaluated domain, in
particular the constraint target should be evaluated (the shrinkwrap
constraint needs to have access to the target's evaluated mesh).

Thx a lot to @sergey for handholding here!

Maniphest Tasks: T94600

Differential Revision: https://developer.blender.org/D13765
2022-01-15 15:34:57 +08:00
925e4449ef Motion Path: Tweak the User Interface
This moves the clear paths button ("X") to the same line of "Update All Paths",
and make it visible at all times.

1. The clear button affects all objects (by default). However the
Calculate/Update Paths only works on the selected objects/objects.
Better to not have them both on the same line.

2. The operator to clear object and pose paths can run even if the active
object/bone has no motion path. However the UI was not showing the button in
those cases.

Before:
{F12757500, size=full}

After:
{F12757502, size=full}

Differential Revision: https://developer.blender.org/D13609
2022-01-15 15:34:57 +08:00
a5845f964d Fix out of bounds memory access displaying the compositor crop gizmo
Regression from typo in cbca71a7cf.
2022-01-15 15:34:57 +08:00
591db70641 Compositing Convert color space node
Compositor node to convert between color spaces.

Conversion is skipped when converting between the same color spaces or to or from data spaces.
Implementation done for tiled and full frame compositor.

Reviewed By: Blendify, jbakker

Differential Revision: https://developer.blender.org/D12481
2022-01-15 15:34:57 +08:00
37acab098c Cleanup: Wintab input processing.
Switched populating GHOST_WintabInfoWin32 vector from resizing and
assigning to reserving and pushing.

Removed unnecessary state tracking for multiple button presses in a
single packet.

Paired initialization with definition, and added default initialization
for GHOST_WintabInfoWin32.
2022-01-15 15:34:57 +08:00
722f0c9efe Cleanup: note that compositor vector blur shares logic with zbuf.c
Note that some functions have been copied between these files.
De-duplication isn't trivial as there are differences in some functions.
2022-01-15 15:34:57 +08:00
ba0259d2e2 Cleanup: typos in comments, remove libnumaapi reference 2022-01-15 15:34:56 +08:00
26713dc7f8 Cleanup: Missing internationization for socket description 2022-01-15 15:34:56 +08:00
2abc2c3a06 Fix mistake in previous commit 2022-01-15 15:34:56 +08:00
6cbb8dd13c Cleanup: redundent semicolons after function braces 2022-01-15 15:34:56 +08:00
6016b7b4d5 Cleanup: Use new socket builder API 2022-01-15 15:34:56 +08:00
70089a813e UI: Make uiTemplateNodeLink work for all socket types
Currently the node link ui template only works with a few socket types.
This commit addes support for the rest of the socket type declarations.

As pointed out in D13776 currently after recent refactors
Shader nodes no longer display in the menu.

In the future more socket types will be used in the shader nodes
and makes the UI template work better for other node trees.

Differential Revision: https://developer.blender.org/D13778
2022-01-15 15:34:56 +08:00
a20bb5bca5 Fix T94243: weightpaint gradient panel shown in other places
Weightpaint gradient tool panel showed in other modes (and as a separate
panel).

Fix for fix, see
- rBf8a0e102cf5e
- rBe549d6c1bd2d

So now, check mode again and restrict to topbar (prevents an additional
panel since this is already included in the brush settings).

ref rB0837926740b3 in sculpt-dev branch, so thx @joeedh as well!

Maniphest Tasks: T94243

Differential Revision: https://developer.blender.org/D13630
2022-01-15 15:34:56 +08:00
33dff50780 Cleanup: Remove no op socket templates 2022-01-15 15:34:56 +08:00
b912f9a5e9 Cleanup: Nodes: Begin splitting shader node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for shader nodes into their respected
source/blender/nodes/shader/nodes file.

In the future, these functions will be simplified to node_layout.

Some nodes were left in `drawnode.cc` as this would require duplicating code
while this is likely fine it is best to leave that to a seperate commit.
2022-01-15 15:34:56 +08:00
01ad793e64 Cleanup: Use new socket builder API 2022-01-15 15:34:56 +08:00
dbce1c7937 Cleanup: Remove no op socket templates 2022-01-15 15:34:56 +08:00
0c440e67c3 Fix T94713: Alembic crash with empty frames and velocities
Some software or processing tools (videogrammetry in this case) may
export malformed files with velocity data even when the frame is empty
for some reason. We need to explicity compare the data size with the
vertex size, and refuse to load the attribute if there is a data size
mismatch.
2022-01-15 15:34:56 +08:00
b6098cc870 Fix T94534: dangling pointer in internal link after removing socket
The dangling pointer caused errors further down the line.
The solution is to simply delete an internal link when one
of the corresponding sockets is removed (just like normal
links are removed as well).
2022-01-15 15:34:56 +08:00
a18b84cd8c Cleanup: Use new socket builder API 2022-01-15 15:34:56 +08:00
3f68244794 Cleanup: Loop through socket listbase instead of array
The socket arrays will be removed when using the new socket builder.
So instead we have to loop through the node outputs list.
2022-01-15 15:34:56 +08:00
dbc1408cc5 Fix Cycles compile error after last own commit
We can't include `BLI_utildefines.h` in `RNA_types.h` since Cycles includes
that, but duplicates some of the util defines. So you'd have duplicated
definitions.
2022-01-15 15:34:56 +08:00
9fbcf97679 Cleanup: Remove unused code from BKE_node.h
Remove a variety of unused functions, declarations without definitions,
incorrect comments, and defines that have been commented for years
2022-01-15 15:34:56 +08:00
395d04fdf5 Fix Adjust Last Operation panel showing session UUID number button
This is implementation specific data that should never be exposed to regular
users. Also make sure this data is not saved to presets.
2022-01-15 15:34:56 +08:00
c88cea6e69 RNA: Support bitwise operators for property flags in C++
Needed for the following commit.
2022-01-15 15:34:56 +08:00
4717cf0147 Cleanup: Use forward declaration of struct in header
This meant that BKE_mesh.h couldn't be used without
the DNA headers first.
2022-01-15 15:34:56 +08:00
Aleksi Juvani
6837ca081a Fix: connecting hair fails on meshes with no generative modifiers
Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the
mesh has no generative modifiers, in which case we can use `mesh_final`, which
would seem to be consistent with the rest of the particle code. An alternative
approach would be to make sure that `mesh_original` is always set in
`deformVerts`.

Differential Revision: https://developer.blender.org/D13754
2022-01-15 15:34:56 +08:00
Olivier Maury
8da966d554 Fix wrong shadow terminator geometry offset with deformation motion blur
Differential Revision: https://developer.blender.org/D13759
2022-01-15 15:34:55 +08:00
Olivier Maury
b996307359 Fix wrong shadow terminator geometry offset for instances
Must take into account SD_OBJECT_TRANSFORM_APPLIED to determine if the normal
was already in world space.

Differential Revision: https://developer.blender.org/D13639
2022-01-15 15:34:55 +08:00
eb5a93823a Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

This is an updated fix with a workaround for freezing with the NVIDIA
driver on Linux.

Differential Revision: https://developer.blender.org/D13385
2022-01-15 15:34:55 +08:00
Michael Jones
1e535f2a45 Cycles: Fix Metal build
This patch fixes a couple of new Metal kernel compilation errors: 1) a kernel parameter count overflow, and 2) missing address space qualifiers.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13763
2022-01-15 15:34:55 +08:00
b0e9b379cf LibOverrides: small refactor of resync main public function.
Simplify signature of `BKE_lib_override_library_resync` and make it a
shallow wrapper around new internal `lib_override_library_resync` that
can then be easily extended for other internal needs.

Not functional changes expected here.
2022-01-15 15:34:55 +08:00
Germano Cavalcante
222cc033be Fix T94078: Wrong Bound Box calculated for curves
`DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` creates temporary objects that
correspond to duplicates or instances.

These temporary objects can share same pointers with the original object
as in the case of Bounding Box.

Bound Box of temporary objects is marked dirty in
`BKE_object_replace_data_on_shallow_copy` since `ob->data` is different.

This causes the original Bounding Box, calculated for the evaluated
geometry, to be lost.

The solution in this commit is to change the boundbox reference of the
temporary objects, so the boundbox of the non-temporary object (with
the data curve) is not marked dirty.

Differential Revision: https://developer.blender.org/D13581
2022-01-15 15:34:55 +08:00
9bf3a02e29 Cleanup: Remove unused numapi library 2022-01-15 15:34:55 +08:00
2a1aee04a5 Remove dead numaapi code in blenlib
It it rather an old experiment now which didn't pay off.
The initial idea was to have main and jobs threads on fast
nodes of TR2 processors. This didn't really work reliably
because in Blender we need to be able to create nested
threads without their affinity set. This is not how some of
OS are creating nested threads, and we don't always have
access to child threads to reset their affinity.

So overall complexity of the initial idea implementation
became too much compared to the performance gain.
2022-01-15 15:34:55 +08:00
f290cc8ce6 LibOverride: Add tag to libraries that had to be recursively resynced.
Request from studio, to help identify quickly libs that need update.

NOTE: Currently only outputing INFO log in console, display of this info
in the outliner will come in a separate commit.
2022-01-15 15:34:55 +08:00
44d5e42dcb Cycles: Remove usage of libnumaapi
No need for it now since all the threading queries and
scheduling is done via TBB.

Should be no functional changes as all the removed code
is supposed to be unused.
2022-01-15 15:34:55 +08:00
Jagannadhan Ravi
77ed565a57 Fix T94310: Blender doesn't support with 128 threads well in Win11
Query TBB for the maximum allowed concurrency, which is free from a bug
in own concurrency detection code. One thing to keep in mind is that now
Cycles is limited by the number of threads in the TBB areana from which
Session is created. This isn't a problem for Blender since we do not limit
arena on Blender side. Could be something to watch out for in other Cycles
integrations.

Differential Revision: https://developer.blender.org/D13658
2022-01-15 15:34:55 +08:00
d4be390b1f Fix T86952: Buffer overflow reading specific DDS images
Add a data boundary check in the flipping code.

This code now also communicates the number of mipmap levels
it processed with an intent to avoid GPU texture from using
more levels than there are in the DDS data.

Differential Revision: https://developer.blender.org/D13755
2022-01-15 15:34:55 +08:00
240dc6ccbf Fix T94659: crash when deleting instances (part 2)
This was missing from rB3e92b4ed2408eacd126c0.
Before only the Separate Geometry node was fixed, because that
node was used in the file from the bug report. The same issue
existed in the Delete Geometry node as well though.
2022-01-15 15:34:55 +08:00
e3f7d9a48e Fix T94707: inverted output of separate geometry node incorrect
This was an oversight in rB3e92b4ed2408eacd126c0.
2022-01-15 15:34:55 +08:00
cb492701d6 Cleanup: exclude uiFont from DNA, rename filename -> filepath
This isn't saved to the preferences,
so there is no need to store in DNA.

Also remove unused `r_to_l` member.
2022-01-15 15:34:55 +08:00
85758c0190 Fix T94708: negative reference count error with Python API callbacks
Regression in 7972785d7b that caused
Python callback arguments to be de-referenced twice - potentially
accessing freed memory. Making a new-file with a circle-select
tool active triggered this (for example).

Now arguments aren't de-referenced when Blender it's self has already
removed the callback handle.
2022-01-15 15:34:55 +08:00
6d3674942c Cleanup: use the ELEM macro 2022-01-15 15:34:55 +08:00
9d9f131bd3 Fix T94629: The IMB_flip API would fail with large images
Fix IMB_flip[xy] to handle cases where integer overflow might occur when
given sufficiently large image dimensions.

All of these fixes were of a similar class where the intermediate
sub-expression would overflow silently. Widen the types as necessary.

Differential Revision: https://developer.blender.org/D13744
2022-01-15 15:34:55 +08:00
830f16ace8 Fix BKE_image_ensure_tile_token being called with a full path
Assert that only the file name component is passed in
since special handling for UDIM should only be applied to the file name.

Also remove an unnecessary NULL check on the filename argument.
2022-01-15 15:34:55 +08:00
59da381e7e Cleanup: use static sets for comparison, quiet unused arg warnings 2022-01-15 15:34:55 +08:00
970d08796a Cleanup: rename sculpt_brushes.c -> sculpt_brush_types.c
This better differentiates sculpt brush types with brush data-blocks,
since the same sculpt brush type may be used for many brushes.
2022-01-15 15:34:55 +08:00
5dbf3ec62e Cleanup: remove redundant const qualifiers for POD types
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
2022-01-15 15:34:55 +08:00
bdda7c0a08 Cleanup: Fix spelling in filename 2022-01-15 15:34:55 +08:00
e7d56a7ab6 Cleanup: Add bf_nodes_texture library
For sake of consistencey with other node tree types, create its own cmake module.
This change helps keep `bf_nodes` focused on  generic nodes files.

Texture nodes are end of life and hopefully for Blender 4.0 they can be removed.
It is not expected that these will see the updates that the other nodes are getting.
This change also helps isolate the end of life files, we may move some texture
specific node tree execution code out of `node_exec` and into a `node_texture_exec` files.

Differential Revision: https://developer.blender.org/D13743
2022-01-15 15:34:55 +08:00
7e69e02d49 Cleanup: Use new socket builder API
This commit converts most shader or bsdf nodes.
2022-01-15 15:34:55 +08:00
bbd652e600 Fix T94635: Sculpt Smooth in Surface mode with Anchored Stroke crash
Sculpt Smooth in Surface mode (as opposed to Laplacian) needs a cache
initialized on first time. In anchored stroke mode with spherical falloff
this was skipped though (because this starts of with no PBVH nodes and
an early return checks for this) and `first_time` was set to false before
cache initialization.

Now move the cache initalization to happen earlier (same as the cache
initialization for automasking).

Maniphest Tasks: T94635

Differential Revision: https://developer.blender.org/D13746
2022-01-15 15:34:55 +08:00
2430d683a3 Fix Cycles updating display unnecessarily when stopping 3D viewport
Debug code accidentally committed in 466b50d. This was found while
investigating issues with D13385.
2022-01-15 15:34:55 +08:00
897a42ee12 Fix T94672: incorrect Workbench shadows with GPU subdivision
The `lines_adjacency` IBO build in the GPU subdivision case was missing
edges at the boundaries of open meshes. As it is used for the shadow
pass, the shadows were then not clipped properly.

This would also make X-Ray mode render differently in those cases.

To fix this, we can simply reuse the buffer finalization routine from the
non-subdivision case, as such edges are handled there.
2022-01-15 15:34:55 +08:00
5ce79f3cb1 GPU subdiv: fix wrong data sizes used for lines adjacency IBO
Function parameters were mismatched, causing an assertion failure in
debug builds.
2022-01-15 15:34:55 +08:00
f9c9437c3e Depsgraph: only link 'IK Constraint -> Init IK Tree' if animated.
This relation is intended to ensure that the properties of the IK
constraint are ready by the time the IK solver tree is built. This
however can cause spurious dependency cycles, because there is only
one init tree node for the whole armature, and the relation actually
implies dependency on all properties of the bone.

This patch reduces spurious dependencies by only creating the relation
if any properties of the IK constraint specifically are animated.

Differential Revision: https://developer.blender.org/D13714
2022-01-15 15:34:55 +08:00
34a7b0aed6 Bone Overlay: support changing bone wireframe opacity.
When weight painting the bone overlay is extremely intrusive,
effectively requiring either extensive use of hiding individual
bones, or disabling the whole bone overlay between selections.

This addresses the issue by adding a bone opacity slider that
is used for the 'wireframe' armature drawing mode. It directly
controls the uniform opacity as a straightforward option.

Differential Revision: https://developer.blender.org/D11804
2022-01-15 15:34:55 +08:00
916c95a11c Depsgraph: fix spurious cycles with identically named idprops on bones.
If multiple bones have a custom property with the same name,
depsgraph didn't distinguish between them, potentially leading
to spurious cycles.

This patch moves ID_PROPERTY operation nodes for bone custom
properties from the parameters component to individual bone
components, thus decoupling them.

Differential Revision: https://developer.blender.org/D13729
2022-01-15 15:34:55 +08:00
44b8de6904 Fix T94685: python error adding Space handlers for Spreadsheet
Oversight in {rB9cb5f0a2282a}.

Above commit made an entry in `rna_Space_refine()`, but the entry in
`rna_Space_refine_reverse()` was missing (and this is what python uses
for the Space callbacks).

Maniphest Tasks: T94685

Differential Revision: https://developer.blender.org/D13751
2022-01-15 15:34:55 +08:00
14a9148492 Cleanup: use correct file namespace name 2022-01-15 15:34:54 +08:00
28a058250b Cleanup: typos in code. 2022-01-15 15:34:54 +08:00
cc313bd73a Fix T94674: crash reading ORCOs from an Alembic animation
The crash is caused as the data is only for the first frame, but the mesh
changes topology, so reading the data in subsequent frames causes a
buffer overflow. To fix this, we check that the data size matches the
mesh's vertex count.
2022-01-15 15:34:54 +08:00
aa8e190694 Cleanup: USD/ABC, remove const from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-15 15:34:54 +08:00
d1b85d0fbe Cleanup: anim, remove const declarations from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-15 15:34:54 +08:00
7887152457 Cleanup: Replace FINISHED with CANCELLED
As the operator does nothing, better use cancelled.
2022-01-15 15:34:54 +08:00
c6c4a2b441 Fix (unreported) crash in liboverride after yesterday's commit.
Own mistake in rBbfb760e16acb.
2022-01-15 15:34:54 +08:00
0f350022e3 Cleanup: move public doc-strings into headers
Some recent changes re-introduced public-style doc-strings
in the source file.
2022-01-15 15:34:54 +08:00
fdf83afe10 Cleanup: quiet GCC stringop-overflow in bmesh_beautify.c
Also elaborate on the doc-string.
2022-01-15 15:34:54 +08:00
d8022d84cb Cleanup: sort cmake file lists 2022-01-15 15:34:54 +08:00
aeb9e31c7e Cleanup: remove unnecessary slashes and quotes from paths in CMake 2022-01-15 15:34:54 +08:00
485ef139bd Cleanup: remove redundant/unused assignment
SRC was being assigned invalid values then overwritten.
2022-01-15 15:34:54 +08:00
1e6ad2580d Cleanup: spelling in comments 2022-01-15 15:34:54 +08:00
3eecadee01 Cleanup: remove declaration for removed function 2022-01-15 15:34:54 +08:00
bf4f64b0d7 Cleanup: compiler warnings 2022-01-15 15:34:54 +08:00
7ef9ce7fa5 CMake: add missing headers 2022-01-15 15:34:54 +08:00
057ace0cb8 Correct error when moving doc-strings into header
Error in ffc4c126f5,
which moved doc-strings from implementation into headers.

Some changes in BKE_animsys.h needed to done manually as there
were already doc-strings in both the header and implementation
(with overlapping information).
When making these changes some doc-strings were removed unintentionally.

Thanks for @sybren for the heads up.
2022-01-15 15:34:54 +08:00
37afb5a7cf Cleanup: Clang-tidy: modernize-redundant-void-arg 2022-01-15 15:34:54 +08:00
430ca952ac Cleanup: Spelling/grammar in comments 2022-01-15 15:34:54 +08:00
e7c27e7cbf Cleanup: Use snake case for file names
This is so that we can have "proper" file namespace names in D13466
2022-01-15 15:34:54 +08:00
9c17c64f9b In obj exporter test, fix a strncpy length and a stray test file left behind. 2022-01-15 15:34:54 +08:00
1b6342d3c3 Cleanup: Remove empty node socket template array 2022-01-15 15:34:54 +08:00
8bbc3a1797 Cleanup: Use new socket builder API
Instead of looping through the old socket template array
looper through the node output listbase.
2022-01-15 15:34:54 +08:00
efb2ba4bdd Fix: MSVC build error
MSVC2017 and early 2019 versions are under
the impression struct OGLRender is non trivial
type due to the ThreadCondition field, not
entirely sure why, but it is what it is.

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

Reviewed by: JacquesLucke
2022-01-15 15:34:54 +08:00
7711571b56 Cleanup: Use new socket builder API 2022-01-15 15:34:54 +08:00
f070c920eb Cleanup: Use new socket builder API
Also enables translation of socket names
2022-01-15 15:34:54 +08:00
1729a11ffd Fix/workaround macOS Rosetta crash running Cycles AVX tests
Just disable these tests on macOS for now as fixing seems hard, and we want to
be able to cross-compile and test x86_64 on Arm machines on the buildbot.
2022-01-15 15:34:54 +08:00
9ea947f604 Fix Cycles AVX test failure with x86_64 build running on Arm
Don't create const avx vectors before validating if CPU supports AVX.
2022-01-15 15:34:54 +08:00
f512d5b9e7 Fix T94563: Cycles standalone build error on with strict float/double casting
Thanks to John David for finding this.
2022-01-15 15:34:54 +08:00
ed15a0d58d Fix T93695: Discontinuous cutting with the knife tool
An important check to reject edge linehits when a vertex of that edge
was already hit was accidentally removed in
rB6e77afe6ec7b6a73f218f1fef264758abcbc778a
2022-01-15 15:34:54 +08:00
502a1399a7 Cleanup: Remove unused node_type_exec for shader node
From what I can tell these are left over from Blender Internal render.

Test still pass locally, also tested a couple eevee scenes.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D13732
2022-01-15 15:34:54 +08:00
cf65a475b8 Fix T94169: Missing grease pencil render with tiled rendering
Delay grease pencil for until after the render result is written
to the Blender side.

Differential Revision: https://developer.blender.org/D13740
2022-01-15 15:34:54 +08:00
49102e4425 Fix Cycles allocating result too early
When tiled rendering was used the render result was
allocated at the end of every view layer render as
opposite of an intended end of all rendering.

Modify the render_result_end so that it only ensures
pixels are allocated if pixels are actually copied
over.
2022-01-15 15:34:54 +08:00
2bbaf26055 Fix Cycles using Cancel semantic on final result write
Seems like a copy-paste bug from another place.
2022-01-15 15:34:54 +08:00
1dcfb7d33c Fix T94650: LibOverride: Bad handling of (auto)resync in case of single override.
Overrides that are not created as part of an override hierarchy should
not be handled through (auto)resync at all. users are responsible to
hanlde those updates if they need it.

This is achieved by flagging overrides created outside of a hierarchical
process accordingly, and skipping them during resync process.
2022-01-15 15:34:54 +08:00
c96db828ea LibOverride: Cleanup some code.
No functional change.
2022-01-15 15:34:54 +08:00
813eaff9e2 Assets: disable automatic preview generation for node groups
The current preview generation is more confusing than useful.
Therefore it is better to disable it until better preview generation
methods are found.

Differential Revision: https://developer.blender.org/D13728
2022-01-15 15:34:53 +08:00
f1f34b3263 Fix T94659: crash when deleting instances
The crash was caused by using `modify_geometry_sets` to modify
instances, which does not generally work unfortunately.
The intended behavior was wrong anyway. In instances mode,
only top level instances should be deleted.

Also removed the old error handling because it doesn't look like it
ever worked. all_is_error remained false all the time.
Furthermore, updating it was not thread safe.

Differential Revision: https://developer.blender.org/D13736
2022-01-15 15:34:53 +08:00
Aleksi Juvani
70f28e58b0 Fix T54488: hair disconnect/reconnect not working with modifiers
Take the Use Modifier Stack setting into account when connecting hair, and
fix wrong results results when using deforming modifiers also.

Differential Revision: https://developer.blender.org/D13704
2022-01-15 15:34:53 +08:00
0c96ddd92c Cleanup: rename mesh -> geom in some places that now handle multiple geom types 2022-01-15 15:34:53 +08:00
0cdc4e5b9b Cleanup: compiler warnings about unused code 2022-01-15 15:34:53 +08:00
1e21723f19 Cycles: Add OptiX temporal denoising support
Enables the `bpy.ops.cycles.denoise_animation()` operator again and modifies it to support
temporal denoising with OptiX. This requires renders that were done with both the "Vector"
and "Denoising Data" passes.

Differential Revision: https://developer.blender.org/D11442
2022-01-15 15:34:53 +08:00
325ba18b44 Cleanup: fix typos in source code in intern/
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13532
2022-01-15 15:34:53 +08:00
a1f037e669 Cleanup: Remove unused code (USE_COLOR_U32) 2022-01-15 15:34:53 +08:00
d4025588de Cycles: support rendering PointCloud motion blur from attribute
This adds support to render PointCloud motion blur from a standard
"velocity" attribute.

This implementation is similar to that of the Mesh geometry, and
perhaps some code could be deduplicated through a more generic API.
`mesh_need_motion_attribute` was renamed `object_need_motion_attribute`
as it does not really require a mesh and moved to `util.h` so that
it can be shared.

This fixes T94622.

Reviewed By: brecht

Maniphest Tasks: T94622

Differential Revision: https://developer.blender.org/D13719
2022-01-15 15:34:53 +08:00
474bad1854 Enable OpenEXR DWAB compresstion
The DWAB compression was disabled in the d59721c2c3 due to
a bug in the OpenEXR library which is now resolved.

Re-enable the DWAB compression for OpenEXR output. It is a
simple change, and DWAB often behaves better than DWAA.

Differential Revision: https://developer.blender.org/D13713
2022-01-15 15:34:53 +08:00
6bb14d126b Fix T94564: Mirror clipping is not properly placed in sculpt mode
If a mirror object is used in a mirror modifier, sculptmode did not take
this into account (and instead always clipped on the sculpt objects
local axis).

Now take this into account by storing a matrix in the preparation
function `sculpt_init_mirror_clipping` and use that later in
`SCULPT_clip`.

Maniphest Tasks: T94564

Differential Revision: https://developer.blender.org/D13711
2022-01-15 15:34:53 +08:00
a0bb580d2d Fix T94506: Crash in Compositing 2022-01-15 15:34:53 +08:00
74df02410a Fix T94545: support realizing instanced collections
This case wasn't handled in rBf5ce243a56a22d718 correctly.
Now `object_get_evaluated_geometry_set` just returns a geometry
set that contains the collection instance for collection instance objects.
2022-01-15 15:34:53 +08:00
a206e4316e IDManagement: Add assert against no-main IDs passed to BKE_id_delete.
This high-level function can only deal with IDs in main, trying to use
it to delete/free a no-main ID does nothing.
2022-01-15 15:34:53 +08:00
dee0aeb1c1 Fix T94366: Grease Pencil Automerge no immediate UI update
Just an oversight in rBe9607f45d85d.
Now add notifier that toolsettings changed.

Maniphest Tasks: T94366

Differential Revision: https://developer.blender.org/D13723
2022-01-15 15:34:53 +08:00
d44653b632 Cleanup: Use new socket builder API 2022-01-15 15:34:53 +08:00
0d20efdac2 Nodes: Consistent link drag search for math and vector math nodes
Previously operations for the math node when connecting to
outputs weren't added. It also used a different method to
check whether the link would be valid.
2022-01-15 15:34:53 +08:00
30ce54db4b Cleanup: Make shade node util header CPP only
Now that all shader nodes are converted to CPP
this header can now be made into a CPP header.
2022-01-15 15:34:53 +08:00
a5cef21888 Fix T89587: Don't Change Line Width For Previews
Do not temporarily change U.pixelsize while creating object previews
in object_preview_render. It does nothing to the render, but the change
in line width can affect other UI drawing since it is done in a thread.

see D13717 for for details.

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

Reviewed by Julian Eisel
2022-01-15 15:34:53 +08:00
56c7258935 Fix T94145: Knife tool fails in orthographic mode
Calculating min and max orthographic extent forgot to convert to
worldspace coordinates.
2022-01-15 15:34:53 +08:00
1c7a1fda94 Cleanup: Dont use relative include
Instead let cmake determine the path for file includes
2022-01-15 15:34:53 +08:00
Aaron Carlisle
7cdd839c3d Cleanup: Nodes: Convert generic shader node files to c++
Along with the general changes to CPP this commit does the following

- Use static casts where possible
- Use new CPP MEM library functions instead of cast
- Use listbase macros where possible
- Declare variables where initialized

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13718
2022-01-15 15:34:53 +08:00
ed982beebf Fix: Link drag search error with random value node from color socket
Dragging from a color socket would hit an assert in a debug build.
The node does not have a color mode currently, so use the vector mode
instead when connecting to a color socket.
2022-01-15 15:34:53 +08:00
9cc686219e Fix T94620: GPencil AutoMerge does not work when Draw On Back is enabled
The problem was the stroke was added to head and the `prev` pointer was NULL. Now check if there is the list is empty`next`.
2022-01-15 15:34:53 +08:00
dfba6c2f20 Fix T94308: Window Manager console error 2022-01-15 15:34:53 +08:00
5136e8ad40 Fix: Build issue with MSVC
std::min was used without including the algorithm
header. Seems to be implicitly included by
something in newer MSVC versions and GCC, however
vs16.4 needed a little help here.
2022-01-15 15:34:53 +08:00
d7d19ecb07 Cleanup: Code formatting. 2022-01-15 15:34:53 +08:00
3c50b45568 Fix T94546: Remove soft limit for the Clamp Node value socket. 2022-01-15 15:34:53 +08:00
379cfdb43c Fix T94544: crash removing image used as camera background via python
Since 2.8, background images are tied to cameras (in 2.79 these were
tied to a View3D I think).
Code in `BKE_library_id_can_use_idtype` wasnt taking this relation
between `Camera` and `Image` into account, thus leading to ID deletion/
unlinking not working properly -- in particular `libblock_remap_data`
not doing its thing (and leaving the camera as a user of the image),
then things went downhill from there...

Now make the "Camera-can-use-an-Image" relation clear in
`BKE_library_id_can_use_idtype`.

Maniphest Tasks: T94544

Differential Revision: https://developer.blender.org/D13722
2022-01-15 15:34:53 +08:00
074795674f Fix T94599: Assert on usercount when deleting image created via operator.
`IMAGE_OT_new` operator would not properly clear the by-default one user
generated by 'new id' code, in case it could not tie the image to
anything.
2022-01-15 15:34:53 +08:00
Manuel Castilla
c365d81556 Fix T90830: Crop node cropping is one pixel short
Currently the crop higher limits are inclusive too which contradicts
the documentation as it says that if Left and Right are both 50, it
will result in a zero-sized image. And the result is one pixel out of
the crop gizmo, which is another hint that this is not intended.

In "Full Frame" experimental mode it's two pixels short because of
a misuse of `BLI_rcti_isect_pt` as it considers max limits inclusive.

Reviewed By: jbakker

Maniphest Tasks: T90830

Differential Revision: https://developer.blender.org/D12786
2022-01-15 15:34:53 +08:00
Aidan Davey
59e1216677 Fix T91160 - Movie Clip Editor - frame indicator/controller is not displayed
The frame indicator/controller is not displayed when in the Graph or Dopesheet view of the Movie Clip Editor

To solve this we could call the function ED_time_scrub_draw_current_frame in clip_draw_dopesheet_main and graph_region_draw in space_clip.c

Reviewed By: jbakker

Maniphest Tasks: T91160

Differential Revision: https://developer.blender.org/D12659
2022-01-15 15:34:53 +08:00
Aaron Carlisle
fc2b102502 Shader Nodes: Unity Build
Enable unity builds for  `bf_nodes_shader`, gives about a 2.7x speedup
of total compile times when just building `bf_nodes_shader`.
On my machine, this equates to saving about 30 seconds.

Differential Revision: https://developer.blender.org/D13720
2022-01-15 15:34:53 +08:00
3db8e3b398 Cleanup: Move node storage macro inside file namespace
Must have been a mistake in previous commits,
this fix is needed to enable unity builds.
2022-01-15 15:34:53 +08:00
ec1eb493fe Fix soft light blend mode math
Function `blend_color_softlight_float` used math different to compositor and
produced result that had abrupt value changes.

Use math based on modified screen blend mode as compositor does.
2022-01-15 15:34:53 +08:00
df512ee3ab Fix out of range color in blend modes
Result of Exclusion and Pin Light blend modes could be greater than 255
which caused artifacts. Limit color value to 0-255 range.
2022-01-15 15:34:53 +08:00
Aaron Carlisle
2642319c25 Cleanup: Remove bNodeType flag from base registration functions
This flag is only used a few small cases, so instead
of setting the flag for every node only set the
required flag for the nodes that require it.

Mostly the flag is used to set `ntype.flag = NODE_PREVIEW`
For nodes that should have previews by default which
is only some compositor nodes and some texture nodes.

The frame node also sets the `NODE_BACKGROUND` flag.

All other nodes were setting a flag of 0 which has no purpose.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13699
2022-01-15 15:34:53 +08:00
f7a6dcc495 BLI: Add slice method to MutableSpan
Span had a slice method with an IndexRange argument, but MutableSpan
did not, yet. This commit makes the two types consistent.
2022-01-15 15:34:52 +08:00
9b4e8856dc Cleanup: Clang tidy 2022-01-15 15:34:52 +08:00
92afe6f2c7 Add a new C++ version of an exporter for the Wavefront .obj format.
This was originally written by Ankit Meel as a GSoC 2020 project.
Howard Trickey added some tests and made some corrections/modifications.
See D13046 for more details.

This commit inserts a new menu item into the export menu called
"Wavefront OBJ (.obj) - New".
For now the old Python exporter remains in the menu, along with
the Python importer, but we plan to remove it soon (leaving the
old addon bundled with Blender but not enabled by default).
2022-01-15 15:34:52 +08:00
8fa48f2d17 Fix T94581: Incorrect geometry delete behavior with instances
Compare the start of the range to zero to figure out whether the
indices for the instances to keep starts at zero. Also rename the
selection argument, since it made it seem like the selected indices
should be removed rather than kept.
2022-01-15 15:34:52 +08:00
fae24bd10d Fix T94316: Asset catalog tree scrolls away when renaming a catalog
The activation of the text button is a bit special, since it happens during
drawing, the layout isn't computed yet then. Comparable cases where the button
is added on top don't use the layout system, so this didn't become an issue
until now. Trigger a delayed call to `UI_but_ensure_in_view()`.
2022-01-15 15:34:52 +08:00
68ce561d0b Fix T94594: Incorrect spreadsheet data set region type in old files
This completes 1a721c5dbe by versioning old files to correct the
region type. The "tools" region type is relatively standard for this type
of region and doesn't require any changes to the theme, unlike
the "nav bar" type, which would have been a reasonable choice.
2022-01-15 15:34:52 +08:00
2d7023912f Geometry Nodes: Edge Angle Node
Calculates the angle in radians between two faces that meet at an edge.
0 to PI in either direction with flat being 0 and folded over on itself PI.
If there are not 2 faces on the edge, the angle will be 0.

For valid edges, the angle is the same as the 'edge angle' overlay.

For the Face and Point domain, the node uses simple interpolation to calculate a value.

Differential Revision: https://developer.blender.org/D13366
2022-01-15 15:34:52 +08:00
a847c0fa99 Cleanup: Silence "integer conversion resulted in a change of sign" warning in Cycles kernel code
Occured because "PATH_RAY_SHADOW_CATCHER_BACKGROUND" is expressed as an unsigned
integer, because too large for a signed integer, but the "PathRayFlag" enum type defaulted to a
signed integer still.
2022-01-15 15:34:52 +08:00
d60d666b7d Allow overrides for cloth, collision and force field properties.
Allow overriding simple properties of cloth simulations, colliders
and force fields. Vertex group and shape key selectors in cloth are
still not overridable since they are tied to mesh data.

Force fields have a number of physical fields shared between multiple
RNA fields. Until they are decoupled, they will produce redundant
overrides, and cannot have different hard range limits.

Differential Revision: https://developer.blender.org/D13710
2022-01-15 15:34:52 +08:00
7f2665cdc2 Fix T94392: 3D Cursor surface projection onto hidden geometry
Regression introduced in rB098008f42d8127d9b60717c7059d3c55a3bfada7

Previously the selected geometry was ignored along with the hidden one.

The mentioned commit caused neither the hidden nor the selected one to be ignored.

But hidden geometry needs to be ignored.
2022-01-15 15:34:52 +08:00
6baadfb2dc Depsgraph: Remove object-level visibility from geometry builders
Continuation of the D13404 which finished the design of not having
geometry-level nodes dependent on object-level.

Differential Revision: https://developer.blender.org/D13405
2022-01-15 15:34:52 +08:00
a1588776a1 Cleanup: Unused variable in Cycles code 2022-01-15 15:34:52 +08:00
0df7484939 Fix (unreported) i18n utils failing to create MO files in trunk.
Not really important anymore, since those are not used by Blender, but
better be consistent.
2022-01-15 15:34:52 +08:00
ee17dfce7a Add Georgian to our list of languages.
CC @Tamuna who started the translation for this language.
2022-01-15 15:34:52 +08:00
81772e60b4 Blender font: Add georgian script.
Weirdly enough, our 'mono' font already had it, but not the main one.

Copied from DeJaVu sans font.

CC @Tamuna who started the translation for that language.
2022-01-15 15:34:52 +08:00
ff6f1dbd43 Install_deps: Also cleanup CLANG CMAKE variables
Needed together with LLVM cleanup, otherwise things fail when LLVM gets
updated.
2022-01-15 15:34:52 +08:00
8b1b20372f Cleanup: Renamed to_object_value to to_dictionary_value. 2022-01-15 15:34:52 +08:00
2e100fab61 Cleanup: rename ValueType.Object to ValueType.Dictionary. 2022-01-15 15:34:52 +08:00
44d4c60980 Cleanup: Rename ObjectValue to DictionaryValue (Serialization).
ObjectValue was to confusing as it is the term from JSON.
2022-01-15 15:34:51 +08:00
732c4d9c82 UDIM: Support virtual filenames
This implements the design detailed in T92696 to support virtual
filenames for UDIM textures. Currently, the following 2 substitution
tokens are supported:

| Token | Meaning |
| ----- | ---- |
| <UDIM>   | 1001 + u-tile + v-tile * 10 |
| <UVTILE> | Equivalent to u<u-tile + 1>_v<v-tile + 1> |

Example for u-tile of 3 and v-tile of 1:
filename.<UDIM>_ver0023.png   --> filename.1014_ver0023.png
filename.<UVTILE>_ver0023.png --> filename.u4_v2_ver0023.png

For image loading, the existing workflow is unchanged. A user can select
one or more image files, belonging to one or more UDIM tile sets, and
have Blender load them all as it does today. Now the <UVTILE> format is
"guessed" just as the <UDIM> format was guessed before.

If guessing fails, the user can simply go into the Image Editor and type
the proper substitution in the filename. Once typing is complete,
Blender will reload the files and correctly fill the tiles. This
workflow is new as attempting to fix the guessing in current versions
did not really work, and the user was often stuck with a confusing
situation.

For image saving, the existing workflow is changed slightly. Currently,
when saving, a user has to be sure to type the filename of the first
tile (e.g. filename.1001.png) to save the entire UDIM set. The number
could differ if they start at a different tile etc. This is confusing.
Now, the user should type a filename containing the appropriate
substitution token. By default Blender will fill in a default name using
the <UDIM> token but the user is free to save out images using <UVTILE>
if they wish.

Differential Revision: https://developer.blender.org/D13057
2022-01-15 15:34:51 +08:00
Aaron Carlisle
f891682ac6 Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2022-01-15 15:34:51 +08:00
0cae4522f0 Geometry Nodes: add field node type for constants
It is common to have fields that contain a constant value. Before this
commit, such constants were represented by operation nodes which
don't have inputs. Having a special node type for constants makes
working with them a bit cheaper.

It also allows skipping some unnecessary processing when evaluating
fields, because constant fields can be detected more easily.

This commit also generalizes the concept of field node types a bit.
2022-01-15 15:34:51 +08:00
a44b637383 Geometry Nodes: small refactor towards supporting partially lazy nodes
Currently, a node either supports lazyness during execution (like the Switch
node), or it doesn't. If it does support lazyness, then every input is computed
lazily. However, usually not all inputs actually have to be computed lazily.
E.g. the boolean switch input is always required, while the other inputs
should be computed lazily.

Better support for such sockets  can avoid unnecessary round trips through
the node execution function.
2022-01-15 15:34:51 +08:00
Charlie Jolly
fae5dfab70 Nodes: Add Compare node operations to link drag search menu
Exposes compare operations via rna emums.
This uses the rna enum to build the search list using
named operations linked to socket A.
This also weights the Math Node comparison operations lower
for geometry node trees.

Differential Revision: https://developer.blender.org/D13695
2022-01-15 15:34:51 +08:00
84bdb1486b LineArt: Correct collection intersection mask logic.
The logic used to be:

"if collection doesn't have child collection, check if ob is from this one"

The correct logic should be:

"if collection child does not have this ob, then check this collection".
2022-01-15 15:34:51 +08:00
7692b39c67 Fix T94464: video texture is not refreshing
In the past that worked because the `GPUMaterial` referenced the
`ImageUser` from the image node. However, that design was incompatible
with the recent node tree update refactor (rB7e712b2d6a0d257d272e).
Also, in general it is a bad idea to have references between data that is
owned by two different data blocks.

This incompatibility was resolved by copying the image user from the node
to the `GPUMaterial` (rB28df0107d4a8). Unfortunately, eevee depended
on this reference, because the image user on the node was update when the
frame changed. Because the image user was copied, the image user in the
`GPUMaterial` did not receive the frame update anymore.

This frame update is added back by this commit. The main change is that
the image user iterator now also iterates over image users in `GPUMaterial`s
on material and world data blocks. An issue is that these materials don't
exist on the original data blocks and that caused the check in
`build_animation_images` in the depsgraph to give the wrong answer.
Therefore the check is extended.

Right now the check is not optimal, because it results in more depsgraph
nodes than are necessary. This can be improved when it becomes cheaper
to check if a node tree contains any references to a video texture.
The node tree update refactor mentioned before makes it much easier
to construct this kind of run-time data from the bottom up, instead of
scanning the entire node tree recursively every time some information
is needed.
2022-01-15 15:34:51 +08:00
f10335bf29 Cleanup: Silence warning for wrong const char comparison
Incorrectly used comparison for empty string.

Reported in chat by @jacqueslucke.
2022-01-15 15:34:51 +08:00
5698a8aba0 Fix T94416: incorrect handling when nodes are linked in a loop
This just skips the entire algorithm when there are cycles.
In the future, cycles could be handled more gracefully in the
algorithm, but for now that's not worth it and is not necessary
to fix the bug.
2022-01-15 15:34:51 +08:00
Charlie Jolly
2d8cfb1348 Nodes: Weight drag link search for Math nodes
As @hooglyboogly suggested in D13680, this patch adds weighting
to the search results. Dragging from a vector/rgba socket weights
the Vector Math node higher than a float Math node, and vice versa.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13691
2022-01-15 15:34:51 +08:00
e37548910d Fix (unreported): remove menu separators from drag link search
Search was picking up the menu separator entries.
Add check for these which are defined by empty identifier strings.
2022-01-15 15:34:51 +08:00
c0b1faffd6 Cleanup: Use switch to get gpu shader name
Rather than using the array syntax that doesnt work in C++,
use a switch state which is also much easier to read.
2022-01-15 15:34:51 +08:00
b4e5985efb Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2022-01-15 15:34:51 +08:00
c6cb1565d5 Fix T93868: GPencil material filter does not work with instances
When the material is used in several objects, the filter by material is not working as expected because the internal pointers are different due eval version.

Now, the original version of the material is compared to keep same address.
2022-01-15 15:34:51 +08:00
Shen Ciao
44843037db Fix T93134: Set origin broken for curve edit mode
Bug: Set Origin causes unexpected offset on Grease Pencil strokes when Curve Editing is enabled.
Fix: Add transformation of editcurve points in `object_origin_set_exec`.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T93134

Differential Revision: https://developer.blender.org/D13273
2022-01-15 15:34:51 +08:00
f8889e0dd9 Fix T93163: GPencil scale thickness fails in negative scales
Before the negative scales produced a thickness invalid. Now, the value is used in absolute value to avoid this situation.
2022-01-15 15:34:51 +08:00
142d1fb73d Nodes: Improve link drag search for Math and Vector Math nodes
Exposes math operations via rna emums.

This uses the rna enum to build the search list.

Differential Revision: https://developer.blender.org/D13680
2022-01-15 15:34:51 +08:00
70b54c2cf1 Point Cloud: Optimize bounding box calculation
This is analagous to 6a71b2af66 which did the same
thing for mesh data. Two differences are that here the coordinates
are simply `float3`, and we account for the radius if it's available.
Here I observed a similar performance increase, from 50ms
average to 10ms average, with 16 million points, a 5x speedup.

The calculation is about 1.4 times faster when no radius is used, down
 to 7.3ms average. Before, the calculation was only 1.2 times faster.
2022-01-15 15:34:51 +08:00
b1697ff76c Cleanup: clang-tidy modernize-redundant-void-arg 2022-01-15 15:34:51 +08:00
e6b4aaa64f Nodes: Convert shader, texture category nodes to c++
Also add/correct file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13688
2022-01-15 15:34:51 +08:00
882a89bed3 Fix T94454: Python API curve to mesh use after free without depsgraph
This was caused by a mistake in eb0eb54d96, which removed
the clearing of the curve edit mode pointers that are set when creating
the temporary data for the conversion. If they are not cleared, the
generic ID free function will also free the edit mode data, which is
wrong when the source curve is in edit mode.
2022-01-15 15:34:51 +08:00
f59669fe94 Modifiers: decrease maximum allocation size for Weld vertices
At the time of allocating the buffer with vertices in context, we don't
know exactly how many vertices are affected, but we do know that it is
less than or equal to twice the number of vertices killed.
2022-01-15 15:34:51 +08:00
56690ce692 Fix (unreported): missing relations update after adding scene time node
This just moves the relations update to a lower level function that is used
by other functions. Eventually, the special case for this node should be
generalized.
2022-01-15 15:34:51 +08:00
ac9816145b Cleanup: Remove unused DerivedMesh functions 2022-01-15 15:34:50 +08:00
dda5a3e475 Geometry Nodes: Support instances in the delete geometry node
Ever since the instance domain was added, this was exposed, it just
didn't do anything. This patch implements the instances domain in the
delete and separate geometry nodes, where it acts on the top-level
instances.

We act on a mutable instances input, with the idea that eventually
copy on write attribute layers will make this less expensive. It also
allows us to keep the instance references in place and to do less
work in some situations.

Ref T93554

Differential Revision: https://developer.blender.org/D13565
2022-01-15 15:34:50 +08:00
3b7b3cb99a Geometry Nodes: Accumulate Fields Node
This function node creates a running total of a given Vector, Float, or
Int field.

Inputs:
  - Value: The field to be accumulated
  - Group Index: The values of this input are used to aggregate the input
    into separate 'bins', creating multiple accumulations.
Outputs:
  - Leading and Trailing: Returns the running totals starting
   at either the first value of each accumulations or 0 respectively.
  - Total: Returns the total accumulation at all positions of the field.

There's currently plenty of duplicate work happening when multiple outputs
are used that could be optimized by a future refactor to field inputs.

Differential Revision: https://developer.blender.org/D12743
2022-01-15 15:34:50 +08:00
d6c73a3de7 Fix: Issues with attribute comparison in geometry nodes tests
A few typos in 17770192fb lead to an incorrect count of custom
data layers in the test meshes. We only want to consider layers that are
not anonymous, and there was a copy and paste mistake.
2022-01-15 15:34:50 +08:00
5ecbd0dca9 Nodes: Composite: UI fixes to time node
- Use default size consistent with other curve nodes
- Use column instead of row for properties
2022-01-15 15:34:50 +08:00
Germano Cavalcante
c49d81f5a8 Fix T94113: Local view + Geometry Nodes is broken for instances
`GeometrySet::compute_boundbox_without_instances` may not initialize min
max in some cases such as meshes without vertices.

This can result in a Bounding Box with impossible dimensions
(min=FLT_MAX, max=-FLT_MAX).

So repeat the same solution seen in `BKE_object_boundbox_calc_from_mesh`
and set boundbox values to zero.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13664
2022-01-15 15:34:50 +08:00
db424947cb Cleanup: Remove dead code 2022-01-15 15:34:50 +08:00
Aaron Carlisle
b67c4cb25b Nodes: Cleanup: Remove no op registration functions
All these function paramaters are set to NULL so they arent necessary.

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13686
2022-01-15 15:34:50 +08:00
Germano Cavalcante
2a66645409 gpu.types.GPUOffScreen: accept format argument for color texture
Some projects need more than 8-bit RGBA off-screen, so add the ability to
accept color format and defaults to RGBA8 so existing code should not be
affected.

Currently supported formats:
- RGBA8 (default)
- RGBA16
- RGBA16F
- RGBA32F

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D13650
2022-01-15 15:34:50 +08:00
d30a3b322c Fix: VSE colormix blend factor not working
Blend factor was used to adjust alpha of background image, which is not
correct. This was done in fdee84fd56 where another change was, that
background alpha is copied into result, which is correct.

Apply blend factor to foreground image alpha channel.
2022-01-15 15:34:50 +08:00
d117b87963 Fix T94422: Shading/Normals break on array modifier caps
The array modifier does not necessarily tag normals dirty.
If it doesnt, normals are recalculated "internally" using the offset ob
transform. This was happening for the array items, but not for the caps.

Now do the same thing for caps.

Maniphest Tasks: T94422

Differential Revision: https://developer.blender.org/D13681
2022-01-15 15:34:50 +08:00
52988a1e5f Fix T94453: Weld modifier crash after recent cleanup
I had assumed that the span's size was the same as the length variable.
In the future, separate lengths could be removed in favor of using
lengths directly from spans.
2022-01-15 15:34:50 +08:00
8f2645a249 Nodes: Convert shader, shader category nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13684
2022-01-15 15:34:50 +08:00
406cc0a6fb Cleanup: clang-tidy
Fixes two instances of `-Wunused-but-set-variable`

There are several more of these but these were low hanging
and noisy with one being in a header functions.
2022-01-15 15:34:50 +08:00
f9b2c60fed Cleanup: clang-tidy
- modernize-deprecated-headers
- modernize-redundant-void-arg

Missed in rB11ac276caaa6e6d42176452526af97cf972abb5f
2022-01-15 15:34:50 +08:00
42d57a52a7 Cleanup: Remove unused node tree "local sync" functions 2022-01-15 15:34:50 +08:00
fff5f391b7 Cleanup: Use indices instead of pointers
This improves code readability.

Take the opportunity and improve the comments too.
2022-01-15 15:34:50 +08:00
1807a724c9 Cleanup: Return early, organize variable declarations 2022-01-15 15:34:50 +08:00
c8734a4f1f Nodes: Enable unity build for function nodes
Unity build saves 5 seconds off the total build time when compiling `bf_nodes_function`.
Total build times went from 25s to 20s (20% reduction),
tested with ninja on linux running i5 8250U.
2022-01-15 15:34:50 +08:00
Aaron Carlisle
0acda17cda Nodes: Add bf_nodes_function module
In the future this will be used to support unity builds for function nodes

Differential Revision: https://developer.blender.org/D13682
2022-01-15 15:34:50 +08:00
62227c7985 Nodes: Split shader color ramp into its own file 2022-01-15 15:34:50 +08:00
25e41213f0 Nodes: Declare function nodes in individual file namespace
To be used in the future to support unity builds
2022-01-15 15:34:50 +08:00
358addfcb5 Fix: Duplicate link search entries for attribute statistic node
Using the output declarations is incorrect because there is a
declaration for each type. Instead loop over the names directly,
since it will make it easier to add an integer mode that only
supports some of the outputs.
2022-01-15 15:34:50 +08:00
1a1709aff9 Fix T94442: Trim curve node can crash with duplicate point
The calculation to find the factor between two evaluated points assumed
that the points were not at the same location. This assumption is some-
what reasonable, since we might expect `lower_bound` to skip those
point anyway. However, the report found a case where the first two
evaluated points were coincident, and there is no strong reason not
to make this safe, so add a check for 0 length before the division.
2022-01-15 15:34:50 +08:00
02268833c6 GPencil: Avoid crashes calling from python
This is part of T94439
2022-01-15 15:34:50 +08:00
42bccef120 Nodes: Add bf_nodes_composite module
In the future this will be used to support unity builds for composite nodes

Differential Revision: https://developer.blender.org/D13678
2022-01-15 15:34:50 +08:00
4f07fab578 Fix T94380: Scrolling zooms in spreadsheet data set region
The region used to be type "Channels", but the standard for this
type is "Tools", which is what the file browser uses. This follows
the changes in rB01df48a98394, which also make the region more
"standard."
2022-01-15 15:34:50 +08:00
ff66d6947d Cleanup: Loops in VSE effect processing
Some effect functions looped over alternating lines, previously with
different factors. Since only one factor is used, code can be
simplified by looping all lines in one for loop.

There should be no functional changes.
2022-01-15 15:34:50 +08:00
1c7f592be9 Fix T94439: Some GPencil operators crash when calling from console
This fix avoid the segment fault for several operators.
2022-01-15 15:34:50 +08:00
b52ed5918f LibOverride: better handling of the "no override of bones' shapes" case.
Also avoid overriding collections of bone shape objects, if possible.
2022-01-15 15:34:50 +08:00
860992fcf8 LibOverride: Tweak RNA 'need resync' detection code.
* Assert about source ID of an overridden pointer property not being a
  liboverride was not necessary, just skip in that case.
* Tag actual 'real' ID owner for resync, and not (potentially) an embedded one.
2022-01-15 15:34:50 +08:00
ec4860a996 Cleanup: Factor in VSE effect processing
2 factor variables were passed to effects, but they were hard coded to
have same value.

Remove duplicate variable from arguments, rename single argument to
`fac`. Inverted factor variables were renamed to `mfac`. Any other
factor related variables are prefixed with `temp_`.

There should be no functional changes.
2022-01-15 15:34:50 +08:00
35f36deefe Fix loss of cloth disk cache on reload in library overrides.
If the override system creates an override record for the cache
name (no idea why though), it trashes the disk cache on file load.

The reason is that it tries to rename cache files in update handler
when assigning the name, and BLI_rename deletes the target file even
if both names are the same.

This is a safe fix that simply aborts the pointless rename attempt.

Differential Revision: https://developer.blender.org/D13679
2022-01-15 15:34:50 +08:00
b45895af4d Fix T94408: missing sockets after adding node group 2022-01-15 15:34:50 +08:00
780a0e7074 Fix compile error when building without OpenSubDiv
Stubs were missing for functions added to opensubdiv_evaluator_capi.h
2022-01-15 15:34:50 +08:00
12023d5ec4 Fix T94420: deadlock with subsurf modifiers
The deadlock was caused as the lock on the Mesh mutex used to compute
the subdivision wrapper was not released in some early exits of the
function.
2022-01-15 15:34:50 +08:00
1a7b0fb28a Cleanup: clang format 2022-01-15 15:34:15 +08:00
8cd6fec611 Nodes: Declare shader nodes in individual file namespace
To be used in the future to support unity builds
2022-01-15 15:34:15 +08:00
5c829279b7 GPencil: Fix error in previous Cleanup 2022-01-15 15:34:15 +08:00
dd7b219dce Cleanup: Use vector function 2022-01-15 15:34:15 +08:00
43fffb8757 Cleanup: Store cursor location in tGPspoint as an array
Fixes many instances of `-Wstringop-overread` warning on GCC 11

Differential Revision: https://developer.blender.org/D13672
2022-01-15 15:34:15 +08:00
07ea40f140 Cleanup: clang tidy
Use c++ headers; use nullptr; redundant `void` in parameter list;
inconsistent parameter name.
2022-01-15 15:34:15 +08:00
60d303dcc3 Render: move editor/render module to c++
Doing this in preparation for some work on asset preview generation.

Differential Revision: https://developer.blender.org/D13676
2022-01-15 15:34:15 +08:00
3e868f0813 Fix T93941: geometry proximity breaks with high resolution mesh
The calls to `.fill` were overwriting indices that are processed by
other threads.
2022-01-15 15:34:15 +08:00
6a3a37342f OpenSubDiv: add support for an OpenGL evaluator
This evaluator is used in order to evaluate subdivision at render time, allowing for
faster renders of meshes with a subdivision surface modifier placed at the last
position in the modifier list.

When evaluating the subsurf modifier, we detect whether we can delegate evaluation
to the draw code. If so, the subdivision is first evaluated on the GPU using our own
custom evaluator (only the coarse data needs to be initially sent to the GPU), then,
buffers for the final `MeshBufferCache` are filled on the GPU using a set of
compute shaders. However, some buffers are still filled on the CPU side, if doing so
on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose
logic is hardly GPU compatible).

This is done at the mesh buffer extraction level so that the result can be readily used
in the various OpenGL engines, without having to write custom geometry or tesselation
shaders.

We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in
order to control the data layout, and interpolation. For example, we store vertex colors
as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float
types.

In order to still access the modified geometry on the CPU side, for use in modifiers
or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`.
Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will
create such a wrapper if possible. If the final subdivision surface is not needed on
the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used.

Enabling or disabling GPU subdivision can be done through the user preferences (under
Viewport -> Subdivision).

See patch description for benchmarks.

Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport

Differential Revision: https://developer.blender.org/D12406
2022-01-15 15:34:15 +08:00
04bdd8fa70 Nodes: Support linking to existing group input from link drag search.
Before one could only create a new group input using the link drag search.
With this patch it becomes possible to create a Group Input node for an
existing input.

Differential Revision: https://developer.blender.org/D13674
2022-01-15 15:34:15 +08:00
18f5dbdc8d BLI: add utility to check if type is any specific type
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.

Differential Revision: https://developer.blender.org/D13673
2022-01-15 15:34:15 +08:00
cd5a9c5421 Allocator: add missing include
The placement-new operator requires `#include <new>`.
It is used in `MEM_new`.
2022-01-15 15:34:15 +08:00
9f06041524 LineArt: Correct handling out of bound isect index
Handles rare cases where line doesn't intersect the triangle correctly.
2022-01-15 15:34:14 +08:00
d88f22ce0d Revert "LineArt: Intersection function additional clamping"
This reverts commit e2166dc217.
2022-01-15 15:34:14 +08:00
53f2fa1fa9 LineArt: Intersection function additional clamping
To handle a rare case where it leads to a -1 index in isect order lookup
2022-01-15 15:34:14 +08:00
e3bcdd15df LineArt: Protecting bounding area links.
In case they overflowed the bounding area maximum link count,
Protect the link array so it doesn't crash.
2022-01-15 15:34:14 +08:00
6df327d648 Cleanup: Use array for BKE cursor functions
Missed this function in rB67525b88d2e
2022-01-15 15:32:49 +08:00
4523bc5d76 Cleanup: Fix compile warning
Own mistake in rB67525b88d2e
2022-01-15 15:32:49 +08:00
88845216a9 Fix T94387: Mesh sequence cache, crash when clicking a panel
The crash happens when opening a panel (added in rB43f5e761a66e87fed664a199cda867639f8daf3e)
when no CacheFile is set in the modifier.

To fix this, check that the CacheFile pointer is not null before attempting to draw anything.
2022-01-15 15:32:49 +08:00
1a6f0ca109 Docs: Add to and cleanup attribute API docs
Most of the comment block is similar to the text in the source
code documentation wiki. It's helpful to have some text in
a header file too, so it's closer for programmers already looking
at the code.

This also uses more consistent syntax and wording in the comments
about the attribute API in `GeometryComponent`.

Ref T93753

Differential Revision: https://developer.blender.org/D13661
2022-01-15 15:32:49 +08:00
ccfa873efa Cleanup: Use more common variable name
It's preferred to use `area` as a name for `ScrArea` variables.
2022-01-15 15:32:49 +08:00
bbd5fdb098 Cleanup: Move customdata.c to C++
Differential Revision: https://developer.blender.org/D13666
2022-01-15 15:32:49 +08:00
Christoph Lendenfeld
f861b6d8fc Breakdown Implementation
This patch adds the breakdown (or tween) functionality to the graph editor.

The factor defines the linear interpolation from left key to right key.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9375
Ref: D9375
2022-01-15 15:32:49 +08:00
Aaron Carlisle
537207e3e4 Shader Nodes: Convert bump node to use new socket builder
This node is a bit special in that it uses two internal sockets
for a hack for Eevee; see rBffd5e1e6acd296a187e7af016f9d7f8a9f209f87

As a result, the `SOCK_UNAVAIL` flag is exposed to socket builder API.

Reviewed By: JacquesLucke, fclem

Differential Revision: https://developer.blender.org/D13496
2022-01-15 15:32:49 +08:00
Aaron Carlisle
cc3c19a3ca Cleanup: use new c++ guarded allocator API in nodes
Also simplify the allocation name to `__func__`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13665
2022-01-15 15:32:49 +08:00
Christoph Lendenfeld
f43b1bd152 Blend To Neighbor Implementation
This patch adds the blend to neighbor operator to the Graph editor.

The operator acts like the blend to neighbor operator for a pose context, just working on keyframes.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9374
Ref: D9374
2022-01-15 15:32:49 +08:00
6d99d3d877 Fix T94375: Python error when trying to add Grease Pencil brush preset
The prop name was wrong.
2022-01-15 15:32:49 +08:00
f1ece8e4d3 Fix T94362: GPUMaterialTexture references freed ImageUser
The issue was caused by rB7e712b2d6a0d257d272ed35622b41d06274af8df
and the fact that `GPUMaterialTexture` contains an `ImageUser *` which
references the `ImageUser` on e.g. `NodeTexImage`.

Since the node tree update refactor, it is possible that the node tree changes
without changing the actual material. Therefore, either the renderer should
check if the node tree has changed or it should not store pointers to data in
node storage. The latter approach is implemented in this patch.

Differential Revision: https://developer.blender.org/D13663
2022-01-15 15:32:49 +08:00
6f7de86b62 Cleanup: Do not use magic number 2022-01-15 15:32:49 +08:00
b3be9bed6e Cleanup: Use array for BKE cursor functions
Differential Revision: https://developer.blender.org/D12962
2022-01-15 15:32:49 +08:00
334119a800 Update RNA to user manual mapping file 2022-01-15 15:32:49 +08:00
159c429a20 Cleanup: Define node tree icon in register function
I suppose this was done to reduce then dependencies.
However, most nodes already depend on UI code so this isnt too useful.
2022-01-15 15:32:49 +08:00
b8ee981ef0 Cleanup: use new c++ guarded allocator API
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
2022-01-15 15:32:49 +08:00
d60c339118 Cleanup: Use consistent order for custom data mesh masks
Loops come last in the struct's definition, use the same order when
initializing the common masks in customdata.c (they were switched
with the poly masks).
2022-01-15 15:32:49 +08:00
b7db8fb0b9 Nodes: Migrate bump shader node to cpp
Needed for D13496
2022-01-15 15:32:49 +08:00
dd68a22370 Cleanup: Remove misleading comments
Most of these custom data layers weren't BMesh only, and the
one that actually looks to be BMesh only has `BM` in its name.
2022-01-15 15:32:49 +08:00
c5fa3e142c Cleanup: Use vector instead of linked list 2022-01-15 15:32:49 +08:00
71c897d577 Fix T94322: add missing updates after recent refactor
This was a regression in rB7e712b2d6a0d257d272ed35622b41d06274af8df.
2022-01-15 15:32:48 +08:00
c99dc4d3ea Fix T94162: incorrect handling when there are multiple group outputs
Typically a node group should only have a single Group Output node.
However, currently Blender already supports having multiple group outputs,
one of which is active. This wasn't handled correctly by geometry nodes.

Differential Revision: https://developer.blender.org/D13611
2022-01-15 15:32:48 +08:00
57d2e064ab Cleanup: remove unused button function
rB05f900e3466b45a19e13bea6dd641e4f7b8b46e9 removed unused button functions,
but since that commit the `uiDefIconTextButBit()` static function sits
unused as well. It's now been removed.
2022-01-15 15:32:48 +08:00
0e84cb1d7e Fix T94357: Node Ungroup operator copies current node tree
This was a mistake in rBfdc4a1a590d8befb1ff which copied the parent
node tree into itself rather than accessing the node group's nodes.
2022-01-15 15:32:48 +08:00
ab342083c1 Fix T94344: Incorrect size for edge vertices node output
This looks like a copy and paste error from the original commit.
The virtual array output used the number of mesh polygons instead
of the number of edges.
2022-01-15 15:32:48 +08:00
5d9e03589b Cleanup: Remove outdated comment
After rB01df48a983944ab3f8a, this comment no longer applies.
2022-01-15 15:32:48 +08:00
10d726186c Cleanup: Move hair object type files to C++
Differential Revision: https://developer.blender.org/D13657
2022-01-15 15:32:48 +08:00
224c325493 Cleanup: Remove unused UI button definition functions
These were part of the older buttons API that shouldn't be used in
more places at this point. Most layouts should be built with the regular
layout system API and RNA properties. This sort of button can still be
created though, since these were just shortcuts anyway.
2022-01-15 15:32:48 +08:00
9e3f0d83b5 Cache File: use panels to organize UI
This adds interface panels to organize the Cache File UI parameters for
modifiers and constraints into related components: velocity, time, and
render procedural.

Properties relating to the three aforementioned components are separated
from `uiTemplateCacheFile` into their own functions (e.g.
`uiTemplateCacheFileVelocity` for the velocity one), which are in turn
called from the specific panel creation routines of the modifiers and
constraints (for constraints, the functions are exposed to the RNA).

`uiTemplateCacheFile` now only shows the properties for the file path,
and in the case of constraints, the scale property.

The properties that are only defined per modifier (like the velocity
scale), are shown in the proper modifier layout panel if applicable.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13652
2022-01-15 15:32:48 +08:00
Christoph Lendenfeld
dd75aee780 Graph Slider Ops: Show error when no valid keys are found
When using graph slider operators like D9374
it showed a warning when no keys were selected.
However since that stops the modal operation it should be an Error.
Also the message was misleading
since it could error for different reasons than stated.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13655
Ref: D13655
2022-01-15 15:32:48 +08:00
d677731db0 Avoid exception when no weight paint settings exist
Just an extra check for `None` before accessing its properties.
2022-01-15 15:32:48 +08:00
309d3481ef Cleanup: remove BKE_animdata_driver_path_hack
The `BKE_animdata_driver_path_hack()` function has had almost no effect
since rB51b796ff1528, and basically boils down to:

```
return base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop);
```

Since `base_path` was `NULL` in the majority of cases, it's just been
replaced by a direct call to `RNA_path_from_ID_to_property()`. The
conditional now just appears in one remaining case.

This relates to T91387.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13646
2022-01-15 15:32:48 +08:00
653de37483 LibOverride: protect better against using on complex inter-dependency cases.
Do not allow 3DView operator to run on the liboverride of an
instantiating Empty object. And tweak behavior in the Outliner
operations too.

Related to T94226.

Note that this remains fairly exotic, bad idea not recommended cases,
such complex inter-dependencies between different libraries inside a
same liboverride hierarchy is just not possible to handle properly.
2022-01-15 15:32:48 +08:00
3dd3144280 Fix missing type declaration compile error
rBbd3bd776c893 broke compilation here due to missing type declaration
for basic types as the source file is not including this header. In any
case, it is the responsibility of header files to include headers for
types used by value in function parameters or struct definitions.
2022-01-15 15:32:48 +08:00
327193dbf4 Cleanup: typo in comment 2022-01-15 15:32:48 +08:00
55b6b60286 Fix: Curve trim node test failure
Caused by 60c59d7d61. The position wasn't copied into the correct
place on each spline. Somehow I didn't catch that in the tests I ran.
2022-01-15 15:32:48 +08:00
1b37862eda Fix T94232: No selection with set material node empty material list
If the input mesh had no materials already, the new material would
become the only material on the mesh, meaning the material was
added to all of the faces, instead of just the selected faces.

The mesh primitive nodes in geometry nodes already add an empty
slot by default, so this only affects outside geometry.

The fix is just adding an empty slot before the new slot, so the
non-selected material indices can still point to an empty slot.

Differential Revision: https://developer.blender.org/D13654
2022-01-15 15:32:48 +08:00
341c735e76 Cleanup: Remove spline add_point method, refactor mesh to curve node
It's better to calculate the size of a spline before creating it, and this
should simplify refactoring to a data structure that stores all point
attribute contiguously (see T94193). The mesh to curve conversion is
simplified slightly now, it creates the curve output after gathering all
of the result vertex indices. This should be more efficient too, since
it only grows an index vector for each spline, not a whole spline.
2022-01-15 15:32:48 +08:00
531e4e58a5 Nodes: Add link drag search support for map range node
Previously only the float version of the node was connected to.
This adds connection operations for vector sockets, and exposes
the "Steps" socket properly when it's selected.
2022-01-15 15:32:48 +08:00
a7a2805ef7 Cleanup: Return early 2022-01-15 15:32:48 +08:00
e9262b6a04 Fix: Extra space at the front of "Sample Curve" node name 2022-01-15 15:32:48 +08:00
890f322013 Fix: Wrong node link drag search menu items for attribute statistic
Caused by capturing local variables by reference in a function that
outlives the scope it was created in. Also use a more generic function
for the first two inputs.
2022-01-15 15:32:48 +08:00
6aed81e124 Fix: Potential use after scope in curve to mesh node
I don't think this has been visible, since I only ran into it after
changing other code that affected this. However, some attributes
can keep a reference to the source component to use when tagging
caches dirty (like the position attribute tagging the normals dirty).
Here, the component was created inside a function, then the attributes
were used afterwards.

Also add some comments warning about this in the header file.
2022-01-15 15:32:48 +08:00
Michael
510532f482 Fix: Large stack allocation in compositor
When COM_EXPORT_GRAPHVIZ is enabled, DebugInfo::graphviz
uses a char[1000000] as local variable. When this function
is called this is allocated on the stack, which has a size
of just 1MB on mac and may cause a stack overflow.

This patch allocates the memory on the heap and frees
the memory at the end of the function.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13628
2022-01-15 15:32:48 +08:00
0afe33c727 Cleanup: Avoid adding points to splines sequentially
This should be faster because it avoids reallocating the internal
vectors when the size is known beforehand, but it may also help
a potential refactor to a different data structure (see T94193).
2022-01-15 15:32:48 +08:00
2eb1c734fb Fix: Missing update when toggling node mute
Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).

Differential Revision: https://developer.blender.org/D13653
2022-01-15 15:32:48 +08:00
b9c73e94f5 Fix T93408: Snap performance regression at high poll rate
Caused by {rBfba9cd019f21f29bad1a6f3713370c5172dbc97f}.

The snap timer was accidentally modified and damaged.
2022-01-15 15:32:48 +08:00
7887100a6d Nodes: Remove unnecessary node tree socket tagging
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).

Differential Revision: https://developer.blender.org/D13645
2022-01-15 15:32:48 +08:00
9cf6f438fb Mesh: Parallelize bounding box calculation (WIP)
This replaces the single-threaded calculation of mesh min and max
positions with a `parallel_reduce` loop. Since the bounding box
of a mesh is retrieved quite often (at the end of each evaluation,
currently 2(?!) times when leaving edit mode, etc.), this makes for a
quite noticeable speedup actually.

On my Ryzen 3700x and a 4.2 million vertex mesh, I observed
a 4.4x performance increase, from 14 ms to 4.4 ms.

I added some methods to `float3` so they would be inlined, but
they're also a nice addition, since they're used often anyway.

Differential Revision: https://developer.blender.org/D13572
2022-01-15 15:32:48 +08:00
3cc5c19b49 Cleanup: Remove debug print. 2022-01-15 15:32:48 +08:00
7efb6674bb Fix (unreported) potential bug in collections parenting update code.
Own mistake in rB2ef192a55b2c. Did not seem to have any visible effect
though...
2022-01-15 15:32:48 +08:00
eee17fc400 Cleanup: Use LISTBASE_FOREACH_ macros. 2022-01-15 15:32:48 +08:00
2595f04956 Fix T93799: Outliner: Remaping objects could result in duplicates in a collection.
Fix is similar to how CollectionObject with NULL object pointers are handled.

Using one of the 'free' pad bytes in Object_Runtime struct instead of a
gset (or other external way to detect object duplicates), as this is
several times faster.

NOTE: This makes remapping slightly slower again (adds 10 extra seconds
to file case in T94059).

General improvements of remapping time complexity, especially when
remapping a lot of IDs at once, is a separate topic currently
investigated in D13615.
2022-01-15 15:32:48 +08:00
439be4658a Fix part of T93799: Outliner: Remap Users crash (for ID Type Object).
This commit fixes the crash itself, however this can still lead to a
same collection 'owning' the same object several time.

Issue here was a bad assumption in layer resync code, that would lead to
removing valid objects from the viewlayer's `object_bases_hash` in
`BKE_layer_collection_sync`, when deleting no-more-used bases, in case
of bases duplicate.
2022-01-15 15:32:48 +08:00
e595d30dab Fix: Build issue on 32 bit archs
The cast to size_t leads to a build issue on 32
bit archs. cursor_delim_type_utf8 expects an int
so an additional cast to size_t is not required.

Reported by user frispete on devtalk.
2022-01-15 15:32:48 +08:00
9494995237 Fix T93999: GPencil Box tool allows decreasing subdiv, but not increase
The problem was the number of points for each edge of the box was wrong and the wheelmouse effect was anulated.

Also fixed the value displayed in the status bar to keep consistency with subdivision value.

Reviewed By: lichtwerk

Maniphest Tasks: T93999

Differential Revision: https://developer.blender.org/D1363
2022-01-15 15:32:48 +08:00
0afcd8e509 Nodes: Improve node tree copy performance
When copying a full node tree, we can avoid an O(n^2) loop finding a
unique name for every node if we assume they already have unique names.
That is a reasonable assumption, since unique names are verified
elsewhere when adding a new node.

Copying a node tree with about 4000 nodes took 42 ms before,
now it takes 6 ms.

Differential Revision: https://developer.blender.org/D13644
2022-01-15 15:32:48 +08:00
b124d49108 Nodes: Refactor to remove node and socket "new" pointers
These pointers point to the new nodes when duplicating,
and their even used to point to "original" nodes for
"localized" trees. They're just a bad design decision
that make code confusing and buggy.

Instead, node copy functions now optionally add to a map
of old to new socket pointers. The case where the compositor
abused these pointers as "original" pointers are handled
by looking up the string node names.

Differential Revision: https://developer.blender.org/D13518
2022-01-15 15:32:47 +08:00
292c4018fb Geometry Nodes: improve multi socket handling in evaluator
Previously, the values passed to a multi-input socket were stored
in the order that they arrived in. Then, when the values are accessed,
they are sorted depending on the link order.

Now, the ordering is determined in the beginning before execution starts.
Every value is assigned to the right index directly, avoiding the sort
in the end. This makes the ordering more explicit.
2022-01-15 15:32:47 +08:00
a69ea3e809 Fix T94295: VSE fades error when no suitable sequences selected
This errored out in two scenarios:
- current frame not in strips framerange (this was reported)
- no strips selected at all

Now handle these cases properly in the operator and give appropriate
report info.

Maniphest Tasks: T94295

Differential Revision: https://developer.blender.org/D13642
2022-01-15 15:32:47 +08:00
deb586b124 Cleanup: Clang tidy, restore alphabetical sorting 2022-01-15 15:32:47 +08:00
Germano Cavalcante
7c18ceef20 Fix T94191: correct (time) translation headers not showing DeltaX
Caused by {rBb0d9e6797fb8}

For the header (both Graph Editor case in general `headerTranslation` as
well as `headerTimeTranslate`) we are interested in deltas values
(not absolute values).

Since culprit commit, `snapFrameTransform` was not working with deltas
anymore, but we have to compensate for this.

For the Graph Editor, this only worked "by accident" in rB7192e57d63a5,
since `ival` is still zero at this point.

So now, reacquire the delta right after the snap operation.

Also use a more appropriate center value in the translate operator.

Maniphest Tasks: T94191

Differential Revision: https://developer.blender.org/D13641
2022-01-15 15:32:47 +08:00
2e9fbe98cc Cleanup: use BKE_pose_is_layer_visible in more places
This was added in rBd13970de8627, now use in more places.
2022-01-15 15:32:47 +08:00
7d6410605e Nodes: Improve performance when freeing a node tree
This commit makes freeing a node tree about 25 to 30 times faster.
Freeing a node tree happens whenever it is edited. Freeing a node
tree with about 4000 nodes went from 30-50ms to about 2 ms.

This was so slow before because for every node that was freed
when freeing the node tree, `node_free_node` looped over all
other nodes to detach frames, and then looped over all links to
remove any links connected to the node. That was all pointless
work because everything else is about to be freed anyway.

Instead, move that "detaching" behavior to the dedicated function
for removing a single node, and to the "local" version of the free
function to be safe, since I know less about what that version expects.

Differential Revision: https://developer.blender.org/D13636
2022-01-15 15:32:47 +08:00
b489a2d4d2 Fix T93960: Asset Catalogs I/O fails with unicode file paths on Windows
On Windows, encode file paths as UTF-16 before trying to open the file
for reading/writing.

This introduces a new class `blender::fstream`, which wraps
`std::fstream` and provides this UTF-16 encoding. This class should also
be used in other areas, like the Alembic importer/exporter.

Manifest Task: T93960

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13633
2022-01-15 15:32:47 +08:00
6e4f2bbbc2 Assets: log message when catalog definitions cannot be loaded
Log a message (via `CLOG`) when asset catalog definitions cannot be
loaded.

Reviewed by @jacqueslucke in D13633
2022-01-15 15:32:47 +08:00
2ca87fa7ef Nodes: refactor node tree update handling
Goals of this refactor:
* More unified approach to updating everything that needs to be updated
  after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
  algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
  when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
  more centralized update procedure.

The refactor consists of two main parts:
* Node tree tagging and update refactor.
  * Generally, when changes are done to a node tree, it is tagged dirty
    until a global update function is called that updates everything in
    the correct order.
  * The tagging is more fine-grained compared to before, to allow for more
    precise depsgraph update tagging.
* Depsgraph changes.
  * The shading specific depsgraph node for node trees as been removed.
  * Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
    tagged when the output of the node tree changed (e.g. the Group Output
    or Material Output node).
  * The copy-on-write relation from node trees to the data block they are
    embedded in is now non-flushing. This avoids e.g. triggering a material
    update after the shader node tree changed in unrelated ways. Instead
    the material has a flushing relation to the new `NTREE_OUTPUT` node now.
  * The depsgraph no longer reports data block changes through to cycles
    through `Depsgraph.updates` when only the node tree changed in ways
    that do not affect the output.

Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.

Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
  `ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
  This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.

Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.

Differential Revision: https://developer.blender.org/D13246
2022-01-15 15:32:47 +08:00
c1eec2b5af Cleanup: clang format
Missed in rB7c9e4099854a, sorry.
2022-01-15 15:32:47 +08:00
504012162f Fix T92930: Outliner "Show Active" bone fails in certain situations
Outliner would frame the armature object instead of the bone if the bone
was on a hidden armature layer.

Similar to issues reported in e.g. T58068 and T80464, this is due to the
fact that `BKE_pose_channel_active` always checks for the armature layer
(and returns NULL if a bone is not on a visible armature layer).

Now propose to make this layer check **optional** (and e.g. from the
Outliner be more permissive). This also introduces
`BKE_pose_channel_active_if_layer_visible` which just wraps
`BKE_pose_channel_active` with the check being ON.

Maniphest Tasks: T92930

Differential Revision: https://developer.blender.org/D13154
2022-01-15 15:32:47 +08:00
0e36849aab Tests: initialise BKE callbacks before loading blend file
Initialise the BKE callback system in
`BlendfileLoadingBaseTest::SetUpTestCase()`. This allows certain tests
to run in debug mode (when `BLI_assert` is enabled).
2022-01-15 15:32:47 +08:00
c184f1aa3e Fix T93757: Do not force-instantiate indrectly linked objects in linking case. 2022-01-15 15:32:47 +08:00
4aed8ed48e Fix T93839: Copy/Paste of empty instantiating a collection.
Do not also instantiate a collection in the view layer, if it is already
instantiated through an empty object.
2022-01-15 15:32:47 +08:00
01498af35d Fix build error in debug builds from recent commit
r7acd3ad7d8e58b913c5 converted a pointer to a reference,
but an assert still compares the variable to a pointer.
2022-01-15 15:32:47 +08:00
82daa8ae66 Fix T94280: Crash when splitting meta strip
This happens because in `SEQ_time_update_sequence` function
`SEQ_get_meta_by_seqbase` returns uninitialized value. This isn't nice,
but it shouldn't happen in first place. Problem is, that
`SEQ_edit_strip_split` does move strips into detached `ListBase`, so
other functions can't see them anymore. Detached `ListBase` is used
solely to preserve relationships during duplication.

Move strips to original `ListBase` immediately after duplication and
return `NULL` if `SEQ_get_meta_by_seqbase` can't find meta strip.

Splitting itself can still rely on fact, that number of original and
duplicated strips is same and they are placed next to each other in
exactly same order at the end of original `ListBase`.
2022-01-15 15:32:47 +08:00
aa419fdba2 Cleanup: Use span instead of raw pointer
This is a followup to the previous commit.
2022-01-15 15:32:47 +08:00
f1979b317b Cleanup: Use simpler loops in weld modifier
In this commit I changed many loops to range-based for loops.
I also removed some of the redundant iterator variables, using
indexing inside the loop instead. Generally an optimizing compiler
should have no problem doing the smartest thing in that situation,
and this way makes it much easier to tell where data is coming from.

I only changed the loops I was confident about, so there is still more
that could be done in the future.

Differential Revision: https://developer.blender.org/D13637
2022-01-15 15:32:47 +08:00
383237f3e6 Fix T94262: Grease Pencil Blur Effect DoF mode wrong
This was visible outside of camera view and was not respecting the
"Depth of Field" checkbox on the Camera properties.

Now return early if DoF should not be visible.

Maniphest Tasks: T94262

Differential Revision: https://developer.blender.org/D13631
2022-01-15 15:32:47 +08:00
20df2491df Run clang-format 2022-01-15 15:32:47 +08:00
3e270b66f7 Sculpt: split sculpt.c into three files
Sculpt.c is now three files:

* Sculpt.c: main API methods and the brush stroke operator
* Sculpt_brushes.c: Code for individual brushes.
* Sculpt_ops.c: Sculpt operators other than the brush stroke operator.

TODO: split brush stroke operator into a new file (sculpt_stroke.c?).
2022-01-15 15:32:47 +08:00
Wannes Malfait
01a43a850c Fix T94144: Duplicate edges in dual mesh node
The duplicated edges were caused by 'oversubdivided' edges, i.e. edges
where some of the vertices on them are only connected to two polygons.
The fix finds these vertices and 'dissolves' them so that only one edge
is created.

For most 'normal' meshes this shouldn't occurr, or only very little, so
the performance impact of this change should be neglegible. In practice
this is also avoidable by triangulating the mesh first.

Differential Revision: https://developer.blender.org/D13445
2022-01-15 15:32:47 +08:00
cf0fc14e06 Cleanup: Remove mesh valid assertions in debug builds
These are useful for development, but when the primitive nodes
aren't actively changing, the performance cost is not worth it.
2022-01-15 15:32:47 +08:00
Piotr Makal
4402918f7d Fix: Incorrect assert conditions in NURBSpline
This fix provides better conditions for asserts in `NURBSpline::knots`
method accounting for cyclic NURBS curves.

Differential Revision: https://developer.blender.org/D13620
2022-01-15 15:32:47 +08:00
9bf71ee07f Cleanup: Remove unused node type flag
This flag was checked, but not set anywhere.
2022-01-15 15:32:47 +08:00
2ecbca77df Cleanup: Comment formatting in node.cc
Also remove a SCOPED_TIMER I added by mistake in a previous commit.
2022-01-15 15:32:47 +08:00
dcf7612806 Geometry Nodes: Parallelize mesh grid primitive
On a Ryzen 3700x, this ended up 2.5x faster than before. More
benchmarking details are included in the differential revision.

For smaller grids, all this should do is increase the
code size a bit, and add a few more if statements.

Differential Revision: https://developer.blender.org/D13617
2022-01-15 15:32:47 +08:00
74f492125f Cleanup: Remove unused arguments 2022-01-15 15:32:47 +08:00
f1df6d6f7f Update our USD 21.02 patch to support gcc-11
There are two issues in USD code that break building it with gcc-11,
one (in `demangle.cpp`) was already fixed upstream, the other (in
`singularTask.h`) is still pending (reported upstream, see
https://github.com/PixarAnimationStudios/USD/issues/1721).

CC #platforms_builds_tests_devices project.
2022-01-15 15:32:47 +08:00
4258368324 Fix T94251: Cycles wrong pointcloud normal for instanced objects
Refactor code a bit also so we need to do fewer matrix transforms for shader
data setup of points and curves.
2022-01-15 15:32:46 +08:00
bfabaadace Fix Cycles OptiX crash with 3D curves after point cloud changes
Includes refactoring to reduce the number of bits taken by primitive types,
so they more easily fit in the OptiX limit.
2022-01-15 15:32:46 +08:00
Maxime Chambonnet
ddbfc4ad03 install_deps: Fix OIIO and OSL build with OpenEXR
Root path variables for those libraries is now using the 'standard' naming
scheme.

With tweaks/cleanups from @mont29.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13591
2022-01-15 15:32:46 +08:00
0f522d18a0 BLI: fix Vector.prepend declaration
Using `&&` there was a typo. With `&&` the `prepend` method
could not be called with a const reference as argument.
2022-01-15 15:32:46 +08:00
2f641f0c1e Fix T93570: VSE image transforms in preview dont autokey
This was basically not implemented, do this via
`ED_autokeyframe_property` in a new dedicated function in
special_aftertrans_update.

Maniphest Tasks: T93570

Differential Revision: https://developer.blender.org/D13608
2022-01-15 15:32:46 +08:00
1773cc2299 Docs: use doxygen formatting for BLI
Differentiate doc-strings from title/section text.
2022-01-15 15:32:46 +08:00
a5679a3c76 Docs: use doxygen formatting for DNA
Differentiate doc-strings from title/section text.
Also use explicit doxygen references to struct members
so it's not ambiguous which member is being referenced.

Note that these changes aren't complete (some files weren't touched).
2022-01-15 15:32:46 +08:00
e72991c984 Docs: minor correction to doc-string
The text editor no longer accumulates changes.
2022-01-15 15:32:46 +08:00
fb5e9ff6dd Fix T94254: Crash using view_all operator in VSE
Caused by `NULL` dereference in `SEQ_meta_stack_active_get()`.

Check if `Editing` is `NULL` before accessing meta stack.
2022-01-15 15:32:46 +08:00
d02c5abd72 Fix: Meta strip not created with alpha over blend mode
Meta add function wasn't updated. All strips now use alpha over
blending, so set it in `SEQ_sequence_alloc()`.
2022-01-15 15:32:46 +08:00
61cb1bbfed Cleanup: Remove more texture nodes preview handling
Similar to the previous commit, this allowed removing a function to set
a single pixel of a node preview.
2022-01-15 15:32:46 +08:00
b364287fd3 VSE: Clamp sound strip when adding movie strip
When adding multiple movie strips and sound stream is longer than video,
this results in gaps between video strips, which is undesirable.
2022-01-15 15:32:46 +08:00
4a1f3932e8 Cleanup: Remove more no-op node preview code
This is a follow-up to rB43875e8dd1d76ee, removing some
processing of non-existent node previews in the shader and
texture nodes systems.
2022-01-15 15:32:46 +08:00
b33bff66fc Cleanup: Const arguments, remove unused argument 2022-01-15 15:32:46 +08:00
ed275a3c90 Cleanup: Clang tidy lamda function name 2022-01-15 15:32:46 +08:00
69657ace38 Cleanup: Move weld modifier to C++
This moves `MOD_weld.cc` to C++, fixing compiler warnings
coming from the change. It also goes a little bit further and converts
the code to use C++ data structures: `Span`, `Array`, and `Vector`.
This makes the code more shorter and easier to reason about, and
makes memory maneagement more automatic.

Differential Revision: https://developer.blender.org/D13618
2022-01-15 15:32:46 +08:00
a410749459 Fix: Build error from missing include 2022-01-15 15:32:45 +08:00
dff29a7b28 Fix: Link drag search missing field nodes from function nodes
When dragging from the inputs of function nodes, other function
nodes wouldn't connect, because their socket declaration field types
weren't set correctly. Instead, they relied on code properly checking
the *node* declaration's `is_function_node()` method. However,
that increases complexity and requires passing the node instead of
just the socket in more places. Instead, set the proper field types
in the socket declaration during building.

Differential Revision: https://developer.blender.org/D13600
2022-01-15 15:32:45 +08:00
721c023c97 Fix T94173: Missing update for frame node size
Before d56bbfea7b, nodes were updated (size calculated and
buttons added) in reverse order. Instead, now calculate the size of
frame nodes after all other nodes. Separating the drawing further
may be a good step to removing the O(n^2) loop later on.
2022-01-15 15:32:45 +08:00
ce90985904 Cleanup: compiler warnings with clang
Includes use of memcpy to avoid warnings about deprecated members.
2022-01-15 15:32:45 +08:00
274ee6241b Fix T94215: compositer denoise node UI wrongly shows as disabled
After recent refactoring in 4e98d974b5.
2022-01-15 15:32:45 +08:00
5c2b8aa119 GPU: add memory barriers for vertex and index buffers
This adds memory barriers to use with `GPU_memory_barrier` to ensure that
writes to a vertex or index buffer issued before the barrier are
completed after it, so they can be safely read later by another shader.

`GPU_BARRIER_VERTEX_ATTRIB_ARRAY` should be used for vertex buffers (`GPUVertBuf`),
and `GPU_BARRIER_ELEMENT_ARRAY` should be used for index buffers (`GPUIndexBuf`).

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13595
2022-01-15 15:32:45 +08:00
Christoph Lendenfeld
2aac51018c Function to return a list of keyframe segments
Add a function that returns a list of keyframe segments
A segment being a continuous selection of keyframes
Will be used by future operators in the graph editor

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13531
Ref: D13531
2022-01-15 15:32:45 +08:00
3197165c90 Fix T94184: Outliner: Collection dragging tooltip is not updating
In the context of the dragdrop tooltip, the event referenced to the window
is out of date and contains invalid `mval` values.

Avoid using `win->eventstate` as much as possible.
2022-01-15 15:32:45 +08:00
7690cf51a9 Fix T94116: Drivers can have multiple variables with same name
The RNA setter now ensures that driver variables are uniquely named
(within the scope of the driver).

Versioning code has been added to ensure this uniqueness. The last
variable with the non-unique name retains the original name; this
ensures that the driver will still evaluate to the same value as before
this fix.

This also introduces a new blenlib function `BLI_listbase_from_link()`,
which can be used to find the entire list from any item within the list.

Manifest Task: T94116

Reviewed By: mont29, JacquesLucke

Maniphest Tasks: T94116

Differential Revision: https://developer.blender.org/D13594
2022-01-15 15:32:45 +08:00
f6d52918f0 Theme: Node Group color only needs RGB, not RGBA
The node group alpha theme was used for the overlay drawing in the node
editor. Since this was removed (919e513fa8) the alpha channel doesn't
need to be exposed anymore.

Reported as part of T93654.
2022-01-15 15:32:45 +08:00
Hans Goudey
9ee2be77a7 Cleanup: Use signed integers in the weld modifier
The style guide mentions that unsigned integers shouldn't be used to
show that a value won't be negative. Many places don't follow this
properly yet. The modifier used to cast an array of `uint` to `int` in
order to pass it to `BLI_kdtree_3d_calc_duplicates_fast`. That is no
longer necessary.

Differential Revision: https://developer.blender.org/D13613
2022-01-15 15:32:45 +08:00
9d0d57cb2e Cleanup: quiet warning due to incompatible pointer types 2022-01-15 15:32:45 +08:00
5d8ed2211b Cleanup: use new c++ guarded allocator api in some files 2022-01-15 15:32:45 +08:00
9a990af4f1 Allocator: simplify using guarded allocator in C++ code
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
  returned `void *`. That leads to having the same type name three times
  in the same line. This patch reduces the amount to two and removes the
  `sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
  of place compared to other allocation methods. Sometimes
  `MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
  in C++ code. It doesn't look great but it's definitely better. The downside
  is that it makes the name of the allocation less useful. That's because
  the same name is used for all allocations of a type, independend of
  where it is allocated.

This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).

The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.

Differential Revision: https://developer.blender.org/D13502
2022-01-15 15:32:45 +08:00
Phil Stopford
7c56625aa9 UI: make Remap User dialog in outliner wider
The previous size was too small for common object names.

Differential Revision: https://developer.blender.org/D13604
2022-01-15 15:32:45 +08:00
Alessio Monti di Sopra
ef9397145e UI: Fix node socket alignment in some cases
The patch fixes some misalignments in the nodes' sockets/options
recently introduced in 26d2caee3b, while maintaining the original
fix for T92268.

The original fix made the top padding always of the same size; while
that works when the first row of the other node is `Socket | Socket`,
it doesn't for other more common cases, `like Socket | Node Option`,
where the text results misaligned.

Differential Revision: https://developer.blender.org/D13451
2022-01-15 15:32:45 +08:00
48faf23f7e Fix error in Cycles geometry update tagging after pointcloud addition
Thanks to Christophe Hery for spotting this.
2022-01-15 15:32:45 +08:00
Michael
f89e96276f Fix T94142, T94182: Cycles metal broken after pointcloud changes
Missing ccl_private form an older patch.

Differential Revision: https://developer.blender.org/D13612
2022-01-15 15:32:45 +08:00
16a60c05a7 Fix T94137: GPencil: Eraser does not erase first point
The eraser checks the current, previous and next point (and sets pc0,
pc1 & pc2 corresponding to that for futher occlusion/brush/clipping
checks). For the very first point, it sets pc0 to pc1 [which makes sense,
there is no previous point, so we should assume the previous segment is
"visible" as soon as the first point is], but does so *before* pc1 is
even calculated. This makes following occlusion/brush/clipping checks
work with zero values [which leads to no earsing in most cases].

Now *first* calculate pc1, *then* set pc0 to pc1.

Maniphest Tasks: T94137

Differential Revision: https://developer.blender.org/D13593
2022-01-15 15:32:45 +08:00
276fbb86d1 Outliner ID Remap Users: hide ID type from the UI
The correct type should be set by invoke already, changing it to a non-
matching type (e.g. trying to remap Mesh users with a Camera block) does
not really make sense afaict, reason being that we would be presented
with the "Invalid old/new ID pair" message in such case anyways (code
checks GS(old_id->name) == GS(new_id->name)).

This alone wouldnt be a pressing issue, but since doing this with an
object ID type crashes atm., it seems to make sense to clean this up now
(of course the crash should be looked into, but this is for a separate
patch -- if that is solved, we could also think about adding the "Remap
Users" entry back in the context menu for objects as well [which was
removed in rB17bd5c9d4b1e for some reason]).

Part of T93799.

Differential Revision: https://developer.blender.org/D13512
2022-01-15 15:32:45 +08:00
7bda4a4601 Fix (unreported): missed running versioning code in some files
The versioning code was accidentally put not at the very bottom.
That lead to a situation where it wasn't run on some files that happened
to be within a specific short time frame.

Since the versioning code is idempotent, it can just run again on existing
files. Therefore, this commit just moves it back to the bottom so that it
is executed on all files again.

Broken Commit: rB5b61737a8f41688699fd1d711a25b7cea86d1530.
2022-01-15 15:32:45 +08:00
99d7c384a8 Fix T94166: set handle position node crashed after refactor
This was an oversight in rB8e2c9f2dd3118bfdb69ccf0ab2b9f968a854aae4.
2022-01-15 15:32:45 +08:00
faf412a0ed GPU: Sort SSBOs In Shader Interface.
SSBOs weren't sorted, but other types were. This was an
oversight when SSBOs were introduced (GPU compute pipeline).

Issue identified by @fclem.
2022-01-15 15:32:45 +08:00
a53c2a7987 Cleanup: Silenced unused var warnings. 2022-01-15 15:32:45 +08:00
1189d44c95 UI: move "undo history" from a custom popup to a menu type
This lets the undo history expand as a regular sub-menu
instead of being a popup.

Also disable the active undo step menu item as this is a no-op.
2022-01-15 15:32:45 +08:00
8f2815f0a5 Cleanup: spelling in comments 2022-01-15 15:32:45 +08:00
c2d1707b7e Cleanup: use more common naming suffix for item callbacks 2022-01-15 15:32:45 +08:00
Johannes Jakob
76c4f615ed UI: Correct "QuickTime" Spelling
Change the spelling of the QuickTime output video container item from
"Quicktime" to "QuickTime"

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

Reviewed by Harley Acheson
2022-01-15 15:32:45 +08:00
437c589d66 Cleanup: Simplify logic in set material node 2022-01-15 15:32:45 +08:00
0741656f13 Geometry Nodes: Support point clouds in the set material node
Now that point clouds can be rendered with cycles, it makes sense
to allow assigning a material to them. Note that like volumes, they
only support a single material though.
2022-01-15 15:32:45 +08:00
11356796e9 Cycles: pointcloud rendering
This add support for rendering of the point cloud object in Blender, as a native
geometry type in Cycles that is more memory and time efficient than instancing
sphere meshes. This can be useful for rendering sand, water splashes, particles,
motion graphics, etc.

Points are currently always rendered as spheres, with backface culling. More
shapes are likely to be added later, but this is the most important one and can
be customized with shaders.

For CPU rendering the Embree primitive is used, for GPU there is our own
intersection code. Motion blur is suppored. Volumes inside points are not
currently supported.

Implemented with help from:
* Kévin Dietrich: Alembic procedural integration
* Patrick Mourse: OptiX integration
* Josh Whelchel: update for cycles-x changes

Ref T92573

Differential Revision: https://developer.blender.org/D9887
2022-01-15 15:32:45 +08:00
effccaee99 Revert "Cycles-X: Add hysteresis to resolution divider algorithm"
This reverts commit d8b4275162. It causes reduced
viewport render resolution. Revert for now until I have time to look into this
more closely.
2022-01-15 15:32:44 +08:00
e81b630231 Cleanup: Move curve.c to C++
I need this for a refactor I'm looking into for bounding boxes.
It may be helpful in the future when using `CurveEval` in more places.

Differential Revision: https://developer.blender.org/D13596
2022-01-15 15:32:44 +08:00
8b89f34e49 LibOverride: Further improve creation/resync pre-process speed.
Fully get rid of `BKE_collection_object_find` in
`lib_override_group_tag_data_object_to_collection_init`, even if only
used a few times this function was still noticeable in profiling data.

Now instead loop over collections' objects to build required
object-to-collections mapping.

Adds an extra 5-10% speed-up compared to previous commit rB0624fad0f3ff.

Related to T94059.
2022-01-15 15:32:44 +08:00
447d89a3e0 Fix T94109: 3d cursor crash when using shortcut
Operator was erroneously starting edge_slide operation.

Revert part of the changes in rB3fab16fe8eb4 as obedit_type was being
confused with object_mode.
2022-01-15 15:32:44 +08:00
01b56762b5 LibOverride: Improve speed of resync and creation of liboverrides.
`BKE_collection_object_find` has extremely bad performances (very high
time complexity). While ideally this should be fixed in that API, for
now cache its results once at the beginning of the resync/creation
process.

This makes loading of complex production files with a lot of
liboverrides to resync three to four times faster.

Thanks to @brecht for the profiling in T94059.
2022-01-15 15:32:44 +08:00
6e847799ac LibOverride: Cleanup log about unfound subitems.
Not finding subitem when its name and index are invalid/unset is
expected behavior, and does happen when e.g. inserting a new constraint
or modifier at the begining of the stack.
2022-01-15 15:32:44 +08:00
1cd6deb197 Fix T94115: Selecting current action in undo history undoes all
When selecting the current undo step there is no need to do anything.

Fix and minor refactor to de-duplicate refreshing after running
undo/redo & undo history.
2022-01-15 15:32:44 +08:00
f60fbaaaef UI: support Copy To Selected for id-properties [GN modifier properties]
Both {key Alt} editing behavior as well as `Copy To Selected` were not
working on geometry nodes modifiers (even if these matched exactly -
having the same nodegroup - on multiple objects)

Reason is that code checks pointer equality on the discovered properties
[geometry nodes modifier properties are stored as ID properties], but
these are not the same across objects (since these are fetched from
NodesModifierSettings - which are different on different objects).

note: if general custom properties are "API defined" on existing classes,
this was working, we are getting the exact property for different IDs in
this case

Now be more permissive with ID properties not defined on classes in
general and dont check pointer equality for them. For ID properties on
specific IDs (not the ones defined on classes) this //might// be undesired
(havent spotted issues though, even if equally named ID properies with
different types existed -- this then simply does nothing).

For geometry nodes modifiers, new code also checks if the nodegroups are
the same [since generic naming "Input_XXX" is shared for all modifiers --
and starting to copy over things to unrelated modifiers is not desired
here].

Fixes T93983.

Maniphest Tasks: T93983

Differential Revision: https://developer.blender.org/D13573
2022-01-15 15:32:44 +08:00
5ff42469f2 UI: deduplicate code for Copy To Selected and Alt-button tweaking
This resolves an old TODO to deduplicate code in copy_to_selected_button
& ui_selectcontext_begin.
This is also in hindsight of adding id-property support [incl. Geometry
Nodes modifier properties] for this in the next commit.
No behavior change expected here.

ref T93983 & D13573
2022-01-15 15:32:44 +08:00
fb601dfee7 Cleanup: correct docstring for driver_variable_name_validate
No functional changes.
2022-01-15 15:32:44 +08:00
13f564f964 Docs: add doc-strings for BLI_path functions 2022-01-15 15:32:44 +08:00
0991cda681 Animation: send notifier when keyframe is inserted
`<some_id>.keyframe_insert()` now sends a notifier that animation data
was changed, so that animation-related editors can properly refresh.

Since this function is quite high-level (if necessary it creates the
Action and FCurves), I thought this would be a suitable location for the
notifier. If high keyframing speed is required, it is still recommended
to use `FCurveKeyframePoints.insert(options={'FAST'})` instead.
2022-01-15 15:32:44 +08:00
c8d3a6c1df Fix compile error on Windows. 2022-01-15 15:32:44 +08:00
a563cd50ba WM: various changes to file writing behavior
Saving with only a filename (from Python) wasn't being prevented,
while it would successfully write the file to the working-directory,
path remapping and setting relative paths wouldn't work afterwards
as `Main.filepath` would have no directory component.

Disallow this since it's a corner case which only ever occurs
when path names without any directories are used from Python,
the overhead of expanding the working-directory for all data saving
operations isn't worthwhile.

The following changes have been made:

- bpy.ops.wm.save_mainfile() without a filepath argument
  fails & reports and error when the file hasn't been saved.

  Previously it would write to "untitled.blend" and set the
  `G.main->filepath` to this as well.

- bpy.ops.wm.save_mainfile(filepath="untitled.blend")
  fails & reports and error as the filename has no directory component.

- `BLI_path_is_abs_from_cwd` was added to check if the path would
  attempt to expand to the CWD.
2022-01-15 15:32:44 +08:00
8fec0c0780 Cleanup: simplify file saving logic
Revert part of the fix from 073669dd85
that initialized the file-path on first save as it's no longer needed.

Also remove relbase argument to BLI_path_normalize as the destination
file paths shouldn't use relative locations.
2022-01-15 15:32:44 +08:00
Aaron Carlisle
977a5293de Nodes: Begin splitting composite node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for composite nodes into their respected
`source/blender/nodes/composite/nodes` file.

In the future, these functions will be simplified to `node_layout` once files have their own namespace.
See {D13466} for more information.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13523
2022-01-15 15:32:44 +08:00
cbe885592f Remove G.relbase_valid
In almost all cases there is no difference between `G.relbase_valid`
and checking `G.main->filepath` isn't an empty string.

In many places a non-empty string is already being used instead of
`G.relbase_valid`.

The only situation where this was needed was when saving from
`wm_file_write` where they temporarily became out of sync.
This has been replaced by adding a new member to `BlendFileWriteParams`
to account for saving an unsaved file for the first time.

Reviewed By: brecht

Ref D13564
2022-01-15 15:32:44 +08:00
b2419ebe07 Cleanup: spelling 2022-01-15 15:32:44 +08:00
7c2383ca15 Cleanup: clang-format 2022-01-15 15:32:44 +08:00
ceb34ae0b3 Cleanup: unused variable warning 2022-01-15 15:32:44 +08:00
4995136d76 Fix various cases of incorrect filtering in node link drag search
Some nodes didn't check the type of the link's socket for filtering.
Do this with a combination of manually calling the node tree's validate
links function and using the helper function for declarations.

Also clean up a few cases that added geometry sockets manually
when they can use the simpler helper function.
2022-01-15 15:32:44 +08:00
f1c37e5443 Fix: Compare node missing from link drag search
This was missing from rB11be151d58ec0ca955f.
It uses the same approach as the quadrilateral node.
2022-01-15 15:32:44 +08:00
8e4c5f2d00 Fix: Crash in nodes modifier with missing node group
We cannot depend on node->id being non-null for group nodes.
2022-01-15 15:32:44 +08:00
b0264cd305 Cleanup: Use const arguments, references
Also slightly change naming to avoid camel case.
2022-01-15 15:32:44 +08:00
c127c996e5 Cleanup: Remove no-op node preview function calls
This patch removes no-op node editor preview code (`PR_NODE_RENDER`)
and most calls to `BKE_node_preview_init_tree`. The only remaining call is
in the compositor.

 - Shader nodes previews don't seem to do anything.
 - In-node previews for the texture node system doesn't work either.

This is a first step to refactoring to remove `preview_xsize`,
`preview_ysize`, and `prvr` from nodes in DNA, aligned with
the general goal of removing runtime/derived data from data
structs.

Differential Revision: https://developer.blender.org/D13578
2022-01-15 15:32:44 +08:00
ed115cfc14 Fix T93995: Cycles camera motion blur not working in right stereo view
Thanks to Michael (michael64) for identifying the solution.

Ref D13567
2022-01-15 15:32:44 +08:00
283a91cad0 Node Editor: Link Drag Search Menu
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.

A few special operators for creating a reroute or a group input node
are also added to the search.

Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.

A small "+" is displayed next to the cursor to give a hint about this.

Further improvements are possible after this first iteration:
 - Support custom node trees.
 - Better drawing of items in the search menu.
 - Potential tweaks to filtering of items, depending on user feedback.

Thanks to Juanfran Matheu for developing an initial patch.

Differential Revision: https://developer.blender.org/D8286
2022-01-15 15:32:44 +08:00
f97918ab95 Refactor: Simplify spreadsheet handling of cell values
Previously we used a `CellValue` class to hold the data for a cell,
and called a function to fill it whenever necessary. This is an
unnecessary complication when we have virtual generic arrays
and most data is already easily accessible that way anyway.
This patch removes `CellValue` and uses `fn::GVArray` to provide
access to data instead.

In the future, if rows have different types within a single column,
we can use a `GVArray` of `blender::Any` to interface with the drawing.

Along with that, the use of virtual arrays made it easy to do a
few other cleanups:
 - Use selection domain interpolations from rB5841f8656d95
   for the mesh selection filter.
 - Change the row filter to only calculate for necessary indices.

Differential Revision: https://developer.blender.org/D13478
2022-01-15 15:32:44 +08:00
e17218f4c1 Fix T93975: add more nested instance limit checks
Differential Revision: https://developer.blender.org/D13585
2022-01-15 15:32:44 +08:00
Michael
c46971a495 Initialize the fourth and final instance variable of MemoryProxy
The constructor of MemoryProxy initializes 3 of 4 instances variables.
If a MemoryProxy is constructed and MemoryProxy::free is called
on this instance, buffer_ is undefined and 'delete buffer_;' causes errors.

Although this misuse pattern does not exist in the current codebase
it already tripped up the Address Sanitizer on various occasions
while debugging unrelated problems.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13569
2022-01-15 15:32:44 +08:00
0f3554347b Geometry Nodes: Add Selection to Attribute Statistics
This adds a bool field selection input to the Attribute Statistics node.
This is useful for running calculations on a subset of the input field data
rather that then whole set.

Differential Revision: https://developer.blender.org/D13520
2022-01-15 15:32:44 +08:00
9fcd33ebfe Fix T93971: "Center Cursor & Frame All" fails to redraw
bda9e4238a changed smooth-view
not to redraw when there were no changes made.
Redrawing is needed for repositioning the cursor.

Subscribe to changes to the 3d cursor to ensure all view ports
are updated (not just the current one).
2022-01-15 15:32:44 +08:00
a5e38cda42 Cleanup: remove disabled code
Originally pointcache wasn't supported when the file wasn't saved.
Remove commented code as this hasn't been the case for a long time.
2022-01-15 15:32:44 +08:00
cfc50a7e71 Cleanup: unused variable warning 2022-01-15 15:32:44 +08:00
47bc33bd0e MetaBall: optimize memory allocation for meta-ball tessellation
Double the allocation size when the limit is reached instead of
increasing by a fixed number.

Also re-allocate to the exact size once complete instead of over
allocating. This gives a minor speedup in my tests ~19% faster
tessellation for ~1million faces.
2022-01-15 15:32:44 +08:00
6d6c07b279 Fix meta-ball bound-box calculation reading past buffer bounds
This broke "test_undo.view3d_multi_mode_select" test in
"lib/tests/ui_simulate" and is likely exposed by recent changes to
bounding box calculation.

The missing check for DL_INDEX4 dates back to code from 2002 which
intended to check this but was checking for DL_INDEX3 twice
which got removed as part of a cleaned up.

This could be hidden from memory checking tools as meta-balls
over-allocate vertex arrays.
2022-01-15 15:32:44 +08:00
b9e93c8cc4 Fix compile errors on windows. 2022-01-15 15:32:44 +08:00
55d8c631ac Cleanup: Use pixel in stead of texels in naming. 2022-01-15 15:32:44 +08:00
e28a91fbfe Images: 1,2,3 channel support for transform function.
Added support for 1, 2, 3 float channel source images. Destination
images must still be 4 channels.
2022-01-15 15:32:44 +08:00
960fde787f LineArt: Ortho tolerancec effective for perspective.
In perspective cameras, there will still be certain rare cases where
the camera needs to be rotated ever so slightly, so make that option effective.
2022-01-15 15:32:44 +08:00
a44bf25acd Fix T94082: Curve to point empty evaluated NURBS crash
This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.
2022-01-15 15:32:43 +08:00
19cd72fe00 Fix T93949: Preview Image Error When No Screen
Fix an error if "File Preview Type" is "Auto" and there is no screen.

See D13574 for details.

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

Reviewed by Julian Eisel
2022-01-15 15:32:43 +08:00
4280c5cdbd Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. This would mess up the iterator of the surface
draw loop.
Similar to 7afd84df40.
2022-01-15 15:32:43 +08:00
a70b2516b1 Fix null-pointer dereference on error handling during VR view drawing 2022-01-15 15:32:43 +08:00
32d947f0e0 Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. But this may still be stored as active surface,
leading to a use-after-free when deactivating this active surface, for
example.
2022-01-15 15:32:43 +08:00
dab8de0db1 Fix Cycles compilation with CUDA / Optix after recent Map Range additions. 2022-01-15 15:32:43 +08:00
Charlie Jolly
1a9c063950 Nodes: Add vector support to Map Range node
This replaces lost functionality from the old GN Attribute Map Range node.
This also adds vector support to the shader version of the node.

Notes:
This breaks forward compatibility as this node now uses data storage.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D12760
2022-01-15 15:32:43 +08:00
dc21482317 Cleanup: Remove unused arguments 2022-01-15 15:32:43 +08:00
044f811d4f Cleanup: Remove runtime uiBlock pointer from nodes
Code is simpler when the uiBlocks used during drawing are simply
stored in an array. Additionally, looping can be simpler when we use
an vector to hold a temporary copy of the tree's linked list of nodes.

This patch also slightly changes how uiBlocks are "named" in
`node_uiblocks_init`. Now it uses the node name instead of the
pointer, which is helpful so we rely less on the node's address.

Differential Revision: https://developer.blender.org/D13540
2022-01-15 15:32:43 +08:00
7c037b6987 Cleanup: Simplify node group input and output socket verification
This commit refactors the way the socket lists for group nodes,
and group input/output nodes are verified to match the group's
interface.

Previously the `bNodeSocket.new_sock` pointer was used to
temporarily mark the new sockets. This made the code confusing
and more complicated than necessary.

Now the old socket list is saved, and sockets are moved directly from
the old list to a new list if they match, or a new socket is created
directly in the new list.

This change is split from D13518, which aims to remove the `new_node`
and `new_sock` pointers. In the future this code might be removed
entirely in favor of using node socket declarations.

Differential Revision: https://developer.blender.org/D13543
2022-01-15 15:32:43 +08:00
32c92014a9 Geometry Nodes: support instance attributes when realizing instances
This patch refactors the instance-realization code and adds new functionality.
* Named and anonymous attributes are propagated from instances to the
  realized geometry. If the same attribute exists on the geometry and on an
  instance, the attribute on the geometry has precedence.
* The id attribute has special handling to avoid creating the same id on many
  output points. This is necessary to make e.g. the Random Value node work
  as expected afterwards.

Realizing instance attributes has an effect on existing files, especially due to the
id attribute. To avoid breaking existing files, the Realize Instances node now has
a legacy option that is enabled for all already existing Realize Instances nodes.
Removing this legacy behavior does affect some existing files (although not many).
We can decide whether it's worth to remove the old behavior as a separate step.

This refactor also improves performance when realizing instances. That is mainly
due to multi-threading. See D13446 to get the file used for benchmarking. The
curve code is not as optimized as it could be yet. That's mainly because the storage
for these attributes might change soonish and it wasn't worth optimizing for the
current storage format right now.

```
1,000,000 x mesh vertex:       530 ms -> 130 ms
1,000,000 x simple cube:      1290 ms -> 190 ms
1,000,000 x point:            1000 ms -> 150 ms
1,000,000 x curve spiral:     1740 ms -> 330 ms
1,000,000 x curve line:       1110 ms -> 210 ms
10,000 x subdivided cylinder:  170 ms ->  40 ms
10 x subdivided spiral:        180 ms -> 180 ms
```

Differential Revision: https://developer.blender.org/D13446
2022-01-15 15:32:43 +08:00
9c5b72b2f0 Geometry Nodes: simplify using selection when evaluating fields
We often had to use two `FieldEvaluator` instances to first evaluate
the selection and then the remaining fields. Now both can be done
with a single `FieldEvaluator`. This results in less boilerplate code in
many cases.

Performance is not affected by this change. In a separate patch we
could improve performance by reusing evaluated sub-fields that are
used by the selection and the other fields.

Differential Revision: https://developer.blender.org/D13571
2022-01-15 15:32:43 +08:00
68acd26982 Fix T93920: Wrong field inferencing state with unavailable socket
This commit ignores unavailable sockets in one more place, to fix the
case in T93920.

Differential Revision: https://developer.blender.org/D13562
2022-01-15 15:32:43 +08:00
4da1c73716 Fix T93649: Blender freezes when saving with active VR session
Dead-lock when VR viewport drawing and depsgraph updates would fight for
the draw-manager GL lock. This didn't usually cause issues because the
depsgraph would be evaluated at this point already, except in rare
exceptions like after file writing.

Fix this by ensuring the XR surface gets its depsgraph updated after
handling notifiers, which is where regular windows also do the depsgraph
updating.
2022-01-15 15:32:43 +08:00
d4560e74d2 Cleanup: consistent naming for the blender file name 2022-01-15 15:32:43 +08:00
c1654a7354 Cleanup: remove oudated comment from early COW development
Added in 161ab6109e
2022-01-15 15:32:43 +08:00
a7ed733c91 Cleanup: use typed enum for wmDrag.flags
Also use 'e' prefix for enum type name.
2022-01-15 15:32:43 +08:00
65e132b5a7 Cleanup: reorganize doxygen modules
- Nest compositor pages under the compositor module
- Nest GUI, DNA/RNA & externformats modules under Blender.
- Remove modules from intern which no longer exist.
- Add intern modules (atomic, eigen, glew-mx, libc_compat, locale,
  numaapi, rigidbody, sky, utfconv).
- Use 'intern_' prefix for intern modules since some of the modules
  use generic terms such as locale & atomic.
2022-01-15 15:32:43 +08:00
aa8af96229 Cleanup: resolve parameter mis-matches in doc-strings
Renamed or removed parameters which no longer exist.
2022-01-15 15:32:43 +08:00
c7a24b34b2 Cleanup: correct unbalanced doxygen groups
Also add groups in some files.
2022-01-15 15:32:43 +08:00
3015d78c61 Fix T91005: Autosplit produces unusable files
Audio PTS was reset for each new file. This caused misalignment of video
and audio streams. In Blender, these files can't be loaded, other
players will fail to align audio and video.

Since timestamps are reset intentionally, reset also video stream
timestamps.

There were other bugs:
After timestamp was reset for audio, write_audio_frames started
encoding from timeline start until target frame, so each split video
had more audio than it should.

Also audio for last frame before splitting was written into new file.

Differential Revision: https://developer.blender.org/D13280
2022-01-15 15:32:43 +08:00
25213256bb Fix T93844: High memory usage during VSE preview
Since 88c02bf826 FFmpeg handles are freed if image is not displayed.
This change did not work correctly if strips are inside meta strip,
because overlap did not consider meta strip boundary, only strips inside
of meta strip.

Pass frame range to `sequencer_all_free_anim_ibufs`, if strip is inside
of meta strip, frame range is reduced to fit meta strip boundary, but if
meta strip is being edited, range must be set to +/-`MAXFRAME`,
otherwise playback performance would be too bad.
2022-01-15 15:32:43 +08:00
a7534a1e91 Remove G.save_over
The difference between G.save_over and G.relbase_valid was minor.

There is one change in functionality. When saving the default-startup
file from an already loaded blend file - future save actions will
continue to write to the originally loaded file instead of prompting
the user to select a location to save the file.

This change makes saving the startup file behave the same way
"Save a Copy" does.

Reviewed By: brecht

Ref D13556
2022-01-15 15:32:43 +08:00
e356d1f0ce Cleanup: clang-format 2022-01-15 15:32:43 +08:00
4165cf757f Fix T94022: Both options GPU/CPU checked under preferences cause viewport render crash. (ARM/Metal)
This fixes crash T94022 when selecting live viewport render with both GPU & CPU devices selected. It is caused by incorrect `KernelBVHLayout` assignment. Similar to `BVH_LAYOUT_MULTI_OPTIX` for Optix, this patch adds a `BVH_LAYOUT_MULTI_METAL` to correctly redirect to the correct Metal BVH layout type.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13561
2022-01-15 15:32:43 +08:00
Piotr Makal
510f735a34 Cleanup: Remove unused curve types from enum
There were a few unused enum values: `CU_CARDINAL` and `CU_BSPLINE`
This commit cleans them up from code as they were not used for
anything meaningful.

Differential Revision: https://developer.blender.org/D13554
2022-01-15 15:32:43 +08:00
5cdb570627 UI: String Search: Add an optional weight parameter
This builds off of rBf951aa063f7, adding a weight parameter which can
be used to change the order of items when they have the same match
score. In the future, if string searching gets a C++ API, we could
use an optional parameter for the weight, since it is not used yet.

This will be used for the node link drag search menu (D8286).

Differential Revision: https://developer.blender.org/D13559
2022-01-15 15:32:43 +08:00
Cody Winchester
60600cdfcb GPencil: Add randomize options to Length modifier
This patch adds a randomize factor for the start/end lengths in the Length modifier.

Reviewed By: #grease_pencil, antoniov, pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D12928
2022-01-15 15:32:43 +08:00
7d96b967ba GPencil: New Shrinkwrap modifier
his new modifier is equals to the existing mesh modifier but adapted to grease pencil.

The underlying functions used to calculate the shrink are the same used in meshes.

{F11794101}

Reviewed By: pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D13192
2022-01-15 15:32:43 +08:00
e933da00c0 Cycles: add text explaining minimum requirements for Metal when no device found 2022-01-15 15:32:43 +08:00
Brecht Van Lommel
d5d7458a20 Cycles: enable Metal GPU rendering
This adds the remaining bits to enable Metal on macOS. There are still
performance optimizations and other improvements planned, but it should
now be ready for early testing.

This is currently only enabled on in Arm builds for M1 GPUs. It is not
yet working on AMD or Intel GPUs.

Ref T92212

Differential Revision: https://developer.blender.org/D13503
2022-01-15 15:32:43 +08:00
13e3b8da5a Geometry Nodes: fix combining field inputs
This was an oversight in rB7b88a4a3ba7eb9b839afa6c42d070812a3af7997.
2022-01-15 15:32:43 +08:00
6f070cee22 Fix T93704: StructRNA.path_resolve fails silently with missing keys
Resolving the path to a missing pose-bone (for example),
was not raising an error as it should have.

Regression introduced in f9ccd26b03,
which didn't update collection lookup logic to fail in the case the
key of a collection wasn't found.
2022-01-15 15:32:42 +08:00
a9ded312aa Geometry Nodes: move up destruct instructions in procedure
This implements an optimization pass for multi-function procedures.
It optimizes memory reuse by moving destruct instructions up.
For more details see the in-code comment.

In very large fields with many short lived intermediate values, this change
can improve performance 3-4x. Furthermore, in such cases, peak memory
consumption is reduced significantly (e.g. 100x lower peak memory usage).

Differential Revision: https://developer.blender.org/D13548
2022-01-15 15:32:42 +08:00
d8545ac8b6 Fix T93169: Weightpaint falloff popover drawn twice
This came with {rBf8a0e102cf5e}.

The panel was meant specifically for the gradient tool, but since it was
given the ".weighpaint" context, it would also draw as part of generic
header toolsettings drawing.

Now remove this context on purpose and only draw this specifically from
the gradient tools ToolDef.

Maniphest Tasks: T93169

Differential Revision: https://developer.blender.org/D13268
2022-01-15 15:32:42 +08:00
622192cb88 Cleanup: clang-format 2022-01-15 15:32:42 +08:00
0a26c94502 Cleanup: spelling in comments
Also move notes about where noise functions come from
into the function body as it's not relavant to the public doc-string.
2022-01-15 15:32:42 +08:00
c20c95bd57 Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal
Use "filepath" which is the current convention for naming full paths.

- Main use "name" which isn't obviously a file path.
- BlendFileData & FileGlobal used "filename" which is often
  used for the name component of a path (without the directory).
2022-01-15 15:32:42 +08:00
509c356a65 Cleanup: remove checks for invalid input for Python Run utilities
These arguments must be non-null for useful functionality,
there is no need for paranoid checks.

The return value in case of invalid input for BPY_run_string_as_number
was also wrong (casting -1 to a bool, when false was expected).
2022-01-15 15:32:42 +08:00
8e9076dae6 Cleanup: Point cloud vs point-cloud in comments
Point cloud is two separate words, this just changes comments in
a few places where we were inconsistent. A small wording change
to another comment is also included.
2022-01-15 15:32:42 +08:00
1b66121cbe Cleanup: Remove includes in node_util.h header
This ends up including the removed headers in many unnecessary places.
Also, remove unnecessary extern from function definitions.
2022-01-15 15:32:42 +08:00
528a17a65f Docs: document all Global (G) struct members 2022-01-15 15:32:42 +08:00
a3755351fc Docs: improve on doc-strings for BPY_extern_run.h
Also add ATTR_NONNULL function attributes.
2022-01-15 15:32:42 +08:00
0c573a361c Cleanup/docs: Add comment to spline lookup factor method 2022-01-15 15:32:42 +08:00
02ed8d684c Geometry Nodes: improve memory reuse in procedure executor
This reduces the number of separate memory allocations done
by the multi-function procedure executor (which is used by the
field evaluation).

Now a linear memory allocator is used to allocate all intermediate
values. Furthermore, more buffers are reused when possible. This
reduces the total amount of allocated memory and improves
cache efficiency because the values are more likely to be in cache
already.

The performance improvement of this patch are most noticable
when few elements are processed by many functions. The situation
will improve even more with D13548, because then buffers can actually
be reused in practice. I measured up to 20% faster field evaluation
in extreme cases with this change.
2022-01-15 15:32:42 +08:00
43af749880 Cleanup: use struct instead of class
Using `class` and `struct` for the same type can cause issues on windows.
2022-01-15 15:32:42 +08:00
Charlie Jolly
ca6d057f24 UI: Add curve handle buttons to CurveMap interface
This patch exposes the vector handle options as buttons
and aligns the UI between CurveMap and CurveProfile more closely.
- CurveMap point editing is on a single row like CurveProfile
- Tools menu is moved to the right hand side on both widgets
- Emboss curve map buttons

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10980
2022-01-15 15:32:42 +08:00
a5704cfa9d macOS: add tilde-based path expander
Replaces `HOME` environment variable usage for user
directories like in D12802.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13212
2022-01-15 15:32:42 +08:00
29f9af295a Cleanup: Use const arguments
Also remove unnecessary function to set a node type's
label function that duplicated its definition, and make
another function static.
2022-01-15 15:32:42 +08:00
004abdba5a Cleanup: const, autoreleasepool, remove unneeded cast.
Early return in some places also.
De-duplicate getSystemDir and getUserDir also.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13211
2022-01-15 15:32:42 +08:00
46013f916e Geometry Nodes: remove accidental exponential time algorithm
Calling `foreach_field_input` on a highly nested field (we do that
often) has an exponential running time in the number of nodes.
That is because the same node may be visited many times.
This made Blender freeze on some setups that should work just fine.
Now every field keeps track of its inputs all the time. That replaces
the exponential algorithm with constant time access.
2022-01-15 15:32:42 +08:00
5d80560e75 Fix compilation error on Windows platform. 2022-01-15 15:32:42 +08:00
76ad6cf7ff Sky: Use Gauss-Laguerre quadrature for optical depth calculation
This allows to use fewer evaluations (30 msec down to 23 for me) while giving more accurate results (3x-10x less relative absolute error) compared to classic ray marching.

Not a massive difference, but meh, it's better. For Cycles the speedup doesn't really matter much, but I also have a patch for Eevee support.

I've also tried Gauss-Legendre and Gauss-Lobatto - the latter was always worse, while the former was slightly better at 2deg elevation but notably worse on 15deg.

Unfortunately the same approach can't be used for the integration along the primary ray, since there we also need the accumulated transmission so far at every integration point, not just the total result.

Differential Revision: https://developer.blender.org/D13521
2022-01-15 15:32:42 +08:00
8e7593bfd9 Cleanup: Return early for null check 2022-01-15 15:32:42 +08:00
9d7f0ac17f Cleanup: Use const argument, rename variables
The const argument makes sense because these are the "source"
sockets, even though a const cast is necessary at one point.
The name "interface_socket" is an improvement over "stemp"
because the latter sounds like "temporary", or it confuses
the old socket template system with a node group's interface.
2022-01-15 15:32:42 +08:00
56bc6414a9 Cleanup: Remove unnecessary runtime rectangle from nodes in DNA
I assume this `butr` rectangle was used more in the past,
but currently its value is set and used less than 10 lines apart,
so it's trivial to remove 16 bytes from every node. The other
rectangles are also runtime data and could be removed, but
they are more difficult.
2022-01-15 15:32:42 +08:00
44b4e271ca Revert recent changes to ImBuf transform
This reverts commit 943aed0de3  and f76e04bf4d

The latter caused a test failure: `sequencer_render_transform`
Reverting since the fix is not obvious (to me), and people are
away for the weekend.
2022-01-15 15:32:42 +08:00
ee6b804653 Cleanup/Docs: Add comments to Mesh header, rearrange fields
Most of the fields in Mesh had no comments, or outdated misleading
comments. For example, "BMESH ONLY" referred to the BMesh project,
not the data structure. Given how much these structs are used, it should
save a lot of time to have proper comments.

I also rearranged the fields in mesh to have a more logical order. Now
the most important fields come first. In the process I was able to
remove 19 bytes of unnecessary padding (31->12). I just had to
change a `short` flag to `char`.

Differential Revision: https://developer.blender.org/D13454
2022-01-15 15:32:42 +08:00
Moritz Röhrich
adb55bf886 Fix T93591: Random Value node first and last value proportion
This patch replaces `round_fl_to_int` with `floor` and adjusts the
maximum value accordingly. The call to `round_fl_to_int` is problematic
here because it messes with the probability distribution at the edges
of the value range, meaning the first and last values were only half
as common as all other values. Since `round_fl_to_int` does
`floor(val + 0.5)`, it will not introduce misbehavior in edge cases.

Differential Revision: https://developer.blender.org/D13474
2022-01-15 15:32:42 +08:00
db233372d0 ImBuf: Extracted UV Wrapping from the Interpolation functions.
Improvement of the IMB_transform function by separating the UVWrapping
method from the color interpolation function. This would allow us to
perform uv wrapping operations separate from the interpolation function.

Currently this wrapping is only supported when interpolating colors.
This change would allow us to perform it on non-color image buffers.
2022-01-15 15:32:42 +08:00
f616e18970 Added support for large images to openexr. 2022-01-15 15:32:42 +08:00
e877e469bd Added support for large texture to OCIO. 2022-01-15 15:32:42 +08:00
f84a3aab76 ImBuf: Use templating for IMB_transform.
Reduce the inner loop of IMB_transform by extracting writing to an
output buffer in a template. This reduces a branch in the inner loop and
would allow different number of channels in the future.
2022-01-15 15:32:42 +08:00
a6eb98cc84 Fix crash using 32k images.
Use IMB_get_rect_len to solve overflow issues.
2022-01-15 15:32:42 +08:00
bd75b35375 Cleanup: move public doc-strings into headers for various API's
Some doc-strings were skipped because of blank-lines between
the doc-string and the symbol and needed to be moved manually.

- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2022-01-15 15:32:42 +08:00
d42082416d Cleanup: move public doc-strings into headers for 'python/intern'
Ref T92709
2022-01-15 15:32:42 +08:00
e512a14948 Cleanup: move public doc-strings into headers for 'nodes'
Ref T92709
2022-01-15 15:32:42 +08:00
dd76d1a843 Cleanup: spelling in comments 2022-01-15 15:32:42 +08:00
8ee95a12d5 Cleanup: doxygen comments for node_geo_dual_mesh
- Indent text after dot-points.
- Use an unparsed code-block to display the text verbatim in doxygen.
2022-01-15 15:32:42 +08:00
3cdca801c0 Fix Crash: Loading Huge Images.
When loading huge images (30k) blender crashed with a buffer overflow.
The reason is that determine the length of a buffer was done in 32bit
precision and afterwards stored in 64 bit precision.

This patch adds a new function to do the correct calculation in 64bit.
It should be added to other sections in blender as well. But that should
be tested on a per case situation.
2022-01-15 15:32:42 +08:00
William Leeson
858e848c36 Fix T92036: Magic Texture in Volumetric World Shaders render differently with the CPU and GPU
When rendering volume surfaces in unbounded worlds the volume stepping can produce large values. If used with a magic texture node the values can results in a Inf float which when used in a sin or cos produces a NaN.

To fix this the input values are mapped into the periodic range of the sin and cos functions (-2*PI 2*PI) this stops the possibility of a Inf occurring and thus the NaN. It also improves the accuracy and smoothness of the result due to loss of precision when large values are summed with smaller ones effectively removing the parts of the smaller number (i.e. those in the -2PI to 2PI range) that result in variation of the output of sin and cos.

Reviewed By: brecht

Maniphest Tasks: T92036

Differential Revision: https://developer.blender.org/D12821
2022-01-15 15:32:42 +08:00
b3ff52eb05 Cleanup: move public doc-strings into headers for 'depsgraph'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2022-01-15 15:32:41 +08:00
dff47a3483 Geometry Nodes: Remove unnecessary copy when replacing data
In the `replace_mesh`/`replace_curve` etc. methods, the component
was retrieved with write access. Retrieving with write access will
duplicate the data if the component has another user. This means that
the replaced geometry data was often duplicated just to be deleted
a moment later.

I expect this would have a large impact in performance in some specific
situations when dealing with large geometry. In a scene with many small
meshes though, I didn't observe a significant difference.

This also makes replacing a geometry set's data with the same data
that's already in the set safe. It would be valid to assert for that
case instead, but this seems safer.

Differential Revision: https://developer.blender.org/D13530
2022-01-15 15:32:41 +08:00
dad664165a Fix T93687: Transform Gpencil vertices not working if scale is zero
Solution similar to rBd5cefc1844cf.

Basically the problem occurs because `td->smtx` was set to zero matrix.
2022-01-15 15:32:41 +08:00
c96626525f Cleanup: Return early in null check
I'm planning to make these functions slightly more complicated,
and it makes sense to return early when checking one of the parameters
for null anyway.
2022-01-15 15:32:41 +08:00
Andrii
d4b371a66f Fix Cycles wrong adaptive sampling render when using sample offset
Sample offset was not accounted for in the adaptive sampling code and caused
issues, like immediately applied adaptive filtering, with non-zero values.

Differential Revision: https://developer.blender.org/D13510
2022-01-15 15:32:41 +08:00
Andrii
c8e1a1aa45 Cycles: support merging images rendered with adaptive sampling
This patch adds support for merging images rendered with adaptive sampling to
the merge operator (which is currently only exposed in the Python API).

To do this an sample count buffer is created for each render layer from the
sample count pass if it exists, or from the metadata otherwise. This is then
used for averaging passes.

Differential Revision: https://developer.blender.org/D13457
2022-01-15 15:32:41 +08:00
Andrii
9d0223807c Cleanup: use more modern C++ in Cycles merge operator
Use structured binding and for-each loop, remove reduntant type casts, use
find_if instead of loop.

Differential Revision: https://developer.blender.org/D13456
2022-01-15 15:32:41 +08:00
72f8c33505 Geometry Nodes: Scene Time Node
This node outputs the current scene time in seconds or in frames.
Use of this node eliminates the need to use drivers to control values
in the node tree that are driven by the scene time.
Frame is a float value to provide for subframe rendering for motion
blur.

Differential Revision: https://developer.blender.org/D13455
2022-01-15 15:32:41 +08:00
6383ebc19a Fix T93498: Cycles fast GI add method affected by bounces settings
This is only for the replace method.
2022-01-15 15:32:41 +08:00
19ac31a6f1 Fix T93890: Cycles error with shadow catcher + OptiX denoise without passes 2022-01-15 15:32:41 +08:00
363f8fd79c Fix T93874: Cycles crash with fast GI approximation 2022-01-15 15:32:41 +08:00
24acc4a8d3 Fix T93871: Image.has_data returns True for images that failed to load 2022-01-15 15:32:41 +08:00
a63b4c2931 Fix T93892: Changing bone name leaves non-functional vertex group
The corresponding vertex group was renamed properly, but the armature
influence was broken for that bone.

Caused by {rB3b6ee8cee708}.

Since above commit, vertex group names are stored on object data (mesh/
lattice/gpencil) and if we update these, we have to inform dependency
graph to have immediate effect.

Maniphest Tasks: T93892

Differential Revision: https://developer.blender.org/D13526
2022-01-15 15:32:41 +08:00
d528367a2d Fix T93691: Crash when loading custom thumbnail in custom library
This was an issue with the mixed list of external assets and assets from
the current file. When closing the File Browser to select the custom
preview image, the assets from the current file would be cleared for
reread, to make sure we display up-to-date file data. That is because
the workspace of the temporary File Browser was deleted, causing a
change in the file data (main data-base). The reread would happen in a
background thread, meaning it might not finish before the custom preview
operator runs and queries the active asset. So the preview operator
would get the wrong active asset from context.

Two fixes were needed:
* Make sure current file data is reread before the operator runs, by
  doing this partial rereading on the main thread.
* Ensure the asset list (in fact file list) order stays consistent over
  rereads. If multiple assets with the same name were shown, the
  operator might also have gotten the wrong asset, also leading to a
  crash.

Additionally the file operation handler should probably poll before
executing, to fail gracefully at least (not crash).
2022-01-15 15:32:41 +08:00
2f2782731d Fix (unreported): missing null check
A crash happened when `instance_id_attribute` further down in the
function was null. This issue was probably introduced when the
id attribute starting using generic attribute handling.
2022-01-15 15:32:41 +08:00
47b59ef6b4 Cleanup: move public doc-strings into headers for 'io/usd'
Ref T92709
2022-01-15 15:32:41 +08:00
8387ea5ec3 Cleanup: move public doc-strings into headers for 'io/alembic'
Ref T92709
2022-01-15 15:32:41 +08:00
111e3ada17 Cleanup: Various cleanups to the tree-view API
* Correct URL for documentation (was changed recently).
* Add comments.
* Reevaluate and update which functions are public, protected or
  private.
* Reorder functions and classes to be more logical and readable.
* Add helper class for the public item API so individual functions it
  uses can be made protected/private (the helper class is a friend).
  Also allows splitting API implementation from the C-API.
* Move internal layout builder helper class to the source file, out of
  the header.
* More consistent naming.
* Add alias for item-container, so it's more clear how it can be used.
* Use const.
* Remove unnecessary forward declaration.
2022-01-15 15:32:41 +08:00
60550a5d71 Cleanup/Documentation: Add/move comments for asset files
Adds some basic high-level explanations for editor/UI level asset APIs.
Also moves one such comment from the source file to the header file,
so it's in the same file as other API comments.
2022-01-15 15:32:41 +08:00
9d57a702a8 Cleanup: move public doc-strings into headers for 'io/collada'
Ref T92709
2022-01-15 15:32:41 +08:00
4259feeb72 Cleanup: use doxy section for itasc_plugin
It wasn't obvious all callbacks were part of the plugin-API.
2022-01-15 15:32:41 +08:00
9a5c240adc Cleanup: move public doc-strings into headers for 'functions'
Ref T92709
2022-01-15 15:32:41 +08:00
Azeem Bande-Ali
de738229e2 Fix T93519: handle prefix names in autocompletes
Autocomplete entires keep track of the length of the prefix
in `name_prefix_offset`. However, the name matching logic
was comparing the string including the prefix which resulted
in tab-completion not working (when the user didn't also type
in the prefix, typically two whitespaces).

This is fixed by passing in a char pointer after the end of
the prefix.

Additionally, some searchbox logic is moved. Previously,
`ui_searchbox_apply` would clear the entry which would mean
that `ui_searchbox_find_index` would never succeed. Now the
search box is only cleared if no match was found.

Differential Revision: https://developer.blender.org/D13483
2022-01-15 15:32:41 +08:00
1b88b329ba Cleanup: move public doc-strings into headers for 'freestyle'
Ref T92709
2022-01-15 15:32:41 +08:00
e18e102650 Cleanup: move public doc-strings into headers for 'nodes/geometry'
Ref T92709
2022-01-15 15:32:41 +08:00
adeb1252e0 Cleanup: move public doc-strings into headers for 'io/gpencil'
Ref T92709
2022-01-15 15:32:41 +08:00
c55768a80b Cleanup: move public doc-strings into headers for 'geometry'
Ref T92709
2022-01-15 15:32:41 +08:00
26280a1c26 Cleanup: spelling in comments 2022-01-15 15:32:41 +08:00
33296e8f1f Cleanup: move public doc-strings into headers for 'gpencil_modifiers'
Removed doc-strings for operator definitions as they didn't provide
useful information in addition to the operators own description.

Ref T92709
2022-01-15 15:32:41 +08:00
9ce32a0c89 Cleanup: move public doc-strings into headers for 'compositor'
Ref T92709
2022-01-15 15:32:28 +08:00
627c1aaee3 Cleanup: move public doc-strings into headers for 'gpu'
Ref T92709
2022-01-15 15:32:28 +08:00
492d0cd946 Cleanup: move public doc-strings into headers for 'imbuf'
Ref T92709
2022-01-15 15:32:28 +08:00
3cee15e21a Cleanup: move public doc-strings into headers for 'blenlib'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2022-01-15 15:32:28 +08:00
Alaska
d9a905be81 Cycles-X: Add hysteresis to resolution divider algorithm
Adds hysteresis to the resolution divider algorithm to avoid having the resolution bounce around when on the boundary of two resolutions.

Reviewed By: brecht, leesonw

Differential Revision: https://developer.blender.org/D12385
2022-01-15 15:32:28 +08:00
1810fbbf9f Fix incorrect copying of XR action map items
After using MEM_dupallocN() on the original item, the bindings ListBase
for the new item needs to be cleared and each binding copied separately.
2022-01-15 15:32:28 +08:00
97f61cb249 Cleanup: Remove empty node button layout function
Was unused since the first commit:
rB658b4c0d56dffbcf1476c2a2a019fa0ecfb79376
2022-01-15 15:32:28 +08:00
c1c63f160d Fix T93869: snap cursor may fail in orthographic view
Float precision issues cause the `ED_view3d_win_to_3d_on_plane` to return
a value even when the view ray is parallel to the plane.

A more general solution might be desired in this case, as other areas that
use `ED_view3d_win_to_3d_on_plane` might have the same problem.

For now, just work around the problem for the snap cursor.
2022-01-15 15:32:28 +08:00
2d5e0e70e5 Fix T93523: Memory leak in Menu Search
Fixes a memory leak introduced by D13225.
Caused by not freeing the hash-map in some cases.

Differential Revision: https://developer.blender.org/D13432
2022-01-15 15:32:28 +08:00
501a553af2 Fix T93858: Zstd-compressed .blend files from external tools aren't recognized
The issue here was that after the seek table check, the underlying file wasn't
rewound to the start, so the code that checks for the BLENDER header
immediately reaches EOF and fails.

Since Blender always writes files with a seek table, this bug isn't triggered
by files saved in Blender itself. However, files compressed in external tools
generally don't have a seek table.
2022-01-15 15:32:28 +08:00
6b837f4a5a Fix T93642: value used as transform offset is ignored in some modes
If a transform operator is executed as modal and has a "value" set, that value works as an offset.

However few transform modes were supporting this.

Include more transform modes as supported.
2022-01-15 15:32:28 +08:00
99ca80716f Cleanup: Avoid lookup the same property string multiple times
This is a micro-optimization that is useful for operators with many properties.
2022-01-15 15:32:28 +08:00
e623f46ca2 Geometry Nodes: Mesh Island Node
This node is a field input that outputs a separate index for each mesh island.
The indices are based on the order of the lowest-numbered vertex in each island.

Authoring help from @hooglyboogly

Differential Revision: https://developer.blender.org/D13504
2022-01-15 15:32:28 +08:00
ec8324b1c2 Fix T93728: Greasepencil separate will loose all vertex groups
Caused by {rB3b6ee8cee708}

The raw data is copied here correctly
[`BKE_gpencil_stroke_weights_duplicate` in
`BKE_gpencil_stroke_duplicate`] but the vertex groups names are missing.
Prior to above commit is was enough to have `ED_object_add_duplicate`
(this seemingly took care of duplicating object's defbase).
Now vertex groups names sit on the `bGPdata` rather than the `Object`,
and since the separate operation creates **new** `bGPdata` we have to
copy vertex groups names - and active index - over [via
`BKE_defgroup_copy_list`].

Maniphest Tasks: T93728

Differential Revision: https://developer.blender.org/D13509
2022-01-15 15:32:27 +08:00
73cd1d1107 Cycles: Fix OS version warnings
This patch suppresses OS version warnings and hides currently unsupported Metal GPUs when enumerating devices.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13506
2022-01-15 15:32:27 +08:00
Campbell Barton
d32e0d3013 Cleanup: Avoid error prone pointer storage in SnapObjectParams
eed48a7322 caused the `SnapObjectParams` to be stored in the `SnapObjectContext`.

As this pointer is always passing in stack memory, so it seems error prone to keep a reference to this in `SnapObjectContext` since failure to set this will reference undefined stack memory.

So avoid this by moving params out of `SnapObjectContext`.

Differential Revision: https://developer.blender.org/D13401
2022-01-15 15:32:27 +08:00
864fc66d4f Fix T91680: viewport selection broken in macOS x86 build with Xcode 13
There is an apparent compiler bug here, tweak the code to avoid it. This did
not affect official builds as we were still using Xcode 12.
2022-01-15 15:32:27 +08:00
77d787b47b Cleanup: Use float2 for node view functions
Though the interfacing with `rctf` becomes slightly more complicated,
this should be more helpful as more of this code usese `float2` instead
of two separate floats.
2022-01-15 15:32:27 +08:00
f69cf7ff07 Cleanup: move public doc-strings into headers for 'editors'
Ref T92709
2022-01-15 15:32:27 +08:00
b5d5e24fe5 ImBuf: Performance IMB_transform.
This change uses generics to reduce code duplication an increases
flexibility and performance. Performance increase isn't measurable
for end users.
2022-01-15 15:32:27 +08:00
dce02f8f48 Cleanup: move public doc-strings into headers for 'sequencer'
Ref T92709
2022-01-15 15:32:27 +08:00
e040b5f035 Cleanup: move public doc-strings into headers for 'draw'
Ref T92709
2022-01-15 15:32:27 +08:00
cd244171d8 Cleanup: move public doc-strings into headers for 'shader_fx'
Ref T92709
2022-01-15 15:32:27 +08:00
75e8c3b9a0 Cleanup: move public doc-strings into headers for 'simulation'
Ref T92709
2022-01-15 15:32:27 +08:00
5ca32581d4 Cleanup: move public doc-strings into headers for 'blentranslation'
Ref T92709
2022-01-15 15:32:27 +08:00
e4babb6b75 Cleanup: moved IMB_transform to transform.cc.
Part of a refactoring to make IMB_transform more generic to reduce
unneeded branching.
2022-01-15 15:32:27 +08:00
c318b6ca8c Cleanup: Silence clang-tidy warnings. 2022-01-15 15:32:27 +08:00
a8618abe2a Cleanup: move public doc-strings into headers for 'blenloader'
Ref T92709
2022-01-15 15:32:27 +08:00
0c73c51746 Cleanup: move public doc-strings into headers for 'render'
Ref T92709
2022-01-15 15:32:27 +08:00
99ec524817 Cleanup: move public doc-strings into headers for 'windowmanager'
Ref T92709
2022-01-15 15:32:27 +08:00
f10156a3bb Cleanup: move public doc-strings into headers for 'makesrna'
Ref T92709
2022-01-15 15:32:27 +08:00
07759e9988 Cleanup: move public doc-strings into headers for 'makesdna'
Ref T92709
2022-01-15 15:32:27 +08:00
3b00587791 Cleanup: move public doc-strings into headers for 'blendthumb'
Ref T92709
2022-01-15 15:32:27 +08:00
5d987c4cce Cleanup: move public doc-strings into headers for 'blenfont'
Ref T92709
2022-01-15 15:32:27 +08:00
0bed5ae03e Cleanup: move public doc-strings into headers for 'modifiers'
Ref T92709
2022-01-15 15:32:27 +08:00
6c807e173d Cleanup: Clang-Tidy modernize-redundant-void-arg 2022-01-15 15:32:27 +08:00
7316900dda Cleanup: Missing braces in array declaration 2022-01-15 15:32:27 +08:00
2163b5a6d1 Fix T94878: LineArt crease threshold logic error.
A coding mistake allows default crease to override object crease, now fixed.
2022-01-14 21:42:52 +08:00
aa63968ac3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2022-01-14 21:05:20 +08:00
59dd49de6e LineArt: Correct collection intersection mask logic.
The logic used to be:

"if collection doesn't have child collection, check if ob is from this one"

The correct logic should be:

"if collection child does not have this ob, then check this collection".
2021-12-31 21:37:18 +08:00
ee6e446b22 Merge branch 'master' into temp-lineart-contained 2021-12-31 21:27:35 +08:00
eaee064dd1 LineArt: Correct handling out of bound isect index
Handles rare cases where line doesn't intersect the triangle correctly.
2021-12-28 11:54:41 +08:00
4dc925bf8f Revert "LineArt: Intersection function additional clamping"
This reverts commit e2166dc217.
2021-12-28 11:40:55 +08:00
e2166dc217 LineArt: Intersection function additional clamping
To handle a rare case where it leads to a -1 index in isect order lookup
2021-12-28 11:19:28 +08:00
e7ff8deee8 LineArt: Protecting bounding area links.
In case they overflowed the bounding area maximum link count,
Protect the link array so it doesn't crash.
2021-12-27 14:33:39 +08:00
c7f20dfbe5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-12-27 14:24:03 +08:00
d0d5b2ef5d LineArt: Ortho tolerancec effective for perspective.
In perspective cameras, there will still be certain rare cases where
the camera needs to be rotated ever so slightly, so make that option effective.
2021-12-15 12:59:47 +08:00
bdb405020e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-12-15 12:24:09 +08:00
dd8b48976a Cleanup: clang-format 2021-12-08 14:53:45 +08:00
4a64dc6231 Cleanup: Nodes: clang-tidy modernize-redundant-void-arg 2021-12-08 14:53:44 +08:00
d8f4a691ec Cleanup: spelling in comments 2021-12-08 14:53:44 +08:00
58c31ea6e8 Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

Re commits part of rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
2021-12-08 14:53:44 +08:00
00e7554c07 Shader Nodes: Use camel case for file names
Recommits part of rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
2021-12-08 14:53:44 +08:00
f0ea8e7ffa Cycles: Fix Metal BVH crash caused by missing WITH_METAL define
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13505
2021-12-08 14:53:44 +08:00
7f22c3aaf6 Cleanup: Extend a few comments in BKE_spline.hh 2021-12-08 14:53:44 +08:00
f80f86f867 Revert "Fix T93350: Cycles renders shows black during rendering huge resolutions"
This reverts commit 5e37f70307.

It is leading to freezing of the entire desktop for a few seconds when stopping
3D viewport rendering on my Linux / NVIDIA system.
2021-12-08 14:53:44 +08:00
73056f848c Tests: add Cycles perspective/ortho/panoramic camera regression tests
Ref D12691
2021-12-08 14:53:44 +08:00
Håkan Ardö
9058f419a5 Cycles: add Fisheye Lens Polynomial camera model
This allows real world cameras to be modeled by specifying the coordinates of a
4th degree polynomial that relates a pixels distance (in mm) from the optical
center on the sensor to the angle (in radians) of the world ray that is
projected onto that pixel.

This is available as part of the panoramic lens type, however it can also be
used to model lens distortions in projective cameras for example.

Differential Revision: https://developer.blender.org/D12691
2021-12-08 14:53:44 +08:00
2b4786023b Build: don't look for CUDA toolkit if not using Cycles CUDA device 2021-12-08 14:53:44 +08:00
86435cb886 Cleanup: fix compiler warning 2021-12-08 14:53:44 +08:00
b458245a2d Shader Nodes: Create a new bf_nodes_shader library
Re commits rBf72cc47d8edf849af98e196f721022bacf86a5e7 but without the unity build
2021-12-08 14:53:44 +08:00
57207c80e6 Cleanup: Missing include
This included is needed for the `ATTR_NONNULL` macro used in the header.
As found in a recent c --> c++ if the includes get ordered in a different order
this could result in an error.

Re commits rBc20098e6ec6adee874a12e510aa4a56d89f92838
2021-12-08 14:53:44 +08:00
2e1d6a2faa Cleanup: clang-tidy: modernize-redundant-void-arg
Re commits part of rB0578921063fbb081239439062215f2538a31af4b
2021-12-08 14:53:44 +08:00
1d25caf77f Docs: Add more comments to geometry set header
This adds a bit more information to `GeometrySet` and each of the
geometry components. There is probably still more that can be written,
but this includes the most important information that I could think of.

I'd like to include some more general information about the
attribute API in a separate patch.

Differential Revision: https://developer.blender.org/D13501
2021-12-08 14:53:44 +08:00
Sergey Sharybin
58b7e02cdb Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

Differential Revision: https://developer.blender.org/D13385
2021-12-08 14:53:44 +08:00
Mikhail Matrosov
f42f6f890d Fix T93418: Cycles shadow terminator Geometry Offset artifacts with translucency
Differential Revision: https://developer.blender.org/D13468
2021-12-08 14:53:44 +08:00
d75cbbdd53 Build: remove Cycles CUDA/HIP/OPTIX build options on macOS
So those device types are not listed in the preferences. Metal will be
added instead as the only option.
2021-12-08 14:53:44 +08:00
faba351c49 Build: clean up handling of some Cycles build options
* Don't link embree / OSL when WITH_CYCLES is disabled
* Simplify lite config by disabling Cycles as a whole using this
* Remove code handling the removed WITH_CYCLES_NETWORK option
2021-12-08 14:53:44 +08:00
defd20240e Cycles: Reintroduce device-only memory handling that got lost in Cycles X merge
Somehow only a part of rBf4f8b6dde32b0438e0b97a6d8ebeb89802987127 ended up in
Cycles X, causing the issue that commit fixed, "OPTIX_ERROR_INVALID_VALUE" when the
system is out of memory, to show up again.
This adds the missing changes to fix that problem.

Maniphest Tasks: T93620

Differential Revision: https://developer.blender.org/D13488
2021-12-08 14:53:44 +08:00
315776bef0 Cycles: add Metal device type to device_type_for_description
Add a `DEVICE_METAL` case to the enum-value-to-string mapping function.
2021-12-08 14:53:44 +08:00
99ab4dfea4 Cycles: fix build on non-Apple systems
Skip compiling `metal.mm` unless `WITH_CYCLES_DEVICE_METAL` is enabled.
2021-12-08 14:53:44 +08:00
da379697d4 Geometry Nodes: Edge Neighbors Node
Creates a new Edge Neighbors node which outputs a field
containing the number of faces connected to each edge.

Differential Revision: https://developer.blender.org/D13493
2021-12-08 14:53:44 +08:00
4c7bcb12ec Cycles: Metal host-side code
This patch adds the Metal host-side code:

- Add all core host-side Metal backend files (device_impl, queue, etc)
- Add MetalRT BVH setup files
- Integrate with Cycles device enumeration code
- Revive `path_source_replace_includes` in util/path (required for MSL compilation)

This patch also includes a couple of small kernel-side fixes:

- Add an implementation of `lgammaf` for Metal [Nemes, Gergő (2010), "New asymptotic expansion for the Gamma function", Archiv der Mathematik](https://users.renyi.hu/~gergonemes/)
- include "work_stealing.h" inside the Metal context class because it accesses state now

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13423
2021-12-08 14:53:44 +08:00
ab2223ecac Geometry Nodes: new Geometry to Instance node
This adds a new Geometry to Instance node that turns every
connected input geometry into an instance. Those instances
can for example be used in the Instance on Points node.

Differential Revision: https://developer.blender.org/D13500
2021-12-08 14:53:44 +08:00
bab0cbd8b6 Geometry Nodes: move type conversions to blenkernel
The type conversions do not depend on other files in the nodes
module. Furthermore we want to use the conversions in the
geometry module without creating a dependency to the
nodes module there.
2021-12-08 14:53:44 +08:00
4e2b05f23e Cleanup: Add macro and functions for node storage
The `node_storage` functions to retrieve const and mutable structs
from a node are generated by a short macro that can be placed at the
top of each relevant file. I use this in D8286 to make code snippets
in the socket declarations much shorter, but I thought it would be
good to use it consistently everywhere else too.

The functions are also useful to avoid copy and paste errors,
like the one corrected in the cylinder node in this commit.

Differential Revision: https://developer.blender.org/D13491
2021-12-08 14:53:44 +08:00
Yuchen Wen
10e1049043 Fix T93467: Use world bg color for pose library previews
Use the World viewport color when rendering pose library previews.

The World's viewport color is chosen instead of the World shading nodes,
as the latter would require rendering with `OB_RENDER` (instead of
`OB_SOLID`), which would take considerably longer.

Manifest Task: T93467

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13470
2021-12-08 14:53:44 +08:00
9219f4721e Revert moving all shader nodes to c++
This reverts to following commits:
* rB5cad004d716da02f511bd34983ac7da820308676
* rB97e3a2d935ba9b21b127eda7ca104d4bcf4e48bd
* rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
* rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
* rBf72cc47d8edf849af98e196f721022bacf86a5e7
* rB3f7014ecc9d523997062eadd62888af5fc70a2b6
* rB0578921063fbb081239439062215f2538a31af4b
* rBc20098e6ec6adee874a12e510aa4a56d89f92838
* rBd5efda72f501ad95679d7ac554086a1fb18c1ac0

The original move to c++ that the other commits depended upon had some issues
that should be fixed before committing it again. The issues were reported in
T93797, T93809 and T93798.

We should also find a better rule for not using c-style casts going forward,
although that wouldn't have been reason enough to revert the commits.
Introducing something like a `MEM_new<T>` and `MEM_delete<T>`
function might help with the the most common case of casting the return
type of `MEM_malloc`.

Going forward, I recommend first committing the changes that don't
require converting files to c++. Then convert the shading node files
in smaller chunks. Especially don't mix fairly low risk changes like
moving some simple nodes, with higher risk changes.
2021-12-08 14:53:44 +08:00
8bfe3e63e1 Fix T93797, T93809: Crash/undefined-behavior when opening demo file
Error in d5efda72f5. Was changing an iteration that would free items
to an iterator that is not safe for use in such cases.

There still seem to be significant issues with the rendering, but that's
a separate issue to be fixed.
2021-12-08 14:53:44 +08:00
78314b91e2 Fix memory leak when loading large asset libraries 2021-12-08 14:53:44 +08:00
2b662a0be8 Fix crash when switching back from render preview.
Issue is that external engine uses the gpu info. but overwrote the
instance data. The draw manager would then detect instance data and
required the engine type to have a instance free callback.

The solution is to save some space in the engine data to hold an empty
and unused instance_data attribute to comply with `ViewportEngineData`
struct.
2021-12-08 14:53:44 +08:00
Jeroen Bakker
a858188604 DrawManager: Engine Instance Data.
In the original design draw engines had to copy with a limitation that
they were not allowed to reuse complex data structures between drawing
calls. Data that could be reused were limited to:
- GPUFramebuffers
- GPUTextures
- Memory that could be removed calling MEM_freeN (storage list)
- DRWPass

This is fine when the storage list contains arrays or structs but when
more complex data types (vectors, maps) etc wasn't possible.

This patch adds instance_data that can be reused between drawing calls.
The instance_data is controlled by the draw engine and doesn't need to
be limited as described above.

When an engines stores instance_data it must implement the
`DrawEngineType.instance_free` callback to free the data.

The patch originates from eevee rewrite. But was added to master as the
image engine rewrite also has a need for it.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13425
2021-12-08 14:53:44 +08:00
Jeroen Bakker
be6783892d Cleanup: Use rcti marking dirty regions when texture painting.
Dirty regions when painting are not using rcti. Meaning less
understandable code. Found issue when refactoring the image_gpu partial
update. In a future change gpu partial update API will be using rcti
also what makes the code even cleaner.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13260
2021-12-08 14:53:44 +08:00
191fc310e6 Cleanup: note that functions in BKE_node.h aren't part of blenkernel 2021-12-08 14:53:44 +08:00
793e03f477 Cleanup: remove BKE_ptcache_remove
No longer needed as the temporary directory is cleared on exit.
2021-12-08 14:53:43 +08:00
a0d0ea3238 Cleanup: sort DNA renaming
Add note at the beginning & end so it's not overlooked.
2021-12-08 14:53:43 +08:00
6b29c21c8b Cleanup: clang-format 2021-12-08 14:53:43 +08:00
bc0402ef21 Cleanup: clarify source/destination args for BKE_spacedata_copylist 2021-12-08 14:53:43 +08:00
427b96fe63 Cleanup: remove incorrect/unhelpful comments 2021-12-08 14:53:43 +08:00
c5d6d6d6d7 Cleanup: replace int with bool type 2021-12-08 14:53:43 +08:00
64fb53278d Cleanup: move public doc-strings into headers for 'blenkernel'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-08 14:53:43 +08:00
luzpaz
e9b90a8669 Cleanup: Fix various source typos
This is a continuation of D13462 to clean up source typos.

Differential Revision: https://developer.blender.org/D13471
2021-12-08 14:53:43 +08:00
luzpaz
549ef980ba Cleanup: Fix typos in source code
Source typos corrected

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D13462
2021-12-08 14:53:43 +08:00
05a49ddfc2 Docs: Incorrect link to context type
Fixes T93773
2021-12-08 14:53:43 +08:00
0f02993436 Cleanup: clang format 2021-12-08 14:53:43 +08:00
7b0ed56c8f Shader Nodes: Migrate shader category to new node socket declaration API
No functional changes, tests passed and I double checked the nodes by hand.
2021-12-08 14:53:43 +08:00
Christoph Lendenfeld
66bfd5b2ba Fix: Remove line from common invoke
The line that sets the factor_prop in graph_slider_ops.c
has been left in the common invoke function by accident.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13477
Ref: D13477
2021-12-08 14:53:43 +08:00
Christoph Lendenfeld
ae72981266 Cleanup: renames in graph_slider_ops
rename percentage_prop to factor_prop
rename remove_ratio to factor
remove "graphkeys" prefix from functions

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13476
Ref: D13476
2021-12-08 14:53:43 +08:00
e4c7c84baf Cleanup: Use C++ types for multi input socket sorting
The algorithm used is still quite inefficient, but at least the code
is easier to read and a little bit simpler now.
2021-12-08 14:53:43 +08:00
c632b2a294 Cleanup: Remove unused includes 2021-12-08 14:53:43 +08:00
43065fea5d Cleanup: Remove unused node flag 2021-12-08 14:53:43 +08:00
66d9746b6d Cleanup: Remove unnecessary generic includes from headers 2021-12-08 14:53:43 +08:00
548d9f2e7c Fix: Compile error in field input
Instead of essentially hashing a bool, just use a ternary operator.

Differential Revision: https://developer.blender.org/D13494
2021-12-08 14:53:43 +08:00
8c31bc7077 macOS: Fix build error in hash functions
Remove unneeded recent static_cast attempt.

Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13492
2021-12-08 14:53:43 +08:00
Aaron Carlisle
9df9d40ae4 Shader Nodes: Split each node into own file
This improves both code finding,  for example "color ramp" now has its own file.
And now each node has its own namespace so function names can be simplified
similar to rBfab39440e94

This commit also makes all file names use snake case instead of camel case.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13482
2021-12-08 14:53:42 +08:00
f65cac02fb Cleanup: Fix warnings about copied Map loop variables
The `Map::items()` iterator does not return references.
2021-12-08 14:53:42 +08:00
3b6d7b4fd8 Fix: Attempt to fix build error on macOS 2021-12-08 14:53:42 +08:00
Aaron Carlisle
4b21003880 Nodes: Add function to set compact socket flag for vectors
This flag is currently only used for vector sockets
so the function is limited to the vector builder.

The flag is only used by two shader nodes at the moment
and this is needed to port them over to the new socket declaration API.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13490
2021-12-08 14:53:42 +08:00
eeb3279af8 Geometry Nodes: reduce code duplication with new GeometyrFieldInput
Most of our field inputs are currently specific to geometry. This patch introduces
a new `GeometryFieldInput` that reduces the overhead of adding new geometry
field input.

Differential Revision: https://developer.blender.org/D13489
2021-12-08 14:53:42 +08:00
25395ae9cc Geometry Nodes: 4 Field Inputs for Mesh Topology Data
Creates 4 new nodes which provide topology information
for the mesh. Values are interpolated from the primary
domain in each case using basic attribute interpolation.

Vertex Neighbors
  - Vertex Count
  - Face Count
Face Neighbors
  - Vertex Count
  - Neighboring Face Count
Edge Vertices
  - Vertex Index 1
  - Vertex Index 2
  - Position 1
  - Position 2
Face Area
  - Face Area

Differential Revision: https://developer.blender.org/D13343
2021-12-08 14:53:42 +08:00
70160f4bc2 Fix T93521: Single point NURBS crash in resample node
The resample node didn't handle the case of when a spline didn't have
any evaluated points. For poly and Bezier splines we should never hit
this case, but it is expected when the number of NURBS control points
is smaller than its order, so we have to handle the case here.

It's not that obvious what to do in this case, there are a few options:
 - Remove the bad splines from the result
 - Generate empty splines for those inputs
 - Skip resampling the bad splines, copy them to the result
 - Arbitrarily generate single point splines

I chose option three, just skipping the "bad" splines. Since the node
already has a selection input, this can be described by just extending
that. "Splines with no evaluated points are implicitly deselected."
The first option would probably be valid too though.

Differential Revision: https://developer.blender.org/D13434
2021-12-08 14:53:42 +08:00
Aaron Carlisle
6acf745fd3 Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

As a test, this commit also converts the Add Shader node to the new API

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13485
2021-12-08 14:53:42 +08:00
Aaron Carlisle
0d701db225 Shader Nodes: Unity Build
- Create a new `bf_nodes_shader` library
- Enable unity builds for  `bf_nodes_shader`, gives abount a 2.7x speed up for compile times

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13484
2021-12-08 14:53:42 +08:00
21dd178c62 Disable asset indexing in the Asset List
Asset indexing should be disabled, but this was overlooked in the
asset list (used for the pose library in the 3D View).
2021-12-08 14:53:42 +08:00
90126bb4a8 Asset Indexer: use fixed-length string for ID code
Use fixed-length string to convert `char[2]` to `std::string`. Otherwise
`strlen()` is called, which is problematic as the `char[2]` is not
zero-terminated.
2021-12-08 14:53:42 +08:00
3115d906b3 Cleanup: remove unnecessary extern template implementations
This technique isn't really necessary anymore, because unity builds
avoid instantiating the same template too many times already.
2021-12-08 14:53:42 +08:00
55c195c82a Fix T93314: Thumbnails not drawn with default scale
Decrease threshold for drawing thumbnails.

This was unintended change in daaa43232d that was overlooked.
2021-12-08 14:53:42 +08:00
f10928354b VSE: Fix strip with mask modifier not blending
Set `ibuf->planes` to `R_IMF_PLANES_RGBA` because mask modifier adds
transparent areas to image.
2021-12-08 14:53:42 +08:00
Aurelien Jarno
6f6a003fe0 cmake: fix linking with WITH_X11_XF86VMODE and bfd
Fix typos in the variables of the Xxf86vm libray to fix link failure
with bfd. These variables are defined in platform_unix.cmake.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D12911
2021-12-08 14:53:41 +08:00
0deb799813 Fix T93707: Dragging the tweaked NLA strip causes crash
Earlier code assumed that the active strip was on the active track. This
commit detects when this assumption doesn't hold, and adds a more thorough
search of the active strip.
2021-12-08 14:53:41 +08:00
7f63996483 Fix T93611: Curve modifier crash in editmode in certain situations
Caused by {rB3b6ee8cee708}

Above commit was trying to get the vertexgroup from the mesh that is
passed into `deformVertsEM` (but that can be NULL).
When can it be NULL, when is is non-NULL?
`editbmesh_calc_modifiers` only passes in a non-NULL mesh to
`deformVertsEM` under certain conditions:
- a non-deform-only modifier is handled currently
- a non-deform-only modifier preceeds the current modifier
- a deform-only modifier preceeds the current modifier (and the current
one depends on normals)

So the passed-in mesh cannot be relied on, now get the vertex group from
the context object data (like it was before the culprit commit).

Related commit: rB8f22feefbc20

Maniphest Tasks: T93611

Differential Revision: https://developer.blender.org/D13487
2021-12-08 14:53:41 +08:00
7bcaeafc02 Cleanup: remove some temp dev asserts in new link/append code.
No longer needed now that all code uses that new
BKE_blendfile_link_append module, and that instantiation code in
BLO_readfile has been removed.
2021-12-08 14:53:41 +08:00
47b88c1be1 Fix T93388: dropping object on grid in orthogonal view misses the floor plane
`ED_view3d_win_to_3d_on_plane` does not use the `clip_start` and
`clip_end` values of the scene, so the `do_clip` option can be misleading
especially in the orthographic view where the `clip_start` is negative.

For now, don't use the `do_clip` option in orthographic view.
2021-12-08 14:53:41 +08:00
2d542b012c Fix T93732: Snap Cursor not working after changing Add Object settings
`g_data_intern.state_default.gzgrp_type` is a very specific member and
cannot be set to default.
2021-12-08 14:53:41 +08:00
Aaron Carlisle
37ce9da1b2 Shader Nodes: Declare nodes in their own namespace
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5

This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly

- The namespace name is derived from the file name.
  That makes it possible to write some tooling that checks the names later on.
  The filename extension (cc) is added to the namespace name as well.
  This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
- In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;.
  This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect.
  The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file.

In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13480
2021-12-08 14:53:41 +08:00
37093fa59b Cleanup: Remove unused next and prev pointers in bNodeType 2021-12-08 14:53:41 +08:00
3ea1bf1e34 Cleanup: Remove unnecesary node type draw callback
As a followup to 338c1060d5, apply the same change to the node
drawing callback. This helps to simplify code when the complexity
of a callback isn't necessary right now.
2021-12-08 14:53:41 +08:00
ac28b34f4f Cleanup: Remove unnecessary node type callbacks for drawing
Currently there are a few callbacks on `bNodeType` that do the same
thing for every node type except reroutes and frame nodes. Having a
callback for basic things complicates code and makes it harder to
understand, and reroutes and frames are special cases in larger way.

Arguably frame nodes shouldn't even be drawn like regular nodes,
given that it adds a case of O(N^2) looping through all nodes.
"Unrolling" the callbacks makes it easier to see what's happening,
and therefore easier to optimize.

Differential Revision: https://developer.blender.org/D13463
2021-12-08 14:53:41 +08:00
15850ce4d8 Cleanup: clang-tidy: modernize-redundant-void-arg
This change follows up on recent c --> c++ conversions
2021-12-08 14:53:41 +08:00
38f763d73d Cleanup: Add missing include
Fixes compilation errors after rBd5efda72f501
Re sorted some includes.
2021-12-08 14:53:41 +08:00
Aaron Carlisle
96aa44caba Cleanup: Migrate all shader nodes to c++
This will be useful in the future to use the new socket builder API

Aditional changes:

- Declare variables where initialized
- Do not use relative includes

Differential Revision: https://developer.blender.org/D13465
2021-12-08 14:53:41 +08:00
c646cf5378 Geometry Nodes: use array instead of map in GeometrySet
`GeometrySet` contains at most one component of each type.
Previously, a map was used to make sure that each component
type only exists once. The overhead of a map (especially with
inline storage) is rather large though. Since all component types
are known at compile time and the number of types is low,
a simple `std::array` works as well.

Some benefits of using `std::array` here:
* Looking up the component of a specific type is a bit faster.
* The size of `GeometrySet` becomes much smaller from 192 to 40 bytes.
* Debugging a `GeometrySet` in many tools becomes simpler because
  one can  easily see which components exists and which don't
2021-12-08 14:53:41 +08:00
ac633ee159 Fix (unreported): off-by-one error when setting curve handles
The problem is that `current_mask` can become `selection.size()`.
The loop could also be refactored to break out of it when the end
of the selection is reached. This can be done separately.
2021-12-08 14:53:41 +08:00
Aaron Carlisle
3eb4b83923 Compositor: Migrate most nodes to new socket builder API
This patch leaves a out a few nodes:

- Group Nodes
- Image input node
- File output node
- Switch View
- Cryptomatte

These nodes above are a bit more complicated and should be worked on individually.

Differential Revision: https://developer.blender.org/D13266
2021-12-08 14:53:41 +08:00
Christoph Lendenfeld
bec6f99b84 Create generic modal functions from GRAPH_OT_decimate
This patch extracts the modal functions from GRAPH_OT_decimate
and makes them generic so they can be reused by future operators

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9326
Ref: D9326
2021-12-08 14:53:41 +08:00
2d808b66c7 Cleanup: Use LISTBASE_FOREACH macro 2021-12-08 14:53:41 +08:00
3548aa3485 Cleanup: Use references in node editor, other improvements
This helps to tell when a pointer is expected to be null, and avoid
overly verbose code when dereferencing. This commit also includes
a few other cleanups in this area:
 - Use const in a few places
 - Use `float2` instead of `float[2]`
 - Remove some unnecessary includes and old code
The change can be continued further in the future.
2021-12-08 14:53:41 +08:00
9ec203ea7b Cleanup: Remove unused code
This is very old and is unlikely to be useful in the near future.
2021-12-08 14:53:41 +08:00
663ac58c93 Cleanup: Const, use references, C++ types
Also remove some unnecessary includes
2021-12-08 14:53:41 +08:00
58c071e14a Cleanup: Comments and ordering in node editor header 2021-12-08 14:53:41 +08:00
22fe426537 Cleanup: Use typed enum for node resize direction 2021-12-08 14:53:41 +08:00
80adda3661 ImBuf: Made Wrapping and Cropping optional in IMB_transform.
`IMB_transform` is used in VSE. It had a required crop parameter
for cropping the source buffer. This is not always needed.

In the image engine we want to use the use the `IMB_transform`
with wrap repeat. Both options are mutual exclusive and due
to performance reasons the wrap repeat is only available when
performing a nearest interpolation.
2021-12-08 14:53:41 +08:00
9cf18f09d8 Cleanup: move public doc-strings into headers for 'bmesh'
Some minor improvements to doc-strings too.

Ref T92709
2021-12-08 14:53:41 +08:00
Jesse Yurkovich
796df8d4be Fix T93541: Use warning instead of error for exceeding layer limits
Instead of using RPT_ERROR, use RPT_WARNING which will not raise an
exception to Python. This broke some scripts (including FBX import)
which already check for a None return value.

Ref D13458

Reviewed By: campbellbarton
2021-12-08 14:53:41 +08:00
e7e00ee914 Fix T93574: Asset triangulating a mesh
Correct assert for edit-mesh normal calculation.
2021-12-08 14:53:41 +08:00
8d7d5b43f0 UI: Expand tree-view items (e.g. asset catalogs) on click to activate
This actually gives a quite nice behavior in my opinion, especially for
asset catalogs, where activating a catalog makes all assets inside it or
its (grand-)child catalogs visible, so showing the child catalogs then
adds useful information. Maybe this should become a feature for
asset catalogs only, to be evaluated once the tree-view API is used in
more cases. Only asset catalogs are affected by this change right now.

Part of T93582.
2021-12-08 14:53:41 +08:00
8364bc5b89 Asset Browser: Don't expand top-level catalogs by default
The "All" item will be expanded of course, and the tree will also be
expanded so that the active item is visible. But feedback was that in
some setups, opening all the top-level catalogs is a bit too much. So
collapse them for a more compact default layout.

Part of T93582.
2021-12-08 14:53:41 +08:00
5f0b81ad60 Blender 3.0 - version bump -> release 2021-12-08 14:53:41 +08:00
0fb60caa18 Licenses: Attribution document for Blender 3.0
A few libraries were updated, a few were added, and a few were missing
from the previous license document.
2021-12-08 14:53:25 +08:00
1006895116 Docs: add README for HIPEW library 2021-12-08 14:53:25 +08:00
2f7d923118 NanoSVG: Mention the version we use 2021-12-08 14:53:25 +08:00
f758aa9aab Docs: 3.0 release description for Linux appdata
Includes a typo fix for 2.93.
2021-12-08 14:53:25 +08:00
ca8474976c Asset Browser: Remove home icon for "All" item
Originally this wasn't really meant to stay there permanently, but
helped giving things a nicer alignment. Others seemed to like it at
first so it stayed, but after more feedback we decided to remove it
again. The alingment is better now with the previous commit.

Part of T93582.
2021-12-08 14:53:25 +08:00
b6b80a834a Asset Browser: Nest all catalogs under the "All" item
This makes the relation to the catalogs and the behavior more clear.

Part of T93582.
2021-12-08 14:53:25 +08:00
96e3ddf57e Cleanup: Avoid using C++ keyword as variable name 2021-12-08 14:53:25 +08:00
6c44d77ae0 Fix missing Blender logo in Windows store package
D9681 was not properly merged to all branches, leaving a path to a non-existent
icon file in the maniphest.
2021-12-08 14:53:25 +08:00
299435adb5 Fix T93560: crash with image paint undo and cycles preview render
Cycles preview rendering could free the image buffers being used by drawing in
another thread due to a race condition. This race condition was unlikely before,
but now that preview renders are started right before we draw the image in the
image editor or load it as a texture in the 3D viewport, it's likely to happen.

As we are close to release this is too risky to fix properly, just avoid freeing
the cache for preview renders instead and accept increased memory usage in some
cases.
2021-12-08 14:53:25 +08:00
f2b81cd022 Fix (unreported): incorrect custom data layer created
Without this fix `CustomDataAttributes::create_by_move`
did not work on named attributes.
2021-12-08 14:53:25 +08:00
e865e8561d Cleanup: Move public docs to BKE_spline.hh header 2021-12-08 14:53:25 +08:00
b5f780aae8 Fix Action.asset_data["is_single_frame"] set incorrectly
The asset metadata custom property `["is_single_frame"]` was set
incorrectly. Since this is intended for forward compatibility, including
being covered by the asset metadata indexing, it's important to have it
set correctly from the first release of Blender that includes the asset
browser.

Differential Revision: https://developer.blender.org/D13452
2021-12-08 14:53:25 +08:00
ec7e20fa18 Fix: don't use BLI_strncpy_utf8 for copying file paths
File paths can be any encoding, so using some UTF-8-specific function is
not the right way to go.
2021-12-08 14:53:25 +08:00
a3c37b6250 Blenloader: move ghost include path from INC to TEST_INC
The Ghost dependency was added to avoid a memory leak (rBc7a1e115b507),
but since that's only for the unit tests, it's better to add the path to
`TEST_INC`.
2021-12-08 14:53:25 +08:00
dc6a2fb205 BLI: avoid invoking tbb for small workloads
We often call `parallel_for` in places with very variable
sized workloads. When many elements are processed,
using multi-threading is great, but when processing
few elements (possibly many times) using `parallel_for`
can result in significant overhead.

I measured that this improves performance by >20% in
the refactored realize instances code I'm working on
separately. The change might also help with debugging
sometimes, because the stack trace is smaller and contains
fewer irrevelant symbols.
2021-12-08 14:53:25 +08:00
6e85fce35f Fix T93563: Crash subdividing with overlapping tri and quad
The first loop was left out when finding the split edge boundary.

Error from f2138686d9.
2021-12-08 14:53:25 +08:00
5fd58eefe0 Cleanup: move public doc-strings into headers for 'python' 2021-12-08 14:53:25 +08:00
2b49336ddc Fix T92308: OptiX denoising fails with high resolutions
The OptiX denoiser does have an upper limit as to how many pixels it can denoise at once, so
this changes the OptiX denoising process to use tiles for high resolution images.
The OptiX SDK does have an utility function for this purpose, so changes are minor, adjusting
the configured tile size and including enough overlap.

Maniphest Tasks: T92308

Differential Revision: https://developer.blender.org/D13436
2021-12-08 14:53:25 +08:00
fb724db968 Fix T93548: Appended (material) assets don't have a fake user
Since our design is to always keep data-blocks marked as assets on exit,
and our technical design for this is to do this via fake users, ensure
the fake user is set for an appended asset.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D13443
2021-12-08 14:53:25 +08:00
71740d140f Blendread: Remove all instantiation logic from BLO_library_link_ code.
Instantiation is now fully handled by BKE_blendfile_link_append module.

Note that this also allows removal of the `BLO_LIBLINK_NEEDS_ID_TAG_DOIT`
flag.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-12-08 14:53:24 +08:00
11501e26da Cleanup: Readfile: Remove deprecated BLO_library_link_copypaste.
Rewrite of ID paste code in rB3f08488244c0 made this function useless,
ID pasting is now handled by the BKE_blendfile_link_append module too.
2021-12-08 14:53:24 +08:00
f849df78c7 Fix T93555: crash when muting nodes with multiple internal links
The crash happened because I was incorrectly and inconsistently assuming
that a socket is part of at most one internal link. However, this is not the case.
In geometry nodes, an input socket can be internally linked to multiple
output sockets. In the general case, an output could also be linked to multiple
input sockets, even though we don't have that in Blender yet.
2021-12-08 14:53:24 +08:00
dbc1521695 Cleanup: spelling in comments 2021-12-08 14:53:24 +08:00
c3f6342f41 Fix T93410: Crash hiding a region from Python used by a popover
Close all active buttons when hiding a region as this can be called
from Python a popover is open from that region.

Failure to do this causes the popover to read from the freed button.

Also rename UI_screen_free_active_but to
UI_screen_free_active_but_highlight since it only frees highlighted
buttons.
2021-12-08 14:53:24 +08:00
cc27d72bc3 Cleanup: FIx build with USD after recent refactor
rB218360a89217f4e8321319035bf4d9ff97fb2658 missed a couple renames in USD code paths.
2021-12-08 14:53:24 +08:00
Leon Leno
168f40f731 UI: Fix scaling of HSV cursor when zooming
The small circle used to choose the hue/saturation and value in the
color widget was drawn with a fixed screen space size. Now scale the
circle used as cursor in the color widget based on the zoom. This
could have been part of a9642f8d61 but the implementation is
different.

Based on a fix provided by Erik Abrahamsson

Differential Revision: https://developer.blender.org/D13444
2021-12-08 14:53:24 +08:00
Nikhil Shringarpurey
41885769a5 Fix T92268: Group input and output nodes have inconsistent padding
The group output node did not have the same size padding as the group
input, leading to the node looking different and actually being smaller.

Differential Revision: https://developer.blender.org/D13092
2021-12-08 14:53:24 +08:00
4777795b0c Cleanup: Rename curve struct fields
These existing names were unhelpful at best, actively confusing at
worst. This patch renames them to be consistent with the terms
used to refer to the values in the UI.
 - `width` -> `offset`
 - `ext1` -> `extrude`
 - `ext2` -> `bevel_radius`

Differential Revision: https://developer.blender.org/D9627
2021-12-08 14:53:24 +08:00
27bb3b2f3d Fix: Add tooltip translation marker to disabled hints
This was overlooked, as it seems there's no way for these strings to be
translated currently. Generally it's not that clear whether `N_` or
`TIP_` should be used in this case, but `TIP_` seems more consistent.
To avoid the cost of the translation lookup when the UI text isn't
necessary, we could allow the disabled hint argument to be optional.

Differential Revision: https://developer.blender.org/D13141
2021-12-08 14:53:24 +08:00
4f379829d1 Fix T84710: Instances with only mesh edges or vertices are invisible
Wire-only meshes have a special case in the overlay drawing to give
the wire shader a special color (which avoids the lines being dashed,
somehow). The fast path for duplis didn't have that special case.

Differential Revision: https://developer.blender.org/D13196
2021-12-08 14:53:24 +08:00
b4c47796f6 UI: Add an option to display the node editor context path
Since we have the overlays popover, it makes sense to allow toggling the
context path like in the 3D viewport. This commit adds a property,
and turns it on by default in existing files.

Differential Revision: https://developer.blender.org/D13248
2021-12-08 14:53:24 +08:00
c4ca0cfa3b Fix: Updating geometry nodes test results fails
I ran into this when adding new geometry nodes tests.
The issue was caused by 7168a4fa5c.

Differential Revision: https://developer.blender.org/D13440
2021-12-08 14:53:24 +08:00
069c5f5715 Fix T93525: Crash with curve/text armature bone gizmo
The problem is that drw_batch_cache_generate_requested_delayed
is called on the object, which uses the original object data type to
choose which data type to get info for. So for curves and text it uses
the incorrect type (not the evaluated mesh like we hardcoded in the
armature overlay code).

To fix this I hardcoded the "delayed" generation to only use the
evaluated mesh. Luckily it wasn't use elsewhere besides this
armature overlay system. That seems like the simplest fix for
3.0. A proper solution should rewrite this whole area anyway.

Differential Revision: https://developer.blender.org/D13439
2021-12-08 14:53:24 +08:00
2a7e609e24 Fix(unreported): LineArt intersection mask logic error.
The stroke generation call mistakenly uses all enabled
types to check intersection mask, the correct behavior
is to use individual edge(chain) type.
2021-12-08 14:53:24 +08:00
258cb9fb85 Cleanup: Move node_shader_util.c to C++
This will allow using a function I've declared in a C++ header.
2021-12-08 14:51:22 +08:00
9ecb614fa0 Cleanup: compiler warning 2021-12-08 14:51:22 +08:00
Sebastian Herholz
210232151f Cycles: fix bugs in point and spot light multiple importance sampling
* Spot lights are now handled as disks aligned with the direction of the
  spotlight instead of view aligned disks.

* Point light is now handled separately from the spot light, to fix a case
  where multiple lights are intersected in a row. Before the origin of the
  ray was the previously intersected light and not the origin of the initial
  ray traced from the last surface/volume interaction.

This makes both strategies in multiple importance sampling converge to the same
result. It changes the render results in some scenes, for example the junkshop
scene where there are large point lights overlapping scene geometry and each
other.

Differential Revision: https://developer.blender.org/D13233
2021-12-08 14:51:22 +08:00
d5abcaba28 Cleanup: clarify material copying for hair and pointclouds
No functional change, just more clear this way it comes from src.
2021-12-08 14:51:22 +08:00
Yuki Hashimoto
f3d7f9b62d Fix some shortcut keys not working on macOS with Japanese input
Differential Revision: https://developer.blender.org/D13414
2021-12-08 14:51:22 +08:00
22811ddb81 Fix: Remove incorrect asserts for empty attributes
While it is an edge case, it isn't incorrect for the attribute storage
to have a zero size, it will just return an empty span or nothing.
2021-12-08 14:51:21 +08:00
dd1443a791 Fix: Instances component does not copy attributes 2021-12-08 14:51:21 +08:00
a73da2f87e Cleanup: Fix errors in previous commit
After 1ef8ef4941 there were build warnings because of unused
arguments. Also missed to change code to iterate `strips` instead of
`seqbase` in 2 functions.
2021-12-08 14:51:21 +08:00
9dddd18096 Geometry Nodes: deduplicate join geometry code
The Realize Instances and Join Geometry node can share most of their code.
Until now, both nodes had their own implementations though. This patch
removes the implementation in the Join Geometry node in favor of the more
general Realize Instances implementation.

This removes an optimization for avoiding spline copies. This can be brought
back later. The realize instances code has to be rewritten to support attribute
instances anyway.

Differential Revision: https://developer.blender.org/D13417
2021-12-08 14:51:21 +08:00
Wannes Malfait
b91b8638cd Geometry Nodes: Dual Mesh Node
This node calculates the dual of the input mesh. This means that faces
get replaced with vertices and vertices with faces. In principle this
only makes sense when the mesh in manifold, but there is an option to
keep the (non-manifold) boundaries of the mesh intact.

Attributes are propagated:
 - Point domain goes to face domain and vice versa
 - Edge domain and Face corner domain gets mapped to itself
Because of the duality, when the mesh is manifold, the attributes get
mapped to themselves when applying the node twice.

Thanks to Leul Mulugeta (@Leul) for help with the
ascii diagrams in the code comments.

Note that this does not work well with some non-manifold geometry,
like an edge connected to more than 2 faces, or a vertex connected to
only two faces, while not being in the boundary. This is because there
is no good way to define the dual at some of those points. This type
of non-manifold vertices are just removed for this reason.

Differential Revision: https://developer.blender.org/D12949
2021-12-08 14:51:21 +08:00
8e092936b5 Geometry Nodes: Generalized Compare Node
Replace compare floats node with a generalized compare node. The node
allows for the comparison of float, int, string, color, and vector.

The datatypes support the following operators:
Float, Int: <, >, <=, >=, ==, !=
String: ==, !=
Color: ==, !=, lighter, darker
    (using rgb_to_grayscale value as the brightness value)

Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >=
Average: The average of the components of the vectors are compared.
Dot Product: The dot product of the vectors are compared.
Direction: The angle between the vectors is compared to an angle
Element-wise: The individual components of the vectors are compared.
Length: The lengths of the vectors are compared.

Differential Revision: https://developer.blender.org/D13228
2021-12-08 14:51:21 +08:00
cfc177adad Cleanup: Store instances id attribute with other attributes
Now that we can store any dynamic attribute on the instances component,
we don't need the special case for `id`, it can just be handled by the
generic attribute storage. Mostly this just allows removing a bunch
of redundant code.

I had to add a null check for `update_custom_data_pointers` because
the instances component doesn't have any pointers to inside of
custom data.

Differential Revision: https://developer.blender.org/D13430
2021-12-08 14:51:21 +08:00
Paul Golter
d604114385 Add layer and pass index parameters to rna_Image_gl_load
This patch adds a layer_idx and pass_idx parameter to the rna_Image_gl_load function. It exposes both to the Python API as optional parameters.
This allows python scripters to specifiy which layer and pass they want to load in to an OpenGL texture. Right now image.gl_load() always takes the first layer and first pass.
This is limiting when working with multilayer openEXRs.

With this patch scripters can do something like this:

```
pass_idx = area.spaces.active.image_user.multilayer_pass
layer_idx = area.spaces.active.image_user.multilayer_layer
image.gl_load(frame=0, layer_idx=layer_idx, pass_idx=pass_idx)
```

As the parameters are optional and default to 0, it should not break existing code.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13435
2021-12-08 14:51:21 +08:00
b84b348636 Cleanup: Remove seq->tmp_flag DNA member
Commit f0d20198b2 used this field to flag rendered strips which were
queried by `SEQ_query_rendered_strips()`. Then operators iterate all
strips and checks state of `seq->tmp_flag`.

Use collection returned by `SEQ_query_rendered_strips` directly.
There should be no functional changes.

This commit adds functions `all_strips_from_context` and
`selected_strips_from_context` that provide collection of strips based
on context. Most operators can use this collection directly.
There is already `seq->tmp` DNA field, but is should not be used unless
absolutely necessary. Better option is to use human readable flag.
Best is to not use DNA fields for temporary storage in runtime.
2021-12-08 14:51:21 +08:00
da8bf6e7e3 Color adjustments for splash for Blender 3.x series
Tweaks by Andy Goralczyk.
2021-12-08 14:51:21 +08:00
7246ab352a Fix T92561: unstable particle distribution with Alembic files
When enabling or disabling a Mesh Sequence Cache modifier of an Object
with a hair particle system, the hair would switch positions. This is
caused because original coordinates in Blender are expected to be
normalized, and toggling the modifier would cause the usage of different
orco layers: one that is normalized, and the other which isn't.

This bug exposes a few related issues:
- if the Alembic file did not have orco data,
`MOD_deform_mesh_eval_get`, used by the particle system modifier, would
add an orco layer without normalization
- `MOD_deform_mesh_eval_get` would also ignore the presence of an orco
layer (e.g. one that could have been read from Alembic)
- if the Alembic file did have orco data, the data would be read
unnormalized

To fix those various issues, original coordinates are normalized when
read from Alembic and unnormalized when written to Alembic; and a new
utility function `BKE_mesh_orco_ensure` is added to add a normalized
orco layer if none exists on the mesh already, this function derives
from the code used in the particle system.

Reviewed By: brecht

Maniphest Tasks: T92561

Differential Revision: https://developer.blender.org/D13306
2021-12-08 14:51:21 +08:00
5fcdc27d6a Cleanup: Use int8 type rather than char for buffer
Indicates that this is just a buffer with an element size of 8 bit, not
a displayable/printable string buffer.
2021-12-08 14:51:21 +08:00
32147c02a6 Fix errors in user preferences after 2.8 hack removal
How to reproduce it:
* Open User Preferences.
* Got to Add-ons tab.

Issue introduced on d723e331f1

Reported via chat by Pedro Alcaide (povmaniac).
2021-12-08 14:51:21 +08:00
44a1a68589 LineArt: Fix consistent view vector bug from merging. 2021-12-08 14:23:21 +08:00
6f4144fafa Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-12-08 13:31:35 +08:00
9afc5ccb6b LineArt: Consistent camera ray direction. 2021-12-01 17:04:10 +08:00
02bcfeb214 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-12-01 17:03:26 +08:00
8a90c19fe5 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-12-01 16:28:47 +08:00
5e0a5059c3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-12-01 16:26:13 +08:00
fbe5c57b0e Merge branch 'temp-lineart-contained' into lineart-shadow 2021-11-30 13:55:18 +08:00
caa68861c2 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-11-30 13:53:16 +08:00
78389c021f LineArt: Ortho tolerance switch 2021-11-17 15:18:24 +08:00
14361596da LineArt: Misc fixes for ortho camera 2021-11-17 14:21:55 +08:00
fd901517b5 Cleanup: Typo 2021-11-15 19:56:19 +08:00
71d6c7e985 LineArt: Clean up occlusion code comments 2021-11-15 19:53:16 +08:00
9bb6c301cd LineArt: Fix thread intersection duplication 2021-11-08 17:36:14 +08:00
ee40dc3678 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-11-08 15:38:23 +08:00
18f1d17898 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-11-07 22:43:48 +08:00
6a9b09a5e9 LineArt: Better handling of boundary cases.
For lineart_LineIntersectTest2d, it fixes the output to 0 or 1 when it's
close enough, gives correct range for point_on_triangle identification.

Then it gives more information through aAligned, which will be true if
two lines completely align, this helps later identification.

Finally: it handles complex cases where one point is on the edge of
a triangle while another point is on the outside.
2021-11-07 22:41:17 +08:00
44548261de LineArt: Point on segment logic correction.
The old code would return true when three points happens to be
on X-Y perpendicular placement, now it handles the case correctly.
2021-11-07 22:31:39 +08:00
1e01459b0a LineArt: view vector fix for ortho back face. 2021-11-07 14:10:55 +08:00
6e8b058093 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-11-07 12:57:24 +08:00
54eec35490 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-28 17:19:17 +08:00
eaf3f080a5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-28 17:09:18 +08:00
48b449797e GPencil: Fix(unreported) Dash modifier wrong logic.
When the modifier iterates to an empty layer with no frame it will return,
while the correct logic is to continue.
2021-10-26 17:11:19 +08:00
a4c5b3568c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-26 17:07:02 +08:00
10da0fed33 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-24 15:59:15 +08:00
513695912c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-18 14:41:09 +08:00
90d1e55b0e Merge branch 'temp-lineart-contained' into lineart-shadow 2021-10-08 16:10:07 +08:00
8a1734bdb6 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-10-08 14:50:58 +08:00
5b88e80ba3 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-09-30 13:31:30 +08:00
b935ae7749 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-30 13:28:39 +08:00
2da010a96e Fix(unreported): LineArt curve objects garbled result.
This is caused by line art loading curve objects twice from curve and converted mesh instances (when instance option is on). Now only load mesh when instance option is on.
2021-09-30 13:26:58 +08:00
e70f187204 LineArt: Fix Merge Error. 2021-09-28 15:06:43 +08:00
3ccc04a817 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-28 14:45:21 +08:00
0f95d361b7 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-26 13:27:40 +08:00
e8612bc000 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-09-25 14:01:33 +08:00
517a025f38 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-25 13:24:05 +08:00
70a3af8f29 Cleanup: Remove extra white space in DNA_gpencil_modifier_defaults.h 2021-09-23 23:25:45 +08:00
64b3d57d3a LineArt: Fix naming error 2021-09-23 13:09:01 +08:00
087e63539e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-23 12:43:54 +08:00
6ce91e6803 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-09-21 14:07:35 +08:00
f594183a9c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-21 14:07:06 +08:00
ae74b38d3b LineArt: Add offset option in object_add. 2021-09-19 20:59:31 +08:00
aaa14be253 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-15 14:40:46 +08:00
d4044db7ed Merge branch 'temp-lineart-contained' into lineart-shadow 2021-09-15 14:22:48 +08:00
d32c3dd556 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-15 14:21:42 +08:00
a460e4e9d8 LineArt: Cleanup trimming patch. 2021-09-11 19:23:51 +08:00
7ae3b3abf8 LineArt: Cleanup smooth patch. 2021-09-11 19:07:06 +08:00
62c2b377fd LineArt: Better smoothing algo. 2021-09-11 17:13:45 +08:00
acea44ca19 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-09-11 13:09:18 +08:00
1d8fdfe121 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-11 13:08:49 +08:00
862d6a9262 LineArt: Restore in_front default on when add 2021-09-01 16:48:54 +08:00
eac266a3d4 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-09-01 16:29:44 +08:00
a087e64396 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-09-01 15:28:06 +08:00
df8a1441aa Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-30 16:47:04 +08:00
53d1b98831 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-08-26 10:43:23 +08:00
253aed44d4 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-26 10:41:17 +08:00
b9fbc0d888 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-25 11:06:46 +08:00
e099a2ceda LineArt: Fix mesh freeing for obi->original_me 2021-08-25 11:00:29 +08:00
2897d16a7f LineArt: Stroke Offset fixes 2021-08-25 10:39:03 +08:00
8c14bea9ea Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-25 10:31:15 +08:00
3a9f3bfa89 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-08-23 16:14:23 +08:00
6b1650a695 LineArt: Use name "stroke depth offset" 2021-08-20 14:02:25 +08:00
992f9147f9 LineArt: Use name "stroke depth offset" 2021-08-20 14:01:46 +08:00
78e27b5e18 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-08-20 12:43:20 +08:00
1433ee03d0 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-20 12:43:06 +08:00
acc25206d0 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-08-18 12:06:22 +08:00
a4757a28dc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-18 12:05:44 +08:00
a12bc92d46 LineArt: point on edge tolerance. 2021-08-17 11:51:21 +08:00
7f126affb2 LineArt: point on edge tolerance. 2021-08-17 11:50:58 +08:00
5a42d2f6b2 LineArt: Fix: Only load selected edge types. 2021-08-16 17:27:42 +08:00
f162a26827 LineArt: Show shadow separator even if no projection. 2021-08-16 14:44:37 +08:00
bfdc22e3ea Merge branch 'temp-lineart-contained' into lineart-shadow 2021-08-16 13:58:40 +08:00
a3714542f8 LineArt: Back face culling auto for shadow scenes. 2021-08-16 13:58:06 +08:00
55f48eebdc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-16 12:20:40 +08:00
72e1c5572e 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-16 12:19:41 +08:00
3ce5d86984 Cleanup: remove unused draw_gpencil_channel.
Code is integrated with draw_scene_channel since 2.80.
2021-08-16 12:19:41 +08:00
cd9c79b465 Docs: tooltip update missing from 3e775a4fc5 2021-08-16 12:19:41 +08:00
b376a65e8e 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-16 12:19:41 +08:00
9ffa6b1c1c 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-16 12:19:41 +08:00
dd0e8059f6 Docs: note that normalize_v# functions zero out input containing nan 2021-08-16 12:19:41 +08:00
6844d98985 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-16 12:19:41 +08:00
9ee1362ace 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-16 12:19:41 +08:00
e4cb956d76 Cleanup: code-comments
Use capitalization, remove unnecessary ellipsis.
2021-08-16 12:19:41 +08:00
4e77953bab 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-16 12:19:41 +08:00
d5a5bde55e 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-16 12:19:41 +08:00
8f5e1bb5be Cleanup: Remove unused includes
I noticed this file was recompiling when adding a node.
2021-08-16 12:19:41 +08:00
a23b0289f8 Geometry Nodes: tag normals dirty after join
Under some circumstances the normals were not tagged dirty
even though they are.
2021-08-16 12:19:41 +08:00
96fc46895a 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-16 12:19:41 +08:00
7a57a5ed29 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-16 12:19:41 +08:00
81ce3fa49d 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-16 12:19:41 +08:00
d083cc1d63 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-16 12:19:41 +08:00
Henrik Dick
6ba45fee77 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-16 12:19:41 +08:00
bb3d6d712e 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-16 12:19:40 +08:00
7c7a57663f 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-16 12:19:40 +08:00
cbab76c1e0 Cleanup: remove redundant variable 2021-08-16 12:19:40 +08:00
105209d6ae 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-16 12:19:40 +08:00
9fd18116b9 datadoc: add newlines to generated source files 2021-08-16 12:19:40 +08:00
70d7c45d12 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-16 12:19:40 +08:00
54e2393246 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-16 12:19:40 +08:00
3e2ca23526 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-16 12:19:40 +08:00
377055560c Cleanup: spelling in comments 2021-08-16 12:19:40 +08:00
f85ca5b649 Cleanup: use C++ style comments for disabled code 2021-08-16 12:19:40 +08:00
075986faed Cleanup: remove *.orig file from 6a9d7139f7 2021-08-16 12:19:40 +08:00
ce1442829c 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-16 12:19:40 +08:00
dcd614d58f 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-16 12:19:40 +08:00
01c21b0ac4 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-16 12:19:40 +08:00
Jeroen Bakker
73b269211b 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-16 12:19:40 +08:00
085bb1324c Cleanup: moved keyframe drawing to a draw list.
In preparation to do threaded drawing preparation. There should not be any
functional changes.
2021-08-16 12:19:39 +08:00
80cce7e9b4 PyAPI: GPU: Expose builtin shaders
Expose `3D_POLYLINE_SMOOTH_COLOR` and
`3D_POLYLINE_FLAT_COLOR` builtins.

Requested by addon developers.
2021-08-16 12:19:39 +08:00
Pedro A
73de430ce9 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-16 12:19:39 +08:00
4d245a4235 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-16 12:19:39 +08:00
3d8069d209 Cleanup: ID management: remove unused old BKE_libblock_copy_for_localize function. 2021-08-16 12:19:39 +08:00
Michael Kowalski
c0d1182d46 Fix T90519: USD Exporter Error
Fixes: `Error: metersPerUnit does not match retrieved type float`
2021-08-16 12:19:39 +08:00
2ac7d66336 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-16 12:19:39 +08:00
13a8641faa Cleanup: Keylist Drawing - Split up in multiple functions. 2021-08-16 12:19:39 +08:00
a4a6b3128e Cleanup: Minor comment update on LIB_TAG_NEW. 2021-08-16 12:19:39 +08:00
8763f0ad97 PyAPI: report unreleased ID's with WITH_PYTHON_SAFETY enabled
This would have made T88033 more straightforward to track down.
2021-08-16 12:19:39 +08:00
ac827c5190 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-16 12:19:39 +08:00
0485dc4197 Cleanup: rename BKE_collection_{free => free_data}
This function doesn't free the collection, only it's memory.
2021-08-16 12:19:39 +08:00
Henrik Dick
6bf81798d8 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-16 12:19:39 +08:00
f2824c87d2 Cleanup: clang-format 2021-08-16 12:19:39 +08:00
c12d153ee2 Cleanup: trailing space, remove BOM 2021-08-16 12:19:39 +08:00
f548ae31f5 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-16 12:19:39 +08:00
d6b9084979 Fix T90447: 3D view transform locks do not use driver colors
Caused by rB6942dd9f4900.
2021-08-16 12:19:39 +08:00
5ca9492c9f Clean-up: Remove UTF8-BOM markers
Done at the request of Sergey.
2021-08-16 12:19:39 +08:00
77427b036b 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-16 12:19:39 +08:00
58639ff494 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-16 12:19:39 +08:00
83f75d7aed Fix T90572: "Render Region" is broken due to compositing
It was using viewer instead of render border. A copy-paste error.
2021-08-16 12:19:39 +08:00
39872ffc96 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-16 12:19:39 +08:00
2e795ab97e 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-16 12:19:39 +08:00
da12b2874b 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-16 12:19:39 +08:00
d92c03da38 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-16 12:19:39 +08:00
6799b5163b 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-16 12:19:39 +08:00
6b44c6f986 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-16 12:19:39 +08:00
9767b51e9c 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-16 12:19:38 +08:00
7b44586375 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-16 12:19:38 +08:00
97589e2b56 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-16 12:19:38 +08:00
ebcd54cdbf 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-16 12:19:38 +08:00
Himanshi Kalra
ba282ac671 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-16 12:19:38 +08:00
5cf4fabad5 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-16 12:19:38 +08:00
29572da1c3 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-16 12:19:38 +08:00
e6a125bac2 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-16 12:19:38 +08:00
7a59ea3bf2 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-16 12:19:38 +08:00
36da47738c 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-16 12:19:38 +08:00
fe42cb6e34 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-16 12:19:38 +08:00
b0a105dfd8 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-16 12:19:38 +08:00
acf1374495 Fix T90268: Mesh.from_pydata error using numpy array for edges/faces
Technically not a bug but worth supporting.
2021-08-16 12:19:38 +08:00
88ff3d6469 PyDoc: fix for renamed context member
Missing change from 9cff9f9f5d.
2021-08-16 12:19:38 +08:00
260d1f73bc Fix T90551: Dopesheet displays keyframes differently.
Regression introduced by {rB73b047bcd431}. Missing a check when
converting the file to use LISTBASE_FOREACH.
2021-08-16 12:19:38 +08:00
f2bd9c5672 Silensed compilation warning in gpu test case. 2021-08-16 12:19:38 +08:00
777772a782 Edit Mesh: multi-object edit-mode support for knife project 2021-08-16 12:19:38 +08:00
88cc74ff5d 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-16 12:19:38 +08:00
21b9137996 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-16 12:19:38 +08:00
3b84d42062 Cleanup: mixing enum/non-enum type warning in conditional expression 2021-08-16 12:19:38 +08:00
8823426389 Cleanup: unused function warning 2021-08-16 12:19:38 +08:00
a40868c2f8 Fix invalid string comparison in cd692c6954 2021-08-16 12:19:38 +08:00
7f8a99a96a Merge branch 'temp-lineart-contained' into lineart-shadow 2021-08-10 10:59:10 +08:00
f56338490a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-10 09:41:48 +08:00
dec44a2e33 Cleanup: avoid using context in versioning code
Also extract versioning into a function that makes it's purpose clear.
2021-08-10 09:35:31 +08:00
449d556637 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-10 09:35:31 +08:00
Aaron Carlisle
f394c52488 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-10 09:35:31 +08:00
004649bc30 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-10 09:35:31 +08:00
4b6f5ca986 Cleanup: Fix comment typo 2021-08-10 09:35:31 +08:00
7e322b4127 GPencil: Fix memory leak in previous commit 2021-08-10 09:35:31 +08:00
d1e4287d0f 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-10 09:35:30 +08:00
5919da6cdd Cleanup: unnecessary double pointers in XR module
No functional changes.
2021-08-10 09:35:30 +08:00
nutti
fd1273ae34 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-10 09:35:30 +08:00
92eac662b0 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-10 09:35:30 +08:00
6c612c5959 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-10 09:35:30 +08:00
3e4ce501a7 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-10 09:35:30 +08:00
ab31d4b3bc 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-10 09:35:30 +08:00
a8532e2862 Cleanup: Add missing newline at end of file 2021-08-10 09:35:30 +08:00
665f31b78d 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-10 09:35:30 +08:00
9beb5a1bd9 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-10 09:35:30 +08:00
7491e12b1b 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-10 09:35:30 +08:00
92c0e5f515 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-10 09:35:30 +08:00
3a38e23778 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-10 09:35:30 +08:00
9feccd8c49 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-10 09:35:30 +08:00
a697119827 Fix missing function param definition in rna_xr.c
Was accidentally left out in rBe844e9e8f3bb.
2021-08-10 09:35:30 +08:00
63660e8f55 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-10 09:35:30 +08:00
e543406ad8 Cleanup: clang tidy
`bugprone-signed-char-misuse`
2021-08-10 09:35:30 +08:00
76e13b2bdc Cleanup: use const result in ED_keyframes_find_* functions. 2021-08-10 09:35:30 +08:00
acfa8d4234 Cleanup: use range2f in ED_keylist_find_any_between. 2021-08-10 09:35:30 +08:00
7682ba36a4 Cleanup: const pass keyframes_keylist. 2021-08-10 09:35:30 +08:00
b93a875df5 Cleanup: use MEM_SAFE_FREE macro 2021-08-10 09:35:30 +08:00
f23655576c Fix memory leak from rB263fa406cd2b 2021-08-10 09:35:30 +08:00
356a386636 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-10 09:35:30 +08:00
Mattias Fredriksson
f77d6e4b90 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-10 09:35:30 +08:00
f554c89ee5 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-10 09:35:30 +08:00
Himanshi Kalra
fb14e41214 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-10 09:35:30 +08:00
Germano Cavalcante
a7c1f437c1 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-10 09:35:30 +08:00
211244b579 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-10 09:35:30 +08:00
fc1855e5ca 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-10 09:35:29 +08:00
bd4e86ae20 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-10 09:35:29 +08:00
a84f20ff68 PyDoc: document how parameter are used for 3D and 2D textures
Improves on rB171433e841379e7efad069bbda9880fb271e2fc4
2021-08-10 09:35:29 +08:00
Eitan
f44e1874c2 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-10 09:35:29 +08:00
5b7ed16bb5 BMesh: support laplacian smooth for n-gons
Follow the same logic already used by the modifier.
2021-08-10 09:35:29 +08:00
a95fdf3645 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-10 09:35:29 +08:00
e7b46dfc29 Cleanup: comment blocks & spelling 2021-08-10 09:35:29 +08:00
8e2ea895a9 Cleanup: quiet array-parameter warning 2021-08-10 09:35:29 +08:00
8966d55e54 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-10 09:35:29 +08:00
63645fafd3 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-10 09:35:29 +08:00
5dae8ee569 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-10 09:35:29 +08:00
d111320629 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-10 09:35:29 +08:00
cc21b47444 Fix build error when WITH_XR_OPENXR not defined 2021-08-10 09:35:29 +08:00
04ed8d96da GPencil: New Caps icons
These icons are used to define the type of caps.

Designed by: Matias Mendiola
Reviewed by: Pablo Vazquez
2021-08-10 09:35:29 +08:00
Germano Cavalcante
1fdbab85b6 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-10 09:35:29 +08:00
035372f749 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-10 09:35:29 +08:00
f4f91fd838 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-10 09:35:28 +08:00
ebb2f665f3 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-10 09:35:28 +08:00
b4d1f15964 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-10 09:35:28 +08:00
9915dbc627 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-10 09:35:28 +08:00
52fdf8bf09 Cleanup: Remove unused members in FileSelectParams 2021-08-10 09:35:28 +08:00
6b8125c616 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-10 09:35:28 +08:00
621b986186 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-10 09:35:28 +08:00
fe2c586aa9 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-10 09:35:28 +08:00
de6ca93c0f 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-10 09:35:28 +08:00
b26b99c8c3 Fix T90256: faces are flat shaded in edit mode with auto smooth
Regression in 39b2a7bb7e.
2021-08-10 09:35:28 +08:00
a79520bd00 Cleanup: remove redundant parenthesis 2021-08-10 09:35:28 +08:00
b23ae77e2e 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-10 09:35:28 +08:00
bad999ece9 Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-10 09:35:28 +08:00
dcb446652d Cleanup: Fix Clang braced-scalar-init warning 2021-08-10 09:35:28 +08:00
58b1a050bc 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-10 09:35:28 +08:00
5ac694a8e5 Cleanup: license headers
These were removed globally in 65ec7ec524.

Some files re-introduced these conventions since.
2021-08-10 09:35:28 +08:00
7961f4a532 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-10 09:35:28 +08:00
72070d1d99 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-10 09:35:28 +08:00
cf8177357d PyDoc: Update GPU Example of draw_view3d
This function was changed in rBc8004ab4078c98c54a70113c12bbb186403e90cf but didnt update the example.

Part of T84227
2021-08-10 09:35:28 +08:00
8caa131001 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-10 09:35:28 +08:00
35c856eb89 Cleanup: make format 2021-08-10 09:35:28 +08:00
8d03a1e8ba 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-10 09:35:28 +08:00
7e84f05f1f 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-10 09:35:28 +08:00
1758de12aa Cycles: make object Fast GI Approximation panel a subpanel of Shading 2021-08-10 09:35:28 +08:00
170f0bc72e 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-10 09:35:28 +08:00
Romain Toumi
57bf88f9a4 Fix Cycles material slots list being too short
Bring it in line with Eevee.

Differential Revision: https://developer.blender.org/D11982
2021-08-10 09:35:28 +08:00
f01a165c9b 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-10 09:35:28 +08:00
cb990ae424 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-10 09:35:28 +08:00
e72cfbbd4f 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-10 09:35:28 +08:00
2f7ec15447 LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides.

Ref. T86656.
2021-08-10 09:35:28 +08:00
2731adb862 LibOverride: Add RNA API to reset/delete overrides.
Ref. T86656.
2021-08-10 09:35:28 +08:00
0354e9c62d Added some TODO remarks. 2021-08-10 09:35:28 +08:00
927bc4ab2d 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-10 09:35:28 +08:00
6ea2f52333 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-10 09:35:28 +08:00
87850b7582 BLI: add double version of 'scaleform'
No functional changes. New utility.
2021-08-10 09:35:28 +08:00
4052aa5e92 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-10 09:35:28 +08:00
Gavin Li
ed9e5d1332 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-10 09:35:28 +08:00
444c606986 Cleanup: remove *.rej from cb67bfdba2 2021-08-10 09:35:28 +08:00
52aaed6a97 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-10 09:35:28 +08:00
b31d1ae667 Cleanup: inconsistent parameter name 2021-08-10 09:35:27 +08:00
c4b6d8015b Cleanup: initialize variable to quiet warning 2021-08-10 09:35:27 +08:00
cd25d64e3f 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-10 09:35:27 +08:00
827ee1db28 Fix compile error without WITH_OCEANSIM enabled
Was changed in 218df99410.
2021-08-10 09:35:27 +08:00
Pratik Borhade
0be185a65a 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-10 09:35:27 +08:00
Gottfried Hofmann
2dba59c4ce 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-10 09:35:27 +08:00
Anthony Edlin
12865fecb7 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-10 09:35:27 +08:00
5337f7d373 Viewport normal drawing with constant length
Patch for: T37878

{F10169694}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11487
2021-08-10 09:35:27 +08:00
5bfc5b93ee 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-10 09:35:27 +08:00
9b72bbc4e3 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-10 09:35:27 +08:00
6de4fd9557 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-10 09:35:27 +08:00
b01859ad12 Cleanup: use C comments for descriptive text 2021-08-10 09:35:27 +08:00
76f8cc43d9 Cleanup: add comment to fix for T90417 2021-08-10 09:35:27 +08:00
Johnny Matthews
6e6cee204e 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-10 09:35:27 +08:00
3366b9db01 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-10 09:35:27 +08:00
85f4e5fb11 Cleanup: de-duplicate ID renaming utility for versioning 2021-08-10 09:35:27 +08:00
33d42d7f5f Icons: add license headers to utilities 2021-08-10 09:35:27 +08:00
f43af9c4f2 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-10 09:35:27 +08:00
c152a0f549 Icons: update alert icon script
Missed from c549d736cf.
2021-08-10 09:35:27 +08:00
1b23072036 Cleanup: spelling 2021-08-10 09:35:27 +08:00
0ed3b9965a 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-10 09:35:27 +08:00
93e3466902 macOS: Fix OpenMP dynamic loader error. 2021-08-10 09:35:27 +08:00
3a7c5c0395 Fix broken logic in Windows directory query function
Mistake in a5bbdd6998
2021-08-10 09:35:27 +08:00
650b3c30d4 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-10 09:35:27 +08:00
3e3b8968b3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-04 16:50:47 +08:00
add7decc85 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-08-04 16:41:12 +08:00
924e5042f6 LineArt: Image boundary trimming. 2021-08-04 16:40:50 +08:00
614cc20246 LineArt: Image boundary trimming. 2021-08-04 16:15:42 +08:00
47e83e0b8e LineArt: UI range optimizations. 2021-08-03 20:27:42 +08:00
e09c632ef1 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-03 20:24:28 +08:00
e49e7ff70a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-03 14:07:35 +08:00
df8dba7d25 LineArt: Shadow camera UI fix. 2021-08-02 14:14:05 +08:00
cb50697d89 LineArt: Versioning and guarding for shadow camera 2021-08-02 14:04:21 +08:00
e6f437e502 LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:44:11 +08:00
82adf9bf4f LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:43:25 +08:00
602266b412 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-08-02 13:33:39 +08:00
a501be11b4 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-08-02 13:32:57 +08:00
116db7cfba LineArt: Support mesh auto smooth. 2021-07-31 10:44:53 +08:00
4a01814c35 LineArt: Support mesh auto smooth. 2021-07-31 10:44:31 +08:00
8615ace7bf LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 10:00:12 +08:00
2cb28836bc LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 09:59:32 +08:00
680af76107 LineArt: Material flag versioning correction. 2021-07-31 09:26:18 +08:00
3b89d726ca Merge branch 'temp-lineart-contained' into lineart-shadow 2021-07-31 08:38:26 +08:00
08286533c4 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-31 08:37:35 +08:00
795e46c20e LineArt: obindex lookup for matching shadow edges. 2021-07-30 15:41:04 +08:00
5746475921 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-07-30 07:56:37 +08:00
54e50f697e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-30 07:18:04 +08:00
8dcaf4c798 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-29 20:09:53 +08:00
28245d8974 LineArt: Bound box shifting support. 2021-07-28 19:48:10 +08:00
6a45a2dfec Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-28 13:34:39 +08:00
1ee00ba85f LineArt: Occlusion accuracy fix. 2021-07-27 13:55:55 +08:00
79a342952f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-27 13:40:20 +08:00
1d6958b2c6 LineArt: Occlusion accuracy fix. 2021-07-26 22:39:09 +08:00
31c962b740 LineArt: Occlusion-aware shadow contour. Enlarge normal threshold 2021-07-26 18:34:01 +08:00
0815437809 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-07-26 16:53:58 +08:00
3b6e60c8ae Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-26 16:53:29 +08:00
40952d229a LineArt: Div 0 issue caught. 2021-07-21 12:23:31 +08:00
d6df3c666a Merge branch 'temp-lineart-contained' into lineart-shadow 2021-07-21 10:40:34 +08:00
e33c9e3e2c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-21 10:39:13 +08:00
85a93ce443 LineArt: Shadow improvements. 2021-07-20 17:22:52 +08:00
d60d036880 Merge branch 'temp-lineart-contained' into lineart-shadow 2021-07-20 14:10:45 +08:00
500fd30dac Merge branch 'master' into temp-lineart-contained 2021-07-20 13:50:42 +08:00
a78b392eeb Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-19 16:41:27 +08:00
966d4a668c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-17 19:43:26 +08:00
71ec828bdd LineArt: set new cut flag when a middle is needed. 2021-07-17 19:30:02 +08:00
3e8eeb1837 LineArt: Fix Edge Cutting flag bug. 2021-07-14 16:58:47 +08:00
3c711c04fd Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-07-14 13:28:05 +08:00
688533db7b Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-13 16:54:08 +08:00
a88074b282 Merge remote-tracking branch 'origin/master' into lineart-shadow 2021-07-13 16:50:27 +08:00
eb63554e3b LineArt: Able to run shadow. 2021-07-13 16:45:38 +08:00
f11a0efe65 Cleanup: correct spelling in comments, remove profanity 2021-07-13 16:45:38 +08:00
9d5b113b8f 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-13 16:45:38 +08:00
a3e5724e18 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-13 16:45:37 +08:00
703c0802cd 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-13 16:41:20 +08:00
b8297923ca 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-13 16:41:20 +08:00
a16f10f756 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-13 16:41:20 +08:00
Johnny Matthews
63e573deb5 Geometry Nodes: fix direction mode in curve primitive line node
Differential Revision: https://developer.blender.org/D11872
2021-07-13 16:41:20 +08:00
d2fa88d63b 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-13 16:41:20 +08:00
3433a24555 Fix: crash when using empty attribute search 2021-07-13 16:41:20 +08:00
b789d2a2f4 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-13 16:41:20 +08:00
Sybren A. Stüvel
afa3c66668 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-13 16:41:20 +08:00
454f41041a 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-13 16:41:19 +08:00
0b2dafaf1e 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-13 16:41:19 +08:00
c7d61f05c5 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-13 16:41:19 +08:00
18db1e6a3d Cleanup: Walk Navigation define remame
WALK_MODAL_TOGGLE > WALK_MODAL_GRAVITY_TOGGLE
2021-07-13 16:41:19 +08:00
89a4c9be7a Fix typo in Fly mode tooltip
The bug was always around and was introduced with the original code
e2a7168e96 (2009).
2021-07-13 16:41:19 +08:00
af7147ca91 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-13 16:41:19 +08:00
45cf9c330a 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-13 16:41:19 +08:00
5b98497d21 Cleanup: use 'uint' for BLI_array 2021-07-13 16:41:19 +08:00
f5cf1612bb BLI_array: add BLI_array_deduplicate_ordered utility & tests 2021-07-13 16:41:19 +08:00
87e0bed1e2 Cleanup: rename BKE_animdata_{add=>ensure}_id
Use the term `ensure` as existing data is used when present.
2021-07-13 16:41:19 +08:00
3d2db8c03d LineArt: Continue shadowing 2021-07-13 16:41:19 +08:00
874ba6595f LineArt: Fix modifier apply. 2021-07-10 13:54:31 +08:00
6bedcb2407 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-10 13:29:31 +08:00
1e8bd566f6 LineArt: WIP shadow thing... 2021-07-09 15:32:18 +08:00
9afee06e4c LineArt: Remove isec unused stuff. 2021-07-09 11:28:53 +08:00
9573d2c28a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-09 08:34:33 +08:00
3c1797a0ee LineArt: Remove text from mask switches 2021-07-09 08:30:31 +08:00
06bc7f5e85 LineArt: Restore "use_loose_as_contour" to panel 2021-07-09 08:30:31 +08:00
34ebd61bdf LineArt: UI optimizations. 2021-07-09 08:30:31 +08:00
a5373d4c51 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-07 13:02:39 +08:00
e63b4b66e5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-06 21:48:41 +08:00
df83a18726 LineArt: Fix occlusion effectiveness for culled triangles. 2021-07-05 20:37:16 +08:00
2462baf45e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-05 20:01:51 +08:00
1447644a33 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-05 15:40:12 +08:00
bb7d07ea19 LineArt: Thread isec 2021-07-04 17:32:13 +08:00
f3eb0068f7 LineArt: Intersection perf. 2021-07-04 17:21:11 +08:00
733dfaadee Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-04 13:27:38 +08:00
7d90de452b Cleanup: Use simpler method to retrieve attribute domain 2021-07-04 13:26:27 +08:00
0c3451583e Cleanup: Remove unused transform matrix from objects
This was the only reference to this matrix.

https://developer.blender.org/D11770
2021-07-04 13:26:27 +08:00
589adbc64a 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-04 13:26:27 +08:00
ff5a636701 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-04 13:26:27 +08:00
a786eae93d Fix T89581: Cycles crash rendering some OpenVDB files with inactive voxels
Print an error message instead.
2021-07-04 13:26:27 +08:00
7ee444fc7b Cleanup: use template utility function to handle OpenVDB grid types in Cycles 2021-07-04 13:26:27 +08:00
d74b0c513c 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-04 13:26:27 +08:00
b76cafb191 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-04 13:26:27 +08:00
0a40cfb79a Cleanup: Fix variable redeclaration warning 2021-07-04 13:26:27 +08:00
41078f22ef GPencil: Fix compiler warnings in previous commit 2021-07-04 13:26:27 +08:00
1dbae18bc9 Cleanup: Remove unused/unneeded code from old Asset Engine design
This code was written for the File Browser together with the Asset Engine
design, that is not part of the Asset Browser/System design anymore. Updated
comments accordingly.

`FileDirEntryRevision` was actually used, but I removed it and moved the used
members to the parent `FileDirEntry`, since there is no concept of revisions
currently.

There should be no functional changes.
2021-07-04 13:26:27 +08:00
b6732c47c1 GPencil: Fix bug in previous commit with Scale 2021-07-03 17:15:28 +02:00
7b1f4a1a89 GPencil: Test weight in Offset Randomize
Test using the vertex weight to modulate randomness
2021-07-03 17:05:52 +02:00
f08b8826db Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-07-02 21:06:37 +08:00
39a3071bd7 LineArt: Remove duplicated panel register func. 2021-06-30 11:26:19 +08:00
12e67e0054 LineArt: Remove merge duplicated code. 2021-06-30 11:11:43 +08:00
ff29428e0d Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-30 10:54:53 +08:00
f8ffde6a07 LineArt: Fix debug number accidental assignment. 2021-06-30 10:50:31 +08:00
ef85fcb2fe Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-29 19:41:23 +08:00
8faaa9873f LineArt: Back face culling. 2021-06-29 17:28:56 +08:00
3d7cf4faf3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-29 16:57:41 +08:00
9ea178f3c3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-29 11:45:34 +08:00
e82b3a312d LineArt: naming change floating->loose 2021-06-29 11:13:55 +08:00
292ce54448 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-29 10:52:38 +08:00
d6f800f360 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-28 22:51:25 +08:00
ba046e0417 LineArt: further fixes. 2021-06-28 22:29:21 +08:00
c7aecfc617 LineArt: Change mask name. 2021-06-28 21:40:50 +08:00
ae7280d123 LineArt: Preserving countour for face mark filtering. 2021-06-28 17:24:22 +08:00
ed6d41d97f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-28 15:53:25 +08:00
23ec896fe0 LineArt: 8 bits for transparency flag 2021-06-28 15:44:08 +08:00
32c3c98568 LineArt: 8 bit transp flag for mat. 2021-06-28 15:37:44 +08:00
ad6a7988fc LineArt: Fix collection intersection ui. 2021-06-28 15:04:53 +08:00
75c9ea0cab Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-28 13:47:08 +08:00
b16db629ba Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-27 11:39:48 +08:00
bdfe539479 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-27 11:34:10 +08:00
fdde2e17c7 LineArt: Correct handling when edge mark is on border. 2021-06-23 21:58:36 +08:00
1b7a2a8563 LineArt: Versioning for smooth surface crease. 2021-06-23 16:03:53 +08:00
3163758e6a LineArt: Remove auto smooth for crease. 2021-06-23 15:53:45 +08:00
bd0feef52a LineArt: Mark sharp as crease. 2021-06-23 15:50:25 +08:00
bfdf868ff5 LineArt: Update deps for selecting camera/light 2021-06-23 15:36:50 +08:00
f5adb96d5c LineArt: Use Smooth/AutoSmooth for crease. 2021-06-23 15:28:23 +08:00
77f7a0e5ab Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-23 14:00:42 +08:00
a31b984be7 LineArt: Move type rejection before visibility check 2021-06-22 23:04:41 +08:00
fb6010e47c LineArt: Fix light contour when no ref is selected 2021-06-22 19:57:05 +08:00
541136601e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-22 19:26:28 +08:00
e704e1f2a8 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-21 20:42:38 +08:00
1bed720982 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-21 09:15:21 +08:00
8572f5720e LineArt: Larger upper limit for smooth tolerance. 2021-06-17 20:49:47 +08:00
83e2b73dde Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-16 23:17:21 +08:00
b906b544e5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-16 22:33:16 +08:00
f77767b4a8 LineArt: Cache related wording changes. 2021-06-16 22:30:36 +08:00
0c1ca28175 LineArt: Respect cache override limits. 2021-06-15 21:39:47 +08:00
3f908c45da LineArt: Use separate sub panel for line types. 2021-06-15 21:07:07 +08:00
aef77043ac LineArt: cache ui changes. 2021-06-15 18:10:50 +08:00
481ff6e7f1 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-15 13:42:47 +08:00
2c4d682edd LineArt: First run cache bug. 2021-06-15 13:38:41 +08:00
9927e833f3 Lineart: Clean up cache patch. 2021-06-14 20:46:35 +08:00
b02b478bb7 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-14 14:45:35 +08:00
0778a469f5 LineArt: Take care of empty duplicollection. 2021-06-11 17:54:14 +08:00
4878f77d58 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-11 15:09:27 +08:00
5e78be3ff8 LineArt: Light contour type. 2021-06-10 22:36:39 +08:00
ca2c6634d5 LineArt: Change edge flag to 16 bits. 2021-06-10 20:53:27 +08:00
e1041b176a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-10 20:27:55 +08:00
e0a800d6bd LineArt: Add camera marker check. 2021-06-10 00:13:43 +08:00
bc06c08212 Cleanup: Remove useless comment. 2021-06-09 17:36:35 +08:00
10f0d4c6e7 LineArt: Use BKE_object_boundbox_get() instead of mesh only. 2021-06-09 17:33:20 +08:00
a170716208 LineArt: Bound box visibility check when loading 2021-06-09 14:38:30 +08:00
8fa34714ae Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-09 12:41:23 +08:00
9d7466739c Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-08 17:25:18 +08:00
d9c3736950 Cleanup: Comments and unused var. 2021-06-08 12:47:09 +08:00
153828b30d LineArt: Move Mesh->BMesh conversion to worker. 2021-06-07 22:48:32 +08:00
852d53a677 LineArt: Remove fixed overscan in discard function. 2021-06-07 21:14:01 +08:00
31608aab54 LineArt: Adjustable overscan. 2021-06-07 21:03:58 +08:00
f06fa3797b LineArt: Shifting fix for different camera fitting 2021-06-07 20:00:46 +08:00
7591e2807d Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-07 18:42:23 +08:00
90ce858ab6 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-05 23:53:05 +08:00
03599c6dca Lineart: Fixed overscan to 0.1 2021-06-05 23:44:21 +08:00
b44eba1c39 LineArt: Fix edge clipping index error. 2021-06-05 23:04:09 +08:00
b519f95b9f LineArt: Option to offset strokes to custom camera 2021-06-03 20:34:31 +08:00
79c2835397 LineArt: update depsgraph for source_camera. 2021-06-03 20:14:54 +08:00
0cffce3258 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-03 20:13:46 +08:00
6ff2853509 LineArt: Custom camera working correctly. 2021-06-02 20:50:33 +08:00
6d644c587b LineArt: Use NOTE instead of FIXME. 2021-06-02 19:56:26 +08:00
de7563c91a LineArt: Better tolerance for faces that are perpendicular to view vector.
This is due to cam->obmat precision issue, where it affects view vector precision.
2021-06-02 19:39:16 +08:00
8186602fec LineArt: Camera selection. 2021-06-02 19:37:54 +08:00
87bae57cdc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-02 16:02:19 +08:00
9b420cfef3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-06-01 21:36:02 +08:00
6e21a40284 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-28 19:55:22 +08:00
423dee4202 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-26 23:32:06 +08:00
7f20c4c885 LineArt: Cleaning up edge list names. 2021-05-25 20:09:11 +08:00
ea48e3bdf3 LineArt: Cleaning up naming convensions. 2021-05-25 19:38:02 +08:00
18e348ded3 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-25 19:18:28 +08:00
cb9504187a LineArt: Change chain_smooth_tolerance default to 0. 2021-05-25 13:02:16 +08:00
c4e0c13604 LineArt: Allow intersection in object selection mode. 2021-05-24 21:56:19 +08:00
17a7b942e1 GPencil: Fix minor stuff in obj_add 2021-05-24 21:39:53 +08:00
e180ed7ee5 GPencil: Use default false for use_lights option. 2021-05-24 16:00:48 +08:00
b2e87e4f77 GPencil: Add line art use_lights option 2021-05-24 15:56:44 +08:00
60a32b8d4e Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-24 15:29:30 +08:00
3b8031e1d6 Cleanup: Use int16_t instead of short. 2021-05-24 14:47:50 +08:00
30d76f3868 Cleanup: List argument renaming. 2021-05-24 14:38:00 +08:00
8d751d48e1 Cleanup: Naming fixes in obj load patch. 2021-05-24 14:26:18 +08:00
072067f546 LineArt: Make consistent with master typo fix. 2021-05-22 20:33:40 +08:00
d3da4c695e Fix T88464: Incorrect baking with camera markers. 2021-05-22 20:33:27 +08:00
1931f7a7c1 Cleanup: Fix naming changes. 2021-05-22 19:41:36 +08:00
cadd0dacf0 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-22 19:23:11 +08:00
f6b4d81933 Fix T88362: Lineart countour rendering error 2021-05-18 22:39:49 +08:00
f3c7da0911 LineArt: Fix API Change. 2021-05-18 17:41:41 +08:00
5fcc83a49f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-18 15:44:04 +08:00
dc8ebd698b Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-15 16:30:40 +08:00
5860d4e240 LineArt: Use array instead of array for ba->linked_edge 2021-05-14 19:15:48 +08:00
be91ecbca3 LineArt: Toggle duplicated edge for types. 2021-05-13 14:23:23 +08:00
13a3dd4be4 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-13 13:33:05 +08:00
ba96e6aa71 LineArt: Option for toggling chaining modes.
Allows switching between image-space and
geometry-space chainin.
2021-05-12 19:41:53 +08:00
099daebdbf Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-12 10:15:37 +08:00
c33d9de716 Cleanup: Use a helper function for repetitive code
Retrieving data from the component can be done in a separate function
to save some repetition.
2021-05-12 10:14:59 +08:00
b0e21a37e4 Functions: Add materialize methods for generic mutable virtual array
Similar to how `GVArray_For_VArray` implements `materialize_impl` to
forward the work to its non-generic virtual array, we can do the same
thing for the mutable version, `GVMutableArray_For_VMutableArray`.

This commit should have no visible changes, since as far as I can tell
the only user of this class does not implement special materialize
methods anyway.
2021-05-12 10:14:59 +08:00
Pablo Dobarro
a95e2eb5b1 Fix T82155: Fade inactive geometry overlay not working with instanced geometry
This enables the overlay for instanced geometry.

After this change, objects that are an instance of the current active
object (which are also being modified in the current active mode) won't
fade, which is different from the previous behavior.

Reviewed By: fclem

Maniphest Tasks: T82155

Differential Revision: https://developer.blender.org/D9362
2021-05-12 10:14:59 +08:00
dc30002cfd Fix T88060: Expand freezing when deleting a Face Set with multiple loose parts
When checking if the mesh has only one Face Set only the current active
component for expand needs to be checked. Otherwhise other components
that won't be modified by Expand that contain other IDs will be taken
into account, making the Face Set deletion go into an infinite loop.

Reviewed By: JacquesLucke

Maniphest Tasks: T88060

Differential Revision: https://developer.blender.org/D11169
2021-05-12 10:14:59 +08:00
300272e8bd Fix T88180: Enable HQ normal workaround for RX 580X cards.
This needs to be backported to 2.83.
2021-05-12 10:14:59 +08:00
367e309fe8 GPencil: Remove B key to create Blank Keyframe in Drawing mode
We have the `I` menu for that. This is part of the old code.
2021-05-12 10:14:59 +08:00
491ee6f15a GPencil: Rename prop dilate_pixels to dilate
Better avoid units in name.
2021-05-12 10:14:59 +08:00
Pratik Borhade
291094b06f Fix T54339: Shapekey Max value doesn't clamp existing value
Update the "current value" of the Shape Key blend amount when value is
not within the min/max range. New function `rna_ShapeKey_update_minmax`
used to update and clamp the current value.

Reviewed By: mano-wii, lichtwerk, #animation_rigging, sybren

Maniphest Tasks: T54339

Differential Revision: https://developer.blender.org/D11071
2021-05-12 10:14:59 +08:00
aec9094530 Fix T87764: Mem-leak during viewport rendering.
When a scene uses cryptomatte the viewport rendering would lead to a
memory leak. The reason was that all image renders (viewport+final)
activated cryptomatte. But is only used for final rendering.

This patch only activates cryptomatte when doing final rendering.
2021-05-12 10:14:59 +08:00
bef38364e8 Animation: move Cycle-Aware Keying to the Keying popover.
The Cycle-Aware Keying option was added in 2.8 and is used
to allow keyframing over cyclic F-Curves without disturbing
the cycle (e.g. overwriting an end keyframe updates both ends).

This effect is not limited to auto keyframing and is applied
to any key insertion, but when the popovers were rearranged
it was put in the Auto-Keyframing related one for some reason.

This is misleading, especially since because of that the
option is incorrectly greyed out when auto keyframing is
disabled, so move it to the generic Keyframing popover.

Differential Revision: https://developer.blender.org/D11213
2021-05-12 10:14:58 +08:00
Severin
2741f3fb2f Fix warning on Apple Clang, missing override specifier
Was giving a warning:
```
BKE_spline.hh:293:35: warning: 'interpolate_to_evaluated_points' overrides a
member function but is not marked 'override' [-Winconsistent-missing-override]
```
2021-05-12 10:14:58 +08:00
4395d7eb27 Fix T88145: Dynamic Paint initial color using vertex color not working as expected
Mistake in {rBe48c4d73d378}.

Was using the vertex index as a lookup for the loop color (instead of
the loop index).
(Issue was not present in original D1429 btw).

Maniphest Tasks: T88145

Differential Revision: https://developer.blender.org/D11212
2021-05-12 10:14:58 +08:00
6afe643435 Compositor: Add vars and methods for easier image looping
These variables and methods should make it easier to loop through buffers elements/pixels. They take into account single element buffers.
Single element buffers can be used for set operations to reduce memory usage.

Usage example: P2078

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11015
2021-05-12 10:14:58 +08:00
b97d5c388d Cleanup: too small loop variable type
Clang-Tidy: bugprone-too-small-loop-variable
2021-05-12 10:14:58 +08:00
c9f37f50dd Functions: support materialize virtual array to initialized span 2021-05-12 10:14:58 +08:00
de8a32352a Cleanup: spelling 2021-05-12 10:14:58 +08:00
5e712c46cd Cleanup: unused variable warning 2021-05-12 10:14:58 +08:00
c2c7d3573c Cleanup: Remove double import in previous commit. 2021-05-12 10:14:58 +08:00
aee9176996 Enable CLog for GPU test cases. 2021-05-12 10:14:58 +08:00
50c9d4f8aa Cleanup: correct/clarify PlayAnim comments 2021-05-12 10:14:58 +08:00
4c706e90f9 LineArt: Floating edge chaining option 2021-05-10 13:47:38 +08:00
df990e78fa LineArt: better ui logic for crease threshold. 2021-05-10 11:49:20 +08:00
a5b3496785 LineArt: Filtering feature line using face mark. 2021-05-10 11:38:17 +08:00
c6f8567f84 LineArt: Fix LRT_ITER_ALL_LINES_BEGIN.
This handles when the first line list being empty.
2021-05-10 10:59:38 +08:00
146cf1db3f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-10 09:10:31 +08:00
b4b2f638e9 LineArt: Working intersection filtering. 2021-05-09 13:17:03 +08:00
50a104d2be LineArt: intersection mask ui and code. 2021-05-09 11:12:21 +08:00
2fc5af5b19 LineArt: show full options in first modifier. 2021-05-09 10:17:59 +08:00
213f704b76 LineArt: Data for intersection_flag 2021-05-09 09:55:10 +08:00
d4bdf9a348 LineArt: Clipping handling multi type edges. 2021-05-09 09:11:39 +08:00
e8fc0697de LineArt: Fix text in object_add.c 2021-05-09 08:26:52 +08:00
a5b5775239 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-09 08:23:30 +08:00
477fe55785 LineArt: Use enum for stroke_depth_order.
This is for gpencil object adding.
2021-05-08 09:47:55 +08:00
670342eafd Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-08 09:22:25 +08:00
29bb98efa6 LineArt; intersection flag variables. 2021-05-08 09:15:27 +08:00
6810d031da LineArt: Fix merge conflicts. 2021-05-06 18:01:07 +08:00
5db821da04 LineArt: Smoothing chains before angle splitting. 2021-05-06 18:00:45 +08:00
8658ae92ed LineArt: In-front UI hints. 2021-05-06 11:34:36 +08:00
43f5ae0cea LineArt: Floating edge type. 2021-05-06 11:00:46 +08:00
e7da22ed8a Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-06 09:53:42 +08:00
246345ba03 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-05-01 16:13:06 +08:00
948e4e55dd LineArt: UI For occlusion effectiveness. 2021-05-01 16:12:47 +08:00
bff21b191f LineArt: Ignore triangle when it's ineffective. 2021-05-01 16:12:47 +08:00
87a0494313 LineArt: Occlusion effectiveness in material. 2021-05-01 16:12:47 +08:00
2d874aa34a Cleanup: compiler warnings 2021-05-01 16:12:47 +08:00
840ea5195d Revert "Fix crash running constraint, modifier, fx from missing NULL check"
This reverts commit f4d5a69cf8.

This causes bpy.ops.object.modifier_apply.poll() to fail as
well as modifier binding operators (breaking tests).
2021-05-01 16:12:47 +08:00
d3464315f0 BLI: support removing Map elements during iteration
While it was technically safe to call Map.remove while iterating over
a map, it wasn't really designed to work. Also it wasn't very efficient,
because to remove the element, the map would have to search it
again. Now it is possible to remove an element given an iterator
into the map. It is safe to remove the element while iterating over
the map. Obviously, the removed element must not be accessed
anymore after it has been removed.
2021-05-01 16:12:47 +08:00
6fd0c7a70d BLI: add a common base class for Map iterators
This is useful for an upcoming commit that allows removing
an element based on an iterator.
2021-05-01 16:12:47 +08:00
c0aef3541a Cleanup: Rename #if GPU_USE_PY_REFERENCES to #ifndef GPU_NO_USE_PY_REFERENCES
This is safer for incremental build.

And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.
2021-05-01 16:12:47 +08:00
0c7a99d6ec Fix accidental lines removed in the last commit 2021-05-01 16:12:47 +08:00
29c5231fd4 Fix gross errors in previous commit 2021-05-01 16:12:47 +08:00
00ecb38225 Documentation: Replace the bgl API in the gpu module exemples 2021-05-01 16:12:47 +08:00
4b355683ee Python GPU: Add new methods to port the code templates in the manual
This commit adds a new API tha allow to replace the bgl API in the exemples on:
https://docs.blender.org/api/current/gpu.html

**Overview (New API):**
```
gpu.state:      active_framebuffer_get
GPUFramebuffer: read_color
GPUOffscreen:   texture_color
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11031
2021-05-01 16:12:47 +08:00
Germano Cavalcante
1376262d87 Python GPU: Add reference of PyObject GPU object to the GPU object itself
Instead of creating different python wrappers for the same GPU object,
return the same `PyObject` created earlier.

This also allows for more secure access to existing GPU objects.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11044
2021-05-01 16:12:47 +08:00
Henrik Dick
3afcf77c91 Fix T85470: Simple deform modifier causes artifacts at low angles
The formula used to compute the bend did subtraction of two big numbers
to get the position. Changed to find the delta and add that,
by rearranging the formula into a more numerically stable form.

Reviewed By: mano-wii, campbellbarton

Ref D11074
2021-05-01 16:12:47 +08:00
c2c70ddc4f Fix/Workaround T87511: snap gizmo flickers on Ctrl-Drag
Hack to bypass drag events, eventually the gizmo API
should support this use case without hacks.
2021-05-01 16:12:47 +08:00
Charlie Jolly
986cc5c018 Geometry Nodes: Add an "Auto" option for Attribute Convert data type
Currently there is an "Auto" option for the domain, this commit adds a
similar option for "Auto" data type, that uses the data type from the
target attribute or the source attribute (in that order).

Ref T87347

Differential Revision: https://developer.blender.org/D10932
2021-05-01 16:12:46 +08:00
9573d22cf8 Object: rename BKE_object_runtime_free, leave data cleared
Rename BKE_object_runtime_free -> BKE_object_runtime_free_data,
since the runtime pointer is part of the object, only the data is freed.

Leave the data cleared to avoid accidental use,
this is in keeping with other `*_free_data()` functions.
2021-05-01 16:12:46 +08:00
ac989a43b2 Fix: missing return 2021-05-01 16:12:46 +08:00
aed01df79e Fix crash running constraint, modifier, fx from missing NULL check
None of these generic poll functions had NULL pointer checks,
since all operators that use these functions expect a valid constraint,
modifier .. etc. Add the NULL check to the poll function.

Ref D11126

Reviewed By: mont29, Severin
2021-05-01 16:12:46 +08:00
5b110496ff Fix all objects getting selected sometimes when droppping object
If no other object was selected while dragging one in (e.g. from the Outliner
or an object asset from the Asset Browser), all visible objects in the active
view layer would get selected.
Issue was caused by a wrong enum type use.

Mistake in bcdba7c34d.
2021-05-01 16:12:46 +08:00
ab94ee39f1 BLI: improve VectorSet data structure
This adds two new methods:
* `clear` just removes all keys from the vector set.
* `index_of_or_add` returns the index of a key and adds it if has not
  been added before.
2021-05-01 16:12:46 +08:00
dc9d940439 Object: improve on fix for Object.to_mesh() crash T86871
While fa7ddd0f43 fixed the reported issue,
the possibility of reusing runtime data during curve-to-mesh conversion
remained. Instead of treating the bounding-box as a special case,
clear all run-time data for temporary objects.

Ref D11026

Reviewed By: sergey
2021-05-01 16:12:46 +08:00
a9ae8d883f Cleanup: interface_intern.h doc-strings
Also clarify some vague comments & add doxygen section for menu-memory.
2021-05-01 16:12:45 +08:00
984637b240 Cleanup: correct comment 2021-05-01 16:12:45 +08:00
e4c6ae784d Cleanup: comments in BMesh bisect, use doxygen sections 2021-05-01 16:12:45 +08:00
0ee0cd71a2 Cleanup: rename BKE_pose_channel_{verify => ensure}
The term `verify` doesn't fit with what this function does
and is sometimes used to check data is valid or to control validity
checking as with `RNA_define_verify_sdna`.
use more common term `ensure`.
2021-05-01 16:12:44 +08:00
40e18eceab Cleanup: rename BKE_pose_channels_hash_{make => ensure}
Use the term `ensure` since it makes it clear the data is
not manipulated if it already exists.
2021-05-01 16:12:44 +08:00
c9030983dc Cleanup: use early return in edittranslation_exec 2021-05-01 16:12:44 +08:00
96160d1ed4 Cleanup: use const variables 2021-05-01 16:12:44 +08:00
8440fcb4d9 Cleanup: avoid ambiguous parenthesis 2021-05-01 16:12:44 +08:00
864303d80e Cleanup: duplicate break 2021-05-01 16:12:44 +08:00
6672a2e9fa Cleanup: use 'else if' 2021-05-01 16:12:44 +08:00
d2daf6aec1 Cleanup: remove redundant assignments & NULL pointer check 2021-05-01 16:12:44 +08:00
b13da56836 Fix potential buffer overrun in drw_shader_dependencies_get
Logical error let this function to write one past the buffer bounds.
2021-05-01 16:12:44 +08:00
1d6642ab1b Fix missing NULL check in grease-pencil clear strokes 2021-05-01 16:12:44 +08:00
0d8c4ec77f Fix sculpt mask operator crash running without a 3D view
Add missing operator poll, depend on the 3D view for all
sculpt paint/mask operators.
2021-05-01 16:12:44 +08:00
c87ea85012 Fix crash running window operators in background mode 2021-05-01 16:12:44 +08:00
59e68605c2 Fix uninitialized memory use in GLDrawList
GLDrawList::init() used MDI_INDEXED which checks base_index_.
2021-05-01 16:12:44 +08:00
f1a1b58105 Fix uninitialized local-view flag on object creation
Local view return argument to ED_object_add_generic_get_opts
was left uninitialized.
2021-05-01 16:12:44 +08:00
27e32c4ce3 Cleanup: quiet shadow variable warning 2021-05-01 16:12:44 +08:00
219679061b Fix T87317: Cycles XML parsing broken after bugfix for initialization order 2021-05-01 16:12:44 +08:00
0f35979283 Fix: crash when creating GPU texture from image fails 2021-05-01 16:12:44 +08:00
8e5c1225f1 Fix error in Python UI script 2021-05-01 16:12:44 +08:00
Wannes Malfait
cc835bec8a Nodes: Add a callback to check for valid socket type
This adds a callback to bNodeTreeType to check which socket types are
valid for the tree type. Function has been implemented for the normal
tree types, and can be implemented for custom node trees with python,
by adding a `classmethod` to the tree. However, only builtin socket
types are supported.

This is relevant for T87049, but it also has the advantage that it is
now clear which node trees support which sockets. Previously this
was assumed to be known by all developers.

Differential Revision: https://developer.blender.org/D10938
2021-05-01 16:12:44 +08:00
ffcb99e1f1 Geometry Nodes: Add a template utility to mix two attribute values
This is just linear interpolation, but it's nice to have an equivalent
to `mix3` for only two values. It will be used for interpolation of
values between bezier spline control points.
2021-05-01 16:12:44 +08:00
c637fe722c Cleanup: Mismatched array bounds in function declaration 2021-05-01 16:12:44 +08:00
c5b622b773 Cleanup: Remove unecessary variable
The value of this variable was incremented, but never used.
2021-05-01 16:12:44 +08:00
Antonio Vazquez
75b157b36b GPencil: Add "Convert Text to Gpencil"
Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve.

This commit converts that curve to a Grease pencil object.

Differential Revision: https://developer.blender.org/D11117
2021-05-01 16:12:44 +08:00
1db971a6dd Cleanup: Reduce indentation by returning early 2021-05-01 16:12:44 +08:00
eb105f3fa4 Fix T86335: Knife tool fails on object with zero scaled axis
Use invert_m4_m4_safe_ortho for the knife tool to support
operating on objects with a single zero scaled axis.
2021-05-01 16:12:44 +08:00
Pratik Borhade
1c9e23892b Clean-up: Edit and comments
- Corrected spellings
- Comments added and edited

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10991
2021-05-01 16:12:44 +08:00
ae3c0c8394 Fix T87297: Gpencil - Disable Frames and Start delay when use Factor
After talking with the GP team, we agree in disable these options when the factor is used in Build modifier.
2021-05-01 16:12:44 +08:00
436a5db96a Fix T86799: Boolean crashes duplicating object with "Fast" solver
BMesh intersect could leave invalid items in the selection list,
causing a crash. The list is now cleared since boolean is such a
destructive operation, it's unlikely the selection order would be useful.

Thanks to @lukastoenne for finding the root cause.
2021-05-01 16:12:44 +08:00
b08082434b GPencil: glow fx, add threshold value color mode
This patch adds a threshold value to the glow effect in color mode.
Currently, the threshold is hardcoded to 5%.
You can select a color and specify a higher threshold to include
similar colors in the effect.

Note: depends on D10670

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D10672
2021-05-01 16:12:44 +08:00
Himanshi Kalra
a263fce3b3 Added Operator tests: unsubdivide, shading, vertex connect and mark seam
Added tests for:
* Mark Seam
* Shade flat
* Shade smooth
* Unsubdivide
* Vertex Connect Path
* select nth (Checkered Deselect)

Notes:
1) Shade flat, shade smooth are base test cases (to check mesh doesn't change for real)

Updated blend file: tests/modeling/operators.blend

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D10893
2021-05-01 16:12:44 +08:00
01e984712b Fix T87779: Asymmetric position vertices in circles primitives.
Incrementing a floating point value in a loop resulted in the vertex
locations for circles in primitives being slightly asymmetric.
2021-05-01 16:12:43 +08:00
e76b6d1ae8 Fix build error after recent changes to CPU name detection 2021-05-01 16:12:43 +08:00
43da1288f4 Cleanup: Use BLI_findindex instead of loop 2021-05-01 16:12:43 +08:00
Christian Baars
4bfbe8c70e Fix missing Cycles CPU name on macOS Arm
Differential Revision: https://developer.blender.org/D11061
2021-05-01 16:12:43 +08:00
9a2f8b80c5 Fix T87686: Cycles persistent data not updating correctly with hair 2021-05-01 16:12:43 +08:00
Matteo Falduto
df29a77303 Cleanup: removed unnecessary multiplications in area light importance sampling
Differential Revision: https://developer.blender.org/D11114
2021-05-01 16:12:43 +08:00
9756e41302 Fix macOS arm crash in scaling images with ffmpeg
Ref T78710
2021-05-01 16:12:43 +08:00
ed10ebbe30 Fix ASAN warnings with Cycles OSL 2021-05-01 16:12:43 +08:00
ae8f78d136 Fix: missing AO factor from Cyclest Fast GI panel
The AO distance was already there, but I forgot the factor also has an impact
on this.
2021-05-01 16:12:43 +08:00
a5a2dfdd60 Fix T87808: Connected proportional editing includes hidden geometry
Regression in 21b9231d7f
2021-05-01 16:12:43 +08:00
821671f987 Cleanup: Add float format 2021-05-01 16:12:43 +08:00
Cody Winchester
6b9009315e Gpencil Offset Modifier - Add randomize offset options
This patch adds the Randomize options that exist in the Array modifier to the offset modifier.

Currently the patch uses
```
BLI_findindex(&gpf->strokes, gps);
```
to get the index of the current stroke for making each stroke a different seed value. This is how the noise modifier also gets the stroke seed value and it is noted there as well that this method is slow, and should be fixed in the future with another method of getting the stroke index.
Other methods were explored such as using the total number of points of the stroke, but that makes the randomize options incompatible with other modifiers before it such as Multiple Strokes, Array, Build, and Simplify.

{F9591325}

Differential Revision: https://developer.blender.org/D10171
2021-05-01 16:12:43 +08:00
09e1e5d9bf Function: add method to create shallow copy of virtual array
Creating a shallow copy is sometimes useful to get a unique ptr
for a virtual array when one only has a reference. It shouldn't
be used usually, but sometimes its the fastest way to do correct
ownership handling.
2021-05-01 16:12:43 +08:00
83056fc8c9 Correction to own previous commit: Add missing break
Small mistake in 88400f0c03.
Not having this break would be harmless, but we can avoid some unnecessary work
with it.
2021-05-01 16:12:43 +08:00
854f639de7 LineArt: Conditional ui for adding line art. 2021-05-01 16:12:43 +08:00
37fd106739 LineArt: In front and stroke order when adding. 2021-04-30 22:53:21 +08:00
97ecbdb0aa LineArt: Remove default in-front (from a merge). 2021-04-30 22:32:57 +08:00
2f6eca4af3 LineArt: Fix memory leaking issue in threaded loading. 2021-04-29 22:17:26 +08:00
d184490f0e Lineart: Cache toggle for baking operators. 2021-04-29 21:26:46 +08:00
ff51da43fe LineArt: Cache/Non-cache toggle for modifier stack. 2021-04-29 21:18:41 +08:00
88065c20dc LineArt: UI grey out for cache mode. 2021-04-29 21:04:55 +08:00
781684d0cf Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-29 19:37:29 +08:00
6b11df31af LineArt: Fix incorrect fov when sensor fit is not Auto. 2021-04-27 11:26:44 +08:00
dac54c3af8 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-27 10:56:09 +08:00
b5dc1def41 LineArt: Offset strokes instead of In Front. 2021-04-26 15:20:43 +08:00
40691f442f Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-26 14:02:09 +08:00
3086602f70 LineArt: Global overrides for cached calculation. 2021-04-22 11:45:08 +08:00
89d1fb011a LineArt: Fix cache allocation error. 2021-04-22 11:05:11 +08:00
8f3d40820e LineArt: Fix cache nullptr bug. 2021-04-21 19:23:58 +08:00
4b3fc7bb04 LineArt: Modifier stack cache wip 2021-04-21 18:00:23 +08:00
5c8187ee86 LineArt: Fix crashing when tile triangle count exceeds 100. 2021-04-21 14:40:18 +08:00
d336e4d9b2 LineArt: Use array for ba->linked_triangles. 2021-04-21 13:51:15 +08:00
4e19a32cd8 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-21 13:14:31 +08:00
9c665e7980 LineArt: UI Fixes. 2021-04-19 16:54:39 +08:00
e1e7e021b2 LineArt: Partial UI fixes for modifier and object panels. 2021-04-16 21:53:42 +08:00
0247439090 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-04-16 20:34:33 +08:00
cd41b9a9a4 LineArt: Optimized tiling strategy for ortho and perspective cameras. 2021-04-14 15:05:45 +08:00
87e3ea74d9 LineArt: Spreading load for multithread loading of geometry. 2021-04-14 14:27:13 +08:00
3df57fe330 LineArt: Accepts multiple line types for one line. 2021-04-13 11:29:03 +08:00
efab421f9e Revert "LineArt: PointCache for caching chains (code path only)"
This reverts commit f3e4464ef7.
2021-04-13 10:50:48 +08:00
f3e4464ef7 LineArt: PointCache for caching chains (code path only) 2021-04-07 23:01:11 +08:00
731b9ad137 LineArt: Use separate memory pool for chained data. 2021-04-07 20:53:35 +08:00
5201296598 GPencil: Fix opacity ineffective curve influence after fading patch. 2021-04-07 20:51:22 +08:00
d883491e40 GPencil: Fading control for opacity/thickness modifier updated. 2021-04-02 12:58:30 +08:00
0da169a778 LineArt: Fix Compiler warnings 2021-03-30 10:38:00 +08:00
0f65f4829a Lineart: Fix missing edge mark problem. 2021-03-27 19:02:06 +08:00
3557fa6963 LineArt: Remove BINARY_WEIGHTS option. 2021-03-26 19:08:10 +08:00
54271f462f LineArt: Remove chaining settings. 2021-03-23 22:15:44 +08:00
8449cfdca2 LineArt: Properly working threaded geometry loading. 2021-03-23 22:09:57 +08:00
e8a9488173 LineArt: Multithread object iterator problem staging. 2021-03-23 18:26:27 +08:00
dc5f6c0d4d LineArt: Fix threading data assignment. 2021-03-23 13:28:25 +08:00
c0d37c9555 LineArt: Fix slight issues for threading object loading (DG still have problems) 2021-03-23 09:49:06 +08:00
3b5044f3bc LineArt: Multithread object loading. 2021-03-23 09:36:12 +08:00
58c2c3262f Merge branch 'master' into temp-lineart-contained 2021-03-22 17:41:52 +01:00
59570d130b LineArt: Fix compiler error for ob->id.orig_id != _rb->_source_object 2021-03-21 15:45:54 +08:00
f9545276c4 Merge branch 'master' into temp-lineart-contained 2021-03-20 14:08:09 +01:00
4194ac20cd LineArt: Fix blank baking for when source type is object. 2021-03-20 20:55:48 +08:00
77261ecb25 Merge branch 'master' into temp-lineart-contained 2021-03-20 12:39:40 +01:00
7f9720124d LineArt: Fixed source selection for nested-instanced collection. 2021-03-20 18:42:27 +08:00
9db7c3db08 Fix T86730: LineArt: keep contour when there's perpendicular faces. 2021-03-20 13:36:17 +08:00
b36ad7dfed Merge branch 'master' into temp-lineart-contained 2021-03-19 21:02:32 +01:00
2468bc8f1b LineArt: Add missing modifer and sanity checks to bake operator
Previously we could crash because we would not check if the modifier in
question actually was a line art modifier. We also did not query if the
modifier was disabled.
2021-03-19 20:56:18 +01:00
8e36187e51 Merge branch 'master' into temp-lineart-contained 2021-03-19 19:00:59 +01:00
203ffd8dee LineArt: Remove geometry space chaining 2021-03-19 20:55:38 +08:00
4569ae7a60 Revert "LineArt: Binary weights option."
This reverts commit 7b76f9f6b6.

# Conflicts:
#	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
#	source/blender/makesrna/intern/rna_gpencil_modifier.c
2021-03-19 20:31:57 +08:00
8793250074 Revert "LineArt: Remove geometry space chaining and clean up vertex group selection code."
This reverts commit b51554bb93.

# Conflicts:
#	source/blender/makesdna/DNA_gpencil_modifier_defaults.h
2021-03-19 20:28:39 +08:00
6276a04d7f LineArt: Added back the missing "allow_clipping_boundaries" option. 2021-03-19 18:48:05 +08:00
8c1bba2fc0 LineArt: Modifier defaults optimization. 2021-03-19 18:47:40 +08:00
ba8e5de378 LineArt: Weight threshold conditional display. 2021-03-19 11:50:11 +08:00
7b76f9f6b6 LineArt: Binary weights option. 2021-03-19 09:11:14 +08:00
b51554bb93 LineArt: Remove geometry space chaining and clean up vertex group selection code. 2021-03-19 09:01:43 +08:00
e51c54478c Merge branch 'master' into temp-lineart-contained 2021-03-18 14:22:49 +01:00
86f404a889 Merge branch 'master' into temp-lineart-contained 2021-03-18 13:29:41 +01:00
6704b49b49 LineArt: Add back allow_duplication property for instanced objects. 2021-03-18 19:29:47 +08:00
dfa85f8629 LineArt: use resample_length property name. 2021-03-18 19:29:17 +08:00
b052e5bf99 LineArt: Add new frame at 0 after clearing baked strokes. 2021-03-18 19:23:52 +08:00
53018b4ac8 LineArt: Use frame 0 when creating grease pencil object. 2021-03-18 17:48:46 +08:00
eb8cc3f33d LineArt: rename tl,tr to t1,t2 2021-03-18 17:45:49 +08:00
8547bf7eb9 LineArt: Fixed collection usage check for nested cases. 2021-03-18 17:24:55 +08:00
719cd96de5 LineArt: Optimize intersection list skipping. 2021-03-18 10:43:26 +08:00
9f52862a1b LineArt: Temp solution for not including lines that are outside selected source. 2021-03-18 10:01:18 +08:00
c1f328753b LineArt: Fix naming error in lineart_cpu.c 2021-03-18 09:44:19 +08:00
4d21182f86 Cleanup LineartLine -> LineartEdge 2021-03-17 14:28:12 +01:00
17f3369f81 LineArt: Fix transparenct mask in cutting function. 2021-03-17 17:55:39 +08:00
59346789fe LineArt:Fix transparency flag error during cutting and chaining. 2021-03-17 17:43:29 +08:00
cdc5e108e5 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-17 15:05:49 +08:00
f8a91f9aaa LineArt: Remove "Render" in structure names. 2021-03-17 15:04:51 +08:00
3f78097a6b LineArt: better explaination in lineart_line_cut() 2021-03-17 12:34:23 +08:00
ca3487007c Merge branch 'master' into temp-lineart-contained 2021-03-16 20:04:02 +01:00
49e839bb46 Cleanup comments from older merges with master 2021-03-16 18:50:30 +01:00
a11448b74d Update debug flag add date 2021-03-16 18:43:38 +01:00
581202b34f Minor cleanup 2021-03-16 18:37:42 +01:00
930ddd844e Merge branch 'master' into temp-lineart-contained 2021-03-16 18:13:06 +01:00
ccf076d804 Tweak the collection propery tab location 2021-03-16 15:46:28 +01:00
7aaab357bd LineArt modifier UI tweaks. 2021-03-16 14:48:05 +01:00
66404a54aa LineArt: Fix UI for misused remove_doubles and allow_overlapping_edges. 2021-03-16 21:45:44 +08:00
c3ae9a3438 LineArt: fix struct LineartRenderLine *testing[1]; for addressing level issue. 2021-03-16 09:52:24 +08:00
512f385210 LineArt: Fix pointer in struct LineartRenderLine **testing; 2021-03-16 09:45:32 +08:00
31d1e751b5 LineArt: Continue comment cleanups. 2021-03-15 23:46:39 +08:00
9ec3d01b13 LineArt: MOD_lineart_get_bounding_area rename in header. 2021-03-15 23:03:28 +08:00
259ab267ec LineArt: Comment cleanups in lineart_cpu.c and so on. 2021-03-15 22:57:37 +08:00
736455522d Update collection tab with instancing and tweak LineArt name 2021-03-15 12:19:28 +01:00
6e33b474b9 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-15 19:12:11 +08:00
e5a1aefd73 LineArt: chain.c growing comment fixed. 2021-03-15 19:11:42 +08:00
4b2dec18b9 Line Art: Tweak collection tab properties
- Use property split
- Use the same oder as in the outliner
2021-03-14 23:28:20 -04:00
72d70aa88b Line Art: Use correct object source icon in modifier
Also use consistent variable name for a column layout.
2021-03-14 23:24:47 -04:00
952d6882bc Line Art: Remove period after UI description 2021-03-14 23:16:51 -04:00
961316d8ce Line Art: Use consistent scene icon in add menu 2021-03-14 23:15:34 -04:00
f92155e135 Line Art: Close panel in object tab by default 2021-03-14 23:12:07 -04:00
b589940174 LineArt: Added back bounding_area->linked_lines access to fix chaining problem. 2021-03-14 12:50:22 +08:00
fdaa780e4e LineArt: Comment grammar and clarity fixes in lineart_chain.c 2021-03-13 21:27:40 +08:00
af8cc21f91 LineArt: Add back fuzzy chaining option in the UI. 2021-03-13 20:39:09 +08:00
8c94e8e98d LineArt: Comment ending style fix. 2021-03-13 09:49:17 +08:00
a4abf09334 LineArt: Clean up the comments. 2021-03-13 09:43:57 +08:00
489c0fd013 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-13 09:00:37 +08:00
Bastien Montagne
b591919172 CLOG: add support for substring matching.
So that `--log "*undo*"` matches any log identifier containing `undo`.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10647
2021-03-13 08:59:00 +08:00
ad94a235e0 Fix heap buffer overflow appending/linking from a blend file
Add new function `blo_bhead_is_id_valid_type()` to correctly check the
blend file block type.

File block type codes have four bytes, and two of those are only in use
when these blocks contain ID datablocks (like `"OB\0\0"`). However,
there are other types defined in `BLO_blend_defs.h` that have four
bytes, like `TEST`, `ENDB`, etc.

The function `BKE_idtype_idcode_is_valid(short idcode)` was used to
check for ID datablocks while reading a blend file. This only takes a
2-byte parameter, and thus its result is invalid for the 4-byte codes.
For `TEST` blocks, it would actually consider it a `TE` block, which is
a valid identifier for a Texture. This caused the heap buffer overflow,
as the datablock is not a valid ID, and thus the bytes that were
expected to form an ID name actually encode something completely
different.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D10703
2021-03-13 08:59:00 +08:00
2bc444763b Fix T82532: Sculpt fails to redo the first sculpt session stroke
Sculpt undo relied on having a mode-changing undo step to properly
apply changes.

However this isn't the case with startup files or when mixing
global undo steps with sculpt (see T82851, also fixed).

Undo stepping logic follows image_undosys_step_decode_undo.
2021-03-13 08:59:00 +08:00
6a1ea4a63c Fix another crash in LibOverride resync code.
Another case where newly overridden ID (stored in `newid` of its linked
reference) gets immediately deleted in old broken overrides.

Re T86501.
2021-03-13 08:59:00 +08:00
d966a57a22 Fix compiler warning when building Cycles without Embree 2021-03-13 08:59:00 +08:00
7eb9ec5441 Cleanup: fix clang-tidy errors when COM_debug is active. 2021-03-13 08:59:00 +08:00
e45492f859 Cleanup: Compiler warnings with COM_TM_NOTHREAD active. 2021-03-13 08:59:00 +08:00
c9bbd5945c Cleanup: document FileSelectAssetLibraryUID::type
No functional changes.
2021-03-13 08:59:00 +08:00
04e451a79f LibOverride: Add a new operation to Outliner to enforce resync of hierarchies.
This is basically done by ignoring override operations from old override
affecting ID pointer properties, when the new (destination) one is not
NULL.

Fix T86501: New object added to overridden collection doesn't show up in linking file on Resync.

This is more of a work-around actually, since there is no real way to
fix the issue in a fully automated and consistent way, it is caused by
older blender files being saved with 'broken' overrides.

WARNING: This cannot ensure that some purposedly edited/overridden ID
pointer properties won't be lost in the process.
2021-03-13 08:59:00 +08:00
eaa00daa34 Fix first part of T86501: Crash during resync process.
Code would end up freeing some of the newly created overrides, which
were assigned to the matching linked ID's `newid` pointer, accessed
again further down the code.

Note that this is not a normal expected situation, and it won't give a
proper resync result anyway, but it might happen in some complicated
corner cases, and also quite often when dealing with older .blend files.
2021-03-13 08:59:00 +08:00
35ca2a8737 IDRemap: Add option to also remap internal runtime ID pointers.
In some cases (advanced, low-level), we also want to remap pointers like
`ID.newid` or `ID.orig_id`.

Only known case currently is `id_delete`, to avoid leaving potential access to freed memory. See next commit and T86501.
2021-03-13 08:59:00 +08:00
139c4f1398 LibQuery: Add an option to process internal runtime ID pointers.
In some cases (advanced, low-level code) we also want to process ID
pointers like `ID.newid` or `ID.orig_id`.
2021-03-13 08:59:00 +08:00
210909e142 Fix T86455: vertex color baking issue with sculpt vertex colors
Baking to Vertex Colors would always bake to sculpt vertex colors (if
such a layer is present) even if those are not enabled in the
experimental preferences. This would bake without an error but leave the
user without a result to look in the viewport.

Now check if sculpt vertex colors are enabled and only bake to them in
that case.

Maniphest Tasks: T86455

Differential Revision: https://developer.blender.org/D10692
2021-03-13 08:59:00 +08:00
d06caba58f Cleanup: remove workaround for MSVC PyTypeObject declarations
This is no longer needed for MSVC-2017.
2021-03-13 08:59:00 +08:00
1333a3ba5c Cleanup: set the window manager to the updated context on load
While this happened to be corrected by code that runs afterwards,
leaving this in an invalid state could cause problems in the future.
2021-03-13 08:59:00 +08:00
c5c542089c Cleanup: make_source_archive.py minor changes & comments
- Add notes on portability.
- Use encoding argument for all file IO.
- Use integer math to calculate major/minor version, while float
  division should be fine prefer matching Blender.
2021-03-13 08:59:00 +08:00
39cdad0b0c Cleanup: incorrect doxy section title
Also correct typo.
2021-03-13 08:59:00 +08:00
3bb7dffd5c Cleanup: break out of loop early 2021-03-13 08:59:00 +08:00
b9c75c67dd Cleanup: redundant flag check 2021-03-13 08:59:00 +08:00
8b3c5feb31 Cleanup: redundant outliner includes 2021-03-13 08:59:00 +08:00
8042cc9613 Fix else after return and NULL pointer value assignment 2021-03-12 17:07:37 +01:00
89f9f9b4f5 Trigger baking progress bar refresh 2021-03-12 17:01:23 +01:00
23d631a869 LineArt: Add new frames when no frame existed in modifier 2021-03-12 23:01:13 +08:00
37cfe9992d LineArt: Baking flags for UI. 2021-03-12 21:59:57 +08:00
a8b950316f LineArt: Unused variable fix 2021-03-12 21:47:10 +08:00
d40048b01a LineArt: Using object list for baking job 2021-03-12 21:28:02 +08:00
03a94ff42e Lineart: remove TODO in object_ops.c 2021-03-12 19:32:47 +08:00
d123aea358 LineArt: Fix wrong return value for cheking LRT_GPENCIL_IS_BAKING 2021-03-12 19:29:05 +08:00
fbb7036b5b LineArt: change ED_ to MOD_ 2021-03-12 19:23:57 +08:00
4dbbeed050 Remove the remaining WITH_LINEART cmake variables 2021-03-12 11:50:45 +01:00
c4f6859938 LineArt: Fix desctription string ending. 2021-03-12 13:06:20 +08:00
1bdd255793 LineArt: Baking buttons rename. 2021-03-12 12:52:29 +08:00
0d0a90fe38 LineArt: Remove 'hide_viewport' in collection panel so it won't accidentally be deactivated. 2021-03-12 12:52:09 +08:00
49441a3595 LineArt: General cleanups for names and order. 2021-03-12 12:36:04 +08:00
af29a17c32 LineArt: use name lineart_get_bounding_area_deep() to clarify. 2021-03-12 12:29:03 +08:00
2dece71d52 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-12 12:25:16 +08:00
84c653fb76 LineArt: Guard modifiers from depsgraph when baking. 2021-03-12 09:46:55 +08:00
fcafc06829 LineArt: Bake canceling now operative. 2021-03-12 09:24:44 +08:00
ae68912364 LineArt: Bounding area duplicated code removal. 2021-03-12 09:14:05 +08:00
b96c04b53a LineArt: Naming and comments clean up. 2021-03-12 09:09:53 +08:00
c806ce9cdb Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-12 07:05:55 +08:00
4dd037dd20 Merge branch 'master' into temp-lineart-contained 2021-03-11 09:55:10 +01:00
2c329f91fe LineArt: Baking and clearing notifier updated. 2021-03-10 13:46:22 +08:00
0a5cb8d8c9 LineArt: involk/exec fix for operators 2021-03-10 13:19:31 +08:00
d317741149 LineArt: use LRT_ITER_ALL_LINES_NEXT for iteration. 2021-03-10 12:40:05 +08:00
b48f69becc Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-10 08:00:31 +08:00
3f254bb955 Merge branch 'master' into temp-lineart-contained 2021-03-09 15:55:40 +01:00
c61691b954 Merge branch 'master' into temp-lineart-contained
Conflicts:
	release/scripts/addons
	source/tools
2021-03-08 15:49:12 +01:00
dda815dea2 Merge branch 'master' into temp-lineart-contained 2021-03-05 19:20:01 +01:00
4427139c6b LineArt: Progress reporting when baking. 2021-03-05 22:28:05 +08:00
012c8b56ed LineArt: Use job system for baking. 2021-03-05 22:12:43 +08:00
f593a8ae15 Lineart: Re-apply truangulation fix as MOD_TRIANGULATE_QUAD_FIXED 2021-03-05 20:58:59 +08:00
3b82c57132 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-03-05 19:59:52 +08:00
2c400731bd Merge branch 'master' into temp-lineart-contained 2021-03-01 16:40:55 +01:00
7853aa3060 Merge branch 'temp-lineart-contained' of git.blender.org:blender into temp-lineart-contained 2021-02-25 15:44:50 +01:00
bc9ab19771 Merge branch 'master' into temp-lineart-contained 2021-02-25 15:44:25 +01:00
b6f8608912 Merge remote-tracking branch 'origin/master' into temp-lineart-contained 2021-02-25 18:22:34 +08:00
d4cfa9e752 Merge branch 'master' into temp-lineart-contained
Conflicts:
	release/datafiles/locale
	release/scripts/addons
	release/scripts/addons_contrib
	source/tools
2021-02-24 16:08:08 +01:00
9b04f61c0e LineArt: Remove missing flag in previous commit 2021-02-20 20:06:29 +01:00
fd0a9d0483 LineArt: Remove WITH_LINEAR and merge projects
As Lineart can be considered a grease pencil feature is not logic to have a flag that only adds problems.

Also, the bf_gpencil_lineart has been removed and all code set inside bf_gpencil_modifiers.
2021-02-20 18:06:45 +01:00
874ecabc91 Lineart: Chnage modifier to use new default system
Now all defaults are defined in `DNA_gpencil_modifier_defaults.h`
2021-02-20 16:23:09 +01:00
7bf2108e4b Merge branch 'master' into temp-lineart-contained 2021-02-20 15:37:07 +01:00
43c43b8d48 Lineart: Fix memory leak in lineart_ops.c (Early return caused memory in list not freed). 2021-02-19 10:58:19 +08:00
24fbb449c6 Lineart: Fixed uninitialized variables. 2021-02-19 10:49:44 +08:00
6f9f45aa4b WIP bake buttons
Buggy and naming and settings needs to change probably.
See TODOs in the code
2021-02-15 01:59:03 +01:00
79ef330aad Cleanup: Remove duplicate definition 2021-02-12 18:32:34 +01:00
f564cda079 Cleanup more unused variables and functions 2021-02-12 01:41:58 +01:00
7446f90707 Cleanup various lineart files, add FIXME comments. 2021-02-12 00:13:14 +01:00
e9120950d8 Fix build issues. 2021-02-11 17:06:21 +01:00
0e59d72b04 Merge branch 'master' into temp-lineart-contained 2021-02-11 14:36:02 +01:00
1d3c721b05 Merge branch 'master' into temp-lineart-contained 2021-02-07 18:55:44 +01:00
be65d12707 Merge branch 'master' into temp-lineart-contained 2021-01-25 10:46:26 +01:00
eb65d5fb09 Fix building with and without WITH_LINEART 2021-01-14 21:28:06 +01:00
93e9068372 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-12-21 15:43:21 +08:00
c5a59fba58 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-12-21 15:43:03 +08:00
1e18ffdf14 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-12-21 15:40:31 +08:00
b30687b2ca LineArt: Proper Use of BMesh operator to remove doubles. 2020-12-21 15:40:12 +08:00
4143d59823 LineArt: Complete UI in the modifier. 2020-12-19 13:57:44 +08:00
1222a08fca Merge remote-tracking branch 'origin/lanpr-under-gp' into temp-lineart-contained
# Conflicts:
#	extern/ceres/README.blender
#	release/scripts/startup/bl_ui/space_userpref.py
#	source/blender/blenkernel/BKE_gpencil_curve.h
#	source/blender/blenkernel/BKE_gpencil_geom.h
#	source/blender/blenkernel/BKE_layer.h
#	source/blender/blenkernel/BKE_screen.h
#	source/blender/blenkernel/intern/gpencil_curve.c
#	source/blender/blenkernel/intern/layer_utils.c
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl
#	source/blender/draw/engines/overlay/shaders/wireframe_vert.glsl
#	source/blender/editors/gpencil/annotate_paint.c
#	source/blender/editors/gpencil/gpencil_convert.c
#	source/blender/editors/gpencil/gpencil_edit.c
#	source/blender/editors/gpencil/gpencil_intern.h
#	source/blender/editors/gpencil/gpencil_interpolate.c
#	source/blender/editors/gpencil/gpencil_merge.c
#	source/blender/editors/gpencil/gpencil_mesh.c
#	source/blender/editors/gpencil/gpencil_paint.c
#	source/blender/editors/gpencil/gpencil_select.c
#	source/blender/editors/gpencil/gpencil_trace_ops.c
#	source/blender/editors/gpencil/gpencil_utils.c
#	source/blender/editors/interface/interface_panel.c
#	source/blender/editors/physics/physics_pointcache.c
#	source/blender/editors/space_buttons/buttons_context.c
#	source/blender/editors/space_outliner/space_outliner.c
#	source/blender/editors/space_view3d/view3d_placement.c
#	source/blender/makesdna/DNA_userdef_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/blender/makesrna/intern/rna_space.c
#	source/blender/python/gpu/gpu_py_shader.c
2020-12-19 12:55:33 +08:00
c2f0ee013b LineArt: Merge changes 2020-12-19 12:47:59 +08:00
4885b649ef Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/makesdna/DNA_brush_types.h
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2020-12-19 12:04:26 +08:00
de9cfde08b LineArt: Ris for New APIs 2020-12-19 12:01:52 +08:00
4a76934ba3 Outliner: Fix memory errors in runtime data
Fix a heap-use-after-free when duplicating outliner editors, and fully
free runtime data when freeing outliner editors.
2020-12-19 12:00:35 +08:00
63ceade783 GPencil: Missing initialization in previous commit 2020-12-19 12:00:35 +08:00
2474b6c789 GPencil: Cleanup clang format 2020-12-19 12:00:35 +08:00
8ff765a036 GPencil: Fix unreported crash in some cases when duplicate a stroke
Some pointers were not initialized.
2020-12-19 12:00:35 +08:00
d598132c96 GPencil: Fix callback parameter list error
In the previous commit the bGPDframe parameter was removed, but this parameter is required to keep the same function signature.
2020-12-19 12:00:35 +08:00
2946762975 Collections: Prevent setting scene collection color tag from rna
It should not be possible to set the scene collection's color tag
through rna. Also adds a missing notifier for setting the collection
color tag from python.
2020-12-19 12:00:35 +08:00
38ddbfa959 UI: Remove remaining uses of old collection icon
After rB452a1c7b3838 there were still a few cases where the old
collection icon was used in the interface. Replace these with the new
filled collection icon.
2020-12-19 12:00:35 +08:00
d4133b2227 GPencil: Fix compiler warning, unused variable 2020-12-19 12:00:35 +08:00
dce2506392 GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660

This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes
Using Curves" project. It adds a submode to greasepencil edit mode that
allows for the transformation of greasepencil strokes using bezier
curves. More information about the project can be found
here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
2020-12-19 12:00:35 +08:00
53e1e6a98f Cleanup: Make panel type flag names more clear
The overlap with the `Panel` flags that start with "PNL" was quite
confusing because wasn't clear which enum a flag was from. The
new names are a bit longer, but the clarity is worth it.
2020-12-19 12:00:35 +08:00
9e42403aa6 Cleanup: Move PanelType flag from DNA to BKE header
Since this flag isn't saved in files and PanelType itself is defined in
BKE, the flag makes more sense there.
2020-12-19 12:00:35 +08:00
f4bbc84197 GPencil: Remove ID from operators to fix T82597
Instead to use the ID of the object, now the parameter is an Enum with Selected object or New.

If use selected mode, the first grease pencil object selected is used. If none of the selected objects is a grease pencil object, a new object is created.

Small cleanup changes to the original patch.

Differential Revision: https://developer.blender.org/D9529
2020-12-19 12:00:35 +08:00
cdd182d09d LibOverride: Adjust PointCache operators to properly handle overrides.
LibOverrides only support a small sub-set of PointCache features for now
(one cannot add new caches, baking in memory is not supported...).

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
1703e652a0 LibOverride: Do not tag overrides for complete recalc.
This was done as some sort of safety, but should not actually be needed,
and including tags like `ID_RECALC_POINT_CACHE` e.g. makes usage of
point caches impossible with liboverrides (since it would systematically
invalidate all cache on file load).

In theory we should not have to tag anything here in fact, RNA accessors
are supposed to take care of it, but for now we keep the
`ID_RECALC_COPY_ON_WRITE` one.

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
2b838a96b2 LibOverride: Make PointCache RNA properties overridable.
Note that due to convoluted layout of point caches in RNA (active one
also storing list of all available ones), we'll often have the
pointcache overrides rules twice. Should not be a huge problem,
practically speaking.

Part of first step of T82503: support disk cache in liboverrides.
2020-12-19 12:00:35 +08:00
640b732959 Ceres: Update to upstream version 2.0.0
We already were using one of earlier RC of the library, so there is no
expected big changes. Just making the update official, using official
version and stating it in the readme file.
2020-12-19 12:00:35 +08:00
904a2a620a CMake: Extend strict flags cancellation flags
Becomes rather annoying to duplicate them across C/C++ GCC/Clang sets,
almost as if the test should test both C and C++, and to do it for all
compilers.

Solves strict warning in the upstream of Ceres library.
2020-12-19 12:00:35 +08:00
adda1d2b23 Revert "Codesign: Versioning code to support older branches"
This reverts commit 9d172f007e.

Got a second thought and remembered why it was not done in the first place.
The issue here is that the server needs to communicate codesign result back
and that must happen within the new protocol. So if the client talks old
protocol it is possible to receieve data from it, but is not possible to
communicate result back to it.
2020-12-19 12:00:35 +08:00
8f3a7d7f3e Cleanup: use IMB_FTYPE_NONE instead of 0 for imbuf format comparison
Image format code checked the file type against an enum except for
zero which is used when the format can't be detected.

Also add doc-strings to some of the image file type callbacks.
2020-12-19 12:00:35 +08:00
eca13099de Fix building after 2e53b646f6f02ab112e0823b9577ff2e1920faaeq 2020-12-19 12:00:35 +08:00
61f1b9f559 GPencil: Remove "angle_split" from Multiply modifier. 2020-12-19 12:00:35 +08:00
df598a9a5d Object: show preview plane for add-object tool
The orientation & depth settings are used to show the preview plane
that is used when adding the object.
2020-12-19 11:59:52 +08:00
4b1fe6616d Codesign: Versioning code to support older branches
Turns out it is easier to have suboptimal versioning code on the server
side than to deal with branches where changes are to be merged into.
2020-12-19 11:59:52 +08:00
79f94f66cf refactor vec_roll_to_mat3_normalized() for clarity
the function vec_roll_to_mat3_normalized() has a bug as described in T82455. This Differential is only for refactoring the code such that it becomes more clear what the function does and how the bug can be fixed. This differential is supposed to not introduce any functional changes.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9410
2020-12-19 11:59:52 +08:00
Ivan Perevala
b46a90e9a1 UI: Adaptive HDRI preview resolution
HDRI preview should have resolution dependent on dpi, viewport scale and HDRI gizmo size.
This patch uses a LOD to render a more round sphere.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9382
2020-12-19 11:59:52 +08:00
YimingWu
cfca5dcb39 Adding 3D_POLYLINE_UNIFORM_COLOR to PyGPU shader API
This would allow python script to access `lineWidth` uniform when drawing lines
without using `glLineWidth`.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9518
2020-12-19 11:59:52 +08:00
Manuel Castilla
a7307edbe1 Fix CalculateStandardDeviationOperation incorrect results for R G B channels
Standard deviation formula wasn't being applied correctly when selecting
R G B cases. Issue is there since Blender 2.64 as it was incorrectly
ported over from the previous compositor.

Reviewed By: Sergey Sharybin, Jeroen Bakker

Differential Revision: https://developer.blender.org/D9384
2020-12-19 11:59:52 +08:00
Jun Mizutani
283aa33605 Add An Opacity Slider to Overlay Wireframe
This patch adds an opacity slider to the wireframe overlay. The previous
wireframe in dense geometry scenes could be too dark and sometimes the
user just wants an impression of the geometry during modelling.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D7622
2020-12-19 11:59:52 +08:00
798749ac71 UI: make add object tool experimental
Some changes here are planned which need feedback from users before
declaring this ready for the next release.
2020-12-19 11:59:52 +08:00
8cc87c4946 BLI_math: add floor_power_of_10, ceil_power_of_10
Add utility functions to get the floor/ceiling of a float value
to the next power of 10.
2020-12-19 11:59:52 +08:00
e7fc0965d6 Cleanup: Remove unecessary logic in panel code
Also use short for panel flag arguments to functions since it matches
the type in DNA, and remove a comment that isn't helpful.
2020-12-19 11:59:52 +08:00
d9b1e6a8c9 Cleanup: Simplify panel activate state function
This commit moves some of the logic around so that the logic in
panel_activate_state is clearly separated by the state being activated.
There are fewer nested and redundant checks, and it's easier to see
the progression of interaction with the panel handler.
2020-12-19 11:59:52 +08:00
282d12663f LineArt: Ris for New APIs 2020-11-15 12:24:23 +08:00
0c0686bd1a Merge branch 'master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	source/blender/blenloader/intern/versioning_290.c
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
#	source/tools
2020-11-15 11:07:21 +08:00
02dd1f110c LineArt: removed unreferenced scene from object_add.c 2020-11-13 16:50:30 +08:00
0c1003c7c8 Merge branch 'lanpr-under-gp' into temp-lineart-contained 2020-11-13 10:43:31 +08:00
87636e93f2 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-13 10:42:44 +08:00
eb2b85de6c LineArt: Revert accidental changes 2020-11-13 10:37:16 +08:00
3dbdf69b58 LineArt: cleanup unnecessary includes. 2020-11-13 10:33:54 +08:00
dba084a659 LineArt: "collection flags"->"Restrictions" 2020-11-13 10:23:17 +08:00
1870205455 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-12 17:34:00 +08:00
dfa4a80e9a LineArt: Remove lineart_share 2020-11-12 17:28:28 +08:00
733c707b16 Merge branch 'lanpr-under-gp' into temp_lineart_contained 2020-11-12 16:13:13 +08:00
3ef840fa2d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-12 16:12:43 +08:00
7acf84a011 LinrArt: Running line art modifier. 2020-11-12 15:05:08 +08:00
64218999ef LineArt: Cmake stuff migration. 2020-11-12 13:30:34 +08:00
ddd10dbc1b LineArt: Remove modifiers access. 2020-11-12 11:28:17 +08:00
4fffd9273f LineArt: Remove SceneLineArt. 2020-11-12 11:00:14 +08:00
257742dd5d LineArt: Move files to gpencil modifier folder. 2020-11-12 10:38:09 +08:00
72f0947c12 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-11 12:26:56 +08:00
64f573c8b5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-10 10:50:26 +08:00
351cf10bf2 LineArt: reduce chaining_image_threshold to 0.001 to prevent errorous chaining. 2020-11-10 10:47:41 +08:00
50ff559544 LineArt: Reduce geometry threshold default to 0.01 2020-11-10 10:37:20 +08:00
6b6052713c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-09 16:27:21 +08:00
a60b3071b5 LineArt: Fix transparency mask lost in angle splitting process 2020-11-09 16:20:47 +08:00
0bed1158e0 LineArt: "Match" checkbox put on top of mask bits. 2020-11-09 16:01:13 +08:00
85899dd8ae Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-07 20:22:34 +08:00
e5310101fa LineArt: Vertex weight transfer index error now fixed. 2020-11-07 20:20:44 +08:00
67852caf0b Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	CMakeLists.txt
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
2020-11-07 15:07:01 +08:00
22875e3ab0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-05 10:43:51 +08:00
eade6d3ae5 LineArt: Added scene line art option. 2020-11-05 10:43:18 +08:00
ac90022760 LineArt: do not restrict GP object selectable 2020-11-05 10:10:36 +08:00
6d3ce4cf07 LineArt: chaining occlusion info assignment to last possible vert. 2020-11-05 10:09:10 +08:00
05089352b8 LineArt: Use array for lineart_push/append_points. 2020-11-05 09:00:41 +08:00
51f07e1652 LineArt: Use ICON_OUTLINER_COLLECTION for collection icon 2020-11-05 08:39:51 +08:00
2c35b091bf LineArt: Cleanup warnings 2020-11-04 19:02:53 +08:00
96ef8ed07f LineArt: rna info updated 2020-11-04 18:07:05 +08:00
d1dee06e5e Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-04 17:58:30 +08:00
24a97e07ee LineArt: default value assignments. 2020-11-04 17:57:24 +08:00
3da9bee809 LineArt: compiler error fixes. 2020-11-04 16:20:10 +08:00
4d382591ff LineArt: naming and description fixes. 2020-11-04 16:07:23 +08:00
418d99d2c7 LineArt: code format changes. 2020-11-04 15:26:25 +08:00
bd9a8de00c LineArt: LISTBASE_FOREACH modifications. 2020-11-04 15:02:50 +08:00
2700d8509f LineArt: UI and property name changes 2020-11-04 14:49:58 +08:00
e5c3317527 LineArt: Collection panel UI fixex 2020-11-04 14:44:36 +08:00
2f953ef6e9 LineArt: Flag sync for "no camera" to "has camera" situation. 2020-11-04 09:38:31 +08:00
f475abdad2 LineArt: Main panel UI logic for no active camera scenario. 2020-11-04 09:26:23 +08:00
de02909d02 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-04 09:09:31 +08:00
31f13c2ae7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-03 14:56:51 +08:00
2ff102e651 LineArt: reduce chaining_geometry_threshold to 0.01 to reduce small bleedings in a typical scene. 2020-11-02 16:40:51 +08:00
dc96fdda01 LineArt: Support line preview in edit mode. 2020-11-02 09:46:04 +08:00
6f8ebd5e50 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-11-02 09:21:09 +08:00
5efc132c2c Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-10-31 18:29:56 +08:00
bb80b1278c LineArt: Further value tweaks for the UI. 2020-10-31 17:00:48 +08:00
ee4069e460 LineArt: Default values and description clean up. 2020-10-31 16:48:39 +08:00
abbe7c9e6a LineArt: Modifier UI cleanup. 2020-10-31 16:48:23 +08:00
dfe08487a4 LineArt: UI logic fixe for object line art panel. 2020-10-31 16:13:28 +08:00
00e7a89f81 LineArt: Main panel UI optimizations. 2020-10-31 16:06:04 +08:00
bd46b40756 LineArt: COLLECTION_HAS_OBJECT_CACHE_INSTANCED flag clear 2020-10-31 15:58:43 +08:00
603dfdcc9d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-31 15:25:58 +08:00
cba8012cd9 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
2020-10-30 12:47:09 +08:00
c4304b3e0f Lineart: Remove cursor progress call to avoid BadCursor error. 2020-10-29 12:33:15 +08:00
009314d417 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-29 12:14:56 +08:00
dd9fce0ba0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 18:11:14 +08:00
18a6508505 LineArt: comment fixes. 2020-10-28 14:44:51 +08:00
7354580f5d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 11:39:43 +08:00
35d16ff452 LineArt: Python formatting fix. 2020-10-28 11:24:36 +08:00
bea6d5ebd4 LineArt: Formatting. 2020-10-28 10:59:22 +08:00
8732277b8c LineArt: Move OP exec functions into lineart_ops.c 2020-10-28 10:52:25 +08:00
dbdd026fb3 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-28 10:37:25 +08:00
8ff66f0183 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/scripts/startup/bl_ui/properties_material_gpencil.py
2020-10-27 20:24:52 +08:00
88eb5b43c3 LineArt: Cancel running calculation when unchecked auto update. 2020-10-27 20:12:25 +08:00
1c35405ec4 LineArt: stage info updated 2020-10-24 22:27:10 +08:00
c99754dabc Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-24 22:26:12 +08:00
e1800eb8e5 LineArt: handle eval_ob == NULL case when rl->object_ref is removed. 2020-10-23 16:27:42 +08:00
34d7559ffe LineArt: Discard outside lines 2020-10-23 09:17:48 +08:00
661fa309f1 LineArt: Use separate adjacent info for clipping 2020-10-23 08:57:23 +08:00
097bb6065c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-23 07:51:16 +08:00
d1152b069a LineArt: type compatible with MSVC 2020-10-23 07:51:11 +08:00
d58c2568bb LineArt: Reduced vert intersecting data size. 2020-10-22 17:19:51 +08:00
8adb6b3595 LineArt: Reduced triangle intersecting data size. 2020-10-22 17:19:33 +08:00
4775d79df5 LineArt: Intersection vert data now allocated in extended way. 2020-10-22 16:45:49 +08:00
257f620f75 LineArt: Use global vert index to detect share_edge 2020-10-22 13:07:14 +08:00
b985019186 LineArt: Fix vertex group name induced early return in modifier. 2020-10-22 13:01:06 +08:00
67f28300c0 LineArt: Hacked culling adjacent data 2020-10-22 11:29:18 +08:00
fb52b3b69d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
2020-10-22 11:08:53 +08:00
78a6c9cfb0 LineArt: Fixing cull adjacent 2020-10-21 21:20:56 +08:00
aecceb7b1e LineArt: Line iterator fixed 2020-10-21 19:28:36 +08:00
8d9c76f43a LineArt: Culling function updated to new structure. 2020-10-21 18:08:39 +08:00
bbcc73607c LineArt: Change RenderLine to a single-way link list. 2020-10-21 17:11:42 +08:00
9ec833266c LineArt: Removed rt->rl. 2020-10-21 15:38:32 +08:00
626ab18f18 Lineart: Prior to removing rt->rl. 2020-10-21 14:45:02 +08:00
4ca8357baf LineArt: Compute contour before culling. 2020-10-21 12:57:04 +08:00
b35611632f LineArt: Remove duplicated canceling 2020-10-21 12:20:22 +08:00
ba4a481c91 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-21 11:46:44 +08:00
50578422f4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-19 20:39:03 +08:00
6c54cdaab5 LineArt: Limit near-by bounding area look up to only one level. 2020-10-19 20:38:27 +08:00
d142b5605e LineArt: Chaning lookup in near by bounding areas. 2020-10-19 20:25:40 +08:00
624bb6c9e2 LineArt: Fuzzy logic fix. 2020-10-19 20:22:44 +08:00
77030d813e LineArt: Use "Show Clipping Boundaries" for clarity 2020-10-19 17:33:11 +08:00
70867ff74e LineArt: Vertex group input will select all when filter is empty 2020-10-19 15:12:20 +08:00
3a00152fe7 LineArt: Option for remove doubles when loading mesh. 2020-10-19 14:34:17 +08:00
d244a66175 LineArt: make format 2020-10-19 12:56:11 +08:00
ed0341ca4c LineArt: Ortho camera clipping bug fixed. 2020-10-19 12:52:20 +08:00
bb25a7a59a LineArt: Remove unused default value in multiple stroke modifier. 2020-10-19 11:43:19 +08:00
2d8d86359c Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-19 11:26:37 +08:00
40ba7e7392 LineArt: Clipped crease line does not show. Fixed. 2020-10-15 19:50:21 +08:00
717c9f0682 LineArt: apply camera scale before matrix 2020-10-15 19:38:53 +08:00
8bfaf0152b Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-15 18:39:09 +08:00
d6eb20701a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-14 22:43:51 +08:00
fe8800eaae LineArt: Memory debug info. 2020-10-14 22:42:21 +08:00
f4c22820f0 LineArt: Line cut reduction 2020-10-14 20:53:14 +08:00
970d4ad696 LineArt: default crease value changes to degrees. 2020-10-14 19:04:50 +08:00
fe578d7c7d Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-14 18:39:10 +08:00
4f52220fbf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-05 21:24:40 +08:00
d2e86c49aa Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-05 15:39:06 +08:00
bc7af55b7a LineArt: Fix compiler warnings for windows. 2020-10-04 15:45:11 +08:00
ff71b67f75 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_gpencil_modifier.c
2020-10-04 12:41:33 +08:00
43770adf13 LineArt: Use max weight among groups for selection. 2020-10-03 13:33:44 +08:00
9eefbdfc51 LineArt: Smooth weight option. 2020-10-03 12:15:30 +08:00
bb231515e5 LineArt: Fix uncaught memory leak in stroke generation. 2020-10-03 11:38:21 +08:00
c28f0e55c1 LineArt: Option for matching input/output vertex group names. 2020-10-03 11:34:35 +08:00
6d53c218de Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-03 10:57:52 +08:00
0c15f1ed3e LineArt: CD_MDEFORMVERT flag in viewport evaluation. 2020-10-02 16:58:16 +08:00
97656f68e1 LineArt: Fixed render vert linking in intersection stage. 2020-10-02 15:08:05 +08:00
ecb734cd02 LineArt: vertex group data matching. 2020-10-02 14:46:13 +08:00
52ef81f848 LineArt: data copying and mofifier UI for vgroup. 2020-10-02 13:38:32 +08:00
6b8b0024db LineArt: Vertex group data structure changes. 2020-10-02 12:47:56 +08:00
cfb867fdaf LineArt: GPencil modifier API changes. 2020-10-02 12:03:06 +08:00
945222740f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-10-02 11:49:48 +08:00
8b2694a005 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/python/mathutils/mathutils_Matrix.c
2020-10-01 21:38:54 +08:00
Ivan Perevala
36c273b68c UI: Motion Tracking: Fix description of K2 coefficient
Fixed description of K2 coefficient. It is second coefficient

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D9050
2020-10-01 21:37:15 +08:00
91b0bfc809 Cleanup: spelling 2020-10-01 21:37:15 +08:00
691183242b Cleanup: remove full-stop from description 2020-10-01 21:37:15 +08:00
162277f050 Cleanup: use angle-brackets for email addresses
This is already the most widely used convention.

Use this so `make check_spelling_c` will ignore all email addresses.
2020-10-01 21:37:15 +08:00
49b3691c23 Cleanup: sort cmake file lists 2020-10-01 21:37:15 +08:00
5796c1455f Cleanup: sort struct declarations 2020-10-01 21:37:15 +08:00
da87ee1d05 Cleanup: Make function private
The "UI_panel_set_expand_from_list_data" doesn't need to be in the
public API since it's just called every time an instanced panel is added.
This commit just sets the expansion automatically and adjusts some
naming to account for the moved function.
2020-10-01 21:37:15 +08:00
a8e7d15fa0 Fix use after free deleting object with modifier panels visible
It's necessary to check if the panels are active before accessing their
data. Thanks to @ankitm for reporting this.
2020-10-01 21:37:15 +08:00
a319af986a Cleanup: Use LISTBASE_FOREACH macro in outliner code 2020-10-01 21:37:15 +08:00
81ad816441 UI: Remove second person in warning message
This phrasing can feel like an accusation, and a simpler phrase
gets across the idea just as well.
2020-10-01 21:37:15 +08:00
Pablo Dobarro
c95015bf96 Sculpt: Preserve Mesh visibility from edit mode using the Face Sets
Before this change, when users switch from edit mode to sculpt mode, the
entire mesh would be visible. Even if in the edit mesh mode part of it was
set to invisible.

With this change the visibility is preserved, by creating a separate face set
for the visible and invisible parts of the mesh and setting their initial visibility.

Implementation details: This adds a function to initialize a new Face Set
 datalayer taking the current mesh visibility into account which is stored
in the ME_HIDE flag of the vertices.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8901
2020-10-01 21:37:15 +08:00
f0b5fceac2 Sculpt: Line Project Gesture tool
This tool projects all vertices to the right of the plane defined by the
line gesture towards the plane. By doing this, this tool can create cuts
and plane surfaces in the mesh without modifying the geometry or using
boolean operations, so it is much faster than bisecting the mesh for
cases where the geometry was going to be remeshed afterwards.

Added as experimental as it does not have icon.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D9021
2020-10-01 21:37:15 +08:00
310d85678e API Docs: Correct syntax for bpy.utils.register_class 2020-10-01 21:37:15 +08:00
nutti
bcaed55995 API Docs: Fix corrupted document of gpu.select.load_id
The Python API document of gpu.select.load_id does not follow rst format.
c.f. https://docs.blender.org/api/current/gpu.select.html

This patch fixes it.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8547
2020-10-01 21:37:15 +08:00
62c8f77395 API docs: Fix sytax error for delaunay_2d_cd
Alternative solution to https://developer.blender.org/D8546
2020-10-01 21:37:15 +08:00
Ankit Meel
0a87fd4b92 Fix T81100: ccl::Node: ASan SEGV due to bad pointer
`SOCKET_OFFSETOF` was added in the initial commit {rBec51175f1fd6c91d5}
when `offsetof` [1] was not supported well enough. GCC and LLVM
support it since C++17.

Other two changes: type and size check can be done without creating
an invalid address too.

[1] https://cppreference.com/w/cpp/types/offsetof

Reviewed By: campbellbarton, brecht

Maniphest Tasks: T81100

Differential Revision: https://developer.blender.org/D9042
2020-10-01 21:37:15 +08:00
fe0b6b564b API Docs: Use raises field list syntax
See 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists
2020-10-01 21:37:15 +08:00
89565e0631 Fix unreported Eisenbug leading to a crash when reading a blend file.
This took more than a day to fully investigate and understand, one of
the reasons being that the probability of the issue to show up was
extremely low, and subjected to very specific random factors.

Root of the issue is that, in some very rare cases, a newly read ID
might get the exact same memory address as the one it had when the blend
file was saved.

In that case, `BKE_workspace_active_set` would return immediately, since
the pointer to the active workspace would remain unchanged. But that
lead to having an unset NULL active layout pointer, which would crash
when attempting to get e.g. the active screen.

For the record, I ran into this when running a specific build (master
with one flag added to the `LIB_ID_CREATE` ones, with value `1 << 3`),
using a specific set of options (`--background --factory-startup -noaudio`),
and passing the .blend file from T80090 as argument.
2020-10-01 21:37:15 +08:00
d704c293c2 Fix (unrepported) utterly broken logic in readfile for Workspaces.
Remove the attempt to update the active layout pointers of each window
from whithin `direct_link_workspace`.

This piece of code was a nonsense for at least to critical reasons:
* Do not, never, ever, access data from another datablock within the
  direct_link_... functions. Just don't. Don't try to be smart.
* Since it was trying (and failing) to update the active layout of every
  window for every workspace, it was effectively setting those
  `act_layout` pointers to NULL (remapping can only ever happen once,
  trying to remap and already remapped new pointer is bound to fail in
  any case).

Luckily (and funnily), this piece of code was actually harmless, since
setting the active layout would be overridden/redone later, in
`lib_link_windowmanager`, when updating their `workspace_hook` in
`lib_link_workspace_instance_hook`.

Note that the similar horror with `WorkSpaceDataRelation->parent` (which
points at a window) is kept for now, because that one is needed. Hope to
refactor it soon though.
2020-10-01 21:37:15 +08:00
cc13cac397 Property Search: Set expansion properly for child panels
Although I haven't seen this cause any visible errors, there is some
incorrect handling for setting panel expansion during search:
 - Properly check if child panel is active first
 - Don't stop traversal at headerless panels that could theoretically
   have children
2020-10-01 21:37:15 +08:00
179d94e407 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-29 22:16:36 +08:00
82422c8d1f LineArt: 2d Intersection function ratio check improvements. 2020-09-27 19:15:31 +08:00
6fb70a29de LineArt: Deg representation of crease threashold. 2020-09-27 15:13:14 +08:00
b9d063ab59 LineArt: Reliable line type determination. 2020-09-27 12:58:17 +08:00
7cc23f317b LineArt: Better logic for usage flags. 2020-09-27 11:38:25 +08:00
2ed35a9f93 LineArt: Collection "no intersection" flag 2020-09-27 11:02:53 +08:00
cb39e2800f LineArt: Object "No Intersection" flag. 2020-09-27 10:45:52 +08:00
94c0d3a4cc Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-27 07:56:10 +08:00
33aef1b100 LineArt: Fix rna_lineart_auto_update_set() error 2020-09-25 21:33:04 +08:00
157f4f37ad LineArt: Fixed viewport auto update. 2020-09-25 20:38:57 +08:00
7b38f90bd1 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-25 20:08:45 +08:00
f3fd29d609 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-24 08:31:17 +08:00
03853fb303 LineArt: Capability of rendering in "lock interface" mode. 2020-09-23 18:40:25 +08:00
bb936cfb6a LineArt: Clearing flag guard before framebuffer creation. 2020-09-23 17:28:14 +08:00
0bcf788c61 LineArt: Baking keyframes only. 2020-09-23 11:30:45 +08:00
78dc814112 LineArt: Preview ranges and skipping in baking. 2020-09-23 10:32:35 +08:00
03d50cddb3 LineArt: Compiler warning 2020-09-23 10:03:19 +08:00
d7fe06b35b Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-23 09:19:09 +08:00
4b51eb5743 LineArt: revert to original object relation linking in modifier depsgraph. 2020-09-23 00:10:05 +08:00
ce55b10522 LineArt: Vector 2D intersection typo fix. 2020-09-22 20:37:10 +08:00
24ab978a67 LineArt: Vertical camera FOV improper scale. 2020-09-22 20:30:21 +08:00
0a42b85fc4 Lineart: fixing Bounding area issues. 2020-09-22 14:15:14 +08:00
992735589d LineArt: No double caching during one update, even with multiple modifiers. 2020-09-22 12:20:07 +08:00
6b91c61a4f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-22 10:50:14 +08:00
69e46f11dd LineArt: Debug print in modifier. 2020-09-22 10:48:18 +08:00
a603f3ad53 LineArt: Instanced collection child function bug. 2020-09-21 23:52:35 +08:00
11c94ad244 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
2020-09-21 23:02:43 +08:00
ca7838d76a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-20 22:45:34 +08:00
42e710b87a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-18 23:30:17 +08:00
c5302b95de LineArt: Strict thread sync. 2020-09-18 23:17:50 +08:00
416ca93300 LineArt: Draw freestyle marks in viewport as well. 2020-09-18 21:02:58 +08:00
639d92f1ed LineArt: Temp fix for using in motion blur situation. (Doubles render time) 2020-09-18 20:16:35 +08:00
3f76836e72 LineArt: Mac compatibility. 2020-09-18 14:00:09 +08:00
12e07cf9de LineArt: Supplimental debug information. 2020-09-18 13:22:28 +08:00
a7d6caf94e Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/object/CMakeLists.txt
2020-09-18 13:13:26 +08:00
92104a822d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesdna/DNA_collection_types.h
#	source/blender/makesrna/intern/rna_collection.c
2020-09-16 18:19:44 +08:00
1a5106c0d1 Merge branch 'master' into lanpr-under-gp 2020-09-15 15:27:32 +02:00
dc6cdfb8d5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-15 13:34:20 +08:00
7567d8959e Merge branch 'master' into lanpr-under-gp 2020-09-14 15:30:41 +02:00
175d684470 LineArt: Fix Depth comparason error in intersection line occlusion stage. 2020-09-13 22:36:12 +08:00
08503a9062 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/gpencil_modifiers/CMakeLists.txt
#	source/blender/makesrna/intern/CMakeLists.txt
2020-09-13 22:07:57 +08:00
a75700a775 LineArt: Fix merge problem 2020-09-11 17:08:42 +02:00
46dc226b23 Merge branch 'master' into lanpr-under-gp
Conflicts:
	source/blender/blenloader/intern/writefile.c
2020-09-11 17:06:04 +02:00
62d3a0d1ec LineArt: Clipped line switch. 2020-09-11 17:16:41 +08:00
bbba3c7e72 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-11 15:16:35 +08:00
2ac3613084 LineArt: Fixed clipping line data link for new iteration path in contour detection. 2020-09-11 11:37:51 +08:00
a78e132bf4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-11 11:23:13 +08:00
5130c9e7a6 LineArt: Far clipping 2020-09-11 00:11:47 +08:00
617a60f8b7 LineArt: Typo 2020-09-10 23:27:03 +08:00
c50483f548 LineArt: Update viewport when changing ObjectLineArt settings. 2020-09-10 21:22:37 +08:00
90e05b47cd LineArt: Own crease setting for Object. 2020-09-10 21:12:58 +08:00
d8d0ae39a3 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-09-10 19:54:47 +08:00
fdfd5dcdf1 LineArt: Fix UI ptr code. 2020-09-10 19:54:01 +08:00
5eaa709063 LineArt: API fixes. 2020-09-10 11:58:22 +08:00
df558cb605 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/include/ED_geometry.h
#	source/blender/editors/lineart/lineart_ops.c
#	source/blender/editors/mesh/editmesh_intersect.c
#	source/blender/editors/object/object_facemap_ops.c
#	source/blender/gpu/CMakeLists.txt
#	source/blender/gpu/intern/gpu_batch.cc
#	source/blender/gpu/intern/gpu_context_private.hh
#	source/blender/gpu/intern/gpu_immediate.cc
#	source/blender/gpu/intern/gpu_immediate_private.hh
#	source/blender/gpu/intern/gpu_platform_private.hh
#	source/blender/gpu/intern/gpu_primitive_private.h
#	source/blender/gpu/intern/gpu_query.cc
#	source/blender/gpu/opengl/gl_batch.cc
#	source/blender/gpu/opengl/gl_context.cc
#	source/blender/gpu/opengl/gl_drawlist.cc
#	source/blender/gpu/opengl/gl_immediate.cc
#	source/blender/python/intern/bpy_rna_ui.h
2020-09-10 09:56:05 +08:00
501d064ee9 Cleanup: GPU: Remove unused attr_binding and primitive code 2020-08-31 22:23:21 +08:00
a47a64d9e4 GPUImmediate: GL backend isolation
This is part of the Vulkan backend task T68990.

This is mostly a cleanup, however, there is a small change:
We don't use a special Vertex Array binding function for Immediate
anymore and just reuse the one for batches.
This might create a bit more state changes but this could be fixed
easily if it causes perf regression.

# Conflicts:
#	source/blender/gpu/intern/gpu_context.cc
2020-08-31 22:23:21 +08:00
bfe222561c GLContext: Fix framebuffer deletion to GPUContext
This has more meaning as it's the base class who holds the pointer.

# Conflicts:
#	source/blender/gpu/opengl/gl_context.cc
2020-08-31 22:23:21 +08:00
a823597548 Cleanup: GPU_immediate: Change assert to BLI_assert 2020-08-31 22:23:21 +08:00
Germano Cavalcante
adfa705804 Fix T79973: Re-ordering face maps messes up the names of other face maps
Use a remap function instead a swap.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D8739
2020-08-31 22:23:21 +08:00
2604bade6c Cleanup: reduce variable scope 2020-08-31 22:23:21 +08:00
d0e2ce54ac Cleanup: reduce variable scope and use LISTBASE_FOREACH 2020-08-31 22:23:21 +08:00
6d5794e6bc Fix T80126: Alembic Import dialogue has overwrite protection UI
Use `FILE_OPENFILE` when importing, rather than `FILE_SAVE`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D8715
2020-08-31 22:23:21 +08:00
7c0068c10f Linux: 2.90 release information in appdata 2020-08-31 22:23:21 +08:00
964071403a Cleanup: Resolve unused variable warning in lite build 2020-08-31 22:23:21 +08:00
9282b3b936 LineArt: Enable vector line intersection code (isect_v2_v2) 2020-08-31 22:23:21 +08:00
383c9717b5 LineArt: Better line intersection function and handling. 2020-08-31 22:23:21 +08:00
7efa3cec8b LineArt: CMake clean up. 2020-08-31 22:23:21 +08:00
f18f6d5354 LineArt: DNA/RNA cleanup. 2020-08-31 15:07:19 +08:00
0e1dd86c5b LineArt: Names clean up. 2020-08-31 15:03:27 +08:00
10f8a79f6a Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-31 10:49:49 +08:00
b45728bbc0 LineArt: added ratio() after interp() functions in math lib. 2020-08-30 10:43:52 +08:00
f14bb97cbf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-30 10:23:51 +08:00
00eee5090d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	build_files/cmake/config/blender_full.cmake
#	build_files/cmake/config/blender_lite.cmake
#	build_files/cmake/config/blender_release.cmake
2020-08-29 12:26:18 +08:00
5f4be7f48e LineArt: Better desctiption for enable linked objects 2020-08-29 12:24:57 +08:00
60881cf8d9 Cleanup 'make vertex parent' operator code.
More localized variables, avoid ugly 'offset by one' index usage in
favor of explicit `INDEX_UNSET` define, etc.

No behavior change expected from this commit.
2020-08-29 12:24:57 +08:00
954c79fe51 Fix T80135: Duplicate doesn't preserve active spline
Checks to preserve the active spline on duplication
required an active vertex too.

Now having no active vertex doesn't prevent duplicate
from keeping the spline active.

Reviewed by: @mano-wii

Ref D8729
2020-08-29 12:24:57 +08:00
a55c383752 Cleanup: use doxy sections in interface_panels.c 2020-08-29 12:24:57 +08:00
b51ebc6785 Cleanup: spelling 2020-08-29 12:24:57 +08:00
64438d679f LineArt: Slope throw away threshold in lineart_LineIntersectTest2d() 2020-08-29 11:29:13 +08:00
b8cf5b7215 LineArt: More fluent viewport manipulation (canceling sequence optimization) 2020-08-28 13:06:14 +08:00
27307a2be6 LineArt: Better manuverability with quick cancel. 2020-08-28 12:41:29 +08:00
328b28cf06 LineArt: Feature line compatible clipping. 2020-08-28 11:34:28 +08:00
bba9a70c00 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-28 10:10:28 +08:00
7e063e00ac Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-27 21:19:21 +08:00
7b6e6ef977 LineArt: Splitting limit for dense triangle situations. 2020-08-27 21:13:33 +08:00
64362a1c13 LineArt: Prompt on baking finish. 2020-08-27 11:39:16 +08:00
1fa0102959 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-27 09:59:28 +08:00
450f3498ca LineArt: Basic background task canceling. 2020-08-26 22:54:26 +08:00
ccef1c234a LineArt: Back-transform strokes to allow gp to sit at other positions. 2020-08-26 20:58:09 +08:00
59c47ac6d1 LineArt: Disable line art object viewport selection by default. 2020-08-26 20:36:51 +08:00
54a7adbe79 LineArt: Prevent crash when using any sort of moving operators. 2020-08-26 20:31:34 +08:00
856265b0d8 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-26 20:18:08 +08:00
6a02e9186b Merge branch 'master' into lanpr-under-gp 2020-08-26 10:11:28 +02:00
1198a68f25 Merge branch 'master' into lanpr-under-gp 2020-08-25 10:37:48 +02:00
8f611fd0bb Merge branch 'master' into lanpr-under-gp 2020-08-23 16:24:35 +02:00
19b5f837b1 Merge branch 'master' into lanpr-under-gp 2020-08-22 13:11:05 +02:00
0c95f4f774 LineArt: "Intersection Only" flag for objects/collections 2020-08-21 21:32:44 +08:00
b3decec480 Merge branch 'master' into lanpr-under-gp 2020-08-21 09:49:21 +02:00
15ca1f8823 LineArt: Remove debug print. 2020-08-20 21:45:14 +08:00
aa07f958fa LineArt: GPencil modifier flag change to mode (wrong use of variable). 2020-08-20 18:11:56 +08:00
a8703111c4 LineArt: guard for no camera situations. 2020-08-20 17:30:50 +08:00
9dfff48b99 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-20 15:07:11 +08:00
6b255bd9bb LineArt: Support for edge split. 2020-08-20 15:03:02 +08:00
d81206066d LineArt: Camera shifting aspect ratio fix. 2020-08-20 14:15:22 +08:00
02cdabddcb LineArt: BKE_scene_graph_update_for_newframe() new api. 2020-08-20 13:34:11 +08:00
ac04fdb1d9 Merge branch 'master' into lanpr-under-gp 2020-08-19 19:53:38 +02:00
886c2936b0 Merge branch 'master' into lanpr-under-gp 2020-08-19 07:52:12 +02:00
b5c8596096 Merge branch 'master' into lanpr-under-gp
Conflicts:
	source/blender/editors/space_buttons/CMakeLists.txt
2020-08-18 16:14:11 +02:00
9061c6919f Merge branch 'master' into lanpr-under-gp 2020-08-18 11:04:02 +02:00
518b8a469d Merge branch 'master' into lanpr-under-gp 2020-08-17 11:30:52 +02:00
fded457fcb LineArt: The line art panel in material is for mesh not for grease pencil. 2020-08-17 10:50:59 +08:00
cc7a57c34e LineArt: Move Linea Art mask panel as subpanel
Also moved to properties_material_gpencil.py
2020-08-16 18:35:23 +02:00
15855dcbcd LineArt: Fix compiler warnings and clang format 2020-08-16 18:19:31 +02:00
c3735cc332 LineArt: "Match" option in modifier settings. 2020-08-16 21:52:44 +08:00
09b2374ac0 LineArt: Transparency mask selection in modifier. 2020-08-16 16:49:18 +08:00
a326688c69 LineArt: Transparency mask data in Material. 2020-08-16 12:05:45 +08:00
9a9b7c3213 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-16 11:01:16 +08:00
f79dea97df Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/versioning_280.c
2020-08-15 13:13:42 +08:00
2eaf5ec228 LineArt: Prevent lines showing inside text object surface, disable crease. 2020-08-14 19:10:07 +08:00
d1ca1b1338 LineArt: metaballs/texts/curves/surfaces support. 2020-08-14 16:17:33 +08:00
3d1ea081cf LineArt: enable/disable duplicated objects in line art. 2020-08-14 15:36:39 +08:00
33f24a5db2 Line Art: file r/w pointer clean-up for collection->object_cache_instanced. 2020-08-14 14:57:48 +08:00
e25fb868d7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-14 13:59:43 +08:00
1e7a51daa6 LineArt: Linked files now support collection-in-collection type of linking. 2020-08-13 23:10:56 +08:00
b76ffc6e04 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-13 21:55:43 +08:00
6ea694ceb8 Merge branch 'master' into lanpr-under-gp 2020-08-13 10:01:39 +02:00
5ca4e75d95 Merge branch 'master' into lanpr-under-gp 2020-08-12 22:59:09 +02:00
2103a1d145 Merge branch 'master' into lanpr-under-gp 2020-08-11 15:34:55 +02:00
30dfe126a6 Merge branch 'master' into lanpr-under-gp 2020-08-11 08:21:11 +02:00
b132cba50a Merge branch 'master' into lanpr-under-gp 2020-08-10 15:36:08 +02:00
c3d1e690cf Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-10 20:32:03 +08:00
64ea607ce4 LineArt: Memory sync fixes for animation rendering. 2020-08-09 21:56:35 +08:00
3e42356af1 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
#	source/blender/makesdna/DNA_gpencil_modifier_types.h
2020-08-09 19:48:41 +08:00
b99a5e70a1 LineArt: Guard more for very short cut situations. 2020-08-06 22:24:38 +08:00
2fec1a99c2 LineArt: Intersection lines can now be selected by different collections if fully contained. 2020-08-06 14:46:41 +08:00
0e9ebfe053 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-06 09:51:03 +08:00
77971dc662 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/tools
2020-08-05 19:51:28 +08:00
716a772d1a LineArt: use LISTBASE_FOREACH in lineart_chain.c 2020-08-03 22:59:34 +08:00
ac220268c8 LineArt: cleanup function names. 2020-08-03 21:41:15 +08:00
77e2f9629d LineArt: Cleanup extra modifications caused by merging and stuff. 2020-08-03 21:26:49 +08:00
5c660f0ff4 LineArt: Remove obsolete BKE_scene_ functions. 2020-08-03 20:17:37 +08:00
100d1c395c Merge branch 'master' into lanpr-under-gp 2020-08-03 12:35:49 +02:00
c52aab8b72 Merge branch 'master' into lanpr-under-gp 2020-08-01 12:13:29 +02:00
a3044f4733 Merge branch 'master' into lanpr-under-gp 2020-08-01 11:21:45 +02:00
0de0b8f335 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-08-01 10:45:46 +08:00
d84ba71149 LineArt: Memory utility changed to size_t instead of int. 2020-07-31 23:43:41 +08:00
31b9fa4e9a Merge branch 'master' into lanpr-under-gp 2020-07-31 12:44:41 +02:00
d842334b24 Merge branch 'master' into lanpr-under-gp 2020-07-31 12:06:11 +02:00
7ecfb0bca8 Merge branch 'master' into lanpr-under-gp 2020-07-30 16:24:14 +02:00
3402f6dec0 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-30 21:33:08 +08:00
d44a93f411 LineArt: Memory optimizations by removing obsolete variables. 2020-07-29 23:48:02 +08:00
9a04768b8b LineArt: Removing more fields in render data structure to save memory. 2020-07-29 23:32:14 +08:00
59714f2a00 LineArt: Remove RenderTriangle::gc. This variable was never really used. 2020-07-29 22:58:13 +08:00
3d33971422 LineArt: Don't call angle splitting when threshold is minimal. 2020-07-29 22:51:09 +08:00
cd9317e74e LineArt: Near clipping intersection hack. 2020-07-29 22:51:09 +08:00
653c6819d4 LineArt: Fix baking crash. 2020-07-29 22:51:09 +08:00
56e6cccefb LineArt: Fix compiler warnings 2020-07-29 13:34:03 +02:00
b33dc98893 LineArt: Remove angle splitting properties in multiply modifier. 2020-07-29 18:24:44 +08:00
d84ec55cff LineArt: Fix typo errors in tooltips 2020-07-29 12:00:27 +02:00
a7bdfd86e9 LineArt: Angle splitting using deg instead of rad. 2020-07-29 17:56:30 +08:00
2a4e6aaf48 LineArt: Allow applying of the modifier. 2020-07-29 16:54:19 +08:00
c7b0368803 Merge branch 'master' into lanpr-under-gp 2020-07-29 10:39:22 +02:00
b82d1cc4c7 LineArt: Internal angle splitting function. 2020-07-29 16:01:42 +08:00
77b00ef498 LineArt: Fix long line not registering bug. 2020-07-29 15:09:05 +08:00
9f4d79d02a LineArt: Adjacent triangle hack. 2020-07-29 14:29:51 +08:00
c760d3069c LineArt: Do not offset near-clip in culling stage. 2020-07-29 13:43:16 +08:00
73747311d5 LineArt: Obsolete functions clean up. 2020-07-29 12:11:30 +08:00
1f9d955faf LineArt: Use linear W for back-transform. 2020-07-29 12:11:18 +08:00
3abb56792d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/editors/space_buttons/buttons_context.c
2020-07-29 11:18:58 +08:00
474e2aef72 Fix small typo in the lineart clipping calculations 2020-07-28 18:25:21 +02:00
ef01d800ec LineArt: NDC to Viewport z depth optimization and near clipping decision change. 2020-07-28 23:11:21 +08:00
839fba88b9 GPencil: Cleanup comments 2020-07-28 16:59:25 +02:00
a4f3f5cec3 LineArt: Fix compiler warnings 2020-07-28 16:40:29 +02:00
a416b3e210 LineArt: Cleanup enum callback for quick line art. 2020-07-28 17:40:28 +08:00
3817355e88 LineArt: Conditinal showing of quick line art options. 2020-07-28 17:26:58 +08:00
77aa5edffd LineArt: (missedd a new file). 2020-07-28 16:40:38 +08:00
91767d7e88 LineArt: Quick line art set-up in add objects menu. 2020-07-28 16:39:51 +08:00
153815a856 Merge branch 'master' into lanpr-under-gp 2020-07-28 09:14:11 +02:00
ab3b1aa3bf LineArt: Don't retain line art buffer result after modifier evaluation. 2020-07-28 13:44:10 +08:00
20b39e4bd6 LineArt: Memory allocation now dynamically stretch each pool for better efficiency and large model handling. 2020-07-28 12:14:42 +08:00
29f160a7a8 LineArt: Don't allow frame number 0 to be baked. 2020-07-28 11:53:29 +08:00
5fc69361be LineArt: Ensure notification of line art gpencil objects when enable/disableing line art. 2020-07-28 11:49:15 +08:00
5222521bc7 LineArt: Don't retain strokes when disabled auto_update. Also prevent render dead-lock. 2020-07-28 11:05:49 +08:00
03f56a9fd6 LineArt: Fix frame cleaning at the wrong time. 2020-07-28 10:34:41 +08:00
a7ed36c803 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-28 09:21:44 +08:00
7afee455b1 LineArt: Fix compiler warnings 2020-07-27 16:53:23 +02:00
0dd6a7647c Merge branch 'master' into lanpr-under-gp 2020-07-27 16:49:01 +02:00
aaa2da3e6d Merge branch 'master' into lanpr-under-gp 2020-07-27 10:50:24 +02:00
1652026cb7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-27 11:22:00 +08:00
c53504a5b5 LineArt: Performance improvements. 2020-07-26 21:52:28 +08:00
0c96ae6724 LineArt: Pre-sample in the modifier. 2020-07-26 12:07:24 +08:00
56cfae9ef0 LineArt: Remove duplicated "Calculate Intersections" switch. 2020-07-26 11:38:50 +08:00
c89742c5b1 LineArt: Global line type flags. 2020-07-26 11:33:52 +08:00
b29749af5f LineArt: Fix force line type when connecting to intersection lines, 2020-07-26 11:12:25 +08:00
56183da948 LineArt: Global line type selection. 2020-07-26 11:07:06 +08:00
7a489cd639 LineArt: Force line types for situations in fuzzy chaining. 2020-07-26 10:48:10 +08:00
0ef3f6760f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-26 10:10:40 +08:00
7f57b9f2c1 LineArt: Restore collection and object panels for usage flag settings. 2020-07-26 00:20:32 +08:00
cbbc9e69c5 Merge branch 'master' into lanpr-under-gp 2020-07-25 16:25:11 +02:00
cf365828d8 LineArt: double point chaining algorithm 2020-07-25 17:56:54 +08:00
9b7b93b206 LineArt: Optimization for avoiding loops in chaining 2020-07-25 16:21:46 +08:00
15a012de17 Revert "Merge remote-tracking branch 'DarkdefenderRepo/npr_tess_2_90' into lanpr-under-gp"
This reverts commit ceb3b7098c, reversing
changes made to ef2189542d.
2020-07-25 12:27:36 +08:00
ceb3b7098c Merge remote-tracking branch 'DarkdefenderRepo/npr_tess_2_90' into lanpr-under-gp 2020-07-24 23:57:16 +08:00
ef2189542d LineArt: Use separate function for getting closest end point in chain. 2020-07-24 22:48:25 +08:00
7fea51be5a Merge branch 'master' into lanpr-under-gp 2020-07-24 16:24:38 +02:00
ce3447c064 LineArt: Random color debug for generated strokes. 2020-07-24 21:41:47 +08:00
8c0845eb7e Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_space.c
2020-07-24 18:13:02 +08:00
5753786bae Merge branch 'master' into lanpr-under-gp 2020-07-23 13:17:16 +02:00
173d690149 LineArt: Optimize details in chaining code. 2020-07-22 19:55:56 +08:00
9784c5021b Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-22 18:49:02 +08:00
4503af102d LineArt: Fuzzy chaining option and UI. 2020-07-22 18:48:56 +08:00
d5d73554c0 Merge branch 'master' into lanpr-under-gp 2020-07-22 11:18:36 +02:00
494b75c654 LineArt: Remove duplicated "use" phrase in modifier UI. 2020-07-22 14:08:40 +08:00
b08d72d2c8 LineArt: Optimize chaining code for better handling for organic features. 2020-07-22 13:19:53 +08:00
e586101619 Merge branch 'master' into lanpr-under-gp 2020-07-21 15:54:59 +02:00
24bce50e58 LineArt: Guard early in the modifier for stopping calculation when there's no active keyframe present. 2020-07-21 19:32:21 +08:00
3cd09680a0 LineArt: Revert accidental changes in constraint.c 2020-07-21 18:31:56 +08:00
18754b54b1 LineArt: Completely remove now obsolete LineLayer structure. 2020-07-21 17:35:37 +08:00
e22c86cbc3 LineArt: Cleanup function names into _lineart_category_operation() format. 2020-07-21 17:10:47 +08:00
f58c3f94c9 Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-21 16:03:44 +08:00
c4a4f6ebce Merge branch 'master' into lanpr-under-gp 2020-07-20 20:22:12 +02:00
9971dcc073 Merge branch 'master' into lanpr-under-gp 2020-07-20 11:12:12 +02:00
338cef6158 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-19 19:26:58 +08:00
8cdcc3703b Merge branch 'master' into lanpr-under-gp 2020-07-18 10:35:12 +02:00
61aad4f0ab Merge branch 'master' into lanpr-under-gp 2020-07-17 16:46:42 +02:00
5927aaafb7 Merge branch 'master' into lanpr-under-gp 2020-07-16 17:45:48 +02:00
c7d0ad77b0 Merge branch 'master' into lanpr-under-gp 2020-07-16 08:17:11 +02:00
38a66b5f1a LineArt: Fix isDisabled function
* The layer is not a pointer, but a name.
* Don't execute if it's disabled.
2020-07-15 23:35:24 +02:00
501489c55e LineArt: Disable modifier when source/target isn't properly set 2020-07-15 23:21:23 +08:00
7316aeb433 LineArt: Do not block the process when applying modifier with auto update turned off. 2020-07-15 22:49:17 +08:00
47985f0ea0 LineArt: Fix multiple calls to clearing frame when have multiple modifier on baking. 2020-07-15 18:58:26 +08:00
bd7308e951 LineArt: use DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN to support instanced collections and view layer flag. 2020-07-15 18:30:13 +08:00
f8ad9f1f8a LineArt: Remove LRT_ENABLED flag. 2020-07-15 18:23:38 +08:00
1250e862e3 LineArt: UI fixes. 2020-07-15 17:42:26 +08:00
5c74c712a9 LineArt: Thickness and strength moved into the modifier. 2020-07-15 17:30:06 +08:00
6fc5b82375 LineArt: use G.debug_value==4000 for line art logs. 2020-07-15 17:07:26 +08:00
ef8ee6b2fd LineArt: Precise and fast cutting point back-transform. 2020-07-15 15:03:45 +08:00
7675d3e6e2 LineArt: Overwrite frame flag now supported for baking. 2020-07-15 13:40:35 +08:00
c4057a0e86 LineArt: Restore original frame after baking is done. 2020-07-15 13:31:02 +08:00
3d13c7ebbc LineArt: Take account of hidden modifiers in render and viewport. 2020-07-15 13:27:33 +08:00
0fd17d27ed LineArt: Property in main panel will trigger auto update in the viewport. 2020-07-15 13:15:23 +08:00
2696d9b293 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-15 11:29:36 +08:00
695ad46107 LineArt: Cleanup some texts 2020-07-14 19:28:33 +02:00
a045a2dac6 LineArt: Fix compiler errors in Windows 2020-07-14 17:35:05 +02:00
98ce3d23a9 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-14 23:09:14 +08:00
8fabcb8372 LineArt: Use orig_id for all object filtering. 2020-07-14 22:49:50 +08:00
07153475ab LineArt: Cleanup code. 2020-07-14 21:32:30 +08:00
4de6902afe Merge branch 'master' into lanpr-under-gp 2020-07-14 10:44:11 +02:00
24c9b37e4b LineArt: Cleanup format 2020-07-13 22:58:43 +02:00
4139347532 Merge branch 'master' into lanpr-under-gp 2020-07-13 10:39:28 +02:00
8c01374ed6 Merge branch 'master' into lanpr-under-gp 2020-07-11 20:30:50 +02:00
023e4a5935 Merge branch 'master' into lanpr-under-gp 2020-07-10 17:11:21 +02:00
cce663421e Merge branch 'master' into lanpr-under-gp 2020-07-09 15:47:29 +02:00
6cbb2ffb0c LineArt: Use LISTBASE_FOREACH 2020-07-07 23:30:41 +08:00
19d73bd6b2 LineArt: Null handling when gpencil target is an empty object. 2020-07-07 23:06:30 +08:00
49ebb8095c Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-07-07 23:01:32 +08:00
7b96cd604a LineArt: Fix conflict on evaluation when baking. 2020-07-07 23:01:26 +08:00
9f6c0715ec LineArt: Replace Loop by LISTBASE_FOREACH 2020-07-07 16:37:56 +02:00
3be3892d85 Merge branch 'master' into lanpr-under-gp 2020-07-07 16:21:17 +02:00
a4d3e6bd47 Merge branch 'master' into lanpr-under-gp 2020-07-07 16:20:11 +02:00
1699d79b42 LineArt: Fix compiler errors and warnings in Windows 2020-07-07 16:19:54 +02:00
25de3e5294 LineArt: Handle accidental scene->master_collection == NULL situation. 2020-07-07 21:21:05 +08:00
7f6efc6769 LineArt: Bake button in render panel. 2020-07-07 20:51:14 +08:00
84e504dd3b LineArt: Obsolete operators cleaned up. 2020-07-07 20:04:39 +08:00
342a51c38c Cleanup: naming conventions in lineart_cpu.c 2020-07-07 19:17:42 +08:00
214a2c637f LineArt: Continue last commit. (git GUI problem) 2020-07-07 18:16:13 +08:00
bbb32cf494 LineArt: Continue last commit. 2020-07-07 18:15:33 +08:00
3f273fbc96 LineArt: Update calculation progress on progress bar and cursor. 2020-07-07 18:05:35 +08:00
302d9b38a7 LineArt: No need to use DEG_SCENE_PARAMETERS now because we have good object relations. 2020-07-07 16:40:23 +08:00
d4f9a1c134 LineArt: Include Depsgraph mode to grease pencil modifiers callback 2020-07-07 10:12:48 +02:00
afc0b5875e LineArt: Making settings panel visible in all engines. 2020-07-07 14:08:54 +08:00
6b216909c7 LineArt: Don't create frames in gpencil modifier. 2020-07-07 14:02:53 +08:00
5186330893 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-07 13:41:55 +08:00
4679d1857f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-07-06 14:39:23 +08:00
fac0a317cb Port smooth countour modifier to 2.90 2020-07-06 03:05:16 +02:00
c80318c84c LineArt: Fix compiler warnings 2020-07-04 16:25:00 +02:00
6f262f79ff Cleanup: Continue last commit 2020-07-04 19:41:07 +08:00
05ffc6fbcb LANPR: Master thickness and strength added. 2020-07-04 19:40:35 +08:00
4bea9c0d2b LANPR: Add related object relationship with modifier when using collection source. 2020-07-04 19:18:44 +08:00
7d28cbf05f LANPR: Remove obsolete UI in render panel. 2020-07-04 18:56:43 +08:00
365df4b5aa LANPR: Removed excessive scene relationship in updateDepsgraph. 2020-07-04 17:22:02 +08:00
0bf58275f6 LANPR: show strokes when rendering. 2020-07-04 17:17:02 +08:00
49152c98a5 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/gpencil.c
2020-07-04 13:56:23 +08:00
248585b3cc LANPR: Contour/Freestyle mark distinguish. 2020-07-03 18:32:52 +08:00
cde5978cf7 LANPR: Suspected memory issue when generating gp strokes fixed. 2020-07-03 16:27:02 +08:00
928da5b65a LANPR: Modifier property now updates viewport. 2020-07-03 15:15:28 +08:00
ee0a9a26da LANPR: Viewport now redraws when grease pencil update is finished in the background. 2020-07-03 14:59:19 +08:00
44ba7b7e1e LANPR: Collection usage flag now effective. 2020-07-03 14:41:12 +08:00
6e64a8d900 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
2020-07-03 14:22:53 +08:00
152d2c5184 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/makesrna/intern/rna_object.c
2020-07-02 12:52:08 +08:00
53b1c2c278 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-29 19:30:43 +08:00
a945849f66 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-29 12:20:41 +08:00
ec9ec3b134 Cleanup: Pointer assignment cast and modifier iteration. 2020-06-28 23:06:39 +08:00
f19ed441b8 Cleanup: Remove target settings in CollectionLineart. 2020-06-28 22:37:39 +08:00
fcec150c50 Cleanup: lanpr RNA name fixes. 2020-06-28 21:52:14 +08:00
da7964ea49 LANPR: Modifier apply now works for all line types. 2020-06-28 21:45:45 +08:00
3e39b45fa4 LANPR: Modifier apply now partially working. 2020-06-28 21:29:32 +08:00
c6fd4b97d0 LANPR: Modifier code cleanup. 2020-06-28 21:02:44 +08:00
35430988c1 LANPR: Fix Append segfault by removing BLO_expand() for a wrong pointer. 2020-06-28 20:53:36 +08:00
624994718d LANPR: Clear picked flags for modifier line picking use. 2020-06-28 19:51:01 +08:00
705a77765d LANPR: Collection mode depsgraph relationship with scene added. 2020-06-28 17:37:56 +08:00
09f72c5dba LANPR: Auto update for modifier now works in dg. 2020-06-28 17:26:43 +08:00
f2873a2f03 LANPR: Modifier stroke generation code now funcional. 2020-06-28 14:58:45 +08:00
74dd526809 Merge remote-tracking branch 'origin/lanpr-under-gp' into lanpr-under-gp 2020-06-28 14:20:45 +08:00
f2c5b7ea86 LANPR: generateStrokes functions added. 2020-06-28 14:18:51 +08:00
c963898200 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-28 12:40:04 +08:00
8f1d640a6f LANPR: GP Lineart modifier file r/w now working. 2020-06-27 21:54:44 +08:00
5b16ae068b LANPR: GP modifier basic UI complete. 2020-06-27 21:24:24 +08:00
dea7176dba LANPR: Modifier properties added. 2020-06-27 20:38:46 +08:00
77115c8832 LANPR: Main panel should also show in Workbench. 2020-06-27 19:02:47 +08:00
141fa711e4 LANPR: Added back chaining threshold values. 2020-06-27 18:06:46 +08:00
e09d0b1330 LANPR: Object LANPR panel name change to Lineart. 2020-06-27 16:21:54 +08:00
554ae0bd05 LANPR: UI name fixes. 2020-06-27 16:11:52 +08:00
cc2a1954d9 Refactor: LANPR file names changed to lineart. 2020-06-27 16:08:38 +08:00
cb676fa7da Refactor: All struct names changed to Lineart 2020-06-27 15:58:01 +08:00
ef33474ed2 Refactor: DNA names and python references for LANPR. 2020-06-27 15:27:41 +08:00
0abac43019 Refactor: Rename LANPR to LineArt in DNA and compiler options 2020-06-27 14:50:53 +08:00
ac56bf75c0 Refactor: (Continue files for last commit) 2020-06-27 14:32:47 +08:00
dad2db3bc9 Refactor: ED_lanpr functions renamed to ED_lineart 2020-06-27 14:32:04 +08:00
b6f390f6a9 Refactor: some struct names for LANPR in editor module changed to eLineArt. 2020-06-27 14:15:27 +08:00
0aed42f8a7 Refactor: Keep up with readfiles.c API changes for LANPR 2020-06-27 12:14:59 +08:00
39419bf99f Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-27 11:52:29 +08:00
bf9680f0b4 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-26 21:26:24 +08:00
44f66c3808 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-26 14:14:21 +08:00
19ba395d99 LANPR: Added placeholder modifier in GP. 2020-06-25 17:50:47 +08:00
c8f3e4cc6c LANPR: Use only (0,1) for crease threshold. 2020-06-25 17:29:27 +08:00
db211c8edd LANPR: Version bumper moved to latest. 2020-06-25 17:26:49 +08:00
26609e2639 LANPR: Fixed occlusion level detection. 2020-06-25 17:20:15 +08:00
1b7ea80690 LANPR: Fix ambiguous occlusion level when having overlapping points on chaining . 2020-06-25 16:18:55 +08:00
941ed655a8 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	CMakeLists.txt
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/editors/space_buttons/CMakeLists.txt
2020-06-25 14:09:03 +08:00
a3dc4a472d Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenloader/intern/readfile.c
2020-06-21 16:29:31 +08:00
a180717911 Fix Wrong struct reference. 2020-06-11 18:23:07 +08:00
1b856226f7 LANPR: object_foreach_id() now takes care of target reference too. 2020-06-11 18:02:51 +08:00
29d02c7c30 LANPR: Fix baking finish flag. 2020-06-11 12:55:23 +08:00
78490a7837 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenkernel/intern/scene.c
2020-06-11 12:37:54 +08:00
80011e847d LANPR: Baking in frame range is now working. 2020-06-10 22:56:23 +08:00
4273836cdc LANPR: Fix deleting GP cause UI crash problem. 2020-06-10 21:58:21 +08:00
26e91f4f1e LANPR: Thread monitoring memory leak fixed. 2020-06-10 21:04:55 +08:00
231bfe46a4 LANPR: Fix undo memory conflict in threaded calculations 2020-06-10 19:49:53 +08:00
e9ad44e368 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-10 18:34:10 +08:00
497633df39 LANPR: Background calculation now doesn't block user input. (Messy code for now) 2020-06-08 15:51:00 +08:00
9803f4502d Cleanup: Compiler debug flags. 2020-06-08 14:24:51 +08:00
b0dda64a95 LANPR: Fixed crashes during duplicate point removal in chain connecting. 2020-06-08 14:20:54 +08:00
56ebc769a6 LANPR: Fix readfile.c node tree linking error from merge. 2020-06-08 12:11:38 +08:00
cbe77c9110 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-08 12:03:03 +08:00
48a7fcdf75 LANPR: Duplicating points in chaining stage is taken care of. 2020-06-07 22:03:44 +08:00
46cd0a12d4 LANPR: ob->imat now untouched by LANPR geometry loading. Normal flipping bug solved. 2020-06-07 21:06:26 +08:00
b211885d0f LANPR: Remove chaining flag. 2020-06-07 20:50:27 +08:00
43df7f9f6a LANPR: GP Target now recalculate geometry (using DEG_id_tag thing) automatically. 2020-06-07 20:30:04 +08:00
050e6bdea7 Merge remote-tracking branch 'origin/master' into lanpr-under-gp
# Conflicts:
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/writefile.c
#	source/blender/makesrna/intern/rna_collection.c
2020-06-07 20:09:56 +08:00
35d83ade04 Merge remote-tracking branch 'origin/master' into lanpr-under-gp 2020-06-04 22:28:23 +08:00
117c0c18a3 LANPR: Memory copy/deleting implemented into depsgrapgh callback. No leaks now. 2020-06-04 22:27:54 +08:00
c2ce9fdee9 LANPR: Chaininng panel is re-configured and shown. 2020-06-04 21:47:05 +08:00
fc3f80d1bb LANPR: Init and deinit triggers in ed_utils.c 2020-06-04 21:42:53 +08:00
0ae685b584 Removed LANPR engine and made LANPR working under Pure GP. 2020-06-04 21:20:35 +08:00
bfbf0bb7f7 Merge remote-tracking branch 'origin/master' into temp-lanpr-review
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
2020-06-04 18:57:28 +08:00
3b52dfe549 Merge remote-tracking branch 'origin/master' into temp-lanpr-review
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	source/blender/blenkernel/intern/lib_query.c
2020-05-30 16:34:11 +08:00
cd54abd2c1 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-05-16 23:08:40 +08:00
f7770cb97b Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-02-01 10:35:40 +08:00
b47883a990 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2020-02-01 10:25:32 +08:00
b5abbc40a0 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-13 13:42:27 +08:00
c2c6447229 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-10 22:13:06 +08:00
191b890883 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-09 14:04:57 +08:00
f83f168c92 LANPR: Typo "identity". 2019-12-04 20:47:39 +08:00
7804323e33 LANPR: CPU mode win_mat fix attempt. 2019-12-04 20:15:45 +08:00
89e01395a8 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-04 20:15:33 +08:00
781c9f5206 LANPR: Grease pencil mode init code fix. 2019-12-03 20:23:43 +08:00
6f7f80775d LANPR: Warning messages for gpu cache overflow. 2019-12-03 13:48:48 +08:00
8b041081c3 LANPR: chaining vertex count fixed. 2019-12-03 13:44:05 +08:00
7f81bb4931 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-12-03 13:30:50 +08:00
2243de9a90 LANPR: Don't use background intersection calculation for GPU mode. 2019-11-29 23:17:00 +08:00
798e93b634 Cleanup: Missing bracket. 2019-11-28 18:44:32 +08:00
ca43179932 LANPR: Camera shift value assign. 2019-11-28 14:50:46 +08:00
6967d60c4b Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-28 14:50:40 +08:00
1c2b864155 LANPR: Remove debug print in triangle clipping 2019-11-28 13:29:49 +08:00
cb47cc14cd LANPR: Removed camera references in RenderBuffer. Safe for thread ops. 2019-11-28 13:27:13 +08:00
352eb65a57 LANPR: Locking parent thread when loading scenes into lanpr. 2019-11-28 12:38:33 +08:00
8eb44bfb81 LANPR: Renderbuffer creation changed to re-init. 2019-11-28 11:48:59 +08:00
acd8fae2d8 LANPR: Const qualifiers for some of the functions 2019-11-28 11:39:21 +08:00
Julian Eisel
541fb672ec Always write LANPR data if set
Gerneral rule of thumb: Don't delete user data without permission.
Data-blocks are a whole different and difficult story. Users may have
disabled just for a render, reloading the file shouldn't make their
settings go lost.
2019-11-27 17:19:41 +01:00
Julian Eisel
6ccd672fee Fix crash on disabling collection LANPR
Also:
* Avoid duplicated copy code (copy code performed already and wouldn't actually run)
* Cleanup freeing
2019-11-27 17:10:27 +01:00
Julian Eisel
cf38c4d49f Fix NULL-ptr mem-copy 2019-11-27 16:03:21 +01:00
12bf6ee36c LANPR: Build option CMakeLists add LANPR. 2019-11-27 22:51:35 +08:00
Julian Eisel
4227b81826 Fix wrong dereferences 2019-11-27 15:38:31 +01:00
Julian Eisel
cf623d8e7b Address some minor warnings 2019-11-27 15:36:36 +01:00
Julian Eisel
692f20604c Run clang-format on all changed files 2019-11-27 15:35:17 +01:00
9f35ef219f LANPR: Collection visibility flags should be visible in all engines. 2019-11-27 22:21:31 +08:00
aa4ff9e5d3 LANPR: Fixing CollectionLANRP file r/w. 2019-11-27 22:09:35 +08:00
1e801df3ef LANPR: Use pointer to save collection LANPR config. 2019-11-27 21:10:38 +08:00
f8384c0d2d Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-27 19:41:17 +08:00
5aa70ac589 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-27 10:18:09 +08:00
c2fbf7668d LANPR: Remove LANPR_LineLayerComponent struct as it's no more used. 2019-11-24 22:02:29 +08:00
365faddd79 LANPR: Fix chain point count error. 2019-11-24 20:55:16 +08:00
c508138e95 LANPR: CMake option in the RNA. 2019-11-24 20:48:47 +08:00
0476090983 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-24 20:43:53 +08:00
7da7d97aff Cleanup: LANPR compilder flags, missing registers, and some other fixes. 2019-11-22 19:17:54 +08:00
9b27248c64 LANPR: Some comments on the occlusion function 2019-11-22 18:27:03 +08:00
b95f15862e Cleanup: Get rid of real/tmat/tnsvector stuff in LANPR internal code. 2019-11-22 18:10:20 +08:00
232e13d4cb Cleanup: variable capitalizations. 2019-11-22 18:02:25 +08:00
96d470c0e2 LANPR: Versioning code move to the latest. 2019-11-22 17:37:15 +08:00
7e577c4857 Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-22 17:29:36 +08:00
66aa0a2181 LANPR: dpix_shader_error type and rna definition fixes. 2019-11-20 21:32:54 +08:00
ba5c4414b0 Cleanup: Function logic and unused variables. 2019-11-20 21:30:13 +08:00
ec9cdd6e51 LANPR: Fix multisample texture functions and engine registering functions. 2019-11-20 20:56:56 +08:00
b3d226ffdb CLeanup: fix property context item descriptions. 2019-11-20 20:25:57 +08:00
bdd96da5eb Merge remote-tracking branch 'origin/master' into temp-lanpr-review 2019-11-20 20:20:38 +08:00
43419e4c32 LANPR: Removed unused DRW_texture_create_2d_multisample function. 2019-11-20 17:20:42 +08:00
dc9f9faff7 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-20 16:11:51 +08:00
f2f2f5f6c7 Cleanup: Code style and dead code stuff. 2019-11-20 16:11:10 +08:00
9c7f536251 LANPR: Fix cmake option in render to allow lanpr callback for gp updates. 2019-11-20 16:02:29 +08:00
a921c5f239 Cleanup: dead codes and commentaries. 2019-11-20 15:44:33 +08:00
bb38766ba6 LANPR: Clipping topology data error fixed.
Also cleaned up some dead code inside.
2019-11-20 15:01:04 +08:00
45eb04adc8 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-20 13:21:35 +08:00
ee7785510b Cleanup: TNS_THREAD_LINE_COUNT commenting. 2019-11-18 22:14:32 +08:00
db12505f51 Cleanup: Fix compiler warnings. 2019-11-18 22:08:48 +08:00
314439e652 Cleanup: Remove snake mode structures in ED_lanpr.h 2019-11-18 21:48:34 +08:00
9a9fa3a206 Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-18 21:46:25 +08:00
c3799f1c31 LANPR: Fix various code issues. 2019-11-17 20:29:17 +08:00
ef1cd34e8d Merge remote-tracking branch 'origin/master' into arcpatch-D5442 2019-11-17 20:10:38 +08:00
dba890910d LANPR: Still enable auto update checkbox when no active camera is persent. 2019-11-15 20:37:20 +08:00
3bcdf06a54 Merge branch 'master' into arcpatch-D5442 2019-11-15 20:30:19 +08:00
1924e96f7d LANPR: Fix asset errors and material marking errors. 2019-11-15 20:06:36 +08:00
YimingWu
e9df7caf19 LANPR line rendering (summer of code)
LANPR Patch

This is the patch for soc-2019-npr branch. Now modified as containing only LANPR changes

This patch **doesn't include** the following:

- GPencil modifiers.
- Smooth contour modifier.
- SVG.
- Affected UI scripts.
- Freestyle changes.

Those above will be submitted in other diffs.

Differential Revision: https://developer.blender.org/D5442
2019-11-15 11:46:33 +08:00
36 changed files with 2944 additions and 385 deletions

View File

@@ -790,6 +790,59 @@ if(CMAKE_COMPILER_IS_GNUCC)
unset(LD_VERSION)
endif()
# NOTE(@campbellbarton): Eventually mold will be able to use `-fuse-ld=mold`,
# however at the moment this only works for GCC 12.1+ (unreleased at time of writing).
# So a workaround is used here "-B" which points to another path to find system commands
# such as `ld`.
if(WITH_LINKER_MOLD)
find_program(MOLD_BIN "mold")
mark_as_advanced(MOLD_BIN)
if(NOT MOLD_BIN)
message(STATUS "The \"mold\" binary could not be found, using system linker!")
set(WITH_LINKER_MOLD OFF)
else()
# By default mold installs the binary to:
# - `{PREFIX}/bin/mold` as well as a symbolic-link in...
# - `{PREFIX}/lib/mold/ld`.
# (where `PREFIX` is typically `/usr/`).
#
# This block of code finds `{PREFIX}/lib/mold` from the `mold` binary.
# Other methods of searching for the path could also be made to work,
# we could even make our own directory and symbolic-link, however it's more
# convenient to use the one provided by mold.
#
# Use the binary path to "mold", to find the common prefix which contains "lib/mold".
# The parent directory: e.g. `/usr/bin/mold` -> `/usr/bin/`.
get_filename_component(MOLD_PREFIX "${MOLD_BIN}" DIRECTORY)
# The common prefix path: e.g. `/usr/bin/` -> `/usr/` to use as a hint.
get_filename_component(MOLD_PREFIX "${MOLD_PREFIX}" DIRECTORY)
# Find `{PREFIX}/lib/mold/ld`, store the directory component (without the `ld`).
# Then pass `-B {PREFIX}/lib/mold` to GCC so the `ld` located there overrides the default.
find_path(
MOLD_BIN_DIR "ld"
HINTS "${MOLD_PREFIX}"
PATH_SUFFIXES "lib/mold" "lib64/mold"
NO_DEFAULT_PATH
NO_CACHE
)
if(NOT MOLD_BIN_DIR)
message(STATUS
"The mold linker could not find the directory containing the linker command "
"(typically \"${MOLD_PREFIX}/lib/mold\"), using system linker!")
set(WITH_LINKER_MOLD OFF)
endif()
unset(MOLD_PREFIX)
endif()
if(WITH_LINKER_MOLD)
# GCC will search for `ld` in this directory first.
string(APPEND CMAKE_CXX_FLAGS " -B \"${MOLD_BIN_DIR}\"")
string(APPEND CMAKE_C_FLAGS " -B \"${MOLD_BIN_DIR}\"")
endif()
unset(MOLD_BIN)
unset(MOLD_BIN_DIR)
endif()
# CLang is the same as GCC for now.
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")

View File

@@ -77,6 +77,18 @@ class COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
row.prop(collection, "lineart_intersection_mask", index=i, text=" ", toggle=True)
if i == 3:
row = col.row(align=True)
row = layout.row(heading="Silouette Group")
row.prop(collection, "use_lineart_silhouette_group", text="")
subrow = row.row()
subrow.active = collection.use_lineart_silhouette_group
subrow.prop(collection, "lineart_silhouette_group", text="")
row = layout.row(heading="Intersection Priority")
row.prop(collection, "use_lineart_intersection_priority", text="")
subrow = row.row()
subrow.active = collection.use_lineart_intersection_priority
subrow.prop(collection, "lineart_intersection_priority", text="")
classes = (

View File

@@ -286,6 +286,18 @@ class MATERIAL_PT_lineart(MaterialButtonsPanel, Panel):
row = layout.row(align=True, heading="Custom Occlusion")
row.prop(lineart, "mat_occlusion", text="Levels")
row = layout.row(heading="Silouette Group")
row.prop(lineart, "use_silhouette_group_override", text="")
subrow = row.row()
subrow.active = lineart.use_silhouette_group_override
subrow.prop(lineart, "mat_silhouette_group", text="")
row = layout.row(heading="Intersection Priority")
row.prop(lineart, "use_intersection_priority_override", text="")
subrow = row.row()
subrow.active = lineart.use_intersection_priority_override
subrow.prop(lineart, "intersection_priority", text="")
classes = (

View File

@@ -316,6 +316,18 @@ class OBJECT_PT_lineart(ObjectButtonsPanel, Panel):
subrow = row.row()
subrow.active = lineart.use_crease_override
subrow.prop(lineart, "crease_threshold", slider=True, text="")
row = layout.row(heading="Silouette Group")
row.prop(lineart, "use_silhouette_group_override", text="")
subrow = row.row()
subrow.active = lineart.use_silhouette_group_override
subrow.prop(lineart, "silhouette_group", text="")
row = layout.row(heading="Intersection Priority")
row.prop(lineart, "use_intersection_priority_override", text="")
subrow = row.row()
subrow.active = lineart.use_intersection_priority_override
subrow.prop(lineart, "intersection_priority", text="")
class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):

View File

@@ -21,7 +21,7 @@ extern "C" {
/* Blender patch version for bugfix releases. */
#define BLENDER_VERSION_PATCH 0
/** Blender release cycle stage: alpha/beta/rc/release. */
#define BLENDER_VERSION_CYCLE alpha
#define BLENDER_VERSION_CYCLE release
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION

View File

@@ -383,6 +383,8 @@ typedef struct GpencilLineartLimitInfo {
char min_level;
char max_level;
short edge_types;
char shadow_selection;
char silhouette_selection;
} GpencilLineartLimitInfo;
GpencilLineartLimitInfo BKE_gpencil_get_lineart_modifier_limits(const struct Object *ob);

View File

@@ -221,6 +221,9 @@ GpencilLineartLimitInfo BKE_gpencil_get_lineart_modifier_limits(const Object *ob
info.max_level = MAX2(info.max_level,
(lmd->use_multiple_levels ? lmd->level_end : lmd->level_start));
info.edge_types |= lmd->edge_types;
info.shadow_selection = MAX2(lmd->shadow_selection, info.shadow_selection);
info.silhouette_selection = MAX2(lmd->silhouette_selection, info.silhouette_selection);
is_first = false;
}
}
}
@@ -237,11 +240,15 @@ void BKE_gpencil_set_lineart_modifier_limits(GpencilModifierData *md,
lmd->level_start_override = info->min_level;
lmd->level_end_override = info->max_level;
lmd->edge_types_override = info->edge_types;
lmd->shadow_selection_override = info->shadow_selection;
lmd->shadow_use_silhouette_override = info->silhouette_selection;
}
else {
lmd->level_start_override = lmd->level_start;
lmd->level_end_override = lmd->level_end;
lmd->edge_types_override = lmd->edge_types;
lmd->shadow_selection_override = lmd->shadow_selection;
lmd->shadow_use_silhouette_override = lmd->silhouette_selection;
}
}

View File

@@ -1185,9 +1185,11 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
// printf("\thandling edge %d / loop %d\n", mlfan_curr->e, mlfan_curr_index);
{
/* Code similar to accumulate_vertex_normals_poly_v3. */
/* Calculate angle between the two poly edges incident on this vertex. */
const float fac = saacos(dot_v3v3(vec_curr, vec_prev));
/* Code similar to #accumulate_vertex_normals_poly_v3. */
/* Calculate angle between the two poly edges incident on this vertex.
* NOTE: no need for #saacos here as the input has been sanitized,
* `nan` values in coordinates normalize to zero which works for `acosf`. */
const float fac = acosf(dot_v3v3(vec_curr, vec_prev));
/* Accumulate */
madd_v3_v3fl(lnor, polynors[mpfan_curr_index], fac);

View File

@@ -40,6 +40,10 @@ MINLINE void swap_v2_v2(float a[2], float b[2]);
MINLINE void swap_v3_v3(float a[3], float b[3]);
MINLINE void swap_v4_v4(float a[4], float b[4]);
MINLINE void swap_v2_v2_db(double a[2], double b[2]);
MINLINE void swap_v3_v3_db(double a[3], double b[3]);
MINLINE void swap_v4_v4_db(double a[4], double b[4]);
/* unsigned char */
MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]);

View File

@@ -5002,7 +5002,10 @@ void accumulate_vertex_normals_tri_v3(float n1[3],
for (i = 0; i < nverts; i++) {
const float *cur_edge = vdiffs[i];
const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
/* Calculate angle between the two poly edges incident on this vertex.
* NOTE: no need for #saacos here as the input has been sanitized,
* `nan` values in coordinates normalize to zero which works for `acosf`. */
const float fac = acosf(-dot_v3v3(cur_edge, prev_edge));
/* accumulate */
madd_v3_v3fl(vn[i], f_no, fac);
@@ -5079,9 +5082,10 @@ void accumulate_vertex_normals_poly_v3(float **vertnos,
for (i = 0; i < nverts; i++) {
const float *cur_edge = vdiffs[i];
/* calculate angle between the two poly edges incident on
* this vertex */
const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
/* Calculate angle between the two poly edges incident on this vertex.
* NOTE: no need for #saacos here as the input has been sanitized,
* `nan` values in coordinates normalize to zero which works for `acosf`. */
const float fac = acosf(-dot_v3v3(cur_edge, prev_edge));
/* accumulate */
madd_v3_v3fl(vertnos[i], polyno, fac);

View File

@@ -316,6 +316,27 @@ MINLINE void swap_v4_v4(float a[4], float b[4])
SWAP(float, a[3], b[3]);
}
MINLINE void swap_v2_v2_db(double a[2], double b[2])
{
SWAP(double, a[0], b[0]);
SWAP(double, a[1], b[1]);
}
MINLINE void swap_v3_v3_db(double a[3], double b[3])
{
SWAP(double, a[0], b[0]);
SWAP(double, a[1], b[1]);
SWAP(double, a[2], b[2]);
}
MINLINE void swap_v4_v4_db(double a[4], double b[4])
{
SWAP(double, a[0], b[0]);
SWAP(double, a[1], b[1]);
SWAP(double, a[2], b[2]);
SWAP(double, a[3], b[3]);
}
/* float args -> vec */
MINLINE void copy_v2_fl2(float v[2], float x, float y)

View File

@@ -1494,6 +1494,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
BKE_animdata_main_cb(bmain, do_version_bbone_len_scale_animdata_cb, NULL);
}
if (!DNA_struct_elem_find(
fd->filesdna, "LineartGpencilModifierData", "bool", "use_crease_on_smooth")) {
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
if (ob->type == OB_GPENCIL) {
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
if (md->type == eGpencilModifierType_Lineart) {
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
lmd->calculation_flags |= LRT_USE_CREASE_ON_SMOOTH_SURFACES;
}
}
}
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 5)) {
@@ -1690,6 +1703,16 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
LISTBASE_FOREACH (GpencilModifierData *, gpd, &ob->greasepencil_modifiers) {
if (gpd->type == eGpencilModifierType_Lineart) {
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)gpd;
lmd->shadow_camera_near = 0.1f;
lmd->shadow_camera_far = 200.0f;
lmd->shadow_camera_size = 200.0f;
}
}
}
}
/* Font names were copied directly into ID names, see: T90417. */

View File

@@ -637,9 +637,11 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
{
/* Code similar to accumulate_vertex_normals_poly_v3. */
/* Calculate angle between the two poly edges incident on this vertex. */
/* Calculate angle between the two poly edges incident on this vertex.
* NOTE: no need for #saacos here as the input has been sanitized,
* `nan` values in coordinates normalize to zero which works for `acosf`. */
const BMFace *f = lfan_pivot->f;
const float fac = saacos(dot_v3v3(vec_next, vec_curr));
const float fac = acosf(dot_v3v3(vec_next, vec_curr));
const float *no = fnos ? fnos[BM_elem_index_get(f)] : f->no;
/* Accumulate */
madd_v3_v3fl(lnor, no, fac);
@@ -1109,6 +1111,9 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
do {
BM_elem_index_set(l_curr, index_loop++); /* set_inline */
BM_elem_flag_disable(l_curr, BM_ELEM_TAG);
/* Needed for when #bm_mesh_edges_sharp_tag doesn't run.
* Mark smooth if there is no smoothing angle. */
BM_elem_flag_enable(l_curr->e, BM_ELEM_TAG);
} while ((l_curr = l_curr->next) != l_first);
}
bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP);

View File

@@ -647,10 +647,10 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
drw_call_calc_orco(ob, ob_infos->orcotexfac);
/* Random float value. */
uint random = (DST.dupli_source) ?
DST.dupli_source->random_id :
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
* put it in ob->runtime and make depsgraph ensure it is up to date. */
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
DST.dupli_source->random_id :
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
* put it in ob->runtime and make depsgraph ensure it is up to date. */
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
ob_infos->ob_random = random * (1.0f / (float)0xFFFFFFFF);
/* Object State. */
ob_infos->ob_flag = 1.0f; /* Required to have a correct sign */

View File

@@ -1048,12 +1048,10 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const i
/* Neighbor columns, accounting for being cyclic. */
if (do_extremes) {
chain.prev = (v > 0) ? &fcu->bezt[v - 1] :
is_cyclic ? &fcu->bezt[fcu->totvert - 2] :
nullptr;
chain.prev = (v > 0) ? &fcu->bezt[v - 1] :
is_cyclic ? &fcu->bezt[fcu->totvert - 2] : nullptr;
chain.next = (v + 1 < fcu->totvert) ? &fcu->bezt[v + 1] :
is_cyclic ? &fcu->bezt[1] :
nullptr;
is_cyclic ? &fcu->bezt[1] : nullptr;
}
add_bezt_to_keycolumns_list(keylist, &chain);

View File

@@ -1429,10 +1429,7 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op)
id_us_plus(&md->target_material->id);
}
if (use_lights) {
ob->dtx |= OB_USE_GPENCIL_LIGHTS;
}
else {
if (!use_lights) {
ob->dtx &= ~OB_USE_GPENCIL_LIGHTS;
}

View File

@@ -17,6 +17,7 @@ set(INC
../windowmanager
../../../intern/eigen
../../../intern/guardedalloc
../../../intern/atomic
# dna_type_offsets.h in BLO_read_write.h
${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
@@ -68,6 +69,7 @@ set(SRC
intern/lineart/lineart_cpp_bridge.cc
intern/lineart/lineart_cpu.c
intern/lineart/lineart_ops.c
intern/lineart/lineart_shadow.c
intern/lineart/lineart_util.c
intern/lineart/MOD_lineart.h

View File

@@ -43,6 +43,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "MOD_gpencil_lineart.h"
#include "MOD_gpencil_modifiertypes.h"
#include "MOD_gpencil_ui_common.h"
@@ -90,6 +91,9 @@ static void generate_strokes_actual(
lmd->intersection_mask,
lmd->thickness,
lmd->opacity,
lmd->shadow_selection,
lmd->silhouette_selection,
lmd->use_silhouette_group,
lmd->source_vertex_group,
lmd->vgname,
lmd->flags);
@@ -195,6 +199,7 @@ static void bakeModifier(Main *UNUSED(bmain),
* modifiers in the stack. */
lmd->edge_types_override = lmd->edge_types;
lmd->level_end_override = lmd->level_end;
lmd->shadow_selection_override = lmd->shadow_selection;
MOD_lineart_compute_feature_lines(
depsgraph, lmd, &gpd->runtime.lineart_cache, (!(ob->dtx & OB_DRAW_IN_FRONT)));
@@ -276,6 +281,7 @@ static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk,
walk(userData, ob, (ID **)&lmd->source_object, IDWALK_CB_NOP);
walk(userData, ob, (ID **)&lmd->source_camera, IDWALK_CB_NOP);
walk(userData, ob, (ID **)&lmd->light_contour_object, IDWALK_CB_NOP);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
@@ -345,16 +351,22 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE);
uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Outline"));
uiItemR(sub, ptr, "use_contour", 0, "", ICON_NONE);
uiLayout *entry = uiLayoutRow(sub, false);
uiLayoutSetActive(entry, RNA_boolean_get(ptr, "use_contour"));
uiItemR(entry, ptr, "silhouette_filtering", 0, "", ICON_NONE);
uiItemR(col, ptr, "use_silhouette_group", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_loose", 0, IFACE_("Loose"), ICON_NONE);
uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE);
uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE);
uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE);
uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease"));
sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease"));
uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
uiLayout *entry = uiLayoutRow(sub, false);
uiLayoutSetEnabled(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
entry = uiLayoutRow(sub, false);
uiLayoutSetActive(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
if (use_cache && !is_first) {
uiItemL(entry, IFACE_("Angle Cached"), ICON_INFO);
}
@@ -362,9 +374,49 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(entry, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE);
}
sub = uiLayoutColumn(col, false);
uiLayoutSetActive(sub, RNA_pointer_get(ptr, "light_contour_object").data != NULL);
uiItemR(sub, ptr, "use_light_contour", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "use_shadow", 0, IFACE_("Cast Shadow"), ICON_NONE);
uiItemR(sub, ptr, "shadow_region_filtering", 0, IFACE_("Regions"), ICON_NONE);
uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, IFACE_("Allow Overlap"), ICON_NONE);
}
static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ob_ptr;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr);
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_cache = RNA_boolean_get(ptr, "use_cache");
const bool use_shadow = RNA_boolean_get(ptr, "use_shadow");
const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data);
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
if (use_cache && !is_first) {
uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
return;
}
uiItemR(layout, ptr, "light_contour_object", 0, NULL, ICON_NONE);
uiLayout *remaining = uiLayoutColumn(layout, false);
uiLayoutSetActive(remaining, use_shadow);
uiItemR(remaining, ptr, "shadow_camera_size", 0, NULL, ICON_NONE);
uiLayout *col = uiLayoutColumn(remaining, true);
uiItemR(col, ptr, "shadow_camera_near", 0, "Near", ICON_NONE);
uiItemR(col, ptr, "shadow_camera_far", 0, "Far", ICON_NONE);
uiItemR(layout, ptr, "shadow_enclosed_shapes", 0, IFACE_("Eclosed Shapes"), ICON_NONE);
}
static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
@@ -390,14 +442,13 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(subrow, true);
uiItemR(subrow, ptr, "source_camera", 0, "", ICON_OBJECT_DATA);
uiLayout *col = uiLayoutColumn(layout, true);
uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE);
uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), ICON_NONE);
uiItemR(col, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), ICON_NONE);
uiItemR(col, ptr, "use_back_face_culling", 0, IFACE_("Force Backface Culling"), ICON_NONE);
uiItemR(layout, ptr, "use_ortho_tolerance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE);
uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), ICON_NONE);
uiItemR(layout, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), ICON_NONE);
uiItemR(layout, ptr, "use_back_face_culling", 0, NULL, ICON_NONE);
}
static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)
@@ -410,7 +461,7 @@ static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiLayoutSetEnabled(layout, !is_baked);
uiItemR(layout, ptr, "thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(layout, ptr, "thickness", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -501,17 +552,33 @@ static void material_mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_material_mask_match", 0, IFACE_("Exact Match"), ICON_NONE);
}
static void intersection_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_isec = RNA_boolean_get(ptr, "use_intersection");
uiLayoutSetEnabled(layout, !is_baked);
uiLayoutSetActive(layout, use_isec);
uiItemR(layout, ptr, "use_intersection_filter", 0, IFACE_("Filter Intersection"), ICON_NONE);
}
static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
const bool is_baked = RNA_boolean_get(ptr, "is_baked");
const bool use_isec = RNA_boolean_get(ptr, "use_intersection");
const bool use_isec_filter = RNA_boolean_get(ptr, "use_intersection_filter");
uiLayoutSetEnabled(layout, !is_baked);
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_intersection"));
uiLayoutSetActive(layout, use_isec && use_isec_filter);
uiLayout *col = uiLayoutColumn(layout, true);
uiLayout *sub = uiLayoutRowWithHeading(col, true, IFACE_("Collection Masks"));
@@ -526,6 +593,7 @@ static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_intersection_match", 0, IFACE_("Exact Match"), ICON_NONE);
}
static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
@@ -595,8 +663,10 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Chain"));
uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_fuzzy_all", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_loose_edge_chain", 0, IFACE_("Loose Edges"), ICON_NONE);
uiItemR(col, ptr, "use_loose_as_contour", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_loose_as_contour", 0, IFACE_("Loose Edges As Contour"), ICON_NONE);
uiItemR(col, ptr, "use_detail_preserve", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_geometry_space_chain", 0, IFACE_("Geometry Space"), ICON_NONE);
@@ -707,6 +777,12 @@ static void panelRegister(ARegionType *region_type)
gpencil_modifier_subpanel_register(
region_type, "edge_types", "Edge Types", NULL, edge_types_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"light_reference",
"Light Referecne",
NULL,
options_light_reference_draw,
panel_type);
gpencil_modifier_subpanel_register(
region_type, "geometry", "Geometry Processing", NULL, options_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
@@ -719,8 +795,12 @@ static void panelRegister(ARegionType *region_type)
material_mask_panel_draw_header,
material_mask_panel_draw,
occlusion_panel);
gpencil_modifier_subpanel_register(
region_type, "intersection", "Intersection", NULL, intersection_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,
"intersection",
"",
intersection_panel_draw_header,
intersection_panel_draw,
panel_type);
gpencil_modifier_subpanel_register(
region_type, "face_mark", "", face_mark_panel_draw_header, face_mark_panel_draw, panel_type);
gpencil_modifier_subpanel_register(

View File

@@ -41,10 +41,17 @@ typedef struct LineartTriangle {
unsigned char mat_occlusion;
unsigned char flags; /* #eLineartTriangleFlags */
/* target_reference = (obi->obindex | triangle_index) */
/* higher 12 bits-------^ ^-----index in object, lower 20 bits */
int target_reference;
unsigned char silhouette_group;
unsigned char intersection_priority;
/**
* Only use single link list, because we don't need to go back in order.
* This variable is also reused to store the pointer to adjacent lines of this triangle before
* intersection stage.
* This variable is also reused to store the pointer to adjacent lines of this triangle
* before intersection stage.
*/
struct LinkNode *intersecting_verts;
} LineartTriangle;
@@ -66,6 +73,7 @@ typedef enum eLineArtElementNodeFlag {
LRT_ELEMENT_IS_ADDITIONAL = (1 << 0),
LRT_ELEMENT_BORDER_ONLY = (1 << 1),
LRT_ELEMENT_NO_INTERSECTION = (1 << 2),
LRT_ELEMENT_INTERSECTION_DATA = (1 << 3),
} eLineArtElementNodeFlag;
typedef struct LineartElementLinkNode {
@@ -75,6 +83,9 @@ typedef struct LineartElementLinkNode {
void *object_ref;
eLineArtElementNodeFlag flags;
/* For edge element link nodes, used for shadow edge matching. */
int obindex;
/** Per object value, always set, if not enabled by #ObjectLineArt, then it's set to global. */
float crease_threshold;
} LineartElementLinkNode;
@@ -88,8 +99,45 @@ typedef struct LineartEdgeSegment {
/* Used to filter line art occlusion edges */
unsigned char material_mask_bits;
/* Only used to mark "lit/shade" for now, But reserverd bits for material info.
* TODO(Yiming): Transfer material masks from shadow results
* onto here so then we can even filter transparent shadows. */
unsigned char shadow_mask_bits;
unsigned char silhouette_group;
} LineartEdgeSegment;
typedef struct LineartShadowSegmentContainer {
struct LineartShadowSegmentContainer *next, *prev;
/* Two end points in framebuffer coordinates viewed from the light source. */
double fbc1[4], fbc2[4];
double g1[3], g2[3];
struct LineartEdge *e_ref;
struct LineartEdge *e_ref_light_contour;
struct LineartEdgeSegment *es_ref; /* Only for 3rd stage casting. */
ListBase shadow_segments;
} LineartShadowSegmentContainer;
enum eLineartShadowSegmentFlag {
LRT_SHADOW_CASTED = 1,
LRT_SHADOW_FACING_LIGHT = 2,
};
typedef struct LineartShadowSegment {
struct LineartShadowSegment *next, *prev;
/* eLineartShadowSegmentFlag */
int flag;
/* In NDC, not in global linear. */
double at;
/* Left and right pos, because when casting shadows at some point there will be
* non-continuous cuts. */
double fbc1[4], fbc2[4];
/* Global position. */
double g1[4], g2[4];
int target_reference;
uint8_t silhouette_group;
} LineartShadowSegment;
typedef struct LineartVert {
double gloc[3];
double fbcoord[4];
@@ -119,24 +167,36 @@ typedef enum eLineArtVertFlags {
} eLineArtVertFlags;
typedef struct LineartEdge {
/** We only need link node kind of list here. */
struct LineartEdge *next;
struct LineartVert *v1, *v2;
/** These two variables are also used to specify original edge and segment during 3rd stage
* reprojection, So we can easily find out the line which results come from. */
struct LineartTriangle *t1, *t2;
ListBase segments;
char min_occ;
/** Also for line type determination on chaining. */
uint16_t flags;
unsigned char intersection_mask;
uint8_t intersection_mask;
/** Matches the shadow result, used to determine whether a line is in the shadow or not.
* Usages:
* - Intersection lines: ((e->t1->target_reference << 32) | e->t2->target_reference);
* - Other lines: LRT_EDGE_IDENTIFIER(obi, e);
* - After shadow calculation: (search the shadow result and set reference to that);
*/
struct LineartEdge *from_shadow;
int target_reference;
uint8_t silhouette_group;
/**
* Still need this entry because culled lines will not add to object
* #LineartElementLinkNode node (known as `eln` internally).
*
* TODO: If really need more savings, we can allocate this in a "extended" way too, but we need
* another bit in flags to be able to show the difference.
* TODO: If really need more savings, we can allocate this in a "extended" way too, but we
* need another bit in flags to be able to show the difference.
*/
struct Object *object_ref;
} LineartEdge;
@@ -158,6 +218,8 @@ typedef struct LineartEdgeChain {
int loop_id;
unsigned char material_mask_bits;
unsigned char intersection_mask;
unsigned char shadow_mask_bits;
unsigned char silhouette_group;
struct Object *object_ref;
} LineartEdgeChain;
@@ -173,6 +235,8 @@ typedef struct LineartEdgeChainItem {
char occlusion;
unsigned char material_mask_bits;
unsigned char intersection_mask;
unsigned char shadow_mask_bits;
unsigned char silhouette_group;
size_t index;
} LineartEdgeChainItem;
@@ -204,6 +268,11 @@ enum eLineArtTileRecursiveLimit {
#define LRT_TILE_SPLITTING_TRIANGLE_LIMIT 100
#define LRT_TILE_EDGE_COUNT_INITIAL 32
enum eLineartShadowCameraType {
LRT_SHADOW_CAMERA_DIRECTIONAL = 1,
LRT_SHADOW_CAMERA_POINT = 2,
};
typedef struct LineartPendingEdges {
LineartEdge **array;
int max;
@@ -222,10 +291,12 @@ typedef struct LineartRenderBuffer {
double view_projection[4][4];
double view[4][4];
bool do_shadow_cast;
float overscan;
struct LineartBoundingArea *initial_bounding_areas;
unsigned int bounding_area_count;
unsigned int bounding_area_initial_count;
/* When splitting bounding areas, if there's an ortho camera placed at a straight angle, there
* will be a lot of triangles aligned in line which can not be separated by continue subdividing
@@ -246,14 +317,25 @@ typedef struct LineartRenderBuffer {
/** Use the one comes with Line Art. */
LineartStaticMemPool render_data_pool;
ListBase wasted_cuts;
ListBase wasted_shadow_cuts;
SpinLock lock_cuts;
/* This is just a pointer to LineartCache::chain_data_pool, which acts as a cache for line
* chains. */
/* This is just a reference to LineartCache::chain_data_pool, which is not cleared after line art
* completes which serves as a cache. */
LineartStaticMemPool *chain_data_pool;
/* Reference to LineartCache::shadow_data_pool, stay available until the final round of line art
* calculation is finished. */
LineartStaticMemPool *shadow_data_pool;
/* Storing shadow edge eln, array, and cuts for shadow information, so it's avaliable when line
* art runs the second time for occlusion. Either a reference to LineartCache::shadow_data_pool
* (shadow stage) or a reference to LineartRenderBuffer::render_data_pool (final stage). */
LineartStaticMemPool *edge_data_pool;
/* Render status */
double view_vector[3];
double view_vector_secondary[3]; /* For shadow. */
int triangle_size;
@@ -263,6 +345,10 @@ typedef struct LineartRenderBuffer {
ListBase chains;
/* Intermediate shadow results, list of LineartShadowSegmentContainer */
LineartShadowSegmentContainer *shadow_containers;
int shadow_containers_count;
/* For managing calculation tasks for multiple threads. */
SpinLock lock_task;
@@ -281,6 +367,14 @@ typedef struct LineartRenderBuffer {
bool use_edge_marks;
bool use_intersections;
bool use_loose;
bool use_light_contour;
bool use_shadow;
bool use_contour_secondary; /* From viewing camera, during shadow calculation. */
int shadow_selection; /* Needs to be numeric because it's not just on/off. */
bool shadow_enclose_shapes;
bool shadow_use_silhouette;
bool fuzzy_intersections;
bool fuzzy_everything;
bool allow_boundaries;
@@ -290,8 +384,8 @@ typedef struct LineartRenderBuffer {
bool use_loose_as_contour;
bool use_loose_edge_chain;
bool use_geometry_space_chain;
bool use_image_boundary_trimming;
bool use_back_face_culling;
bool use_image_boundary_trimming;
bool filter_face_mark;
bool filter_face_mark_invert;
@@ -305,17 +399,25 @@ typedef struct LineartRenderBuffer {
/* Keep an copy of these data so when line art is running it's self-contained. */
bool cam_is_persp;
bool cam_is_persp_secondary; /* "Secondary" ones are from viewing camera (as opposed to shadow
camera), during shadow calculation. */
float cam_obmat[4][4];
float cam_obmat_secondary[4][4];
double camera_pos[3];
double camera_pos_secondary[3];
double active_camera_pos[3]; /* Stroke offset calculation may use active or selected camera. */
double near_clip, far_clip;
float shift_x, shift_y;
float crease_threshold;
float chaining_image_threshold;
float angle_splitting_threshold;
float chain_smooth_tolerance;
/* Could be direction or position, depends on light_is_sun. */
double light_vector[3];
bool light_is_sun;
/* FIXME(Yiming): Temporary solution for speeding up calculation by not including lines that
* are not in the selected source. This will not be needed after we have a proper scene-wise
* cache running because multiple modifiers can then select results from that without further
@@ -327,19 +429,25 @@ typedef struct LineartRenderBuffer {
} LineartRenderBuffer;
typedef struct LineartCache {
/** Separate memory pool for chain data, this goes to the cache, so when we free the main pool,
* chains will still be available. */
/** Separate memory pool for chain data and shadow, this goes to the cache, so when we free the
* main pool, chains and shadows will still be available. */
LineartStaticMemPool chain_data_pool;
LineartStaticMemPool shadow_data_pool;
/** A copy of rb->chains so we have that data available after rb has been destroyed. */
/** A copy of rb->Chains after calculation is done, then we can destroy rb. */
ListBase chains;
/** Shadow-computed feature lines from original meshes to be matched with the second load of
* meshes thus providing lit/shade info in the second run of line art. */
ListBase shadow_elns;
/** Cache only contains edge types specified in this variable. */
char rb_edge_types;
uint16_t rb_edge_types;
} LineartCache;
#define DBL_TRIANGLE_LIM 1e-8
#define DBL_EDGE_LIM 1e-9
#define DBL_SHADOW_LIM 1e-6
#define LRT_MEMORY_POOL_1MB (1 << 20)
@@ -353,6 +461,13 @@ typedef enum eLineartTriangleFlags {
LRT_TRIANGLE_MAT_BACK_FACE_CULLING = (1 << 5),
} eLineartTriangleFlags;
#define LRT_SHADOW_MASK_UNDEFINED 0
#define LRT_SHADOW_MASK_LIT (1 << 0)
#define LRT_SHADOW_MASK_SHADED (1 << 1)
#define LRT_SHADOW_MASK_ENCLOSED_SHAPE (1 << 2)
#define LRT_SHADOW_MASK_INHIBITED (1 << 3)
#define LRT_SHADOW_SILHOUETTE_ERASED (1 << 4)
/**
* Controls how many edges a worker thread is processing at one request.
* There's no significant performance impact on choosing different values.
@@ -373,6 +488,13 @@ typedef struct LineartRenderTaskInfo {
} LineartRenderTaskInfo;
#define LRT_OBINDEX_SHIFT 20
#define LRT_OBINDEX_LOWER 0x0fffff /* Lower 20 bits. */
#define LRT_OBINDEX_HIGHER 0xFFF00000 /* Higher 12 bits. */
#define LRT_EDGE_IDENTIFIER(obi, e) \
(((uint64_t)((obi->obindex << 0) | (e->v1->index & LRT_OBINDEX_LOWER)) << 32) | \
((obi->obindex << 0) | (e->v2->index & LRT_OBINDEX_LOWER)))
typedef struct LineartObjectInfo {
struct LineartObjectInfo *next;
struct Object *original_ob;
@@ -380,11 +502,16 @@ typedef struct LineartObjectInfo {
double model_view_proj[4][4];
double model_view[4][4];
double normal[4][4];
LineartElementLinkNode *v_eln;
LineartElementLinkNode *eln;
int usage;
uint8_t override_intersection_mask;
uint8_t silhouette_group;
uint8_t intersection_priority;
int global_i_offset;
/* Shifted LRT_OBINDEX_SHIFT bits to be combined with object triangle index. */
int obindex;
bool free_use_mesh;
/* Note: Data inside #pending_edges are allocated with MEM_xxx call instead of in pool. */
@@ -398,7 +525,8 @@ typedef struct LineartObjectLoadTaskInfo {
/* LinkNode styled list */
LineartObjectInfo *pending;
/* Used to spread the load across several threads. This can not overflow. */
long unsigned int total_faces;
uint64_t total_faces;
ListBase *shadow_elns;
} LineartObjectLoadTaskInfo;
/**
@@ -471,6 +599,10 @@ typedef struct LineartBoundingArea {
#define DBL_LOOSER 1e-5
#define LRT_DOUBLE_CLOSE_LOOSER(a, b) (((a) + DBL_LOOSER) >= (b) && ((a)-DBL_LOOSER) <= (b))
#define LRT_DOUBLE_CLOSE_ENOUGH(a, b) (((a) + DBL_EDGE_LIM) >= (b) && ((a)-DBL_EDGE_LIM) <= (b))
#define LRT_SHADOW_CLOSE_ENOUGH(a, b) \
(((a) + DBL_SHADOW_LIM) >= (b) && ((a)-DBL_SHADOW_LIM) <= (b))
#define LRT_DOUBLE_CLOSE_ENOUGH_TRI(a, b) \
(((a) + DBL_TRIANGLE_LIM) >= (b) && ((a)-DBL_TRIANGLE_LIM) <= (b))
@@ -630,6 +762,90 @@ BLI_INLINE int lineart_intersect_seg_seg(const double *a1,
#endif
}
BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(
const double *a1, const double *a2, const double *b1, const double *b2, double *aRatio)
{
#define USE_VECTOR_LINE_INTERSECTION_IGN
#ifdef USE_VECTOR_LINE_INTERSECTION_IGN
/* from isect_line_line_v2_point() */
double s10[2], s32[2];
double div;
sub_v2_v2v2_db(s10, a2, a1);
sub_v2_v2v2_db(s32, b2, b1);
div = cross_v2v2_db(s10, s32);
if (div != 0.0f) {
const double u = cross_v2v2_db(a2, a1);
const double v = cross_v2v2_db(b2, b1);
const double rx = ((s32[0] * u) - (s10[0] * v)) / div;
const double ry = ((s32[1] * u) - (s10[1] * v)) / div;
if (fabs(a2[0] - a1[0]) > fabs(a2[1] - a1[1])) {
*aRatio = ratiod(a1[0], a2[0], rx);
if ((*aRatio) >= -DBL_EDGE_LIM && (*aRatio) <= 1 + DBL_EDGE_LIM) {
return 1;
}
return 0;
}
*aRatio = ratiod(a1[1], a2[1], ry);
if ((*aRatio) >= -DBL_EDGE_LIM && (*aRatio) <= 1 + DBL_EDGE_LIM) {
return 1;
}
return 0;
}
return 0;
#else
double k1, k2;
double x;
double y;
double ratio;
double x_diff = (a2[0] - a1[0]);
double x_diff2 = (b2[0] - b1[0]);
if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff, 0)) {
if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
*aRatio = 0;
return 0;
}
double r2 = ratiod(b1[0], b2[0], a1[0]);
x = interpd(b2[0], b1[0], r2);
y = interpd(b2[1], b1[1], r2);
*aRatio = ratio = ratiod(a1[1], a2[1], y);
}
else {
if (LRT_DOUBLE_CLOSE_ENOUGH(x_diff2, 0)) {
ratio = ratiod(a1[0], a2[0], b1[0]);
x = interpd(a2[0], a1[0], ratio);
*aRatio = ratio;
}
else {
k1 = (a2[1] - a1[1]) / x_diff;
k2 = (b2[1] - b1[1]) / x_diff2;
if ((k1 == k2))
return 0;
x = (a1[1] - b1[1] - k1 * a1[0] + k2 * b1[0]) / (k2 - k1);
ratio = (x - a1[0]) / x_diff;
*aRatio = ratio;
}
}
if (ratio <= 0 || ratio >= 1)
return 0;
return 1;
#endif
}
struct Depsgraph;
struct LineartGpencilModifierData;
struct LineartRenderBuffer;
@@ -706,6 +922,9 @@ void MOD_lineart_gpencil_generate(LineartCache *cache,
unsigned char intersection_mask,
short thickness,
float opacity,
unsigned char shadow_selection,
unsigned char silhouette_mode,
unsigned char silhouette_group,
const char *source_vgname,
const char *vgname,
int modifier_flags);

View File

@@ -17,13 +17,16 @@
#define LRT_OTHER_VERT(e, vt) ((vt) == (e)->v1 ? (e)->v2 : ((vt) == (e)->v2 ? (e)->v1 : NULL))
struct Object;
/* Get a connected line, only for lines who has the exact given vert, or (in the case of
* intersection lines) who has a vert that has the exact same position. */
static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
LineartVert *vt,
LineartVert **new_vt,
int match_flag,
unsigned char match_isec_mask)
unsigned char match_isec_mask,
struct Object *match_isec_object)
{
for (int i = 0; i < ba->line_count; i++) {
LineartEdge *n_e = ba->linked_lines[i];
@@ -46,6 +49,9 @@ static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
}
if (n_e->flags & LRT_EDGE_FLAG_INTERSECTION) {
if (n_e->object_ref != match_isec_object) {
continue;
}
if (vt->fbcoord[0] == n_e->v1->fbcoord[0] && vt->fbcoord[1] == n_e->v1->fbcoord[1]) {
*new_vt = LRT_OTHER_VERT(n_e, n_e->v1);
return n_e;
@@ -93,6 +99,8 @@ static LineartEdgeChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
char type,
int level,
unsigned char material_mask_bits,
unsigned char shadow_mask_bits,
unsigned char silhouette_group,
size_t index)
{
LineartEdgeChainItem *eci;
@@ -105,6 +113,8 @@ static LineartEdgeChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
old_eci->line_type = type;
old_eci->occlusion = level;
old_eci->material_mask_bits = material_mask_bits;
old_eci->shadow_mask_bits = shadow_mask_bits;
old_eci->silhouette_group = silhouette_group;
return old_eci;
}
@@ -117,6 +127,8 @@ static LineartEdgeChainItem *lineart_chain_append_point(LineartRenderBuffer *rb,
eci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
eci->occlusion = level;
eci->material_mask_bits = material_mask_bits;
eci->shadow_mask_bits = shadow_mask_bits;
eci->silhouette_group = silhouette_group;
BLI_addtail(&ec->chain, eci);
return eci;
@@ -130,6 +142,8 @@ static LineartEdgeChainItem *lineart_chain_prepend_point(LineartRenderBuffer *rb
char type,
int level,
unsigned char material_mask_bits,
unsigned char shadow_mask_bits,
unsigned char silhouette_group,
size_t index)
{
LineartEdgeChainItem *eci;
@@ -147,6 +161,8 @@ static LineartEdgeChainItem *lineart_chain_prepend_point(LineartRenderBuffer *rb
eci->line_type = type & LRT_EDGE_FLAG_ALL_TYPE;
eci->occlusion = level;
eci->material_mask_bits = material_mask_bits;
eci->shadow_mask_bits = shadow_mask_bits;
eci->silhouette_group = silhouette_group;
BLI_addhead(&ec->chain, eci);
return eci;
@@ -160,6 +176,8 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
LineartEdgeSegment *es;
int last_occlusion;
unsigned char last_transparency;
unsigned char last_shadow;
unsigned char last_silhouette;
/* Used when converting from double. */
float use_fbcoord[4];
float use_gpos[3];
@@ -219,9 +237,11 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
e->flags,
es->occlusion,
es->material_mask_bits,
es->shadow_mask_bits,
es->silhouette_group,
e->v1->index);
while (ba && (new_e = lineart_line_get_connected(
ba, new_vt, &new_vt, e->flags, e->intersection_mask))) {
ba, new_vt, &new_vt, e->flags, ec->intersection_mask, ec->object_ref))) {
new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
if (new_e->t1 || new_e->t2) {
@@ -256,15 +276,21 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
es->occlusion,
es->material_mask_bits,
es->shadow_mask_bits,
es->silhouette_group,
new_e->v1->index);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
}
}
else if (new_vt == new_e->v2) {
es = new_e->segments.first;
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
es = es->next;
for (; es; es = es->next) {
double gpos[3], lpos[3];
@@ -282,9 +308,13 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
last_occlusion,
last_transparency,
last_shadow,
last_silhouette,
new_e->v2->index);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
}
VERT_COORD_TO_FLOAT(new_e->v2);
lineart_chain_prepend_point(rb,
@@ -295,6 +325,8 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
last_occlusion,
last_transparency,
last_shadow,
last_silhouette,
new_e->v2->index);
}
ba = MOD_lineart_get_bounding_area(rb, new_vt->fbcoord[0], new_vt->fbcoord[1]);
@@ -318,8 +350,10 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
/* Step 2: Adding all cuts from the given line, so we can continue connecting the right side
* of the line. */
es = e->segments.first;
last_occlusion = ((LineartEdgeSegment *)es)->occlusion;
last_transparency = ((LineartEdgeSegment *)es)->material_mask_bits;
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
for (es = es->next; es; es = es->next) {
double gpos[3], lpos[3];
double *lfb = e->v1->fbcoord, *rfb = e->v2->fbcoord;
@@ -336,9 +370,13 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
e->flags,
es->occlusion,
es->material_mask_bits,
es->shadow_mask_bits,
es->silhouette_group,
e->v1->index);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
}
VERT_COORD_TO_FLOAT(e->v2)
lineart_chain_append_point(rb,
@@ -349,13 +387,15 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
e->flags,
last_occlusion,
last_transparency,
last_shadow,
last_silhouette,
e->v2->index);
/* Step 3: grow right. */
ba = MOD_lineart_get_bounding_area(rb, e->v2->fbcoord[0], e->v2->fbcoord[1]);
new_vt = e->v2;
while (ba && (new_e = lineart_line_get_connected(
ba, new_vt, &new_vt, e->flags, e->intersection_mask))) {
ba, new_vt, &new_vt, e->flags, ec->intersection_mask, ec->object_ref))) {
new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
if (new_e->t1 || new_e->t2) {
@@ -381,9 +421,13 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
es = new_e->segments.last;
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
/* Fix leading vertex occlusion. */
eci->occlusion = last_occlusion;
eci->material_mask_bits = last_transparency;
eci->shadow_mask_bits = last_shadow;
eci->silhouette_group = last_silhouette;
for (es = new_e->segments.last; es; es = es->prev) {
double gpos[3], lpos[3];
double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
@@ -393,6 +437,8 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
use_fbcoord[3] = interpf(new_e->v2->fbcoord[3], new_e->v1->fbcoord[3], global_at);
last_occlusion = es->prev ? es->prev->occlusion : last_occlusion;
last_transparency = es->prev ? es->prev->material_mask_bits : last_transparency;
last_shadow = es->prev ? es->prev->shadow_mask_bits : last_shadow;
last_silhouette = es->prev ? es->prev->silhouette_group : last_silhouette;
POS_TO_FLOAT(lpos, gpos)
lineart_chain_append_point(rb,
ec,
@@ -402,6 +448,8 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
last_occlusion,
last_transparency,
last_shadow,
last_silhouette,
new_e->v1->index);
}
}
@@ -409,8 +457,12 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
es = new_e->segments.first;
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
eci->occlusion = last_occlusion;
eci->material_mask_bits = last_transparency;
eci->shadow_mask_bits = last_shadow;
eci->silhouette_group = last_silhouette;
es = es->next;
for (; es; es = es->next) {
double gpos[3], lpos[3];
@@ -428,9 +480,13 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
es->occlusion,
es->material_mask_bits,
es->shadow_mask_bits,
es->silhouette_group,
new_e->v2->index);
last_occlusion = es->occlusion;
last_transparency = es->material_mask_bits;
last_shadow = es->shadow_mask_bits;
last_silhouette = es->silhouette_group;
}
VERT_COORD_TO_FLOAT(new_e->v2)
lineart_chain_append_point(rb,
@@ -441,6 +497,8 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
new_e->flags,
last_occlusion,
last_transparency,
last_shadow,
last_silhouette,
new_e->v2->index);
}
ba = MOD_lineart_get_bounding_area(rb, new_vt->fbcoord[0], new_vt->fbcoord[1]);
@@ -509,7 +567,7 @@ static void lineart_bounding_area_link_point_recursive(LineartRenderBuffer *rb,
{
if (root->child == NULL) {
LineartChainRegisterEntry *cre = lineart_list_append_pointer_pool_sized(
&root->linked_chains, &rb->render_data_pool, ec, sizeof(LineartChainRegisterEntry));
&root->linked_chains, rb->chain_data_pool, ec, sizeof(LineartChainRegisterEntry));
cre->eci = eci;
@@ -565,6 +623,8 @@ static bool lineart_chain_fix_ambiguous_segments(LineartEdgeChain *ec,
int fixed_occ = last_matching_eci->occlusion;
unsigned char fixed_mask = last_matching_eci->material_mask_bits;
unsigned char fixed_shadow = last_matching_eci->shadow_mask_bits;
unsigned char fixed_silhouette = last_matching_eci->silhouette_group;
LineartEdgeChainItem *can_skip_to = NULL;
LineartEdgeChainItem *last_eci = last_matching_eci;
@@ -579,7 +639,8 @@ static bool lineart_chain_fix_ambiguous_segments(LineartEdgeChain *ec,
if (eci->occlusion < fixed_occ) {
break;
}
if (eci->material_mask_bits == fixed_mask && eci->occlusion == fixed_occ) {
if (eci->material_mask_bits == fixed_mask && eci->occlusion == fixed_occ &&
eci->shadow_mask_bits == fixed_shadow && eci->silhouette_group == fixed_silhouette) {
can_skip_to = eci;
}
}
@@ -589,12 +650,15 @@ static bool lineart_chain_fix_ambiguous_segments(LineartEdgeChain *ec,
LineartEdgeChainItem *next_eci;
for (LineartEdgeChainItem *eci = last_matching_eci->next; eci != can_skip_to; eci = next_eci) {
next_eci = eci->next;
if (eci->material_mask_bits == fixed_mask && eci->occlusion == fixed_occ) {
if (eci->material_mask_bits == fixed_mask && eci->occlusion == fixed_occ &&
eci->shadow_mask_bits == fixed_shadow && eci->silhouette_group == fixed_silhouette) {
continue;
}
if (preserve_details) {
eci->material_mask_bits = fixed_mask;
eci->occlusion = fixed_occ;
eci->shadow_mask_bits = fixed_shadow;
eci->silhouette_group = fixed_silhouette;
}
else {
BLI_remlink(&ec->chain, eci);
@@ -628,11 +692,16 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
LineartEdgeChainItem *first_eci = (LineartEdgeChainItem *)ec->chain.first;
int fixed_occ = first_eci->occlusion;
unsigned char fixed_mask = first_eci->material_mask_bits;
unsigned char fixed_shadow = first_eci->shadow_mask_bits;
unsigned char fixed_silhouette = first_eci->silhouette_group;
ec->level = fixed_occ;
ec->material_mask_bits = fixed_mask;
ec->shadow_mask_bits = fixed_shadow;
ec->silhouette_group = fixed_silhouette;
for (eci = first_eci->next; eci; eci = next_eci) {
next_eci = eci->next;
if (eci->occlusion != fixed_occ || eci->material_mask_bits != fixed_mask) {
if (eci->occlusion != fixed_occ || eci->material_mask_bits != fixed_mask ||
eci->shadow_mask_bits != fixed_shadow || eci->silhouette_group != fixed_silhouette) {
if (next_eci) {
if (lineart_point_overlapping(next_eci, eci->pos[0], eci->pos[1], 1e-5)) {
continue;
@@ -649,7 +718,9 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
/* Set the same occlusion level for the end vertex, so when further connection is needed
* the backwards occlusion info is also correct. */
eci->occlusion = fixed_occ;
eci->shadow_mask_bits = fixed_shadow;
eci->material_mask_bits = fixed_mask;
eci->silhouette_group = fixed_silhouette;
/* No need to split at the last point anyway. */
break;
}
@@ -670,6 +741,8 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
eci->line_type,
fixed_occ,
fixed_mask,
fixed_shadow,
fixed_silhouette,
eci->index);
new_ec->object_ref = ec->object_ref;
new_ec->type = ec->type;
@@ -677,8 +750,12 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
ec = new_ec;
fixed_occ = eci->occlusion;
fixed_mask = eci->material_mask_bits;
fixed_shadow = eci->shadow_mask_bits;
fixed_silhouette = eci->silhouette_group;
ec->level = fixed_occ;
ec->material_mask_bits = fixed_mask;
ec->shadow_mask_bits = fixed_shadow;
ec->silhouette_group = fixed_silhouette;
}
}
}
@@ -749,6 +826,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
int occlusion,
unsigned char material_mask_bits,
unsigned char isec_mask,
unsigned char shadow_mask,
unsigned char silhouette_group,
int loop_id,
float dist,
float *result_new_len,
@@ -779,7 +858,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
}
if (cre->ec == ec || (!cre->ec->chain.first) || (cre->ec->level != occlusion) ||
(cre->ec->material_mask_bits != material_mask_bits) ||
(cre->ec->intersection_mask != isec_mask)) {
(cre->ec->intersection_mask != isec_mask) || (cre->ec->shadow_mask_bits != shadow_mask) ||
(cre->ec->silhouette_group != silhouette_group)) {
continue;
}
if (!rb->fuzzy_everything) {
@@ -826,6 +906,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
occlusion, \
material_mask_bits, \
isec_mask, \
shadow_mask, \
silhouette_group, \
loop_id, \
dist, \
&adjacent_new_len, \
@@ -857,7 +939,7 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
float dist = rb->chaining_image_threshold;
float dist_l, dist_r;
int occlusion, reverse_main, loop_id;
unsigned char material_mask_bits, isec_mask;
unsigned char material_mask_bits, isec_mask, shadow_mask, silhouette_group;
ListBase swap = {0};
if (rb->chaining_image_threshold < 0.0001) {
@@ -871,7 +953,7 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
while ((ec = BLI_pophead(&swap)) != NULL) {
ec->next = ec->prev = NULL;
if (ec->picked) {
if (ec->picked || ec->chain.first == ec->chain.last) {
continue;
}
BLI_addtail(&rb->chains, ec);
@@ -884,6 +966,8 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
occlusion = ec->level;
material_mask_bits = ec->material_mask_bits;
isec_mask = ec->intersection_mask;
shadow_mask = ec->shadow_mask_bits;
silhouette_group = ec->shadow_mask_bits;
eci_l = ec->chain.first;
eci_r = ec->chain.last;
@@ -896,6 +980,8 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
occlusion,
material_mask_bits,
isec_mask,
shadow_mask,
silhouette_group,
loop_id,
dist,
&dist_l,
@@ -907,6 +993,8 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
occlusion,
material_mask_bits,
isec_mask,
shadow_mask,
silhouette_group,
loop_id,
dist,
&dist_r,
@@ -1072,20 +1160,21 @@ static LineartEdgeChainItem *lineart_chain_create_crossing_point(LineartRenderBu
LineartEdgeChainItem *eci_outside)
{
float isec[2];
float LU[2] = {-1.0f, 1.0f}, LB[2] = {-1.0f, -1.0f}, RU[2] = {1.0f, 1.0f}, RB[2] = {1.0f, -1.0f};
float ref_lu[2] = {-1.0f, 1.0f}, ref_lb[2] = {-1.0f, -1.0f}, ref_ru[2] = {1.0f, 1.0f},
ref_rb[2] = {1.0f, -1.0f};
bool found = false;
LineartEdgeChainItem *eci2 = eci_outside, *eci1 = eci_inside;
if (eci2->pos[0] < -1.0f) {
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, LU, LB, isec) > 0);
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, ref_lu, ref_lb, isec) > 0);
}
if (!found && eci2->pos[0] > 1.0f) {
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, RU, RB, isec) > 0);
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, ref_ru, ref_rb, isec) > 0);
}
if (!found && eci2->pos[1] < -1.0f) {
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, LB, RB, isec) > 0);
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, ref_lb, ref_rb, isec) > 0);
}
if (!found && eci2->pos[1] > 1.0f) {
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, LU, RU, isec) > 0);
found = (isect_seg_seg_v2_point(eci1->pos, eci2->pos, ref_lu, ref_ru, isec) > 0);
}
if (UNLIKELY(!found)) {
@@ -1155,19 +1244,21 @@ void MOD_lineart_chain_clip_at_border(LineartRenderBuffer *rb)
is_inside = new_inside;
continue;
}
/* Stroke comes in. */
new_eci = lineart_chain_create_crossing_point(rb, eci, prev_eci);
else {
/* Stroke comes in. */
new_eci = lineart_chain_create_crossing_point(rb, eci, prev_eci);
ec->chain.first = eci;
eci->prev = NULL;
ec->chain.first = eci;
eci->prev = NULL;
BLI_addhead(&ec->chain, new_eci);
BLI_addhead(&ec->chain, new_eci);
ec_added = false;
ec_added = false;
next_eci = eci->next;
is_inside = new_inside;
continue;
next_eci = eci->next;
is_inside = new_inside;
continue;
}
}
}
@@ -1219,6 +1310,8 @@ void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshol
eci->line_type,
ec->level,
eci->material_mask_bits,
eci->shadow_mask_bits,
eci->silhouette_group,
eci->index);
new_ec->object_ref = ec->object_ref;
new_ec->type = ec->type;
@@ -1226,6 +1319,8 @@ void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshol
new_ec->loop_id = ec->loop_id;
new_ec->intersection_mask = ec->intersection_mask;
new_ec->material_mask_bits = ec->material_mask_bits;
new_ec->shadow_mask_bits = ec->shadow_mask_bits;
new_ec->silhouette_group = ec->silhouette_group;
ec = new_ec;
}
}
@@ -1240,8 +1335,6 @@ void MOD_lineart_chain_offset_towards_camera(LineartRenderBuffer *rb,
float cam[3];
float view[3];
float view_clamp[3];
copy_v3fl_v3db(cam, rb->camera_pos);
copy_v3fl_v3db(view, rb->view_vector);
if (use_custom_camera) {
copy_v3fl_v3db(cam, rb->camera_pos);
@@ -1262,6 +1355,7 @@ void MOD_lineart_chain_offset_towards_camera(LineartRenderBuffer *rb,
}
}
else {
copy_v3fl_v3db(view, rb->view_vector);
LISTBASE_FOREACH (LineartEdgeChain *, ec, &rb->chains) {
LISTBASE_FOREACH (LineartEdgeChainItem *, eci, &ec->chain) {
sub_v3_v3v3(dir, cam, eci->gpos);

File diff suppressed because it is too large Load Diff

View File

@@ -22,26 +22,28 @@ struct LineartRenderBuffer;
struct LineartStaticMemPool;
struct LineartStaticMemPoolNode;
void *lineart_list_append_pointer_pool(ListBase *h, struct LineartStaticMemPool *smp, void *data);
void *lineart_list_append_pointer_pool_sized(ListBase *h,
void *lineart_list_append_pointer_pool(ListBase *list,
struct LineartStaticMemPool *smp,
void *data);
void *lineart_list_append_pointer_pool_sized(ListBase *list,
struct LineartStaticMemPool *smp,
void *data,
int size);
void *lineart_list_append_pointer_pool_thread(ListBase *h,
void *lineart_list_append_pointer_pool_thread(ListBase *list,
struct LineartStaticMemPool *smp,
void *data);
void *lineart_list_append_pointer_pool_sized_thread(ListBase *h,
void *lineart_list_append_pointer_pool_sized_thread(ListBase *list,
LineartStaticMemPool *smp,
void *data,
int size);
void *list_push_pointer_static(ListBase *h, struct LineartStaticMemPool *smp, void *p);
void *list_push_pointer_static_sized(ListBase *h,
void *list_push_pointer_static(ListBase *list, struct LineartStaticMemPool *smp, void *p);
void *list_push_pointer_static_sized(ListBase *list,
struct LineartStaticMemPool *smp,
void *p,
int size);
void *lineart_list_pop_pointer_no_free(ListBase *h);
void lineart_list_remove_pointer_item_no_free(ListBase *h, LinkData *lip);
void *lineart_list_pop_pointer_no_free(ListBase *list);
void lineart_list_remove_pointer_item_no_free(ListBase *list, LinkData *lip);
struct LineartStaticMemPoolNode *lineart_mem_new_static_pool(struct LineartStaticMemPool *smp,
size_t size);
@@ -49,7 +51,6 @@ void *lineart_mem_acquire(struct LineartStaticMemPool *smp, size_t size);
void *lineart_mem_acquire_thread(struct LineartStaticMemPool *smp, size_t size);
void lineart_mem_destroy(struct LineartStaticMemPool *smp);
void lineart_prepend_edge_direct(void **list_head, void *node);
void lineart_prepend_pool(LinkNode **first, struct LineartStaticMemPool *smp, void *link);
void lineart_matrix_ortho_44d(double (*mProjection)[4],
@@ -67,14 +68,16 @@ int lineart_count_intersection_segment_count(struct LineartRenderBuffer *rb);
void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb);
#define LRT_ITER_ALL_LINES_BEGIN \
LineartEdge *e; \
for (int i = 0; i < rb->pending_edges.next; i++) { \
e = rb->pending_edges.array[i];
{ \
LineartEdge *e; \
for (int __i = 0; __i < rb->pending_edges.next; __i++) { \
e = rb->pending_edges.array[__i];
#define LRT_ITER_ALL_LINES_NEXT ; /* Doesn't do anything now with new array setup. */
#define LRT_ITER_ALL_LINES_END \
LRT_ITER_ALL_LINES_NEXT \
} \
}
#define LRT_BOUND_AREA_CROSSES(b1, b2) \
@@ -84,12 +87,125 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb
* performance under current algorithm. */
#define LRT_BA_ROWS 10
#define LRT_EDGE_BA_MARCHING_BEGIN(fb1, fb2) \
double x = fb1[0], y = fb1[1]; \
LineartBoundingArea *ba = lineart_edge_first_bounding_area(rb, fb1, fb2); \
LineartBoundingArea *nba = ba; \
double k = (fb2[1] - fb1[1]) / (fb2[0] - fb1[0] + 1e-30); \
int positive_x = (fb2[0] - fb1[0]) > 0 ? 1 : (fb2[0] == fb1[0] ? 0 : -1); \
int positive_y = (fb2[1] - fb1[1]) > 0 ? 1 : (fb2[1] == fb1[1] ? 0 : -1); \
while (nba)
#define LRT_EDGE_BA_MARCHING_NEXT(fb1, fb2) \
/* Marching along `e->v1` to `e->v2`, searching each possible bounding areas it may touch. */ \
nba = lineart_bounding_area_next(nba, fb1, fb2, x, y, k, positive_x, positive_y, &x, &y);
#define LRT_EDGE_BA_MARCHING_END
void lineart_main_occlusion_begin(struct LineartRenderBuffer *rb);
void lineart_main_cull_triangles(struct LineartRenderBuffer *rb, bool clip_far);
void lineart_main_free_adjacent_data(struct LineartRenderBuffer *rb);
void lineart_main_perspective_division(struct LineartRenderBuffer *rb);
void lineart_main_discard_out_of_frame_edges(struct LineartRenderBuffer *rb);
void lineart_main_load_geometries(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *camera,
struct LineartRenderBuffer *rb,
bool allow_duplicates,
bool do_shadow_casting,
struct ListBase *shadow_elns);
void lineart_main_get_view_vector(struct LineartRenderBuffer *rb);
void lineart_main_bounding_area_make_initial(struct LineartRenderBuffer *rb);
void lineart_main_bounding_areas_connect_post(struct LineartRenderBuffer *rb);
void lineart_main_clear_linked_edges(struct LineartRenderBuffer *rb);
void lineart_main_link_lines(struct LineartRenderBuffer *rb);
void lineart_main_add_triangles(struct LineartRenderBuffer *rb);
bool lineart_main_try_generate_shadow(struct Depsgraph *depsgraph,
struct Scene *scene,
struct LineartRenderBuffer *original_rb,
struct LineartGpencilModifierData *lmd,
struct LineartStaticMemPool *shadow_data_pool,
struct LineartElementLinkNode **r_veln,
struct LineartElementLinkNode **r_eeln,
struct ListBase *r_calculated_edges_eln_list,
struct LineartRenderBuffer **r_shadow_rb_if_reproject);
void lineart_main_make_enclosed_shapes(struct LineartRenderBuffer *rb,
struct LineartRenderBuffer *shadow_rb);
void lineart_main_transform_and_add_shadow(struct LineartRenderBuffer *rb,
struct LineartElementLinkNode *veln,
struct LineartElementLinkNode *eeln);
LineartElementLinkNode *lineart_find_matching_eln(struct ListBase *shadow_elns, int obindex);
LineartEdge *lineart_find_matching_edge(struct LineartElementLinkNode *shadow_eln,
uint64_t edge_identifier);
void lineart_register_shadow_cuts(struct LineartRenderBuffer *rb,
struct LineartEdge *e,
struct LineartEdge *shadow_edge);
void lineart_register_intersection_shadow_cuts(struct LineartRenderBuffer *rb,
struct ListBase *shadow_elns);
bool lineart_edge_from_triangle(const struct LineartTriangle *tri,
const struct LineartEdge *e,
bool allow_overlapping_edges);
LineartBoundingArea *lineart_edge_first_bounding_area(struct LineartRenderBuffer *rb,
double *fbcoord1,
double *fbcoord2);
LineartBoundingArea *lineart_bounding_area_next(struct LineartBoundingArea *_this,
double *fbcoord1,
double *fbcoord2,
double x,
double y,
double k,
int positive_x,
int positive_y,
double *next_x,
double *next_y);
void lineart_edge_cut(struct LineartRenderBuffer *rb,
struct LineartEdge *e,
double start,
double end,
uchar material_mask_bits,
uchar mat_occlusion,
uchar shadow_bits);
void lineart_add_edge_to_array(struct LineartPendingEdges *pe, struct LineartEdge *e);
void lineart_finalize_object_edge_array_reserve(struct LineartPendingEdges *pe, int count);
void lineart_destroy_render_data_keep_init(struct LineartRenderBuffer *rb);
#ifdef __cplusplus
extern "C" {
#endif
void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length);
void lineart_sort_adjacent_items(struct LineartAdjacentEdge *ai, int length);
#ifdef __cplusplus
}
#endif
#ifndef __cplusplus /* Compatibility code for atomics, only for C. */
# if defined __has_include /* Try to use C11 atomics support. */
# if __has_include(<stdatomic.h>)
# include <stdatomic.h>
# define lineart_atomic_load(p) atomic_load((volatile size_t *)p)
# define lineart_atomic_store(p, d) atomic_store((volatile size_t *)p, (size_t)d)
# endif
# endif
# ifdef _MSC_VER /* Atomics walkaround for windows. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# define lineart_atomic_load(p) (MemoryBarrier(), *(p))
# define lineart_atomic_store(p, d) \
do { \
*(p) = (d); \
MemoryBarrier(); \
} while (0)
# endif
# if !defined lineart_atomic_load /* Fallback */
# include "atomic_ops.h"
# define lineart_atomic_load(p) atomic_add_and_fetch_z((size_t *)p, 0)
# define lineart_atomic_store(p, d) atomic_add_and_fetch_z((size_t *)p, (size_t)d)
# endif
#endif /* !__cplusplus */

View File

@@ -132,6 +132,9 @@ static bool bake_strokes(Object *ob,
lmd->intersection_mask,
lmd->thickness,
lmd->opacity,
lmd->shadow_selection,
lmd->silhouette_selection,
lmd->use_silhouette_group,
lmd->source_vertex_group,
lmd->vgname,
lmd->flags);
@@ -141,8 +144,8 @@ static bool bake_strokes(Object *ob,
if (!is_first) {
MOD_lineart_clear_cache(&local_lc);
}
/* Restore the original cache pointer so the modifiers below still have access to the
* "global" cache. */
/* Restore the original cache pointer so the modifiers below still have access to the "global"
* cache. */
lmd->cache = gpd->runtime.lineart_cache;
}

File diff suppressed because it is too large Load Diff

View File

@@ -21,71 +21,73 @@
/* Line art memory and list helper */
void *lineart_list_append_pointer_pool(ListBase *h, LineartStaticMemPool *smp, void *data)
void *lineart_list_append_pointer_pool(ListBase *list, LineartStaticMemPool *smp, void *data)
{
LinkData *lip;
if (h == NULL) {
if (list == NULL) {
return 0;
}
lip = lineart_mem_acquire(smp, sizeof(LinkData));
lip->data = data;
BLI_addtail(h, lip);
BLI_addtail(list, lip);
return lip;
}
void *lineart_list_append_pointer_pool_sized(ListBase *h,
void *lineart_list_append_pointer_pool_sized(ListBase *list,
LineartStaticMemPool *smp,
void *data,
int size)
{
LinkData *lip;
if (h == NULL) {
if (list == NULL) {
return 0;
}
lip = lineart_mem_acquire(smp, size);
lip->data = data;
BLI_addtail(h, lip);
BLI_addtail(list, lip);
return lip;
}
void *lineart_list_append_pointer_pool_thread(ListBase *h, LineartStaticMemPool *smp, void *data)
void *lineart_list_append_pointer_pool_thread(ListBase *list,
LineartStaticMemPool *smp,
void *data)
{
LinkData *lip;
if (h == NULL) {
if (list == NULL) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, sizeof(LinkData));
lip->data = data;
BLI_addtail(h, lip);
BLI_addtail(list, lip);
return lip;
}
void *lineart_list_append_pointer_pool_sized_thread(ListBase *h,
void *lineart_list_append_pointer_pool_sized_thread(ListBase *list,
LineartStaticMemPool *smp,
void *data,
int size)
{
LinkData *lip;
if (h == NULL) {
if (list == NULL) {
return 0;
}
lip = lineart_mem_acquire_thread(smp, size);
lip->data = data;
BLI_addtail(h, lip);
BLI_addtail(list, lip);
return lip;
}
void *lineart_list_pop_pointer_no_free(ListBase *h)
void *lineart_list_pop_pointer_no_free(ListBase *list)
{
LinkData *lip;
void *rev = 0;
if (h == NULL) {
if (list == NULL) {
return 0;
}
lip = BLI_pophead(h);
lip = BLI_pophead(list);
rev = lip ? lip->data : 0;
return rev;
}
void lineart_list_remove_pointer_item_no_free(ListBase *h, LinkData *lip)
void lineart_list_remove_pointer_item_no_free(ListBase *list, LinkData *lip)
{
BLI_remlink(h, (void *)lip);
BLI_remlink(list, (void *)lip);
}
LineartStaticMemPoolNode *lineart_mem_new_static_pool(LineartStaticMemPool *smp, size_t size)
@@ -144,13 +146,6 @@ void lineart_mem_destroy(LineartStaticMemPool *smp)
}
}
void lineart_prepend_edge_direct(void **list_head, void *node)
{
LineartEdge *e_n = (LineartEdge *)node;
e_n->next = (*list_head);
(*list_head) = e_n;
}
void lineart_prepend_pool(LinkNode **first, LineartStaticMemPool *smp, void *link)
{
LinkNode *ln = lineart_mem_acquire_thread(smp, sizeof(LinkNode));

View File

@@ -316,7 +316,7 @@ class FormatHandler : NonCopyable, NonMovable {
* `eFileType::MTL`.
*/
template<typename FileTypeTraits<filetype>::SyntaxType key, typename... T>
constexpr void write(T &&...args)
constexpr void write(T &&... args)
{
/* Get format syntax, number of arguments expected and whether types of given arguments are
* valid.
@@ -340,7 +340,7 @@ class FormatHandler : NonCopyable, NonMovable {
}
}
template<typename... T> void write_impl(const char *fmt, T &&...args)
template<typename... T> void write_impl(const char *fmt, T &&... args)
{
/* Format into a local buffer. */
fmt::memory_buffer buf;

View File

@@ -40,6 +40,8 @@ enum eCollectionLineArt_Usage {
enum eCollectionLineArt_Flags {
COLLECTION_LRT_USE_INTERSECTION_MASK = (1 << 0),
COLLECTION_LRT_USE_SILHOUETTE_GROUP = (1 << 1),
COLLECTION_LRT_USE_INTERSECTION_PRIORITY = (1 << 2),
};
typedef struct Collection {
@@ -62,7 +64,9 @@ typedef struct Collection {
short lineart_usage; /* eCollectionLineArt_Usage */
unsigned char lineart_flags; /* eCollectionLineArt_Flags */
unsigned char lineart_intersection_mask;
char _pad[6];
unsigned char lineart_silhouette_group;
unsigned char lineart_intersection_priority;
char _pad[4];
int16_t color_tag;

View File

@@ -296,7 +296,7 @@
#define _DNA_DEFAULT_LineartGpencilModifierData \
{ \
.edge_types = LRT_EDGE_FLAG_ALL_TYPE, \
.edge_types = LRT_EDGE_FLAG_INIT_TYPE, \
.thickness = 25, \
.opacity = 1.0f, \
.flags = LRT_GPENCIL_MATCH_OUTPUT_VGROUP, \
@@ -306,7 +306,12 @@
/* Do not split by default, this is for better chaining quality. */ \
.angle_splitting_threshold = 0.0f, \
.chaining_image_threshold = 0.001f, \
.chain_smooth_tolerance = 0.2f,\
.stroke_depth_offset = 0.05,\
.chain_smooth_tolerance = 0.0f,\
.overscan = 0.1f,\
.shadow_camera_near = 0.1f, \
.shadow_camera_far = 200.0f, \
.shadow_camera_size = 200.0f, \
.stroke_depth_offset = 0.05,\
}

View File

@@ -998,6 +998,18 @@ typedef enum eLineartGpencilModifierSource {
LRT_SOURCE_SCENE = 2,
} eLineartGpencilModifierSource;
typedef enum eLineartGpencilModifierShadowFilter {
LRT_SHADOW_FILTER_NONE = 0,
LRT_SHADOW_FILTER_LIT = 1,
LRT_SHADOW_FILTER_SHADED = 2,
} eLineartGpencilModifierShadowFilter;
typedef enum eLineartGpencilModifierSilhouetteFilter {
LRT_SILHOUETTE_FILTER_NONE = 0,
LRT_SILHOUETTE_FILTER_SILHOUETTE = 1,
LRT_SILHOUETTE_FILTER_ANTI_SILHOUETTE = 2,
} eLineartGpencilModifierSilhouetteFilter;
/* This enum is for modifier internal state only. */
typedef enum eLineArtGPencilModifierFlags {
/* These two moved to #eLineartMainFlags to keep consistent with flag variable purpose. */
@@ -1014,7 +1026,8 @@ typedef enum eLineartGpencilMaskSwitches {
LRT_GPENCIL_MATERIAL_MASK_ENABLE = (1 << 0),
/** When set, material mask bit comparisons are done with bit wise "AND" instead of "OR". */
LRT_GPENCIL_MATERIAL_MASK_MATCH = (1 << 1),
LRT_GPENCIL_INTERSECTION_MATCH = (1 << 2),
LRT_GPENCIL_INTERSECTION_FILTER = (1 << 2),
LRT_GPENCIL_INTERSECTION_MATCH = (1 << 3),
} eLineartGpencilMaskSwitches;
struct LineartCache;
@@ -1024,8 +1037,7 @@ struct LineartCache;
typedef struct LineartGpencilModifierData {
GpencilModifierData modifier;
/** Line type enable flags, bits in #eLineartEdgeFlag. */
short edge_types;
uint16_t edge_types; /* line type enable flags, bits in eLineartEdgeFlag */
/** Object or Collection, from #eLineartGpencilModifierSource. */
char source_type;
@@ -1035,6 +1047,7 @@ typedef struct LineartGpencilModifierData {
short level_end;
struct Object *source_camera;
struct Object *light_contour_object;
struct Object *source_object;
struct Collection *source_collection;
@@ -1049,14 +1062,19 @@ typedef struct LineartGpencilModifierData {
char source_vertex_group[64];
char vgname[64];
/**
* Camera focal length is divided by `1 + overscan`, before calculation, which give a wider FOV,
* this doesn't change coordinates range internally (-1, 1), but makes the calculated frame
/* Camera focal length is divided by (1 + overscan), before caluclation, which give a wider FOV,
* this doesn't change coordinates range internally (-1, 1), but makes the caluclated frame
* bigger than actual output. This is for the easier shifting calculation. A value of 0.5 means
* the "internal" focal length become 2/3 of the actual camera.
*/
* the "internal" focal length become 2/3 of the actual camera. */
float overscan;
/* Values for point light and directional (sun) light. */
/* For point light, fov always gonna be 120 deg horizontal, with 3 "cameras" covering 360 deg. */
float shadow_camera_fov;
float shadow_camera_size;
float shadow_camera_near;
float shadow_camera_far;
float opacity;
short thickness;
@@ -1064,7 +1082,9 @@ typedef struct LineartGpencilModifierData {
unsigned char material_mask_bits;
unsigned char intersection_mask;
char _pad[3];
unsigned char shadow_selection;
unsigned char silhouette_selection;
unsigned char use_silhouette_group;
/** `0..1` range for cosine angle */
float crease_threshold;
@@ -1078,7 +1098,7 @@ typedef struct LineartGpencilModifierData {
/* CPU mode */
float chaining_image_threshold;
/* Ported from SceneLineArt flags. */
/* eLineartMainFlags, for one time calculation. */
int calculation_flags;
/* #eLineArtGPencilModifierFlags, modifier internal state. */
@@ -1095,6 +1115,10 @@ typedef struct LineartGpencilModifierData {
char level_start_override;
char level_end_override;
short edge_types_override;
char shadow_selection_override;
char shadow_use_silhouette_override;
char _pad2[6];
struct LineartCache *cache;
/* Keep a pointer to the render buffer so we can call destroy from ModifierData. */

View File

@@ -31,13 +31,16 @@ typedef enum eLineartMainFlags {
LRT_CHAIN_LOOSE_EDGES = (1 << 12),
LRT_CHAIN_GEOMETRY_SPACE = (1 << 13),
LRT_ALLOW_OVERLAP_EDGE_TYPES = (1 << 14),
LRT_USE_CREASE_ON_SMOOTH_SURFACES = (1 << 15),
LRT_USE_CREASE_ON_SHARP_EDGES = (1 << 16),
LRT_USE_CUSTOM_CAMERA = (1 << 17),
LRT_USE_CUSTOM_CAMERA = (1 << 15),
LRT_USE_CREASE_ON_SMOOTH_SURFACES = (1 << 16),
LRT_USE_CREASE_ON_SHARP_EDGES = (1 << 17),
LRT_FILTER_FACE_MARK_KEEP_CONTOUR = (1 << 18),
LRT_USE_BACK_FACE_CULLING = (1 << 19),
LRT_USE_IMAGE_BOUNDARY_TRIMMING = (1 << 20),
LRT_USE_ORTHO_TOLERANCE = (1 << 21),
LRT_CHAIN_PRESERVE_DETAILS = (1 << 22),
LRT_SHADOW_ENCLOSED_SHAPES = (1 << 23),
LRT_SHADOW_USE_SILHOUETTE = (1 << 24),
} eLineartMainFlags;
typedef enum eLineartEdgeFlag {
@@ -47,12 +50,20 @@ typedef enum eLineartEdgeFlag {
LRT_EDGE_FLAG_MATERIAL = (1 << 3),
LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
LRT_EDGE_FLAG_LOOSE = (1 << 5),
LRT_EDGE_FLAG_LIGHT_CONTOUR = (1 << 6),
/* LRT_EDGE_FLAG_FOR_FUTURE = (1 << 7), */
/* Limited to 8 bits for edge type flag, don't add anymore because `BMEdge->head.eflag` only has
* 8 bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */
/* Limited to 8 bits for edge type flag, don't add anymore because BMEdge->head.eflag only has 8
bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */
/* Shaow edge type doesn't go into BMEdge->head.eflag so we can make it higher than 1<<7. */
LRT_EDGE_FLAG_PROJECTED_SHADOW = (1 << 8),
/* To determine an edge to be occluded from the front or back face it's lying on. */
LRT_EDGE_FLAG_SHADOW_FACING_LIGHT = (1 << 9),
/** Also used as discarded line mark. */
LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 8),
LRT_EDGE_FLAG_CLIPPED = (1 << 9),
LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 10),
LRT_EDGE_FLAG_CLIPPED = (1 << 11),
/** Used to specify contor from viewing camera when computing shadows. */
LRT_EDGE_FLAG_CONTOUR_SECONDARY = (1 << 12),
/** Limited to 16 bits for the entire thing. */
/** For object loading code to use only. */
@@ -61,4 +72,6 @@ typedef enum eLineartEdgeFlag {
LRT_EDGE_FLAG_NEXT_IS_DUPLICATION = (1 << 15),
} eLineartEdgeFlag;
#define LRT_EDGE_FLAG_ALL_TYPE 0x3f
#define LRT_EDGE_FLAG_ALL_TYPE 0x01ff
#define LRT_EDGE_FLAG_INIT_TYPE 0x37 /* Without material & light contour */
#define LRT_EDGE_FLAG_TYPE_MAX_BITS 7

View File

@@ -150,7 +150,10 @@ typedef struct MaterialLineArt {
/** Maximum 255 levels of equivalent occlusion. */
unsigned char mat_occlusion;
unsigned char _pad[2];
/** Maximum 255 groups of contour. */
unsigned char mat_silhouette_group;
unsigned char intersection_priority;
} MaterialLineArt;
typedef enum eMaterialLineArtFlags {
@@ -158,6 +161,8 @@ typedef enum eMaterialLineArtFlags {
/* Deprecated, kept for versioning code. */
LRT_MATERIAL_CUSTOM_OCCLUSION_EFFECTIVENESS = (1 << 1),
LRT_MATERIAL_CUSTOM_SILHOUETTE_GROUP = (1 << 2),
LRT_MATERIAL_CUSTOM_INTERSECTION_PRIORITY = (1 << 3),
} eMaterialLineArtFlags;
typedef struct Material {

View File

@@ -215,6 +215,11 @@ typedef struct ObjectLineArt {
/** if OBJECT_LRT_OWN_CREASE is set */
float crease_threshold;
unsigned char silhouette_group;
unsigned char intersection_priority;
char _pad[6];
} ObjectLineArt;
/**
@@ -231,6 +236,8 @@ enum eObjectLineArt_Usage {
enum eObjectLineArt_Flags {
OBJECT_LRT_OWN_CREASE = (1 << 0),
OBJECT_LRT_OWN_SILHOUETTE_GROUP = (1 << 1),
OBJECT_LRT_OWN_INTERSECTION_PRIORITY = (1 << 2),
};
typedef struct Object {

View File

@@ -549,6 +549,36 @@ void RNA_def_collections(BlenderRNA *brna)
prop, "Masks", "Intersection generated by this collection will have this mask value");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "lineart_silhouette_group", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(
prop,
"Silouette Group",
"Objects with the same silhouette group numbers will be drawn as a continuous shape");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "use_lineart_silhouette_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_default(prop, 0);
RNA_def_property_boolean_sdna(prop, NULL, "lineart_flags", COLLECTION_LRT_USE_SILHOUETTE_GROUP);
RNA_def_property_ui_text(
prop, "Use Silhouette Group", "Assign silhouette group value for this collection");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "lineart_intersection_priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(prop,
"Intersection Priority",
"The intersection line will be included into the object with the "
"higher intersection priority value");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "use_lineart_intersection_priority", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_default(prop, 0);
RNA_def_property_boolean_sdna(prop, NULL, "lineart_flags", COLLECTION_LRT_USE_SILHOUETTE_GROUP);
RNA_def_property_ui_text(
prop, "Use Intersection Priority", "Assign intersection priority value for this collection");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "color_tag");
RNA_def_property_enum_funcs(

View File

@@ -3196,6 +3196,20 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem modifier_lineart_shadow_region_filtering[] = {
{LRT_SHADOW_FILTER_NONE, "NONE", 0, "None", ""},
{LRT_SHADOW_FILTER_LIT, "LIT", 0, "Lit", ""},
{LRT_SHADOW_FILTER_SHADED, "SHADED", 0, "Shaded", ""},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem modifier_lineart_silhouette_filtering[] = {
{LRT_SILHOUETTE_FILTER_NONE, "NONE", 0, "Contour", ""},
{LRT_SILHOUETTE_FILTER_SILHOUETTE, "SILHOUETTE", 0, "Silhouette", ""},
{LRT_SILHOUETTE_FILTER_ANTI_SILHOUETTE, "ANTI_SILHOUETTE", 0, "Anti Silhouette", ""},
{0, NULL, 0, NULL, NULL},
};
srna = RNA_def_struct(brna, "LineartGpencilModifier", "GpencilModifier");
RNA_def_struct_ui_text(
srna, "Line Art Modifier", "Generate line art strokes from selected source");
@@ -3208,7 +3222,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_CUSTOM_CAMERA);
RNA_def_property_ui_text(
prop, "Use Custom Camera", "Use custom camera instead of the active camera");
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
prop = RNA_def_property(srna, "use_fuzzy_intersections", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_INTERSECTION_AS_CONTOUR);
@@ -3267,7 +3281,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "chain_smooth_tolerance");
RNA_def_property_ui_text(
prop, "Smooth Tolerance", "Strength of smoothing applied on jagged chains");
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05f, 4);
RNA_def_property_ui_range(prop, 0.0f, 0.1f, 0.05f, 4);
RNA_def_property_range(prop, 0.0f, 30.0f);
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
@@ -3314,8 +3328,10 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
prop,
"Image Threshold",
"Segments with an image distance smaller than this will be chained together");
RNA_def_property_ui_range(prop, 0.0f, 0.3f, 0.001f, 4);
RNA_def_property_range(prop, 0.0f, 0.3f);
RNA_def_property_ui_range(prop, 0.0f, 0.1f, 0.001f, 4);
/* A threshold of 1.0 means half of the image frame width already, it does not make any sense to
* go anything beyond that. */
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_loose_edge_chain", PROP_BOOLEAN, PROP_NONE);
@@ -3367,6 +3383,14 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
prop, "Camera Object", "Use specified camera object for generating line art");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
prop = RNA_def_property(srna, "light_contour_object", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(
prop, "Light Object", "Use this light object to generate light contour");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
prop = RNA_def_property(srna, "source_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, modifier_lineart_source_type);
RNA_def_property_ui_text(prop, "Source Type", "Line art stroke source type");
@@ -3417,6 +3441,45 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Intersection", "Generate strokes from intersections");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_light_contour", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_LIGHT_CONTOUR);
RNA_def_property_ui_text(prop,
"Use Light Contour",
"Generate light/shadow separation lines from a reference light object");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_PROJECTED_SHADOW);
RNA_def_property_ui_text(
prop, "Use Shadow", "Project contour lines using a light shource object");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "shadow_region_filtering", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shadow_selection");
RNA_def_property_enum_items(prop, modifier_lineart_shadow_region_filtering);
RNA_def_property_ui_text(prop,
"Shadow Region Filtering",
"Select feature lines that comes from lit or shaded regions");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
prop = RNA_def_property(srna, "shadow_enclosed_shapes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_SHADOW_ENCLOSED_SHAPES);
RNA_def_property_ui_text(prop,
"Shadow Enclosed Shapes",
"Reproject visible lines again to get enclosed shadow shapes");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "silhouette_filtering", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "silhouette_selection");
RNA_def_property_enum_items(prop, modifier_lineart_silhouette_filtering);
RNA_def_property_ui_text(prop, "Silhouette Filtering", "Select contour or silhouette");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
prop = RNA_def_property(srna, "use_silhouette_group", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Silhouette Group", "Select contour/silhouette from this group");
RNA_def_property_range(prop, 0, 255);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_multiple_levels", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_multiple_levels", 0);
RNA_def_property_ui_text(
@@ -3479,7 +3542,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
"Certain settings will be unavailable");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "overscan", PROP_FLOAT, PROP_NONE);
prop = RNA_def_property(srna, "overscan", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(
prop,
"Overscan",
@@ -3491,7 +3554,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Thickness", "The thickness for the generated strokes");
RNA_def_property_ui_range(prop, 1, 100, 1, 1);
RNA_def_property_range(prop, 1, 200);
RNA_def_property_range(prop, 1, GPENCIL_MAX_THICKNESS);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_FACTOR);
@@ -3518,6 +3581,12 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Masks", "Mask bits to match from Material Line Art settings");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_intersection_filter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mask_switches", LRT_GPENCIL_INTERSECTION_FILTER);
RNA_def_property_ui_text(
prop, "Flter Intersection", "Filter intersection lines using mask bits");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_intersection_match", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mask_switches", LRT_GPENCIL_INTERSECTION_MATCH);
RNA_def_property_ui_text(
@@ -3542,13 +3611,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Crease On Sharp Edges", "Allow crease to show on sharp edges");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_image_boundary_trimming", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_IMAGE_BOUNDARY_TRIMMING);
RNA_def_property_ui_text(
prop,
"Image Boundary Trimming",
"Trim all edges right at the boundary of image(including overscan region)");
prop = RNA_def_property(srna, "use_back_face_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_BACK_FACE_CULLING);
RNA_def_property_ui_text(
@@ -3558,10 +3620,43 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
"different occlusion levels than when disabled");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "shadow_camera_near", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(prop, "Shadow Camera Near", "Near clipping distance of shadow camera");
RNA_def_property_ui_range(prop, 0.0f, 500.0f, 0.1f, 2);
RNA_def_property_range(prop, 0.0f, 10000.0f);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "shadow_camera_far", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(prop, "Shadow Camera Far", "Far clipping distance of shadow camera");
RNA_def_property_ui_range(prop, 0.0f, 500.0f, 0.1f, 2);
RNA_def_property_range(prop, 0.0f, 10000.0f);
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "shadow_camera_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(
prop, "Shadow Camera Size", "Frame size of the shadow camera for sun light");
RNA_def_property_ui_range(prop, 0.0f, 500.0f, 0.1f, 2);
RNA_def_property_range(prop, 0.0f, 10000.0f);
prop = RNA_def_property(srna, "use_image_boundary_trimming", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_IMAGE_BOUNDARY_TRIMMING);
RNA_def_property_ui_text(
prop,
"Image Boundary Trimming",
"Trim all edges right at the boundary of image(including overscan region)");
prop = RNA_def_property(srna, "use_ortho_tolerance", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_ORTHO_TOLERANCE);
RNA_def_property_ui_text(
prop,
"Use Ortho Tolerance",
"Internally rotate the camera slightly to comphensate for the precision of the algorithm");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "use_invert_collection", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_INVERT_COLLECTION);
RNA_def_property_ui_text(prop,
"Invert Collection Filtering",
"Invert collection filtering",
"Select everything except lines from specified collection");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");

View File

@@ -754,6 +754,37 @@ static void rna_def_material_lineart(BlenderRNA *brna)
"Effectiveness",
"Faces with this material will behave as if it has set number of layers in occlusion");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
prop = RNA_def_property(srna, "mat_silhouette_group", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(
prop,
"Silouette Group",
"Faces with the same silhouette group numbers will be drawn as a continuous shape");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
prop = RNA_def_property(srna, "use_silhouette_group_override", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_default(prop, 0);
RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_MATERIAL_CUSTOM_SILHOUETTE_GROUP);
RNA_def_property_ui_text(
prop, "Use Silhouette Group", "Override object and collection silhouette group value");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(prop,
"Intersection Priority",
"The intersection line will be included into the object with the "
"higher intersection priority value");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_default(prop, 0);
RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_MATERIAL_CUSTOM_INTERSECTION_PRIORITY);
RNA_def_property_ui_text(prop,
"Use Intersection Priority",
"Override object and collection intersection priority value");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialLineArt_update");
}
void RNA_def_material(BlenderRNA *brna)

View File

@@ -2950,6 +2950,37 @@ static void rna_def_object_lineart(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(180.0f), 0.01f, 1);
RNA_def_property_ui_text(prop, "Crease", "Angles smaller than this will be treated as creases");
RNA_def_property_update(prop, 0, "rna_object_lineart_update");
prop = RNA_def_property(srna, "use_silhouette_group_override", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", OBJECT_LRT_OWN_SILHOUETTE_GROUP);
RNA_def_property_ui_text(prop,
"Use Silhouette Group",
"Use this object's silhouette group to override collection setting");
RNA_def_property_update(prop, 0, "rna_object_lineart_update");
prop = RNA_def_property(srna, "silhouette_group", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(
prop,
"Silhouette Group",
"Objects with the same silhouette group numbers will be drawn as a continuous shape");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_object_lineart_update");
prop = RNA_def_property(srna, "use_intersection_priority_override", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", OBJECT_LRT_OWN_INTERSECTION_PRIORITY);
RNA_def_property_ui_text(
prop,
"Use Intersection Priority",
"Use this object's intersection priority to override collection setting");
RNA_def_property_update(prop, 0, "rna_object_lineart_update");
prop = RNA_def_property(srna, "intersection_priority", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 255);
RNA_def_property_ui_text(prop,
"Intersection Priority",
"The intersection line will be included into the object with the "
"higher intersection priority value");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_object_lineart_update");
}
static void rna_def_object_visibility(StructRNA *srna)