Dec 3, 2013 · Comments
If you need to re-encode a lot of videos all at once, each video being in a different folder, here is a little bash script for you.
Just put everything in a file and execute it. The file needs to be executed in the main directory where all the children folders are. If you have spaces in the name of the files, it’ll still work.
#!/bin/bash
for folder in "*"/
do
for file in "$folder"/"*".flv
do
ffmpeg -i $file ${file%.*}.mp4
done
done
It’s easy to understand, so you can adapt it to your own needs easily.
Nov 12, 2013 · Comments
Recently a friend of mine was using the Final Gather Map Visualizer to diagnose and set the FG of the scene she was working on. One annoying thing though, it was only visible on one Render Layer.
After some reading in the documentation of Maya, it appears the Final Gather Visualizer is actually a node: mapVizShape.
If it is a node, then it must be added to the Render Layer to be displayed on that specific Render Layer. To do so, filter mapViz in the outliner and then add it to the Render Layer or just execute that little piece of Python.
import maya.cmds as cmds
if cmds.objExists("mapViz*"):
mapViz = cmds.ls ("mapViz*", transforms = True)
renderLayers = cmds.ls(type = "renderLayer")
for layer in renderLayers[1:]:
listConnections = cmds.listConnections(layer, source = False)
nodePresentInLayer = set(listConnections).intersection(mapViz)
if not nodePresentInLayer:
cmds.editRenderLayerMembers(layer, mapViz)
Now all your Render Layers can display the Final Gather points in the viewport!
Don’t forget to execute it each time you create a new layer.
Nov 9, 2013 · Comments
On the great website xyz2.net there is the entry on How do I find the Shape node of a Transform? Or the Transform of a Shape node?
But what if you want the Transforms of a list of Shape nodes?
proc string[] getTransform(string $shape[]) {
string $transform[];
for ($node in $shape) {
if ( "transform" != `nodeType $node` ) {
// If given node is already a transform, just pass on through
string $parents[] = `listRelatives -fullPath -parent $node`;
appendStringArray($transform, $parents, size($parents));
}
}
return $transform;
}
def getTransforms(shapeList, fullPath=False):
transforms = []
for node in shapeList:
if 'transform' != cmds.nodeType( node ):
parent = cmds.listRelatives( node, fullPath=fullPath, parent=True )
transforms.append( parent[0] )
return transforms
Sep 22, 2013 · Comments
Did it ever happen to you to feel stupid in front of your program stuck in an infinite loop?
We all now that feeling…
The documentation of Mari’s API and the Python Console are really bad to work with, but at least there is one great thing about Mari: you can very easily stop your scripts if they are stuck.
Simply hit Ctrl+C in the terminal Mari has been launched from and… that’s it, your script stopped and you can continue to work normally. It’s quite useful especially since Mari takes a lot of time to simply print some strings.