2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
* Copyright 2006 by Nicholas Bishop. All rights reserved. */
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup edsculpt
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2009-01-06 21:23:42 +00:00
|
|
|
|
2020-04-03 21:05:20 +02:00
|
|
|
#include "DNA_brush_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_key_types.h"
|
2009-01-06 21:23:42 +00:00
|
|
|
#include "DNA_listBase.h"
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
#include "DNA_meshdata_types.h"
|
2022-04-15 16:39:50 +02:00
|
|
|
#include "DNA_scene_types.h"
|
2009-01-06 21:23:42 +00:00
|
|
|
#include "DNA_vec_types.h"
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2021-12-20 14:04:53 -05:00
|
|
|
#include "BKE_paint.h"
|
|
|
|
#include "BKE_pbvh.h"
|
2012-03-14 06:32:43 +00:00
|
|
|
#include "BLI_bitmap.h"
|
2022-04-15 16:39:50 +02:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2021-12-20 14:04:53 -05:00
|
|
|
#include "BLI_compiler_compat.h"
|
2020-03-01 13:59:51 -07:00
|
|
|
#include "BLI_gsqueue.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_threads.h"
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2023-01-13 00:10:46 -08:00
|
|
|
#include "ED_view3d.h"
|
|
|
|
|
2023-02-22 22:32:09 -08:00
|
|
|
#include <functional>
|
|
|
|
|
2020-10-15 19:34:54 +02:00
|
|
|
struct AutomaskingCache;
|
2022-09-28 23:21:56 -07:00
|
|
|
struct AutomaskingNodeData;
|
2023-02-09 20:35:50 +01:00
|
|
|
struct Dial;
|
|
|
|
struct DistRayAABB_Precalc;
|
2022-04-15 16:39:50 +02:00
|
|
|
struct Image;
|
|
|
|
struct ImageUser;
|
2009-12-09 11:09:56 +00:00
|
|
|
struct KeyBlock;
|
2009-01-06 21:23:42 +00:00
|
|
|
struct Object;
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptProjectVector;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct SculptUndoNode;
|
|
|
|
struct bContext;
|
2022-04-15 16:39:50 +02:00
|
|
|
struct PaintModeSettings;
|
2023-02-09 20:35:50 +01:00
|
|
|
struct WeightPaintInfo;
|
|
|
|
struct WPaintData;
|
2022-10-04 13:54:04 +11:00
|
|
|
struct wmKeyConfig;
|
|
|
|
struct wmOperator;
|
|
|
|
struct wmOperatorType;
|
2020-03-01 19:53:40 +01:00
|
|
|
|
2019-09-30 15:56:12 +02:00
|
|
|
/* Updates */
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Types
|
|
|
|
* \{ */
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum SculptUpdateType {
|
2019-09-30 15:56:12 +02:00
|
|
|
SCULPT_UPDATE_COORDS = 1 << 0,
|
|
|
|
SCULPT_UPDATE_MASK = 1 << 1,
|
2020-03-05 14:53:23 +01:00
|
|
|
SCULPT_UPDATE_VISIBILITY = 1 << 2,
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
SCULPT_UPDATE_COLOR = 1 << 3,
|
2022-04-15 16:39:50 +02:00
|
|
|
SCULPT_UPDATE_IMAGE = 1 << 4,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-09-30 15:56:12 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptCursorGeometryInfo {
|
2019-08-30 16:27:31 +02:00
|
|
|
float location[3];
|
|
|
|
float normal[3];
|
|
|
|
float active_vertex_co[3];
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-08-30 16:27:31 +02:00
|
|
|
|
2020-02-28 14:40:40 +01:00
|
|
|
#define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptVertexNeighborIter {
|
2020-02-28 14:40:40 +01:00
|
|
|
/* Storage */
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef *neighbors;
|
|
|
|
int *neighbor_indices;
|
2020-02-28 14:40:40 +01:00
|
|
|
int size;
|
|
|
|
int capacity;
|
2022-07-29 19:01:32 -07:00
|
|
|
|
|
|
|
PBVHVertRef neighbors_fixed[SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY];
|
|
|
|
int neighbor_indices_fixed[SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY];
|
2020-02-28 14:40:40 +01:00
|
|
|
|
|
|
|
/* Internal iterator. */
|
|
|
|
int num_duplicates;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Public */
|
|
|
|
int index;
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef vertex;
|
2020-02-28 14:40:40 +01:00
|
|
|
bool is_duplicate;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2020-03-01 19:53:40 +01:00
|
|
|
/* Sculpt Original Data */
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptOrigVertData {
|
2020-03-01 19:53:40 +01:00
|
|
|
struct BMLog *bm_log;
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptUndoNode *unode;
|
2020-03-01 19:53:40 +01:00
|
|
|
float (*coords)[3];
|
Refactor: Move normals out of MVert, lazy calculation
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.
The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.
The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).
**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code
In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).
Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.
**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
- Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
showing that accessing just `MVert` is now more efficient.
- Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
change that at least shows there is no regression.
- Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
but observable speedup.
- Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
shows that using normals in geometry nodes is faster.
- Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
shows that calculating normals is slightly faster now.
- File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
Normals are not saved in files, which can help with large meshes.
As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.
**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
- The subdivision surface modifier is not responsible for calculating
normals anymore. In master, the modifier creates different normals
than the result of the `Mesh` normal calculation, so this is a bug
fix.
- There are small differences in the results of some modifiers that
use normals because they are not converted to and from `short`
anymore.
**Future improvements**
- Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
already retrieves normals if they are needed anyway.
- Copy normals as part of a better CoW system for attributes.
- Make more areas use lazy instead of eager normal calculation.
- Remove `BKE_mesh_normals_tag_dirty` in more places since that is
now the default state of a new mesh.
- Possibly apply a similar change to derived face corner normals.
Differential Revision: https://developer.blender.org/D12770
2022-01-13 14:37:58 -06:00
|
|
|
float (*normals)[3];
|
2020-03-01 19:53:40 +01:00
|
|
|
const float *vmasks;
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
float (*colors)[4];
|
2020-03-01 19:53:40 +01:00
|
|
|
|
|
|
|
/* Original coordinate, normal, and mask. */
|
|
|
|
const float *co;
|
Refactor: Move normals out of MVert, lazy calculation
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.
The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.
The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).
**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code
In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).
Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.
**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
- Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
showing that accessing just `MVert` is now more efficient.
- Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
change that at least shows there is no regression.
- Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
but observable speedup.
- Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
shows that using normals in geometry nodes is faster.
- Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
shows that calculating normals is slightly faster now.
- File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
Normals are not saved in files, which can help with large meshes.
As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.
**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
- The subdivision surface modifier is not responsible for calculating
normals anymore. In master, the modifier creates different normals
than the result of the `Mesh` normal calculation, so this is a bug
fix.
- There are small differences in the results of some modifiers that
use normals because they are not converted to and from `short`
anymore.
**Future improvements**
- Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
already retrieves normals if they are needed anyway.
- Copy normals as part of a better CoW system for attributes.
- Make more areas use lazy instead of eager normal calculation.
- Remove `BKE_mesh_normals_tag_dirty` in more places since that is
now the default state of a new mesh.
- Possibly apply a similar change to derived face corner normals.
Differential Revision: https://developer.blender.org/D12770
2022-01-13 14:37:58 -06:00
|
|
|
const float *no;
|
2020-03-01 19:53:40 +01:00
|
|
|
float mask;
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
const float *col;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2020-03-01 19:53:40 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptOrigFaceData {
|
|
|
|
SculptUndoNode *unode;
|
2022-11-22 12:13:33 -08:00
|
|
|
struct BMLog *bm_log;
|
|
|
|
const int *face_sets;
|
|
|
|
int face_set;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-11-22 12:13:33 -08:00
|
|
|
|
2020-03-01 19:53:40 +01:00
|
|
|
/* Flood Fill. */
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptFloodFill {
|
2020-03-01 13:59:51 -07:00
|
|
|
GSQueue *queue;
|
2022-09-08 11:22:30 +10:00
|
|
|
BLI_bitmap *visited_verts;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2020-03-01 19:53:40 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum eBoundaryAutomaskMode {
|
2022-01-19 16:19:21 -08:00
|
|
|
AUTOMASK_INIT_BOUNDARY_EDGES = 1,
|
|
|
|
AUTOMASK_INIT_BOUNDARY_FACE_SETS = 2,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Undo */
|
2020-04-03 23:41:54 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum SculptUndoType {
|
2022-01-19 16:19:21 -08:00
|
|
|
SCULPT_UNDO_COORDS,
|
|
|
|
SCULPT_UNDO_HIDDEN,
|
|
|
|
SCULPT_UNDO_MASK,
|
|
|
|
SCULPT_UNDO_DYNTOPO_BEGIN,
|
|
|
|
SCULPT_UNDO_DYNTOPO_END,
|
|
|
|
SCULPT_UNDO_DYNTOPO_SYMMETRIZE,
|
|
|
|
SCULPT_UNDO_GEOMETRY,
|
|
|
|
SCULPT_UNDO_FACE_SETS,
|
|
|
|
SCULPT_UNDO_COLOR,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Storage of geometry for the undo node.
|
|
|
|
* Is used as a storage for either original or modified geometry. */
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptUndoNodeGeometry {
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Is used for sanity check, helping with ensuring that two and only two
|
|
|
|
* geometry pushes happened in the undo stack. */
|
|
|
|
bool is_initialized;
|
|
|
|
|
|
|
|
CustomData vdata;
|
|
|
|
CustomData edata;
|
|
|
|
CustomData ldata;
|
|
|
|
CustomData pdata;
|
Mesh: Replace MPoly struct with offset indices
Implements #95967.
Currently the `MPoly` struct is 12 bytes, and stores the index of a
face's first corner and the number of corners/verts/edges. Polygons
and corners are always created in order by Blender, meaning each
face's corners will be after the previous face's corners. We can take
advantage of this fact and eliminate the redundancy in mesh face
storage by only storing a single integer corner offset for each face.
The size of the face is then encoded by the offset of the next face.
The size of a single integer is 4 bytes, so this reduces memory
usage by 3 times.
The same method is used for `CurvesGeometry`, so Blender already has
an abstraction to simplify using these offsets called `OffsetIndices`.
This class is used to easily retrieve a range of corner indices for
each face. This also gives the opportunity for sharing some logic with
curves.
Another benefit of the change is that the offsets and sizes stored in
`MPoly` can no longer disagree with each other. Storing faces in the
order of their corners can simplify some code too.
Face/polygon variables now use the `IndexRange` type, which comes with
quite a few utilities that can simplify code.
Some:
- The offset integer array has to be one longer than the face count to
avoid a branch for every face, which means the data is no longer part
of the mesh's `CustomData`.
- We lose the ability to "reference" an original mesh's offset array
until more reusable CoW from #104478 is committed. That will be added
in a separate commit.
- Since they aren't part of `CustomData`, poly offsets often have to be
copied manually.
- To simplify using `OffsetIndices` in many places, some functions and
structs in headers were moved to only compile in C++.
- All meshes created by Blender use the same order for faces and face
corners, but just in case, meshes with mismatched order are fixed by
versioning code.
- `MeshPolygon.totloop` is no longer editable in RNA. This API break is
necessary here unfortunately. It should be worth it in 3.6, since
that's the best way to allow loading meshes from 4.0, which is
important for an LTS version.
Pull Request: https://projects.blender.org/blender/blender/pulls/105938
2023-04-04 20:39:28 +02:00
|
|
|
int *poly_offset_indices;
|
2022-01-19 16:19:21 -08:00
|
|
|
int totvert;
|
|
|
|
int totedge;
|
|
|
|
int totloop;
|
|
|
|
int totpoly;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptUndoNode {
|
|
|
|
SculptUndoNode *next, *prev;
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
SculptUndoType type;
|
|
|
|
|
|
|
|
char idname[MAX_ID_NAME]; /* Name instead of pointer. */
|
|
|
|
void *node; /* only during push, not valid afterwards! */
|
|
|
|
|
|
|
|
float (*co)[3];
|
|
|
|
float (*orig_co)[3];
|
|
|
|
float (*no)[3];
|
|
|
|
float (*col)[4];
|
|
|
|
float *mask;
|
|
|
|
int totvert;
|
|
|
|
|
2022-04-05 11:42:55 -07:00
|
|
|
float (*loop_col)[4];
|
|
|
|
float (*orig_loop_col)[4];
|
|
|
|
int totloop;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* non-multires */
|
|
|
|
int maxvert; /* to verify if totvert it still the same */
|
2022-04-05 11:42:55 -07:00
|
|
|
int *index; /* Unique vertex indices, to restore into right location */
|
|
|
|
int maxloop;
|
|
|
|
int *loop_index;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
BLI_bitmap *vert_hidden;
|
|
|
|
|
|
|
|
/* multires */
|
|
|
|
int maxgrid; /* same for grid */
|
|
|
|
int gridsize; /* same for grid */
|
|
|
|
int totgrid; /* to restore into right location */
|
|
|
|
int *grids; /* to restore into right location */
|
|
|
|
BLI_bitmap **grid_hidden;
|
|
|
|
|
|
|
|
/* bmesh */
|
2023-02-09 20:35:50 +01:00
|
|
|
BMLogEntry *bm_entry;
|
2022-01-19 16:19:21 -08:00
|
|
|
bool applied;
|
|
|
|
|
|
|
|
/* shape keys */
|
|
|
|
char shapeName[sizeof(((KeyBlock *)0))->name];
|
|
|
|
|
|
|
|
/* Geometry modification operations.
|
|
|
|
*
|
|
|
|
* Original geometry is stored before some modification is run and is used to restore state of
|
|
|
|
* the object when undoing the operation
|
|
|
|
*
|
|
|
|
* Modified geometry is stored after the modification and is used to redo the modification. */
|
|
|
|
bool geometry_clear_pbvh;
|
|
|
|
SculptUndoNodeGeometry geometry_original;
|
|
|
|
SculptUndoNodeGeometry geometry_modified;
|
|
|
|
|
|
|
|
/* Geometry at the bmesh enter moment. */
|
|
|
|
SculptUndoNodeGeometry geometry_bmesh_enter;
|
|
|
|
|
|
|
|
/* pivot */
|
|
|
|
float pivot_pos[3];
|
|
|
|
float pivot_rot[4];
|
|
|
|
|
|
|
|
/* Sculpt Face Sets */
|
|
|
|
int *face_sets;
|
|
|
|
|
2022-11-22 12:13:33 -08:00
|
|
|
PBVHFaceRef *faces;
|
|
|
|
int faces_num;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
size_t undo_size;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Factor of brush to have rake point following behind
|
|
|
|
* (could be configurable but this is reasonable default). */
|
|
|
|
#define SCULPT_RAKE_BRUSH_FACTOR 0.25f
|
|
|
|
|
|
|
|
struct SculptRakeData {
|
|
|
|
float follow_dist;
|
|
|
|
float follow_co[3];
|
2023-04-12 18:33:53 -07:00
|
|
|
float angle;
|
2020-04-03 23:41:54 +02:00
|
|
|
};
|
|
|
|
|
2022-04-11 11:41:00 +10:00
|
|
|
/**
|
|
|
|
* Generic thread data. The size of this struct has gotten a little out of hand;
|
|
|
|
* normally we would split it up, but it might be better to see if we can't eliminate it
|
|
|
|
* altogether after moving to C++ (where we'll be able to use lambdas).
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptThreadedTaskData {
|
|
|
|
bContext *C;
|
|
|
|
Sculpt *sd;
|
|
|
|
Object *ob;
|
|
|
|
const Brush *brush;
|
|
|
|
PBVHNode **nodes;
|
2022-01-19 16:19:21 -08:00
|
|
|
int totnode;
|
2020-04-03 23:41:54 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
VPaint *vp;
|
|
|
|
WPaintData *wpd;
|
|
|
|
WeightPaintInfo *wpi;
|
2022-01-19 16:19:21 -08:00
|
|
|
unsigned int *lcol;
|
2023-02-09 20:35:50 +01:00
|
|
|
Mesh *me;
|
2022-01-19 16:19:21 -08:00
|
|
|
/* For passing generic params. */
|
|
|
|
void *custom_data;
|
2020-04-03 19:42:48 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Data specific to some callbacks. */
|
2020-04-03 23:41:54 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* NOTE: even if only one or two of those are used at a time,
|
|
|
|
* keeping them separated, names help figuring out
|
|
|
|
* what it is, and memory overhead is ridiculous anyway. */
|
|
|
|
float flippedbstrength;
|
|
|
|
float angle;
|
|
|
|
float strength;
|
|
|
|
bool smooth_mask;
|
|
|
|
bool has_bm_orco;
|
2020-04-03 23:41:54 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptProjectVector *spvc;
|
2022-01-19 16:19:21 -08:00
|
|
|
float *offset;
|
|
|
|
float *grab_delta;
|
|
|
|
float *cono;
|
|
|
|
float *area_no;
|
|
|
|
float *area_no_sp;
|
|
|
|
float *area_co;
|
|
|
|
float (*mat)[4];
|
|
|
|
float (*vertCos)[3];
|
2020-04-03 23:41:54 +02:00
|
|
|
|
2022-06-28 15:35:35 +02:00
|
|
|
/* When true, the displacement stored in the proxies will be applied to the original coordinates
|
2022-06-03 19:21:04 -07:00
|
|
|
* instead of to the current coordinates. */
|
|
|
|
bool use_proxies_orco;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* X and Z vectors aligned to the stroke direction for operations where perpendicular vectors to
|
|
|
|
* the stroke direction are needed. */
|
|
|
|
float (*stroke_xz)[3];
|
2020-03-09 19:04:37 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
int filter_type;
|
|
|
|
float filter_strength;
|
|
|
|
float *filter_fill_color;
|
2020-10-15 19:34:54 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool use_area_cos;
|
|
|
|
bool use_area_nos;
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* 0=towards view, 1=flipped */
|
|
|
|
float (*area_cos)[3];
|
|
|
|
float (*area_nos)[3];
|
|
|
|
int *count_no;
|
|
|
|
int *count_co;
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool any_vertex_sampled;
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float *wet_mix_sampled_color;
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float *prev_mask;
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float *pose_factor;
|
|
|
|
float *pose_initial_co;
|
|
|
|
int pose_chain_segment;
|
|
|
|
|
|
|
|
float multiplane_scrape_angle;
|
|
|
|
float multiplane_scrape_planes[2][4];
|
|
|
|
|
|
|
|
float max_distance_squared;
|
|
|
|
float nearest_vertex_search_co[3];
|
|
|
|
|
|
|
|
/* Stabilized strength for the Clay Thumb brush. */
|
|
|
|
float clay_strength;
|
|
|
|
|
|
|
|
int mask_expand_update_it;
|
|
|
|
bool mask_expand_invert_mask;
|
|
|
|
bool mask_expand_use_normals;
|
|
|
|
bool mask_expand_keep_prev_mask;
|
|
|
|
bool mask_expand_create_face_set;
|
|
|
|
|
|
|
|
float transform_mats[8][4][4];
|
2022-06-03 19:21:04 -07:00
|
|
|
float elastic_transform_mat[4][4];
|
|
|
|
float elastic_transform_pivot[3];
|
|
|
|
float elastic_transform_pivot_init[3];
|
|
|
|
float elastic_transform_radius;
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Boundary brush */
|
|
|
|
float boundary_deform_strength;
|
|
|
|
|
|
|
|
float cloth_time_step;
|
|
|
|
SculptClothSimulation *cloth_sim;
|
|
|
|
float *cloth_sim_initial_location;
|
|
|
|
float cloth_sim_radius;
|
|
|
|
|
|
|
|
/* Mask By Color Tool */
|
|
|
|
|
|
|
|
float mask_by_color_threshold;
|
|
|
|
bool mask_by_color_invert;
|
|
|
|
bool mask_by_color_preserve_mask;
|
|
|
|
|
|
|
|
/* Index of the vertex that is going to be used as a reference for the colors. */
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef mask_by_color_vertex;
|
2022-01-19 16:19:21 -08:00
|
|
|
float *mask_by_color_floodfill;
|
|
|
|
|
|
|
|
int face_set;
|
|
|
|
int filter_undo_type;
|
|
|
|
|
|
|
|
int mask_init_mode;
|
|
|
|
int mask_init_seed;
|
|
|
|
|
|
|
|
ThreadMutex mutex;
|
2022-10-14 23:00:13 -07:00
|
|
|
int iteration;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/*************** Brush testing declarations ****************/
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptBrushTest {
|
2022-01-19 16:19:21 -08:00
|
|
|
float radius_squared;
|
|
|
|
float radius;
|
|
|
|
float location[3];
|
|
|
|
float dist;
|
2022-11-09 19:27:41 -06:00
|
|
|
ePaintSymmetryFlags mirror_symmetry_pass;
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
int radial_symmetry_pass;
|
|
|
|
float symm_rot_mat_inv[4][4];
|
|
|
|
|
|
|
|
/* For circle (not sphere) projection. */
|
|
|
|
float plane_view[4];
|
|
|
|
|
|
|
|
/* Some tool code uses a plane for its calculations. */
|
|
|
|
float plane_tool[4];
|
|
|
|
|
|
|
|
/* View3d clipping - only set rv3d for clipping */
|
2023-02-09 20:35:50 +01:00
|
|
|
RegionView3D *clip_rv3d;
|
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
using SculptBrushTestFn = bool (*)(SculptBrushTest *test, const float co[3]);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptSearchSphereData {
|
|
|
|
Sculpt *sd;
|
|
|
|
SculptSession *ss;
|
2022-01-19 16:19:21 -08:00
|
|
|
float radius_squared;
|
|
|
|
const float *center;
|
|
|
|
bool original;
|
|
|
|
/* This ignores fully masked and fully hidden nodes. */
|
|
|
|
bool ignore_fully_ineffective;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct SculptSearchCircleData {
|
|
|
|
Sculpt *sd;
|
|
|
|
SculptSession *ss;
|
2022-01-19 16:19:21 -08:00
|
|
|
float radius_squared;
|
|
|
|
bool original;
|
|
|
|
bool ignore_fully_ineffective;
|
2023-02-09 20:35:50 +01:00
|
|
|
DistRayAABB_Precalc *dist_ray_to_aabb_precalc;
|
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Sculpt Filters */
|
2023-02-09 20:35:50 +01:00
|
|
|
enum SculptFilterOrientation {
|
2022-01-19 16:19:21 -08:00
|
|
|
SCULPT_FILTER_ORIENTATION_LOCAL = 0,
|
|
|
|
SCULPT_FILTER_ORIENTATION_WORLD = 1,
|
|
|
|
SCULPT_FILTER_ORIENTATION_VIEW = 2,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2022-06-03 19:21:04 -07:00
|
|
|
/* Defines how transform tools are going to apply its displacement. */
|
2023-02-09 20:35:50 +01:00
|
|
|
enum SculptTransformDisplacementMode {
|
2022-06-03 19:21:04 -07:00
|
|
|
/* Displaces the elements from their original coordinates. */
|
|
|
|
SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL = 0,
|
|
|
|
/* Displaces the elements incrementally from their previous position. */
|
|
|
|
SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL = 1,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-06-03 19:21:04 -07:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
#define SCULPT_CLAY_STABILIZER_LEN 10
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct AutomaskingSettings {
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Flags from eAutomasking_flag. */
|
|
|
|
int flags;
|
|
|
|
int initial_face_set;
|
2023-01-19 16:53:43 -08:00
|
|
|
int initial_island_nr;
|
2022-09-28 23:21:56 -07:00
|
|
|
|
2022-09-28 16:22:34 -07:00
|
|
|
float cavity_factor;
|
|
|
|
int cavity_blur_steps;
|
2023-02-09 20:35:50 +01:00
|
|
|
CurveMapping *cavity_curve;
|
2022-09-28 23:21:56 -07:00
|
|
|
|
|
|
|
float start_normal_limit, start_normal_falloff;
|
|
|
|
float view_normal_limit, view_normal_falloff;
|
2023-01-24 11:03:21 -08:00
|
|
|
|
|
|
|
bool topology_use_brush_limit;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct AutomaskingCache {
|
2022-01-19 16:19:21 -08:00
|
|
|
AutomaskingSettings settings;
|
2022-09-28 16:22:34 -07:00
|
|
|
|
2022-09-28 23:21:56 -07:00
|
|
|
bool can_reuse_mask;
|
|
|
|
uchar current_stroke_id;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct FilterCache {
|
2022-01-19 16:19:21 -08:00
|
|
|
bool enabled_axis[3];
|
|
|
|
bool enabled_force_axis[3];
|
|
|
|
int random_seed;
|
|
|
|
|
|
|
|
/* Used for alternating between filter operations in filters that need to apply different ones to
|
|
|
|
* achieve certain effects. */
|
|
|
|
int iteration_count;
|
|
|
|
|
|
|
|
/* Stores the displacement produced by the laplacian step of HC smooth. */
|
|
|
|
float (*surface_smooth_laplacian_disp)[3];
|
|
|
|
float surface_smooth_shape_preservation;
|
|
|
|
float surface_smooth_current_vertex;
|
|
|
|
|
|
|
|
/* Sharpen mesh filter. */
|
|
|
|
float sharpen_smooth_ratio;
|
|
|
|
float sharpen_intensify_detail_strength;
|
|
|
|
int sharpen_curvature_smooth_iterations;
|
|
|
|
float *sharpen_factor;
|
|
|
|
float (*detail_directions)[3];
|
|
|
|
|
|
|
|
/* Filter orientation. */
|
|
|
|
SculptFilterOrientation orientation;
|
|
|
|
float obmat[4][4];
|
|
|
|
float obmat_inv[4][4];
|
|
|
|
float viewmat[4][4];
|
|
|
|
float viewmat_inv[4][4];
|
|
|
|
|
|
|
|
/* Displacement eraser. */
|
|
|
|
float (*limit_surface_co)[3];
|
|
|
|
|
|
|
|
/* unmasked nodes */
|
|
|
|
PBVHNode **nodes;
|
|
|
|
int totnode;
|
|
|
|
|
|
|
|
/* Cloth filter. */
|
|
|
|
SculptClothSimulation *cloth_sim;
|
|
|
|
float cloth_sim_pinch_point[3];
|
|
|
|
|
|
|
|
/* mask expand iteration caches */
|
|
|
|
int mask_update_current_it;
|
|
|
|
int mask_update_last_it;
|
|
|
|
int *mask_update_it;
|
|
|
|
float *normal_factor;
|
|
|
|
float *edge_factor;
|
|
|
|
float *prev_mask;
|
|
|
|
float mask_expand_initial_co[3];
|
|
|
|
|
|
|
|
int new_face_set;
|
|
|
|
int *prev_face_set;
|
|
|
|
|
|
|
|
int active_face_set;
|
2020-04-03 19:42:48 +02:00
|
|
|
|
2022-06-03 19:21:04 -07:00
|
|
|
SculptTransformDisplacementMode transform_displacement_mode;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Auto-masking. */
|
|
|
|
AutomaskingCache *automasking;
|
2022-09-28 23:21:56 -07:00
|
|
|
float initial_normal[3];
|
|
|
|
float view_normal[3];
|
2022-04-11 22:49:18 -07:00
|
|
|
|
2022-04-13 13:46:22 +10:00
|
|
|
/* Pre-smoothed colors used by sharpening. Colors are HSL. */
|
2022-04-11 22:49:18 -07:00
|
|
|
float (*pre_smoothed_color)[4];
|
2023-01-13 00:10:46 -08:00
|
|
|
|
|
|
|
ViewContext vc;
|
2023-02-20 11:51:16 +01:00
|
|
|
float start_filter_strength;
|
|
|
|
bool no_orig_co;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* This structure contains all the temporary data
|
|
|
|
* needed for individual brush strokes.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
struct StrokeCache {
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Invariants */
|
|
|
|
float initial_radius;
|
|
|
|
float scale[3];
|
|
|
|
int flag;
|
|
|
|
float clip_tolerance[3];
|
|
|
|
float clip_mirror_mtx[4][4];
|
|
|
|
float initial_mouse[2];
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Variants */
|
|
|
|
float radius;
|
|
|
|
float radius_squared;
|
|
|
|
float true_location[3];
|
|
|
|
float true_last_location[3];
|
|
|
|
float location[3];
|
|
|
|
float last_location[3];
|
2022-08-03 14:08:23 -07:00
|
|
|
float stroke_distance;
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Used for alternating between deformation in brushes that need to apply different ones to
|
|
|
|
* achieve certain effects. */
|
|
|
|
int iteration_count;
|
2020-10-01 18:50:52 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Original pixel radius with the pressure curve applied for dyntopo detail size */
|
|
|
|
float dyntopo_pixel_radius;
|
2020-10-01 18:50:52 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool is_last_valid;
|
2020-08-17 22:18:26 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool pen_flip;
|
|
|
|
bool invert;
|
|
|
|
float pressure;
|
|
|
|
float bstrength;
|
|
|
|
float normal_weight; /* from brush (with optional override) */
|
|
|
|
float x_tilt;
|
|
|
|
float y_tilt;
|
2020-08-17 22:18:26 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Position of the mouse corresponding to the stroke location, modified by the paint_stroke
|
|
|
|
* operator according to the stroke type. */
|
|
|
|
float mouse[2];
|
|
|
|
/* Position of the mouse event in screen space, not modified by the stroke type. */
|
|
|
|
float mouse_event[2];
|
2020-08-17 22:18:26 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float (*prev_colors)[4];
|
2022-04-20 22:03:45 -07:00
|
|
|
void *prev_colors_vpaint;
|
2020-05-19 00:00:21 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Multires Displacement Smear. */
|
|
|
|
float (*prev_displacement)[3];
|
|
|
|
float (*limit_surface_co)[3];
|
2020-12-06 23:11:33 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* The rest is temporary storage that isn't saved as a property */
|
2020-05-19 00:00:21 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool first_time; /* Beginning of stroke may do some things special */
|
2020-12-09 22:19:34 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* from ED_view3d_ob_project_mat_get() */
|
|
|
|
float projection_mat[4][4];
|
2020-12-09 22:19:34 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Clean this up! */
|
2023-02-09 20:35:50 +01:00
|
|
|
ViewContext *vc;
|
|
|
|
const Brush *brush;
|
2020-12-09 22:19:34 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float special_rotation;
|
|
|
|
float grab_delta[3], grab_delta_symmetry[3];
|
|
|
|
float old_grab_location[3], orig_grab_location[3];
|
2020-12-09 22:19:34 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* screen-space rotation defined by mouse motion */
|
|
|
|
float rake_rotation[4], rake_rotation_symmetry[4];
|
|
|
|
bool is_rake_rotation_valid;
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptRakeData rake_data;
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Face Sets */
|
|
|
|
int paint_face_set;
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Symmetry index between 0 and 7 bit combo 0 is Brush only;
|
|
|
|
* 1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
|
|
|
|
int symmetry;
|
2022-11-09 19:27:41 -06:00
|
|
|
ePaintSymmetryFlags
|
|
|
|
mirror_symmetry_pass; /* The symmetry pass we are currently on between 0 and 7. */
|
2022-01-19 16:19:21 -08:00
|
|
|
float true_view_normal[3];
|
|
|
|
float view_normal[3];
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* sculpt_normal gets calculated by calc_sculpt_normal(), then the
|
|
|
|
* sculpt_normal_symm gets updated quickly with the usual symmetry
|
|
|
|
* transforms */
|
|
|
|
float sculpt_normal[3];
|
|
|
|
float sculpt_normal_symm[3];
|
Sculpt: Boundary Brush
This brush includes a set of deformation modes designed to deform and
control the shape of the mesh boundaries, which are really hard to do
with regular sculpt brushes (and even in edit mode). This is useful
for creating cloth assets and hard surface base meshes.
The brush detects the mesh boundary closest to the active vertex and
propagates the deformation using the brush falloff into the mesh.
It includes bend, expand, inflate, grab and twist deform modes.
The main use cases of this brush are the Bend and Expand deformation
modes, which depend on a grid topology to create the best results.
In order to do further adjustments and tweaks to the result of these
deformation modes, the brush also includes the Inflate, Grab and
Twist deformation modes, which do not depend that much on the topology.
Grab and Inflate are the same operation that is implemented in the
Grab and Inflate tools, they are also available in the boundary brush
as producing deformations with regular brushes in these areas is very
hard to control.
Even if this brush can produce deformations in triangle meshes and
meshes with a non-regular quad grid, the more regular and clean the
topology is, the better. Most of the assets this brush is intended to
deform are always created from a cylindrical or plane quad grid, so it
should be fine. Also, its algorithms can be improved in future versions
to handle more corner cases and topology patterns.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8356
2020-08-10 17:57:01 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Used for area texture mode, local_mat gets calculated by
|
2023-02-14 15:29:27 +01:00
|
|
|
* calc_brush_local_mat() and used in sculpt_apply_texture().
|
|
|
|
* Transforms from model-space coords to local area coords.
|
|
|
|
*/
|
2022-01-19 16:19:21 -08:00
|
|
|
float brush_local_mat[4][4];
|
2023-02-14 15:29:27 +01:00
|
|
|
/* The matrix from local area coords to model-space coords is used to calculate the vector
|
|
|
|
* displacement in area plane mode. */
|
|
|
|
float brush_local_mat_inv[4][4];
|
Sculpt: Boundary Brush
This brush includes a set of deformation modes designed to deform and
control the shape of the mesh boundaries, which are really hard to do
with regular sculpt brushes (and even in edit mode). This is useful
for creating cloth assets and hard surface base meshes.
The brush detects the mesh boundary closest to the active vertex and
propagates the deformation using the brush falloff into the mesh.
It includes bend, expand, inflate, grab and twist deform modes.
The main use cases of this brush are the Bend and Expand deformation
modes, which depend on a grid topology to create the best results.
In order to do further adjustments and tweaks to the result of these
deformation modes, the brush also includes the Inflate, Grab and
Twist deformation modes, which do not depend that much on the topology.
Grab and Inflate are the same operation that is implemented in the
Grab and Inflate tools, they are also available in the boundary brush
as producing deformations with regular brushes in these areas is very
hard to control.
Even if this brush can produce deformations in triangle meshes and
meshes with a non-regular quad grid, the more regular and clean the
topology is, the better. Most of the assets this brush is intended to
deform are always created from a cylindrical or plane quad grid, so it
should be fine. Also, its algorithms can be improved in future versions
to handle more corner cases and topology patterns.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8356
2020-08-10 17:57:01 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float plane_offset[3]; /* used to shift the plane around when doing tiled strokes */
|
|
|
|
int tile_pass;
|
2020-03-06 16:00:33 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float last_center[3];
|
|
|
|
int radial_symmetry_pass;
|
|
|
|
float symm_rot_mat[4][4];
|
|
|
|
float symm_rot_mat_inv[4][4];
|
|
|
|
bool original;
|
|
|
|
float anchored_location[3];
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Paint Brush. */
|
|
|
|
struct {
|
|
|
|
float hardness;
|
|
|
|
float flow;
|
|
|
|
float wet_mix;
|
|
|
|
float wet_persistence;
|
|
|
|
float density;
|
|
|
|
} paint_brush;
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Pose brush */
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptPoseIKChain *pose_ik_chain;
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Enhance Details. */
|
|
|
|
float (*detail_directions)[3];
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Clay Thumb brush */
|
|
|
|
/* Angle of the front tilting plane of the brush to simulate clay accumulation. */
|
|
|
|
float clay_thumb_front_angle;
|
|
|
|
/* Stores pressure samples to get an stabilized strength and radius variation. */
|
|
|
|
float clay_pressure_stabilizer[SCULPT_CLAY_STABILIZER_LEN];
|
|
|
|
int clay_pressure_stabilizer_index;
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Cloth brush */
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptClothSimulation *cloth_sim;
|
2022-01-19 16:19:21 -08:00
|
|
|
float initial_location[3];
|
|
|
|
float true_initial_location[3];
|
|
|
|
float initial_normal[3];
|
|
|
|
float true_initial_normal[3];
|
Fix T78747: Fix mesh boundary detection and automasking
This issue was produced by a hack in the sculpt mode code from 2.80
when the sculpt API for connectivity info was not available.
The smooth brush was the only brush that needed connectivity info,
so there were 3 different smooth functions with the connectivity
queries implemented for dyntopo, meshes and grids. The mesh version
of smoothing was checking the number of connected faces to a vertex
to mask the mesh boundaries, which was not covering all cases and
was hardcoded in the smooth function itself.
This patch removes all those legacy functions and unifies all
smooth functions into a single one using the new API and the
automasking system. In order to achieve this, there were needed
some extra changes:
- The smooth brush now does not automasks the boundaries by default,
so its default preset needs to be updated to enable automasking
- The mesh boundary info is extracted once and cached in a
bitmap, similar to the disconnected elements IDs. This makes
boundary detection work as expected in all cases, solving a lot
of known issues with the smooth brush. In multires, this info is
extracted and cached only at the base mesh level, so it is much
more memory efficient than the previous automasking system.
- In order to keep the brushes responsive as they were before,
the automasking system can now skip creating the cache when it
is not needed for the requested options. This means that for
high poly meshes and simple automasking options the brushes
won't lag on start.
Reviewed By: sergey
Maniphest Tasks: T78747
Differential Revision: https://developer.blender.org/D8260
2020-07-15 16:24:03 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Boundary brush */
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptBoundary *boundaries[PAINT_SYMM_AREAS];
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Surface Smooth Brush */
|
|
|
|
/* Stores the displacement produced by the laplacian step of HC smooth. */
|
|
|
|
float (*surface_smooth_laplacian_disp)[3];
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Layer brush */
|
|
|
|
float *layer_displacement_factor;
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float vertex_rotation; /* amount to rotate the vertices when using rotate brush */
|
2023-02-09 20:35:50 +01:00
|
|
|
Dial *dial;
|
2020-03-09 20:03:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
char saved_active_brush_name[MAX_ID_NAME];
|
|
|
|
char saved_mask_brush_tool;
|
|
|
|
int saved_smooth_size; /* smooth tool copies the size of the current tool */
|
|
|
|
bool alt_smooth;
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float plane_trim_squared;
|
2012-03-14 06:32:43 +00:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool supports_gravity;
|
|
|
|
float true_gravity_direction[3];
|
|
|
|
float gravity_direction[3];
|
2020-03-27 16:37:29 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Auto-masking. */
|
|
|
|
AutomaskingCache *automasking;
|
2020-03-27 16:37:29 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float stroke_local_mat[4][4];
|
|
|
|
float multiplane_scrape_angle;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float wet_mix_prev_color[4];
|
|
|
|
float density_seed;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
rcti previous_r; /* previous redraw rectangle */
|
|
|
|
rcti current_r; /* current redraw rectangle */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-28 16:22:34 -07:00
|
|
|
int stroke_id;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Expand
|
|
|
|
* \{ */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum eSculptExpandFalloffType {
|
2022-01-19 16:19:21 -08:00
|
|
|
SCULPT_EXPAND_FALLOFF_GEODESIC,
|
|
|
|
SCULPT_EXPAND_FALLOFF_TOPOLOGY,
|
|
|
|
SCULPT_EXPAND_FALLOFF_TOPOLOGY_DIAGONALS,
|
|
|
|
SCULPT_EXPAND_FALLOFF_NORMALS,
|
|
|
|
SCULPT_EXPAND_FALLOFF_SPHERICAL,
|
|
|
|
SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY,
|
|
|
|
SCULPT_EXPAND_FALLOFF_BOUNDARY_FACE_SET,
|
|
|
|
SCULPT_EXPAND_FALLOFF_ACTIVE_FACE_SET,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum eSculptExpandTargetType {
|
2022-01-19 16:19:21 -08:00
|
|
|
SCULPT_EXPAND_TARGET_MASK,
|
|
|
|
SCULPT_EXPAND_TARGET_FACE_SETS,
|
|
|
|
SCULPT_EXPAND_TARGET_COLORS,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
enum eSculptExpandRecursionType {
|
2022-01-19 16:19:21 -08:00
|
|
|
SCULPT_EXPAND_RECURSION_TOPOLOGY,
|
|
|
|
SCULPT_EXPAND_RECURSION_GEODESICS,
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
#define EXPAND_SYMM_AREAS 8
|
2020-03-27 16:37:29 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct ExpandCache {
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Target data elements that the expand operation will affect. */
|
|
|
|
eSculptExpandTargetType target;
|
2019-08-14 18:37:46 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Falloff data. */
|
|
|
|
eSculptExpandFalloffType falloff_type;
|
2019-09-10 19:55:15 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Indexed by vertex index, precalculated falloff value of that vertex (without any falloff
|
|
|
|
* editing modification applied). */
|
|
|
|
float *vert_falloff;
|
|
|
|
/* Max falloff value in *vert_falloff. */
|
|
|
|
float max_vert_falloff;
|
2020-03-05 14:53:23 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Indexed by base mesh poly index, precalculated falloff value of that face. These values are
|
|
|
|
* calculated from the per vertex falloff (*vert_falloff) when needed. */
|
|
|
|
float *face_falloff;
|
|
|
|
float max_face_falloff;
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Falloff value of the active element (vertex or base mesh face) that Expand will expand to. */
|
|
|
|
float active_falloff;
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, expand skips all falloff computations and considers all elements as enabled.
|
|
|
|
*/
|
|
|
|
bool all_enabled;
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Initial mouse and cursor data from where the current falloff started. This data can be changed
|
|
|
|
* during the execution of Expand by moving the origin. */
|
|
|
|
float initial_mouse_move[2];
|
|
|
|
float initial_mouse[2];
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef initial_active_vertex;
|
|
|
|
int initial_active_vertex_i;
|
2022-01-19 16:19:21 -08:00
|
|
|
int initial_active_face_set;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Maximum number of vertices allowed in the SculptSession for previewing the falloff using
|
|
|
|
* geodesic distances. */
|
|
|
|
int max_geodesic_move_preview;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Original falloff type before starting the move operation. */
|
|
|
|
eSculptExpandFalloffType move_original_falloff_type;
|
|
|
|
/* Falloff type using when moving the origin for preview. */
|
|
|
|
eSculptExpandFalloffType move_preview_falloff_type;
|
2019-04-22 00:18:34 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Face set ID that is going to be used when creating a new Face Set. */
|
|
|
|
int next_face_set;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Face Set ID of the Face set selected for editing. */
|
|
|
|
int update_face_set;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Mouse position since the last time the origin was moved. Used for reference when moving the
|
|
|
|
* initial position of Expand. */
|
|
|
|
float original_mouse_move[2];
|
2020-02-02 20:11:51 +01:00
|
|
|
|
2023-01-19 18:22:59 -08:00
|
|
|
/* Active island checks. */
|
|
|
|
/* Indexed by symmetry pass index, contains the connected island ID for that
|
|
|
|
* symmetry pass. Other connected island IDs not found in this
|
2022-01-19 16:19:21 -08:00
|
|
|
* array will be ignored by Expand. */
|
2023-01-19 18:22:59 -08:00
|
|
|
int active_connected_islands[EXPAND_SYMM_AREAS];
|
2019-09-10 19:55:15 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Snapping. */
|
|
|
|
/* GSet containing all Face Sets IDs that Expand will use to snap the new data. */
|
|
|
|
GSet *snap_enabled_face_sets;
|
|
|
|
|
|
|
|
/* Texture distortion data. */
|
|
|
|
Brush *brush;
|
2023-02-09 20:35:50 +01:00
|
|
|
Scene *scene;
|
2022-12-13 09:14:33 +01:00
|
|
|
// struct MTex *mtex;
|
2019-12-16 23:16:21 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Controls how much texture distortion will be applied to the current falloff */
|
|
|
|
float texture_distortion_strength;
|
2019-12-16 23:16:21 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Cached PBVH nodes. This allows to skip gathering all nodes from the PBVH each time expand
|
|
|
|
* needs to update the state of the elements. */
|
|
|
|
PBVHNode **nodes;
|
|
|
|
int totnode;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Expand state options. */
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Number of loops (times that the falloff is going to be repeated). */
|
|
|
|
int loop_count;
|
2019-09-09 16:20:40 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Invert the falloff result. */
|
|
|
|
bool invert;
|
2019-09-09 17:44:08 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, preserves the previous state of the data and adds the new one on top. */
|
|
|
|
bool preserve;
|
2019-11-06 19:39:34 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, the mask or colors will be applied as a gradient. */
|
|
|
|
bool falloff_gradient;
|
2019-09-09 16:58:09 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, Expand will use the Brush falloff curve data to shape the gradient. */
|
|
|
|
bool brush_gradient;
|
2020-01-22 02:23:51 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, Expand will move the origin (initial active vertex and cursor position)
|
|
|
|
* instead of updating the active vertex and active falloff. */
|
|
|
|
bool move;
|
2019-09-10 15:11:33 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, Expand will snap the new data to the Face Sets IDs found in
|
|
|
|
* *original_face_sets. */
|
|
|
|
bool snap;
|
2019-09-10 19:55:15 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, Expand will use the current Face Set ID to modify an existing Face Set
|
|
|
|
* instead of creating a new one. */
|
|
|
|
bool modify_active_face_set;
|
Sculpt: Boundary Brush
This brush includes a set of deformation modes designed to deform and
control the shape of the mesh boundaries, which are really hard to do
with regular sculpt brushes (and even in edit mode). This is useful
for creating cloth assets and hard surface base meshes.
The brush detects the mesh boundary closest to the active vertex and
propagates the deformation using the brush falloff into the mesh.
It includes bend, expand, inflate, grab and twist deform modes.
The main use cases of this brush are the Bend and Expand deformation
modes, which depend on a grid topology to create the best results.
In order to do further adjustments and tweaks to the result of these
deformation modes, the brush also includes the Inflate, Grab and
Twist deformation modes, which do not depend that much on the topology.
Grab and Inflate are the same operation that is implemented in the
Grab and Inflate tools, they are also available in the boundary brush
as producing deformations with regular brushes in these areas is very
hard to control.
Even if this brush can produce deformations in triangle meshes and
meshes with a non-regular quad grid, the more regular and clean the
topology is, the better. Most of the assets this brush is intended to
deform are always created from a cylindrical or plane quad grid, so it
should be fine. Also, its algorithms can be improved in future versions
to handle more corner cases and topology patterns.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8356
2020-08-10 17:57:01 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* When set to true, Expand will reposition the sculpt pivot to the boundary of the expand result
|
|
|
|
* after finishing the operation. */
|
|
|
|
bool reposition_pivot;
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2022-12-26 21:43:08 -08:00
|
|
|
/* If nothing is masked set mask of every vertex to 0. */
|
|
|
|
bool auto_mask;
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Color target data type related data. */
|
|
|
|
float fill_color[4];
|
|
|
|
short blend_mode;
|
2019-09-30 15:37:37 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Face Sets at the first step of the expand operation, before starting modifying the active
|
|
|
|
* vertex and active falloff. These are not the original Face Sets of the sculpt before starting
|
|
|
|
* the operator as they could have been modified by Expand when initializing the operator and
|
|
|
|
* before starting changing the active vertex. These Face Sets are used for restoring and
|
|
|
|
* checking the Face Sets state while the Expand operation modal runs. */
|
|
|
|
int *initial_face_sets;
|
2020-07-01 19:19:30 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Original data of the sculpt as it was before running the Expand operator. */
|
|
|
|
float *original_mask;
|
|
|
|
int *original_face_sets;
|
|
|
|
float (*original_colors)[4];
|
2023-01-19 17:27:40 -08:00
|
|
|
|
|
|
|
bool check_islands;
|
2023-01-31 10:01:18 -08:00
|
|
|
int normal_falloff_blur_steps;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2020-07-01 19:19:30 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2020-07-01 19:19:30 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Poll Functions
|
|
|
|
* \{ */
|
2021-03-12 21:35:56 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_mode_poll(bContext *C);
|
|
|
|
bool SCULPT_mode_poll_view3d(bContext *C);
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Checks for a brush, not just sculpt mode.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_poll(bContext *C);
|
|
|
|
bool SCULPT_poll_view3d(bContext *C);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-04-20 23:38:55 -07:00
|
|
|
/**
|
|
|
|
* Returns true if sculpt session can handle color attributes
|
|
|
|
* (BKE_pbvh_type(ss->pbvh) == PBVH_FACES). If false an error
|
|
|
|
* message will be shown to the user. Operators should return
|
|
|
|
* OPERATOR_CANCELLED in this case.
|
|
|
|
*
|
|
|
|
* NOTE: Does not check if a color attribute actually exists.
|
|
|
|
* Calling code must handle this itself; in most cases a call to
|
|
|
|
* BKE_sculpt_color_layer_create_if_needed() is sufficient.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_handles_colors_report(SculptSession *ss, ReportList *reports);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Update Functions
|
|
|
|
* \{ */
|
2020-10-06 12:50:11 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags);
|
|
|
|
void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags);
|
2017-10-06 00:18:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_pbvh_clear(Object *ob);
|
2017-10-02 13:21:23 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Flush displacement from deformed PBVH to original layer.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Should be used after modifying the mask or Face Sets IDs.
|
|
|
|
*/
|
|
|
|
void SCULPT_tag_update_overlays(bContext *C);
|
|
|
|
/** \} */
|
2017-10-02 21:07:25 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Stroke Functions
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
/* Stroke */
|
2017-10-02 21:07:25 +11:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Do a ray-cast in the tree to find the 3d brush location
|
|
|
|
* (This allows us to ignore the GL depth buffer)
|
|
|
|
* Returns 0 if the ray doesn't hit the mesh, non-zero otherwise.
|
2023-02-22 22:32:09 -08:00
|
|
|
*
|
|
|
|
* If check_closest is true and the ray test fails a point closest
|
|
|
|
* to the ray will be found. If limit_closest_radius is true then
|
|
|
|
* the closest point will be tested against the active brush radius.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-02-22 22:32:09 -08:00
|
|
|
bool SCULPT_stroke_get_location_ex(bContext *C,
|
|
|
|
float out[3],
|
|
|
|
const float mval[2],
|
|
|
|
bool force_original,
|
|
|
|
bool check_closest,
|
|
|
|
bool limit_closest_radius);
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_stroke_get_location(bContext *C,
|
2022-07-16 17:27:25 -07:00
|
|
|
float out[3],
|
|
|
|
const float mouse[2],
|
|
|
|
bool force_original);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Gets the normal, location and active vertex location of the geometry under the cursor. This also
|
|
|
|
* updates the active vertex and cursor related data of the SculptSession using the mouse position
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2022-01-19 16:19:21 -08:00
|
|
|
bool SCULPT_cursor_geometry_info_update(bContext *C,
|
|
|
|
SculptCursorGeometryInfo *out,
|
|
|
|
const float mouse[2],
|
|
|
|
bool use_sampled_normal);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float radius);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
void SCULPT_stroke_modifiers_check(const bContext *C, Object *ob, const Brush *brush);
|
2023-02-09 20:35:50 +01:00
|
|
|
float SCULPT_raycast_init(ViewContext *vc,
|
2022-06-22 18:58:25 -05:00
|
|
|
const float mval[2],
|
2022-01-19 16:19:21 -08:00
|
|
|
float ray_start[3],
|
|
|
|
float ray_end[3],
|
|
|
|
float ray_normal[3],
|
|
|
|
bool original);
|
|
|
|
|
|
|
|
/* Symmetry */
|
2023-02-07 21:56:45 +01:00
|
|
|
ePaintSymmetryFlags SCULPT_mesh_symmetry_xyz_get(Object *object);
|
2017-10-06 00:18:11 +11:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Returns true when the step belongs to the stroke that is directly performed by the brush and
|
|
|
|
* not by one of the symmetry passes.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_stroke_is_main_symmetry_pass(StrokeCache *cache);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Return true only once per stroke on the first symmetry pass, regardless of the symmetry passes
|
|
|
|
* enabled.
|
|
|
|
*
|
|
|
|
* This should be used for functionality that needs to be computed once per stroke of a particular
|
|
|
|
* tool (allocating memory, updating random seeds...).
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_stroke_is_first_brush_step(StrokeCache *cache);
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Returns true on the first brush step of each symmetry pass.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(StrokeCache *cache);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt mesh accessor API
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
/** Ensure random access; required for PBVH_BMESH */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_vertex_random_access_ensure(SculptSession *ss);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
int SCULPT_vertex_count_get(SculptSession *ss);
|
|
|
|
const float *SCULPT_vertex_co_get(SculptSession *ss, PBVHVertRef vertex);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/** Get the normal for a given sculpt vertex; do not modify the result */
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_vertex_normal_get(SculptSession *ss, PBVHVertRef vertex, float no[3]);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
float SCULPT_vertex_mask_get(SculptSession *ss, PBVHVertRef vertex);
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_vertex_color_get(const SculptSession *ss, PBVHVertRef vertex, float r_color[4]);
|
|
|
|
void SCULPT_vertex_color_set(SculptSession *ss, PBVHVertRef vertex, const float color[4]);
|
2022-04-05 11:42:55 -07:00
|
|
|
|
2022-09-28 23:21:56 -07:00
|
|
|
bool SCULPT_vertex_is_occluded(SculptSession *ss, PBVHVertRef vertex, bool original);
|
|
|
|
|
2022-04-05 11:42:55 -07:00
|
|
|
/** Returns true if a color attribute exists in the current sculpt session. */
|
|
|
|
bool SCULPT_has_colors(const SculptSession *ss);
|
|
|
|
|
|
|
|
/** Returns true if the active color attribute is on loop (ATTR_DOMAIN_CORNER) domain. */
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_has_loop_colors(const Object *ob);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
2022-07-29 19:01:32 -07:00
|
|
|
const float *SCULPT_vertex_persistent_co_get(SculptSession *ss, PBVHVertRef vertex);
|
|
|
|
void SCULPT_vertex_persistent_normal_get(SculptSession *ss, PBVHVertRef vertex, float no[3]);
|
Sculpt: Experimental Pen Tilt Support
This adds support for pen tilt in sculpt mode. For now, pen tilt is used
by tweaking the tilt strength property, which controls how much the pen
angle affects the sculpt normal. This is available in Draw, Draw Sharp,
Flatten, Fill, Scrape and Clay Strips brushes, but it can be enabled in
more tools later.
The purpose of this patch is to have a usable implementation of pen tilt
in a painting mode, so users can test and see in which hardware and
platforms this feature is supported and how well it works. If it works
ok, more tools and features that rely on pen tilt can be implemented,
like brushes that blend between two deformations depending on the angle.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8893
2020-10-08 00:00:36 +02:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Coordinates used for manipulating the base mesh when Grab Active Vertex is enabled.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2022-07-29 19:01:32 -07:00
|
|
|
const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, PBVHVertRef vertex);
|
2020-10-20 13:44:30 +02:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
2022-01-19 16:19:21 -08:00
|
|
|
* Returns the info of the limit surface when multi-res is available,
|
|
|
|
* otherwise it returns the current coordinate of the vertex.
|
2021-12-09 00:55:11 +11:00
|
|
|
*/
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_vertex_limit_surface_get(SculptSession *ss, PBVHVertRef vertex, float r_co[3]);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Returns the pointer to the coordinates that should be edited from a brush tool iterator
|
|
|
|
* depending on the given deformation target.
|
2018-01-10 19:57:02 +11:00
|
|
|
*/
|
2022-01-19 16:19:21 -08:00
|
|
|
float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss,
|
|
|
|
int deform_target,
|
|
|
|
PBVHVertexIter *iter);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_vertex_neighbors_get(SculptSession *ss,
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef vertex,
|
2022-01-19 16:19:21 -08:00
|
|
|
bool include_duplicates,
|
|
|
|
SculptVertexNeighborIter *iter);
|
Fix T78747: Fix mesh boundary detection and automasking
This issue was produced by a hack in the sculpt mode code from 2.80
when the sculpt API for connectivity info was not available.
The smooth brush was the only brush that needed connectivity info,
so there were 3 different smooth functions with the connectivity
queries implemented for dyntopo, meshes and grids. The mesh version
of smoothing was checking the number of connected faces to a vertex
to mask the mesh boundaries, which was not covering all cases and
was hardcoded in the smooth function itself.
This patch removes all those legacy functions and unifies all
smooth functions into a single one using the new API and the
automasking system. In order to achieve this, there were needed
some extra changes:
- The smooth brush now does not automasks the boundaries by default,
so its default preset needs to be updated to enable automasking
- The mesh boundary info is extracted once and cached in a
bitmap, similar to the disconnected elements IDs. This makes
boundary detection work as expected in all cases, solving a lot
of known issues with the smooth brush. In multires, this info is
extracted and cached only at the base mesh level, so it is much
more memory efficient than the previous automasking system.
- In order to keep the brushes responsive as they were before,
the automasking system can now skip creating the cache when it
is not needed for the requested options. This means that for
high poly meshes and simple automasking options the brushes
won't lag on start.
Reviewed By: sergey
Maniphest Tasks: T78747
Differential Revision: https://developer.blender.org/D8260
2020-07-15 16:24:03 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** Iterator over neighboring vertices. */
|
|
|
|
#define SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator) \
|
|
|
|
SCULPT_vertex_neighbors_get(ss, v_index, false, &neighbor_iterator); \
|
|
|
|
for (neighbor_iterator.i = 0; neighbor_iterator.i < neighbor_iterator.size; \
|
|
|
|
neighbor_iterator.i++) { \
|
2022-07-29 19:01:32 -07:00
|
|
|
neighbor_iterator.vertex = neighbor_iterator.neighbors[neighbor_iterator.i]; \
|
|
|
|
neighbor_iterator.index = neighbor_iterator.neighbor_indices[neighbor_iterator.i];
|
2020-10-15 19:34:54 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** Iterate over neighboring and duplicate vertices (for PBVH_GRIDS). Duplicates come
|
2022-01-20 11:48:29 +11:00
|
|
|
* first since they are nearest for floodfill. */
|
2022-01-19 16:19:21 -08:00
|
|
|
#define SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator) \
|
|
|
|
SCULPT_vertex_neighbors_get(ss, v_index, true, &neighbor_iterator); \
|
|
|
|
for (neighbor_iterator.i = neighbor_iterator.size - 1; neighbor_iterator.i >= 0; \
|
|
|
|
neighbor_iterator.i--) { \
|
2022-07-29 19:01:32 -07:00
|
|
|
neighbor_iterator.vertex = neighbor_iterator.neighbors[neighbor_iterator.i]; \
|
|
|
|
neighbor_iterator.index = neighbor_iterator.neighbor_indices[neighbor_iterator.i]; \
|
2022-01-19 16:19:21 -08:00
|
|
|
neighbor_iterator.is_duplicate = (neighbor_iterator.i >= \
|
|
|
|
neighbor_iterator.size - neighbor_iterator.num_duplicates);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
#define SCULPT_VERTEX_NEIGHBORS_ITER_END(neighbor_iterator) \
|
|
|
|
} \
|
|
|
|
if (neighbor_iterator.neighbors != neighbor_iterator.neighbors_fixed) { \
|
|
|
|
MEM_freeN(neighbor_iterator.neighbors); \
|
|
|
|
} \
|
|
|
|
((void)0)
|
2019-11-24 21:15:48 +01:00
|
|
|
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef SCULPT_active_vertex_get(SculptSession *ss);
|
2022-01-19 16:19:21 -08:00
|
|
|
const float *SCULPT_active_vertex_co_get(SculptSession *ss);
|
|
|
|
void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]);
|
2020-03-09 20:03:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Returns PBVH deformed vertices array if shape keys or deform modifiers are used, otherwise
|
|
|
|
* returns mesh original vertices array. */
|
Mesh: Move positions to a generic attribute
**Changes**
As described in T93602, this patch removes all use of the `MVert`
struct, replacing it with a generic named attribute with the name
`"position"`, consistent with other geometry types.
Variable names have been changed from `verts` to `positions`, to align
with the attribute name and the more generic design (positions are not
vertices, they are just an attribute stored on the point domain).
This change is made possible by previous commits that moved all other
data out of `MVert` to runtime data or other generic attributes. What
remains is mostly a simple type change. Though, the type still shows up
859 times, so the patch is quite large.
One compromise is that now `CD_MASK_BAREMESH` now contains
`CD_PROP_FLOAT3`. With the general move towards generic attributes
over custom data types, we are removing use of these type masks anyway.
**Benefits**
The most obvious benefit is reduced memory usage and the benefits
that brings in memory-bound situations. `float3` is only 3 bytes, in
comparison to `MVert` which was 4. When there are millions of vertices
this starts to matter more.
The other benefits come from using a more generic type. Instead of
writing algorithms specifically for `MVert`, code can just use arrays
of vectors. This will allow eliminating many temporary arrays or
wrappers used to extract positions.
Many possible improvements aren't implemented in this patch, though
I did switch simplify or remove the process of creating temporary
position arrays in a few places.
The design clarity that "positions are just another attribute" brings
allows removing explicit copying of vertices in some procedural
operations-- they are just processed like most other attributes.
**Performance**
This touches so many areas that it's hard to benchmark exhaustively,
but I observed some areas as examples.
* The mesh line node with 4 million count was 1.5x (8ms to 12ms) faster.
* The Spring splash screen went from ~4.3 to ~4.5 fps.
* The subdivision surface modifier/node was slightly faster
RNA access through Python may be slightly slower, since now we need
a name lookup instead of just a custom data type lookup for each index.
**Future Improvements**
* Remove uses of "vert_coords" functions:
* `BKE_mesh_vert_coords_alloc`
* `BKE_mesh_vert_coords_get`
* `BKE_mesh_vert_coords_apply{_with_mat4}`
* Remove more hidden copying of positions
* General simplification now possible in many areas
* Convert more code to C++ to use `float3` instead of `float[3]`
* Currently `reinterpret_cast` is used for those C-API functions
Differential Revision: https://developer.blender.org/D15982
2023-01-10 00:10:43 -05:00
|
|
|
float (*SCULPT_mesh_deformed_positions_get(SculptSession *ss))[3];
|
2019-11-24 21:15:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Fake Neighbors */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
#define FAKE_NEIGHBOR_NONE -1
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_fake_neighbors_ensure(Sculpt *sd, Object *ob, float max_dist);
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_fake_neighbors_enable(Object *ob);
|
|
|
|
void SCULPT_fake_neighbors_disable(Object *ob);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_fake_neighbors_free(Object *ob);
|
2020-10-12 20:32:26 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Vertex Info. */
|
|
|
|
void SCULPT_boundary_info_ensure(Object *object);
|
|
|
|
/* Boundary Info needs to be initialized in order to use this function. */
|
2022-07-29 19:01:32 -07:00
|
|
|
bool SCULPT_vertex_is_boundary(const SculptSession *ss, PBVHVertRef vertex);
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Visibility API
|
|
|
|
* \{ */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_vertex_visible_set(SculptSession *ss, PBVHVertRef vertex, bool visible);
|
|
|
|
bool SCULPT_vertex_visible_get(SculptSession *ss, PBVHVertRef vertex);
|
2022-09-14 14:33:55 -05:00
|
|
|
bool SCULPT_vertex_all_faces_visible_get(const SculptSession *ss, PBVHVertRef vertex);
|
|
|
|
bool SCULPT_vertex_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-14 14:33:55 -05:00
|
|
|
void SCULPT_face_visibility_all_invert(SculptSession *ss);
|
|
|
|
void SCULPT_face_visibility_all_set(SculptSession *ss, bool visible);
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_visibility_sync_all_from_faces(Object *ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Face Sets API
|
|
|
|
* \{ */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
int SCULPT_active_face_set_get(SculptSession *ss);
|
2022-07-29 19:01:32 -07:00
|
|
|
int SCULPT_vertex_face_set_get(SculptSession *ss, PBVHVertRef vertex);
|
|
|
|
void SCULPT_vertex_face_set_set(SculptSession *ss, PBVHVertRef vertex, int face_set);
|
2020-03-05 14:53:23 +01:00
|
|
|
|
2022-11-22 12:13:33 -08:00
|
|
|
int SCULPT_face_set_get(const SculptSession *ss, PBVHFaceRef face);
|
|
|
|
void SCULPT_face_set_set(SculptSession *ss, PBVHFaceRef face, int fset);
|
|
|
|
|
2022-07-29 19:01:32 -07:00
|
|
|
bool SCULPT_vertex_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_set);
|
|
|
|
bool SCULPT_vertex_has_unique_face_set(SculptSession *ss, PBVHVertRef vertex);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
int SCULPT_face_set_next_available_get(SculptSession *ss);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_face_set_visibility_set(SculptSession *ss, int face_set, bool visible);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Original Data API
|
|
|
|
* \{ */
|
2020-07-20 00:37:41 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Initialize a #SculptOrigVertData for accessing original vertex data;
|
|
|
|
* handles #BMesh, #Mesh, and multi-resolution.
|
|
|
|
*/
|
2022-06-26 16:13:09 -07:00
|
|
|
void SCULPT_orig_vert_data_init(SculptOrigVertData *data,
|
|
|
|
Object *ob,
|
|
|
|
PBVHNode *node,
|
|
|
|
SculptUndoType type);
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Update a #SculptOrigVertData for a particular vertex from the PBVH iterator.
|
|
|
|
*/
|
|
|
|
void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter);
|
|
|
|
/**
|
|
|
|
* Initialize a #SculptOrigVertData for accessing original vertex data;
|
|
|
|
* handles #BMesh, #Mesh, and multi-resolution.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, SculptUndoNode *unode);
|
2022-11-22 12:13:33 -08:00
|
|
|
/**
|
|
|
|
* Initialize a #SculptOrigFaceData for accessing original face data;
|
|
|
|
* handles #BMesh, #Mesh, and multi-resolution.
|
|
|
|
*/
|
|
|
|
void SCULPT_orig_face_data_init(SculptOrigFaceData *data,
|
|
|
|
Object *ob,
|
|
|
|
PBVHNode *node,
|
|
|
|
SculptUndoType type);
|
|
|
|
/**
|
|
|
|
* Update a #SculptOrigFaceData for a particular vertex from the PBVH iterator.
|
|
|
|
*/
|
|
|
|
void SCULPT_orig_face_data_update(SculptOrigFaceData *orig_data, PBVHFaceIter *iter);
|
|
|
|
/**
|
|
|
|
* Initialize a #SculptOrigVertData for accessing original vertex data;
|
|
|
|
* handles #BMesh, #Mesh, and multi-resolution.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_orig_face_data_unode_init(SculptOrigFaceData *data, Object *ob, SculptUndoNode *unode);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2019-09-09 17:44:08 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Brush Utilities.
|
|
|
|
* \{ */
|
2020-08-18 16:13:43 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
BLI_INLINE bool SCULPT_tool_needs_all_pbvh_nodes(const Brush *brush)
|
|
|
|
{
|
|
|
|
if (brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) {
|
|
|
|
/* Elastic deformations in any brush need all nodes to avoid artifacts as the effect
|
|
|
|
* of the Kelvinlet is not constrained by the radius. */
|
|
|
|
return true;
|
|
|
|
}
|
2020-01-22 02:23:51 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
if (brush->sculpt_tool == SCULPT_TOOL_POSE) {
|
|
|
|
/* Pose needs all nodes because it applies all symmetry iterations at the same time
|
|
|
|
* and the IK chain can grow to any area of the model. */
|
|
|
|
/* TODO: This can be optimized by filtering the nodes after calculating the chain. */
|
|
|
|
return true;
|
|
|
|
}
|
2020-02-28 14:40:40 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
if (brush->sculpt_tool == SCULPT_TOOL_BOUNDARY) {
|
|
|
|
/* Boundary needs all nodes because it is not possible to know where the boundary
|
|
|
|
* deformation is going to be propagated before calculating it. */
|
|
|
|
/* TODO: after calculating the boundary info in the first iteration, it should be
|
|
|
|
* possible to get the nodes that have vertices included in any boundary deformation
|
|
|
|
* and cache them. */
|
|
|
|
return true;
|
|
|
|
}
|
Sculpt: Boundary Brush
This brush includes a set of deformation modes designed to deform and
control the shape of the mesh boundaries, which are really hard to do
with regular sculpt brushes (and even in edit mode). This is useful
for creating cloth assets and hard surface base meshes.
The brush detects the mesh boundary closest to the active vertex and
propagates the deformation using the brush falloff into the mesh.
It includes bend, expand, inflate, grab and twist deform modes.
The main use cases of this brush are the Bend and Expand deformation
modes, which depend on a grid topology to create the best results.
In order to do further adjustments and tweaks to the result of these
deformation modes, the brush also includes the Inflate, Grab and
Twist deformation modes, which do not depend that much on the topology.
Grab and Inflate are the same operation that is implemented in the
Grab and Inflate tools, they are also available in the boundary brush
as producing deformations with regular brushes in these areas is very
hard to control.
Even if this brush can produce deformations in triangle meshes and
meshes with a non-regular quad grid, the more regular and clean the
topology is, the better. Most of the assets this brush is intended to
deform are always created from a cylindrical or plane quad grid, so it
should be fine. Also, its algorithms can be improved in future versions
to handle more corner cases and topology patterns.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8356
2020-08-10 17:57:01 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
if (brush->sculpt_tool == SCULPT_TOOL_SNAKE_HOOK &&
|
|
|
|
brush->snake_hook_deform_type == BRUSH_SNAKE_HOOK_DEFORM_ELASTIC) {
|
|
|
|
/* Snake hook in elastic deform type has same requirements as the elastic deform tool. */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-03-26 16:05:46 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_calc_brush_plane(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3]);
|
2020-04-14 21:06:49 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_calc_area_normal(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3]);
|
|
|
|
/**
|
|
|
|
* This calculates flatten center and area normal together,
|
|
|
|
* amortizing the memory bandwidth and loop overhead to calculate both at the same time.
|
|
|
|
*/
|
|
|
|
void SCULPT_calc_area_normal_and_center(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3]);
|
|
|
|
void SCULPT_calc_area_center(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_co[3]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
PBVHVertRef SCULPT_nearest_vertex_get(
|
|
|
|
Sculpt *sd, Object *ob, const float co[3], float max_distance, bool use_original);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
int SCULPT_plane_point_side(const float co[3], const float plane[4]);
|
2023-02-09 20:35:50 +01:00
|
|
|
int SCULPT_plane_trim(const StrokeCache *cache, const Brush *brush, const float val[3]);
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Handles clipping against a mirror modifier and #SCULPT_LOCK_X/Y/Z axis flags.
|
|
|
|
*/
|
|
|
|
void SCULPT_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float SCULPT_brush_plane_offset_get(Sculpt *sd, SculptSession *ss);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
ePaintSymmetryAreas SCULPT_get_vertex_symm_area(const float co[3]);
|
|
|
|
bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], char symm);
|
|
|
|
/**
|
|
|
|
* Checks if a vertex is inside the brush radius from any of its mirrored axis.
|
|
|
|
*/
|
|
|
|
bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3],
|
|
|
|
const float br_co[3],
|
|
|
|
float radius,
|
|
|
|
char symm);
|
|
|
|
bool SCULPT_is_symmetry_iteration_valid(char i, char symm);
|
|
|
|
void SCULPT_flip_v3_by_symm_area(float v[3],
|
|
|
|
ePaintSymmetryFlags symm,
|
|
|
|
ePaintSymmetryAreas symmarea,
|
|
|
|
const float pivot[3]);
|
|
|
|
void SCULPT_flip_quat_by_symm_area(float quat[4],
|
|
|
|
ePaintSymmetryFlags symm,
|
|
|
|
ePaintSymmetryAreas symmarea,
|
|
|
|
const float pivot[3]);
|
2019-09-09 16:58:09 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
2022-01-20 11:48:29 +11:00
|
|
|
* Initialize a point-in-brush test
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_brush_test_init(SculptSession *ss, SculptBrushTest *test);
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool SCULPT_brush_test_sphere(SculptBrushTest *test, const float co[3]);
|
|
|
|
bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3]);
|
|
|
|
bool SCULPT_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3]);
|
|
|
|
bool SCULPT_brush_test_cube(SculptBrushTest *test,
|
|
|
|
const float co[3],
|
|
|
|
const float local[4][4],
|
|
|
|
float roundness);
|
|
|
|
bool SCULPT_brush_test_circle_sq(SculptBrushTest *test, const float co[3]);
|
|
|
|
/**
|
|
|
|
* Test AABB against sphere.
|
|
|
|
*/
|
|
|
|
bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v);
|
|
|
|
/**
|
|
|
|
* 2D projection (distance to line).
|
|
|
|
*/
|
|
|
|
bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-06-03 19:21:04 -07:00
|
|
|
void SCULPT_combine_transform_proxies(Sculpt *sd, Object *ob);
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
2022-03-02 12:07:18 +11:00
|
|
|
* Initialize a point-in-brush test with a given falloff shape.
|
2022-01-19 16:19:21 -08:00
|
|
|
*
|
2022-03-02 12:07:18 +11:00
|
|
|
* \param falloff_shape: #PAINT_FALLOFF_SHAPE_SPHERE or #PAINT_FALLOFF_SHAPE_TUBE.
|
|
|
|
* \return The brush falloff function.
|
2022-01-19 16:19:21 -08:00
|
|
|
*/
|
2022-06-03 19:21:04 -07:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss,
|
|
|
|
SculptBrushTest *test,
|
|
|
|
char falloff_shape);
|
|
|
|
const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss,
|
|
|
|
char falloff_shape);
|
2023-04-12 18:33:53 -07:00
|
|
|
void SCULPT_cube_tip_init(Sculpt *sd, Object *ob, Brush *brush, float mat[4][4]);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Return a multiplier for brush strength on a particular vertex.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
float SCULPT_brush_strength_factor(SculptSession *ss,
|
|
|
|
const Brush *br,
|
2022-01-19 16:19:21 -08:00
|
|
|
const float point[3],
|
|
|
|
float len,
|
|
|
|
const float vno[3],
|
|
|
|
const float fno[3],
|
|
|
|
float mask,
|
2022-07-29 19:01:32 -07:00
|
|
|
const PBVHVertRef vertex,
|
2022-09-28 23:21:56 -07:00
|
|
|
int thread_id,
|
2023-02-09 20:35:50 +01:00
|
|
|
AutomaskingNodeData *automask_data);
|
2020-08-17 18:47:00 +02:00
|
|
|
|
2023-02-14 15:29:27 +01:00
|
|
|
/**
|
|
|
|
* Return a color of a brush texture on a particular vertex multiplied by active masks.
|
|
|
|
*/
|
|
|
|
void SCULPT_brush_strength_color(SculptSession *ss,
|
|
|
|
const Brush *brush,
|
|
|
|
const float brush_point[3],
|
|
|
|
float len,
|
|
|
|
const float vno[3],
|
|
|
|
const float fno[3],
|
|
|
|
float mask,
|
|
|
|
const PBVHVertRef vertex,
|
|
|
|
int thread_id,
|
|
|
|
AutomaskingNodeData *automask_data,
|
|
|
|
float r_rgba[4]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculates the vertex offset for a single vertex depending on the brush setting rgb as vector
|
|
|
|
* displacement.
|
|
|
|
*/
|
|
|
|
void SCULPT_calc_vertex_displacement(SculptSession *ss,
|
|
|
|
const Brush *brush,
|
|
|
|
float rgba[3],
|
|
|
|
float out_offset[3]);
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Tilts a normal by the x and y tilt values using the view axis.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_tilt_apply_to_normal(float r_normal[3], StrokeCache *cache, float tilt_strength);
|
2020-11-26 00:37:56 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Get effective surface normal with pen tilt and tilt strength applied to it.
|
|
|
|
*/
|
|
|
|
void SCULPT_tilt_effective_normal_get(const SculptSession *ss, const Brush *brush, float r_no[3]);
|
2020-08-17 18:47:00 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Flood Fill
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood);
|
|
|
|
void SCULPT_floodfill_add_active(
|
|
|
|
Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, float radius);
|
|
|
|
void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
|
|
|
|
Object *ob,
|
|
|
|
SculptSession *ss,
|
2022-01-19 16:19:21 -08:00
|
|
|
SculptFloodFill *flood,
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef vertex,
|
2022-01-19 16:19:21 -08:00
|
|
|
float radius);
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex);
|
|
|
|
void SCULPT_floodfill_add_and_skip_initial(SculptFloodFill *flood, PBVHVertRef vertex);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_floodfill_execute(SculptSession *ss,
|
2022-07-29 19:01:32 -07:00
|
|
|
SculptFloodFill *flood,
|
|
|
|
bool (*func)(SculptSession *ss,
|
|
|
|
PBVHVertRef from_v,
|
|
|
|
PBVHVertRef to_v,
|
|
|
|
bool is_duplicate,
|
|
|
|
void *userdata),
|
|
|
|
void *userdata);
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_floodfill_free(SculptFloodFill *flood);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Dynamic topology
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
enum eDynTopoWarnFlag {
|
|
|
|
DYNTOPO_WARN_VDATA = (1 << 0),
|
|
|
|
DYNTOPO_WARN_EDATA = (1 << 1),
|
|
|
|
DYNTOPO_WARN_LDATA = (1 << 2),
|
|
|
|
DYNTOPO_WARN_MODIFIER = (1 << 3),
|
|
|
|
};
|
2023-01-16 14:41:28 -06:00
|
|
|
ENUM_OPERATORS(eDynTopoWarnFlag, DYNTOPO_WARN_MODIFIER);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** Enable dynamic topology; mesh will be triangulated */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_dynamic_topology_enable_ex(Main *bmain,
|
|
|
|
Depsgraph *depsgraph,
|
2022-01-19 16:19:21 -08:00
|
|
|
Scene *scene,
|
|
|
|
Object *ob);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_dynamic_topology_disable(bContext *C, SculptUndoNode *unode);
|
|
|
|
void sculpt_dynamic_topology_disable_with_undo(Main *bmain,
|
|
|
|
Depsgraph *depsgraph,
|
2022-01-19 16:19:21 -08:00
|
|
|
Scene *scene,
|
|
|
|
Object *ob);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Returns true if the stroke will use dynamic topology, false
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* Factors: some brushes like grab cannot do dynamic topology.
|
|
|
|
* Others, like smooth, are better without.
|
|
|
|
* Same goes for alt-key smoothing.
|
|
|
|
*/
|
|
|
|
bool SCULPT_stroke_is_dynamic_topology(const SculptSession *ss, const Brush *brush);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_dynamic_topology_triangulate(BMesh *bm);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
enum eDynTopoWarnFlag SCULPT_dynamic_topology_check(Scene *scene, Object *ob);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Auto-masking.
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
struct AutomaskingNodeData {
|
2022-09-28 23:21:56 -07:00
|
|
|
PBVHNode *node;
|
|
|
|
SculptOrigVertData orig_data;
|
|
|
|
bool have_orig_data;
|
2023-02-09 20:35:50 +01:00
|
|
|
};
|
2022-09-28 23:21:56 -07:00
|
|
|
|
|
|
|
/** Call before PBVH vertex iteration.
|
2022-09-28 23:41:53 -07:00
|
|
|
* \param automask_data: pointer to an uninitialized AutomaskingNodeData struct.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_automasking_node_begin(Object *ob,
|
2022-09-28 23:21:56 -07:00
|
|
|
const SculptSession *ss,
|
2023-02-09 20:35:50 +01:00
|
|
|
AutomaskingCache *automasking,
|
2022-09-28 23:21:56 -07:00
|
|
|
AutomaskingNodeData *automask_data,
|
|
|
|
PBVHNode *node);
|
|
|
|
|
|
|
|
/* Call before SCULPT_automasking_factor_get and SCULPT_brush_strength_factor. */
|
|
|
|
void SCULPT_automasking_node_update(SculptSession *ss,
|
|
|
|
AutomaskingNodeData *automask_data,
|
|
|
|
PBVHVertexIter *vd);
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
|
2022-01-19 16:19:21 -08:00
|
|
|
SculptSession *ss,
|
2022-09-28 23:21:56 -07:00
|
|
|
PBVHVertRef vertex,
|
|
|
|
AutomaskingNodeData *automask_data);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Returns the automasking cache depending on the active tool. Used for code that can run both for
|
|
|
|
* brushes and filter. */
|
2023-02-09 20:35:50 +01:00
|
|
|
AutomaskingCache *SCULPT_automasking_active_cache_get(SculptSession *ss);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-11-24 08:53:15 -08:00
|
|
|
/* Brush can be null. */
|
2023-02-09 20:35:50 +01:00
|
|
|
AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob);
|
|
|
|
void SCULPT_automasking_cache_free(AutomaskingCache *automasking);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd, const Brush *br, eAutomasking_flag mode);
|
|
|
|
bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, const Brush *br);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
float *SCULPT_boundary_automasking_init(Object *ob,
|
|
|
|
eBoundaryAutomaskMode mode,
|
|
|
|
int propagation_steps,
|
|
|
|
float *automask_factor);
|
2022-09-28 23:21:56 -07:00
|
|
|
bool SCULPT_automasking_needs_normal(const SculptSession *ss,
|
|
|
|
const Sculpt *sculpt,
|
|
|
|
const Brush *brush);
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_automasking_needs_original(const Sculpt *sd, const Brush *brush);
|
2022-09-28 16:22:34 -07:00
|
|
|
int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking);
|
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Geodesic distances.
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Returns an array indexed by vertex index containing the geodesic distance to the closest vertex
|
|
|
|
* in the initial vertex set. The caller is responsible for freeing the array.
|
|
|
|
* Geodesic distances will only work when used with PBVH_FACES, for other types of PBVH it will
|
|
|
|
* fallback to euclidean distances to one of the initial vertices in the set.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
float *SCULPT_geodesic_distances_create(Object *ob, GSet *initial_verts, float limit_radius);
|
|
|
|
float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd,
|
|
|
|
Object *ob,
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef vertex,
|
2022-01-19 16:19:21 -08:00
|
|
|
float limit_radius);
|
2022-07-29 19:01:32 -07:00
|
|
|
float *SCULPT_geodesic_from_vertex(Object *ob, PBVHVertRef vertex, float limit_radius);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Filter API
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_filter_cache_init(bContext *C,
|
2022-09-28 23:21:56 -07:00
|
|
|
Object *ob,
|
|
|
|
Sculpt *sd,
|
|
|
|
int undo_type,
|
|
|
|
const int mval[2],
|
2023-02-20 11:51:16 +01:00
|
|
|
float area_normal_radius,
|
|
|
|
float start_strength);
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_filter_cache_free(SculptSession *ss);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_mesh_filter_properties(wmOperatorType *ot);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_mask_filter_smooth_apply(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, int smooth_iterations);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Filter orientation utils. */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_filter_to_orientation_space(float r_v[3], FilterCache *filter_cache);
|
|
|
|
void SCULPT_filter_to_object_space(float r_v[3], FilterCache *filter_cache);
|
|
|
|
void SCULPT_filter_zero_disabled_axis_components(float r_v[3], FilterCache *filter_cache);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Cloth Simulation.
|
|
|
|
* \{ */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Main cloth brush function */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_cloth_simulation_free(SculptClothSimulation *cloth_sim);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Public functions. */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptClothSimulation *SCULPT_cloth_brush_simulation_create(Object *ob,
|
|
|
|
float cloth_mass,
|
|
|
|
float cloth_damping,
|
|
|
|
float cloth_softbody_strength,
|
|
|
|
bool use_collisions,
|
|
|
|
bool needs_deform_coords);
|
|
|
|
void SCULPT_cloth_brush_simulation_init(SculptSession *ss, SculptClothSimulation *cloth_sim);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_cloth_sim_activate_nodes(SculptClothSimulation *cloth_sim,
|
2022-01-19 16:19:21 -08:00
|
|
|
PBVHNode **nodes,
|
|
|
|
int totnode);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_cloth_brush_store_simulation_state(SculptSession *ss,
|
|
|
|
SculptClothSimulation *cloth_sim);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_cloth_brush_do_simulation_step(
|
|
|
|
Sculpt *sd, Object *ob, SculptClothSimulation *cloth_sim, PBVHNode **nodes, int totnode);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_cloth_brush_ensure_nodes_constraints(Sculpt *sd,
|
|
|
|
Object *ob,
|
|
|
|
PBVHNode **nodes,
|
2022-01-19 16:19:21 -08:00
|
|
|
int totnode,
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptClothSimulation *cloth_sim,
|
2022-01-19 16:19:21 -08:00
|
|
|
float initial_location[3],
|
|
|
|
float radius);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Cursor drawing function.
|
|
|
|
*/
|
|
|
|
void SCULPT_cloth_simulation_limits_draw(uint gpuattr,
|
2023-02-09 20:35:50 +01:00
|
|
|
const Brush *brush,
|
2022-01-19 16:19:21 -08:00
|
|
|
const float location[3],
|
|
|
|
const float normal[3],
|
|
|
|
float rds,
|
|
|
|
float line_width,
|
|
|
|
const float outline_col[3],
|
|
|
|
float alpha);
|
|
|
|
void SCULPT_cloth_plane_falloff_preview_draw(uint gpuattr,
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptSession *ss,
|
2022-01-19 16:19:21 -08:00
|
|
|
const float outline_col[3],
|
|
|
|
float outline_alpha);
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
PBVHNode **SCULPT_cloth_brush_affected_nodes_gather(SculptSession *ss,
|
|
|
|
Brush *brush,
|
|
|
|
int *r_totnode);
|
2019-09-09 15:42:51 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
BLI_INLINE bool SCULPT_is_cloth_deform_brush(const Brush *brush)
|
|
|
|
{
|
|
|
|
return (brush->sculpt_tool == SCULPT_TOOL_CLOTH && ELEM(brush->cloth_deform_type,
|
|
|
|
BRUSH_CLOTH_DEFORM_GRAB,
|
|
|
|
BRUSH_CLOTH_DEFORM_SNAKE_HOOK)) ||
|
|
|
|
/* All brushes that are not the cloth brush deform the simulation using softbody
|
|
|
|
* constraints instead of applying forces. */
|
|
|
|
(brush->sculpt_tool != SCULPT_TOOL_CLOTH &&
|
|
|
|
brush->deform_target == BRUSH_DEFORM_TARGET_CLOTH_SIM);
|
|
|
|
}
|
|
|
|
/** \} */
|
2020-03-09 20:03:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Smoothing API
|
|
|
|
* \{ */
|
2020-03-26 16:05:46 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* For bmesh: Average surrounding verts based on an orthogonality measure.
|
|
|
|
* Naturally converges to a quad-like structure.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v);
|
2020-04-05 02:00:50 +02:00
|
|
|
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], PBVHVertRef vertex);
|
|
|
|
float SCULPT_neighbor_mask_average(SculptSession *ss, PBVHVertRef vertex);
|
|
|
|
void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], PBVHVertRef vertex);
|
2020-08-17 18:47:00 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Mask the mesh boundaries smoothing only the mesh surface without using auto-masking.
|
|
|
|
*/
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_neighbor_coords_average_interior(SculptSession *ss,
|
|
|
|
float result[3],
|
|
|
|
PBVHVertRef vertex);
|
2020-08-18 15:22:51 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_smooth(
|
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength, bool smooth_mask);
|
|
|
|
void SCULPT_do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
2019-09-09 15:42:51 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Surface Smooth Brush. */
|
2020-06-01 22:36:26 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_surface_smooth_laplacian_step(SculptSession *ss,
|
|
|
|
float *disp,
|
|
|
|
const float co[3],
|
|
|
|
float (*laplacian_disp)[3],
|
2022-07-29 19:01:32 -07:00
|
|
|
PBVHVertRef vertex,
|
2022-01-19 16:19:21 -08:00
|
|
|
const float origco[3],
|
|
|
|
float alpha);
|
2022-07-29 19:01:32 -07:00
|
|
|
void SCULPT_surface_smooth_displace_step(SculptSession *ss,
|
|
|
|
float *co,
|
|
|
|
float (*laplacian_disp)[3],
|
|
|
|
PBVHVertRef vertex,
|
|
|
|
float beta,
|
|
|
|
float fade);
|
2022-01-19 16:19:21 -08:00
|
|
|
void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
2020-03-05 14:53:23 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Slide/Relax */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_relax_vertex(SculptSession *ss,
|
|
|
|
PBVHVertexIter *vd,
|
2022-01-19 16:19:21 -08:00
|
|
|
float factor,
|
|
|
|
bool filter_boundary_face_sets,
|
|
|
|
float *r_final_pos);
|
2020-03-05 14:53:23 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Expose 'calc_area_normal' externally (just for vertex paint).
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_pbvh_calc_area_normal(const Brush *brush,
|
2022-01-19 16:19:21 -08:00
|
|
|
Object *ob,
|
|
|
|
PBVHNode **nodes,
|
|
|
|
int totnode,
|
|
|
|
bool use_threading,
|
|
|
|
float r_area_no[3]);
|
2020-10-15 19:34:54 +02:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
* Flip all the edit-data across the axis/axes specified by \a symm.
|
|
|
|
* Used to calculate multiple modifications to the mesh when symmetry is enabled.
|
|
|
|
*/
|
2022-11-09 19:27:41 -06:00
|
|
|
void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache,
|
|
|
|
ePaintSymmetryFlags symm,
|
|
|
|
char axis,
|
|
|
|
float angle);
|
2020-03-06 15:24:15 +01:00
|
|
|
void SCULPT_cache_free(StrokeCache *cache);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Sculpt Undo
|
|
|
|
* \{ */
|
|
|
|
|
2020-03-06 15:24:15 +01:00
|
|
|
SculptUndoNode *SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type);
|
2022-06-26 16:13:09 -07:00
|
|
|
SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node, SculptUndoType type);
|
2020-05-06 08:17:27 +10:00
|
|
|
SculptUndoNode *SCULPT_undo_get_first_node(void);
|
2022-04-25 12:03:16 -07:00
|
|
|
|
2022-08-16 10:37:34 +10:00
|
|
|
/**
|
|
|
|
* Pushes an undo step using the operator name. This is necessary for
|
2022-08-15 14:52:02 -07:00
|
|
|
* redo panels to work; operators that do not support that may use
|
2022-08-16 10:37:34 +10:00
|
|
|
* #SCULPT_undo_push_begin_ex instead if so desired.
|
2022-08-15 14:52:02 -07:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_undo_push_begin(Object *ob, const wmOperator *op);
|
2022-08-15 14:52:02 -07:00
|
|
|
|
2022-04-25 12:03:16 -07:00
|
|
|
/**
|
2022-08-16 10:37:34 +10:00
|
|
|
* NOTE: #SCULPT_undo_push_begin is preferred since `name`
|
2022-08-15 14:52:02 -07:00
|
|
|
* must match operator name for redo panels to work.
|
2022-04-25 12:03:16 -07:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_undo_push_begin_ex(Object *ob, const char *name);
|
|
|
|
void SCULPT_undo_push_end(Object *ob);
|
|
|
|
void SCULPT_undo_push_end_ex(Object *ob, const bool use_nested_undo);
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
|
|
|
|
2020-03-06 15:24:15 +01:00
|
|
|
void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
|
2010-07-14 14:11:03 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
* Copy the PBVH bounding box into the object's bounding box.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_update_object_bounding_box(Object *ob);
|
2014-02-04 19:47:17 +06:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
* Get a screen-space rectangle of the modified area.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect);
|
2017-09-28 01:38:17 +10:00
|
|
|
|
2020-04-03 21:05:20 +02:00
|
|
|
/* Operators. */
|
2020-04-03 19:16:49 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Expand Operator
|
|
|
|
* \{ */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_expand(wmOperatorType *ot);
|
|
|
|
void sculpt_expand_modal_keymap(wmKeyConfig *keyconf);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
Sculpt: Expand Operator
Expand is a new operator for Sculpt Mode which is intended to be the main
tool for masking, Face Set editing, interacting with the filters and pattern
creation.
The fundamentals of the tool are similar to the previous sculpt.mask_expand
operator. It shares the same default shortcuts and functionality, making
the previous operator obsolete.
The shortcuts to execute the operator are:
- Shift + A: Expand mask
- Shift + Alt + A: Expand mask by normals
- Shift + W: Expand Face Set
- Shift + Alt + W: Resize current Face Set
The main changes compared to the previous sculpt.mask_expand operator are:
- Modal keymap, all operator options can be changed in real time while the
operator is running.
- Supports creating Mask, Face Sets and Sculpt Vertex Colors.
- Much better code, new features can be easily integrated.
Limitations:
- All Mask operations are supported for Sculpt Vertex colors, but not exposed
by default as their support is still experimental.
- Dyntopo does not support any Face Set or Sculpt Vertex Colors. functionality
(they are not implemented in general for Dyntopo).
- Multires does not support any feature related to geodesic distances.
- Multires does not support vertex colors.
- Multires does not support recursions.
- In Multires, Face Sets snaping does not initialize all current enabled Face
Sets when toggling snapping.
- In Multires, Face Sets are created at base mesh level (works by this by
design, like any other tool).
- Unlike the previous mask_expand operator, this one does not blur the mask
by default after finishing Expand as that does not fit the new design.
The mask can still be blurred by using the mask filter manually.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10455
2021-03-01 23:37:48 +01:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Gesture Operators
|
|
|
|
* \{ */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_face_set_lasso_gesture(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_face_set_box_gesture(wmOperatorType *ot);
|
2020-09-03 16:15:20 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_trim_lasso_gesture(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_trim_box_gesture(wmOperatorType *ot);
|
2020-09-05 20:06:27 +02:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_project_line_gesture(wmOperatorType *ot);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2020-09-29 22:46:38 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Face Set Operators
|
|
|
|
* \{ */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_face_sets_randomize_colors(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_face_sets_change_visibility(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_face_sets_init(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_face_sets_create(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_face_sets_edit(wmOperatorType *ot);
|
2020-04-03 19:16:49 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Transform Operators
|
|
|
|
* \{ */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_set_pivot_position(wmOperatorType *ot);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Filter Operators
|
|
|
|
* \{ */
|
2020-04-03 19:42:48 +02:00
|
|
|
|
2020-04-03 21:05:20 +02:00
|
|
|
/* Mesh Filter. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_mesh_filter(wmOperatorType *ot);
|
2023-03-08 01:18:21 +01:00
|
|
|
struct wmKeyMap *filter_mesh_modal_keymap(struct wmKeyConfig *keyconf);
|
2020-04-03 21:05:20 +02:00
|
|
|
|
2020-06-01 22:36:26 +02:00
|
|
|
/* Cloth Filter. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_cloth_filter(wmOperatorType *ot);
|
2020-06-01 22:36:26 +02:00
|
|
|
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
/* Color Filter. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_color_filter(wmOperatorType *ot);
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Interactive Mask Operators
|
|
|
|
* \{ */
|
|
|
|
|
2020-04-03 21:46:08 +02:00
|
|
|
/* Mask filter and Dirty Mask. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_mask_filter(wmOperatorType *ot);
|
2020-04-03 21:46:08 +02:00
|
|
|
|
|
|
|
/* Mask and Face Sets Expand. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_mask_expand(wmOperatorType *ot);
|
2020-04-03 21:46:08 +02:00
|
|
|
|
2021-03-12 21:35:56 +01:00
|
|
|
/* Mask Init. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_mask_init(wmOperatorType *ot);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2021-03-12 21:35:56 +01:00
|
|
|
|
2020-04-03 23:41:54 +02:00
|
|
|
/* Detail size. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
2022-01-20 11:55:33 +11:00
|
|
|
/** \name Dyntopo/Retopology Operators
|
2022-01-19 16:19:21 -08:00
|
|
|
* \{ */
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_detail_flood_fill(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_sample_detail_size(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_set_detail_size(wmOperatorType *ot);
|
|
|
|
void SCULPT_OT_dyntopo_detail_size_edit(wmOperatorType *ot);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2020-04-03 23:41:54 +02:00
|
|
|
|
|
|
|
/* Dyntopo. */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_dynamic_topology_toggle(wmOperatorType *ot);
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2023-02-07 21:56:45 +01:00
|
|
|
/* sculpt_brush_types.cc */
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2022-01-19 16:19:21 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Brushes
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
/* Pose Brush. */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main Brush Function.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_do_pose_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
2022-01-19 16:19:21 -08:00
|
|
|
/**
|
|
|
|
* Calculate the pose origin and (Optionally the pose factor)
|
|
|
|
* that is used when using the pose brush.
|
|
|
|
*
|
|
|
|
* \param r_pose_origin: Must be a valid pointer.
|
|
|
|
* \param r_pose_factor: Optional, when set to NULL it won't be calculated.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_pose_calc_pose_data(Sculpt *sd,
|
|
|
|
Object *ob,
|
|
|
|
SculptSession *ss,
|
2022-01-19 16:19:21 -08:00
|
|
|
float initial_location[3],
|
|
|
|
float radius,
|
|
|
|
float pose_offset,
|
|
|
|
float *r_pose_origin,
|
|
|
|
float *r_pose_factor);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_pose_brush_init(Sculpt *sd, Object *ob, SculptSession *ss, Brush *br);
|
|
|
|
SculptPoseIKChain *SCULPT_pose_ik_chain_init(Sculpt *sd,
|
|
|
|
Object *ob,
|
|
|
|
SculptSession *ss,
|
|
|
|
Brush *br,
|
|
|
|
const float initial_location[3],
|
|
|
|
float radius);
|
|
|
|
void SCULPT_pose_ik_chain_free(SculptPoseIKChain *ik_chain);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Boundary Brush. */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main function to get #SculptBoundary data both for brush deformation and viewport preview.
|
|
|
|
* Can return NULL if there is no boundary from the given vertex using the given radius.
|
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptBoundary *SCULPT_boundary_data_init(Object *object,
|
|
|
|
Brush *brush,
|
|
|
|
PBVHVertRef initial_vertex,
|
|
|
|
float radius);
|
|
|
|
void SCULPT_boundary_data_free(SculptBoundary *boundary);
|
2022-01-19 16:19:21 -08:00
|
|
|
/* Main Brush Function. */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
void SCULPT_boundary_edges_preview_draw(uint gpuattr,
|
2023-02-09 20:35:50 +01:00
|
|
|
SculptSession *ss,
|
2022-01-19 16:19:21 -08:00
|
|
|
const float outline_col[3],
|
|
|
|
float outline_alpha);
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_boundary_pivot_line_preview_draw(uint gpuattr, SculptSession *ss);
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Multi-plane Scrape Brush. */
|
|
|
|
/* Main Brush Function. */
|
|
|
|
void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_multiplane_scrape_preview_draw(uint gpuattr,
|
|
|
|
Brush *brush,
|
|
|
|
SculptSession *ss,
|
|
|
|
const float outline_col[3],
|
|
|
|
float outline_alpha);
|
|
|
|
/* Draw Face Sets Brush. */
|
|
|
|
void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
|
|
|
|
/* Paint Brush. */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_do_paint_brush(PaintModeSettings *paint_mode_settings,
|
2022-04-15 16:39:50 +02:00
|
|
|
Sculpt *sd,
|
|
|
|
Object *ob,
|
|
|
|
PBVHNode **nodes,
|
2023-01-23 10:29:40 -08:00
|
|
|
int totnode,
|
|
|
|
PBVHNode **texnodes,
|
|
|
|
int texnodes_num) ATTR_NONNULL();
|
2022-04-15 16:39:50 +02:00
|
|
|
|
|
|
|
/**
|
2022-05-19 10:02:52 +10:00
|
|
|
* \brief Get the image canvas for painting on the given object.
|
2022-04-15 16:39:50 +02:00
|
|
|
*
|
2022-05-19 10:02:52 +10:00
|
|
|
* \return #true if an image is found. The #r_image and #r_image_user fields are filled with the
|
2022-04-15 16:39:50 +02:00
|
|
|
* image and image user. Returns false when the image isn't found. In the later case the r_image
|
2022-05-19 10:02:52 +10:00
|
|
|
* and r_image_user are set to NULL.
|
2022-04-15 16:39:50 +02:00
|
|
|
*/
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_paint_image_canvas_get(PaintModeSettings *paint_mode_settings,
|
|
|
|
Object *ob,
|
|
|
|
Image **r_image,
|
|
|
|
ImageUser **r_image_user) ATTR_NONNULL();
|
|
|
|
void SCULPT_do_paint_brush_image(PaintModeSettings *paint_mode_settings,
|
2022-04-15 16:39:50 +02:00
|
|
|
Sculpt *sd,
|
|
|
|
Object *ob,
|
2023-01-23 10:29:40 -08:00
|
|
|
PBVHNode **texnodes,
|
|
|
|
int texnode_num) ATTR_NONNULL();
|
2023-02-09 20:35:50 +01:00
|
|
|
bool SCULPT_use_image_paint_brush(PaintModeSettings *settings, Object *ob) ATTR_NONNULL();
|
2022-01-19 16:19:21 -08:00
|
|
|
|
|
|
|
/* Smear Brush. */
|
|
|
|
void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
float SCULPT_clay_thumb_get_stabilized_pressure(StrokeCache *cache);
|
|
|
|
|
|
|
|
void SCULPT_do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
|
|
|
|
void SCULPT_do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_elastic_deform_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_draw_sharp_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_slide_relax_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
|
|
|
|
void SCULPT_do_displacement_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_displacement_eraser_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
|
|
|
void SCULPT_do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode);
|
2022-01-19 16:19:21 -08:00
|
|
|
/** \} */
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2022-01-07 11:38:08 +11:00
|
|
|
void SCULPT_bmesh_topology_rake(
|
2023-02-09 20:35:50 +01:00
|
|
|
Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength);
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2023-02-07 21:56:45 +01:00
|
|
|
/* end sculpt_brush_types.cc */
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2023-02-07 21:56:45 +01:00
|
|
|
/* sculpt_ops.cc */
|
2022-04-04 13:17:03 +10:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_OT_brush_stroke(wmOperatorType *ot);
|
2021-12-20 14:04:53 -05:00
|
|
|
|
2023-02-07 21:56:45 +01:00
|
|
|
/* end sculpt_ops.cc */
|
2022-04-05 11:42:55 -07:00
|
|
|
|
2022-06-29 23:11:24 -07:00
|
|
|
BLI_INLINE bool SCULPT_tool_is_paint(int tool)
|
|
|
|
{
|
|
|
|
return ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR);
|
|
|
|
}
|
2022-04-05 11:42:55 -07:00
|
|
|
|
2022-09-12 12:48:35 -05:00
|
|
|
BLI_INLINE bool SCULPT_tool_is_mask(int tool)
|
|
|
|
{
|
|
|
|
return ELEM(tool, SCULPT_TOOL_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_INLINE bool SCULPT_tool_is_face_sets(int tool)
|
|
|
|
{
|
|
|
|
return ELEM(tool, SCULPT_TOOL_DRAW_FACE_SETS);
|
|
|
|
}
|
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_stroke_id_ensure(Object *ob);
|
|
|
|
void SCULPT_stroke_id_next(Object *ob);
|
2022-09-28 23:21:56 -07:00
|
|
|
bool SCULPT_tool_can_reuse_automask(int sculpt_tool);
|
2022-09-28 16:22:34 -07:00
|
|
|
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_ensure_valid_pivot(const Object *ob, Scene *scene);
|
2022-11-30 13:54:56 -08:00
|
|
|
|
2023-01-19 16:53:43 -08:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Topology island API
|
|
|
|
* \{
|
|
|
|
* Each mesh island shell gets its own integer
|
|
|
|
* key; these are temporary and internally limited to 8 bits.
|
|
|
|
* Uses the `ss->topology_island_key` attribute.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Ensures vertex island keys exist and are valid. */
|
2023-02-09 20:35:50 +01:00
|
|
|
void SCULPT_topology_islands_ensure(Object *ob);
|
2023-01-19 16:53:43 -08:00
|
|
|
|
2023-02-27 21:44:59 +11:00
|
|
|
/**
|
|
|
|
* Mark vertex island keys as invalid.
|
|
|
|
* Call when adding or hiding geometry.
|
2023-01-19 16:53:43 -08:00
|
|
|
*/
|
|
|
|
void SCULPT_topology_islands_invalidate(SculptSession *ss);
|
|
|
|
|
2023-02-27 21:44:59 +11:00
|
|
|
/** Get vertex island key. */
|
2023-01-19 16:53:43 -08:00
|
|
|
int SCULPT_vertex_island_get(SculptSession *ss, PBVHVertRef vertex);
|
|
|
|
|
|
|
|
/** \} */
|