Make custom hotkeys with Wm operators

Hi, I hope I´m in the right place here. I´m trying to make a custom hotkey for any data path in a project.
For example: changing a node value in the shader node editor. What I´ve found out so far is that I
can do that with Wm operators. I seem to hit a wall though when I paste a data path that I copied with right mouse click from a node into the operator. wm.context_modal_mouse for example gives me two slots for data paths but when I use them with lets say node_tree.nodes[“Wave Texture”].inputs[1].default_value it gives me an error (“Context” object has no atrribute) - what am I missing here?

To give you some context as to why I´m doing this: I am currently trying to get these in depth values to work with my loupedeck, to change them with dials on the fly while playing the animation live in eevee. This could be handy for vjing.

Thanks in advance, any help is appreciated!

1 Like

Hi!

The context operators that require an iterable are a bit special.

The data_path_iter argument expects a sequence in the context namespace, eg. selected_objects.
The data_path_item argument expects a sub path which when concatenated with an element of the sequence, forms a qualified path.

Try putting:
selected_objects as data_path_iter and
active_material.node_tree.nodes["Wave Texture"].inputs[1].default_value as data_path_item.

The key here being that active_material is a member of an object, and then the rest of the path you already got.

1 Like

Wow, that did it! Thank you so much! And it makes sense… but I never saw any explanation of the data_path_iter argument in the documentation! That´s a big step forward for me. I´d like to ask a related question though: do these shortcuts only work in the active space (e.g. when the node editor is open) or can I make them globally active? The point being that I want to be able to just let the animation run in the 3D window and if possible not have to click into the node editor or any other windows…

1 Like

Great!

The path you posted in particular works anywhere as it’s considered relatively absolute. The caveat being that the object(s) must first be selected, a prerequisite for the operator.

If you need truly absolute paths and want to change values of specific things regardless of selection, you’d likely have to write a less generic operator that accounts for this.

1 Like

@MartWol, does the Loupedck allows for specific user config with a -software of their own- to connect to Blender?
I imagine there is a way to assign hardware keys to keyboard commands from the edit-user prefs-keyboard in Blender?
I read you are doing your own custom calls to Blender functions.