Hi,
I'm currently playing a bit with LOPs trying to use the context options editor to control several switches and variables in a multishot setup.
In order to make that work I wanted to use a python script that allows me to add menu items of a context option.
So lets say the context option is called shot and i wanna add an item with the name "shot_01_name" and value "shot_01"
I was going through the documentation and I saw setContextOption() to change the current option, but I was not able to find a way to add items to the menu?
I guess that's something obvious I'm missing here,
but I would be very thankful if somebody could give me a hint.
Thanks mil,
Alex
Context Options Editor - adding string menu items via python
60138 4 0- kernberg
- Member
- 13 posts
- Joined: 11月 2013
- Offline
- ben toogood
- Member
- 31 posts
- Joined: 2月 2014
- Offline
Hi - think you've got to use hou.setContextOptionConfig() to add the metadata to define the GUI for a context option.
You can see the formatting for the config string if you add a default "string_menu" context option and query its config with hou.contextOptionConfig("string_menu")
Looks something like this:
Hope that's helpful
You can see the formatting for the config string if you add a default "string_menu" context option and query its config with hou.contextOptionConfig("string_menu")
Looks something like this:
{"comment": "", "autovalues": false, "minimum": 0, "menu_items": [["First item", "a"], ["Second item", "b"]], "maximum": 10, "label": "String Menu", "menu_source": "", "max_locked": false, "min_locked": false, "type": "string_menu", "order": 3}
Hope that's helpful
- kernberg
- Member
- 13 posts
- Joined: 11月 2013
- Offline
- thorna100
- Member
- 4 posts
- Joined: 6月 2020
- Offline
- sebd3dvfx
- Member
- 6 posts
- Joined: 3月 2024
- Offline
-
- Quick Links