Python + MXS


#201

Thought I post a Backburner hack and some telnet info for those still struggling to network render with backburner… ( Like us… Uhhggg… )

I've written a Python command line utility to set Dependencies in BackBurner after submission.  To use it, the network folder on the manager needs to have a full control share open to the artists box.    Python connects to the manager via Telnet.  Archives the job and then makes specific changes to the xml document on the server.    Upon unarchiving the job, backburner reads the changed xml data and applies the changes.  

I couldn’t find a way to send the “Update Job” to BB via telnet, it appears to be binary, while every other command is xml… ?

Syntax for usage.
BBSetDependency <Ip Address> <Port> <Dependent Job Name> <Depends on Job Name> {<Depends on Job Name> ...}

Also including in the zip is a txt document outlining some of the other telnet commands I found while sniffing the connection between BB and the monitor.

Much thanks to David Mackenzie < specxor > for PyBurner, my starting point for this!

#202

finally! thanks heaps for this awesom share. The inablity to set backburner dependencies via mxs has been holding us back for too long! I’ll be checking this out asap.


#203

What I really miss in pyburner is func for submitting new job to backburner. I tried do do that on my own.
I’ve intercepted data sent to backburner while submitting job. This seems to be simple xml. When I send this data using telnet connection nothing happens. By nothing I mean job doesn’t appear in queue.

tn = telnetlib.Telnet("bbmanager", 3234)
    print tn.read_until("backburner>", WAIT_TIME)
    tn.write("new job 4692")
    f = open("S:/sent.txt","rt")
    try:
    	for line in f:
    		print line
    		tn.write(line)		
    finally:
    	f.close()
    	
    print tn.read_until("backburner>", WAIT_TIME)

sent.txt contains data from intercepted packets. I think this is right way to do it but I’m probably missing something. Do you have any ideas how to solve this problem?


#204

I don’t know what protocol Backburner uses for sure, but I doubt it’s Telnet.

If the packets you’re snagging always contain XML, it’s more likely xmlrpc or a custom protocol. Have a look at the xmlrpclib module in the Python standard library.


#205

Lechoo: Have you tried sending the whole XML vs. sending line by line… I don’t think telnet likes that…


HELP! Having an issue with the blurPython.dlx?

I just DL’d the BlurBeta, installed for max9 , copied the dlx in and it’s not working as the original.
Has the class name been changed?
Could it be because I’m in 32bit max 9 but on XP64?

Thanks


#206

I’ve tried both. None of them works.


#207

Hi,

we have two solution for communication with backburner

with telnet, u can try in command line for know command

with simple tcpip protocol, like a simple client

i use it for create a new monitor, with pyqt

an other solution is to warp 3dsmax lib from sdk for “net communication”, i think more simple, but i don"t try it

Kermit

edit : i forget, i use ethereal for snif communication between manager and standart monitor


#208

Lechoo;
I’ve tried a few different things to create a job, but didn’t see that much use as you can create any job BB will render through cmdjob.exe or 3dsmaxcmd.exe…


#209

I need to submit non-3dsmax job from non-windows machine and in this case cmdjob.exe or 3dsmaxcmd.exe can’t be used.


#210

Well, I’ve got a start going in learning some python by using a slight modification of the Lazy Evaluation Directory Treeview sample found on the wxPyWiki. combined with the ThumbnailCtrlfrom Andrea Gavana. And its blazing fast compared to what i’ve seen in maxscript and dotnet so far in terms of thumbnail generation from even very large images and directory structures.!

thought that this might be of interest since I know there’s a couple other guys on here in the ‘asset/prop’ experimenting mode currently. nothing quite finished enough for release though yet…


#211

Hi!
if u mean pressing “Register” button in COM/DCOM Server Control Utility - I did so.But i get:

File “C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py”, line 309, in RunScript
debugger.run(codeObject, main.dict, start_stepping=0)
File “C:\Python25\Lib\site-packages\pythonwin\pywin\debugger_init_.py”, line 60, in run
GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File “C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\debugger.py”, line 624, in run
exec cmd in globals, locals
File “C:\Python25\Script1.py”, line 2, in <module>
conn = win32com.client.Dispatch(“MAX.Application.8”)
File "C:\Python25\Lib\site-packages\win32com\client_init
.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File “C:\Python25\Lib\site-packages\win32com\client\dynamic.py”, line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File “C:\Python25\Lib\site-packages\win32com\client\dynamic.py”, line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, ‘Invalid class string’, None, None)

again and again…what am i supposed to do?


#212

Yeah, you need to register Max with COM, that error means Windows doesn’t know about it.

Try this. Start Max then run the attached MaxScript. It should add the necessary info to registry. Then try to do your Dispatch again and see what happens.


#213

Thank u very much!:slight_smile: everything it’s ok right now:)


#214

Sure thing. I also added the code from that script to registerPythonCom.ms in my sample files from my GDC talk.

If anyone was having problems getting my COM samples to work before, grab the updated ZIP and give it a go.


#215

I’ve added some functions to my BackBurner Class and made it directly available in 3dsmax via a COM connection… Though I’d post the latest since there’s a few posts about BB control on the forum currently…

   Just unzip in 
   &lt;max&gt;\\plugins\\Scripted Global Functions\\
   
   There will be a command window flash when Max starts and then in maxScript there should be a global structure PythonLib with a backburner property.
   
   PythonLib.BackBurner.GetJobList &lt;manager name&gt; &lt;manager port&gt; 
   
   Should list ALL the jobs on that manager.
   
   More functions coming soon !
 
 Edit1: Sorry About that typo... New zip...

#216

Kramsurfer it is giving me errors in 2009 (x64 and x86):

– Error occurred in anonymous codeblock; filename: C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms; position: 237
– Frame:
– pythonModualsStruct: StructDef:pythonModualsStruct
– Error occurred during fileIn in <File:C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms>
>> MAXScript Auto-load Script Error - C:\Program Files\Autodesk\3ds Max 2009\PlugIns\Script Global Functions\PythonLib_BackBurner.ms Exception: – Runtime error: createOLEObject: can’t find server PythonLib.BackBurner <<
-Eric

Edit: the path according to the script is plugins\Global Scripted Functions\, not \Plugins\Script Global Functions\ as documented. You may want to update that. Still errors do to the spaces in the paths, I believe.

EDIT2: I modified the script to get rid of the error change the doscommand line to:

dosCommand ( “”"+( getDir #maxRoot ) +“plugins\Script Global Functions\PythonLib_BackBurner.py”")


#217

Here is a modified PythonLib_Backburner.ms, that won’t flash the dos window:

(
struct pythonModualsStruct ( BackBurner )
hiddendosCommand ( "\""+( getDir #maxRoot ) +"plugins/Script Global Functions/PythonLib_BackBurner.py\"") startpath:"c:/"
global PythonLib = ( pythonModualsStruct BackBurner:(createOLEObject("PythonLib.BackBurner")) )	
)

-Eric


#218

For some reason all .GetJobList returns is “Sorting JobList”. No jobs are returned, eventhough I have 5 in the queue.

-Eric


#219

Always an issue when you try to quickly tear a piece of something out of a bigger construct!

 Updated PythonLib.BackBurner

#220

Thanks for the update, but the joblist output really isn’t helpful:

0FEF27CE Complete Autodesk 3ds Max 2009 (32-bit
On top of that it is returning a multi-line string, rather than something useful.

-Eric