This may be a noob question, however, I am having trouble in trying to grab and check if my selection is of camera /mesh type.
For example, if user clicks onto this button, it will queries if it is a camera. If it is a camera, it will input and displays the name of the camera into a text field. If it is not a camera, it will prompts up a warning asking user to select a camera.
-
I tried using cmds.ls(type=‘camera’) but it does not seems to be helping in my cause. I will still try to find some other ways, but am I in the right direction?
-
Then I would like to ask if the following code to grab the camera name, is it the correct way to do so where currentCamTxt is the name of qLineEdit? Cause I realized if I am using just the first line of the code, it will display [u’camera1’] instead of camera1 and this is the only method i can think of, unless there are other better ways in doing it
curSel = cmds.ls(sl=True)
camPath = cmds.listRelatives(curSel, f=True)
camName = str(camPath).split('|')
self.currentCamTxt.setText(str(camName[1]))