WENIE RAHARDJA
Effects + CGI
  • work
  • Reel

Alembic Option Documentation

8/23/2016

 
AbcExport -h;
​
// AbcExport [options]
Options:
-h / -help  Print this message.
-prs / -preRollStartFrame double
-duf / -dontSkipUnwrittenFrames
-v / -verbose
-j / -jobArg string REQUIRED
-jobArg flags:
-a / -attr string
-df / -dataFormat string
-atp / -attrPrefix string (default ABC_)
-ef / -eulerFilter
-f / -file string REQUIRED
-fr / -frameRange double double
-frs / -frameRelativeSample double
-nn / -noNormals
-pr / -preRoll
-ro / -renderableOnly
-rt / -root
-s / -step double (default 1.0)
-sl / -selection
-sn / -stripNamespaces (optional int)
-u / -userAttr string
-uatp / -userAttrPrefix string
-uv / -uvWrite
-wcs / -writeColorSets
-wfs / -writeFaceSets
-wfg / -wholeFrameGeo
-ws / -worldSpace
-wv / -writeVisibility
-wc / -writeCreases
-mfc / -melPerFrameCallback string
-mpc / -melPostJobCallback string
-pfc / -pythonPerFrameCallback string
-ppc / -pythonPostJobCallback string

Complete description here
AbcImport -h;
//                                                                            
AbcImport  [options] File                                                 

Options:                                                                    
-rpr/ reparent      DagPath                                                                           -ftr/ fitTimeRange                                                          
-rcs / recreateAllColorSets                                                                     
-ct / connect       string node1 node2 ...                                                    -crt/ createIfNotFound                                                                      
-rm / removeIfNoUpdate                                                                
-sts/ setToStartFrame                                                       
-m  / mode          string ("open"|"import"|"replace")                
-ft / filterObjects "regex1 regex2 ..."                                   
-eft / excludeFilterObjects "regex1 regex2 ..."                                         -h  / help          Print this message                                      
-d  / debug         Turn on debug message printout                        

Complete description here

Alembic Cache Script Via Python

8/22/2016

 
Recently I found that there is no equivalent python command for alembic export import. I can't find the documentation on it either.
To read on the documentation, you have to call it in script editor using AbcExport -h and it only comes in mel.

So after further research, I found a way to do it the python way. Basically, you have to wrap the mel version in a string and use it on the jobArg (j) flag. 

For the alembic export

import maya.cmds as cmd

start = 0
end = 120
root = "-root pSphere1 -root pCube1"
save_name = "c:\documents\maya\project\default\cache\alembicTest.abc"

command = "-frameRange " + start + " " + end +" -uvWrite -worldSpace " + root + " -file " + save_name
cmd.AbcExport ( j = command )


 If you do print command you'll get the following result

-frameRange 0 120 -uvWrite -worldSpace -root pSphere1 -root pCube1 -file c:\documents\maya\project\default\cache\alembicTest.abc



The alembic import command doesn't have the jobArg flag so I figured that I can import maya.mel to my python script and use the eval command.

import maya.cmds as cmd
import maya.mel as mel
 command = "AbcImport -mode import -fitTimeRange -connect " + '"' + root + '"' + " " + '"' + save_name + '"' 

 mel.eval(command)

Notice that you need to include the double quote encasing the root and save_name  in the string. ' " '
 If you do print command you'll get the following result

AbcImport -mode import -fitTimeRange -connect "pSphere1 -root pCube1"  "c:\documents\maya\project\default\cache\alembicTest.abc"

Reference:
About alembic export, click  here

About wrapping melscript inside python, click here

Aligning Object Along the Curve with Translation Matrix

8/14/2016

 
I found this to be the easiest way to align object orientation along a curve. Using pointOnCurve command, you can query the position, tangent, and normal information. Using normal and tangent vector, find the bi normal / cross product and arrange all the numbers in a translation matrix with xform command. Normalized everything except position.
Picture
Finding the cross product
Mel or python has the "cross product" command, but to do it manually, you can do this:

Given the normal { Nx, Ny, Nz }   and tangent {Tx, Ty, Tz}

binormal = Ny*Tz - Nz*Ty , Nz*Tx - Nx*Tz, Nx*Ty - Ny*TX


​Prevent the normal from "roll" around the curve
Specify the "up vector" for the curve. For example, Y can be up vector. Using this information, find the normal by calculating the cross product between tangent and the up vector. 

Given the up vector { Ux, Uy, Uz }   and tangent {Tx, Ty, Tz}

normal = Uy*Tz - Uz*Ty , Uz*Tx - Ux*Tz, Ux*Ty - Uy*TX

Reference

https://ilmvfx.wordpress.com/2014/01/28/how-do-i-align-an-object-to-a-curve-without-using-a-constraint/

http://tutorial.math.lamar.edu/Classes/CalcII/CrossProduct.aspx


Pymel / Python Quick Reference

8/13/2016

 
Query time slider value - use playbackOptions. 
link to documentation here
​

Importing pymel -> import pymel.core as pm

Convert to pynode -> pm.PyNode("[name]")

    Categories

    All
    Hair / Fur
    Scripting