/*************************************************************************** * * * 3DS Max Test Plugin * * * *************************************************************************** * * * Version : 1.0ß, March 11th, 1998 * * * * Written By Loic Baumann from Fatal Design, specially for Gamasutra * * * *************************************************************************** * * * This Plugin demonstrates how to write a simple 3DS MAX Plugin, using MFCs * * * ***************************************************************************/ #include "stdafx.h" #ifdef STRICT // Already defined by stdafx, #undef STRICT // so we avoid warning linking msg #endif #ifdef _MBCS // The same as above #undef _MBCS #endif #include "JointPrefrence.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif JointPreferencePanel g_jointPreferencePanel; //////////////////////////////////////////////////////////////////////////////// // JointPrefrencePanel Dialog Procedure to handle User and System Interactions static BOOL CALLBACK JointPrefPanelProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); switch (msg) { case WM_INITDIALOG: //Panel's extra initialization g_jointPreferencePanel.Init(hWnd); break; case WM_DESTROY: //Panel's extra destruction g_jointPreferencePanel.Destroy(hWnd); break; case WM_COMMAND : switch (LOWORD(wParam)) { //Handle Panel's controls case IDC_ABOUT: { CAbout dlg; dlg.DoModal(); break; } case IDC_EDIT_JOINT: { g_jointPreferencePanel.EditPrefs(); break; } case IDC_DELETE_ALL: { g_jointPreferencePanel.DeletePrefs(); break; } } break; //////////////////////////////////////////////////////////////////////// //The following lines are not necessary for MAX2 Plugins case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: g_jointPreferencePanel.m_ip->RollupMouseMessage(hWnd, msg, wParam, lParam); break; //////////////////////////////////////////////////////////////////////// default: return FALSE; } return TRUE; } //////////////////////////////////////////////////////////////////////////////// // Display the Plugin's Panel void JointPreferencePanel::BeginEditParams(Interface* ip, IUtil* iu) { m_ip = ip; //Get the Plugin's Interface m_iu = iu; //Get the Utility Plugin's Interface //Display the plugin's Rollup Dialog AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE loc_hInstance = AfxGetResourceHandle (); m_hPanel = ip->AddRollupPage(loc_hInstance, MAKEINTRESOURCE(IDD_JOINT_PREF_PANEL), JointPrefPanelProc, GetString(IDS_JOINTPREF_NAME),0); } //////////////////////////////////////////////////////////////////////////////// // Free the Plugins' Panel void JointPreferencePanel::EndEditParams(Interface *ip, IUtil *iu) { m_iu = NULL; m_ip = NULL; //Remove the Rollup Dialog ip->DeleteRollupPage(m_hPanel); m_hPanel = NULL; } //////////////////////////////////////////////////////////////////////////////// // Panel Initialization callback void JointPreferencePanel::Init(HWND hWnd) { } //////////////////////////////////////////////////////////////////////////////// // Panel Destruction callback void JointPreferencePanel::Destroy(HWND hWnd) { } //////////////////////////////////////////////////////////////////////////////// // Called when the Pick Button is pushed void JointPreferencePanel::EditPrefs() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE loc_hInstance = AfxGetResourceHandle (); JointEditDialog dialog(g_jointPreferencePanel.m_ip->GetRootNode(), m_ip); dialog.DoModal(); } //////////////////////////////////////////////////////////////////////////////// // Called when the delete Button is pushed void JointPreferencePanel::DeletePrefs() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE loc_hInstance = AfxGetResourceHandle (); if (::MessageBox(m_hPanel, "DELETE ALL MW4 Prefrences?", "Are you sure?", MB_OKCANCEL) == IDOK) { JointEditDialog::DeleteAllJointPrefrence(g_jointPreferencePanel.m_ip->GetRootNode()); } }