您的位置:首页 > 其它

3dsmax模型导出插件调试技巧

2011-06-13 13:26 417 查看
以前调试3dsmax的模型导出插件总是很头疼,因为3dsmax的插件是在启动的时候加载进去,在运行中是无法卸载的,这样每一次修改都得重启3dsmax,而且3dsmax的启动时间还特别长,很是郁闷.昨天晚上没事逛书店,偶然发现一本书在讲3dsmax的导出插件,提到了关于调试的一个小技巧,欣喜若狂,立马回家试验了一下,果然很爽.

其实很简单,就是再写一个dll,实际的操作都在这个dll里面,每一次导出动作都将实时的加载这个dll,导出完毕再卸载这个dll文件,这样就不用每次都重启3dsmax而可以实时的更新了.



简单的例子:

extern "C"

{

int Exporter( void );

typedef int(*CallBackExporter)( const TCHAR *name, ExpInterface *ei, Interface *i,

BOOL suppressPrompts, DWORD options );

}

//+-------------&-------------

//+---------------------------&------------------- ------

int IGameExporter::DoExport( const TCHAR *name, ExpInterface *ei, Interface *i, BOOL suppressPrompts, DWORD options )

{

HMODULE hModule;

hModule = ::LoadLibraryEx( "plugins/BMLExporter.dll", NULL, 0 );

if( hModule == NULL )

{

hModule = ::LoadLibraryEx( "BMLExporter.dll", NULL, 0 );

if( hModule == NULL )

{

MessageBox( NULL, "加载模块BMLExporter.dll失败.", "", 0 );

return 0;

}

}

CallBackExporter pfnExporter = NULL;

pfnExporter = (CallBackExporter)GetProcAddress( hModule, "Exporter" );

if( pfnExporter == NULL )

return FALSE;

int nRet = pfnExporter( name, ei, i, suppressPrompts, options );

::FreeLibrary( hModule );

return nRet;

}

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhengkangchen/archive/2011/05/16/6424806.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: