Accessing value in ordered menu

   1841   6   2
User Avatar
Member
5 posts
Joined: 12月 2013
オフライン
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 :

s@wall_id = chs("parm");

I get a -1 as a value instead of the actual string value.


Could somebody help me out here?
User Avatar
Member
5 posts
Joined: 12月 2013
オフライン
Does anyone have an idea why the access to the string value does not work?
User Avatar
Member
5089 posts
Joined: 2月 2012
オフライン
Hi,

Could be how you are accessing the current node. I would just do it like this:

node = hou.pwd()
geo = node.geometry()
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
312 posts
Joined: 3月 2023
オフライン
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
User Avatar
Member
247 posts
Joined: 5月 2017
オフライン
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.
User Avatar
Member
5 posts
Joined: 12月 2013
オフライン
Thanks for your replies!

I tried

node = hou.pwd()

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.
User Avatar
Member
5 posts
Joined: 12月 2013
オフライン
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!
  • Quick Links