Home Technical Talk

Chuggnut's UV tools - hotkeying?

MoP
polycounter lvl 18
Offline / Send Message
MoP polycounter lvl 18
Hey folks... I imagine a number of you Max users out there will be familiar with Chuggnut's excellent unwrap tools (from www.chuggnut.com).

I was wondering if there was any easy way to set often-used items like the "align" and "space" tools (for vertical/horizontal alignment and spacing) to be activated by hotkeys? It'd be a lot faster than mousing over to the side bar every time, that gets very repetetive.

I had a quick hack around in the macroscript, to determine the names of the functions (stuff like alignU and alignV), but I can't figure out how to link them up to hotkeys.

I assume it'd involve writing a new macroscript containing the same functions, but able to be set up as hotkeys. Anyone already done this, or know how it might be done?

Cheers!

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    I've given up on his tools ever since the upgrade to max6. It never remembers settings anymore, way too annoying for me. I asked him a couple times for an update, but he's never gotten to it (said he bought a house earlier this year, so I can understand). Are you using the max5 version?

    I'd like to hear about any hacks too.
  • killingpeople
    Options
    Offline / Send Message
    killingpeople polycounter lvl 18
    *stands in line*
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    I haven't looked at the script, but if there are functions are set up right, you can just add extra macroscripts to the end of the file:

    ---

    macroScript NameOfMacroScript
    Category:"Category name"
    ButtonText:"Text on the button"
    Tooltip:"Tooltip text"
    (
    function_goes_here()
    )

    ---

    And then you'll be able to make hotkeys. Whee.
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Hmmm, looking at the script; the actions you want to perform aren't defined as functions, just in button handlers. Not much in the script is put into functions at all; kinda bad script writing on his part.

    So, you'd have to break them out into functions and then make macroscript definitions for those or copy+paste their code into a macroscript.
  • Eric Chadwick
    Options
    Offline / Send Message
    I fired off an email, see if he bites.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Eric: What settings are you wanting it to remember? I'm using the Max5 version in Max8 here, but pretty much all I use it for is the align, space, dump map and absolute offset/scale tools - Max itself remembers all of the other settings for the UV editor.

    Sinistergfx: Yeah, I got as far as what you said in your first post, I tried making a macroscript in the same manner and just calling on the names i found in the script - no joy.
    I'm a maxscript n00b, so I have no idea how to convert stuff like that into functions - any tips?
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Ok here's -one- example:

    Here's how he has alignu defined in the button handler:

    <font class="small">Code:</font><hr /><pre>
    on alignu pressed do
    (
    uvsel = uv.getselectedvertices() as array
    mid = 0.0
    for i in uvsel do
    (
    mid += (uv.getvertexposition currenttime i).x
    )
    mid /= uvsel.count

    undo "Align U" on
    (
    uv.forceupdate false
    uv.movex mid
    uv.forceupdate true
    uv.updateview()
    )
    )
    </pre><hr />

    if we wanted it to be a function, we'd put a function along with the other functions near the top of the script (functions have to be defined first before you use them):

    <font class="small">Code:</font><hr /><pre>
    function ChuggAlignU =
    (
    uvsel = uv.getselectedvertices() as array
    mid = 0.0
    for i in uvsel do
    (
    mid += (uv.getvertexposition currenttime i).x
    )
    mid /= uvsel.count

    undo "Align U" on
    (
    uv.forceupdate false
    uv.movex mid
    uv.forceupdate true
    uv.updateview()
    )
    )
    </pre><hr />

    It's fairly simple because the function doesn't return any values and doesn't need any arguments.

    Now, the button handler for alignu only needs to be (you don't HAVE to change it, but it only makes sense since you have a function for it now):

    <font class="small">Code:</font><hr /><pre>
    on alignu pressed do
    ChuggAlignU()
    </pre><hr />

    Now, we can make a macroscript (place it at the end of the script file):

    <font class="small">Code:</font><hr /><pre>
    macroScript ChuggnutAlignU
    Category:"Chugg's Tools"
    ButtonText:"AlignU"
    (
    chuggAlignU()
    )
    </pre><hr />

    Now, [if i explained it correctly...] you can hotkey it! Look up functions in the maxscript help file for extra explanation.
  • Xenobond
    Options
    Offline / Send Message
    Xenobond polycounter lvl 18
    Aha! So this is what you do on company time.
  • Eric Chadwick
    Options
    Offline / Send Message
    Mop, I tried using the plugin version he made for max6. Guess I should try the old one instead.
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Xeno: Yes, cut and paste is very taxing smile.gif.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Excellent, thanks Sins. I reckoned it would be something fairly simple like that, I just wasn't sure of the syntax.
  • Xenobond
    Options
    Offline / Send Message
    Xenobond polycounter lvl 18
    [ QUOTE ]
    Xeno: Yes, cut and paste is very taxing smile.gif.

    [/ QUOTE ]

    I'm keeping my eyes on you...

    ( o ) ( o )

    |

    |
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Hmm ... trying your method, Sinistergfx, gives me the same error as what I got yesterday - I tested it by cutting out the relevent code section and evaluating it in the maxscript editor.

    It gives me this error:

    -- Unknown property: "getSelectedVertices" in undefined

    Did you test this yourself, or just type it out? I can't figure out what the problem is... it's asking for uv.getSelectedVertices, which seems to be a valid statement... is it missing some other piece of code in order to function properly?
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    EDIT: Hmmm, I don't really have time to mess with it to make it work (the script is setup a bit different organizationaly than i like, and i don't feel like rearranging/rewriting the whole script); but you could just make it a totally stand alone macroscript by adding the uv variable definition inside it.

    local UV = modpanel.getcurrentobject()

    so it'd look like this:

    <font class="small">Code:</font><hr /><pre>
    macroScript ChuggnutAlignU
    Category:"Chugg's Tools"
    ButtonText:"AlignU"
    (
    local UV = modpanel.getcurrentobject()
    uvsel = uv.getselectedvertices() as array

    mid = 0.0
    for i in uvsel do
    (
    mid += (uv.getvertexposition currenttime i).x
    )
    mid /= uvsel.count

    undo "Align U" on
    (
    uv.forceupdate false
    uv.movex mid
    uv.forceupdate true
    uv.updateview()
    )
    )
    </pre><hr />

    Yay for hacks.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Cheers sins ... works fine for the AlignU and AlignV functions, but not for the SpaceU and SpaceV - don't worry about it though, I don't use them as often.
    Great help, thanks again! smile.gif
  • Eric Chadwick
    Options
    Offline / Send Message
    I also got this to work, thanks sinistergfx. And Mop the v5 one works much better than the crappy beta v6, thanks for the nudge in the right direction.
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    After taking another quick glance at the script while investigating spaceU and space V, I think I figured out how to make the function way work the way I originally wanted it to. I'll test it out when I get home.

    I'll feel dumb if it does work. smile.gif

    So maybe we'll be able to get this done the "right" way; instead of having the operations defined in 2 places.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    that'd be great, too wink.gif
  • CodeFather
    Options
    Offline / Send Message
    CodeFather polycounter lvl 15
    [ QUOTE ]

    <font class="small">Code:</font><hr /><pre>
    macroScript ChuggnutAlignU
    Category:"Chugg's Tools"
    ButtonText:"AlignU"
    (
    local UV = modpanel.getcurrentobject()
    uvsel = uv.getselectedvertices() as array

    mid = 0.0
    for i in uvsel do
    (
    mid += (uv.getvertexposition currenttime i).x
    )
    mid /= uvsel.count

    undo "Align U" on
    (
    uv.forceupdate false
    uv.movex mid
    uv.forceupdate true
    uv.updateview()
    )
    )
    </pre><hr />



    [/ QUOTE ]

    Give us the AlignV macro , pleaseee smile.gif
  • Ghostscape
    Options
    Offline / Send Message
    Ghostscape polycounter lvl 13
    [ QUOTE ]
    [ QUOTE ]

    <font class="small">Code:</font><hr /><pre>
    macroScript ChuggnutAlignU
    Category:"Chugg's Tools"
    ButtonText:"AlignU"
    (
    local UV = modpanel.getcurrentobject()
    uvsel = uv.getselectedvertices() as array

    mid = 0.0
    for i in uvsel do
    (
    mid += (uv.getvertexposition currenttime i).x
    )
    mid /= uvsel.count

    undo "Align U" on
    (
    uv.forceupdate false
    uv.movex mid
    uv.forceupdate true
    uv.updateview()
    )
    )
    </pre><hr />



    [/ QUOTE ]

    Give us the AlignV macro , pleaseee smile.gif

    [/ QUOTE ]
    Isn't that simply replacing all the instances of U with V?
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Yeah, you were meant to use your thinker a bit. Might learn something.
  • CodeFather
    Options
    Offline / Send Message
    CodeFather polycounter lvl 15
    Ok, guys, sorry, I did it on my own,it wasn't so difficult at all smile.gif

    Ghostscape, actually all the instances of x must be replaced with y in order to work smile.gif

    Cheers!
  • FatAssasin
    Options
    Offline / Send Message
    FatAssasin polycounter lvl 18
    http://jhaywood.com/maxScripts.htm

    Check out the UVTools section. All hotkeyable.
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    i know its not directly relevant to the hotkeying, but i found this the other day while trawling t'interweb.

    http://www.sloft.com/category/maxscripts/

    looks like the tools are updated for max9 somehow? laugh.gif (claps)
  • Eric Chadwick
    Options
    Offline / Send Message
    Wow, thanks for the link. Works great. Doesn't remember changes I make to the UI though. Gonna put in a request. Thanks again!
  • cw
    Options
    Offline / Send Message
    cw polycounter lvl 17
    no probs. smile.gif it made me really happy for about 10 minutes til i realised it doesnt work for max8 (which is what we're still using atm at work.) aah well, never mind. ;-)
Sign In or Register to comment.