I am writing a addon that shows the currently available shourtcut keys.
At the moment I am filtering the availalble shortcuts via the bpy.context region and space data and comparing those to the settings for each shortcut. I then poll each one to see if it can be called in the current context. After all this I am still getting shortcuts in the list that are not actually relevant to the current context. I am thinking this is because the active object is in a different scope/context which the C code is filtering out but I can't work out how to do this filtering.
If I could find which space the active object is in and if that was the same as the current space then show those shortcuts otherwise don't. I can't seem to find out how to find the context of the active object rather than just the current context. I hope I have been clear enough here.
Thanks
Yardie
if idname and eval("bpy.ops.{:}.poll()".format(idname)):
is not failing as it should - then maybe that is my problem and that's not the right way to do this. It does seem to be the way that the C code works. $\endgroup$return {'CANCELLED'}
or{'PASS_THROUGH'}
to terminate execution afterpoll()
returnedTrue
, which is sometimes necessary, as you can't access everything from the class methodpoll()
or the conditions are too manifold to check in advance. You can't rely onpoll()
only, and not all operators have one anyway. $\endgroup$