Commit Graph

15950 Commits

Author SHA1 Message Date
Dalai Felinto
d4e638baac User Interface: Re-organization of Geometry Nodes Add Node Menu
The menus are growing too large. This patches move some categories under
sub-menus, and shuffle some entries around.

We already had sub-categories split by separators. This change now
goes a step further and embrace 3-level menus.

Inspired by the "Simpler Add Menu" add-on by Quackers (waiting to hear
back to know Quackers real name).

Inspired by the "Simpler Add Menu" add-on by Alfonso Martinez II.

Differential Revision: https://developer.blender.org/D16993
2023-01-13 16:31:27 +01:00
Joseph Eagar
daedf19315 Sculpt: Fix T103724: missing mask attr existance check for PBVH_GRIDS 2023-01-12 23:58:00 -08:00
Christoph Lendenfeld
ed178f5ff5 Fix: Potential divide by 0 using GRAPH_OT_ease
In case there is only 1 key on the FCurve,
the operator can run into a situation where it divides by 0.
It now skips the curve in that case

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16982
Ref: D16982
2023-01-12 12:54:27 +01:00
Joseph Eagar
88e9826529 Sculpt: Fix T102889: Sculpt trim tool extrudes in perspective
Added an extrude mode enum to the trim operators to
control extrusion: "project" and "fixed."  "Fixed" just
extrudes along a fixed normal and is the new default.
2023-01-11 09:57:58 -08:00
Campbell Barton
12a26b8fe3 Cleanup: format 2023-01-11 13:04:23 +11:00
Damien Picard
30c90f0ad0 Cleanup: Replace "UV's" with "UVs"
An apostrophe should not be used because it is not a mark of plural,
even for initialisms. This involves mostly comments, but a few UI
messages are affected as well.

Differential Revision: https://developer.blender.org/D16749
2023-01-10 14:50:13 -05:00
Pratik Borhade
6f38ce5a40 Fix T103679: Add missing operators in object context menu for point cloud and curves
Set origin and convert operator now accepts point cloud and new curve
object. But these operators were not added in context menu.
Support for set origin and convert operator was added in
rBadb4dd911b91, rB933d56d9e98d and rB2752a88478a8

Reviewed by: HooglyBoogly

Differential Revision: https://developer.blender.org/D16939
2023-01-10 15:27:57 +05:30
Martijn Versteegh
6c774feba2 Mesh: Move UV layers to generic attributes
Currently the `MLoopUV` struct stores UV coordinates and flags related
to editing UV maps in the UV editor. This patch changes the coordinates
to use the generic 2D vector type, and moves the flags into three
separate boolean attributes. This follows the design in T95965, with
the ultimate intention of simplifying code and improving performance.

Importantly, the change allows exporters and renderers to use UVs
"touched" by geometry nodes, which only creates generic attributes.
It also allows geometry nodes to create "proper" UV maps from scratch,
though only with the Store Named Attribute node for now.

The new design considers any 2D vector attribute on the corner domain
to be a UV map. In the future, they might be distinguished from regular
2D vectors with attribute metadata, which may be helpful because they
are often interpolated differently.

Most of the code changes deal with passing around UV BMesh custom data
offsets and tracking the boolean "sublayers". The boolean layers are
use the following prefixes for attribute names: vert selection: `.vs.`,
edge selection: `.es.`, pinning: `.pn.`. Currently these are short to
avoid using up the maximum length of attribute names. To accommodate
for these 4 extra characters, the name length limit is enlarged to 68
bytes, while the maximum user settable name length is still 64 bytes.

Unfortunately Python/RNA API access to the UV flag data becomes slower.
Accessing the boolean layers directly is be better for performance in
general.

Like the other mesh SoA refactors, backward and forward compatibility
aren't affected, and won't be changed until 4.0. We pay for that by
making mesh reading and writing more expensive with conversions.

Resolves T85962

Differential Revision: https://developer.blender.org/D14365
2023-01-10 01:01:43 -05:00
Hans Goudey
1af62cb3bf Mesh: Move positions to a generic attribute
**Changes**
As described in T93602, this patch removes all use of the `MVert`
struct, replacing it with a generic named attribute with the name
`"position"`, consistent with other geometry types.

Variable names have been changed from `verts` to `positions`, to align
with the attribute name and the more generic design (positions are not
vertices, they are just an attribute stored on the point domain).

This change is made possible by previous commits that moved all other
data out of `MVert` to runtime data or other generic attributes. What
remains is mostly a simple type change. Though, the type still shows up
859 times, so the patch is quite large.

One compromise is that now `CD_MASK_BAREMESH` now contains
`CD_PROP_FLOAT3`. With the general move towards generic attributes
over custom data types, we are removing use of these type masks anyway.

**Benefits**
The most obvious benefit is reduced memory usage and the benefits
that brings in memory-bound situations. `float3` is only 3 bytes, in
comparison to `MVert` which was 4. When there are millions of vertices
this starts to matter more.

The other benefits come from using a more generic type. Instead of
writing algorithms specifically for `MVert`, code can just use arrays
of vectors. This will allow eliminating many temporary arrays or
wrappers used to extract positions.

Many possible improvements aren't implemented in this patch, though
I did switch simplify or remove the process of creating temporary
position arrays in a few places.

The design clarity that "positions are just another attribute" brings
allows removing explicit copying of vertices in some procedural
operations-- they are just processed like most other attributes.

**Performance**
This touches so many areas that it's hard to benchmark exhaustively,
but I observed some areas as examples.
* The mesh line node with 4 million count was 1.5x (8ms to 12ms) faster.
* The Spring splash screen went from ~4.3 to ~4.5 fps.
* The subdivision surface modifier/node was slightly faster
RNA access through Python may be slightly slower, since now we need
a name lookup instead of just a custom data type lookup for each index.

**Future Improvements**
* Remove uses of "vert_coords" functions:
  * `BKE_mesh_vert_coords_alloc`
  * `BKE_mesh_vert_coords_get`
  * `BKE_mesh_vert_coords_apply{_with_mat4}`
* Remove more hidden copying of positions
* General simplification now possible in many areas
* Convert more code to C++ to use `float3` instead of `float[3]`
  * Currently `reinterpret_cast` is used for those C-API functions

Differential Revision: https://developer.blender.org/D15982
2023-01-10 00:10:43 -05:00
Bastien Montagne
4887401789 Usual UI messages and i18n fixes and tweaks. 2023-01-09 09:20:37 +01:00
Aaron Carlisle
01efcb3de2 Update RNA to User manual mappings 2023-01-06 16:29:48 -05:00
Omar Emara
0bf8b98437 Realtime Compositor: Move out of experimental
This patch moves the realtime compositor out of experimental. See
T99210.

The first milestone is finished with regards to implementing most
essential nodes for single pass compositing. It is also now documented
in the manual and no major issues are known.

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

Reviewed By: Clement Foucault
2023-01-06 14:50:39 +02:00
Christoph Lendenfeld
825f01b7b5 Animation: Remove While Held Pose propagate option
The "While Held" option from the Pose Propagate Operator
doesn't do anything meaningful.
After talking with the Animation Module it was decided to remove it.

In code it was called `POSE_PROPAGATE_SMART_HOLDS`

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16771
Ref: D16771
2023-01-06 13:24:36 +01:00
Campbell Barton
706b13959e Cleanup: use double-quotes for non-enum strings 2023-01-06 14:00:36 +11:00
Christoph Lendenfeld
76a68649c1 Animation: Graph Editor Ease operator
Added a new operator that aligns selected keys on an exponential curve

Revied by Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9479
Ref: D9479
2023-01-05 10:11:24 +01:00
YimingWu
168091a1d6 Cleanup: Missing debug #ifdef for GPU_vertbuf_raw_step 2023-01-05 11:01:32 +08:00
Hans Goudey
7355d64f2b Node Editor: Paste nodes on mouse position
When pasting nodes with the shortcut or the context menu, place the
center of the selected nodes at the same position as the mouse cursor.
This should save time, and is more intuitive because the new nodes are
actually visible.

Based on a patch by Juanfran Matheu (@jfmatheu).

Differential Revision: https://developer.blender.org/D10787
2023-01-03 14:27:57 -05:00
Campbell Barton
896ad9d5d0 Cleanup: avoid F-string use in startup scripts 2023-01-03 13:26:33 +11:00
Campbell Barton
75cd1fdc0a Cleanup: format 2023-01-03 11:03:50 +11:00
Sergey Sharybin
68906c605f Fix T103080: Regression: Setup tracking scene is disabled
There are two underlying issues which got uncovered by the report:

First, is that the poll() function for the operator was using legacy
API which is on its way of removal in the next major version release.

This part is fixed in this patch based on a patch provided by Philipp
Oeser (P3389) with the modification that the `clip` is not accessed
prior to None check. Ended up in a bit annoying one-liner, the entire
function could be refactored to use early returns.

The second issue is that the Python access to the legacy property
was wrong: need to access camera reconstruction instead of accessing
deprecated DNA field.
2023-01-02 12:44:10 +01:00
Kevin C. Burke
614704f90c GPencil: Removing 'Only Show Selected' Requirement for DOPESHEET_HT_editor_buttons
It's confusing for users when the Dopesheet's Editor Buttons for Grease Pencil are greyed out.
{F14099985}

[[ https://blenderartists.org/t/cant-create-new-layers-in-grease-pencil-dopesheet/1353882 | Can’t create new layers in grease pencil dopesheet ]]

This is often because the 'Only Show Selected' filter is disabled. This 'requirement' does not seem to be necessary since the Dopesheet is already in Grease Pencil mode and there is an active Grease Pencil Object. It is also not apparent as to why so many Operators depend on it and unintuitive that it controls their function. The 'Only Show Selected' filter button is far away from the Operator buttons in the User Interface Header, so it's difficult to make the association.

If the 'Only Show Selected' IS absolutely required, I believe it should be closer to the DOPESHEET_HT_editor_buttons. Otherwise, I think the requirement should be removed.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16885
2022-12-31 16:26:39 +01:00
Kevin C. Burke
17d66fe79e GPencil: 'Delete Duplicate Keyframes' in GPENCIL_MT_cleanup Menu
The command text 'Delete Duplicated Frames' used in the `GPENCIL_MT_cleanup` menu is not correct grammar for what the command does. Keyframes removed by this command may be duplicate keys without having been duplicated. It also does not match the name of the command in `DOPESHEET_MT_context_menu`.
[[ https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_ui/space_dopesheet.py$676 | space_dopesheet.py ]]

This patch fixes the grammar, gets the command's text to match the `DOPESHEET_MT_context_menu`, and corrects the description in the [[ https://docs.blender.org/api/current/bpy.ops.gpencil.html#bpy.ops.gpencil.frame_clean_duplicate | Python API documentation ]].

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16887
2022-12-31 16:25:16 +01:00
Aleš Jelovčan
f53bb93af9 GPencil: Rename popup on Change active layer -> New Layer
This patch adds rename popup when using Y key to switch 
active layer and choosing New layer in Draw mode.
It follows https://developer.blender.org/D15092, which introduced this 
for moving selected strokes to layers in Edit mode.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D16877
2022-12-29 16:12:20 +01:00
Antonio Vazquez
6aad3c7297 GPencil: Show Display Cursor popover for Eraser
The Eraser tool was not showing the display cursor popover.

This commit fixes this inconsistency.
2022-12-27 16:45:17 +01:00
Antonio Vazquez
a2cf9a8647 GPencil: Display real brush cursor size always
Remove the option to display the real size of the cursor
and set as default. Now the cursor is displayed or not using
show_cursor option, but if it's displayed always use the real size.
2022-12-27 10:26:28 +01:00
Joseph Eagar
dce7917717 Sculpt: Invert Expand behavior for masking consistency
This patch makes sure that each of the expand keymap entries will use consistent "invert" and "use_mask_preserve" properties.

Based on previous discussions we decided to flip the default Mask Expand behavior.
This has multiple benefited:

- The mask creation is more consistent with other masking tools (Always add to existing mask. Mask selected areas)
- It's easier to use expanding for masking face sets (Snapping with `Ctrl`) or building a mask from repeated operations
- It's less likely to mask certain areas unintentionally (Loose mesh islands)
- If the current behavior is desired for an expand operation the user can use `E` & `F` in the modal keymap (Which is less often the case).

If we want to revisit the original design of inverted masking again in the future we should do this via {T97903}.

Reviewed By: Joseph Eagar
Differential Revision https://developer.blender.org/D16434
Ref D16434
2022-12-26 21:46:33 -08:00
Hans Goudey
00b3f863b8 Curves: Remove option to disable selection
Remove the redundant option to disable selection in order to simplify
the tools and UI, both conceptually and internally.

It was possible to disable curves selection completely by clicking on
the active selection domain. However, that was redundant compared to
just selecting everything by pressing "A". The remaining potential use
could have been saving a selection for later, but that can be done with
more complete attribute editing tools in the future.
2022-12-24 16:09:40 -05:00
Aaron Carlisle
014d0a8ede Update RNA to User manual mappings 2022-12-23 19:00:02 -05:00
Aaron Carlisle
fea60eccbf UI: Remove unused light object panel
This panel showed a duplication of options that were in the main light panel and only mistakenly shows up in the workbench engine where lights should have no options.

This panel was also used by the POV-Ray add-on but that was removed recently.
2022-12-23 18:58:48 -05:00
Sietse Brouwer
a44c128482 GPencil: show brush size in Draw tool cursor
When drawing strokes in Grease Pencil, it was always a bit hard
to predict how thick the strokes would be, because there was
no visual reference of the thickness in the cursor.
This patch adds that visual reference. It shows the brush size
as a circle in the draw cursor.
Showing the brush size can be toggled in the Cursor menu
of the Grease Pencil draw tool.

Request in RCS with 26 upvotes for this option:
https://blender.community/c/rightclickselect/0zfbbc

On the technical side: the brush size is calculated
in 3D space and takes zoom level into account, as well as
object/layer transfrom, layer thickness change (gpl->line_change)
and thickness scale (gpd->pixfactor).

Reviewed By: mendio, antoniov

Differential Revision: https://developer.blender.org/D16851
2022-12-23 16:02:54 +01:00
Dalai Felinto
a8aae66f0e Asset Browser: New catalog menu
This replaces the old Edit menu, creating a menu only for catalog
operators. The Undo/Redo were already working only for catalogs, so now
this is more clear.

The menu also contains the Save and New catalog operators.

Differential Revision: https://developer.blender.org/D16820
2022-12-23 11:31:38 +01:00
Joseph Eagar
f803a0a95b Sculpt: Fix T103341: Move sculpt overlay flags to View3DOverlay.flag
"Show mask" and "Show face sets" were being stored in
`Sculpt`, yet their opacities are in `View3dOverlay`.
Now `View3DOverlay` has the flags too.
2022-12-22 16:56:50 -08:00
dc30c9971d Anim: clarify the "Clear Motion Paths" operators
Make the "Clear Motion Paths" operators more intuitive. Previously, the
only way to clear the motion path of the selected object/bone would be
to shift-click the "Clear ALL Motion Paths" button. Now there are two
"X" buttons, one for "selected" and one for "all".

The "Clear Selected" and "Clear All" buttons align with the
corresponding "Update Selected" and "Update All" buttons.
2022-12-22 12:46:19 +01:00
4d22a517c9 Cleanup: animation, refactor motion paths UI code
Simplify the UI code for the motion paths properties panel.

No functional changes.
2022-12-22 12:38:46 +01:00
b617ddc004 Anim: rearrange the motion paths panel
Move the "Calculation Range" property above the "Frame Range" properties,
as you have to select the former before adjusting the latter.
2022-12-22 11:10:35 +01:00
Jeroen Bakker
f4b03031e8 GPU: Select GPU Backend from Preferences.
(MacOS) only: In the System tab of the user preferences the user has the
ability to select a GPU backend that Blender will use. After changing
the GPU backend setting, the user has to restart Blender before the
setting is used.

It was added to start collecting feedback on the Metal backend without
using the command lines.

By default Blender will select OpenGL as backend. When Metal is selected
(via `--gpu-backend metal` or via user preferences) OpenGL will be used as
fallback when the platform isn't capable of running Metal.
2022-12-21 20:54:36 +01:00
Campbell Barton
5a761a47e1 Cleanup: replace StringIO seek() & read() with a call to getvalue() 2022-12-18 14:18:01 +11:00
Hans Goudey
ae886596a0 Nodes: Allow skipping node attachment after dragging
This patch allows skipping the automatic insertion of nodes on top of
links when the transform operator ends. When putting nodes into small
spaces this often gets in the way and wastes time. Now, when holding
`alt`, this is turned off.

The header text is also improved to add this shortcut and to remove
the Dx and Dy values and improve the formatting a bit.

Making this functionality optional might allow us to use it in more
places in the future, like for the nodes added by link-drag-search.

Differential Revision: https://developer.blender.org/D16230
2022-12-15 14:21:35 -06:00
Campbell Barton
7571222a69 Cleanup: add trailing commas for multi-line collections
Avoid accidentally missing commas between strings, see: T101020.
Also use single quotes for enum identifiers.
2022-12-15 17:34:09 +11:00
Campbell Barton
2dd27d5f06 Cleanup: remove function for accessing supported add-ons
This was only called once in a situation where such functions
are typically used as a dynamic enum callbacks.

Prefer keeping the items close to the EnumProperty definition &
avoid the need to note why this is a special case that doesn't follow
the common pattern for enum callbacks.
2022-12-15 09:46:14 +11:00
Campbell Barton
e476afff41 Cleanup: format 2022-12-15 09:37:02 +11:00
Campbell Barton
d173a52f56 Cleanup: doc-strings and minor changes to anim_utils.py
- Follow sphinx conventions for doc-strings.
- Use __slots__ for KeyframesCo as dynamically assigning new members
  isn't needed.
- Import from bpy.types instead of assigning.
- Split typing imports across multiple lines as they tend to become
  quite large.
2022-12-15 09:34:00 +11:00
Campbell Barton
2d21fc3f5d Cleanup: avoid multiplying lists multiple times
Parenthesis are important in this case to avoid creating a list with
multiplication, then multiplying it again.

Oversight in 58c8c4fde35c158407ca2ba0c0bc099d1455f691.
2022-12-15 09:34:00 +11:00
Thomas Dinges
e8c7866608 Add-ons: Exclude contrib for beta, rc and release builds.
* Make it clearer that contrib isn't shipped with releases, by already excluding it in beta.
* Improve the UI by hiding the "Testing" enum item in these case.

Differential Revision: https://developer.blender.org/D16729
2022-12-13 11:12:36 +01:00
d72c7eefd1 Fix T101522: Animation: motion path range overwritten by 'Update Paths'
Expand the motion path frame range options with an extra option "Manual
Range". When chosen, Blender will not automatically update the path
range any more.

Additionally, the start/end frame fields are greyed out in the UI when
one of the automatic range options is selected (i.e. all but the new
"Manual Range" one). It is still possible to set the start/end frame
temporarily, but the original behaviour (of recomputing those on update)
remains.

Manifest Task: T101522
2022-12-12 17:36:36 +01:00
Damien Picard
19d90c7a33 UI: fix several labels and tooltips
See the differential revision for details about each change.

Differential Revision: https://developer.blender.org/D15608
2022-12-09 16:10:14 -06:00
Iliya Katueshenock
a3251e66a7 Geometry Nodes: Image Input Node
Add a simple node to choose an image data-block.

Ref T102854

Differential Revision: https://developer.blender.org/D16644
2022-12-09 16:10:14 -06:00
Damien Picard
538d4cc998 UI: Fix and improve various labels and tooltips
Improve a few messages, but mostly fix typos in many areas of the UI.
See inline comments in the differential revisiion for the rationale
behind the various changes.

Differential Revision: https://developer.blender.org/D16716
2022-12-09 16:10:14 -06:00
Aaron Carlisle
508815cc71 UI: Correct improper capitalization
Fixes T103034
2022-12-08 11:26:31 -06:00
Joseph Eagar
8e46ef2fa5 Sculpt: Fix crash when sculpting after disabling dyntopo
Attributes weren't being reinitialized properly.
2022-12-08 04:40:42 -08:00
Iliya Katueshenock
d68c47ff34 Geometry Nodes: new Blur Attribute node
The Blur Attribute node mixes values of neighboring elements in meshes and curves.

Currently it supports points, edges and faces on meshes and points on curves.
In theory, support for face corners could be added, but useful semantics are not
obvious yet.

The node calculates a weighted average of each element with its neighbors (based
on curve/mesh topology). The weight of the element itself is always 1, and the weight
of the neighbor elements is controlled by the weight input socket. In the future,
more options for how different elements are weight can be added (e.g. smoothing
groups and selection).

The node can perform multiple blurring iterations to achieve a blurrier result.
Generally, it is better to do multiple iterations in one node instead of using
multiple blur nodes because it has better performance in the current implementation.

We use the term "Blur" (instead of "Smooth") because smoothing is generally more
related to removing roughness from surfaces. When viewing the result of the
Blur Attribute node in the viewport, it looks like an image is blurred. While the
node can also be used to smooth surfaces, other/better algorithms exists for that
purpose (which e.g. don't reduce the volume of the mesh to zero with too many
iterations).

Differential Revision: https://developer.blender.org/D13952
2022-12-07 18:22:44 +01:00
Weizhen Huang
53ef52f165 Cycles: improve sampling of ellipse area light with spread
**Problem**:
Area lights in Cycles have spread angle, in which case some part of the area light might be invisible to a shading point. The current implementation samples the whole area light, resulting some samples invisible and thus simply discarded. A technique is applied on rectangular light to sample a subset of the area light that is potentially visible (rB3f24cfb9582e1c826406301d37808df7ca6aa64c), however, ellipse (including disk) area lights remained untreated. The purpose of this patch is to apply a techniques to ellipse area light.
**Related Task**:
T87053
**Results**:
These are renderings before and after the patch:
|16spp|Disk light|Ellipse light|Square light (for reference, no changes)
|Before|{F13996789}|{F13996788}|{F13996822}
|After|{F13996759}|{F13996787}|{F13996852}
**Explanation**:
The visible region on an area light is found by drawing a cone from the shading point to the plane where the area light lies, with the aperture of the cone being the light spread.
{F13990078,height=200}
Ideally, we would like to draw samples only from the intersection of the area light and the projection of the cone onto the plane (forming a circle). However, the shape of the intersection is often irregular and thus hard to sample from directly.
{F13990104,height=200}
Instead, the current implementation draws samples from the bounding rectangle of the intersection. In this case, we still end up with some invalid samples outside of the circle, but already much less than sampling the original area light, and the bounding rectangle is easy to sample from.
{F13990125}
The above technique is only applied to rectangle area lights, ellipse area light still suffers from poor sampling. We could apply a similar technique to ellipse area lights, that is, find the
smallest regular shape (rectangle, circle, or ellipse) that covers the intersection (or maybe not the smallest but easy to compute).
For disk area light, we consider the relative position of both circles. Denoting `dist` as the distance between the centre of two circles, and `r1`, `r2` their radii. If `dist > r1 + r2`, the area light is completely invisible, we directly return `false`. If `dist < abs(r1 - r2)`, the smaller circle lies inside the larger one, and we sample whichever circle is smaller. Otherwise, the two circles intersect, we compute the bounding rectangle of the intersection, in which case `axis_u`, `len_u`, `axis_v`, `len_v` needs to be computed anew. Depending on the distance between the two circles, `len_v` is either the diameter of the smaller circle or the length of the common chord.
|{F13990211,height=195}|{F13990225,height=195}|{F13990274,height=195}|{F13990210,height=195}
|`dist > r1 + r2`|`dist < abs(r1 - r2)`|`dist^2 < abs(r1^2 - r2^2)`|`dist^2 > abs(r1^2 - r2^2)`
For ellipse area light, it's hard to find the smallest bounding shape of the intersection, therefore, we compute the bounding rectangle of the ellipse itself, then treat it as a rectangle light.
|{F13990386,height=195}|{F13990385,height=195}|{F13990387,height=195}
We also check the areas of the bounding rectangle of the intersection, the ellipse (disk) light, and the spread circle, then draw samples from the smallest shape of the three. For ellipse light, this also detects where one shape lies inside the other. I am not sure if we should add this measure to rectangle area light and sample from the spread circle when it has smaller area, as we seem to have a better sampling technique for rectangular (uniformly sample the solid angle). Maybe we could add [area-preserving parameterization for spherical
ellipse](https://arxiv.org/pdf/1805.09048.pdf) in the future.
**Limitation**:
At some point we switch from sampling the ellipse to sampling the rectangle, depending on the area of the both, and there seems to be a visible line (with |slope| =1) on the final rendering
which demonstrate at which point we switch between the two methods. We could see that the new sampling method clearly has lower variance near the boundaries, but close to that visible line,
the rectangle sampling method seems to have larger variance. I could not spot any bug in the implementation, and I am not sure if this happens because different sampling patterns for ellipse and rectangle are used.
|Before (256spp)|After (256spp)
|{F13996995}|{F13996998}

Differential Revision: https://developer.blender.org/D16694
2022-12-07 18:21:55 +01:00
Ray Molenkamp
388bbc3290 Build: library updates for Blender 3.5
This updates the libraries dependencies for VFX platform 2023, and adds various
new libraries. It also enables Python bindings and switches from static to
shared for various libraries.

The precompiled libraries for all platforms will be updated to these new
versions in the coming weeks.

New:

Fribidi 1.0.12
Harfbuzz 5.1.0
MaterialX 1.38.6 (shared lib with python bindings)
Minizipng 3.0.7
Pybind11 2.10.1
Shaderc 2022.3
Vulkan 1.2.198

Updated:

Boost 1.8.0 (shared lib)
Cython 0.29.30
Numpy 1.23.2
OpenColorIO 2.2.0 (shared lib with python bindings)
OpenImageIO 2.4.6.0 (shared lib with python bindings)
OpenSubdiv 3.5.0
OpenVDB 10.0.0 (shared lib with python bindings)
OSL 1.12.7.1 (enable nvptx backend)
TBB (shared lib)
USD 22.11 (shared lib with python bindings, enable hydra)
yaml-cpp 0.8.0

Includes contributions by Ray Molenkamp, Brecht Van Lommel, Georgiy Markelov
and Campbell Barton.

Ref T99618
2022-12-07 15:28:17 +01:00
Ray Molenkamp
6d27a2ff76 Windows: install shared libraries in blender.shared
Instead of the the same folder as the Blender executable, generate a manifest
that lets us move the libraries out of the way of users and into a separate
folder.

Ref T99618
2022-12-07 15:28:17 +01:00
48b5dcdbe8 Animation: Removal of most of the old pose library
Remove most of the old (pre-3.0) pose library:

- Remove The entire `editors/armature/pose_lib.c` file
- Deprecate `Object::poselib` in DNA
- Remove Operators marked as deprecated in T93405
- Remove RNA property `Object.pose_library`
- Add comment to clarify that the call `BLO_read_id_address(reader,
  ob->id.lib, &ob->poselib);` handles deprecated data.

Note that this functionality has been documented as deprecated since
Blender 3.2.

What remains of the old pose library: The DNA for action markers
(`bAction::markers`) and the corresponding Python API. This will allow
future versions of Blender to still convert old pose libraries to new
ones (via the Pose Library panel in the Action editor).

Manifest task: T93406
2022-12-06 18:37:10 +01:00
Thomas Dinges
adea6681c0 Merge branch 'blender-v3.4-release' 2022-12-06 16:35:44 +01:00
Thomas Dinges
212b054bb3 Update freedesktop file with Blender 3.4 features. 2022-12-06 16:34:53 +01:00
Philipp Oeser
997ff54d30 Fix: UI: broken texpaintslot/color attributes/attributes name filtering
rB8b7cd1ed2a17 broke this for the paint slots
rB4669178fc378 broke this for regular attributes

Name filtering in UI Lists works when:
- [one] the items to be filtered have a name property
-- see how `uilist_filter_items_default` gets the `namebuf`
- [two] custom python filter functions (`filter_items`) implement it
themselves
-- if you use `filter_items` and dont do name filtering there, the default
name filtering wont be used

So, two problems with rB8b7cd1ed2a17:
- [1] items to be listed changed from `texture_paint_images` to
`texture_paint_slots`
-- the former has name_property defined, the later lacks this
- [2] the new `ColorAttributesListBase` defined a `filter_items` function,
but did not implement name filtering

And the problem with rB4669178fc378:
- it added `filter_items` functions, but did not implement name filtering.

These are all corrected now.

Fixes T102878

Maniphest Tasks: T102878

Differential Revision: https://developer.blender.org/D16676
2022-12-06 11:09:28 +01:00
Dalai Felinto
ea14c48c09 Fix T102276: Hotkey conflict Alt D in Node Editor with Duplicate Linked and Detach
This unassign the Alt+D shortcut from the detach operator. Right now the
operator has to be accessed via the menu.

Alt+D is left for duplicate link, following the other editors.
2022-12-06 09:45:20 +01:00
Campbell Barton
cc6bdac921 Cleanup: format 2022-12-05 12:54:00 +11:00
Hans Goudey
ce16fa0f4c Fix: Node Editor: Hide compoitor-specific menu items
Previews and the "Read Viewlayers" operator are specific to the
compositor and shouldn't show in other node editor types.
2022-12-02 14:31:44 -06:00
Hans Goudey
6b7119f9ed Merge branch 'blender-v3.4-release' 2022-12-02 11:24:18 -06:00
Hans Goudey
99dc90accc Fix: Reversed attribute is_internal RNA property
`is_internal` is supposed to mean that the attribute shouldn't be
visible in lists or the spreadsheet by default, and that it can't be
accessed in geometry nodes. But the value was reversed, which
just happened to work because the list filtering was swapped.

Differential Revision: https://developer.blender.org/D16680
2022-12-02 11:21:54 -06:00
Bastien Montagne
ab8946f957 Merge branch 'blender-v3.4-release' 2022-12-02 16:48:09 +01:00
Bastien Montagne
e2f6fb5d35 i18n: Enable Finish language processing. 2022-12-02 16:28:53 +01:00
Thomas Dinges
0197b524e4 Update THIRD-PARTY-LICENSES.txt for Blender 3.4. 2022-12-02 00:38:23 -08:00
Joseph Eagar
46f991dbae Sculpt: Fix broken pivots when entering paint modes
When entering paint modes the paint pivot was cleared,
which broken rotate around pivot.  Fixed for all paint modes.
PBVH modes set the pivot to the PBVH bounding box
while texture paint uses the evaluated mesh bounding box.
2022-12-02 00:37:50 -08:00
Thomas Dinges
f95768d1e0 Update THIRD-PARTY-LICENSES.txt for Blender 3.4. 2022-12-01 15:21:43 +01:00
Hans Goudey
3cebc58936 Fix: Assert in subdivide curves node after span slicing change
a5e7657ceeb6cc5b6 missed this call where clamped slicing is necessary.
The subdivision of a segment purposefully modifies the handle types of
the other side of the following control point, but that didn't work for
the final cyclic segment.
2022-11-30 21:21:58 -06:00
Julian Eisel
ccc9eef1b9 Assets: Get asset path via new identifier (not via file browser hacks)
With the asset identifier introduced in the previous commit, we can now
locate an asset just from its `AssetRepresentation`, without requiring
information from the asset library and the file browser storage. With
this we can remove some hacks and function parameters. A RNA/BPY
function is also affected, but I didn't remove the paramter to keep
compatibility. It's simply ignored and not required anymore, noted this
in the parameter description (noted for T102877).
2022-11-30 19:44:34 +01:00
Christoph Lendenfeld
5c1cc79cf4 Fix T100879: Bake Action fails with "Nothing to Bake"
When applying the "Bake Action" operator in pose mode
it could throw an error saying "Nothing to Bake"
even though bones are selected

That is because the code was looking for a selected armature
But in Pose Mode, clicking into empty space to de-select would also
deselect the armature.
Then box selecting would not make the armature selected again

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16593
2022-11-30 17:24:14 +01:00
Christoph Lendenfeld
18de712257 Fix T100879: Bake Action fails with "Nothing to Bake"
When applying the "Bake Action" operator in pose mode
it could throw an error saying "Nothing to Bake"
even though bones are selected

That is because the code was looking for a selected armature
But in Pose Mode, clicking into empty space to de-select would also
deselect the armature.
Then box selecting would not make the armature selected again

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16593
2022-11-30 16:57:21 +01:00
Antonio Vazquez
56ae4089eb GPencil: Allow interpolation to use breakdown keyframe as extremes
Actually, the interpolation can be done only between keyframes different of breakdown type,
but in some cases, this is not convenient.

Now, a new option is displayed to allow the interpolation using breakdown keyframes
as interpolation extremes.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D16515
2022-11-28 19:32:18 +01:00
Colin Basnett
c47b6978e3 Animation: Make Bake Animation operator use preview range when enabled
This patch makes the Bake Actions operator fills the Start Frame & End From with that of the Preview Range if "Use Preview Range" is enabled.

{F13973619}

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16630
2022-11-28 08:04:21 -08:00
Alexander Gavrilov
d961119563 Python API Docs: document when fields use mathutils types.
When accessing certain structure fields from Python, they return
mathutils types instead of generic arrays (this is based on subtype).

This exposes this information in the Python API documentation.

Differential Revision: https://developer.blender.org/D16626
2022-11-28 00:33:41 +02:00
Philipp Oeser
3ccf4a3944 Merge branch 'blender-v3.4-release' 2022-11-27 12:41:42 +01:00
Philipp Oeser
ee56c46c15 Fix: greasepencil selection mask picking points not working
When in greasepencil sculpt-/vertexpaint mode and using selection
masking, picking points wasnt working correctly.

So regular gpencil.select (without modifier keys) was not enabled for the
keymap. This only really makes sense for RCS (right click select) atm
(and not using RC fallback tools - which I dont think are present in
these modes anyways). With RCS, this can be supported and afaict, this
does not cause conflicts.

NOTE: prior to D16576, one could use the ALT modifier key (this
combination was actually in the keymap) -- but it should select the
entire stroke, which is handled in D16576.

Differential Revision: https://developer.blender.org/D16577
2022-11-27 12:21:02 +01:00
Antonio Vazquez
1aff91b1a7 GPencil: Add Vertex Opacity Overlay parameter in Sculpt
This option was missing in overlay panel.
2022-11-26 15:39:59 +01:00
Yiming Wu
dad0f37c1e Fix T101824: Line art flickers when light object has scaling.
Line art doesn't expect light or camera objects to have scaling.
2022-11-25 22:21:26 +08:00
Yiming Wu
118afe1de3 Fix T101824: Line art flickers when light object has scaling.
Line art doesn't expect light or camera objects to have scaling.
2022-11-25 22:00:21 +08:00
Colin Basnett
58c8c4fde3 Animation: Improve performance of Bake Action operator
This dramatically improves baking performance by batch-adding keyframes
instead of adding them individually, reducing unnecessary overhead.

Testing indicates an approximate 4x performance uplift.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D8808
2022-11-24 11:26:17 -08:00
Thomas Dinges
6e37f14489 Windows: Run blender-launcher.exe instead of blender.exe
With this change Blender, delivered via the Microsoft store, will launch without the console window flashing.

Ref T88613

Differential Revision: https://developer.blender.org/D16589
2022-11-24 15:32:22 +01:00
Christoph Lendenfeld
bb665ef8d2 Merge branch 'blender-v3.4-release' 2022-11-24 15:20:30 +01:00
Christoph Lendenfeld
705fe08b61 Fix T99400: "Jump to Keyframe" preserves subframe offset
Previously when using the "Jump To Keyframe" operator
in conjunction with subframes, the decimal part would be kept.
Meaning that it wouldn't jump exactly to the frame.
This fix also makes it so it is possible to jump to keyframes
that are on subframes.

Reviewed by: Sybren
Differential Revision: https://developer.blender.org/D16595
2022-11-24 15:19:48 +01:00
Omar Emara
2dcdfab94c Realtime Compositor: Warn about unsupported MacOS
This patch warns the user that MacOS is not supported for the viewport
compositor in the shading panel.

See T102353.
2022-11-24 09:25:44 +02:00
Thomas Dinges
460f7ec7aa Windows: Run blender-launcher.exe instead of blender.exe
With this change Blender, delivered via the Microsoft store, will launch without the console window flashing.

Ref T88613

Differential Revision: https://developer.blender.org/D16589
2022-11-23 15:14:13 +01:00
Omar Emara
7d44676b5f Realtime Compositor: Disable on MacOS
This patch disables the realtime compositor on MacOS until Metal is
supported. This is because MacOS doesn't support the necessary GPU
features to make it work.

An engine error overlay is displayed if it is enabled and the option
itself is greyed out.

See T102353.

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

Reviewed By: Clement Foucault
2022-11-23 13:34:31 +02:00
Omar Emara
11275b7363 Realtime Compositor: Extend option to enable compositor
This patch turns the checkbox option to enable the viewport compositor
into a 3-option enum that allows:

- Disabled.
- Enabled.
- Enabled only in camera view.

See T102353.

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

Reviewed By: Clement Foucault
2022-11-23 13:27:47 +02:00
Sergey Sharybin
7dea18b3aa Tracking: Store lens principal point in normalized space
This avoids need to do special trickery detecting whether the principal
point is to be changed when reloading movie clip. This also allows to
transfer the optical center from high-res footage to possibly its lower
resolution proxy without manual adjustment.

On a user level the difference is that the principal point is exposed in
the normalized coordinates: frame center has coordinate of (0, 0), left
bottom corner of a frame has coordinate of (-1, -1) and the right top
corner has coordinate of (1, 1).

Another user-visible change is that there is no more operator for setting
the principal point to center: use backspace on the center sliders will
reset values to 0 which corresponds to the center.

The code implements versioning in both directions, so it should be
possible to open file in older Blender versions without loosing
configuration.

For the Python API there are two ways to access the property:
- `tracking.camera.principal_point` which is measured in the normalized
  space.
- `tracking.camera.principal_point_pixels` to access the pixel-space
  principal point.

Both properties are not animatable, so there will by no conflict coming.

Differential Revision: https://developer.blender.org/D16573
2022-11-22 11:49:56 +01:00
Leon Schittek
dfb157f9c4 Merge branch 'blender-v3.4-release' 2022-11-19 19:09:49 +01:00
Leon Schittek
331e8007ed Fix T102520: Positioning of nodes added via search
Always position the nodes added with the node search at the point where
the search operator was invoked by ensuring the operator context is the
main node editor region.

This was an unintended change of rBbdb57541475f, caused by the operator
now getting the cursor position in region space. So when the operator
was called from the menu, it would get the cursor position in the
region space of the menu, which lead to an offset when adding the node
since it expected the coordinates to be in the space of the node editor.

Setting the correct operator context also fixes inconsistent transform
sensitivity depending on zoom when adding nodes via the search in the
menu which has been an issue since as far back as Blender 2.79.

Also includes a small fix for the vertical offset of nodes added by the
search which varied depending on the UI scale. Same fix as in
rB998ffcbf096e.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16555
2022-11-19 19:03:38 +01:00
Aaron Carlisle
bfb3d78902 Cleanup: Remove disabled edge slide keymap feature
This feature has been disabled since 2.80 but the feature description was still visible in the UI.

Addresses part of T101429

Breaking changes:

- Removes `EDGESLIDE_EDGE_NEXT`
- Removes `EDGESLIDE_PREV_NEXT`

Reviewed By: mano-wii

Maniphest Tasks: T101429

Differential Revision: https://developer.blender.org/D16430
2022-11-18 21:13:33 -05:00
Philipp Oeser
40b63bbf5b Merge branch 'blender-v3.4-release' 2022-11-18 12:50:21 +01:00
Philipp Oeser
3e81d177ea Fix Grease Pencil materials added by Python missing
These materials were missing from the "Change Active Material" menu.

Caused by rBe3faef686d38.

Error was getting the preview [which wasnt there yet]
These only appeared once the material tab in the Properties Editor was
used (since this ensured a valid preview icon).

Above commit changed behavior for RNA icon getter (this does not create
data anymore), so ensure the preview by hand here.

Similar to rB182edd4c35c2.

Fixes T102566.

Maniphest Tasks: T102566

Differential Revision: https://developer.blender.org/D16541
2022-11-18 12:34:16 +01:00
Pablo Vazquez
2c096f17a6 UI: Refactor Node Context Menu
The Node Context Menu contains options that are not always available for
the selected nodes, and misses important entries for accesibility.

This patch covers the following:
* Add operators to join and remove nodes from frames.
* Sort and group entries more logically and follow Blender conventions.
* Add `Insert into Group`
* Show group actions only on nodes that support it.
* Move all toggles to a sub-menu called `Show/Hide`.
* When nothing is selected, show Add menu, links actions, and paste.

Inspired by RightClickSelect proposals and community feedback.

See D16216 for images.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16216
2022-11-17 23:27:12 +01:00
Jeroen Bakker
4f2ce8d8d3 DrawManager: Remove experimental draw lock.
The draw locking was implemented for project Heist and moved behind an experimental
feature after it became clear there were issues with it. Nowadays it isn't used,
and the idea is to replace it with a different solution after all draw engines have
been ported to the new draw manager API. {T102180}

This patch will remove the experimental feature as it isn't used, or useful.
2022-11-16 15:18:39 +01:00
Bastien Montagne
06e9d40c33 Merge branch 'blender-v3.4-release' 2022-11-16 12:32:51 +01:00
Damien Picard
9d732445b9 I18n: make a few messages translatable.
I18n: make a few messages translatable

    * Missing Paths * in the Presets menu when no preset exists yet.
    The White Noise entry in the Add Node menu is the only one lacking a "Texture" suffix, which doesn't seem justified since the node itself is already called "White Noise Texture". Rename the entry its name can be extracted and used for the node--and for consistency.
    New object material node names (Principled BSDF, Material Output) come from a preset node tree. The nodes' names need to be translated after creation.
    Extract the "Fallback Tool" pie menu title.
    Translate grease pencil options in the viewport overlay menu.

Ref T102030.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16345
2022-11-16 12:27:20 +01:00
Damien Picard
f415051a57 I18n: fix printf-style format translation in release/scripts/startup
Many reports and a few labels used string formatting without
explicitly calling tip_() or iface_(), so the untranslated message
was used instead of the translated one, even when it was extracted.

Differential Revision: https://developer.blender.org/D16405
2022-11-16 12:08:53 +01:00
Joseph Eagar
2d251478bb Sculpt: Fix mask from cavity settings issues
Mask from cavity can now pull settings from three
places: the operator properties, scene tool settings
or the brush.  This is needed to make the "create mask"
button work as expected.
2022-11-15 08:39:06 -08:00
Joseph Eagar
e460f188f0 Sculpt: Fix mask from cavity settings issues
Mask from cavity can now pull settings from three
places: the operator properties, scene tool settings
or the brush.  This is needed to make the "create mask"
button work as expected.
2022-11-15 08:34:45 -08:00
Bastien Montagne
1b5ceb9a75 Merge branch 'blender-v3.4-release' 2022-11-15 12:05:11 +01:00
Damien Picard
337dbb1ab0 I18n: fix UI layout operator context extraction
Some operator layout buttons with custom text did not get the proper
context: they'd get * instead of Operator.

This was probably never noticed because the only operator that
actually had this issue was Import Images as Planes in the Add menu.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15993
2022-11-15 12:03:18 +01:00
Bastien Montagne
d95216b94c Merge branch 'blender-v3.4-release' 2022-11-15 11:35:29 +01:00
Damien Picard
9795f2645c I18n: fix description_from_data_path() for property assignment
The property assignment operators' tooltips were never actually
translated when they were constructed dynamically from the description
in the prop's RNA.

This was visible when using such operators in menus (example I found
was the Marker Settings, Shift + E in the Movie Clip Editor).

"%s: %s" is already extracted elsewhere, might as well use it.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16439
2022-11-15 11:29:07 +01:00
Damien Picard
83c21e01dd I18n: improve keymap translations
- The label for modal keymaps was extracted but did not use the proper
  context on translation.
- Same goes for modal keymap items.
- Extract the UI messages from rna_keymap_ui.py
- Translate global keymap names.
- Use the proper context in the status bar for the tool prompt operator

Ref T102071

Maniphest Tasks: T102071

Differential Revision: https://developer.blender.org/D16348
2022-11-15 11:08:26 +01:00
Campbell Barton
2a41cd46ba Cleanup: format 2022-11-15 16:43:18 +11:00
Iliya Katueshenock
efcd587bc2 Geometry Nodes: Image Info Node
This commit adds a new "Image Info" node to retrieve various
information from an image like its width, height, and whether
it has an alpha channel. It is also possible to retrieve the FPS
and frame count of video files.

Differential Revision: https://developer.blender.org/D15042
2022-11-14 18:55:51 -06:00
Bastien Montagne
85bbcb32eb Merge branch 'blender-v3.4-release' 2022-11-14 16:46:01 +01:00
Bastien Montagne
99d00a7489 Usual minor fixes to UI messages & i18m utils module. 2022-11-14 16:44:10 +01:00
Ejner Fergo
b557e4317d Gizmo toggle for Movie Clip Editor
This patch adds a "Show Gizmo" toggle to the Movie Clip Editor header, for consistency with other editors.

{F13892765}

Differential Revision: https://developer.blender.org/D16437
2022-11-14 14:35:32 +01:00
Pratik Borhade
7419e291e8 Merge branch 'blender-v3.4-release' 2022-11-13 22:54:38 +05:30
Pratik Borhade
b927cc9ba6 Fix T102187: Add knife tool in mesh panel
Add knife tool option in mesh panel

Reviewer: campbellbarton, JulienKaspar

Differential Revision: https://developer.blender.org/D16395
2022-11-13 22:48:24 +05:30
Chris Blackbourn
721fc9c1c9 UV: implement copy and paste for uv
Implement a new topology-based copy and paste solution for UVs.

Usage notes:

* Open the UV Editor

* Use the selection tools to select a Quad joined to a Triangle joined to another Quad.
* From the menu, choose UV > UV Copy
 * The UV co-ordinates for your quad<=>tri<=>quad are now stored internally

* Use the selection tools to select a different Quad joined to a Triangle joined to a Quad.
* (Optional) From the menu, choose UV > Split > Selection

* From the menu, choose UV > UV Paste
 * The UV co-ordinates for the new selection will be moved to match the stored UVs.

Repeat selection / UV Paste steps as many times as desired.
For performance considerations, see https://en.wikipedia.org/wiki/Graph_isomorphism_problem

In theory, UV Copy and Paste should work with all UV selection modes.
Please report any problems.

A copy has been made of the Graph Isomorphism code from https://github.com/stefanoquer/graphISO
Copyright (c) 2019 Stefano Quer stefano.quer@polito.it GPL v3 or later.

Additional integration code Copyright (c) 2022 by Blender Foundation, GPL v2 or later.

Maniphest Tasks: T77911
Differential Revision: https://developer.blender.org/D16278
2022-11-13 12:48:17 +13:00
demeterdzadik@gmail.com
111974234c Addons submodule version bump
(Previous attempt was accidentally 4 days outdated)
2022-11-11 15:10:30 +01:00
demeterdzadik@gmail.com
5f35e7f12a Addons submodule version bump 2022-11-11 12:48:14 +01:00
Ramil Roosileht
9800312590 Mesh: Convert color attribute operator
Implements an operator to convert color attributes in
available domains and types, as described in T97106.

Differential Revision: https://developer.blender.org/D15596
2022-11-10 15:29:21 -06:00
Joseph Eagar
969aa7bbfc Sculpt: Change symmetrize merge threshold and expose in workspace panel
The sculpt symmetrize operator's merge threshold now defaults
to 0.0005 instead of 0.001, which tends to be a bit too big for
metric scale.

Also changed its step and precision a bit to be more usable.
2022-11-10 10:55:09 -08:00
Julien Kaspar
659de90a32 Sculpt: Rename Show/Hide operators for consistency
This is a minor naming update to make the box hide and show operators in sculpt mode follow current naming conventions.

Reviewed by: Joseph Eagar
Differential Revision: https://developer.blender.org/D16413
Ref D16413
2022-11-10 10:47:08 -08:00
Jason Schleifer
0b4bd3ddc0 NLA: Update context menu to include meta strip operators
The meta strip operator is available in the Add menu, but not in the
context menu.

This patch adds these two operators to the context menu:
* nla.meta_add
* nla.meta_remove

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D16353
2022-11-10 12:07:29 +01:00
Harley Acheson
ce68367969 Fix T102140: Replacement of Noto Sans CJK Font
Replace our Noto Sans CJK with a version that has Simplified Chinese
set as the default script.

See D16426 for details and examples

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

Reviewed by Brecht Van Lommel
2022-11-09 08:22:38 -08:00
Harley Acheson
d01187c963 Fix T102140: Replacement of Noto Sans CJK Font
Replace our Noto Sans CJK with a version that has Simplified Chinese
set as the default script.

See D16426 for details and examples

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

Reviewed by Brecht Van Lommel
2022-11-09 08:17:52 -08:00
Campbell Barton
683b945917 Cleanup: format 2022-11-09 21:07:09 +11:00
Antonio Vazquez
4c182aef7c GPencil: Make Sculpt Auto-masking Global and not by Brush
The auto-masking was working by Brush and this was very
inconvenient because it was necessary set the options by
Brush, now the options are global and can be set at once.

Also, the automa-masking now works with `and` logic
and not with `or` as before. That means that a stroke
must meet all the conditions of the masking.

Added new Layer and Material options to masking the 
strokes using the same Layer/Material of the selected stroke.
Before, only Active Layer and Active Material could be masked.

The options of masking has been moved to the top-bar using
the same design of Mesh Sculpt masking.

As result of the changes above, the following props changed:

Removed:

`brush.gpencil_settings.use_automasking_strokes`
`brush.gpencil_settings.use_automasking_layer`
`brush.gpencil_settings.use_automasking_material`

Added:

`tool_settings.gpencil_sculpt.use_automasking_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_stroke`
`tool_settings.gpencil_sculpt.use_automasking_material_stroke`
`tool_settings.gpencil_sculpt.use_automasking_layer_active`
`tool_settings.gpencil_sculpt.use_automasking_material_active`


Reviewed by: Julien Kaspar, Matias Mendiola, Daniel Martinez Lara
2022-11-08 16:55:59 +01:00
Campbell Barton
8b151982fe Merge branch 'blender-v3.4-release' 2022-11-08 17:00:46 +11:00
Campbell Barton
3c1fb9aea1 Workaround crash generating Python API documentation
Avoid accessing freed memory from dynamically allocated EnumPropertyItem
arrays. Rely on the memory being held by the iterator which isn't the
case when it was converted to a tuple.
2022-11-08 16:52:30 +11:00
Pablo Vazquez
28e952dacd UI: Sort items in Weight Locks menu
Reorder the items in the `Locks` menu:
* Split into three groups: Lock, Unlock, Invert.
* Use icon only in the first item of each group, following the HIG.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D16383
2022-11-06 02:28:48 +01:00
Colin Basnett
11a705c2d0 Fix T102218: Baked f-curves display incorrectly when normalized
This fixes T102218, where baked f-curves would display incorrectly when normalized.

This bug was a result of the code making no effort to determine the y-range of baked f-curves, so it fell back to a default that looked horrible.

I've added specific handling for finding the y-range of each f-curve (I extracted this functionality out to a new function, `fcurve_scene_coord_range_get`, for organization purposes). In addition, a minor optimization was made to eliminate redundant range-checks when in preview range mode.

{F13838304}

Reviewed By: sybren

Maniphest Tasks: T102218

Differential Revision: https://developer.blender.org/D16363
2022-11-03 23:56:50 -07:00
Aaron Carlisle
31d43cb0e7 Update RNA to User manual mappings 2022-11-03 00:32:22 -04:00
Aaron Carlisle
ea94d5723f PyDocs: Upgrade Sphinx to 5.3.0
Trivial changes, should not affect us in anyway.
2022-11-02 22:35:42 -04:00
Campbell Barton
5a90bbf716 Cleanup: format 2022-11-02 11:20:06 +11:00
Hans Goudey
cf98518055 Nodes: Add node group assets in add menu
This patch builds on the work from bdb57541475f to add node group
assets directly in the node editor add menu. Assets are added after
separators to distinguish them, but otherwise they look like any other
node. The catalog trees from all configured libraries are used to build
the menu hierarchy. Only catalogs with matching asset types are used
though.

There are a few limitations of this initial version. For now this only
supports geometry nodes. Support for other built-in node systems just
requires some refactoring of the corresponding add menu though. Lazy
loading will be added in a followup commit. For now there is a label
the first time the menu is opened.

Like the search menu integration, re-saving asset library files in 3.4
is required, if it hasn't been done already.

Implementation wise, there is a some ugly code here. A lot of that is
because the asset system isn't complete. The RNA API doesn't work well
yet, and the system isn't built to interact with multiple libraries at
once. It's also ugly because of the way we combine automatic menu
generation with builtin menus. As noted in a code comment, these two
systems could be merged completely so that the menus for builtin nodes
are also generated in the same way.

Differential Revision: https://developer.blender.org/D16135
2022-11-01 16:09:58 +01:00
Philipp Oeser
2186d58d1c Fix T102045: Properties Editor Attribute panels errors when pinning mesh
When pinning a Mesh, we cannot rely on the context object.
Instead, use the context mesh now.
For vertexgroups names [which are still on the object API wise], this
means name collisions cannot be checked when pinning a Mesh (so print
this as a warning in that case)

Maniphest Tasks: T102045

Differential Revision: https://developer.blender.org/D16333
2022-10-26 09:10:50 +02:00
Stephen Seo
59a0b49c10 Video rendering: FFMpeg AV1 codec encoding support
Previously, the Blender video renderer did not have support for
encoding video to AV1 (not to be confused with the container AVI).
The proposed solution is to leverage the existing FFMpeg renderer
to encode to AV1.

Note that avcodec_find_encoder(AV_CODEC_ID_AV1) usually returns
"libaom-av1" which is the "reference implementation" for AV1 encoding
(the default for FFMpeg, and is slow). "libsvtav1" is faster and
preferred so there is extra handling when fetching the AV1 codec for
encoding such that "libsvtav1" is used when possible.

This commit should only affect the options available for video
rendering, which includes the additional AV1 codec to choose from, and
setting "-crf".

Also note that the current release of FFMpeg for ArchLinux does not
support "-crf" for "libsvtav1", but the equivalent option "-qp" is
supported and used as a fallback when "libsvtav1" is used (as
mentioned here: https://trac.ffmpeg.org/wiki/Encode/AV1#SVT-AV1 ).
(Actually, both "-crf" and "-qp" is specified with the same value in
the code. When a release of FFMpeg obtains support for "-crf" for
"libsvtav1" is released, the code shouldn't be needed to change.)

The usage of the AV1 codec should be very similar to the usage of the
H264 codec, but is limited to the "mp4" and "mkv" containers.

This patch pertains to the "VFX & Video" module, as its main purpose
is to supplement the Video Sequencer tool with the additional AV1
codec for encoded video output.

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

Reviewed By: sergey , ISS, zeddb
2022-10-21 20:10:17 -06:00
Germano Cavalcante
9c20eda0ad Fix T101244: Empty point list in shader batch creation cause error
Allow empty VBOs in Python GPUBatch creation.
2022-10-21 14:24:30 -03:00
Jeroen Bakker
ec60c8abe7 SystemInfo: Add active GPU backend.
For debugging it is useful to known the active GPU backend. Although
it could be determined from looking at the extensions, this is easier
to understand when not activly working in this area.
2022-10-21 15:06:07 +02:00
Philipp Oeser
2180e6fc9f Curves: make the "surface_uv_map" a searchable dropdown
The users had to type in a name here, but we can also make it a dropdown
choice with existing UV Maps for convenience:
- dont have to remember a name or copy paste obviously
- shows in red if it was removed / invalid

Came up in T101028

Maniphest Tasks: T101028

Differential Revision: https://developer.blender.org/D15956
2022-10-19 11:56:27 +02:00
Philipp Oeser
4163c63def Curves sculptmode: fix missing mode and tool in Brush Specials
For consistency with other brush based (paint) systems we should add
these entries in the brushes context menu.
For this, expose the brushes `ob_mode` to RNA and show this (along with
the tool choice) to the appropriate menus.

Differential Revision: https://developer.blender.org/D16287
2022-10-19 08:53:09 +02:00
Philipp Oeser
96fa5e1e84 Cleanup: remove unused 'VIEW3D_MT_brush_context_menu_paint_modes'
This was added in rB4c9fe657458f, however that new code never used this
menu (but the existing `VIEW3D_MT_brush_paint_modes` instead).

Differential Revision: https://developer.blender.org/D16285
2022-10-19 08:50:38 +02:00
Pablo Vazquez
db40b62252 Sculpt: Auto-masking UI improvements
Add auto-masking as a popover in the header while in Sculpt mode,
following the design in T101593.

These properties were present in the Options panel (and popover),
they have been removed from there.

Moreover, this commit makes the auto-masking section in Brush settings
match the new popover.

In the future this popover can be used for other modes that support
auto-masking such as Grease Pencil.

See D16145 for details and screenshots.

Reviewed By: JulienKaspar

Differential Revision: https://developer.blender.org/D16145
2022-10-17 11:23:16 +02:00
Dalai Felinto
6beeba1ef5 Nodes: Duplicate Linked operator + User Preference option for Node Tree
This operator (Alt + D) allows users to explicitly create a linked copy
of a group node (same current behaviour for the Duplicate operator).

The duplicate operator (Shift + D) now takes the new User Preference
duplicate data option for Node Tree into account. It is by default
disabled, leading to no functional change for users.

Although we could make in the future make this option "on" by default,
to make it consistent with the rest of Blender we do not at the time.

Differential Revision: https://developer.blender.org/D16210
2022-10-13 20:06:20 +02:00
Campbell Barton
fabf4ee33d Fix T100699: Older preferences from 2.93 wont load
Even though this was intentionally removed in [0], loading data from
older startup files is supported. So show them when available.

[0]: 45439dfe4c05eabaa83d0c1b75463966b5ba896d
2022-10-13 17:36:30 +11:00
Campbell Barton
3f64b88684 Cleanup: use function style casts for C++, format & spelling 2022-10-12 10:39:12 +11:00
Chris Blackbourn
b7decab07e UV: add grid shape source to the uv editor, and add new "pixel" option
This change is part of a wider set of changes to implement Grid and Pixel
snapping in the UV Editor. This particular change adds a new third option,
`pixel grid`, to the previous grid options, `dynamic grid` and `fixed grid`.

Maniphest Tasks : T78391

Differential Revision: https://developer.blender.org/D16197
2022-10-12 11:27:41 +13:00
Pratik Borhade
9a6dc39d4b Sculpt: Fix T101694: Change operator for unhide face sets
In 22c3db72ca2f `SHOW_ALL` has been removed from
`face_set_change_visibility`. Instead `SCULPT_OT_reveal_all` is now used
for unhiding all face sets.

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D16199
Ref D16199
2022-10-11 02:49:45 -07:00
Damien Picard
b099cf73ae I18n: disambiguate or extract a few messages
Disambiguate:
- "Active Only" (GPencil copy material and layer, add NLA modifier)
- "Clip" (movie clip, image extension mode)
- "Emission" (particles)
- "New" (scene)
- "Tracking" (movie clip)

Extract:
- "ViewLayer", the default view layer name when creating new scene

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16196
2022-10-10 13:03:26 +02:00
Bastien Montagne
d855f5fdcd Fix typos & co in UI messages. 2022-10-10 10:36:15 +02:00
Campbell Barton
a24f11e0ec UI: show the windowing environment in the "About" splash
Show the windowing environment on non MS-Windows/Apple systems,
since X11/WAYLAND are selected startup there was no convenient way
for users to know which back-end was being used.

Include the windowing environment in the About splash & system-info.txt
since it will be useful for handling bug reports.

This commit adds a private API call not intended for general use
as I would like to be able to remove this later and it's only needed
in the specific case of testing if Blender is using WAYLAND or X11
(which maybe be used via XWayland).

Python scripts can already inspect the system to check which windowing
environment used, the API call is mainly useful for troubleshooting.
2022-10-10 11:22:41 +11:00
Campbell Barton
781d03efe4 Preferences: support loading factory settings only for app-templates
When app-templates are enabled, support resetting defaults only for the
app-templates.

Without this, it's not possible to reset app-template preferences
without also resetting the default preferences for all settings the
app-template does not override (used when there is no application
template loaded, and other app-templates).

These additional menu items are shown in menus when an app-template has
been loaded.

Address issue raised by T96427.

Reviewed By: mont29, brecht

Ref D16150
2022-10-07 10:50:17 +11:00
Antonio Vazquez
6942f05848 UI: New modifier Icons Envelope and Outline
Task: T101155

Designed by: Matias Mendiola
Reviewed by : Pablo Vazquez
2022-10-06 17:16:56 +02:00
Sebastian Parborg
7163a83450 Fix addons submodule ref
Was downgraded to a version from 2019 by mistake
2022-10-06 12:53:19 +02:00
Damien Picard
8b485e7226 I18n: ignore user-installed add-ons when extracting bl_info
Since add-on info was made translatable in D15747, user-installed
add-ons could also get their info extracted. This led to having
different messages depending on the environment of the Blender doing
the I18n messages update.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15963
2022-10-06 10:28:18 +02:00
Bastien Montagne
247af8cf5b UI Translations: Add context to 'New' menu entries for files.
Aftermath of rBf5d67f3fdf2d and rBa096248d1253, from D16159 (did not
apply direclty).
2022-10-06 10:16:09 +02:00
Campbell Barton
63ed9550e9 Fix exception in bpy_extras.object_utils.object_data_add(..)
Adding object-data that doesn't support edit-mode would raise an
exception when the "Enter Edit Mode" preferences was enabled.

Other changes:

- Don't attempt to enter edit-mode for library-data.
- Support entering edit-mode for grease-pencil objects.

Alternate fix for the issue raised by D15999.
2022-10-06 13:07:16 +11:00
Campbell Barton
68ea6c85ab Fix: File context menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf2ddec073898bc60feeb2440f2c1b30
2022-10-06 12:49:22 +11:00
Hans Goudey
a096248d12 Fix: File menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf2ddec073898bc60feeb2440f2c1b30
2022-10-05 13:48:01 -05:00
Clément Foucault
6306d747b7 DRW: Split ViewProjectionMatrix in order to increase precision
This also removes the need to compute the persmat and saves some memory
from the `ViewInfos` struct. This is needed to allow multiview support.

Initial testing found no major performance regression during vertex
heavy workload.

Test file: {F13610017}

Results:
| Platform | Master | Split Matrix|
| Linux + Mesa + AMD W6600 | 48 fps | 47 fps |
| Macbook Pro M1 | 50 fps | 51 fps |
| Linux + NVidia 1080Ti | 51 fps | 52 fps |
| Linux + Radeon Vega 64 | 25.6 fps | 26.7 fps |

Increased precision when far from origin:
{F13610024}

{F13610025}

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D16125
2022-10-05 20:29:12 +02:00
Hans Goudey
9a633b967a Revert "Geometry Nodes: Add index input to Edge Vertices node"
Unfortunately this commit changed behavior in a fundamental way that
can't be addressed without larger changes. Previously the position
outputs were evaluated on the edge domain and then interpolated to the
context domain, which could be useful for some rudimentary mesh smoothing.
After the commit they were just evaluated at the specified index, which
looks practically random when evaluated on a different domain. We may need
a new node that doesn't have the implicit behavior in the future.

This reverts commit 4ddc5a936e07129aaf94ed7d188b8f5f5ea14085.
2022-10-05 11:38:53 -05:00
Hans Goudey
424df9ea87 Fix T101610: UV Sphere missing from geometry nodes menu
Caused by 837144b4577f161baf1625f8a5478c83a088ea0f
2022-10-05 11:02:45 -05:00
Damien Picard
fd48f1b505 I18n: improve unit extraction regex
There were two issues with the unit extraction regex:
- it didn't take the inches, feet, arcminutes and arcseconds symbols
into accounts, which aren’t letters but ' and ";
- some units have more than one B_UNIT_DEF_* flag.

This allows extracting feet, inches, square millimeters, cubic
millimeters, arcminutes, and arcseconds.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16144
2022-10-05 17:58:50 +02:00
Damien Picard
f5d67f3fdf I18n: disambiguate a few messages
- Active Track (NLA vs movie clip)
- New (file)
- Object Index (loop cut)
- Object Index (render pass)
- Proxy Storage (sequence)
- Rim (Solidify modifier)
- Roughness (particle children)
- Spaces (text whitespace)
- Out (sequencer wipe transition)

Also make new asset tag name translatable.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16067
2022-10-05 17:53:37 +02:00
Philipp Oeser
634e4a49d6 Fix T101334: Paint Texture Slots appear greyed out
To the user, this looks like a disfunctional thing (usually greying out
is used for props having no effect).

The greying out is caused by
{rB8b7cd1ed2a17e40661101eea4adae99e8e3d02e9}.
Above commit disabled the direct renaming of images in the
`TEXTURE_UL_texpaintslots` UIList (and instead displays the texture slot
directly as a prop -- which has its `PROP_EDITABLE` flag cleared)
(from the commit message):
> A limitation of this patch is that is isn't possible anymore to rename
images directly from
> the selection panel. This is currently allowed in master. But as
CustomDataLayers
> aren't ID fields and not owned by the material supporting this wouldn't
be easy.

To work around the UI confusion (but still keep the non-editable nature
of the property), now just display this as a label.

Maniphest Tasks: T101334

Differential Revision: https://developer.blender.org/D16138
2022-10-05 13:41:59 +02:00
Joseph Eagar
22c3db72ca Sculpt: Visibility bugfixes
* Unhide all is no longer part of face_set_change_visibility.
* Implemented a few visibility API methods for PBVH_BMESH
* Fixed bug with unhide all not freeing all multires grid_hidden
  bitmaps.
2022-10-03 17:19:50 -07:00
Hans Goudey
4ddc5a936e Geometry Nodes: Add index input to Edge Vertices node
Previously the edge index was always determined by the field context,
and the node didn't work when the context was in any other domain.
Adding an index input makes it work much more nicely with the other
topology nodes. It's now in the topology submenu too.

I also reimplemented the edge positions input to use the field at index
node internally. That will probably make it slower for now, but we need
to optimize that to do nothing in some special cases anyway.

Differential Revision: https://developer.blender.org/D16105
2022-10-03 16:54:23 -05:00
Hans Goudey
c3b6e37254 Geometry Nodes: Rename Control Point Neighbors Node
Rename the node to "Offset Point in Curve"

Since this was committed, more mesh and curve topology nodes have been
committed with a different naming scheme (482d431bb6735e82069). Change
the name of this node to match "Offset Corner in Face". Because the
node was only added recently, it's a full rename, including the ID,
so forward compatibility is broken.
2022-10-03 16:41:58 -05:00
Johnny Matthews
748fda32ed Geometry Nodes: Set Curve Normal
This node allows for curves to have their evaluated normal mode changed
between MINIMUM_TWIST and Z_UP. A selection input allows for choosing
which spline in the curves object will be affected.

Differential Revision: D16118
2022-10-03 15:50:21 -05:00
Jacques Lucke
e65598b4fa Geometry Nodes: new Sample UV Surface node
This node allows sampling an attribute on a mesh surface based
on a UV coordinate. Internally, this has to do a "reverse uv lookup",
i.e. the node has to find the polygon that corresponds to the uv
coordinate. Therefore, the uv map of the mesh should not have
overlapping faces.

Differential Revision: https://developer.blender.org/D15440
2022-10-03 16:06:29 +02:00
Philipp Oeser
68ac737d48 Cleanup: format 2022-09-30 10:28:11 +02:00
Hans Goudey
912a1e2820 Fix: Order of node mixins in custom nodes python template
See T101259. This order makes the poll not work, even when called from
Python. The bundled template shouldn't be a source of errors for node
addons.
2022-09-29 11:59:02 -05:00
Antonio Vazquez
d2e576f34c GPencil: Remove Fill use_collide_only option
After a lot of testing, this option is not required and
now this is managed by stroke_collsion.

If the stroke_collision is enabled, only collide strokes 
are used.
2022-09-29 14:58:29 +02:00
Dalai Felinto
fae975dd54 UI: Nodes re-organize the nodes in alphabetical order
This was a regression introduced after the 3.3 release.

This fix T101452
2022-09-29 11:13:27 +02:00
Campbell Barton
a56da7b045 Fix bpy.utils.script_paths() ignoring environment variables
When check_all=True was passed,

- `os.path.join(bpy.utils.resource_path('USER'), "scripts")`
  was used instead of BLENDER_USER_SCRIPTS.
- `os.path.join(bpy.utils.resource_path('SYSTEM'), "scripts")`
  was used instead of BLENDER_SYSTEM_SCRIPTS.

Other minor changes:

- Simplify collecting paths.
- Don't add user-directories multiple times when check_all=True.
- Normalize paths before before checking duplicates to reduce the
  change the same path is added multiple times.

Found these issues while investigating T101389.
2022-09-29 17:31:55 +10:00
Joseph Eagar
bbc69563d0 Sculpt: Normal-based automasking modes
Two new normal-based automasking modes.

The first mode, "brush", compares vertex normals with the initial
normal at the beginning of the brush stroke.

The second, "view", compares vertex normals with the view normal.
If "occlusion" is on then rays will be shot from each vertex to test
if it is occluded by other geometry (note: this can be very slow).\
Only geometry inside the sculpt mesh is considered.

Each mode has an associated angular limit and a falloff.

Reviewed by: Julien Kaspar and Jeroen Bakker
Differential Revision: https://developer.blender.org/D15297
Ref D15297
2022-09-28 23:21:56 -07:00
Campbell Barton
9cfa8b945a Cleanup: format 2022-09-29 10:11:42 +10:00
Joseph Eagar
0156a677c7 Sculpt: New Cavity Automasking Mode
Add new cavity automasking mode based on local mesh
curvature.  Cavity masking is a great way to quickly add
detail in crevices and the like.  It's meant to be used
with the Paint brush in color attribute mode.  It does
work with other brushes but the results can be unpredictable.

{F13131497}

The old "dirty mask" operator has been replace with a new
"mask from cavity" operator that shares the same code with
cavity automasking.

Differences from the sculpt-dev implementation:
    * It uses the word "cavity."  When I first implemented
this I wasn't aware
      this feature existed in other software (and other
paint modes in Blender),
      and for reasons that escape me today I initially
decided to call it a concave or
      concavity mask.
    * The cavity factor works a bit differently.  It's
      no longer non-linear and functions as a simple
      scale around 0.5f.
    * Supports custom curves.
    * Supports blurring.

Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton
Differential Revision: https://developer.blender.org/D15122
Ref D15122
2022-09-28 16:22:34 -07:00
Hans Goudey
482d431bb6 Geometry Nodes: Curve and mesh topology access nodes
This patch contains an initial set of nodes to access basic
mesh topology information, as explored in T100020.

The nodes allow six direct topology mappings for meshes:
- **Corner -> Face** The face a corner is in, the index in the face
- **Vertex -> Edge** Choose an edge attached to the vertex
- **Vertex -> Corner** Choose a corner attached to the vertex
- **Corner -> Edge** The next and previous edge at each face corner
- **Corner -> Vertex** The vertex associated with a corner
- **Corner -> Corner** Offset a corner index within a face

And two new topology mappings for curves:
- **Curve -> Points** Choose a point within a curve
- **Point -> Curve** The curve a point is in, the index in the curve

The idea is that some of the 16 possible mesh mappings are more
important, and that this is a useful set of nodes to start exploring
this area. For mappings with an arbitrary number of connections, we
must sort them and use an index to choose a single element, because
geometry nodes does not support list fields. Note that the sort
index has repeating behavior as it goes over the "Total" number of
connections, and negative sort indices choose from the end.

Currently which of the "start" elements is used is determined by the
field context, so the "Field at Index" and "Interpolate Domain" nodes
will be quite important. Also, currently the "Sort Index" inputs are
clamped to the number of connections.

One important feature that isn't implemented here is using the winding
order for the output elements. This can be a separate mode for some
of these nodes. It will be optional because of the performance impact.

There are several todos for separate commits after this:
- Rename "Control Point Neighbors" to be consistent with this naming
- Version away the "Vertex Neighbors" node which is fully redundant now
- Implement a special case for when no weights are used for performance
- De-duplicating some of the sorting logic between the nodes
- Improve performance and memory use of topology mappings
- Look into caching some of the mappings on meshes

Differential Revision: https://developer.blender.org/D16029
2022-09-28 14:38:27 -05:00
Jacques Lucke
c55d38f00b Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.

**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
  makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
  is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
  its active or not.

**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
  When pinned, the spreadsheet still references the viewer node even
  when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
  the active viewer.

**Attribute**
* When a field is linked to the second input of the viewer node it is
  displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
  automatically. This does not work in all cases. It falls back to the
  face corner domain on meshes and the point domain on curves. When
  necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
  that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.

**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
  setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
  by disabling the "Viewer Node" option in the "View" menu.

**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
  is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
  field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
  attribute.
* The ground truth for the active viewer node is stored in the workspace
  now. Node editors, spreadsheets and viewports retrieve the active
  viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
  the viewed geometry of the corresponding object is part of the iterator
  instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
  to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
  existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
  "preferred domain" for every field input. If there is not exactly one
  preferred domain, the fallback is used.

Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
  added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
  the values might have to be normalized or some should be drawn as arrays.
  For now, we encourage users to build node groups that generate appropriate
  viewer-geometry. We might include some of that functionality in future versions.
  Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
  nvidia gpus, to be investigated.

Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
Antonio Vazquez
fe19de5fcc GPencil: Fill Tool - Check if extensions collide with real strokes
This commit is an improvement in the previous fill tool
changes in order to improve how the extended strokes
are managed.

* Now, the algorithm checks if the extend cross a standard stroke, not only extend strokes.

* Option to enable or disable the stroke cross checking
because this can be slow in very complex scenes.

* Added `D` key to toggle stroke cross option.

* Option to use only collide strokes to be used as fill limit.

If the option to use only collide strokes is enabled, the
open extensions are in different color.

* Status text now shows mode and the actual extend factor.

This commits also contains a refactor of the loops
to use arrays as much as possible.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D16052
2022-09-28 15:44:20 +02:00
Sebastian Parborg
050b6498d3 Bump submodule versions 2022-09-28 13:45:22 +02:00
Hans Goudey
0084b8635f Fix T101398: Transfer Attribute node still defined in menu
Removing this item was missed in 837144b4577f161baf1625.
2022-09-27 07:49:21 -05:00
Campbell Barton
78952518e7 Cleanup: format 2022-09-27 16:36:27 +10:00
Iyad Ahmed
cd7ec0dac6 WM: batch rename action clips
Batch rename for action clips works in outliner and 3d view.

Reviewed By: campbellbarton

Ref D15819
2022-09-27 12:13:08 +10:00
recht Van Lommel
84ddb8b3cc UI: add preference to disable touchpad multitouch gestures
Available on Windows and macOS, where such gestures are supported.
For Windows, disabling this option restores touchpad behavior to
match Blender 3.2.

Ref T97925

Differential Revision: https://developer.blender.org/D16005
2022-09-26 22:59:35 +02:00
Hans Goudey
837144b457 Nodes: Use plain menus for geometry nodes add menu
At the cost of slightly more boilerplate code, we can avoid the `NodeItem`
and `NodeCategory` abstractions used to build the node add menu.
This makes the menus more flexible and more obvious, which will
make them easier to extend with assets.

The identifiers for the new menu types are inconsistent with regular
class naming for backwards compatibility with the old "category"
menu naming.

Also adds an item for the "Self Object" node missed in dd5131bd700c.

Differential Revision: https://developer.blender.org/D15973
2022-09-26 13:10:42 -05:00
Johnny Matthews
8a6dc0fac7 Geometry Nodes: Control Point Neighbors Node
This node allows access to the indices of neighboring control points
within a curve via an offset. This includes taking into consideration
curves that are cyclic.

Differential Revision: D13373
2022-09-26 13:03:28 -05:00
Campbell Barton
2356afc7af Cleanup: format, ensure trailing newlines 2022-09-26 21:52:40 +10:00
Jeroen Bakker
6075b04cf9 System info: Added GPU device type and feature support.
Adds more information to System info to help triaging/debugging.
2022-09-26 08:36:05 +02:00
Jeroen Bakker
b4605f6158 Console: Add gpu python module to list of internal modules.
The python GPU module was not mentioned in the list of internal
modules. Adding the GPU module to the list allows curious users
to find it.
2022-09-26 08:18:17 +02:00
Hans Goudey
dedc679eca Geometry Nodes: Split transfer attribute node
This patch replaces the existing transfer attribute node with three
nodes, "Sample Nearest Surface", "Sample Index", and "Sample Nearest".
This follows the design in T100010, allowing for new nodes like UV
sampling in the future. There is versioning so the new nodes replace
the old ones and are relinked as necessary.

The "Sample Nearest Surface" node is meant for the more complex
sampling algorithms that only work on meshes and interpolate
values inside of faces.

The new "Sample Index" just retrieves attributes from a geometry at
specific indices. It doesn't have implicit behavior like the old
transfer mode, which should make it more predictable. In order to not
change the behavior from existing files, the node has a has a "Clamp",
which is off by default for consistency with the "Field at Index" node.

The "Sample Nearest" node returns the index of the nearest element
on a geometry. It can be combined with the "Sample Index" node for
the same functionality as the old transfer node. This node can support
curves in the future.

Backwards compatibility is handled by versioning, but old versions can
not understand these nodes. The warning from 680fa8a523e0 should make
this explicit in 3.3 and earlier.

Differential Revision: https://developer.blender.org/D15909
2022-09-23 13:56:35 -05:00
Antonio Vazquez
392855ce50 GPencil: Improve Fill Tool Extend lines
* Improve how the extend lines collision is calculated.
* Added `S` key to switch between modes.
*  Now extend factor does not disable visual aids (thi sis done with checkbox).
* Reduce the use of linked list and now memory array is used.
* Refactor Radius functions.
* Fixed bug of Radius mode when object is rotated.
* Cleanup code.

Differential Revision: https://developer.blender.org/D16022
2022-09-23 19:29:02 +02:00
Hans Goudey
a8a454287a Mesh: Move edge crease out of MEdge
This is very similar to D14077. There are two differences though.
First is that vertex creases are already stored in a separate layer,
and second is that we can now completely remove use of `Mesh.cd_flag`,
since that information is now inherent to whether the layers exist.

There are two functional differences here:
 * Operators are used to add and remove layers instead of a property.
 * The "crease" attribute can be created and removed by geometry nodes.

The second change should make various geometry nodes slightly faster,
since the "crease" attribute was always processed before. Creases are
now interpolated generically in the CustomData API too, which should
help maintain the values across edits better.

Meshes get an `edge_creases` RNA property like the existing vertex
property, to provide more efficient access to the data in Cycles.

One test failure is expected, where different rounding between float
the old char storage means that 5 additional points are scattered in
a geometry nodes test.

Differential Revision: https://developer.blender.org/D15927
2022-09-23 09:02:28 -05:00
Campbell Barton
187d8ba362 Cleanup: avoid unnecessary access to context.space_data 2022-09-23 14:33:46 +10:00
Chris Blackbourn
c50335b359 UV: add toggle to show the grid over the image
In UV editor, previously unable to see grid and image at same time.

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D16038
2022-09-22 17:20:11 +12:00
Campbell Barton
f97728248e Fix module search path for Python on initialization
Initializing the sys.path on startup attempted to add subdirectories
of {BLENDER_SYSTEM_SCRIPTS}:

- ./modules/modules
- ./modules/startup

As the directories aren't expected to exist there is no need to add them.

Also improved comments for path searching logic.
2022-09-21 12:01:49 +10:00
Chris Blackbourn
7f284f5134 Fix T101138: remove console spam when hovering over toolbar in uv editor
Reviewers: Campbell Barton <ideasman42>, Ryan Inch <Imaginer>

Differential Revision: https://developer.blender.org/D16015
2022-09-21 09:44:59 +12:00
Miguel Porces
01a4d38606 Fix: Group input and output always show in node add menu
In D10241, both NodeItems for NodeGroupInput and NodeGroupOutput in the
were moved from their categories into the 'node_group_items' generator.

As the NodeItem.poll() is called by the NodeCategory class and not by
the NodeItem class, the poll functions associated with those NodeItems
were never called. This should correct that.

Differential Revision: https://developer.blender.org/D16013
2022-09-20 12:07:59 -05:00
RedMser
1f828a5a06 Animation: Add redo panel to Dopesheet and NLA
Add the Redo panel to the dopesheet & NLA editors. This also implicitly
adds it to the timeline editor, since it's a kind of action editor
internally.

This feature is needed for changing advanced properties of animation
operators, such as select grouped (see D14811). But it can also be
useful for existing operators, like precise keyframe position tweaking.

Changes are basically the same as in D6286 (which added the redo panel
for Graph Editor).

Some operators have internal properties that should be hidden. A full
list can be found in T98195. These will be fixed in a follow-up patch.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14960
2022-09-20 14:37:16 +02:00
Philipp Oeser
22efaa2e7b Fix T101201: Missing filter from outliner header
This was missing in Blender File & Orphan Data view.

Typo in rBb5fc8f611e39.

Maniphest Tasks: T101201

Differential Revision: https://developer.blender.org/D16016
2022-09-20 12:20:14 +02:00
Chris Blackbourn
a24fc6bbc1 UV: extend custom grid sizes to set each axis separately
For example, allows a custom UV grid size of 4 x 12.

TODO: Fix snapping with custom UV grid sizes.

Manifest Tasks: T78391

Differential Revision: https://developer.blender.org/D16000
2022-09-20 10:00:41 +12:00
Hans Goudey
bdb5754147 Nodes: Add node group assets to search menus
Currently node group assets are supported, but using them by dragging
from the asset browser is cumbersome. This patch adds all node group
assets from user asset libraries and the current file libraries to the
add node search menu and the link drag search menu.

Node groups added through the search will have their "options" hidden,
meaning the data-block selector is displayed. This helps keep the UI
clean, and the selector shouldn't be necessary anyway.

To make that possible, metadata like the node tree type and its inputs
and outputs has to be saved in the file. This requires re-saving the
files that contain the assets with the patch applied.

The node add search operator is moved from Python to C++ to ease
development and allow more flexibility. It supports a tooltip that
gives the description of assets.

Currently the node groups are added with the asset system's existing
"Append & Reuse" behavior. It's likely that linking should be possible
in the future too, but for now the idea is to use the more foolproof
option that doesn't create dependencies between files.

Because loading assets can potentially take a long time, the search
menu refreshes its items as new assets are loaded. However, changing
the search field is necessary to see the update.

Differential Revision: https://developer.blender.org/D15568
2022-09-19 11:57:10 -05:00
Iyad Ahmed
b6e26a410c Geometry Nodes: Distribute Points in Volume
This commit adds a node to distribute points inside of volume grids.
The "Random" mode usese OpenVDB's "point scatter" implementation, and
there is also a "Grid" mode for uniform distributions. Both methods
operate on all of the float grids in the volume, using every voxel with
a value higher than the threshold. The random method is not stable as
the input volume deforms.

Based on a patch by Angus Stanton (@abstanton), which was based on a
patch by Kenzie (@kenziemac130).

Differential Revision: https://developer.blender.org/D15375
2022-09-19 10:14:08 -05:00
Germano Cavalcante
2ce8b01c59 PyGPU: call 'GPU_shader_bind' in 'GPUShader.uniform_' methods
This simplifies python code.

When we call a method like shader.uniform_float("color", (1,1,1,1)),
we expect the shader's uniform to be updated regardless of whether the
shader is bound or not.

And `batch.draw()` already calls `GPU_shader_bind` inside.

Differential Revision: https://developer.blender.org/D15929
2022-09-19 09:40:20 -03:00
Campbell Barton
4baa6e57bd Cleanup: prefer 'arg' over 'params' for sphinx documentation
While both are supported, 'arg' is in more common use so prefer it.
2022-09-19 14:24:31 +10:00
Wannes Malfait
3ff15a9e23 Geometry Nodes: New Face Set Boundaries node
With the recent addition of the UV unwrapping node, there is a need to
be able to create seams easily. This node does that by outputting a
selection of the boundaries between different input face sets. In the
context of UV mapping, one inputs the "patches" you want, and the node
gives you the seams needed to make those patches.

Differential Revision: https://developer.blender.org/D15423
2022-09-17 22:18:52 -05:00
Antonio Vazquez
742268c50b GPencil: Move Gap Closure option to separated subpanel
Also removed leak size
2022-09-17 12:30:13 +02:00
Dave Pagurek
468f2ccc0e GPencil: Add more types of stroke extensions when filling
The motivation for this change: while working on an animation recently, I found that there are some gaps that won't close easily via stroke extension or leak size checking. In D14698, I attempted to address this by changing the algorithm of the raster-space flood fill. This patch attempts to address the same issue in vector space by adding two new cases where stroke extensions are added, as suggested by @frogstomp:

  # **Points of high curvature:** when the curvature at a point is high enough that it's hard to visually distinguish between it and an endpoint, add a stroke extension out along the normal (pointing in the opposite direction of the stroke's acceleration.) This addresses cases where technically the endpoint points up, but there's a sharp corner right below it that should extend to connect.

  # **Stroke endpoints within a radius**: when two endpoints are close together, regardless of the angle they make, connect them if they are within a radius. This addresses cases like where the two endpoints have effectively parallel tangents, so extensions won't close the gap.

Reviewed By: antoniov, mendio, frogstomp

Differential Revision: https://developer.blender.org/D14809
2022-09-17 12:30:13 +02:00
Chris Blackbourn
b5115ed80f UV: rename "Pixel Snap Mode" to "Pixel Round Mode"
Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D15952
2022-09-15 10:36:13 +12:00
Bastien Montagne
38a77c1400 Fix T100977: Wrong native Ukrainian language name in UI. 2022-09-14 11:37:59 +02:00
Campbell Barton
39c341bf4a Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
2022-09-14 16:18:59 +10:00
Charlie Jolly
e1a9c16176 UI: Add Mix Node to color section of add node menu
This adds back the new mix node to the Color sections
of the add node menu.

The add menu now contains two entries for the mix node.

One under Utilites/Converter which defaults for float.

One under Color which defaults to color with `Mix Color` label.

This was moved as part of D13749.

The issue was reported on BlenderArtists.

Differential Revision: https://developer.blender.org/D15887
2022-09-13 23:06:40 +01:00
Jeroen Bakker
8068b89a68 EEVEE-Next: Cryptomatte render passes.
This change adds cryptomatte render passes to EEVEE-Next. Due to the upcoming viewport
compositor we also improved cryptomatte so it will be real-time. This also allows viewing
the cryptomatte passes in the viewport directly.

{F13482749}

A surface shader would store any active cryptomatte layer to a texture. Object hash is stored
as R, Asset hash as G and Material hash as B. Hashes are only calculated when the cryptomatte
layer is active to reduce any unneeded work.

During film accumulation the hashes are separated and stored in a texture array that matches
the cryptomatte standard. For the real-time use case sorting is skipped. For final rendering
the samples are sorted and normalized.

NOTE: Eventually we should also do sample normalization in the viewport in order to extract the correct
mask when using the viewport compositor.

Reviewed By: fclem

Maniphest Tasks: T99390

Differential Revision: https://developer.blender.org/D15753
2022-09-13 11:07:38 +02:00
Aaron Carlisle
c8b6062d6c Update RNA to User manual mappings 2022-09-12 19:09:32 -04:00
Bastien Montagne
ec2e866aee UI: Cleanup/Fixes of some UI messages. 2022-09-12 14:18:17 +02:00
Alexander Gavrilov
33abb68cf2 UI: add a Custom Properties panel to the View Layer tab of properties.
Although view layers aren't ID, they do support custom properties,
so not providing the UI to access them seems to be a simple oversight.
2022-09-12 10:31:53 +03:00
Antonio Vazquez
8b612c6496 GPencil: Add new Set Start Point operator to context menu 2022-09-10 16:12:18 +02:00
Antonio Vazquez
98c4e1e590 GPencil: New Set Start point operator
This operator allows to set the start point for any cyclic stroke.

This is very handy to fit interpolation issues or
use thickness modifier.

Note: There is small change in this commit to fix
a typo error in the name of the operator.

Reviewed By: mendio, frogstomp

Maniphest Tasks: T100827

Differential Revision: https://developer.blender.org/D15881
2022-09-10 15:43:20 +02:00
Campbell Barton
eae081f8fd Cleanup: format, spelling 2022-09-10 14:17:32 +10:00
Hans Goudey
291c313f80 Mesh: Move bevel weight out of MVert and MEdge
As described in T95966, the goal is to move to a "struct of arrays"
approach rather than gathering an arbitrary set of data in hard-coded
structs. This has performance benefits, but also code complexity
benefits (this patch removes plenty of code, though the boilerplate
for the new operators outweighs that here).

To mirror the internal change, the options for storing mesh bevel
weights are converted into operators that add or remove the layer,
like for some other layers.

The most complex change is to the solidify modifier, where bevel
weights had special handling. Other than that, most changes are
removing clearing of the weights, boilerplate for the add/remove
operators, and removing the manual transfer of bevel weights
in bmesh - mesh conversion.

Eventually bevel weights can become a fully generic attribute,
but for now this patch aims to avoid most functional changes.

Bevel weights are still written and read from the mesh in the old way,
so neither forward nor backward compatibility are affected. As described
in T95965, writing in the old format will be done until 4.0.

Differential Revision: https://developer.blender.org/D14077
2022-09-09 08:29:47 -05:00
Julian Eisel
e254d8867d Outliner: Hide library overrdies context menu when no IDs are selected
The library overrides context menu operators only make sense when at
least one ID is selected in the Outliner. So don't show them unless
that's the case. This also means the menu items don't show up anymore
for things like RNA properties, or the overridden properties in the
Library Overrides Properties view.

Also see 7eda9d8dda59 and the previous commit.
2022-09-09 14:04:27 +02:00
Julian Eisel
860c3dce1b Outliner: Don't show asset context menu when no IDs are selected
The asset context menu operators only make sense when at least one ID is
selected in the Outliner. So don't show them unless that's the case.
This also means the menu items don't show up anymore for things like RNA
properties, or the overridden properties in the Library Overrides
Properties view.

Also see 7eda9d8dda59.
2022-09-09 14:04:27 +02:00
Julian Eisel
b5fc8f611e Outliner: Hide ID type filter for library overrides
a) There were two filter icons next to each other in the header which
isn't exactly professional, b) the filter was redundant since IDs are
now grouped under an ID type element ("Objects", "Collection", ...)
anyway.
In the hierarchies view it was already hidden (because the whole point
of it is to show relationships between IDs, you wouldn't want to have
any parts of the hierarchy hidden).
2022-09-08 14:19:59 +02:00
Julian Eisel
2a769e76a0 Outliner: Hide search options for library overrides hierarchies view
Searching isn't possible in the hierarchies view anymore, so the options
for it shouldn't be displayed either.
Followup to 21b92a5f31a4, forgot to remove these.
2022-09-08 14:10:58 +02:00
Julian Eisel
21b92a5f31 Outliner: Hide search button for library overrides hierarchies view
c9a996790307 added a workaround for performance issues in heavy
production scenes in the library overrides hierarchies view, reducing
the amounts of elements to be built. Searching for elements would still
have to build the entire tree, so Blender would essentially freeze when
searching in mentioned heavy scenes. Removing the search functionality
works around this issue for now.
2022-09-08 12:54:49 +02:00
Campbell Barton
3f5505b4cb Cleanup: de-duplicate bounding box center calculation 2022-09-07 15:14:50 +10:00
Campbell Barton
adb746415f Cleanup: add sections, use float literals 2022-09-07 15:14:50 +10:00
Campbell Barton
7c52f18f15 Cleanup: format 2022-09-07 15:14:49 +10:00
Chris Blackbourn
20daaeffce UV: add new operator, uvcalc_align_rotation
Adds a new operator to automatically rotate UV Islands into alignment.

Modes:
* Auto (All edges)
* Geometry (V direction will point in geometry direction) [1]
* Edge (Rotate until selected edge is in V direction)

Also adds uv_sync_selection support to UV Randomize Transform.

Resolves: T78399
Differential Revision: https://developer.blender.org/D15820

[1] Listed as "World" in Task description.
2022-09-07 16:26:32 +12:00
Brecht Van Lommel
44619eaa32 Cleanup: make format 2022-09-05 17:25:05 +02:00
Damien Picard
19b9ea72b0 I18n: extract keymap preferences
The per-keymap user preferences messages were not extracted. This goes
through the keymap preferences RNA, as well as Python files for UI.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15871
2022-09-05 15:37:09 +02:00
Damien Picard
dead26b577 I18n: translate untitled file names
When saving, the default file name is "untitled" regardless of
selected language. This can be translated, like many graphical
applications do.

This applies to:
- blend file
- alembic file
- collada file
- obj file
- usd file
- rendered image
- grease pencil export
- subtitles export
- other Python exports through ExportHelper

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15868
2022-09-05 15:29:20 +02:00
Antonio Vazquez
141d5cac3a GPencil: Move Outline operator in menu
Reviewed by: Matias Mendiola
2022-09-05 15:20:20 +02:00
Antonio Vazquez
fbf875a3da GPencil: Move Scale Thickness option in menu
The option is more logic in the Normalize group

Reviewed by: Matias Mendiola
2022-09-05 15:16:42 +02:00
Harley Acheson
1a641b449a BLF: Replacement of Hebrew Font
Replacement of our Hebrew font, which has bad variable weight default.

See D15846 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-02 10:54:03 -07:00
Clément Foucault
65ad36f5fd DRWManager: New implementation.
This is a new implementation of the draw manager using modern
rendering practices and GPU driven culling.

This only ports features that are not considered deprecated or to be
removed.

The old DRW API is kept working along side this new one, and does not
interfeer with it. However this needed some more hacking inside the
draw_view_lib.glsl. At least the create info are well separated.

The reviewer might start by looking at `draw_pass_test.cc` to see the
API in usage.

Important files are `draw_pass.hh`, `draw_command.hh`,
`draw_command_shared.hh`.

In a nutshell (for a developper used to old DRW API):
- `DRWShadingGroups` are replaced by `Pass<T>::Sub`.
- Contrary to DRWShadingGroups, all commands recorded inside a pass or
   sub-pass (even binds / push_constant / uniforms) will be executed in order.
- All memory is managed per object (except for Sub-Pass which are managed
   by their parent pass) and not from draw manager pools. So passes "can"
   potentially be recorded once and submitted multiple time (but this is
   not really encouraged for now). The only implicit link is between resource
   lifetime and `ResourceHandles`
- Sub passes can be any level deep.
- IMPORTANT: All state propagate from sub pass to subpass. There is no
   state stack concept anymore. Ensure the correct render state is set before
   drawing anything using `Pass::state_set()`.
- The drawcalls now needs a `ResourceHandle` instead of an `Object *`.
   This is to remove any implicit dependency between `Pass` and `Manager`.
   This was a huge problem in old implementation since the manager did not
   know what to pull from the object. Now it is explicitly requested by the
   engine.
- The pases need to be submitted to a `draw::Manager` instance which can
   be retrieved using `DRW_manager_get()` (for now).

Internally:
- All object data are stored in contiguous storage buffers. Removing a lot
   of complexity in the pass submission.
- Draw calls are sorted and visibility tested on GPU. Making more modern
   culling and better instancing usage possible in the future.
- Unit Tests have been added for regression testing and avoid most API
   breakage.
- `draw::View` now contains culling data for all objects in the scene
   allowing caching for multiple views.
- Bounding box and sphere final setup is moved to GPU.
- Some global resources locations have been hardcoded to reduce complexity.

What is missing:
- ~~Workaround for lack of gl_BaseInstanceARB.~~ Done
- ~~Object Uniform Attributes.~~ Done (Not in this patch)
- Workaround for hardware supporting a maximum of 8 SSBO.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15817
2022-09-02 18:45:14 +02:00
Germano Cavalcante
8cfca8e1bd PyGPU: only use 3D shaders and rename string enums
Since rB6269d66da, creating formats no longer depends solely on the
shader, but now depends on the dimensions used to fill the VBOs.

This allows 3D shaders to work flawlessly when assigned dimensions are
2D.

So there's no real benefit to us having shaders that are limited to 2D
use anymore.

This limitation makes it difficult to implement other builtin shaders
as they indirectly require a 2D version.

So this commit removes the 2D versions of the builtin sahders used in
Python , renames the string enums but keeps the old enums working for
backward compatibility.

(This brings parts of the changes reviewed in D15836).
2022-09-02 09:39:09 -03:00
Germano Cavalcante
6269d66da2 PyGPU: GPUShader: implementation of 'attrs_info_get' method
With the new `attrs_info_get` method, we can get information about
the attributes used in a `GPUShader` and thus have more freedom in the
automatic creation of `GPUVertFormat`s

Reviewed By: fclem, campbellbarton

Differential Revision: https://developer.blender.org/D15764
2022-09-01 08:25:55 -03:00
Joseph Eagar
ab8240fcff Fix submodule refs 2022-08-31 10:02:42 -07:00
Joseph Eagar
373e69b94e Merge branch 'blender-v3.3-release' 2022-08-31 09:46:33 -07:00
Dalai Felinto
370b17a8c6 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-31 16:30:57 +02:00
Dalai Felinto
0864ab5248 UI: Fix order of Geometry Nodes in the Add Nodes Mesh menu 2022-08-31 16:29:13 +02:00
Antonio Vazquez
ae79bc490a GPencil: Apply Brush Size to Outline thickness while drawing
The new factor allows to apply the current brush size to the
external stroke perimeter conversion done in draw mode.
2022-08-31 16:18:08 +02:00
Hans Goudey
f1c0249f34 Mesh: Move material indices to a generic attribute
This patch moves material indices from the mesh `MPoly` struct to a
generic integer attribute. The builtin material index was already
exposed in geometry nodes, but this makes it a "proper" attribute
accessible with Python and visible in the "Attributes" panel.

The goals of the refactor are code simplification and memory and
performance improvements, mainly because the attribute doesn't have
to be stored and processed if there are no materials. However, until
4.0, material indices will still be read and written in the old
format, meaning there may be a temporary increase in memory usage.

Further notes:
* Completely removing the `MPoly.mat_nr` after 4.0 may require
  changes to DNA or introducing a new `MPoly` type.
* Geometry nodes regression tests didn't look at material indices,
  so the change reveals a bug in the realize instances node that I fixed.
* Access to material indices from the RNA `MeshPolygon` type is slower
  with this patch. The `material_index` attribute can be used instead.
* Cycles is changed to read from the attribute instead.
* BMesh isn't changed in this patch. Theoretically it could be though,
  to save 2 bytes per face when less than two materials are used.
* Eventually we could use a 16 bit integer attribute type instead.

Ref T95967

Differential Revision: https://developer.blender.org/D15675
2022-08-31 09:09:01 -05:00
Thomas Dinges
caa352bc45 Merge branch 'blender-v3.3-release' 2022-08-31 09:44:15 +02:00
Thomas Dinges
e2deee73ab Update freedesktop file.
Add new features for upcoming Blender 3.3 and also missing 3.2 notes, which were not merged to master.
2022-08-31 09:42:17 +02:00
Charlie Jolly
bfa0ee13d5 Node: Mix node
This patch is a response to T92588 and is implemented
as a Function/Shader node.

This node has support for Float, Vector and Color data types.

For Vector it supports uniform and non-uniform mixing.

For Color it now has the option to remove factor clamping.

It replaces the Mix RGB for Shader and Geometry node trees.

As discussed in T96219, this patch converts existing nodes
in .blend files. The old node is still available in the
Python API but hidden from the menus.

Reviewed By: HooglyBoogly, JacquesLucke, simonthommes, brecht

Maniphest Tasks: T92588

Differential Revision: https://developer.blender.org/D13749
2022-08-31 00:13:57 +01:00
Hans Goudey
25237d2625 Attributes: Improve custom data initialization options
When allocating new `CustomData` layers, often we do redundant
initialization of arrays. For example, it's common that values are
allocated, set to their default value, and then set to some other
value. This is wasteful, and it negates the benefits of optimizations
to the allocator like D15082. There are two reasons for this. The
first is array-of-structs storage that makes it annoying to initialize
values manually, and the second is confusing options in the Custom Data
API. This patch addresses the latter.

The `CustomData` "alloc type" options are rearranged. Now, besides
the options that use existing layers, there are two remaining:
* `CD_SET_DEFAULT` sets the default value.
  * Usually zeroes, but for colors this is white (how it was before).
  * Should be used when you add the layer but don't set all values.
* `CD_CONSTRUCT` refers to the "default construct" C++ term.
  * Only necessary or defined for non-trivial types like vertex groups.
  * Doesn't do anything for trivial types like `int` or `float3`.
  * Should be used every other time, when all values will be set.

The attribute API's `AttributeInit` types are updated as well.
To update code, replace `CD_CALLOC` with `CD_SET_DEFAULT` and
`CD_DEFAULT` with `CD_CONSTRUCT`. This doesn't cause any functional
changes yet. Follow-up commits will change to avoid initializing
new layers where the correctness is clear.

Differential Revision: https://developer.blender.org/D15617
2022-08-30 14:56:05 -05:00
Hans Goudey
4d107041ec Merge branch 'blender-v3.3-release' 2022-08-30 10:43:36 -05:00
Hans Goudey
002f339aed Fix: Alphabetical order in duplicate data preferences panel 2022-08-30 08:22:31 -05:00
Campbell Barton
e0ab4b29a9 Merge branch 'blender-v3.3-release' 2022-08-30 21:07:31 +10:00
Campbell Barton
524d9a3e2f Fix error in operator poll functions
- PALETTE_OT_color_add: crashed without a brush.
- SCREEN_OT_actionzone: crashed without a window.
- PREFERENCES_OT_studiolight_show: exception when opening prefs failed.
2022-08-30 21:06:17 +10:00