Backburner In maxscript - Need Advices

Hello there, I'm again looking for your help, i just finished the first version of my second script, and hope i can post it here in the future for all of you.

But first i've got a litle problem, with backburner. I'm Trying to use function to get control of the queue to submit a large amount of files. In fact, i have another option to use a batch with vray spawner, wich work perfectly but in case i want backburner to deal with it, i need it to work properly.

The problem is the control of the queue, i don't want to get it by force, and i want to promp the current queue controller and take it only of he / she let met (in fact probably "He")

Here's a quick view of my current code.

I choose to open each file and send it to backburner, to keep the current setting of the scene. but the script crash sometimes if i didn't get control,I think it's because of the #wait option but i need advice(s), i hope you guys can tell me more about backbuner in maxscript, cause i don't get it.

Thank's in advance for your help.

Big up to barigazy, if you read this, you supported me last time i needed help here, and i can't stop Max-scripting since then :)

on LR_btn_bckbrnr pressed do
(
mymanager = NetRender.GetManager()
--Connect To Manager using defaut mask
mymanager.connect #automatic "255.255.255.0"
 
if mymanager.connected == true then
  (
  print "Connected To Manager"
  LR_lbl_batchscenes.text = "Waiting Manager..."	
 
    if mymanager.QueryControl #dontwait == true then
    (
      print "I Have Control"
      mymanager.GetControl()
      print mymanager.haveControl
    )
    else
    (
      if mymanager.QueryControl #wait == true then
      (
        print "Control Granted by Current Queue Controller"
        mymanager.GetControl()
      )
      else
      (
        messagebox "Current Queue Controller didn't let you get control the Manager" title:"Layers_Render - Backburner"
      )
    )
 
    if mymanager.haveControl == true then
    (
    LR_lbl_batchscenes.text = "Controlling Manager"
    --Disallow other users to get controll until I want them to.
    mymanager.GetControl()
    mymanager.Lock true
    print "I Have Control, and nobody can take it From me"
 
    LR_pb_render.value = 0
    --Get The List To Process
    local GotoRendernames = Myfn.bitarray2stringarray LR_mlb_render
    local theBITS = LR_mlb_render.selection
    local numberselected = theBITS as array;
    local GotoRenderFull = #()
 
    for i = 1 to numberselected.count do
    (
    GotoRenderFull [i] = (Thepathtosave + "\\" +  (GotoRendernames [i]) + ".max")
    )
    if GotoRenderFull.count > 0 do
    (
    LR_lbl_batchscenes.text = "Sending to Manager..."
    for i = 1 to numberselected.count do
      (
        loadMaxFile (GotoRenderFull[i] as string) quiet:true
        thejob = mymanager.newjob()
	thejob.name = ("CLST_LAYERS_" + GotoRendernames[i] as string)
	thejob.suspended = false
	if rendTimeType == 1 then
	(
	  thejob.fromFrame = 0
	  thejob.toFrame = 0
	)
	thejob.useAllServers = true
	thejob.skipRenderedFrames = true
	thejob.submit()
	--
	mymanager.SetUpdates true
	LR_pb_render.value = (100 / numberselected.count) * i						
      )
    LR_lbl_batchscenes.text = "All Scene Sent"
    messagebox ("All files have been sent to Manager") title:"Layers_Render - Backburner"
    )
    )
  mymanager.Lock false
  mymanager.Disconnect ()
  )
  else
  (
  messagebox "Couldn't Connect To Manager" title:"Layers_Render - Backburner"
  )
)

Comments

Comment viewing options

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

I wrote a Backburner script

I wrote a Backburner script recently and it really looks like the Backburner MAXScript API in general and the queue control part in particular is buggy. Not reliable at all and simply not working as described in the docs. One workaround I found was to ask for queue control twice, so you do a #dontwait first and a #wait afterwards and check the result of the second.

But in the end I switched to a GUI automation completely, as described here:
http://forums.cgsociety.org/showthread.php?f=98&s=9f6abfed0537ff7aa7a752...

There is an updated version of the script on the second page of the thread. Works really well for me and lets you add dependent jobs as well, which is not possible using the API.

Never get low & slow & out of ideas

Comment viewing options

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