Commit: aa93d417fc2f29a7badef28b17606f2ba44771ad Author: Campbell Barton Date: Tue Apr 10 13:52:15 2018 +0200 Branches: temp-object-multi-mode https://developer.blender.org/rBaa93d417fc2f29a7badef28b17606f2ba44771ad
tmp =================================================================== M source/blender/editors/transform/transform.c M source/blender/editors/transform/transform.h M source/blender/editors/transform/transform_conversions.c M source/blender/editors/transform/transform_generics.c M source/blender/editors/transform/transform_snap.c =================================================================== diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a872e9e9294..9ce0bf26159 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -650,7 +650,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) static void viewRedrawPost(bContext *C, TransInfo *t) { ED_area_headerprint(t->sa, NULL); - + if (t->spacetype == SPACE_VIEW3D) { /* if autokeying is enabled, send notifiers that keyframes were added */ if (IS_AUTOKEY_ON(t->scene)) @@ -662,12 +662,12 @@ static void viewRedrawPost(bContext *C, TransInfo *t) { WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL); } - + /* XXX temp, first hack to get auto-render in compositor work (ton) */ WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C)); } - + #if 0 // TRANSFORM_FIX_ME if (t->spacetype == SPACE_VIEW3D) { allqueue(REDRAWBUTSOBJECT, 0); @@ -843,14 +843,14 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) {TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""}, {0, NULL, 0, NULL, NULL} }; - + wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map"); - + /* this function is called for each spacetype, only needs to add map once */ if (keymap && keymap->modal_items) return NULL; - + keymap = WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); - + /* items for modal map */ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); @@ -860,7 +860,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, GKEY, KM_PRESS, 0, 0, TFM_MODAL_TRANSLATE); WM_modalkeymap_add_item(keymap, RKEY, KM_PRESS, 0, 0, TFM_MODAL_ROTATE); WM_modalkeymap_add_item(keymap, SKEY, KM_PRESS, 0, 0, TFM_MODAL_RESIZE); - + WM_modalkeymap_add_item(keymap, TABKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_SNAP_TOGGLE); WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON); @@ -868,7 +868,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON); WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TFM_MODAL_SNAP_INV_OFF); - + WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, 0, 0, TFM_MODAL_ADD_SNAP); WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, KM_ALT, 0, TFM_MODAL_REMOVE_SNAP); @@ -884,7 +884,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_UP); WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ALT, 0, TFM_MODAL_EDGESLIDE_DOWN); - + WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); @@ -903,7 +903,7 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm const bool edit_2d = (t->flag & T_2D_EDIT) != 0; const char *msg1 = "", *msg2 = "", *msg3 = ""; char axis; - + /* Initialize */ switch (key_type) { case XKEY: @@ -1074,7 +1074,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) restoreTransObjects(t); resetTransModal(t); resetTransRestrictions(t); - + if (t->mode == TFM_ROTATION) { initTrackball(t); } @@ -1119,7 +1119,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) } } break; - + case TFM_MODAL_SNAP_INV_ON: t->modifiers |= MOD_SNAP_INVERT; t->redraw |= TREDRAW_HARD; @@ -1701,7 +1701,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments static int helpline_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); - + if (ar && ar->regiontype == RGN_TYPE_WINDOW) return 1; return 0; @@ -1844,7 +1844,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; - + glLineWidth(1.0f); drawConstraint(t); @@ -1868,10 +1868,10 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) const int font_id = BLF_default(); BLF_width_and_height(font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]); - + xco = (rect.xmax - U.widget_unit) - (int)printable_size[0]; yco = (rect.ymax - U.widget_unit); - + /* warning text (to clarify meaning of overlays) * - original color was red to match the icon, but that clashes badly with a less nasty border */ @@ -1883,28 +1883,28 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) #else BLF_draw_default_ascii(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX); #endif - + /* autokey recording icon... */ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - + xco -= U.widget_unit; yco -= (int)printable_size[1] / 2; UI_icon_draw(xco, yco, ICON_REC); - + glDisable(GL_BLEND); } static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg) -{ +{ TransInfo *t = arg; Scene *scene = t->scene; ViewLayer *view_layer = t->view_layer; Object *ob = OBACT(view_layer); - - /* draw autokeyframing hint in the corner - * - only draw if enabled (advanced users may be distracted/annoyed), + + /* draw autokeyframing hint in the corner + * - only draw if enabled (advanced users may be distracted/annoyed), * for objects that will be autokeyframed (no point ohterwise), * AND only for the active region (as showing all is too overwhelming) */ @@ -1995,7 +1995,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ts->prop_mode = t->prop_mode; } } - + /* do we check for parameter? */ if (t->modifiers & MOD_SNAP) { ts->snap_flag |= SCE_SNAP; @@ -2018,7 +2018,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } } - + if ((prop = RNA_struct_find_property(op->ptr, "proportional"))) { RNA_property_enum_set(op->ptr, prop, proportional); RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode); @@ -2102,7 +2102,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve options |= CTX_TEXTURE; } } - + if ((prop = RNA_struct_find_property(op->ptr, "gpencil_strokes")) && RNA_property_is_set(op->ptr, prop)) { if (RNA_property_boolean_get(op->ptr, prop)) { options |= CTX_GPENCIL_STROKES; @@ -2463,7 +2463,7 @@ int transformEnd(bContext *C, TransInfo *t) else if (t->mode == TFM_VERT_SLIDE) { doVertSlide(t, 0.0f); } - + exit_code = OPERATOR_CANCELLED; restoreTransObjects(t); // calls recalcData() } @@ -2528,7 +2528,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl /* check that protection flags are set */ if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; - + if (protectflag & OB_LOCK_ROT4D) { /* axis-angle getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) @@ -2543,19 +2543,19 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl else { /* axis-angle get limited with euler... */ float eul[3], oldeul[3]; - + axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle); axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle); - + if (protectflag & OB_LOCK_ROTX) eul[0] = oldeul[0]; if (protectflag & OB_LOCK_ROTY) eul[1] = oldeul[1]; if (protectflag & OB_LOCK_ROTZ) eul[2] = oldeul[2]; - + eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT); - + /* when converting to axis-angle, we need a special exception for the case when there is no axis */ if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) { /* for now, rotate around y-axis then (so that it simply becomes the roll) */ @@ -2570,7 +2570,7 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa /* check that protection flags are set */ if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) return; - + if (protectflag & OB_LOCK_ROT4D) { /* quaternions getting limited as 4D entities that they are... */ if (protectflag & OB_LOCK_ROTW) @@ -2604,7 +2604,7 @@ static void protectedQuaternionBits(short protectflag, float quat[4], const floa /* restore original quat size */ mul_qt_fl(quat, qlen); - + /* quaternions flip w sign to accumulate rotations correctly */ if ((nquat[0] < 0.0f && quat[0] > 0.0f) || (nquat[0] > 0.0f && quat[0] < 0.0f)) @@ -2621,43 +2621,43 @@ static void constraintTransLim(TransInfo *t, TransData *td) if (td->con) { const bConstraintTypeInfo *ctiLoc = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_LOCLIMIT); const bConstraintTypeInfo *ctiDist = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_DISTLIMIT); - + bConstraintOb cob = {NULL}; bConstraint *con; float ctime = (float)(t->scene->r.cfra); - + /* Make a temporary bConstraintOb for using these limit constraints * - they only care that cob->matrix is correctly set ;-) * - current space should be local */ unit_m4(cob.matrix); copy_v3_v3(cob.matrix[3], td->loc); - + /* Evaluate valid constraints */ for (con = td->con; con; con = con->next) { const bConstraintTypeInfo *cti = NULL; ListBase targets = {NULL, NULL}; - + /* only consider constraint if enabled */ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; if (con->enforce == 0.0f) continue; - + /* only use it if it's tagged for this purpose (and the right type) */ if (con->type == CONSTRAINT_TYPE_LOCLIMIT) { bLocLimitConstraint *data = @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs