If you need to convert a file from Houdini Indie to Commercial, you can use python to convert the entire Houdini File into a python script and then run it inside a new file.
Inside the file you want to convert, open up the python shell window (Windows>Python Shell)
The File I want to copy, I have two objects so I'll do them one at a time |
You're going to want to make a variable that contains a reference to your Houdini Object, so in the node view, left click on your Houdini Object and drag it into the Python Shell. The variable can be named anything just make sure you remember it.
Hit enter to go to the next line. Now we want a pointer to where we want to save the file. So type:
outfile = open(r"YourFilePathHere\NameForFile.py", "w")
The r is to make sure the file path is in raw in case you have any spaces in it. We also need the "w" to tell python that it is in write mode.In my Temp Folder |
We've created a py file, but nothing is inside it. Now we're going to write to the file.
outfile.write(foo2.asCode(recurse=True))
See how it now has data inside the Python File |
If you look into the file, you'll see code has now been generated.
To Run this code now, open a new Houdini File. You'll be making a Shelf button to run this. Right click on your shelf (make a new one if you need to for organization), and click "New Tool"
Name and Label it as you like. Then go to the script tab. You'll want to open up the py file you just made, Ctrl+A to select everything and copy and paste it into the script tab.
No comments:
Post a Comment