Notes on various shells, shell commands, programs, and resources used in VFX production.
Read and print a file to the shell.
Print the contents of file.txt:
cat file.txt
For more info:
man cat
Used to change file permissions. Useful for limiting or sharing access to files.
Set file to execute/read/write access to user only:
chmod 700 /path/to/file
Set file to read/write access to read/write for everyone:
chmod 666 /path/to/file
To change all the directories to 755 (drwxr-xr-x):
find /path/to/file -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--):
find /path/to/file -type f -exec chmod 644 {} \;
For more info:
man chmod
Copy a file to a new location or a new name.
Make a copy of an existing file in the same directory:
cp /path/to/file.txt /path/to/newfile.txt
Copy a file to a different directory:
cp /path/to/file.txt /new/path/to/newfile.txt
Copy an entire directory and it's contents to a different directory:
cp -r /path/to/dir /path/to/newdir
For more info:
man cp
ffmpeg is a video and audio encoder commonly used in vfx
A number of useful examples of generating videos for a vfx pipeline are available here: https://trac.ffmpeg.org/wiki/Encode/VFX
Search for files or directories in a filesystem.
Find a file named "demo_reel.mov":
find /path/to/search/ -name "demo_reel.mov"
Find a file with a .mov extension modified in last 2 days:
find /path/to/search/ -mtime -2 -name "*.mov"
Load every QT found into a single RV session:
find /path/to/search/ -mtime -2 -name "*.mov" -exec rv {} +
For more info:
man find
File pattern search tool.
Find every line in a file that contains the text "file" in it:
grep 'file' /path/to/file.nk
Find every line in every log file in a directory that contains the text "render" in it:
grep -r 'render' /path/to/files/*.log
Find the path to every file that contains the text "compositing":
grep -rl 'compositing' /path/to/files/*.log
For more info:
man grep
Move files or directories.
Move file to new location:
mv /source/path/file.txt /dest/path/file.txt
Move folder to new location:
mv /source/path/dir /dest/path/dir
Rename a file:
mv /source/path/file.txt /source/path/new_file.txt
For more info:
man mv
Delete files or directories. Be careful, there is not an "undo".
Delete file:
rm /path/to/file.txt
Delete directory and contents:
rm -r /path/to/dir
For more info:
man rm
Copy files from or to a local or remote system. Transfers only the differences in files such as a new file or a change in a file. This is very useful for creating backup systems.
Sync a folder and all files and sub-directories from one location to another:
rsync --recursive /path/to/dir/ /path/to/backup/dir/
A day of work has gone by. Let's sync again but only the new or changed files:
rsync --recursive --ignore-existing /path/to/dir/ /path/to/backup/dir/
Another day has gone by. Let's run a test to see which files would be transferred:
rsync --recursive --ignore-existing --dry-run /path/to/dir/ /path/to/backup/dir/
Transfer files to a remote server:
rsync --recursive --ignore-existing /path/to/dir/ user@remote:/path/to/backup/dir/
For more info:
man rsync
Used for securely logging into remote machines.
Log into remote machine with user "worker":
ssh worker@remote
Use a specific identity key to log into a remote machine:
ssh -i ~/.ssh/remote_key.pem worker@remote
SSH can use a config file to set commonly used configurations. First make the file:
touch ~/.ssh/config
To set our configuration in the file, add this to ~/.ssh/config:
Host remote
HostName remote
Port 22
User pi
IdentityFile ~/.ssh/remote_key.pem
Now we can login to the remote server with a shorter command:
ssh remote
Used to put data into archive files for security or file transfer.
To compress:
tar -zcvf archive_name.tar.gz folder_to_compress
To extract:
tar -zxvf archive_name.tar.gz
Setting a basic environment variable:
export TEST_VAR="/some/path"
Running a command to set a variable. In this case, the current directory:
export CURDIR=$(pwd)
alias ls_all='ls -l'
setenv TEST_VAR "/some/path"
alias ls_all 'ls -l'
Example of iterating through selected nodes
for n in nuke.selectedNodes():
print n.name()
Same example but only using a specific node class
for n in nuke.selectedNodes("Camera2"):
print n.name()
Get current script path
print nuke.root().name()
Get selected node class
print nuke.selectedNode().Class()
Looking through all nodes
for n in nuke.allNodes():
if n.Class() == "Read":
print n.name()
Select a node by name
nuke.toNode("Noise1")
Running tcl commands in python
nuke.tcl("value label")
Setting defaults in menu.py or init.py. http://docs.thefoundry.co.uk/nuke/63/pythondevguide/basics.html
nuke.knobDefault("Blur.size", "20")
nuke.knobDefault("Read.exr.compression", "2")
Return an expression on a knob if it eists
if knob.hasExpression():
origExpression = knob.toScript()
List all knobs on a node
for n in nuke.selectedNodes().knobs():
print n
Set value on all Read nodes within a selected group
for n in nuke.selectedNodes():
if n.Class() == "Group":
for s in n.nodes():
if s.Class() == "Read":
s['postage_stamp'].setValue(True)
Useful expressions and tcl for Nuke
On/Off in GUI mode
$gui
$gui ? 1 : 0
$gui ? 1 : 16 #scanline render
Use python wrapped in tcl
[python nuke.tcl("value gain")]
Check node directly above this one and return some values for a knob:
[value [value input[value 0].name].distortion2] + [value [value input[value 0].name].distortion1] > 0 ? 1:0
Nuke Random Range between max and min values
(1.1 - .9) * random(t) + .9
Random curve expression
(random(1,frame*1)*1)+0
or just simplified:
random(1,frame)
This creates a curve containing random values between 0 and 1. The breakdown controls:
(random(seed,frame*frequency)*amplitude)+valueOffset
Simple html for label knobs
<font color="red">Some red text</font> # change font color
<font color="blue">Some blue text</font> # a different font color
<font align="left">Left aligned text
<b>Bold text</b> # bold text
Metadata get exr compression type
[metadata exr/compression]
Root dir
[file dirname [knob [topnode].file]]
Filename
[file tail [knob [topnode].file]]
Value of this node's first knob
[value this.first]
Value of the first input's first knob
[value this.input0.first]
Value of the second input's first knob
[value this.input1.first]
Value of top most node in chain's first knob
[value [topnode].first]
Retime a Camera with a Timewarp node named TimeWarp1. Useful when matchmove tracks the plate and then a retime is applied to match editorial. Place this expression on translate, rotate, and focal knobs
curve(TimeWarp1.lookup)
Useful for determining if sharpening is needed on retimes Example with a Timewarp node named Timewarp1
abs(rint(TimeWarp1.lookup)-TimeWarp1.lookup) > 0.15 ? 1:0
Using TCL lindex and split to get a specific portion of a file path In this case we split the directory separator "/" and choose the 3rd item in the resulting list
[ lindex [split [value [topnode].file] / ] 3 ]
Normalize
(value - valuesMin)/(ValuesMax - valuesMin)
All examples using Shotgun's demo projects
Find all project names
sg.find('Project',[],['name'])
Find info on a specific shot
shot = 'bunny_150_0200'
sg.find('Shot', [['project', 'is', {'type': 'Project', 'id': 70}], ['code', 'is', shot]], [ 'code', 'sg_status_list', 'tags', 'sg_sequence'])
Get all shots in a specific sequence
sg.find('Shot', [['project', 'is', {'type': 'Project', 'id': 70}], ['sg_sequence', 'is', {'type': 'Sequence', 'id': 37, 'name': 'bunny_150'}]], ['code', 'sg_sequence', 'tags'])
https://nick-shaw.github.io/cinematiccolor/cinematic-color.html# http://brucelindbloom.com/ https://opencolorio.org/ https://github.com/AcademySoftwareFoundation/OpenColorIO https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES https://github.com/AcademySoftwareFoundation/openexr-images https://www.colour-science.org/ https://github.com/colour-science https://github.com/colour-science/OpenColorIO-Configs http://mikeboers.com/blog/2013/11/07/linear-raw-conversions https://nick-shaw.github.io/cinematiccolor/full-and-legal-ranges.html https://chrisbrejon.com/cg-cinematography/ https://acescentral.com/ https://www.babelcolor.com/colorchecker.htm
https://opencontent.netflix.com/
https://docs.ansible.com/ansible/latest/
https://lollypopman.com/lighting-club/ https://academy.substance3d.com/courses/the-pbr-guide-part-1
https://en.wikipedia.org/wiki/Spherical_coordinate_system https://en.wikipedia.org/wiki/Rotation_matrix https://en.wikipedia.org/wiki/Euclidean_distance https://en.wikipedia.org/wiki/Feature_scaling https://en.wikipedia.org/wiki/Quaternion https://en.wikipedia.org/wiki/Transformation_matrix https://en.wikipedia.org/wiki/Sawtooth_wave https://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/
https://github.com/FFmpeg/FFmpeg https://github.com/OpenImageIO/oiio https://github.com/AcademySoftwareFoundation https://github.com/AcademySoftwareFoundation/openvdb https://github.com/AcademySoftwareFoundation/openexr https://github.com/NatronGitHub/Natron https://github.com/alembic/alembic https://www.blender.org/
https://en.wikipedia.org/wiki/Circle_of_confusion https://jtra.cz/stuff/essays/bokeh/#what_is_bokeh https://vfxcamdb.com/
https://github.com/pyblish/pyblish-base https://getavalon.github.io/2.0/
https://docs.python-guide.org/
https://github.com/AcademySoftwareFoundation/aswf-docker https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ https://www.codementor.io/@jquacinella/docker-and-docker-compose-for-local-development-and-small-deployments-ph4p434gb