Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.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 "bmesh.h"
#include <math.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | PoseGrowFactorTLSData |
struct | PoseFloodFillData |
Typedefs | |
typedef struct PoseGrowFactorTLSData | PoseGrowFactorTLSData |
typedef struct PoseFloodFillData | PoseFloodFillData |
typedef struct PoseFloodFillData PoseFloodFillData |
typedef struct PoseGrowFactorTLSData PoseGrowFactorTLSData |
|
static |
Definition at line 144 of file sculpt_pose.c.
References add_v3_v3(), add_v3_v3v3(), StrokeCache::automasking, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, SculptSession::cache, SculptOrigVertData::co, copy_v3_v3(), data, Brush::deform_target, PBVHVertexIter::index, mask(), PBVHVertexIter::mask, mul_m4_v3(), mul_v3_fl(), PBVHVertexIter::mvert, SculptSession::pbvh, PBVH_ITER_UNIQUE, StrokeCache::pose_ik_chain, SCULPT_automasking_factor_get(), SCULPT_brush_deform_target_vertex_co_get(), SCULPT_get_vertex_symm_area(), SCULPT_orig_vert_data_init(), SCULPT_orig_vert_data_update(), SCULPT_UNDO_COORDS, SculptPoseIKChain::segments, sub_v3_v3v3(), SculptPoseIKChain::tot_segments, and zero_v3().
Referenced by SCULPT_do_pose_brush().
|
static |
Definition at line 243 of file sculpt_pose.c.
References add_v3_v3(), PoseGrowFactorTLSData::pos_avg, and PoseGrowFactorTLSData::pos_count.
Referenced by sculpt_pose_grow_pose_factor().
|
static |
Definition at line 210 of file sculpt_pose.c.
References add_v3_v3(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, PBVHVertexIter::co, data, PBVHVertexIter::index, SculptVertexNeighborIter::index, max, MAX2, SculptSession::pbvh, PBVH_ITER_UNIQUE, PoseGrowFactorTLSData::pos_avg, PoseGrowFactorTLSData::pos_count, SCULPT_check_vertex_pivot_symmetry(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, and SCULPT_VERTEX_NEIGHBORS_ITER_END.
Referenced by sculpt_pose_grow_pose_factor().
|
static |
Definition at line 577 of file sculpt_pose.c.
References BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, data, PBVHVertexIter::index, SculptVertexNeighborIter::index, SculptSession::pbvh, PBVH_ITER_UNIQUE, SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, and SCULPT_VERTEX_NEIGHBORS_ITER_END.
Referenced by SCULPT_pose_brush_init().
|
static |
Definition at line 638 of file sculpt_pose.c.
References BRUSH_POSE_DEFORM_SCALE_TRASLATE, BRUSH_POSE_DEFORM_SQUASH_STRETCH, ELEM, Brush::pose_deform_type, and Brush::pose_ik_segments.
Referenced by pose_ik_chain_init_face_sets(), and pose_ik_chain_init_topology().
|
static |
Definition at line 803 of file sculpt_pose.c.
References BLI_gset_add(), BLI_gset_haskey(), data, POINTER_FROM_INT, SCULPT_FACE_SET_NONE, SCULPT_vertex_face_set_get(), SCULPT_vertex_has_face_set(), and SCULPT_vertex_has_unique_face_set().
Referenced by pose_ik_chain_init_face_sets_fk().
|
static |
Definition at line 837 of file sculpt_pose.c.
References data, and SCULPT_vertex_has_face_set().
Referenced by pose_ik_chain_init_face_sets_fk().
|
static |
Definition at line 429 of file sculpt_pose.c.
References add_v3_v3(), BLI_BITMAP_ENABLE, BLI_BITMAP_TEST, BLI_gset_add(), BLI_gset_haskey(), BLI_gsetIterator_getKey(), data, GSET_ITER, SculptVertexNeighborIter::index, POINTER_AS_INT, POINTER_FROM_INT, SCULPT_check_vertex_pivot_symmetry(), SCULPT_FACE_SET_NONE, sculpt_pose_brush_is_vertex_inside_brush_radius(), SCULPT_vertex_co_get(), SCULPT_vertex_face_set_get(), SCULPT_vertex_has_face_set(), SCULPT_vertex_has_unique_face_set(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, and SCULPT_VERTEX_NEIGHBORS_ITER_END.
Referenced by pose_ik_chain_init_face_sets().
|
static |
Definition at line 731 of file sculpt_pose.c.
References BLI_BITMAP_NEW, BLI_gset_add(), BLI_gset_free(), BLI_gset_int_new_ex(), copy_v3_v3(), PoseFloodFillData::current_face_set, PoseFloodFillData::fallback_count, PoseFloodFillData::fallback_origin, MEM_SAFE_FREE, mul_v3_fl(), PoseFloodFillData::next_face_set, PoseFloodFillData::next_vertex, NULL, SculptPoseIKChainSegment::orig, POINTER_FROM_INT, pose_brush_num_effective_segments(), pose_face_sets_floodfill_cb(), pose_ik_chain_new(), pose_ik_chain_origin_heads_init(), PoseFloodFillData::pose_initial_co, PoseFloodFillData::pose_origin, PoseFloodFillData::radius, SCULPT_active_vertex_co_get(), SCULPT_active_vertex_get(), SCULPT_FACE_SET_NONE, SCULPT_floodfill_add_initial_with_symmetry(), SCULPT_floodfill_execute(), SCULPT_floodfill_free(), SCULPT_floodfill_init(), SCULPT_mesh_symmetry_xyz_get(), SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SculptPoseIKChain::segments, PoseFloodFillData::tot_co, SculptPoseIKChain::tot_segments, SculptPoseIKChainSegment::weights, and zero_v3().
Referenced by SCULPT_pose_ik_chain_init().
|
static |
Definition at line 845 of file sculpt_pose.c.
References add_v3_v3(), BLI_gset_free(), BLI_gset_int_new_ex(), copy_v3_v3(), PoseFloodFillData::fk_weights, PoseFloodFillData::floodfill_it, SculptPoseIKChain::grab_delta_offset, SculptPoseIKChainSegment::head, PoseFloodFillData::initial_face_set, PoseFloodFillData::masked_face_set, PoseFloodFillData::masked_face_set_it, MEM_calloc_arrayN, MEM_freeN, mul_v3_fl(), NULL, SculptPoseIKChainSegment::orig, pose_face_sets_fk_find_masked_floodfill_cb(), pose_face_sets_fk_set_weights_floodfill_cb(), pose_ik_chain_new(), pose_ik_chain_origin_heads_init(), SCULPT_active_face_set_get(), SCULPT_active_vertex_get(), SCULPT_FACE_SET_NONE, SCULPT_floodfill_add_active(), SCULPT_floodfill_add_initial(), SCULPT_floodfill_execute(), SCULPT_floodfill_free(), SCULPT_floodfill_init(), SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SCULPT_vertex_has_face_set(), SculptPoseIKChain::segments, sub_v3_v3v3(), PoseFloodFillData::target_face_set, PoseFloodFillData::visited_face_sets, SculptPoseIKChainSegment::weights, and zero_v3().
Referenced by SCULPT_pose_ik_chain_init().
|
static |
Definition at line 651 of file sculpt_pose.c.
References copy_v3_v3(), MEM_callocN, MEM_freeN, NULL, SculptPoseIKChainSegment::orig, pose_brush_num_effective_segments(), pose_ik_chain_new(), pose_ik_chain_origin_heads_init(), Brush::pose_offset, SCULPT_nearest_vertex_get(), SCULPT_pose_calc_pose_data(), sculpt_pose_grow_pose_factor(), SCULPT_vertex_count_get(), SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, and SculptPoseIKChainSegment::weights.
Referenced by SCULPT_pose_ik_chain_init().
|
static |
Definition at line 602 of file sculpt_pose.c.
References MEM_callocN, SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, and SculptPoseIKChainSegment::weights.
Referenced by pose_ik_chain_init_face_sets(), pose_ik_chain_init_face_sets_fk(), and pose_ik_chain_init_topology().
|
static |
Definition at line 615 of file sculpt_pose.c.
References copy_v3_fl(), copy_v3_v3(), SculptPoseIKChainSegment::head, SculptPoseIKChainSegment::initial_head, SculptPoseIKChainSegment::initial_orig, SculptPoseIKChainSegment::len, len_v3v3(), SculptPoseIKChainSegment::orig, SculptPoseIKChainSegment::scale, SculptPoseIKChain::segments, and SculptPoseIKChain::tot_segments.
Referenced by pose_ik_chain_init_face_sets(), pose_ik_chain_init_face_sets_fk(), and pose_ik_chain_init_topology().
|
static |
Definition at line 39 of file sculpt_pose.c.
References add_v3_v3(), copy_v3_v3(), len, madd_v3_v3v3fl(), normalize_v3(), rot, rotation_between_vecs_to_quat(), SculptPoseIKChain::segments, sub_v3_v3v3(), and SculptPoseIKChain::tot_segments.
Referenced by sculpt_pose_do_rotate_deform(), and sculpt_pose_do_scale_deform().
|
static |
Definition at line 92 of file sculpt_pose.c.
References axis_angle_normalized_to_quat(), BKE_brush_curve_strength(), normalize_v3(), rot, rotation_between_quats_to_quat(), SculptPoseIKChain::segments, sub_v3_v3v3(), and SculptPoseIKChain::tot_segments.
Referenced by sculpt_pose_do_twist_deform().
|
static |
Definition at line 133 of file sculpt_pose.c.
References copy_v3_v3(), SculptPoseIKChain::segments, and SculptPoseIKChain::tot_segments.
Referenced by sculpt_pose_do_scale_deform(), and sculpt_pose_do_squash_stretch_deform().
|
static |
Definition at line 118 of file sculpt_pose.c.
References add_v3_v3v3(), rot, SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, and unit_qt().
Referenced by sculpt_pose_do_translate_deform().
|
static |
Definition at line 400 of file sculpt_pose.c.
References add_v3_v3(), copy_v3_v3(), data, len_squared_v3v3(), SCULPT_check_vertex_pivot_symmetry(), sculpt_pose_brush_is_vertex_inside_brush_radius(), and SCULPT_vertex_co_get().
Referenced by SCULPT_pose_calc_pose_data().
void SCULPT_do_pose_brush | ( | struct Sculpt * | sd, |
struct Object * | ob, | ||
struct PBVHNode ** | nodes, | ||
int | totnode | ||
) |
Definition at line 1112 of file sculpt_pose.c.
References BKE_paint_brush(), BKE_pbvh_parallel_range_settings(), BLI_task_parallel_range(), BRUSH_POSE_DEFORM_ROTATE_TWIST, BRUSH_POSE_DEFORM_SCALE_TRASLATE, BRUSH_POSE_DEFORM_SQUASH_STRETCH, SculptSession::cache, copy_qt_qt(), copy_v3_v3(), data, do_pose_brush_task_cb_ex(), SculptPoseIKChainSegment::initial_orig, invert_m4_m4(), StrokeCache::mirror_symmetry_pass, mul_m4_m4_post(), mul_v3_fl(), SculptPoseIKChainSegment::orig, StrokeCache::orig_grab_location, Sculpt::paint, PAINT_SYMM_AREAS, SculptPoseIKChainSegment::pivot_mat, SculptPoseIKChainSegment::pivot_mat_inv, Brush::pose_deform_type, StrokeCache::pose_ik_chain, quat_to_mat4(), SculptPoseIKChainSegment::rot, SculptPoseIKChainSegment::scale, Object::sculpt, SCULPT_flip_quat_by_symm_area(), SCULPT_flip_v3_by_symm_area(), SCULPT_mesh_symmetry_xyz_get(), sculpt_pose_align_pivot_local_space(), sculpt_pose_do_rotate_twist_deform(), sculpt_pose_do_scale_translate_deform(), sculpt_pose_do_squash_stretch_deform(), SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, SculptPoseIKChainSegment::trans_mat, translate_m4(), and unit_m4().
Referenced by do_brush_action().
|
static |
Definition at line 1089 of file sculpt_pose.c.
References copy_v3_v3(), normalize_v3(), ortho_basis_v3v3_v3(), SCULPT_flip_v3_by_symm_area(), and sub_v3_v3v3().
Referenced by SCULPT_do_pose_brush().
void SCULPT_pose_brush_init | ( | Sculpt * | sd, |
Object * | ob, | ||
SculptSession * | ss, | ||
Brush * | br | ||
) |
Definition at line 957 of file sculpt_pose.c.
References BKE_pbvh_parallel_range_settings(), BKE_pbvh_search_gather(), BLI_task_parallel_range(), SculptSession::cache, data, MEM_SAFE_FREE, NULL, SculptSession::pbvh, pose_brush_init_task_cb_ex(), StrokeCache::pose_ik_chain, Brush::pose_smooth_iterations, StrokeCache::radius, Object::sculpt, SCULPT_pose_ik_chain_init(), SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, StrokeCache::true_location, and SculptPoseIKChainSegment::weights.
Referenced by do_brush_action().
|
static |
Definition at line 341 of file sculpt_pose.c.
References flip_v3_v3(), len_v3v3(), and SCULPT_is_symmetry_iteration_valid().
Referenced by pose_face_sets_floodfill_cb(), and pose_topology_floodfill_cb().
void SCULPT_pose_calc_pose_data | ( | struct Sculpt * | sd, |
struct Object * | ob, | ||
struct SculptSession * | ss, | ||
float | initial_location[3], | ||
float | radius, | ||
float | pose_offset, | ||
float * | r_pose_origin, | ||
float * | r_pose_factor | ||
) |
Calculate the pose origin and (Optionally the pose factor) that is used when using the pose brush.
r_pose_origin | Must be a valid pointer. |
r_pose_factor | Optional, when set to NULL it won't be calculated. |
Definition at line 527 of file sculpt_pose.c.
References copy_v3_v3(), PoseFloodFillData::fallback_floodfill_origin, madd_v3_v3fl(), mul_v3_fl(), normalize_v3(), NULL, PoseFloodFillData::pose_initial_co, PoseFloodFillData::pose_origin, pose_topology_floodfill_cb(), PoseFloodFillData::radius, SCULPT_floodfill_add_active(), SCULPT_floodfill_execute(), SCULPT_floodfill_free(), SCULPT_floodfill_init(), SCULPT_mesh_symmetry_xyz_get(), sculpt_pose_grow_pose_factor(), SCULPT_vertex_random_access_ensure(), sub_v3_v3v3(), PoseFloodFillData::tot_co, and zero_v3().
Referenced by pose_ik_chain_init_topology().
|
static |
Definition at line 1039 of file sculpt_pose.c.
References add_v3_v3(), BRUSH_POSE_IK_ANCHORED, SculptSession::cache, copy_v3_v3(), Brush::flag2, StrokeCache::grab_delta, SculptPoseIKChain::grab_delta_offset, StrokeCache::pose_ik_chain, pose_solve_ik_chain(), and StrokeCache::true_location.
Referenced by sculpt_pose_do_rotate_twist_deform().
|
static |
Definition at line 1053 of file sculpt_pose.c.
References SculptSession::cache, StrokeCache::invert, sculpt_pose_do_rotate_deform(), and sculpt_pose_do_twist_deform().
Referenced by SCULPT_do_pose_brush().
|
static |
Definition at line 1009 of file sculpt_pose.c.
References add_v3_v3(), BRUSH_POSE_IK_ANCHORED, BRUSH_POSE_USE_LOCK_ROTATION, SculptSession::cache, copy_v3_fl(), copy_v3_v3(), Brush::flag2, StrokeCache::grab_delta, StrokeCache::pose_ik_chain, pose_solve_ik_chain(), pose_solve_scale_chain(), sculpt_pose_get_scale_from_grab_delta(), and StrokeCache::true_location.
Referenced by sculpt_pose_do_scale_translate_deform().
|
static |
Definition at line 1063 of file sculpt_pose.c.
References SculptSession::cache, StrokeCache::invert, sculpt_pose_do_scale_deform(), and sculpt_pose_do_translate_deform().
Referenced by SCULPT_do_pose_brush().
|
static |
Definition at line 1073 of file sculpt_pose.c.
References add_v3_v3(), SculptSession::cache, copy_v3_v3(), StrokeCache::grab_delta, StrokeCache::pose_ik_chain, pose_solve_scale_chain(), sculpt_pose_get_scale_from_grab_delta(), sqrtf, and StrokeCache::true_location.
Referenced by SCULPT_do_pose_brush().
|
static |
Definition at line 989 of file sculpt_pose.c.
References BKE_curvemapping_init(), SculptSession::cache, Brush::curve, StrokeCache::grab_delta, StrokeCache::pose_ik_chain, and pose_solve_translate_chain().
Referenced by sculpt_pose_do_scale_translate_deform().
|
static |
Definition at line 1029 of file sculpt_pose.c.
References BKE_curvemapping_init(), StrokeCache::bstrength, SculptSession::cache, Brush::curve, StrokeCache::initial_mouse, StrokeCache::mouse, StrokeCache::pose_ik_chain, and pose_solve_roll_chain().
Referenced by sculpt_pose_do_rotate_twist_deform().
|
static |
Definition at line 997 of file sculpt_pose.c.
References SculptSession::cache, dist_signed_to_plane_v3(), SculptPoseIKChainSegment::initial_head, SculptPoseIKChainSegment::initial_orig, SculptPoseIKChainSegment::len, normalize_v3(), plane_from_point_normal_v3(), StrokeCache::pose_ik_chain, SculptPoseIKChain::segments, and sub_v3_v3v3().
Referenced by sculpt_pose_do_scale_deform(), and sculpt_pose_do_squash_stretch_deform().
|
static |
Definition at line 255 of file sculpt_pose.c.
References BKE_pbvh_parallel_range_settings(), BKE_pbvh_search_gather(), BLI_task_parallel_range(), copy_v3_v3(), data, TaskParallelSettings::func_reduce, len, len_v3v3(), MEM_freeN, MEM_mallocN, MEM_SAFE_FREE, mul_v3_fl(), NULL, SculptSession::pbvh, PoseGrowFactorTLSData::pos_avg, PoseGrowFactorTLSData::pos_count, pose_brush_grow_factor_reduce(), pose_brush_grow_factor_task_cb_ex(), Object::sculpt, SCULPT_vertex_count_get(), TaskParallelSettings::userdata_chunk, TaskParallelSettings::userdata_chunk_size, and zero_v3().
Referenced by pose_ik_chain_init_topology(), and SCULPT_pose_calc_pose_data().
void SCULPT_pose_ik_chain_free | ( | SculptPoseIKChain * | ik_chain | ) |
Definition at line 1209 of file sculpt_pose.c.
References MEM_SAFE_FREE, SculptPoseIKChain::segments, SculptPoseIKChain::tot_segments, and SculptPoseIKChainSegment::weights.
Referenced by paint_cursor_draw_3d_view_brush_cursor_inactive(), and SCULPT_cache_free().
SculptPoseIKChain* SCULPT_pose_ik_chain_init | ( | Sculpt * | sd, |
Object * | ob, | ||
SculptSession * | ss, | ||
Brush * | br, | ||
const float | initial_location[3], | ||
const float | radius | ||
) |
Definition at line 922 of file sculpt_pose.c.
References BRUSH_POSE_ORIGIN_FACE_SETS, BRUSH_POSE_ORIGIN_FACE_SETS_FK, BRUSH_POSE_ORIGIN_TOPOLOGY, BRUSH_USE_CONNECTED_ONLY, Brush::disconnected_distance_max, Brush::flag2, NULL, pose_ik_chain_init_face_sets(), pose_ik_chain_init_face_sets_fk(), pose_ik_chain_init_topology(), Brush::pose_origin_type, SCULPT_fake_neighbors_disable(), SCULPT_fake_neighbors_enable(), and SCULPT_fake_neighbors_ensure().
Referenced by paint_cursor_draw_3d_view_brush_cursor_inactive(), and SCULPT_pose_brush_init().