Hello,
I am having some trouble retrieving custom meshes from grasshopper objects connected to custom preview nodes.
the code i am using is something like the following
RhRdk::CustomRenderMeshes::IManager& meshManager = RhRdkCustomRenderMeshManager2();
ON__UINT32 flags = RhRdk::CustomRenderMeshes::IManager::Flags::None;
std::vector<RhRdk::CustomRenderMeshes::ObjectId> ids = meshManager.NonObjectIds();
for (auto id : ids) {
if (!meshManager.HasCustomRenderMeshes(ON::mesh_type::render_mesh, viewport, *doc, id, flags, myPlugin, displayAttributes)) continue;
CRhRdkObjectAncestry ancestry;
std::shared_ptr<const RhRdk::CustomRenderMeshes::IRenderMeshes> customRenderMeshes = meshManager.RenderMeshes(ON::mesh_type::render_mesh, viewport, *doc, id, ancestry, flags, myPlugin, displayAttributes);
if (customRenderMeshes == nullptr) continue;
for (auto instance : *customRenderMeshes) {
std::shared_ptr<const ON_Mesh> mesh = instance->Geometry().Mesh();
assert(mesh != nullptr);
assert(mesh->VertexUnsignedCount() > 0);
}
}
the call to NonObjectsIds does return ids with the same count as the custom preview nodes and i do get an actual mesh pointer, it is just that the mesh is empty (no triangles/quads).
the same code works for objects with displacement/edge softening etc just not for grasshopper objects.