Fix widget not showing up

(and more Scene.base > SceneLayer.object_bases changes in transforma code)
This commit is contained in:
Dalai Felinto 2017-02-09 14:49:07 +01:00
parent 8ff7f14c76
commit 0b473168cd
4 changed files with 39 additions and 29 deletions

View File

@ -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)

View File

@ -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]);

View File

@ -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;
}

View File

@ -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)