create shortcuts of menubar buttons ?

Hi all !

in Blender 2.63…

I wonder wether or not it is possible to create keyboard shortcuts for the 3 selection mode buttons in the bar of the 3D view ?
You know ? the 3 buttons with “vertex”, “edge”, and “face”…
It seems that i only need the name of the function called when those buttons are
clicked, but i can find them nowhere…
If anyone know about this, it would really be appreciated !

Thanks !

File > User preferences > Input

View 3D > Mesh > Add new (scroll down to the end of the list)

Enter the following:

wm.context_set_value
Context attrib: tool_settings.mesh_select_mode
Value: (True, False, False) --> for Vertex select mode

(False, True, False) --> edge
(False, False, True) --> face

http://img6.imagebanana.com/img/ui19fai8/thumb/Unbenannt.PNG

thanks CoDEmanX !
Will be extremely usefull to me. I got another question though.
As all blender is made of small PY scripts, i believe that almost all action can be bind to a key.
Where can i find the specific name for all functions corresponding to buttons ?
For example, for the transform dropdown menu ? or for the snapping mode button ? I’d really like
to shortcut all those things but i don’t have the function names.

Thanks a lot !

EDIT OMG ! it works like a charm !!! me now want a 300 keys keyboard !!! 8-D
Despite some defects, Blender is really an awesome tool !

you can find operators by hovering UI elements until tooltip pops up

or type bpy.ops. in py console and hit ctrl + spacebar for autocomplete

hmm. Am not sure but…
hovering ui elements gives nothing usefull. For example, in Bl 2.63 in edit mode, hovering the edge toolbar button give
only a help bubble: “Edge select - Shift-Click for multiple modes”. This looks like much more human language than function name :wink:
However on some other buttons, things are more interresting. For example, hovering the display mode ( wireframe/flat/textured… ) button in the same toolbar gives someting like:“Python: Spaceview3D.viewport_shade”. This is much more computer-like language…
Finally, the python console ( i comfess i opened it 10 mins ago for the first time 8-O ) gives much much more interresting things. I wish i had time to spend diving into this interresting thing for discovering blender’s mechanics, but unfortunately, i have none.
i CTRL-SPACEd lots of things and also found the “bpy.ops.wm.context_set_value(…”. Wich makes me come back & again to my previous question wich was about the 2 formals ( strings ) of this method: data_path & value. The principle seems pretty simple provided you know the possible values… and this was the object of my previous question.
Is there a way ( in a doc, wiki, or even a well documented python include file ) to know what values and formats can “datapath” and
“value” have ? I believe that is i got this info, i can rule the world ! or at least blender :wink:
Thanks for your answer, and have a nice day !

PS @ codemanX:
Your picture on imagebanana leads to a broken link. It’s not really a prob, as your post is accurate enough for getting rid of the pic. was just for your info :wink: regards.

Well…

Am back there to ask one lil more question about shortcuts on menubar buttons.

what are the variables to set in the different fields, to change the pivot center mode from one value to another ?
I’m ok with the CTRL+SPACEBAR in the python console, but it doesn’t help for ‘data_path’ and ‘value’ variables values.

please anyone could help on those vars, or maybe tell me where i can find the list of the different possible data_path values ?

thanks.

OK, answering to my own question after some searches in python thingies ( that i absolutely don’t know)…

The principle given by Codemanx is also valid for pivot mode settings:
so i partly copy his previous post…
File > User preferences > Input

View 3D > Mesh > Add new (scroll down to the end of the list)

Enter the following:

wm.context_set_value
Context attrib: space_data.pivot_point
value: (with the quotes)
“BOUNDING_BOX_CENTER”
or
“CURSOR”
or
“INDIVIDUAL_ORIGINS”
or
“MEDIAN_POINT”
or
“ACTIVE_ELEMENT”

depending on the mode you want…
It’s damn simple !!! wich is not is to find the right ‘context attrib’ and ‘value’ settings…

Have you tried Ctrl + Tab?

Back there to post a new question.

@molino: no i didn’t know CTRL+TAB. but now i can choose directly between vert, edge and face wit 1 2 and 3, and i don’t need ctrl+TAB. I did the same with the pivot: center/cursor choosen directly with 0 and 9 key… those are the features i use VERY VERY often, and it allows me gaining hours & confort in modeling.

Now in the same way, i come to ask wether or not it’s possible to have a key for toggling between modes :wink:
what i want is using the ‘>’ key ( the one aside the left shift ) for toggling between 2 snapping modes i use very often: increment and vertex.
This would mean that in the settings windows for shortcuts, there should be some conditionnal setup:
when current snapping setup is VERTEX, pressing the > key sets it to INCREMENT.
when current snapping setup is not VERTEX, pressing the > key sets it to VERTEX.

any idea ?

If this is not possible ( because of the conditionnal thing ) i think i’ll use the ‘)’ and ‘=’ keys for switching between the 2 snapping modes. In this case, could anybody please give me some clue on the values to setup in the new shortcut fields ?

thanks a lot !
and have nice blends !

EDIT: i know that the snapping menu shortcut is CTRL+SHIFT+TAB, but i want it smarter & faster with a direct shortcut :stuck_out_tongue:

bump !
noone have idea about this ?
possible or not ???

Grab the line just under the top menu and pull. You’ll see the gears of Blender spinning behind the scene…

When you change the snapping mode, it says:

bpy.context.scene.tool_settings.snap_element = ‘INCREMENT’
bpy.context.scene.tool_settings.snap_element = ‘VERTEX’
bpy.context.scene.tool_settings.snap_element = ‘EDGE’
bpy.context.scene.tool_settings.snap_element = ‘FACE’
bpy.context.scene.tool_settings.snap_element = ‘VOLUME’

From that, you can create a shortcut.

In the 1st text field: wm.context_set_value
Context Attributes: tool_settings.snap_element
Value: ‘INCREMENT’ (Don’t forget the single quotes around the text!)

You choose you key combination… Et voilà! :smiley: Next!

OH MY GOD !!! a debug console!!! 8-O
i never noticed this ! great thanks to you Kaluura !!! this will be damn helpfull for many things !

Many answers to my questions can come from this !
regards.