00001 00002 /********************************************************************** 00003 * mesh_global.H 00004 **********************************************************************/ 00005 #ifndef MESH_GLOBAL_H_IS_INCLUDED 00006 #define MESH_GLOBAL_H_IS_INCLUDED 00007 00008 #include "bedge.H" 00009 #include "bface.H" 00010 00011 /***************************************************************** 00012 * MeshGlobal: 00013 * 00014 * Contains static methods relating to the mesh library. 00015 * 00016 *****************************************************************/ 00017 00018 class MeshGlobal { 00019 public: 00020 00021 //************ FACE SELECTION ******* 00022 00023 // adds the face (and its quad partner, if it has one) to the 00024 // selected list, setting the selected flags as needed. 00025 static void select(Bface* f); 00026 00027 // removes the face (and its quad partner, if it has one) from the 00028 // selected list, clearing the selected flags as needed. 00029 static void deselect(Bface* f); 00030 00031 // deselects the face if it is currently selected 00032 // and selects it otherwise 00033 static void toggle_select(Bface* f); 00034 00035 // selects the faces 00036 static void select(CBface_list& faces); 00037 00038 // deselects the faces 00039 static void deselect(CBface_list& faces); 00040 00041 // removes all faces from the selected list, clearing 00042 // the selected flags as needed 00043 static void deselect_all_faces(); 00044 00045 // returns a "read-only" list of all currently selected faces 00046 static CBface_list& selected_faces() { return _selected_faces; } 00047 00048 // returns a list of all currently selected faces from the given mesh 00049 static Bface_list selected_faces(BMESH* mesh); 00050 00051 // returns a list of all currently selected faces from the given 00052 // mesh. if the given mesh is an LMESH*, also returns selected 00053 // faces from any other meshes in its subdivision hierarchy 00054 static Bface_list selected_faces_all_levels(BMESH* mesh); 00055 00056 // deselect all selected elements of the given mesh (at all levels): 00057 static void deselect_all(BMESH* mesh) { 00058 deselect(selected_faces_all_levels(mesh)); 00059 deselect(selected_edges_all_levels(mesh)); 00060 deselect(selected_verts_all_levels(mesh)); 00061 } 00062 00063 static void deselect_all(CBMESH_list& meshes) { 00064 for (int i=0; i<meshes.num(); i++) 00065 deselect_all(meshes[i]); 00066 } 00067 00068 //************ EDGE SELECTION ******* 00069 00070 // adds the edge to the selected list, setting the selected flags 00071 // as needed. 00072 static void select(Bedge* e); 00073 00074 // removes the edge from the selected list, clearing the selected 00075 // flags as needed. 00076 static void deselect(Bedge* e); 00077 00078 // deselects the edge if it is currently selected 00079 // and selects it otherwise 00080 static void toggle_select(Bedge* e); 00081 00082 // selects the edges 00083 static void select(CBedge_list& edges); 00084 00085 // deselects the edges 00086 static void deselect(CBedge_list& edges); 00087 00088 // removes all edges from the selected list, clearing the selected 00089 // flags as needed 00090 static void deselect_all_edges(); 00091 00092 // returns a "read-only" list of all currently selected edges 00093 static CBedge_list& selected_edges() { return _selected_edges; } 00094 00095 // returns a list of all currently selected edges from the given mesh 00096 static Bedge_list selected_edges(BMESH* mesh); 00097 00098 // returns a list of all currently selected edges from the given 00099 // mesh. if the given mesh is an LMESH*, also returns selected 00100 // edges from any other meshes in the subdivision hierarchy 00101 static Bedge_list selected_edges_all_levels(BMESH* mesh); 00102 00103 //************ VERT SELECTION ******* 00104 00105 // adds the vert to the selected list, setting the selected flags 00106 // as needed. 00107 static void select(Bvert* v); 00108 00109 // removes the vert from the selected list, clearing the selected 00110 // flags as needed. 00111 static void deselect(Bvert* v); 00112 00113 // deselects the vert if it is currently selected 00114 // and selects it otherwise 00115 static void toggle_select(Bvert* v); 00116 00117 // selects the verts 00118 static void select(CBvert_list& verts); 00119 00120 // deselects the verts 00121 static void deselect(CBvert_list& verts); 00122 00123 // removes all verts from the selected list, clearing the selected 00124 // flags as needed 00125 static void deselect_all_verts(); 00126 00127 // returns a "read-only" list of all currently selected verts 00128 static CBvert_list& selected_verts() { return _selected_verts; } 00129 00130 // returns a list of all currently selected verts from the given mesh 00131 static Bvert_list selected_verts(BMESH* mesh); 00132 00133 // returns a list of all currently selected verts from the given 00134 // mesh. if the given mesh is an LMESH*, also returns selected 00135 // verts from any other meshes in the subdivision hierarchy 00136 static Bvert_list selected_verts_all_levels(BMESH* mesh); 00137 00138 //************ SELECTION UPDATE ******* 00139 00140 // updates the list of currently selected components of the given 00141 // mesh to reflect a change in edit level. 'from' is the former 00142 // edit level, 'to' is the current edit level. 00143 static void edit_level_changed(BMESH* mesh, int from, int to); 00144 00145 //******** DESELECT ALL ******** 00146 static void deselect_all() { 00147 deselect_all_verts(); 00148 deselect_all_edges(); 00149 deselect_all_faces(); 00150 } 00151 00152 protected: 00153 00154 //******** STATIC DATA ******** 00155 static Bface_list _selected_faces; 00156 static Bedge_list _selected_edges; 00157 static Bvert_list _selected_verts; 00158 }; 00159 00160 00161 #endif // MESH_GLOBAL_IS_INCLUDED 00162 00163 /* end of file mesh_global.H */