View Full Version : MayaApi: Which header file?
01-23-2006, 06:34 PM
In the maya api documentiation there is a listing of all the classes; is there any way to know which class belong to which header file?
thanks in advance
01-23-2006, 07:26 PM
I think the header files in the Include\Maya directory all have names exactly corresponding to the classes, but I might have missed something.
01-23-2006, 08:46 PM
well say for example the MVector or the Mpoint, how do i know for sure they belong to the MFnMesh header file...
ok I am lazy to open every header file and check it, there MUST be some other easy way to find that out....
01-23-2006, 09:33 PM
Oh, you mean MVector and Mpoint header files are included in the MFnMesh header file. Well I'm guessing they need to be because MFnMesh takes them as input in some of its member functions. I'm not very API savvy really but I don't think you need to worry about that. I've never even thought about double inclusions, I just go by the rule that if I use a class I make sure I include its header file. That's worked fine for me so far. If it causes any inefficiency it will afaik only affect compilation time - not runtime, and since maya plugins usually take about 2 seconds to compile it's not a problem. But like I said - I'm pretty illiterate with c++ so if I'm wrong I'll be glad to be corrected.
01-23-2006, 09:53 PM
but that precisely my point.... how does one know which class belongs to which header?
There isnt a good documentation on that in the alias docs...
01-24-2006, 11:12 AM
i don't think there is a way to find out which files are included in which classes. but for your programming:
if you use "#pragma once" above your includes your compiler will know that he should load the header-files only once, although they might be included several times ...
you only include those classes which you use in your project not the classes the used classes use ... so if MFnMesh uses MVector but you don't need to work with MVectors, you don't have to care about/include them.
maybe that helps
01-24-2006, 06:44 PM
That certainly cleared things up for me. Thanks Starrider.
01-24-2006, 06:49 PM
ah thats a good idea, but if someone from alias is reading this probably it would help to include a simple line in the documentation that says "this is the header for this class"... doesnt hurt anyone instead helps programmers and makes the plugin efficient.
01-24-2006, 07:41 PM
You can't use e.g. MVectors without having included them although you included MFnMesh (which might include MVector) ...
You HAVE to include every class YOU want to use - no matter if this class is already in use by another class which you use!
01-25-2006, 12:44 AM
My experience is that every API class that I have used has been declared in Maya/MClassName. I haven't done mesh stuff in a while, so I forget whether or not MPoint or MVector have their own header (Maya/MVector.h, Maya/MPoint.h), but for everything else, Maya's bases seem to covered.
Though I agree that it'd be nice to have a line in the doc that says which header you can find stuff, even if it is redundant information. Never hurts to be explicit.
01-25-2006, 12:44 AM
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-2014, Jelsoft Enterprises Ltd.