maya视图物体对齐放大平移插件 - 建模人员必备

在这里插入图片描述

建模人员经常要导入参考图平面作为参考,但是在调整模型局部位置时看不清,精度不够,那么摄像机如何能不改变视角、位置和参数,而实现单纯视图的放大呢?这个工具解决这个问题。
maya视图平移发大镜工具-建模人员必备

使用方法:
直接将代码拷贝到maya脚本编辑中,按ctrl+回车,即可弹出界面,点击 pan view按钮,鼠标按住左键点击视图并拖动即可平移视图,点击插件zoom view按钮,之后左键点击视图并拖动即可放大视图,,之后,使用移动、旋转、缩放工具进行局部物体与参考图对齐和微调。点击插件reset view按钮,可以恢复视图默认状态。南无阿弥陀佛

global proc tjh_CameraPanAndZoom()
	{
	if ( ` windowPref -exists tjh_CameraPanAndZoom_window `)
		    windowPref -remove  tjh_CameraPanAndZoom_window;     
		  
			if (`window -exists tjh_CameraPanAndZoom_window`)
				deleteUI tjh_CameraPanAndZoom_window;


	window -w 180-h 200 tjh_CameraPanAndZoom_window;
	columnLayout;						
			separator -h 10 -w 180;
			text  -fn boldLabelFont   -al "center" -l " Zoom and pan Camera V1.0";
			//text  -fn boldLabelFont   -al "center" -l " programmer:tiancg  ";
			separator -h 10 -w 180;
			text -w 180 -wordWrap 1  -al "center" -l "  插件说明:本工具可以移动放大摄像机视图方便参考图片与模型对齐。";
			separator -h 10 -w 180;
			text  -w 180 -wordWrap 1   -al "center" -l " 切换到有参考图平面的摄像机,点击相应的按钮,按住鼠标左键在视图中拖动即可操作视图。";
			separator -h 10 -w 180;
			button  -w 180 -backgroundColor 0.6 0.6 1.0 -label "Pan View"  -command  "PanZoomTool;tjh_CameraPanAndZoom_openToggle;panZoomCtx -e -panMode PanZoomContext;";
			separator -h 10 -w 180;
			button  -w 180 -backgroundColor 0.6 0.6 1.0 -label "Zoom View"  -command  "PanZoomTool;tjh_CameraPanAndZoom_openToggle;panZoomCtx -e -zoomMode PanZoomContext;";
			separator -h 10 -w 180;
			button  -w 180 -backgroundColor 0.6 1.6 0.6 -label "Reset View"  -command  "tjh_CameraPanAndZoom_reset;;";
			
			setParent ..;
	showWindow;

}
global proc tjh_CameraPanAndZoom_openToggle()
{	
	

	string $camera = ` lookThru -q `;
	string $cameraShape[] = ` ls -dag  -shapes  $camera `;
	print $cameraShape[0];


	if (`objExists $cameraShape[0]`) 
	{
		
		if (`attributeExists "panZoomEnabled" $cameraShape[0]`)	setAttr ($cameraShape[0] + ".panZoomEnabled") 1;
	}	
}



global proc tjh_CameraPanAndZoom_reset()
{	
	
	string $camera = ` lookThru -q `;
	string $cameraShape[] = ` ls -dag  -shapes  $camera `;
	print $cameraShape[0];

	if (`objExists $cameraShape[0]`) 
	{
		//reset attributes
		if (`attributeExists "overscan" $cameraShape[0]`)	setAttr ($cameraShape[0] + ".overscan") 1;
		if (`attributeExists "horizontalFilmOffset" $cameraShape[0]`)	setAttr ($cameraShape[0] + ".horizontalFilmOffset") 0;
		if (`attributeExists "verticalFilmOffset" $cameraShape[0]`)	setAttr ($cameraShape[0] + ".verticalFilmOffset")  0;
		if (`attributeExists "panZoomEnabled" $cameraShape[0]`)	setAttr ($cameraShape[0] + ".panZoomEnabled") 0;
		
	}

	
	
	//restore undo
	undoInfo -swf 1;
	global string $gSelect;
	setToolTo $gSelect;
}
tjh_CameraPanAndZoom;
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Maya动画技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值