Commit Graph

26927 Commits

Author SHA1 Message Date
Jacques Lucke
071b18a3cc Spreadsheet: support navigating instance trees
Previously, it was not possible to see detailed information about instances in
the spreadsheet. Only the attributes on the top level instances were shown. Now,
all nested instances can be inspected too.

Combined with #114910 this will make inspecting more complex geometry with the
spreadsheet much more feasible. It's also an important part of integrating
grease pencil into geometry nodes because it makes it more obvious how layers
are converted to curve instances.

The data-selection is split into two separate tree views now. One that selects
the geometry from the instance tree, and one that's used to select the geometry
component and domain within that geometry. We found that this works better than
combining both tree views into one (we tried that in #124186).

Pull Request: https://projects.blender.org/blender/blender/pulls/125293
2024-07-29 20:42:08 +02:00
Hans Goudey
a26819ad88 Fix #125400: Copy modifier to selected ignores modifier pinning
If we encounter this problem again it's probably worth extracting this
modifier addition to a helper function.
2024-07-29 10:19:18 -04:00
softyoda
5e9096829c Cycles: Add Central Cylindrical Panoramic camera model
This type of projection is often used e.g. in exhibitions that leverage big
curved screens.

Effectively, the frame is mapped onto a cylinder, with the x axis becoming the
longitude and y axis becoming the height.

Users can configure the min/max longitude, the min/max height and the radius of
the cylinder.

Co-authored-by: Lukas Stockner <lukas.stockner@freenet.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/123046
2024-07-29 15:03:57 +02:00
Falk David
a1630792cf Python: Attributes: Add domain_size function
This function returns the number of elements of a given domain.

Example:
```py
>>> attributes.domain_size('POINT')
500
```

Pull Request: https://projects.blender.org/blender/blender/pulls/125519
2024-07-29 11:14:50 +02:00
Falk David
0f42f277b7 Grease Pencil: Remove legacy modifiers
This removes the legacy Grease Pencil modifiers from the code.
These should have already been inaccessible from the UI and hidden from
the user. The modifiers have been reimplemented for the new GPv3
data structure.

On top of the modifier code, some other related things have been
removed as well:
 * Operators related to the legacy modifiers.
 * Keymaps for the legacy modifier operators.
 * Some bits of code that used modifier functions.

Some code has to be kept, because it is still used:
 * The core line art code, which is used by the new line art modifier. It's
    moved to `modifiers/lineart`.
 * The DNA structs for the legacy modifiers. They are still needed for
    conversion.
 * A few kernel functions for the modifiers are kept (also for conversion).

Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/125102
2024-07-29 10:37:29 +02:00
Campbell Barton
4afb3aff35 Cleanup: pass const arguments, use r_ prefixed return arg 2024-07-29 13:01:12 +10:00
Campbell Barton
004c247670 Cleanup: different declaration names, use r_ prefix for return args 2024-07-29 13:01:10 +10:00
Campbell Barton
111a40239a Cleanup: match argument names for function & declarations
Match function and declaration names, picking names based on
consistency with related code & clarity.

Also changes for old conventions, missed in previous cleanups:

- name -> filepath
- tname -> newname
- maxlen -> maxncpy
2024-07-27 13:32:51 +10:00
Sean Kim
f217dad8de Cleanup: Rename SubdivCCGNeighbors duplicate() to duplicates()
Avoid implying that the method duplicates the underlying data.

Pull Request: https://projects.blender.org/blender/blender/pulls/125520
2024-07-27 00:51:22 +02:00
Sean Kim
ac344aae1f Subdiv: Add neighbor slicing helper methods
Pull Request: https://projects.blender.org/blender/blender/pulls/125513
2024-07-26 21:42:09 +02:00
Sean Kim
eda872b6eb Cleanup: SubdivCCG: Add SubdivCCGCoord constructor from key and index
* Adds test for this usecase.
* Reduces existing duplicated code.

Pull Request: https://projects.blender.org/blender/blender/pulls/125511
2024-07-26 21:16:37 +02:00
Sean Kim
8a812e334d Fix #125375: Sculpt undo with duplicate object causes crash
Introduced with d527e3a6bd.

Cached values are tagged as dirty during the update step, this can cause
conflicts where we attempt to then flush then changes into the PBVH but
have not yet updated the mesh pointers and reinitialized them.

This commit forcibly initializes the underlying data to prevent such
cases from happening when flushing to the PBVH.

Pull Request: https://projects.blender.org/blender/blender/pulls/125396
2024-07-26 18:01:11 +02:00
Falk David
6f050fecfb GPv3: Python API for frame, drawing and drawing attributes
This is a PR that is built on top of #122094 (thanks to @SietseB
for the initial work).

Adds the following properties and functions:
* `layer.frames`,
* `layer.frames.new(frame_number)`
* `layer.frames.remove(frame_number)`
* `layer.frames.copy(from, to)`
* `frame = layer.get_frame_at(frame_number)`
* `frame.drawing`
* `frame.frame_number`
* `frame.select`: the selection state of the keyframe in the dope sheet
* `frame.keyframe_type`
* `drawing = frame.drawing`
* `drawing.type` (`DRAWING`/`REFERENCE`)
* `drawing.user_count`: The number of keyframes that use this drawing
* `drawing.attributes`: attribute read/write access to the drawing data

To be able to access attributes on drawings, a new
`AttributeOwnerType::GreasePencilDrawing` is added.
The API in `BKE_attributes.h` is updated to handle this type.

In `rna_attributes.cc`, there is a new
`rna_def_attribute_group_grease_pencil_drawing` that defines the
attribute group. For this to work, it also defines its own rna
callback functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/124787
2024-07-26 16:29:59 +02:00
Julian Eisel
489a5e92b8 Cleanup: Remove now unused asset identifier files
Missed this in 693e590d9f.
2024-07-26 15:12:51 +02:00
Julian Eisel
693e590d9f Refactor: Assets: Remove unnecessary asset identifier class
This was just rather useless level of abstraction. I heard from other
devs that these helper classes caused confusion, so better to avoid
this.

Now the asset representation has all the needed bits to create its full
path, blend-file path and asset library relative path. In fact only the
asset library relative path needs to be stored to make all this
available, since the asset representation already stores a reference to
the asset library owning it, so the paths can be recreated easily.
2024-07-26 15:03:06 +02:00
Sybren A. Stüvel
c7bf1a697e Anim: forward compatibility for F-Curves in layered Actions
When writing a layered Action to disk, take the F-Curves from the
first keyframe strip and write that as `action.curves` as well. This
will make older Blender versions see those curves and load them
properly.

Only the curves for the first slot are written this way. This means
that any legacy Action that was converted to a layered Action will be
loaded again properly by older Blender versions. Of course this is
limited to a single layer, single strip, and single slot -- once the
newer features are used, older versions of Blender will not be able to
see this extra data.

When an Action contains multiple slots, so with animation for multiple
distinct objects, the forward compatibility becomes a bit iffy. Older
versions of Blender will just see a legacy Action, with its legacy
semantics, and thus all objects that use that Action will receive the
exact same animation data. I don't think there's a way around this.
(_Unless we start breaking up Actions into an Action per slot, alter
the assignments, and then store metadata so that modern Blenders can
reassemble them. I do not think this is a good idea._)

Ref: #124714

Pull Request: https://projects.blender.org/blender/blender/pulls/125065
2024-07-26 11:13:40 +02:00
Sean Kim
6568629520 SubdivCCG: Add to_index helper method
This commit adds a method to compute the position of a given
SubdivCCGCoord in an appropriately sized array.

Pull Request: https://projects.blender.org/blender/blender/pulls/125462
2024-07-26 04:35:34 +02:00
Hans Goudey
d24957450c Cleanup: Remove unused BMesh fairing function 2024-07-25 13:45:00 -04:00
Hans Goudey
88b6910d06 Cleanup: Sculpt: Remove unnecessary allocation, use references 2024-07-25 13:45:00 -04:00
Harley Acheson
5bf44c6eb4 UI: Text Style for Tooltips
This gives users the ability to control the size of tooltip text
separately from other text styles. This is an accessibility issue
in that users with low vision can choose to make these larger than
the working text.

Pull Request: https://projects.blender.org/blender/blender/pulls/125147
2024-07-25 19:12:41 +02:00
Hans Goudey
4742fa7f40 Refactor: Sculpt: Remove BMesh custom data offset from BVH tree
Instead just compute the offsets as necessary. This avoids the need
to keep them in sync as the BMesh changes, though it requires passing
a few more arguments in the dynamic topology remeshing code.
2024-07-25 12:40:14 -04:00
Hans Goudey
6155c72237 Refactor: Sculpt: Remove PBVH BMesh log pointer
This log is owned by SculptSession, it's a bit misleading
to store a pointer to it in the sculpt BVH tree, and having
multiple mutable pointers to objects should generally be
avoided anyway. Now just pass it to the remeshing function
which is the oinly place it was needed anyway.
2024-07-25 12:40:13 -04:00
Hans Goudey
3199915f35 Cleanup: Switch to C++ API for 3D cursor transform
Replace the `BKE_scene_cursor` functions with member functions
of the `View3DCursor` DNA struct. This makes using the cursor's
transform simpler, especially in newer C++ code.

Pull Request: https://projects.blender.org/blender/blender/pulls/124903
2024-07-25 17:53:09 +02:00
Falk David
b1f747b19c Curves: Add explanation of magic number in calculate_point_handles
Add an explanation of the math for where the magic `2.5614f` comes from.

Pull Request: https://projects.blender.org/blender/blender/pulls/125302
2024-07-25 17:32:49 +02:00
Falk David
f34a4229e0 Fix: GPv3: Lineart: Conversion from 4.2 not working correctly
There were two issues:
* The target layer name was not copied over
* The thickness setting was being divided by two when it
resulted in thinner strokes.
2024-07-25 12:08:19 +02:00
Falk David
d2714dab7d Cleanup: GPv3: static function name for lineart conversion 2024-07-25 12:08:19 +02:00
Sybren A. Stüvel
651a7522a4 Refactor: Anim, rename leftover 'binding' references to 'slot'
Rename leftover references to action 'bindings' to 'slot':

- Two comments, and
- bunch of `bind_` variable prefixes, renamed to `slot_`.

No functional changes.
2024-07-25 12:04:05 +02:00
Sybren A. Stüvel
9427ec3f40 Fix #125063: Anim: layered Action data is still loaded in 4.2-release
Add `#ifdef WITH_ANIM_BAKLAVA` to the blend file reading/writing code,
so that the Action layers & slots are ignored when Blender is built
without experimental features.

This ensures that any loaded Action is just treated as 'legacy' (which
is the only kind of Action non-experimental Blender should have to deal
with), which will also properly deal with the forward compatible data
written by !125065.

This fix was committed on the `blender-v4.2-release` branch as
1b7485f20892523942752f81239807b2eab0f00b.

Pull Request: https://projects.blender.org/blender/blender/pulls/125068
2024-07-25 11:38:40 +02:00
Campbell Barton
8418ec4952 CMake: include headers in source lists 2024-07-25 11:24:11 +10:00
Campbell Barton
547b63b69b Cleanup: sort cmake file lists 2024-07-25 11:24:10 +10:00
Campbell Barton
c589634f73 Cleanup: use colon after parameters 2024-07-25 10:17:45 +10:00
Campbell Barton
2edc2393d2 Cleanup: spelling in comments 2024-07-25 10:17:42 +10:00
Sean Kim
53df43e064 Cleanup: Move variable initialization into struct definition
Pull Request: https://projects.blender.org/blender/blender/pulls/125388
2024-07-24 23:45:40 +02:00
Omar Emara
40be124184 Fix #122253: Image saving ignores EXR color format
All image saving mechanisms in Blender ignores the color format for EXR
images, including Render Pipeline, Save Operator, and File Output nodes.

To fix this, we first allow EXR images to be BW for flexibility. Then we
adjust the EXR saving code to take into account the required number of
channels. This is only done for single layer EXR images. Multi-layer EXR
images correctly ignores the option.

Pull Request: https://projects.blender.org/blender/blender/pulls/124807
2024-07-24 14:20:59 +02:00
Hans Goudey
45e4fecf9b Refactor: Separate mesh and multires PBVH building
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.
2024-07-24 07:54:59 -04:00
Hans Goudey
aa0ea3cf8f Cleanup: Remove "using" statements
The proper solution is to move the relevant code to the Blender
namespace. It should look ugly until then because it is.
2024-07-24 07:54:59 -04:00
Hans Goudey
dca3d87052 Cleanup: Remove unhelpful PBVH debugging utilities
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.
2024-07-24 07:54:59 -04:00
Hans Goudey
d4f824b5af Cleanup: Reorder functions to group PBVH building 2024-07-24 07:54:59 -04:00
Hans Goudey
9d1b230a55 Cleanup: Sculpt: Pass BVH nodes by reference 2024-07-24 07:54:59 -04:00
Hans Goudey
f9c6fe30db Sculpt: Extract bounds calculation from BVH build, parallelize
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.
2024-07-24 07:46:02 -04:00
Hans Goudey
8ab2a139ca Sculpt: Extract visibility calculation from BVH build, parallelize
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.
2024-07-24 07:46:02 -04:00
Hans Goudey
0da90f05fe Cleanup: Sculpt: Simplify scratch array usage for BVH build 2024-07-24 07:46:02 -04:00
Hans Goudey
d40751c7b2 Cleanup: Sculpt: Clarify naming of BVH node field 2024-07-24 07:46:01 -04:00
Hans Goudey
2401a022ab Cleanup: Sculpt: Reduce indirection for painting data access
Remove unnecessary structs that just hold pointers to other data
2024-07-24 07:46:01 -04:00
Hans Goudey
eed48ea5eb Cleanup: Sculpt: Remove unused PBVH struct 2024-07-24 07:46:01 -04:00
Campbell Barton
32c721767e Fix failure to toggle filtering for add-ons with long names
Regression from [0] which didn't increase the length of owner_id names.

[0]: 31cb31d736
2024-07-24 14:49:27 +10:00
Sean Kim
98c96e12a4 Refactor: Remove dead boundary loop calculation code
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
2024-07-24 05:21:39 +02:00
Sean Kim
06aa1ce7b2 Refactor: Switch vector of PBVHVertRef in SculptBoundary for int
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
2024-07-23 23:19:41 +02:00
Sean Kim
b518172ae5 Refactor: Remove SculptBoundary initial_vert field
Pull Request: https://projects.blender.org/blender/blender/pulls/125273
2024-07-23 23:05:03 +02:00
Sean Kim
6181569a21 Refactor: Replace sparse mesh-sized array with map
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
2024-07-23 23:03:57 +02:00