Search the Community
Showing results for tags 'node selection'.
-
Hello, I am creating a shelftool using python script. Part of this script determines if there is any camera in the scene. If there is no camera then it creates one. If there are multiple cameras; it asks, if user still wants to create a camera or want to select from the existing cameras. The problem I am facing is when user decides to select the camera from existing cameras. When user decides to select the camera from existing cameras, first i want to display a message "Select the camera and press ok" then user should select camera from the network editor and press ok. I am not able to select camera from the network editor as network editor is not the current pane (The pane showing the message "Select the camera and press ok" is the current pane ) This script works well if i select the camera first and then run this script but not when first I run the script and ask user to select camera and press ok. It seems that this is an active window issue . If i manage to set network editor as active window even when displaying the message window this script will work. Please help me, let me know if there is any better way of doing this. I am learning python. Create couple of camera objects and run this python script. This is a part of the script , it assumes that there are multiple cameras in the scene and asks user to select the camera. Thanks a lot inputcam = hou.ui.displayMessage("There is already a camera in the Scene. Do you want to create a New camera or select from the existing cameras ?", buttons =("New","Select","Cancel")) if inputcam ==0: hou.node("/obj").createNode("cam","MyCAMERA") if inputcam ==1: choice = hou.ui.displayMessage("Select camera and press Enter") #print choice if choice == 0: selectedcam = len(hou.selectedNodes()) if selectedcam >1: hou.ui.displayMessage("You have selected more than one object, please select object of 'cam' type ") if selectedcam == 0: hou.ui.displayMessage("You have not selected any camera") if selectedcam == 1: camselected = hou.selectedNodes() hou.ui.displayMessage((camselected[0].name()))
- 9 replies
-
- python
- active window
-
(and 2 more)
Tagged with: