VEX - get ordered menu label

   4053   6   1
User Avatar
Member
388 posts
Joined: July 2018
Offline
How can i do this in Vex instead of Python?
i have managed to get the index of the ordered menu but not the label

Attachments:
Capture.JPG (40.9 KB)

User Avatar
Member
9696 posts
Joined: July 2007
Offline
I don't think you can get menu labels in VEX, VEX would potentially have to evaluate the menu script to get the labels which would be a huge bottleneck and probably not even thread safe

do you have a reason for not having the menu value and label being the same?
like instead of having your menu defined as:
0 | something
1 | something else
2 | one more thing

you can have:
something | something
something else | something else
one more thing | one more thing

and then you should get expected string using your code
Edited by tamte - April 11, 2022 15:06:29
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
388 posts
Joined: July 2018
Offline
tamte
I don't think you can get menu labels in VEX, VEX would potentially have to evaluate the menu script to get the labels which would be a huge bottleneck and probably not even thread safe

do you have a reason for not having the menu value and label being the same?
like instead of having your menu defined as:
0 | something
1 | something else
2 | one more thing

you can have:
something | something
something else | something else
one more thing | one more thing

and then you should get expected string using your code

Thank you! nice and simple
btw i was doing this in python module in order to pick an object and change its pscale but python was throwing me an error that the geometry is read only. i remember reading something about that. That python cant alter geometry?attributes? so i moved the setup to VEX. i am probably wrong but didnt have much time for debugging
Edited by papsphilip - April 13, 2022 15:52:41
User Avatar
Member
9696 posts
Joined: July 2007
Offline
papsphilip
. That python cant alter geometry?
it can
- either during the cook of Python SOP, so as long as your code is in Python SOP you can alter currently cooked geo same way as Wrangle is affecting currently cooked geo using VEX

- or you can alter any geo that's not read only, like frozen geo copy in memory and then inject it into Geometry Data parameters for example
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
388 posts
Joined: July 2018
Offline
tamte
as long as your code is in Python SOP

i was trying to do that in a python module actually. Is there a difference?

Attachments:
sop_ulc.dev.override_pscale.1.0.hda (35.7 KB)

User Avatar
Member
9696 posts
Joined: July 2007
Offline
papsphilip
i was trying to do that in a python module actually. Is there a difference?
big difference
since Python SOP executes the python when it's cooking the node, so it's allowed to process the input geo and create output geo
Python anywhere else can't modify geometry of another node, it can modify geometry of Geometry Data parameters for example or geometry in memory, etc
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
388 posts
Joined: July 2018
Offline
thank you for clearing this up!

"it can modify geometry of Geometry Data parameters for example or geometry in memory"

i am not sure what this means though can you give me an example?
what is Geometry Data parameters? when would i have geometry in memory?
  • Quick Links