How could I get items in Operator List, using Python ...?
2926
3
0
Masoud
Member
411 posts
Joined: Aug. 2015
Offline
May 1, 2018 1:44 a.m.
Hi; I create a button in my digital asset that runs a function called “myBtnPressed()”. I also add a “Operator List” to select some geometries from my scene. Now I would like to retrieve items in my “Operator List”, using Python script, but I don't know what how… Thanks for helping
Edited by Masoud - May 1, 2018 02:03:19
Attachments:
1.JPG (465.2 KB)
Masoud Saadatmand (MSDVFX)
Masoud
Member
411 posts
Joined: Aug. 2015
Offline
May 1, 2018 2:06 a.m.
I wrote these codes :
print hou . evalParm ( "refObjSelection" )
Now it show my selected object like this :
/obj/grid_object2 /obj/grid_object1
But I want separate each item by index, something like :
print hou . evalParm ( "refObjSelection" )[ 0 ]
Edited by Masoud - May 1, 2018 02:07:19
Masoud Saadatmand (MSDVFX)
huey_yeng
Member
69 posts
Joined: Nov. 2016
Offline
May 1, 2018 2:55 a.m.
I'm unsure if you want to further manipulate the refObjSelection list or print the list on every separate line.
Not sure if this is what you're looking for but you can get an idea from the sample above.
Attachments:
python_print.PNG (101.6 KB)
Masoud
Member
411 posts
Joined: Aug. 2015
Offline
May 1, 2018 3:20 a.m.
Hi “huey-yeng”
I found these codes to solve the problem :
print hou . evalParm ( "refObjSelection" ) . split ()[ 0 ]
Edited by Masoud - May 1, 2018 03:21:30
Masoud Saadatmand (MSDVFX)