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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-05-03 16:09:48 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-05-03 16:09:48 +0300
commit3a808270df31ea438e7ca912b8035920ad24cd4a (patch)
tree907f780689a09a59251b84f817ac75fdbfd7c373 /source/blender/editors/mesh/mesh_data.c
parent472b3c582820d32ac39be91a6a884ed09285fe4f (diff)
Fix T44589: No way to add a skin data layer manualy.
There are several ways to end up with an object with skin modifier, but no skin data on the geometry. So we need an operator to add it by hands. Also tweaked a bit UI of this modifier.
Diffstat (limited to 'source/blender/editors/mesh/mesh_data.c')
-rw-r--r--source/blender/editors/mesh/mesh_data.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 86991d7dfeb..1d0cd6a2934 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -804,7 +804,7 @@ void MESH_OT_customdata_clear_mask(wmOperatorType *ot)
}
/* Clear Skin */
-static int mesh_customdata_clear_skin_poll(bContext *C)
+static bool mesh_customdata_skin_has(bContext *C)
{
Object *ob = ED_object_context(C);
@@ -819,6 +819,45 @@ static int mesh_customdata_clear_skin_poll(bContext *C)
}
return false;
}
+
+static int mesh_customdata_skin_add_poll(bContext *C)
+{
+ return !mesh_customdata_skin_has(C);
+}
+
+static int mesh_customdata_skin_add_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Object *ob = ED_object_context(C);
+ Mesh *me = ob->data;
+
+ BKE_mesh_ensure_skin_customdata(me);
+
+ DAG_id_tag_update(&me->id, 0);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_customdata_skin_add(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Add Skin Data";
+ ot->idname = "MESH_OT_customdata_skin_add";
+ ot->description = "Add a vertex skin layer";
+
+ /* api callbacks */
+ ot->exec = mesh_customdata_skin_add_exec;
+ ot->poll = mesh_customdata_skin_add_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int mesh_customdata_clear_skin_poll(bContext *C)
+{
+ return mesh_customdata_skin_has(C);
+}
+
static int mesh_customdata_clear_skin_exec(bContext *C, wmOperator *UNUSED(op))
{
return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_MVERT_SKIN);