Notifications
Clear all

[Closed] Xref Grief

Greetings

I’m having some trouble with Xrefs in maxscript… I basically want everything xrefed from one .max file to a new one, with the exception of a bunch of helper objects and their parents which need to get merged into the new scene. (this preserves some custom attribute and animation behavior which is requirred in the new scene)

The way I’ve gone about this, which use to work, but now seems broken… is as follows…

-- save array of object names into array
 
 -- delete all objects in the scene and re-save with a new filename, then
 
 xrefs.addNewXRefObject xrFilename xrObjArray modifiers:#xref manipulators:#xref
 
 --where xrFilename is the new scene filename, and xrObjArray, is the array of object names i want to suck back in...
 
 --then i did the following, which would merge in all my little helper objects named Axis_[n]
  for obj in $Axis_*  do
  (
 	objXRefMgr.MergeXRefItemsIntoScene obj
 	objXRefMgr.MergeXRefItemsIntoScene obj.Controller
 		 if obj.parent != undefined do ( --similar merge to above )
 )
 

For some reason this doesn’t seem to work anymore (might have stopped working any time over the past few months, and i’m not sure what would have changed…(Besides moving from max 10 through various SPs to max 11, but no changes were indicated to this kind of maxscript stuff)
The objects remain as x-refs in the new file…

I’ve tried using objXRefMgr.MergeRecordIntoScene obj.xrefRecord instead… But for some reason (mainly because i don’t really understand what an xref record is… ) rather then just merge in one object, or the specific objects i want to merge in, everything gets merged in.

This seems to differ to when i test it in the listener using
objXRefMgr.MergeRecordIntoScene $.xrefRecord

Any advice would be greatly appreciated.

Mikie

2 Replies

looks like if it modify things to

objXRefMgr.MergeXRefItemsIntoScene obj.baseObject

and

objXRefMgr.MergeXRefItemsIntoScene obj.baseObject.controller

it all works again…I just wonder if at some point the behavior of objXRefMgr.MergeXRefItemsIntoScene was changed to be a bit more picky as to what gets passed in…

Well, the xrefs all seem to work fine, but on reloading the new file, All of the node references in my helper object script controllers fail… saying that .pos isn’t valid for instance…

Obviously there is more to this problem…