Jump to content

How to get All the bgeo.sc used in scene


Hiro11

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
Link to comment
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
Link to comment
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

Link to comment
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!!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...