Good evening wizards of Xref-land!
I'm working on a script for updating XrefObjs in scenes with identical numbers of objects and running into some trouble...
Before executing the script "C:\\test\\srcScn1.max" exists in the local scene as an Xref record.
These two scenes ("srcScn1" and "SrcScn2") are currently identical in content, I'm just trying to flip the switch to change the 'Xref Object' 'File Name' field before running the update script it's path is "C:\\test\\srcScn1.max"
xr = objXRefMgr
Record = xr.GetRecord 1
a = #()
x = Record.GetItems #XRefAllType a
for i = 1 to x do
(
XRefItem = Record.GetItem i #XRefObjectType
if XRefObjectType = true
then
xr.SetXRefItemSrcFile XRefItem "C:\\test\\srcScn2.max"
)
Listener reports:
<Interface:objXRefMgr>
<MixinInterface:IXRefRecord>
#()
1
-- Error occurred in i loop; filename: S:\net_exe\scripts\maxscript\musevfx\_Referenced-Scripts\___WIP\XRef-Objects\_XrefObjUpdate_v.07.ms; position: 513; line: 14
-- Frame:
-- XRefObjectType: true
-- i: 1
** system exception **
OK
Also I notice that the "old" Xref record and the new are both listed still active, (srcScn1 record still holds the type->'Xref Controller', while srcScn2 now contains the type->'Xref Object. Assuming I need to find a way to move the controller and then use then use 'CombineRecords' to put them together after all Xref paths are set to be sourced from the same file?
I'm assuming I have two distinct problems here (one with the exception caused by my "for" formatting and another where I'm not changing the path on my controller). Hoping I'm close to a breakthrough on this, can anyone point me in the right direction?
I've been heavily referencing
http://www.cgplusplus.com/online-reference/maxscript-reference/source/in…
Thanks in advance!
-Eric