Commit Graph

25115 Commits

Author SHA1 Message Date
Falk David
f43426f0de GPv3: Rename layer domain to just "Layer"
We had a short discussion on this change. "Grease Pencil Layer" is
just a bit too long, especially in the UI. Even though "Layer" might be
ambiguous, it shouldn't be in the context of geometry nodes. There are
currently no other "Layers" and if there were, using the same domain
name could be fine (just like we reuse the point domain for e.g. vertices
in meshes and control points in curves).

This also renames the internal enum to `ATTR_DOMAIN_LAYER`

Pull Request: https://projects.blender.org/blender/blender/pulls/113589
2023-10-12 13:54:32 +02:00
Campbell Barton
db093a4608 Merge branch 'blender-v4.0-release' 2023-10-12 09:27:43 +11:00
Campbell Barton
b8ad624006 Cleanup: use doxygen doc-strings, spelling in comments 2023-10-12 09:26:53 +11:00
Miguel Pozo
1ba16edaf0 EEVEE-Next: Rename light probes
Update to the new naming convention for `Light Probes`:

`Reflection Cubemap` -> `Sphere`
`Reflection Plane` -> `Plane`
`Irradiance Grid` -> `Volume`

Note that this breaks the Python API (`bpy.types.LightProbe.type`).

Pull Request: https://projects.blender.org/blender/blender/pulls/113452
2023-10-11 19:38:42 +02:00
Jacques Lucke
c52582e3fe Fix: properties search crash
The issue was that the panel run-time pointer was overwritten by
the shallow copy.
2023-10-11 16:44:54 +02:00
Jacques Lucke
449ded0258 Fix #113545: crash when trying to create panel with unknown type
Caused by 6a6dd392e2.
2023-10-11 16:08:17 +02:00
Jacques Lucke
7a8600f967 Cleanup: remove accidentally committed asserts
I wanted to remove those before committing 6a6dd392e2.
2023-10-11 16:08:17 +02:00
Jacques Lucke
16ae169388 Cleanup: quite warning for function only used in debug build 2023-10-11 12:49:42 +02:00
Jacques Lucke
6a6dd392e2 Fix: copying panels in regions did not handle runtime data
Caused by 663aa353.
2023-10-11 12:48:40 +02:00
Jacques Lucke
1d516bba1e Cleanup: use C++ struct for panel runtime data 2023-10-11 11:52:46 +02:00
Jacques Lucke
80dd5a4f52 Cleanup: remove padding in runtime data 2023-10-11 11:49:35 +02:00
Jacques Lucke
613a0ad651 Cleanup: move panel runtime data out of dna header 2023-10-11 11:48:37 +02:00
Jacques Lucke
c393d2a4d9 Merge branch 'blender-v4.0-release' 2023-10-11 11:36:55 +02:00
Jacques Lucke
535d211c94 Fix #113386: separating by loose parts removes attribute data
The issue was that custom data layers were modified without checking
that the data was not shared. Now the data is unshared first.

I also added an assert to catches this kind of issue more directly.
2023-10-11 11:35:11 +02:00
Hans Goudey
a6a2af5fdd Fix: Sculpt dynamic topology doesn't draw active/render color attribute
Pass the mesh to the drawing functions so it doesn't have to be
retrieved from the PBVH. It's nice to rely less on the PBVH `me`
pointer, since it's a fairly ugly "back pointer" which isn't necessarily
good design.
2023-10-10 18:22:50 +02:00
Jacques Lucke
663aa3538d UI: allocate panel runtime data separately
This results in better separation for what is stored in .blend files and what is not.
Also allows us to potentially use C++ in panel run-time data.

Pull Request: https://projects.blender.org/blender/blender/pulls/113502
2023-10-10 18:17:31 +02:00
Germano Cavalcante
5429d892b7 Merge branch 'blender-v4.0-release' into main 2023-10-10 12:19:37 -03:00
Falk David
559c271a53 Clang-format 2023-10-10 16:59:56 +02:00
Bastien Montagne
a238ab737b Fix (unreported) liboverride: Hierarchy corruption when making some override local.
Making some liboverride local will break/corrupt liboverride hierarchies
in many cases. So that function (or its caller, in some cases) need to
call #BKE_lib_override_library_main_hierarchy_root_ensure to re-validate
(and re-generate if needed) the liboverride hierarchy roots.
2023-10-10 16:56:48 +02:00
Bastien Montagne
c5e10920f9 Fix (studio-reported) liboverride: hierarchy root ensure fails in some cases.
The code ensuring a valid liboverride hierarchy root ID pointer for all
liboverrides in a given Main would fail in some cases, and crash on
asserts (in Debug builds) or due to corrupted data later in code
(release builds).

The main issue fixed here is re-entry in case of dependency loops (a
same ID being checked more than once within the same chain of recursive
calls to ensure its hierarchy root is valid). Solved the usual way now,
using the intermediate 'PROCESSING' flag instead of setting immediately
the 'PROCESSED' one, when recursively processing the chain of
dependencies.

A second issue fixed in that code was that in some cases, it could leave
the invalid existing hierarchy root pointer unchanged, because it could
not find a 'valid enough' alternative.

NOTE: This data corruption is presumably caused by 'make local'
operations on liboverride hierarchy root IDs. This will be addressed as
a second commit.

For reference, issue is reproducible when opening
`/promo/splash/040_0010.lighting.splash.blend` from Pets SVN repo r3106.
2023-10-10 16:56:48 +02:00
Falk David
3931a54e08 GPv3: Initial Geometry Nodes support
This implements the core changes for this design: https://devtalk.blender.org/t/grease-pencil-integration-into-geometry-nodes/31220

The changes include:
* Add `CustomData` for layer attributes
* Add attribute support for the `GreasePencilComponent` to read/write layer attributes. Also introduces a `Layer` domain.
* Implement a `GreasePencilLayerFieldContext` and make `GeometryFieldContext` work with grease pencil layers.
* Implement `Set Position` node for `Grease Pencil`.

Note: These changes are only accessible/visible with the `Grease Pencil 3.0` experimental flag enabled.
Co-authored-by: Jacques Lucke <jacques@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/112535
2023-10-10 16:49:30 +02:00
Campbell Barton
57fc3d48b8 Merge branch 'blender-v4.0-release' 2023-10-10 22:49:58 +11:00
Campbell Barton
8d80d611e9 Use BLI_read instead of read to avoid issues with large files
Follow up to fix for #113473, similar issues exist elsewhere.
2023-10-10 22:47:35 +11:00
Hans Goudey
1ccba4d9fe Nodes: Use index instead of reordering for draw order
Currently nodes are reordered so that the "on top" nodes are last in
the list. Node order changing for simple operations like selection
means we either have to reevaluate the node tree data-block on
selections or accept that the evaluated order can be different from the
original. Currently we do the latter (see d76a0e98ba), but
makes it complex to access nodes by index, and is hard to reason about.

Instead of reordering nodes, store the ui order in the node itself
and sort the nodes before drawing them or doing any processing
that depends on the "depth."

The "selected_nodes" list in the context is no longer ordered by the
recent selection.

Pull Request: https://projects.blender.org/blender/blender/pulls/113419
2023-10-10 10:57:51 +02:00
Campbell Barton
acd54a2afb Merge branch 'blender-v4.0-release' 2023-10-10 14:57:00 +11:00
Campbell Barton
ae6b1ead4c Fix failure to check the error value for file-size access
Accessing the file size returns -1 on error, for file packing this
was passed directly to an allocation which would wrap around to
SIZE_T_MAX and fail to allocate. In other cases zero was treated
as an error value but -1 wasn't.

Add checks for the error return value, also warn that packing files over
2gb isn't supported.
2023-10-10 14:56:30 +11:00
Hans Goudey
a935701a87 Cleanup: Remove unnecessary struct keyword in BKE_object.hh
Pull Request: https://projects.blender.org/blender/blender/pulls/113464
2023-10-10 00:55:58 +02:00
Campbell Barton
137f8dd7bc Cleanup: spelling in comments 2023-10-10 09:44:57 +11:00
Hans Goudey
8f27baf388 Merge branch 'blender-v4.0-release' 2023-10-09 23:54:43 +02:00
Hans Goudey
976eaae02f Cleanup: Move BKE_object.hh to C++
Simplifies the fix to #111120, where the object bounds functions
may return a C++ type instead of `BoundBox`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113462
2023-10-09 23:41:53 +02:00
Harley Acheson
311a3d5695 Merge branch 'blender-v4.0-release' 2023-10-09 07:58:47 -07:00
Harley Acheson
35d3d52508 UI: Search All Menus with Space Bar
Allow initiating the search of any named menu by pressing space bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/113299
2023-10-09 16:56:16 +02:00
Hans Goudey
7507251071 Cleanup: Extract attribute function to copy values from group to group
Use the typical combination of an "array utils" function used by an
attribute interpolation function. This helps moves us towards having
a more centralized implementaiton of attribute propagation that can
be changed and optimized more easily.
2023-10-09 15:23:48 +02:00
Falk David
e7e1ec55d2 GPv3: Add DrawingTransforms
This makes sure that when the object is transformed, the painting code will take that
transformation into account.

Resolves #113424.

Pull Request: https://projects.blender.org/blender/blender/pulls/113442
2023-10-09 12:42:01 +02:00
Jacques Lucke
1ecc315d34 Nodes: pass node declaration builder to dynamic declaration function
Generally, one should use the declaration builder instead of trying to
do it manually which is more error prone and verbose.
2023-10-08 14:38:28 +02:00
Jacques Lucke
29d4779bf9 Merge branch 'blender-v4.0-release' 2023-10-07 23:19:41 +02:00
Jacques Lucke
262c67d36b Fix: instance reference does not compare equal to copy of itself
A copy has to compare equal to itself and have the same hash
when it is supposed to be used as a reference in a hash table
like `VectorSet`.

Just making the hash not change during a copy by hashing the
geometry component pointers instead of the geometry-set pointer
does not work because of `geometry_set_from_reference` which
assumed that changing the geometry set does not change the
hash of the reference.

For now the solution is to just not use a hash table as this
makes it easier to get corretness right. Instead, just use a
regular `Vector` to store all the references which avoids
the need for a hash function.

This can now lead to some O(n^2) behavior when adding many
references. Fortunately, this is not too common yet, as usually
one has few references but many instances that use those.
It's still something that has to be solved at some point. It's
not clear yet what approach would work best:
* Reintroduce `VectorSet` for the references and properly update
  the reference positions in the hash table after the references
  have changed.
* Add a separate `Map<Object*/Collection*, int>` for the
  deduplication.
* Do deduplication on the call-site of `add_reference` by building
  a temporary map there.
2023-10-07 23:14:04 +02:00
Campbell Barton
77a94e9e38 Cleanup: various non-functional changes for C++ 2023-10-07 18:29:48 +11:00
Jacques Lucke
144a5aa512 Cleanup: replace use of std::iota with more specific function
`iota` is name that has no meaning, it's not an acronym or initialism.
It's usually very cryptic when I come across it. Replacing it with a
specialized function makes the code more readible.
2023-10-06 23:01:16 +02:00
Sergey Sharybin
9a44445667 Fix assert in PBVH face set drawing code
The assert was assuming that the attribute request is properly
initialized and that was not the case: the "special" data layers
like coordinates, normals, masks, and face sets did not initialize
domain in the attribute request.

The domain is now properly initialized. As well as there is an
assert added in other PBVH types for the face sets. It is possible
to add asserts in more places, but it is not directly related to
this CL.

Pull Request: https://projects.blender.org/blender/blender/pulls/113354
2023-10-06 18:05:59 +02:00
Lukas Tönne
711c9c5553 Fix for wobbly volume object outlines in the viewport
The outlines of volume grids in the viewport are noticeable "wobbly"
when they should simply represent grid boxes. This is especially
noticeable on simple regular grids such as the "Volume Cube" geometry
node output.

The reason is that the outlines generated by taking a triangulated mesh
of the grid boxes and then growing it by successively scaling each
triangle. The offset for each vertex grows proportional to its degree
(number of connected edges). The fix is to divide each vertex's offset
by its degree.

The resulting mesh is much more regular and closer to to 1% desired
growth factor.

Old: ![Screenshot_20230829_155602](/attachments/87fbdca3-fb9d-49d8-b4f5-6780d1c72f79)
New: ![Screenshot_20230829_155648](/attachments/4452c52b-96df-4200-a02f-3d0d8aa8680e)

Pull Request: https://projects.blender.org/blender/blender/pulls/111657
2023-10-06 17:43:07 +02:00
Sergey Sharybin
491bd7fff0 Cleanup: Remove redundant mask interpolation in dyntopo
Since the recently added support for vertex interpolation the
manual mask interpolation is not needed anymore.
2023-10-06 14:31:23 +02:00
Sergey Sharybin
2a7e06b98d Sculpt: Add vertex interpolation for the dynamic topology
This change makes it so the newly added vertices have properly
interpolated attributes. This includes things like vertex colors.
New vertices are created by splitting edges, so the interpolation
mixes between the edge's two vertices equally.

Co-Authored-By: Hans Goudey <hans@blender.org>
2023-10-06 14:31:23 +02:00
Sergey Sharybin
1885116a9a Fix: Noisy false-positive assert in dyntopo sculpt
This assert triggers whenever dyntopo is used, even when all the
objects and environment is pristine. The semantic of the assert
is not very clear either.

Avoid having a false-positive trigger which gets in the way of any
development in the area.
2023-10-06 14:31:23 +02:00
Falk David
7e87435cf4 GPv3: Initial drawing tool
This PR implements an initial drawing tool that can already be used for testing.
While this is not fully feature complete (compared to the current grease pencil draw tool) the following is already implemented:

* Pressure support for radius and opacity.
* Material color and vertex color support.
* New active smoothing algorithm based on curve fitting.
* Simplify algorithm as a post-process step.

Some deliberate limitations include:
* The drawing plane is always the front plane. Drawing on surfaces is also not supported.
*

The current approach has not been optimized for performance yet. The goal was to have a straightforward implementation
first and then focus on performance later.

There are numerous parameters in the code that are hard-coded for now. These should be exposed at some point, potentially as user settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/110093
2023-10-06 10:49:54 +02:00
Campbell Barton
bd66e2e662 Cleanup: use defines for superscript numbers in unit.cc 2023-10-06 14:12:26 +11:00
Campbell Barton
2b77cd726d Cleanup: wrap definitions across multiple lines, add struct identifiers
When units were initially defined having each on their own line was
compact, since them more fields have been added, making the lines
overly long and the difference between each field non-obvious.

Further, the conversion from C to C++ [0], wrapped definitions onto the
same line (for some reason), resulting in lines over 700 wide.

Use clang-format & add struct ID's for clarity.

[0]: 129f78eee7
2023-10-06 13:57:52 +11:00
Campbell Barton
ade74a6584 Merge branch 'blender-v4.0-release' 2023-10-06 13:27:23 +11:00
Campbell Barton
5e2b8c43e4 Fix invalid collection length for dummy unit collection
While this didn't show up as a bug, if this length was used it could
result in an out of bounds read.
2023-10-06 13:23:42 +11:00
Campbell Barton
71b1712d79 Cleanup: spelling in comments 2023-10-06 12:50:27 +11:00