diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-09 16:49:07 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-09 16:49:56 +0300 |
commit | 0b473168cd291615d81ad31ce8254a90ce4f2738 (patch) | |
tree | 16a92a02a35a260386f71df53ace3a3ac66ea6ca /source/blender | |
parent | 8ff7f14c76df2cd2d214e3b5f8078a213a262a6b (diff) |
Fix widget not showing up
(and more Scene.base > SceneLayer.object_bases changes in transforma code)
Diffstat (limited to 'source/blender')
4 files changed, 39 insertions, 29 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2e8d583b14d..fbf8c9158d7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5352,7 +5352,6 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) /* it deselects Bases, so we have to call the clear function always after */ static void set_trans_object_base_flags(TransInfo *t) { - Scene *scene = t->scene; SceneLayer *sl = t->sl; /* @@ -5372,7 +5371,7 @@ static void set_trans_object_base_flags(TransInfo *t) DAG_scene_relations_update(G.main, t->scene); /* handle pending update events, otherwise they got copied below */ - for (base = scene->base.first; base; base = base->next) { + for (base = sl->object_bases.first; base; base = base->next) { if (base->object->recalc & OB_RECALC_ALL) { /* TODO(sergey): Ideally, it's not needed. */ BKE_object_handle_update(G.main->eval_ctx, t->scene, base->object); @@ -5443,17 +5442,16 @@ static bool mark_children(Object *ob) static int count_proportional_objects(TransInfo *t) { int total = 0; - Scene *scene = t->scene; - View3D *v3d = t->view; - BaseLegacy *base; + SceneLayer *sl = t->sl; + Base *base; /* rotations around local centers are allowed to propagate, so we take all objects */ if (!((t->around == V3D_AROUND_LOCAL_ORIGINS) && (t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL))) { /* mark all parents */ - for (base = scene->base.first; base; base = base->next) { - if (TESTBASELIB_BGMODE(v3d, scene, base)) { + for (base = sl->object_bases.first; base; base = base->next) { + if (TESTBASELIB_BGMODE_NEW(base)) { Object *parent = base->object->parent; /* flag all parents */ @@ -5465,22 +5463,24 @@ static int count_proportional_objects(TransInfo *t) } /* mark all children */ - for (base = scene->base.first; base; base = base->next) { + for (base = sl->object_bases.first; base; base = base->next) { /* all base not already selected or marked that is editable */ - if ((base->object->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && - (BASE_EDITABLE_BGMODE(v3d, scene, base))) + if ((base->object->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && + (base->flag & BASE_SELECTED) == 0 && + (BASE_EDITABLE_BGMODE_NEW(base))) { mark_children(base->object); } } } - for (base = scene->base.first; base; base = base->next) { + for (base = sl->object_bases.first; base; base = base->next) { Object *ob = base->object; /* if base is not selected, not a parent of selection or not a child of selection and it is editable */ - if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && - (BASE_EDITABLE_BGMODE(v3d, scene, base))) + if ((ob->flag & (BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 && + (base->flag & BASE_SELECTED) == 0 && + (BASE_EDITABLE_BGMODE_NEW(base))) { DAG_id_tag_update(&ob->id, OB_RECALC_OB); @@ -5495,7 +5495,7 @@ static int count_proportional_objects(TransInfo *t) /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ - for (base = scene->base.first; base; base = base->next) { + for (base = sl->object_bases.first; base; base = base->next) { if (base->object->recalc & OB_RECALC_OB) base->flag_legacy |= BA_HAS_RECALC_OB; if (base->object->recalc & OB_RECALC_DATA) diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index b25e8ef5241..1dae055878b 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -271,11 +271,12 @@ static int calc_manipulator_stats(const bContext *C) ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *obedit = CTX_data_edit_object(C); View3D *v3d = sa->spacedata.first; RegionView3D *rv3d = ar->regiondata; - BaseLegacy *base; - Object *ob = OBACT; + Base *base; + Object *ob = OBACT_NEW; bGPdata *gpd = CTX_data_gpencil_data(C); const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)); int a, totsel = 0; @@ -587,11 +588,12 @@ static int calc_manipulator_stats(const bContext *C) else { /* we need the one selected object, if its not active */ - ob = OBACT; - if (ob && !(ob->flag & SELECT)) ob = NULL; + base = BASACT_NEW; + ob = OBACT_NEW; + if (base && ((base->flag & BASE_SELECTED) == 0)) ob = NULL; - for (base = scene->base.first; base; base = base->next) { - if (TESTBASELIB(v3d, base)) { + for (base = sl->object_bases.first; base; base = base->next) { + if (TESTBASELIB_NEW(base)) { if (ob == NULL) ob = base->object; calc_tw_center(scene, base->object->obmat[3]); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 62360c8972a..9c9cf2dba50 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -586,10 +586,10 @@ 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) { - Scene *scene = CTX_data_scene(C); + SceneLayer *sl = CTX_data_scene_layer(C); Object *obedit = CTX_data_edit_object(C); - BaseLegacy *base; - Object *ob = OBACT; + Base *base; + Object *ob = OBACT_NEW; int result = ORIENTATION_NONE; const bool activeOnly = (around == V3D_AROUND_ACTIVE); @@ -1017,15 +1017,16 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 else { /* we need the one selected object, if its not active */ View3D *v3d = CTX_wm_view3d(C); - ob = OBACT; - if (ob && (ob->flag & SELECT)) { + base = BASACT_NEW; + ob = OBACT_NEW; + if (base && ((base->flag & BASE_SELECTED) != 0)) { /* pass */ } else { /* first selected */ ob = NULL; - for (base = scene->base.first; base; base = base->next) { - if (TESTBASELIB(v3d, base)) { + for (base = sl->object_bases.first; base; base = base->next) { + if (TESTBASELIB_NEW(base)) { ob = base->object; break; } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 29d96b900a0..4cf4259d1de 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1989,10 +1989,17 @@ extern const char *RE_engine_id_CYCLES; (base->lay & (v3d ? v3d->lay : scene->lay)) && \ (base->object->restrictflag & OB_RESTRICT_VIEW) == 0) +#define TESTBASELIB_NEW(base) ( \ + ((base->flag & BASE_SELECTED) != 0) && \ + ((base)->object->id.lib == NULL) && \ + ((base->flag & BASE_VISIBLED) != 0)) #define TESTBASELIB_BGMODE_NEW(base) ( \ ((base->flag & BASE_SELECTED) != 0) && \ - ((base->object->id.lib == NULL) && \ - ((base->flag & BASE_VISIBLED) != 0))) + (base->object->id.lib == NULL) && \ + ((base->flag & BASE_VISIBLED) != 0)) +#define BASE_EDITABLE_BGMODE_NEW(base) ( \ + ((base)->object->id.lib == NULL) && \ + ((base->flag & BASE_VISIBLED) != 0)) #define BASE_SELECTABLE_NEW(base) \ ((base->flag & BASE_SELECTABLED) != 0) |