Polyxion Posted August 7, 2018 Share Posted August 7, 2018 Hi everyone, this is my first time writing tools with python, so maybe I got something completely wrong here. I want to built a HDA to setup the houdini scene by selecting project, sequence and shot number. For that I created a HDA with a ordered menu and a drop down listing all available projects. The menu is created by a python function in the python module and then called in the menu script area. I then have another ordered menu to select from all the available sequences based on the selected project. A callback script on the project drop down is triggering the create menu function for the sequence drop down. I then need to know the currently selected project in the project drop down. I tried getting this information with the node eval parm, but this is only kind of working. It returns the right token, but as an integer and multiple times for each menu item causing a long loop. I also tried using the menu parm template, but I cannot access the data correctly. What would be the best way to geht the menu label as a string for the currently selected item in the drop down menu? Thanks Here is some of the code I used: #ProjectMenuDropDown def projectMenu(): import os projectPath = 'H:/' projectList = os.listdir(projectPath) projectMenu=[] for i, item in enumerate(projectList): projectMenu.append(i) projectMenu.append(item) return projectMenu #Call function in menu script hou.pwd().hdaModule().projectMenu() #Callback function to trigger sequence menu in python module hou.phm().sequenceMenu(kwargs) #SequenceMenuDropDown #SequenceMenu def sequenceMenu(kwargs): import os node = kwargs['node'] projSelect = node.parm('project').eval() Quote Link to comment Share on other sites More sharing options...
RichardF Posted August 9, 2018 Share Posted August 9, 2018 There's a menuLabels function: prjID = node.parm('project').eval() prjName = node.parm('project').menuLabels()[prjID] Quote Link to comment Share on other sites More sharing options...
e_noni Posted August 23, 2018 Share Posted August 23, 2018 i whould use this: projSelect = node.parm('project').evalAsString() http://www.sidefx.com/docs/houdini/hom/hou/Parm.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.