Hiro11 Posted December 14, 2019 Share Posted December 14, 2019 (edited) I want to print all the bgeo.sc used in the scene.Using Python. hou.fileReferences() doesn`t give me any bgeo.sc used in the scene. I am looking for a way. Can someone guide me?? Thanks Hiro Edited December 14, 2019 by Hiro11 Quote Link to comment Share on other sites More sharing options...
Atom Posted December 14, 2019 Share Posted December 14, 2019 I think you would have to recursively scan all nodes in the system for node types that are known to reference files. Look for the File node, and the FileCache node. Once you have those nodes, you can review their .parm value to extract the filename they reference. 1 Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted December 16, 2019 Share Posted December 16, 2019 files = filter(lambda p: p.endswith('.sc'), [n.evalParm('file') for n in hou.nodeType('Sop/file').instances()]) 3 1 Quote Link to comment Share on other sites More sharing options...
Hiro11 Posted December 19, 2019 Author Share Posted December 19, 2019 AtomicPerception Alex Rusev Thanks for the reply.Sorry I was late to see this. This Worked perfectly!! files = filter(lambda p: p.endswith('.sc'), [n.evalParm('file') for n in hou.nodeType('Sop/file').instances()]) Thanks Hiro Quote Link to comment Share on other sites More sharing options...
Hiro11 Posted December 19, 2019 Author Share Posted December 19, 2019 import os import hou files = filter(lambda p: p.endswith('.sc'), [n.evalParm('file') for n in hou.nodeType('Sop/file').instances()] ) text = '\n'.join(files) hipdir = os.environ["HIP"] hipname = hou.hipFile.basename() name,ext = os.path.splitext(hipname) file_path = os.path.join(hipdir,(name+'.txt')) with open(file_path, 'w') as f: f.write(text) It turn out like this.I am a beginner at python stuff,it might be not good.But,it works for now. Thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.