Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_cloth.c
| Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, | ||||
| } | } | ||||
| /* Gravity */ | /* Gravity */ | ||||
| float gravity[3] = {0.0f}; | float gravity[3] = {0.0f}; | ||||
| if (ss->cache->supports_gravity) { | if (ss->cache->supports_gravity) { | ||||
| madd_v3_v3fl(gravity, ss->cache->gravity_direction, -data->sd->gravity_factor); | madd_v3_v3fl(gravity, ss->cache->gravity_direction, -data->sd->gravity_factor); | ||||
| } | } | ||||
| AutomaskingNodeData automask_data; | |||||
| SCULPT_automasking_node_begin( | |||||
| data->ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, data->nodes[n]); | |||||
| BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| float force[3]; | float force[3]; | ||||
| float sim_location[3]; | float sim_location[3]; | ||||
| cloth_brush_simulation_location_get(ss, brush, sim_location); | cloth_brush_simulation_location_get(ss, brush, sim_location); | ||||
| const float sim_factor = cloth_brush_simulation_falloff_get( | const float sim_factor = cloth_brush_simulation_falloff_get( | ||||
| brush, ss->cache->radius, sim_location, cloth_sim->init_pos[vd.index]); | brush, ss->cache->radius, sim_location, cloth_sim->init_pos[vd.index]); | ||||
| float current_vertex_location[3]; | float current_vertex_location[3]; | ||||
| if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB) { | if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB) { | ||||
| Show All 23 Lines | const float fade = sim_factor * bstrength * | ||||
| SCULPT_brush_strength_factor(ss, | SCULPT_brush_strength_factor(ss, | ||||
| brush, | brush, | ||||
| current_vertex_location, | current_vertex_location, | ||||
| dist, | dist, | ||||
| vd.no, | vd.no, | ||||
| vd.fno, | vd.fno, | ||||
| vd.mask ? *vd.mask : 0.0f, | vd.mask ? *vd.mask : 0.0f, | ||||
| vd.vertex, | vd.vertex, | ||||
| thread_id); | thread_id, | ||||
| &automask_data); | |||||
| float brush_disp[3]; | float brush_disp[3]; | ||||
| switch (brush->cloth_deform_type) { | switch (brush->cloth_deform_type) { | ||||
| case BRUSH_CLOTH_DEFORM_DRAG: | case BRUSH_CLOTH_DEFORM_DRAG: | ||||
| sub_v3_v3v3(brush_disp, ss->cache->location, ss->cache->last_location); | sub_v3_v3v3(brush_disp, ss->cache->location, ss->cache->last_location); | ||||
| normalize_v3(brush_disp); | normalize_v3(brush_disp); | ||||
| mul_v3_v3fl(force, brush_disp, fade); | mul_v3_v3fl(force, brush_disp, fade); | ||||
| ▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | static void do_cloth_brush_solve_simulation_task_cb_ex( | ||||
| const float time_step = data->cloth_time_step; | const float time_step = data->cloth_time_step; | ||||
| const int node_index = POINTER_AS_INT(BLI_ghash_lookup(data->cloth_sim->node_state_index, node)); | const int node_index = POINTER_AS_INT(BLI_ghash_lookup(data->cloth_sim->node_state_index, node)); | ||||
| if (data->cloth_sim->node_state[node_index] != SCULPT_CLOTH_NODE_ACTIVE) { | if (data->cloth_sim->node_state[node_index] != SCULPT_CLOTH_NODE_ACTIVE) { | ||||
| return; | return; | ||||
| } | } | ||||
| AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss); | AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss); | ||||
| AutomaskingNodeData automask_data; | |||||
| SCULPT_automasking_node_begin( | |||||
| data->ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, data->nodes[n]); | |||||
| BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| float sim_location[3]; | float sim_location[3]; | ||||
| cloth_brush_simulation_location_get(ss, brush, sim_location); | cloth_brush_simulation_location_get(ss, brush, sim_location); | ||||
| const float sim_factor = | const float sim_factor = | ||||
| ss->cache ? cloth_brush_simulation_falloff_get( | ss->cache ? cloth_brush_simulation_falloff_get( | ||||
| brush, ss->cache->radius, sim_location, cloth_sim->init_pos[vd.index]) : | brush, ss->cache->radius, sim_location, cloth_sim->init_pos[vd.index]) : | ||||
| 1.0f; | 1.0f; | ||||
| if (sim_factor <= 0.0f) { | if (sim_factor <= 0.0f) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| int i = vd.index; | int i = vd.index; | ||||
| float temp[3]; | float temp[3]; | ||||
| copy_v3_v3(temp, cloth_sim->pos[i]); | copy_v3_v3(temp, cloth_sim->pos[i]); | ||||
| mul_v3_fl(cloth_sim->acceleration[i], time_step); | mul_v3_fl(cloth_sim->acceleration[i], time_step); | ||||
| float pos_diff[3]; | float pos_diff[3]; | ||||
| sub_v3_v3v3(pos_diff, cloth_sim->pos[i], cloth_sim->prev_pos[i]); | sub_v3_v3v3(pos_diff, cloth_sim->pos[i], cloth_sim->prev_pos[i]); | ||||
| mul_v3_fl(pos_diff, (1.0f - cloth_sim->damping) * sim_factor); | mul_v3_fl(pos_diff, (1.0f - cloth_sim->damping) * sim_factor); | ||||
| const float mask_v = (1.0f - (vd.mask ? *vd.mask : 0.0f)) * | const float mask_v = (1.0f - (vd.mask ? *vd.mask : 0.0f)) * | ||||
| SCULPT_automasking_factor_get(automasking, ss, vd.vertex); | SCULPT_automasking_factor_get(automasking, ss, vd.vertex, &automask_data); | ||||
| madd_v3_v3fl(cloth_sim->pos[i], pos_diff, mask_v); | madd_v3_v3fl(cloth_sim->pos[i], pos_diff, mask_v); | ||||
| madd_v3_v3fl(cloth_sim->pos[i], cloth_sim->acceleration[i], mask_v); | madd_v3_v3fl(cloth_sim->pos[i], cloth_sim->acceleration[i], mask_v); | ||||
| if (cloth_sim->collider_list != NULL) { | if (cloth_sim->collider_list != NULL) { | ||||
| cloth_brush_solve_collision(data->ob, cloth_sim, i); | cloth_brush_solve_collision(data->ob, cloth_sim, i); | ||||
| } | } | ||||
| Show All 16 Lines | |||||
| } | } | ||||
| static void cloth_brush_satisfy_constraints(SculptSession *ss, | static void cloth_brush_satisfy_constraints(SculptSession *ss, | ||||
| Brush *brush, | Brush *brush, | ||||
| SculptClothSimulation *cloth_sim) | SculptClothSimulation *cloth_sim) | ||||
| { | { | ||||
| AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss); | AutomaskingCache *automasking = SCULPT_automasking_active_cache_get(ss); | ||||
| AutomaskingNodeData automask_data = {0}; | |||||
| automask_data.have_orig_data = true; | |||||
| for (int constraint_it = 0; constraint_it < CLOTH_SIMULATION_ITERATIONS; constraint_it++) { | for (int constraint_it = 0; constraint_it < CLOTH_SIMULATION_ITERATIONS; constraint_it++) { | ||||
| for (int i = 0; i < cloth_sim->tot_length_constraints; i++) { | for (int i = 0; i < cloth_sim->tot_length_constraints; i++) { | ||||
| const SculptClothLengthConstraint *constraint = &cloth_sim->length_constraints[i]; | const SculptClothLengthConstraint *constraint = &cloth_sim->length_constraints[i]; | ||||
| if (cloth_sim->node_state[constraint->node] != SCULPT_CLOTH_NODE_ACTIVE) { | if (cloth_sim->node_state[constraint->node] != SCULPT_CLOTH_NODE_ACTIVE) { | ||||
| /* Skip all constraints that were created for inactive nodes. */ | /* Skip all constraints that were created for inactive nodes. */ | ||||
| continue; | continue; | ||||
| Show All 22 Lines | for (int i = 0; i < cloth_sim->tot_length_constraints; i++) { | ||||
| mul_v3_v3fl(correction_vector, v1_to_v2, CLOTH_SOLVER_DISPLACEMENT_FACTOR); | mul_v3_v3fl(correction_vector, v1_to_v2, CLOTH_SOLVER_DISPLACEMENT_FACTOR); | ||||
| } | } | ||||
| mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f); | mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f); | ||||
| PBVHVertRef vertex1 = BKE_pbvh_index_to_vertex(ss->pbvh, v1); | PBVHVertRef vertex1 = BKE_pbvh_index_to_vertex(ss->pbvh, v1); | ||||
| PBVHVertRef vertex2 = BKE_pbvh_index_to_vertex(ss->pbvh, v2); | PBVHVertRef vertex2 = BKE_pbvh_index_to_vertex(ss->pbvh, v2); | ||||
| automask_data.orig_data.co = cloth_sim->init_pos[v1]; | |||||
| automask_data.orig_data.no = cloth_sim->init_no[v1]; | |||||
| const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, vertex1)) * | const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, vertex1)) * | ||||
| SCULPT_automasking_factor_get(automasking, ss, vertex1); | SCULPT_automasking_factor_get( | ||||
| automasking, ss, vertex1, &automask_data); | |||||
| automask_data.orig_data.co = cloth_sim->init_pos[v2]; | |||||
| automask_data.orig_data.no = cloth_sim->init_no[v2]; | |||||
| const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, vertex2)) * | const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, vertex2)) * | ||||
| SCULPT_automasking_factor_get(automasking, ss, vertex2); | SCULPT_automasking_factor_get( | ||||
| automasking, ss, vertex2, &automask_data); | |||||
| float sim_location[3]; | float sim_location[3]; | ||||
| cloth_brush_simulation_location_get(ss, brush, sim_location); | cloth_brush_simulation_location_get(ss, brush, sim_location); | ||||
| const float sim_factor_v1 = ss->cache ? | const float sim_factor_v1 = ss->cache ? | ||||
| cloth_brush_simulation_falloff_get(brush, | cloth_brush_simulation_falloff_get(brush, | ||||
| ss->cache->radius, | ss->cache->radius, | ||||
| sim_location, | sim_location, | ||||
| ▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | SculptClothSimulation *SCULPT_cloth_brush_simulation_create(Object *ob, | ||||
| cloth_sim->acceleration = MEM_calloc_arrayN( | cloth_sim->acceleration = MEM_calloc_arrayN( | ||||
| totverts, sizeof(float[3]), "cloth sim acceleration"); | totverts, sizeof(float[3]), "cloth sim acceleration"); | ||||
| cloth_sim->pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim pos"); | cloth_sim->pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim pos"); | ||||
| cloth_sim->prev_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim prev pos"); | cloth_sim->prev_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim prev pos"); | ||||
| cloth_sim->last_iteration_pos = MEM_calloc_arrayN( | cloth_sim->last_iteration_pos = MEM_calloc_arrayN( | ||||
| totverts, sizeof(float[3]), "cloth sim last iteration pos"); | totverts, sizeof(float[3]), "cloth sim last iteration pos"); | ||||
| cloth_sim->init_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim init pos"); | cloth_sim->init_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim init pos"); | ||||
| cloth_sim->init_no = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim init normals"); | |||||
| cloth_sim->length_constraint_tweak = MEM_calloc_arrayN( | cloth_sim->length_constraint_tweak = MEM_calloc_arrayN( | ||||
| totverts, sizeof(float), "cloth sim length tweak"); | totverts, sizeof(float), "cloth sim length tweak"); | ||||
| if (needs_deform_coords) { | if (needs_deform_coords) { | ||||
| cloth_sim->deformation_pos = MEM_calloc_arrayN( | cloth_sim->deformation_pos = MEM_calloc_arrayN( | ||||
| totverts, sizeof(float[3]), "cloth sim deformation positions"); | totverts, sizeof(float[3]), "cloth sim deformation positions"); | ||||
| cloth_sim->deformation_strength = MEM_calloc_arrayN( | cloth_sim->deformation_strength = MEM_calloc_arrayN( | ||||
| totverts, sizeof(float), "cloth sim deformation strength"); | totverts, sizeof(float), "cloth sim deformation strength"); | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | void SCULPT_cloth_brush_simulation_init(SculptSession *ss, SculptClothSimulation *cloth_sim) | ||||
| const int totverts = SCULPT_vertex_count_get(ss); | const int totverts = SCULPT_vertex_count_get(ss); | ||||
| const bool has_deformation_pos = cloth_sim->deformation_pos != NULL; | const bool has_deformation_pos = cloth_sim->deformation_pos != NULL; | ||||
| const bool has_softbody_pos = cloth_sim->softbody_pos != NULL; | const bool has_softbody_pos = cloth_sim->softbody_pos != NULL; | ||||
| for (int i = 0; i < totverts; i++) { | for (int i = 0; i < totverts; i++) { | ||||
| PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); | PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); | ||||
| copy_v3_v3(cloth_sim->last_iteration_pos[i], SCULPT_vertex_co_get(ss, vertex)); | copy_v3_v3(cloth_sim->last_iteration_pos[i], SCULPT_vertex_co_get(ss, vertex)); | ||||
| copy_v3_v3(cloth_sim->init_pos[i], SCULPT_vertex_co_get(ss, vertex)); | copy_v3_v3(cloth_sim->init_pos[i], SCULPT_vertex_co_get(ss, vertex)); | ||||
| SCULPT_vertex_normal_get(ss, vertex, cloth_sim->init_no[i]); | |||||
| copy_v3_v3(cloth_sim->prev_pos[i], SCULPT_vertex_co_get(ss, vertex)); | copy_v3_v3(cloth_sim->prev_pos[i], SCULPT_vertex_co_get(ss, vertex)); | ||||
| if (has_deformation_pos) { | if (has_deformation_pos) { | ||||
| copy_v3_v3(cloth_sim->deformation_pos[i], SCULPT_vertex_co_get(ss, vertex)); | copy_v3_v3(cloth_sim->deformation_pos[i], SCULPT_vertex_co_get(ss, vertex)); | ||||
| cloth_sim->deformation_strength[i] = 1.0f; | cloth_sim->deformation_strength[i] = 1.0f; | ||||
| } | } | ||||
| if (has_softbody_pos) { | if (has_softbody_pos) { | ||||
| copy_v3_v3(cloth_sim->softbody_pos[i], SCULPT_vertex_co_get(ss, vertex)); | copy_v3_v3(cloth_sim->softbody_pos[i], SCULPT_vertex_co_get(ss, vertex)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim) | ||||
| MEM_SAFE_FREE(cloth_sim->last_iteration_pos); | MEM_SAFE_FREE(cloth_sim->last_iteration_pos); | ||||
| MEM_SAFE_FREE(cloth_sim->prev_pos); | MEM_SAFE_FREE(cloth_sim->prev_pos); | ||||
| MEM_SAFE_FREE(cloth_sim->acceleration); | MEM_SAFE_FREE(cloth_sim->acceleration); | ||||
| MEM_SAFE_FREE(cloth_sim->length_constraints); | MEM_SAFE_FREE(cloth_sim->length_constraints); | ||||
| MEM_SAFE_FREE(cloth_sim->length_constraint_tweak); | MEM_SAFE_FREE(cloth_sim->length_constraint_tweak); | ||||
| MEM_SAFE_FREE(cloth_sim->deformation_pos); | MEM_SAFE_FREE(cloth_sim->deformation_pos); | ||||
| MEM_SAFE_FREE(cloth_sim->softbody_pos); | MEM_SAFE_FREE(cloth_sim->softbody_pos); | ||||
| MEM_SAFE_FREE(cloth_sim->init_pos); | MEM_SAFE_FREE(cloth_sim->init_pos); | ||||
| MEM_SAFE_FREE(cloth_sim->init_no); | |||||
| MEM_SAFE_FREE(cloth_sim->deformation_strength); | MEM_SAFE_FREE(cloth_sim->deformation_strength); | ||||
| MEM_SAFE_FREE(cloth_sim->node_state); | MEM_SAFE_FREE(cloth_sim->node_state); | ||||
| BLI_ghash_free(cloth_sim->node_state_index, NULL, NULL); | BLI_ghash_free(cloth_sim->node_state_index, NULL, NULL); | ||||
| if (cloth_sim->collider_list) { | if (cloth_sim->collider_list) { | ||||
| BKE_collider_cache_free(&cloth_sim->collider_list); | BKE_collider_cache_free(&cloth_sim->collider_list); | ||||
| } | } | ||||
| MEM_SAFE_FREE(cloth_sim); | MEM_SAFE_FREE(cloth_sim); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | static void cloth_filter_apply_forces_task_cb(void *__restrict userdata, | ||||
| float sculpt_gravity[3] = {0.0f}; | float sculpt_gravity[3] = {0.0f}; | ||||
| if (sd->gravity_object) { | if (sd->gravity_object) { | ||||
| copy_v3_v3(sculpt_gravity, sd->gravity_object->obmat[2]); | copy_v3_v3(sculpt_gravity, sd->gravity_object->obmat[2]); | ||||
| } | } | ||||
| else { | else { | ||||
| sculpt_gravity[2] = -1.0f; | sculpt_gravity[2] = -1.0f; | ||||
| } | } | ||||
| mul_v3_fl(sculpt_gravity, sd->gravity_factor * data->filter_strength); | mul_v3_fl(sculpt_gravity, sd->gravity_factor * data->filter_strength); | ||||
| AutomaskingNodeData automask_data; | |||||
| SCULPT_automasking_node_begin( | |||||
| data->ob, ss, SCULPT_automasking_active_cache_get(ss), &automask_data, node); | |||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { | BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| float fade = vd.mask ? *vd.mask : 0.0f; | float fade = vd.mask ? *vd.mask : 0.0f; | ||||
| fade *= SCULPT_automasking_factor_get(ss->filter_cache->automasking, ss, vd.vertex); | fade *= SCULPT_automasking_factor_get( | ||||
| ss->filter_cache->automasking, ss, vd.vertex, &automask_data); | |||||
| fade = 1.0f - fade; | fade = 1.0f - fade; | ||||
| float force[3] = {0.0f, 0.0f, 0.0f}; | float force[3] = {0.0f, 0.0f, 0.0f}; | ||||
| float disp[3], temp[3], transform[3][3]; | float disp[3], temp[3], transform[3][3]; | ||||
| if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) { | if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) { | ||||
| if (!SCULPT_vertex_has_face_set(ss, vd.vertex, ss->filter_cache->active_face_set)) { | if (!SCULPT_vertex_has_face_set(ss, vd.vertex, ss->filter_cache->active_face_set)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| SculptCursorGeometryInfo sgi; | SculptCursorGeometryInfo sgi; | ||||
| SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false); | SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false); | ||||
| SCULPT_vertex_random_access_ensure(ss); | SCULPT_vertex_random_access_ensure(ss); | ||||
| /* Needs mask data to be available as it is used when solving the constraints. */ | /* Needs mask data to be available as it is used when solving the constraints. */ | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | ||||
| SCULPT_stroke_id_next(ob); | |||||
| SCULPT_undo_push_begin(ob, op); | SCULPT_undo_push_begin(ob, op); | ||||
| SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS); | SCULPT_filter_cache_init( | ||||
| C, ob, sd, SCULPT_UNDO_COORDS, event->mval, RNA_float_get(op->ptr, "area_normal_radius")); | |||||
| ss->filter_cache->automasking = SCULPT_automasking_cache_init(sd, NULL, ob); | ss->filter_cache->automasking = SCULPT_automasking_cache_init(sd, NULL, ob); | ||||
| const float cloth_mass = RNA_float_get(op->ptr, "cloth_mass"); | const float cloth_mass = RNA_float_get(op->ptr, "cloth_mass"); | ||||
| const float cloth_damping = RNA_float_get(op->ptr, "cloth_damping"); | const float cloth_damping = RNA_float_get(op->ptr, "cloth_damping"); | ||||
| const bool use_collisions = RNA_boolean_get(op->ptr, "use_collisions"); | const bool use_collisions = RNA_boolean_get(op->ptr, "use_collisions"); | ||||
| ss->filter_cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ss->filter_cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ||||
| ob, | ob, | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | void SCULPT_OT_cloth_filter(struct wmOperatorType *ot) | ||||
| /* API callbacks. */ | /* API callbacks. */ | ||||
| ot->invoke = sculpt_cloth_filter_invoke; | ot->invoke = sculpt_cloth_filter_invoke; | ||||
| ot->modal = sculpt_cloth_filter_modal; | ot->modal = sculpt_cloth_filter_modal; | ||||
| ot->poll = SCULPT_mode_poll; | ot->poll = SCULPT_mode_poll; | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* RNA. */ | /* RNA. */ | ||||
| SCULPT_mesh_filter_properties(ot); | |||||
| RNA_def_enum(ot->srna, | RNA_def_enum(ot->srna, | ||||
| "type", | "type", | ||||
| prop_cloth_filter_type, | prop_cloth_filter_type, | ||||
| CLOTH_FILTER_GRAVITY, | CLOTH_FILTER_GRAVITY, | ||||
| "Filter Type", | "Filter Type", | ||||
| "Operation that is going to be applied to the mesh"); | "Operation that is going to be applied to the mesh"); | ||||
| RNA_def_float( | |||||
| ot->srna, "strength", 1.0f, -10.0f, 10.0f, "Strength", "Filter strength", -10.0f, 10.0f); | |||||
| RNA_def_enum_flag(ot->srna, | RNA_def_enum_flag(ot->srna, | ||||
| "force_axis", | "force_axis", | ||||
| prop_cloth_filter_force_axis_items, | prop_cloth_filter_force_axis_items, | ||||
| CLOTH_FILTER_FORCE_X | CLOTH_FILTER_FORCE_Y | CLOTH_FILTER_FORCE_Z, | CLOTH_FILTER_FORCE_X | CLOTH_FILTER_FORCE_Y | CLOTH_FILTER_FORCE_Z, | ||||
| "Force Axis", | "Force Axis", | ||||
| "Apply the force in the selected axis"); | "Apply the force in the selected axis"); | ||||
| RNA_def_enum(ot->srna, | RNA_def_enum(ot->srna, | ||||
| "orientation", | "orientation", | ||||
| Show All 33 Lines | |||||