Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 3,515 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Brush *brush = BKE_paint_brush(&sd->paint); | Brush *brush = BKE_paint_brush(&sd->paint); | ||||
| float grab_delta[3], rot_quat[4], initial_v[3], current_v[3], temp[3]; | float grab_delta[3], rot_quat[4], initial_v[3], current_v[3], temp[3]; | ||||
| float pose_origin[3]; | float pose_origin[3]; | ||||
| float pose_initial_co[3]; | float pose_initial_co[3]; | ||||
| float transform_rot[4][4], transform_trans[4][4], transform_trans_inv[4][4]; | float transform_rot[4][4], transform_trans[4][4], transform_trans_inv[4][4]; | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return; | |||||
| } | |||||
| copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry); | copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry); | ||||
| copy_v3_v3(pose_origin, ss->cache->pose_origin); | copy_v3_v3(pose_origin, ss->cache->pose_origin); | ||||
| flip_v3(pose_origin, (char)ss->cache->mirror_symmetry_pass); | flip_v3(pose_origin, (char)ss->cache->mirror_symmetry_pass); | ||||
| copy_v3_v3(pose_initial_co, ss->cache->pose_initial_co); | copy_v3_v3(pose_initial_co, ss->cache->pose_initial_co); | ||||
| flip_v3(pose_initial_co, (char)ss->cache->mirror_symmetry_pass); | flip_v3(pose_initial_co, (char)ss->cache->mirror_symmetry_pass); | ||||
| ▲ Show 20 Lines • Show All 1,535 Lines • ▼ Show 20 Lines | if (totnode) { | ||||
| if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0) { | if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0) { | ||||
| if (sculpt_automasking_enabled(ss, brush)) { | if (sculpt_automasking_enabled(ss, brush)) { | ||||
| sculpt_automasking_init(sd, ob); | sculpt_automasking_init(sd, ob); | ||||
| } | } | ||||
| } | } | ||||
| if (brush->sculpt_tool == SCULPT_TOOL_POSE && ss->cache->first_time && | if (brush->sculpt_tool == SCULPT_TOOL_POSE && ss->cache->first_time && | ||||
| ss->cache->mirror_symmetry_pass == 0) { | ss->cache->mirror_symmetry_pass == 0) { | ||||
| if (BKE_pbvh_type(ss->pbvh) != PBVH_GRIDS) { | |||||
| sculpt_pose_brush_init(sd, ob, ss, brush); | sculpt_pose_brush_init(sd, ob, ss, brush); | ||||
| } | } | ||||
| } | |||||
| /* Apply one type of brush action */ | /* Apply one type of brush action */ | ||||
| switch (brush->sculpt_tool) { | switch (brush->sculpt_tool) { | ||||
| case SCULPT_TOOL_DRAW: | case SCULPT_TOOL_DRAW: | ||||
| do_draw_brush(sd, ob, nodes, totnode); | do_draw_brush(sd, ob, nodes, totnode); | ||||
| break; | break; | ||||
| case SCULPT_TOOL_SMOOTH: | case SCULPT_TOOL_SMOOTH: | ||||
| do_smooth_brush(sd, ob, nodes, totnode); | do_smooth_brush(sd, ob, nodes, totnode); | ||||
| ▲ Show 20 Lines • Show All 3,046 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| int filter_type = RNA_enum_get(op->ptr, "type"); | int filter_type = RNA_enum_get(op->ptr, "type"); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return OPERATOR_CANCELLED; | |||||
| } | |||||
| int deform_axis = RNA_enum_get(op->ptr, "deform_axis"); | int deform_axis = RNA_enum_get(op->ptr, "deform_axis"); | ||||
| if (deform_axis == 0) { | if (deform_axis == 0) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| sculpt_vertex_random_access_init(ss); | sculpt_vertex_random_access_init(ss); | ||||
| bool needs_pmap = (filter_type == MESH_FILTER_SMOOTH); | bool needs_pmap = (filter_type == MESH_FILTER_SMOOTH); | ||||
| ▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | static int sculpt_mask_filter_exec(bContext *C, wmOperator *op) | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| int totnode; | int totnode; | ||||
| int filter_type = RNA_enum_get(op->ptr, "filter_type"); | int filter_type = RNA_enum_get(op->ptr, "filter_type"); | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return OPERATOR_CANCELLED; | |||||
| } | |||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | ||||
| sculpt_vertex_random_access_init(ss); | sculpt_vertex_random_access_init(ss); | ||||
| if (!ob->sculpt->pmap) { | if (!ob->sculpt->pmap) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op) | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| int totnode; | int totnode; | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return OPERATOR_CANCELLED; | |||||
| } | |||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | ||||
| sculpt_vertex_random_access_init(ss); | sculpt_vertex_random_access_init(ss); | ||||
| if (!ob->sculpt->pmap) { | if (!ob->sculpt->pmap) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| bool use_normals = RNA_boolean_get(op->ptr, "use_normals"); | bool use_normals = RNA_boolean_get(op->ptr, "use_normals"); | ||||
| int edge_sensitivity = RNA_int_get(op->ptr, "edge_sensitivity"); | int edge_sensitivity = RNA_int_get(op->ptr, "edge_sensitivity"); | ||||
| SculptCursorGeometryInfo sgi; | SculptCursorGeometryInfo sgi; | ||||
| float mouse[2]; | float mouse[2]; | ||||
| mouse[0] = event->mval[0]; | mouse[0] = event->mval[0]; | ||||
| mouse[1] = event->mval[1]; | mouse[1] = event->mval[1]; | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return OPERATOR_CANCELLED; | |||||
| } | |||||
| sculpt_vertex_random_access_init(ss); | sculpt_vertex_random_access_init(ss); | ||||
| op->customdata = MEM_mallocN(2 * sizeof(float), "initial mouse position"); | op->customdata = MEM_mallocN(2 * sizeof(float), "initial mouse position"); | ||||
| copy_v2_v2(op->customdata, mouse); | copy_v2_v2(op->customdata, mouse); | ||||
| sculpt_cursor_geometry_info_update(C, &sgi, mouse, false); | sculpt_cursor_geometry_info_update(C, &sgi, mouse, false); | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true); | ||||
| ▲ Show 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| ARegion *ar = CTX_wm_region(C); | ARegion *ar = CTX_wm_region(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL; | const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL; | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| return OPERATOR_CANCELLED; | |||||
| } | |||||
| int mode = RNA_enum_get(op->ptr, "mode"); | int mode = RNA_enum_get(op->ptr, "mode"); | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true); | BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true); | ||||
| int vert_count = sculpt_vertex_count_get(ss); | int vert_count = sculpt_vertex_count_get(ss); | ||||
| /* Pivot to center */ | /* Pivot to center */ | ||||
| if (mode == SCULPT_PIVOT_POSITION_ORIGIN) { | if (mode == SCULPT_PIVOT_POSITION_ORIGIN) { | ||||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||