Maya 플러그인의 QT 디자이너에서 .UI 파일을 사용하는 경우 This Tutorial을 따라 왔습니다. 우리는 우리가 조회 할 수 있습니다 마야의 내부에 우리의 QT UI를로드 할 때 이제Maya 2018 Python + QT : 가져온 TextField의 값 쿼리
을 : 그것은 UI가 마야에로드 된 후에은 QTextEdit 필드의 값을 조회하기 위해, 나는 다음을 수행해야한다고 우리의 라인 편집의 텍스트 다음 코드 줄을 사용하여 우리가 원하는 때마다 :
pm.textField('textFieldName', query = True, text = True)
그러나 나는이 기능을 얻을 수없는 것.
# Load our window and put it into a variable.
ebWin = cmds.loadUI(uiFile = self.BE_UIpath)
아무 문제가, 내가 cmds.showWindow (ebWin)을하려고 할 때, 모든 것이 작동하고 의도 한대로 정확하게 보이는 다음 없기 때문에 나는 UI를로드하고 있습니다. 이제 'exportDirectoryTF'라는 QtextEdit을 쿼리하려고 할 때 Maya는 그것이 존재하지 않는다고 주장합니다. 내가 해봤 두 가지 접근 방법 :
접근 A :
# Connect Functions to the buttons.
exportDir = ebWin.textField('exportDirectoryTF', query = True, text = True)
출력 :
# Error: 'unicode' object has no attribute 'textField'
# # Traceback (most recent call last):
# # File "C:/Users/Censored/Documents/maya/2018/plug-ins/EB_pi_cmds.py", line 39, in doIt
# # exportDir = ebWin.textField('exportDirectoryTF', query = True, text = True)
# # AttributeError: 'unicode' object has no attribute 'textField'
및 방법 B :
import maya.cmds as cmds
# Connect Functions to the buttons.
exportDir = cmds.textField('exportDirectoryTF', query = True, text = True)
반환
# RuntimeError: Object 'exportDirectoryTF' not found.
# # Traceback (most recent call last):
# # File "C:/Users/Censored/Documents/maya/2018/plug-ins/EB_pi_cmds.py", line 39, in doIt
# # exportDir = cmds.textField('exportDirectoryTF', query = True, text = True)
# # RuntimeError: Object 'exportDirectoryTF' not found. #
이 튜토리얼은 'pm.textField ('textFieldName ', q = True, text = True)'를 가지고 있으며, "pm"이 어디서 왔는지를 알 수 없다. UI 또는 Maya Python textField 명령 또는 둘 다 사용하지 마십시오.
누구나 올바른 방향으로 나를 가리킬 수 있다면 크게 환영 할 것입니다.
ui 파일도 공유해야합니다. – user1767754