|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| Starting MotionBuilder from the command line with flags
|
|
|
Hello
Do exist any ways/workarounds to tell Motionbuilder to execute a python script given some parameters ?
Because, in the doc -F works for sceneFilePath OR scriptFilePath,
put I think linking to a scriptFilePath without anyway to give it some arguments is useless.
Right now, I managed to write some .py file at runtime in a temp folder with hardcoded behaviour.
If someone had a better idea, i’m all ears !
By the way, -console is no real batch mode, it still open the UI which I really regret.
|
|
|
|
There is nothing directly available in MotionBuilder to pass in parameters via the startup flags, only the full script name, so it either runs or doesn’t run, all or nothing.
-console isn’t suppose to be a batch mode, more just and output window to catch or display output in the OR SDK or Python SDK (if you set it up to output Python), sorry there is no headless MotionBuilder.
~Kristine
KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn
|
|
|
|
We had the issue as well here and we considered 2 workarounds:
1- Pass the arguments through the Environment Variables.
2- Pass the arguments through a file.
We chose #1. When we start MotionBuilder in C# using the Process class, we pass our arguments there like so: proc.StartInfo.EnvironmentVariables.Add("Param1", paramValue). So when MotionBuilder starts our script, we read os.getenv("Param1") or something like that.
If we had chosen #2, we would have written our args in a specific file, and read it back in our python script.
Not pretty, but it gets the job done.
-Oli
|
|
|
|
Thank you for those answers.
Another workaround, only available is the new 2012 versions is to launch motionBuilder and send him code via telnet-pipe.
import telnetlib
host = telnetlib.Telnet('127.0.0.1', 4242)
print(host.read_until('>>>', 5))
print(host.write(_commandAsString+'\n'))
print(host.read_until('>>>', 5)) host.close()
|
|
|
|
|
|