matchmove流程中修改Maya相机数据的脚本
matchmove组的流程涉及到syntheyes与maya,nuke交接的问题。syntheyes会生成包含去畸变节点的nuke工程 和带跟踪信息的maya工程。在nuke工程上渲染得到去畸变的序列,这是第一步。第二步就是进入maya工程替换去畸变的序列,并修改相应相机参数。
maya.window(title = 'MatchMove Tool v1.3',w=500,h=170)
maya.rowColumnLayout(numberOfColumns=2,columnAttach=[1,"right",0],columnWidth=[[1,100],[2,400]])
################################################################################################################
####################################################序列路径修改################################################
################################################################################################################
maya.text(label="Input Image File",align = 'right',font = 'boldLabelFont')
file = maya.textField()
commandstr = 'filename = maya.fileDialog2(fileMode=1, caption="Import Image");\
maya.textField(file,edit=True,w=400,fi=filename[0])'
maya.textField(file,edit=True,w=400,fi='R:/filmServe',dgc = commandstr)
maya.text(label="Frame Cahe")
cacheframe = maya.intSliderGrp(field = True, v = 100 , minValue=0 , maxValue=1000 , fieldMinValue=0 , fieldMaxValue=5000)
maya.text(label="On/Off")
maya.checkBox(l = 'Use Image Sequence',onCommand = 'maya.setAttr(thisImagePlane+".useFrameExtension",1)',\
offCommand = 'maya.setAttr(thisImagePlane+".useFrameExtension",0)')
cameralist = maya.listCameras() #获得当前相机列表
cameralist.remove('persp');cameralist.remove('front');cameralist.remove('top');cameralist.remove('side');
cameralist.reverse()
eistr = []
for i in cameralist:
eistr.append([cameralist.index(i),i]) #获得ei字符串
cameraenum = maya.attrEnumOptionMenu(w = 100, ei = eistr) #建立一个下拉框显示过滤后的camera
cameraindex = maya.attrEnumOptionMenu(cameraenum,q=1,npm=True)
for i in eistr:
if i[0] == cameraindex:
thisCamera = i[1] #获得当前camera
break
if maya.imagePlane(thisCamera,q= 1,camera=True):
thisImagePlane = maya.imagePlane(thisCamera,q = 1,n = True)[0] #获得当前plane
else:
maya.imagePlane(thisCamera,camera=thisCamera)
thisImagePlane = maya.imagePlane(thisCamera,q = 1,n = True)[0] #获得当前plane
maya.button(label="Replace sequence",w = 100,command = 'selected_node = maya.ls(sl=1);\
file_value = maya.textField(file,q = 1,tx = 1);\
picture = maya.getFileList(folder = file_value)[1] if file_value.find(".") == -1 else "";\
maya.setAttr(thisImagePlane+".imageName",file_value + picture,type="string");\
framecache_value = maya.intSliderGrp(cacheframe,q=True,v = True);\
maya.setAttr(thisImagePlane+".frameCache",framecache_value);\
imageSizelist = maya.imagePlane(thisCamera,q=1,imageSize=1);\
maya.textField(targetsizewidth,tx = imageSizelist[0] ,w=100,edit=True,enterCommand=("maya.setFocus(\'" + targetsizeheight + "\')"));\
maya.textField(targetsizeheight,tx = imageSizelist[1] ,w=100,edit=True,enterCommand=("maya.setFocus(\'" + sourcesizewidth + "\')"));\
')
################################################################################################################
####################################################具体参数修改################################################
################################################################################################################
maya.text(label="")
maya.text(label="")
maya.text(label="")
maya.text(label="")
maya.text(label="Input Source Size",font = 'boldLabelFont')
maya.text(label="")
sourcesizewidth = maya.textField()
sourcesizeheight = maya.textField()
maya.text(label="")
maya.text(label="")
#maya.text(label="Input Source Aperture(mm)",font = 'boldLabelFont')
#maya.text(label="")
sourceApeH = maya.textField()
sourceApeV = maya.textField()
#maya.text(label="")
#maya.text(label="")
maya.text(label="Input Target Size",font = 'boldLabelFont')
maya.text(label="")
targetsizewidth = maya.textField()
targetsizeheight = maya.textField()
Rwidth = maya.getAttr("defaultResolution.width")
Rheight = maya.getAttr("defaultResolution.height")
horizontalFilmAperture = maya.getAttr(thisCamera+"Shape.horizontalFilmAperture")
verticalFilmAperture = maya.getAttr(thisCamera+"Shape.verticalFilmAperture")
#imageSizelist = maya.imagePlane(thisCamera,q=1,imageSize=1)
maya.textField(sourcesizewidth,tx=Rwidth,w=100,edit=True,enterCommand=('maya.setFocus(\"' + sourcesizeheight + '\")'))
maya.textField(sourcesizeheight,tx=Rheight,w=100,edit=True,enterCommand=('maya.setFocus(\"' + sourceApeH + '\")'))
maya.textField(sourceApeH,tx=horizontalFilmAperture,w=100,edit=True,enterCommand=('maya.setFocus(\"' + sourceApeV + '\")'))
maya.textField(sourceApeV,tx=verticalFilmAperture,w=100,edit=True,enterCommand=('maya.setFocus(\"' + targetsizewidth + '\")'))
maya.textField(targetsizewidth,tx = 'input target width' ,w=100,edit=True,enterCommand=('maya.setFocus(\"' + targetsizeheight + '\")'))
maya.textField(targetsizeheight,tx = 'input target height' ,w=100,edit=True,enterCommand=('maya.setFocus(\"' + sourcesizewidth + '\")'))
maya.button(label="Default Size",w=100,command = 'selected_node = maya.ls(sl=1);\
sourcesizewidth_value = maya.textField(sourcesizewidth,q = 1,tx = 1);\
sourcesizeheight_value = maya.textField(sourcesizeheight,q = 1,tx = 1);\
maya.setAttr(thisCamera+"Shape.horizontalFilmAperture",horizontalFilmAperture);\
maya.setAttr(thisCamera+"Shape.verticalFilmAperture",verticalFilmAperture);\
maya.setAttr("defaultResolution.width",int(sourcesizewidth_value));\
maya.setAttr("defaultResolution.height",int(sourcesizeheight_value));\
maya.setAttr(thisImagePlane+".sizeX",horizontalFilmAperture);\
maya.setAttr(thisImagePlane+".sizeY",verticalFilmAperture);\
')
maya.button(label="Go",w = 100,command = 'selected_node = maya.ls(sl=1);\
sourcesizewidth_value = maya.textField(sourcesizewidth,q = 1,tx = 1);\
sourcesizeheight_value = maya.textField(sourcesizeheight,q = 1,tx = 1);\
targetsizewidth_value = maya.textField(targetsizewidth,q = 1,tx = 1);\
targetsizeheight_value = maya.textField(targetsizeheight,q = 1,tx = 1);\
maya.setAttr("defaultResolution.width",int(targetsizewidth_value));\
maya.setAttr("defaultResolution.height",int(targetsizeheight_value));\
agr_val = float(targetsizewidth_value)/float(sourcesizewidth_value);\
horizon = maya.getAttr(thisCamera+"Shape.horizontalFilmAperture");\
vertical = maya.getAttr(thisCamera+"Shape.verticalFilmAperture");\
maya.setAttr(thisCamera+"Shape.horizontalFilmAperture",horizon*agr_val);\
maya.setAttr(thisCamera+"Shape.verticalFilmAperture",vertical*agr_val);\
maya.setAttr(thisImagePlane+".sizeX",horizon*agr_val);\
maya.setAttr(thisImagePlane+".sizeY",vertical*agr_val);\
')
maya.text(label="")
maya.text(label="")
maya.text(label="")
maya.text(label="")
maya.text(label="InputAspectRatio",font = 'boldLabelFont')
maya.text(label="")
defaultpixelaspectratio = maya.getAttr("defaultResolution.pixelAspect")
defaultdeviceaspectratio = maya.getAttr("defaultResolution.deviceAspectRatio")
#complete the creating of maintain width/height ratio
maya.text(label="Lock Aspect")
maya.setAttr("defaultResolution.aspectLock",0)
maya.checkBox(l = 'maintain width/height ratio',onCommand = 'maya.setAttr("defaultResolution.aspectLock",1)',\
offCommand = 'maya.setAttr("defaultResolution.aspectLock",0)')
maya.text(label="Pixel Aspect Ratio")
maya.rowColumnLayout(numberOfColumns=3,columnAttach=[1,"right",0])
PixelAspectRatio = maya.textField()
maya.button(label="SetValue",w = 60,command = 'pixelAspectvalue = maya.textField(PixelAspectRatio,q = 1,tx = 1);\
maya.setAttr("defaultResolution.pixelAspect",float(pixelAspectvalue));\
maya.setAttr("defaultResolution.deviceAspectRatio",defaultdeviceaspectratio*float(pixelAspectvalue)/defaultpixelaspectratio)')
maya.button(label="Restore",w = 60,command = 'maya.setAttr("defaultResolution.pixelAspect",defaultpixelaspectratio);\
maya.setAttr("defaultResolution.deviceAspectRatio",defaultdeviceaspectratio)')
#complete the creating of pixel aspect ratio
#targetsizewidth_value = float(maya.textField(targetsizewidth,q = 1,tx = 1))
#targetsizeheight_value = float(maya.textField(targetsizeheight,q = 1,tx = 1))
#correctvalue = targetsizewidth_value/(targetsizeheight_value*float(defaultdeviceaspectratio))
maya.textField(PixelAspectRatio,tx = float(defaultpixelaspectratio),edit = True,enterCommand = 'pixelAspectvalue = maya.textField(PixelAspectRatio,q = 1,tx = 1);\
maya.setAttr("defaultResolution.pixelAspect",float(pixelAspectvalue));\
')
maya.showWindow()
################################################################################################################
################################################################################################################
###################################################################################Write By Sol He##############
################################################################################################################
################################################################################################################
matchmove流程中修改Maya相机数据的脚本的更多相关文章
- oracle数据库中修改已存在数据的字段
在oracle中,如果已经存在的数据的某些列,假如要更换类型的话,有的时候是比较麻烦的, 会出现:ORA-01439: column to be modified must be empty to c ...
- MySQL中修改多个数据表的字段拼接问题
错误1: 异常:Truncated incorrect DOUBLE value: 'lili' 问题分析:我的修改sql语句是:update video set vname='汉字' and vdi ...
- C#程序中:如何修改xml文件中的节点(数据)
要想在web等程序中实现动态的数据内容给新(如网页中的Flash),不会更新xml文件中的节点(数据)是远远不够的,今天在这里说一个简单的xml文件的更新,方法比较基础,很适合初学者看的,保证一看就懂 ...
- ResultSet遍历过程中修改自身数据,不会改变循环的过程
ResultSet遍历过程中修改自身数据,不会改变循环的过程: import java.sql.Connection; import java.sql.PreparedStatement; impor ...
- 072——VUE中vuex之使用mutations修改购物车仓库数据
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Java如何大批量从json数据源中按指定符号隔字符串,并修改、删除数据
原文出自:https://blog.csdn.net/seesun2012 package com.seesun2012.com; /** * Java大批量修改.删除数据,按指定标识符分隔字符串 * ...
- oracle中修改表已有数据的某一列的字段类型的方法,数据备份
1.在开发过程中经常会遇到表中的某一个字段数据类型不对,比如说需要保存的数据带小数,但是在最初设计的时候是给的number(10)类型,开始保存是整数的时候满足要求,后来在保存小数的时候 会发现自动四 ...
- 【mybatis】service层中一个方法中使用mybatis进行数据库的 多个修改操作,可能是update也可能是delete操作,但是sql语句命名执行并且在控制台打印出来了,但是数据库中未更新到数据【事务的问题】
问题描述: service层中一个方法中使用mybatis进行数据库的 多个修改操作,可能是update也可能是delete操作,但是sql语句命名执行并且在控制台打印出来了,但是数据库中未更新到数据 ...
- mybatis中修改了数据,控制台显示成功,数据库没有修改
在mybatis中遇到了修改数据时,控制台显示修改成功,但是去数据库查看并没有修改,这是因为mybatis不时自动提交事务的,所以是不会修改数据库的数据,这是我们加上一句 sqlSession.com ...
随机推荐
- Spring架构-01-微服务架构
一.单体架构 所有功能,所有模块都耦合在一个系统里面,如传统的一MVC. 需要重新编译测试,重新部署. 伸缩性差 可靠性差 系统迭代困难 跨开发语言程序低 团队协作麻烦 二.微服务架构 常见架构风格: ...
- iccv文献引用
1.@inproceedings:会议 2.@article:期刊 3.@incollection:书 4.@misc:啥不是 author的名字书写: pdf显示为:G. Wang bibtex中: ...
- 处理tcp里的粘包问题
typedef struct _CONN_BUFFER { uint8_t buffer[CONN_BUFFER_LENGTH]; uint32_t tail; uint64_t id; time_t ...
- 【opencv基础】图像的几何变换
参考 1. 图像的几何变换-平移和镜像: 2.图像的几何变换-缩放和旋转: 3. opencv图像旋转实现: 完
- 【CSP】最大的矩形
问题描述 试题编号: 201312-3 试题名称: 最大的矩形 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 在横轴上放了n个相邻的矩形,每个矩形的宽度是1,而第i(1 ≤ ...
- [LeetCode&Python] Problem 350. Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...
- HDU 2023 求平均成绩
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU ...
- fedora的选择
Fedora 首页包含3种版本: 工作站,服务器,ATOMIC 个人只要使用工作站即可,然后,下载界面有另一个选择:Silverblue ========================== Silv ...
- #505 1&2 A-C 后面未完成
A. Doggo Recoloring 题目意思是给一个字符串(都是小写字母),如果有两个字符相同,我们可以将这两个字符变成其他字符,问能不能使字符串字母都一样 思路 有两个相同字符时就能: 字符 ...
- 《DSP using MATLAB》Problem 5.4
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...