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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-10-16 03:50:09 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-10-16 03:50:09 +0400
commit1de76baf88c96184f579884d50e08b2b463d89eb (patch)
tree6e23b187ecd1e1f8c448669baf2095577b8b5297 /source/blender/bmesh/intern
parent6533ebff28f2f7826f17280eeb7da09a63ba6429 (diff)
Add BMesh and WM symmetrize operators
* The symmetrize operation makes the input mesh elements symmetrical, but unlike mirroring it only copies in one direction. The edges and faces that cross the plane of symmetry are split as needed to enforce symmetry. * The symmetrize operator can be controlled with the "direction" property, which combines the choices of symmetry plane and positive-negative/negative-positive. The enum for this is BMO_SymmDirection. * Added menu items in the top-level Mesh menu and the WKEY specials menu. * Documentation: http://wiki.blender.org/index.php/User:Nicholasbishop/Symmetrize * Reviewed by Brecht: https://codereview.appspot.com/6618059
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c24
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_operators_private.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 362157ad71b..f50de0d6ee4 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1182,6 +1182,29 @@ static BMOpDefine bmo_convex_hull_def = {
0
};
+/*
+ * Symmetrize
+ *
+ * Mekes the mesh elements in the "input" slot symmetrical. Unlike
+ * normal mirroring, it only copies in one direction, as specified by
+ * the "direction" slot. The edges and faces that cross the plane of
+ * symmetry are split as needed to enforce symmetry.
+ *
+ * All new vertices, edges, and faces are added to the "geomout" slot.
+ */
+static BMOpDefine bmo_symmetrize_def = {
+ "symmetrize",
+ {{BMO_OP_SLOT_ELEMENT_BUF, "input"},
+ {BMO_OP_SLOT_INT, "direction"},
+
+ /* Outputs */
+ {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
+
+ {0} /* null-terminating sentinel */},
+ bmo_symmetrize_exec,
+ 0
+};
+
BMOpDefine *opdefines[] = {
&bmo_automerge_def,
&bmo_average_vert_facedata_def,
@@ -1246,6 +1269,7 @@ BMOpDefine *opdefines[] = {
&bmo_split_def,
&bmo_split_edges_def,
&bmo_subdivide_edges_def,
+ &bmo_symmetrize_def,
&bmo_transform_def,
&bmo_translate_def,
&bmo_triangle_fill_def,
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index 0674103162c..a2f4cdc8c6a 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -266,6 +266,16 @@ enum {
DEL_ONLYTAGGED
};
+typedef enum {
+ BMO_SYMMETRIZE_NEGATIVE_X,
+ BMO_SYMMETRIZE_NEGATIVE_Y,
+ BMO_SYMMETRIZE_NEGATIVE_Z,
+
+ BMO_SYMMETRIZE_POSITIVE_X,
+ BMO_SYMMETRIZE_POSITIVE_Y,
+ BMO_SYMMETRIZE_POSITIVE_Z,
+} BMO_SymmDirection;
+
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);
void BMO_op_flag_disable(BMesh *bm, BMOperator *op, const int op_flag);
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
index dc1bdaa4689..fa239bb6ceb 100644
--- a/source/blender/bmesh/intern/bmesh_operators_private.h
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -96,6 +96,7 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op);
void bmo_split_edges_exec(BMesh *bm, BMOperator *op);
void bmo_split_exec(BMesh *bm, BMOperator *op);
void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op);
+void bmo_symmetrize_exec(BMesh *bm, BMOperator *op);
void bmo_transform_exec(BMesh *bm, BMOperator *op);
void bmo_translate_exec(BMesh *bm, BMOperator *op);
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op);