Commit Graph

88556 Commits

Author SHA1 Message Date
Campbell Barton eb837ba17e Cleanup: format 2022-05-05 17:33:43 +10:00
Hans Goudey 6513ce258f Geometry Nodes: Improve performance of mesh to points node
There are fancier possibilities for improvements, like taking ownership
of existing arrays in some cases, but this patch takes a simpler brute
force approach for now.

The first change is to move from the previous loop to using the new
`materialize_compressed_to_uninitialized` method on virtual arrays,
which adds only the selected values to the output. That is a nice
improvement in some cases, corresponding to the "Without Threading"
column in the chart below.

The next change is to call that function in parallel on slices of
the output. To avoid generating too much code, we can avoid
templating based on the type and devirtualizing completely.

The test input is a 4 million point grid, generated by the grid
primitive node. Color and 2D vector attributes were also transferred
to the points.

| Test      | Before | Final No Threading | Final  | Change |
| --------- | ------ | ------------------ | ------ | ------ |
| All Verts | 209 ms | 186 ms             | 170 ms | 0.8x   |
| 1%        | 148 ms | 143 ms             | 133 ms | 0.9x   |
| All Faces | 326 ms | 303 ms             | 87 ms  | 0.27x  |
| 1%  Faces | 70 ms  | 68 ms              | 34 ms  | 0.49x  |

Differential Revision: https://developer.blender.org/D14661
2022-05-05 09:28:46 +02:00
Campbell Barton 0f567ada9d Docs: add doc-string for BMFace.mat_nr struct member 2022-05-05 17:18:50 +10:00
Campbell Barton e33c15951b Cleanup: spelling in comments 2022-05-05 10:55:51 +10:00
Campbell Barton d0c2fd0570 Cleanup: use 'r_' prefix for return arguments 2022-05-05 10:44:25 +10:00
Campbell Barton d3c895fc41 Cleanup: shadow and format warnings 2022-05-05 10:44:25 +10:00
Campbell Barton 777b72b5cb Cleanup: unused argument warnings 2022-05-05 10:44:25 +10:00
Germano Cavalcante 73fa571598 Merge branch 'blender-v3.2-release' 2022-05-04 21:43:56 -03:00
Germano Cavalcante adbe71c3fa Fix T97835: crash when creating hair particle system on Mac
Recently `gpu_shader_3D_smooth_color_frag.glsl` had the uniform declarations removed.

For shaders without `ShaderCreateInfo` that require this source this results in the error:
```
ERROR (gpu.shader): hair_refine_shader_transform_feedback_workaround_create FragShader:
      |
   54 |   fragColor = finalColor;
      |
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'finalColor'
      |
   55 |   fragColor = blender_srgb_to_framebuffer_space(fragColor);
      |
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
```

So port that shader to use `ShaderCreateInfo`.
2022-05-04 21:42:38 -03:00
Harley Acheson 8960c6e060 IMBUF: Faster JPEG Thumbnails
Make preview thumbnails of JPEG files in less time and with less RAM.

See D14727 for more details.

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

Reviewed by Brecht Van Lommel
2022-05-04 16:55:59 -07:00
Juanfran Matheu ed0964c976 UI: Add Gizmos toggle to SpaceImage
This patch adds the show_gizmo and show_gizmo_navigate properties to the Image and UV editors.

Image Editor:
{F13026317}
UV Editor:
{F13026319}

VIDEO:
{F13026324}

Reviewed By: #user_interface, campbellbarton

Differential Revision: https://developer.blender.org/D14755
2022-05-05 00:23:25 +02:00
Kévin Dietrich 319a772b7f Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 19:37:48 +02:00
Kévin Dietrich fc0f6d19ad Fix T96845: artifacts with GPU subdivision and mirror modifier
The coarse polygon count was set to the one of the BMesh instead of
the the one of the mesh used for subdivision, which caused the
compute shaders to output wrong data.
2022-05-04 19:31:53 +02:00
Brecht Van Lommel 5d7ee44406 Fix T95527: wrong motion blur with rigid bodies
This index is not meant for the point cache data array, it's already offset.
2022-05-04 19:28:17 +02:00
Kévin Dietrich 1a98bec40e Subdivision node: add input for vertex creases
This adds an input to the Subdivision node to specify a field to use
for controling vertex creases. Common code with edge creasing was
extracted into utility functions to avoid redundancy.

Differential Revision: https://developer.blender.org/D14199
2022-05-04 18:59:08 +02:00
Hallam Roberts 82df48227b Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
  "Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
  "Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
  nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
  "Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
  "Separate RGB/HSV" nodes.

Python addons have not been updated to the new nodes yet.

**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.

**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.

Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
Bastien Montagne 7d41e1ed40 Merge branch 'blender-v3.2-release' 2022-05-04 17:30:26 +02:00
Bastien Montagne 60772baebf Fix T97709: Compositor: Scenes are being set to no users after doing a full copy.
Similar issue/solution as in rB5188c14718c5 from this Monday actually,
there may be more of those still lurking around... Quite surprising they
all get reported now, this behavior has been in Blender since years.
2022-05-04 17:29:50 +02:00
Antonio Vazquez 8ff5836766 Merge branch 'blender-v3.2-release' 2022-05-04 17:19:25 +02:00
Antonio Vazquez b5c3885bf0 Fix T97851: GPencil Bake object transform operator wrong transformation
The problem was the layer transformation was already applied in the layer and if we apply in the bake, we are doing double transformation.

Differential Revision: https://developer.blender.org/D14844
2022-05-04 17:18:58 +02:00
Germano Cavalcante d2271cf939 Transform: use a threshold for UV snapping
Unlike 3Dview snapping, UV snapping is always done to the UV closest to
the mouse cursor, no matter the distance.

From the user's point of view, this appears to be an inconsistency (See
{T93538}).

Therefore, set a minimum distance for snapping and, as in 3D View and
highlight the snap with a drawing of a circle.

Release Note: https://wiki.blender.org/wiki/Reference/Release_Notes/3.3/Modeling

Reviewed By: #uv_editing, campbellbarton

Maniphest Tasks: T93538

Differential Revision: https://developer.blender.org/D13873
2022-05-04 12:08:17 -03:00
YimingWu 08daeb9472 LineArt: Clean up file name and license.
lineart_cpp_bridge.cpp changed to .cc
2022-05-04 22:32:50 +08:00
YimingWu 03aba8046e LineArt: Object loading optimization
This patch replaces BMesh conversion into index-based triangle adjacent
lookup method, and use multithread in many steps to speed up object
loading for line art.

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

Reviewed By: Sebastian Parborg (zeddb)
2022-05-04 22:11:33 +08:00
Jeroen Bakker a0d139076c Silenced compilation warning on clang. 2022-05-04 15:04:30 +02:00
Jacques Lucke a52fbeadb1 Merge branch 'blender-v3.2-release' 2022-05-04 15:02:55 +02:00
Jacques Lucke 54b293237e Fix T97375: changing node tree from Python is very slow
The issue was that the `NodeTreeRef` acceleration data structure was
rebuild much more often than necessary. That happened because the
Map Range node accidentally tagged the node tree for change even
though it did not actually change.

Differential Revision: https://developer.blender.org/D14842
2022-05-04 15:02:19 +02:00
Jacques Lucke 82bf11e73f Cleanup: unused parameter 2022-05-04 14:36:16 +02:00
Kévin Dietrich dc1793e85b Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 14:33:13 +02:00
Kévin Dietrich d86d7c935e Fix T97827: material preview not displaying textures
Caused by rB281bcc1c1dd6 which did not properly made use
of `vec4` for UVs which are now loaded as attributes.
2022-05-04 14:30:52 +02:00
Jacques Lucke 5162135e14 Curves: add second experimental option for new curves tools
Now there are two experimental feature options:
* "New Curves Type": Enables the new data type and a couple of tools
  that are meant to be in the first release that comes with the new curves object.
* "New Curves Tools": This is only available when the new curve type is available
  as well. It mainly exists to keep some tools experimental even after the initial
  curves object is release officially.
  * For now this only includes the curves edit mode which is not usable yet and
    probably won't be for the initial release.

Differential Revision: https://developer.blender.org/D14840
2022-05-04 14:18:42 +02:00
Aras Pranckevicius 3bdda67e50 Merge branch 'blender-v3.2-release' 2022-05-04 15:11:25 +03:00
Aras Pranckevicius cbeb8770cc Fix T97794: new OBJ importer does not handle quoted MTL paths
Fixes T97794 (which is a reintroduction of an older issue T67266 that
has been fixed in the python importer, but the fix was not in the C++
one). Some software produces OBJ files with mtllib statements like
mtllib "file name in quotes.mtl", and the new importer was not stripping
the quotes away.

While at it, I noticed that MTLParser constructor was taking a StringRef
and treating it as a zero-terminated string, which is not necessarily
the case. Fixed that by explicitly using a StringRefNull type.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14838
2022-05-04 15:10:54 +03:00
Hans Goudey 48c0738d4a Cleanup: Adjust variable names, miscellaneous changes
Use `src` and `dst` instead of less common variable names,
less redundant logic, simpler use of const, and "typename"
for template arguments instead of "class".
2022-05-04 14:10:22 +02:00
Hans Goudey 9ee9dd257f Curves: Add method to find indices for curve type in a selection
For example, this can be used to find the indices of all Bezier curves
inside an existing selection. The important part is that it is optimized
for the case when all curves have the same type.
2022-05-04 13:55:13 +02:00
Hans Goudey 16011e34f0 Curves: Optimize filling all curves with a single type
If all curves are selected for setting the new type,
skip counting the types and just set it directly.
2022-05-04 13:55:13 +02:00
Falk David 7d7047058a Merge branch 'blender-v3.2-release' 2022-05-04 13:00:04 +02:00
Yann Lanthony b31f5b8ce7 GPencil: Apply layer transforms to visible frames
Fix regression described in T97799.

Apply layer transform and layer parenting to all visible frames, i.e. active frame + onion skinning frames.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T97799

Differential Revision: https://developer.blender.org/D14829
2022-05-04 12:58:57 +02:00
Hans Goudey 0f2cc50fc6 Cleanup: Avoid asan overflow warning for RNG seed 2022-05-04 12:58:45 +02:00
Hans Goudey caeea212cf Merge branch 'blender-v3.2-release' 2022-05-04 12:28:05 +02:00
Hans Goudey 302584bd6e Fix T97831: Curve to mesh node can create invalid wire mesh
When the profile only has one control point, its segment count was
determined incorrectly. There needs to be a special case for a single
control point, when there are no segments even if the curve is cyclic.
2022-05-04 12:26:59 +02:00
Campbell Barton 14d845192a Merge branch 'blender-v3.2-release' 2022-05-04 19:32:12 +10:00
Campbell Barton e7ba34599c Merge branch 'blender-v3.2-release' 2022-05-04 19:32:09 +10:00
Campbell Barton 79e94caa6b Fix error pasting text containing tabs
Regression in [0] which missed updating the string length
when converting tabs to spaces - the pasted string would be shorter.

[0]: e2f4c4db8d
2022-05-04 19:28:11 +10:00
Sergey Sharybin 5f8f436dca Allow surface deform when target mesh increases number of vertices
A studio request actually.

The goal is to cover rather typical situation: when the mesh was
bound to target when the target was on subdivision level 0 but
uses a higher subdivision level for rendering. Example of such
setup is a facial hair bound to the face.

The idea of this change is to use first N vertices from the target
where N is the number of vertices on target during binding process.
While this sounds a bit arbitrary it covers typical modifier setup
used for rigging. Arguably, it is not more arbitrary than using a
number of polygons (which is how the modifier was checking for
changes on target before this change).

Quite straightforward change. A bit tricky part was to not break
the behavior since before this change we did not track number of
vertices sued when binding. The naming I'm also not super happy
with and just followed the existing one. Ideally the variables in
DNA will be prefixed with `target_` but doing it for an existing
field would mean compatibility change, and only using prefix for
the new field will introduce weird semantic where the polygons
count will be even more easily confused with a count on the
deforming mesh.

Differential Revision: https://developer.blender.org/D14830
2022-05-04 10:56:33 +02:00
Sergey Sharybin aa1fb4204d Cleanup: More clear name in surface deform modifier
Make it explicit that counter is about target mesh.

Use DNA rename for it so that the files stay compatible.

Also renamed some purely runtime fields to replace `t`
prefix with `target` as the short `t` is super easy
to miss.

Differential Revision: https://developer.blender.org/D14835
2022-05-04 10:56:33 +02:00
Hans Goudey 2d80f814cc Curves: Use copied original data for invalid NURBS curves
NURBS curves can be invalid when the order is less than the number
of points, or in a few other situations. Currently the evaluated data of
an invalid NURBS curve is empty. This is inconvenient because it
requires checking for empty curves when it otherwise wouldn't be
necessary. This patch replaces that fallback with copying the original
data to the evaluated points. This makes conceptual sense too, as if
the curve couldn't be evaluated-- which wouldn't necessarily delete it.

Usually the UI protects against this happening, but it's currently
possible to create an invalid curve with some operations like the
delete geometry node.

Differential Revision: https://developer.blender.org/D14837
2022-05-04 10:27:46 +02:00
Jacques Lucke 7dc94155f6 Curves: support symmetry in curves sculpting brushes
This adds support for X/Y/Z symmetry for all brushes in curves
sculpt mode. In theory this can be extended to support radial
symmetry, but that's not part of this patch.

It works by essentially applying a brush stroke multiple with
different transforms. This is similiar to how symmetry works in
mesh sculpt mode, but is quite different from how it worked in
the old hair system (there it tried to find matching hair strands
on both sides of the surface; if none was found, symmetry did
not work).

Differential Revision: https://developer.blender.org/D14795
2022-05-04 09:51:32 +02:00
Jeroen Bakker 0375720e28 Fix T95165: Custom Normals tools dont update immediately.
Recalc selection count at the end of the circle selection.
This was removed from circle selection as it became a performance
bottleneck, helas some operators rely on it.
2022-05-04 09:22:17 +02:00
Campbell Barton 78e8fae346 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:21 +10:00
Campbell Barton b1cd3be0d0 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:18 +10:00