Accessing value in ordered menu
2773
6
2
regart
Member
5 posts
Joined: Dec. 2013
Offline
Aug. 6, 2024 9:41 a.m.
Hi, I guess I have a very simple question, since i am very new to python.
On a wrangle I created an ordered menu.
the Menu Python Script looks like that:
node = kwargs . get ( 'node' )
names = []
geo = node . geometry ()
wall_IDs = geo . stringListAttribValue ( "wall_ids" )
for id in wall_IDs :
names . append ( id )
names . append ( id )
return names
I read from a detail string array called "wall_ids" and the menu gets created as expected. All items from the string array appear in the drop down menu.
But when I try to simply access the chosen string value from the created parm with something like :
I get a -1 as a value instead of the actual string value.
Could somebody help me out here?
regart
Member
5 posts
Joined: Dec. 2013
Offline
Aug. 13, 2024 3:08 a.m.
Does anyone have an idea why the access to the string value does not work?
animatrix_
Member
5320 posts
Joined: Feb. 2012
Offline
Aug. 13, 2024 5:11 a.m.
Hi,
Could be how you are accessing the current node. I would just do it like this:
node = hou . pwd ()
geo = node . geometry ()
ASquirrel
Member
343 posts
Joined: March 2023
Offline
Aug. 13, 2024 6:36 a.m.
make sure you wall_id attribute don't already exist as a different type, the fact you say your value is '-1' tell me that this attribute already exist in your network, since a badly configured chs() should simply return an empty string.
Head of Pipeline @ LightVFX
vikus
Member
255 posts
Joined: May 2017
Offline
Aug. 13, 2024 7:36 a.m.
regart I get a -1 as a value instead of the actual string value.Not sure but it could be a bug. I remember facing the same issue some time ago since then I use string parms as menus to pass string values.
regart
Member
5 posts
Joined: Dec. 2013
Offline
Aug. 13, 2024 7:43 a.m.
Thanks for your replies!
I tried
instead of
node = kwargs . get ( 'node' )
this didn't seem to change anything. The dropdown menu works, just like before. Meaning the string values from the array are listed as expected.
Also I made sure the the attribute didn't exist in the first place.
But still, when I try to access the parm with vex from the wrangle, I get a -1 as a result.
regart
Member
5 posts
Joined: Dec. 2013
Offline
Aug. 13, 2024 7:52 a.m.
viklc regart I get a -1 as a value instead of the actual string value. Not sure but it could be a bug. I remember facing the same issue some time ago since then I use string parms as menus to pass string values.Thank you! By using string parms, it works!