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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index e488bedca8a..aed0e49cf7e 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1268,12 +1268,12 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
}
-static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name)
{
PointerRNA ptr;
CustomData *ldata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+ int index = ED_mesh_color_add(me, name, false);
if (index != -1) {
ldata = rna_mesh_ldata_helper(me);
@@ -1284,8 +1284,14 @@ static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C,
return ptr;
}
-static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bContext *C, ReportList *reports,
- const char *name)
+static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
+{
+ if (ED_mesh_color_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "vertex color '%s' not found", layer->name);
+ }
+}
+
+static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, ReportList *reports, const char *name)
{
PointerRNA ptr;
CustomData *fdata;
@@ -1302,7 +1308,7 @@ static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bCo
return PointerRNA_NULL;
}
- index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+ index = ED_mesh_color_add(me, name, false);
if (index != -1) {
fdata = rna_mesh_fdata_helper(me);
@@ -1358,12 +1364,12 @@ static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, struct b
return ptr;
}
-static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, const char *name)
{
PointerRNA ptr;
CustomData *pdata;
CustomDataLayer *cdl = NULL;
- int index = ED_mesh_uv_texture_add(C, me, name, FALSE);
+ int index = ED_mesh_uv_texture_add(me, name, false);
if (index != -1) {
pdata = rna_mesh_pdata_helper(me);
@@ -1374,11 +1380,17 @@ static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, c
return ptr;
}
+static void rna_Mesh_uv_texture_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
+{
+ if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "texture layer '%s' not found", layer->name);
+ }
+}
+
/* while this is supposed to be readonly,
* keep it to support importers that only make tessfaces */
-static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bContext *C, ReportList *reports,
- const char *name)
+static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, ReportList *reports, const char *name)
{
PointerRNA ptr;
CustomData *fdata;
@@ -1395,7 +1407,7 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bCont
return PointerRNA_NULL;
}
- index = ED_mesh_uv_texture_add(C, me, name, FALSE);
+ index = ED_mesh_uv_texture_add(me, name, false);
if (index != -1) {
fdata = rna_mesh_fdata_helper(me);
@@ -2385,7 +2397,7 @@ static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
/* eventually deprecate this */
func = RNA_def_function(srna, "new", "rna_Mesh_tessface_vertex_color_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
parm = RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
@@ -2420,21 +2432,18 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
RNA_def_property_flag(parm, PROP_RNAPTR);
RNA_def_function_return(func, parm);
-#if 0
func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
RNA_def_function_ui_description(func, "Remove a vertex color layer");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
+ parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-#endif
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
@@ -2561,7 +2570,7 @@ static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
/* eventually deprecate this */
func = RNA_def_function(srna, "new", "rna_Mesh_tessface_uv_texture_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a UV tessface-texture layer to Mesh (only for meshes with no polygons)");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
parm = RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
@@ -2598,21 +2607,17 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps");
func = RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The newly created layer");
RNA_def_property_flag(parm, PROP_RNAPTR);
RNA_def_function_return(func, parm);
-#if 0
func = RNA_def_function(srna, "remove", "rna_Mesh_uv_texture_layers_remove");
RNA_def_function_ui_description(func, "Remove a vertex color layer");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
- RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-#endif
+ parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The layer to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");