Commit Graph

26 Commits

Author SHA1 Message Date
Hans Goudey 744f3b2823 Cleanup: Grammar in comments: Fix uses of "own"
"Own" (the adjective) cannot be used on its own. It should be combined
with something like "its own", "our own",  "her own", or "the object's own".
It also isn't used separately to mean something like "separate".

Also, "its own" is correct instead of "it's own" which is a misues of the verb.
2024-03-07 16:23:35 -05:00
Sean Kim a2b3fe5e01 Sculpt: Add per-brush input samples
This pull request adds the ability for users to specify input samples
on a per brush basis. The existing field in the main `Paint` struct
forces all brushes of a particular tool type to use the same value.
A new field was added to the `Brush` struct to allow for this value
to be specified there instead, and a corresponding unified value in
`UnifiedPaintSettings` has been created to allow users to use the
same value across all brushes.

Addresses #108109

Pull Request: https://projects.blender.org/blender/blender/pulls/117080
2024-01-30 05:08:23 +01:00
Sean Kim 1e4f133950 Sculpt: Add brush settings for view & normal automasking values
This pull request adds the ability for the `Limit` and `Falloff` values for the View and Normal automask modes to be applied per-brush instead of modifying the global tool value.

Previously, while the flag settings were stored at the brush and global level, the values would always change the global value even when using the advanced tab of the brush menu.

## Testing
* `make test` results in 3 failures (49 - io_wavefront, 134 - compositor_distort_cpu, 323 - imbuf_save), but these tests appear to fail even prior to any changes being applied when running locally
* Manual testing with older version blend files to ensure that the value is defaulted correctly.
* Visual testing to verify that brush values are favored over global values.

Addresses #115174

Pull Request: https://projects.blender.org/blender/blender/pulls/117433
2024-01-24 10:59:50 +01: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
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
Sergey Sharybin c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Joseph Eagar 29f137e138 Sculpt: fix brush.falloff_shape not being reset in "reset brush" op 2023-04-17 15:16:35 -07:00
Campbell Barton 91346755ce Cleanup: use '#' prefix for issues instead of 'T'
Match the convention from Gitea instead of Phabricator's T for tasks.
2023-02-12 14:56:05 +11:00
Pablo Vazquez 69e7274d4f Brush: Fix mismatch in DNA Brush defaults
Missed changing the DNA brush default in rBdb40b6

Thanks to SteffenD for reporting in blender.chat!
2022-10-17 14:11:21 +02:00
Joseph Eagar 0156a677c7 Sculpt: New Cavity Automasking Mode
Add new cavity automasking mode based on local mesh
curvature.  Cavity masking is a great way to quickly add
detail in crevices and the like.  It's meant to be used
with the Paint brush in color attribute mode.  It does
work with other brushes but the results can be unpredictable.

{F13131497}

The old "dirty mask" operator has been replace with a new
"mask from cavity" operator that shares the same code with
cavity automasking.

Differences from the sculpt-dev implementation:
    * It uses the word "cavity."  When I first implemented
this I wasn't aware
      this feature existed in other software (and other
paint modes in Blender),
      and for reasons that escape me today I initially
decided to call it a concave or
      concavity mask.
    * The cavity factor works a bit differently.  It's
      no longer non-linear and functions as a simple
      scale around 0.5f.
    * Supports custom curves.
    * Supports blurring.

Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton
Differential Revision: https://developer.blender.org/D15122
Ref D15122
2022-09-28 16:22:34 -07:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton 4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
Pablo Dobarro cc6ec71b19 Sculpt: Wet paint area radius
This adds a new property to the sculpt vertex color paint brush to limit
the area of the brush that is going to be used to sample the wet paint
color. This is exactly the same concept as normal radius and area radius
that exist for sculpting brushes for sampling the surface depth and
orientation.

When working near color hard edges, this allows to prevent the color
from the other side of the edge to blend into the wet paint.

With 1.0 (the previous default) wet paint radius, as soon as the brush touches
one vertex of the other color, the wet paint mix color changes, making it
impossible to maintain the border between the two colors.

Reviewed By: sergey, dbystedt, JulienKaspar

Differential Revision: https://developer.blender.org/D9587
2020-12-03 22:55:35 +01:00
Jacques Lucke 91694b9b58 Code Style: use "#pragma once" in source directory
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.

This patch has been generated by P1561 followed by `make format`.

Differential Revision: https://developer.blender.org/D8466
2020-08-07 09:50:34 +02:00
Pablo Dobarro 438bd82371 Sculpt: Pose Brush option to affect loose parts
This option allows posing meshes with different disconnected elements
using the Pose Brush.

This is achieved by doing the following:
- Creating an ID per vertex that stores the connected component of that vertex.
- By using those IDs, one fake topology connection is created per vertex to the nearest vertex in a different ID. The maximum distance to create that connection is determined by the "Max Element Distance" property. These fake connectivity neighbors are used in the Sculpt API functions iterators, so all the algorithms of the Pose Brush can run without modifications as if everything was part of the same mesh.

In order to make this work, the "Connected only" property of the Pose Brush needs to be disabled. This will add an extra performance cost to the Pose Brush and its preview. To achieve optimal results, max element distance should be as low as possible.

Reviewed By: sergey, campbellbarton

Differential Revision: https://developer.blender.org/D7282
2020-06-30 17:43:37 +02:00
Pablo Dobarro 84b94f9e7b Sculpt: Edge Automasking
This automasking option protects the open boundary edges of the mesh from the brush deformation. This is needed to sculpt cloths and it works nicely with the cloth brush.
It has a Propagation Steps property that controls the falloff of the mask from the edge.

Limitations:
- The automask is recalculated at the beginning of each stroke, creating a little bit of lag in high poly meshes, but it is not necessary. This can be fixed in the future by caching the edge distances, increasing a little bit the complexity of the code.
- The boundary vertex detection in meshes is not ideal and it fails with triangulated geometry, but it is the same as in the smooth brush. After fixing this, we should refactor the smooth brush to use the API and let the automasking option manually control the affected vertices.
- It does not work in Multires (it needs to be implemented in the API). The smooth brush in Multires is also not making boundary vertices.
- The falloff has a visible line artifact on grid patterns. We can smooth the final automasking factors several iterations, but it will make the initialization much slower. This can also be added in the future if we decided to cache the distances.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6705
2020-03-09 21:16:02 +01:00
Pablo Dobarro ff0124418f Sculpt: Hardness brush property
The hardness property moves the brush falloff towards the edges, making
the brush sharper.

This should be the intended way to control the brush falloff instead of
tweaking the falloff curve manually, as it can be mapped to pressure to
make the falloff variable during the stroke.
It is also a good idea to show in the UI that the custom curves is an
advance features and it should almost never be modified when sculpting/
painting unless you want to create some advanced effects. By modifying
the curves freely it is really easy to break the brushes and make them
produce artifacts. This needs to be done in a later after merging the
pending projects to reorganize all the brush properties accordingly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6902
2020-03-01 20:05:58 +01:00
Pablo Dobarro 4a373afa5f Sculpt: Cloth brush
This brush has a simple physics solver that helps when sculpting cloth.

- The mass and the damping properties of the simulation are properties of the brush.
- It has two additional radius control to limit the influence and falloff of the simulation.
- Masked vertices are pinned in the simulation, and it applies the sculpt gravity directly in the solver.
- The Cloth Brush has 7 deformation modes with 2 falloff types (radial and plane).

The brush can create the constraints only on the required PBVH nodes, so the simulation is isolated on high poly meshes. As long
as the brush size is not too big it should be possible to keep it real time.

Known issues:
- The way constraints are created is extremely basic and it creates repeated constraints. Maybe there is another way to create fewer constraints while keeping the simulation quality decent. This part can also be multithreaded. (As it is it works ok, but it could be better)

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6715
2020-02-28 17:03:20 +01:00
Pablo Dobarro df45257ec5 Sculpt: Split normal radius and area radius
This enables an extra layer of control in the sculpt brushes.
For now it is enabled only in Scrape, but it should work in all brushes (like normal radius). In the future it may also be enabled in other brushes.
You can tweak in this property in the scrape brush to achieve a much better behavior when working on curve surfaces and control how much volume you want to trim. In most cases, it also fixes the bug where the brush keeps trimming in the same area without disabling accumulate.
It should be possible to fix some other artifacts in other brushes by tweaking this default property.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5993
2020-02-11 20:48:01 +01:00
Pablo Dobarro e7c90438e0 Fix T73054: Add DNA defaults for pose_ik_segments
This fixes the crash with pose_ik_segments = 0 in old files.
Some files were saved with the property set to 0, so the versioning code
won't work in that cases. I also changed that to fix the crash in those
files.

Reviewed By: brecht

Maniphest Tasks: T73054

Differential Revision: https://developer.blender.org/D6663
2020-01-29 16:47:24 +01:00
Pablo Dobarro 0314561684 Sculpt: Add color alpha controls to the brush cursor
Previously the alpha was hardcoded to 0.7. Now it is possible to control
the cursor alpha by changing the alpha color of the cursor color
property. New alpha default is 0.9. This, with the new saturated colors,
should make the cursor more visible on highdpi screens.

I also removed the cache location preview as it is too visible right now
with the new alpha and color values.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D6433
2019-12-30 16:42:25 +01:00
Pablo Dobarro 186bd1759f Pose brush: Smooth Iterations Brush Property
The smooth iterations of the pose factor were hardcoded to 4. This works fine in most situations when you are posing a low poly mesh, which is the main use case of this tool. I added the smooth iterations as a brush property in case you need to pose a high poly mesh directly without producing artifacts.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D6157
2019-11-21 18:41:58 +01:00
Pablo Dobarro 15f82278d5 Sculpt/Paint: Dash Ratio and Dash Samples
Dash Ratio and Dash Samples are brush properties to modify the strength of the brush during a stroke. This is useful to create dashed lines in texture paint or stitches in sculpt mode.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5949
2019-11-21 17:55:36 +01:00
Pablo Dobarro cd827194f7 Paint: Option to disable antialiasing
You may want to disable antialiasing if you are working with pixel art
or low resolution textures. It is enabled by default.

Reviewed By: jbakker, campbellbarton

Differential Revision: https://developer.blender.org/D6044
2019-10-31 14:45:26 +01:00
Campbell Barton 72666ae3e7 Brush: default the strength to 1.0
This applies to all paint modes except sculpt and grease pencil brushes.

When painting color or weight it's best to paint the color
the user has selected, without them having to make multiple strokes.
2019-10-02 03:37:29 +10:00
Campbell Barton 9a076dd95a DNA: defaults for ID types 2019-09-12 04:58:09 +10:00