Using qt to develop maya plugin on windows
2016-07-09 03:25
381 查看
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
![](https://img-blog.csdn.net/20160709032337956)
note: the command HelloMaya is the class name not the plugin's name.
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.
相关文章推荐
- 1.1 Qt入门
- Qt中绘制五子棋棋盘
- 给Qt生成的exe执行程序添加版本信息
- qt#4信号触发的槽函数到底是哪个线程响应
- Qt irrlicht(鬼火)3D引擎 摄像机旋转问题
- QT中多线程QWaitCondition例子解析
- 使用qt设计师
- pyqt4学习之一:搭建环境和入门
- windeployqt xx.exe
- win7_64bits下QT使用openCV库(3)
- W3CSchool中加载QT插件问题
- QT 加载静态库和动态库的方法
- QT 子窗口获取父窗口指针的方法
- Qt5线程之间通信的小例子
- qt#3线程使用
- lib、dll文件默认打开方式改变之后进行恢复
- Qt 访问 MySQL
- 异步消息传递技术的比较:JMS、AMQP和MQTT
- QT中PRO文件写法的记录
- Qt qml中listview 列表视图控件(下拉刷新、上拉分页、滚动轴)