Search the Community
Showing results for tags '17.5 python destroy deleteitems scripting object network'.
-
Hi gents, I have been having trouble figuring this out; so I have 2 ways of deleting children of a subnet/object network with python and they both work in H17.0.352 but I am getting the following errors in H17.5.285: For 'destroy' within a loop: Error Python error: Traceback (most recent call last): File "", line 17, in File "", line 14, in destroy_geo File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\houpythonportion\ui.py", line 850, in decorator return func(*args, **kwargs) File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\hou.py", line 9715, in destroy return _hou.Node_destroy(*args) OperationFailed: The attempted operation failed. Cannot delete nodes while cooking For 'deleteItems': Python error: Traceback (most recent call last): File "", line 13, in File "", line 8, in clean_stale_geometry File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.285/houdini/python2.7libs\hou.py", line 9125, in deleteItems return _hou.Node_deleteItems(*args) OperationFailed: The attempted operation failed. Cannot delete nodes while cooking Here is the script and the hip folder: #Destroy node = hou.pwd() geo = hou.node('/obj/' + str(node.parent())) objimport = hou.node('/obj/' + str(node.parent()) + '/IMPORT_GLTF') def list_geometry_imports( subnet ): list = [] for n in subnet.allSubChildren(): list.append(n) return list def destroy_geo(list): for n in list: n.destroy() destroy_geo(list_geometry_imports(objimport)) #DeleteItems node = hou.pwd() geo = hou.node('/obj/' + str(node.parent())) objimport = hou.node('/obj/' + str(node.parent()) + '/IMPORT_GLTF') def clean_stale_geometry( subnet ): #print '\t' + str(subnet.children()) subnet.deleteItems( subnet.children() ) clean_stale_geometry(objimport) I need a fresh pair of eyes; please let me know if you have any ideas about why this is not working in 17.5. I didn't had much luck with the interweb... Thank you, Berk. python_deleteItems_test.hip