PDA

View Full Version : Merge in Xref Objects?


DaveWortley
02-25-2010, 09:42 AM
How can I merge all my Xref objects in my scene into my file using maxscript....

phfatmonkey
02-25-2010, 03:49 PM
I don't think there is a straight function call for merging xrefs, but here is a quick function that merges in the associated Max file:


fn mergeXRef xRefObj = (

try (
mergeMAXFile xRefObj.filename #(xRefObj.objectName) #select #deleteOldDups #useMergedMtlDups #alwaysReparent quiet: true
newNode = $

delete xRefObj
xRefObj = newNode
return true
)
catch(
return false
)


)

success = mergeXRef $

banda
03-03-2010, 05:20 PM
i am trying to do the same thing.. merge all xref entries to the current scene...
can someone explain the code above?

or tell me how i can merge all xref objects comming from a file i know the path for ? for example "C:\\Program Files\\Autodesk\\3ds Max 2009\\Scripts\\Startup\\1.max"

PiXeL_MoNKeY
03-03-2010, 06:08 PM
Check the interface:objXrefMgr in the maxscript help:Interface: objXRefMgr <bool>objXRefMgr.MergeRecordIntoScene <Interface>record

record Validated by Validator function

Merges the specified record into the scene. Returns true on success, false on failure. See IXrefRecord MixinInterface for details on the record argument.-Eric

banda
03-03-2010, 06:49 PM
i am new to maxscripting and some of the instructions in max's maxscript help are a bit above my head ...
so, i still can get it to work..

say its xrefs from this "C:\\Program Files\\Autodesk\\3ds Max 2009\\Scripts\\Startup\\1.max" file that i want to be merged how do i get objXRefMgr.MergeRecordIntoScene to do that for me?

banda
03-04-2010, 02:15 PM
ok i finally used the following code to completely merge the xrefed objects in scene

objs = getCurrentSelection()
for i in objs do
(
objXRefMgr.MergeXRefItemsIntoScene i
objXRefMgr.MergeXRefItemsIntoScene i.material
objXRefMgr.MergeXRefItemsIntoScene i.controller
)

DaveWortley
03-05-2010, 01:23 PM
Opps, forgot to say thanks for this! I managed to get what i wanted by not merging and instead editing the baseobject of the xref, saved a load of pipeline hassle!

CGTalk Moderation
03-05-2010, 01:23 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.