3dsmaxbatch with Quiet Mode disabled vs. 3dsmax.exe with customer parameters and exporting Listener Log



I have 2 questions regarding running 3DS Max from the command line:

  1. Is there a way to have 3dsmaxbatch.exe run a script with Quiet Mode disabled?
  2. If running my Python script through 3dsmax.exe, are there ways for me to pass in customized parameters, as well as redirecting the outputs from the Listener Log and System Log?

Here’s the context of what I’m trying to do:

I am working on automating parts of the 3DS Max art asset pipeline, which involves my Python script parsing some text files and calling a function from a MaxScript written by another technical artist.

After first, I launched the Python script with 3dsmaxbatch.exe, which worked fine enough at first:
3dsmaxbatch.exe .\maxBatchTest_exportFunc.py -listenerlog <custom_listener_log > -v 5 -log <custom_sys_log> -mxsString someParam1:<my_parama_1> -mxsString someParam2:<my_parama_2>

However, recently I noticed that the same script might run with different results based on how I launch 3DS Max to run my Python script.

To sum things up, running my Python script with 3dsmaxbatch.exe or 3dsmax.exe in Quiet mode (with “-silent”) will skip certain error checking function which would have run if the same script is ran with standard 3dsmax.exe or within 3ds Max’s “Scripts > Run Script…”.

As a unit test, if maxBatchTest_exportFunc.py is:

import MaxPlus
import sys, os
def main():
    strMaxCmd = "OurFileExportFunc(\"Q:/some/known/source_max_file.max\")(#some_flag)(\"N:/\")"

    r = MaxPlus.FPValue()
    bOK = None
    bOK = MaxPlus.Core.EvalMAXScript( strMaxCmd, r)
    print "[{0}] Type: {1} ==> {2}".format( bOK, r.Type, r.Get() )

if __name__ == '__main__':

Running this script through these commands:

3dsmaxbatch.exe maxBatchTest_exportFunc.py -listenerlog .\maxBatchTest_exportFunc_Listener.log
3dsmax.exe -u PythonHost maxBatchTest_exportFunc.py -silent

… will have results different from:
3dsmax.exe -u PythonHost maxBatchTest_exportFunc.py

For either case, r is of Type 8 (String), and its content will include the result of the function, including its success and fail status. It’s from this that we notice that the former will run to completion as with a success status, while the other will fail due to error check routines.

This could be something on the Maxscript side. The TA who wrote the Maxscript mentioned that his script’s error checking routine uses values from certain dialogs and UI. Quiet mode suppresses UI elements, and 3dsmaxbatch’s purpose is more on running batch job and less for UI interaction, so not having access to certain UI components might affect those routines.

However, before I get into a deeper discussion of how the Maxscript works, I also want to get those 2 questions out there to have a better understanding on how we can tackle this.

Thank you and stay well.

[Edit: 2020/6/24]
It appears that this issue stems from loadMaxFile behaving differently based on whether it’s being called with Quiet mode or not. I have a unit test setup such that:

  1. A maxscript with a UnitTest class that wraps a call to loadMaxFile
  2. A Python script that initiates a UnitTest instance, and calls the wrapper load function through pymxs
    unitLoadMaxFileFunc.ms (985 Bytes)
    maxBatchTest_Load.py (2.5 KB)

In the event where maxBatchTest_Load.py attempts to open a file with missing references (with strLoadMaxFile), running the Python script with standard 3dsmax.exe will detect the missing files, while 3dsmax.exe in Quiet mode and 3dsmaxbatch.exe will not show the missing files.

Right now, it just seems that 3dsmaxbatch.exe don’t play nice with loadMaxFile. Yet we do want to be informed of missing files if there is any. If we have to run the Python script with 3dsmax.exe, will it be better if we adopt a server/client model instead, where the 3dsMax runs a server that runs loadMaxFile based on data it received through a TCP socket? What will be the best way to implement such a model?