Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_tools.c
| Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | void MESH_OT_subdivide(wmOperatorType *ot) | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* properties */ | /* properties */ | ||||
| prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10); | prop = RNA_def_int(ot->srna, "number_cuts", 1, 1, 100, "Number of Cuts", "", 1, 10); | ||||
| /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */ | /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */ | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | |||||
| RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f); | prop = RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1e3f, "Smoothness", "Smoothness factor", 0.0f, 1.0f); | ||||
| RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | |||||
| RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons"); | RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons"); | ||||
| RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_CORNER_STRAIGHT_CUT, | RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_CORNER_STRAIGHT_CUT, | ||||
| "Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)"); | "Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)"); | ||||
| RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, 1e6f, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f); | RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, 1e6f, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f); | ||||
| RNA_def_float(ot->srna, "fractal_along_normal", 0.0f, 0.0f, 1.0f, | RNA_def_float(ot->srna, "fractal_along_normal", 0.0f, 0.0f, 1.0f, | ||||
| "Along Normal", "Apply fractal displacement along normal only", 0.0f, 1.0f); | "Along Normal", "Apply fractal displacement along normal only", 0.0f, 1.0f); | ||||
| ▲ Show 20 Lines • Show All 701 Lines • ▼ Show 20 Lines | void MESH_OT_mark_seam(wmOperatorType *ot) | ||||
| ot->description = "(Un)mark selected edges as a seam"; | ot->description = "(Un)mark selected edges as a seam"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = edbm_mark_seam_exec; | ot->exec = edbm_mark_seam_exec; | ||||
| ot->poll = ED_operator_editmesh; | ot->poll = ED_operator_editmesh; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| prop = RNA_def_boolean(ot->srna, "clear", 0, "Clear", ""); | prop = RNA_def_boolean(ot->srna, "clear", 0, "Clear", ""); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | |||||
| } | } | ||||
| static int edbm_mark_sharp_exec(bContext *C, wmOperator *op) | static int edbm_mark_sharp_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| Mesh *me = ((Mesh *)obedit->data); | Mesh *me = ((Mesh *)obedit->data); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| BMesh *bm = em->bm; | BMesh *bm = em->bm; | ||||
| Show All 35 Lines | void MESH_OT_mark_sharp(wmOperatorType *ot) | ||||
| ot->description = "(Un)mark selected edges as sharp"; | ot->description = "(Un)mark selected edges as sharp"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = edbm_mark_sharp_exec; | ot->exec = edbm_mark_sharp_exec; | ||||
| ot->poll = ED_operator_editmesh; | ot->poll = ED_operator_editmesh; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| prop = RNA_def_boolean(ot->srna, "clear", false, "Clear", ""); | prop = RNA_def_boolean(ot->srna, "clear", false, "Clear", ""); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_boolean(ot->srna, "use_verts", false, "Vertices", | prop = RNA_def_boolean(ot->srna, "use_verts", false, "Vertices", | ||||
| "Consider vertices instead of edges to select which edges to (un)tag as sharp"); | "Consider vertices instead of edges to select which edges to (un)tag as sharp"); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| } | } | ||||
| static int edbm_vert_connect_exec(bContext *C, wmOperator *op) | static int edbm_vert_connect_exec(bContext *C, wmOperator *op) | ||||
| ▲ Show 20 Lines • Show All 854 Lines • ▼ Show 20 Lines | static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) | ||||
| EDBM_update_generic(em, true, false); | EDBM_update_generic(em, true, false); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void MESH_OT_vertices_smooth(wmOperatorType *ot) | void MESH_OT_vertices_smooth(wmOperatorType *ot) | ||||
| { | { | ||||
| PropertyRNA *prop; | |||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Smooth Vertex"; | ot->name = "Smooth Vertex"; | ||||
| ot->description = "Flatten angles of selected vertices"; | ot->description = "Flatten angles of selected vertices"; | ||||
| ot->idname = "MESH_OT_vertices_smooth"; | ot->idname = "MESH_OT_vertices_smooth"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = edbm_do_smooth_vertex_exec; | ot->exec = edbm_do_smooth_vertex_exec; | ||||
| ot->poll = ED_operator_editmesh; | ot->poll = ED_operator_editmesh; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| RNA_def_float(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f); | prop = RNA_def_float(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f); | ||||
| RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Repeat", "Number of times to smooth the mesh", 1, 100); | RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | ||||
| prop = RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Repeat", "Number of times to smooth the mesh", 1, 100); | |||||
| RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | |||||
| RNA_def_boolean(ot->srna, "xaxis", true, "X-Axis", "Smooth along the X axis"); | RNA_def_boolean(ot->srna, "xaxis", true, "X-Axis", "Smooth along the X axis"); | ||||
| RNA_def_boolean(ot->srna, "yaxis", true, "Y-Axis", "Smooth along the Y axis"); | RNA_def_boolean(ot->srna, "yaxis", true, "Y-Axis", "Smooth along the Y axis"); | ||||
| RNA_def_boolean(ot->srna, "zaxis", true, "Z-Axis", "Smooth along the Z axis"); | RNA_def_boolean(ot->srna, "zaxis", true, "Z-Axis", "Smooth along the Z axis"); | ||||
| } | } | ||||
| static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) | static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | static int edbm_do_smooth_laplacian_vertex_exec(bContext *C, wmOperator *op) | ||||
| EDBM_update_generic(em, true, false); | EDBM_update_generic(em, true, false); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot) | void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot) | ||||
| { | { | ||||
| PropertyRNA *prop; | |||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Laplacian Smooth Vertex"; | ot->name = "Laplacian Smooth Vertex"; | ||||
| ot->description = "Laplacian smooth of selected vertices"; | ot->description = "Laplacian smooth of selected vertices"; | ||||
| ot->idname = "MESH_OT_vertices_smooth_laplacian"; | ot->idname = "MESH_OT_vertices_smooth_laplacian"; | ||||
| /* api callbacks */ | /* api callbacks */ | ||||
| ot->exec = edbm_do_smooth_laplacian_vertex_exec; | ot->exec = edbm_do_smooth_laplacian_vertex_exec; | ||||
| ot->poll = ED_operator_editmesh; | ot->poll = ED_operator_editmesh; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| RNA_def_int(ot->srna, "repeat", 1, 1, 1000, | prop = RNA_def_int(ot->srna, "repeat", 1, 1, 1000, | ||||
| "Number of iterations to smooth the mesh", "", 1, 200); | "Number of iterations to smooth the mesh", "", 1, 200); | ||||
| RNA_def_float(ot->srna, "lambda_factor", 5e-5f, 1e-7f, 1000.0f, | RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | ||||
| prop = RNA_def_float(ot->srna, "lambda_factor", 5e-5f, 1e-7f, 1000.0f, | |||||
| "Lambda factor", "", 1e-7f, 1000.0f); | "Lambda factor", "", 1e-7f, 1000.0f); | ||||
| RNA_def_float(ot->srna, "lambda_border", 5e-5f, 1e-7f, 1000.0f, | RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | ||||
| prop = RNA_def_float(ot->srna, "lambda_border", 5e-5f, 1e-7f, 1000.0f, | |||||
| "Lambda factor in border", "", 1e-7f, 1000.0f); | "Lambda factor in border", "", 1e-7f, 1000.0f); | ||||
| RNA_def_property_tags(prop, OP_PROP_TAG_BASIC); | |||||
| RNA_def_boolean(ot->srna, "use_x", true, "Smooth X Axis", "Smooth object along X axis"); | RNA_def_boolean(ot->srna, "use_x", true, "Smooth X Axis", "Smooth object along X axis"); | ||||
| RNA_def_boolean(ot->srna, "use_y", true, "Smooth Y Axis", "Smooth object along Y axis"); | RNA_def_boolean(ot->srna, "use_y", true, "Smooth Y Axis", "Smooth object along Y axis"); | ||||
| RNA_def_boolean(ot->srna, "use_z", true, "Smooth Z Axis", "Smooth object along Z axis"); | RNA_def_boolean(ot->srna, "use_z", true, "Smooth Z Axis", "Smooth object along Z axis"); | ||||
| RNA_def_boolean(ot->srna, "preserve_volume", true, "Preserve Volume", "Apply volume preservation after smooth"); | RNA_def_boolean(ot->srna, "preserve_volume", true, "Preserve Volume", "Apply volume preservation after smooth"); | ||||
| } | } | ||||
| /********************** Smooth/Solid Operators *************************/ | /********************** Smooth/Solid Operators *************************/ | ||||
| ▲ Show 20 Lines • Show All 439 Lines • ▼ Show 20 Lines | void MESH_OT_merge(wmOperatorType *ot) | ||||
| ot->poll = ED_operator_editmesh; | ot->poll = ED_operator_editmesh; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* properties */ | /* properties */ | ||||
| ot->prop = RNA_def_enum(ot->srna, "type", merge_type_items, MESH_MERGE_CENTER, "Type", "Merge method to use"); | ot->prop = RNA_def_enum(ot->srna, "type", merge_type_items, MESH_MERGE_CENTER, "Type", "Merge method to use"); | ||||
| RNA_def_enum_funcs(ot->prop, merge_type_itemf); | RNA_def_enum_funcs(ot->prop, merge_type_itemf); | ||||
| RNA_def_property_tags(ot->prop, OP_PROP_TAG_BASIC); | |||||
| RNA_def_boolean(ot->srna, "uvs", false, "UVs", "Move UVs according to merge"); | RNA_def_boolean(ot->srna, "uvs", false, "UVs", "Move UVs according to merge"); | ||||
| } | } | ||||
| static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) | static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| ▲ Show 20 Lines • Show All 3,634 Lines • Show Last 20 Lines | |||||