Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.
ClassDirectory& class_dir = MAXScript_interface->GetDllDir().ClassDir();
SubClassList* renderers = class_dir.GetClassList(RENDERER_CLASS_ID);
and so on...
edited: ... but.. let me think a little more...
I wrote the code below to obtain the renderers list.
It kind of works, but the thing is that for some renderers like Arnold, SuperClassID() returns REF_TARGET_CLASS_ID rather than expected RENDERER_CLASS_ID.
QHash<QString, Class_ID> Plugin::getRenderers() { auto renderers = QHash<QString, Class_ID>{}; auto count = GetCOREInterface()->GetDllDir().Count(); for (auto i = 0; i != count; ++i) { const auto desc = GetCOREInterface()->GetDllDir().GetDllDescription(i).GetClassDesc(0); //if (std::strcmp((char*)desc->ClassName(), "Arnold")) // qDebug() << desc->SuperClassID(); if (desc && desc->SuperClassID() == RENDERER_CLASS_ID) { const auto name = QString::fromWCharArray(desc->ClassName()); renderers.insert(name, desc->ClassID()); } } return renderers; }
I want to get complete renderers list just like it appears in Render Setup dialog. Does anyone know how to solve this?
That's true. You can write a Renderer by extending just the ReferenceTarget. But anyway as I can see you have to add IRENDERERREQUIREMENTS_INTERFACE. So you can find all renderer classes by this interface.
Thanks for responding. I took a look at the IRenderRequirements class but it's not clear to me how to proceed. Could you show an example?
This works correctly:
QList<QPair<QString, Class_ID>> Plugin::getRenderers() { auto renderers = QList<QPair<QString, Class_ID>>{}; static auto sub = ClassDirectory::GetInstance().GetClassList(RENDERER_CLASS_ID); const auto& xd = sub[0]; for (auto i = 0; i != xd.Count(ACC_ALL); ++i) { const auto name = QString::fromWCharArray(xd[i].ClassName()); const auto cid = xd[i].ClassID(); renderers.append(QPair{ name, cid }); } return renderers; }