Blender V4.5
mesh_ops.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "RNA_access.hh"
10
11#include "WM_api.hh"
12#include "WM_types.hh"
13
14#include "ED_mesh.hh"
15#include "ED_screen.hh"
16
17#include "mesh_intern.hh" /* own include */
18
19/**************************** registration **********************************/
20
22{
23 using namespace blender::ed::mesh;
55
57
59
64
70
79
84
103#ifdef WITH_FREESTYLE
104 WM_operatortype_append(MESH_OT_mark_freestyle_face);
105#endif
106
110
122#if defined(WITH_FREESTYLE)
123 WM_operatortype_append(MESH_OT_mark_freestyle_edge);
124#endif
132
133 /* editmesh_polybuild */
139
147
150
160
162
172
173#ifdef WITH_BULLET
175#endif
176
180
184
194}
195
196#if 0 /* UNUSED, remove? */
197static int operator_editmesh_face_select(bContext *C)
198{
199 Object *obedit = CTX_data_edit_object(C);
200 if (obedit && obedit->type == OB_MESH) {
202 if (em && em->selectmode & SCE_SELECT_FACE) {
203 return 1;
204 }
205 }
206 return 0;
207}
208#endif
209
211{
213 wmOperatorTypeMacro *otmacro;
214
215 ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide",
216 "Loop Cut and Slide",
217 "Cut mesh loop and slide it",
219 WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
220 WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
221
222 ot = WM_operatortype_append_macro("MESH_OT_offset_edge_loops_slide",
223 "Offset Edge Slide",
224 "Offset edge loop slide",
226 WM_operatortype_macro_define(ot, "MESH_OT_offset_edge_loops");
227 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
228 RNA_boolean_set(otmacro->ptr, "single_side", true);
229
230 ot = WM_operatortype_append_macro("MESH_OT_duplicate_move",
231 "Add Duplicate",
232 "Duplicate mesh and move",
234 WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
235 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
236 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
237 RNA_boolean_set(otmacro->ptr, "mirror", false);
238
239 ot = WM_operatortype_append_macro("MESH_OT_rip_move",
240 "Rip",
241 "Rip polygons and move the result",
243 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
244 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
245 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
246 RNA_boolean_set(otmacro->ptr, "mirror", false);
247
248 ot = WM_operatortype_append_macro("MESH_OT_rip_edge_move",
249 "Extend Vertices",
250 "Extend vertices and move the result",
252 WM_operatortype_macro_define(ot, "MESH_OT_rip_edge");
253 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
254 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
255 RNA_boolean_set(otmacro->ptr, "mirror", false);
256
257 ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move",
258 "Extrude Region and Move",
259 "Extrude region and move result",
261 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
262 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
263 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
264 RNA_boolean_set(otmacro->ptr, "mirror", false);
265
267 "MESH_OT_extrude_manifold",
268 "Extrude Manifold",
269 "Extrude, dissolves edges whose faces form a flat surface and intersect new edges",
271 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
272 RNA_boolean_set(otmacro->ptr, "use_dissolve_ortho_edges", true);
273 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
274 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
275 RNA_boolean_set(otmacro->ptr, "mirror", false);
276 RNA_boolean_set(otmacro->ptr, "use_automerge_and_split", true);
277
278 ot = WM_operatortype_append_macro("MESH_OT_extrude_context_move",
279 "Extrude Region and Move",
280 "Extrude region together along the average normal",
282 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_context");
283 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
284 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
285 RNA_boolean_set(otmacro->ptr, "mirror", false);
286
287 ot = WM_operatortype_append_macro("MESH_OT_extrude_region_shrink_fatten",
288 "Extrude Region and Shrink/Fatten",
289 "Extrude region together along local normals",
291 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
292 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
293 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
294 RNA_boolean_set(otmacro->ptr, "mirror", false);
295
296 ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move",
297 "Extrude Individual Faces and Move",
298 "Extrude each individual face separately along local normals",
300 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
301 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
302 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
303 RNA_boolean_set(otmacro->ptr, "mirror", false);
304
305 ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move",
306 "Extrude Only Edges and Move",
307 "Extrude edges and move result",
309 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
310 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
311 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
312 RNA_boolean_set(otmacro->ptr, "mirror", false);
313
314 ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move",
315 "Extrude Only Vertices and Move",
316 "Extrude vertices and move result",
318 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
319 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
320 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
321 RNA_boolean_set(otmacro->ptr, "mirror", false);
322
323 ot = WM_operatortype_append_macro("MESH_OT_polybuild_face_at_cursor_move",
324 "Face at Cursor Move",
325 nullptr,
327 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_face_at_cursor");
328 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
329 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
330 RNA_boolean_set(otmacro->ptr, "mirror", false);
331
332 ot = WM_operatortype_append_macro("MESH_OT_polybuild_split_at_cursor_move",
333 "Split at Cursor Move",
334 nullptr,
336 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_split_at_cursor");
337 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
338 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
339 RNA_boolean_set(otmacro->ptr, "mirror", false);
340
341 ot = WM_operatortype_append_macro("MESH_OT_polybuild_transform_at_cursor_move",
342 "Transform at Cursor Move",
343 nullptr,
345 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_at_cursor");
346 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
347 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
348 RNA_boolean_set(otmacro->ptr, "mirror", false);
349
350 ot = WM_operatortype_append_macro("MESH_OT_polybuild_extrude_at_cursor_move",
351 "Extrude at Cursor Move",
352 nullptr,
354 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_at_cursor");
355 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
356 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
357 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
358 RNA_boolean_set(otmacro->ptr, "mirror", false);
359}
360
362{
363 wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Mesh", SPACE_EMPTY, RGN_TYPE_WINDOW);
364 keymap->poll = ED_operator_editmesh;
365
366 knifetool_modal_keymap(keyconf);
368 bevel_modal_keymap(keyconf);
369}
Object * CTX_data_edit_object(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
Definition editmesh.cc:61
@ OB_MESH
@ SCE_SELECT_FACE
@ RGN_TYPE_WINDOW
@ SPACE_EMPTY
bool ED_operator_editmesh(bContext *C)
#define C
Definition RandGen.cpp:29
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
void MESH_OT_primitive_plane_add(wmOperatorType *ot)
void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
void MESH_OT_primitive_cone_add(wmOperatorType *ot)
void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
void MESH_OT_primitive_cube_add(wmOperatorType *ot)
void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
void MESH_OT_primitive_grid_add(wmOperatorType *ot)
void MESH_OT_primitive_circle_add(wmOperatorType *ot)
void MESH_OT_primitive_cube_add_gizmo(wmOperatorType *ot)
void MESH_OT_attribute_set(wmOperatorType *ot)
wmKeyMap * bevel_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_bevel(wmOperatorType *ot)
void MESH_OT_bisect(wmOperatorType *ot)
void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
void MESH_OT_extrude_context(wmOperatorType *ot)
void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
void MESH_OT_extrude_region(wmOperatorType *ot)
void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
void MESH_OT_extrude_repeat(wmOperatorType *ot)
void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
void MESH_OT_screw(wmOperatorType *ot)
void MESH_OT_spin(wmOperatorType *ot)
void MESH_OT_inset(wmOperatorType *ot)
void MESH_OT_intersect(wmOperatorType *ot)
void MESH_OT_intersect_boolean(wmOperatorType *ot)
void MESH_OT_face_split_by_edges(wmOperatorType *ot)
wmKeyMap * knifetool_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_knife_tool(wmOperatorType *ot)
void MESH_OT_knife_project(wmOperatorType *ot)
void MESH_OT_loopcut(wmOperatorType *ot)
void SCULPT_OT_face_set_extract(wmOperatorType *ot)
void SCULPT_OT_paint_mask_slice(wmOperatorType *ot)
void SCULPT_OT_paint_mask_extract(wmOperatorType *ot)
void MESH_OT_shortest_path_select(wmOperatorType *ot)
void MESH_OT_shortest_path_pick(wmOperatorType *ot)
void MESH_OT_polybuild_transform_at_cursor(wmOperatorType *ot)
void MESH_OT_polybuild_face_at_cursor(wmOperatorType *ot)
void MESH_OT_polybuild_delete_at_cursor(wmOperatorType *ot)
void MESH_OT_polybuild_dissolve_at_cursor(wmOperatorType *ot)
void MESH_OT_polybuild_split_at_cursor(wmOperatorType *ot)
void MESH_OT_rip(wmOperatorType *ot)
void MESH_OT_rip_edge(wmOperatorType *ot)
void MESH_OT_select_less(wmOperatorType *ot)
void MESH_OT_loop_to_region(wmOperatorType *ot)
void MESH_OT_select_mode(wmOperatorType *ot)
void MESH_OT_select_similar_region(wmOperatorType *ot)
void MESH_OT_select_linked_pick(wmOperatorType *ot)
void MESH_OT_select_random(wmOperatorType *ot)
void MESH_OT_select_nth(wmOperatorType *ot)
void MESH_OT_loop_multi_select(wmOperatorType *ot)
void MESH_OT_select_loose(wmOperatorType *ot)
void MESH_OT_select_by_pole_count(wmOperatorType *ot)
void MESH_OT_select_by_attribute(wmOperatorType *ot)
void MESH_OT_edgering_select(wmOperatorType *ot)
void MESH_OT_select_face_by_sides(wmOperatorType *ot)
void MESH_OT_select_axis(wmOperatorType *ot)
void MESH_OT_select_mirror(wmOperatorType *ot)
void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
void MESH_OT_edges_select_sharp(wmOperatorType *ot)
void MESH_OT_select_interior_faces(wmOperatorType *ot)
void MESH_OT_select_linked(wmOperatorType *ot)
void MESH_OT_select_all(wmOperatorType *ot)
void MESH_OT_select_more(wmOperatorType *ot)
void MESH_OT_region_to_loop(wmOperatorType *ot)
void MESH_OT_loop_select(wmOperatorType *ot)
void MESH_OT_select_ungrouped(wmOperatorType *ot)
void MESH_OT_select_non_manifold(wmOperatorType *ot)
void MESH_OT_select_similar(wmOperatorType *ot)
void MESH_OT_poke(wmOperatorType *ot)
void MESH_OT_wireframe(wmOperatorType *ot)
void MESH_OT_hide(wmOperatorType *ot)
void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
void MESH_OT_uvs_reverse(wmOperatorType *ot)
void MESH_OT_mod_weighted_strength(wmOperatorType *ot)
void MESH_OT_faces_shade_flat(wmOperatorType *ot)
void MESH_OT_edge_rotate(wmOperatorType *ot)
void MESH_OT_set_normals_from_faces(wmOperatorType *ot)
void MESH_OT_symmetrize(wmOperatorType *ot)
void MESH_OT_edge_split(wmOperatorType *ot)
void MESH_OT_delete(wmOperatorType *ot)
void MESH_OT_beautify_fill(wmOperatorType *ot)
void MESH_OT_colors_rotate(wmOperatorType *ot)
void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
void MESH_OT_vert_connect(wmOperatorType *ot)
void MESH_OT_vertices_smooth(wmOperatorType *ot)
void MESH_OT_face_make_planar(wmOperatorType *ot)
void MESH_OT_dissolve_edges(wmOperatorType *ot)
void MESH_OT_uvs_rotate(wmOperatorType *ot)
void MESH_OT_delete_loose(wmOperatorType *ot)
void MESH_OT_split_normals(wmOperatorType *ot)
void MESH_OT_fill(wmOperatorType *ot)
void MESH_OT_mark_seam(wmOperatorType *ot)
void MESH_OT_remove_doubles(wmOperatorType *ot)
void MESH_OT_offset_edge_loops(wmOperatorType *ot)
void MESH_OT_subdivide_edgering(wmOperatorType *ot)
void MESH_OT_separate(wmOperatorType *ot)
void MESH_OT_dissolve_limited(wmOperatorType *ot)
void MESH_OT_dissolve_degenerate(wmOperatorType *ot)
void MESH_OT_blend_from_shape(wmOperatorType *ot)
void MESH_OT_fill_grid(wmOperatorType *ot)
void MESH_OT_vert_connect_nonplanar(wmOperatorType *ot)
void MESH_OT_flip_quad_tessellation(wmOperatorType *ot)
void MESH_OT_decimate(wmOperatorType *ot)
void MESH_OT_point_normals(wmOperatorType *ot)
void MESH_OT_dissolve_mode(wmOperatorType *ot)
void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
void MESH_OT_subdivide(wmOperatorType *ot)
void MESH_OT_unsubdivide(wmOperatorType *ot)
void MESH_OT_duplicate(wmOperatorType *ot)
wmKeyMap * point_normals_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_normals_make_consistent(wmOperatorType *ot)
void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
void MESH_OT_flip_normals(wmOperatorType *ot)
void MESH_OT_mark_sharp(wmOperatorType *ot)
void MESH_OT_smooth_normals(wmOperatorType *ot)
void MESH_OT_vert_connect_path(wmOperatorType *ot)
void MESH_OT_merge_normals(wmOperatorType *ot)
void MESH_OT_reveal(wmOperatorType *ot)
void MESH_OT_delete_edgeloop(wmOperatorType *ot)
void MESH_OT_merge(wmOperatorType *ot)
void MESH_OT_sort_elements(wmOperatorType *ot)
void MESH_OT_fill_holes(wmOperatorType *ot)
void MESH_OT_solidify(wmOperatorType *ot)
void MESH_OT_vert_connect_concave(wmOperatorType *ot)
void MESH_OT_symmetry_snap(wmOperatorType *ot)
void MESH_OT_normals_tools(wmOperatorType *ot)
void MESH_OT_average_normals(wmOperatorType *ot)
void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
void MESH_OT_colors_reverse(wmOperatorType *ot)
void MESH_OT_dissolve_faces(wmOperatorType *ot)
void MESH_OT_edge_face_add(wmOperatorType *ot)
void MESH_OT_edge_collapse(wmOperatorType *ot)
void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
void MESH_OT_dissolve_verts(wmOperatorType *ot)
void MESH_OT_split(wmOperatorType *ot)
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
Definition mesh_data.cc:618
void MESH_OT_customdata_skin_add(wmOperatorType *ot)
Definition mesh_data.cc:671
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
Definition mesh_data.cc:536
void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
Definition mesh_data.cc:696
void MESH_OT_uv_texture_add(wmOperatorType *ot)
Definition mesh_data.cc:497
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
Definition mesh_data.cc:739
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
Definition mesh_data.cc:782
void MESH_OT_convex_hull(wmOperatorType *ot)
void ED_operatortypes_mesh()
Definition mesh_ops.cc:21
void ED_keymap_mesh(wmKeyConfig *keyconf)
Definition mesh_ops.cc:361
void ED_operatormacros_mesh()
Definition mesh_ops.cc:210
void MESH_OT_set_sharpness_by_angle(wmOperatorType *ot)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
short selectmode
bool(* poll)(struct bContext *)
wmOperatorType * ot
Definition wm_files.cc:4226
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:893
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)