From 92b342d30d33a3da0816d2c2715adc959360e095 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 9 Nov 2017 08:17:35 -0200 Subject: Fix logic for pinning textures users from context This was wrong since it's concenption in 28ee0f9218. The if statement was returning true when pinid was NULL, and false otherwise. However when scene is pinned we also want to run this code. Code snippet by Brecht Van Lommel. --- source/blender/editors/space_buttons/buttons_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 1d67ac620b0..e3d72ba67d8 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -350,7 +350,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * if (!scene) scene = CTX_data_scene(C); - if (!(pinid || pinid == &scene->id)) { + if (!pinid || GS(pinid->name) == ID_SCE) { ob = (scene->basact) ? scene->basact->object : NULL; wrld = scene->world; brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); -- cgit v1.2.3 From ee49ee24c33b3bf905603322d35a60d59331a7f7 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 9 Nov 2017 08:27:37 -0200 Subject: Fix: unselectable objects can be selected via the NLA editor This is not reported anywhere, but it's easy to reproduce. I ran into this while updating this code for the blender2.8 branch. --- .../blender/editors/animation/anim_channels_edit.c | 68 +++++++++++----------- source/blender/editors/space_nla/nla_channels.c | 2 +- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 75a6af3819c..25f1e206be5 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2687,41 +2687,43 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, AnimData *adt = ob->adt; /* set selection status */ - if (selectmode == SELECT_INVERT) { - /* swap select */ - base->flag ^= SELECT; - ob->flag = base->flag; - - if (adt) adt->flag ^= ADT_UI_SELECTED; - } - else { - Base *b; - - /* deselect all */ - /* TODO: should this deselect all other types of channels too? */ - for (b = sce->base.first; b; b = b->next) { - b->flag &= ~SELECT; - b->object->flag = b->flag; - if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE); + if ((ob->restrictflag & OB_RESTRICT_SELECT) == 0) { + if (selectmode == SELECT_INVERT) { + /* swap select */ + base->flag ^= SELECT; + ob->flag = base->flag; + + if (adt) adt->flag ^= ADT_UI_SELECTED; } - - /* select object now */ - base->flag |= SELECT; - ob->flag |= SELECT; - if (adt) adt->flag |= ADT_UI_SELECTED; + else { + Base *b; + + /* deselect all */ + /* TODO: should this deselect all other types of channels too? */ + for (b = sce->base.first; b; b = b->next) { + b->flag &= ~SELECT; + b->object->flag = b->flag; + if (b->object->adt) b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE); + } + + /* select object now */ + base->flag |= SELECT; + ob->flag |= SELECT; + if (adt) adt->flag |= ADT_UI_SELECTED; + } + + /* change active object - regardless of whether it is now selected [T37883] */ + ED_base_object_activate(C, base); /* adds notifier */ + + if ((adt) && (adt->flag & ADT_UI_SELECTED)) + adt->flag |= ADT_UI_ACTIVE; + + /* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */ + if (ob != sce->obedit) + ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); + + notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } - - /* change active object - regardless of whether it is now selected [T37883] */ - ED_base_object_activate(C, base); /* adds notifier */ - - if ((adt) && (adt->flag & ADT_UI_SELECTED)) - adt->flag |= ADT_UI_ACTIVE; - - /* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */ - if (ob != sce->obedit) - ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); - - notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); break; } case ANIMTYPE_FILLACTD: /* Action Expander */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index e9c46e9d04b..c261821db16 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -129,7 +129,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe Object *ob = base->object; AnimData *adt = ob->adt; - if (nlaedit_is_tweakmode_on(ac) == 0) { + if (nlaedit_is_tweakmode_on(ac) == 0 && (ob->restrictflag & OB_RESTRICT_SELECT) == 0) { /* set selection status */ if (selectmode == SELECT_INVERT) { /* swap select */ -- cgit v1.2.3