Removing MESH_OT_vertices_transform_to_sphere.
This operator was a port of the old ToSphere button that worked only around the cursor. To Sphere transform (Alt-Shift-S) can already do it around cursor if pivot is set to that, can be used interactively and work on more data types, so this is unneeded.
This commit is contained in:
@@ -4397,99 +4397,6 @@ void vertexnoise(Object *obedit, EditMesh *em)
|
||||
|
||||
}
|
||||
|
||||
static void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, float perc)
|
||||
{
|
||||
EditVert *eve;
|
||||
float *curs, len, vec[3], cent[3], fac, facm, imat[3][3], bmat[3][3];
|
||||
int tot;
|
||||
|
||||
// XXX if(button(&perc, 1, 100, "Percentage:")==0) return;
|
||||
|
||||
fac= perc/100.0f;
|
||||
facm= 1.0f-fac;
|
||||
|
||||
Mat3CpyMat4(bmat, obedit->obmat);
|
||||
Mat3Inv(imat, bmat);
|
||||
|
||||
/* center */
|
||||
curs= give_cursor(scene, v3d);
|
||||
cent[0]= curs[0]-obedit->obmat[3][0];
|
||||
cent[1]= curs[1]-obedit->obmat[3][1];
|
||||
cent[2]= curs[2]-obedit->obmat[3][2];
|
||||
Mat3MulVecfl(imat, cent);
|
||||
|
||||
len= 0.0;
|
||||
tot= 0;
|
||||
eve= em->verts.first;
|
||||
while(eve) {
|
||||
if(eve->f & SELECT) {
|
||||
tot++;
|
||||
len+= VecLenf(cent, eve->co);
|
||||
}
|
||||
eve= eve->next;
|
||||
}
|
||||
len/=tot;
|
||||
|
||||
if(len==0.0) len= 10.0;
|
||||
|
||||
eve= em->verts.first;
|
||||
while(eve) {
|
||||
if(eve->f & SELECT) {
|
||||
vec[0]= eve->co[0]-cent[0];
|
||||
vec[1]= eve->co[1]-cent[1];
|
||||
vec[2]= eve->co[2]-cent[2];
|
||||
|
||||
Normalize(vec);
|
||||
|
||||
eve->co[0]= fac*(cent[0]+vec[0]*len) + facm*eve->co[0];
|
||||
eve->co[1]= fac*(cent[1]+vec[1]*len) + facm*eve->co[1];
|
||||
eve->co[2]= fac*(cent[2]+vec[2]*len) + facm*eve->co[2];
|
||||
|
||||
}
|
||||
eve= eve->next;
|
||||
}
|
||||
|
||||
recalc_editnormals(em);
|
||||
// DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
|
||||
|
||||
}
|
||||
|
||||
static int vertices_to_sphere_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
|
||||
|
||||
vertices_to_sphere(scene, v3d, obedit, em, RNA_float_get(op->ptr,"percent"));
|
||||
|
||||
BKE_mesh_end_editmesh(obedit->data, em);
|
||||
|
||||
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void MESH_OT_vertices_transform_to_sphere(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Vertices to Sphere";
|
||||
//added "around cursor" to differentiate between "TFM_OT_tosphere()"
|
||||
ot->description= "Move selected vertices outward in a spherical shape around cursor.";
|
||||
ot->idname= "MESH_OT_vertices_transform_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_float(ot->srna, "percent", 100.0f, 0.0f, 100.0f, "Percent", "DOC_BROKEN", 0.01f, 100.0f);
|
||||
}
|
||||
|
||||
void flipface(EditMesh *em, EditFace *efa)
|
||||
{
|
||||
if(efa->v4) {
|
||||
|
||||
@@ -158,7 +158,6 @@ void MESH_OT_edges_select_sharp(struct wmOperatorType *ot);
|
||||
void MESH_OT_select_shortest_path(struct wmOperatorType *ot);
|
||||
void MESH_OT_select_similar(struct wmOperatorType *ot);
|
||||
void MESH_OT_select_random(struct wmOperatorType *ot);
|
||||
void MESH_OT_vertices_transform_to_sphere(struct wmOperatorType *ot);
|
||||
void MESH_OT_selection_type(struct wmOperatorType *ot);
|
||||
void MESH_OT_loop_multi_select(struct wmOperatorType *ot);
|
||||
void MESH_OT_mark_seam(struct wmOperatorType *ot);
|
||||
|
||||
@@ -103,7 +103,6 @@ void ED_operatortypes_mesh(void)
|
||||
WM_operatortype_append(MESH_OT_spin);
|
||||
WM_operatortype_append(MESH_OT_screw);
|
||||
|
||||
WM_operatortype_append(MESH_OT_vertices_transform_to_sphere);
|
||||
WM_operatortype_append(MESH_OT_split);
|
||||
WM_operatortype_append(MESH_OT_extrude_repeat);
|
||||
WM_operatortype_append(MESH_OT_edge_rotate);
|
||||
@@ -215,8 +214,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
|
||||
|
||||
RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
|
||||
RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user