Home Technical Talk

MEL questions

polycount lvl 666
Offline / Send Message
PolyHertz polycount lvl 666
I've been learning mel recently (only knew some basics till now), and have a few questions for those in the know.

1. Is their a way to lock variables? I'd like to be able to make a procedure declare variables once and never again, so they dont get reset values every time a global is called.

2.How does the tokenize command work, I really dont see its usefullness from the description or examples i have seen in the mel command reference.

3. what is a uint? I know int/float/boolean/string/vector, but not uint, and searching the help files yields nothing.

4. Can component selections be made based on vector locations instead of point order?
also, checking the vector for an edge or faces center? verts work wia pointPosition command already.

5. Is their any way to select a border via mel? The polySelect command just clears the selection, as does every other tool in maya that says 'border other then double clicking...

6. Printing a specific number of elements from an array? Something like: print $someVariable[1 through 6]

7. Making a command not go into the undo que, as opposed to turning undo mode on and off at the beginning and end of a command? right now I'm using undos alot in my scripts because I dont want to cram the undo que with junk while running anything that involves much user interaction. Problem is each undo slows down the codes execution by quite a bit.

Replies

  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    1. you can use optionVar for that which will add the variable to maya's dedicated list of variables (where it stores your defaults for bevel, extrude, etc)

    2. hmm maybe they have better ways to do it now, but tokenize is nice when you're trying to do things like split up filepaths or something like that. It's just for splitting stuff up. Maybe you have "testShiznit.txt" and you tokenize it with "." as the split char to get just "testShiznit"

    3. haha I don't recall ever seeing that in mel. Maybe in the builtin commands' arguments? anyway a uint should be an unsigned int, which is just a positive int.

    4. whatchoo talkin bout! selecting based on position? no, not that I know of, you'd need to make a proc to do that I bet. For getting center positions of edges and faces there's also no builtin command I know of. I think I've always taken "xform -q -ws -t object.e[2]" for stuff like that which will return positions of the involved points and then get the average of those in a common proc if you're doing it often.

    5. say wut? with polySelect you can't specify an object, are you sure it's not working? syntax is like "polySelect -eb 6458". You can also force a 'Border selection mode' with "polySelectConstraint -border 1" if you're going for everyday use.

    6. hmm not that I know of. Arrays are handled specially in print so I don't think you can do anything too fancy

    7. yeah unless you turn off/on the undo before and after your stuff it'll store it in the undo queue
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    1. Yep, what Funky Bunnies said - optionVars are the way to do it.

    2. I use tokenize all the time... hopefully not because I'm doing something wrong :)
    But for example if you want to extract the vertex index as an int from "pCube1.vtx[21]" which is a string, so tokenize it into an array with "[]" as the split characters, then the last index of that array will be the index alone.
    For example:
    string $tokens[];
    int $numTokens = `tokenize "pCube1.vtx[21]" "[]" $tokens`;
    int $vertexIndex = $tokens[ $numTokens - 1 ];
    
    If anyone knows a better way of getting this value, please tell me :)

    3. Yeah, unsigned int, but I don't think MEL uses that (at least not outwardly). You always declare stuff just as ints, never uints.

    4. There's some stuff for finding closest face based on a ray intersection, not sure if that's available in MEL, but it's in the API so you could access it through Python if you wanted. I've never really had to do stuff like that.

    5. The polySelectConstraint stuff is evil, because it actually requires a physical selection rather than just an array passed through MEL, so it's only useful if you're taking an original selection and converting it to borders, IMHO. The polySelect stuff that Funky Bunnies mentioned should work...

    6. The obvious answer to this one is:
    for ( $i = 1; $i < 7; $i++ ) print $myArray[ $i ]; 
    
    7. Just use undoInfo to turn off undo before your script executes, then turn it back on afterwards. Bear in mind that if your script errors out or gets cancelled by the user, you'll need to turn undo back on! Try to handle every possible case of exiting the script unexpectedly (eg. test for empty strings, zero numbers, anything that's a "bad" value) and turn Undo back on before returning out of the script.
  • renderhjs
    Offline / Send Message
    renderhjs sublime tool
    3.) apparently in some languages uint's are faster as regular int's because they hold a smaller range. Though mostly you will end up with regular int's anyway
  • Whargoul
    Offline / Send Message
    Whargoul polycounter lvl 18
    1. Not sure exactly what you want here. Why can't you just declare a global variable in one proc, and access it in all the others? There's no reason to "lock" it - the only way to change the var is to explicitly set it. If you want it to be stored across sessions (as in, literally set it ONCE only) then you can use optionVars, but that's a bit of overkill. They are usually best used for saving user preferences and stuff (ie set some sliders in a UI and they are there the next time). For things like this, I usually just have one proc that sets all variables (easy to find, edit, maintain) as globals and use those in the others.

    2. Tokenize just breaks things up, like everyone else said. Sentences into words, paths into directories, full names into name spaces, etc.

    MoP, you'd be better off with some simple match (regEx) type stuff - see my last example.

    Examples:
    getting the final node name from the full node name (if there are dups in the scene):
    string $node = "group1|group2|group3|myObject";
    print `match "[^|]*$" $node`;
    -> myObject

    get path from full file name:
    string $file = "c:/temp/stuff/thing.ext";
    print `match "^.*/" $file`;
    -> c:/temp/stuff/

    get file name from full full name:
    string $file = "c:/temp/stuff/thing.ext";
    print `match "[^/\\]*$" $file`;
    -> thing.ext

    extension from filename:
    string $file = "c:/temp/stuff/thing.ext";
    print `match "[^.]*$" $file`;
    -> ext

    getting the component number (doesn't work with ranges though):
    string $thing = "pCube.f[23]";
    print (int(match("[0-9]+", `match "\[[0-9]+\]" $thing`)));
    -> 23

    getting object from component:
    string $thing = "pCube.f[23]";
    print `match "[a-z,A-Z,0-9,_,|]*" $thing`;
    -> pCube

    Those are all much faster than tokenizing - but damn hard to figure out (I had some programmer help on the regular expression stuff).
    But yeah, I bet a good chunk of my scripts will have tokenize in there somewhere - it's always useful!

    3. uint - doesn't exist in MEL I think. Just use an int.

    4. Selecting based on position: sort of. You can use the PolySelectConstraint to do it in a way, or you can code them manually. pointPosition is the fastest way to get vertex positions, otherwise use the xform -q -ws -t command (query the worldspace transform). Iterate through them to see if they match your criteria, build a selection list, then select at the end.

    5. What they said. Again, PolySelectConstraint can do it - but I think it will always physically select the stuff, which is slower if you just want the ID's of the things for further processing in a script.

    Also, you could use the polyInfo command on an edge to list it's connected faces, if there's only 1 it's a border edge (which is actually a fairly fast way in script to do it - even though you have to tokenize and parse the output yourself - believe me - that's odd :) )

    6. MoP said it best - just print it out yourself.

    7. Generally - turning undo off is a bad thing in any script. Like MoP said, if it fails you're in a bad state. The user also can't undo what your script did - so if the wrong thing was selected, they are shit out of luck. If you are going to, make sure you switch the state without clearing the queue, something like undoInfo -swf 0 (by memory - stateWithoutFlush? something like that anyways). But like I said, not very user friendly.
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Time to revive this thread. Thanks for your help guys, the responses really helped. :)

    Anyhow, got a few more questions been meaning to ask once I got back online sense I'm only on the net for a short period once every few weeks these days.


    8. If I use a list selection command to store a bunch of edges/verts/etc. in a variable, how would I make sure that each item becomes its own element in the array. For example, if I have 3 selected verts they can end up as two elements, like such: pSphere1.vtx[182] pSphere1.vtx[202:203]
    If possible don't want this to happen.

    9. forcing selection hold when modifying geo, or selecting geo affected by something in the history stack of an object? For example, if I select an edge and perform a bevel, the newly split edges are by default unselected, but I want this newly modified geo to be selected like the edge it was made from.

    10. Performing an action when a window is closed via the X button, possible?

    11. How would you differintiate individual loops/rings in an array containing several of them? I need to be able to perform a loop operation on each one and am not sure how I could break down the array like this.

    12. a good text editor for writing mel. mel studio pro is long sense discontinued, and EditPlus has a glitch that makes it turn off syntax highlighting when the file is saved. I've also heard the Crimson Editor has mel syntax highlighting, though I havn't used it. Suggestions?
  • osman
    Offline / Send Message
    osman polycounter lvl 18
    3.) unsigned integers are positive numbers only. Because it can't hold any negative values, the positive range is twice as big compared to a (signed)int.
  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    8. most commands have an expanding flag. If using 'filterExpand' it has a flag called '-expand', if using 'ls' the flag is called '-flatten'

    9. There's no particular option in Maya by default. I have a melscript hack on my site to save selections or you could try NEX. As far as selecting modified components I don't know how you'd do that since different tools effect the topology in different ways and there isn't a good way to predict the edge ID's

    10. what type of action? you can render by right clicking on a maya file so that the scene loading doesn't slow the process down but besides that I think you're pretty limited.

    11. maybe it would be more predictable to store only a selection of individual edges and either ring or loop them within the script. Otherwise you'd have to do 'math' or some of that crazy shit!

    12. I actually still use Mel Studio Pro because I'm an old man in disguise. I haven't found one that can really compare to the SciTE based Maxscript editor besides that. If anyone has any suggestions I'd sure love to hear them too.


    In conclusion, I can answer one or two of your questions and for the rest I am worthless! Hopefully someone more well-versed will chime in here
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    8. As Funky Bunnies said. A lot of the time if I'm getting values passed from something other than "ls" or "filterExpand" then I'll just run an "ls -fl" on the resulting selection, for example:
    = `ls -fl `;
    

    9. If you write something that does this, let me know, cos it sounds handy ... never done it myself though :)

    10. You'd probably want to look into the scriptJob command - you can set up a scriptJob that will run when a named piece of UI is deleted. Obviously for this you need to know the name of the window, which may or may not be problematic depending on which window it is you want to trigger the script from. For example:
    int  = `scriptJob -uiDeleted "myWindow" "myScriptToRun"`;
    

    11. If you want to do anything like that then yeah, you're going to start getting into some more complex scripting where you have to determine the topology of the selection (what each edge is connected to etc), sounds pretty heavy. Might I ask what it is you want to do, maybe there's a better way?

    12. I use Notepad++ and because I'm lazy, I haven't upgraded to the latest version (which I believe has MEL support, or at least someone wrote a syntax set plugin for it anyway)... so I just leave it on TCL highlighting since it's pretty close. Doesn't get any of the key command words highlighted, but I don't really care since I know what they are anyway. Maybe I should upgrade! :)
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Wow, cant believe I didnt notice the ls -flatten flag, no idea how I missed it. Wish more things in mel had simple solutions like that :p

    I've actually used your save selection script FunkyB, comes in handy quite often. Unfortunatly it breaks part of mayas performPolyExtrude procedure, which I'm using for one of my scripts atm :(
    I figure it might be possible to write a script that figures out whats been modified and selecting it by storing all the edges/faces/etc. on an object and then running xform over them to get an array of their positions. After that you modify the geo and run a 2nd script that gets all the positions again and compares them to the first set, with anything that has no position match getting selected. Problem is this method would select 'all' modified geo, not just new cuts but also the edges they were cut across for example. You could narrow down the selection to the 'new' geo only by looping through the new selection and having each element run through all possible combinations with the other elements and checking their average position against the original list.
    That method might work but would probably be too complex and slow to be a practicle solution.

    As for breaking down array loops/rings, I'm afraid their probably isnt a better way to do it.
    What I'm trying to do is create a shell script that mimics the max modifier. The script basicly takes an object and performs a localTranslateZ extrusion on it in the positive and negative directions. Then through a series of grow/shrink/convert commands it selects all the edges at the borders. The problem then is that the polySplitRing command is limited to one rings connection at a time, and will randomly pick which ring to use if multiple are selected at a given time.
    One solution Im toying with atm is to use pickwalking to determin if any of the edges are directly next to any other in the selection. It'd be great if pickwalking could simply move from one edge to another, but it needs to create a loop or ring first if in edge mode. Thankfully vertex pick walking doesn't have this limitation.

    I've already implemented pinch and slide functions to the border segments (sense I had already been messing with them for a script that mimics the max connect tool). but I'd like the get this problem solved first before I start tackling other more complex issues of the script like push angle correction, profile curve support (which, btw mop, I'm going to put your shell thread under a magnifying glass during :) ), etc.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Heh, I still haven't come up with a decent Shell method in Maya. Still looking though. Please post if you make any progress!
  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    oh shi- what does it break with performPolyExtrude? sorry about that :(

    Sounds like you've got some sweetness going on. Maybe I'm just dumb but I don't get what you're trying to do right now for your shell modifier. Could you make a pretty picture so we can get a better idea?
  • rebb
    Offline / Send Message
    rebb polycounter lvl 17
    Neat, i've been fiddling around with a shell thing too ( plugin based ), but since i'm not on the ADN Network ( yeah, let people pay lots of money if they want to add features to your software, what a great idea ) i have no access to unique Plugin IDs - so releasing it with some random ID might be a bit of a gamble :/.
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    MEL thread response:

    FunkyB:
    Well the performPolyExtrude procedure keeps the original faces selected after being performed, but the saveSelection script makes it deselect them once done instead. So the procedure still works, but it loses its advantage over using a regular extrude command.

    Also, pics (These answer your question?):

    shellmx-push_connect.gifshellmx-pinch_and_slide.gif

    shellmx-length_correct.gifshellmx-angle_correct.gif


    Mop:
    sure thing, update then: I finished the ring/loop identify script and push length correction, and now I'm onto curve support. Had already come up with a method to acuratly implement linear curves, but decided to scrap it in favor of another method that should be able to auto-update all the affected meshes whenever the curve is changed. Problem is it wont work in anything below Maya2009.
    Also making some progress on 'Shell Mode', which makes the shell auto-update over the top of a planar mesh while its being modeled. Gotta say though, scriptjobs are proving to be very unpredicatable with anything but simple commands. But either way, progress is being made :)


    rebb:
    Neat! Give us the heads up when your going to release it, or any info you'd be willing to share atm (like its fuctions and such)?


    Got some new questions would like to throw out their while I'm at it:

    13. Does anyone know how to create 'ghost' geo? For example, in the NEX plugin they show preview geometry in green lines for any action before its verified. These things dont show up in the history stack, affect undos, creat any additional objects or nodes, nothing (hense why I'm refering to it as ghost geo). Even if no one knows, I'm open to any theories behind how this 'phenomenon' could be achieved in mel.

    14. what do these four symbols do?: += -= /= *=
    (As usual the documentation fails).

    15. Is their a way to add two arrays together, without one at a time adding the second arrays elements to the first via a loop? Combining via loop works but seems like an unnecessarily slow method for such a simple task.

    16. Is their a way to create extra undo ques? I'd like the have an undo que for individual objects instead of just a general one for the overall scene.

    17. How would you change a single meshs active wire color, or the active color of specific edges on a mesh? Its easy enough to set for single inactive objects, but somehow I'm not finding anything for active ones...
  • rebb
    Offline / Send Message
    rebb polycounter lvl 17
    @PolyHertz :
    Looking cool so far :).

    I'm kinda coming from the other end when it comes to features it seems :D.
    Currently it has curve-support and linear-subdivision support, but no pinching/sliding and not compensating the offset-length. I'll post some images later.

    13.
    Didn't use it before, but you can issue OpenGL Commands via some API Methods. You can probably access these using Python, which in turn you can call from MEL. Could be slow though :).

    14.
    They are just simple ways to write some operations involving the same variable. For example, "a = a + 2" can be written as "a += 2", "a = a * b" as "a *= b" etc.

    15.
    Python to the rescue, possibly. But not sure how you convert MEL Arrays to Python and vice versa. http://www.mail-archive.com/linux-il@cs.huji.ac.il/msg17662.html
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Thanks for the help rebb. Unfortunatly I dont know python (yet!), but intend to get around to that sooner rather then later.

    Even though the thread didnt get as much of a response to the last set as would have liked, i'll post a few more questions (I'm greedy arnt I ;) ).

    18. How would you go about determining the currently held key? So in the event something like the shift key is being held an action will perform differently then if its not.

    19. Are textscrollList higharchies possible, or is their another command I have to use for that? Example would be something like the outliner, where selections can be expanded or collapsed via a + or - button.

    20. Not sure if this is possible, but can scriptjobs be forced to not run when an undo is performed? Say you have an event that runs every time the selection changes, if the user performs an undo to go back to the previous selection the script will run. If the script is actually what causes the new selection you essentially have stoped undo from working while that sciptjob exists.

    21. Is their something more compact then sliders that can be used to quickly go up and down values? In max most tools just use up and down arrows with an invisible verticle slider attached, but I havnt found anything that nice in maya yet.


    Also, I've added a scripts section to my site, so stuff I'm making will be posted their. Hopeing maybe someone finds the scripts useful other then me :)
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    15. StringArrayCatenate?

    18. getModifiers

    19. Heh, you mean a tree control? Nope. You can create a custom Outliner but it's probably not what you want. Overkill in most cases and hard to control. TextScrollList is about as good as you're gonna get unless you want to grab wxPython and start doing GUIs with that... I heard they're implementing Qt for future releases though, if that's true then that'll be nice, it's similar to wx.

    20. Sounds scary. I'd try to avoid scriptJobs doing that sort of work, since as you're discovering it can really mess up your workflow and undo history if it keeps trying to do things while you're undoing them.

    21. floatFields and intFields can be dragged by holding CTRL and left mouse button. It's like having an invisible slider, you can even set the step value when you create the control.
  • greuh
    Offline / Send Message
    greuh polycounter lvl 17
    18: getModifier will give you the actual state of the shift/ctrl/alt/capslock keys, not if there was a keystroke event earlier. If it is what you are looking for, then just like me you are pretty much stuck and will be forced to implement some sort of wrapper function with a loop somewhere looking for the change of state of the modifier you are looking after.
    I implemented a class to do that for my script in python, just so I could hide away the ugly code :(

    I wish Autodesk would implement proper input event sometime soon.

    19: if you were looking for a way to customize a line entry so it has for example a checkbox + a text + some other values for each line, just like Mop said I am afraid there is no way with the basic MEL Ui controls. The closest you can get is using the popupMenu family of commands and some fancy custom class to store the extra data, but that will be yet again ugly and python only I am afraid.
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Hmm, well the getModifiers command seems like it'll work for some of the stuff I wanted it for, shame its so limited though. Ended up using it and stringArrayCantenate right away :)
    As for the undo stuff, atm I'm using the scriptJobs compressUndo flag as a stand in till can figure out a real solution, sense while as it'll let you undo in the formentioned situation it's got some problems of its own.

    Anyhow, time for the usual round of new questions. Only two this time.

    22. How would you add/remove specific nodes from different sections of the hisory stack? I'm trying to figure out how to auto-update tweak nodes that are several items down in the history stack. Unlike most other nodes they dont have standard attributes that can be linked to, so afaik they would have to be replaced if you wanted to change them.

    23. How does the polySplit command determin directional percent? Originaly I thought that after the -ep flag and specifying the edge number to split, the percentage to slide was based on the point number, with the higher number being a 100% (or 1.00) value and the lower one being the starting point at 0% (or 0.00). so if one point was # 14 and the other was # 15, sliding to 15 would be 1.00 and sliding to 14 would be 0.00. Unfortunatly after writing a script based on this premis turns out thats not true 100% of the time, and as usual the command reference gives no indication of the specifics.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    22. Not sure. I imagine you'd have to get the input and output connections to find the nodes it's connected to, break those connections, and then re-connect the original plugs avoiding the node you wanted to remove. Never tried something like that though, sounds dangerous :)

    23. Your description is correct, that's how polySplit works. How are you determining which vertex has index 0 and index 1? You need to use the polyInfo command to return the actual index, anything else is unreliable in terms of ordering.

    For example:
    polyInfo -ev pCube1.e[45];
    
    This will return the info:
    // Result: EDGE 45: 5 25

    You can tokenize this return value to get the vertex order (eg. for edge 45, vertex 5 is index 0, vertex 25 is index 1).

    Beware, since if the edge you query is hard, it will return this value:
    // Result: EDGE 55: 15 35 Hard

    So you need to watch out for "Hard" appearing at the end and deal appropriately. I wrote a little helper function where you just pass an edge and it returns the full vertex names nicely in a 2-value string array.

    This is the most reliable way I found to do this anyway, it feels a bit hacky to me (tokenizing returns, argh!) but I haven't found any other method, so if anyone else knows one, please do tell!
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Well right now how I'm determing the point order is by simply converting the edge to verts, saving the result to a string array, and then tolkenizing the numbers out of the two resulting strings in the array. After that I just determin which is a larger number and slide based on that. Not the fastest way to go, but as far as I can tell it works as intended. But once and a while I'll come across a set of edges where the point order does not determin the cut values as expected, where even manually entering the 'correct' values will not result in the proper connection.

    Edit: removed code sense wasn't important and was crowding up the thread
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    You have to use polyInfo to get the correct vertex order. Just assuming that the larger vertex index is the "second" index is not always true, I'm pretty sure.
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Alright, didn't realize the index was being determined seperatly, will give that a shot and see how it goes.

    Thanks as always :)
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Question time.

    MEL thread:
    24. Is it possible to know what order component selects were made in? I could make a proc that runs on app start to keep an ordered list, but I dont want to have to do that if possible.
    25. How do you get errors to stay shown? Mine always just flash on and off before they can be read.
    26. What command would let you end a procedure instantly? break will stop loops, but I want the whole script to stop (without an error) if a certan condition is met. Its not really necessary, but would be convienient.
    27. I've been using the getModifiers command to make scripts that would do different things depending on which was pressed when executed. The problem is that they dont seem to work in conjunction with the repeat last action ("g") function, and instead result in strange errors that don't make sense. Is their a way around this?
    28. What does the "mag" command do? I'd like to know as I've seen it in a few inspirational scripts I've run through but havn't been able to figure out its use. And the help files only have a single sentence about it thats not very informative :-/

    Sorry to double post, not sure how else to bump the thread though.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    24. Don't think so. I've never tried though, but offhand I can't think of anything. Maybe some sort of tool context? ScriptCtx or something might be worth looking at.

    25. You mean in the single-line feedback box in the bottom right? If an error was the last thing that occurred, it should be shown there. Are you putting a newline at the end of the error string? If so, don't, since the error command does that anyway, so you might just be pushing it off the screen?
    Or maybe there's some other print happening after your error? Is there anything that gets called after the error, or anything you do in the viewport?

    26. return
    I use this all the time for early-outs of scripts (eg. if no objects are selected, or some condition isn't met, then it just bails out right at the start). I hate big nested if checks before getting to the "meat" of a script, I'd much rather have everything nicely indented only one or two tabs.
    You can use return even if your procedure has no return value, but bear in mind if your procedure has a return value then you should have a sensible "bail out" value (eg. 0 or -1 if an int proc failed, or "" if a string proc failed). Then you can check for that in whatever script is calling the proc if necessary, and end that one too.

    27. Sorry, don't know :(

    28. mag returns the magnitude of a vector, I think, but I've never used it.
  • Funky Bunnies
    Offline / Send Message
    Funky Bunnies polycounter lvl 17
    24. yeah, this has been talked about tons of times, but with the way maya handles the selection list you'd have to monitor the selection in order to determine the component selection order, and even then marquee selections are troublesome. There might be a way with python though? I have no idea

    27. I could be waaay off base, but I thiiink the repeat Last option actually ends up taking your recent tool or whatever from the 'Recent Commands' list (edit->Recent Commands). If I remember right no hotkeys are registered in this list. Or at least not hotkeyed scripts :(

    So if you want to use repeatLast with this sort of thing, you'll probably have to build your own. (you could take undoInfo -q -un for a lot of the blind commands going on in the background, but it'll only return the last thing, so id you have a startTool, doTool, endTool it'll only return endTool. And some things you'd still need that list from listHistory $Object but it gives you a text description - and one that changes from version to version at that! :poly127: )

    but another problem is that you're running a chunk of code that checks which function to use, so of course when you repeat that, your modifier check will return 0 unless you hold that same key.


    haha so I guess one easy solution is using a global to store your global modifier (since it's only used on the last tool) so you can recall it later in a custom repeatLast proc. :poly124:

    Otherwise I'm too lame to think how to force an absolute command there...
Sign In or Register to comment.