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
I'd like to hear about any hacks too.
---
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.
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.
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?
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.
Xeno: Yes, cut and paste is very taxing .
[/ QUOTE ]
I'm keeping my eyes on you...
( o ) ( o )
|
|
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?
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.
Great help, thanks again!
I'll feel dumb if it does work.
So maybe we'll be able to get this done the "right" way; instead of having the operations defined in 2 places.
<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
[ 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
[/ QUOTE ]
Isn't that simply replacing all the instances of U with V?
Ghostscape, actually all the instances of x must be replaced with y in order to work
Cheers!
Check out the UVTools section. All hotkeyable.
http://www.sloft.com/category/maxscripts/
looks like the tools are updated for max9 somehow? (claps)