Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-08-22 14:52:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-22 14:52:30 +0400
commit2462d4976ba65a8639445b19e8ac13df7ef1a9fa (patch)
tree21833fddf6583361d60d837599439edb9d04d5a0 /source/blender/editors/space_outliner/outliner.c
parent4e4b7971657b5211984989ccf3068cf9518a8e1c (diff)
possible fix [#23331] Hidden Bones Contribute to Axis Normal
cant redo this bug but noticed a number of places where bone selection/hidden state isn't being set properly.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner.c')
-rw-r--r--source/blender/editors/space_outliner/outliner.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index b0cbe304d75..3865fd213b4 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1554,10 +1554,10 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short
void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem)
{
Base *base= (Base *)te->directdata;
-
- if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
- if(base) {
- base->object->restrictflag^=OB_RESTRICT_VIEW;
+ if(base || (base= object_in_scene((Object *)tselem->id, scene))) {
+ if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
+ ED_base_object_select(base, BA_DESELECT);
+ }
}
}
@@ -1883,8 +1883,8 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
}
/* find associated base in current scene */
- for(base= FIRSTBASE; base; base= base->next)
- if(base->object==ob) break;
+ base= object_in_scene(ob, scene);
+
if(base) {
if(set==2) {
/* swap select */
@@ -1894,12 +1894,8 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
ED_base_object_select(base, BA_SELECT);
}
else {
- Base *b;
/* deleselect all */
- for(b= FIRSTBASE; b; b= b->next) {
- b->flag &= ~SELECT;
- b->object->flag= b->flag;
- }
+ scene_deselect_all(scene);
ED_base_object_select(base, BA_SELECT);
}
if(C)
@@ -4835,7 +4831,6 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
{
- Base *base;
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
Object *obedit= CTX_data_edit_object(C);
@@ -4851,15 +4846,9 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
/* deselect objects that are invisible */
if (ob->restrictflag & OB_RESTRICT_VIEW) {
-
/* Ouch! There is no backwards pointer from Object to Base,
* so have to do loop to find it. */
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object==ob) {
- base->flag &= ~SELECT;
- base->object->flag= base->flag;
- }
- }
+ ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT);
}
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
@@ -4867,21 +4856,14 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
{
- Base *base;
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
/* if select restriction has just been turned on */
if (ob->restrictflag & OB_RESTRICT_SELECT) {
-
/* Ouch! There is no backwards pointer from Object to Base,
* so have to do loop to find it. */
- for(base= FIRSTBASE; base; base= base->next) {
- if(base->object==ob) {
- base->flag &= ~SELECT;
- base->object->flag= base->flag;
- }
- }
+ ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT);
}
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
@@ -4908,9 +4890,20 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2)
{
+ Bone *bone= (Bone *)poin2;
+ if(bone && (bone->flag & BONE_HIDDEN_P))
+ bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
}
+static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2)
+{
+ EditBone *ebone= (EditBone *)poin2;
+ if(ebone && (ebone->flag & BONE_HIDDEN_A))
+ ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+}
static int group_restrict_flag(Group *gr, int flag)
{
@@ -5195,7 +5188,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF,
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
+ uiButSetFunc(bt, restrictbutton_bone_cb, NULL, bone);
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
@@ -5207,11 +5200,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
bt= uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF,
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
- uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
+ uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, ebone);
bt= uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(ebone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
- uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
+ uiButSetFunc(bt, restrictbutton_ebone_cb, NULL, NULL);
}
}