1
$\begingroup$

This question is an extension of this: What identifier of operator must be entered for assign shortcuts

I did not understand how have copied Python command or Data Path available I could to determine that it is the context is wm.context_toggle and attribute is space_data.use_occlude_geometry.

Could someone explain in more detail the thing about where the operators came from?

I found on the official website section initiated to the python, but I can not be guided in it

$\endgroup$
3
$\begingroup$

Since i don't want to add another comment:

You can list all available operators via Info Menu -> Help -> Operator Cheat Sheet and look at the Text Block generated in the Text Editor

The operators are listed by category in this section (at the bottom of the page) of the API documentation.

If you drag down the Info Area you can see a history of recently used (registered) operators

You can hover over buttons with python tooltips enabled.

The context data is listed in this section (available members depend on the area/mode)

The different spaces used by the corresponding editors/areas are listed in this section (subclasses - top of the page)

See also Screen Elements

$\endgroup$
1
$\begingroup$

Once again I'm not really I coder myself, so I don't know a definite answer for this.

I think I figured it out by trial and error myself, I looked up how other key maps were pre-configured by default, tested a few things and tried until it worked.

Googling for the operators is often useful too.

You can also look in Blender Info Editor (by default the header with the File, Render, Window and Help menus) if you expand the editor you will find above the menus is a message history. There and in the Online Python Manual you can find that it is a Boolean Property, and it toggles between TRUE or FALSE. Most other toggles that work like this are also probably Boolean Properties, for which you must toggle with the wm.context_toggle operator.

Some others are actually Enums (enumeration of several possible predefined values) like for example the current 3D View Shading mode, and for those you use the operator wm.context_toggle_enum instead. You can also learn this by inspecting other existing default keymaps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.