diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-04 18:59:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-04 18:59:09 +0300 |
commit | 6753882e42282ccf9dea49bdef2fc5455d852710 (patch) | |
tree | 5cc4fea764a9eb72b05d5c233d3549c52d7c7e02 /source/blender/editors/screen | |
parent | 5fafa570d06a920fcbd73b0e5b1944846cce43ed (diff) |
bugfix [#24009] Crash when switching area types and performing ops
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 845ef2bae4d..7cdd19e435b 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -132,17 +132,26 @@ int ED_operator_view3d_active(bContext *C) int ED_operator_region_view3d_active(bContext *C) { -#if 0 // correct but messes up poll() for menu items. if(CTX_wm_region_view3d(C)) return TRUE; -#else - if(ed_spacetype_test(C, SPACE_VIEW3D)) - return TRUE; -#endif + CTX_wm_operator_poll_msg_set(C, "expected a view3d region"); return FALSE; } +/* generic for any view2d which uses anim_ops */ +int ED_operator_animview_active(bContext *C) +{ + if(ED_operator_areaactive(C)) { + SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C); + if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME))) + return TRUE; + } + + CTX_wm_operator_poll_msg_set(C, "expected an timeline/animation area to be active"); + return 0; +} + int ED_operator_timeline_active(bContext *C) { return ed_spacetype_test(C, SPACE_TIME); @@ -229,6 +238,12 @@ int ED_operator_object_active_editable(bContext *C) return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW)); } +int ED_operator_object_active_editable_mesh(bContext *C) +{ + Object *ob = ED_object_active_context(C); + return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH); +} + int ED_operator_editmesh(bContext *C) { Object *obedit= CTX_data_edit_object(C); @@ -2248,7 +2263,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) /* api callbacks */ // ot->invoke= WM_operator_confirm; ot->exec= region_quadview_exec; - ot->poll= ED_operator_areaactive; + ot->poll= ED_operator_region_view3d_active; ot->flag= 0; } |