PDA

View Full Version : getSelectedVerticesByNode() ?


Hobbs
09-22-2009, 06:51 PM
How do we get the node parameter for "getSelectedVerticesByNode()", or can someone show me an example of how to use this call.

i used to use the call .getSelectedVertices(), but i need to modify my code for use with multiple objects selected. Since .getSelectedVertices() returns an empty array when used when unwrapping several objects at the same time.

I'm using max 2010.

Thanks.

denisT
09-22-2009, 07:22 PM
How do we get the node parameter for "getSelectedVerticesByNode()", or can someone show me an example of how to use this call.

i used to use the call .getSelectedVertices(), but i need to modify my code for use with multiple objects selected. Since .getSelectedVertices() returns an empty array when used when unwrapping several objects at the same time.

I'm using max 2010.

Thanks.


delete objects
for k=1 to 3 do sphere mapCoords:on
select objects
modpanel.addmodtoselection (global uvw = UVWUnwrap()) ui:on
uvw.Edit()
for n in objects do
(
k = uvw.numberVerticesByNode n
i = random 1 k
j = random 1 k
if i > j do swap i j
uvw.SelectVerticesByNode #{i..j} n
format "% %\n" n.name (uvw.getSelectedVerticesByNode n)
)

Hobbs
09-22-2009, 07:27 PM
Thanks Denis,


But what if i don't know what objects i have selected, or which i'm working with in a given selection? This is for a function that is used during the unwrap process.

Unless there is a call that i missed that allows you get node by vert, that i'm missing.

i would prefer to not have to use "isVertexSelectedByNode()" throughout my selection to see if thats the node i'm working with, but if i must, i must.

It would just seem like a slowdown and overkill to do that everytime i run this function.

Thanks for your time.

denisT
09-22-2009, 07:59 PM
Thanks Denis,


But what if i don't know what objects i have selected, or which i'm working with in a given selection? This is for a function that is used during the unwrap process.

Unless there is a call that i missed that allows you get node by vert, that i'm missing.

i would prefer to not have to use "isVertexSelectedByNode()" throughout my selection to see if thats the node i'm working with, but if i must, i must.

It would just seem like a slowdown and overkill to do that everytime i run this function.

Thanks for your time.


to get nodes which are using current uvwunwrap (uvw in my sample) is easy.

nodes = refs.dependentNodes (refs.dependents uvw)[1]
nodes = for n in nodes where n.isselected collect n -- double check


after that you have go through all nodes in list and check their selection. It's fast.
But you have to know that uvwunwrap returns selection per node in range of number of node verts.

when you call .getSelectedVertices in multi-selection case it returns you a selection of main node (usually first one).

Hobbs
09-22-2009, 09:06 PM
ok, i'll try to work this in. Thanks for looking into it.

CGTalk Moderation
09-22-2009, 09:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.