Jump to content

Automate File Naming Convention?


Recommended Posts

Hi,

Is there away to automate my Output File parameter in ROP FBX Output node based on the Geometry File parameter in File node?

For example,
Input: Geometry File: D:/chair_big.fbx
Output: Output File: D:/chair_big_fixed.fbx

I have a lot of these fbx files that needs fixing and it would be nice if I can just swap them out and click save disk rather than changing the output file everytime.

 I can use the copy/paste relative reference but there is the "_fixed" suffix that I don't know how to insert lol

Link to comment
Share on other sites

Throw this in your Python Source Editor and run it:

import hou
import os

fbx_rops = [f for f in hou.root().allSubChildren() if f.type().name() == "rop_fbx"]
if fbx_rops:
    for rop in fbx_rops:
        outparm = rop.parm("sopoutput")
        if "_fixed" not in outparm.eval():
            basepath = os.path.splitext(outparm.unexpandedString())[0]
            newpath = basepath + "_fixed.fbx"
            outparm.set(newpath)

 

  • Like 1
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...