grayOlorin
March 21, 2014 12:14:49
hey guys, I would really like to be able to use Alembic to pass vertex cache data in between maya and houdini. Unfortunately, the maya plug in for this is incredibly limiting (it only passes position, normals, and a single UV set.. maybe color… but I really need control on what kind of mesh data I pass)
I was thinking to make my own abcExporter and I wanted to see if anyone could point me in any direction? Ideally it would be nice if I could use the python API to avoid having to write a plug in
thank you in advance!
Sadjad Rabiee
March 21, 2014 15:19:23
Also we have “Attributes” option in the Maya Alembic window and I so curious to know what is it and how we can use it !?
Maybe we can do that with this option :?
jparker
March 21, 2014 20:54:26
I wrote this MEL script in Maya 2013 to get rest position data into Houdini. You can use colorSets in Maya to get your vector data across. The most useful info for you is probably in the comments on top. Note that it also is saving out a “abcMaterial” and “abcMaterialTextures” attribute that you probably don't need.
/*
To save color information into the alembic file the flag “-wcs” is needed.
Example:
AbcExport -verbose -j “ -wcs -frameRange 1 1 -attr abcMaterial -attr abcMaterialTextures -ro -uvWrite -wholeFrameGeo -worldSpace -writeVisibility -root |model_GRP -file /tmp/test.abc”;
*/
global proc storeRestPosition(string $sel)
{
string $colorSet = “rest”;
int $undoState = `undoInfo -q -state`;
undoInfo -state false;
constructionHistory -toggle false;
string $nodes = `listRelatives -ad -f $sel`;
for ($node in $nodes)
{
if (`nodeType $node` == “mesh”)
{
print (“Setting vertex colors on node ”+$node+“\n”);
string $cmd = “”;
if (!stringArrayContains($colorSet, `polyColorSet -q -allColorSets`))
{
polyColorSet -create -clamped 0 -rpt RGB -colorSet $colorSet $node;
}
polyColorSet -currentColorSet -colorSet $colorSet $node;
int $nverts = `polyEvaluate -v $node`;
int $i;
for ($i = 0; $i < $nverts; $i++)
{
string $currentVtx = ($node+".vtx");
float $pos = `xform -q -ws -t $currentVtx`;
$cmd += (“polyColorPerVertex -nun -rgb ”+$pos+“ ”+$pos+“ ”+$pos+“ ”+$currentVtx+“;\n”);
}
eval($cmd);
clearCache -all;
setAttr ($node+“.displayColors”) 1;
}
}
undoInfo -state $undoState;
constructionHistory -toggle true;
}
That said, I haven't attempted going back out of Houdini into Maya.
grayOlorin
March 26, 2014 21:46:42
hey guys, thank you for the reply! jparker, the route to remap to color beforehand is not a terrible idea. it could be a“preprocess” script to exporting an alembic cache. Will have to dig in into how to make it work with moving geometry in maya from a previous cache (I have never parsed multiple geo frames in maya

)
Sadjad Rabiee
March 27, 2014 04:20:01
jparker
I wrote this MEL script in Maya 2013 to get rest position data into Houdini. You can use colorSets in Maya to get your vector data across. The most useful info for you is probably in the comments on top. Note that it also is saving out a “abcMaterial” and “abcMaterialTextures” attribute that you probably don't need.
/*
To save color information into the alembic file the flag “-wcs” is needed.
Example:
AbcExport -verbose -j “ -wcs -frameRange 1 1 -attr abcMaterial -attr abcMaterialTextures -ro -uvWrite -wholeFrameGeo -worldSpace -writeVisibility -root |model_GRP -file /tmp/test.abc”;
*/
global proc storeRestPosition(string $sel)
{
string $colorSet = “rest”;
int $undoState = `undoInfo -q -state`;
undoInfo -state false;
constructionHistory -toggle false;
string $nodes = `listRelatives -ad -f $sel`;
for ($node in $nodes)
{
if (`nodeType $node` == “mesh”)
{
print (“Setting vertex colors on node ”+$node+“\n”);
string $cmd = “”;
if (!stringArrayContains($colorSet, `polyColorSet -q -allColorSets`))
{
polyColorSet -create -clamped 0 -rpt RGB -colorSet $colorSet $node;
}
polyColorSet -currentColorSet -colorSet $colorSet $node;
int $nverts = `polyEvaluate -v $node`;
int $i;
for ($i = 0; $i < $nverts; $i++)
{
string $currentVtx = ($node+".vtx");
float $pos = `xform -q -ws -t $currentVtx`;
$cmd += (“polyColorPerVertex -nun -rgb ”+$pos+“ ”+$pos+“ ”+$pos+“ ”+$currentVtx+“;\n”);
}
eval($cmd);
clearCache -all;
setAttr ($node+“.displayColors”) 1;
}
}
undoInfo -state $undoState;
constructionHistory -toggle true;
}
That said, I haven't attempted going back out of Houdini into Maya.
That's good idea for starting ,really thanks