Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_math.h"
#include "BLI_task.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_mesh.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_scene.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "bmesh.h"
#include <math.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | BoundaryInitialVertexFloodFillData |
struct | BoundaryFloodFillData |
Macros | |
#define | BOUNDARY_VERTEX_NONE -1 |
#define | BOUNDARY_STEPS_NONE -1 |
Typedefs | |
typedef struct BoundaryInitialVertexFloodFillData | BoundaryInitialVertexFloodFillData |
typedef struct BoundaryFloodFillData | BoundaryFloodFillData |
Variables | |
static int | BOUNDARY_INDICES_BLOCK_SIZE = 300 |
#define BOUNDARY_STEPS_NONE -1 |
Definition at line 46 of file sculpt_boundary.c.
#define BOUNDARY_VERTEX_NONE -1 |
Definition at line 45 of file sculpt_boundary.c.
typedef struct BoundaryFloodFillData BoundaryFloodFillData |
|
static |
Definition at line 209 of file sculpt_boundary.c.
References data, SculptBoundary::distance, len_v3v3(), sculpt_boundary_index_add(), sculpt_boundary_is_vertex_in_editable_boundary(), sculpt_boundary_preview_edge_add(), SCULPT_vertex_co_get(), and SCULPT_vertex_is_boundary().
Referenced by sculpt_boundary_indices_init().
|
static |
Definition at line 56 of file sculpt_boundary.c.
References data, len_squared_v3v3(), SCULPT_vertex_co_get(), SCULPT_vertex_is_boundary(), and SCULPT_vertex_visible_get().
Referenced by sculpt_boundary_get_closest_boundary_vertex().
|
static |
Definition at line 626 of file sculpt_boundary.c.
References add_v3_v3(), angle(), StrokeCache::automasking, SculptBoundary::bend, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::edit_info, floorf, PBVHVertexIter::index, SculptBoundary::initial_vertex_position, StrokeCache::invert, M_PI, mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, PBVHVertexIter::mvert, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SculptBoundary::pivot_positions, SculptBoundary::pivot_rotation_axis, StrokeCache::radius, rotate_v3_v3v3fl(), SCULPT_automasking_factor_get(), sculpt_boundary_displacement_from_grab_delta_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, SculptBoundaryEditInfo::strength_factor, and sub_v3_v3v3().
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 772 of file sculpt_boundary.c.
References StrokeCache::automasking, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::edit_info, StrokeCache::grab_delta_symmetry, PBVHVertexIter::index, SculptBoundary::initial_vertex_position, madd_v3_v3v3fl(), mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, PBVHVertexIter::mvert, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SCULPT_automasking_factor_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, and SculptBoundaryEditInfo::strength_factor.
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 726 of file sculpt_boundary.c.
References StrokeCache::automasking, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::edit_info, PBVHVertexIter::index, SculptBoundary::initial_vertex_position, madd_v3_v3v3fl(), mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, PBVHVertexIter::mvert, SculptOrigVertData::no, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SCULPT_automasking_factor_get(), sculpt_boundary_displacement_from_grab_delta_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, and SculptBoundaryEditInfo::strength_factor.
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 680 of file sculpt_boundary.c.
References StrokeCache::automasking, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::directions, SculptBoundary::edit_info, PBVHVertexIter::index, SculptBoundary::initial_vertex_position, madd_v3_v3v3fl(), mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, PBVHVertexIter::mvert, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SCULPT_automasking_factor_get(), sculpt_boundary_displacement_from_grab_delta_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, SculptBoundary::slide, and SculptBoundaryEditInfo::strength_factor.
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 869 of file sculpt_boundary.c.
References add_v3_v3(), BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, PBVHVertexIter::co, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::edit_info, PBVHVertexIter::index, SculptVertexNeighborIter::index, SculptBoundary::initial_vertex_position, madd_v3_v3v3fl(), mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, mul_v3_v3fl(), PBVHVertexIter::mvert, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, SCULPT_vertex_co_get(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, SculptBoundaryEditInfo::strength_factor, and sub_v3_v3v3().
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 815 of file sculpt_boundary.c.
References add_v3_v3(), angle(), StrokeCache::automasking, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, StrokeCache::boundaries, StrokeCache::bstrength, SculptSession::cache, SculptOrigVertData::co, data, Brush::deform_target, SculptBoundary::edit_info, floorf, PBVHVertexIter::index, SculptBoundary::initial_vertex_position, StrokeCache::invert, M_PI, mask(), PBVHVertexIter::mask, StrokeCache::mirror_symmetry_pass, PBVHVertexIter::mvert, SculptBoundaryEditInfo::num_propagation_steps, SculptSession::pbvh, PBVH_ITER_UNIQUE, SculptBoundary::pivot_position, StrokeCache::radius, rotate_v3_v3v3fl(), SculptBoundary::rotation_axis, SCULPT_automasking_factor_get(), sculpt_boundary_displacement_from_grab_delta_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, SculptBoundaryEditInfo::strength_factor, sub_v3_v3v3(), and SculptBoundary::twist.
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 531 of file sculpt_boundary.c.
References SculptBoundary::bend, BOUNDARY_STEPS_NONE, copy_v3_v3(), cross_v3_v3v3(), SculptBoundary::edit_info, SculptBoundary::max_propagation_steps, MEM_calloc_arrayN, normal, normalize_v3(), SculptBoundaryEditInfo::num_propagation_steps, SculptBoundaryEditInfo::original_vertex, SculptBoundary::pivot_positions, SculptBoundary::pivot_rotation_axis, SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SCULPT_vertex_normal_get(), and sub_v3_v3v3().
Referenced by SCULPT_do_boundary_brush().
void SCULPT_boundary_data_free | ( | SculptBoundary * | boundary | ) |
Definition at line 515 of file sculpt_boundary.c.
References SculptBoundary::bend, SculptBoundary::directions, SculptBoundary::distance, SculptBoundary::edges, SculptBoundary::edit_info, MEM_SAFE_FREE, SculptBoundary::pivot_positions, SculptBoundary::pivot_rotation_axis, SculptBoundary::slide, and SculptBoundary::vertices.
Referenced by paint_cursor_preview_boundary_data_update(), SCULPT_cache_free(), and sculpt_expand_boundary_topology_falloff_create().
SculptBoundary* SCULPT_boundary_data_init | ( | Object * | object, |
Brush * | brush, | ||
int | initial_vertex, | ||
float | radius | ||
) |
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.
Definition at line 474 of file sculpt_boundary.c.
References Brush::boundary_falloff_type, Brush::boundary_offset, BOUNDARY_VERTEX_NONE, BRUSH_BOUNDARY_FALLOFF_CONSTANT, MEM_callocN, NULL, sculpt_boundary_edit_data_init(), sculpt_boundary_get_closest_boundary_vertex(), sculpt_boundary_indices_init(), SCULPT_boundary_info_ensure(), sculpt_boundary_is_vertex_in_editable_boundary(), and SCULPT_vertex_random_access_ensure().
Referenced by paint_cursor_preview_boundary_data_update(), SCULPT_do_boundary_brush(), and sculpt_expand_boundary_topology_falloff_create().
|
static |
Definition at line 612 of file sculpt_boundary.c.
References add_v3_v3v3(), SculptSession::cache, dist_signed_to_plane_v3(), StrokeCache::grab_delta_symmetry, StrokeCache::initial_location, SculptBoundary::initial_pivot_position, normal, normalize_v3(), plane_from_point_normal_v3(), pos, and sub_v3_v3v3().
Referenced by do_boundary_brush_bend_task_cb_ex(), do_boundary_brush_inflate_task_cb_ex(), do_boundary_brush_slide_task_cb_ex(), and do_boundary_brush_twist_task_cb_ex().
void SCULPT_boundary_edges_preview_draw | ( | const uint | gpuattr, |
SculptSession * | ss, | ||
const float | outline_col[3], | ||
const float | outline_alpha | ||
) |
Definition at line 1010 of file sculpt_boundary.c.
References SculptSession::boundary_preview, SculptBoundary::edges, GPU_line_width(), GPU_PRIM_LINES, immBegin(), immEnd(), immUniformColor3fvAlpha(), immVertex3fv(), SculptBoundary::num_edges, SCULPT_vertex_co_get(), SculptBoundaryPreviewEdge::v1, and SculptBoundaryPreviewEdge::v2.
Referenced by paint_cursor_draw_3d_view_brush_cursor_inactive().
|
static |
This functions initializes all data needed to calculate falloffs and deformation from the boundary into the mesh into a SculptBoundaryEditInfo array. This includes how many steps are needed to go from a boundary vertex to an interior vertex and which vertex of the boundary is the closest one.
Definition at line 287 of file sculpt_boundary.c.
References BKE_pbvh_type(), BLI_BITMAP_ENABLE, BLI_BITMAP_NEW, BLI_gsqueue_free(), BLI_gsqueue_is_empty(), BLI_gsqueue_new(), BLI_gsqueue_pop(), BLI_gsqueue_push(), BOUNDARY_STEPS_NONE, BOUNDARY_VERTEX_NONE, copy_v3_v3(), SculptBoundary::edit_info, SculptVertexNeighborIter::index, SculptBoundary::initial_pivot_position, SculptVertexNeighborIter::is_duplicate, len_v3v3(), SculptBoundary::max_propagation_steps, MEM_malloc_arrayN, MEM_SAFE_FREE, SculptBoundaryEditInfo::num_propagation_steps, SculptBoundary::num_vertices, SculptBoundaryEditInfo::original_vertex, SculptSession::pbvh, PBVH_GRIDS, SculptBoundary::pivot_vertex, SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, SCULPT_vertex_visible_get(), and SculptBoundary::vertices.
Referenced by SCULPT_boundary_data_init().
|
static |
Definition at line 416 of file sculpt_boundary.c.
References BKE_brush_curve_strength(), BKE_curvemapping_init(), BLI_assert, Brush::boundary_falloff_type, BRUSH_BOUNDARY_FALLOFF_CONSTANT, BRUSH_BOUNDARY_FALLOFF_LOOP, BRUSH_BOUNDARY_FALLOFF_LOOP_INVERT, BRUSH_BOUNDARY_FALLOFF_RADIUS, Brush::curve, SculptBoundary::distance, SculptBoundary::edit_info, fmodf, SculptBoundary::initial_vertex, SculptBoundary::max_propagation_steps, mod(), SculptBoundaryEditInfo::num_propagation_steps, SculptBoundaryEditInfo::original_vertex, SCULPT_vertex_count_get(), and SculptBoundaryEditInfo::strength_factor.
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 86 of file sculpt_boundary.c.
References BoundaryInitialVertexFloodFillData::boundary_initial_vertex, boundary_initial_vertex_floodfill_cb(), BOUNDARY_VERTEX_NONE, BoundaryInitialVertexFloodFillData::floodfill_steps, BoundaryInitialVertexFloodFillData::initial_vertex, MEM_calloc_arrayN, MEM_freeN, SCULPT_floodfill_add_initial(), SCULPT_floodfill_execute(), SCULPT_floodfill_free(), SCULPT_floodfill_init(), SCULPT_vertex_count_get(), and SCULPT_vertex_is_boundary().
Referenced by SCULPT_boundary_data_init().
|
static |
Definition at line 121 of file sculpt_boundary.c.
References BLI_gset_add(), BOUNDARY_INDICES_BLOCK_SIZE, SculptBoundary::distance, blender::math::distance(), MEM_reallocN_id, SculptBoundary::num_vertices, POINTER_FROM_INT, SculptBoundary::vertices, and SculptBoundary::vertices_capacity.
Referenced by boundary_floodfill_cb(), and sculpt_boundary_indices_init().
|
static |
Definition at line 229 of file sculpt_boundary.c.
References BLI_gset_free(), BLI_gset_haskey(), BLI_gset_int_new_ex(), BoundaryFloodFillData::boundary, boundary_floodfill_cb(), BOUNDARY_INDICES_BLOCK_SIZE, BOUNDARY_VERTEX_NONE, copy_v3_v3(), SculptBoundary::distance, SculptBoundary::edges, SculptBoundary::forms_loop, SculptVertexNeighborIter::index, SculptBoundary::initial_vertex, SculptBoundary::initial_vertex_position, BoundaryFloodFillData::last_visited_vertex, MEM_calloc_arrayN, MEM_malloc_arrayN, NULL, POINTER_FROM_INT, sculpt_boundary_index_add(), sculpt_boundary_is_vertex_in_editable_boundary(), sculpt_boundary_preview_edge_add(), SCULPT_floodfill_add_initial(), SCULPT_floodfill_execute(), SCULPT_floodfill_free(), SCULPT_floodfill_init(), SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, and SculptBoundary::vertices.
Referenced by SCULPT_boundary_data_init().
|
static |
This function is used to check where the propagation should stop when calculating the boundary, as well as to check if the initial vertex is valid.
Definition at line 161 of file sculpt_boundary.c.
References SculptVertexNeighborIter::index, SCULPT_vertex_is_boundary(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, and SCULPT_vertex_visible_get().
Referenced by boundary_floodfill_cb(), SCULPT_boundary_data_init(), and sculpt_boundary_indices_init().
void SCULPT_boundary_pivot_line_preview_draw | ( | const uint | gpuattr, |
SculptSession * | ss | ||
) |
Definition at line 1028 of file sculpt_boundary.c.
References SculptSession::boundary_preview, GPU_line_width(), GPU_PRIM_LINES, immBegin(), immEnd(), immUniformColor4f(), immVertex3fv(), SculptBoundary::initial_vertex, SculptBoundary::pivot_vertex, and SCULPT_vertex_co_get().
Referenced by paint_cursor_draw_3d_view_brush_cursor_inactive().
|
static |
Definition at line 142 of file sculpt_boundary.c.
References BOUNDARY_INDICES_BLOCK_SIZE, SculptBoundary::edges, SculptBoundary::edges_capacity, MEM_reallocN_id, SculptBoundary::num_edges, SculptBoundaryPreviewEdge::v1, v1, SculptBoundaryPreviewEdge::v2, and v2.
Referenced by boundary_floodfill_cb(), and sculpt_boundary_indices_init().
|
static |
Definition at line 566 of file sculpt_boundary.c.
References BOUNDARY_STEPS_NONE, copy_v3_v3(), SculptBoundary::directions, SculptBoundary::edit_info, SculptBoundary::max_propagation_steps, MEM_calloc_arrayN, normalize_v3(), SculptBoundaryEditInfo::num_propagation_steps, SculptBoundaryEditInfo::original_vertex, SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SculptBoundary::slide, and sub_v3_v3v3().
Referenced by SCULPT_do_boundary_brush().
|
static |
Definition at line 590 of file sculpt_boundary.c.
References add_v3_v3(), copy_v3_v3(), float(), SculptBoundary::forms_loop, SculptBoundary::initial_vertex, MEM_freeN, MEM_malloc_arrayN, mul_v3_fl(), normal_poly_v3(), normalize_v3(), SculptBoundary::num_vertices, SculptBoundary::pivot_position, SculptBoundary::pivot_vertex, SculptBoundary::rotation_axis, SCULPT_vertex_co_get(), sub_v3_v3v3(), SculptBoundary::twist, SculptBoundary::vertices, and zero_v3().
Referenced by SCULPT_do_boundary_brush().
Definition at line 928 of file sculpt_boundary.c.
References BKE_paint_brush(), BKE_pbvh_parallel_range_settings(), BLI_task_parallel_range(), StrokeCache::boundaries, Brush::boundary_deform_type, BRUSH_BOUNDARY_DEFORM_BEND, BRUSH_BOUNDARY_DEFORM_EXPAND, BRUSH_BOUNDARY_DEFORM_GRAB, BRUSH_BOUNDARY_DEFORM_INFLATE, BRUSH_BOUNDARY_DEFORM_SMOOTH, BRUSH_BOUNDARY_DEFORM_TWIST, SculptSession::cache, data, do_boundary_brush_bend_task_cb_ex(), do_boundary_brush_grab_task_cb_ex(), do_boundary_brush_inflate_task_cb_ex(), do_boundary_brush_slide_task_cb_ex(), do_boundary_brush_smooth_task_cb_ex(), do_boundary_brush_twist_task_cb_ex(), flip_v3_v3(), StrokeCache::initial_radius, StrokeCache::mirror_symmetry_pass, Sculpt::paint, StrokeCache::radius_squared, Object::sculpt, SCULPT_active_vertex_co_get(), SCULPT_active_vertex_get(), sculpt_boundary_bend_data_init(), SCULPT_boundary_data_init(), sculpt_boundary_falloff_factor_init(), sculpt_boundary_slide_data_init(), sculpt_boundary_twist_data_init(), SCULPT_nearest_vertex_get(), and SCULPT_stroke_is_first_brush_step_of_symmetry_pass().
Referenced by do_brush_action().
|
static |
Definition at line 119 of file sculpt_boundary.c.
Referenced by sculpt_boundary_index_add(), sculpt_boundary_indices_init(), and sculpt_boundary_preview_edge_add().