Commit Graph

100935 Commits

Author SHA1 Message Date
Joseph Eagar
7e2659e4ab Cleanup: Split BKE_pbvh.h into BKE_pbvh_api.hh
Split much of BKE_pbvh.h into BKE_pbvh_api.hh.
BKE_pbvh.h is included by BKE_paint.h, which in
turn is included by large amounts of code including
RNA.

This makes it extremely difficult to change
or clean up the PBVH API, since each modification
of BKE_pbvh.h can take 20-30 minutes to compile,
even on a quad-core system with an SSD. This
commit fixes that by moving most of BKE_pbvh.h
into another file and just having the core,
external-facing interfaces in BKE_pbvh.h.
2023-07-03 20:01:04 -07:00
Campbell Barton
5c4510d39e Cleanup: update code comment for DNA_struct_get_compareflags
Translate (last?) Dutch text in Blender's source.
2023-07-04 12:37:22 +10:00
Campbell Barton
9e26960b77 Cleanup: code-comments 2023-07-04 12:36:41 +10:00
Campbell Barton
2b30e5ba05 Cleanup: remove unsafe strcat, strcpy, sprintf in non-blender utilities
Use BLI_string in makesrna, makesdna.
2023-07-04 12:02:26 +10:00
Campbell Barton
9753e70e37 Cleanup: move BLI_str_replace into BLI_string_utils.h
String search & replace is a higher level function (unlike BLI_string.h)
which handlers lower level replacements for printing and string copying.

Also use BLI_string_* prefix (matching other utilities).

This makes it possible to use BLI_string in Blender's internal utilities
without depending on DynStr, MemArena... etc.
2023-07-04 12:02:25 +10:00
Campbell Barton
bcdba3516b Cleanup: remove unused variable 2023-07-04 12:02:24 +10:00
Alice Scarlett
9cd07da339 Fix VSE subtitle export indexing
Some programs have trouble parsing .srt files if first index is 0.

While there doesn't seem to be any official specs for the .srt file
format, all resourses I could find online start indexing at 1. This
commit makes Blender's .srt exports start at 1 instead of 0.

Pull Request: https://projects.blender.org/blender/blender/pulls/107997
2023-07-04 03:55:44 +02:00
Chris Blackbourn
4f6ce68500 UV: Add "Invert Pins" to the menu in the uv editor
Thanks Robert Rioux for the suggestion.

Pull Request: https://projects.blender.org/blender/blender/pulls/109187
2023-07-04 02:46:23 +02:00
Hans Goudey
a3bfd6e20d Cleanup: Extract utility for counting indices
This utility counts the number of occurrences of each index in an array.
This is used for building mesh topology maps offsets, or for counting
the number of connected elements. Some users are geometry nodes,
the subdivision draw cache, and mesh to curve conversion.

See #109628
2023-07-03 18:47:03 -04:00
Clément Foucault
91d15a3613 EEVEE-Next: Fix shader compilation on Metal 2023-07-03 23:08:53 +02:00
Germano Cavalcante
5ea561b51c Cleanup: Use Vector and Matrices types in C++ 2023-07-03 16:20:52 -03:00
Germano Cavalcante
bc3ec100c2 Cleanup: Remove redundant code in Snap To Nearest
Result registration is already done in `SnapData::register_result`.
2023-07-03 16:20:52 -03:00
Germano Cavalcante
d0bbae8596 Fix #109641: Snapping doesn't respect Clipping Border
The clip planes in `rv3d->clip` were not being added.
2023-07-03 14:37:33 -03:00
Sergey Sharybin
5907ab0364 Fix redefinition SSE2NEON_PRECISE_SQRT on Apple Silicon
After some recent changes BLI_math_base got (indirectly) included
from DNA file, causing defines conflict in Cycles: Cycles wants the
default fast behavior of square root, and BLI color wants it to be
more preciese.

Proposed solution is to move the SSE block away from the math_base
closer to code which uses it. The initial intent was to make those
functions reusable, but for a long long time the color utilities
are the only users of those functions.

This change does not prevent the error from re-occurring in the
future if some code includes sse2neon and BLI color utilities, but
it makes such conflict situation much less likely to happen, for
now.

The downside of this change is that the code now need to include
BLI_simd.h explicitly to access BLI_HAVE_SSE2 instead of relying
on it being included indirectly with math headers. The mitigation
for this is to change semantic of the BLI_HAVE_SSE2: now it is
defined to 1 if SSE2 is supported and to 0 otherwise. This makes
it so the code needs to check if using `#if BLI_HAVE_SSE2` and
if the BLI_simd.h is not included it will generate warning when
using GCC or Clang.

This change in semantic is is something the current patches would
need to ensure is handled correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/109664
2023-07-03 19:18:30 +02:00
Sergey Sharybin
4cd10ddfdb Fix naive 4x4 matrix multiplication C++ implementation
Is not visible on any of the officially platforms, as everywhere
SSE2 is available (on Apple Silicon via sse2neon).

Only got noticed by some intermittent issue during development
which made BLI_HAVE_SSE2 unaccessible.

Seems that transpose was done a bit wrong. Not sure if worth trying
to fold the equation into C++ types, as that requires extra memory
transfers for transpose. Opted for a more naive folding, which
avoids extra copies.

Added a regression test for it, verified against numpy, the BLI
SSE2 implementation.
2023-07-03 19:18:28 +02:00
Germano Cavalcante
6abf253689 Fix #109633: 'Project Individual Elements' for 'Vert/Edge Slide'
`Project Individual Elements` was never supported for `Vert Slide` and
`Edge Slide`, however, albeit erroneously, this option still affected
those operations.

In Blender 3.6 this situation of `Project Individual Elements`
affecting the result, has been "fixed". But users still preferred the
old behavior.

Therefore, instead of falling back to `Snap To Face`, support
`Project Individual Elements` for `Vert Slide` and `Edge Slide`.

This is more like how it worked previously.
2023-07-03 12:30:56 -03:00
Falk David
3d99d05f00 GPv3: Add separate paint mode
This patch adds a separate paint mode for Grease Pencil 3.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/109453
2023-07-03 16:34:30 +02:00
Miguel Pozo
9c955a20fe EEVEE Next: Use draw_gpencil_new
Avoid shader validation errors from overlapping resources.
GPencil drawing is not fully implemented yet, so this doesn't cause any functional change.
2023-07-03 16:01:49 +02:00
Julian Eisel
ed38ef31f7 UI: Fix view item context menu not using context from button
Needed for the asset shelf context menu to work, see #104831.

Ensures the view item button's context is passed on to the context menu.
Otherwise it cannot display operators relying on this context.
2023-07-03 15:55:34 +02:00
Jeroen Bakker
590f3582c9 Eevee-next: Lookdev HDRI Switcher
This PR adds support to override the world with the HDRI of the
viewport.

Blurring of the background and camera based rotation isn't supported.
Switching the HDRI would still use the world diffuse light as that is
baked into the irradiance cache.

These issues have been added to #109646

![image](/attachments/2613adff-064a-4f81-8bdd-f687ab8ffcfb)

Pull Request: https://projects.blender.org/blender/blender/pulls/109548
2023-07-03 15:34:11 +02:00
Falk David
de95539ced Cleanup: Rename grease pencil modes to legacy
Renames `OB_MODE_EDIT_GPENCIL`, `OB_MODE_PAINT_GPENCIL`,  `OB_MODE_SCULPT_GPENCIL`,  `OB_MODE_WEIGHT_GPENCIL`, `OB_MODE_VERTEX_GPENCIL, and the context modes` to `*_LEGACY`.

Pull Request: https://projects.blender.org/blender/blender/pulls/109648
2023-07-03 15:15:54 +02:00
Julian Eisel
0d1f3f445a UI: Support page based scrolling in View2D
No user visible changes expected. The feature is not exposed yet.

For the asset shelf (#102879), design is to use a paginated scrolling
style. That means, that any scrolling will always snap to a multiple of
the page size (the size used when pressing the Page Up/Down keys).
Together with strict region size snapping (implemented in the asset
shelf patch, #104831), this gives a clean scrolling experience where
partially visible rows are avoided (impossible even).

Introduces:
- `View2D.flag` value `V2D_SNAP_TO_PAGESIZE_Y`, which will cause any
  scrolling to only use multiples of the page size.
- A custom page size via `View2D.page_size_y` for when the full region
  size is not the appropriate page size value.
- API function `UI_view2d_offset_y_snap_to_closest_page()` to enforce
  the snapping from outside View2D. The asset shelf uses this to keep
  strict scrolling over DPI changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/109154
2023-07-03 15:15:18 +02:00
Jeroen Bakker
c6c69c0656 Eevee-next: Octahedral mapping
Use octahedral mapping to store probe textures. Octahedral textures are easier to sample
and will increase performance. When extracting the world probe it will first be rendered into
a cubemap. This cubemap will then be remapped using octahedral texture coordinates.

* `CaptureView` captures the world light into a cubemap.
* `CaptureView` triggers the reflection probe module to update the octahedral texture using
   the cubemap.
* When sampling reflection probes it will convert the (cubemap) direction to octahedral
   coordinate and read from the octahedral texture.

![image](/attachments/d3331660-f893-41b7-8c17-ae12ddf2ad11)

Pull Request: https://projects.blender.org/blender/blender/pulls/109559
2023-07-03 15:14:34 +02:00
Germano Cavalcante
9d1f66c492 Fix 'optimize' directive usage on MSVC
"O" isn't an option.
2023-07-03 09:48:56 -03:00
Jeroen Bakker
c2c1d6f67b Metal: EEVEE Next shadow unit test enablement
Ensure correct SSBO bindings are present for shadow tests.
Metal validation errors occur if SSBO bindings that are expected are
not bound. In this case, we can bind empty SSBOs, but these should
be of the correct type for the tests.

Also adding missing zero-initializations for required members within
LightData. Without these, unit tests fail with various issues including
prevalence of OOB reads.

Co-authored-by: Michael Parkin-White <mparkinwhite@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/109645
2023-07-03 14:24:34 +02:00
Julian Eisel
248b322896 UI: Improve how region size snapping respects the maximum size
Previously, a region that used size snapping could be dragged to a
snapped size (say 3 times a column width), but then would be clamped to
an unsnapped size (say 2.7 times a column width) to make it fit the
available space.
Instead clamp the size before snapping, so that snapping respects the
available width/height (resulting in 2 times a column width for
example). Put differently, the region will not be made taller if there's
not enough space to fit the region up to the next snapping point.

Implemented as part of #104831.

Pull Request: https://projects.blender.org/blender/blender/pulls/109027
2023-07-03 13:06:38 +02:00
Jacques Lucke
d5cd0a1ea6 Cleanup: quiet warning due to unused function 2023-07-03 12:17:26 +02:00
Damien Picard
11ecfaa6b0 I18n: use proper name for the Convert Colorspace node
The Convert Colorspace node uses "Convert Colorspace" as a name on
registration, but it uses "Color Space" as a `DefNode()` in
NOD_static_types.h.

As a result, the node name is not extracted to the .po files, and thus
not translated.

This commit uses the same name in all definitions of the node.

Pull Request: https://projects.blender.org/blender/blender/pulls/109419
2023-07-03 12:16:43 +02:00
Bastien Montagne
fb8c9a2a42 Fix toggling of liboverrides between editable and non-edtiable with "Make" tool in the Outliner.
regression from 43a31d3c93.

Found while investigating #109513.
2023-07-03 12:07:08 +02:00
Clément Foucault
8fa8f1ca78 Cleanup: DRW: Remove uneeded point cloud vertex inputs 2023-07-03 11:51:53 +02:00
Bastien Montagne
0aafc49c91 Fix (unreported) missing viewlayer sync call in Outliner liboverride tool. 2023-07-03 11:46:38 +02:00
Campbell Barton
e06a341546 License headers: add SPDX-FileCopyrightText 2023-07-03 19:20:39 +10:00
Bastien Montagne
ad4aa692ce Fix #109590: Outliner: Assert in outliner_collect_objects_to_delete. 2023-07-03 11:19:44 +02:00
Miguel Pozo
903f9ad178 Workbench Next: Point Clouds
Point Cloud support for the new Draw Manager and Workbench Next.

Pull Request: https://projects.blender.org/blender/blender/pulls/109568
2023-07-03 11:16:44 +02:00
Clément Foucault
c2d693f431 GPU: Print shader dependency errors to error stream
This avoid loosing these messages during the build process
which is the point of WITH_GPU_BUILDTIME_SHADER_BUILDER.
2023-07-03 10:36:20 +02:00
Philipp Oeser
5308abafd8 Fix #109455: NLA editor tracks widgets backdrop is too small
Caused by d9f5ce2546 which moved the NLA solo button to the right, but
didnt make the backdrop behind the right-hand-side widgets bigger. So
the first widget seemed "transparent" over the channel name.

Now make the backdrop bigger if the solo button is drawn.

Pull Request: https://projects.blender.org/blender/blender/pulls/109498
2023-07-03 09:15:12 +02:00
Campbell Barton
1a758aa793 BLI_dynstr: remove workaround for vsnprintf on WIN32
Based on code-comments it seems vsnprintf didn't return the un-clamped
string length on MS-Windows, this is no longer the case.
BLI_dynstr used allocation doubling in a loop (with a 65536 limit)
in an attempt to allocate sufficient space.

This workaround isn't needed anymore. Expose BLI_sprintfN_with_buffer &
BLI_vsprintfN_with_buffer functions that take a fixed buffer to avoid
allocation for smaller strings.
This simplifies BLI_dynstr_appendf considerably.
2023-07-03 17:01:32 +10:00
Campbell Barton
6fbe467021 Cleanup: replace BLI_dynstr with a call to BLI_vsprintfN 2023-07-03 14:15:07 +10:00
Campbell Barton
c63fd11095 Cleanup: simplify BKE_report_prependf
Format the prefix once, then prepend it using a function shared between
BKE_report_prependf & BKE_report_prepend.
Replace BLI_dynstr with BLI_vsprintfN for string formatting.
2023-07-03 14:15:02 +10:00
Campbell Barton
33a7b80a6f BLI_string: use vsnprintf for BLI_sprintfN & BLI_vsprintfN
Avoid having to create & free the DynStr, which created an additional
temporary buffer. Gives around 1.5x overall speedup.
2023-07-03 13:57:25 +10:00
Campbell Barton
10bbf29d49 BLI_string: add BLI_vsprintfN
Avoid having to use BLI_dynstr to format a string using a va_list.
2023-07-03 13:14:06 +10:00
Campbell Barton
22b98a1a55 Fix error creating a random seed from the time
On my system `int(PIL_check_seconds_timer() * 1000000.0)` always game
the same result because the double value was out of the int range.

Use PIL_check_seconds_timer_i instead (as is done elsewhere).
2023-07-03 13:06:00 +10:00
Campbell Barton
ea3e221cc7 Cleanup: avoid ambiguous conversion from short -1 to bool 2023-07-03 12:36:30 +10:00
Hans Goudey
301f13191b Geometry Nodes: Use implicit sharing for mesh to curve node simple case
When the vertex indices are already ordered like curve points, the
attribute arrays can be shared with the result mesh. This reduces
memory and saves time copying the data. The improvement is
larger when the mesh contains more point domain attributes.
2023-07-02 22:12:32 -04:00
Hans Goudey
b2017978d4 Cleanup: Mesh to Curve: Decrease variable scope, improve comments 2023-07-02 21:37:26 -04:00
Hans Goudey
7be0d1481c Cleanup: Simplify topology node deduplication comparisons
And add deduplication to the corners of edge count field input.
2023-07-02 18:31:20 -04:00
Germano Cavalcante
dd4f0cebae Fix #109577: Wireframe edge factor is sometimes random
In some situations the loop value might not be set.
2023-07-02 19:25:08 -03:00
Germano Cavalcante
43015f5763 Mesh Merge By Distance: Avoiding unnecessary copying of 'vert_dest_map'
The `vert_dest_map` array, which contains a map indicating the index of
destination vertices, was being copied to another array (`WeldVert`)
unnecessarily.

By directly using the `vert_dest_map` array, we achieved a performance
improvement.

The average execution time of different operations was reduced from
267.4ms to 261.3ms, resulting in a 2.3% improvement in overall
performance.
2023-07-02 18:19:10 -03:00
Germano Cavalcante
2b0c1c6b75 Mesh Merge by Distance: Add 'SCOPED_TIMER' utility 2023-07-02 17:36:53 -03:00
Germano Cavalcante
087fd3bdc5 Fix compilation error with USE_WELD_DEBUG
Missed in 7966cd16d6
2023-07-02 16:53:44 -03:00