136559 Commits

Author SHA1 Message Date
Campbell Barton
c110d26c61 Cleanup: use const pointers where possible 2024-05-28 13:47:43 +10:00
Hans Goudey
91c7809640 Fix #122319: GPU subdivision loose geometry positions invalid
Caused by 8d4da6063a1edd467f885a4d863fbd68efb18158
2024-05-27 23:04:07 -04:00
Damien Picard
3865eb5cdb Fix: error when selecting Size Mode in Import Images as Planes
When importing images as planes, on Size Mode update, this error would
be raised in the console because the update tried to assign a value to
a nonexistent member of the class:

Ref: !122343
2024-05-28 12:01:43 +10:00
Hans Goudey
81a6eb2118 Fix #121789: Viewer node crash with matrix socket type 2024-05-27 16:27:41 -04:00
Hans Goudey
0dd61a9dc6 Fix #122293: Hidden edges affect incorrect loose edge indices
The loose edge section of the index buffer was built incorrectly,
essentially assuming that all the hidden edges came at the end of the
loose edge indices. To correct this, we need to track the visibility of
each loose edge index rather than the visibility of each edge itself.
This is driven by the need to combine the loose and non-loose indices
into one IBO with the loose edges in a contiguous section, and the
desire to avoid restart "invisible" indices in the buffer to upload
less data to the GPU.
2024-05-27 16:18:41 -04:00
Julian Eisel
71b0e9d92a UI: Don't refresh searchbox region blocks on text input
Refreshing refers to the recreation of the block and it's buttons in
this case.

Refreshing popup regions on text input was added in 7d80fde033. It can
be useful to update the popup contents on text input, searchboxes have
their completely own update handling however.
2024-05-27 21:25:28 +02:00
Julian Eisel
98c92b9033 Fix more potential crashes when refreshing certain popups
These popups had refreshing enabled, but the callback used for
refreshing would access a likely dangling operator pointer. One case can
use the operator-type pointer instead, in the other case disable
refreshing altogether. Also see 8ea79dc3a7.
2024-05-27 21:21:39 +02:00
Julian Eisel
8ea79dc3a7 Fix #122276: Crash when searching for a Collection Instance
This search menu creation/refreshing function relies on the operator
pointer which might be dangling. There are more such cases, will fix in
followup commits.
2024-05-27 20:58:12 +02:00
Harley Acheson
8542797c6f Fix: UI: Versioning Error with V3D_SHOW_CAMERA_GUIDES
Fix test failures after versioning change introduced in #121923.

Pull Request: https://projects.blender.org/blender/blender/pulls/122333
2024-05-27 20:16:44 +02:00
Julian Eisel
95886fdfe2 Refactor: Use new context string support for node asset menus
Since 2fbf206491 it's possible to store named strings in context, rather
than having to wrap them in RNA pointers. Here this can avoid some
boilerplate code.

After this the `AssetCatalogPath` RNA struct should be unused. Might
be better to remove it in 5.0 only though, since it's part of the API.
Added to #110461.

Pull Request: https://projects.blender.org/blender/blender/pulls/122331
2024-05-27 20:02:49 +02:00
Damien Picard
b37d121e0a I18n: extract and disambiguate a few messages
Extract
- Add to Quick Favorites tooltip.
- "Mask", the name of a newly created mask (DATA_).
- "New" in the context of the new mask ID button.
- A few strings using BLI_STR_UTF8_ defines were not extracted.
  Take the special characters out of the translation macros.
- "External" menu items from the filebrowser's Files context
  menu (right-click on a file). These items were already extracted,
  but not translated.

Improve
- Separate formatted error message "%s is not compatible with
  ["the specified", "any"] 'refresh' options" into two messages.

Disambiguate
- Use Action context for new F-modifiers' names. This is already used
  for the "type" operator prop.
- Translate ImportHelper's default confirmation text using the
  Operator context, as it uses the operator name which is extracted
  with this context.
- "Scale" can be a noun, the scale of something, or a verb, to scale
  something. The latter mostly uses the Operator context, so apply
  this context to verbs, and the default contexts to nouns.
- "Scale Influence" can mean "Influence on Scale" (tracking
  stabilization) and "to Scale the Influence" (dynamic paint canvas).
- "Object Line Art" as type of Line Art to add, as opposed to the
  active object's Line Art settings.
- Float to Integer node: use NodeTree context for the node label, as
  this is already extracted and used for the enum.

Do not translate
- Sequencer labels containing only a string formatting field.

Some issues reported by Gabriel Gazzán and Ye Gui.

Pull Request: https://projects.blender.org/blender/blender/pulls/122283
2024-05-27 19:33:35 +02:00
Damien Picard
f5c4372531 Extensions: expose extension tagline to bl_info
An extension's optional "tagline" field is equivalent to a legacy
add-on's "description". This allows exposing the tagline as a
description in `bl_info`.

The main goal of this change is to expose extension taglines to the
translations, since the legacy description was already extracted.

Pull Request: https://projects.blender.org/blender/blender/pulls/122327
2024-05-27 19:30:14 +02:00
Damien Picard
8b8d58a7e5 I18n: extract UILayout headings with context
Some UI elements (row and column) can define a heading text.
Optionally, this text can use a custom translation context specified
through `heading_text`. This changes allows extraction of those
headings using the appropriate context instead of the default one.

Pull Request: https://projects.blender.org/blender/blender/pulls/122326
2024-05-27 19:28:23 +02:00
Jesse Yurkovich
3ccb84fee6 Fix: USD: warning when printing bke::AttrDomain type 2024-05-27 19:20:54 +02:00
Hans Goudey
55ff4aef85 Cleanup: Sculpt: Improve function name 2024-05-27 13:12:43 -04:00
Jacques Lucke
41472dc659 Geometry Nodes: clear data block references before baking
The references are automatically recreated during the bake. Clearing them
first ensures that no old references stay around unnecessarily.
2024-05-27 19:11:23 +02:00
Julian Eisel
2fbf206491 UI: Allow passing named strings via context
Sometimes it is necessary to pass additional data through generic UI entities,
to specific implementations. For example to pass additional options to panel
polling & drawing when instantiating a panel through its panel type. Or storing
additional data in a button, without hardcoding it in the button struct/class.

Passing data via context is a simple solution to this, however so far this only
works using hardcoded context queries or RNA pointers. For passing arbitrary
strings we've used workarounds like creating an RNA type to wrap it already.
For example `RNA_AssetCatalogPath`, which is used to dynamically populate menu
items based on an asset catalog path, via a generic menu type.
type instantiation. This makes it possible to invoke specific asset shelves as
popover panels.

Idea is simply to let `bContextStore` entries hold copies of the string (as
`std::string`), avoiding lifetime issues. Context APIs are extended to support
setting/querying strings via a context member name.

Pull Request: https://projects.blender.org/blender/blender/pulls/122113
2024-05-27 18:46:19 +02:00
Lukas Tönne
cdf960ecec GPv3: Use "Precision" setting for the fill tool
The Precision setting (aka "fill_factor" in DNA) is used increase or
decrease the size of the image buffer for flood fill and thereby
balance accuracy vs. performance. This was not yet implemented in GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/122318
2024-05-27 18:24:16 +02:00
Harley Acheson
392ac52ebb UI: Toggle Camera Guides in Viewport Overlays
Allow toggling camera composition guides in the 3DView Overlay popover.

Pull Request: https://projects.blender.org/blender/blender/pulls/121923
2024-05-27 18:16:04 +02:00
Clément Foucault
8aec5f5e91 EEVEE-Next: Precompute AO/GI quality factor
This avoid some ALU in hot loops of expensive shaders.
2024-05-27 18:14:01 +02:00
Clément Foucault
66af5ed445 EEVEE-Next: Add fast GI max distance
This is implemented as a separate parameter from AO
since the AO can be tweaked for the AO pass.
2024-05-27 18:14:00 +02:00
Clément Foucault
8a7b9f6f66 EEVEE-Next: Add option to turn off GI
This new `Method` property allows to replace Diffuse GI
by simple ambient occlusion. This can be desirable for
performance or look.

This doesn't add the memory savings but there are already
some performance gain by using this option.
2024-05-27 18:14:00 +02:00
Falk David
7b66e2274b GPv3: Draw Tool: Refactor simplify_stroke
Previously the `simplify_stroke` stroke step used the screen
space coordinates to do the simplification.
Instead, this is now refactored to use the more general
`geometry::simplify_curve_attribute`. This means we can
simplify the stroke based on the positions and radii.

The simplify step is also now hooked up to the simplify option
in the tool settings (under the `Stroke` panel).
2024-05-27 17:27:31 +02:00
Falk David
2c44789bc3 GPv3: Draw Tool: Use the Post-Processing toggle
In the `Stroke` panel for the draw tool settings, there is a
toggle to enable/disable post processing. This is now hooked
up in the code.
2024-05-27 17:27:31 +02:00
Falk David
bf7e3e9256 GPv3: Draw Tool: Use input_samples tool setting
This uses the `input_samples` tool setting as a minimum distance
in pixels (screen space) for newly created points.
By default this is 10, which means that the points in a drawn stroke
will all be at a distance of 10px or less (in screen space when
the stroke is drawn).
2024-05-27 17:27:31 +02:00
Falk David
76ed87bcf9 GPv3: Draw Tool: Use hardness value from tool settings
Use the `hardness` value from the grease pencil tool setting
to set the (now called) `softness` attribute of the new stroke.
2024-05-27 17:27:31 +02:00
Falk David
8269f1dd8a GPv3: UI: Remove active smooth factor
This setting was added for testing purposes early on.
It's now in the right place in the `Advanced` tool setting panel.
2024-05-27 17:27:31 +02:00
Jacques Lucke
874dee0670 Fix: crash in data-block lookup with multiple libraries 2024-05-27 17:07:48 +02:00
Hans Goudey
a3fe547bf9 Cleanup: Sculpt: Remove duplicate function
Looks like `calc_sculpt_plane` was duplicated in d93dd8595103ea0c0d48.
2024-05-27 10:42:14 -04:00
Falk David
a0294e0b9a GPv3: Refactor Layer::frame_at
There were two issues:
* The const and non-const version behaved differently
* The frames map was not used to query the `frame_number`

Now both the const and non-const implementations behave
the same way. Additionally, the frames map is used to do a
lookup first and, on sucess , return the frame immediatly.
Otherwise we do a binary search for a keyframe that starts
before the frame number (and ends after).
2024-05-27 15:42:12 +02:00
Bastien Montagne
191cfd4d53 18N: Updated UI translations from git/weblate repo (2b5d8724c5e897f7). 2024-05-27 15:30:43 +02:00
Lukas Tönne
f5b9ff15a0 Fix #121356: GPv3: Conversion operators to/from Curves
Adds object conversion between Grease Pencil and Curves types.

GPv3 object is converted to Curves by combining all visible layers at
the current frame.
Curves object is converted to Grease Pencil by constructing a new layer
and keyframe with the curves geometry.

The type enum for the conversion operator gets a dynamic function to
check for the experimental flags and only show the enabled Grease Pencil
object types. It does not currently exclude unsupported type
combinations.

Pull Request: https://projects.blender.org/blender/blender/pulls/122304
2024-05-27 15:27:36 +02:00
Jeroen Bakker
854dc30c63 Fix 122018: EEVEE-Next crashes on Intel
Intel drivers do not follow the OpenGL standards for barriers. Although
the barriers are in balance for any thread, they need to be in a simple
for-loop in order to not crash on intel.

Recently the sun light extraction added new barriers that needed to be
adapted. We also reviewed all barriers to find faulty code-paths.

Previously we were able to change the for-loop with an index based loop.
But for more complex shaders this trick didn't work anymore and the loop
didn't seem to be unrolled anymore. `eevee_reflection_probe_remap_comp.glsl`
has more complexity due to the recent sun light extraction. For this shader
we manually did the unrolling.

**Compatibility**
- This PR was tested with success on Windows/OpenGL and Apple/Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/122308
2024-05-27 15:20:48 +02:00
Bastien Montagne
a367cf664e Fix (unreported) I18N extraction tooling fully broken by some new strings in code.
Strings built by concatenating literals and pre-processor-defined
strings would lock the code extracting them for i18n forever.

This commit 'fixes' the issue by adding some support for these cases in
the `inbetween` regex snippet part of the 'extract string' complex regex
system, to avoid the lock.

The code has no way currently to extract the value of these defines
though, so they should not be used in translated strings.

NOTE: PR !122283 should do a propoer fix to these issues, by refactoring
the string building such that only actual strings pieces get processed
by the translation code.
2024-05-27 14:48:09 +02:00
Lukas Tönne
aa88ced5c2 GPv3: Render boundary strokes with half width to hide gaps on boundaries
The leak detection filter in the fill tool flood-fill method can cause
gaps between filled areas and boundary strokes. This is undesirable, so
the boundary stroke radius is scaled by half for drawing, typically
creating enough overlap between boundaries and the generated fill
strokes to hide artifacts. This behavior is copied from GPv2.

Pull Request: https://projects.blender.org/blender/blender/pulls/122307
2024-05-27 14:43:58 +02:00
Lukas Tönne
dbe39fb202 Fix memory leak when copying materials from evaluated data.
The materials array was being allocated even when `eval_totcol` is zero.
The material code assumes that the array is nullptr when totcol is zero
and would leak that memory. Only allocate the array when the material
count is greater than zero.
2024-05-27 14:27:42 +02:00
Damien Picard
388855132e Fix #115542: Update space when selection end has moved after script error
When an error occurs in the text editor the cursor moves to the
location of the error and selects the word there. However the text
space is only updated if the current cursor position moved, not if the
selection end did. So if the cursor is already at the end of the word,
it looks like nothing has changed while under the hood the word has
been selected.

This commit simply checks whether the selection has moved and updates
the space if so.

Pull Request: https://projects.blender.org/blender/blender/pulls/121658
2024-05-27 14:05:29 +02:00
Philipp Oeser
6256e2a838 Fix #122150: UI: layout.template_search() crash without an active item
`template_search` was introduced in c20c203b8226

Seems it assumed an active item is always there.
Without an active item, we are running into a crash trying to get the
textbut width.

So solution is to not draw that text button at all until an active item
is chosen.

This also goes in line with what `template_ID` is doing (it also skips
the text button without an active item).

Pull Request: https://projects.blender.org/blender/blender/pulls/122165
2024-05-27 14:04:32 +02:00
Philipp Oeser
c7dae7e455 Fix #122217 : Datablock Pointers id_properties_ui().update() crashes
It would crash with no `id_type` specified.

Custom Properties Datablock Pointers were introduced in the UI in
b3c7f3c8a9eb.

When created via python, we dont enforce a `id_type`, when done via the
UI, this should be set though. However, I think when using `update()`,
the `id_type` is optional, so should be possible to just change the
`description` for example and leave the type untouched.

Code was trying to get the id type from the string passed in (None in
this case) and crashed somewhere along the way of
`pyrna_enum_value_from_id` which such NULL string.

So to resolve, just leave the `id_type` untouched if nothing is
specified here.

Pull Request: https://projects.blender.org/blender/blender/pulls/122306
2024-05-27 14:04:00 +02:00
Pratik Borhade
f9e42519ae Fix: Operator search crash when no asset library is present
Appears to be due to missing null check. `filelist->asset_library` is
null if no file path is selected for user library.

Pull Request: https://projects.blender.org/blender/blender/pulls/122134
2024-05-27 13:45:36 +02:00
Sebastian Parborg
241c19a57a Add "Only project onto selected" for curve, GP3, and annotation drawing
Implementation of the proposal in: #121535

When drawing with "project to surface" turned on, it is now possible to restrict the projection to only the selected objects.
This is really useful for drawing onto surfaces that has a lot of detail meshes that you don't want to project onto.
2024-05-27 13:37:36 +02:00
Bastien Montagne
435b6743fd Fix #121733: Linked masks/moviclips/images used by editors get lost on file reload.
This was a consequence of the work done in #106321, where this specific
'active in UI' case was not identified and properly handled.

Now, consider most ID usages from UI (editors) as 'weak links', i.e.
keep a reference to these IDs even if they are only indirectly used.

Note that missing weak links will not create placeholders if the source
data is not found in the library anymore on load. they are just silently
dropped.

Pull Request: https://projects.blender.org/blender/blender/pulls/122207
2024-05-27 13:35:53 +02:00
Damien Picard
446a653cb7 I18n: improve add-on translation tooling
- Allow versions from bl_info to be strings
  Versions are now allowed to be strings in extensions using
  blender_manifest.toml, so this commit prevents them from being badly
  formatted on extraction to add-on translations.

- Do not export Blender copyright text to add-on translations
  This text is only relevant for Blender and maybe core add-ons, not
  for the general case.

- Copy comment lines from add-on .po files to .py translations
  Without this comments added by translators could be lost since they
  were not copied over to the Python files.

- Fix indentation in add-on translations
  Some lines in the translation dict were off by a few spaces. This
  resulted in linting tools complaining about the indentation.

- Do not escape messages in add-on translations multiple times
  When extracting add-on messages, they would get escaped multiple
  times, resulting in invalid strings when they contained quotes for
  example.

  This happened because on updating the messages from the ref
  ones (those actually extracted from Blender), each ref I18nMessage
  would be assigned to the corresponding language I18nMessage, without
  copy. When this message was escaped, it happened once for every
  language since they were actually the same object.

  To avoid this, I18nMessage objects are copied when merging.

-----

Example tuple before PR:
```python
translations_tuple = (
    (("*", ""),
     ((), ()),
     ("fr_FR", "Project-Id-Version: AnimAll 0...1.1...0 (0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2024-05-26 17:10+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit",
               (False,
                ("Blender's translation file (po format).",
                 "Copyright (C) 2024 The Blender Authors.",
                 "This file is distributed under the same license as the Blender package.",
                 "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
    ),
    (("*", "\\"Location\\" and \\"Shape Key\\" are redundant?"),
     (("extensions/user_default/animall/__init__.py:250",),
      ()),
     ("fr_FR", "",
               (False, ())),
    ),
    ...
```

After:
```python
translations_tuple = (
    (("*", ""),
     ((), ()),
     ("fr_FR", "Project-Id-Version: AnimAll 0.11.0 (0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2024-05-26 17:06+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit",
      (False, ("FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.",))),
     ),
    (("*", "\"Location\" and \"Shape Key\" are redundant?"),
     (("extensions/user_default/animall/__init__.py:250",),
      ()),
     ("fr_FR", "",
      (False, ())),
     ),
    ...
```

Pull Request: https://projects.blender.org/blender/blender/pulls/122273
2024-05-27 13:33:49 +02:00
Sergey Sharybin
f74d32e17f Python API: Expose list of running modal operators
It is accessible via window.modal_operators, and is a collection of
elements of type Operator.

It allows to implement key and operator capture overlay without need
to do low-level ctype style of access to internal data.

Pull Request: https://projects.blender.org/blender/blender/pulls/122193
2024-05-27 13:04:15 +02:00
Alaska
9bbc12559f Gitea: Adjust Report a Bug wording in issue template
Pull Request: https://projects.blender.org/blender/blender/pulls/122166
2024-05-27 13:00:14 +02:00
Hoshinova
de6ff6eb0a Fix #121969: Noise texture outputs 0 with coordinates beyond 8.40*10^6
One of the properties of Perlin noise is that it always evaluates to 0.0
when not normalized (or 0.5 when normalized) when the input consists of
only whole integers in all vector components.

Blender's Perlin noise implementation uses single precision floats with
a machine epsilon of 1.19e-07 meaning that for numbers that are greater
than 1/(1.19e-07) = 8.40e6 there mantissa doesn't have any bits left to
store a rational part of the number, effectively meaning that any number
greater than 8.40e6 is a whole integer as far as Blender is concerned.
Therefore when evaluating Perlin noise for any coordinates greater than
that it always results in 0.0 (or 0.5 when normalized).

This fix works as follows: If the original input number is larger than
1.0e6 it is offset by 0.5 after it underwent modulo, which always outputs
numbers in a [0.0, 1.0e5) range leaving the mantissa room for a rational
part. This way the quantization error still persists however the outputs
are random again instead of a constant 0.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/122112
2024-05-27 12:48:15 +02:00
Brecht Van Lommel
e7489664ce Fix: Assert about invalid namemap with brush assets
Linking a datablock from a library does not update the namemap, but
there is an assert added in 47672bd06a4c that checks this at the end
of library linking.

Usually it does not trigger because the namemap does not exist, and it
is cleared at the end of the process. Now clear it earlier, at the
moment the namemap becomes invalid.

Pull Request: https://projects.blender.org/blender/blender/pulls/122182
2024-05-27 12:43:43 +02:00
Brecht Van Lommel
d32a10e6ff Fix #122305: Crash generating API docs for node socket defaults
For the case of documenting node socket classes generically, there is no
specific socket instance to get the default value from.
2024-05-27 12:40:26 +02:00
Brecht Van Lommel
97acee6e68 Cleanup: make format 2024-05-27 12:24:16 +02:00
Brecht Van Lommel
6efd7a6a50 Operators: Add option to give a modal operator priority in event handling
This may be used by add-ons like screencast keys, to log events before a
modal operator like transform handles them.

Pull Request: https://projects.blender.org/blender/blender/pulls/122226
2024-05-27 12:06:01 +02:00