Blender V5.3
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
19namespace blender {
20
21/**************************** registration **********************************/
22
24{
25 using namespace blender::ed::mesh;
58
60
62
67
73
82
87
106#ifdef WITH_FREESTYLE
107 WM_operatortype_append(MESH_OT_mark_freestyle_face);
108#endif
109
113
127#if defined(WITH_FREESTYLE)
128 WM_operatortype_append(MESH_OT_mark_freestyle_edge);
129#endif
137
138 /* editmesh_polybuild */
144
153
156
166
168
178
179#ifdef WITH_BULLET
181#endif
182
186
197
204}
205
206#if 0 /* UNUSED, remove? */
207static int operator_editmesh_face_select(bContext *C)
208{
209 Object *obedit = CTX_data_edit_object(C);
210 if (obedit && obedit->type == OB_MESH) {
212 if (em && em->selectmode & SCE_SELECT_FACE) {
213 return 1;
214 }
215 }
216 return 0;
217}
218#endif
219
221{
222 wmOperatorType *ot;
223 wmOperatorTypeMacro *otmacro;
224
225 ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide",
226 "Loop Cut and Slide",
227 "Cut mesh loop and slide it",
229 WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
230 WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
231
232 ot = WM_operatortype_append_macro("MESH_OT_offset_edge_loops_slide",
233 "Offset Edge Slide",
234 "Offset edge loop slide",
236 WM_operatortype_macro_define(ot, "MESH_OT_offset_edge_loops");
237 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
238 RNA_boolean_set(otmacro->ptr, "single_side", true);
239
240 ot = WM_operatortype_append_macro("MESH_OT_duplicate_move",
241 "Add Duplicate",
242 "Duplicate mesh and move",
244 WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
245 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
246 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
247 RNA_boolean_set(otmacro->ptr, "mirror", false);
248
249 ot = WM_operatortype_append_macro("MESH_OT_rip_move",
250 "Rip",
251 "Rip polygons and move the result",
253 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
254 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
255 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
256 RNA_boolean_set(otmacro->ptr, "mirror", false);
257
258 ot = WM_operatortype_append_macro("MESH_OT_rip_edge_move",
259 "Extend Vertices",
260 "Extend vertices and move the result",
262 WM_operatortype_macro_define(ot, "MESH_OT_rip_edge");
263 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
264 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
265 RNA_boolean_set(otmacro->ptr, "mirror", false);
266
267 ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move",
268 "Extrude Region and Move",
269 "Extrude region and move result",
271 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
272 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
273 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
274 RNA_boolean_set(otmacro->ptr, "mirror", false);
275
277 "MESH_OT_extrude_manifold",
278 "Extrude Manifold",
279 "Extrude, dissolves edges whose faces form a flat surface and intersect new edges",
281 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
282 RNA_boolean_set(otmacro->ptr, "use_dissolve_ortho_edges", true);
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 RNA_boolean_set(otmacro->ptr, "use_automerge_and_split", true);
287
288 ot = WM_operatortype_append_macro("MESH_OT_extrude_context_move",
289 "Extrude Region and Move",
290 "Extrude region together along the average normal",
292 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_context");
293 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
294 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
295 RNA_boolean_set(otmacro->ptr, "mirror", false);
296
297 ot = WM_operatortype_append_macro("MESH_OT_extrude_region_shrink_fatten",
298 "Extrude Region and Shrink/Fatten",
299 "Extrude region together along local normals",
301 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
302 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
303 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
304 RNA_boolean_set(otmacro->ptr, "mirror", false);
305
306 ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move",
307 "Extrude Individual Faces and Move",
308 "Extrude each individual face separately along local normals",
310 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
311 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
312 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
313 RNA_boolean_set(otmacro->ptr, "mirror", false);
314
315 ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move",
316 "Extrude Only Edges and Move",
317 "Extrude edges and move result",
319 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
320 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
321 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
322 RNA_boolean_set(otmacro->ptr, "mirror", false);
323
324 ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move",
325 "Extrude Only Vertices and Move",
326 "Extrude vertices and move result",
328 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
329 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
330 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
331 RNA_boolean_set(otmacro->ptr, "mirror", false);
332
333 ot = WM_operatortype_append_macro("MESH_OT_polybuild_face_at_cursor_move",
334 "Face at Cursor Move",
335 nullptr,
337 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_face_at_cursor");
338 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
339 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
340 RNA_boolean_set(otmacro->ptr, "mirror", false);
341
342 ot = WM_operatortype_append_macro("MESH_OT_polybuild_split_at_cursor_move",
343 "Split at Cursor Move",
344 nullptr,
346 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_split_at_cursor");
347 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
348 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
349 RNA_boolean_set(otmacro->ptr, "mirror", false);
350
351 ot = WM_operatortype_append_macro("MESH_OT_polybuild_transform_at_cursor_move",
352 "Transform at Cursor Move",
353 nullptr,
355 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_at_cursor");
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 ot = WM_operatortype_append_macro("MESH_OT_polybuild_extrude_at_cursor_move",
361 "Extrude at Cursor Move",
362 nullptr,
364 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_at_cursor");
365 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
366 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
367 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
368 RNA_boolean_set(otmacro->ptr, "mirror", false);
369}
370
372{
373 wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Mesh", SPACE_EMPTY, RGN_TYPE_WINDOW);
374 keymap->poll = ED_operator_editmesh;
375
376 knifetool_modal_keymap(keyconf);
378 bevel_modal_keymap(keyconf);
379}
380
381} // namespace blender
#define C
Definition RandGen.cpp:29
void MESH_OT_set_sharpness_by_angle(wmOperatorType *ot)
BMesh Iterators.
void MESH_OT_fit_edge_loops_to_annotation(wmOperatorType *ot)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void MESH_OT_merge_normals(wmOperatorType *ot)
void MESH_OT_symmetrize(wmOperatorType *ot)
void MESH_OT_dissolve_faces(wmOperatorType *ot)
void MESH_OT_customdata_face_sets_clear(wmOperatorType *ot)
Definition mesh_data.cc:563
void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
void ED_operatormacros_mesh()
Definition mesh_ops.cc:220
void MESH_OT_polybuild_split_at_cursor(wmOperatorType *ot)
void MESH_OT_vert_connect_concave(wmOperatorType *ot)
void MESH_OT_dissolve_edges(wmOperatorType *ot)
void MESH_OT_select_by_pole_count(wmOperatorType *ot)
void MESH_OT_mod_weighted_strength(wmOperatorType *ot)
void MESH_OT_beautify_fill(wmOperatorType *ot)
void MESH_OT_subdivide(wmOperatorType *ot)
void MESH_OT_customdata_mask_clear(wmOperatorType *ot)
Definition mesh_data.cc:575
void MESH_OT_convex_hull(wmOperatorType *ot)
void MESH_OT_select_more(wmOperatorType *ot)
void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
void MESH_OT_duplicate(wmOperatorType *ot)
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
Definition mesh_data.cc:748
void MESH_OT_intersect(wmOperatorType *ot)
void MESH_OT_select_less(wmOperatorType *ot)
void MESH_OT_screw(wmOperatorType *ot)
void MESH_OT_delete_edgeloop(wmOperatorType *ot)
void MESH_OT_primitive_cube_add(wmOperatorType *ot)
void MESH_OT_loop_select(wmOperatorType *ot)
void MESH_OT_dissolve_verts(wmOperatorType *ot)
void MESH_OT_decimate(wmOperatorType *ot)
wmKeyMap * point_normals_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
void MESH_OT_vert_connect_nonplanar(wmOperatorType *ot)
void MESH_OT_select_edge_ring_multi(wmOperatorType *ot)
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
Definition mesh_data.cc:709
void MESH_OT_select_ungrouped(wmOperatorType *ot)
void MESH_OT_select_axis(wmOperatorType *ot)
void MESH_OT_wireframe(wmOperatorType *ot)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
void MESH_OT_primitive_circle_add(wmOperatorType *ot)
void MESH_OT_knife_tool(wmOperatorType *ot)
void MESH_OT_colors_rotate(wmOperatorType *ot)
void MESH_OT_poke(wmOperatorType *ot)
void ED_operatortypes_mesh()
Definition mesh_ops.cc:23
void MESH_OT_vertices_smooth(wmOperatorType *ot)
void MESH_OT_split_normals(wmOperatorType *ot)
void MESH_OT_reorder_vertices_spatial(wmOperatorType *ot)
Definition meshtools.cc:978
void MESH_OT_select_interior_faces(wmOperatorType *ot)
void MESH_OT_vert_connect_path(wmOperatorType *ot)
void MESH_OT_loopcut(wmOperatorType *ot)
void MESH_OT_blend_from_shape(wmOperatorType *ot)
void MESH_OT_subdivide_edgering(wmOperatorType *ot)
void MESH_OT_split(wmOperatorType *ot)
void MESH_OT_merge(wmOperatorType *ot)
void MESH_OT_primitive_plane_add(wmOperatorType *ot)
void MESH_OT_symmetry_snap(wmOperatorType *ot)
void MESH_OT_delete_loose(wmOperatorType *ot)
void MESH_OT_select_linked_pick(wmOperatorType *ot)
void MESH_OT_rip_edge(wmOperatorType *ot)
void MESH_OT_extrude_repeat(wmOperatorType *ot)
wmKeyMap * knifetool_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_extrude_region(wmOperatorType *ot)
void MESH_OT_solidify(wmOperatorType *ot)
bool ED_operator_editmesh(bContext *C)
void MESH_OT_uvs_reverse(wmOperatorType *ot)
void MESH_OT_shortest_path_select(wmOperatorType *ot)
void MESH_OT_face_make_planar(wmOperatorType *ot)
void MESH_OT_attribute_set(wmOperatorType *ot)
void MESH_OT_knife_project(wmOperatorType *ot)
void MESH_OT_edge_face_add(wmOperatorType *ot)
void MESH_OT_select_mirror(wmOperatorType *ot)
void MESH_OT_flip_normals(wmOperatorType *ot)
void MESH_OT_bevel(wmOperatorType *ot)
void MESH_OT_separate(wmOperatorType *ot)
void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
void MESH_OT_dissolve_degenerate(wmOperatorType *ot)
void MESH_OT_primitive_cone_add(wmOperatorType *ot)
void MESH_OT_smooth_normals(wmOperatorType *ot)
wmKeyMap * bevel_modal_keymap(wmKeyConfig *keyconf)
void MESH_OT_loop_to_region(wmOperatorType *ot)
void MESH_OT_offset_edge_loops(wmOperatorType *ot)
Object * CTX_data_edit_object(const bContext *C)
void MESH_OT_select_face_by_sides(wmOperatorType *ot)
void MESH_OT_mark_seam(wmOperatorType *ot)
void MESH_OT_primitive_quad_sphere_add(wmOperatorType *ot)
void MESH_OT_select_by_attribute(wmOperatorType *ot)
void MESH_OT_vert_connect(wmOperatorType *ot)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:935
void MESH_OT_edges_select_sharp(wmOperatorType *ot)
void MESH_OT_spin(wmOperatorType *ot)
void MESH_OT_faces_shade_flat(wmOperatorType *ot)
void MESH_OT_select_boundary_loop_multi(wmOperatorType *ot)
void MESH_OT_select_similar(wmOperatorType *ot)
void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
void MESH_OT_average_normals(wmOperatorType *ot)
void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
void MESH_OT_set_normals_from_faces(wmOperatorType *ot)
void MESH_OT_edgering_select(wmOperatorType *ot)
void MESH_OT_mark_sharp(wmOperatorType *ot)
void MESH_OT_fill_holes(wmOperatorType *ot)
void MESH_OT_select_loose(wmOperatorType *ot)
void MESH_OT_normals_tools(wmOperatorType *ot)
void MESH_OT_dissolve_mode(wmOperatorType *ot)
void MESH_OT_bisect(wmOperatorType *ot)
void MESH_OT_shortest_path_pick(wmOperatorType *ot)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void MESH_OT_select_non_manifold(wmOperatorType *ot)
void MESH_OT_normals_make_consistent(wmOperatorType *ot)
void MESH_OT_fill_grid(wmOperatorType *ot)
void MESH_OT_select_edge_loop_multi(wmOperatorType *ot)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
Definition editmesh.cc:59
void MESH_OT_uvs_rotate(wmOperatorType *ot)
void MESH_OT_uv_texture_add(wmOperatorType *ot)
Definition mesh_data.cc:411
void MESH_OT_uv_texture_remove(wmOperatorType *ot)
Definition mesh_data.cc:446
void MESH_OT_polybuild_delete_at_cursor(wmOperatorType *ot)
void MESH_OT_delete(wmOperatorType *ot)
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
void MESH_OT_inset(wmOperatorType *ot)
void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
void MESH_OT_face_split_by_edges(wmOperatorType *ot)
void MESH_OT_colors_reverse(wmOperatorType *ot)
void MESH_OT_select_linked(wmOperatorType *ot)
void MESH_OT_polybuild_dissolve_at_cursor(wmOperatorType *ot)
void MESH_OT_circularize(wmOperatorType *ot)
void MESH_OT_customdata_skin_add(wmOperatorType *ot)
Definition mesh_data.cc:632
void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
Definition mesh_data.cc:673
void MESH_OT_space_edge_loops_evenly(wmOperatorType *ot)
void MESH_OT_reveal(wmOperatorType *ot)
void MESH_OT_fill(wmOperatorType *ot)
void MESH_OT_point_normals(wmOperatorType *ot)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
void MESH_OT_curve_edge_loops_between_selected(wmOperatorType *ot)
void MESH_OT_polybuild_face_at_cursor(wmOperatorType *ot)
void MESH_OT_select_nth(wmOperatorType *ot)
void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
void MESH_OT_hide(wmOperatorType *ot)
void MESH_OT_unsubdivide(wmOperatorType *ot)
void MESH_OT_flatten(wmOperatorType *ot)
void MESH_OT_sort_elements(wmOperatorType *ot)
void MESH_OT_select_all(wmOperatorType *ot)
void MESH_OT_dissolve_limited(wmOperatorType *ot)
void MESH_OT_edge_collapse(wmOperatorType *ot)
void MESH_OT_rip(wmOperatorType *ot)
void MESH_OT_select_mode(wmOperatorType *ot)
void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
void MESH_OT_region_to_loop(wmOperatorType *ot)
void MESH_OT_select_random(wmOperatorType *ot)
void MESH_OT_relax_edge_loops(wmOperatorType *ot)
void MESH_OT_primitive_grid_add(wmOperatorType *ot)
void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
void MESH_OT_primitive_cube_add_gizmo(wmOperatorType *ot)
void MESH_OT_polybuild_transform_at_cursor(wmOperatorType *ot)
void MESH_OT_edge_split(wmOperatorType *ot)
void MESH_OT_remove_doubles(wmOperatorType *ot)
void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
void MESH_OT_flip_quad_tessellation(wmOperatorType *ot)
void MESH_OT_edge_rotate(wmOperatorType *ot)
void MESH_OT_select_similar_region(wmOperatorType *ot)
void MESH_OT_intersect_boolean(wmOperatorType *ot)
void MESH_OT_extrude_context(wmOperatorType *ot)
void ED_keymap_mesh(wmKeyConfig *keyconf)
Definition mesh_ops.cc:371
const NodeType * type
Definition graph/node.h:179
bool(*) poll(struct bContext *)