Posted by: | glavian | |
Data created: | 9 April 2010 |
Hi, I'm new to Max.Net and am evaluating it for our company's use. The problem we are seeing is in our IPlugin->Initialize function we want to just construct a WinForm and call Show(). The problem we see is that when I'm using an edit box in my form, the hot keys for max are still active. So when I try to type the character '8' Max pops up the Environment and Effects Dialog. What is your best recommendation for creating a seperate window app plug-in. We did solve the problem by using Application.Run(new Form()) in the Initialize function for the Plug-In but then the Initialize function never returns and we'll get an exception when Max is closed. I looked at the ViewWindow code and if that is your recommendation I have 2 questions on that. 1) CreateViewWindow takes an IntPtr hParent -> what should this hParent represent. 2) Plugin.Instance.MainFrame -> how do I get this object form the Plugin Initialize IGlobal parameter passed in? Thanks, keith | |
10 April 2010
#1735 | |
Hi Keith, Thanks for your interest in Max.NET. I have added a docs entry to explain how to deal with entering dialog text. If you have more questions about this I'd be happy to answer them.
You can just create a modeless dialog inside IPlugin.Initialize(...) and it will run on the same thread as the rest of 3dsmax. You can also create it using 3dsmax window as parent to make it always appear on top of it. Let me know if you need an example of that.
I would not recommend that. Application.Run(...) starts a new thread for message pumping and your whole form/app runs inside that thread. Naturally, unless you're very careful with thread synchronization you will have problems calling 3dsmax methods from another thread. This is why I recommend the method I wrote above.
hParent is the pointer to main 3dsmax window's or a 3dsmax viewport's HWND (native window handle). You can use it to make it parent of the form you create.
Plugin is a class only used for that sample which doesn't actually exist as part of the framework. Plugin is a basic class that implements IPlugin. Mainframe is a class derived from Form (I happened to call it that) and plugin contains a static instance of itself inside Instance property (its a singleton class). Let me know if you need more info on this. I hope this clears a few things up and I'm here to provide more help. Best regards, Marsel Khadiyev (Software Developer, EPHERE Inc.) |