diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-10-23 03:22:05 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-10-23 03:22:05 +0400 |
commit | 8f788c64db587e74079d812dbcea40c2bd4b91ff (patch) | |
tree | c767e8318a9e7aded16be6cab2042f3ea11e7912 /source/blender/editors/space_outliner | |
parent | 36bb566d4e6e06e08d782d610d60d755cbda2396 (diff) |
merge with trunk/2.5 at r23876
[[Split portion of a mixed commit.]]
Diffstat (limited to 'source/blender/editors/space_outliner')
5 files changed, 50 insertions, 33 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index a3b47d505fd..2612f8a024c 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1113,16 +1113,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(type == TSE_KEYMAP) { wmKeyMap *km= (wmKeyMap *)idv; - wmKeymapItem *kmi; + wmKeyMapItem *kmi; char opname[OP_MAX_TYPENAME]; te->directdata= idv; - te->name= km->nameid; + te->name= km->idname; if(!(tselem->flag & TSE_CLOSED)) { a= 0; - for (kmi= km->keymap.first; kmi; kmi= kmi->next, a++) { + for (kmi= km->items.first; kmi; kmi= kmi->next, a++) { const char *key= WM_key_event_string(kmi->type); if(key[0]) { @@ -1408,7 +1408,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) wmWindowManager *wm= mainvar->wm.first; wmKeyMap *km; - for(km= wm->keymaps.first; km; km= km->next) { + for(km= wm->defaultconf->keymaps.first; km; km= km->next) { ten= outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0); } } @@ -1824,7 +1824,7 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops } if(ob!=scene->obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); @@ -2173,7 +2173,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, if(set) { if(scene->obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); if(ob->mode & OB_MODE_POSE) ED_armature_exit_posemode(C, base); @@ -2229,14 +2229,14 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) { - wmKeymapItem *kmi= te->directdata; + wmKeyMapItem *kmi= te->directdata; if(set==0) { - if(kmi->inactive) return 0; + if(kmi->flag & KMI_INACTIVE) return 0; return 1; } else { - kmi->inactive= !kmi->inactive; + kmi->flag ^= KMI_INACTIVE; } return 0; } @@ -2327,7 +2327,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) { Object *obedit= CTX_data_edit_object(C); if(obedit) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); else { ED_object_enter_editmode(C, EM_WAITCURSOR); // XXX extern_set_butspace(F9KEY, 0); @@ -3057,7 +3057,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(base) { // check also library later if(scene->obedit==base->object) - ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); ED_base_object_free_and_unlink(scene, base); te->directdata= NULL; @@ -3939,6 +3939,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa /* add a new path with the information obtained (only if valid) */ // TODO: what do we do with group name? for now, we don't supply one, and just let this use the KeyingSet name BKE_keyingset_add_destination(ks, id, NULL, path, array_index, flag, groupmode); + ks->active_path= BLI_countlist(&ks->paths); } break; case KEYINGSET_EDITMODE_REMOVE: @@ -3950,6 +3951,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa /* free path's data */ // TODO: we probably need an API method for this if (ksp->rna_path) MEM_freeN(ksp->rna_path); + ks->active_path= 0; /* remove path from set */ BLI_freelinkN(&ks->paths, ksp); @@ -4324,7 +4326,7 @@ static void outliner_draw_tree_element(bContext *C, Scene *scene, ARegion *ar, S tselem= TREESTORE(te); - if(*starty >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { + if(*starty+2*OL_H >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) { glEnable(GL_BLEND); @@ -4579,7 +4581,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops) ystart= (int)ar->v2d.tot.ymax; ystart= OL_H*(ystart/(OL_H)); - while(ystart > ar->v2d.cur.ymin) { + while(ystart+2*OL_H > ar->v2d.cur.ymin) { glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H); ystart-= 2*OL_H; } @@ -4597,7 +4599,7 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) ystart= (int)ar->v2d.tot.ymax; ystart= OL_H*(ystart/(OL_H)); - while(ystart > ar->v2d.cur.ymin) { + while(ystart+2*OL_H > ar->v2d.cur.ymin) { glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H); ystart-= 2*OL_H; } @@ -4812,7 +4814,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { /* objects have toggle-able restriction flags */ if(tselem->type==0 && te->idcode==ID_OB) { ob = (Object *)tselem->id; @@ -4875,19 +4877,27 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar else if(tselem->type==TSE_POSE_CHANNEL) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; Bone *bone = pchan->bone; - + 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); + + 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"); + uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL); } else if(tselem->type==TSE_EBONE) { EditBone *ebone= (EditBone *)te->directdata; - + 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); + + 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); } } @@ -4924,7 +4934,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if(tselem->type == TSE_RNA_PROPERTY) { ptr= &te->rnaptr; prop= te->directdata; @@ -4947,7 +4957,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) { wmOperatorType *ot= arg2; - wmKeymapItem *kmi= arg_kmi; + wmKeyMapItem *kmi= arg_kmi; if(ot) BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME); @@ -4977,7 +4987,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) static char search[OP_MAX_TYPENAME]; wmEvent event; wmWindow *win= CTX_wm_window(C); - wmKeymapItem *kmi= arg_kmi; + wmKeyMapItem *kmi= arg_kmi; wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0); uiBlock *block; uiBut *but; @@ -5016,8 +5026,8 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) static short keymap_menu_type(short type) { if(ISKEYBOARD(type)) return OL_KM_KEYBOARD; - if(WM_key_event_is_tweak(type)) return OL_KM_TWEAK; - if(type >= LEFTMOUSE && type <= WHEELOUTMOUSE) return OL_KM_MOUSE; + if(ISTWEAK(type)) return OL_KM_TWEAK; + if(ISMOUSE(type)) return OL_KM_MOUSE; // return OL_KM_SPECIALS; return 0; } @@ -5049,6 +5059,8 @@ static char *keymap_mouse_menu(void) str += sprintf(str, formatstr, "Left Mouse", LEFTMOUSE); str += sprintf(str, formatstr, "Middle Mouse", MIDDLEMOUSE); str += sprintf(str, formatstr, "Right Mouse", RIGHTMOUSE); + str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE); + str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE); str += sprintf(str, formatstr, "Action Mouse", ACTIONMOUSE); str += sprintf(str, formatstr, "Select Mouse", SELECTMOUSE); str += sprintf(str, formatstr, "Mouse Move", MOUSEMOVE); @@ -5101,7 +5113,7 @@ static char *keymap_tweak_dir_menu(void) static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v) { - wmKeymapItem *kmi= kmi_v; + wmKeyMapItem *kmi= kmi_v; short maptype= keymap_menu_type(kmi->type); if(maptype!=kmi->maptype) { @@ -5135,7 +5147,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { uiBut *but; char *str; int xstart= 240; @@ -5144,7 +5156,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo int butw3= 43; /* modifiers */ if(tselem->type == TSE_KEYMAP_ITEM) { - wmKeymapItem *kmi= te->directdata; + wmKeyMapItem *kmi= te->directdata; /* modal map? */ if(kmi->propvalue); @@ -5213,7 +5225,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); - if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { + if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c index d4eeaabd1d3..b60cc075869 100644 --- a/source/blender/editors/space_outliner/outliner_header.c +++ b/source/blender/editors/space_outliner/outliner_header.c @@ -228,7 +228,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar) xco += xmax; /* header text */ - xco += XIC*2; + xco += XIC; uiBlockSetEmboss(block, UI_EMBOSS); } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 4f9a0f686b9..c71b5181d16 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -110,7 +110,7 @@ typedef struct TreeElement { /* outliner_ops.c */ void outliner_operatortypes(void); -void outliner_keymap(struct wmWindowManager *wm); +void outliner_keymap(struct wmKeyConfig *keyconf); /* outliner_header.c */ void outliner_header_buttons(const struct bContext *C, struct ARegion *ar); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index 2e11eb379b4..3cdd054fe0e 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -74,9 +74,9 @@ void outliner_operatortypes(void) WM_operatortype_append(OUTLINER_OT_drivers_delete); } -void outliner_keymap(wmWindowManager *wm) +void outliner_keymap(wmKeyConfig *keyconf) { - ListBase *keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OUTLINER, 0); + wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", 0); RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_activate", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 5058a167a29..fabe889ace6 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -72,12 +72,12 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar) { - ListBase *keymap; + wmKeyMap *keymap; UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); /* own keymap */ - keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OUTLINER, 0); /* XXX weak? */ + keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); } @@ -137,10 +137,15 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) /* all actions now, todo: check outliner view mode? */ ED_region_tag_redraw(ar); break; + case NC_LAMP: + /* For updating lamp icons, when changing lamp type */ + if(wmn->data == ND_LIGHTING_DRAW) + ED_region_tag_redraw(ar); + break; case NC_SPACE: if(wmn->data == ND_SPACE_OUTLINER) ED_region_tag_redraw(ar); - break; + break; } } |