adrienlambert
2021年1月29日 21:22:28
Hi everyone,
Having a hard time to make python work with lop, looking especially to get a list of the camera present in scene graph tree. LopSelectionRule sounds like a good candidate for that, tried to understand better with
these example[/url, especially the one that look for lights but would get errors like
AttributeError: 'LopNetwork' object has no attribute 'editableStage'
Not sure why though, would appreciate any insights 
[
www.sidefx.com]
robp_sidefx
2021年2月1日 10:31:04
Hi Adrien,
Can you elaborate a bit more on the context in which you're running Python? Is it in a Python LOP? A Python pane?
If you're in a Python LOP, then `stage = node.editableStage()` should work. If you're in some other context (e.g., a Python pane), then:
1 - make sure you're trying to query the stage from a node (`/stage/some_node`) not the LOP network (`/stage`)
2 - consider `node.stage()` instead of `node.editableStage()` for querying
- Rob
simon_o
2021年2月1日 10:35:35
editableStage only works within a python lop. when testing in the python shell use node.stage()
this should work:
stage=mynode.stage()
for p in stage.TraverseAll():
if p.GetTypeName() == "Camera":
print p
adrienlambert
2021年2月1日 12:18:09
Oh I see my mistake was trying to run in external editor. That makes more sense now ! Thank you guys you are legends