Commit Graph

4430 Commits

Author SHA1 Message Date
Philipp Oeser 1b7d257ce5 Fix #112664: Expand face sets freeze when cursor is on mesh boundaries
Mistake/typo in f4505e7b0a (not actually setting the bit).

Pull Request: https://projects.blender.org/blender/blender/pulls/112706
2023-09-22 14:52:07 +02:00
Hans Goudey 867f99c2af Cleanup: Move depsgraph headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/110816
2023-09-22 03:18:17 +02:00
Hans Goudey 72a33623e6 Cleanup: Sculpt: Use C++ threading API
Also remove unnecessarily parallelized loop that was just setting a
flag for every PBVH node.
2023-09-21 13:42:13 -04:00
Hans Goudey 64ce21aa2a Cleanup: Move sculpt mask fill to lambda, remove data struct
The actual logic in the callback is quite short, most of the lines are
dedicated to moving arguments in and out of a local "data" struct.
2023-09-21 12:45:17 -04:00
Hans Goudey 0fd0539f04 Cleanup: Rename grease pencil function to access layer at index
The plural was confusing when only one layer was returned.
2023-09-20 08:39:30 -04:00
Campbell Barton edc47d3d5a Cleanup: split ID property access into get/ensure functions
- Add IDP_EnsureProperties,
- Remove create_if_needed argument from IDP_GetProperties.

Split access & creation so intention reads more clearly without
looking up function arguments.
2023-09-17 12:16:40 +10:00
Campbell Barton c7cd1c8d0b Cleanup: use enum literals for space_type & region_type arguments
Also remove unique names for grease pencil keymaps.
There was not advantage in having separate names for each grease pencil
key-map.
2023-09-14 13:36:34 +10:00
Campbell Barton b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10:00
Philipp Oeser 564716d5a2 Fix #112285: Sculpt Mode: Mask brush smoothing is broken
Mistake in cc01bb83f6.

Above commit tried to be smart about early out, but wasnt.
Now corrected.

NOTE: fix needs to go into 3.6 LTS

Pull Request: https://projects.blender.org/blender/blender/pulls/112292
2023-09-13 11:04:52 +02:00
Campbell Barton 4fc5d287ac Cleanup: doxygen parameters, blank comment lines 2023-09-08 16:53:30 +10:00
Jacques Lucke b5c89822ac RNA: return PointerRNA from rna create functions
There are a couple of functions that create rna pointers. For example
`RNA_main_pointer_create` and `RNA_pointer_create`. Currently, those
take an output parameter `r_ptr` as last argument. This patch changes
it so that the functions actually return a` PointerRNA` instead of using
the output parameters.

This has a few benefits:
* Output parameters should only be used when there is an actual benefit.
  Otherwise, one should default to returning the value.
* It's simpler to use the API in the large majority of cases (note that this
  patch reduces the number of lines of code).
* It allows the `PointerRNA` to be const on the call-site, if that is desired.

No performance regression has been measured in production files.
If one of these functions happened to be called in a hot loop where
there is a regression, the solution should be to use an inline function
there which allows the compiler to optimize it even better.

Pull Request: https://projects.blender.org/blender/blender/pulls/111976
2023-09-06 00:48:50 +02:00
Hans Goudey 644297cc6e Cleanup: Remove mistanly committed timer
Mistake in afdbb734cf
2023-09-04 22:47:59 -04:00
Hans Goudey 646b3555ff Cleanup: Use C++ Set for expand snap enabled face sets
Instead of the less-type-safe and slower `GSet`.
2023-09-04 22:23:27 -04:00
Hans Goudey e52404db95 Cleanup: Use simpler face vert iteration in sculpt expand 2023-09-04 22:23:26 -04:00
Hans Goudey f4505e7b0a Cleanup: Use BitVector instead of BLI_Bitmap in sculpt expand 2023-09-04 22:23:26 -04:00
Hans Goudey 96f761a17c Cleanup: Use const arguments to sculpt "get" functions 2023-09-04 22:23:26 -04:00
Hans Goudey 8bc1e5a0e9 Cleanup: Use consistent static function names in sculpt_geodesic.cc
The capital prefixes are meant for non-static functions in C code.
2023-09-04 22:23:26 -04:00
Hans Goudey afdbb734cf Cleanup: Avoid mesh positions copy applying sculpt to shape key
`BKE_pbvh_vert_coords_alloc` is unnecessary after 1af62cb3bf
since PBVH vertex positions are stored in a contiguous array.
2023-09-04 22:23:26 -04:00
Hans Goudey fa34992def Cleanup: Remove unnecessary includes from C++ data structure headers
The hash tables and vector blenlib headers were pulling many more
headers than they actually need, including the C base math header,
our C string API header, and the StringRef header. All of this
potentially slows down compilation and polutes autocomplete
with unrelated information.

Also remove the `ListBase` constructor for `Vector`. It wasn't used
much, and making it easy to use `ListBase` isn't worth it for the
same reasons mentioned above.

It turns out a lot of files depended on indirect includes of
`BLI_string.h` and `BLI_listbase.h`, so those are fixed here.

Pull Request: https://projects.blender.org/blender/blender/pulls/111801
2023-09-01 21:37:11 +02:00
Hans Goudey 4e94db97e2 Mesh: Add three cached topology maps
Add three cached topology maps to `Mesh`, to avoid computations when
mesh data isn't changed. Choosing the right maps to cache is a bit
arbitrary, but generally we have to start somewhere. The limiting
factor is memory usage (all the new caches combined have a
comparable footprint to a UV map).

For now, the caches added are:
- Vertex to face corner
- Vertex to face
- Face corner to face

These caches are used in quite a few places already;
- Face corner normal calculation
- UV value merging
- Setting sharp edges from face angles
- Data transfer modifier
- Voxel remesh attribute remapping
- Sculpt mode painting
- Sculpt mode normal calculation
- Vertex paint mode
- Split edges geometry node
- Mesh topology geometry nodes

Caching topology maps means they don't have to be rebuilt every time
they're used. Meshes copied but without topology changes can share
the cache, further reducing re-computations. For example, FPS with a
large mesh using the "Corners of Vertex" node went from 1.8 to 2.3.
Entering sculpt mode is slightly faster too.

There is some obvious work for future commits:
- Use caches in attribute domain interpolation
- More multithreading of second phase of map building
- Update/build caches eagerly in some geometry nodes

Pull Request: https://projects.blender.org/blender/blender/pulls/107816
2023-08-30 23:41:59 +02:00
Petar Dosev 5894ab2e07 Fix #104022: Expand Mask inverted fill
A small new feature that clears the mask completely on the current mesh island.
Closes #104022

When hovering outside the object the Expand operator is running on, it will get floodfilled with the mask/face set.

Previously, when the Invert option was used, it wouldn't also clear the mask/face set when hovering outside the object.

Pull Request: https://projects.blender.org/blender/blender/pulls/111665
2023-08-30 09:28:46 +02:00
Hans Goudey 3f0eba32d4 Cleanup: Fix unused variable warning 2023-08-29 12:00:18 -04:00
Hans Goudey 69c498084a Cleanup: Remove unnecessary Mesh C API functions 2023-08-29 11:47:29 -04:00
Hans Goudey b339e3937d Fix: Crash in sculpt mode with shared normals caches
Since the normals are stored in a shared cache, tagging them dirty
recreated the cache from scratch when it was shared. Instead,
add a function that updates the cache in the same call as tagging
it dirty. This keeps the old state of the cache around even if it was
shared, and reflects the way that it's really the PBVH and sculpt
mode managing the dirty status of normals while sculpt mode
is active.

One consequence is that the BVH cache and the triangulation
cache need to be tagged dirty manually. I'd like to avoid abstracting
this more than necessary, because I'm hoping in the long term
different caching abstractions like a more global cache that takes
implicit sharing versions into account will make this complexity
unnecessary.

Fixes #111628, #111563

Pull Request: https://projects.blender.org/blender/blender/pulls/111641
2023-08-29 17:07:42 +02:00
Hans Goudey 425b871607 Mesh: Replace EdgeHash and EdgeSet with C++ classes
The `EdgeHash` and `EdgeSet` data structures are designed specifically
as a hash of an order agnostic pair of integers. This specialization can
be achieved much more easily with the templated C++ data structures,
which gives improved performance, readability, and type safety.

This PR removes the older data structures and replaces their use with
`Map`, `Set`, or `VectorSet` depending on the situation. The changes
are mostly straightforward, but there are a few places where the old
API made the goals of the code confusing.

The last time these removed data structures were significantly changed,
they were already moving closer to the implementation of the newer
C++ data structures (aa63a87d37).

Pull Request: https://projects.blender.org/blender/blender/pulls/111391
2023-08-29 17:00:33 +02:00
Hans Goudey c9621a002d Cleanup: Sculpt: Remove duplicate visibility update function
`node_update_visibility_redraw` and `BKE_pbvh_update_visibility`
do the same thing, and the latter is better specialized for the three
PBVH types, so remove the first.

The two update methods were added in:
- f4411b58ad
- 38d6533f21

Pull Request: https://projects.blender.org/blender/blender/pulls/110709
2023-08-29 14:23:04 +02:00
Philipp Oeser cc01bb83f6 Fix #111490: paint radius set to 1 (shift-smoothing but brush missing)
This affected sculpt, vertex- and weightpaint.

So attempting to (temporarily) switching to the smooth/blur tools from
another tool using the "Shift" shortcut can fail if the corresponding
smooth/blur brush is not found/missing [which was the case in the report
because the brush was deleted].

In this case, brushes dont really get switched, but blender would still
try to cache the size (because the smooth/blur brush temporarily uses
the same size as the previous brush) of the smooth brush in
`StrokeCache` (see `smooth_brush_toggle_on`). Then in
`smooth_brush_toggle_off` it was assumed brushes were actually switched
and the (non-existing) size of the (missing) smooth brush was applied to
the **actual** brush.

Now restructure code a bit so in the case of a missing brush we can
early out (without affecting the **actual** brush then).

Pull Request: https://projects.blender.org/blender/blender/pulls/111516
2023-08-29 13:44:35 +02:00
Sergey Sharybin 42473099b4 Cleanup: Braces around initialization
Pull Request: https://projects.blender.org/blender/blender/pulls/111605
2023-08-28 12:46:27 +02:00
Campbell Barton 19850496cb Cleanup: remove unused function, format 2023-08-26 17:05:19 +10:00
Harley Acheson eb0a9346df Cleanup: Make format
Only formatting changes.
2023-08-25 12:18:13 -07:00
Hans Goudey cf9fcbf24e Cleanup: Use C++ threading API in sculpt/paint code
Remove the global `SculptThreadedTaskData` struct which contained
the arguments to ALL multi-threaded sculpt functions. Use the C++
threading API instead of the old task API, moving the arguments
previously stored in the shared struct to actual function arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/111525
2023-08-25 18:18:35 +02:00
Pratik Borhade faff3d1d15 Cleanup: Comment style
Pull Request: https://projects.blender.org/blender/blender/pulls/111509
2023-08-25 11:14:19 +02:00
Campbell Barton 09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Hans Goudey 111e586424 Cleanup: Sculpt: Avoid unnecessarily changing vertex normals
Keeping a mutable reference to vertex normals for the entire lifetime
of the PBVH structure makes caching the normals and sharing the cache
harder than it should be. Generally code is safer when we reduce the
number of mutable references to data.

Currently the normals are modified in two places. First is the sculpt
mesh normal recalculation. There we can just retrieve the normals from
the mesh each time. Second is the restore from an undo step. That is
unnecessary because the normals are marked for recalculation anyway.
It doesn't even make much sense to store the normals in an undo step
when we can easily recalculate them based on new positions.

This change helps with #110479. These were also the last place that
kept a mutable reference to normals. I tested undo and redo after
sculpting, and it works well for each PBVH type.

Pull Request: https://projects.blender.org/blender/blender/pulls/111470
2023-08-24 16:47:55 +02:00
Hans Goudey 7fc7441a7b Cleanup: Separate sculpt undo restore into types
Though this means a few loops are duplicated, overall the code is
easier to reason about because the cases are separated more. This
makes potential changes to the way normals are stored clearer
(related to !110479), and makes potential optimizations easier too.
2023-08-24 07:37:07 -04:00
Hans Goudey 4a0581eca2 Fix: Missing multires to faces visibility sync after box hide
The operator handled faces visibility change correctly but not
multires. Use the existing PBVH API function for that, also remove
a redundant call to the function that fetched the attribute pointers
again after the change.
2023-08-24 07:37:07 -04:00
Campbell Barton 3ec489000f Cleanup: spelling in comments 2023-08-24 10:43:45 +10:00
Amelie Fondevilla 1193f2d7ec GPv3: Refactor code for the hard eraser
This patch refactors most of the code of the hard eraser, both for readability purpose, and to prepare the integration of the soft mode of the eraser.
The refactoring includes :
 - the use of specific structures and enum types `SegmentCircleIntersection`, `PointCircleSide`, and `PointTransferData` to handle the data more easily,
 - improve readability of the intersections functions (better naming, and more accurate and generic comments),
 - definition of a more generic `compute_topology_change` function that handles point insertion, removal, and curve splitting for curves geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/111390
2023-08-23 14:13:50 +02:00
Sergey Sharybin beaf4854b1 Fix #110328: Clay Strip symmetry does not mirror rotation
Caused by 351034891e

This change is a partial revert of the change.

The SCULPT_cube_tip_init() does not deal with the symmetry passes.

Additionally, the commit changed the way how the Z component of
the matrix was constructed: displaced vs. non-displaced area
coordinate.

While the code duplication is often to be avoided, sometimes it is
more clear than a centralized place with a lot of arguments passed
to a function. We can have a pass of de-duplication later on, and
make a better decision, but for now restore user level behavior to
what it is expected to be.

Pull Request: https://projects.blender.org/blender/blender/pulls/111425
2023-08-23 12:21:44 +02:00
Campbell Barton 24ef5e097a Cleanup: balance doxy sections 2023-08-23 14:54:46 +10:00
Hans Goudey 1857df8d5b Cleanup: Use FunctionRef for PBVH filtering callback
Call functions directly in lambdas rather than passing their
arguments in a separate void * argument. This can be changed
more in the future to move callback arguments out of smaller
structs.
2023-08-22 15:06:42 -04:00
Amelie Fondevilla 6cfda322a6 Fix: GPv3: Stroke Eraser does not work with one-point strokes.
The stroke mode of the eraser only tests distance with segments of the strokes, so it does not take into account strokes that only have one point, and thus no segment. This patch fixes the issue by testing if the point is inside the eraser in the case of a one-point stroke.

Pull Request: https://projects.blender.org/blender/blender/pulls/111387
2023-08-22 17:04:51 +02:00
Campbell Barton c713c70781 CMake: quiet uninitialized warnings 2023-08-17 11:53:56 +10:00
Aras Pranckevicius 2f060706a4 Cleanup: fewer BLI_color.hh et al includes
Include counts of some headers while making full blender build:
- BLI_color.hh 1771 -> 1718
- BLI_math_color.h 1828 -> 1783
- BLI_math_vector.hh 496 -> 405
- BLI_index_mask.hh 1341 -> 1267
- BLI_task.hh 958 -> 903
- BLI_generic_virtual_array.hh 509 -> 435
- IMB_colormanagement.h 437 -> 130
- GPU_texture.h 806 -> 780
- FN_multi_function.hh 331 -> 257

Note: DNA_node_tree_interface_types.h needs color include only
for the currently unused (but soon to be used) socket_color function.
Future step is to figure out how to include
DNA_node_tree_interface_types.h less.

Pull Request: #111113
2023-08-16 14:48:53 +03:00
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Hans Goudey f0467b4615 Cleanup: Return std::string from operator name and description callbacks
With the end goal of simplifying ownership and memory management,
and allowing the use of `get_name` in contexts without statically
allocated strings, use `std::string` for the return values of these two
operator type callbacks instead of `const char *` and `char *`.

In the meantime things get uglier in some places. I'd expect `std::string`
to be used more in the future elsewhere in Blender though.

Pull Request: https://projects.blender.org/blender/blender/pulls/110823
2023-08-11 19:11:27 +02:00
Bastien Montagne 203e6e2b41 Fix (unreported) Several `OperatorType.get_name` not doing translation.
`OperatorType.get_name` callback is supposed to return strings directly
usable in the UI, i.e. translated if needed.

Several callbacks did not, noticiably the generic
`ED_select_pick_get_name` and `ED_select_circle_get_name` ones.

And the `sculpt_color_filter_get_name` was not using available RNA
helpers for enum items has it should have.

Finally, `RNA_property_enum_name_gettexted` and
`RNA_property_enum_item_from_value_gettexted` were also not using the
optimal higher-level translation API.

Noticed while reviewing !110776.
2023-08-11 12:00:16 +02:00
Philipp Oeser 3c26f84225 Vertex Paint: Add option to lock alpha for 'Set Vertex Colors'
It is a common practice in gamedev to rely on coding various data into
the alpha channel of the mesh and there was no way to preserve that when
using the `Set Vertex Colors` operator (would always sets the Alpha component to '1').

Now add an "Affect Alpha" option (similar to what we have for brushes)
and when that is disabled, existing alpha is locked.

Fixes #110014

Pull Request: https://projects.blender.org/blender/blender/pulls/111002
2023-08-11 10:39:13 +02:00
Jacques Lucke cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Aras Pranckevicius d973355b3a Cleanup: reduce amount of math-related includes
Using ClangBuildAnalyzer on the whole Blender build, it was pointing
out that BLI_math.h is the heaviest "header hub" (i.e. non tiny file
that is included a lot).

However, there's very little (actually zero) source files in Blender
that need "all the math" (base, colors, vectors, matrices,
quaternions, intersection, interpolation, statistics, solvers and
time). A common use case is source files needing just vectors, or
just vectors & matrices, or just colors etc. Actually, 181 files
were including the whole math thing without needing it at all.

This change removes BLI_math.h completely, and instead in all the
places that need it, includes BLI_math_vector.h or BLI_math_color.h
and so on.

Change from that:
- BLI_math_color.h was included 1399 times -> now 408 (took 114.0sec
  to parse -> now 36.3sec)
- BLI_simd.h 1403 -> 418 (109.7sec -> 34.9sec).

Full rebuild of Blender (Apple M1, Xcode, RelWithDebInfo) is not
affected much (342sec -> 334sec). Most of benefit would be when
someone's changing BLI_simd.h or BLI_math_color.h or similar files,
that now there's 3x fewer files result in a recompile.

Pull Request #110944
2023-08-10 14:51:40 +03:00
Sergey Sharybin 8141ee90f4 Fix #109201: Consistent mapping boundaries of brush textures
This fix makes it so the circular brush is fitted into the square
texture. This seems to be the most straightforward way to resolve
confusion of the inter-dependencies between different brush and
texture options.

Pull Request: https://projects.blender.org/blender/blender/pulls/110896
2023-08-09 11:39:58 +02:00
Campbell Barton 8d0268b09c Cleanup: spelling in comments 2023-08-09 11:20:59 +10:00
Amelie Fondevilla 242e94acec GPv3: Fix floating-point error in the hard eraser tool.
The hard eraser tool was not working properly when trying to erase closely to existing points, leading either to the insertion of various close points in the stroke, or to deleting a whole stroke segment.

This was due to the differenciation between the computation of the intersections between the eraser and the stroke, and the computation of whether a point lie inside the eraser, which lead to inconsistencies in the interpretation of the result.

This patch solves this issue by  :
 * computing if the point is inside the eraser based on the result of the intersection, to avoid unconsistencies,
 * computing with integers and not float (we are in screen space anyways),
 * adding the ability for source points to be cuts, and not only the inner intersections.

Pull Request: https://projects.blender.org/blender/blender/pulls/110801
2023-08-07 15:11:34 +02:00
Campbell Barton 845a5146e7 Cleanup: avoid term '_len' for buffer size 2023-08-06 16:09:04 +10:00
Campbell Barton bf2b1f7e01 Cleanup: simplify enum typedefs 2023-08-05 14:22:48 +10:00
Hans Goudey 07019e7ef5 Cleanup: Remove more struct keywords from C++ headers 2023-08-04 22:47:29 -04:00
Hans Goudey ffe4fbe832 Cleanup: Move editors headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110820
2023-08-05 02:57:52 +02:00
Hans Goudey c15d391e86 Cleanup: Various cleanups in newly C++ headers
Mostly remove unnecessary struct and typedef keywords.
Move a few more small wm headers to C++ as well.
2023-08-04 17:55:14 -04:00
Hans Goudey bc8c892c65 Cleanup: Move WM headers to C++
Also move a few more headers that included WM headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/110815
2023-08-04 23:11:22 +02:00
Campbell Barton adf58a77ff Cleanup: use LISTBASE_FOREACH & LISTBASE_FOREACH_BACKWARD macros 2023-08-04 08:51:13 +10:00
Campbell Barton 0af370a62d Cleanup: use C++ style sizeof(struct::member) instead of casting nullptr 2023-08-03 20:23:01 +10:00
Campbell Barton de391cf811 Cleanup: use nullptr instead of zero 2023-08-03 19:17:43 +10:00
Hans Goudey 8bb8cfb54e Cleanup: Remove unnecessary struct keyword from C++ headers
Pull Request: https://projects.blender.org/blender/blender/pulls/110734
2023-08-03 01:11:28 +02:00
Hans Goudey 731d296f35 Cleanup: Move mesh related blenkernel headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110730
2023-08-02 22:14:18 +02:00
Germano Cavalcante e423fd469d Cleanup: Move int to float conversions outside the function
The function doesn't actually use the `int` value, so the parameter
already comes as `float`, this avoids unnecessary conversions.
2023-08-02 15:25:22 -03:00
Hans Goudey c3685fe068 Cleanup: Sculpt: Use consistent operator function names
Make function names consistent with operator idname
2023-08-01 21:38:21 -04:00
Hans Goudey e4e23bdd73 Cleanup: Sculpt: Remove unnecessary visibility flushing
Face set code modifies visibility of faces, then flushes those changes
to vertex and edge visibility. However, then it did an extra flush back
from vertices to faces and edges, which shouldn't be necessary.
2023-08-01 21:25:38 -04:00
Hans Goudey 12258d4931 Cleanup: Sculpt: Remove unused function to set vert visibility
Unused after ef5f307031. More recently, visibility
is just set at the face level and synced to vertices with generic
Mesh API functions.
2023-08-01 21:20:25 -04:00
Hans Goudey 7114d2efa6 Cleanup: Sculpt: Use utility functions for setting face visibility 2023-08-01 21:15:29 -04:00
Sergey Sharybin 63e2832057 Color management: Remove old name-based exceptions
Historically, the OCIO based color management implementation in Blender
had exceptions to treat specific configurations differently. It was a
compatibility with the legacy "No color management" option.

With time and more development in the area there are better ways of
achieving this goal, if needed.

This commit removes the named-based exception, which also solves confusion
about why certain similar configurations (from OCIO stand point) give
different results. As well as allows to create a cleaner plate for an
upcoming additions in the OCIO configuration such as AgX.

Quite simple and technical change which constant-folds the check for
whether the scene color management enabled or not with "true" value.

Ref #110685

Pull Request: https://projects.blender.org/blender/blender/pulls/110580
2023-08-01 14:39:29 +02:00
Campbell Barton 52acf6a6ec Cleanup: correct file names in comments after C -> C++ renaming
Use back-tick quotes to differentiate these from plain text.
2023-07-31 13:02:30 +10:00
Campbell Barton 916f6a7bf3 UI: add weight paint gradient menu items for discoverability 2023-07-29 16:33:14 +10:00
Campbell Barton cfffd813c1 Cleanup: use typed enum for UI_ITEM_* flags
Using an int lead to confusion with other flags often used with buttons.
For e.g. these flags could be easily confused with uiItem::flag.
2023-07-29 15:32:45 +10:00
Campbell Barton 2bc89982dc Cleanup: remove unused variable 2023-07-29 13:47:53 +10:00
Falk David 187545109a Cleanup: GPv3 drawings API
This cleans up the API a bit to make things more readable.
No functional changes.
2023-07-28 16:32:42 +02:00
Hans Goudey a632f1ddfd Sculpt: Remove dynamic topology "Smooth Shading" option
Dynamic topology drawing can now use the smooth status saved in each
edge. Because of that, the "Smooth Shading" draw option is unnecessary
and just adds confusion because of inconsistency between dynamic
topology drawing and other modes.

Fixes #109191

Pull Request: https://projects.blender.org/blender/blender/pulls/110548
2023-07-28 13:44:01 +02:00
Campbell Barton 88902a273e UI: add menu items for sample weight/color
These were only available as shortcuts without any menu item.
2023-07-28 16:27:24 +10:00
Campbell Barton 09c66631a6 Refactor: use object.vertex_group_set_active for group sample operator
This change is needed for PAINT_OT_weight_sample_group to be accessed
from a menu.

Otherwise using the OPTYPE_DEPENDS_ON_CURSOR flag causes both the
initial activation and the selected vertex group to prompt the user
to select a region.
2023-07-28 16:09:29 +10:00
Hans Goudey 1c9e32cab1 Cleanup: Sculpt: Use r_ prefix for return argument 2023-07-27 23:38:28 -04:00
Hans Goudey 81e687b49d Cleanup: Use const for PBVH node grid indices 2023-07-27 17:47:34 -04:00
Campbell Barton 7b7af7d1d5 Fix vertex paint color sample on some GPU's under Wayland
Support sampling vertex colors when WM_CAPABILITY_GPU_FRONT_BUFFER_READ
isn't supported (see #106264).
2023-07-27 21:35:32 +10:00
Campbell Barton a5215fda33 Fix image projection paint with "mode" set to "Smooth"
Setting the paint.image_paint mode to smooth did nothing,
now it uses the soften tool as expected.
2023-07-27 21:03:04 +10:00
Pratik Borhade d2fb16baeb Merge branch 'main' of projects.blender.org:blender/blender 2023-07-27 16:22:27 +05:30
Amelie Fondevilla 18de91f960 GPv3: Option to use tablet pressure for the eraser
The eraser tool now calibrates its radius according to the pressure only if the Use Pressure option is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/110460
2023-07-27 12:48:04 +02:00
Pratik Borhade 6f0477bd1d Fix #107918: Weight Gradient tool paints over locked vertex groups
Exit the operator code if `DG_LOCK_WEIGHT` flag is set
for active vertex group to avoid painting over locked vertex
group. New function `BKE_object_defgroup_active_is_locked`
created to handle this.
2023-07-27 16:06:07 +05:30
Campbell Barton c14a43acce Fix paint stroke "mode" property being reused when weight painting
Binding a key to weight-paint with mode set (invert/smooth for e.g.)
caused regular weight painting to reuse this setting.

Don't reuse paint "mode" between strokes.
This also allows the default to be removed from the key-map.
2023-07-27 15:58:50 +10:00
Campbell Barton cc892efcd4 Cleanup: use snake case, especially for structs that define callbacks
Use snake case for ShaderFxTypeInfo, ModifierTypeInfo,
GpencilModifierTypeInfo & bConstraintTypeInfo.
2023-07-27 12:21:06 +10:00
Hans Goudey f9a4fcd8cf Cleanup: Access more mesh data with C++ methods
Recent C++ conversions have enabled more changes like
af53207b43 and 7826aed105.
2023-07-25 21:59:54 -04:00
Hans Goudey aebc743bf1 Cleanup: Make format
Sorry for the noise, I thought I ran this in the previous commit.
2023-07-25 15:23:56 -04:00
Hans Goudey 95edff7495 Cleanup: Rename mesh custom data fields
Implements the rest of #101689, after 5e9ea9243b.

- `vdata` -> `vert_data`
- `edata` -> `edge_data`
- `pdata` -> `face_data`
- `ldata` -> `loop_data`

A deeper rename of `loop` to `corner` will be proposed as a next
step, and renaming `totvert` and `totedge` can be done separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/110432
2023-07-25 21:15:52 +02:00
Hans Goudey 0e87e25b37 Cleanup: Simplify iteration over mesh faces, use utility functions
Utility functions make accessing the next and previous corner of a face
more obvious, and range based for loops make iterating over corners
or vertices in a face simpler too.
2023-07-25 11:56:01 -04:00
Ray molenkamp 4ea2baf4ae CMake: revert last weeks modernizations
The cleanup of blenkernel last weeks , caused the house of cards to
collapse on  top of bf_gpu's shader_builder, which is off by default
but used on a daily basis by the rendering team.

Given the fixes forward in #110394 ran into a ODR violation in OSL that
was hiding there for years, I don't see another way forward without
impeding the rendering teams productivity for "quite a while" as there
is no guarantee the OSL issue would be the end of it.

the only way forward appears to be back.

this reverts :

19422044ed
a670b53abe
0f541db97c
be516e8c81
3e88a2f44c
4e64b772f5
9547e7a317
07fe6c5a57

The problematic commit was 07fe6c5a57
as blenkernel links most of blender, it's a bit of a link order issue
magnet. Given all these commits stack, it's near impossible to revert
just that one without spending a significant amount of time resolving
merge conflicts. 99% of that work was automated, so easier to just
revert all of them, and re-do the work, than it is to deal with the
merge conflicts.

Pull Request: https://projects.blender.org/blender/blender/pulls/110438
2023-07-25 16:43:21 +02:00
Hans Goudey 5e9ea9243b Mesh: Rename "polys" to "faces"
Implements part of #101689.

The "poly" name was chosen to distinguish the `MLoop` + `MPoly`
combination from the `MFace` struct it replaced. Those two structures
persisted together for a long time, but nowadays `MPoly` is gone, and
`MFace` is only used in some legacy code like the particle system.

To avoid unnecessarily using a different term, increase consistency
with the UI and with BMesh, and generally make code a bit easier to
read, this commit replaces the `poly` term with `poly`. Most variables
that use the term are renamed too. `Mesh.totface` and `Mesh.fdata` now
have a `_legacy` suffix to reduce confusion. In a next step, `pdata`
can be renamed to `face_data` as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/109819
2023-07-24 22:06:55 +02:00
Hans Goudey 189fc24f1a Cleanup: Simplify removing curves in GP erasor stroke mode
Avoid the initial copy, and avoid moving from a const reference.
2023-07-24 14:07:44 -04:00
Hans Goudey 78dba0bb17 Cleanup: Pass array references with spans in GP eraser 2023-07-24 13:49:27 -04:00
Amelie 4f56261f76 GPv3: Stroke mode for the Eraser tool
Implementation of the stroke mode of the eraser tool for grease pencil.
In this mode, the eraser removes each stroke that it touches, meaning each stroke that either intersects the eraser or that has all points inside of it.

Pull Request: https://projects.blender.org/blender/blender/pulls/110304
2023-07-24 17:04:39 +02:00
Campbell Barton b8ea968929 Cleanup: simplify struct & enum declarations for C++ 2023-07-24 10:13:31 +10:00
Campbell Barton 302887c619 Cleanup: use boolean literals in source/
Apply clang-tidy modernize-use-bool-literals to source/.
2023-07-22 11:43:01 +10:00
Campbell Barton 81ee130063 Cleanup: use C++ system headers
Apply clang-tidy modernize-deprecated-headers to source/
2023-07-22 11:27:25 +10:00
Ray molenkamp 19422044ed Cleanup: CMake: Modernize bf_bmesh dependencies
Pretty straightforward

- Remove any bmesh paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110363
2023-07-22 02:05:21 +02:00
Ray Molenkamp 0f541db97c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110350
2023-07-21 18:37:30 +02:00
Ray molenkamp be516e8c81 Cleanup: CMake: Modernize bf_blentranslation dependencies
Pretty straightforward:

- Remove any blentranslation paths from INC
- Add a dependency though LIB when needed

Slightly different than usual:

blentranslation still had a dependency on imbuf, from a time long
gone, cleaned that up since I was in the area

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110324
2023-07-21 16:22:10 +02:00
Ray molenkamp 3e88a2f44c Cleanup: CMake: Modernize bf_depsgraph dependencies
Pretty straightforward

- Remove any depsgraph paths from INC
- Add a dependency though LIB when needed

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/110317
2023-07-20 22:13:00 +02:00
Ray molenkamp 4e64b772f5 Cleanup: CMake: Modernize bf_windowmanager dependencies
Pretty straightforward

- Remove any windowmanager paths from INC
- Add a dependency though LIB when needed

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109984
2023-07-20 18:52:52 +02:00
Amelie 924aa0ef07 GPv3: Hard Eraser tool
Implementation of the hard eraser for grease pencil.
The tool "cuts" the strokes, meaning it removes points that are inside the eraser's radius, while adding points at intersections between the eraser and the strokes.

Note that this does not implement the "Stroke" and "Dissolve" mode of the eraser yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/110063
2023-07-20 13:56:23 +02:00
Alexander Gavrilov d32748cdf4 Shape Key editing: propagate updates through basis chains.
It is possible to organize shape keys into a tree through the
reference key setting. Mesh editing and sculpting a reference
key is supposed to update all its children, but this was only
done for one level of dependencies.

This changes the code to retrieve the complete set of dependent
keys and update them all.
2023-07-18 16:30:51 +03:00
Joseph Eagar a1a08610b6 Paint: Fix drawing delay bug with paint modes
The paint code doesn't invoke `stroke->redraw`
on `INBETWEEN_MOUSEMOVE` events.  This causes
drawing lag on devices that tends to generate
more of them, like pen tablets.

The code no longer does this.  It does still exclude
inbetween events for updating the paint cursor.

I checked, and only the two paint modes (3d texture paint and image paint) actually
use `stroke->redraw`.  Both are implemented to only draw when necessary:

* `paint_2d_redraw` checks for `.need_redraw` flag on tiles.
* `paint_proj_redraw` checks `ProjStrokeHandle.need_redraw`.

I believe this may be the cause of #93796

Pull Request: https://projects.blender.org/blender/blender/pulls/110119
2023-07-15 20:34:41 +02:00
Campbell Barton 3889baab4f Cleanup: spelling in comments 2023-07-15 15:54:55 +10:00
Hans Goudey 5a86705d4c Cleanup: Move ED_curves.h to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110115
2023-07-15 03:44:58 +02:00
Hans Goudey 2c1a7d6960 Cleanup: Make format 2023-07-14 10:46:37 -04:00
Joseph Eagar a75b7e1551 Sculpt: Split paint_vertex.cc into paint_weight.cc
Functions shared between the two now live in a new `blender::editors::vwpaint` namespace.

Pull Request: https://projects.blender.org/blender/blender/pulls/109996
2023-07-14 16:31:17 +02:00
Campbell Barton 32fb40fa76 Cleanup: use function style casts for C++ 2023-07-14 12:31:00 +10:00
Falk David 7cf8bfd2a0 GPv3: Draw paint cursor 2023-07-13 15:58:16 +02:00
Falk David 9356e18d15 GPv3: Add `on_stroke_begin` callback
This adds a new virtual function `on_stroke_begin` to
`GreasePencilStrokeOperation`. It's only called on the first input.
2023-07-13 13:57:23 +02:00
Jacques Lucke 3f33e0c6cd Cleanup: clang format in disabled code segments
This formats code that is disabled using `#if 0`. Formatting was achieved
by temporarily changing `#if 0` to `#if 1 /*something*/`, then formatting,
and then changing it back to `#if 0`.
2023-07-12 14:18:59 +02:00
Philipp Oeser ac3f4e959f Fix #109822: Average Brush in Vertex Paint Mode is broken
Caused by 7a943428de

Looking at history, e.g. 575ade22d4 or prior, it seems the
"fallthrough" [related compiler warning was removed in 7a943428de] was
actually intended in the case of `VPAINT_TOOL_AVERAGE`.

So first, the average color is calculated and after that regular drawing
should happen with that color.

Now make this more clear by calling both `calculate_average_color` as
well as `vpaint_do_draw` before breaking.

Pull Request: https://projects.blender.org/blender/blender/pulls/109971
2023-07-12 09:45:21 +02:00
Hans Goudey f0b53777c8 Cleanup: Use spans and float3 to store sculpt and PBVH vert positions
Also store the allocated deformed positions in a separate array in PBVH,
so there isn't one pointer that _sometimes_ has ownership of its data.

Pull Request: https://projects.blender.org/blender/blender/pulls/109981
2023-07-11 21:01:53 +02:00
Ray molenkamp 07fe6c5a57 Cleanup: CMake: Modernize bf_blenkernel dependencies
Pretty straightforward

- Remove any blenkernel paths from INC
- Add a dependency though LIB

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/109939
2023-07-11 19:28:01 +02:00
Hans Goudey 087612c042 Cleanup: Reduce use and scope of templates in vertex paint
Many high-level functions with unrelated code were templated based on
the color attribute domain and type. In the end, those were just a few
branches though, similar to other branches. So to reduce binary bloat
and clarify code, move tempates to the point where separate types are
actually needed. Also move constant code out of loops, and use generic
arrays and spans to store some caches. The binary ended up 53 KB
smaller for me, which isn't much but it's in the right direction.

Performance wise nothing really changes. The vast majority of time in
vertex paint is spent on unrelated things like calculating normals or
uploading GPU buffers anyway.

The one ugly part I didn't account for when I started is the casting
between the "ColorGeometry" and "ColorPaint" types. I'm not sure that
this is correct, but it's just a more explicit version of what was
there already.

Pull Request: https://projects.blender.org/blender/blender/pulls/109941
2023-07-11 15:52:28 +02:00
Amelie f2d3d321bb GPv3: Add access functions for opacity and radius attributes
We need setters and getters for these two very commonly accessed attributes of grease pencil.
The code is based on the implementation of `CurvesGeometry::positions()` and `CurvesGeometry::positions_for_write()`.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/109733
2023-07-11 15:11:14 +02:00
Campbell Barton 1ec1e783cc Cleanup: consistent naming for wmTimer API
Word ordering for wmTimer API wasn't consistent.

- Use "WM_event_timer_" / "WM_event_timers_" prefix.
- Rename "wm_window_timer" to "wm_window_timers_process"
  because it wasn't clear what the function did from its name.
- Rename "wm_window_process_events" to "wm_window_events_process"
  for consistency with "wm_window_timers_process".
2023-07-11 13:16:04 +10:00
Ray Molenkamp 04235d0e55 Cleanup: CMake: Modernize bf_blenlib dependencies
Pretty straightforward

- Remove any blenlib paths from INC
- Add a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109934
2023-07-10 22:04:18 +02:00
Ray Molenkamp 57ad866d81 Cleanup: CMake: Modernize bf_guardedalloc dependencies
Pretty straightforward

- Removes any guardedalloc paths from INC
- Adds a dependency though LIB

Pull Request: https://projects.blender.org/blender/blender/pulls/109925
2023-07-10 18:44:19 +02:00
Joseph Eagar fc10d04187 Cleanup: remove unused variables 2023-07-10 07:35:55 -07:00
Ray Molenkamp 7cebb61486 Cleanup: CMake: Modernize bf_dna dependencies
There's quite a few libraries that depend on dna_type_offsets.h
but had gotten to it by just adding the folder that contains it to
their includes INC section without declaring a dependency to
bf_dna in the LIB section.

which occasionally lead to the lib building before bf_dna and the
header being missing, while this generally gets fixed in CMake by
adding bf_dna to the LIB section of the lib, however until last
week all libraries in the LIB section were linked as INTERFACE so
adding it in there did not resolve the build issue.

To make things still build, we sprinkled add_dependencies wherever
we needed it to force a build order.

This diff :

Declares public include folders for the bf_dna target so there's
no more fudging the INC section required to get to them.

Removes all dna related paths from the INC section for all
libraries.

Adds an alias target bf:dna to signify it has been updated to
modern cmake

Declares a dependency on bf::dna for all libraries that require it

Removes (almost) all calls to add_dependencies for bf_dna

Future work:

Because of the manual dependency management that was done, there is
now some "clutter" with libs depending on bf_dna that realistically
don't. Example bf_intern_opencolorio itself has no dependency on
bf_dna at all, doesn't need it, doesn't use it. However the
dna include folder had been added to it in the past since bf_blenlib
uses dna headers in some of its public headers and
bf_intern_opencolorio does use those blenlib headers.

Given bf_blenlib now correctly declares the dependency on bf_dna
as public bf_intern_opencolorio will get the dna header directory
automatically from CMake, hence some cleanup could be done for
bf_intern_opencolorio

Because 99% of the changes in this diff have been automated, this diff
does not seek to address these issues as there is no easy way to
determine why a certain dependency is in place. A developer will have
to make a pass a this at some later point in time. As I'd rather not
mix automated and manual labour.

There are a few libraries that could not be automatically processed
(ie bf_blendthumb) that also will need this manual look-over.

Pull Request: https://projects.blender.org/blender/blender/pulls/109835
2023-07-10 15:07:37 +02:00
Joseph Eagar 351034891e Sculpt: Cleanup duplicate code in clay strips brush
Clay strips was using it's own brush local matrix,
which wasn't quite compatible with texture matrices.
This could lead to brush textures not lining up with
the stroke dabs.

There was also a bug where the stroke was starting
20 pixels into the stroke, which is much higher than
necassary to derive the initial rake angle.

Notes:
* The clay strips brush now uses SCULPT_cube_tip_init
  to calculate the local brush matrix.
* SCULPT_cube_tip_init now accepts custom brush location
  and radius arguments.
* The mouse sample preroll used to calculate initial brush
  rotation angle is now smaller than the update interval.
* Clay strips now supports tip_scale_x, which has also
  been added to DNA defaults.
2023-07-10 05:01:58 -07:00
Campbell Barton 98a2c2229d Fix error in 29bfd03009 2023-07-10 12:36:59 +10:00
Hans Goudey 29bfd03009 Cleanup: Reduce indentation in paint_vertex.cc
The file is easier to read and change when less context is needed at
each step. Also extract some complex-looking flag testing into a
separate function, and move some constant checks out of loops.
2023-07-09 22:25:41 -04:00
Hans Goudey 2a1ac6145a Cleanup: Use C++ attribute API to add attributes in a few places
This is a bit more flexible and future proof than CustomData.
2023-07-09 20:00:17 -04:00
Hans Goudey 475e8bcd97 Cleanup: Deduplicate color attribute domain and type RNA enums 2023-07-09 19:38:32 -04:00
Joseph Eagar 0b01b7c1fa Sculpt: Fix #109555: More floating point error fixes
* Renamed BKE_pbvh_raycast_project_ray_root to
          BKE_pbvh_clip_ray_ortho for greater
	  clarity.
* BKE_pbvh_clip_ray_ortho no longer strictly clips
  within the input ray interval.  This is not necassary
  for orthographic views and was too prone to floating
  point error.  The function is only called to clip
  brush rays for orthographic views so this is acceptable.
2023-07-07 18:53:06 -07:00
Ray Molenkamp f0ee4c3ffe Cleanup: Cmake: use alias target for bf_intern_atomic
This introduces an alias target `bf::intern::atomic` for
`bf_intern_atomic`. This has the following benefits:

- Any target name with `::` in it will be recognized as an actual
target by cmake, rather than a library name it may not know about.
and will be validated by cmake to exist. Which means if you make
a typo in the LIB section, CMake will error out telling you it
doesn't know about this specific target rather than passing it on
to the build system, where you'll either get build or linker errors
because of said typo.

- Given there is quite a cleanup still to do in the build system,
it won't always be obvious which targets have been updated to
modern targets and which still need to be done. Having a namespaced
target name is a good indicator there.

Pull Request: https://projects.blender.org/blender/blender/pulls/109784
2023-07-07 15:37:02 +02:00
Joseph Eagar 7e2659e4ab Cleanup: Split BKE_pbvh.h into BKE_pbvh_api.hh
Split much of BKE_pbvh.h into BKE_pbvh_api.hh.
BKE_pbvh.h is included by BKE_paint.h, which in
turn is included by large amounts of code including
RNA.

This makes it extremely difficult to change
or clean up the PBVH API, since each modification
of BKE_pbvh.h can take 20-30 minutes to compile,
even on a quad-core system with an SSD. This
commit fixes that by moving most of BKE_pbvh.h
into another file and just having the core,
external-facing interfaces in BKE_pbvh.h.
2023-07-03 20:01:04 -07:00
Hans Goudey a3bfd6e20d Cleanup: Extract utility for counting indices
This utility counts the number of occurrences of each index in an array.
This is used for building mesh topology maps offsets, or for counting
the number of connected elements. Some users are geometry nodes,
the subdivision draw cache, and mesh to curve conversion.

See #109628
2023-07-03 18:47:03 -04:00
Falk David 3d99d05f00 GPv3: Add separate paint mode
This patch adds a separate paint mode for Grease Pencil 3.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/109453
2023-07-03 16:34:30 +02:00
Falk David de95539ced Cleanup: Rename grease pencil modes to legacy
Renames `OB_MODE_EDIT_GPENCIL`, `OB_MODE_PAINT_GPENCIL`,  `OB_MODE_SCULPT_GPENCIL`,  `OB_MODE_WEIGHT_GPENCIL`, `OB_MODE_VERTEX_GPENCIL, and the context modes` to `*_LEGACY`.

Pull Request: https://projects.blender.org/blender/blender/pulls/109648
2023-07-03 15:15:54 +02:00
Hans Goudey 5ccb458a21 Cleanup: Sculpt: Remove unnecessary absolute values of face sets
Since ee23f0f3fb, face sets no longer store the hidden
status of faces. Code used to use the absolute value of face set values
to avoid including the hidden status. That's no longer necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/109612
2023-07-02 16:21:31 +02:00
Campbell Barton 69aee8ba6b Cleanup: remove redundant (void) for functions with no args in C++ 2023-07-02 19:54:27 +10:00
Campbell Barton 345d1a4b44 Cleanup: simplify struct declarations in C++
Replace `typedef struct X {} X;` with `struct X {};`

In some cases the first and last name didn't match although this
is rarely useful, even a typo in some cases, e.g. TrachPathPoint.
2023-07-02 19:54:26 +10:00
Ray molenkamp 2dac20e35f CMake/Cleanup: Use bf_intern_atomic target
Use the bf_intern_atomic target rather than adding a relative path
to it in the INC section.

Pull Request: https://projects.blender.org/blender/blender/pulls/109424
2023-06-28 19:12:55 +02:00
Falk David 6bec3bca09 GPv3: Remove dead code in drawing operator
These lines were not used and caused compiler warnings.
They can be safely removed.
2023-06-28 11:40:12 +02:00
Falk David fdfc09502a GPv3: Improve redrawing for drawing operator
The new drawing operator uses the `paint_stroke` API which didn't
know about grease pencil yet. This simple change causes the redraw
to happen on every(?) event, which did not happen before.
2023-06-28 11:40:12 +02:00
Falk David 8a39f438c3 Fix compiler warning 2023-06-26 18:22:33 +02:00
Falk David 2418252ea7 Refactor: Move `stroke_cache` to gpencil runtime
This moves the `stroke_cache` that was previously stored on every
drawing to the `GreasePencilRuntime` struct.

Since this cache is only used for when a user is drawing a stroke, there
can only ever be one. It makes more sense to have this cache on the
data-block runtime data, rather than every drawings runtime data.
2023-06-26 15:49:18 +02:00
Falk David 0a693165c8 Refactor: Move `GreasePencilDrawing` functionality
Moves the functions from `GreasePencilDrawing` to a C++ wrapper class.
2023-06-26 14:58:42 +02:00
Sergey Sharybin d8cc8fcf7f Refactor: Move color space information to ImBuf buffers
Before this change the ImBuf struct had dedicated fields for the
buffer data. Now the color space is stored inside of the struct
which wraps around the buffer information.

This only changes the field placement, without changing the way
it is handled. In the future one might imagine that operations
like stealing buffer data should null-ify the buffer colorspace
pointer. Such changes would need to have more accurate thinking
before implementation.

Should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/109291
2023-06-23 15:55:42 +02:00
Falk David b3f3b41d09 GPv3: Initial Layer Tree UI
Adds a new UI template to view the current layer tree of the active Grease Pencil object.

This UI tree view implements the following features (for now):
 - Displaying all the layers with their names and highlighting the active layer.
 - Changing the active layer by clicking on an item.
 - Adding new layers (using a new operator).
 - Removing the active layer (using a new operator).
 - Renaming a layer.

Pull Request: https://projects.blender.org/blender/blender/pulls/109197
2023-06-22 10:51:43 +02:00
Joseph Eagar 93020db5e0 Sculpt: Fix #109112: Connected island code broken for multires 2023-06-21 02:19:00 -07:00
Campbell Barton 472c461816 Cleanup: spelling in comments 2023-06-21 11:28:58 +10:00
Falk David 171de8b5a7 Cleanup: Remove `ED_grease_pencil_draw.h`
This is no longer needed. The function can be moved to
`ED_grease_pencil.h`
2023-06-19 17:38:58 +02:00