| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
Possibility of Using the Microsoft Foundation Classes in Utility Plug-Ins Plug-ins are usually developed using the Microsoft Windows Win32 API. But with utility plug-ins you can use the Microsoft Foundation Class as well. The Microsoft Foundation Class Library is an "application framework" for programming in Microsoft Windows. The MFC framework is a powerful approach that lets you build upon the work of expert programmers for Windows. As far as I know, utility plug-ins are the only plug-in type where MFC can be used. To download a skeleton utility that uses MFC, have a look at the Discreet web site: http://www.ktx.com/mfc. Advantages of Using MFC MFC shortens development time, provides tremendous support without reducing programming freedom and flexibility, and gives its user easy access to "hard to program" user-interface elements and technologies. MFC makes it easy to program features like property sheets ("tab dialogs"), print preview, and floating, customizable toolbars. If you use the Microsoft Visual C++ compiler, MFI is fully integrated with the development environment interface. For example: you have the MFC ClassWizard which helps you to map messages and controls from your dialog boxes; since version 6.0 of Microsoft Visual C++, it automatically shows the member functions of the class while typing. This is not possible when using the Win32 API because a lot of functions use a window handle (HWND) and global functions to deal with your dialog boxes controls. This means, for example, that there is no class regrouping all functions of the list boxes or combo boxes - while in MFC, you have the CListBox and CComboBox classes. For example, when you want to empty a list box using the Win32 API, you have to use the following function: SendMessage(
You have to know the HWND of your list box. And messages processing is a burden to use. In MFC, you just have to do : ClistBox
MyListBox; // list box that has
been mapped Moreover, a strong advantage of MFC over the Win32 API is that you can download a lot of complete MFC projects with source code. So you rarely start from scratch when you have to do, for instance, a treeview with the drag and drop functionalities enabled. Have a look at the following web site to download some examples of MFC projects: http://codeguru.com . This web site has everything you need to use MFC; I managed to save a couple of weeks using existing code. Drawbacks of Using MFC You should probably know before choosing to use the MFC inside 3D Studio Max that you won't be getting any support from Discreet. MFC is not officially supported, so you have to use it at your own risk. This will be a concern with pure MFC problems and problems with integration of MFC inside 3D Studio Max. Here are some of the strange problems you may encounter when combining the two: Most of
the problems met when using MFC are 3D Studio Max functions from the
kernel that don't work. For example, when using release 3 or later,
if you want to have customizable keyboard shortcuts for your plug-in
(which are very useful), you need to call the functions ActivateShortCutTable
and DeactivateShortcutTable as follows: //Create
an instance of this class And DeactivateShortcutTable
crashes each time you call it when using MFC, while it works fine when
you use just the Win32 API. So there are issues with using MFC, but to date I have always been able to solve the problems that I've run into when using MFC. Conclusions Let's wrap this up. A modifier is a plug-in made to modify objects in some way and that benefits from the geometry pipeline, while a utility is a plug-in that is useful for implementing modal procedures but is not designed (in theory) to modify objects. In my
opinion, modifiers should be used when you can't develop a utility,
because utility plug-ins are simpler to develop. A utility should be
developed to:
So knowing the constraints and the specifications of the tool that you have to develop, you should now be able to choose wisely between the two types of plug-in, as well as the Microsoft Foundation Classes. And remember: programming in 3D Studio Max, your code might not always look nice, not when you have to make things work in any way you can, but you usually can make things work. Acknowledgments and References Thanks to Jurie Horneman for his help in writing this article. Further
information about this topic can be found at:
_________________________________________________ |
|
|