diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-23 19:41:38 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-11-23 20:13:14 +0300 |
commit | 9be5b2d23fb46a7da22d16decd044324ed8d4e78 (patch) | |
tree | c486399ce5c7c2b46cd9aceca7dfba272d8eb598 /source/blender/editors/transform | |
parent | 0d0c79e879fe0c7bf1f1d47968c11578a05db7cf (diff) |
Pass viewport to BASE_ related tests, for viewport view/select restrictions
Note: functions like select all are still not respecting that.
I will fix this as part of the local view commit though.
Diffstat (limited to 'source/blender/editors/transform')
4 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 73f4c05b2f8..e531c65e829 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5800,6 +5800,7 @@ static void set_trans_object_base_flags(TransInfo *t) { Main *bmain = CTX_data_main(t->context); ViewLayer *view_layer = t->view_layer; + View3D *v3d = t->view; Scene *scene = t->scene; Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); /* NOTE: if Base selected and has parent selected: @@ -5818,7 +5819,7 @@ static void set_trans_object_base_flags(TransInfo *t) /* Traverse all bases and set all possible flags. */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { base->flag_legacy &= ~BA_WAS_SEL; - if (TESTBASELIB_BGMODE(base)) { + if (TESTBASELIB_BGMODE(v3d, base)) { Object *ob = base->object; Object *parsel = ob->parent; /* If parent selected, deselect. */ @@ -5826,7 +5827,7 @@ static void set_trans_object_base_flags(TransInfo *t) if (parsel->base_flag & BASE_SELECTED) { Base *parbase = BKE_view_layer_base_find(view_layer, parsel); if (parbase != NULL) { /* in rare cases this can fail */ - if (TESTBASELIB_BGMODE(parbase)) { + if (TESTBASELIB_BGMODE(v3d, parbase)) { break; } } @@ -5873,6 +5874,7 @@ static int count_proportional_objects(TransInfo *t) { int total = 0; ViewLayer *view_layer = t->view_layer; + View3D *v3d = t->view; Scene *scene = t->scene; Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); /* Clear all flags we need. It will be used to detect dependencies. */ @@ -5883,7 +5885,7 @@ static int count_proportional_objects(TransInfo *t) { /* Mark all parents. */ for (Base *base = view_layer->object_bases.first; base; base = base->next) { - if (TESTBASELIB_BGMODE(base)) { + if (TESTBASELIB_BGMODE(v3d, base)) { Object *parent = base->object->parent; /* flag all parents */ while (parent != NULL) { @@ -5897,7 +5899,7 @@ static int count_proportional_objects(TransInfo *t) /* all base not already selected or marked that is editable */ if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && (base->flag & BASE_SELECTED) == 0 && - (BASE_EDITABLE_BGMODE(base))) + (BASE_EDITABLE_BGMODE(v3d, base))) { mark_children(base->object); } @@ -5911,7 +5913,7 @@ static int count_proportional_objects(TransInfo *t) */ if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && (base->flag & BASE_SELECTED) == 0 && - (BASE_EDITABLE_BGMODE(base))) + (BASE_EDITABLE_BGMODE(v3d, base))) { flush_trans_object_base_deps_flag(depsgraph, ob); total += 1; @@ -6916,6 +6918,7 @@ static void createTransObject(bContext *C, TransInfo *t) if (is_prop_edit) { ViewLayer *view_layer = t->view_layer; + View3D *v3d = t->view; Base *base; for (base = view_layer->object_bases.first; base; base = base->next) { @@ -6924,7 +6927,7 @@ static void createTransObject(bContext *C, TransInfo *t) /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && (base->flag & BASE_SELECTED) == 0 && - BASE_EDITABLE_BGMODE(base)) + BASE_EDITABLE_BGMODE(v3d, base)) { td->protectflag = ob->protectflag; td->ext = tx; @@ -8694,7 +8697,8 @@ void createTransData(bContext *C, TransInfo *t) if (ob_armature && ob_armature->mode & OB_MODE_POSE) { Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature); if (base_arm) { - if (BASE_VISIBLE(base_arm)) { + View3D *v3d = t->view; + if (BASE_VISIBLE(v3d, base_arm)) { Object *objects[1]; objects[0] = ob_armature; uint objects_len = 1; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 6f3cef7c09d..8872fe91ae3 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -722,8 +722,8 @@ int ED_transform_calc_gizmo_stats( Scene *scene = CTX_data_scene(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obedit = CTX_data_edit_object(C); View3D *v3d = sa->spacedata.first; + Object *obedit = CTX_data_edit_object(C); RegionView3D *rv3d = ar->regiondata; Base *base; Object *ob = OBACT(view_layer); @@ -1128,7 +1128,7 @@ int ED_transform_calc_gizmo_stats( if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL; for (base = view_layer->object_bases.first; base; base = base->next) { - if (!TESTBASELIB(base)) { + if (!TESTBASELIB(v3d, base)) { continue; } if (ob == NULL) { diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index b220652395d..f230841ddd2 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -588,6 +588,7 @@ static unsigned int bm_mesh_faces_select_get_n(BMesh *bm, BMVert **elems, const int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3], const short around) { ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); Object *obedit = CTX_data_edit_object(C); Base *base; Object *ob = OBACT(view_layer); @@ -839,7 +840,6 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } else { - View3D *v3d = CTX_wm_view3d(C); const bool use_handle = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) != 0; for (nu = nurbs->first; nu; nu = nu->next) { @@ -1090,7 +1090,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 /* first selected */ ob = NULL; for (base = view_layer->object_bases.first; base; base = base->next) { - if (TESTBASELIB(base)) { + if (TESTBASELIB(v3d, base)) { ob = base->object; break; } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index e28f00e6509..64ae9d4c018 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -205,12 +205,13 @@ static void iter_snap_objects( void *data) { ViewLayer *view_layer = DEG_get_input_view_layer(sctx->depsgraph); + const View3D *v3d = sctx->v3d_data.v3d; const eSnapSelect snap_select = params->snap_select; const bool use_object_edit_cage = params->use_object_edit_cage; Base *base_act = view_layer->basact; for (Base *base = view_layer->object_bases.first; base != NULL; base = base->next) { - if ((BASE_VISIBLE(base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 && + if ((BASE_VISIBLE(v3d, base)) && (base->flag_legacy & BA_SNAP_FIX_DEPS_FIASCO) == 0 && !((snap_select == SNAP_NOT_SELECTED && ((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL))) || (snap_select == SNAP_NOT_ACTIVE && base == base_act))) { |