How to create a Quick surface material through Python

   350   4   2
User Avatar
Member
174 posts
Joined: June 2016
Offline
Hi Everyone,

Im trying to write a python script to create a `Quick surface material` which is modified `Edit Material Properties` LOP

Is there any helpers to do it?

https://www.sidefx.com/docs/houdini/solaris/quick_materials.html#quick_surface_material [www.sidefx.com]

Thanks!
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
174 posts
Joined: June 2016
Offline
For now i used the legacy presets to my advantage

- drop a `Quick surface material`
- store it as a legacy preset using gear menu.
- in python create edit material properties lop
- set the preset through hscript `oppresetload` within python using hou.hscript()

mat = hou.node("/stage").createNode("editmaterialproperties", "my_mat")
matpath = mat.path()
hou.hscript(f"oppresetload {matpath} quick_surface_mat")
`quick_surface_mat` is my preset name here.

This works for now, still eager to know if there is simpler or efficient approach.

Thanks
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
174 posts
Joined: June 2016
Offline
Funny update:
I asked ChatGPT how to create a Quick Surface Material with Python.
It did deep research for 10 mins and confidently explained a “clever” method involving legacy presets and oppresetload,
Which was written by me in this exact forum thread, and it sourced the details from here.

And how did I know for sure?
Because the AI even used the same variable name I used in my workaround.
At that point I realized I wasn’t getting help from ChatGPT —
I was getting help from past me, repackaged as AI wisdom.
It even accepted that it this was the source for its answer.
AI is wild. 😂
Edited by Mohanpugaz - Nov. 20, 2025 10:40:22
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
128 posts
Joined: Dec. 2019
Offline
Usually this kind of modified nodes are created using scripted Shelf Tools.

You can find these scripts inside .shelf files under $HFS/houdini/toolbarfolder.

In the particular case of Quick Surface Material, the tool is written inside ExtraLopTools.shelffile and has the following script :

import loptoolutils
node = loptoolutils.genericTool(kwargs, 'editmaterialproperties', nodename='quicksurfacematerial1')
loptoolutils.createQuickSurfaceMaterial(quick_material_node=node)

Note that the call for loptoolutils.genericTool()will not work if kwargs argument is note defined. So you either need to define kwargs argument, or create an Edit Material Properties LOP node and provide it in argument to call loptoolutils.createQuickSurfaceMaterial().

And if you want to check on how these toolutils libs are written, you can take a look at Python files under $HFS/houdini/pythonX.Ylibsfolder.
Houdini Pipeline Supervisor @ TAT Studio
User Avatar
Member
174 posts
Joined: June 2016
Offline
Wow Great to know this. such a valuable information. Thanks a lot.
Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
  • Quick Links