[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48825] branches/soc-2012-bratwurst/source /blender/editors: By request, X button for each item on the UV Maps list box.
Jorge Rodriguez
bs.vino at gmail.com
Wed Jul 11 09:47:10 CEST 2012
Revision: 48825
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48825
Author: vino
Date: 2012-07-11 07:47:09 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
By request, X button for each item on the UV Maps list box.
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c
branches/soc-2012-bratwurst/source/blender/editors/mesh/mesh_data.c
Modified: branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c 2012-07-11 07:46:36 UTC (rev 48824)
+++ branches/soc-2012-bratwurst/source/blender/editors/interface/interface_templates.c 2012-07-11 07:47:09 UTC (rev 48825)
@@ -2137,10 +2137,16 @@
/* hardcoded types */
if (itemptr->type == &RNA_MeshTexturePolyLayer || itemptr->type == &RNA_MeshLoopColorLayer) {
+ PointerRNA remove_rna;
+
uiItemL(sub, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
uiDefIconButR(block, TOG, 0, ICON_SCENE, 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "active_render", 0, 0, 0, 0, 0, NULL);
uiBlockSetEmboss(block, UI_EMBOSS);
+
+ WM_operator_properties_create(&remove_rna, "MESH_OT_uv_texture_remove");
+ RNA_int_set(&remove_rna, "index", i);
+ uiItemFullO(sub, "mesh.uv_texture_remove", "", ICON_X, remove_rna.data, uiLayoutGetOperatorContext(layout), UI_ITEM_O_RETURN_PROPS|UI_ITEM_R_NO_BG);
}
else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
uiItemL(sub, name, icon);
Modified: branches/soc-2012-bratwurst/source/blender/editors/mesh/mesh_data.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/mesh/mesh_data.c 2012-07-11 07:46:36 UTC (rev 48824)
+++ branches/soc-2012-bratwurst/source/blender/editors/mesh/mesh_data.c 2012-07-11 07:47:09 UTC (rev 48825)
@@ -382,17 +382,28 @@
return layernum_dst;
}
-int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
+int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me, int delete_index)
{
CustomData *pdata = GET_CD_DATA(me, pdata), *ldata = GET_CD_DATA(me, ldata);
CustomDataLayer *cdlp, *cdlu;
int index;
- index = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
- cdlp = (index == -1) ? NULL : &pdata->layers[index];
+ if (delete_index < 0)
+ {
+ index = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
+ cdlp = (index == -1) ? NULL : &pdata->layers[index];
- index = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
- cdlu = (index == -1) ? NULL : &ldata->layers[index];
+ index = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+ cdlu = (index == -1) ? NULL : &ldata->layers[index];
+ }
+ else
+ {
+ index = CustomData_get_layer_index_n(pdata, CD_MTEXPOLY, delete_index);
+ cdlp = (index == -1) ? NULL : &pdata->layers[index];
+
+ index = CustomData_get_layer_index_n(ldata, CD_MLOOPUV, delete_index);
+ cdlu = (index == -1) ? NULL : &ldata->layers[index];
+ }
if (!cdlp || !cdlu)
return 0;
@@ -620,12 +631,13 @@
RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
}
-static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
+ int index = RNA_int_get(op->ptr, "index");
- if (!ED_mesh_uv_texture_remove(C, ob, me))
+ if (!ED_mesh_uv_texture_remove(C, ob, me, index))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -644,6 +656,8 @@
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ RNA_def_int(ot->srna, "index", -1, INT_MIN, INT_MAX, "Index to remove", "< 0 means selection", INT_MIN, INT_MAX);
}
/*********************** vertex color operators ************************/
More information about the Bf-blender-cvs
mailing list