Jump to content
Hiro11

How to get All the bgeo.sc used in scene

Recommended Posts

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 by Hiro11

Share this post


Link to post
Share on other sites

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.

  • Thanks 1

Share this post


Link to post
Share on other sites
files = filter(lambda p: p.endswith('.sc'), [n.evalParm('file') for n in hou.nodeType('Sop/file').instances()])

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×