Since my asset info are on a list of points, I figured I would use a Python SOP to do this, but I can't delete nodes/assets in a Python SOP. If you try and run this code:
obj = hou.node('/obj') sub = obj.createNode('subnet') sub.destroy()
You'll get this error message :
Error Python error: Traceback (most recent call last): File "", line 3, in File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.348/houdini/python2.7libs\houpythonportion\ui.py", line 927, in decorator return func(*args, **kwargs) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.348/houdini/python2.7libs\hou.py", line 10553, in destroy return _hou.Node_destroy(*args, **kwargs) OperationFailed: The attempted operation failed. Cannot delete nodes while cooking
So instead I tried to use a pre-render script in a geometry ROP. That allows me to destroy my assets, but I can't create and copy the attributes I need on my point cloud as it gives me this error message:
Error Python error: Traceback (most recent call last): File "", line 1, in File "opdef:/Sop/fetch_material_info?PythonModule", line 16, in fetchMaterials File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.348/houdini/python2.7libs\houpythonportion\Geometry.py", line 67, in addAttrib create_local_variable) File "D:/PROGRA~1/SIDEEF~1/HOUDIN~1.348/houdini/python2.7libs\hou.py", line 29644, in addAttrib return _hou.Geometry_addAttrib(*args) GeometryPermissionError: Geometry is read-only.
So how can I write a Python script that will load and delete assets as it sets new data per point attribute? What's the proper way to do something like this?