[Closed] Maxsdk treeview control
Hi all,
I’m looking into writing a procedural texture map plugin and I need to use a treeview control. However I’m kind of at a loss as to how to implement this. Can someone point me in the right direction or show me how something like this can be done. Is this something that can be done using a .net plugin. It’s been quite a while since I’ve messed with the SDK so I’m a little rusty.
Thanks
you will have a lot of problems later if you will use .net treeview in a plugin’s ui
Hi Dave,
Thanks for the response. I guess I’m still unclear if it’s possible to use a dotnet treeview outside of a scripted plugin. As far as I can tell the only way to make a scripted plugin for a texture plugin is to extend an existing texture plugin. I have examples of texture plugins using a treeview so I know it’s possible. I’ve searched the SDK examples for a plugin using a control other then the custom controls in the SDK but haven’t found any. I kind of assumed it would have to be a WinAPI control to work in a .dlt plugin. Maybe I’m way off. An example would be a huge help.
It’s the same implementation of any other win32 api control in a window. theres no parameter block linkage so you’ll have to manage that your self. For examples look for some other win32 api resourses. The windows dev has all the reference and some examples.
Thanks Klvnk I kind of figured that was the case. Looks like the TreeViewUtil in the sdk samples actually does this, using a List Control in a Utility plugin though. I’ll see if I can muddle my way through.
the other thing you can do is prototype the Treeview in a standalone win32 project. Means you can develop the core coding quicker without having to start max up for every minor code change as you learn.
Thanks for the advice Klvnk. I was able to incorportate a pretty fully functional treeview Dialog Proc into my plugin and run. I’m still not clear how to hook it to the Material editor window (hwMtlEdit) however. I assume it’s through ParamMap2UserDlgProc. Is this correct?
This is from the Checker Procedural map sample.
class CheckerDlgProc : public ParamMap2UserDlgProc {
//public ParamMapUserDlgProc {
public:
Checker *check;
CheckerDlgProc(Checker *m) {check = m;}
INT_PTR DlgProc(TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
void DeleteThis() {delete this;}
void SetThing(ReferenceTarget *m) {
check = (Checker*)m;
// ReloadDialog();
}
};
INT_PTR CheckerDlgProc:DlgProc(
TimeValue t,IParamMap2 *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch (msg) {
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_CHECK_SWAP:
{
check->SwapInputs();
}
}
break;
}
return FALSE;
}
you’ll need a param block definition (which has the dialog resource ID) then you “attach” the dialog proc to paramblock in the CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) function passing this in the constructor. You can then add paramblock getters and setters to the base class (which holds the IParamBlock2 ptr ) That way the dialog proc can change the paramblock directly see check->SwapInputs(); in the checker example.
Success. I got the treeview working. Now to see if I can get it to do something useful.
Thanks again for your help Klvnk, hopefully I’m good for awhile. Some of this is starting to make a little sense again.