Toggle xRef Scenes / xRef Objects

Hello all,

So of course i'm aware that you can just get to the xRef Scenes / xRef Objects by going through File -> Reference.

But i like to toggle the xRef Scenese / xRef Objects by using a script. I have my own "summary script" in which i like to include them.

So i'm looking for the function to toggle these two, unfortunately i couldn't find these online. Hopefully you can help me :)

Thank you.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

Adding xRef Objects to the scene:

(
-- the file from which to load objects as xREf objects
	newSrcFile = @"D:\3D_CAD\scenes\scenes\myTestScene.max"
-- get the names of allobjects in newSrcFile
	allObjInNewSrcFile = getMAXFileObjectNames newSrcFile quiet:true
	-- load all objects as xRef objects
	newXrefObj = xrefs.addNewXRefObject newSrcFile allObjInNewSrcFile
)

Loading xRefScene

(
	newSrcFile = @"D:\3D_CAD\scenes\scenes\myTestScene.max"	
	xrefs.addNewXRefFile newSrcFile 
)
remykonings's picture

Haha. Is this all necessary

Haha. Is this all necessary just to open the xRef Scenes window/dialog?

Same for the xRef Objects? I think there is some miscommunication :)

miauu's picture

.

Just to open the dialogs use this:

max file xref object
max file xref scene
remykonings's picture

Thank you. That is indeed

Thank you. That is indeed what i was looking for. Although for some reason this doesn’t work though a FileIn function which i’m using.

Do you have any idea how this might work then?

miauu's picture

.

Can you show the code that you use along with teh fileIn function?

remykonings's picture

Sure. This is the file that i

Sure. This is the file that i use to call the function.

rollout rollout4 "xRef"
(
button xrefScenes "xRef Scenes" tooltip:"Show all xRefs Scenes" width:90 across:3
button xrefObjects "xRef Objects" tooltip:"Show all xRef Objects" width:90
button copyXref "Copy xRef" tooltip:"Copy the selected xRef" width:90
button toggleXref "Toggle xRef" tooltip:"Toggle xRef" width:90 across:3

on xrefScenes pressed do (
fileIn ("W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\xRef Scenes\xRef Scene.ms")
)
on xrefObjects pressed do (
fileIn ("W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\xRef Objects\xRef Objects.ms")
)
on copyXref pressed do (
fileIn ("W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\Copy xRef\Copy xRef.mcr")
)
on toggleXref pressed do (
fileIn ("W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\Toggle xRef\Toggle xRef.ms")
)
)

miauu's picture

.

Ok. But what is in the xRef Scene.ms for example?

remykonings's picture

*

The only thing that is in there is what you wrote me:

max file xref scene

This works well if i just execute the function, just not in combination with the FileIn function.

miauu's picture

.

Strange. Here is what I did:
1- open MaxScript Editor and paste this in a new file

(
	max file xref scene
)

2- save the file as xRefOpenFileIn.ms
3- create new file with this code:

macroscript miauuXRefOpenDialog
category:"miauu"
tooltip:"XRefOpenDialog"
buttonText:"XRefOpenDialog"
(
	fileIn @"C:\Users\MyUserName\Desktop\NewFolder\xRefOpenFileIn.ms"
)

and save it as mcrXrefOpenDialog.mcr file
4- drag and drop the mcrXrefOpenDialog.mcr onto 3ds max viewports and assign a hot key to it(Ctrl+T).
Every time when I press the Ctrl+T the XREf Scene dialog appears.

remykonings's picture

*

Oke it works now.

It seems that the problem was indeed the path.

DOES WORK:
fileIn @"W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\xRef Scenes\xRef Scenes.ms"

DOESN'T WORK:
fileIn ("W:\Algemeen\Werknemers\Remy\3Ds Max\Scripts\xRef Scenes\xRef Scenes.ms")

Thank you for your help :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.