Saturday 4 November 2017

moving specific Mash points

How to manually move points in MASH, using the python node..
Bold bits are the important lines of code, where 7 and 16 are the point numbers (add a Points node to see numbers). I'd assume you could hide specific points here too?



import openMASH

#initialise the MASH network data
md = openMASH.MASHData(thisNode)

#this is how to get the frame number
frame = md.getFrame()
#and this gets the number of objects in the network
count = md.count()

#add the index to the Y position
#for i in range(count):
#    md.outPosition[i].y=i

md.outPosition[7].y+=2;
md.outPosition[16].z+=3;
md.outVisibility[12]=0;
md.outRotation[12].x=12;

#tell MASH to write the network data
md.setData()


The docs say you can change -
  • outPosition
  • outScale
  • outRotation
  • outId
  • outVisibility

Wednesday 7 June 2017

seem to use this a lot - set matte attr for arnold crap

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


int $sizeArray=size($selectedStuff);
for($i=0; $i<($sizeArray);$i++){
print $selectedStuff[$i];


setAttr ($selectedStuff[$i]+"Shape.aiMatte") 1;
//setAttr ($selectedStuff[$i]+".overrideLevelOfDetail") 1;
   
   
}

Wednesday 1 March 2017

fix texture paths maya

https://mayapy.wordpress.com/2012/04/23/fix-texture-paths-in-maya-python-script/


import maya.cmds as cmds
import os

def renameTex(newName):
        tex=cmds.ls(sl=True,type="file")
for item in tex:
fullpath = cmds.getAttr("%s.fileTextureName" %item)
fileName= fullpath.split("/")[-1]
newPath= os.path.join(newName,fileName)
cmds.setAttr("%s.fileTextureName" %item, newPath,type="string")

def selectDir():
 folder=cmds.fileDialog2(cap="locate folder",fm=3)
 uniToStr=str(folder)

 filePath=uniToStr.split("'")[1]
 cmds.textField(pathText, edit=True,text=filePath)
 global newName
 newName=filePath

win=cmds.window(title="RV TEXTURE PATH FIX",w=350,h=150)
cmds.columnLayout(adjustableColumn=True )
cmds.text("FIRSTlect your file nodes in Hypershade!!",bgc=(1,0,0))
cmds.frameLayout(l="browse folder for textures")
cmds.flowLayout()
cmds.text("file",h=25)
pathText=cmds.textField(w=250,h=25)
loadBtn=cmds.button(w=50,h=25,label="get",c="selectDir()")

cmds.setParent( '..' )
fixit=cmds.button(l="Fix textures", c="renameTex(newName)")
cmds.setParent( '..' )

cmds.showWindow(win)