mayaplugin 第一个文件helloworld的两种方式
2010-06-17 17:56
120 查看
1、用Wizard新建一个工程,然后在加入
#include <maya/MGlobal.h>
把
setResult("helloWorld command executed!/n");
改为
MGlobal::displayInfo("Hello World/n");
2、新建一个空文档,添加*.c++文档,输入
#include <maya/MPxCommand.h>
#include <maya/MGlobal.h>
#include <maya/MFnPlugin.h>
class HelloWorld2Cmd: public MPxCommand
{
public:
virtual MStatus doIt (const MArgList&)
{MGlobal::displayInfo("Hello World/n"); return MS::kSuccess;}
static void *creator() { return new HelloWorld2Cmd;}
};
MStatus initializePlugin(MObject obj)
{
MFnPlugin pluginFn(obj,"lijy","1.0");
MStatus stat;
stat = pluginFn.registerCommand("helloWorld2",HelloWorld2Cmd::creator);
if(!stat)
stat.perror("registerCommand failed");
return stat;
}
MStatus uninitializePlugin(MObject obj)
{
MStatus stat;
MFnPlugin pluginFn(obj);
stat = pluginFn.deregisterCommand("helloWorld2");
if(!stat)
stat.perror("deregisterCommand failed");
return stat;
}
下面就是最重要的,设置编译参数:
1)
Linker->General
-> OutputFile
设置为你的输出文件名 设置为 debug/myCmd.mll
2) linker->Command Line
add /subsystem:windows /dll
/incremental:yes /debug /machine:I386 /export:initializePlugin
/export:uninitializePlugin
3)
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
{font-family:"/@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri","sans-serif";
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;
#include <maya/MGlobal.h>
把
setResult("helloWorld command executed!/n");
改为
MGlobal::displayInfo("Hello World/n");
2、新建一个空文档,添加*.c++文档,输入
#include <maya/MPxCommand.h>
#include <maya/MGlobal.h>
#include <maya/MFnPlugin.h>
class HelloWorld2Cmd: public MPxCommand
{
public:
virtual MStatus doIt (const MArgList&)
{MGlobal::displayInfo("Hello World/n"); return MS::kSuccess;}
static void *creator() { return new HelloWorld2Cmd;}
};
MStatus initializePlugin(MObject obj)
{
MFnPlugin pluginFn(obj,"lijy","1.0");
MStatus stat;
stat = pluginFn.registerCommand("helloWorld2",HelloWorld2Cmd::creator);
if(!stat)
stat.perror("registerCommand failed");
return stat;
}
MStatus uninitializePlugin(MObject obj)
{
MStatus stat;
MFnPlugin pluginFn(obj);
stat = pluginFn.deregisterCommand("helloWorld2");
if(!stat)
stat.perror("deregisterCommand failed");
return stat;
}
下面就是最重要的,设置编译参数:
1)
Linker->General
-> OutputFile
设置为你的输出文件名 设置为 debug/myCmd.mll
2) linker->Command Line
add /subsystem:windows /dll
/incremental:yes /debug /machine:I386 /export:initializePlugin
/export:uninitializePlugin
3)
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
{font-family:"/@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 680460288 22 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri","sans-serif";
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
WIN32;_DEBUG;_WINDOWS;_AFXDLL;_MBCS;NT_PLUGIN;REQUIRE_IOSTREAM;
相关文章推荐
- C++ 处理文件结束符的两种不同方式
- 常用的两种ajax上传文件的方式
- 《连载 | 物联网框架ServerSuperIO教程》- 10.持续传输大块数据流的两种方式(如:文件)
- Android加载布局文件的两种方式及区别
- Eclipse导出jar文件的两种方式(转)
- angualr2 下载文件的两种方式
- eclipse中添加约束文件的两种方式(以dubbo.xsd文件为例)
- DLL中导出函数的两种方式(dllexport与.def文件)
- JSP引入文件的两种方式:<jsp:include page=”file.jsp” />和<%@ include file=”file.jsp”%>
- Java中读取properties文件的两种方式
- hibernate中另外两种配置文件方式的配置
- [oracle]初始化参数文件spfile、pfile及修改参数的两种方式
- 前端实现文件下载的两种方式
- 两种方式文件下载
- IOS文件操作的两种方式:NSFileManager操作和流操作
- (转)DLL中导出函数的两种方式(dllexport与.def文件)
- node中上传文件【base64文件流+插件调用】两种方式
- 一步一个脚印学习WCF系列之WCF概要—WCF服务的创建与调用HelloWorld实例,通过配置文件方式(六)
- Android 扫描音乐文件、两种方式获取文件最新修改时间
- java 实现文件复制的两种方式