diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-11-08 19:05:10 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-11-09 12:19:51 +0300 |
commit | 04b4ec78898b53dab7ad898736a883353a3eaaed (patch) | |
tree | 60a1036c215d865d2fa1e885bd0ab56c78ce5b12 /source/blender/makesrna | |
parent | 486d1e85102f738bc5933d8e241267c390865393 (diff) |
Fix T92318: adding layers (UVs, ...) doesn't notify about limit
When adding certain customdata layers (namely UVs, vertex colors and
sculpt vertex colors), the user does not get notified the specific limit
has been hit (blender just silently does nothing).
Now inform the user [decided to not do this in poll() since it could get
messy once operators are extended to operate on all selected objects, so
left this as a visible error in execute() -- or from python].
Maniphest Tasks: T92318
Differential Revision: https://developer.blender.org/D13147
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index fbc578acb8e..5a937e6b06b 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1507,12 +1507,15 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr) return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0; } -static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name, const bool do_init) +static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, + ReportList *reports, + const char *name, + const bool do_init) { PointerRNA ptr; CustomData *ldata; CustomDataLayer *cdl = NULL; - int index = ED_mesh_color_add(me, name, false, do_init); + int index = ED_mesh_color_add(me, name, false, do_init, reports); if (index != -1) { ldata = rna_mesh_ldata_helper(me); @@ -1533,13 +1536,14 @@ static void rna_Mesh_vertex_color_remove(struct Mesh *me, } static PointerRNA rna_Mesh_sculpt_vertex_color_new(struct Mesh *me, + ReportList *reports, const char *name, const bool do_init) { PointerRNA ptr; CustomData *vdata; CustomDataLayer *cdl = NULL; - int index = ED_mesh_sculpt_color_add(me, name, false, do_init); + int index = ED_mesh_sculpt_color_add(me, name, false, do_init, reports); if (index != -1) { vdata = rna_mesh_vdata_helper(me); @@ -1591,12 +1595,15 @@ DEFINE_CUSTOMDATA_PROPERTY_API( polygon, string, CD_PROP_STRING, pdata, totpoly, MeshPolygonStringPropertyLayer) # undef DEFINE_CUSTOMDATA_PROPERTY_API -static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, const char *name, const bool do_init) +static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, + ReportList *reports, + const char *name, + const bool do_init) { PointerRNA ptr; CustomData *ldata; CustomDataLayer *cdl = NULL; - int index = ED_mesh_uv_texture_add(me, name, false, do_init); + int index = ED_mesh_uv_texture_add(me, name, false, do_init, reports); if (index != -1) { ldata = rna_mesh_ldata_helper(me); @@ -2520,6 +2527,7 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new"); RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_string(func, "name", "Col", 0, "", "Vertex color name"); RNA_def_boolean(func, "do_init", @@ -2569,6 +2577,7 @@ static void rna_def_vert_colors(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new", "rna_Mesh_sculpt_vertex_color_new"); RNA_def_function_ui_description(func, "Add a sculpt vertex color layer to Mesh"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_string(func, "name", "Col", 0, "", "Sculpt Vertex color name"); RNA_def_boolean(func, "do_init", @@ -2622,6 +2631,7 @@ static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers"); func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Add a UV map layer to Mesh"); RNA_def_string(func, "name", "UVMap", 0, "", "UV map name"); RNA_def_boolean(func, |