diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 9 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 14 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 15 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 3 |
5 files changed, 28 insertions, 16 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e227db1c644..fd5018f76ff 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1130,9 +1130,6 @@ static bool texture_paint_toggle_poll(bContext *C) if (!ob->data || ID_IS_LINKED(ob->data)) { return 0; } - if (CTX_data_edit_object(C)) { - return 0; - } return 1; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index d607b6a9d6f..634e29ca400 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -731,7 +731,14 @@ static bool brush_generic_tool_set(bContext *C, WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); /* Tool System - * This is needed for when there is a non-sculpt tool active (transform for e.g.) */ + * This is needed for when there is a non-sculpt tool active (transform for e.g.). + * In case we are toggling (and the brush changed to the toggle_brush), we need to get the + * tool_name again. */ + int tool_result = brush_tool(brush, paint->runtime.tool_offset); + ePaintMode paint_mode = BKE_paintmode_get_active_from_context(C); + const EnumPropertyItem *items = BKE_paint_get_tool_enum_from_paintmode(paint_mode); + RNA_enum_name_from_value(items, tool_result, &tool_name); + char tool_id[MAX_NAME]; SNPRINTF(tool_id, "builtin_brush.%s", tool_name); WM_toolsystem_ref_set_by_id(C, tool_id); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 045fd54b46a..855e7503e3b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7389,7 +7389,7 @@ static bool sculpt_no_multires_poll(bContext *C) return false; } -static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op)) +static int sculpt_symmetrize_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); const Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -7440,7 +7440,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op)) MirrorModifierData mmd = {{0}}; int axis = 0; mmd.flag = 0; - mmd.tolerance = 0.005f; + mmd.tolerance = RNA_float_get(op->ptr, "merge_tolerance"); switch (sd->symmetrize_direction) { case BMO_SYMMETRIZE_NEGATIVE_X: axis = 0; @@ -7497,6 +7497,16 @@ static void SCULPT_OT_symmetrize(wmOperatorType *ot) /* API callbacks. */ ot->exec = sculpt_symmetrize_exec; ot->poll = sculpt_no_multires_poll; + + RNA_def_float(ot->srna, + "merge_tolerance", + 0.001f, + 0.0f, + FLT_MAX, + "Merge Limit", + "Distance within which symmetrical vertices are merged", + 0.0f, + 1.0f); } /**** Toggle operator for turning sculpt mode on or off ****/ diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 912a6e1aaf6..4a449e529d5 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -847,6 +847,7 @@ static void sculpt_undo_free_list(ListBase *lb) sculpt_undo_geometry_free_data(&unode->geometry_original); sculpt_undo_geometry_free_data(&unode->geometry_modified); + sculpt_undo_geometry_free_data(&unode->geometry_bmesh_enter); if (unode->face_sets) { MEM_freeN(unode->face_sets); @@ -913,7 +914,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, SculptUndoNode *unode BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, NULL); - unode->grid_hidden = MEM_mapallocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); + unode->grid_hidden = MEM_callocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); for (i = 0; i < totgrid; i++) { if (grid_hidden[grid_indices[i]]) { @@ -974,13 +975,11 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node, Sculpt maxgrid = 0; } - /* We will use this while sculpting, is mapalloc slow to access then? */ - /* General TODO, fix count_alloc. */ switch (type) { case SCULPT_UNDO_COORDS: - unode->co = MEM_mapallocN(sizeof(float[3]) * allvert, "SculptUndoNode.co"); - unode->no = MEM_mapallocN(sizeof(short[3]) * allvert, "SculptUndoNode.no"); + unode->co = MEM_callocN(sizeof(float[3]) * allvert, "SculptUndoNode.co"); + unode->no = MEM_callocN(sizeof(short[3]) * allvert, "SculptUndoNode.no"); usculpt->undo_size = (sizeof(float[3]) + sizeof(short[3]) + sizeof(int)) * allvert; break; @@ -994,7 +993,7 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node, Sculpt break; case SCULPT_UNDO_MASK: - unode->mask = MEM_mapallocN(sizeof(float) * allvert, "SculptUndoNode.mask"); + unode->mask = MEM_callocN(sizeof(float) * allvert, "SculptUndoNode.mask"); usculpt->undo_size += (sizeof(float) * sizeof(int)) * allvert; @@ -1013,12 +1012,12 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node, Sculpt unode->maxgrid = maxgrid; unode->totgrid = totgrid; unode->gridsize = gridsize; - unode->grids = MEM_mapallocN(sizeof(int) * totgrid, "SculptUndoNode.grids"); + unode->grids = MEM_callocN(sizeof(int) * totgrid, "SculptUndoNode.grids"); } else { /* Regular mesh. */ unode->maxvert = ss->totvert; - unode->index = MEM_mapallocN(sizeof(int) * allvert, "SculptUndoNode.index"); + unode->index = MEM_callocN(sizeof(int) * allvert, "SculptUndoNode.index"); } if (ss->deform_modifiers_active) { diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index a1094dde749..d6b259c9ac0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -548,8 +548,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm if (do_island_optimization) { UvElement *element; UvNearestHit hit = UV_NEAREST_HIT_INIT; - Image *ima = CTX_data_edit_image(C); - uv_find_nearest_vert(scene, ima, obedit, co, 0.0f, &hit); + uv_find_nearest_vert(scene, obedit, co, 0.0f, &hit); element = BM_uv_element_get(data->elementMap, hit.efa, hit.l); island_index = element->island; |