xgen primitives data getter

31 views
Skip to first unread message

TTw TTa

unread,
Apr 9, 2024, 4:23:29 AMApr 9
to Python Programming for Autodesk Maya
hi, everyone, I what to kown xgen generated primiitives was driver by which guide, How Could I do It
such as that

Snipaste_2024-04-09_16-19-33.png
```
MStatus status;
std::cout << "--------------------" << std::endl;

std::string collection_name{"collection4"};
std::string description_name{"description4"};
std::string patch_name{"pPlane1"};

XgPalette * collection = XgPalette::palette(collection_name);
XgDescription * description = collection->description(description_name);

XgPrimitive * primitive = description->activePrimitive();
// GLRenderer
XgRenderer * renderer = description->activePreviewer();

// 视口内 primitive的总数
int primitives_count = renderer->totalEmitCount();
auto num_patch = description->numPatches();
XgPatch * patch = description->patch(patch_name);

// Get a reference to the array of spline control points.
auto const context = primitive->context();
primitive->initDescriptionInParallel(*context);


std::cout << "id :" << primitive->id() << std::endl;
std::cout << "num guide :" << primitive->numGuides() << std::endl;
std::cout << "num patch :" << num_patch << std::endl;

XgGuide * guide = primitive->guide(0);
auto u = guide->u();
auto v = guide->v();

std::cout << "u :" << u << " v: " << v << std::endl;
auto patch_u = guide->patchU();
auto patch_v = guide->patchV();
std::cout << "patch_u :" << patch_u << " patch_v: " << patch_v << std::endl;
XgDict<safevector<SgVec3d> > attrs = context->cvAttrs();
for (auto &attr: attrs)
{
    std::cout << attr.first << " " << attr.second.size() << std::endl;
}
```
I think it store in svAttrs, but that data was empty, 
then I tray other way which I can thought, but failed, how could I do it

thanks


Reply all
Reply to author
Forward
0 new messages