Hello,
Iām learning C# and trying to open a maya scene using a maya path and file.ma using c#. Any ideas would be ace!
Thanks
Hello,
Iām learning C# and trying to open a maya scene using a maya path and file.ma using c#. Any ideas would be ace!
Thanks
I would say you can use ProcessStartInfo
with the path to your maya.exe to launch Maya
and should be able to pass in the filepath to your scene afaik
public Process Start(ProcessStartInfo startInfo, string filepath)
{
startInfo.FileName = filepath; // path to your file
startInfo.CreateNoWindow = false;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
return Process.Start(startInfo);
}
Obviously you might need some more stuff in there, but this is one way we do it for launching Houdini.
Hey Tool,
This is awesome start! Thanks
Hey Tool,
It worked! Your code pointed me in the right direction. Iām currently learning C# in Unity. This code will help me open source file data from selected game asset files in Unity.
Here is a part of the Unity C# code to share with the community:
public static System.Diagnostics.Process OpenMayaFileScene(string maya_file_path)
{
System.Diagnostics.ProcessStartInfo process = new System.Diagnostics.ProcessStartInfo();
process.FileName = maya_file_path; // path file to open within it's source app!
process.CreateNoWindow = false;
process.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
return System.Diagnostics.Process.Start(process); // Run to open file!
}
Thanks for your help.