Blender  V3.3
Typedefs | Enumerations | Functions | Variables
sculpt_filter_mesh.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_hash.h"
#include "BLI_math.h"
#include "BLI_task.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_view3d.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_interface.h"
#include "bmesh.h"
#include <math.h>
#include <stdlib.h>

Go to the source code of this file.

Typedefs

typedef enum eSculptMeshFilterType eSculptMeshFilterType
 
typedef enum eMeshFilterDeformAxis eMeshFilterDeformAxis
 

Enumerations

enum  eSculptMeshFilterType {
  MESH_FILTER_SMOOTH = 0 , MESH_FILTER_SCALE = 1 , MESH_FILTER_INFLATE = 2 , MESH_FILTER_SPHERE = 3 ,
  MESH_FILTER_RANDOM = 4 , MESH_FILTER_RELAX = 5 , MESH_FILTER_RELAX_FACE_SETS = 6 , MESH_FILTER_SURFACE_SMOOTH = 7 ,
  MESH_FILTER_SHARPEN = 8 , MESH_FILTER_ENHANCE_DETAILS = 9 , MESH_FILTER_ERASE_DISPLACEMENT = 10
}
 
enum  eMeshFilterDeformAxis { MESH_FILTER_DEFORM_X = 1 << 0 , MESH_FILTER_DEFORM_Y = 1 << 1 , MESH_FILTER_DEFORM_Z = 1 << 2 }
 

Functions

void SCULPT_filter_to_orientation_space (float r_v[3], struct FilterCache *filter_cache)
 
void SCULPT_filter_to_object_space (float r_v[3], struct FilterCache *filter_cache)
 
void SCULPT_filter_zero_disabled_axis_components (float r_v[3], struct FilterCache *filter_cache)
 
static void filter_cache_init_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
void SCULPT_filter_cache_init (bContext *C, Object *ob, Sculpt *sd, const int undo_type)
 
void SCULPT_filter_cache_free (SculptSession *ss)
 
static bool sculpt_mesh_filter_needs_pmap (eSculptMeshFilterType filter_type)
 
static void mesh_filter_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void mesh_filter_enhance_details_init_directions (SculptSession *ss)
 
static void mesh_filter_surface_smooth_init (SculptSession *ss, const float shape_preservation, const float current_vertex_displacement)
 
static void mesh_filter_init_limit_surface_co (SculptSession *ss)
 
static void mesh_filter_sharpen_init (SculptSession *ss, const float smooth_ratio, const float intensify_detail_strength, const int curvature_smooth_iterations)
 
static void mesh_filter_surface_smooth_displace_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static int sculpt_mesh_filter_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static int sculpt_mesh_filter_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void SCULPT_OT_mesh_filter (struct wmOperatorType *ot)
 

Variables

static EnumPropertyItem prop_mesh_filter_types []
 
static EnumPropertyItem prop_mesh_filter_deform_axis_items []
 
static EnumPropertyItem prop_mesh_filter_orientation_items []
 

Typedef Documentation

◆ eMeshFilterDeformAxis

◆ eSculptMeshFilterType

Enumeration Type Documentation

◆ eMeshFilterDeformAxis

Enumerator
MESH_FILTER_DEFORM_X 
MESH_FILTER_DEFORM_Y 
MESH_FILTER_DEFORM_Z 

Definition at line 230 of file sculpt_filter_mesh.c.

◆ eSculptMeshFilterType

Enumerator
MESH_FILTER_SMOOTH 
MESH_FILTER_SCALE 
MESH_FILTER_INFLATE 
MESH_FILTER_SPHERE 
MESH_FILTER_RANDOM 
MESH_FILTER_RELAX 
MESH_FILTER_RELAX_FACE_SETS 
MESH_FILTER_SURFACE_SMOOTH 
MESH_FILTER_SHARPEN 
MESH_FILTER_ENHANCE_DETAILS 
MESH_FILTER_ERASE_DISPLACEMENT 

Definition at line 185 of file sculpt_filter_mesh.c.

Function Documentation

◆ filter_cache_init_task_cb()

static void filter_cache_init_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

Definition at line 94 of file sculpt_filter_mesh.c.

References data, node, and SCULPT_undo_push_node().

Referenced by SCULPT_filter_cache_init().

◆ mesh_filter_enhance_details_init_directions()

static void mesh_filter_enhance_details_init_directions ( SculptSession ss)
static

◆ mesh_filter_init_limit_surface_co()

static void mesh_filter_init_limit_surface_co ( SculptSession ss)
static

◆ mesh_filter_sharpen_init()

static void mesh_filter_sharpen_init ( SculptSession ss,
const float  smooth_ratio,
const float  intensify_detail_strength,
const int  curvature_smooth_iterations 
)
static

◆ mesh_filter_surface_smooth_displace_task_cb()

static void mesh_filter_surface_smooth_displace_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ mesh_filter_surface_smooth_init()

static void mesh_filter_surface_smooth_init ( SculptSession ss,
const float  shape_preservation,
const float  current_vertex_displacement 
)
static

◆ mesh_filter_task_cb()

static void mesh_filter_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

Definition at line 273 of file sculpt_filter_mesh.c.

References add_v3_v3(), add_v3_v3v3(), FilterCache::automasking, BKE_pbvh_node_mark_update(), BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, BLI_hash_int_2d(), clamp_f(), PBVHVertexIter::co, SculptOrigVertData::co, copy_v3_v3(), data, FilterCache::detail_directions, ELEM, FilterCache::enabled_axis, fabsf, fade(), SculptSession::filter_cache, hash, PBVHVertexIter::index, SculptVertexNeighborIter::index, FilterCache::iteration_count, FilterCache::limit_surface_co, madd_v3_v3fl(), madd_v3_v3v3fl(), PBVHVertexIter::mask, MESH_FILTER_ENHANCE_DETAILS, MESH_FILTER_ERASE_DISPLACEMENT, MESH_FILTER_INFLATE, MESH_FILTER_RANDOM, MESH_FILTER_RELAX, MESH_FILTER_RELAX_FACE_SETS, MESH_FILTER_SCALE, MESH_FILTER_SHARPEN, MESH_FILTER_SMOOTH, MESH_FILTER_SPHERE, MESH_FILTER_SURFACE_SMOOTH, mid_v3_v3v3(), mul_m3_v3(), mul_v3_fl(), mul_v3_v3fl(), PBVHVertexIter::mvert, SculptOrigVertData::no, node, normal, normalize_v3_v3(), SculptSession::pbvh, PBVH_ITER_UNIQUE, pow2f(), FilterCache::random_seed, scale_m3_fl(), SCULPT_automasking_factor_get(), SCULPT_filter_to_object_space(), SCULPT_filter_to_orientation_space(), SCULPT_neighbor_coords_average(), SCULPT_neighbor_coords_average_interior(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_relax_vertex(), SCULPT_surface_smooth_laplacian_step(), SCULPT_UNDO_COORDS, SCULPT_vertex_co_get(), SCULPT_vertex_has_unique_face_set(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, FilterCache::sharpen_factor, FilterCache::sharpen_intensify_detail_strength, FilterCache::sharpen_smooth_ratio, sub_v3_v3v3(), FilterCache::surface_smooth_laplacian_disp, FilterCache::surface_smooth_shape_preservation, transform(), and unit_m3().

Referenced by sculpt_mesh_filter_modal().

◆ SCULPT_filter_cache_free()

void SCULPT_filter_cache_free ( SculptSession ss)

◆ SCULPT_filter_cache_init()

void SCULPT_filter_cache_init ( bContext C,
Object ob,
Sculpt sd,
const int  undo_type 
)

◆ SCULPT_filter_to_object_space()

void SCULPT_filter_to_object_space ( float  r_v[3],
struct FilterCache filter_cache 
)

◆ SCULPT_filter_to_orientation_space()

void SCULPT_filter_to_orientation_space ( float  r_v[3],
struct FilterCache filter_cache 
)

◆ SCULPT_filter_zero_disabled_axis_components()

void SCULPT_filter_zero_disabled_axis_components ( float  r_v[3],
struct FilterCache filter_cache 
)

◆ sculpt_mesh_filter_invoke()

static int sculpt_mesh_filter_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ sculpt_mesh_filter_modal()

static int sculpt_mesh_filter_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ sculpt_mesh_filter_needs_pmap()

static bool sculpt_mesh_filter_needs_pmap ( eSculptMeshFilterType  filter_type)
static

◆ SCULPT_OT_mesh_filter()

void SCULPT_OT_mesh_filter ( struct wmOperatorType ot)

Variable Documentation

◆ prop_mesh_filter_deform_axis_items

EnumPropertyItem prop_mesh_filter_deform_axis_items[]
static
Initial value:
= {
{MESH_FILTER_DEFORM_X, "X", 0, "X", "Deform in the X axis"},
{MESH_FILTER_DEFORM_Y, "Y", 0, "Y", "Deform in the Y axis"},
{MESH_FILTER_DEFORM_Z, "Z", 0, "Z", "Deform in the Z axis"},
{0, NULL, 0, NULL, NULL},
}
@ MESH_FILTER_DEFORM_X
@ MESH_FILTER_DEFORM_Y
@ MESH_FILTER_DEFORM_Z

Definition at line 236 of file sculpt_filter_mesh.c.

Referenced by SCULPT_OT_mesh_filter().

◆ prop_mesh_filter_orientation_items

EnumPropertyItem prop_mesh_filter_orientation_items[]
static
Initial value:
= {
"LOCAL",
0,
"Local",
"Use the local axis to limit the displacement"},
"WORLD",
0,
"World",
"Use the global axis to limit the displacement"},
"VIEW",
0,
"View",
"Use the view axis to limit the displacement"},
{0, NULL, 0, NULL, NULL},
}
@ SCULPT_FILTER_ORIENTATION_WORLD
@ SCULPT_FILTER_ORIENTATION_VIEW
@ SCULPT_FILTER_ORIENTATION_LOCAL

Definition at line 243 of file sculpt_filter_mesh.c.

Referenced by SCULPT_OT_mesh_filter().

◆ prop_mesh_filter_types

EnumPropertyItem prop_mesh_filter_types[]
static
Initial value:
= {
{MESH_FILTER_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth mesh"},
{MESH_FILTER_SCALE, "SCALE", 0, "Scale", "Scale mesh"},
{MESH_FILTER_INFLATE, "INFLATE", 0, "Inflate", "Inflate mesh"},
{MESH_FILTER_SPHERE, "SPHERE", 0, "Sphere", "Morph into sphere"},
{MESH_FILTER_RANDOM, "RANDOM", 0, "Random", "Randomize vertex positions"},
{MESH_FILTER_RELAX, "RELAX", 0, "Relax", "Relax mesh"},
"RELAX_FACE_SETS",
0,
"Relax Face Sets",
"Smooth the edges of all the Face Sets"},
"SURFACE_SMOOTH",
0,
"Surface Smooth",
"Smooth the surface of the mesh, preserving the volume"},
{MESH_FILTER_SHARPEN, "SHARPEN", 0, "Sharpen", "Sharpen the cavities of the mesh"},
"ENHANCE_DETAILS",
0,
"Enhance Details",
"Enhance the high frequency surface detail"},
"ERASE_DISCPLACEMENT",
0,
"Erase Displacement",
"Deletes the displacement of the Multires Modifier"},
{0, NULL, 0, NULL, NULL},
}
@ MESH_FILTER_ENHANCE_DETAILS
@ MESH_FILTER_SURFACE_SMOOTH
@ MESH_FILTER_INFLATE
@ MESH_FILTER_SMOOTH
@ MESH_FILTER_SCALE
@ MESH_FILTER_RELAX
@ MESH_FILTER_ERASE_DISPLACEMENT
@ MESH_FILTER_RANDOM
@ MESH_FILTER_SPHERE
@ MESH_FILTER_RELAX_FACE_SETS
@ MESH_FILTER_SHARPEN

Definition at line 199 of file sculpt_filter_mesh.c.

Referenced by SCULPT_OT_mesh_filter().