Commit Graph

123630 Commits

Author SHA1 Message Date
Campbell Barton
391f86bc38 clang-format: set BraceWrapping::AfterControlStatement to "MultiLine"
This was the code-style Blender used before switching to clang-format
which did not support this style of brace placement at the time.

Since then support was added, this helps readability as the beginning
of braces isn't as clear in the case of multi-line conditionals.

This implements a proposal from #75956.
2023-05-02 09:37:08 +10:00
Campbell Barton
ec25c7b341 Cleanup: remove outdated/invalid comment 2023-05-02 09:36:51 +10:00
Campbell Barton
6a5ab77dcc Cleanup: format 2023-05-02 08:41:10 +10:00
illua1
0652945dbd Fix #107306: Merge by distance node is not deterministic
In some cases the node didn't reproduce the same results given the
same input. Based on the test results (just 2 very detailed cubes
and a transformation), it doesn't seem to affect performance that
much. Credit to @MMMM who pointed out this option.

Pull Request: https://projects.blender.org/blender/blender/pulls/107312
2023-05-01 22:15:19 +02:00
Germano Cavalcante
c7f1ad1058 Fix #107474: Proportional Size not saved when canceling the operation
cc623ee7b0 did not consider some implications such as the habit of
users initiating transform operations just to change the size of the
Proportional Edit.

Therefore, partially revert the cc623ee7b0.
2023-05-01 13:58:17 -03:00
Hans Goudey
5525e5b942 Fix #107480: Crashes in mesh format conversion for old files
There were a few issues, but they mostly came from the fact that some
versioning was done in the "after linking" versioning, which came after
the regular legacy mesh conversion. Also, the `MFace` array wasn't
necessarily part of CustomData for some very old files.

The `BKE_mesh_strip_loose_faces` function was moved because it now
uses the deprecated `me->mface` pointer.
2023-05-01 11:33:42 -04:00
Michael B Johnson
3c74575dac Fix #107062: support opacityThreshold when exporting USD
This PR addresses issue “USD export does not respect opacity threshold for clip alpha blend mode #107062”

This commit extends the USD Preview Surface material support to author the opacityThreshold attribute of materials on export, when the Alpha Clip blend mode is selected.

When authoring alpha cutouts in Blender, one sets the Blend Mode to "Alpha Clip", and the Clip Threshold to some value greater than zero.
When this case is detected on export, we now author the opacityThreshold attribute to match the specified clip threshold.

Note that opacityThreshold is already handled correctly on import, so this change allows the feature to be fully round-tripped.

Co-authored-by: Matt McLin <mmclin@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/107149
2023-05-01 17:28:23 +02:00
Hans Goudey
f59fdc40ec Fix: Missing normalization for sampled normals when adding curves
Mistake when splitting up commits for 0a5f0890cc.
2023-05-01 08:41:20 -04:00
illua1
314866eb3a Fix #107431: tag node tree topology as changed when changing socket order
Pull Request: https://projects.blender.org/blender/blender/pulls/107437
2023-05-01 13:22:44 +02:00
Chris Blackbourn
3ea060860a UV: Tuning rotating to minimum square during packing
* Perform rotate_inside_square earler in the pipeline. (improved layout)
* #rotate_inside_square with AABB margin if there is only one island.
* Conservative bounds when using xatlas on non-D4 transforms.
2023-05-01 23:18:15 +12:00
Aldo Bleeker
d68ed238b9 Cycles: solve compilation errors with OptiX 7.7
* User simpler API names that accept both PTX and OptiX-IR
* New argument for optixProgramGroupGetStackSize, leave to default
* Remove OptixPipelineLinkOptions::debugLevel that does nothing

Pull Request: https://projects.blender.org/blender/blender/pulls/107450
2023-05-01 12:07:26 +02:00
Omar Emara
3f6912ece2 Realtime Compositor: Implement Mask node
This patch implements the Mask node for the realtime compositor. The
evaluation of the mask is not GPU accelerated, but is cached as a form
of temporary implementation until we implement a GPU evaluator for
masks.

One limitation currently is that we do not redraw the viewport while the
mask is getting edited by the user, because always doing that will be
redundant in most situations, and conditioning the redraw requires a lot
of work that should be handled outside of this patch.

This is similar to the Texture node implementation in 151a53110c.

Pull Request: https://projects.blender.org/blender/blender/pulls/107464
2023-05-01 11:29:06 +02:00
Omar Emara
92983967cb Cleanup: Improve readability of Mask node flags
This patch improves the readability of the Mask node flags by using the
same naming conventions as other node flags.
2023-05-01 12:07:57 +03:00
Julian Eisel
f8d2156dda Fix #104722: Outliner renaming uses wrong item
The property value should be reset for the next operator execution, not
remembered. Also hide it from auto-generated UIs, this is an internal
property nothing meant for the user to edit.

Also see discussion in #105872.
2023-05-01 11:03:39 +02:00
Julian Eisel
20f54a5698 Asset Browser: Let "Clear Asset" act on entire selection
Users were confused that "Clear Asset" would only act on the clicked on
asset, not the entire selection. They would have to clear them one by
one, which can be quite annoying. The previous commit prepared the asset
clearing operator for this, so all this commit has to do is expose the
selected IDs to context.
2023-05-01 10:47:55 +02:00
Julian Eisel
f22e2bab72 Assets: Prefer selected IDs over single active ID for asset mark/clear
Shouldn't cause user visible changes.

Usually batch operations are more handy, so prefer editing multiple
items over a single one. That is, act on the whole selection not the
active item. Mark and clear will now respect this when retrieving IDs
from context, however right now there's no case where actually both
selected and the active ID are exposed in context. Because of this there
shouldn't be a user visible change until the following commit.
2023-05-01 10:47:55 +02:00
Jason Fielder
36e1ebc78d Metal: Resolve runtime issues with texture views
When creating a texture view, Metal may require that the original
GPUTexture state is modified in some way. This may be a result
of deferred creation, or, to cache the texture view against the
source.

As a result, GPUTexture passed into GPU_texture_create_view
cannot be const.

Small fixes have also been made in the Metal texture
implementation to ensure correct function of texture views.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/107167
2023-05-01 09:14:00 +02:00
Campbell Barton
46316b29dc GHOST/Wayland: remove keyboard modifier mismatch warning suppression
Detecting when to show warnings about GHOST/XKB modifier
mismatches was rather involved, remove the check as it's
unnecessary for Gnome-Shell >= v43.

Older versions of Gnome-Shell will show warnings on window activation
with modifier keys held.
2023-05-01 11:57:45 +10:00
Campbell Barton
4efacf7e85 GHOST/Wayland: use GHOST modifiers, not XKB without an active windows
Reading modifiers from XKB caused a complications in getModifierKeys(..)
when called on a window that was activated, before the keyboard enter
handler had run - because the keys held by GHOST had not yet been
updated by XKB. This caused a problem which Gnome-shell which runs
the keyboard-enter handler after window activation.

This change would have fixed the Super key being stuck, see: #107314.
Keep the previous fix since in the unlikely case GHOST & XKB get out of
sync, stuck modifier keys should still be prevented.

This change means the warning for GHOST & XKB getting out of sync
can be enabled for Gnome-shell again, as it was previously suppressed
as it happened frequently on window activation.
2023-05-01 11:57:13 +10:00
Campbell Barton
358ce4f52b Fix more crashes attempting to run operators in unexpected contexts
Add missing NULL checks for:

- OBJECT_OT_transform_to_mouse
- GPENCIL_OT_time_segment_remove
2023-04-30 15:23:43 +10:00
Campbell Barton
5d59f4ad7b Cleanup: use term "Delete" for sequence strips
Use consistent terminology with the rest of Blender,
the menu items already overrode this with the term "Delete".
2023-04-30 15:10:49 +10:00
Campbell Barton
44d13c787d Fix various crashes attempting to run operators in unexpected contexts
Use bl_run_operators to detect cases when operators would crash
when run in an expected context for the following operators:

- GIZMOGROUP_OT_gizmo_select
- GIZMOGROUP_OT_gizmo_tweak
- GPENCIL_OT_time_segment_move
- OBJECT_OT_add_named
- OBJECT_OT_data_instance_add
- OBJECT_OT_drop_named_material
- SCULPT_OT_mask_by_color
- SEQUENCER_OT_delete
- SEQUENCER_OT_rename_channel
- SEQUENCER_OT_retiming_handle_move
- SPREADSHEET_OT_change_spreadsheet_data_source
- UI_OT_drop_color

Note that some of these situations users were unlikely to encounter,
however there were cases script authors could run into such as deleting
sequence strips without a region or masking by color without a 3D view.
2023-04-30 15:08:27 +10:00
Campbell Barton
d302901ce0 Fix bl_run_operators test running without a window context
While technically valid, a context without a window set can't access
the active object or view layer, causing object mode setting to fail,
making the checks not all that useful.

Use Context.temp_override(..) to set the context's window.
2023-04-30 15:08:27 +10:00
Campbell Barton
91325378cb Fix potential buffer overflow with FileListEntryPreview::filepath 2023-04-30 15:08:27 +10:00
Campbell Barton
635cccc54e Fix curve-sculpt invoke function accessing the wrong brush
The brush used to check if curve sculpt should run didn't necessarily
match the brush which was used for curve sculpt.
2023-04-30 15:08:27 +10:00
Campbell Barton
0a7f2486ec Fix apply as shape operator accessing properties that don't exist 2023-04-30 15:08:27 +10:00
Campbell Barton
951c31e258 Fix use-after-free error in sculpt color filter 2023-04-30 15:08:26 +10:00
Campbell Barton
03ad5c17e6 Fix crash accessing the image clipboard in background mode 2023-04-30 15:08:26 +10:00
Campbell Barton
fa5cc84a0a WM: avoid Python exceptions in poll functions 2023-04-30 15:08:26 +10:00
Campbell Barton
cfe25e6efb Use native path separators for run-time generated paths 2023-04-30 15:08:26 +10:00
Campbell Barton
1c026befca Cleanup: spelling in comments, remove annotations that aren't validated 2023-04-30 15:08:26 +10:00
Chris Blackbourn
5c1c45cd59 UV: Improve packing efficiency by rotating to minimum square
After primary packing is completed, perform a deep earch for any
rotation of the entire layout which improves efficiency even further.

This can sometime provides *optimal* packing results. e.g. When packing
a single island, the layout will now touch all 4 sides of the unit square.
2023-04-30 16:55:39 +12:00
Yonatan Maor
adb63a5102 Gizmo: Add anti aliasing to transform constraints
Transform constraints were being drawn on screen without anti-aliasing,
now fixed to make them look smoother.
See #107038

Adding a comparison of before and after the change

Pull Request: https://projects.blender.org/blender/blender/pulls/107394
2023-04-29 22:06:39 +02:00
Sebastian Herholz
3298c61d1f Deps: Updating to Open PGL 0.5.0
Pull Request: https://projects.blender.org/blender/blender/pulls/107343
2023-04-29 12:58:08 +02:00
Chris Blackbourn
ca00cb5470 Cleanup: format 2023-04-29 13:50:23 +12:00
Campbell Barton
d145dfdae0 Fix #107443 movie clip fails to load
Regression with incorrect sizeof argument to BLI_path_sequence_encode.

[0]: 6701d24084
2023-04-29 11:31:16 +10:00
Joseph Eagar
2d2f4d9d28 Cleanup: Rename StrokeCache.original to .accum
Note: the value is inverted, StrokeCache.accum = !StrokeCache.original.
2023-04-28 17:58:26 -07:00
Joseph Eagar
15d2487e26 Sculpt: Fix #105303: improper setting of SculptCache.original
I'm going to rename this in a seperate commit
2023-04-28 17:53:47 -07:00
Chris Blackbourn
69d52c5f1c UV: Fix uv packing overflow with fraction margin method
When UV Packing with the `fraction` margin method, if the UVs
overflowed the unit square, the UVs could sometimes overlap.

(island_index was incorrect.)
2023-04-29 10:25:40 +12:00
Chris Blackbourn
bf56df3236 UV: Add new packing option, scale_to_fit
When `scale_to_fit` is enabled, the existing behavior is used,
UVs will be scaled to fill the unit square.

If disabled, UVs will not be rescaled. They will be packed to the
bottom-left corner, possibly overflowing the unit square, or not
filling space.
2023-04-29 09:50:33 +12:00
Jesse Yurkovich
97222519de Fix #106945: IES file parsing failures
There were two issues here preventing the proper display of the IES
files in question.

The primary one was that these lights are actually vertical. Their
profiles actually point upwards from 90deg to 180deg but our parser was
trying hard to adjust it to start at 0deg incorrectly.

Lastly, the files in question ended with the parser in the `eof`
state - they are "missing" the final carriage return that other IES
files tend to have but other viewers don't seem to mind. Change the
`eof` check instead for a better one that will indicate if any parsing
errors occurred along the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/107320
2023-04-28 23:29:04 +02:00
Harley Acheson
a20bb83c21 Fix 3D text selection & cursor mismatch when not on curve
Commit 5c184525ed improved text cursor
placement when text is on a curve, but when not on a curve it is now
on the baseline. This corrects for that, placing 25% below baseline.
2023-04-28 14:12:56 -07:00
Chris Blackbourn
609010f5c0 Cleanup: format 2023-04-29 08:41:33 +12:00
Damien Picard
44103f5529 I18n: improve geometry nodes field tooltips
Node socket tooltips suffered from several issues.

- Some could not be translated because they were not properly
  extracted, so extraction macros were added.

- Some were extracted but included newlines at the end which did not
  get translated, such as `ss << TIP_("Geometry:\n")`, changed to
  `ss << TIP_("Geometry:") << "\n"`.

- Some translations were not functional, such as:
  `TIP_(attributes_num == 1 ? " Named Attribute" : " Named Attributes");`
  because `TIP_()` needs to be around a single string.

- Some extraction macros had no effect and were removed, such as:
  `.description(N_(leading_out_description));`
  This is a no-op macro which can be used only around a string literal.

Pull Request: https://projects.blender.org/blender/blender/pulls/107257
2023-04-28 21:37:33 +02:00
Germano Cavalcante
e33974effb Fix Auto Depth not working
Error in 67203c0ec8

The wrong Auto Depth flag was being read.
2023-04-28 16:38:15 -03:00
Hans Goudey
96fd14a65f Cleanup: Fix typo in mesh sample function name 2023-04-28 14:45:22 -04:00
Hans Goudey
bec033e057 Cleanup: Simplify and deduplicate mesh sampling code
It arguably reads easier if simple operations like reading from indices
of an array don't each get their own line. Also the same corner
attribute sampling was repeated in a few places. And add a new
function to sample normals from the corner domain, and use
lower level arguments to the lower level functions (i.e. not just
a mesh pointer, but the necessary data arrays).
2023-04-28 14:45:22 -04:00
Hans Goudey
f8cc6cc866 Cleanup: Simplify passing empty anonymous attribute set 2023-04-28 14:45:22 -04:00
Hans Goudey
696b56c1da Cleanup: Add note about adding attributes while iterating 2023-04-28 14:45:22 -04:00
Hans Goudey
0a5f0890cc Cleanup: Use helper function to sample normals when adding curves 2023-04-28 14:45:22 -04:00