Notifications
Clear all

[Closed] Xref Scene override material/properties

Is there a way through maxscript to have an override on a Xref scene entry.

For instance, to have a material set to override any in the xref scene entry, or be able to set things like Visible to camera off…

13 Replies

I xref Scene’d a max file with 9 boxes in it… then in the listener…


tnXref = xrefs.getXRefFile 1
XRefScene:"Nine_Boxes.max"
tnXref.tree.children
#children($Box01, $Box02, $Box03, $Box04, $Box05, $Box06, $Box07, $Box08, $Box09)
tnXref.tree.children[2]
$Box:Box02 @ [17359.349609,-445.685547,0.000000]
tnXref.tree.children[2].primaryVisibility = off
false
for tnObj in tnXref.tree.children do tnObj.material = StandardMaterial diffusecolor:( color 128 128 128 )
OK

The .tree construct allows you to access/change all the node properties…
The loop is a “material override” for the x-ref scene… We’ve been doing mattes like this for years… The best part is all you have to do is reload the Xref to get all the old properties back…

Thanks Kramsurfer, that looks really useful!

Once this script has run does it store the settings propperly, or do you need to set it as a pre-render script if you submit it over backburner?

Hmm ok so resets when you re-open the file… Currently designing an interface to work in our pipeline with this as it will be uber useful, I guess I’ve now got to write a script that writes a script, lol. Once it’s generated the script I can have this as a pre-render script so I can render over backburner.

I have it as a #filePostOpen callback for network rendering, but I’m sure the #prerender would work too…
And you’ll want to define one material to a var and apply it… the example I gave makes a unique material for each object, not such a good idea, but was a quick one line demo…

Do you setup your script manually every time or do you have an automated way of doing it?

My next challenge is to adapt a script I wrote that sets up colour correction masks quickly by filtering through all the scene materials and applys a self illuminating material to all of them, but If the material has an opacity map it makes a new material with the opacity map.

Hmmmmmm… it would seem I need to add another feature to Professor Xref…

Professor Xref?

I did some test yesterday with using this as an override on lots of xrefs and I had problems, only appear to apply to some objects… need to test it propperly.

I have an non-renderable object in the scene and when our scene manager sees that object, it puts the callback in “persistently” before submittal, then removes it. That way it says with the file when it goes to render, but the user never sees it, they just add a max object with a cute name…
On the self illuminating material thing… make sure you random at least 8 values apart so you can get a clean selection. Are you selecting in PhotoShop, AE or Combustion? My color random is for this is
( color (( random 2 25 )*10) (( random 2 25 )*10) (( random 2 25 )*10))
when the aliasing happens it can be hard to have a clean selection.
Of course randomizing it, you’ll occassionally get a green real close to another green on something you need a clean selection on, so it’s a rerender… but these should render super fast anyway…
good luck

I only use pure Red, Green and Blue for masks as with anything else you don’t get true antialiasing, sure this means sometimes u have to set up a few masks but as you say it doesn’t take very long to render.

Page 1 / 2