Overriding local mental ray settings for a pass

I was recently asked how an xsibatch script could override local mental ray settings for a pass (the user was using xsibatch -script to force certain settings before kicking off a render).

You just have to get Pass.Properties(“mental ray”).
That will give you either the shared renderer property, or the local one if the pass has a local copy.

p = Application.ActiveProject.ActiveScene.ActivePass
mr_prop = p.Properties("mental ray")

# a local mentalray property has one Owner
# a shared mentalray property is owned by the PassContainer (Passes)
# and the passes that don't have a local copy
if mr_prop.Owners.Count == 1:
	Application.LogMessage( "Local" )

# or you could check LocalProperties
if p.LocalProperties("mental ray") != None :
	Application.LogMessage( "Local" )