Lightening plugin is loaded. But, it seems not working properly. CurrentTask returns -1

I’m working on own 3dsmaxbatch plugin based on Bobo’s version.
I can see Lightening plugin is loaded.
But, it seems it is not communicating with Deadline properly.
LogMessage doesn’t do anything.
CurrentTask returns -1.

It there somrthing I have to do in plugin Python file?
Some env var?
any clue?

My plugin does not depend on the Lightining.dlx - I based it on the 3dsmaxcmd which called the command line renderer of 3ds Max (the Backburner-based one). The Lightining.dlx is loaded and used by the 3dsmax plugin which uses a completely different mechanism for talking to the 3ds Max via the SDK.

Are you saying you took the 3dsmax plugin and started converting it into a 3dsmaxbatch plugin? It makes no sense, since the whole point of 3dsmaxbatch is to control 3ds Max via a Python or MAXScript passed via the command line. I am not sure the Lightining.dlx and 3dsmaxbatch can be mixed in a reasonable way.

@Bobo
The reason why I tried to use Lightening was to query the job info or set progress and log messages from the maxscript that I’m running.

Also I wanted re-use the current code that has tons of line which uses DeadlineUtil command.

I guess I need to make a DeadlineUtil struct and swap it.

Let me check your code.

The 3dsmax.py script populates the CurrentTask value in Lightning by calling

    self.MaxSocket.Send( "CurrentTask,%s" % self.Plugin.GetCurrentTaskId() )

(line 2446 in my version of 3dsmax.py)

So the Python integration script is responsible for settings the DeadlineUtils struct values. If you base your 3dsmaxbatch plugin on the 3dsmax instead of the 3dscmd plugin, you might be able to set all relevant values and access them from the MAXScript you are running. But you will have to reimplement it, and it is huge. I am not 100% sure it would be compatible and a good idea, but you are welcome to try.

In my version of the 3dsmaxbatch, I don’t have access to all job settings, only to the ones I have passed on as command line arguments (things like the StartFrame and EndFrame, the custom values and strings, etc.).

I assume the easiest way to query job setting is feeding jobinfo and plugininfo file as an argument of 3dsmaxbatch. I could build array of all settings. But, when I have a lot of data, it could exceed the command line limit,

You can try that. You probably don’t need all of them. Also, you could dump all of them to a temp. INI file from the 3dsmaxbatch.py integration script, and pass the path to that temp. file to the command line as a String Value. Then parse the INI content in your batch script.

I wonder if I should do that in my version of the plugin… :slight_smile:

Update: I’m dumping all items in plugininfo file as mxsString.
I still need to see if it is ok with many many many many items. But, All working good so far.

One question.

I don’t see a method to get all PluginInfoKeys so I can run GetPluginInfoEntryWithDefault on all items.

I considered to use data in for file. But, then if user change value in Deadline monitor. I would not be able to get the updated value.

As of now, I read plugin info file and get all keys and run GetPluginInfoEntryWithDefault for each keys.

    job = self.Plugin.GetJob()
    jobInfoKeys = job.GetJobInfoKeys()
    for i in jobInfoKeys:
        keyValue = self.Plugin.GetJobInfoEntry( str(i) )
        if keyValue != "":
            arguments += " -mxsString jobinfo_" + str(i) + ":\"" + keyValue + "\""

    pluginInfoKeys = job.GetJobPluginInfoKeys()
    for i in pluginInfoKeys:
        keyValue = self.Plugin.GetPluginInfoEntryWithDefault( str(i), "" )
        if keyValue != "":
            arguments += " -mxsString plugininfo_" + str(i) + ":\"" + keyValue + "\""

This grabs all JobInfo and PluginInfo keys from the actual Job, and dumps them as MXSString entries to the command line, each with a jobinfo_ or plugininfo prefix. So if you modify the job settings and re-render, the updated values will be used. No need to dump data during the submission…

GetJobInfoKeys !!! Why I missed this…

ok… I found a problem tho. Windows has character limit for command line, 8000 character-ish.
Even in batch file… so, I guess I need to dump to a new file.

Because it is a member of the Job and not the Plugin. You can read the values from the Plugin, but you need to get the list of names from the Job itself…