diff options
author | Ton Roosendaal <ton@blender.org> | 2009-07-25 17:40:59 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-07-25 17:40:59 +0400 |
commit | dcfc0333d16a6a85c54f056edfce7a9089f64ef7 (patch) | |
tree | aa1f641575d431a23622d67ec88f846cd790c81e | |
parent | 90dfb61e046625b61c3af8a7f8bfee431a356832 (diff) |
2.5
Outliner: brought back to near full functioning:
- proper operators, like for open/close items, exec operations
(note: select is still same operator as activate, should
become modal ops later)
- rename works again (ctrl+click)
- proper notifiers for redraws
- select / extend select works again
- editmode in/out works again
- enter key opens/closes again
- right mouse operations work again
Didn't do:
- options for Sequence strips
- signals to change button views on clicks
- error/warning messages
UI:
- added new uiButSetRenameFunc(), which passes on the old name
- added uiButActiveOnly(), which ensures a button gets created in
active state, and gets removed when used. Needed for editing
names in outliner.
Andrea: check outliner.c for uiButActiveOnly(), very easy to use!
Also:
- Added posemode operator, CTRL+TAB tied to it.
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 10 | ||||
-rw-r--r-- | source/blender/editors/include/ED_armature.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 44 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 42 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 7 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 36 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 1077 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_intern.h | 10 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_ops.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 1 |
15 files changed, 891 insertions, 384 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index c47b86f326c..cda7f1754bb 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -1737,7 +1737,7 @@ void ARMATURE_OT_delete(wmOperatorType *ot) * toggle==2: only active tag * toggle==3: swap (no test) */ -void deselectall_armature(Object *obedit, int toggle, int doundo) +void ED_armature_deselectall(Object *obedit, int toggle, int doundo) { bArmature *arm= obedit->data; EditBone *eBone; @@ -1809,7 +1809,7 @@ void mouse_armature(bContext *C, short mval[2], int extend) if (nearBone) { if (!extend) - deselectall_armature(obedit, 0, 0); + ED_armature_deselectall(obedit, 0, 0); /* by definition the non-root connected bones have no root point drawn, so a root selection needs to be delivered to the parent tip */ @@ -2187,7 +2187,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) Mat3MulMat3(totmat, obmat, viewmat); Mat3Inv(imat, totmat); - deselectall_armature(obedit, 0, 0); + ED_armature_deselectall(obedit, 0, 0); /* Create a bone */ bone= add_editbone(obedit, "Bone"); @@ -2240,7 +2240,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op) to_root= 1; } - deselectall_armature(obedit, 0, 0); + ED_armature_deselectall(obedit, 0, 0); /* we re-use code for mirror editing... */ flipbone= NULL; @@ -3405,7 +3405,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) Mat3MulMat3(totmat, obmat, viewmat); Mat3Inv(imat, totmat); - deselectall_armature(obedit, 0, 0); + ED_armature_deselectall(obedit, 0, 0); /* Create a bone */ bone= add_editbone(obedit, name); diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 3b5932b2950..31b0f712b97 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -99,6 +99,8 @@ void ED_armature_from_edit(struct Scene *scene, struct Object *obedit); void ED_armature_to_edit(struct Object *ob); void ED_armature_edit_free(struct Object *ob); void ED_armature_edit_remake(struct Object *obedit); +void ED_armature_deselectall(struct Object *obedit, int toggle, int doundo); + int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, short hits, short extend); void mouse_armature(struct bContext *C, short mval[2], int extend); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index b40f90dcf0c..8dc766499bc 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -313,6 +313,10 @@ int uiButGetRetVal (uiBut *but); void uiButSetFlag (uiBut *but, int flag); void uiButClearFlag (uiBut *but, int flag); +/* special button case, only draw it when used actively, for outliner etc */ +int uiButActiveOnly (const struct bContext *C, uiBlock *block, uiBut *but); + + /* Buttons * * Functions to define various types of buttons in a block. Postfixes: @@ -474,9 +478,9 @@ int uiSearchBoxhHeight(void); void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg); void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg); - void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2); -void uiBlockSetRenameFunc(uiBlock *block, uiButHandleRenameFunc func, void *arg1); + +void uiButSetRenameFunc (uiBut *but, uiButHandleRenameFunc func, void *arg1); void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2); void uiButSetNFunc (uiBut *but, uiButHandleNFunc func, void *argN, void *arg2); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 284ec6943ea..18634e21a36 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -442,7 +442,7 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut) if(but->retval != oldbut->retval) return 0; if(but->rnapoin.data != oldbut->rnapoin.data) return 0; if(but->rnaprop != oldbut->rnaprop) - if(but->rnaindex != oldbut->rnaindex) return 0; + if(but->rnaindex != oldbut->rnaindex) return 0; if(but->func != oldbut->func) return 0; if(but->funcN != oldbut->funcN) return 0; if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0; @@ -496,6 +496,43 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut return found; } +/* needed for temporarily rename buttons, such as in outliner or fileselect, + they should keep calling uiDefButs to keep them alive */ +/* returns 0 when button removed */ +int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) +{ + uiBlock *oldblock; + uiBut *oldbut; + int activate= 0, found= 0, isactive= 0; + + oldblock= block->oldblock; + if(!oldblock) + activate= 1; + else { + for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) { + if(ui_but_equals_old(oldbut, but)) { + found= 1; + + if(oldbut->active) + isactive= 1; + + break; + } + } + } + if(activate || found==0) { + ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but); + } + else if(found && isactive==0) { + + BLI_remlink(&block->buttons, but); + ui_free_but(C, but); + return 0; + } + + return 1; +} + void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) { uiBut *but; @@ -2767,9 +2804,10 @@ void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2 block->func_arg2= arg2; } -void uiBlockSetRenameFunc(uiBlock *block, uiButHandleRenameFunc func, void *arg1) +void uiButSetRenameFunc(uiBut *but, uiButHandleRenameFunc func, void *arg1) { - + but->rename_func= func; + but->rename_arg1= arg1; } void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const bContext *C, void *idv, void *argv, rcti *rect), void *arg) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 442d472a47a..1736cd1ef52 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -152,6 +152,10 @@ typedef struct uiAfterFunc { uiButHandleNFunc funcN; void *func_argN; + uiButHandleRenameFunc rename_func; + void *rename_arg1; + void *rename_orig; + uiBlockHandleFunc handle_func; void *handle_func_arg; int retval; @@ -239,7 +243,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but) * handling is done, i.e. menus are closed, in order to avoid conflicts * with these functions removing the buttons we are working with */ - if(but->func || but->funcN || block->handle_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) { + if(but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) { after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc"); after->func= but->func; @@ -250,6 +254,10 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->funcN= but->funcN; after->func_argN= but->func_argN; + after->rename_func= but->rename_func; + after->rename_arg1= but->rename_arg1; + after->rename_orig= but->rename_orig; /* needs free! */ + after->handle_func= block->handle_func; after->handle_func_arg= block->handle_func_arg; after->retval= but->retval; @@ -344,7 +352,12 @@ static void ui_apply_but_funcs_after(bContext *C) after.handle_func(C, after.handle_func_arg, after.retval); if(after.butm_func) after.butm_func(C, after.butm_func_arg, after.a2); - + + if(after.rename_func) + after.rename_func(C, after.rename_arg1, after.rename_orig); + if(after.rename_orig) + MEM_freeN(after.rename_orig); + if(after.undostr[0]) ED_undo_push(C, after.undostr); } @@ -468,10 +481,10 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data) /* give butfunc the original text too */ /* feature used for bone renaming, channels, etc */ - /* XXX goes via uiButHandleRenameFunc now */ -// if(but->func_arg2==NULL) but->func_arg2= data->origstr; + /* afterfunc frees origstr */ + but->rename_orig= data->origstr; + data->origstr= NULL; ui_apply_but_func(C, but); -// if(but->func_arg2==data->origstr) but->func_arg2= NULL; data->retval= but->retval; data->applied= 1; @@ -3484,7 +3497,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA data= MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData"); data->window= CTX_wm_window(C); data->region= ar; - if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp + if( ELEM3(but->type, TEX, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp else data->interactive= 1; data->state = BUTTON_STATE_INIT; @@ -3630,6 +3643,23 @@ static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar) return WM_UI_HANDLER_CONTINUE; } +/* exported to interface.c: uiButActiveOnly() */ +void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) +{ + wmWindow *win= CTX_wm_window(C); + wmEvent event; + + button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); + + event= *(win->eventstate); /* XXX huh huh? make api call */ + event.type= EVT_BUT_OPEN; + event.val= KM_PRESS; + event.customdata= but; + event.customdatafree= FALSE; + + ui_do_button(C, but->block, but, &event); +} + static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type) { uiBut *oldbut; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index aef52572fe3..04c0c417fdb 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -186,7 +186,11 @@ struct uiBut { uiButSearchFunc search_func; void *search_arg; - + + uiButHandleRenameFunc rename_func; + void *rename_arg1; + void *rename_orig; + uiLink *link; short linkto[2]; @@ -416,6 +420,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rct /* interface_handlers.c */ +extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); extern void ui_button_active_cancel(const struct bContext *C, uiBut *but); extern int ui_button_is_active(struct ARegion *ar); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 5c6c55e956b..1752f48990d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3717,6 +3717,42 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) /* *************************** */ +static int posemode_exec(bContext *C, wmOperator *op) +{ + Base *base= CTX_data_active_base(C); + + if(base->object->type==OB_ARMATURE) { + if(base->object==CTX_data_edit_object(C)) { + ED_object_exit_editmode(C, EM_FREEDATA); + ED_armature_enter_posemode(C, base); + } + else if(base->object->flag & OB_POSEMODE) + ED_armature_exit_posemode(C, base); + else + ED_armature_enter_posemode(C, base); + + return OPERATOR_FINISHED; + } + + return OPERATOR_PASS_THROUGH; +} + +void OBJECT_OT_posemode_toggle(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Toggle Pose Mode"; + ot->idname= "OBJECT_OT_posemode_toggle"; + ot->description= "Enables or disables posing/selecting bones"; + + /* api callbacks */ + ot->exec= posemode_exec; + ot->poll= ED_operator_object_active; + + /* flag */ + ot->flag= OPTYPE_REGISTER; +} + +/* *********************** */ void check_editmode(int type) { diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index fba49caba28..da1dd458555 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -40,6 +40,7 @@ struct Mesh; /* object_edit.c */ void OBJECT_OT_editmode_toggle(struct wmOperatorType *ot); +void OBJECT_OT_posemode_toggle(struct wmOperatorType *ot); void OBJECT_OT_parent_set(struct wmOperatorType *ot); void OBJECT_OT_parent_clear(struct wmOperatorType *ot); void OBJECT_OT_track_set(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index ad3d13ed511..27d481ef509 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -64,6 +64,7 @@ void ED_operatortypes_object(void) { WM_operatortype_append(OBJECT_OT_editmode_toggle); + WM_operatortype_append(OBJECT_OT_posemode_toggle); WM_operatortype_append(OBJECT_OT_parent_set); WM_operatortype_append(OBJECT_OT_parent_clear); WM_operatortype_append(OBJECT_OT_track_set); @@ -149,6 +150,7 @@ void ED_keymap_object(wmWindowManager *wm) /* Note: this keymap works disregarding mode */ WM_keymap_add_item(keymap, "OBJECT_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "OBJECT_OT_posemode_toggle", TABKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_center_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0); /* Note: this keymap gets disabled in non-objectmode, */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index c5aea5ae077..812c41f430e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1088,7 +1088,7 @@ static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ Mesh *me; me= get_mesh(ob); - if(ob->id.lib || me==NULL) return OPERATOR_CANCELLED; + if(ob->id.lib || me==NULL) return OPERATOR_PASS_THROUGH; if(me && me->totface>=MAXINDEX) { error("Maximum number of faces: %d", MAXINDEX-1); @@ -1465,7 +1465,7 @@ static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) // XXX if(multires_level1_test()) return; me= get_mesh(ob); - if(me==NULL || me->totface==0) return OPERATOR_CANCELLED; + if(me==NULL || me->totface==0) return OPERATOR_PASS_THROUGH; /* if nothing was added yet, we make dverts and a vertex deform group */ if (!me->dvert) @@ -1585,7 +1585,7 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ if(me==NULL || object_data_is_libdata(ob)) { G.f &= ~G_VERTEXPAINT; - return OPERATOR_FINISHED; + return OPERATOR_PASS_THROUGH; } if(me && me->totface>=MAXINDEX) { @@ -1821,7 +1821,7 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) /* context checks could be a poll() */ me= get_mesh(ob); - if(me==NULL || me->totface==0) return OPERATOR_CANCELLED; + if(me==NULL || me->totface==0) return OPERATOR_PASS_THROUGH; if(me->mcol==NULL) make_vertexcol(CTX_data_scene(C), 0); if(me->mcol==NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 78392fceace..1d478514779 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -319,6 +319,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->data) { case ND_FRAME: case ND_MODE: + case ND_RENDER_OPTIONS: ED_area_tag_redraw(sa); break; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index f27dfcb4897..40a365f956c 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -82,6 +82,8 @@ #include "BKE_sequence.h" #include "BKE_utildefines.h" +#include "ED_armature.h" +#include "ED_object.h" #include "ED_screen.h" #include "ED_util.h" #include "ED_types.h" @@ -103,7 +105,9 @@ #include "ED_armature.h" #include "ED_keyframing.h" #include "ED_object.h" +#include "ED_particle.h" #include "ED_screen.h" +#include "ED_view3d.h" #include "outliner_intern.h" @@ -129,18 +133,15 @@ /* ************* XXX **************** */ -static void BIF_undo_push() {} -static void BIF_preview_changed() {} static void error() {} -static int pupmenu() {return 0;} /* ********************************** */ /* ******************** PROTOTYPES ***************** */ -static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty); -static void outliner_do_object_operation(Scene *scene, SpaceOops *soops, ListBase *lb, - void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *)); +static void outliner_draw_tree_element(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty); +static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, + void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *)); /* ******************** PERSISTANT DATA ***************** */ @@ -1429,9 +1430,8 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short /* --- */ -void object_toggle_visibility_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; // XXX Base *base= (Base *)te->directdata; if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); @@ -1446,9 +1446,8 @@ static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_visibility_cb); + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1470,9 +1469,8 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* --- */ -static void object_toggle_selectability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; // XXX Base *base= (Base *)te->directdata; if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); @@ -1487,9 +1485,8 @@ static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_selectability_cb); + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1511,9 +1508,8 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) /* --- */ -void object_toggle_renderability_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; // XXX Base *base= (Base *)te->directdata; if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); @@ -1528,9 +1524,8 @@ static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_renderability_cb); + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1562,7 +1557,6 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op) else outliner_set_flag(soops, &soops->tree, TSE_CLOSED, 1); - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1596,7 +1590,6 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *op) soops->storeflag |= SO_TREESTORE_REDRAW; - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1654,7 +1647,6 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op) if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0); } - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -1732,7 +1724,7 @@ void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up) /* **** do clicks on items ******* */ -static int tree_element_active_renderlayer(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) { Scene *sce; @@ -1743,6 +1735,7 @@ static int tree_element_active_renderlayer(TreeElement *te, TreeStoreElem *tsele if(set) { sce->r.actlay= tselem->nr; + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce); } else { return sce->r.actlay==tselem->nr; @@ -1750,13 +1743,12 @@ static int tree_element_active_renderlayer(TreeElement *te, TreeStoreElem *tsele return 0; } -static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te) +static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { TreeStoreElem *tselem= TREESTORE(te); Scene *sce; Base *base; Object *ob= NULL; - int shift= 0; // XXX /* if id is not object, we search back */ if(te->idcode==ID_OB) ob= (Object *)tselem->id; @@ -1775,7 +1767,7 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops for(base= FIRSTBASE; base; base= base->next) if(base->object==ob) break; if(base) { - if(shift) { + if(set==2) { /* swap select */ if(base->flag & SELECT) ED_base_object_select(base, BA_DESELECT); @@ -1795,11 +1787,14 @@ static void tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops ED_base_object_activate(C, base); /* adds notifier */ } -// XXX if(ob!=obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); -// else countall(); /* exit_editmode calls f() */ + if(ob!=scene->obedit) + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + + WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); + } -static int tree_element_active_material(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { TreeElement *tes; Object *ob; @@ -1834,13 +1829,12 @@ static int tree_element_active_material(Scene *scene, SpaceOops *soops, TreeElem } } if(set) { -// XXX extern_set_butspace(F5KEY, 0); // force shading buttons - BIF_preview_changed(ID_MA); + WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL); } return 0; } -static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { TreeElement *tep; TreeStoreElem *tselem, *tselemp; @@ -1911,7 +1905,7 @@ static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeEleme } -static int tree_element_active_lamp(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { Object *ob; @@ -1921,14 +1915,13 @@ static int tree_element_active_lamp(Scene *scene, SpaceOops *soops, TreeElement if(set) { // XXX extern_set_butspace(F5KEY, 0); - BIF_preview_changed(ID_LA); } else return 1; return 0; } -static int tree_element_active_world(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { TreeElement *tep; TreeStoreElem *tselem=NULL; @@ -1942,7 +1935,7 @@ static int tree_element_active_world(Scene *scene, SpaceOops *soops, TreeElement if(set) { // make new scene active if(sce && scene != sce) { - // XXX ED_screen_set_scene(C, sce); + ED_screen_set_scene(C, sce); } } @@ -1957,7 +1950,7 @@ static int tree_element_active_world(Scene *scene, SpaceOops *soops, TreeElement return 0; } -static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Object *ob; @@ -1966,6 +1959,7 @@ static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStore if(set) { ob->actdef= te->index+1; DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); } else { if(ob==OBACT) @@ -1974,13 +1968,14 @@ static int tree_element_active_defgroup(Scene *scene, TreeElement *te, TreeStore return 0; } -static int tree_element_active_posegroup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; if(set) { if (ob->pose) { ob->pose->active_group= te->index+1; + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); } } else { @@ -1991,7 +1986,7 @@ static int tree_element_active_posegroup(Scene *scene, TreeElement *te, TreeStor return 0; } -static int tree_element_active_posechannel(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; bPoseChannel *pchan= te->directdata; @@ -1999,10 +1994,16 @@ static int tree_element_active_posechannel(Scene *scene, TreeElement *te, TreeSt if(set) { if(!(pchan->bone->flag & BONE_HIDDEN_P)) { -// XXX if(G.qual & LR_SHIFTKEY) deselectall_posearmature(ob, 2, 0); // 2 = clear active tag -// else deselectall_posearmature(ob, 0, 0); // 0 = deselect - pchan->bone->flag |= BONE_SELECTED|BONE_ACTIVE; + if(set==2) ED_pose_deselectall(ob, 2, 0); // 2 = clear active tag + else ED_pose_deselectall(ob, 0, 0); // 0 = deselect + + if(set==2 && (pchan->bone->flag & BONE_SELECTED)) + pchan->bone->flag &= ~(BONE_SELECTED|BONE_ACTIVE); + else + pchan->bone->flag |= BONE_SELECTED|BONE_ACTIVE; + WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, ob); + } } else { @@ -2013,17 +2014,22 @@ static int tree_element_active_posechannel(Scene *scene, TreeElement *te, TreeSt return 0; } -static int tree_element_active_bone(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { bArmature *arm= (bArmature *)tselem->id; Bone *bone= te->directdata; if(set) { if(!(bone->flag & BONE_HIDDEN_P)) { -// XXX if(G.qual & LR_SHIFTKEY) deselectall_posearmature(OBACT, 2, 0); // 2 is clear active tag -// else deselectall_posearmature(OBACT, 0, 0); - bone->flag |= BONE_SELECTED|BONE_ACTIVE; + if(set==2) ED_pose_deselectall(OBACT, 2, 0); // 2 is clear active tag + else ED_pose_deselectall(OBACT, 0, 0); + + if(set==2 && (bone->flag & BONE_SELECTED)) + bone->flag &= ~(BONE_SELECTED|BONE_ACTIVE); + else + bone->flag |= BONE_SELECTED|BONE_ACTIVE; + WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, OBACT); } } else { @@ -2038,21 +2044,21 @@ static int tree_element_active_bone(Scene *scene, TreeElement *te, TreeStoreElem /* ebones only draw in editmode armature */ -static int tree_element_active_ebone(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { EditBone *ebone= te->directdata; -// int shift= 0; // XXX if(set) { if(!(ebone->flag & BONE_HIDDEN_A)) { -// XXX if(shift) deselectall_armature(2, 0); // only clear active tag -// else deselectall_armature(0, 0); // deselect + if(set==2) ED_armature_deselectall(scene->obedit, 2, 0); // only clear active tag + else ED_armature_deselectall(scene->obedit, 0, 0); // deselect ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL|BONE_ACTIVE; // flush to parent? if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL; + WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit); } } else { @@ -2061,70 +2067,84 @@ static int tree_element_active_ebone(TreeElement *te, TreeStoreElem *tselem, int return 0; } -static int tree_element_active_modifier(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) { if(set) { + Object *ob= (Object *)tselem->id; + + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + // XXX extern_set_butspace(F9KEY, 0); } return 0; } -static int tree_element_active_psys(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { if(set) { -// Object *ob= (Object *)tselem->id; -// ParticleSystem *psys= te->directdata; + Object *ob= (Object *)tselem->id; + ParticleSystem *psys= te->directdata; + + PE_change_act_psys(scene, ob, psys); + WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); -// XXX PE_change_act_psys(ob, psys); // XXX extern_set_butspace(F7KEY, 0); } return 0; } -static int tree_element_active_constraint(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) { if(set) { + Object *ob= (Object *)tselem->id; + + WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob); // XXX extern_set_butspace(F7KEY, 0); } return 0; } -static int tree_element_active_text(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { // XXX removed return 0; } /* generic call for ID data check or make/check active in UI */ -static int tree_element_active(Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { switch(te->idcode) { case ID_MA: - return tree_element_active_material(scene, soops, te, set); + return tree_element_active_material(C, scene, soops, te, set); case ID_WO: - return tree_element_active_world(scene, soops, te, set); + return tree_element_active_world(C, scene, soops, te, set); case ID_LA: - return tree_element_active_lamp(scene, soops, te, set); + return tree_element_active_lamp(C, scene, soops, te, set); case ID_TE: - return tree_element_active_texture(scene, soops, te, set); + return tree_element_active_texture(C, scene, soops, te, set); case ID_TXT: - return tree_element_active_text(scene, soops, te, set); + return tree_element_active_text(C, scene, soops, te, set); } return 0; } -static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; + Base *base= object_in_scene(ob, scene); if(set) { -// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); -// if(ob->flag & OB_POSEMODE) exit_posemode(); -// else enter_posemode(); + if(scene->obedit) + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + + if(ob->flag & OB_POSEMODE) + ED_armature_exit_posemode(C, base); + else + ED_armature_enter_posemode(C, base); } else { if(ob->flag & OB_POSEMODE) return 1; @@ -2132,7 +2152,7 @@ static int tree_element_active_pose(TreeElement *te, TreeStoreElem *tselem, int return 0; } -static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) { Sequence *seq= (Sequence*) te->directdata; @@ -2146,7 +2166,7 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *tselem, return(0); } -static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) { Sequence *seq, *p; Editing *ed= seq_give_editing(scene, FALSE); @@ -2180,59 +2200,57 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, switch(tselem->type) { case TSE_DEFGROUP: - return tree_element_active_defgroup(scene, te, tselem, set); + return tree_element_active_defgroup(C, scene, te, tselem, set); case TSE_BONE: - return tree_element_active_bone(scene, te, tselem, set); + return tree_element_active_bone(C, scene, te, tselem, set); case TSE_EBONE: - return tree_element_active_ebone(te, tselem, set); + return tree_element_active_ebone(C, scene, te, tselem, set); case TSE_MODIFIER: - return tree_element_active_modifier(te, tselem, set); + return tree_element_active_modifier(C, te, tselem, set); case TSE_LINKED_OB: - if(set) tree_element_set_active_object(C, scene, soops, te); + if(set) tree_element_set_active_object(C, scene, soops, te, set); else if(tselem->id==(ID *)OBACT) return 1; break; case TSE_LINKED_PSYS: - return tree_element_active_psys(te, tselem, set); + return tree_element_active_psys(C, scene, te, tselem, set); break; case TSE_POSE_BASE: - return tree_element_active_pose(te, tselem, set); + return tree_element_active_pose(C, scene, te, tselem, set); break; case TSE_POSE_CHANNEL: - return tree_element_active_posechannel(scene, te, tselem, set); + return tree_element_active_posechannel(C, scene, te, tselem, set); case TSE_CONSTRAINT: - return tree_element_active_constraint(te, tselem, set); + return tree_element_active_constraint(C, te, tselem, set); case TSE_R_LAYER: - return tree_element_active_renderlayer(te, tselem, set); + return tree_element_active_renderlayer(C, te, tselem, set); case TSE_POSEGRP: - return tree_element_active_posegroup(scene, te, tselem, set); + return tree_element_active_posegroup(C, scene, te, tselem, set); case TSE_SEQUENCE: - return tree_element_active_sequence(te, tselem, set); + return tree_element_active_sequence(C, te, tselem, set); break; case TSE_SEQUENCE_DUP: - return tree_element_active_sequence_dup(scene, te, tselem, set); + return tree_element_active_sequence_dup(C, scene, te, tselem, set); break; } return 0; } -static int do_outliner_mouse_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, short event, float *mval) +static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, float *mval) { - int shift= 0, ctrl= 0; // XXX if(mval[1]>te->ys && mval[1]<te->ys+OL_H) { TreeStoreElem *tselem= TREESTORE(te); int openclose= 0; - /* open close icon, three things to check */ - if(event==RETKEY || event==PADENTER) openclose= 1; // enter opens/closes always - else if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close - if( mval[0]>te->xs && mval[0]<te->xs+OL_X) openclose= 1; + /* open close icon */ + if((te->flag & TE_ICONROW)==0) { // hidden icon, no open/close + if( mval[0]>te->xs && mval[0]<te->xs+OL_X) + openclose= 1; } if(openclose) { - /* all below close/open? */ - if(shift) { + if(extend) { tselem->flag &= ~TSE_CLOSED; outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1)); } @@ -2241,95 +2259,67 @@ static int do_outliner_mouse_event(bContext *C, Scene *scene, ARegion *ar, Space else tselem->flag |= TSE_CLOSED; } - + soops->storeflag |= SO_TREESTORE_REDRAW; + return 1; } /* name and first icon */ else if(mval[0]>te->xs && mval[0]<te->xend) { - /* activate a name button? */ - if(event==LEFTMOUSE) { + /* always makes active object */ + if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) + tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0)); - if (ctrl) { - if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) - error("Cannot edit builtin name"); - else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) - error("Cannot edit sequence name"); - else if(tselem->id->lib) { -// XXX error_libdata(); - } else if(te->idcode == ID_LI && te->parent) { - error("Cannot edit the path of an indirectly linked library"); - } else { - tselem->flag |= TSE_TEXTBUT; - } - } else { - /* always makes active object */ - if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) - tree_element_set_active_object(C, scene, soops, te); - - if(tselem->type==0) { // the lib blocks - /* editmode? */ - if(te->idcode==ID_SCE) { - if(scene!=(Scene *)tselem->id) { - ED_screen_set_scene(C, (Scene *)tselem->id); - } - } - else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) { -// XXX if(obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); -// else { -// enter_editmode(EM_WAITCURSOR); -// extern_set_butspace(F9KEY, 0); -// } - } else { // rest of types - tree_element_active(scene, soops, te, 1); - } - + if(tselem->type==0) { // the lib blocks + /* editmode? */ + if(te->idcode==ID_SCE) { + if(scene!=(Scene *)tselem->id) { + ED_screen_set_scene(C, (Scene *)tselem->id); } - else tree_element_type_active(C, scene, soops, te, tselem, 1); } - } - else if(event==RIGHTMOUSE) { - /* select object that's clicked on and popup context menu */ - if (!(tselem->flag & TSE_SELECTED)) { - - if ( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) ) - outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0); - - tselem->flag |= TSE_SELECTED; - /* redraw, same as outliner_select function */ - soops->storeflag |= SO_TREESTORE_REDRAW; -// XXX screen_swapbuffers(); + 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); + else { + ED_object_enter_editmode(C, EM_WAITCURSOR); + // XXX extern_set_butspace(F9KEY, 0); + } + } else { // rest of types + tree_element_active(C, scene, soops, te, 1); } - outliner_operation_menu(scene, ar, soops); } + else tree_element_type_active(C, scene, soops, te, tselem, 1+(extend!=0)); + return 1; } } for(te= te->subtree.first; te; te= te->next) { - if(do_outliner_mouse_event(C, scene, ar, soops, te, event, mval)) return 1; + if(do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1; } return 0; } /* event can enterkey, then it opens/closes */ -static int outliner_activate_click(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); TreeElement *te; float fmval[2]; + int extend= RNA_boolean_get(op->ptr, "extend"); UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1); for(te= soops->tree.first; te; te= te->next) { - if(do_outliner_mouse_event(C, scene, ar, soops, te, event->type, fmval)) break; + if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break; } if(te) { - BIF_undo_push("Outliner click event"); + ED_undo_push(C, "Outliner click event"); } else { short selecting= -1; @@ -2342,24 +2332,150 @@ static int outliner_activate_click(bContext *C, wmOperator *op, wmEvent *event) /* select relevant row */ outliner_select(soops, &soops->tree, &row, &selecting); - // XXX old flag found in old code, do we still use this? - //soops->storeflag |= SO_TREESTORE_REDRAW; + soops->storeflag |= SO_TREESTORE_REDRAW; + + ED_undo_push(C, "Outliner selection event"); + } + + ED_region_tag_redraw(ar); + + return OPERATOR_FINISHED; +} + +void OUTLINER_OT_item_activate(wmOperatorType *ot) +{ + ot->name= "Activate Item"; + ot->idname= "OUTLINER_OT_item_activate"; + + ot->invoke= outliner_item_activate; + + ot->poll= ED_operator_outliner_active; + + RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation."); +} + +/* *********** */ + +static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, float *mval) +{ + + if(mval[1]>te->ys && mval[1]<te->ys+OL_H) { + TreeStoreElem *tselem= TREESTORE(te); + + /* all below close/open? */ + if(all) { + tselem->flag &= ~TSE_CLOSED; + outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1)); + } + else { + if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED; + else tselem->flag |= TSE_CLOSED; + } - BIF_undo_push("Outliner selection event"); + soops->storeflag |= SO_TREESTORE_REDRAW; + + return 1; } - // XXX need proper notifiers here instead + for(te= te->subtree.first; te; te= te->next) { + if(do_outliner_item_openclose(C, soops, te, all, mval)) + return 1; + } + return 0; + +} + +/* event can enterkey, then it opens/closes */ +static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event) +{ + ARegion *ar= CTX_wm_region(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + TreeElement *te; + float fmval[2]; + int all= RNA_boolean_get(op->ptr, "all"); + + UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1); + + for(te= soops->tree.first; te; te= te->next) { + if(do_outliner_item_openclose(C, soops, te, all, fmval)) + break; + } + ED_region_tag_redraw(ar); + + return OPERATOR_FINISHED; +} + +void OUTLINER_OT_item_openclose(wmOperatorType *ot) +{ + ot->name= "Open/Close Item"; + ot->idname= "OUTLINER_OT_item_openclose"; + + ot->invoke= outliner_item_openclose; + + ot->poll= ED_operator_outliner_active; + + RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items."); + +} + + +/* ********************************************** */ + +static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, float *mval) +{ + + if(mval[1]>te->ys && mval[1]<te->ys+OL_H) { + TreeStoreElem *tselem= TREESTORE(te); + + /* name and first icon */ + if(mval[0]>te->xs && mval[0]<te->xend) { + + if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) + error("Cannot edit builtin name"); + else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) + error("Cannot edit sequence name"); + else if(tselem->id->lib) { + // XXX error_libdata(); + } else if(te->idcode == ID_LI && te->parent) { + error("Cannot edit the path of an indirectly linked library"); + } else { + tselem->flag |= TSE_TEXTBUT; + ED_region_tag_redraw(ar); + } + } + return 1; + } + + for(te= te->subtree.first; te; te= te->next) { + if(do_outliner_item_rename(C, ar, soops, te, mval)) return 1; + } + return 0; +} +static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event) +{ + ARegion *ar= CTX_wm_region(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + TreeElement *te; + float fmval[2]; + + UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1); + + for(te= soops->tree.first; te; te= te->next) { + if(do_outliner_item_rename(C, ar, soops, te, fmval)) break; + } + return OPERATOR_FINISHED; } -void OUTLINER_OT_activate_click(wmOperatorType *ot) + +void OUTLINER_OT_item_rename(wmOperatorType *ot) { - ot->name= "Activate Click"; - ot->idname= "OUTLINER_OT_activate_click"; + ot->name= "Rename Item"; + ot->idname= "OUTLINER_OT_item_rename"; - ot->invoke= outliner_activate_click; + ot->invoke= outliner_item_rename; ot->poll= ED_operator_outliner_active; } @@ -2447,7 +2563,6 @@ static int outliner_show_active_exec(bContext *C, wmOperator *op) so->storeflag |= SO_TREESTORE_REDRAW; } - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -2656,7 +2771,6 @@ static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) /* recursively open/close levels */ tree_element_show_hierarchy(scene, soops, &soops->tree); - // XXX need proper notifiers here instead ED_region_tag_redraw(ar); return OPERATOR_FINISHED; @@ -2733,13 +2847,10 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, tselem= TREESTORE(te); if(tselem->flag & TSE_SELECTED) { if(tselem->type) { - if(tselem->type==TSE_SEQUENCE) - *datalevel= TSE_SEQUENCE; - else if(tselem->type==TSE_SEQ_STRIP) - *datalevel= TSE_SEQ_STRIP; - else if(tselem->type==TSE_SEQUENCE_DUP) - *datalevel= TSE_SEQUENCE_DUP; - else if(*datalevel!=tselem->type) *datalevel= -1; + if(*datalevel==0) + *datalevel= tselem->type; + else if(*datalevel!=tselem->type) + *datalevel= -1; } else { int idcode= GS(tselem->id->name); @@ -2769,7 +2880,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } -static void unlink_material_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { Material **matar=NULL; int a, totcol=0; @@ -2803,7 +2914,7 @@ static void unlink_material_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreEl } } -static void unlink_texture_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { MTex **mtex= NULL; int a; @@ -2832,7 +2943,7 @@ static void unlink_texture_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreEle } } -static void unlink_group_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; @@ -2848,8 +2959,8 @@ static void unlink_group_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem } } -static void outliner_do_libdata_operation(SpaceOops *soops, ListBase *lb, - void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *)) +static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, + void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *)) { TreeElement *te; TreeStoreElem *tselem; @@ -2859,20 +2970,19 @@ static void outliner_do_libdata_operation(SpaceOops *soops, ListBase *lb, if(tselem->flag & TSE_SELECTED) { if(tselem->type==0) { TreeStoreElem *tsep= TREESTORE(te->parent); - operation_cb(te, tsep, tselem); + operation_cb(C, scene, te, tsep, tselem); } } if((tselem->flag & TSE_CLOSED)==0) { - outliner_do_libdata_operation(soops, &te->subtree, operation_cb); + outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb); } } } /* */ -static void object_select_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; // XXX Base *base= (Base *)te->directdata; if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); @@ -2882,9 +2992,8 @@ static void object_select_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem } } -static void object_deselect_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; Base *base= (Base *)te->directdata; if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); @@ -2894,28 +3003,31 @@ static void object_deselect_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreEl } } -static void object_delete_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; Base *base= (Base *)te->directdata; - if(base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if(base==NULL) + base= object_in_scene((Object *)tselem->id, scene); if(base) { // check also library later -// XXX if(obedit==base->object) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); + if(scene->obedit==base->object) + ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); if(base==BASACT) { - G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE); -// XXX setcursor_space(SPACE_VIEW3D, CURSOR_STD); + ED_view3d_exit_paint_modes(C); } -// XXX free_and_unlink_base(base); + ED_base_object_free_and_unlink(scene, base); te->directdata= NULL; tselem->id= NULL; } + + WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); + } -static void id_local_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) { tselem->id->lib= NULL; @@ -2924,9 +3036,8 @@ static void id_local_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tse } } -static void group_linkobs2scene_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) { - Scene *scene= NULL; Group *group= (Group *)tselem->id; GroupObject *gob; Base *base; @@ -2949,8 +3060,8 @@ static void group_linkobs2scene_cb(TreeElement *te, TreeStoreElem *tsep, TreeSto } } -static void outliner_do_object_operation(Scene *scene, SpaceOops *soops, ListBase *lb, - void (*operation_cb)(TreeElement *, TreeStoreElem *, TreeStoreElem *)) +static void outliner_do_object_operation(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, + void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *)) { TreeElement *te; TreeStoreElem *tselem; @@ -2962,18 +3073,20 @@ static void outliner_do_object_operation(Scene *scene, SpaceOops *soops, ListBas // when objects selected in other scenes... dunno if that should be allowed Scene *sce= (Scene *)outliner_search_back(soops, te, ID_SCE); if(sce && scene != sce) { -// XXX ED_screen_set_scene(C, sce); + ED_screen_set_scene(C, sce); } - operation_cb(te, NULL, tselem); + operation_cb(C, scene, te, NULL, tselem); } } if((tselem->flag & TSE_CLOSED)==0) { - outliner_do_object_operation(scene, soops, &te->subtree, operation_cb); + outliner_do_object_operation(C, scene, soops, &te->subtree, operation_cb); } } } +/* ******************************************** */ + static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; @@ -3049,145 +3162,387 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li } } -void outliner_del(Scene *scene, ARegion *ar, SpaceOops *soops) +void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) +{ + + if(soops->outlinevis==SO_SEQUENCE) + ;// del_seq(); + else { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); + DAG_scene_sort(scene); + ED_undo_push(C, "Delete Objects"); + } +} + +/* **************************************** */ + +static EnumPropertyItem prop_object_op_types[] = { + {1, "SELECT", 0, "Select", ""}, + {2, "DESELECT", 0, "Deselect", ""}, + {4, "DELETE", 0, "Delete", ""}, + {6, "TOGVIS", 0, "Toggle Visible", ""}, + {7, "TOGSEL", 0, "Toggle Selectable", ""}, + {8, "TOGREN", 0, "Toggle Renderable", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int outliner_object_operation_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + int event; + char *str; + + /* check for invalid states */ + if (soops == NULL) + return OPERATOR_CANCELLED; + + event= RNA_enum_get(op->ptr, "type"); + + if(event==1) { + Scene *sce= scene; // to be able to delete, scenes are set... + outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb); + if(scene != sce) { + ED_screen_set_scene(C, sce); + } + + str= "Select Objects"; + } + else if(event==2) { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb); + str= "Deselect Objects"; + } + else if(event==4) { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); + DAG_scene_sort(scene); + str= "Delete Objects"; + } + else if(event==5) { /* disabled, see above (ton) */ + outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb); + str= "Localized Objects"; + } + else if(event==6) { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); + str= "Toggle Visibility"; + } + else if(event==7) { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); + str= "Toggle Selectability"; + } + else if(event==8) { + outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); + str= "Toggle Renderability"; + } + + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); + + ED_undo_push(C, str); + + return OPERATOR_FINISHED; +} + + +void OUTLINER_OT_object_operation(wmOperatorType *ot) { + /* identifiers */ + ot->name= "Outliner Object Operation"; + ot->idname= "OUTLINER_OT_object_operation"; + ot->description= ""; -// XXX if(soops->outlinevis==SO_SEQUENCE) -// del_seq(); -// else { -// outliner_do_object_operation(scene, soops, &soops->tree, object_delete_cb); -// DAG_scene_sort(scene); -// BIF_undo_push("Delete Objects"); -// } + /* callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= outliner_object_operation_exec; + ot->poll= ED_operator_outliner_active; + + ot->flag= 0; + + RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", ""); } +/* **************************************** */ + +static EnumPropertyItem prop_group_op_types[] = { + {1, "UNLINK", 0, "Unlink", ""}, + {2, "LOCAL", 0, "Make Local", ""}, + {3, "LINK", 0, "Link Group Objects to Scene", ""}, + {0, NULL, 0, NULL, NULL} +}; -void outliner_operation_menu(Scene *scene, ARegion *ar, SpaceOops *soops) +static int outliner_group_operation_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + int event; + + /* check for invalid states */ + if (soops == NULL) + return OPERATOR_CANCELLED; + + event= RNA_enum_get(op->ptr, "type"); + + if(event==1) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); + ED_undo_push(C, "Unlink group"); + } + else if(event==2) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); + ED_undo_push(C, "Localized Data"); + } + else if(event==3) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); + ED_undo_push(C, "Link Group Objects to Scene"); + } + + + WM_event_add_notifier(C, NC_GROUP, NULL); + + return OPERATOR_FINISHED; +} + + +void OUTLINER_OT_group_operation(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Outliner Group Operation"; + ot->idname= "OUTLINER_OT_group_operation"; + ot->description= ""; + + /* callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= outliner_group_operation_exec; + ot->poll= ED_operator_outliner_active; + + ot->flag= 0; + + RNA_def_enum(ot->srna, "type", prop_group_op_types, 0, "Group Operation", ""); +} + +/* **************************************** */ + +static EnumPropertyItem prop_id_op_types[] = { + {1, "UNLINK", 0, "Unlink", ""}, + {2, "LOCAL", 0, "Make Local", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int outliner_id_operation_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; + int event; + + /* check for invalid states */ + if (soops == NULL) + return OPERATOR_CANCELLED; + + set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); + + event= RNA_enum_get(op->ptr, "type"); + + if(event==1) { + switch(idlevel) { + case ID_MA: + outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_material_cb); + ED_undo_push(C, "Unlink material"); + break; + case ID_TE: + outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_texture_cb); + ED_undo_push(C, "Unlink texture"); + break; + default: + BKE_report(op->reports, RPT_WARNING, "Not Yet"); + } + } + else if(event==2) { + outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); + ED_undo_push(C, "Localized Data"); + } + + /* wrong notifier still... */ + WM_event_add_notifier(C, NC_OBJECT, NULL); + + return OPERATOR_FINISHED; +} + + +void OUTLINER_OT_id_operation(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Outliner ID data Operation"; + ot->idname= "OUTLINER_OT_id_operation"; + ot->description= ""; + + /* callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= outliner_id_operation_exec; + ot->poll= ED_operator_outliner_active; + + ot->flag= 0; + + RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", ""); +} + +/* **************************************** */ + +static EnumPropertyItem prop_data_op_types[] = { + {1, "SELECT", 0, "Select", ""}, + {2, "DESELECT", 0, "Deselect", ""}, + {3, "HIDE", 0, "Hide", ""}, + {4, "UNHIDE", 0, "Unhide", ""}, + {0, NULL, 0, NULL, NULL} +}; + +static int outliner_data_operation_exec(bContext *C, wmOperator *op) +{ + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; + int event; + /* check for invalid states */ + if (soops == NULL) + return OPERATOR_CANCELLED; + + event= RNA_enum_get(op->ptr, "type"); set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); - if(scenelevel) { - if(objectlevel || datalevel || idlevel) error("Mixed selection"); - else pupmenu("Scene Operations%t|Delete"); + if(datalevel==TSE_POSE_CHANNEL) { + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); + ED_undo_push(C, "PoseChannel operation"); + } } - else if(objectlevel) { - short event= pupmenu("Select%x1|Deselect%x2|Delete%x4|Toggle Visible%x6|Toggle Selectable%x7|Toggle Renderable%x8"); /* make local: does not work... it doesn't set lib_extern flags... so data gets lost */ + else if(datalevel==TSE_BONE) { if(event>0) { - char *str=""; - - if(event==1) { - Scene *sce= scene; // to be able to delete, scenes are set... - outliner_do_object_operation(scene, soops, &soops->tree, object_select_cb); - if(scene != sce) { -// XXX ED_screen_set_scene(C, sce); - } - - str= "Select Objects"; - } - else if(event==2) { - outliner_do_object_operation(scene, soops, &soops->tree, object_deselect_cb); - str= "Deselect Objects"; - } - else if(event==4) { - outliner_do_object_operation(scene, soops, &soops->tree, object_delete_cb); - DAG_scene_sort(scene); - str= "Delete Objects"; - } - else if(event==5) { /* disabled, see above (ton) */ - outliner_do_object_operation(scene, soops, &soops->tree, id_local_cb); - str= "Localized Objects"; - } - else if(event==6) { - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_visibility_cb); - str= "Toggle Visibility"; - } - else if(event==7) { - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_selectability_cb); - str= "Toggle Selectability"; - } - else if(event==8) { - outliner_do_object_operation(scene, soops, &soops->tree, object_toggle_renderability_cb); - str= "Toggle Renderability"; - } - - BIF_undo_push(str); + outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); + ED_undo_push(C, "Bone operation"); } } - else if(idlevel) { - if(idlevel==-1 || datalevel) error("Mixed selection"); - else { - short event; - if (idlevel==ID_GR) - event = pupmenu("Unlink %x1|Make Local %x2|Link Group Objects to Scene%x3"); - else - event = pupmenu("Unlink %x1|Make Local %x2"); + else if(datalevel==TSE_EBONE) { + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); + ED_undo_push(C, "EditBone operation"); + } + } + else if(datalevel==TSE_SEQUENCE) { + if(event>0) { + outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); + } + } + + return OPERATOR_FINISHED; +} + + +void OUTLINER_OT_data_operation(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Outliner Data Operation"; + ot->idname= "OUTLINER_OT_data_operation"; + ot->description= ""; + + /* callbacks */ + ot->invoke= WM_menu_invoke; + ot->exec= outliner_data_operation_exec; + ot->poll= ED_operator_outliner_active; + + ot->flag= 0; + + RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", ""); +} + + +/* ******************** */ + + +static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, wmEvent *event, float *mval) +{ + + if(mval[1]>te->ys && mval[1]<te->ys+OL_H) { + int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; + TreeStoreElem *tselem= TREESTORE(te); + + /* select object that's clicked on and popup context menu */ + if (!(tselem->flag & TSE_SELECTED)) { + if ( outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) ) + outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0); - if(event==1) { - switch(idlevel) { - case ID_MA: - outliner_do_libdata_operation(soops, &soops->tree, unlink_material_cb); - BIF_undo_push("Unlink material"); - break; - case ID_TE: - outliner_do_libdata_operation(soops, &soops->tree, unlink_texture_cb); - BIF_undo_push("Unlink texture"); - break; - case ID_GR: - outliner_do_libdata_operation(soops, &soops->tree, unlink_group_cb); - BIF_undo_push("Unlink group"); - break; - default: - error("Not yet..."); - } - } - else if(event==2) { - outliner_do_libdata_operation(soops, &soops->tree, id_local_cb); - BIF_undo_push("Localized Data"); + tselem->flag |= TSE_SELECTED; + /* redraw, same as outliner_select function */ + soops->storeflag |= SO_TREESTORE_REDRAW; + ED_region_tag_redraw(ar); + } + + set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel); + + if(scenelevel) { + //if(objectlevel || datalevel || idlevel) error("Mixed selection"); + //else pupmenu("Scene Operations%t|Delete"); + } + else if(objectlevel) { + WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL); + } + else if(idlevel) { + if(idlevel==-1 || datalevel) error("Mixed selection"); + else { + if (idlevel==ID_GR) + WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL); + else + WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL); } - else if(event==3 && idlevel==ID_GR) { - outliner_do_libdata_operation(soops, &soops->tree, group_linkobs2scene_cb); - BIF_undo_push("Link Group Objects to Scene"); + } + else if(datalevel) { + if(datalevel==-1) error("Mixed selection"); + else { + WM_operator_name_call(C, "OUTLINER_OT_data_operation", WM_OP_INVOKE_REGION_WIN, NULL); } } + + return 1; } - else if(datalevel) { - if(datalevel==-1) error("Mixed selection"); - else { - if(datalevel==TSE_POSE_CHANNEL) { - short event= pupmenu("PoseChannel Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4"); - if(event>0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb); - BIF_undo_push("PoseChannel operation"); - } - } - else if(datalevel==TSE_BONE) { - short event= pupmenu("Bone Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4"); - if(event>0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb); - BIF_undo_push("Bone operation"); - } - } - else if(datalevel==TSE_EBONE) { - short event= pupmenu("EditBone Operations%t|Select%x1|Deselect%x2|Hide%x3|Unhide%x4"); - if(event>0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb); - BIF_undo_push("EditBone operation"); - } - } - else if(datalevel==TSE_SEQUENCE) { - short event= pupmenu("Sequence Operations %t|Select %x1"); - if(event>0) { - outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb); - } - } + + for(te= te->subtree.first; te; te= te->next) { + if(do_outliner_operation_event(C, scene, ar, soops, te, event, mval)) + return 1; + } + return 0; +} - } + +static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event) +{ + Scene *scene= CTX_data_scene(C); + ARegion *ar= CTX_wm_region(C); + SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + TreeElement *te; + float fmval[2]; + + UI_view2d_region_to_view(&ar->v2d, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, fmval, fmval+1); + + for(te= soops->tree.first; te; te= te->next) { + if(do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break; } + + return OPERATOR_FINISHED; } +/* Menu only! Calls other operators */ +void OUTLINER_OT_operation(wmOperatorType *ot) +{ + ot->name= "Execute Operation"; + ot->idname= "OUTLINER_OT_operation"; + + ot->invoke= outliner_operation; + + ot->poll= ED_operator_outliner_active; +} + + + /* ***************** ANIMATO OPERATIONS ********************************** */ /* KeyingSet and Driver Creation - Helper functions */ @@ -3878,7 +4233,7 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen } } -static void outliner_draw_iconrow(Scene *scene, SpaceOops *soops, ListBase *lb, int level, int *offsx, int ys) +static void outliner_draw_iconrow(bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, int level, int *offsx, int ys) { TreeElement *te; TreeStoreElem *tselem; @@ -3895,7 +4250,7 @@ static void outliner_draw_iconrow(Scene *scene, SpaceOops *soops, ListBase *lb, if(tselem->type==0) { if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id); else if(scene->obedit && scene->obedit->data==tselem->id) active= 1; // XXX use context? - else active= tree_element_active(scene, soops, te, 0); + else active= tree_element_active(C, scene, soops, te, 0); } else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0); @@ -3917,12 +4272,12 @@ static void outliner_draw_iconrow(Scene *scene, SpaceOops *soops, ListBase *lb, /* this tree element always has same amount of branches, so dont draw */ if(tselem->type!=TSE_R_LAYER) - outliner_draw_iconrow(scene, soops, &te->subtree, level+1, offsx, ys); + outliner_draw_iconrow(C, scene, soops, &te->subtree, level+1, offsx, ys); } } -static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty) +static void outliner_draw_tree_element(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty) { TreeElement *ten; TreeStoreElem *tselem; @@ -3960,12 +4315,12 @@ static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soo } } -// XXX context? else if(obedit && obedit->data==tselem->id) { -// glColor4ub(255, 255, 255, 100); -// active= 2; -// } + else if(scene->obedit && scene->obedit->data==tselem->id) { + glColor4ub(255, 255, 255, 100); + active= 2; + } else { - if(tree_element_active(scene, soops, te, 0)) { + if(tree_element_active(C, scene, soops, te, 0)) { glColor4ub(220, 220, 255, 100); active= 2; } @@ -4044,7 +4399,7 @@ static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soo glEnable(GL_BLEND); glPixelTransferf(GL_ALPHA_SCALE, 0.5); - outliner_draw_iconrow(scene, soops, &te->subtree, 0, &tempx, *starty+2); + outliner_draw_iconrow(C, scene, soops, &te->subtree, 0, &tempx, *starty+2); glPixelTransferf(GL_ALPHA_SCALE, 1.0); glDisable(GL_BLEND); @@ -4061,7 +4416,7 @@ static void outliner_draw_tree_element(Scene *scene, ARegion *ar, SpaceOops *soo if((tselem->flag & TSE_CLOSED)==0) { for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_draw_tree_element(scene, ar, soops, ten, startx+OL_X, starty); + outliner_draw_tree_element(C, scene, ar, soops, ten, startx+OL_X, starty); } } } @@ -4140,20 +4495,12 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb, } -static void outliner_draw_tree(Scene *scene, ARegion *ar, SpaceOops *soops) +static void outliner_draw_tree(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) { TreeElement *te; int starty, startx; float col[4]; - -#if 0 // XXX was #ifdef INTERNATIONAL - /* Maybe the INTERNATIONAL was really for check about freetype2 ? - * anyway I think that we can remove this now - Diego - */ - FTF_SetFontSize('l'); - BIF_SetScale(1.0); -#endif - + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { @@ -4180,7 +4527,7 @@ static void outliner_draw_tree(Scene *scene, ARegion *ar, SpaceOops *soops) starty= (int)ar->v2d.tot.ymax-OL_H; startx= 0; for(te= soops->tree.first; te; te= te->next) { - outliner_draw_tree_element(scene, ar, soops, te, startx, &starty); + outliner_draw_tree_element(C, scene, ar, soops, te, startx, &starty); } } @@ -4255,6 +4602,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) } } } + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } @@ -4276,16 +4624,18 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) } } } + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2) { + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, poin); } static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2) { - /* XXX redraws */ + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin); } static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) @@ -4296,26 +4646,40 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) DAG_object_flush_update(scene, ob, OB_RECALC_DATA); object_handle_update(scene, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); } static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) { - /* XXX redraws */ + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); } -static void namebutton_cb(bContext *C, void *tep, void *oldnamep) +static void namebutton_cb(bContext *C, void *tsep, char *oldname) { - SpaceOops *soops= NULL; // XXXcurarea->spacedata.first; - Scene *scene= NULL; // XXX + SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + Scene *scene= CTX_data_scene(C); + Object *obedit= CTX_data_edit_object(C); TreeStore *ts= soops->treestore; - TreeElement *te= tep; + TreeStoreElem *tselem= tsep; - if(ts && te) { - TreeStoreElem *tselem= TREESTORE(te); + if(ts && tselem) { + TreeElement *te= outliner_find_tse(soops, tselem); if(tselem->type==0) { test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort + switch(GS(tselem->id->name)) { + case ID_MA: + WM_event_add_notifier(C, NC_MATERIAL, NULL); break; + case ID_TE: + WM_event_add_notifier(C, NC_TEXTURE, NULL); break; + case ID_IM: + WM_event_add_notifier(C, NC_IMAGE, NULL); break; + case ID_SCE: + WM_event_add_notifier(C, NC_SCENE, NULL); break; + default: + WM_event_add_notifier(C, NC_MATERIAL, NULL); break; + } /* Check the library target exists */ if (te->idcode == ID_LI) { char expanded[FILE_MAXDIR + FILE_MAXFILE]; @@ -4343,8 +4707,9 @@ static void namebutton_cb(bContext *C, void *tep, void *oldnamep) /* restore bone name */ BLI_strncpy(newname, ebone->name, 32); - BLI_strncpy(ebone->name, oldnamep, 32); -// XXX armature_bone_rename(obedit->data, oldnamep, newname); + BLI_strncpy(ebone->name, oldname, 32); + ED_armature_bone_rename(obedit->data, oldname, newname); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, OBACT); } } break; @@ -4356,13 +4721,14 @@ static void namebutton_cb(bContext *C, void *tep, void *oldnamep) char newname[32]; // always make current object active - tree_element_set_active_object(C, scene, soops, te); + tree_element_set_active_object(C, scene, soops, te, 1); ob= OBACT; /* restore bone name */ BLI_strncpy(newname, bone->name, 32); - BLI_strncpy(bone->name, oldnamep, 32); -// XXX armature_bone_rename(ob->data, oldnamep, newname); + BLI_strncpy(bone->name, oldname, 32); + ED_armature_bone_rename(ob->data, oldname, newname); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); } break; case TSE_POSE_CHANNEL: @@ -4372,13 +4738,14 @@ static void namebutton_cb(bContext *C, void *tep, void *oldnamep) char newname[32]; // always make current object active - tree_element_set_active_object(C, scene, soops, te); + tree_element_set_active_object(C, scene, soops, te, 1); ob= OBACT; /* restore bone name */ BLI_strncpy(newname, pchan->name, 32); - BLI_strncpy(pchan->name, oldnamep, 32); -// XXX armature_bone_rename(ob->data, oldnamep, newname); + BLI_strncpy(pchan->name, oldname, 32); + ED_armature_bone_rename(ob->data, oldname, newname); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); } break; case TSE_POSEGRP: @@ -4387,6 +4754,7 @@ static void namebutton_cb(bContext *C, void *tep, void *oldnamep) bActionGroup *grp= te->directdata; BLI_uniquename(&ob->pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name), 32); + WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); } break; case TSE_R_LAYER: @@ -4402,7 +4770,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar TreeElement *te; TreeStoreElem *tselem; Object *ob = NULL; - + for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { @@ -4421,7 +4789,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, 0, ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability"); - uiButSetFunc(bt, restrictbutton_rend_cb, NULL, NULL); + uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); uiBlockSetEmboss(block, UI_EMBOSS); } @@ -4431,7 +4799,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, te->directdata, 0, 0, 0, 0, "Render this RenderLayer"); - uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL); + uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiBlockSetEmboss(block, UI_EMBOSS); } @@ -4442,13 +4810,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar /* NOTE: tselem->nr is short! */ bt= uiDefIconButBitI(block, ICONTOG, tselem->nr, 0, ICON_CHECKBOX_HLT-1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass"); - uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL); + uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); layflag++; /* is lay_xor */ if(ELEM6(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_RADIO)) bt= uiDefIconButBitI(block, TOG, tselem->nr, 0, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); - uiButSetFunc(bt, restrictbutton_r_lay_cb, NULL, NULL); + uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiBlockSetEmboss(block, UI_EMBOSS); } @@ -4537,7 +4905,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } -static void outliner_buttons(uiBlock *block, ARegion *ar, SpaceOops *soops, ListBase *lb) +static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, SpaceOops *soops, ListBase *lb) { uiBut *bt; TreeElement *te; @@ -4549,6 +4917,7 @@ static void outliner_buttons(uiBlock *block, ARegion *ar, SpaceOops *soops, List if(te->ys >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { if(tselem->flag & TSE_TEXTBUT) { + /* If we add support to rename Sequence. * need change this. */ @@ -4563,17 +4932,15 @@ static void outliner_buttons(uiBlock *block, ARegion *ar, SpaceOops *soops, List if(dx<50) dx= 50; bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", (short)te->xs+2*OL_X-4, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, ""); - uiButSetFunc(bt, namebutton_cb, te, NULL); - - // signal for button to open -// XXX addqueue(curarea->win, BUT_ACTIVATE, OL_NAMEBUTTON); + uiButSetRenameFunc(bt, namebutton_cb, tselem); - /* otherwise keeps open on ESC */ - tselem->flag &= ~TSE_TEXTBUT; + /* returns false if button got removed */ + if( 0 == uiButActiveOnly(C, block, bt) ) + tselem->flag &= ~TSE_TEXTBUT; } } - if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(block, ar, soops, &te->subtree); + if((tselem->flag & TSE_CLOSED)==0) outliner_buttons(C, block, ar, soops, &te->subtree); } } @@ -4627,11 +4994,11 @@ void draw_outliner(const bContext *C) /* draw outliner stuff (background and hierachy lines) */ outliner_back(ar, soops); - outliner_draw_tree(scene, ar, soops); + outliner_draw_tree((bContext *)C, scene, ar, soops); /* draw icons and names */ block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS); - outliner_buttons(block, ar, soops, &soops->tree); + outliner_buttons(C, block, ar, soops, &soops->tree); if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 69f88fbcca7..fc305361fe1 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -115,11 +115,17 @@ void outliner_header_buttons(const struct bContext *C, struct ARegion *ar); /* outliner.c */ void outliner_free_tree(struct ListBase *lb); -void outliner_operation_menu(struct Scene *scene, struct ARegion *ar, struct SpaceOops *soops); void outliner_select(struct SpaceOops *soops, struct ListBase *lb, int *index, short *selecting); void draw_outliner(const struct bContext *C); -void OUTLINER_OT_activate_click(struct wmOperatorType *ot); +void OUTLINER_OT_item_activate(struct wmOperatorType *ot); +void OUTLINER_OT_item_openclose(struct wmOperatorType *ot); +void OUTLINER_OT_item_rename(struct wmOperatorType *ot); +void OUTLINER_OT_operation(struct wmOperatorType *ot); +void OUTLINER_OT_object_operation(struct wmOperatorType *ot); +void OUTLINER_OT_group_operation(struct wmOperatorType *ot); +void OUTLINER_OT_id_operation(struct wmOperatorType *ot); +void OUTLINER_OT_data_operation(struct wmOperatorType *ot); void OUTLINER_OT_show_one_level(struct wmOperatorType *ot); void OUTLINER_OT_show_active(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index 6fddd16c174..2e11eb379b4 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -47,8 +47,15 @@ void outliner_operatortypes(void) { - WM_operatortype_append(OUTLINER_OT_activate_click); - + WM_operatortype_append(OUTLINER_OT_item_activate); + WM_operatortype_append(OUTLINER_OT_item_openclose); + WM_operatortype_append(OUTLINER_OT_item_rename); + WM_operatortype_append(OUTLINER_OT_operation); + WM_operatortype_append(OUTLINER_OT_object_operation); + WM_operatortype_append(OUTLINER_OT_group_operation); + WM_operatortype_append(OUTLINER_OT_id_operation); + WM_operatortype_append(OUTLINER_OT_data_operation); + WM_operatortype_append(OUTLINER_OT_show_one_level); WM_operatortype_append(OUTLINER_OT_show_active); WM_operatortype_append(OUTLINER_OT_show_hierarchy); @@ -71,12 +78,19 @@ void outliner_keymap(wmWindowManager *wm) { ListBase *keymap= WM_keymap_listbase(wm, "Outliner", SPACE_OUTLINER, 0); - WM_keymap_verify_item(keymap, "OUTLINER_OT_activate_click", LEFTMOUSE, KM_PRESS, 0, 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); - WM_keymap_verify_item(keymap, "OUTLINER_OT_show_hierarchy", HOMEKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, 0, 0)->ptr, "all", 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_item_openclose", RETKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", 1); + + WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "OUTLINER_OT_operation", RIGHTMOUSE, KM_PRESS, 0, 0); + + WM_keymap_add_item(keymap, "OUTLINER_OT_show_hierarchy", HOMEKEY, KM_PRESS, 0, 0); - WM_keymap_verify_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0); - WM_keymap_verify_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */ RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */ diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 4ddb586beb4..4737fb53a1a 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -120,6 +120,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: case ND_KEYINGSET: case ND_FRAME: + case ND_RENDER_OPTIONS: ED_region_tag_redraw(ar); break; } |