Recommitted eltopo collision code (but disabled by default)
with Genscher's permission.

To use, you need to install liblapack and libblas
This commit is contained in:
Joseph Eagar 2011-05-03 01:48:15 +00:00
parent 1fdc760bfe
commit 03734f5c58
9 changed files with 95 additions and 54 deletions

@ -795,6 +795,9 @@ class USERPREF_PT_input(InputKeyMapPanel):
sub.separator()
sub.label(text="Loop Cut:")
sub.prop(inputs, "loopcut_finish_on_release")
sub.label(text="Orbit Style:")
sub.row().prop(inputs, "view_rotate_method", expand=True)

@ -100,6 +100,7 @@ typedef struct tringselOpData {
int extend;
int do_cut;
wmTimer *timer;
} tringselOpData;
/* modal loop selection drawing callback */
@ -315,10 +316,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
}
/* called when modal loop selection is done... */
static void ringsel_exit(wmOperator *op)
static void ringsel_exit(bContext *C, wmOperator *op)
{
tringselOpData *lcd= op->customdata;
if (lcd->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), lcd->timer);
/* deactivate the extra drawing stuff in 3D-View */
ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle);
@ -354,10 +358,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
return 1;
}
static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op)
static int ringcut_cancel (bContext *C, wmOperator *op)
{
/* this is just a wrapper around exit() */
ringsel_exit(op);
ringsel_exit(C, op);
return OPERATOR_CANCELLED;
}
@ -375,7 +379,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
lcd = op->customdata;
if (lcd->em->selectmode == SCE_SELECT_FACE) {
ringsel_exit(op);
ringsel_exit(C, op);
WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL);
return OPERATOR_CANCELLED;
}
@ -385,7 +389,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
edge = findnearestedge(&lcd->vc, &dist);
if(!edge) {
ringsel_exit(op);
ringsel_exit(C, op);
return OPERATOR_CANCELLED;
}
@ -393,7 +397,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
ringsel_find_edge(lcd, 1);
ringsel_finish(C, op);
ringsel_exit(op);
ringsel_exit(C, op);
return OPERATOR_FINISHED;
}
@ -404,7 +408,11 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
tringselOpData *lcd;
EditEdge *edge;
int dist = 75;
/*if we're in the cut-n-slide macro, set release_confirm based on user pref*/
if (op->opm)
RNA_boolean_set(op->next->ptr, "release_confirm", U.loopcut_finish_on_release);
if(modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display");
@ -437,22 +445,34 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C);
switch (event->type) {
case LEFTMOUSE: /* confirm */ // XXX hardcoded
if (event->val == KM_PRESS) {
if (event->val == KM_RELEASE) {
/* finish */
ED_region_tag_redraw(lcd->ar);
ringsel_finish(C, op);
ringsel_exit(op);
ringsel_exit(C, op);
ED_area_headerprint(CTX_wm_area(C), NULL);
return OPERATOR_FINISHED;
return OPERATOR_FINISHED|OPERATOR_ABORT_MACRO;
}else {
lcd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER2, 0.12);
}
ED_region_tag_redraw(lcd->ar);
break;
case TIMER2:
/* finish */
ED_region_tag_redraw(lcd->ar);
ringsel_finish(C, op);
ringsel_exit(C, op);
ED_area_headerprint(CTX_wm_area(C), NULL);
return OPERATOR_FINISHED;
case RIGHTMOUSE: /* abort */ // XXX hardcoded
case ESCKEY:
if (event->val == KM_RELEASE) {

@ -175,8 +175,10 @@ void ED_operatormacros_mesh(void)
ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Cut mesh loop and slide it";
WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
RNA_boolean_set(otmacro->ptr, "release_confirm", 1);
RNA_int_set(otmacro->ptr, "launch_event", LEFTMOUSE);
ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Duplicate mesh and move";
WM_operatortype_macro_define(ot, "MESH_OT_duplicate");

@ -1521,7 +1521,9 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->mode = mode;
t->launch_event = event ? event->type : -1;
if (RNA_property_is_set(op->ptr, "launch_event"))
t->launch_event = RNA_int_get(op->ptr, "launch_event");
if (t->launch_event == EVT_TWEAK_R)
{
t->launch_event = RIGHTMOUSE;

@ -495,10 +495,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
{
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
}
// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
/*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
//RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_int(ot->srna, "launch_event", 0, 0, INT_MAX, "Launch Event", "", 0, INT_MAX);
}
void TRANSFORM_OT_translate(struct wmOperatorType *ot)
@ -742,7 +743,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
ot->poll = ED_operator_editmesh;
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
Transform_Properties(ot, P_MIRROR|P_SNAP);
}

@ -383,13 +383,13 @@ typedef struct UserDef {
short autokey_mode; /* autokeying mode */
short autokey_flag; /* flags for autokeying */
short text_render, pad9; /*options for text rendering*/
short text_render, dsm_maxmem; /*options for text rendering*/
float pad10;
struct ColorBand coba_weight; /* from texture.h */
float sculpt_paint_overlay_col[3];
int pad3;
int loopcut_finish_on_release;
char author[80]; /* author name for file formats supporting it */
} UserDef;

@ -312,6 +312,7 @@ typedef struct wmOperator {
#define OPERATOR_PASS_THROUGH 8
/* in case operator got executed outside WM code... like via fileselect */
#define OPERATOR_HANDLED 16
#define OPERATOR_ABORT_MACRO 32
/* wmOperator flag */
#define OP_GRAB_POINTER 1

@ -2676,6 +2676,10 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_enum_items(prop, view_zoom_axes);
RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on");
prop= RNA_def_property(srna, "loopcut_finish_on_release", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "loopcut_finish_on_release", 1);
RNA_def_property_ui_text(prop, "End Loopcut Slide On Release", "End Loopcut Slide On Mouse Release, a 'click-drag-and-hold' workflow");
prop= RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");

@ -214,6 +214,9 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
} else {
break; /* operator didn't finish, end macro */
}
if (retval & OPERATOR_ABORT_MACRO)
break;
}
}
@ -239,6 +242,9 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event,
} else {
break; /* operator didn't finish, end macro */
}
if (retval & OPERATOR_ABORT_MACRO)
break;
}
return wm_macro_end(op, retval);
@ -265,43 +271,45 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
MacroData *md = op->customdata;
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
retval = wm_macro_invoke_internal(C, op, event, opm->next);
/* if new operator is modal and also added its own handler */
if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) {
wmWindow *win = CTX_wm_window(C);
wmEventHandler *handler = NULL;
for (handler = win->modalhandlers.first; handler; handler = handler->next) {
/* first handler in list is the new one */
if (handler->op == op)
break;
}
if (handler) {
BLI_remlink(&win->modalhandlers, handler);
wm_event_free_handler(handler);
}
/* if operator is blocking, grab cursor
* This may end up grabbing twice, but we don't care.
* */
if(op->opm->type->flag & OPTYPE_BLOCKING) {
int bounds[4] = {-1,-1,-1,-1};
int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
if(wrap) {
ARegion *ar= CTX_wm_region(C);
if(ar) {
bounds[0]= ar->winrct.xmin;
bounds[1]= ar->winrct.ymax;
bounds[2]= ar->winrct.xmax;
bounds[3]= ar->winrct.ymin;
}
if (!(retval & OPERATOR_ABORT_MACRO)) {
retval = wm_macro_invoke_internal(C, op, event, opm->next);
/* if new operator is modal and also added its own handler */
if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) {
wmWindow *win = CTX_wm_window(C);
wmEventHandler *handler = NULL;
for (handler = win->modalhandlers.first; handler; handler = handler->next) {
/* first handler in list is the new one */
if (handler->op == op)
break;
}
if (handler) {
BLI_remlink(&win->modalhandlers, handler);
wm_event_free_handler(handler);
}
/* if operator is blocking, grab cursor
* This may end up grabbing twice, but we don't care.
* */
if(op->opm->type->flag & OPTYPE_BLOCKING) {
int bounds[4] = {-1,-1,-1,-1};
int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
if(wrap) {
ARegion *ar= CTX_wm_region(C);
if(ar) {
bounds[0]= ar->winrct.xmin;
bounds[1]= ar->winrct.ymax;
bounds[2]= ar->winrct.xmax;
bounds[3]= ar->winrct.ymin;
}
}
WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds);
}
WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds);
}
}
}