회원 로그인
|
pymel 예제
pymel 예제
- 느리지만 한번 써보자!
# pymel # https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=__PyMel_index_html # https://archive.ph/ZnF4t for sO in pm.core.general.ls('*_kdw'): print(sO.listAttr(st=Kcore.Kmaya._templateAttributes.keys())) att = pm.core.general.PyNode('TemplateManager') # nt.Transform(u'TemplateManager') print(pm.core.general.PyNode('TemplateManager')) att.nodeType() # u'transform' att.name() # u'TemplateManager' att.nodeName() # u'TemplateManager' # attribute # https://archive.ph/tw20v att.visibility # Attribute(u'TemplateManager.visibility') att.attr('visibility') # Attribute(u'TemplateManager.visibility') att.v.type() #bool pm.core.general.Attribute('TemplateManager.visibility') # Attribute(u'TemplateManager.visibility') pm.core.general.PyNode('TemplateManager.translate') #instance = Attribute(u'TemplateManager.translate') # lock for axis in ['scaleX', 'scaleY', 'scaleZ']: att.attr(axis).lock() # attr set/lock if att.visibility.isKeyable() and not att.visibility.isLocked(): att.visibility.set(True) att.visibility.lock() # lock att.visibility.unlock() # unlock # att att.visibility.setLocked(True) # lock att.v.setLocked(True) pmg.lockNode([], lock=1) # list lock att.visibility.setKeyable(True) # keyable att.visibility.showInChannelBox(True) # hidden att.visibility.isInChannelBox() # hide/show pmg.hide(att) # visibility off pmg.showHidden(att) # visibility on pmg.showHidden(all=True) # all visibility on (with cameras) pmg.showHidden(all=False) # not working # add attr s = pm.core.modeling.polyCube()[0] # nt.Transform(u'pCube1') s.addAttr('fValue') # set attr s.fValue.setRange(-2, None) s.fValue.setMax(3) # get attr s.fValue.getRange() # [-2.0, 3.0] # add attr pm.core.general.addAttr(att, ln='testString', dt='string') # del attr pm.core.general.deleteAttr(att.testString) att.testString.delete() # add / set attr att = pm.core.general.ls('TemplateManager')[0] att.nodeType() # u'transform' att.addAttr('test', dt='string') # Warning: pymel.core.general : object TemplateManager no longer exists # # 위 경고가 나올 때는 본 상위 스크립트 att 변수로 했을 경우 나오고, # 바로 위 att 변수로 했을 경우 경고 없음 # https://archive.ph/h3LSS (해결 없음) att.test.set('test') # setAttr att.translate.set([1,1,1]) att.translate.set(pm.core.general.datatypes.Vector([1,1,1])) att.nodeId.set('aaaa') # # Error: Problem with the API object returned by __apiobject__ method # # 위 에러가 나올 때는 cmds를 사용한 것을 pymel로 변경 # https://archive.ph/X1Wrz # getAttr att.translate.get() # connect att.translateX.connect(att.translateY) att.tx >> att.ty # disconnect att.tx // att.ty # parent ###### # pymel dictionary # https://archive.ph/uRSGX AllObjects = {} # node-to-name dictionary def store(): for obj in pmg.ls(): AllObjects[obj] = obj.name() def diff(): AllObjsCopy = AllObjects.copy() for obj in pmg.ls(): try: oldName = AllObjsCopy.pop(obj) newName = obj.name() if newName != oldName: print ("renamed: %s ---> %s" % ( oldName, newName )) except KeyError: print ("new: %s" % ( obj.name() )) for obj, name in AllObjsCopy.iteritems(): print ("deleted:", name) s = pmm.sphere()[0] c = pmm.polyCube(ch=0)[0] store() # save the state of the current scene s.rename('monkey') pmg.delete(c.getShape()) pmm.polyTorus() diff() # ######
댓글 0개
| 엮인글 0개
466개(1/24페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
마야 뷰포트 네비게이션 팁 | 푸딩뱃살 | 42082 | 2020.04.06 17:22 | |
Maya 버전 별 Python 버전 | 푸딩뱃살 | 63478 | 2014.01.08 17:59 | |
464 | [Dev] Autodesk Maya Devkit 다운로드 | 푸딩뱃살 | 674 | 2023.01.28 14:28 |
463 | [Base] (해결 중) modules 환경설정 중 | 푸딩뱃살 | 606 | 2022.11.09 11:47 |
462 | [Script] pymel 딕셔너리형 사용 시 KeyError | 푸딩뱃살 | 805 | 2022.11.07 12:08 |
461 | [오류] Building Numpy for Maya Python 2.7.x | 푸딩뱃살 | 571 | 2022.10.23 14:38 |
460 | [Base] 뷰포트에서 조절자가 안 보일때 | 푸딩뱃살 | 744 | 2022.10.13 15:47 |
459 | [Rigging] mirror joints 사용 시 유의 사항 | 푸딩뱃살 | 742 | 2022.10.04 10:46 |
458 | [Script] 2022에서 enum34 모듈 설치 금지 | 푸딩뱃살 | 586 | 2022.08.17 18:08 |
>> | [Script] pymel 예제 | 푸딩뱃살 | 606 | 2022.07.05 19:20 |
456 | [Script] 인코드 / 디코드 - 2.7 한글 사용 | 푸딩뱃살 | 876 | 2022.03.08 17:52 |
455 | [Dev] ui 없이 mayapy로 자동화 | 푸딩뱃살 | 677 | 2022.02.17 13:56 |
454 | [Dev] mayapy로 ui파일 py로 | 푸딩뱃살 | 515 | 2022.02.15 18:20 |
453 | [오류] Error : MayaBonusTools | 푸딩뱃살 | 885 | 2022.01.21 17:52 |
452 | [오류] Error: ModuleNotFoundError | 푸딩뱃살 | 746 | 2022.01.21 16:24 |
451 | [Dev] mayapy | 푸딩뱃살 | 622 | 2022.01.19 20:08 |
450 | [Base] function selCom at 0x7f29c5c04aa0 | 푸딩뱃살 | 589 | 2022.01.19 17:24 |
449 | [Base] wireframe on shaded 단축키 만들기 | 푸딩뱃살 | 878 | 2022.01.04 10:55 |
448 | [오류] OpenCL Error | 푸딩뱃살 | 506 | 2021.12.28 01:40 |
447 | [Script] Easily Translate MEL Commands to Python | 푸딩뱃살 | 798 | 2021.12.02 11:22 |
446 | [Base] output window 띄우지 않기 | 푸딩뱃살 | 778 | 2021.11.24 21:44 |
445 | [Rigging] shapeEditorManager 삭제 안됨 | 푸딩뱃살 | 857 | 2021.11.12 23:30 |