static int transform_modal(bContext *C, wmOperator *op, wmEvent *event) { int exit_code; TransInfo *t = op->customdata; #if 0 // stable 2D mouse coords map to different 3D coords while the 3D mouse is active // in other words, 2D deltas are no longer good enough! // disable until individual 'transformers' behave better if (event->type == NDOF_MOTION) return OPERATOR_PASS_THROUGH; #endif /* XXX insert keys are called here, and require context */ t->context= C; exit_code = transformEvent(t, event); t->context= NULL; transformApply(C, t); exit_code |= transformEnd(C, t); if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } return exit_code; }
static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) { int exit_code; TransInfo *t = op->customdata; const enum TfmMode mode_prev = t->mode; #if 0 // stable 2D mouse coords map to different 3D coords while the 3D mouse is active // in other words, 2D deltas are no longer good enough! // disable until individual 'transformers' behave better if (event->type == NDOF_MOTION) return OPERATOR_PASS_THROUGH; #endif /* XXX insert keys are called here, and require context */ t->context = C; exit_code = transformEvent(t, event); t->context = NULL; transformApply(C, t); exit_code |= transformEnd(C, t); if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } else { if (mode_prev != t->mode) { /* WARNING: this is not normal to switch operator types * normally it would not be supported but transform happens * to share callbacks between differernt operators. */ wmOperatorType *ot_new = NULL; TransformModeItem *item = transform_modes; while (item->idname) { if (item->mode == t->mode) { ot_new = WM_operatortype_find(item->idname, false); break; } item++; } BLI_assert(ot_new != NULL); if (ot_new) { WM_operator_type_set(op, ot_new); } /* end suspicious code */ } } return exit_code; }
static int transform_exec(bContext *C, wmOperator *op) { TransInfo *t; if (!transformops_data(C, op, NULL)) { G.moving = 0; return OPERATOR_CANCELLED; } t = op->customdata; t->options |= CTX_AUTOCONFIRM; transformApply(C, t); transformEnd(C, t); transformops_exit(C, op); return OPERATOR_FINISHED; }
static int transform_modal(bContext *C, wmOperator *op, wmEvent *event) { int exit_code; TransInfo *t = op->customdata; /* XXX insert keys are called here, and require context */ t->context= C; exit_code = transformEvent(t, event); t->context= NULL; transformApply(C, t); exit_code |= transformEnd(C, t); if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } return exit_code; }
static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) { int exit_code; TransInfo *t = op->customdata; const enum TfmMode mode_prev = t->mode; #if 0 // stable 2D mouse coords map to different 3D coords while the 3D mouse is active // in other words, 2D deltas are no longer good enough! // disable until individual 'transformers' behave better if (event->type == NDOF_MOTION) return OPERATOR_PASS_THROUGH; #endif /* XXX insert keys are called here, and require context */ t->context = C; exit_code = transformEvent(t, event); t->context = NULL; /* XXX, workaround: active needs to be calculated before transforming, * since we're not reading from 'td->center' in this case. see: T40241 */ if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) { /* In camera view, tsnap callback is not set (see initSnappingMode() in transfrom_snap.c, and T40348). */ if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) { t->tsnap.targetSnap(t); } } transformApply(C, t); exit_code |= transformEnd(C, t); if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } else { if (mode_prev != t->mode) { /* WARNING: this is not normal to switch operator types * normally it would not be supported but transform happens * to share callbacks between different operators. */ wmOperatorType *ot_new = NULL; TransformModeItem *item = transform_modes; while (item->idname) { if (item->mode == t->mode) { ot_new = WM_operatortype_find(item->idname, false); break; } item++; } BLI_assert(ot_new != NULL); if (ot_new) { WM_operator_type_set(op, ot_new); } /* end suspicious code */ } } return exit_code; }