Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions
sculpt_expand.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_linklist_stack.h"
#include "BLI_math.h"
#include "BLI_task.h"
#include "BLT_translation.h"
#include "DNA_brush_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_subdiv_ccg.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.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 "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "bmesh.h"
#include <math.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  ExpandFloodFillData
 

Macros

#define SCULPT_EXPAND_VERTEX_NONE   -1
 
#define EXPAND_ACTIVE_COMPONENT_NONE   -1
 
#define SCULPT_EXPAND_TEXTURE_DISTORTION_STEP   0.01f
 
#define SCULPT_EXPAND_LOOP_THRESHOLD   0.00001f
 
#define SCULPT_EXPAND_NORMALS_FALLOFF_EDGE_SENSITIVITY   300
 

Typedefs

typedef struct ExpandFloodFillData ExpandFloodFillData
 

Enumerations

enum  {
  SCULPT_EXPAND_MODAL_CONFIRM = 1 , SCULPT_EXPAND_MODAL_CANCEL , SCULPT_EXPAND_MODAL_INVERT , SCULPT_EXPAND_MODAL_PRESERVE_TOGGLE ,
  SCULPT_EXPAND_MODAL_GRADIENT_TOGGLE , SCULPT_EXPAND_MODAL_FALLOFF_CYCLE , SCULPT_EXPAND_MODAL_RECURSION_STEP_GEODESIC , SCULPT_EXPAND_MODAL_RECURSION_STEP_TOPOLOGY ,
  SCULPT_EXPAND_MODAL_MOVE_TOGGLE , SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC , SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY , SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY_DIAGONALS ,
  SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL , SCULPT_EXPAND_MODAL_SNAP_TOGGLE , SCULPT_EXPAND_MODAL_LOOP_COUNT_INCREASE , SCULPT_EXPAND_MODAL_LOOP_COUNT_DECREASE ,
  SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE , SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE , SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_DECREASE
}
 

Functions

static bool sculpt_expand_is_vert_in_active_component (SculptSession *ss, ExpandCache *expand_cache, const int v)
 
static bool sculpt_expand_is_face_in_active_component (SculptSession *ss, ExpandCache *expand_cache, const int f)
 
static float sculpt_expand_falloff_value_vertex_get (SculptSession *ss, ExpandCache *expand_cache, const int v)
 
static float sculpt_expand_max_vertex_falloff_get (ExpandCache *expand_cache)
 
static bool sculpt_expand_state_get (SculptSession *ss, ExpandCache *expand_cache, const int v)
 
static bool sculpt_expand_face_state_get (SculptSession *ss, ExpandCache *expand_cache, const int f)
 
static float sculpt_expand_gradient_value_get (SculptSession *ss, ExpandCache *expand_cache, const int v)
 
static BLI_bitmapsculpt_expand_bitmap_from_enabled (SculptSession *ss, ExpandCache *expand_cache)
 
static BLI_bitmapsculpt_expand_boundary_from_enabled (SculptSession *ss, const BLI_bitmap *enabled_vertices, const bool use_mesh_boundary)
 
static int sculpt_expand_get_vertex_index_for_symmetry_pass (Object *ob, const char symm_it, const int original_vertex)
 
static floatsculpt_expand_geodesic_falloff_create (Sculpt *sd, Object *ob, const int v)
 
static bool expand_topology_floodfill_cb (SculptSession *UNUSED(ss), int from_v, int to_v, bool is_duplicate, void *userdata)
 
static floatsculpt_expand_topology_falloff_create (Sculpt *sd, Object *ob, const int v)
 
static bool mask_expand_normal_floodfill_cb (SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata)
 
static floatsculpt_expand_normal_falloff_create (Sculpt *sd, Object *ob, const int v, const float edge_sensitivity)
 
static floatsculpt_expand_spherical_falloff_create (Object *ob, const int v)
 
static floatsculpt_expand_boundary_topology_falloff_create (Object *ob, const int v)
 
static floatsculpt_expand_diagonals_falloff_create (Object *ob, const int v)
 
static void sculpt_expand_update_max_vert_falloff_value (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_update_max_face_falloff_factor (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_grids_to_faces_falloff (SculptSession *ss, Mesh *mesh, ExpandCache *expand_cache)
 
static void sculpt_expand_vertex_to_faces_falloff (Mesh *mesh, ExpandCache *expand_cache)
 
static void sculpt_expand_mesh_face_falloff_from_vertex_falloff (SculptSession *ss, Mesh *mesh, ExpandCache *expand_cache)
 
static void sculpt_expand_geodesics_from_state_boundary (Object *ob, ExpandCache *expand_cache, BLI_bitmap *enabled_vertices)
 
static void sculpt_expand_topology_from_state_boundary (Object *ob, ExpandCache *expand_cache, BLI_bitmap *enabled_vertices)
 
static void sculpt_expand_resursion_step_add (Object *ob, ExpandCache *expand_cache, const eSculptExpandRecursionType recursion_type)
 
static void sculpt_expand_initialize_from_face_set_boundary (Object *ob, ExpandCache *expand_cache, const int active_face_set, const bool internal_falloff)
 
static void sculpt_expand_falloff_factors_from_vertex_and_symm_create (ExpandCache *expand_cache, Sculpt *sd, Object *ob, const int v, eSculptExpandFalloffType falloff_type)
 
static void sculpt_expand_snap_initialize_from_enabled (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_cache_data_free (ExpandCache *expand_cache)
 
static void sculpt_expand_cache_free (SculptSession *ss)
 
static void sculpt_expand_restore_face_set_data (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_restore_color_data (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_restore_mask_data (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_restore_original_state (bContext *C, Object *ob, ExpandCache *expand_cache)
 
static void sculpt_expand_cancel (bContext *C, wmOperator *UNUSED(op))
 
static void sculpt_expand_mask_update_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_expand_face_sets_update (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_colors_update_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_expand_flush_updates (bContext *C)
 
static void sculpt_expand_original_state_store (Object *ob, ExpandCache *expand_cache)
 
static void sculpt_expand_face_sets_restore (SculptSession *ss, ExpandCache *expand_cache)
 
static void sculpt_expand_update_for_vertex (bContext *C, Object *ob, const int vertex)
 
static int sculpt_expand_target_vertex_update_and_get (bContext *C, Object *ob, const float mval[2])
 
static void sculpt_expand_reposition_pivot (bContext *C, Object *ob, ExpandCache *expand_cache)
 
static void sculpt_expand_finish (bContext *C)
 
static void sculpt_expand_find_active_connected_components_from_vert (Object *ob, ExpandCache *expand_cache, const int initial_vertex)
 
static void sculpt_expand_set_initial_components_for_mouse (bContext *C, Object *ob, ExpandCache *expand_cache, const float mval[2])
 
static void sculpt_expand_move_propagation_origin (bContext *C, Object *ob, const wmEvent *event, ExpandCache *expand_cache)
 
static void sculpt_expand_ensure_sculptsession_data (Object *ob)
 
static int sculpt_expand_active_face_set_id_get (SculptSession *ss, ExpandCache *expand_cache)
 
static int sculpt_expand_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void sculpt_expand_delete_face_set_id (int *r_face_sets, SculptSession *ss, ExpandCache *expand_cache, Mesh *mesh, const int delete_id)
 
static void sculpt_expand_cache_initial_config_set (bContext *C, wmOperator *op, ExpandCache *expand_cache)
 
static void sculpt_expand_undo_push (Object *ob, ExpandCache *expand_cache)
 
static int sculpt_expand_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void sculpt_expand_modal_keymap (wmKeyConfig *keyconf)
 
void SCULPT_OT_expand (wmOperatorType *ot)
 

Macro Definition Documentation

◆ EXPAND_ACTIVE_COMPONENT_NONE

#define EXPAND_ACTIVE_COMPONENT_NONE   -1

Used for defining an uninitialized active component index for an unused symmetry pass.

Definition at line 89 of file sculpt_expand.c.

◆ SCULPT_EXPAND_LOOP_THRESHOLD

#define SCULPT_EXPAND_LOOP_THRESHOLD   0.00001f

This threshold offsets the required falloff value to start a new loop. This is needed because in some situations, vertices which have the same falloff value as max_falloff will start a new loop, which is undesired.

Definition at line 101 of file sculpt_expand.c.

◆ SCULPT_EXPAND_NORMALS_FALLOFF_EDGE_SENSITIVITY

#define SCULPT_EXPAND_NORMALS_FALLOFF_EDGE_SENSITIVITY   300

Defines how much changes in curvature in the mesh affect the falloff shape when using normal falloff. This default was found experimentally and it works well in most cases, but can be exposed for tweaking if needed.

Definition at line 108 of file sculpt_expand.c.

◆ SCULPT_EXPAND_TEXTURE_DISTORTION_STEP

#define SCULPT_EXPAND_TEXTURE_DISTORTION_STEP   0.01f

Defines how much each time the texture distortion is increased/decreased when using the modal key-map.

Definition at line 94 of file sculpt_expand.c.

◆ SCULPT_EXPAND_VERTEX_NONE

#define SCULPT_EXPAND_VERTEX_NONE   -1

Used for defining an invalid vertex state (for example, when the cursor is not over the mesh).

Definition at line 86 of file sculpt_expand.c.

Typedef Documentation

◆ ExpandFloodFillData

Topology: Initializes the falloff using a flood-fill operation, increasing the falloff value by 1 when visiting a new vertex.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SCULPT_EXPAND_MODAL_CONFIRM 
SCULPT_EXPAND_MODAL_CANCEL 
SCULPT_EXPAND_MODAL_INVERT 
SCULPT_EXPAND_MODAL_PRESERVE_TOGGLE 
SCULPT_EXPAND_MODAL_GRADIENT_TOGGLE 
SCULPT_EXPAND_MODAL_FALLOFF_CYCLE 
SCULPT_EXPAND_MODAL_RECURSION_STEP_GEODESIC 
SCULPT_EXPAND_MODAL_RECURSION_STEP_TOPOLOGY 
SCULPT_EXPAND_MODAL_MOVE_TOGGLE 
SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC 
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY 
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY_DIAGONALS 
SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL 
SCULPT_EXPAND_MODAL_SNAP_TOGGLE 
SCULPT_EXPAND_MODAL_LOOP_COUNT_INCREASE 
SCULPT_EXPAND_MODAL_LOOP_COUNT_DECREASE 
SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE 
SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE 
SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_DECREASE 

Definition at line 111 of file sculpt_expand.c.

Function Documentation

◆ expand_topology_floodfill_cb()

static bool expand_topology_floodfill_cb ( SculptSession UNUSEDss,
int  from_v,
int  to_v,
bool  is_duplicate,
void userdata 
)
static

◆ mask_expand_normal_floodfill_cb()

static bool mask_expand_normal_floodfill_cb ( SculptSession ss,
int  from_v,
int  to_v,
bool  is_duplicate,
void userdata 
)
static

Normals: Flood-fills the mesh and reduces the falloff depending on the normal difference between each vertex and the previous one. This creates falloff patterns that follow and snap to the hard edges of the object.

Definition at line 472 of file sculpt_expand.c.

References CLAMP, data, dot_v3v3(), powf, and SCULPT_vertex_normal_get().

Referenced by sculpt_expand_normal_falloff_create().

◆ sculpt_expand_active_face_set_id_get()

static int sculpt_expand_active_face_set_id_get ( SculptSession ss,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_bitmap_from_enabled()

static BLI_bitmap* sculpt_expand_bitmap_from_enabled ( SculptSession ss,
ExpandCache expand_cache 
)
static

Returns a bitmap indexed by vertex index which contains if the vertex was enabled or not for a give expand_cache state.

Definition at line 345 of file sculpt_expand.c.

References BLI_BITMAP_NEW, BLI_BITMAP_SET, enabled, sculpt_expand_state_get(), and SCULPT_vertex_count_get().

Referenced by sculpt_expand_reposition_pivot(), sculpt_expand_resursion_step_add(), and sculpt_expand_snap_initialize_from_enabled().

◆ sculpt_expand_boundary_from_enabled()

static BLI_bitmap* sculpt_expand_boundary_from_enabled ( SculptSession ss,
const BLI_bitmap enabled_vertices,
const bool  use_mesh_boundary 
)
static

Returns a bitmap indexed by vertex index which contains if the vertex is in the boundary of the enabled vertices. This is defined as vertices that are enabled and at least have one connected vertex that is not enabled.

Definition at line 361 of file sculpt_expand.c.

References BLI_BITMAP_NEW, BLI_BITMAP_SET, BLI_BITMAP_TEST, SculptVertexNeighborIter::index, SCULPT_vertex_count_get(), SCULPT_vertex_is_boundary(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, and SCULPT_VERTEX_NEIGHBORS_ITER_END.

Referenced by sculpt_expand_geodesics_from_state_boundary(), sculpt_expand_reposition_pivot(), and sculpt_expand_topology_from_state_boundary().

◆ sculpt_expand_boundary_topology_falloff_create()

static float* sculpt_expand_boundary_topology_falloff_create ( Object ob,
const int  v 
)
static

◆ sculpt_expand_cache_data_free()

static void sculpt_expand_cache_data_free ( ExpandCache expand_cache)
static

◆ sculpt_expand_cache_free()

static void sculpt_expand_cache_free ( SculptSession ss)
static

◆ sculpt_expand_cache_initial_config_set()

static void sculpt_expand_cache_initial_config_set ( bContext C,
wmOperator op,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_cancel()

static void sculpt_expand_cancel ( bContext C,
wmOperator UNUSEDop 
)
static

◆ sculpt_expand_colors_update_task_cb()

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

◆ sculpt_expand_delete_face_set_id()

static void sculpt_expand_delete_face_set_id ( int *  r_face_sets,
SculptSession ss,
ExpandCache expand_cache,
Mesh mesh,
const int  delete_id 
)
static

◆ sculpt_expand_diagonals_falloff_create()

static float* sculpt_expand_diagonals_falloff_create ( Object ob,
const int  v 
)
static

◆ sculpt_expand_ensure_sculptsession_data()

static void sculpt_expand_ensure_sculptsession_data ( Object ob)
static

◆ sculpt_expand_face_sets_restore()

static void sculpt_expand_face_sets_restore ( SculptSession ss,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_face_sets_update()

static void sculpt_expand_face_sets_update ( SculptSession ss,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_face_state_get()

static bool sculpt_expand_face_state_get ( SculptSession ss,
ExpandCache expand_cache,
const int  f 
)
static

◆ sculpt_expand_falloff_factors_from_vertex_and_symm_create()

static void sculpt_expand_falloff_factors_from_vertex_and_symm_create ( ExpandCache expand_cache,
Sculpt sd,
Object ob,
const int  v,
eSculptExpandFalloffType  falloff_type 
)
static

◆ sculpt_expand_falloff_value_vertex_get()

static float sculpt_expand_falloff_value_vertex_get ( SculptSession ss,
ExpandCache expand_cache,
const int  v 
)
static

Returns the falloff value of a vertex. This function includes texture distortion, which is not precomputed into the initial falloff values.

Definition at line 168 of file sculpt_expand.c.

References BKE_brush_sample_tex_3d(), ExpandCache::brush, ExpandCache::max_vert_falloff, Brush::mtex, usdtokens::rgba(), ExpandCache::scene, SCULPT_vertex_co_get(), MTex::tex, SculptSession::tex_pool, ExpandCache::texture_distortion_strength, v, and ExpandCache::vert_falloff.

Referenced by sculpt_expand_gradient_value_get(), and sculpt_expand_state_get().

◆ sculpt_expand_find_active_connected_components_from_vert()

static void sculpt_expand_find_active_connected_components_from_vert ( Object ob,
ExpandCache expand_cache,
const int  initial_vertex 
)
static

◆ sculpt_expand_finish()

static void sculpt_expand_finish ( bContext C)
static

◆ sculpt_expand_flush_updates()

static void sculpt_expand_flush_updates ( bContext C)
static

◆ sculpt_expand_geodesic_falloff_create()

static float* sculpt_expand_geodesic_falloff_create ( Sculpt sd,
Object ob,
const int  v 
)
static

Geodesic: Initializes the falloff with geodesic distances from the given active vertex, taking symmetry into account.

Definition at line 418 of file sculpt_expand.c.

References SCULPT_geodesic_from_vertex_and_symm(), and v.

Referenced by sculpt_expand_falloff_factors_from_vertex_and_symm_create().

◆ sculpt_expand_geodesics_from_state_boundary()

static void sculpt_expand_geodesics_from_state_boundary ( Object ob,
ExpandCache expand_cache,
BLI_bitmap enabled_vertices 
)
static

◆ sculpt_expand_get_vertex_index_for_symmetry_pass()

static int sculpt_expand_get_vertex_index_for_symmetry_pass ( Object ob,
const char  symm_it,
const int  original_vertex 
)
static

Utility function to get the closet vertex after flipping an original vertex position based on an symmetry pass iteration index.

Definition at line 397 of file sculpt_expand.c.

References flip_v3_v3(), NULL, Object::sculpt, SCULPT_EXPAND_VERTEX_NONE, SCULPT_nearest_vertex_get(), and SCULPT_vertex_co_get().

Referenced by sculpt_expand_boundary_topology_falloff_create(), sculpt_expand_diagonals_falloff_create(), sculpt_expand_find_active_connected_components_from_vert(), and sculpt_expand_spherical_falloff_create().

◆ sculpt_expand_gradient_value_get()

static float sculpt_expand_gradient_value_get ( SculptSession ss,
ExpandCache expand_cache,
const int  v 
)
static

◆ sculpt_expand_grids_to_faces_falloff()

static void sculpt_expand_grids_to_faces_falloff ( SculptSession ss,
Mesh mesh,
ExpandCache expand_cache 
)
static

Functions to get falloff values for faces from the values from the vertices. This is used for expanding Face Sets. Depending on the data type of the SculptSession, this needs to get the per face falloff value from the connected vertices of each face or from the grids stored per loops for each face.

Definition at line 746 of file sculpt_expand.c.

References BKE_pbvh_get_grid_key(), ExpandCache::face_falloff, usdtokens::g(), CCGKey::grid_area, l, MPoly::loopstart, mesh, Mesh::mpoly, SculptSession::pbvh, MPoly::totloop, Mesh::totpoly, and ExpandCache::vert_falloff.

Referenced by sculpt_expand_mesh_face_falloff_from_vertex_falloff().

◆ sculpt_expand_initialize_from_face_set_boundary()

static void sculpt_expand_initialize_from_face_set_boundary ( Object ob,
ExpandCache expand_cache,
const int  active_face_set,
const bool  internal_falloff 
)
static

◆ sculpt_expand_invoke()

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

◆ sculpt_expand_is_face_in_active_component()

static bool sculpt_expand_is_face_in_active_component ( SculptSession ss,
ExpandCache expand_cache,
const int  f 
)
static

◆ sculpt_expand_is_vert_in_active_component()

static bool sculpt_expand_is_vert_in_active_component ( SculptSession ss,
ExpandCache expand_cache,
const int  v 
)
static

◆ sculpt_expand_mask_update_task_cb()

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

◆ sculpt_expand_max_vertex_falloff_get()

static float sculpt_expand_max_vertex_falloff_get ( ExpandCache expand_cache)
static

Returns the maximum valid falloff value stored in the falloff array, taking the maximum possible texture distortion into account.

Definition at line 194 of file sculpt_expand.c.

References ExpandCache::brush, ExpandCache::max_vert_falloff, Brush::mtex, MTex::tex, and ExpandCache::texture_distortion_strength.

Referenced by sculpt_expand_gradient_value_get(), and sculpt_expand_state_get().

◆ sculpt_expand_mesh_face_falloff_from_vertex_falloff()

static void sculpt_expand_mesh_face_falloff_from_vertex_falloff ( SculptSession ss,
Mesh mesh,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_modal()

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

Definition at line 1675 of file sculpt_expand.c.

References BKE_report(), BKE_sculpt_update_object_for_edit(), BLI_gset_add(), BLI_gset_free(), BLI_gset_int_new(), ExpandCache::brush, ExpandCache::brush_gradient, MTex::brush_map_mode, C, copy_v2_v2(), CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_tool_settings(), depsgraph, ELEM, EVT_MODAL_MAP, SculptSession::expand_cache, ExpandCache::falloff_gradient, ExpandCache::falloff_type, ExpandCache::initial_active_vertex, ExpandCache::initial_mouse, ExpandCache::initial_mouse_move, ExpandCache::invert, ExpandCache::loop_count, max_ff(), ExpandCache::max_geodesic_move_preview, max_ii(), MOUSEMOVE, ExpandCache::move, ExpandCache::move_original_falloff_type, ExpandCache::move_preview_falloff_type, Brush::mtex, MTEX_MAP_MODE_3D, wmEvent::mval, NULL, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, ExpandCache::original_mouse_move, POINTER_FROM_INT, ExpandCache::preserve, wmOperator::reports, ExpandCache::reposition_pivot, RPT_WARNING, Object::sculpt, ToolSettings::sculpt, sculpt_expand_active_face_set_id_get(), sculpt_expand_cancel(), sculpt_expand_ensure_sculptsession_data(), sculpt_expand_falloff_factors_from_vertex_and_symm_create(), SCULPT_EXPAND_FALLOFF_GEODESIC, SCULPT_EXPAND_FALLOFF_SPHERICAL, SCULPT_EXPAND_FALLOFF_TOPOLOGY, SCULPT_EXPAND_FALLOFF_TOPOLOGY_DIAGONALS, sculpt_expand_finish(), SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE, SCULPT_EXPAND_MODAL_CANCEL, SCULPT_EXPAND_MODAL_CONFIRM, SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC, SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL, SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY, SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY_DIAGONALS, SCULPT_EXPAND_MODAL_GRADIENT_TOGGLE, SCULPT_EXPAND_MODAL_INVERT, SCULPT_EXPAND_MODAL_LOOP_COUNT_DECREASE, SCULPT_EXPAND_MODAL_LOOP_COUNT_INCREASE, SCULPT_EXPAND_MODAL_MOVE_TOGGLE, SCULPT_EXPAND_MODAL_PRESERVE_TOGGLE, SCULPT_EXPAND_MODAL_RECURSION_STEP_GEODESIC, SCULPT_EXPAND_MODAL_RECURSION_STEP_TOPOLOGY, SCULPT_EXPAND_MODAL_SNAP_TOGGLE, SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_DECREASE, SCULPT_EXPAND_MODAL_TEXTURE_DISTORTION_INCREASE, sculpt_expand_move_propagation_origin(), SCULPT_EXPAND_RECURSION_GEODESICS, SCULPT_EXPAND_RECURSION_TOPOLOGY, sculpt_expand_reposition_pivot(), sculpt_expand_resursion_step_add(), sculpt_expand_snap_initialize_from_enabled(), sculpt_expand_target_vertex_update_and_get(), SCULPT_EXPAND_TEXTURE_DISTORTION_STEP, sculpt_expand_update_for_vertex(), SCULPT_vertex_count_get(), ExpandCache::snap, ExpandCache::snap_enabled_face_sets, MTex::tex, ExpandCache::texture_distortion_strength, wmEvent::type, UNPACK2, and wmEvent::val.

Referenced by SCULPT_OT_expand().

◆ sculpt_expand_modal_keymap()

void sculpt_expand_modal_keymap ( wmKeyConfig keyconf)

◆ sculpt_expand_move_propagation_origin()

static void sculpt_expand_move_propagation_origin ( bContext C,
Object ob,
const wmEvent event,
ExpandCache expand_cache 
)
static

Displaces the initial mouse coordinates using the new mouse position to get a new active vertex. After that, initializes a new falloff of the same type with the new active vertex.

Definition at line 1617 of file sculpt_expand.c.

References add_v2_v2v2(), C, CTX_data_tool_settings(), ExpandCache::initial_active_vertex, ExpandCache::initial_mouse_move, ExpandCache::move_preview_falloff_type, wmEvent::mval, ExpandCache::original_mouse_move, ToolSettings::sculpt, sculpt_expand_falloff_factors_from_vertex_and_symm_create(), sculpt_expand_set_initial_components_for_mouse(), sub_v2_v2v2(), and UNPACK2.

Referenced by sculpt_expand_modal().

◆ sculpt_expand_normal_falloff_create()

static float* sculpt_expand_normal_falloff_create ( Sculpt sd,
Object ob,
const int  v,
const float  edge_sensitivity 
)
static

◆ sculpt_expand_original_state_store()

static void sculpt_expand_original_state_store ( Object ob,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_reposition_pivot()

static void sculpt_expand_reposition_pivot ( bContext C,
Object ob,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_restore_color_data()

static void sculpt_expand_restore_color_data ( SculptSession ss,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_restore_face_set_data()

static void sculpt_expand_restore_face_set_data ( SculptSession ss,
ExpandCache expand_cache 
)
static

Functions to restore the original state from the ExpandCache when canceling the operator.

Definition at line 1107 of file sculpt_expand.c.

References BKE_pbvh_node_mark_redraw(), BKE_pbvh_search_gather(), SculptSession::face_sets, MEM_freeN, node, NULL, ExpandCache::original_face_sets, SculptSession::pbvh, and SculptSession::totfaces.

Referenced by sculpt_expand_restore_original_state().

◆ sculpt_expand_restore_mask_data()

static void sculpt_expand_restore_mask_data ( SculptSession ss,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_restore_original_state()

static void sculpt_expand_restore_original_state ( bContext C,
Object ob,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_resursion_step_add()

static void sculpt_expand_resursion_step_add ( Object ob,
ExpandCache expand_cache,
const eSculptExpandRecursionType  recursion_type 
)
static

◆ sculpt_expand_set_initial_components_for_mouse()

static void sculpt_expand_set_initial_components_for_mouse ( bContext C,
Object ob,
ExpandCache expand_cache,
const float  mval[2] 
)
static

◆ sculpt_expand_snap_initialize_from_enabled()

static void sculpt_expand_snap_initialize_from_enabled ( SculptSession ss,
ExpandCache expand_cache 
)
static

Adds to the snapping Face Set gset all Face Sets which contain all enabled vertices for the current ExpandCache state. This improves the usability of snapping, as already enabled elements won't switch their state when toggling snapping with the modal key-map.

Definition at line 1035 of file sculpt_expand.c.

References BKE_pbvh_type(), BLI_BITMAP_TEST, BLI_gset_add(), BLI_gset_remove(), ExpandCache::invert, l, MPoly::loopstart, MEM_freeN, SculptSession::mloop, SculptSession::mpoly, NULL, ExpandCache::original_face_sets, SculptSession::pbvh, PBVH_FACES, POINTER_FROM_INT, sculpt_expand_bitmap_from_enabled(), ExpandCache::snap, ExpandCache::snap_enabled_face_sets, SculptSession::totfaces, MPoly::totloop, and MLoop::v.

Referenced by sculpt_expand_modal().

◆ sculpt_expand_spherical_falloff_create()

static float* sculpt_expand_spherical_falloff_create ( Object ob,
const int  v 
)
static

◆ sculpt_expand_state_get()

static bool sculpt_expand_state_get ( SculptSession ss,
ExpandCache expand_cache,
const int  v 
)
static

◆ sculpt_expand_target_vertex_update_and_get()

static int sculpt_expand_target_vertex_update_and_get ( bContext C,
Object ob,
const float  mval[2] 
)
static

Updates the SculptSession cursor data and gets the active vertex if the cursor is over the mesh.

Definition at line 1447 of file sculpt_expand.c.

References C, Object::sculpt, SCULPT_active_vertex_get(), SCULPT_cursor_geometry_info_update(), and SCULPT_EXPAND_VERTEX_NONE.

Referenced by sculpt_expand_modal(), and sculpt_expand_set_initial_components_for_mouse().

◆ sculpt_expand_topology_falloff_create()

static float* sculpt_expand_topology_falloff_create ( Sculpt sd,
Object ob,
const int  v 
)
static

◆ sculpt_expand_topology_from_state_boundary()

static void sculpt_expand_topology_from_state_boundary ( Object ob,
ExpandCache expand_cache,
BLI_bitmap enabled_vertices 
)
static

◆ sculpt_expand_undo_push()

static void sculpt_expand_undo_push ( Object ob,
ExpandCache expand_cache 
)
static

◆ sculpt_expand_update_for_vertex()

static void sculpt_expand_update_for_vertex ( bContext C,
Object ob,
const int  vertex 
)
static

◆ sculpt_expand_update_max_face_falloff_factor()

static void sculpt_expand_update_max_face_falloff_factor ( SculptSession ss,
ExpandCache expand_cache 
)
static

Updates the max_falloff value for faces in a ExpandCache based on the current values of the falloff, skipping any invalid values initialized to FLT_MAX and not initialized components.

Definition at line 721 of file sculpt_expand.c.

References ExpandCache::face_falloff, ExpandCache::max_face_falloff, max_ff(), sculpt_expand_is_face_in_active_component(), and SculptSession::totfaces.

Referenced by sculpt_expand_falloff_factors_from_vertex_and_symm_create(), and sculpt_expand_resursion_step_add().

◆ sculpt_expand_update_max_vert_falloff_value()

static void sculpt_expand_update_max_vert_falloff_value ( SculptSession ss,
ExpandCache expand_cache 
)
static

Updates the max_falloff value for vertices in a ExpandCache based on the current values of the falloff, skipping any invalid values initialized to FLT_MAX and not initialized components.

Definition at line 698 of file sculpt_expand.c.

References max_ff(), ExpandCache::max_vert_falloff, sculpt_expand_is_vert_in_active_component(), SCULPT_vertex_count_get(), and ExpandCache::vert_falloff.

Referenced by sculpt_expand_falloff_factors_from_vertex_and_symm_create(), and sculpt_expand_resursion_step_add().

◆ sculpt_expand_vertex_to_faces_falloff()

static void sculpt_expand_vertex_to_faces_falloff ( Mesh mesh,
ExpandCache expand_cache 
)
static

◆ SCULPT_OT_expand()

void SCULPT_OT_expand ( wmOperatorType ot)