[Closed] unwrap_uvw getSelectedVertices errors
hello all. I am having a hell of a time understanding how to get/set UV vertices/edges/faces. I have been reading the online documentation, and following how to get the current selection of UV vertices, by using the following command…
unwrap_uvw.getSelectedVertices()
as it clearly shows in the documentation, this method does not have any arguments. However, when I try testing this in the listener window, I get an error stating… Argument count error: getSelectedVertices wanted 1, got 0. I thought maybe I needed a node arugument, just like in some of the polyop methods, where it still requires an Editable_Poly argument, but then I get a different error when I do this…
unwrap_uvw.getSelectedVertices $ <– standing for my selected object as an Editable_Poly
and this is the error I get…
– Runtime error: Object does not implement this interface: unwrap
I tried searching on Google and in here, using such keywords as… selecting uv vertices, or getSelectedVertices wanted 1, got 0, but with no such luck. I have ran out of any ideas and I want to know what am I doing wrong? Why is this not documented correctly, and what is this argument that the unwrap_uvw.getSelectedVertices is looking for? I really wish Maxscript had intellsense, just like C++/C# does in MS Viusual Studio.
You need to get a reference to the current Unwrap UVW Modifier in order to access it’s methods and properties.
uvw_mod = modpanel.getcurrentobject()
uvw_mod.getselectedvertices()
Try something like this:
Assign the unwrap modifier to a variable and use it.
UVWunwrap needs to be the current element in the Command Panel and Max must be in modify mode.
(
local b = box()
local uvwWrap = UVWunwrap()
addmodifier b uvwWrap
max modify mode
modPanel.setCurrentObject uvwWrap
uvwWrap.selectVertices #{1..(uvwWrap.NumberVertices())}
local baVerts = uvwWrap.getSelectedVertices()
format "baVerts %
" baVerts
)
It would be really helpful if the unwrap_uvw modifier documentation would explain that you need a reference to the current unwrap modifier.:rolleyes: Man, you do not know how much this pisses me off. Yeah, yeah, I know… its better to be pissed off then pissed on.
A little piece of advice that could avoid you from rewriting all your code. (like I did)
All unwrap command work on one node!
Check getSelectedVerticesByNode if you want your script to work with multiple object.