I know this is tiny :P, but tacit math reminded me that I've always hated the default behavior of maya's polygonal combine tool, so I wrote this script to have more options - specifically for the pivots. Maybe some of you guys will find it useful
grab it here:
FBcombine.mel
just drop it in
mydocuments/maya/X.X/scripts and type
FBcombine in the commandline like always. It'll pop up to a FBtools menu that you can disable if you want.
here's a screen of the options I have so far:
Delete history deletes history afterward, duh
Toggle behavior will set up a toggle so that it will run FBcombine if multiple objects are selected, but a modified polySeparate if only one object is selected
Position:
- retain - will keep pivot position of first selected object
- zero - will set pivot to origin (like default maya)
- center - will center pivot
Rotation:
- retain - will keep pivot rotation from first selected object
- zero - will zero rotation (like default maya)
Parent:
- retain - will keep original parent of first selected object
- ignore - will ignore original parent (like default maya)
sorry if it has any errors, i haven't noticed any but let me know if you do find anything or want something else added :poly122:
Replies
Mine doesn't have fancy options like yours though, I just always assumes that you want to preserve the final object's pivot/rotation/position etc., and also always deletes history and empty groups.
Nice work! It'll be a good timesaver for sure
The next thing on the list is a proper Align tool, more like Max's, with all the options and useful functions in one easy options window, instead of having about 10 different tools all scattered at random around the Maya interface.
and I hear that with the align tools, man!
I can do the math if you do the MEL and we can release it on TAO.
You're on! I like writing UIs and MEL stuff, and I'm not too good at the maths stuff yet
Contact me via MSN, we can knock it out in a couple hours. Some of the rotation stuff can be tricky (not sure I'll get it on the first pass).
if you're afraid of hijacking the animation you could just constrain a locator and store those transformations?
is there another problem that could create?
jez copy paste the code.
hacking a maya command( constraints ) solution is almost always faster than mel math ( time to learn py ).
Aligning objects is not expensive but if u extend to components interpreted mel math may be slow.
you can set it up to a hotkey or something until MoP+Rob finish a more fleshed out one
[edit: alright I'll just post the code with wonky formatting. It's pretty simple anyway]
{
//snaps to last selected object
//store selected transforms
string $selection[] = `ls -sl -l -tr`;
int $lastIndex = (`size $selection`-1);
//create a locator to parent constrain
string $pivLocator[] = `spaceLocator -p 0 0 0 -n pivLocator`;
string $constraintTemp[] = `parentConstraint -weight 1 $selection[$lastIndex] $pivLocator[0]`;
float $initPos[] = `xform -q -ws -rp $pivLocator[0]`;
float $initRot[] = `xform -q -a -ro $pivLocator[0]`;
delete -constraints $constraintTemp[0];
delete $pivLocator;
//reapply selection of just the things I care about
select -r $selection;
select -d $selection[$lastIndex];
//move them foos
move -a -ws -xyz $initPos[0] $initPos[1] $initPos[2];
//rotate them foos
rotate -a -ws -xyz $initRot[0] $initRot[1] $initRot[2];
if (`size $selection`>1)
warning ( (`size $selection`-1) + " objects snapped to last selected object");
}