tips mainly for Houdini

Packed Primitive

Create Packed Primitive in Python
node = hou.pwd()
geo = node.geometry()

geo.createPacked("PackedDisk")

Create Packed Primitive in Vex

int ptnum = addpoint(geoself(), {0,0,0});
int primnum = addprim(geoself(), "PackedDisk", ptnum);

Change frame to load in Vex


//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");
    
}



Speed Comparison









Packed Alembic

Give points path for alembic files.

s@path = "/aa/bb/ccc/alembic.abc";

Get ObjectPaths

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)

Manipulation of intrinsic attributes

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");
}






コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

管理人/副管理人のみ編集できます