View Full Version : using maya api outside
caspermel 03-08-2007, 11:26 AM hi there;
I am just new to developing in maya. I have been searching for the flexibility of maya API and had some experience with plug-in writing in maya. What I am curious about is that whether it is allowed to use the maya api(the C++ part of it) outside maya? I want to be able to write a standalone application(that is not something like a plug-in that is to be loaded within maya) with some GUI (may be), and want to be able to make Maya the job (in the application I plan to use the maya api, to do all that staff)? Is such a thing possible? I plan to use C++ and have Maya 7.0.
Thanks in advance...
Any ideas will be appreciated...
Melis
|
|
JamesPiechota
03-08-2007, 11:57 PM
Check out the MLibrary class. You can access the Maya API from a standalone application - you don't, however, have access to any of the Maya UI.
caspermel
03-13-2007, 12:08 PM
Thanks James;
By not reaching Maya UI, do you mean that I cannot reach the render/animation view or some other staff like that?
Thanks again;
Melis
JamesPiechota
03-13-2007, 01:06 PM
Yep. When you run a standalone API application, the Maya GUI is not loaded - you don't have access to any of the views or editors. However you can still render and do pretty much anything you can do with the API that does not rely on Maya's graphical user interface.
Depending on what you want to do, it might also be worth checking out mayabatch (or 'maya -batch') - basically the same limitations as a standalone API application, but you use MEL instead of the C++ API.
Robert Bateman
03-13-2007, 01:28 PM
the only limitation to using MLibrary is that anyone then trying to run your app must have a valid maya license available.
caspermel
03-14-2007, 07:09 AM
hmm.. Actually what I wanted to do is to import a file into a standalone application, then do some manipulations on it (by the way do you know how to get the scene objects from the API, after that import action occured, anyway I better start a new thread for that :)) and to produce an .avi file just by using the Maya API and then viewing that (in media player or some other player). So not being able to use the Maya UI means I can not use the Maya's own viewers.
Thanks a lot for sharing the valuable knowledge :)
Melis
caspermel
05-09-2007, 12:52 PM
hi robert;
the only limitation to using MLibrary is that anyone then trying to run your app must have a valid maya license available.
does it mean that I cannot give out the maya dlls within my application, should there allways be a maya license?
Thanks,
Melis
Robert Bateman
05-09-2007, 01:06 PM
Not sure on whether giving the dll's out is legal or not, i assume not. either way, MLibrary will not initialise unless the PC on which it is running has a valid maya license.
caspermel
05-10-2007, 02:12 PM
hmm;
Thanks a lot Robert, the information has been very usefull for me :)
Melis
vishangshah
05-15-2007, 06:38 AM
Hi Robert
hmm.. Actually what I wanted to do is to import a file into a standalone application, then do some manipulations on it (by the way do you know how to get the scene objects from the API, after that import action occured, anyway I better start a new thread for that :)) and to produce an .avi file just by using the Maya API and then viewing that (in media player or some other player).
I have same goal,
is it possible to make a standalone application through which we can browse for a maya file, and playblast it without opening Maya GUI,
and then automate this process for any number of files,
:)
caspermel
05-15-2007, 06:52 AM
Hi,
Yes it seems to be possible, but still I couldnt reached my aim, use MFileIO class to open and save files. Dont know how to playblast the animation but I am sure that the mel commands will be helpfull in playblasting via the api, by the MGlobal::executeCommand.
The bad thing is there is not much documentation on API, except a few, like the one at,
robthebloke site. But still one of the best (may be the only one) to understand the maya scene concept.
Melis :)
vishangshah
05-15-2007, 07:45 AM
hi,
it seems that the first thing to be figured out is "How Maya does the Playblast",
I mean if its taking snapshots of current viewport frame by frame then it virtually looks impossible to do without opening GUI, unless we can find any other way,
Even if we make a standalone application , we will have to incorporate maya modelpanel for this kind of task,
correct me if I am wrong,
:)
Vishang Shah
caspermel
05-15-2007, 08:28 AM
yes you are right we cannot use the maya specific GUI tools to view the rendered animation/image via the api in a standalone application.
But there is the FCheck viewer that is used to view the image sequences produced by the maya api. May be it can help :)
Melis
vishangshah
05-15-2007, 10:01 AM
hi Melis,
FCheck will show only image sequences we have in our hard drive,
in order to see it , we will have to output those images in first hand,
the question is how we can access, what is visible in some maya viewport, without opening maya,
sounds weird, doesn't it?
any idea, Robert???
caspermel
05-15-2007, 10:38 AM
hmm,
the image sequences can be produced using the render.exe that allows to specify cameras,
start and end time of an animation and lots of other things.
But it seems though a bit long way, compared to doing that in maya GUI.
And also ı found out that the playblast mel command doesnt execute from the
stand alone appliation :(
Yes any ideas will be greatly appreciated :)
Melis
vishangshah
05-15-2007, 11:28 AM
hi,
if we go for standalone , then no need for using playblast command,
we can write a code for capturing loaded viewport area,
then only thing is to make a modelpanel in our application and load maya scene data into it,
and ya, one more thing will be timeline,
so i guess, it would be fast and feasible to write a MEL script which can open maya scenes one by one, do playblast , and then close it,
:lightbulb
:wise:
Vishang Shah
caspermel
05-15-2007, 12:48 PM
hi;
But the problem is how to have that modelpanel, isnt it? Since the Maya GUI and the window support provided by the mel is not availbale for a standalone application?
is there a way to have that modelpanel without having to open that large maya framework gui?
Thanks a lot for the comments
Melis :)
vishangshah
05-15-2007, 01:23 PM
I guess, we can get the modelpanel,
:rolleyes:
I am just guessing,
first of all we are binding our application to Maya API, and we have access to MEL commands through MLibrary,
and there are classes like M3DView,
so there must be a way to get the modelPanel,
because by accessing API , we can rebuild the whole Maya GUI from ground,
the only question is How can we do it? :curious:
?????????????????????
Robert Bateman
05-15-2007, 02:00 PM
there is no GUI available when using MLibrary end of story. Classes such as M3DView are related to maya's GUI, so they are not available when using MLibrary. The modelPanel mel command is part of Maya's gui. The command is not there when using MLibrary.
The only way to do this is to re-create the entire Maya GUI and rendering system from scratch - that or give up on the idea of a standalone app and make it a plugin for maya.
vishangshah
05-16-2007, 05:48 AM
hi Robert ,
thanks for making it clear,
but still I await the answer,,,
can we make playblast of a maya scene file without opening maya,
forget modelpanel and 3dViews,
can we access maya's internal database to fetch information through which we can make a preview file,
only you can answer,
thanks in advance,
cagebee
05-16-2007, 09:10 AM
hai guys,
i think we can get an answer if we know how exactly maya takes a playblast...does it capture frame by frame from the viewport or some other method..
i think if we can figure this out we can find a solution,,,
Someone who know has to answer ....maybe from autodesk ...?
if this can be done then it is a great help for animators... ( batch playblasting)
thanks
JamesPiechota
05-16-2007, 09:23 AM
Fairly certain 'playblast' requires the viewport to be open and visible.
Quick test: open a regular session of Maya, load a scene, playblast. While the playblast is running move another window over the viewport. The resulting playblast movie will not update after the point where the viewport is covered.
My suggestion: see if you can get what you want out of the hardware renderer.
krichter
05-17-2007, 05:58 PM
Hi,
Just wanted to add that I too am trying to figure out a solution to the playblast problem. We are trying to implement a way to send a playblast to the render farm, using just one proc, so our animators can continue to work while a playblast is running. While some kind of command line solution would be ideal, I'm having issues just getting an interactive maya to start up on a farm machine and do a playblast....
Karl
JamesPiechota
05-17-2007, 11:33 PM
Not sure what problems you're having, but here's one issue I've had when trying to automatically launch an interactive Maya using the -command flag to run a script: it can take a while for Maya to set itself up (load all the UI, register script jobs, etc...), and it may run the specified script before all this is done.
In my case it was enough to wrap the script in an evalDeferred statement. If this doesn't delay execution enough, though, something may be possible with scriptJobs (e.g. having an idleEvent script job check to see that everything is setup and only then launching the playblast or whatever)
CGTalk Moderation
05-17-2007, 11:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.