Category Archives: Max SDK with C++

Max Find Only Instance (C++)

Max SDK and C++

Find any object instance using Max SDK and C++
This code block is returned only instance of objects. IInstanceMgr::GetInstanceMgr()->GetInstances functions is finding any object references and instance.But This functions return only instance.

INodeTab MaxSDK::GetInstances(INode *node)
    Object *obj = node->GetObjectRef();
    INodeTab instanceAndRef;
    IInstanceMgr::GetInstanceMgr()->GetInstances(*node, instanceAndRef);
    INodeTab onlyInstance;

    for (int k=0; k < instanceAndRef.Count(); k++)
        if (obj == instanceAndRef[k]->GetObjectRef())
    return onlyInstance;