Since matrices are usually indexed **row first**, displaying matrices in
the UI seems flipped.
They are stored as flat arrays.
When `matrix[1][0]` is accessed via python, the logic from
`pyrna_py_from_array_index` will actually look up index 2 in the flat
array (rightfully so).
But UI code was flipped in that regard.
The second value in the flat array **should** show at row 1 column 0,
but it currently doesnt.
Now (hopefully) handled properly (not only in `ui_item_array` but also
made code in `ui_item_rna_size` detect proper row count for a `height`)
Pull Request: https://projects.blender.org/blender/blender/pulls/148197
Reported for the geometry nodes gizmos, but in general `cage2d`,
`cage3d` and `arrow` were affected (so for example Forcefield arrows, UV
editing transform tool, Lamp angle gizmo, ...)
`gizmo_cage3d_modal`, `gizmo_cage2d_modal` and `gizmo_arrow_modal` add a
`WM_event_add_mousemove` which ... lets the modal run even if the mouse
does **not** move...
This seems to date back to d8f931c9b7 in the arrow gizmo, others
probably just copied from there (not the DialGizmo though), did not do
further git archeology.
Propose to just remove `WM_event_add_mousemove` (even though there
_might_ still be reasons for this -- could not spot any though...)
Pull Request: https://projects.blender.org/blender/blender/pulls/146310
The issue is in the `ED_region_overlap_isect_` family of functions I
believe. Their purpose is to check if a coordinate is in the
"non-transparent" or opaque parts of the overlapping region.
These are getting event coordinates (in window space), converted to
region relative space (substracting region->winrct).
Comparison is in view space (through `UI_view2d_region_to_view_y`)
to account for scrolling and zooming.
The thing where it goes wrong is that we are actually comparing to
`region->v2d.tot` (this can be huge, most of it not visible), where I
think we should be comparing to `region->v2d.cur` (that is the part that
is actually visible...)
Swapping `region->v2d.tot` with `region->v2d.cur` is what this PR does.
Pull Request: https://projects.blender.org/blender/blender/pulls/146032
Oversight in 4bede1b555
`transformApply` / `transformEnd` already gives us a `NC_MASK |
NA_EDITED` notifier (via `viewRedrawForce`), so listen to that in
`image_main_region_listener`.
NOTE: alternatively, we could send an appropriate notifier in
`special_aftertrans_update__mask` (or remove the condition from the one
that is already there), with the difference that the gizmo would only
update after the transform is confirmed -- which may or may not be
desired
Pull Request: https://projects.blender.org/blender/blender/pulls/146292
The recently introduced size, strength, and jitter pressure curves
affect most paint code. This exposed further odd behavior inside
`paint_brush_update` where the size pressure curve was being evaluated
even if the brush's size did not vary with pressure.
To fix this issue, this commit clarifies a few comments and updates the
code flow such that cached input values and evaluated pressure values
are used more consistently.
Pull Request: https://projects.blender.org/blender/blender/pulls/148077
The Cycles cpu/device.cpp `device_cpu_capabilities()` function used to
fill out a string of supported CPU capabilities separated with spaces,
with some trailing-space cleaning logic at the end of the function.
However, if no check succeeded, and especially after commit 2bf6d0fd71
which left only one check and removed the need for removing trailing
spaces, the check would run against an empty string, resulting in an
unsigned 0 - 1 operation which would then cause an out of bound access
catched by ASan.
Fixed by removing the now superflous trailing space cleaning logic and
simplifying to a direct return.
Pull Request: https://projects.blender.org/blender/blender/pulls/148227
Rewrite the "mesh is valid" and "validate mesh" functions to be more
agnostic of the custom data storage system, align with the changes to
topology storage in the last 5 years, be much clearer overall, more
reusable.
Each check is implemented as a separate pass over the remaining
valid geometry in the mesh, producing an IndexMask of the invalid
elements it finds. At the cost of some extra iteration over mesh elements,
this should make each requirement clearer and make it easier to
optimize and reuse each check if needed.
The code is roughly twice as fast as it was before. I measured 92ms
instead of 200ms for a 1 million vertex cube on a Ryzen 7950X.
There's a bit of low hanging fruit for further optimization too.
There are now automated tests just for the validation code as well.
For now they are very basic but they could be extended in the future.
Some non-obvious points:
- The new face offsets storage (replacing `MPoly`) upholds more
invariants by itself. Previously faces could easily overlap or leave
corners unreferenced. That doesn't really happen anymore, but
bad offset values are a more "global" problem.
- The validation code for the old "MFace" storage was removed. It is
just rebuilt when it's needed at runtime anyway, so there isn't much
point in validating it.
- The versioning code for 2.90.1 was calling the mesh validation code
to fix an issue where the extrude manifold tool could generate bad faces.
Unfortunately keeping that would mean being unable to remove the old
code, so now there's a warning to open and save the file in a previous
version instead.
- One of the main goals of the new code is better const correctness, and
working better with implicit sharing. The code now only requests mutable
copies of the mesh data if it has to change.
Part of #122398
Pull Request: https://projects.blender.org/blender/blender/pulls/148063
This was caused by 3dfec1ff73
which introduce the new behavior. This was to fix workflows
using a lot of semi-transparent objects which made nagivation
difficult.
This patch first roll back to the previous behavior: The
unselectable object will affect depth-aware operators.
This patch introduces a new visibility property to remove
the influence of objects in all depth picking operations
and selection operations. However the object is still
selectable through non-drawing selection operators
(e.g. select by material) and through the outliner.
This is to adress the aforementionned navigation issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/146706
644fb2b679 fixed a long standing issue
that offscreen example showed the wrong colors. However the fix assumes
that input texture color space is always sRGB.
This adds a shader variation that draws textures that are stored in scene referred
linear color space (like all of our Image data-block).
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/147788
Adding panel toggles in nodegroups have somewhat of a UX antipattern. When
running the operator, it checks for conditions that indicate it should not run,
and if those are hit, it cancels execution and mentions the invalid condition in
the footer bar.
This is not ideal, the user should not have to call the operator to find out
whether it can be called.
Why it got implemented like this is likely a consequence of all interface items
being the same "New Item" operator. Poll functions cannot use operator
properties, so variants of the same operator cannot check for different
conditions for execution.
This is a problem for panel toggles, as they have more restrictions to when they
can be added that don't apply to other interface items.
This patch creates a separate operator for adding panel toggles. This allows the
condition checks to be implemented in the poll function, which enables greying
out the operator buttons and showing on tooltips what condition is invalid.
Pull Request: https://projects.blender.org/blender/blender/pulls/146379
The implementation of this was broken and not actually used for the EEVEE
tests, as there is currently no separate reference directory for AMD.
Move it to the render report module so it can be reused by different tests.
Pull Request: https://projects.blender.org/blender/blender/pulls/148148
Only use this feature when building for 1 or 2 CUDA architectures.
Otherwise CMake will build the binaries in parallel, and NVCC will then
also launch multiple threads for each binary.
We could add more manual control for this, but the main use case for
this is local builds and an automatic heuristic seems more likely to
help than an option that developers or users might not discover.
For minimal memory usage WITH_CYCLES_CUDA_BUILD_SERIAL still exists
to use only 1 thread for CUDA compilation.
Pull Request: https://projects.blender.org/blender/blender/pulls/147303
It's not very obvious to some people what the effect will be from
looking at the thumbnail alone. Also, we plan to make the thumbnails
smaller (48px vs 64px) by default to match other asset shelves size.
This PR updates the thumbnails by making the effects stronger. See PR
for example images.
Pull Request: https://projects.blender.org/blender/blender/pulls/148192
The issue was that the data-blocks of two different undo steps were detected to
be identical, even if the attributes changed. That's because even if the
implicitly-shared data was different, they were turned into the same pointer by
cadb3fe5c5 on write.
This patch makes it so that for undo steps, implicitly shared data does not use
the pointer stability feature (in a sense, implicit-sharing itself provides
pointer stability for undo steps already).
The main tricky aspect is that we need to know if a pointer is implicitly shared
in `writestruct_at_address_nr` and oftentimes that's called before the
corresponding shared data is actually written with `BLO_write_shared`. The
solution is to enforce that the blend-write code has to know what pointers are
implicitly-shared before they are written the first time. The simplest way to
ensure that is to call `BLO_write_shared` first. However, that's not always
possible, especially when the pointer is directly embedded in an ID. Therefore,
there is a new `BLO_write_shared_tag` function that can be used in such cases.
The undo performance for the file in #141262 is still fixed with this change.
Pull Request: https://projects.blender.org/blender/blender/pulls/148144
This is an alternate solution to !146889 to improve labels in the
camera UI, while being much less invasive. It doesn't take custom
labels into account, but it simply uses the parameter names with title
case.
Pull Request: https://projects.blender.org/blender/blender/pulls/148141
When saving asset catalogs to an already-existing file, only perform
that save when there were local changes to the catalogs. This prevents
unnecessary writes to the catalog definition file, as that can cause
conflicts when multiple Blender instances share the same asset library
(either directly or via Syncthing/Dropbox/etc.)
Pull Request: https://projects.blender.org/blender/blender/pulls/148205