Commit Graph

99659 Commits

Author SHA1 Message Date
Jason Fielder
03e4325fa9 Fix: High resolution textures in Metal from Integer overflow
Resolve an issue where a high resolution texutre 16k x 8k
did not update in metal due to integer overflow of size parameter.

This patch contains several changes to address size correctness
across multiple use cases within the Metal backend.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108238
2023-05-25 08:50:14 +02:00
Campbell Barton
92b4e74985 Fix out-of-bounds read drawing bundles with custom-colors 2023-05-25 09:15:47 +10:00
Bastien Montagne
43a31d3c93 Fix #107913: Creation of liboverrides of Scenes should not be allowed.
It was still possible to create liboverrides of Scene IDs from the
Outliner.

Scenes are currently not officially supported, RNA API allows to create
them for experimental purposes, but UI should not.
2023-05-24 18:03:09 +02:00
Bastien Montagne
babdfc2294 Fix #107913: LibOverride: Hard Crash Opening Blender File with overriden active scene.
The main issue was the fact that if a Scene is overridden, it's content
will be fully invalidated when updating the liboverride at the end of
the file reading process. Since the FileData keeps a pointer to the
active view layer, it needs to be udated then.

As a side consequence, the liblinking of global data also needs to
happen before liboverrides are updated.
2023-05-24 18:03:09 +02:00
Bastien Montagne
43e6f110f4 Fix (unreported) ID copying code tagging embedded IDs as no-main data.
Embedded IDs (master collection of scene, etc.) do not exist in the Main
data-base. However, their tags should follow these from their owners. So
e.g. if a scene is in Main, its master collection should not be tagged
as no-main.

NOTE: this is somewhat also related to our ID tags sanitizing TODO task
(#88555).

Found while invesigating #107913.
2023-05-24 18:03:09 +02:00
Brecht Van Lommel
9419f5a289 Fix #107932: crash attempting to load invalid OpenVDB file path on macOS
Add catch all exceptions similar as was done for OpenEXR in #107184, and
also properly handle errors in Hydra delegate.
2023-05-24 17:47:27 +02:00
Hans Goudey
39780b39bd Fix #108226, #108219: Crash in mesh validation in importers
This line was removed by 7966cd16d6, the fix is
adding back the equivalent operation for poly offset indices.
2023-05-24 11:25:09 -04:00
Damien Picard
9f0807acd6 UI: Fix and improve a few messages
- Samplerate -> Sample rate: should be two words.
- "Falloff type the feather": typo.
- JPEG, OpenJPEG and JPEG 2000 are the official spellings of the
  respective projects.
- "... boundary of image(including ...": missing space.
- "Points in . direction (cannot be changed ...)":
  Plural, it is a collection of multiple points. Also do not use
  contraction for "cannot".
- The Bevel modifier's "Only Vertices" option was replaced by a
  Vertices mode in 2.90.
- "Metaball Types": affects one object, should be singular.
- "Metaball data-block to defined blobby surfaces": typo.
- "Wire Size": this option has nothing to do with wireframes, I suppose
  it's an old terminology.
- "... (for negative speed.)": remove trailing period.
- "Smooth factor effect": the prop describes a factor for an effect,
  not an effect for a factor.
- "... assigned to their vertices(ensures ...": missing space.
- "... used when faces have the ObColor mode enabled": ObColor is not
  used anywhere else in the UI (since Blender 2.50).
- "Effect Children": typo -> Affect.
- "Distort Min/Max": copy-pasted from another pair of properties.
- "... dismiss menu on release.(in 1/100ths of sec)": replace period
  with space.
- "resolution": field names should be capitalized.

Pull Request: https://projects.blender.org/blender/blender/pulls/108227
2023-05-24 16:33:33 +02:00
Philipp Oeser
c4f39eab88 Fix #108171: crash calling bpy.ops.uv.pack_islands
When the operator was executed directly (instead of being invoked as
from the UI), `stop`, `do_update` & `progress` were passed to the job
uninitialized, but `pack_islands_startjob` assigns to them (leading to
crash).

Now write protect in `pack_islands_startjob`.

Also fix memleak (missing call to `pack_islands_freejob`).

Pull Request: https://projects.blender.org/blender/blender/pulls/108185
2023-05-24 11:57:22 +02:00
Sergey Sharybin
3bc189a62e Add option to install copyright.txt
The file is specific for the builds created by the Blender Foundation
and strictly speaking should only be used by builds created on our
release environment.

This change introduces a CMake option which is disabled by default and
which will be enabled on our buildbot.

Ref #107295

Pull Request: https://projects.blender.org/blender/blender/pulls/108191
2023-05-24 10:07:19 +02:00
Campbell Barton
686ec6310c Fix potential buffer overflow with thumbnail URI creation on WIN32
Avoid unsafe strcat use.
2023-05-24 17:08:05 +10:00
Jacques Lucke
edf4cb8b67 Geometry Nodes: store path to simulation bake in modifier
This adds `char *simulation_bake_directory` to the nodes modifier. The path is automatically generated the first time the modifier is baked. It is _not_ automatically changed afterwards. The path is relative to the .blend file by default. For now, the path is not exposed in the UI or Python API.

This fixes issues where renaming objects/modifiers can cause the baked data to not work anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/108201
2023-05-24 08:45:31 +02:00
Campbell Barton
d56c38525c Fix flipped check for file-copy failure on OBJ export
The check for file-copy success was flipped,
document the return value.

Relocate move next to copy as they're related functions.
2023-05-24 16:31:39 +10:00
Campbell Barton
1f6b3c20c8 Fix potential buffer overflow for BLI_copy & BLI_path_move on WIN32
Avoid unsafe strcat use for file copy & move on WIN32.
Allocate the necessary space for the string.
2023-05-24 16:28:01 +10:00
Campbell Barton
574b2db317 Fix buffer overflow in BLI_path_abs on WIN32
Loading paths without a drive-prefix could overflow by 3 bytes.
Replace unsafe strcat with BLI_strncpy.
2023-05-24 13:33:27 +10:00
Campbell Barton
b5150ee8ea Fix potential buffer overflows in USD export & OpenEXR
- Don't use the source string length +1 as the size of the destination
  (USD export & IMB_exr_get_handle_name).
- Correct undersized buffer being passed into imb_exr_insert_view_name.
2023-05-24 12:32:47 +10:00
Chris Blackbourn
f96e108b63 UV: Complete options for rotation during uv packing
The rotation options are now:
* None
* Axis-Aligned (Blender 3.3 default)
   - Rotate to a minimal rectangle, either vertical or horizontal.
* Cardinal (new)
   - Only 90 degree rotations are allowed.
* Any
   - Blender 3.6 default.
2023-05-24 11:27:59 +12:00
Hans Goudey
34791dc37b Fix #108108: Remesh modifier crash with empty result
Caused by 7966cd16d6
2023-05-23 17:46:32 -04:00
Sonny Campbell
a127707cb4 USD Curve Export: Pinned CatmullRom Curve
In Blender the first and last points of a catmullRom curve are
treated as endpoints. To account for this in USD, we must set
the wrap attribute to 'pinned'. This lets the client know that
the first and last points are to be treated as points on the
curve, and that it needs to generate "phantom" points to account
for the start and end control points of a general catmullRom curve.

Related to #102376

Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108183
2023-05-23 19:18:17 +02:00
Hans Goudey
2262ea079b Fix #108034: Multires simple subdivide crash
Before 9f78530d80, the -1 coarse_edge_index values in the
foreach_edge calls would return false in BLI_BITMAP_TEST_BOOL,
which made them look like loose edges. BitSpan doesn't have this
problem, so the return for negative indices must be explicit.
2023-05-23 12:58:26 -04:00
Bastien Montagne
a4aee6a997 Fix (unreported) crash in blendkernel unittest in debug builds.
Some `ImagePartialUpdateTest` test are calling code that needs access to
a valid `G_MAIN`. So store the generated main there as part of the setup
step, and reset G_MAIN to its original value (should be NULL) in the
teardown step.

NOTE: Things like `ID_BLEND_PATH_FROM_GLOBAL` and
`BKE_main_blendfile_path_from_global` are pure evil. It may be necessary
in a very few small cases, but their current usages need a lot of strong
cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/108189
2023-05-23 15:55:12 +02:00
Bastien Montagne
89bd7b6402 Fix #105889: LibOverride: Overrides of shape keys reset on resync.
The usual special ShapeKey case needs yet another extra corner case
special handling... See comments in code for details about that specific
issue.

NOTE: May be worth checking if this can be backported to 3.3 LTS too.
2023-05-23 15:06:48 +02:00
Campbell Barton
bceb1adb20 Fix potential buffer overflow in AssetList::setup
While in practice an overflow seems unlikely in this particular case,
internal path manipulation assume FILE_MAX_LIBEXTRA so passing in
smaller buffer sizes is error prone.
2023-05-23 11:30:52 +10:00
Campbell Barton
7d682fa107 Fix missing include 2023-05-23 10:18:02 +10:00
Chris Blackbourn
43fe7bec4f Cleanup: format 2023-05-23 09:38:47 +12:00
Chris Blackbourn
a569344a81 Fix: Build error from ae9ac99d2b 2023-05-23 09:38:07 +12:00
Chris Blackbourn
ae9ac99d2b Fix #108117: Crash in uv editor with hidden geometry
Many "UV island" style operations internally use #UvElementMap, including:

- Transform tools
- Smart-Stitch
- UV Pinch, UV Grab and UV Relax sculpt tools.

Normally, every UV in the mesh is included in the #UvElementMap.
However, with hidden geometry, only the visible geometry is included in the map. [0]
This change enforces stricter usage, reducing the chance of crashes in other areas.

Regression from [0] which was a fix for "UV Island calculation doesn't ignore hidden faces" [1].

[0]: 8f543a73ab
[1]: #99659

Pull Request: https://projects.blender.org/blender/blender/pulls/108130
2023-05-22 23:23:23 +02:00
Philipp Oeser
adb36b89c7 Fix #107988: Spreadsheet not updating when playing animation
Similar to other screen options, add one for Spreadsheet editors that
makes them update when playing animation.

NOTE: there are some editors that always update when playback was
invoked from an animation editor while others only do this when their
respective option is specifically set (think the later behavior fits the
spreadsheet better).

Pull Request: #108002
2023-05-22 15:15:22 +02:00
Jacques Lucke
9692262b9d Fix #108122: onion skin disappears after scrubbing timeline
This was broken in 037b3f87bd.
2023-05-22 14:01:14 +02:00
Damien Picard
b9049411a8 I18n: disambiguate more "A" and "B" messages
In dd32dac60f, the "A" and "B" input socket from the Mix node were
disambiguated, so as not to confuse them with Alpha and Blue.

These messages are used in other nodes and elsewhere in the same
sense, so this commit adds translation contexts to these occurrences
as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/108051
2023-05-22 12:54:39 +02:00
Damien Picard
94fd2efc96 Cleanup: remove translation headers from node files
After 22f641e7f8, translation macros were removed and thus in many
files inclusion of the translation header is no longer needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/107986
2023-05-22 12:06:46 +02:00
Damien Picard
60ac9ab7a1 Fix: I18n: Vector Math node label translation function
The Vector Math node's label has a special function used to compute
its label based on the currently selected operation. This operation,
like that of the Math node, is extracted using the "NodeTree"
translation context.

Therefore, in this function it must also use the same context to
translate the label.

In addition, a few node types can have an "Unknown" label if there is
a problem with their internal state (operation, filter type, blending
type). This message can also be translated.

Pull Request: https://projects.blender.org/blender/blender/pulls/108029
2023-05-22 12:04:29 +02:00
Damien Picard
94934301e9 I18n: Add translation contexts to properties declared from Python
Some property labels need a context to disambiguate them from others
which have the same name.

The only way to show the proper text currently for such properties is
to override it in the UI code with a translation context, like:

```python
    layout.prop(obj, "area", text="Area",
                context=i18n_contexts.amount)
```

Python properties already store a translation context though, but this
context cannot be chosen from a Python script.

For instance, typing:

```python
bpy.types.Scene.test_area = bpy.props.BoolProperty(name="Area")
print(bpy.context.scene.bl_rna.properties['test_area'].translation_context)
```

will print `*`, the default context for Python props.

This commit allows specifying a context in this manner:

```python
from bpy.app.translations import contexts as i18n_contexts
bpy.types.Scene.test_number_area = bpy.props.BoolProperty(
    name="Area", translation_context=i18n_contexts.amount
)
print(bpy.context.scene.bl_rna.properties['test_number_area'].translation_context)
```

will now print `Amount` and can be translated differently from other
labels. In this instance, the word for a surface area measurement,
instead of a UI area.

-----

This is what translated properties look like using the existing ("Area", "") and ("Area", "Amount") messages:
![python_prop_contexts_test.png](/attachments/b0d9737e-4b31-4c91-a08e-b347db31225f)

The panel can be generated with this script:
[python_prop_contexts_test.py](/attachments/ab613cdc-8eba-46bc-8f3c-ad0a97e7a6e5)

Pull Request: https://projects.blender.org/blender/blender/pulls/107150
2023-05-22 11:41:48 +02:00
Sybren A. Stüvel
7a06588f05 Fix #102662: NLA-Strip Corrupted after reopening file w/ lib override
Mark `NlaStrip.frame_{start,end}` and `NlaStrip.frame_{start,end}_ui` as
to-be-ignored for the library override system, and add a new set of RNA
properties `frame_{start,end}_raw` that the library override system can
use.

Versioning code ensures that overrides on `frame_{start,end}` are
altered to be applied to the `..._raw` counterpart instead.

The override system uses RNA to update properties one-by-one, and the
RNA code trying its best to keep things consistent / valid. This is very
much desired behaviour while a human is editing the data.

However, when the library override system is doing this, it is not
replaying the individual steps (that each end in a valid configuration),
but just setting each property one by one. As a result, the intermediate
state can be invalid (for example moving one strip into another) even
when the end result is perfectly fine.

This is what the `..._raw` properties do -- they set the values without
doing any validation, so they allow the library overrides system to move
strips around.

This assumes that the result of the override is still valid. Logic to
detect invalid situations, and reshuffle the NLA strips if necessary, is
left for a future commit as it is related to #107990 (NLA Vertical
Reorder).

Additionally, this commit adds functions
`BKE_lib_override_library_property_rna_path_change()` and
`BKE_lib_override_library_property_search_and_delete()` to the library
override API. The former is used to change RNA paths of property
overrides, and the latter is used to remove a property override
identified by its RNA path.
2023-05-22 10:36:50 +02:00
guishe
e83a2386b5 Fix #107411: Non-visible objects in the viewport affect selection collusion
When using edit mode with a mesh, if you have the retopology overlay active,
the selection of vertices, edges, or faces is occluded by the other objects.
However, if local view is on or collections with objects are hidden,
these non-visible objects can occlude the selection.

This patch discards objects that are not visible in the viewport so they
do not occlude selection.
2023-05-22 08:27:05 +02:00
Chris Blackbourn
96101a66fc UV: Use correct uv packing method when all/none islands are pinned.
During packing, some combinations of `Fraction` margin method, and
various locking options, interact with situations where all or none
of the islands are pinned.

Previously, the settings were queried to choose the best packing method.

Now, the islands themselves are queried if they can translate or scale,
and the packing method is chosen based on the input, rather than the
parameters.

Fixes unreported crash with "Locked Position" when all islands are pinned.

Reported as #108037 "3. In some case locked position is not respected"
2023-05-22 15:54:38 +12:00
Chris Blackbourn
47cbeabb11 UV: Fix uv packing problem with rotate and scale line-search
When rotation is enabled and doing a scale line-search (locked islands
or "fraction" margin method), if the `rotate_inside_square` would
result in a a tighter packing, the wrong scale value was being used,
resulting in UVs outside of the unit square.

Reported as #108037 "1. Use locked scale on after scaling UV..."
2023-05-22 15:44:01 +12:00
Chris Blackbourn
de4f456ea2 UV: Fix overlap problem during uv packing with scale locked islands
If an island overlaps a pinned island, and that pinned island has
locked scale, then the pinning information must be copied to the
first island so it can be scaled correctly.

Reported in #108037 as "2. Use with Merge Overlapped"
2023-05-22 15:36:03 +12:00
Richard Antalik
a928d6d6b7 Fix #107588: Sound strip has negative length
Make sure pitch property has positive value in versioning.
Cause of 0 value pitch is unknown.
2023-05-22 03:55:52 +02:00
Harley Acheson
52f991b1a9 Fix #106484: Show all rotations with same precision
Increase precision of some rotational inputs so that they all show the
same precision. And have the arrows change in full degrees.

Pull Request: #106515
2023-05-21 10:38:07 -07:00
Harley Acheson
d81646cbce Fix #102574: Don't Show "Rename" for Volume and & System lists
For File Browser "System" and "Volumes" lists, the item names cannot be
changed by users yet the tooltip says "Double click to rename". This PR
just removes that text for these non-editable lists.

Pull Request: #106873
2023-05-21 10:29:22 -07:00
Campbell Barton
bf36a61e62 Cleanup: spelling in comments & some corrections 2023-05-20 21:17:09 +10:00
Campbell Barton
1d6eb9bc93 Fix UV vertex snap while transforming snapping to itself
When the mouse cursor was close to the selection being transformed,
the UV's could snap to themselves.
2023-05-20 20:28:11 +10:00
Philipp Oeser
370b7ae917 Fix #107889: Scale Cage gizmo wrong in editmode with rotated objects
Object transforms were already respected, issue was just pre vs. post
matrix multiplication when local axis were used.

Should go into LTS as well I guess.

Pull Request: https://projects.blender.org/blender/blender/pulls/108076
2023-05-19 15:51:28 +02:00
Campbell Barton
8a4ab1b3fe Fix assertion in BLI_path_normalize & add test 2023-05-19 19:25:08 +10:00
Jason Fielder
c267256f01 Fix #105830: Add depth bias for overlay faces in Metal
Resolves z-fighting blocking artifacts on faces due to limited
depth precision at certain camera positions. Depth bias
offsets the calculation enough without affecting display.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108048
2023-05-19 09:23:17 +02:00
Campbell Barton
2c6e88da96 Fix memory leak in copy_to_selected_button
Memory leak introduced in [0] early return cleanup.

[0]: a25a1f39aa
2023-05-19 14:29:46 +10:00
Campbell Barton
bb543620ae Fix invalid UTF8 strings being copied into the Python console
Add a ensure_utf8 argument to WM_clipboard_text_get so callers don't
have to handle validation themselves.

Copying non-utf8 text into the Python console and buttons was possible,
causing invalid cursor position and a UnicodeDecodeError accessing
ConsoleLine.body from Python.
2023-05-19 12:49:27 +10:00
Campbell Barton
6dcebc68d6 Fix "~" expanding to the default document directory instead of HOME
Originally this function expanded to the home however on WIN32
functionality changed to return the default Documents directory & the
function was renamed. Always expand "~" to the users home directory
since that's what it represents when used at the beginning of a path.
2023-05-18 13:30:40 +10:00
Hans Goudey
112a5196f6 Fix: Missing loose vertices converting BMesh to Mesh
Mistake in 6323d56eb5
2023-05-17 11:58:49 -04:00