Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-08-03 06:17:46 +0300
committerHans Goudey <h.goudey@me.com>2022-08-03 06:17:46 +0300
commitd9683a5937fe6e55c309df06a47b9d551902d5bc (patch)
tree6e384ec5bbf5ca58c4e5913efdf596ff7f398a1a /source/blender/editors/mesh
parent41fb4bedb81603956d8a8f1b61614fd6f920a71a (diff)
parent43918ec28d12124cfa32b3e84ead1bfb65501f6f (diff)
Merge branch 'master' into refactor-mesh-hide-generic
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/mesh_data.cc243
-rw-r--r--source/blender/editors/mesh/mesh_intern.h4
-rw-r--r--source/blender/editors/mesh/mesh_ops.c4
3 files changed, 3 insertions, 248 deletions
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index 67834bf05ce..971fab1508e 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -444,44 +444,6 @@ bool ED_mesh_color_ensure(Mesh *me, const char *name)
return (layer != nullptr);
}
-bool ED_mesh_color_remove_index(Mesh *me, const int n)
-{
- CustomData *ldata = GET_CD_DATA(me, ldata);
- CustomDataLayer *cdl;
- int index;
-
- index = CustomData_get_layer_index_n(ldata, CD_PROP_BYTE_COLOR, n);
- cdl = (index == -1) ? nullptr : &ldata->layers[index];
-
- if (!cdl) {
- return false;
- }
-
- delete_customdata_layer(me, cdl);
- DEG_id_tag_update(&me->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, me);
-
- return true;
-}
-bool ED_mesh_color_remove_active(Mesh *me)
-{
- CustomData *ldata = GET_CD_DATA(me, ldata);
- const int n = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR);
- if (n != -1) {
- return ED_mesh_color_remove_index(me, n);
- }
- return false;
-}
-bool ED_mesh_color_remove_named(Mesh *me, const char *name)
-{
- CustomData *ldata = GET_CD_DATA(me, ldata);
- const int n = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, name);
- if (n != -1) {
- return ED_mesh_color_remove_index(me, n);
- }
- return false;
-}
-
/*********************** General poll ************************/
static bool layers_poll(bContext *C)
@@ -494,25 +456,7 @@ static bool layers_poll(bContext *C)
/*********************** Sculpt Vertex colors operators ************************/
-static bool sculpt_vertex_color_remove_poll(bContext *C)
-{
- if (!layers_poll(C)) {
- return false;
- }
-
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
- CustomData *vdata = GET_CD_DATA(me, vdata);
- const int active = CustomData_get_active_layer(vdata, CD_PROP_COLOR);
- if (active != -1) {
- return true;
- }
-
- return false;
-}
-
-int ED_mesh_sculpt_color_add(
- Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports)
+int ED_mesh_sculpt_color_add(Mesh *me, const char *name, const bool do_init, ReportList *reports)
{
/* NOTE: keep in sync with #ED_mesh_uv_add. */
@@ -536,7 +480,7 @@ int ED_mesh_sculpt_color_add(
const int layernum_dst = CustomData_get_active_layer(&em->bm->vdata, CD_PROP_COLOR);
BM_data_layer_copy(em->bm, &em->bm->vdata, CD_PROP_COLOR, layernum_dst, layernum);
}
- if (active_set || layernum == 0) {
+ if (layernum == 0) {
CustomData_set_layer_active(&em->bm->vdata, CD_PROP_COLOR, layernum);
}
}
@@ -559,7 +503,7 @@ int ED_mesh_sculpt_color_add(
&me->vdata, CD_PROP_COLOR, CD_DEFAULT, nullptr, me->totvert, name);
}
- if (active_set || layernum == 0) {
+ if (layernum == 0) {
CustomData_set_layer_active(&me->vdata, CD_PROP_COLOR, layernum);
}
@@ -572,58 +516,6 @@ int ED_mesh_sculpt_color_add(
return layernum;
}
-bool ED_mesh_sculpt_color_ensure(Mesh *me, const char *name)
-{
- BLI_assert(me->edit_mesh == nullptr);
-
- if (me->totvert && !CustomData_has_layer(&me->vdata, CD_PROP_COLOR)) {
- CustomData_add_layer_named(&me->vdata, CD_PROP_COLOR, CD_DEFAULT, nullptr, me->totvert, name);
- BKE_mesh_update_customdata_pointers(me, true);
- }
-
- DEG_id_tag_update(&me->id, 0);
-
- return (me->mloopcol != nullptr);
-}
-
-bool ED_mesh_sculpt_color_remove_index(Mesh *me, const int n)
-{
- CustomData *vdata = GET_CD_DATA(me, vdata);
- CustomDataLayer *cdl;
- int index;
-
- index = CustomData_get_layer_index_n(vdata, CD_PROP_COLOR, n);
- cdl = (index == -1) ? nullptr : &vdata->layers[index];
-
- if (!cdl) {
- return false;
- }
-
- delete_customdata_layer(me, cdl);
- DEG_id_tag_update(&me->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, me);
-
- return true;
-}
-bool ED_mesh_sculpt_color_remove_active(Mesh *me)
-{
- CustomData *vdata = GET_CD_DATA(me, vdata);
- const int n = CustomData_get_active_layer(vdata, CD_PROP_COLOR);
- if (n != -1) {
- return ED_mesh_sculpt_color_remove_index(me, n);
- }
- return false;
-}
-bool ED_mesh_sculpt_color_remove_named(Mesh *me, const char *name)
-{
- CustomData *vdata = GET_CD_DATA(me, vdata);
- const int n = CustomData_get_named_layer(vdata, CD_PROP_COLOR, name);
- if (n != -1) {
- return ED_mesh_sculpt_color_remove_index(me, n);
- }
- return false;
-}
-
/*********************** UV texture operators ************************/
static bool uv_texture_remove_poll(bContext *C)
@@ -709,135 +601,6 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-/*********************** vertex color operators ************************/
-
-static bool vertex_color_remove_poll(bContext *C)
-{
- if (!layers_poll(C)) {
- return false;
- }
-
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
- CustomData *ldata = GET_CD_DATA(me, ldata);
- const int active = CustomData_get_active_layer(ldata, CD_PROP_BYTE_COLOR);
- if (active != -1) {
- return true;
- }
-
- return false;
-}
-
-static int mesh_vertex_color_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
-
- if (ED_mesh_color_add(me, nullptr, true, true, op->reports) == -1) {
- return OPERATOR_CANCELLED;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_vertex_color_add(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Add Vertex Color";
- ot->description = "Add vertex color layer";
- ot->idname = "MESH_OT_vertex_color_add";
-
- /* api callbacks */
- ot->poll = layers_poll;
- ot->exec = mesh_vertex_color_add_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
-
- if (!ED_mesh_color_remove_active(me)) {
- return OPERATOR_CANCELLED;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_vertex_color_remove(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Remove Vertex Color";
- ot->description = "Remove vertex color layer";
- ot->idname = "MESH_OT_vertex_color_remove";
-
- /* api callbacks */
- ot->exec = mesh_vertex_color_remove_exec;
- ot->poll = vertex_color_remove_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-/*********************** Sculpt Vertex Color Operators ************************/
-
-static int mesh_sculpt_vertex_color_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
-
- if (ED_mesh_sculpt_color_add(me, nullptr, true, true, op->reports) == -1) {
- return OPERATOR_CANCELLED;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_sculpt_vertex_color_add(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Add Sculpt Vertex Color";
- ot->description = "Add vertex color layer";
- ot->idname = "MESH_OT_sculpt_vertex_color_add";
-
- /* api callbacks */
- ot->poll = layers_poll;
- ot->exec = mesh_sculpt_vertex_color_add_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int mesh_sculpt_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_context(C);
- Mesh *me = static_cast<Mesh *>(ob->data);
-
- if (!ED_mesh_sculpt_color_remove_active(me)) {
- return OPERATOR_CANCELLED;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_sculpt_vertex_color_remove(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Remove Sculpt Vertex Color";
- ot->description = "Remove vertex color layer";
- ot->idname = "MESH_OT_sculpt_vertex_color_remove";
-
- /* api callbacks */
- ot->exec = mesh_sculpt_vertex_color_remove_exec;
- ot->poll = sculpt_vertex_color_remove_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
/* *** CustomData clear functions, we need an operator for each *** */
static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int type)
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 303234df48c..7c8dbffeb31 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -308,10 +308,6 @@ void MESH_OT_mark_freestyle_face(struct wmOperatorType *ot);
void MESH_OT_uv_texture_add(struct wmOperatorType *ot);
void MESH_OT_uv_texture_remove(struct wmOperatorType *ot);
-void MESH_OT_vertex_color_add(struct wmOperatorType *ot);
-void MESH_OT_vertex_color_remove(struct wmOperatorType *ot);
-void MESH_OT_sculpt_vertex_color_add(struct wmOperatorType *ot);
-void MESH_OT_sculpt_vertex_color_remove(struct wmOperatorType *ot);
void MESH_OT_customdata_mask_clear(struct wmOperatorType *ot);
void MESH_OT_customdata_skin_add(struct wmOperatorType *ot);
void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index be7f60b0da0..b9e78740e3c 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -134,10 +134,6 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_uv_texture_add);
WM_operatortype_append(MESH_OT_uv_texture_remove);
- WM_operatortype_append(MESH_OT_vertex_color_add);
- WM_operatortype_append(MESH_OT_vertex_color_remove);
- WM_operatortype_append(MESH_OT_sculpt_vertex_color_add);
- WM_operatortype_append(MESH_OT_sculpt_vertex_color_remove);
WM_operatortype_append(MESH_OT_customdata_mask_clear);
WM_operatortype_append(MESH_OT_customdata_skin_add);
WM_operatortype_append(MESH_OT_customdata_skin_clear);