diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-03-23 19:19:00 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-03-23 19:19:00 +0300 |
commit | 09eb086779b4349a4245fdcb74493204db856286 (patch) | |
tree | 1a86c221b405f532d6c522846e4e86d558d90d3a /source/blender/editors | |
parent | 51c3ce1353db33c7d78a2636e543c08f95a95e1d (diff) |
temp-sculpt-colors:
* Updated reverse face colors to use color attribute api.
* Updated rotate face colors to use color attribute api.
* Fixed mask by color not redrawing.
* Fixed duplicate mask by color keymap entry.
* Change bunches of UI strings from "vertex color" to "color attribute."
- But not in git submodules.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/geometry/geometry_attributes.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/io/io_alembic.c | 2 | ||||
-rw-r--r-- | source/blender/editors/io/io_usd.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 30 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_ops.c | 3 |
5 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc index 4f864c15751..10438ae1492 100644 --- a/source/blender/editors/geometry/geometry_attributes.cc +++ b/source/blender/editors/geometry/geometry_attributes.cc @@ -506,7 +506,7 @@ void GEOMETRY_OT_attribute_convert(wmOperatorType *ot) {int(ConvertAttributeMode::Generic), "GENERIC", 0, "Generic", ""}, {int(ConvertAttributeMode::UVMap), "UV_MAP", 0, "UV Map", ""}, {int(ConvertAttributeMode::VertexGroup), "VERTEX_GROUP", 0, "Vertex Group", ""}, - {int(ConvertAttributeMode::VertexColor), "VERTEX_COLOR", 0, "Vertex Color", ""}, + {int(ConvertAttributeMode::VertexColor), "VERTEX_COLOR", 0, "Color Attribute", ""}, {0, nullptr, 0, nullptr, nullptr}, }; diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c index c9421d9aace..fd454083653 100644 --- a/source/blender/editors/io/io_alembic.c +++ b/source/blender/editors/io/io_alembic.c @@ -374,7 +374,7 @@ void WM_OT_alembic_export(wmOperatorType *ot) RNA_def_boolean(ot->srna, "normals", 1, "Normals", "Export normals"); - RNA_def_boolean(ot->srna, "vcolors", 0, "Vertex Colors", "Export vertex colors"); + RNA_def_boolean(ot->srna, "vcolors", 0, "Color Attributes", "Export color attributes"); RNA_def_boolean(ot->srna, "orcos", diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c index c4f1ae88d28..98df418b5d4 100644 --- a/source/blender/editors/io/io_usd.c +++ b/source/blender/editors/io/io_usd.c @@ -520,7 +520,7 @@ void WM_OT_usd_import(struct wmOperatorType *ot) RNA_def_boolean(ot->srna, "read_mesh_uvs", true, "UV Coordinates", "Read mesh UV coordinates"); - RNA_def_boolean(ot->srna, "read_mesh_colors", false, "Vertex Colors", "Read mesh vertex colors"); + RNA_def_boolean(ot->srna, "read_mesh_colors", false, "Color Attributes", "Read mesh color attributes"); RNA_def_string(ot->srna, "prim_path_mask", diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 2181b652d16..d84e2d732c5 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -27,6 +27,7 @@ #include "BLI_sort_utils.h" #include "BLI_string.h" +#include "BKE_attribute.h" #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" @@ -37,6 +38,7 @@ #include "BKE_main.h" #include "BKE_material.h" #include "BKE_mesh.h" +#include "BKE_object.h" #include "BKE_report.h" #include "BKE_texture.h" @@ -726,7 +728,7 @@ void MESH_OT_edge_collapse(wmOperatorType *ot) /* identifiers */ ot->name = "Collapse Edges & Faces"; ot->description = - "Collapse isolated edge and face regions, merging data such as UV's and vertex colors. " + "Collapse isolated edge and face regions, merging data such as UV's and color attributes. " "This can collapse edge-rings as well as regions of connected faces into vertices"; ot->idname = "MESH_OT_edge_collapse"; @@ -3088,7 +3090,20 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op) BMOperator bmop; - EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf use_ccw=%b", BM_ELEM_SELECT, use_ccw); + Mesh *me = BKE_object_get_original_mesh(ob); + CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + + if (!layer || BKE_id_attribute_domain(&me->id, layer) != ATTR_DOMAIN_CORNER) { + continue; + } + + EDBM_op_init(em, + &bmop, + op, + "rotate_colors faces=%hf use_ccw=%b object=%p", + BM_ELEM_SELECT, + use_ccw, + ob); BMO_op_exec(em->bm, &bmop); @@ -3125,9 +3140,16 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op) continue; } + Mesh *me = BKE_object_get_original_mesh(obedit); + CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id); + + if (!layer || BKE_id_attribute_domain(&me->id, layer) != ATTR_DOMAIN_CORNER) { + continue; + } + BMOperator bmop; - EDBM_op_init(em, &bmop, op, "reverse_colors faces=%hf", BM_ELEM_SELECT); + EDBM_op_init(em, &bmop, op, "reverse_colors faces=%hf object=%p", BM_ELEM_SELECT, obedit); BMO_op_exec(em->bm, &bmop); @@ -3188,7 +3210,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot) /* identifiers */ ot->name = "Rotate Colors"; ot->idname = "MESH_OT_colors_rotate"; - ot->description = "Rotate vertex colors inside faces"; + ot->description = "Rotate color attributes inside faces"; /* api callbacks */ ot->exec = edbm_rotate_colors_exec; diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index 7e7a009dec9..fbf1e56cbd4 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -866,7 +866,7 @@ static void do_mask_by_color_contiguous_update_nodes_cb( } BKE_pbvh_vertex_iter_end; if (update_node) { - BKE_pbvh_node_mark_redraw(data->nodes[n]); + BKE_pbvh_node_mark_update_mask(data->nodes[n]); } } @@ -1066,6 +1066,7 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven SCULPT_undo_push_end(ob); SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_MASK); + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); return OPERATOR_FINISHED; } |