cpp maya plugin example


dashuai009/cpp-maya-pluginsThis is an example collection of cpp maya plugins, sourced fromautodeskwebsite.Setting-up-your-buildhow can I get these code?I use a Python crawler, in 1cpp_maya_plugins to get these code.DevelopFirst,1cmake_minimum_required(VERSION 3.26)2project(maya_plugins)34set(CMAKE_CXX_STANDARD 17)56# set maya include path7set(MAYA_PATH "C:/Program Files/Autodesk/Maya2022")8include_directories(${MAYA_PATH}/include)9link_directories(${MAYA_PATH}/lib)10set(LINK_FLAGS "/export:initializePlugin /export:uninitializePlugin")11# Maya plug-ins that consist of a single file and are intended foryour own individual use or for use within your organization can bedistributed by placing the files in a shared directory pointed at bythe MAYA_PLUG_IN_PATH in users' Maya.env files.1213# You can add several directories to MAYA_PLUG_IN_PATH. Eachdirectory must be separated by a semicolon (;) on Windows or by acolon (:) on macOS and Linux.1415set(MAYA_PLUG_IN_PATH "C:/Users/User/work/maya-plugins/out")1617add_subdirectory(helloWorld)18add_subdirectory(pickCmd)19add_subdirectory(pluginCallbacks)20add_subdirectory(zoomCameraCmd)for every single plugin in subdirectry:1cmake_minimum_required(VERSION 3.26)2project(pickCmd)34message(${PROJECT_NAME})5# output a dll6add_library(${PROJECT_NAME} SHARED pickCmd.cpp)78# set the suffix of the output dynamic library to .mll,9# and directly put it into ourself plugin dirs10set_target_properties(11 ${PROJECT_NAME}12 PROPERTIES13 SUFFIX ".mll"14 RUNTIME_OUTPUT_DIRECTORY_DEBUG "${MAYA_PLUG_IN_PATH}/plug-ins") # debug1516#set_target_properties(${PROJECT_NAME} PROPERTIES RELEASE_POSTFIX".mll")1718# These two libs are only the core modules of Maya. If you need touse other modules, you need to add other libs, such as OpenMayaUI.lib.You can find all of them in `${MAYA_PATH}/lib`19target_link_libraries(${PROJECT_NAME} Foundation OpenMaya)Build