vert to sphere - S + ctrl + shift keys
This commit is contained in:
@@ -3625,7 +3625,7 @@ void MESH_OT_selectrandom_mesh(wmOperatorType *ot)
|
||||
/* props */
|
||||
|
||||
|
||||
RNA_def_int(ot->srna, "percentage", 50, 0, 100, "percentage", "", 0, 100);
|
||||
RNA_def_int(ot->srna, "percentage", 50, 0, 100, "Percentage", "", 0, 100);
|
||||
}
|
||||
|
||||
void editmesh_select_by_material(EditMesh *em, int index)
|
||||
@@ -4499,12 +4499,11 @@ void vertexnoise(Object *obedit, EditMesh *em)
|
||||
|
||||
}
|
||||
|
||||
void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em)
|
||||
void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, int perc)
|
||||
{
|
||||
EditVert *eve;
|
||||
float *curs, len, vec[3], cent[3], fac, facm, imat[3][3], bmat[3][3];
|
||||
int tot;
|
||||
short perc=100;
|
||||
|
||||
// XXX if(button(&perc, 1, 100, "Percentage:")==0) return;
|
||||
|
||||
@@ -4557,3 +4556,35 @@ void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em)
|
||||
|
||||
}
|
||||
|
||||
static int vertices_to_sphere_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
|
||||
|
||||
vertices_to_sphere(scene, v3d, obedit, em, RNA_int_get(op->ptr,"percentage"));
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_vertices_to_sphere(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Vertices to Sphere";
|
||||
ot->idname= "MESH_OT_vertices_to_sphere";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= vertices_to_sphere_exec;
|
||||
ot->poll= ED_operator_editmesh;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
|
||||
|
||||
/* props */
|
||||
|
||||
|
||||
RNA_def_int(ot->srna, "percentage", 100, 0, 100, "Percentage", "", 0, 100);
|
||||
}
|
||||
|
||||
@@ -190,6 +190,7 @@ void MESH_OT_similar_vertex_select(struct wmOperatorType *ot);
|
||||
void MESH_OT_similar_edge_select(struct wmOperatorType *ot);
|
||||
void MESH_OT_similar_face_select(struct wmOperatorType *ot);
|
||||
void MESH_OT_selectrandom_mesh(struct wmOperatorType *ot);
|
||||
void MESH_OT_vertices_to_sphere(struct wmOperatorType *ot);
|
||||
|
||||
extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
|
||||
extern void EM_automerge(int update);
|
||||
|
||||
@@ -140,6 +140,7 @@ void ED_operatortypes_mesh(void)
|
||||
WM_operatortype_append(MESH_OT_removedoublesflag);
|
||||
WM_operatortype_append(MESH_OT_extrude_mesh);
|
||||
WM_operatortype_append(MESH_OT_edit_faces);
|
||||
WM_operatortype_append(MESH_OT_vertices_to_sphere);
|
||||
|
||||
WM_operatortype_append(MESH_OT_delete_mesh);
|
||||
|
||||
@@ -186,6 +187,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
|
||||
RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_selectrandom_mesh", SPACEKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_add_item(keymap, "MESH_OT_vertices_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
|
||||
|
||||
/* temp hotkeys! */
|
||||
WM_keymap_add_item(keymap, "MESH_OT_similar_vertex_select", GKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
Reference in New Issue
Block a user