Blender V4.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
9#include "DNA_scene_types.h"
10
11#include "RNA_access.hh"
12
13#include "WM_api.hh"
14#include "WM_types.hh"
15
16#include "ED_mesh.hh"
17#include "ED_screen.hh"
18
19#include "mesh_intern.hh" /* own include */
20
21/**************************** registration **********************************/
22
24{
25 using namespace blender::ed::mesh;
56
58
60
65
71
80
85
102 WM_operatortype_append(MESH_OT_set_sharpness_by_angle);
104#ifdef WITH_FREESTYLE
105 WM_operatortype_append(MESH_OT_mark_freestyle_face);
106#endif
107
111
123#if defined(WITH_FREESTYLE)
124 WM_operatortype_append(MESH_OT_mark_freestyle_edge);
125#endif
133
134 /* editmesh_polybuild */
140
148
151
161
163
173
174#ifdef WITH_BULLET
176#endif
177
181
185
195}
196
197#if 0 /* UNUSED, remove? */
198static int ED_operator_editmesh_face_select(bContext *C)
199{
200 Object *obedit = CTX_data_edit_object(C);
201 if (obedit && obedit->type == OB_MESH) {
203 if (em && em->selectmode & SCE_SELECT_FACE) {
204 return 1;
205 }
206 }
207 return 0;
208}
209#endif
210
212{
214 wmOperatorTypeMacro *otmacro;
215
216 ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide",
217 "Loop Cut and Slide",
218 "Cut mesh loop and slide it",
220 WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
221 WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
222
223 ot = WM_operatortype_append_macro("MESH_OT_offset_edge_loops_slide",
224 "Offset Edge Slide",
225 "Offset edge loop slide",
227 WM_operatortype_macro_define(ot, "MESH_OT_offset_edge_loops");
228 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
229 RNA_boolean_set(otmacro->ptr, "single_side", true);
230
231 ot = WM_operatortype_append_macro("MESH_OT_duplicate_move",
232 "Add Duplicate",
233 "Duplicate mesh and move",
235 WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
236 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
237 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
238 RNA_boolean_set(otmacro->ptr, "mirror", false);
239
240 ot = WM_operatortype_append_macro("MESH_OT_rip_move",
241 "Rip",
242 "Rip polygons and move the result",
244 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_rip");
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_edge_move",
250 "Extend Vertices",
251 "Extend vertices and move the result",
253 WM_operatortype_macro_define(ot, "MESH_OT_rip_edge");
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_extrude_region_move",
259 "Extrude Region and Move",
260 "Extrude region and move result",
262 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
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
268 "MESH_OT_extrude_manifold",
269 "Extrude Manifold",
270 "Extrude, dissolves edges whose faces form a flat surface and intersect new edges",
272 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
273 RNA_boolean_set(otmacro->ptr, "use_dissolve_ortho_edges", true);
274 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
275 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
276 RNA_boolean_set(otmacro->ptr, "mirror", false);
277 RNA_boolean_set(otmacro->ptr, "use_automerge_and_split", true);
278
279 ot = WM_operatortype_append_macro("MESH_OT_extrude_context_move",
280 "Extrude Region and Move",
281 "Extrude region together along the average normal",
283 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_context");
284 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
285 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
286 RNA_boolean_set(otmacro->ptr, "mirror", false);
287
288 ot = WM_operatortype_append_macro("MESH_OT_extrude_region_shrink_fatten",
289 "Extrude Region and Shrink/Fatten",
290 "Extrude region together along local normals",
292 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
293 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
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_faces_move",
298 "Extrude Individual Faces and Move",
299 "Extrude each individual face separately along local normals",
301 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
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_edges_move",
307 "Extrude Only Edges and Move",
308 "Extrude edges and move result",
310 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
311 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
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_vertices_move",
316 "Extrude Only Vertices and Move",
317 "Extrude vertices and move result",
319 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_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_polybuild_face_at_cursor_move",
325 "Face at Cursor Move",
326 nullptr,
328 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_face_at_cursor");
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_split_at_cursor_move",
334 "Split at Cursor Move",
335 nullptr,
337 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_split_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_transform_at_cursor_move",
343 "Transform at Cursor Move",
344 nullptr,
346 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_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_extrude_at_cursor_move",
352 "Extrude at Cursor Move",
353 nullptr,
355 WM_operatortype_macro_define(ot, "MESH_OT_polybuild_transform_at_cursor");
356 otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
357 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
358 RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
359 RNA_boolean_set(otmacro->ptr, "mirror", false);
360}
361
363{
364 wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Mesh", SPACE_EMPTY, RGN_TYPE_WINDOW);
365 keymap->poll = ED_operator_editmesh;
366
367 knifetool_modal_keymap(keyconf);
369 bevel_modal_keymap(keyconf);
370}
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:63
@ OB_MESH
@ SCE_SELECT_FACE
@ RGN_TYPE_WINDOW
@ SPACE_EMPTY
bool ED_operator_editmesh(bContext *C)
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
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 MESH_OT_paint_mask_extract(wmOperatorType *ot)
void MESH_OT_paint_mask_slice(wmOperatorType *ot)
void MESH_OT_face_set_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_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:535
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:496
void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
Definition mesh_data.cc:735
void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
Definition mesh_data.cc:778
void MESH_OT_convex_hull(wmOperatorType *ot)
void ED_operatortypes_mesh()
Definition mesh_ops.cc:23
void ED_keymap_mesh(wmKeyConfig *keyconf)
Definition mesh_ops.cc:362
void ED_operatormacros_mesh()
Definition mesh_ops.cc:211
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
short selectmode
bool(* poll)(struct bContext *)
wmOperatorType * ot
Definition wm_files.cc:4125
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:897
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)