I'm trying to write some simple UV tools, but I'm running up against some oddities with arrays. I'm no MaxScript expert, so I'm probably doing something wrong somewhere. I'd started off with trying to find out the UV coords of the selected vertices in the Edit window of an Unwrap UVW modifier. The code is;selVerts =…
bit array is though a lot faster - and if you are once familiar with them they can improve the performance. And some methods in maxscript require bit arrays as parameters like when passing over a selection to transform and so on. for bit arrays you can use:for v in myBitarray do(print("element: "+v as string);)
Aha, nevermind. Googled the answer by accident. It appears I needed "as array" at the end of the first line, so; selVerts = $.modifiers[#unwrap_uvw].unwrap.getSelectedVertices() as array Feel free to delete this thread, sorry :P
This example actually iterates over the bitarray fine. When you print its contents of a selected box uv, you get true or false 24 times. Maybe you mean something else but then Rob will have to enlighten us :poly121: When you tell it as array it magically converts the bit to an int, that is obviously very strange because…
Yeh, I figured it out in the end, cheers guys. I was just confused as to what it was doing as the Maxscript listener displays it as a regular array with the vertex IDs, so I thought that's what I was getting. Got my UV align scripts working. Now I just have to figure out how to stuff it into the interface :P
You can actually do a "for" in a bitarray I believe, but it's a different syntax (Rob Galanakis told me how once, can't remember offhand though)... personally I prefer using arrays since they're more familiar, but I think it's probably a little faster / more efficient to keep it as a bitarray.
got your PM, is it something you want to contribute or is it more personal? because either way I could implement it for you. I designed the GUI in a way that all scripts are seperate *.ms files with a single function in them. The main script that builds the floater then loads the function and calls it from one of the…
Ok i figured it out. The behaviour you get is correct. The function getSelectedVertices() returns a bitarray. This means a bit can be turned "on" or "off", 1 or 0, true or false. The documentation says this: BitArray ValuesOperators <bitarray>[<integer>] Yields true if selected, else false You will have to search another…