polygon pickwalk script for download


#1

Hi All,
I just wrote a script for pickwalking on polys… its based on screen space of the current camera, so you can just go up, down, left, right relative to your view…
it also has the option to add the resulting pickwalk to the current selection. (basically grow selection in a particular direction)

here is the link on highend [jhPolyPickwalk v1.0](http://www.highend3d.com/files/dl.3d?group=melscripts&file_loc=jhPolyPickWalk-v1.0-.mel&file_id=3486)

.j


#2

HE john very cool!!..I’e been trying to write something like that but didn’t succeed, was going the way of transforamtion matrix and fail lamentably.(a programer around me at that time suggest it would be the only way, but my math were not up for the challenge).I suppose i can now check inside your brain…hehe …

Anyway I’ll use yours thanks for that very usefull stuff.

cheers


#3

Thanks, John - very much appreciated… will try later and report back :slight_smile:

A.


#4

wow sounds technical… the closest I came to something like that in this script would be checking if ($a > $b)

:arteest:

BTW that link above seems to just go to the search page…
this one should go to the script.

.j


#5

Really cool, I like it a lot. Definitely gonna bind this to some hotkeys.

Some crits if you don’t mind:

It is a bit counterintuitive as to what it selects (i.e. if I have a vertex at the left rim of a sphere in the viewport it can start pickwalking upwards if I set it to “right” - perfectly logical but not what one would intuitively expect) but this is all in the nature of how it works (which is a really cool idea btw).

It’s also a bit slow when the selection starts growing - this might be caused by the creation of all the groups or it might also be caused by the xform command (which is ridiculously slow but alas afaik there’s no faster alternative - I think pointPosition is just as slow). Here’s a few optimization tips:

1 You could take the original selection and use [size=2]polySelectConstraint -pp 3; to get the border vertices, and only use those in the main for loop instead of all the selected vertices - if you pickwalk a vertex that’s not a on the selection border, you’re allways gonna reselect a vertex that was already selected to begin with, aren’t you?[/size]
[size=2][/size]
[size=2]2 This is a bit trickier but I think it’s gonna make a big speed difference: the script creates (n+1) transforms for every vertex, where n is the number of edges connected to that vertex, so if your selection consists of 10 quad vertices, 50 new transforms will be created am I right? You could skip the group creation entirely using a pointMatrixMult node. If you connect the camera’s worldInverseMatrix to the pointMatrixMult’s inMatrix attribute and set the pointMatrixMult’s inPoint attribute to the world space position of any vertex, the pointMatrixMult’s output attribute will store that vertex’ position in the cameras local space - same result as getting the translate attributes from your reference groups, but probably a lot faster. And you only need to create one pointMatrixMult node at the start of the script and then you can delete it at the end.[/size]
[size=2][/size]
[size=2]And lastly a request: this script would totally kick ass if you could pickwalk any poly component type - vertex, edge, face, UV. It shouldn’t be too hard if you convert e.g. faces to vertices first, run the pickwalk loop, and then convert back to face using polylistComponentConversion -fromVertex -toFace -internal.[/size]
[size=2][/size]
[size=2]Thanks for a great script, mate.
[/size]


#6

creation entirely using a pointMatrixMult node. If you connect the camera’s worldInverseMatrix to the pointMatrixMult’s inMatrix attribute and set the pointMatrixMult’s inPoint attribute to the world space position of any vertex, the pointMatrixMult’s output attribute will store that vertex’ position in the cameras local space

see what i’m talking about John ?..I guess my math are still not up for that…damn why did i do art school??
Sounds greta anyway Anders.:slight_smile:

cheers


#7

Well, it’s based on a very simple, but extremely useful rule:

To convert a point from local space to world space, multiply its local coordinates by the world transform matrix. worldPoint3 = localPoint3 * worldMatrix4

To convert a point from world space to local space, multiply its world coordinates by the inverse of the world transform matrix. localPoint3 = worldPoint3 * inverse(worldMatrix4)

In Maya, all dag nodes (and thus all nodes which derive from dag nodes, e.g. transform nodes) have both the world matrix and inverse world matrix stored as read only attributes, so you don’t actually have to know how to multiply points by matrices mathematically (not to mention multiplying matrices by matrices and especially inverting matrices where it gets really involved) - maya can do that for you :slight_smile:

Btw my math education isn’t that rigorous either, I usually read up on things when I need them. But yes, vector and matrix math can get a bit involved.


#8

It just occurred to me that you can use a vectorProduct node instead of a pointMatrixMult node. I don’t know why Alias have made two nodes for doing the exact same thing, and I don’t know which one is better, but the vectorProduct node has a nice and descriptive icon… :slight_smile:


#9

thanks for the head on…I read stuff about it all the time, but it seems that it can never stick in my brain…said the same for mel a year ago and finally got a grip on it…well hopefully it won’t take much than that…(not too sure).

thanks anyway


#10

hey Anders, stop showing me up!!!
cheeky bugger :argh:

just kidding buddy, all good suggestions… and I will look into all of them.
hopefully I get some time, that was probably a pretty premature release of the script, as I’m pretty busy and just wrote it in my breaks over the course of a week and didn’t really test it.
I did notice it was dog slow with a large selection ;^)

damn you, after having the idea i couldn’t rest untill it was done (hence the working on it in my breaks), now I wont be able to rest untill it is up to the “Anders standard”.

the script only creates 1 transform for each vert, and the verts connected to it…
probably doesnt need one for the start vert…

hey did you get my email the other week? I think it bounced! you change addresses? send me a mail if you still have mine would ya?

.j


#11

Sorry bout that mate :).

The mail most likely bounced. Check your mail and PM.


#12

hey guys does this script work with maya 6 or 6.5? I get a syntax error in 6.01, maybe I’m doing something wrong, I just dragged it onto my shelf.

Cheers

MunCH


#13

yes, will work in all versions

yes, thats what you are doing wrong. not many scripts will work like that…
read the top of the file.

.j


#14

Thanks john, it helps reading all the info, was running late for work when I tried it (slack excuse), would this be possible to put in a marking menu? and also it only works on vertices right?

Good job John, thanks for sharing:thumbsup:

MunCH


#15

sure, just make a marking menu in the usual way, and put the relative commands in.

I’ll put in support for faces and edges next chance I get, should only take a few minutes…

I’m looking at the speed too… finding interesting things about maya… that shouldn’t happen… the slowness is actually due (in part) to the undo que, which I’m looking at going “around”…

.j


#16

version 2

now works on verts, faces, edges, and combinations of any/all three.

have not addressed speed increase. it gets slower every time you use it :frowning:
this seems to be due to the undo que.
to “reset” the speed you can run the command flushUndo; however this will flush the undo que…
I will look into this for a future update.

.j


#17

version 2.1
sorts out a problem with returning to the correct component mode

.j


#18

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.