회원 로그인
|
Maya Python API 2.0 : 나의 첫 플러그인 Hello World!
Maya Python API 2.0 : 나의 첫 플러그인 Hello World!
Maya 2017 Update 3 |
환경 변수 설정 사용자 변수 설정에 추가 변수명 MAYA_PLUG_IN_PATH 값 %USERPROFILE%\Documents\scripts |
import sys import maya.api.OpenMaya as om """ def maya_useNewAPI(): pass """ # command class PyHelloWorldCmd(om.MPxCommand): kPluginCmdName = "pyHelloWorld" #실행 명령어 def __init__(self): om.MPxCommand.__init__(self) @staticmethod def cmdCreator(): return PyHelloWorldCmd() def doIt(self, args): print "Hello World!" # Initialize the plug-in def initializePlugin(plugin): pluginFn = om.MFnPlugin(plugin) try: pluginFn.registerCommand( PyHelloWorldCmd.kPluginCmdName, PyHelloWorldCmd.cmdCreator ) except: sys.stderr.write( "Failed to register command: %s\n" % PyHelloWorldCmd.kPluginCmdName ) raise # Uninitialize the plug-in def uninitializePlugin(plugin): pluginFn = om.MFnPlugin(plugin) try: pluginFn.deregisterCommand(PyHelloWorldCmd.kPluginCmdName) except: sys.stderr.write( "Failed to unregister command: %s\n" % PyHelloWorldCmd.kPluginCmdName ) raise
Script Editor에서 사용자\문서\Maya\버젼\plug-ins 폴더에 스크립트(myFirstPlugin.py) 저장
마야의 Windows>Settings/Preferences>Plug-in Manager에서 myFirstPlugin.py 확인 (로드는 하지 않는다.)
실행
import maya.cmds as cmds cmds.loadPlugin("myFirstPlugin.py") #플러그인 로드 cmds.pyHelloWorld() #실행
출력
Hello World!
참고 도움말> https://goo.gl/04AIAY
- myFirstPlugin.py (1.1KB) (0)
댓글 0개
| 엮인글 0개
35개(2/2페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 45224 | 2020.04.06 17:22 | |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 65956 | 2014.01.08 17:59 | |
13 | [Plugin] AnimShader library | 푸딩뱃살 | 3764 | 2018.01.23 11:25 |
12 | [Plugin] Mesh Reorder / Transfer vertex position Tool - Mesh Pick | 푸딩뱃살 | 3578 | 2018.01.17 16:35 |
11 | [FX] PhysX Clothing 간략 프로세스 (with Maya) | 푸딩뱃살 | 2591 | 2017.11.10 14:35 |
10 | [Modeling] Text 사용 | 푸딩뱃살 | 3322 | 2017.10.25 10:39 |
9 | [Plugin] SHAPES | 푸딩뱃살 | 3366 | 2017.09.04 16:03 |
>> | [Dev] Maya Python API 2.0 : 나의 첫 플러그인 Hello World! | 푸딩뱃살 | 4117 | 2017.05.19 18:48 |
7 | [Dev] Maya devkit 설정 | 푸딩뱃살 | 3424 | 2017.05.18 14:23 |
6 | [Dev] Maya 2013 64bit *.mll을 만들기 위한 Visual Studio Express 2013 | 푸딩뱃살 | 7027 | 2015.08.07 20:42 |
5 | [Plugin] OutlinerPlus v1.3 | 푸딩뱃살 | 4744 | 2015.03.04 02:25 |
4 | [Plugin] Advanced Skeleton | 푸딩뱃살 | 6895 | 2013.04.14 13:15 |
3 | [Plugin] Studio Library for Maya | 푸딩뱃살 | 6590 | 2013.04.10 02:31 |
2 | [Dev] Visual Studio 2012 Express에서 Maya Plugin 개발 | artsOne | 6811 | 2013.01.08 13:38 |
1 | [Plugin] Mel Studio Pro v1.1.0 for Maya 6.5, 7 | artsOne | 4446 | 2008.03.10 18:35 |