Bug? Script issue

Bug? Script issue

I discovered that tool.getParameter('xxx') only returns lowercase text for a selector. Is this by design? I can work around it, but it's kind of nasty.

I might note that getting an object's name does not have the same problem, so it doesn't happen for all tools.
 
Last edited:
More info: It looks like setParameterSelector modifies the array of strings it is passed (lowercasing them all) but displays the original strings. This is pretty strange behavior.
 
hi

It returns index of selected value of array for parameter selector in my environment. :confused:

All parameter's name and option labels of addParameterSelector are localized.
If you use parameter's name that already exists in localizable string file, the string of name will be converted to localized one.

Best

tg_jp, Hiroto
 
Ok. But it's messing with the array I pass to it, which is nutty and very unexpected. This means I get a different string than I passed in which happened to be significant.
 
Hi,
I'm also a little bit confused. Selectors are internally integer parameters. Calling the getParameter() function therefore returns a Number, the index of the selected item. It doesn't return a string.

Bye
Martin
 
Sorry, I wrote the original post in haste, but the problem is real.

Yes, but calling setParameterSelector("foo", array, false, false) appears to change the contents of array.

So if I have an array ["Foo", "Bar"] it is now ["foo", "bar"] but the menu is capitalized. This is problematic when (as it happens) I actually want to use the array contents for something else, and seems weird to me.

If the user selects the first menu item, array[tool.getParameter('foo')] != "Foo".

(I encountered the problem in Pose Utilities, which has an array of left/right prefixes. I solved the problem by making the prefixes case-insensitive, but it still seems like very strange behavior to me. I'm guessing that the original string is converted to lowercase to look for localizations — but it should treat the input as immutable even though it isn't, since having your data changed by a method call is a side-effect.)
 
Last edited:
I can't reproduce that problem. Please try the attached tool script. At least on my Mac the array doesn't gets modified.

Bye
Martin
 

Attachments

  • SelectorTest.js.zip
    753 bytes · Views: 185
Back
Top