Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_dial_2d.h"
#include "BLI_edgehash.h"
#include "BLI_gsqueue.h"
#include "BLI_hash.h"
#include "BLI_math.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_brush.h"
#include "BKE_bvhutils.h"
#include "BKE_ccg.h"
#include "BKE_collision.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_kelvinlet.h"
#include "BKE_key.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_mirror.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pbvh.h"
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subsurf.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.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 "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Classes | |
struct | ClothBrushCollision |
Typedefs | |
typedef struct ClothBrushCollision | ClothBrushCollision |
typedef enum eSculpClothFilterType | eSculptClothFilterType |
typedef enum eClothFilterForceAxis | eClothFilterForceAxis |
Enumerations | |
enum | eSculpClothFilterType { CLOTH_FILTER_GRAVITY , CLOTH_FILTER_INFLATE , CLOTH_FILTER_EXPAND , CLOTH_FILTER_PINCH , CLOTH_FILTER_SCALE } |
enum | eClothFilterForceAxis { CLOTH_FILTER_FORCE_X = 1 << 0 , CLOTH_FILTER_FORCE_Y = 1 << 1 , CLOTH_FILTER_FORCE_Z = 1 << 2 } |
Variables | |
static EnumPropertyItem | prop_cloth_filter_type [] |
static EnumPropertyItem | prop_cloth_filter_orientation_items [] |
static EnumPropertyItem | prop_cloth_filter_force_axis_items [] |
#define CLOTH_DEFORMATION_GRAB_STRENGTH 0.1f |
Definition at line 183 of file sculpt_cloth.c.
#define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f |
Definition at line 181 of file sculpt_cloth.c.
#define CLOTH_DEFORMATION_TARGET_STRENGTH 0.01f |
Definition at line 182 of file sculpt_cloth.c.
#define CLOTH_LENGTH_CONSTRAINTS_BLOCK 100000 |
Definition at line 175 of file sculpt_cloth.c.
#define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024 |
Definition at line 179 of file sculpt_cloth.c.
#define CLOTH_SIMULATION_ITERATIONS 5 |
Definition at line 176 of file sculpt_cloth.c.
#define CLOTH_SIMULATION_TIME_STEP 0.01f |
Definition at line 180 of file sculpt_cloth.c.
#define CLOTH_SOLVER_DISPLACEMENT_FACTOR 0.6f |
Definition at line 178 of file sculpt_cloth.c.
typedef struct ClothBrushCollision ClothBrushCollision |
typedef enum eClothFilterForceAxis eClothFilterForceAxis |
typedef enum eSculpClothFilterType eSculptClothFilterType |
Enumerator | |
---|---|
CLOTH_FILTER_FORCE_X | |
CLOTH_FILTER_FORCE_Y | |
CLOTH_FILTER_FORCE_Z |
Definition at line 1362 of file sculpt_cloth.c.
Enumerator | |
---|---|
CLOTH_FILTER_GRAVITY | |
CLOTH_FILTER_INFLATE | |
CLOTH_FILTER_EXPAND | |
CLOTH_FILTER_PINCH | |
CLOTH_FILTER_SCALE |
Definition at line 1322 of file sculpt_cloth.c.
|
static |
Definition at line 296 of file sculpt_cloth.c.
References cloth_brush_reallocate_constraints(), SculptClothSimulation::deformation_pos, SculptClothLengthConstraint::elem_index_a, SculptClothLengthConstraint::elem_index_b, SculptClothLengthConstraint::elem_position_a, SculptClothLengthConstraint::elem_position_b, SculptClothLengthConstraint::length, SculptClothSimulation::length_constraints, SculptClothLengthConstraint::node, SculptClothSimulation::pos, SCULPT_CLOTH_CONSTRAINT_DEFORMATION, SculptClothLengthConstraint::strength, SculptClothSimulation::tot_length_constraints, SculptClothLengthConstraint::type, and v.
Referenced by do_cloth_brush_build_constraints_task_cb_ex().
|
static |
Definition at line 203 of file sculpt_cloth.c.
References BLI_edgeset_add(), cloth_brush_reallocate_constraints(), SculptClothSimulation::created_length_constraints, SculptClothLengthConstraint::elem_index_a, SculptClothLengthConstraint::elem_index_b, SculptClothLengthConstraint::elem_position_a, SculptClothLengthConstraint::elem_position_b, len_v3v3(), SculptClothLengthConstraint::length, SculptClothSimulation::length_constraints, SculptClothLengthConstraint::node, SculptClothSimulation::pos, SCULPT_CLOTH_CONSTRAINT_STRUCTURAL, SCULPT_vertex_co_get(), SCULPT_vertex_persistent_co_get(), SculptClothLengthConstraint::strength, SculptClothSimulation::tot_length_constraints, SculptClothLengthConstraint::type, v1, and v2.
Referenced by do_cloth_brush_build_constraints_task_cb_ex().
|
static |
Definition at line 269 of file sculpt_cloth.c.
References cloth_brush_reallocate_constraints(), SculptClothLengthConstraint::elem_index_a, SculptClothLengthConstraint::elem_index_b, SculptClothLengthConstraint::elem_position_a, SculptClothLengthConstraint::elem_position_b, SculptClothSimulation::init_pos, SculptClothLengthConstraint::length, SculptClothSimulation::length_constraints, SculptClothLengthConstraint::node, SculptClothSimulation::pos, SCULPT_CLOTH_CONSTRAINT_PIN, SculptClothLengthConstraint::strength, SculptClothSimulation::tot_length_constraints, SculptClothLengthConstraint::type, and v.
Referenced by do_cloth_brush_build_constraints_task_cb_ex().
|
static |
Definition at line 242 of file sculpt_cloth.c.
References cloth_brush_reallocate_constraints(), SculptClothLengthConstraint::elem_index_a, SculptClothLengthConstraint::elem_index_b, SculptClothLengthConstraint::elem_position_a, SculptClothLengthConstraint::elem_position_b, SculptClothLengthConstraint::length, SculptClothSimulation::length_constraints, SculptClothLengthConstraint::node, SculptClothSimulation::pos, SCULPT_CLOTH_CONSTRAINT_SOFTBODY, SculptClothSimulation::softbody_pos, SculptClothLengthConstraint::strength, SculptClothSimulation::tot_length_constraints, SculptClothLengthConstraint::type, and v.
Referenced by do_cloth_brush_build_constraints_task_cb_ex().
|
static |
Definition at line 933 of file sculpt_cloth.c.
References SculptThreadedTaskData::area_co, SculptThreadedTaskData::area_no, BKE_curvemapping_init(), BKE_paint_brush(), BKE_pbvh_parallel_range_settings(), BLI_task_parallel_range(), BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_CLOTH_FORCE_FALLOFF_PLANE, SculptSession::cache, Brush::cloth_deform_type, Brush::cloth_force_falloff_type, StrokeCache::cloth_sim, copy_m4_m4(), copy_v3_v3(), cross_v3_v3v3(), Brush::curve, SculptClothSimulation::deformation_strength, do_cloth_brush_apply_forces_task_cb_ex(), ELEM, SculptThreadedTaskData::grab_delta, StrokeCache::grab_delta_symmetry, is_zero_v3(), StrokeCache::location, SculptThreadedTaskData::mat, StrokeCache::mirror_symmetry_pass, mul_v3_fl(), mul_v3_v3(), mul_v3_v3fl(), normalize_m4(), normalize_v3(), offset, SculptThreadedTaskData::offset, Sculpt::paint, StrokeCache::radius, StrokeCache::scale, Object::sculpt, SCULPT_calc_brush_plane(), StrokeCache::sculpt_normal_symm, SCULPT_vertex_count_get(), SculptThreadedTaskData::sd, and StrokeCache::stroke_local_mat.
Referenced by SCULPT_do_cloth_brush().
|
static |
Definition at line 451 of file sculpt_cloth.c.
References SculptClothSimulation::acceleration, madd_v3_v3fl(), and SculptClothSimulation::mass.
Referenced by cloth_filter_apply_forces_to_vertices(), and do_cloth_brush_apply_forces_task_cb_ex().
|
static |
Definition at line 614 of file sculpt_cloth.c.
References BKE_modifiers_findby_type(), BLI_addtail(), CollisionModifierData::bvhtree, col, collision_move_object(), DEG_ITER_OBJECT_FLAG_DUPLI, DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY, DEG_ITER_OBJECT_FLAG_VISIBLE, DEG_OBJECT_ITER_BEGIN, DEG_OBJECT_ITER_END, depsgraph, eModifierType_Collision, Object::id, MEM_callocN, ID::name, NULL, and STREQ.
Referenced by SCULPT_cloth_brush_simulation_create().
|
static |
Definition at line 653 of file sculpt_cloth.c.
References BVHTreeRayHit::co, MVert::co, col, copy_v3_v3(), BVHTreeRay::direction, BVHTreeRayHit::dist, BVHTreeRayHit::index, isect_ray_tri_watertight_v3(), madd_v3_v3v3fl(), BVHTreeRayHit::no, normal_tri_v3(), NULL, BVHTreeRay::origin, MVertTri::tri, CollisionModifierData::tri, UNPACK3, and CollisionModifierData::x.
Referenced by cloth_brush_solve_collision().
|
static |
Definition at line 192 of file sculpt_cloth.c.
References SculptClothSimulation::capacity_length_constraints, CLOTH_LENGTH_CONSTRAINTS_BLOCK, SculptClothSimulation::length_constraints, MEM_reallocN_id, and SculptClothSimulation::tot_length_constraints.
Referenced by cloth_brush_add_deformation_constraint(), cloth_brush_add_length_constraint(), cloth_brush_add_pin_constraint(), and cloth_brush_add_softbody_constraint().
|
static |
Definition at line 814 of file sculpt_cloth.c.
References SculptSession::cache, cloth_brush_simulation_falloff_get(), cloth_brush_simulation_location_get(), Brush::cloth_constraint_softbody_strength, CLOTH_SIMULATION_ITERATIONS, CLOTH_SOLVER_DISPLACEMENT_FACTOR, SculptClothSimulation::deformation_strength, SculptClothLengthConstraint::elem_index_a, SculptClothLengthConstraint::elem_index_b, SculptClothLengthConstraint::elem_position_a, SculptClothLengthConstraint::elem_position_b, SculptClothSimulation::init_pos, len_v3(), SculptClothLengthConstraint::length, SculptClothSimulation::length_constraint_tweak, SculptClothSimulation::length_constraints, madd_v3_v3fl(), mul_v3_v3fl(), SculptClothLengthConstraint::node, SculptClothSimulation::node_state, SculptClothSimulation::pos, StrokeCache::radius, SCULPT_automasking_active_cache_get(), SCULPT_automasking_factor_get(), SCULPT_CLOTH_CONSTRAINT_DEFORMATION, SCULPT_CLOTH_CONSTRAINT_SOFTBODY, SCULPT_CLOTH_NODE_ACTIVE, SCULPT_vertex_mask_get(), SculptClothSimulation::softbody_pos, SculptClothLengthConstraint::strength, sub_v3_v3v3(), SculptClothSimulation::tot_length_constraints, SculptClothLengthConstraint::type, v1, and v2.
Referenced by SCULPT_cloth_brush_do_simulation_step().
|
static |
Definition at line 185 of file sculpt_cloth.c.
References BLI_edgeset_haskey(), SculptClothSimulation::created_length_constraints, v1, and v2.
Referenced by do_cloth_brush_build_constraints_task_cb_ex().
|
static |
Definition at line 143 of file sculpt_cloth.c.
References BRUSH_CLOTH_SIMULATION_AREA_GLOBAL, Brush::cloth_sim_falloff, Brush::cloth_sim_limit, Brush::cloth_simulation_area_type, blender::math::distance(), len_v3v3(), Brush::sculpt_tool, and SCULPT_TOOL_CLOTH.
Referenced by cloth_brush_satisfy_constraints(), do_cloth_brush_apply_forces_task_cb_ex(), do_cloth_brush_build_constraints_task_cb_ex(), and do_cloth_brush_solve_simulation_task_cb_ex().
|
static |
Definition at line 90 of file sculpt_cloth.c.
References BRUSH_CLOTH_SIMULATION_AREA_LOCAL, SculptSession::cache, Brush::cloth_simulation_area_type, copy_v3_v3(), StrokeCache::initial_location, StrokeCache::location, and zero_v3().
Referenced by cloth_brush_satisfy_constraints(), do_cloth_brush_apply_forces_task_cb_ex(), do_cloth_brush_solve_simulation_task_cb_ex(), and sculpt_cloth_ensure_constraints_in_simulation_area().
|
static |
Definition at line 683 of file sculpt_cloth.c.
References add_v3_v3(), BLI_bvhtree_ray_cast_ex(), BVH_RAYCAST_DEFAULT, BVH_RAYCAST_WATERTIGHT, CollisionModifierData::bvhtree, closest_to_plane_v3(), cloth_brush_collision_cb(), BVHTreeRayHit::co, col, SculptClothSimulation::collider_list, ColliderCache::collmd, copy_v3_v3(), BVHTreeRayHit::dist, ListBase::first, BVHTreeRayHit::index, invert_m4_m4(), isect_ray_tri_watertight_v3_precalc(), SculptClothSimulation::last_iteration_pos, len_v3(), mul_v3_fl(), mul_v3_m4v3(), mul_v3_v3fl(), ColliderCache::next, BVHTreeRayHit::no, normalize_v3(), Object::obmat, plane_from_point_normal_v3(), SculptClothSimulation::pos, and sub_v3_v3v3().
Referenced by do_cloth_brush_solve_simulation_task_cb_ex().
|
static |
Definition at line 1380 of file sculpt_cloth.c.
References add_v3_v3v3(), FilterCache::cloth_sim, copy_v3_v3(), SculptClothSimulation::deformation_pos, SculptClothSimulation::init_pos, and SCULPT_filter_zero_disabled_axis_components().
Referenced by cloth_filter_apply_forces_task_cb().
|
static |
Definition at line 1404 of file sculpt_cloth.c.
References FilterCache::active_face_set, FilterCache::automasking, BKE_pbvh_node_mark_update(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, cloth_filter_apply_displacement_to_deform_co(), cloth_filter_apply_forces_to_vertices(), CLOTH_FILTER_EXPAND, CLOTH_FILTER_GRAVITY, CLOTH_FILTER_INFLATE, cloth_filter_is_deformation_filter(), CLOTH_FILTER_PINCH, CLOTH_FILTER_SCALE, FilterCache::cloth_sim, FilterCache::cloth_sim_pinch_point, PBVHVertexIter::co, copy_v3_v3(), data, fade(), SculptSession::filter_cache, Sculpt::gravity_factor, Sculpt::gravity_object, PBVHVertexIter::index, SculptClothSimulation::init_pos, SculptClothSimulation::length_constraint_tweak, PBVHVertexIter::mask, mul_m3_v3(), mul_v3_fl(), mul_v3_v3fl(), node, normal, normalize_v3(), Object::obmat, FilterCache::orientation, SculptSession::pbvh, PBVH_ITER_UNIQUE, scale_m3_fl(), SCULPT_automasking_factor_get(), SCULPT_FACE_SET_NONE, SCULPT_FILTER_ORIENTATION_VIEW, SCULPT_filter_to_object_space(), SCULPT_vertex_has_face_set(), SCULPT_vertex_normal_get(), sub_v3_v3v3(), transform(), unit_m3(), and zero_v3().
Referenced by sculpt_cloth_filter_modal().
|
static |
Definition at line 1392 of file sculpt_cloth.c.
References add_v3_v3(), cloth_brush_apply_force_to_vertex(), FilterCache::cloth_sim, copy_v3_v3(), NULL, and SCULPT_filter_zero_disabled_axis_components().
Referenced by cloth_filter_apply_forces_task_cb().
|
static |
Definition at line 1375 of file sculpt_cloth.c.
References CLOTH_FILTER_SCALE, and ELEM.
Referenced by cloth_filter_apply_forces_task_cb(), and sculpt_cloth_filter_invoke().
|
static |
Definition at line 1019 of file sculpt_cloth.c.
References BKE_pbvh_search_gather(), BLI_ghash_insert(), BLI_ghash_ptr_new(), MEM_malloc_arrayN, MEM_SAFE_FREE, SculptClothSimulation::node_state, SculptClothSimulation::node_state_index, NULL, SculptSession::pbvh, POINTER_FROM_INT, and SCULPT_CLOTH_NODE_UNINITIALIZED.
Referenced by SCULPT_cloth_brush_simulation_create().
|
static |
Definition at line 459 of file sculpt_cloth.c.
References add_v3_v3v3(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, BLI_task_parallel_thread_id(), BRUSH_CLOTH_DEFORM_DRAG, BRUSH_CLOTH_DEFORM_EXPAND, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_INFLATE, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PINCH_POINT, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_CLOTH_FORCE_FALLOFF_PLANE, StrokeCache::bstrength, SculptSession::cache, clamp_f(), cloth_brush_apply_force_to_vertex(), cloth_brush_simulation_falloff_get(), cloth_brush_simulation_location_get(), Brush::cloth_deform_type, Brush::cloth_force_falloff_type, StrokeCache::cloth_sim, PBVHVertexIter::co, copy_v3_v3(), data, SculptClothSimulation::deformation_pos, SculptClothSimulation::deformation_strength, SculptBrushTest::dist, dist_signed_to_plane_v3(), dist_to_plane_v3(), blender::math::distance(), dot_v3v3(), fade(), float(), PBVHVertexIter::fno, StrokeCache::grab_delta_symmetry, StrokeCache::gravity_direction, PBVHVertexIter::index, SculptClothSimulation::init_pos, StrokeCache::last_location, SculptClothSimulation::length_constraint_tweak, StrokeCache::location, madd_v3_v3fl(), madd_v3_v3v3fl(), PBVHVertexIter::mask, mul_v3_fl(), mul_v3_v3fl(), PBVHVertexIter::no, normalize_v3(), normalize_v3_v3(), offset, SculptSession::pbvh, PBVH_ITER_UNIQUE, plane_from_point_normal_v3(), SculptClothSimulation::pos, StrokeCache::radius, SCULPT_brush_strength_factor(), SCULPT_brush_test_init_with_falloff_shape(), sqrtf, sub_v3_v3v3(), StrokeCache::supports_gravity, blender::threading::enumerable_thread_specific_utils::thread_id, and zero_v3().
Referenced by cloth_brush_apply_brush_foces().
|
static |
Definition at line 323 of file sculpt_cloth.c.
References BKE_brush_curve_strength(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, BLI_ghash_lookup(), BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_CLOTH_FORCE_FALLOFF_PLANE, BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY, BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC, BRUSH_CLOTH_SIMULATION_AREA_LOCAL, BRUSH_PERSISTENT, SculptSession::cache, cloth_brush_add_deformation_constraint(), cloth_brush_add_length_constraint(), cloth_brush_add_pin_constraint(), cloth_brush_add_softbody_constraint(), cloth_brush_sim_has_length_constraint(), cloth_brush_simulation_falloff_get(), Brush::cloth_deform_type, CLOTH_DEFORMATION_GRAB_STRENGTH, CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH, CLOTH_DEFORMATION_TARGET_STRENGTH, Brush::cloth_force_falloff_type, CLOTH_MAX_CONSTRAINTS_PER_VERTEX, Brush::cloth_simulation_area_type, PBVHVertexIter::co, data, fade(), Brush::flag, Brush::flag2, PBVHVertexIter::index, SculptVertexNeighborIter::index, StrokeCache::initial_radius, len_squared(), len_squared_v3v3(), StrokeCache::location, node, NULL, SculptSession::pbvh, PBVH_ITER_UNIQUE, POINTER_AS_INT, StrokeCache::radius, SCULPT_CLOTH_NODE_UNINITIALIZED, SCULPT_is_cloth_deform_brush(), Brush::sculpt_tool, SCULPT_TOOL_CLOTH, SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, and sqrtf.
Referenced by SCULPT_cloth_brush_ensure_nodes_constraints().
|
static |
Definition at line 746 of file sculpt_cloth.c.
References SculptClothSimulation::acceleration, BKE_pbvh_vert_tag_update_normal(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, BLI_ghash_lookup(), SculptSession::cache, cloth_brush_simulation_falloff_get(), cloth_brush_simulation_location_get(), cloth_brush_solve_collision(), PBVHVertexIter::co, SculptClothSimulation::collider_list, copy_v3_fl(), copy_v3_v3(), SculptClothSimulation::damping, data, PBVHVertexIter::index, SculptClothSimulation::init_pos, SculptClothSimulation::last_iteration_pos, madd_v3_v3fl(), PBVHVertexIter::mask, mul_v3_fl(), PBVHVertexIter::mvert, node, SculptClothSimulation::node_state, NULL, SculptSession::pbvh, PBVH_ITER_UNIQUE, POINTER_AS_INT, SculptClothSimulation::pos, SculptClothSimulation::prev_pos, StrokeCache::radius, SCULPT_automasking_active_cache_get(), SCULPT_automasking_factor_get(), SCULPT_CLOTH_NODE_ACTIVE, SCULPT_CLOTH_NODE_INACTIVE, and sub_v3_v3v3().
Referenced by SCULPT_cloth_brush_do_simulation_step().
PBVHNode** SCULPT_cloth_brush_affected_nodes_gather | ( | SculptSession * | ss, |
Brush * | brush, | ||
int * | r_totnode | ||
) |
Definition at line 106 of file sculpt_cloth.c.
References BKE_pbvh_search_gather(), BLI_assert, BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC, BRUSH_CLOTH_SIMULATION_AREA_GLOBAL, BRUSH_CLOTH_SIMULATION_AREA_LOCAL, SculptSession::cache, Brush::cloth_sim_limit, Brush::cloth_simulation_area_type, data, StrokeCache::initial_location, StrokeCache::initial_radius, StrokeCache::location, NULL, SculptSession::pbvh, StrokeCache::radius, SCULPT_search_sphere_cb(), Brush::sculpt_tool, SCULPT_TOOL_CLOTH, and square_f().
Referenced by do_brush_action().
void SCULPT_cloth_brush_do_simulation_step | ( | Sculpt * | sd, |
Object * | ob, | ||
SculptClothSimulation * | cloth_sim, | ||
PBVHNode ** | nodes, | ||
int | totnode | ||
) |
Definition at line 908 of file sculpt_cloth.c.
References BKE_paint_brush(), BKE_pbvh_parallel_range_settings(), BLI_task_parallel_range(), cloth_brush_satisfy_constraints(), CLOTH_SIMULATION_TIME_STEP, do_cloth_brush_solve_simulation_task_cb_ex(), Sculpt::paint, Object::sculpt, and SculptThreadedTaskData::sd.
Referenced by do_brush_action(), sculpt_cloth_filter_modal(), and SCULPT_do_cloth_brush().
void SCULPT_cloth_brush_ensure_nodes_constraints | ( | Sculpt * | sd, |
Object * | ob, | ||
PBVHNode ** | nodes, | ||
int | totnode, | ||
SculptClothSimulation * | cloth_sim, | ||
float | initial_location[3], | ||
const float | radius | ||
) |
Definition at line 1089 of file sculpt_cloth.c.
References BKE_paint_brush(), BKE_pbvh_parallel_range_settings(), BLI_edgeset_free(), BLI_edgeset_new(), BLI_task_parallel_range(), SculptClothSimulation::created_length_constraints, do_cloth_brush_build_constraints_task_cb_ex(), Sculpt::paint, and SculptThreadedTaskData::sd.
Referenced by do_brush_action(), sculpt_cloth_ensure_constraints_in_simulation_area(), and sculpt_cloth_filter_invoke().
SculptClothSimulation* SCULPT_cloth_brush_simulation_create | ( | Object * | ob, |
const float | cloth_mass, | ||
const float | cloth_damping, | ||
const float | cloth_softbody_strength, | ||
const bool | use_collisions, | ||
const bool | needs_deform_coords | ||
) |
Definition at line 1036 of file sculpt_cloth.c.
References SculptClothSimulation::acceleration, SculptClothSimulation::capacity_length_constraints, cloth_brush_collider_cache_create(), CLOTH_LENGTH_CONSTRAINTS_BLOCK, cloth_sim_initialize_default_node_state(), SculptClothSimulation::collider_list, SculptClothSimulation::damping, SculptClothSimulation::deformation_pos, SculptClothSimulation::deformation_strength, SculptSession::depsgraph, SculptClothSimulation::init_pos, SculptClothSimulation::last_iteration_pos, SculptClothSimulation::length_constraint_tweak, SculptClothSimulation::length_constraints, SculptClothSimulation::mass, MEM_calloc_arrayN, MEM_callocN, SculptClothSimulation::pos, SculptClothSimulation::prev_pos, Object::sculpt, SCULPT_vertex_count_get(), SculptClothSimulation::softbody_pos, and SculptClothSimulation::softbody_strength.
Referenced by do_brush_action(), sculpt_cloth_filter_invoke(), and SCULPT_do_cloth_brush().
void SCULPT_cloth_brush_simulation_init | ( | SculptSession * | ss, |
SculptClothSimulation * | cloth_sim | ||
) |
Definition at line 1126 of file sculpt_cloth.c.
References copy_v3_v3(), SculptClothSimulation::deformation_pos, SculptClothSimulation::deformation_strength, SculptClothSimulation::init_pos, SculptClothSimulation::last_iteration_pos, NULL, SculptClothSimulation::prev_pos, SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), and SculptClothSimulation::softbody_pos.
Referenced by do_brush_action(), sculpt_cloth_filter_invoke(), and SCULPT_do_cloth_brush().
void SCULPT_cloth_brush_store_simulation_state | ( | SculptSession * | ss, |
SculptClothSimulation * | cloth_sim | ||
) |
Definition at line 1145 of file sculpt_cloth.c.
References copy_v3_v3(), SculptClothSimulation::pos, SCULPT_vertex_co_get(), and SCULPT_vertex_count_get().
Referenced by do_brush_action(), and SCULPT_do_cloth_brush().
|
static |
Definition at line 1164 of file sculpt_cloth.c.
References BKE_paint_brush(), SculptSession::cache, cloth_brush_simulation_location_get(), StrokeCache::cloth_sim, Brush::cloth_sim_limit, StrokeCache::initial_radius, Sculpt::paint, Object::sculpt, and SCULPT_cloth_brush_ensure_nodes_constraints().
Referenced by SCULPT_do_cloth_brush().
|
static |
Definition at line 1551 of file sculpt_cloth.c.
References FilterCache::active_face_set, FilterCache::automasking, BKE_sculpt_update_object_for_edit(), C, CLOTH_FILTER_FORCE_X, CLOTH_FILTER_FORCE_Y, CLOTH_FILTER_FORCE_Z, cloth_filter_is_deformation_filter(), FilterCache::cloth_sim, FilterCache::cloth_sim_pinch_point, copy_v3_v3(), CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_tool_settings(), depsgraph, FilterCache::enabled_force_axis, SculptSession::filter_cache, wmEvent::mval, FilterCache::nodes, NULL, OPERATOR_RUNNING_MODAL, FilterCache::orientation, wmOperator::ptr, RNA_boolean_get(), RNA_enum_get(), RNA_float_get(), Object::sculpt, ToolSettings::sculpt, SCULPT_active_face_set_get(), SCULPT_active_vertex_co_get(), SCULPT_automasking_cache_init(), SCULPT_cloth_brush_ensure_nodes_constraints(), SCULPT_cloth_brush_simulation_create(), SCULPT_cloth_brush_simulation_init(), SCULPT_cursor_geometry_info_update(), SCULPT_FACE_SET_NONE, SCULPT_filter_cache_init(), SCULPT_UNDO_COORDS, SCULPT_undo_push_begin(), SCULPT_vertex_random_access_ensure(), FilterCache::totnode, UNPACK2, and WM_event_add_modal_handler().
Referenced by SCULPT_OT_cloth_filter().
|
static |
Definition at line 1490 of file sculpt_cloth.c.
References BKE_pbvh_parallel_range_settings(), BKE_sculpt_update_object_for_edit(), BLI_task_parallel_range(), C, cloth_filter_apply_forces_task_cb(), FilterCache::cloth_sim, copy_v3_v3(), CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_tool_settings(), data, SculptSession::deform_modifiers_active, depsgraph, SculptSession::filter_cache, KM_RELEASE, LEFTMOUSE, len, MOUSEMOVE, FilterCache::nodes, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, SculptClothSimulation::pos, wmOperator::ptr, RNA_enum_get(), RNA_float_get(), Object::sculpt, ToolSettings::sculpt, SCULPT_cloth_brush_do_simulation_step(), SCULPT_cloth_sim_activate_nodes(), SCULPT_filter_cache_free(), SCULPT_flush_stroke_deform(), SCULPT_flush_update_done(), SCULPT_flush_update_step(), SCULPT_undo_push_end(), SCULPT_UPDATE_COORDS, SCULPT_vertex_co_get(), SCULPT_vertex_count_get(), SCULPT_vertex_random_access_ensure(), SculptSession::shapekey_active, FilterCache::totnode, wmEvent::type, UI_DPI_FAC, and wmEvent::val.
Referenced by SCULPT_OT_cloth_filter().
void SCULPT_cloth_plane_falloff_preview_draw | ( | const uint | gpuattr, |
SculptSession * | ss, | ||
const float | outline_col[3], | ||
float | outline_alpha | ||
) |
Definition at line 1283 of file sculpt_cloth.c.
References add_v3_v3v3(), StrokeCache::brush, BRUSH_CLOTH_DEFORM_GRAB, SculptSession::cache, Brush::cloth_deform_type, copy_m4_m4(), GPU_line_width(), GPU_matrix_mul, GPU_PRIM_LINES, GPU_PRIM_TRIS, StrokeCache::grab_delta, immBegin(), immEnd(), immUniformColor3fvAlpha(), immVertex3f(), StrokeCache::radius, StrokeCache::stroke_local_mat, and StrokeCache::true_location.
Referenced by paint_cursor_cursor_draw_3d_view_brush_cursor_active().
void SCULPT_cloth_sim_activate_nodes | ( | SculptClothSimulation * | cloth_sim, |
PBVHNode ** | nodes, | ||
int | totnode | ||
) |
Definition at line 1153 of file sculpt_cloth.c.
References BLI_ghash_lookup(), SculptClothSimulation::node_state, SculptClothSimulation::node_state_index, POINTER_AS_INT, and SCULPT_CLOTH_NODE_ACTIVE.
Referenced by do_brush_action(), sculpt_cloth_filter_modal(), and SCULPT_do_cloth_brush().
void SCULPT_cloth_simulation_free | ( | struct SculptClothSimulation * | cloth_sim | ) |
Definition at line 1234 of file sculpt_cloth.c.
References SculptClothSimulation::acceleration, BKE_collider_cache_free(), BLI_ghash_free(), SculptClothSimulation::collider_list, SculptClothSimulation::deformation_pos, SculptClothSimulation::deformation_strength, SculptClothSimulation::init_pos, SculptClothSimulation::last_iteration_pos, SculptClothSimulation::length_constraint_tweak, SculptClothSimulation::length_constraints, MEM_SAFE_FREE, SculptClothSimulation::node_state, SculptClothSimulation::node_state_index, NULL, SculptClothSimulation::pos, SculptClothSimulation::prev_pos, and SculptClothSimulation::softbody_pos.
Referenced by SCULPT_cache_free(), and SCULPT_filter_cache_free().
void SCULPT_cloth_simulation_limits_draw | ( | const uint | gpuattr, |
const Brush * | brush, | ||
const float | location[3], | ||
const float | normal[3], | ||
const float | rds, | ||
const float | line_width, | ||
const float | outline_col[3], | ||
const float | alpha | ||
) |
Definition at line 1254 of file sculpt_cloth.c.
References Brush::cloth_sim_falloff, Brush::cloth_sim_limit, GPU_line_width(), GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), imm_draw_circle_dashed_3d(), imm_draw_circle_wire_3d(), immUniformColor3fvAlpha(), normal, quat_to_mat4(), rotation_between_vecs_to_quat(), translate_m4(), and unit_m4().
Referenced by paint_cursor_cursor_draw_3d_view_brush_cursor_active(), and paint_cursor_draw_3d_view_brush_cursor_inactive().
Definition at line 1179 of file sculpt_cloth.c.
References BKE_paint_brush(), BRUSH_CLOTH_SIMULATION_AREA_LOCAL, BRUSH_CLOTH_USE_COLLISION, SculptSession::cache, cloth_brush_apply_brush_foces(), Brush::cloth_constraint_softbody_strength, Brush::cloth_damping, Brush::cloth_mass, StrokeCache::cloth_sim, Brush::cloth_simulation_area_type, Brush::flag2, Sculpt::paint, Object::sculpt, SCULPT_cloth_brush_do_simulation_step(), SCULPT_cloth_brush_simulation_create(), SCULPT_cloth_brush_simulation_init(), SCULPT_cloth_brush_store_simulation_state(), sculpt_cloth_ensure_constraints_in_simulation_area(), SCULPT_cloth_sim_activate_nodes(), SCULPT_is_cloth_deform_brush(), SCULPT_stroke_is_first_brush_step(), and SCULPT_stroke_is_first_brush_step_of_symmetry_pass().
Referenced by do_brush_action().
void SCULPT_OT_cloth_filter | ( | struct wmOperatorType * | ot | ) |
Definition at line 1619 of file sculpt_cloth.c.
References CLOTH_FILTER_FORCE_X, CLOTH_FILTER_FORCE_Y, CLOTH_FILTER_FORCE_Z, CLOTH_FILTER_GRAVITY, wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, wmOperatorType::prop, prop_cloth_filter_force_axis_items, prop_cloth_filter_orientation_items, prop_cloth_filter_type, RNA_def_boolean(), RNA_def_enum(), RNA_def_enum_flag(), RNA_def_float(), sculpt_cloth_filter_invoke(), sculpt_cloth_filter_modal(), SCULPT_FILTER_ORIENTATION_LOCAL, SCULPT_mode_poll(), and wmOperatorType::srna.
Referenced by ED_operatortypes_sculpt().
|
static |
Definition at line 1368 of file sculpt_cloth.c.
Referenced by SCULPT_OT_cloth_filter().
|
static |
Definition at line 1343 of file sculpt_cloth.c.
Referenced by SCULPT_OT_cloth_filter().
|
static |
Definition at line 1330 of file sculpt_cloth.c.
Referenced by SCULPT_OT_cloth_filter().