fix to allow [#24009] to be fixed.

WM_operator_poll() could fail in cases WM_operator_name_call() would succeed because calling the operator would setup the context before calling poll.
this would result in python raising an invalid error or menu items being greyed out.

now python can also check with an operator context:
  bpy.ops.object.editmode_toggle.poll('INVOKE_SCREEN')
This commit is contained in:
2010-11-04 12:59:03 +00:00
parent 0e81723683
commit 64ff9d6de4
6 changed files with 64 additions and 39 deletions

View File

@@ -629,7 +629,7 @@ void uiEndBlock(const bContext *C, uiBlock *block)
if(but->context)
CTX_store_set((bContext*)C, but->context);
if(ot == NULL || WM_operator_poll((bContext*)C, ot)==0) {
if(ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
}