diff options
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d9e23b98c66..95aa48efd84 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -19,6 +19,7 @@ #include "BKE_context.h" #include "BKE_editmesh.h" +#include "BKE_layer.h" #include "BKE_mask.h" #include "BKE_scene.h" @@ -484,7 +485,9 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) /* XXX how to deal with lock? */ SpaceImage *sima = (SpaceImage *)t->area->spacedata.first; if (sima->lock) { - WM_event_add_notifier(C, NC_GEOM | ND_DATA, OBEDIT_FROM_VIEW_LAYER(t->view_layer)->data); + BKE_view_layer_synced_ensure(t->scene, t->view_layer); + WM_event_add_notifier( + C, NC_GEOM | ND_DATA, BKE_view_layer_edit_object_get(t->view_layer)->data); } else { ED_area_tag_redraw(t->area); @@ -525,7 +528,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t) UVCALC_TRANSFORM_CORRECT_SLIDE : UVCALC_TRANSFORM_CORRECT; - if ((t->data_type == TC_MESH_VERTS) && (t->settings->uvcalc_flag & uvcalc_correct_flag)) { + if ((t->data_type == &TransConvertType_Mesh) && + (t->settings->uvcalc_flag & uvcalc_correct_flag)) { WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL); } @@ -847,7 +851,7 @@ static bool transform_event_modal_constraint(TransInfo *t, short modal_type) return false; } - if (t->data_type == TC_SEQ_IMAGE_DATA) { + if (t->data_type == &TransConvertType_SequencerImage) { /* Setup the 2d msg string so it writes out the transform space. */ msg_2d = msg_3d; @@ -1327,7 +1331,7 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } - if (t->redraw && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { + if (t->redraw && !ISMOUSE_MOTION(event->type)) { WM_window_status_area_tag_redraw(CTX_wm_window(t->context)); } @@ -1475,7 +1479,8 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void * if (region == t->region) { Scene *scene = t->scene; ViewLayer *view_layer = t->view_layer; - Object *ob = OBACT(view_layer); + BKE_view_layer_synced_ensure(scene, view_layer); + Object *ob = BKE_view_layer_active_object_get(view_layer); /* draw auto-key-framing hint in the corner * - only draw if enabled (advanced users may be distracted/annoyed), @@ -1535,7 +1540,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (!(t->options & CTX_NO_PET)) { if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit")) && !RNA_property_is_set(op->ptr, prop)) { - const Object *obact = OBACT(t->view_layer); + BKE_view_layer_synced_ensure(t->scene, t->view_layer); + const Object *obact = BKE_view_layer_active_object_get(t->view_layer); if (t->spacetype == SPACE_GRAPH) { ts->proportional_fcurve = use_prop_edit; @@ -1713,11 +1719,17 @@ static void initSnapSpatial(TransInfo *t, float r_snap[2]) int grid_size = SI_GRID_STEPS_LEN; float zoom_factor = ED_space_image_zoom_level(v2d, grid_size); float grid_steps[SI_GRID_STEPS_LEN]; + float grid_steps_y[SI_GRID_STEPS_LEN]; - ED_space_image_grid_steps(sima, grid_steps, grid_size); + ED_space_image_grid_steps(sima, grid_steps, grid_steps_y, grid_size); /* Snapping value based on what type of grid is used (adaptive-subdividing or custom-grid). */ r_snap[0] = ED_space_image_increment_snap_value(grid_size, grid_steps, zoom_factor); r_snap[1] = r_snap[0] / 2.0f; + + /* TODO: Implement snapping for custom grid sizes with `grid_steps[0] != grid_steps_y[0]`. + * r_snap_y[0] = ED_space_image_increment_snap_value(grid_size, grid_steps_y, zoom_factor); + * r_snap_y[1] = r_snap_y[0] / 2.0f; + */ } else if (t->spacetype == SPACE_CLIP) { r_snap[0] = 0.125f; |