Hey,
Sorry if this has been asked but I can't find an answer -
I'm writing some Python code inside of a Python SOP and I want to get the current point/prim selection. When querying the sceneViewer to see what primitives or points are selected, the only option I see is to use the function mergedSelectionString(). I then need to convert this into a list of selected prims or points by writing the following code:
def parseSelectionString(str):
# Separate the string at each space
a = str.split(' ')
# Parse the list of strings into list of integers
b = [range(int(x.split('-')), int(x.split('-'))+1) if ‘-’ in x else for x in a]
# Flatten the list
c =
return c
Then I would need to loop through the geo's prims/points and grab the right ones based on this converted list.
This seems archaic. Is there an easier way to do this?
Parsing selection strings in Python
4153 3 0-
- KMcNamara
- Member
- 228 posts
- Joined: Dec. 2012
- Offline
-
- graham
- Member
- 1924 posts
- Joined: Nov. 2006
- Online
-
- KMcNamara
- Member
- 228 posts
- Joined: Dec. 2012
- Offline
-
- jacobhalls
- Member
- 1 posts
- Joined: Feb. 2019
- Offline
-
- Quick Links