export PYTHONPATH=$PYTHONPATH:$RMANTREE/binexport PATH=$RMANTREE/bin:$PATHexport MAYA_USER_DIR=$HOME/Documents/mayaexport RMS_SCRIPT_PATHS=$MAYA_USER_DIR/rfm_scripts/image_toolRMANFB=it# change directory below to where your cutter iscd /Users/ddu/Desktop/ddu/projects/vsfx_705/cutter# To uncomment the next line - remove the '#' characterjava -Xms512m -Xmx512m -classpath .:cutter.jar Cutter
chmod 777 run
http://fundza.com/rfm/customizing/index.html
Copy rfm_scripts
folder to /Users/ddu/Documents/maya
copy scripts
folder to /Users/ddu/Documents/maya
Copy Arnold Shaders
to /Users/ddu/Documents/maya/projects
copy maya.env
file to /Users/ddu/Library/Preferences/Autodesk/maya/2020
Maya > Window > Plugin manager > Ensure Renderman for Maya is loaded and auto-loaded
check script editor for environment and preferences
Go myScad > my info > Web Space Activation
Go to: https://studentpages.scad.edu/instructions.html > Myfile
Upload your html and asset files to https://sav-myfile.scad.edu/myfile/ws-idrive/Savannah/Webspaces/Studentpages/web_pages
Core: font size: 20, source code pro, 4 spaces tab, Scroll past end
Packages: Turn off auto-complete-plus & snippets
apm install script autocomplete-python minimap file-icons python-autopep8 linter-flake8maya language-melpip install autopep8pip install flake8
if linter does not show up, delete your Atom config files located: /Users/userName/.atom/config.cson
keep in mind Renderman Attribute Editor, Shelf, Menu bar
cmd+click
on a function (eg.print) to read the Built-in Functions documentation
Python Scripting for Maya Artists (on-line), Chad Vernon
Learning Python, Mark Lutz, O'Reilly Media
Think Python(on-line), Allen Downey
Key terms: list, tuple, dictionary
# script is called test.py but it# implements a module called "test"# a modules contrains attributes# an attribute can be, eg. name of a variable# the built-in datatypes are, nubmers, text(string),# (and collections) list, tuple, dictionary. file.age = 26name = "tom"family = 'jones'nationatlity = 'welsh'# an attribute can also be the name of function#create functiondef person()print(age)print(name)print(family)#creating listcountries = []countries.append('usa')countries.append('china')countries.append('new zealand')countries.append('england')#countries.sort()#countries.reverse# using a tuple (fixed value list) - for vertices data structures transferlocked = (2,4,3,6,8,9)# i can test my code by printing some value# this call the values# but comment it out if used asa moduleperson()if __ name__ == '__main__':#person() #(debugging purposes)#for place in countries:# print(place)#print(countries[3])print(locked[0])#print(__name__) # return name of module from where it was run
# file_test.py# an example of how to store text in a documentout_file= open('file directory', 'w')for n in range(10):out_file.write('sphere -r 1;\n)out_file.write('move %f %f 0;\n' % (n,(n-2))) # placeholder %out_file.close()# to run the mel document in Maya use this mel...#source "filedirectory"
#vsfx705/cutter/using_test.py# only possible if the python files exist in the same directoryimport testfrom importlib import reloadprint(test.nationality)test.person
# importing randomimport randomval = random.uniform(0,1)print(val)for n in range(10):val = random.uniform(0,1)if val>0.5:print(val)
# rib_test.py"""Points "P" [0 0 0 3 5 6 5 6 7 9 9 9] "constantwidth" [1.0]"""import randomrib_file = open('/Users/ddu/Desktop/ddu/projects/vsfx_705/cutter/data2.rib', 'w')rib_file.write('##bbox: -5 -5 -5 5 5 5\n')rib_file.write('Points "P" [\n')for n in range(100000):x = random.uniform(-5, 5)y = random.uniform(-5, 5)z = random.uniform(-5, 5)rib_file.write('%f %f %f\n' % (x,y,z) )rib_file.write('] "constantwidth" [0.05]')rib_file.close()#Maya > Renderman menu > Archive > import rib archive
# maya/scripts/gen_points.pyimport randomdef cubic(num, side):data = []n = 0while n < num:x = random.uniform(-side/2, side/2)y = random.uniform(-side/2, side/2)z = random.uniform(-side/2, side/2)data.append( (x,y,z) )n = n + 1return datadef box(num, width, height, depth):data = []n = 0while n < num:x = random.uniform(-width/2, width/2)y = random.uniform(-height/2, height/2)z = random.uniform(-depth/2, depth/2)data.append( (x,y,z) )n = n + 1return data# how to create a spherical point clouddef spherical(num,radius):pass # define function but not implemented
# maya/scripts/rib_particles.pyimport randomimport gen_pointsrib_file = open('/Users/ddu/Desktop/ddu/projects/vsfx_705/cutter/data2.rib', 'w')data = gen_points.cubic(10000,10,0.05)rib_file.write('##bbox: -5 -5 -5 5 5 5\n')rib_file.write('Points "P" [\n')for coord in data:rib_file.write('%f %f %f\n' % (coord[0],coord[1],coord[2]) )rib_file.write('] "constantwidth" [0.05]')rib_file.close()#Maya > Renderman menu > Archive > import rib archive
questionswhy is my cutter so slow?does not have vsfx705cannot open hyperlink
list []tuple () fixed values## bbox: -5 5 -5 5 5 5 # read by ribdef writeCubic(pathcmd E to render in Renderman
open Script Editor to see echo MEL command
go to Help > Python reference
flags: ch,o,w,g,d,name
DAG - direct acyclic graphic: transform node>shape node > data structures
Window > Setting / Preferences > Preferences > Selection > Track Selection Order
Hotkeys
Cmd T - new python
import maya.cmds as cmdsdef keyFullRotation(pObjectName,pStartTime, pEndTime, pTargetAttribute):#print '%s type: %s' % (objectname, objectTypeResult)cmds.cutKey(pObjectName, time=(pStartTime,pEndTime), attribute=pTargetAttribute)cmds.setKeyframe(pObjectName, time= pStartTime, attribute = pTargetAttribute, value=0)cmds.setKeyframe(pObjectName, time= pEndTime, attribute = pTargetAttribute, value=360)#linear tangentcmds.selectKey(pObjectName, time-(pStartTime,pEndTime), attribute = pTargetAttributecmds.keyTangent(inTangentType = 'linear', outTangetType='linear')selectionList = cmds.ls(selection=True, type = 'transform))if len(selectionList)>=1:#print 'Selected items: %s' % (selectionList)for objectName in selectionList:startTime = cmds.playBackOptions(query=True,minTime=True)endTime = cmds.playBackOptions(query=True,maxTime=True)#objectTypeResult = cmds.objectType(objectName)keyFullRotation(objectName, startTime,endTime,'rotateY')else:print ' Please select at least one object'
#aimAtFirst.pyimport maya.cmds. as cmdsselectionList = cmds.ls (orderedSelection = True)if len(selectionList) >=2:print 'Selected itesms: %s' %(selectionList)targetName = SelecitonList[0]selectionList.remove(targetName)for objectName in SelectionList:print 'Constraining %s towards %s' % (objectName, tartgetName)cmds.aimConstraint(targetName, objetName, aimVector = [ 0,1,0])else:print 'Please select two or more objects.'
#randomInstances.pyimport maya.cmds as cmdsimport randomrandom.seed(1234)# selectionOrderresult = cmd.ls(orderedSelection = True)print 'result: %s' % (result) # replace string techniquetransformName = result[0]# create a groupinstanceGroupName = cmds.group(empty=True,name = transformName + '_instance_grp')#instancing with for loopfor i in range(0,50):instanceResult = cmds.instance(transformName, name = transformName + ' _instance#'cmds.parent(instanceRsult,instanceGroupName)x = random.uniform(10,10)y = random.uniform(0,20)z = random.uniform(-10,10)cmds.move(x,y,z, instanceResult)#randomize rotationxRot= random.uniform (0,360)yRot= random.uniform (0,360)zRot= random.uniform (0,360)cmds.rotation(xRot,yRot,zRot, instanceResult)# randomize factorscalingFactor = random.uniform(0.3, 1.5)cmds.scale(scalingFactor, scalingFactor,scalingFactor, instanceResult)# hide original cube & center pivitcmds.hide(transformName)cmds.xform(instanceGroupName, centerPiviots=True)
#randomCubes.pyimport maya.cmds as cmdsimport randomrandom.seed(1234)#commenting out multiple lines'''#fetch all objects who name starts with myCube + wildcardcubeList = cmds.ls('myCube*')#delete all cube items in cubeListif (len(cubeList)) > 0:cmds.delete(cubeList)'''result = cmds.polyCube(w=9,h=9,d=9, name = 'myCube#')transformName = result[0]# create a groupinstanceGroupName = cmds.group(empty=True,name = transformName + '_instance_grp')#instancing with for loopfor i in range(0,50):instanceResult = cmds.instance(transformName, name = transformName + ' _instance#'cmds.parent(instanceRsult,instanceGroupName)x = random.uniform(10,10)y = random.uniform(0,20)z = random.uniform(-10,10)cmds.move(x,y,z, instanceResult)#randomize rotationxRot= random.uniform (0,360)yRot= random.uniform (0,360)zRot= random.uniform (0,360)cmds.rotation(xRot,yRot,zRot, instanceResult)# randomize factorscalingFactor = random.uniform(0.3, 1.5)cmds.scale(scalingFactor, scalingFactor,scalingFactor, instanceResult)# hide original cube & center pivitcmds.hide(transformName)cmds.xform(instanceGroupName, centerPiviots=True)
widespread
cross platform
cross-software