Notifications
Clear all

[Closed] [SDK] Trouble loading/saving indirect references

I’m having trouble saving an object plugin class AssetModel that holds a strong reference to a ReferenceTarget class AssetModelContext. The AssetModelContext then again indirectly references the INode the AssetModel is attached to, using the IRefTargMonitor and IIndirectReferenceMaker classes (like the controller sample class in samples\controllers\NodeMonitor.h).

The problem is once I try to save the file, 3ds Max (2015) crashes throwing a HRException. 🙁 Debugging shows the problem seems to be
a pure virtual function call that happens when SaveEnum is called on the AssetModelContext (actually ReferenceMaker::SaveEnum, I do not override that function).

Here are the sources of both classes:

AssetModel.h
AssetModel.cpp

MaxScript test case where 3ds max crashes:

theAssetModel = AssetModel()
theAssetModel.contextNode = theAssetModel

-- now save the file

Any ideas, what might be causing the crash? Are even indirect references in that use case not allowed?
Any help is greatly appreciated

[B]EDIT:

Finally got it working… without using the IIndirectReferenceMaker class. I just load/save the RefTargMonitorRefMaker in the AssetModelContext::Load/AssetModelContext::Save methods by myself.[/B]