Though it results in more duplication currently, splitting these
could help to facilitate further performance improvements here
in the future, and it avoids passing a bunch of useless arguments
for the multires case.
These were mostly getting in the way of refactoring this code.
If the referenced problems actually happen, there would be
more obvious ways to observe the issues anyway.
This applies the same change as the previous commit to the bounds
of every BVH node. The bounds calculation can be changed to use
the standard functions from the regular BVH deformation.
In a simple test this makes building the sculpt BVH 64% faster.
I observed a change from 762ms to 464ms for a 1.9m vertex mesh.
This simplifies the BVH build process and potentially improves
its performance when parts of the geometry is hidden. The method
used to calculate whether a node is fully hidden is slightly different
too, vertex indices are used instead of triangle indices and a triangle
to face map.
After e3697710d0, if no UV map was found, then Cycles OSL would
generate UV coordinates for users. This was done to add UV coordinates
to lights, however it had the side effect of creating new UV
coordinates for other object types that don't have a UV map.
This lead to a rendering difference between OSL and SVM
when rendering meshes with no UV map, and objects with no
UV map, like curves.
This commit fixes this issue by adding a new "is_light" attribute to
Cycles OSL and using that to figure out if UV coordinates should be
generated for lights.
Pull Request: https://projects.blender.org/blender/blender/pulls/124673
Where possible, removes SculptSession as a parameter. Currently, this
only leaves the add_active function with this concept, as how we handle
this concept in the future is currently ambiguous
Pull Request: https://projects.blender.org/blender/blender/pulls/125352
Core extensions should have their bugs reported as any other issue in
Blender.
This PR removes their "Rrport a Bug" link.
I left the link only for glTF since it has its own tracker. But I
wouldn't mind removing it as well.
Ref: !125218
Originally added in ed9c0464ba.
`last_visited_vertex` was never assigned to inside the flood fill loop,
therefore the following conditional to check if it had been set would
always be false, meaning that `forms_loop` was always false.
Pull Request: https://projects.blender.org/blender/blender/pulls/125344
Commit adds support for new format of RawInput packets used by
3Dconnexion devices: SpaceMouse Enterprise, Keyboard Pro and Numpad Pro
specifically. This required distinguishing processing button data
delivered as a bitmask and as a numbers array.
Basically it allows for using said devices buttons in Blender including
using these buttons in shortcuts.
Changes work only for Windows. MacOS will allow only for older format
that is bitmask.
Details:
- NDOF button event values have been moved into the public GHOST_Types.h
header and are no longer aligned to the WM event values.
This was done so the values could be changed to match hardware/drivers
without breaking key-maps stored in user preferences.
- Keyboard Pro and Numpad Pro buttons are not currently used because
they don't map to any standard keyboard events.
These could be supported, see the PR for details.
Ref: !124155
Part of #118145
Both int indices and PBVVertRef objects are used in multiple places
throughout the sculpt_boundary.cc code. This commit removes the
external-facing PBVHVertRef in favor of the int index to make further
refactoring of the methods that use this data easier.
Pull Request: https://projects.blender.org/blender/blender/pulls/125274
Prior behavior for interactive area split would create the new area
immediately. If pulled from the top the new area would be above, while
if pulled from the bottom the new area would always be below. With
docking the split does not occur until the end, which would reverse
the area orders if the split was larger than 50%. This PR creates with
the old expected order, based on the starting position.
Pull Request: https://projects.blender.org/blender/blender/pulls/125338
Currently, the SculptBounary struct initializes and stores an array of
distances from the original boundary vert. However, this data is only
actually stored and calculated for boundary vertices, every other vertex
is initialized to 0.0f.
Pull Request: https://projects.blender.org/blender/blender/pulls/125278
Introduced in d527e3a6bd.
The change to update PBVH normals before destroying the PBVH to fix
shading on duplicate meshes issues had the unfortunate side effect of
causing crashes for multires due to a race condition. This commit
simply avoids performing this flushing for multires to allow for
further iteration in the future instead of reverting the offending
commit entirely.
Pull Request: https://projects.blender.org/blender/blender/pulls/125268
Part of #118145.
These days we aren't really benefiting from making PBVH an opaque type.
As we remove its responsibilities to focus it on being a BVH tree and look
to improve performance with data-oriented design, that will only become
more true.
There are some other future developments the current header structure
makes difficult:
- Storing selections of nodes with `IndexMask` for simpler iteration, etc.
- Specialization of node type for each PBVH type
- Reducing overhead of access to node data as nodes get smaller
- General C++ cleanliness and consistency
This PR moves `PBVH` to `blender::bke::pbvh::Tree` and moves `PBVHNode`
to `blender::bke::pbvh::Node`. Both are classes visible to elsewhere in Blender
but with private data fields.
The difficult part about the change is that we're in the middle of a transition
removing data from PBVH. Rather than making some data truly private I
chose to just give it the `_` suffix, since it will ideally be removed later.
Other things should be class methods or implemented as part of friend
classes. But the "fake" private status is much simpler for now and avoids
increasing the scope of this PR too much. Though that's a bit ugly, there's a
straightforward way to resolve these issues-- it just looks like the sort of
inconsistency you'd expect in the middle of a large refactor.
Pull Request: https://projects.blender.org/blender/blender/pulls/124919
When docking is enabled it is currently skipping the movement threshold
when holding down shift (dupli) or ctrl (swap). This PR adds that back
by not immediately applying unless no modifiers are held.
Pull Request: https://projects.blender.org/blender/blender/pulls/125329
Blendfile format expects all `BLO_CODE_DATA` bheads belonging to a same
ID 'space' to have unique identifiers (their old addresses).
When this is not the case, the blendfile is considered as corrupted.
Consequences can vary, from mere memory leaks, to catastrophic
unrecoverable crashes.
NOTE: This is what happens in file from #125001.
for transmissive closures the color is squared, but Blended square
BEFORE the weight is applied, and Dithered square AFTER the weight is
applied, causing difference in the final color.
This fix aligns the behaviour of Blended with Dithered.
NOTE that this is a partial fix, because Dithered is also behaving
incorrectly. A more proper fix would be !125233.
Pull Request: https://projects.blender.org/blender/blender/pulls/125299
Switching to an asset browser, then back to a different editor would
cause a crash when loading a new file.
Basically the file/asset browser tried to free dangling asset and asset
library pointers when trying to free itself. That's because the asset
system gets destructed with a `AS_asset_libraries_exit()` call before
the screen and with that the asset browser were freed.
Pull Request: https://projects.blender.org/blender/blender/pulls/125084
This commit covers the case where all objects get removed from local
view, and an undo or blendfile read leads to such empty local views.
It also adds code to remapping/foreachID View3D callbacks to tag
potential local views as 'maybe empty', and use the View3D refresh
callback to actually check and potentially exit the local empty view.
Pull Request: https://projects.blender.org/blender/blender/pulls/123128
In the case where the last layer is removed and all the drawings
have zero users, in the `remove_drawings_with_no_users` function
the `find_next_swap_index` lambda would return `false` on the
first call. Both `first_unused_drawing` and `last_used_drawing`
are `0` in this case. This meant that the `drawings_to_remove`
index mask would exclude the first drawing (because
`last_used_drawing` is the index of the first drawing) and not
remove it as it should.
To fix this, we check if `first_unused_drawing` is greater than zero.
If it is not, then we know all the drawings have to be removed.
Otherwise we only remove the drawings after
`last_used_drawing + 1`.
Pull Request: https://projects.blender.org/blender/blender/pulls/125318
The issue was that some `material_index` were `-1`. This meant that
the rendering code was accessing out-of-bounds memory to read
from the material pool.
The fix adds an assert to the `gpencil_material_resources_get` and
clamps the `material_index` to >= 0 to ensure that the material is
valid. It also changes the default read value for the material indices
in `create_curves_outline` and `retrieve_visible_strokes` to be 0
instead of -1.
Pull Request: https://projects.blender.org/blender/blender/pulls/125309
The code to create 'key lists' (for example to go to the next/previous
key) do so by creating fake data-structures (`bDopeSheet` and
`bAnimContext`). These are zero-initialised, very few fields are set,
and then passed to the generic animation filtering function. Because of
this, `bAnimContext::bmain` was `nullptr`, which caused the crash.
Instead of fixing the real issue (major design problems in the animation
channel/filtering code), I've made the use of `bmain` optional. The
pointer is necessary to find the animated data-blocks, in order to
resolve the RNA path of F-Curves to the animated properties, which in
turn is necessary to determine the F-Curve display name. If that name is
irrelevant (for example when finding the next/previous key) the `bmain`
is not necessary. This is now handled more or less properly, at least to
the extent that the crash is prevented.
Pull Request: https://projects.blender.org/blender/blender/pulls/125300