Press "Enter" to skip to content

aoMoveToCamera

[code lang="c"]
// 
// aoKit
// Andrew Odendaal's Maya Script Kit
// Software developed by Andrew Odendaal
// Code compatible with versions 7 - 8.5
//
// Author : Andrew Odendaal
// E-mail : [email protected]
// Website: http://www.andrewodendaal.com
// 

// Moves the selected object to the perspective camera
global proc aoKitMoveToCamera() {
	vector $aoKitCameraIsWhere = `getAttr persp.translate`;
	float $aoKitMyX = $aoKitCameraIsWhere.x;
	float $aoKitMyY = $aoKitCameraIsWhere.y;
	float $aoKitMyZ = $aoKitCameraIsWhere.z;

	string $aoKitSelection[] = `ls -sl`;
		
	move $aoKitMyX $aoKitMyY $aoKitMyZ;
	print "Moved to Perspective Camera";
}

// Moves the selected object to the perspective camera and frame it
global proc aoKitMoveToCameraF() {
	vector $aoKitCameraIsWhere = `getAttr persp.translate`;
	float $aoKitMyX = $aoKitCameraIsWhere.x;
	float $aoKitMyY = $aoKitCameraIsWhere.y;
	float $aoKitMyZ = $aoKitCameraIsWhere.z;

	string $aoKitSelection[] = `ls -sl`;

	move $aoKitMyX $aoKitMyY $aoKitMyZ;
	select $aoKitSelection;
	FrameSelected;
	fitPanel -selected;
	print "Moved to Perspective Camera and Fit to Panel";
}
[/code]