Xref objects revert to Xref material


Recently I started programming a script to control Xref objects in 3Ds max.
Wondering of there is a way to update Xref objects their materials and controllers
to the original Xref materials and controllers by script?

Such as you can do in the UI by right clicking on the sub-objects and choose
"revert to xref material/controller" -> see image below

Also, is their a way to control which controllers are updates?
I like to only update the scale control!

This is the code I have so far

Xrefobjects = objXRefMgr		
for i = 1 to Xrefobjects.recordCount do
	tmpRecord = Xrefobjects.GetRecord i
        --Update the Xref record file
        --Try to update the sub items materials and controllers in the record file
	tmpRecordSubList = tmpRecord.GetItems #XRefObjectType $tmpRecord
	objXRefMgr.ApplyXRefMaterialsToXRefObjects $tmpRecordSubList
	objXRefMgr.ApplyXRefControllersToXRefObjects $tmpRecordSubList


objects_001.jpg251.81 KB