VSFX 705

Setting up

Cutter for Mac

Modifying the run file

1
export PYTHONPATH=$PYTHONPATH:$RMANTREE/bin
2
export PATH=$RMANTREE/bin:$PATH
3
​
4
export MAYA_USER_DIR=$HOME/Documents/maya
5
export RMS_SCRIPT_PATHS=$MAYA_USER_DIR/rfm_scripts/image_tool
6
RMANFB=it
7
​
8
# change directory below to where your cutter is
9
cd /Users/ddu/Desktop/ddu/projects/vsfx_705/cutter
10
​
11
# To uncomment the next line - remove the '#' character
12
​
13
java -Xms512m -Xmx512m -classpath .:cutter.jar Cutter
Copied!

Making the text file executable

1
chmod 777 run
Copied!

Setting up Maya Env for Mac

  1. 1.
    Copy rfm_scripts folder to /Users/ddu/Documents/maya
  2. 2.
    copy scripts folder to /Users/ddu/Documents/maya
  3. 3.
    Copy Arnold Shaders to /Users/ddu/Documents/maya/projects
  4. 4.
    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

Student web spaces

  1. 1.
    Go myScad > my info > Web Space Activation​
  2. 3.
    Upload your html and asset files to https://sav-myfile.scad.edu/myfile/ws-idrive/Savannah/Webspaces/Studentpages/web_pages

​Atom​

  • Core: font size: 20, source code pro, 4 spaces tab, Scroll past end
  • Packages: Turn off auto-complete-plus & snippets
1
apm install script autocomplete-python minimap file-icons python-autopep8 linter-flake8
2
maya language-mel
3
pip install autopep8
4
pip install flake8
Copied!
if linter does not show up, delete your Atom config files located: /Users/userName/.atom/config.cson

Notes

1
keep in mind Renderman Attribute Editor, Shelf, Menu bar
Copied!

Using cutter

Resources

Documentation

Learning Python for Maya

Learning Python

  1. 2.
    ​Learning Python, Mark Lutz, O'Reilly Media
  2. 3.
    ​Think Python(on-line), Allen Downey

Getting started with Python

Key terms: list, tuple, dictionary
1
# script is called test.py but it
2
# implements a module called "test"
3
# a modules contrains attributes
4
# an attribute can be, eg. name of a variable
5
​
6
# the built-in datatypes are, nubmers, text(string),
7
# (and collections) list, tuple, dictionary. file.
8
​
9
​
10
age = 26
11
name = "tom"
12
family = 'jones'
13
nationatlity = 'welsh'
14
​
15
# an attribute can also be the name of function
16
#create function
17
def person()
18
print(age)
19
print(name)
20
print(family)
21
​
22
#creating list
23
countries = []
24
countries.append('usa')
25
countries.append('china')
26
countries.append('new zealand')
27
countries.append('england')
28
#countries.sort()
29
#countries.reverse
30
​
31
# using a tuple (fixed value list) - for vertices data structures transfer
32
locked = (2,4,3,6,8,9)
33
# i can test my code by printing some value
34
# this call the values
35
# but comment it out if used asa module
36
person()
37
​
38
​
39
if __ name__ == '__main__':
40
#person() #(debugging purposes)
41
42
#for place in countries:
43
# print(place)
44
45
#print(countries[3])
46
47
print(locked[0])
48
​
49
#print(__name__) # return name of module from where it was run
50
​
Copied!
fileWriting
Python
importRandom
1
# file_test.py
2
# an example of how to store text in a document
3
​
4
out_file= open('file directory', 'w')
5
for n in range(10):
6
out_file.write('sphere -r 1;\n)
7
out_file.write('move %f %f 0;\n' % (n,(n-2))) # placeholder %
8
9
out_file.close()
10
​
11
# to run the mel document in Maya use this mel...
12
#source "filedirectory"
Copied!
1
#vsfx705/cutter/using_test.py
2
# only possible if the python files exist in the same directory
3
import test
4
from importlib import reload
5
​
6
print(test.nationality)
7
test.person
8
​
Copied!
1
# importing random
2
import random
3
val = random.uniform(0,1)
4
print(val)
5
​
6
for n in range(10):
7
val = random.uniform(0,1)
8
if val>0.5:
9
print(val)
Copied!
rib_test
gen_points
rib_particles
1
# rib_test.py
2
"""
3
Points "P" [0 0 0 3 5 6 5 6 7 9 9 9] "constantwidth" [1.0]
4
"""
5
6
import random
7
8
rib_file = open('/Users/ddu/Desktop/ddu/projects/vsfx_705/cutter/data2.rib', 'w')
9
10
rib_file.write('##bbox: -5 -5 -5 5 5 5\n')
11
rib_file.write('Points "P" [\n')
12
for n in range(100000):
13
x = random.uniform(-5, 5)
14
y = random.uniform(-5, 5)
15
z = random.uniform(-5, 5)
16
rib_file.write('%f %f %f\n' % (x,y,z) )
17
rib_file.write('] "constantwidth" [0.05]')
18
rib_file.close()
19
​
20
#Maya > Renderman menu > Archive > import rib archive
Copied!
1
# maya/scripts/gen_points.py
2
3
import random
4
5
def cubic(num, side):
6
data = []
7
n = 0
8
while n < num:
9
x = random.uniform(-side/2, side/2)
10
y = random.uniform(-side/2, side/2)
11
z = random.uniform(-side/2, side/2)
12
data.append( (x,y,z) )
13
n = n + 1
14
return data
15
16
def box(num, width, height, depth):
17
data = []
18
n = 0
19
while n < num:
20
x = random.uniform(-width/2, width/2)
21
y = random.uniform(-height/2, height/2)
22
z = random.uniform(-depth/2, depth/2)
23
data.append( (x,y,z) )
24
n = n + 1
25
return data
26
27
# how to create a spherical point cloud
28
def spherical(num,radius):
29
pass # define function but not implemented
Copied!
1
# maya/scripts/rib_particles.py
2
import random
3
import gen_points
4
5
rib_file = open('/Users/ddu/Desktop/ddu/projects/vsfx_705/cutter/data2.rib', 'w')
6
data = gen_points.cubic(10000,10,0.05)
7
8
rib_file.write('##bbox: -5 -5 -5 5 5 5\n')
9
rib_file.write('Points "P" [\n')
10
​
11
for coord in data:
12
rib_file.write('%f %f %f\n' % (coord[0],coord[1],coord[2]) )
13
14
rib_file.write('] "constantwidth" [0.05]')
15
rib_file.close()
16
​
17
#Maya > Renderman menu > Archive > import rib archive
Copied!
1
questions
2
why is my cutter so slow?
3
does not have vsfx705
4
cannot open hyperlink
Copied!

Lesson 3

recap
1
list []
2
tuple () fixed values
3
## bbox: -5 5 -5 5 5 5 # read by rib
4
​
5
def writeCubic(path
6
​
7
cmd E to render in Renderman
8
​
Copied!
​