Send To Blender || Houdini and Python Tutorial
Вставка
- Опубліковано 6 лип 2024
- In this tutorial, you will learn how to use Python scripting in Houdini to launch Blender and open a geometry file. By using the subprocess module in Python, we can execute external commands and interact with other software from within Houdini. This technique can be useful for integrating different software tools in a pipeline, or for automating repetitive tasks.
In this tutorial, we will cover the following steps:
Setting up a Houdini scene with a geometry file that we want to open in Blender.
Writing a Python script that uses the subprocess module to launch Blender and open the geometry file.
Adding the Python script to a Houdini shelf tool for easy access.
Testing the script by launching Blender and verifying that the geometry file is loaded.
By the end of this tutorial, you will have a basic understanding of how to use Python in Houdini to interact with external software and automate tasks. You will also have a useful tool for editing geometry files in Blender and integrating it into your Houdini workflow.
Note: This tutorial assumes a basic knowledge of Houdini and Python scripting. It also assumes that Blender is installed on your computer and accessible from the command line.
Project files (with more features) siver.gumroad.com/l/pihcq
Timestamps
00:00 Intro
00:15 Overview
00:38 Scene setup
01:37 Make Shelf tool
02:36 USD exporter
04:04 Export using Python
06:50 Launching Blender
09:25 Blender Python Import USD
11:42 Make a Blender py script
12:25 Launch Blender with script
13:35 Remove Objects in Blender scene
15:54 Trying out the tool
thank you for this video. I wanted to add a bit so you dont have to go to the stage and add those nodes just work straight from /obj context.
So this adds the two nodes in the stage context and connects them add the parameters press the button and destroys the nodes.
stage = hou.node("/stage")
importnode = stage.createNode("sceneimport::2.0", "sceneimportall")
importnode.parm("objects").set("*")
importnode.parm("materials").set("*")
usdrop = stage.createNode("usd_rop", "usd_rop")
stage.layoutChildren()
usdrop.setInput(0,importnode)
usdrop.parm("lopoutput").set("D:/Tools/Temp_Scene.usd")
usdrop.parm("execute").pressButton()
usdrop.destroy()
importnode.destroy()
you can add this between the import subprocess and the blenderpath.
only change the output usdropparm to your destination
Really cool, thanks for your work!
Very creative !!💥⚡
great video!
awesome, something like this should be pushed to the limits to create the best possible workflow between Houdini and Blender
Awesome thank you very much.
It would be great if after editing the mesh in blender another python script exports everything back to Houdini and updates the sop node tree.
Sort of part two of this tutorial :)
There maybe a part 2 if there is enough interest of people
Thanks a lot Simon,
What are the limitations?
For example, can we export heavy rbd simulations with smoke or pyro?
Thanks again
In this case it is all based on USD file, a heavy/larger file will take longer to load in Blender. When it comes to sending simulation you might want to use other file types like vdb.
does this work for the latest houdini
Hi Simon, hoping you see this comment, can you possibly make a video or guide covering file structure, organization and asset management? It's a reoccurring problem for me and I have troubles wrapping my head around it all.
Hey, sounds like a good idea. I will try to find some time for the next video. SideFX provides some basic docs but a video will be better.
Is there a way to import particles sims with attributes into blender from houdini?
Thanks for the tutorial, Simon! -- I wish you'd have shown the other way around though!
-- i.e. How do I create / edit / sculpt this file in Blender and then import that into Houdini as USD (i.e. to generate UVs, etc., since that'd be my preferred workflow).
If there is enough interest there could be a part 2 with the other way around. It would be somewhat similar in code.
@@simonhoudini5074 yes there is interest, lots of it) thanks for the tut by the way!
@@simonhoudini5074 I definitely would enjoy the reverse workflow. Blender is getting a little more Houdini-like these days, and some things are just straight-up easier / more fun to do in Blender than in Houdini, so that's why I think this is worth the effort.
Thank you for considering this! -- I would love to see a building editor that uses Houdini for the tedious stuff, and Blender for the "blocking-out" of the building since it is a lot nicer and more fun to use for that sort of thing!
Yeah
Hello there! If I buy a tool from your gumroud, shoug I follow this tutorial or there is a ready tool?
The Gumroad version provides the tool files. It also has a few more features and videos explaining that
Now that Blender has .USD support, that might be a better way of going about it.
Hi! I found a few problematic things with the gumroad plugin.
When you export one object from blender, all are sent. It would be much more convenient to send only selected objects.
Also the camera and lights from the blender is not exporting to Houdini.
Export selected can be done by tweaking the export function like this: bpy.ops.export_scene.fbx(filepath=obj_path, use_selection=True)
This (use_selection=True) enables export selected only. The Camera and lights are a bit more tricky, the Houdini sop imported is limited to geometry only. So would be more of obj level, I need to look at the API to see what is possible. I can later look into adding some updates. Hope this helped
Did add an update v2.1, this will be exporting selected and better support for light and camera in Houdini
Insta dislike, since blender is mentioned.
Because?
Cry me a river kid