[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45154] trunk/blender/source: disallow adding tessfaces to a mesh with polygons ( only allowed case is creating a new mesh with tessfaces and later converting to polygons , which wont work if polygons exist)

Campbell Barton ideasman42 at gmail.com
Mon Mar 26 06:32:19 CEST 2012


Revision: 45154
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45154
Author:   campbellbarton
Date:     2012-03-26 04:32:04 +0000 (Mon, 26 Mar 2012)
Log Message:
-----------
disallow adding tessfaces to a mesh with polygons (only allowed case is creating a new mesh with tessfaces and later converting to polygons, which wont work if polygons exist)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/mesh/mesh_data.c
    trunk/blender/source/blender/makesrna/intern/rna_mesh.c
    trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c

Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h	2012-03-26 04:23:18 UTC (rev 45153)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h	2012-03-26 04:32:04 UTC (rev 45154)
@@ -270,7 +270,7 @@
 /* mesh_data.c */
 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
 void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count);
-void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_tessfaces_add(struct Mesh *mesh, struct ReportList *reports, int count);
 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
 void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count);
 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);

Modified: trunk/blender/source/blender/editors/mesh/mesh_data.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_data.c	2012-03-26 04:23:18 UTC (rev 45153)
+++ trunk/blender/source/blender/editors/mesh/mesh_data.c	2012-03-26 04:32:04 UTC (rev 45154)
@@ -906,7 +906,7 @@
 	mesh->totedge = totedge;
 }
 
-static void mesh_add_faces(Mesh *mesh, int len)
+static void mesh_add_tessfaces(Mesh *mesh, int len)
 {
 	CustomData fdata;
 	MFace *mface;
@@ -1047,14 +1047,19 @@
 }
 #endif
 
-void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
+void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
 {
 	if (mesh->edit_btmesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode");
+		BKE_report(reports, RPT_ERROR, "Can't add tessfaces in edit mode");
 		return;
 	}
 
-	mesh_add_faces(mesh, count);
+	if (mesh->mpoly) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessfaces to a mesh that already has polygons");
+		return;
+	}
+
+	mesh_add_tessfaces(mesh, count);
 }
 
 void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)

Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mesh.c	2012-03-26 04:23:18 UTC (rev 45153)
+++ trunk/blender/source/blender/makesrna/intern/rna_mesh.c	2012-03-26 04:32:04 UTC (rev 45154)
@@ -2143,7 +2143,7 @@
 }
 
 /* mesh.faces */
-static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_mesh_tessfaces(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
@@ -2151,8 +2151,8 @@
 	FunctionRNA *func;
 /*	PropertyRNA *parm; */
 
-	RNA_def_property_srna(cprop, "MeshFaces");
-	srna = RNA_def_struct(brna, "MeshFaces", NULL);
+	RNA_def_property_srna(cprop, "MeshTessFaces");
+	srna = RNA_def_struct(brna, "MeshTessFaces", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Mesh Faces", "Collection of mesh faces");
 
@@ -2160,7 +2160,7 @@
 	RNA_def_property_int_sdna(prop, NULL, "act_face");
 	RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh");
 
-	func = RNA_def_function(srna, "add", "ED_mesh_faces_add");
+	func = RNA_def_function(srna, "add", "ED_mesh_tessfaces_add");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to add", 0, INT_MAX);
 #if 0 /* BMESH_TODO Remove until BMesh merge */
@@ -2496,7 +2496,7 @@
 	RNA_def_property_collection_sdna(prop, NULL, "mface", "totface");
 	RNA_def_property_struct_type(prop, "MeshTessFace");
 	RNA_def_property_ui_text(prop, "TessFaces", "Tessellation faces of the mesh (derived from polygons)");
-	rna_def_mesh_faces(brna, prop);
+	rna_def_mesh_tessfaces(brna, prop);
 
 	prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");

Modified: trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c
===================================================================
--- trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c	2012-03-26 04:23:18 UTC (rev 45153)
+++ trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c	2012-03-26 04:32:04 UTC (rev 45154)
@@ -324,7 +324,7 @@
 void ED_mesh_update(struct Mesh *mesh, struct bContext *C){}
 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count){}
-void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_tessfaces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count){}




More information about the Bf-blender-cvs mailing list