Notifications
Clear all

[Closed] #preRender isNetRender

How do I set the isNetRender flag/option/condition of the preRender Callbacks.addscript?

From the Help:

[left][b][b]#preRender: Array [/b][/b]
  [/left]
   [left]Sent  before rendering is started. This notification is sent out before the renderer  creates the render instance objects, which means that you can create nodes and  other objects as a response to this event. When rendering multiple frames, this  event is sent only once at the beginning of the rendering phase, and not on a  per-frame basis. In the [b][b]#preRender[/b][/b] callback, you can't  change any of the render parameters (height, width, aliasing, etc) and  affect the current render sessions. Those parameters have already been set  up internally in [b][b]3ds  Max[/b][/b], and  so changes to them won't occur until the next render session occurs.
  [/left]
   [left]Returns  a 28 element array - see the SDK help file, class RendParams, for more  information on the parameter definitions.
  [/left]
   [left]1 - Name  - rpar->rendType
  [/left]
   [left]2 -  Boolean - rpar->isNetRender
  [/left]
   [left]3 -  Boolean - rpar->fieldRender
  [/left]
   [left]4 -  Integer - rpar->fieldOrder
  [/left]
   [left]5 - Time  - rpar->frameDur
  [/left]
   [left]6 -  Boolean - rpar->colorCheck
  [/left]
   [left]7 -  Integer - rpar->vidCorrectMethod
  [/left]
   [left]8 -  Integer - rpar->ntscPAL
  [/left]
   [left]9 -  Boolean - rpar->superBlack
  [/left]
   [left]10 -  Integer - rpar->sbThresh
  [/left]
   [left]11 -  Boolean - rpar->rendHidden
  [/left]
   [left]12 -  Boolean - rpar->force2Side
  [/left]
   [left]13 -  Boolean - rpar->inMtlEdit
  [/left]
   [left]14 -  Float - rpar->mtlEditTile
  [/left]
   [left]15 -  Boolean - rpar->mtlEditAA
  [/left]
   [left]16 -  Boolean - rpar->multiThread
  [/left]
   [left]17 -  Boolean - rpar->useEnvironAlpha
  [/left]
   [left]18 -  Boolean - rpar->dontAntialiasBG
  [/left]
   [left]19 -  Boolean - rpar->useDisplacement
  [/left]
   [left]20 -  Boolean - rpar->useRadiosity
  [/left]
   [left]21 -  Boolean - rpar->computeRadiosity
  [/left]
   [left]22 -  TextureMap - rpar->envMap
  [/left]
   [left]23 -  Time - rpar->firstFrame
  [/left]
   [left]24 -  Integer - rpar->scanBandHeight
  [/left]
   [left]25 -  Integer - rpar->extraFlags
  [/left]
   [left]26 -  Point2 - rpar->width, rpar->height
  [/left]
   [left]27 -  Boolean - rpar->filterBG
  [/left]
   [left]28 -  Boolean - rpar->alphaOutOnAdditive
  [/left]
  

Having Scene Explorers open when netRendering to nodes running BB as a service, crash on opening the scene.

My Script:

fn closeAllSceneExplorers = 
(
	for i = 1 to SceneExplorerManager.GetExplorerCount() do
	(
		theName = SceneExplorerManager.GetExplorerName i
		SceneExplorerManager.CloseExplorer theName
	)
	
)

fn openAllSceneExplorers = 
(
	for i = 1 to SceneExplorerManager.GetExplorerCount() do
	(
		theName = SceneExplorerManager.GetExplorerName i
		SceneExplorerManager.OpenExplorer theName
	)
)

callbacks.addscript #preRender  "closeAllSceneExplorers()"
callbacks.addscript #postRender "openAllSceneExplorers()"
callbacks.addscript #preSystemShutdown "closeAllSceneExplorers()"
8 Replies

you can’t set that value, but I don’t think that’s what you need anyway.

If you just want your callbacks to only run if the machine’s -not- performing a network render, use:


if (not IsNetServer()) do ( ... )

Thanks for the reply ZeBoxx. And thank you for your overall presence here in the community. Like so many others, I learn so much from your public discussions and solutions and problem solving sessions with the likes of Lone Robot, Bobo, Paul Neal, and a few other frequenters I can’t think of at the moment. One of my powerball lottery fantasies is to put all of you guys together in a sort of 3ds Think Tank just to see what would come of your colaborative, unlimited R&D… ok, enough day dreaming…

I’m trying to close any scene explorer windows on net render. If we leave them open the job fails on every node that runs bb as a service. which is 99% of our farm.

The prerender callback works for local renders but not for submission to BB. Because this is not really rendering I suppose. Using PreSave works because the scene is saved before submitting to BB. But this will also fire off on Holds and Autosaves.

We will submit this issue to Autodesk but who knows if/when they’ll patch it. I don’t even know if anyone else uses BB as a service as much as we do. Every employee workstation with 2GB RAM or more is added to the farm when they log off or reboot.

Any thoughts or hints would be much appreciated.

to prevent hold/autosave triggers, check the callbacks.notificationparams() result in the #filePreSaveProcess callback:


 General Event Callback Mechanism[left]Calling  [b][b]callbacks.notificationParam()[/b][/b] returns a 2 element  array:
 [/left]
  [left]Element 1 is 
 [/left]
  [left]1 if  doing a normal file save,  
 [/left]
  [left]2 if  doing an Edit>Hold
 [/left]
  [left]3 if  doing an Autobackup
 [/left]
  [left]Element 2 is the scene file name being saved.
 [/left]

closing them when launching a network render is, sadly, more difficult as there’s no callback for that – and leaving a dialog monitor running in the background to wait for the network render submission dialog is bad news as the monitor tends to interfere with use sometimes.
Have you determined whether files actually crash on load when network rendering, or after? i.e. perhaps you could auto-close them when the file is loaded in #filePostOpen ?

I saw that in the help but I don’t understand how to implement it. There is a similar array for #prerender notifications;

2 -  Boolean - rpar->isNetRender

but again, I don’t know what to do with it.

Do I put the IF/DO in my functions or in the callbacks line somehow?

sorry, I’m a struggling noob here. I’ll experitment and see if I can come up with a solution or at least more intelligent questions.

Have you determined whether files actually crash on load when network rendering, or after?

I’m pretty sure it is a crash on load because of the very short time it takes for each node to post an error. I’ll check the logs.

it’d be something like…

callbacks.addscript #filePreSaveProcess "savetype = (callbacks.notificationParam())[1]; if (saveType == 1) do  ( close-explorer-windows )" id:#yourcallbackID

The array’s provided by callbacks are read-only, AFAIK, so you can’t set them. The only thing you could do is read that, but if it is crashing before it gets to the render stage it really isn’t going to help.

You need to figure out where and why it is crashing. What version of Max and do you have all the service packs and hotfixes installed?

-Eric

If we close the Scene Explorer and netrender, everything is fine. The user account that runs the service does not have a desktop. It is similar to a System account, active in the background only while real users are logged off. This way the BB service is started when people log off and stopped when they log on. We have four offices around the U.S. with many people/potential render nodes in each office. The deployment/management has to be pretty streamlined.

We are using 2009 Design, SP1, all hotfixes on our workstations. But maybe not on the farm machines. I know the deployment includes SP1 but not the two most recent hotfixes. I don’t think the deployment app allows you to include the hotfixes. I’ll experiment with that. But I don’t remember seeing this issue listed in any of the hotfixes. anyway.

This is my meager attempt:

(callbacks.addscript #filePreSave case of 
   		(callbacks.notificationParam == 1): "closeAllSceneExplorers()"
   		(callbacks.notificationParam == 2): "()"
   		(callbacks.notificationParam == 3): "()"
   	)

But I know this will also return the Hold or AutoSave Path/Filename too… Would I just check the first element of the array?

callbacks.notificationParam[1] == 1

correct – you’ll want to check the first element of the array it returns only.