node = hou.pwd()
geo = node.geometry()
geo.createPacked("PackedDisk")
int ptnum = addpoint(geoself(), {0,0,0});
int primnum = addprim(geoself(), "PackedDisk", ptnum);
//Display as bounding box
setprimintrinsic(geoself(), "viewportlod", @primnum, "box", "set");
int f = @Frame-1;
string ver = sprintf("%04d", f);
setprimintrinsic(geoself(), "unexpandedfilename", @primnum, "/hou/foo/obj_" + ver +".bgeo.sc", "set");
string file = primintrinsic(geoself(), "unexpandedfilename", @primnum);
string ver = sprintf("%04d", @Frame);
int idx = find(file, ver);
if(idx!=-1)
{
ver = sprintf("%04d", @Frame + ch("offset"));
file = file[:idx] + ver + file[idx+4:];
setprimintrinsic(geoself(), "unexpandedfilename", @primnum, file, "set");
}
In python, we can get object paths of cxform, xform, camera, polymesh, subdmesh, faceset, curves, points and nupatch.
(unknown is no readable).
For now, the best way is to add these paths to a string attribute with "," for seperation.
node = hou.pwd()
geo = node.geometry()
geo.addAttrib(hou.attribType.Point, "objpath","")
import _alembic_hom_extensions as abc
for pt in geo.points():
abcPath = pt.stringAttribValue("path")
paths = abc.alembicGetObjectPathListForMenu(abcPath)
meshPath = ""
for i in range(0,len(paths),2):
path = paths[i]
hie = abc.alembicGetSceneHierarchy(abcPath, path)
if hie[1] == "polymesh":
if meshPath != "":
meshPath += ","
meshPath += path
pt.setAttribValue("objpath", meshPath)
At least, there are 3 intrinsic attributes to modify to read an alembic file properly.
int primnum = addprim(geoself(), "AlembicRef", ptnum); //setprimintrinsic(geoself(), "viewportlod", primnum, "box", "set"); setprimintrinsic(geoself(), "abcfilename", primnum, s@path, "set"); setprimintrinsic(geoself(), "abcframe", primnum, @Frame*@TimeInc, "set"); setprimintrinsic(geoself(), "abcobjectpath", primnum, objpath[n], "set");
Rotate Packed Primitives with orient.
string atrs[] = detailintrinsic(geoself(), "pointattributes");
int find[] = find(atrs, "orient");
if(len(find) >0)
{
matrix3 mat = qconvert(vector4(point(0,"orient", @ptnum)));
setprimintrinsic(geoself(), "transform", primnum, mat, "set");
}




タグ






コメントをかく