材质和纹理更改Python脚本

时间:2018-03-28 16:04:01

标签: python textures material-ui maya

我正在尝试通过下拉菜单和通过滑块的纹理来改变材质。我在申请模型时遇到一些困难。如何更改我的脚本以满足此要求?

import maya.cmds as mc
if mc.window("ram", exists =True):
    mc.deleteUI(ram)

ram = mc.window("Material and Texture",t = "Material and Texture v0.9", 
w=300, h=300)
mc.columnLayout(adj = True)
imagePath = mc.internalVar(upd = True)+"icons/scriptlogo.jpg"
mc.image(w=300,h=200,image = imagePath)

# A dropdown menu deisnged to change material/color of octopus (the colors 
below are used as a test)
mc.optionMenu(label = "Material",)
mc.menuItem (label="Red")
mc.menuItem (label="Blue")
mc.menuItem (label="Yellow")
mc.menuItem (label="Green")
mc.menuItem (label="Orange")
mc.menuItem (label="Purple")

# A slider designed to alter the intensity of the octopus' texture
mc.intSliderGrp (label="Texture", min=0, max=10, field=True)

mc.showWindow(ram)

1 个答案:

答案 0 :(得分:0)

阅读你的问题,我不了解你想要完成的任务。

以下是如何使用菜单项设置lambert1颜色的示例,您可以重现滑块的语法和纹理的强度:

http://<my 2016 owa not on my local box>/x/_layouts/xlviewerinternal.aspx?WOPISrc=http%3a%2f%2flocalhost%3a8080%2fwopi%2ffiles%2ftest.xlsx&access_token=rykC%2fPgFQOs%3dRJT%2fPULGbsyZKGVnQmcO5tqJgEKoY3MIfAE3sh15shw%3d

请记住它确实是一个基本的例子,您可能想要阅读有关在maya ui,partial(或lambda),嵌套变量和dictionnaries中查询值的信息