회원 로그인
|
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개
466개(9/24페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 42309 | 2020.04.06 17:22 | |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 63647 | 2014.01.08 17:59 | |
304 | [Script] Expression Editor에서 원하는 구간 프레임 홀드 | cgextra | 2117 | 2017.08.24 12:10 |
303 | [오류] Expression Editor Open Error | cgextra | 2367 | 2017.08.24 12:06 |
302 | [Modeling] Maya에서 Collision과 함께 익스포트 (for UE4) | 푸딩뱃살 | 4204 | 2017.08.24 11:58 |
301 | [Base] Grid(Unit) 설정 for UE4 | 푸딩뱃살 | 3814 | 2017.08.24 10:19 |
300 | [Script] 쉐이더 검색 | 푸딩뱃살 | 3485 | 2017.08.23 11:03 |
299 | [Script] scriptNode | 푸딩뱃살 | 3822 | 2017.08.22 18:08 |
298 | [Rendering] Maya 2017 Render Setup & Legacy Render Layer | cgextra | 3434 | 2017.08.08 12:12 |
297 | [Script] Maya 2017 Switching to PySide2 | 푸딩뱃살 | 4108 | 2017.07.13 17:26 |
296 | [Plugin] convertInstanceUE4 설치 | 푸딩뱃살 | 3597 | 2017.07.12 14:14 |
295 | [Base] LOD (Level of Detail) | 푸딩뱃살 | 3228 | 2017.07.06 11:53 |
294 | [Dev] PySide2 | 푸딩뱃살 | 3316 | 2017.07.05 17:55 |
293 | [Script] [펌] Maya 2017 PySide2 Docking Qt QMainWindow | 푸딩뱃살 | 4413 | 2017.07.05 14:54 |
292 | [Script] Maya 버전 구하기 | 푸딩뱃살 | 3161 | 2017.07.05 12:56 |
291 | [Dev] Maya 2017 Qt5 Designer 실행 시 오류 | 푸딩뱃살 | 3879 | 2017.07.02 20:59 |
290 | [Rigging] 스켈레톤(본) 기반 페이셜 리깅 구조 | 푸딩뱃살 | 2864 | 2017.06.29 12:55 |
289 | [Animation] Controller Nodes | 푸딩뱃살 | 3164 | 2017.06.09 11:12 |
288 | [Dev] sip / PyQt5 빌드 for Maya 2017 | 푸딩뱃살 | 5254 | 2017.05.31 12:46 |
>> | [Dev] Maya Python API 2.0 : 나의 첫 플러그인 Hello World! | 푸딩뱃살 | 4031 | 2017.05.19 18:48 |
286 | [Dev] Maya 2017은 Python 버젼 2.7.11 (64bit) | 푸딩뱃살 | 3459 | 2017.05.18 16:29 |
285 | [Dev] Maya devkit 설정 | 푸딩뱃살 | 3338 | 2017.05.18 14:23 |