Jump to content

how to Output arbitrarily attribute to custom file


Recommended Posts

Here's a good reference page: http://www.sidefx.com/docs/hdk13.0/hdk_dataflow_sop.html

 

Untested.

bool foo(OP_Context &context, const char *sop_path, const char *vector_attrib_name, UT_Vector3Array &data)
{
    SOP_Node *sop = CAST_SOPNODE(OPgetDirector()->findNode(sop_path));
    if (!sop)
        return false; // ERROR! not a valid sop node path
   
    GU_DetailHandle gd_handle = sop->getCookedGeoHandle(context);
    if (gd_handle.isNull())
        return false; // ERROR! failed to cook
 
    GU_DetailHandleAutoReadLock gd_lock(gd_handle);
    const GU_Detail* gdp = gd_lock.getGdp();
 
    GA_ROAttributeRef attrib = gdp->findPointAttribute(vector_attrib_name);
    if (attrib.isInvalid())
       return false; // ERROR! wrong attrib name
 
    if (!gdp->getPointAttributeAsArray(attrib.get(), gdp->getPointRange(), data))
        return false; // ERROR! wrong type?
 
    return true;
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...