1
1
Commit Graph

123129 Commits

Author SHA1 Message Date
fbf091750c Sculpt: cleanup sculpt attribute API
* `BKE_sculpt_vertex_attr_get` (and it's alias `SCULPT_vertex_attr_get`)
  is now `blender::bke::paint::vertex_attr_ptr`.  Same for the face
  versions of those functions.  The SCULPT_XXX aliases are removed.
* Removed code duplication; `[vertex/face]_attr_ptr` now just calls
  a generic template (`elem_attr_ptr`).
* Added `[vertex/face]_attr_get` and `[vertex/face]_attr_set` functions
  to get/set attribute data without pointer wrangling.
* Given the unwieldly length of `blender::bke::paint::` it's recommended
  to do a `using blender::bke::paint;` at the top of sculpt files.

Example: `float w = vertex_attr_get<float>(vertex,
ss->attrs.automasking_factor);`
2023-04-13 12:12:56 -07:00
97c05aa288 Transform: improve visualization when dragging Gizmos
Apply the changes suggested at #103782

It includes:
- Draw dot at the origin the active gizmo
- Hide other gizmos while dragging (except the move arrows)

Other changes:
- Draw shadow for the move and scale circle gizmos (while transforming)

Pull Request: blender/blender#104624
2023-04-13 20:23:03 +02:00
bdd6e617ea Cleanup: expose utility that finds a gizmo through its properties
Some properties may have the pointer stored in the gizmo structure
itself.

Reading from the struct directly is useful for cases where the value is
accessed frequently but not often required by the caller.

A disadvantage is that the property may not be saved in the file.
2023-04-13 15:18:44 -03:00
fa13058fa6 UI: Color Picker Positioning
If there is not enough space for the Color Picker either above or below
the launching button, adjust the position to fit instead of clipping.

Pull Request: blender/blender#106122
2023-04-13 19:44:54 +02:00
71ed98debe Point Cloud: Avoid unnecessarily initializing initial positions
Similar to e35f971da1. We aren't meant to rely on the
zero-initiatialization on creation anyway. I observed a small (a few
percent) decrease in minimum runtime in the geometry nodes points node.
2023-04-13 12:49:16 -04:00
197e9b9f80 Cleanup: Use more descriptive function name in extrude node 2023-04-13 12:49:16 -04:00
a7bee90c1d Cleanup: Add access method for point cloud positions
The position attribute has special meaning for point clouds, and
meshes and curves have access methods for the attribute as well.
This saves boilerplate and gives more consistency between types.
2023-04-13 12:49:16 -04:00
cef128e68a Fix menu padding in Console editor header
The View menu was a few pixels to the right compared to all other editors.
2023-04-13 18:06:12 +02:00
5ba35b3d15 Fix #106748: Rendering with OSL fails with OPTIX_ERROR_PIPELINE_LINK_ERROR
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
2023-04-13 15:52:23 +02:00
936e608382 Cleanup: Deduplicate curves data-block copying
After 7eee378ecc, the logic is the same in the
CurvesGeometry copy constructor and the curves data-block
copying.
2023-04-13 09:26:13 -04:00
1db918f948 Fix #106901: Dangling pointer after freeing mesh runtime data
This lead to a double-free when deleting the mesh runtime
struct after explicitly clearing the derived caches separately.
2023-04-13 09:21:22 -04:00
7eee378ecc Custom Data: support implicit sharing for custom data layers
This integrates the new implicit-sharing system (from fbcddfcd68)
with `CustomData`. Now the potentially long arrays referenced by custom
data layers can be shared between different systems but most importantly
between different geometries. This makes e.g. copying a mesh much cheaper
because none of the attributes has to be copied. Only when an attribute
is modified does it have to be copied.

Also see the original design task: #95845.

This reduces memory and improves performance by avoiding unnecessary
data copies. For example, the used memory after loading a highly
subdivided mesh is reduced from 2.4GB to 1.79GB. This is about 25%
less which is the expected amount because in `main` there are 4 copies
of the data:
1. The original data which is allocated when the file is loaded.
2. The copy for the depsgraph allocated during depsgraph evaluation.
3. The copy for the undo system allocated when the first undo step is
  created right after loading the file.
4. GPU buffers allocated for drawing.

This patch only gets rid of copy number 2 for the depsgraph. In theory
the other copies can be removed as part of follow up PRs as well though.

-----

The patch has three main components:
* Slightly modified `CustomData` API to make it work better with implicit
  sharing:
  * `CD_REFERENCE` and `CD_DUPLICATE` have been removed because they are
    meaningless when implicit-sharing is used.
  * `CD_ASSIGN` has been removed as well because it's not an allocation
    type anyway. The functionality of using existing arrays as custom
    data layers has not been removed though.
  * This can still be done with `CustomData_add_layer_with_data` which
    also has a new argument that allows passing in information about
    whether the array is shared.
  * `CD_FLAG_NOFREE` has been removed because it's no longer necessary. It
    only existed because of `CD_REFERENCE`.
  * `CustomData_copy` and `CustomData_merge` have been split up into a
    functions that do copy the actual attribute values and those that do
    not. The latter functions now have the `_layout` suffix
    (e.g. `CustomData_copy_layout`).
* Changes in `customdata.cc` to make it actually use implicit-sharing.
* Changes in various other files to adapt to the changes in `BKE_customdata.h`.

Pull Request: blender/blender#106228
2023-04-13 14:57:57 +02:00
7e764ec692 GPU: Texture: Expose depth dimension extent
This function was not exposed outside of internal GPU module.

Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
2023-04-13 14:06:53 +02:00
aa6e95281f Add support for OpenPGL 0.5.0
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.

Pull Request: blender/blender#106861
2023-04-13 11:44:35 +02:00
c26083b6be Fix warning in the STL code
The fast_float is an external library, so move it to the
system includes which has less strict compiler flags applied.

This matches how other IO module use this library as well.

Pull Request: blender/blender#106892
2023-04-13 11:06:42 +02:00
e5d50b1787 Fix Cycles unknown passes logged when build with Cycles debug
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:

E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness

This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.

Pull Request: blender/blender#106863
2023-04-13 10:27:07 +02:00
34739f6a6d Fix #106672: MacOS/OpenGL doesn't draw anything Eevee related.
This PR reverts the breaking part of the #106535. This part doesn't seem
to be required to fix the HD4400-HD5500 issue.

Might also fix #106844.

Pull Request: blender/blender#106887
2023-04-13 10:18:44 +02:00
a899d57e57 Fix: Ignore hidden FCurves when framing y-extents
On hitting normalize,
when the y-extents of the Graph Editor are framed to the FCurves,
it didn't ignore hidden FCurves.
2023-04-13 09:52:05 +02:00
0e5c941049 Fix #106773: resolve Metal grease pencil fill
Changes to viewport state to resolve texture paint color
selection introduced a side effect wherein the correct
attachment size of a framebuffer was reset. This size is
needed when scissor regions are disabled to return the
state to its correct default. When this default was wrong,
certain operators would have incorrect offsets.

To maintain consistency with the OpenGL backend, the
Metal backend independently tracks the raw attachment
size using default_width/height. This will also reset to zero
when attachments are all removed, unlike other state which
may be retained.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#106857
2023-04-13 08:23:34 +02:00
ed4374f089 Fix #66722: file doesn't open if app not focused
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.

pull request #106769
2023-04-13 10:48:29 +05:30
0a270e3513 Revert "GHOST/Wayland: avoid up-scaling window content"
This reverts commit 4fe2685615.

Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).

After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.

Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
2023-04-13 13:14:24 +10:00
684dcd3680 CMake: use GCC's -fuse-ld=mold support (mold now requires GCC 12.1)
GCC did not support mold when support was initially added,
since then GCC has been updated to add support, removing the need
to point to a binary directory containing an alternative `ld` command.

Support for MOLD_BIN CMake option has been kept as mold may be installed
to standard location.
2023-04-13 13:14:19 +10:00
a7462f58d1 Fix missing import for DJV on APPLE
We might removing support for this if it's not used,
correct the import for now.
2023-04-13 13:14:17 +10:00
11ad851fbe Fix lightmap UV calculation ignoring unselected objects in edit-mode 2023-04-13 13:14:15 +10:00
ad5ec544c8 Cleanup: remove unused apply-image option from uvcalc_lightmap
Note that this was a quick update from Blender 2.4's API,
while many other improvements could be made - remove this option as
it does nothing.
2023-04-13 13:14:13 +10:00
61cb302dd5 Cleanup: sort cmake file lists 2023-04-13 13:14:11 +10:00
678dc456e3 Cleanup: remove duplicate class
Introduced in ba982119cd.
2023-04-13 13:14:09 +10:00
14905cd1d5 Cleanup: quiet pylint's inconsistent-return-statements warning
No functional changes as the return value either relied on None
evaluating to False or wasn't used.
2023-04-13 13:14:06 +10:00
6482f9fffe Cleanup: quiet various pylint warnings 2023-04-13 13:14:05 +10:00
84e72e8170 Cleanup: remove duplicate assignments, assign 'layout' early in draw(..)
Also remove unused assignments.
2023-04-13 13:14:03 +10:00
ab64bd264a Cleanup: consistent naming for tool_settings & operator properties
Use names:
- `tool_settings` instead of `ts`.

- `props` instead of `op` / `prop` / `op_props`
  As Python may reference operators, don't confuse the operator
  properties with an instance of the operator.

In both cases these names were already used for most scripts.
2023-04-13 13:14:01 +10:00
b0edd63752 Cleanup: avoid early imports, remove unused variable 2023-04-13 13:13:59 +10:00
741d8dc1e2 Cleanup: format, use C++ nullptr & function style casts 2023-04-13 13:13:57 +10:00
4bccbceb34 Cleanup: quiet GCC warnings 2023-04-13 13:13:56 +10:00
35071af465 Sculpt: Fix #104631: Tip Roundness on Paint brush causes jitering
I cleaned up the cube brush tip code quite a bit; more remains
to be done.  There is a new function to initialize cube
tip matrices, SCULPT_cube_tip_init.  It's currently only
used by the paint brush, I'll need to do a bit of testing
before using it for clay strips and multiplane scrape.

Note: SCULPT_cube_tip_init uses the brush local matrix code
to avoid code duplication (and to take advantage of the debouncing
that is done there).
2023-04-12 18:33:53 -07:00
d48939f103 Cleanup: Simplify uv packing engine
Migrating to use uv_phi[] for placement.
2023-04-13 10:05:19 +12:00
5ba30e07f2 Cleanup: Simplify uv packing api
Migrating preprocessing into the packing engine.
2023-04-13 10:01:43 +12:00
ecfdbaef9b Cleanup: format 2023-04-13 09:58:15 +12:00
2b565c6bd0 UI: Add slash character support to fuzzy search initials mode
Nodes with names separated by a slash / can
not be searched by their initials.

This commit adds the slash character to
the list of separators for this type of
fuzzy search.

Pull Request: blender/blender#106838
2023-04-12 23:53:36 +02:00
e35f971da1 Mesh: Avoid unnecessarily initializing corner topology arrays
This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
2023-04-12 15:49:09 -04:00
a04098ebba Fix: Incorrect creation of deform mesh with no deform modifiers
Logic error in 99c630cd9c, hidden by a null check
in `BKE_id_copy_ex`.
2023-04-12 15:42:14 -04:00
16de3ba759 Fix #106845: Extrude node crash when no faces added
The non-individual face mode needs to check if there are any new faces
before accumulating their corner offsets.
2023-04-12 15:40:55 -04:00
e03da77033 Curves: Avoid unnecessary allocations in copy and move constructors
These aren't used much in current code, but currently they created
offsets on the result curves, then just freed them again when copying
from the source data. In the future it might be better to completely
avoid using the base constructor in the first place.
2023-04-12 15:32:30 -04:00
dccd42766c Cleanup: Use swap to take ownership of mesh data
Swap is commonly used to implement move assignment since it's short
and the logic is relatively simple. Use is here to avoid the need to
spell out the copying and freeing manually. The `BKE_id_free` call
at the end of the function will free whatever data was swapped.
2023-04-12 15:08:15 -04:00
642bc5546a Cleanup: Access curves offsets in RNA with C wrapper function
This simplifies the process of adding implicit sharing to the curve
offsets in the future.
2023-04-12 14:58:17 -04:00
b7e9906337 Cleanup: Remove unnecessary check when allocating mesh face offsets
The assert already checks this, but even in release builds,
doing nothing is probably worse than a memory leak here.
2023-04-12 14:56:28 -04:00
dd229a9d54 Cleanup: Slightly CurvesGeometry reorganize read function
The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
2023-04-12 14:54:18 -04:00
87cd22f643 Cleanup: Use early return in legacy curve conversion
Return null instead of an empty curves data-block, which amounts to
the same thing in geometry nodes, with less potential for error in
the rest of the function.
2023-04-12 14:51:24 -04:00
2b6c1600cf UI: Allow Float Kerning for Text Objects
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.

Pull Request: blender/blender#105181
2023-04-12 19:11:53 +02:00
0ee0e8c0d4 UI: Tooltips for Assets
Show tooltips for Asset Browser items.

Pull Request: blender/blender#106189
2023-04-12 18:44:47 +02:00