2.5: Curve edit mode. Transform works again, and editcurve.c is

partly operatorized though nothing hooked up yet.
This commit is contained in:
2009-02-11 23:02:21 +00:00
parent 51fc28efc7
commit b8e6e01cfd
8 changed files with 1150 additions and 502 deletions

View File

@@ -38,5 +38,38 @@ char *ED_lorem;
/* editfont.c */
void FONT_OT_textedit(struct wmOperatorType *ot);
/* editcurve.c */
void CURVE_OT_separate(struct wmOperatorType *ot);
void CURVE_OT_switch_direction(struct wmOperatorType *ot);
void CURVE_OT_set_weight(struct wmOperatorType *ot);
void CURVE_OT_set_radius(struct wmOperatorType *ot);
void CURVE_OT_smooth(struct wmOperatorType *ot);
void CURVE_OT_smooth_curve_radius(struct wmOperatorType *ot);
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
void CURVE_OT_de_select_all(struct wmOperatorType *ot);
void CURVE_OT_hide(struct wmOperatorType *ot);
void CURVE_OT_reveal(struct wmOperatorType *ot);
void CURVE_OT_select_invert(struct wmOperatorType *ot);
void CURVE_OT_subdivide(struct wmOperatorType *ot);
void CURVE_OT_set_spline_type(struct wmOperatorType *ot);
void CURVE_OT_make_segment(struct wmOperatorType *ot);
void CURVE_OT_spin(struct wmOperatorType *ot);
void CURVE_OT_add_vertex(struct wmOperatorType *ot);
void CURVE_OT_extrude(struct wmOperatorType *ot);
void CURVE_OT_make_cyclic(struct wmOperatorType *ot);
void CURVE_OT_select_linked(struct wmOperatorType *ot);
void CURVE_OT_select_row(struct wmOperatorType *ot);
void CURVE_OT_select_next(struct wmOperatorType *ot);
void CURVE_OT_select_previous(struct wmOperatorType *ot);
void CURVE_OT_select_more(struct wmOperatorType *ot);
void CURVE_OT_select_less(struct wmOperatorType *ot);
void CURVE_OT_select_random(struct wmOperatorType *ot);
void CURVE_OT_select_every_nth(struct wmOperatorType *ot);
void CURVE_OT_add_duplicate(struct wmOperatorType *ot);
void CURVE_OT_delete(struct wmOperatorType *ot);
void CURVE_OT_set_smooth(struct wmOperatorType *ot);
void CURVE_OT_clear_tilt(struct wmOperatorType *ot);
#endif /* ED_UTIL_INTERN_H */

View File

@@ -64,6 +64,38 @@
void ED_operatortypes_curve(void)
{
WM_operatortype_append(FONT_OT_textedit);
WM_operatortype_append(CURVE_OT_separate);
WM_operatortype_append(CURVE_OT_switch_direction);
WM_operatortype_append(CURVE_OT_set_weight);
WM_operatortype_append(CURVE_OT_set_radius);
WM_operatortype_append(CURVE_OT_smooth);
WM_operatortype_append(CURVE_OT_smooth_curve_radius);
WM_operatortype_append(CURVE_OT_de_select_first);
WM_operatortype_append(CURVE_OT_de_select_last);
WM_operatortype_append(CURVE_OT_de_select_all);
WM_operatortype_append(CURVE_OT_hide);
WM_operatortype_append(CURVE_OT_reveal);
WM_operatortype_append(CURVE_OT_select_invert);
WM_operatortype_append(CURVE_OT_subdivide);
WM_operatortype_append(CURVE_OT_set_spline_type);
WM_operatortype_append(CURVE_OT_make_segment);
WM_operatortype_append(CURVE_OT_spin);
WM_operatortype_append(CURVE_OT_add_vertex);
WM_operatortype_append(CURVE_OT_extrude);
WM_operatortype_append(CURVE_OT_make_cyclic);
WM_operatortype_append(CURVE_OT_select_linked);
WM_operatortype_append(CURVE_OT_select_row);
WM_operatortype_append(CURVE_OT_select_next);
WM_operatortype_append(CURVE_OT_select_previous);
WM_operatortype_append(CURVE_OT_select_more);
WM_operatortype_append(CURVE_OT_select_less);
WM_operatortype_append(CURVE_OT_select_random);
WM_operatortype_append(CURVE_OT_select_every_nth);
WM_operatortype_append(CURVE_OT_add_duplicate);
WM_operatortype_append(CURVE_OT_delete);
WM_operatortype_append(CURVE_OT_set_smooth);
WM_operatortype_append(CURVE_OT_clear_tilt);
}
void ED_keymap_curve(wmWindowManager *wm)
@@ -77,6 +109,5 @@ void ED_keymap_curve(wmWindowManager *wm)
keymap= WM_keymap_listbase(wm, "Curve", 0, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
}

File diff suppressed because it is too large Load Diff

View File

@@ -2661,7 +2661,7 @@ void MESH_OT_hide(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
RNA_def_boolean(ot->srna, "invert", 0, "Invert", "Hide unselected rather than selected.");
}
void EM_reveal_mesh(EditMesh *em)
@@ -3167,7 +3167,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */
}
static int selectswap_mesh_exec(bContext *C, wmOperator *op)
static int select_invert_mesh_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
@@ -3181,11 +3181,11 @@ static int selectswap_mesh_exec(bContext *C, wmOperator *op)
void MESH_OT_select_invert(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select Swap";
ot->name= "Select Invert";
ot->idname= "MESH_OT_select_invert";
/* api callbacks */
ot->exec= selectswap_mesh_exec;
ot->exec= select_invert_mesh_exec;
ot->poll= ED_operator_editmesh;
/* flags */
@@ -3388,7 +3388,7 @@ static void selectrandom_mesh(EditMesh *em, float perc) /* randomly selects a us
EditVert *eve;
EditEdge *eed;
EditFace *efa;
float randfac= perc/100.0f;
float randfac= perc;
/* Get the percentage of vertices to randomly select as 'randfac' */
// XXX if(button(&randfac,0, 100,"Percentage:")==0) return;
@@ -3451,7 +3451,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
/* props */
RNA_def_float(ot->srna, "percent", 50.0f, 0.0f, 100.0f, "Percent", "percentage of mesh data to randomly select", 0.01f, 100.0f);
RNA_def_float(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
}
void editmesh_select_by_material(EditMesh *em, int index)

View File

@@ -1170,7 +1170,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op)
void MESH_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Delete Mesh";
ot->name= "Delete";
ot->idname= "MESH_OT_delete";
/* api callbacks */
@@ -6672,7 +6672,7 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
}
static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -6735,7 +6735,7 @@ void MESH_OT_subdivs(wmOperatorType *ot)
/* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/
RNA_def_int(ot->srna, "number_cuts", 4, 1, 10, "Number of Cuts", "", 1, INT_MAX);
RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f);
RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
}

View File

@@ -238,6 +238,9 @@ int ED_operator_editcurve(bContext *C)
if(obedit && obedit->type==OB_CURVE)
return NULL != ((Mesh *)obedit->data)->edit_mesh;
return 0;
// XXX this test was in many tools, still needed?
// if(v3d==0 || (v3d->lay & obedit->lay)==0 ) return 0;
}

View File

@@ -1338,8 +1338,6 @@ TransDataCurveHandleFlags *initTransDataCurveHandes(TransData *td, struct BezTri
static void createTransCurveVerts(bContext *C, TransInfo *t)
{
// TRANSFORM_FIX_ME
#if 0
Object *obedit= CTX_data_edit_object(C);
Curve *cu= obedit->data;
TransData *td = NULL;
@@ -1542,7 +1540,6 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
calc_distanceCurveVerts(head, tail-1);
}
}
#endif
}
/* ********************* lattice *************** */

View File

@@ -351,41 +351,12 @@ void recalcData(TransInfo *t)
}
}
}
else if (t->obedit) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
Nurb *nu= cu->editnurb->first;
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
while(nu) {
calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
} else {
/* Normal updating */
while(nu) {
test2DNurb(nu);
calchandlesNurb(nu);
nu= nu->next;
}
retopo_do_all();
}
}
else if(t->obedit->type==OB_LATTICE) {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if(editLatt->flag & LT_OUTSIDE) outside_lattice(editLatt);
}
else {
DAG_object_flush_update(G.scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
}
#endif
if (t->obedit) {
}
else if(G.f & G_PARTICLEEDIT) {
flushTransParticles(t);
}
#endif
if (t->spacetype==SPACE_NODE) {
flushTransNodes(t);
}
@@ -446,7 +417,35 @@ void recalcData(TransInfo *t)
}
}
else if (t->obedit) {
if (t->obedit->type == OB_MESH) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
Nurb *nu= cu->editnurb->first;
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
while(nu) {
calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
} else {
/* Normal updating */
while(nu) {
test2DNurb(nu);
calchandlesNurb(nu);
nu= nu->next;
}
/* TRANSFORM_FIX_ME */
// retopo_do_all();
}
}
else if(t->obedit->type==OB_LATTICE) {
Lattice *la= t->obedit->data;
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
if(la->editlatt->flag & LT_OUTSIDE) outside_lattice(la->editlatt);
}
else if (t->obedit->type == OB_MESH) {
if(t->spacetype==SPACE_IMAGE) {
SpaceImage *sima= t->sa->spacedata.first;
@@ -454,7 +453,7 @@ void recalcData(TransInfo *t)
if(sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA);
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);
} else {
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
/* mirror modifier clipping? */
@@ -466,10 +465,10 @@ void recalcData(TransInfo *t)
// }
clipMirrorModifier(t, t->obedit);
}
if((t->options & CTX_NO_MIRROR) == 0 && (t->scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
if((t->options & CTX_NO_MIRROR) == 0 && (scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
DAG_object_flush_update(t->scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
recalc_editnormals(em);
}
@@ -552,6 +551,8 @@ void recalcData(TransInfo *t)
transform_armature_mirror_update(t->obedit);
}
else
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
}
else if( (t->flag & T_POSE) && t->poseobj) {
Object *ob= t->poseobj;