bool GusdGU_PackedUSD::save(UT_Options &options, const GA_SaveMap &map) const { options.setOptionS( "usdFileName", m_fileName ); options.setOptionS( "usdAltFileName", m_altFileName ); options.setOptionS( "usdPrimPath", m_primPath.GetText() ); options.setOptionS( "usdSrcPrimPath", m_srcPrimPath.GetText() ); options.setOptionI( "usdIndex", m_index ); options.setOptionF( "usdFrame", GusdUSD_Utils::GetNumericTime(m_frame) ); UT_StringArray purposes; getIntrinsicPurposes( purposes ); options.setOptionSArray( "usdViewportPurpose", purposes ); return true; }
int main(int argc, char *argv[]) { // Make sure to install the GU plug-ins GU_Detail::loadIODSOs(); // Process command line arguments UT_Args args; args.initialize(argc, argv); args.stripOptions("l:o:v:h"); if (args.found('h')) { usage(argv[0]); return 1; } const char *output = args.found('o') ? args.argp('o') : "stdout.geo"; int lod = args.found('l') ? args.iargp('l') : 3; const char *viewportLOD = args.found('v') ? args.argp('v') : "full"; GU_Detail gdp; // Create a packed sphere primitive GU_PrimPacked *pack = GU_PrimPacked::build(gdp, "PackedSphere"); if (!pack) fprintf(stderr, "Can't create a packed sphere\n"); else { // Set the location of the packed primitive's point. UT_Vector3 pivot(0, 0, 0); pack->setPivot(pivot); gdp.setPos3(pack->getPointOffset(0), pivot); // Set the options on the sphere primitive UT_Options options; options.setOptionI("lod", lod); pack->implementation()->update(options); pack->setViewportLOD(GEOviewportLOD(viewportLOD)); // Save the geometry. With the .so file installed, this should load // into Houdini and should be rendered by mantra. if (!gdp.save(output, NULL).success()) fprintf(stderr, "Error saving to: %s\n", output); } return 0; }