Using qt to develop maya plugin on windows

1. download the maya develop kit 

https://apps.autodesk.com/MAYA/en/Detail/Index?id=6303159649350432165&appLang=en&os=Win64


then extract to C:\Program Files\Autodesk\Maya2016


2. set environmental variable:

MAYA_PATH = c:\Program Files\Autodesk\Maya2016

add c:\Program Files\Autodesk\Maya2016\bin; to Path


3.new a plain C++ Application project 

4.overwrite the .pro file as follows:

TEMPLATE = lib

TARGET = Hello

CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

QMAKE_EXTENSION_SHLIB = mll

QMAKE_LFLAGS	= /export:initializePlugin /export:uninitializePlugin /SUBSYSTEM:WINDOWS
_CFLAGS		= /FD /GS
QMAKE_CFLAGS	+= $${_CFLAGS}
QMAKE_CXXFLAGS	+= $${_CFLAGS}

SOURCES += \
    main.cpp

DEFINES += WIN32 \
           _WIN64 \
           _WINDOWS \
           _USRDLL \
           NT_PLUGIN \
           REQUIRE_IOSTREAM \
           _BOOL
INCLUDEPATH += $$(MAYA_PATH)/include \

QMAKE_LIBDIR += $$(MAYA_PATH)/lib

LIBS += -lFoundation -lOpenMaya -lOpenMayaUI

#OBJECTS_DIR = ""


5. create a c++ source file and write into it with following contents:

#include <maya/MSimple.h>
#include <maya/MIOStream.h>
#include <maya/MGlobal.h>


DeclareSimpleCommand( HelloMaya , "NCCA", "Maya 2016") //HelloMaya is the class name



MStatus HelloMaya::doIt( const MArgList& )
{
    std::cout<<"This should come from the shell\n"<<std::endl;
    MGlobal::displayInfo("Hello Maya in the maya command shell");
    return MS::kSuccess;
}

6. Now we can copy the Hello.mll to C:\Program Files\Autodesk\Maya2016\bin\plug-ins


7.open maya, type and execute HelloMaya in maya command shell 




note: the command HelloMaya is the class name not the plugin's name.














  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值